Lines Matching defs:amixer
29 rsc->idx = container_of(rsc, struct amixer, rsc)->idx[0];
39 return container_of(rsc, struct amixer, rsc)->idx[rsc->conj];
54 static int amixer_set_input(struct amixer *amixer, struct rsc *rsc)
58 hw = amixer->rsc.hw;
59 hw->amixer_set_mode(amixer->rsc.ctrl_blk, AMIXER_Y_IMMEDIATE);
60 amixer->input = rsc;
62 hw->amixer_set_x(amixer->rsc.ctrl_blk, BLANK_SLOT);
64 hw->amixer_set_x(amixer->rsc.ctrl_blk,
71 static int amixer_set_y(struct amixer *amixer, unsigned int y)
75 hw = amixer->rsc.hw;
76 hw->amixer_set_y(amixer->rsc.ctrl_blk, y);
81 static int amixer_set_invalid_squash(struct amixer *amixer, unsigned int iv)
85 hw = amixer->rsc.hw;
86 hw->amixer_set_iv(amixer->rsc.ctrl_blk, iv);
91 static int amixer_set_sum(struct amixer *amixer, struct sum *sum)
95 hw = amixer->rsc.hw;
96 amixer->sum = sum;
98 hw->amixer_set_se(amixer->rsc.ctrl_blk, 0);
100 hw->amixer_set_se(amixer->rsc.ctrl_blk, 1);
101 hw->amixer_set_sadr(amixer->rsc.ctrl_blk,
108 static int amixer_commit_write(struct amixer *amixer)
116 hw = amixer->rsc.hw;
117 input = amixer->input;
118 sum = amixer->sum;
121 amixer->rsc.ops->master(&amixer->rsc);
128 for (i = 0; i < amixer->rsc.msr; i++) {
129 hw->amixer_set_dirty_all(amixer->rsc.ctrl_blk);
131 hw->amixer_set_x(amixer->rsc.ctrl_blk,
136 hw->amixer_set_sadr(amixer->rsc.ctrl_blk,
140 index = amixer->rsc.ops->output_slot(&amixer->rsc);
141 hw->amixer_commit_write(hw, index, amixer->rsc.ctrl_blk);
142 amixer->rsc.ops->next_conj(&amixer->rsc);
144 amixer->rsc.ops->master(&amixer->rsc);
154 static int amixer_commit_raw_write(struct amixer *amixer)
159 hw = amixer->rsc.hw;
160 index = amixer->rsc.ops->output_slot(&amixer->rsc);
161 hw->amixer_commit_write(hw, index, amixer->rsc.ctrl_blk);
166 static int amixer_get_y(struct amixer *amixer)
170 hw = amixer->rsc.hw;
171 return hw->amixer_get_y(amixer->rsc.ctrl_blk);
174 static int amixer_setup(struct amixer *amixer, struct rsc *input,
177 amixer_set_input(amixer, input);
178 amixer_set_y(amixer, scale);
179 amixer_set_sum(amixer, sum);
180 amixer_commit_write(amixer);
195 static int amixer_rsc_init(struct amixer *amixer,
201 err = rsc_init(&amixer->rsc, amixer->idx[0],
206 /* Set amixer specific operations */
207 amixer->rsc.ops = &amixer_basic_rsc_ops;
208 amixer->ops = &amixer_ops;
209 amixer->input = NULL;
210 amixer->sum = NULL;
212 amixer_setup(amixer, NULL, 0, NULL);
217 static int amixer_rsc_uninit(struct amixer *amixer)
219 amixer_setup(amixer, NULL, 0, NULL);
220 rsc_uninit(&amixer->rsc);
221 amixer->ops = NULL;
222 amixer->input = NULL;
223 amixer->sum = NULL;
229 struct amixer **ramixer)
233 struct amixer *amixer;
238 /* Allocate mem for amixer resource */
239 amixer = kzalloc(sizeof(*amixer), GFP_KERNEL);
240 if (!amixer)
244 * amixer resources to meet request. */
252 amixer->idx[i] = idx;
261 err = amixer_rsc_init(amixer, desc, mgr);
265 *ramixer = amixer;
272 mgr_put_resource(&mgr->mgr, 1, amixer->idx[i]);
275 kfree(amixer);
279 static int put_amixer_rsc(struct amixer_mgr *mgr, struct amixer *amixer)
285 for (i = 0; i < amixer->rsc.msr; i++)
286 mgr_put_resource(&mgr->mgr, 1, amixer->idx[i]);
289 amixer_rsc_uninit(amixer);
290 kfree(amixer);