Lines Matching refs:amixer
33 return rsc->idx = container_of(rsc, struct amixer, rsc)->idx[0];
39 return container_of(rsc, struct amixer, rsc)->idx[rsc->conj];
44 return container_of(rsc, struct amixer, rsc)->idx[rsc->conj];
59 static int amixer_set_input(struct amixer *amixer, struct rsc *rsc)
63 hw = amixer->rsc.hw;
64 hw->amixer_set_mode(amixer->rsc.ctrl_blk, AMIXER_Y_IMMEDIATE);
65 amixer->input = rsc;
67 hw->amixer_set_x(amixer->rsc.ctrl_blk, BLANK_SLOT);
69 hw->amixer_set_x(amixer->rsc.ctrl_blk,
76 static int amixer_set_y(struct amixer *amixer, unsigned int y)
80 hw = amixer->rsc.hw;
81 hw->amixer_set_y(amixer->rsc.ctrl_blk, y);
86 static int amixer_set_invalid_squash(struct amixer *amixer, unsigned int iv)
90 hw = amixer->rsc.hw;
91 hw->amixer_set_iv(amixer->rsc.ctrl_blk, iv);
96 static int amixer_set_sum(struct amixer *amixer, struct sum *sum)
100 hw = amixer->rsc.hw;
101 amixer->sum = sum;
103 hw->amixer_set_se(amixer->rsc.ctrl_blk, 0);
105 hw->amixer_set_se(amixer->rsc.ctrl_blk, 1);
106 hw->amixer_set_sadr(amixer->rsc.ctrl_blk,
113 static int amixer_commit_write(struct amixer *amixer)
121 hw = amixer->rsc.hw;
122 input = amixer->input;
123 sum = amixer->sum;
126 amixer->rsc.ops->master(&amixer->rsc);
133 for (i = 0; i < amixer->rsc.msr; i++) {
134 hw->amixer_set_dirty_all(amixer->rsc.ctrl_blk);
136 hw->amixer_set_x(amixer->rsc.ctrl_blk,
141 hw->amixer_set_sadr(amixer->rsc.ctrl_blk,
145 index = amixer->rsc.ops->output_slot(&amixer->rsc);
146 hw->amixer_commit_write(hw, index, amixer->rsc.ctrl_blk);
147 amixer->rsc.ops->next_conj(&amixer->rsc);
149 amixer->rsc.ops->master(&amixer->rsc);
159 static int amixer_commit_raw_write(struct amixer *amixer)
164 hw = amixer->rsc.hw;
165 index = amixer->rsc.ops->output_slot(&amixer->rsc);
166 hw->amixer_commit_write(hw, index, amixer->rsc.ctrl_blk);
171 static int amixer_get_y(struct amixer *amixer)
175 hw = amixer->rsc.hw;
176 return hw->amixer_get_y(amixer->rsc.ctrl_blk);
179 static int amixer_setup(struct amixer *amixer, struct rsc *input,
182 amixer_set_input(amixer, input);
183 amixer_set_y(amixer, scale);
184 amixer_set_sum(amixer, sum);
185 amixer_commit_write(amixer);
200 static int amixer_rsc_init(struct amixer *amixer,
206 err = rsc_init(&amixer->rsc, amixer->idx[0],
211 /* Set amixer specific operations */
212 amixer->rsc.ops = &amixer_basic_rsc_ops;
213 amixer->ops = &amixer_ops;
214 amixer->input = NULL;
215 amixer->sum = NULL;
217 amixer_setup(amixer, NULL, 0, NULL);
222 static int amixer_rsc_uninit(struct amixer *amixer)
224 amixer_setup(amixer, NULL, 0, NULL);
225 rsc_uninit(&amixer->rsc);
226 amixer->ops = NULL;
227 amixer->input = NULL;
228 amixer->sum = NULL;
234 struct amixer **ramixer)
238 struct amixer *amixer;
243 /* Allocate mem for amixer resource */
244 amixer = kzalloc(sizeof(*amixer), GFP_KERNEL);
245 if (!amixer)
249 * amixer resources to meet request. */
257 amixer->idx[i] = idx;
265 err = amixer_rsc_init(amixer, desc, mgr);
269 *ramixer = amixer;
276 mgr_put_resource(&mgr->mgr, 1, amixer->idx[i]);
279 kfree(amixer);
283 static int put_amixer_rsc(struct amixer_mgr *mgr, struct amixer *amixer)
289 for (i = 0; i < amixer->rsc.msr; i++)
290 mgr_put_resource(&mgr->mgr, 1, amixer->idx[i]);
293 amixer_rsc_uninit(amixer);
294 kfree(amixer);