Lines Matching refs:scontrol
15 static int sof_ipc3_set_get_kcontrol_data(struct snd_sof_control *scontrol, bool set) in sof_ipc3_set_get_kcontrol_data() argument
17 struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scontrol->scomp); in sof_ipc3_set_get_kcontrol_data()
18 struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data; in sof_ipc3_set_get_kcontrol_data()
26 if (swidget->comp_id == scontrol->comp_id) { in sof_ipc3_set_get_kcontrol_data()
34 scontrol->comp_id); in sof_ipc3_set_get_kcontrol_data()
62 cdata->comp_id = scontrol->comp_id; in sof_ipc3_set_get_kcontrol_data()
69 cdata->num_elems = scontrol->num_channels; in sof_ipc3_set_get_kcontrol_data()
71 msg_bytes = scontrol->num_channels * in sof_ipc3_set_get_kcontrol_data()
93 static void snd_sof_refresh_control(struct snd_sof_control *scontrol) in snd_sof_refresh_control() argument
95 struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data; in snd_sof_refresh_control()
96 struct snd_soc_component *scomp = scontrol->scomp; in snd_sof_refresh_control()
99 if (!scontrol->comp_data_dirty) in snd_sof_refresh_control()
110 scontrol->comp_data_dirty = false; in snd_sof_refresh_control()
111 ret = sof_ipc3_set_get_kcontrol_data(scontrol, false); in snd_sof_refresh_control()
116 scontrol->comp_data_dirty = true; in snd_sof_refresh_control()
120 static int sof_ipc3_volume_get(struct snd_sof_control *scontrol, in sof_ipc3_volume_get() argument
123 struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data; in sof_ipc3_volume_get()
124 unsigned int channels = scontrol->num_channels; in sof_ipc3_volume_get()
127 snd_sof_refresh_control(scontrol); in sof_ipc3_volume_get()
132 scontrol->volume_table, in sof_ipc3_volume_get()
133 scontrol->max + 1); in sof_ipc3_volume_get()
138 static bool sof_ipc3_volume_put(struct snd_sof_control *scontrol, in sof_ipc3_volume_put() argument
141 struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data; in sof_ipc3_volume_put()
142 struct snd_soc_component *scomp = scontrol->scomp; in sof_ipc3_volume_put()
143 unsigned int channels = scontrol->num_channels; in sof_ipc3_volume_put()
150 scontrol->volume_table, scontrol->max + 1); in sof_ipc3_volume_put()
159 int ret = sof_ipc3_set_get_kcontrol_data(scontrol, true); in sof_ipc3_volume_put()
163 scontrol->name); in sof_ipc3_volume_put()
171 static int sof_ipc3_switch_get(struct snd_sof_control *scontrol, in sof_ipc3_switch_get() argument
174 struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data; in sof_ipc3_switch_get()
175 unsigned int channels = scontrol->num_channels; in sof_ipc3_switch_get()
178 snd_sof_refresh_control(scontrol); in sof_ipc3_switch_get()
187 static bool sof_ipc3_switch_put(struct snd_sof_control *scontrol, in sof_ipc3_switch_put() argument
190 struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data; in sof_ipc3_switch_put()
191 struct snd_soc_component *scomp = scontrol->scomp; in sof_ipc3_switch_put()
192 unsigned int channels = scontrol->num_channels; in sof_ipc3_switch_put()
207 int ret = sof_ipc3_set_get_kcontrol_data(scontrol, true); in sof_ipc3_switch_put()
211 scontrol->name); in sof_ipc3_switch_put()
219 static int sof_ipc3_enum_get(struct snd_sof_control *scontrol, in sof_ipc3_enum_get() argument
222 struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data; in sof_ipc3_enum_get()
223 unsigned int channels = scontrol->num_channels; in sof_ipc3_enum_get()
226 snd_sof_refresh_control(scontrol); in sof_ipc3_enum_get()
235 static bool sof_ipc3_enum_put(struct snd_sof_control *scontrol, in sof_ipc3_enum_put() argument
238 struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data; in sof_ipc3_enum_put()
239 struct snd_soc_component *scomp = scontrol->scomp; in sof_ipc3_enum_put()
240 unsigned int channels = scontrol->num_channels; in sof_ipc3_enum_put()
255 int ret = sof_ipc3_set_get_kcontrol_data(scontrol, true); in sof_ipc3_enum_put()
259 scontrol->name); in sof_ipc3_enum_put()
267 static int sof_ipc3_bytes_get(struct snd_sof_control *scontrol, in sof_ipc3_bytes_get() argument
270 struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data; in sof_ipc3_bytes_get()
271 struct snd_soc_component *scomp = scontrol->scomp; in sof_ipc3_bytes_get()
275 snd_sof_refresh_control(scontrol); in sof_ipc3_bytes_get()
277 if (scontrol->max_size > sizeof(ucontrol->value.bytes.data)) { in sof_ipc3_bytes_get()
279 scontrol->max_size); in sof_ipc3_bytes_get()
284 if (data->size > scontrol->max_size - sizeof(*data)) { in sof_ipc3_bytes_get()
287 data->size, scontrol->max_size - sizeof(*data)); in sof_ipc3_bytes_get()
299 static int sof_ipc3_bytes_put(struct snd_sof_control *scontrol, in sof_ipc3_bytes_put() argument
302 struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data; in sof_ipc3_bytes_put()
303 struct snd_soc_component *scomp = scontrol->scomp; in sof_ipc3_bytes_put()
307 if (scontrol->max_size > sizeof(ucontrol->value.bytes.data)) { in sof_ipc3_bytes_put()
309 scontrol->max_size); in sof_ipc3_bytes_put()
314 if (data->size > scontrol->max_size - sizeof(*data)) { in sof_ipc3_bytes_put()
316 data->size, scontrol->max_size - sizeof(*data)); in sof_ipc3_bytes_put()
327 return sof_ipc3_set_get_kcontrol_data(scontrol, true); in sof_ipc3_bytes_put()
332 static int sof_ipc3_bytes_ext_get(struct snd_sof_control *scontrol, in sof_ipc3_bytes_ext_get() argument
336 struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data; in sof_ipc3_bytes_ext_get()
337 struct snd_soc_component *scomp = scontrol->scomp; in sof_ipc3_bytes_ext_get()
341 snd_sof_refresh_control(scontrol); in sof_ipc3_bytes_ext_get()
357 if (cdata->data->size > scontrol->max_size - sizeof(struct sof_abi_hdr)) { in sof_ipc3_bytes_ext_get()
360 scontrol->max_size - sizeof(struct sof_abi_hdr)); in sof_ipc3_bytes_ext_get()
381 static int sof_ipc3_bytes_ext_put(struct snd_sof_control *scontrol, in sof_ipc3_bytes_ext_put() argument
386 struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data; in sof_ipc3_bytes_ext_put()
387 struct snd_soc_component *scomp = scontrol->scomp; in sof_ipc3_bytes_ext_put()
406 if (header.length > scontrol->max_size) { in sof_ipc3_bytes_ext_put()
408 header.length, scontrol->max_size); in sof_ipc3_bytes_ext_put()
434 if (cdata->data->size > scontrol->max_size - sizeof(struct sof_abi_hdr)) { in sof_ipc3_bytes_ext_put()
441 return sof_ipc3_set_get_kcontrol_data(scontrol, true); in sof_ipc3_bytes_ext_put()
446 static int sof_ipc3_bytes_ext_volatile_get(struct snd_sof_control *scontrol, in sof_ipc3_bytes_ext_volatile_get() argument
451 struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data; in sof_ipc3_bytes_ext_volatile_get()
452 struct snd_soc_component *scomp = scontrol->scomp; in sof_ipc3_bytes_ext_volatile_get()
471 ret = sof_ipc3_set_get_kcontrol_data(scontrol, false); in sof_ipc3_bytes_ext_volatile_get()
476 if (cdata->data->size > scontrol->max_size - sizeof(struct sof_abi_hdr)) { in sof_ipc3_bytes_ext_volatile_get()
479 scontrol->max_size - sizeof(struct sof_abi_hdr)); in sof_ipc3_bytes_ext_volatile_get()
500 static void snd_sof_update_control(struct snd_sof_control *scontrol, in snd_sof_update_control() argument
503 struct snd_soc_component *scomp = scontrol->scomp; in snd_sof_update_control()
507 local_cdata = scontrol->ipc_control_data; in snd_sof_update_control()
518 } else if (cdata->num_elems != scontrol->num_channels) { in snd_sof_update_control()
520 cdata->num_elems, scontrol->num_channels); in snd_sof_update_control()
532 struct snd_sof_control *scontrol; in sof_ipc3_control_update() local
593 scontrol = sm->dobj.private; in sof_ipc3_control_update()
597 scontrol = be->dobj.private; in sof_ipc3_control_update()
601 scontrol = se->dobj.private; in sof_ipc3_control_update()
632 snd_sof_update_control(scontrol, cdata); in sof_ipc3_control_update()
635 scontrol->comp_data_dirty = true; in sof_ipc3_control_update()
643 struct snd_sof_control *scontrol; in sof_ipc3_widget_kcontrol_setup() local
647 list_for_each_entry(scontrol, &sdev->kcontrol_list, list) in sof_ipc3_widget_kcontrol_setup()
648 if (scontrol->comp_id == swidget->comp_id) { in sof_ipc3_widget_kcontrol_setup()
650 ret = sof_ipc3_set_get_kcontrol_data(scontrol, true); in sof_ipc3_widget_kcontrol_setup()
654 scontrol->comp_id, swidget->widget->name); in sof_ipc3_widget_kcontrol_setup()
667 ret = sof_ipc3_set_get_kcontrol_data(scontrol, false); in sof_ipc3_widget_kcontrol_setup()
671 scontrol->comp_id, swidget->widget->name); in sof_ipc3_widget_kcontrol_setup()
678 sof_ipc3_set_up_volume_table(struct snd_sof_control *scontrol, int tlv[SOF_TLV_ITEMS], int size) in sof_ipc3_set_up_volume_table() argument
683 scontrol->volume_table = kcalloc(size, sizeof(u32), GFP_KERNEL); in sof_ipc3_set_up_volume_table()
684 if (!scontrol->volume_table) in sof_ipc3_set_up_volume_table()
689 scontrol->volume_table[i] = vol_compute_gain(i, tlv); in sof_ipc3_set_up_volume_table()