]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: tegra: tegra186: use snd_kcontrol_chip() instead of snd_soc_kcontrol_component()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 14 Oct 2025 04:27:53 +0000 (04:27 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 20 Oct 2025 01:44:28 +0000 (02:44 +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/87frbmm7jr.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/tegra/tegra186_asrc.c
sound/soc/tegra/tegra186_dspk.c

index 851509ae07f5958c06201789a797ebc519c92c2d..2c0220e14a570dca6c8a28f0069a33310a6d344f 100644 (file)
@@ -241,7 +241,7 @@ static int tegra186_asrc_get_ratio_source(struct snd_kcontrol *kcontrol,
 {
        struct soc_enum *asrc_private =
                (struct soc_enum  *)kcontrol->private_value;
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
        unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
 
@@ -255,7 +255,7 @@ static int tegra186_asrc_put_ratio_source(struct snd_kcontrol *kcontrol,
 {
        struct soc_enum *asrc_private =
                (struct soc_enum  *)kcontrol->private_value;
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
        unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
        bool change = false;
@@ -275,7 +275,7 @@ static int tegra186_asrc_get_ratio_int(struct snd_kcontrol *kcontrol,
 {
        struct soc_mixer_control *asrc_private =
                (struct soc_mixer_control *)kcontrol->private_value;
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
        unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
 
@@ -293,7 +293,7 @@ static int tegra186_asrc_put_ratio_int(struct snd_kcontrol *kcontrol,
 {
        struct soc_mixer_control *asrc_private =
                (struct soc_mixer_control *)kcontrol->private_value;
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
        unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
        bool change = false;
@@ -323,7 +323,7 @@ static int tegra186_asrc_get_ratio_frac(struct snd_kcontrol *kcontrol,
 {
        struct soc_mreg_control *asrc_private =
                (struct soc_mreg_control *)kcontrol->private_value;
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
        unsigned int id = asrc_private->regbase / TEGRA186_ASRC_STREAM_STRIDE;
 
@@ -341,7 +341,7 @@ static int tegra186_asrc_put_ratio_frac(struct snd_kcontrol *kcontrol,
 {
        struct soc_mreg_control *asrc_private =
                (struct soc_mreg_control *)kcontrol->private_value;
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
        unsigned int id = asrc_private->regbase / TEGRA186_ASRC_STREAM_STRIDE;
        bool change = false;
@@ -371,7 +371,7 @@ static int tegra186_asrc_get_hwcomp_disable(struct snd_kcontrol *kcontrol,
 {
        struct soc_mixer_control *asrc_private =
                (struct soc_mixer_control *)kcontrol->private_value;
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
        unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
 
@@ -385,7 +385,7 @@ static int tegra186_asrc_put_hwcomp_disable(struct snd_kcontrol *kcontrol,
 {
        struct soc_mixer_control *asrc_private =
                (struct soc_mixer_control *)kcontrol->private_value;
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
        unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
        int value = ucontrol->value.integer.value[0];
@@ -403,7 +403,7 @@ static int tegra186_asrc_get_input_threshold(struct snd_kcontrol *kcontrol,
 {
        struct soc_mixer_control *asrc_private =
                (struct soc_mixer_control *)kcontrol->private_value;
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
        unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
 
@@ -417,7 +417,7 @@ static int tegra186_asrc_put_input_threshold(struct snd_kcontrol *kcontrol,
 {
        struct soc_mixer_control *asrc_private =
                (struct soc_mixer_control *)kcontrol->private_value;
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
        unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
        int value = (asrc->lane[id].input_thresh & ~(0x3)) |
@@ -436,7 +436,7 @@ static int tegra186_asrc_get_output_threshold(struct snd_kcontrol *kcontrol,
 {
        struct soc_mixer_control *asrc_private =
                (struct soc_mixer_control *)kcontrol->private_value;
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
        unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
 
@@ -450,7 +450,7 @@ static int tegra186_asrc_put_output_threshold(struct snd_kcontrol *kcontrol,
 {
        struct soc_mixer_control *asrc_private =
                (struct soc_mixer_control *)kcontrol->private_value;
-       struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
        struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
        unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
        int value = (asrc->lane[id].output_thresh & ~(0x3)) |
index 21fdab2a197718cec3c92f4c3cff2d0acfc9d493..a762150db802ab6653f4edb16694e9e247a27c20 100644 (file)
@@ -28,7 +28,7 @@ static const struct reg_default tegra186_dspk_reg_defaults[] = {
 static int tegra186_dspk_get_fifo_th(struct snd_kcontrol *kcontrol,
                                     struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
        struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
 
        ucontrol->value.integer.value[0] = dspk->rx_fifo_th;
@@ -39,7 +39,7 @@ static int tegra186_dspk_get_fifo_th(struct snd_kcontrol *kcontrol,
 static int tegra186_dspk_put_fifo_th(struct snd_kcontrol *kcontrol,
                                     struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
        struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
        int value = ucontrol->value.integer.value[0];
 
@@ -54,7 +54,7 @@ static int tegra186_dspk_put_fifo_th(struct snd_kcontrol *kcontrol,
 static int tegra186_dspk_get_osr_val(struct snd_kcontrol *kcontrol,
                                     struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
        struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
 
        ucontrol->value.enumerated.item[0] = dspk->osr_val;
@@ -65,7 +65,7 @@ static int tegra186_dspk_get_osr_val(struct snd_kcontrol *kcontrol,
 static int tegra186_dspk_put_osr_val(struct snd_kcontrol *kcontrol,
                                     struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
        struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
        unsigned int value = ucontrol->value.enumerated.item[0];
 
@@ -80,7 +80,7 @@ static int tegra186_dspk_put_osr_val(struct snd_kcontrol *kcontrol,
 static int tegra186_dspk_get_pol_sel(struct snd_kcontrol *kcontrol,
                                     struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
        struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
 
        ucontrol->value.enumerated.item[0] = dspk->lrsel;
@@ -91,7 +91,7 @@ static int tegra186_dspk_get_pol_sel(struct snd_kcontrol *kcontrol,
 static int tegra186_dspk_put_pol_sel(struct snd_kcontrol *kcontrol,
                                     struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
        struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
        unsigned int value = ucontrol->value.enumerated.item[0];
 
@@ -106,7 +106,7 @@ static int tegra186_dspk_put_pol_sel(struct snd_kcontrol *kcontrol,
 static int tegra186_dspk_get_ch_sel(struct snd_kcontrol *kcontrol,
                                    struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
        struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
 
        ucontrol->value.enumerated.item[0] = dspk->ch_sel;
@@ -117,7 +117,7 @@ static int tegra186_dspk_get_ch_sel(struct snd_kcontrol *kcontrol,
 static int tegra186_dspk_put_ch_sel(struct snd_kcontrol *kcontrol,
                                    struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
        struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
        unsigned int value = ucontrol->value.enumerated.item[0];
 
@@ -132,7 +132,7 @@ static int tegra186_dspk_put_ch_sel(struct snd_kcontrol *kcontrol,
 static int tegra186_dspk_get_mono_to_stereo(struct snd_kcontrol *kcontrol,
                                            struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
        struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
 
        ucontrol->value.enumerated.item[0] = dspk->mono_to_stereo;
@@ -143,7 +143,7 @@ static int tegra186_dspk_get_mono_to_stereo(struct snd_kcontrol *kcontrol,
 static int tegra186_dspk_put_mono_to_stereo(struct snd_kcontrol *kcontrol,
                                            struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
        struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
        unsigned int value = ucontrol->value.enumerated.item[0];
 
@@ -158,7 +158,7 @@ static int tegra186_dspk_put_mono_to_stereo(struct snd_kcontrol *kcontrol,
 static int tegra186_dspk_get_stereo_to_mono(struct snd_kcontrol *kcontrol,
                                            struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
        struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
 
        ucontrol->value.enumerated.item[0] = dspk->stereo_to_mono;
@@ -169,7 +169,7 @@ static int tegra186_dspk_get_stereo_to_mono(struct snd_kcontrol *kcontrol,
 static int tegra186_dspk_put_stereo_to_mono(struct snd_kcontrol *kcontrol,
                                            struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
+       struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
        struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
        unsigned int value = ucontrol->value.enumerated.item[0];