.hw_free = class_function_sdw_remove_peripheral,
};
-static int class_function_component_probe(struct snd_soc_component *component)
+static int class_function_component_fixup_controls(struct snd_soc_component *component)
{
struct class_function_drv *drv = snd_soc_component_get_drvdata(component);
struct sdca_class_drv *core = drv->core;
}
static const struct snd_soc_component_driver class_function_component_drv = {
- .probe = class_function_component_probe,
+ .fixup_controls = class_function_component_fixup_controls,
.remove = class_function_component_remove,
.endianness = 1,
};
struct jack_state *state = interrupt->priv;
struct snd_kcontrol *kctl = state->kctl;
struct snd_ctl_elem_value *ucontrol __free(kfree) = NULL;
+ struct soc_enum *soc_enum;
unsigned int reg, val;
int ret;
return -ENOMEM;
kctl = snd_soc_component_get_kcontrol(component, name);
- if (!kctl)
- dev_dbg(dev, "control not found: %s\n", name);
- else
- state->kctl = kctl;
+ if (!kctl) {
+ dev_err(dev, "control not found: %s\n", name);
+ return -ENODEV;
+ }
+
+ state->kctl = kctl;
}
reg = SDW_SDCA_CTL(interrupt->function->desc->adr, interrupt->entity->id,
dev_dbg(dev, "%s: %#x\n", interrupt->name, val);
- if (kctl) {
- struct soc_enum *soc_enum = (struct soc_enum *)kctl->private_value;
-
- ucontrol = kzalloc_obj(*ucontrol);
- if (!ucontrol)
- return -ENOMEM;
-
- ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(soc_enum, val);
+ ucontrol = kzalloc_obj(*ucontrol);
+ if (!ucontrol)
+ return -ENOMEM;
- ret = snd_soc_dapm_put_enum_double(kctl, ucontrol);
- if (ret < 0) {
- dev_err(dev, "failed to update selected mode: %d\n", ret);
- return ret;
- }
+ soc_enum = (struct soc_enum *)kctl->private_value;
+ ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(soc_enum, val);
- snd_ctl_notify(card->snd_card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
- } else {
- ret = regmap_write(interrupt->function_regmap, reg, val);
- if (ret) {
- dev_err(dev, "failed to write selected mode: %d\n", ret);
- return ret;
- }
+ ret = snd_soc_dapm_put_enum_double(kctl, ucontrol);
+ if (ret < 0) {
+ dev_err(dev, "failed to update selected mode: %d\n", ret);
+ return ret;
}
+ snd_ctl_notify(card->snd_card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
+
return sdca_jack_report(interrupt);
}
EXPORT_SYMBOL_NS_GPL(sdca_jack_process, "SND_SOC_SDCA");
struct sdca_control_range *range;
struct jack_state *jack_state;
- if (!interrupt->irq)
+ if (!interrupt->dev)
continue;
switch (SDCA_CTL_TYPE(entity->type, control->sel)) {