]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: codecs: wcd937x: use snd_kcontrol_chip() instead of snd_soc_kcontrol_component()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 14 Oct 2025 04:25:33 +0000 (04:25 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 20 Oct 2025 01:43:50 +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/87zf9unm82.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/wcd937x.c

index 421ec7a2d6bdc8e4beed133ef4e3e1909f132804..e7b9ba284cd34f4e7f7444b22f2eb1f92c9ef323 100644 (file)
@@ -1208,7 +1208,7 @@ static int wcd937x_connect_port(struct wcd937x_sdw_priv *wcd, u8 port_idx, u8 ch
 static int wcd937x_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 wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
 
        ucontrol->value.integer.value[0] = wcd937x->hph_mode;
@@ -1218,8 +1218,7 @@ static int wcd937x_rx_hph_mode_get(struct snd_kcontrol *kcontrol,
 static int wcd937x_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 wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
        u32 mode_val;
 
@@ -1251,7 +1250,7 @@ static int wcd937x_rx_hph_mode_put(struct snd_kcontrol *kcontrol,
 static int wcd937x_get_compander(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 wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
        struct soc_mixer_control *mc;
        bool hphr;
@@ -1267,7 +1266,7 @@ static int wcd937x_get_compander(struct snd_kcontrol *kcontrol,
 static int wcd937x_set_compander(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 wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
        struct wcd937x_sdw_priv *wcd = wcd937x->sdw_priv[AIF1_PB];
        int value = ucontrol->value.integer.value[0];
@@ -1304,7 +1303,7 @@ static int wcd937x_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 wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(comp);
        struct wcd937x_sdw_priv *wcd;
        int dai_id = mixer->shift;
@@ -1323,7 +1322,7 @@ static int wcd937x_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 wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(comp);
        struct wcd937x_sdw_priv *wcd;
        int dai_id = mixer->shift;
@@ -1951,7 +1950,7 @@ static const struct wcd_mbhc_cb mbhc_cb = {
 static int wcd937x_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 wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
 
        ucontrol->value.integer.value[0] = wcd_mbhc_get_hph_type(wcd937x->wcd_mbhc);
@@ -1965,8 +1964,7 @@ static int wcd937x_hph_impedance_get(struct snd_kcontrol *kcontrol,
        u32 zl, zr;
        bool hphr;
        struct soc_mixer_control *mc;
-       struct snd_soc_component *component =
-                                       snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
 
        mc = (struct soc_mixer_control *)(kcontrol->private_value);