]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: codecs: wcd939x: use snd_kcontrol_chip() instead of snd_soc_kcontrol_component()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 14 Oct 2025 04:25:40 +0000 (04:25 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 20 Oct 2025 01:43:52 +0000 (02:43 +0100)
We have very similar name functions (A)(B). Both gets component from
snd_kcontrol, but (A) is used in callback functions which is registered
through snd_soc_add_component_controls(), (B) is used through
snd_soc_dapm_new_widgets().

(A) snd_soc_kcontrol_component()
(B) snd_soc_dapm_kcontrol_component()

(B) is using very picky way to get component but using it is necessary in
ASoC. But (A) is just wrapper function to snd_kcontrol_chip(), and directly
using it without wrapper is very common way on ALSA.
To reduce confusions of similar function, let's use common way on (A).

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87wm4ynm7v.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/wcd939x.c

index e74e6f0131318c9f5041e844e2a2753f5a8c6c32..7c5dd048438420986d41bc6326f7d78fb51048fa 100644 (file)
@@ -1433,7 +1433,7 @@ static int wcd939x_codec_enable_micbias_pullup(struct snd_soc_dapm_widget *w,
 static int wcd939x_tx_mode_get(struct snd_kcontrol *kcontrol,
                               struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component);
        struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
        int path = e->shift_l;
@@ -1446,7 +1446,7 @@ static int wcd939x_tx_mode_get(struct snd_kcontrol *kcontrol,
 static int wcd939x_tx_mode_put(struct snd_kcontrol *kcontrol,
                               struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component);
        struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
        int path = e->shift_l;
@@ -1464,7 +1464,7 @@ static int wcd939x_tx_mode_put(struct snd_kcontrol *kcontrol,
 static int wcd939x_rx_hph_mode_get(struct snd_kcontrol *kcontrol,
                                   struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component);
 
        ucontrol->value.integer.value[0] = wcd939x->hph_mode;
@@ -1475,7 +1475,7 @@ static int wcd939x_rx_hph_mode_get(struct snd_kcontrol *kcontrol,
 static int wcd939x_rx_hph_mode_put(struct snd_kcontrol *kcontrol,
                                   struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component);
        u32 mode_val;
 
@@ -1520,7 +1520,7 @@ static int wcd939x_get_compander(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_value *ucontrol)
 {
        struct soc_mixer_control *mc = (struct soc_mixer_control *)(kcontrol->private_value);
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component);
 
        if (mc->shift)
@@ -1535,7 +1535,7 @@ static int wcd939x_set_compander(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_value *ucontrol)
 {
        struct soc_mixer_control *mc = (struct soc_mixer_control *)(kcontrol->private_value);
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component);
        struct wcd939x_sdw_priv *wcd = wcd939x->sdw_priv[AIF1_PB];
        bool value = !!ucontrol->value.integer.value[0];
@@ -1557,7 +1557,7 @@ static int wcd939x_set_compander(struct snd_kcontrol *kcontrol,
 static int wcd939x_ldoh_get(struct snd_kcontrol *kcontrol,
                            struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component);
 
        ucontrol->value.integer.value[0] = wcd939x->ldoh ? 1 : 0;
@@ -1568,7 +1568,7 @@ static int wcd939x_ldoh_get(struct snd_kcontrol *kcontrol,
 static int wcd939x_ldoh_put(struct snd_kcontrol *kcontrol,
                            struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component);
 
        if (wcd939x->ldoh == !!ucontrol->value.integer.value[0])
@@ -1789,7 +1789,7 @@ static int wcd939x_get_swr_port(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_value *ucontrol)
 {
        struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value;
-       struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
        struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(comp);
        struct wcd939x_sdw_priv *wcd = wcd939x->sdw_priv[mixer->shift];
        unsigned int portidx = wcd->ch_info[mixer->reg].port_num;
@@ -1816,7 +1816,7 @@ static int wcd939x_set_swr_port(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_value *ucontrol)
 {
        struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value;
-       struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol);
        struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(comp);
        struct wcd939x_sdw_priv *wcd = wcd939x->sdw_priv[mixer->shift];
        unsigned int portidx = wcd->ch_info[mixer->reg].port_num;
@@ -2432,7 +2432,7 @@ static const struct wcd_mbhc_cb mbhc_cb = {
 static int wcd939x_get_hph_type(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component);
 
        ucontrol->value.integer.value[0] = wcd_mbhc_get_hph_type(wcd939x->wcd_mbhc);
@@ -2444,7 +2444,7 @@ static int wcd939x_hph_impedance_get(struct snd_kcontrol *kcontrol,
                                     struct snd_ctl_elem_value *ucontrol)
 {
        struct soc_mixer_control *mc = (struct soc_mixer_control *)(kcontrol->private_value);
-       struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component);
        bool hphr = mc->shift;
        u32 zl, zr;