lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdUU=qf=Uh4htyYqcHeQTLwadznXO=dJcVQxpKrQv6a5g@mail.gmail.com>
Date:   Fri, 22 Jan 2021 22:58:28 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Hans de Goede <hdegoede@...hat.com>
Cc:     Lee Jones <lee.jones@...aro.org>,
        Cezary Rojewski <cezary.rojewski@...el.com>,
        Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
        Liam Girdwood <liam.r.girdwood@...ux.intel.com>,
        Jie Yang <yang.jie@...ux.intel.com>,
        Mark Brown <broonie@...nel.org>, patches@...nsource.cirrus.com,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Charles Keepax <ckeepax@...nsource.cirrus.com>,
        ALSA Development Mailing List <alsa-devel@...a-project.org>
Subject: Re: [PATCH v3 12/13] ASoC: arizona: Make the wm5102, wm5110, wm8997
 and wm8998 drivers use the new jack library

On Fri, Jan 22, 2021 at 6:41 PM Hans de Goede <hdegoede@...hat.com> wrote:
>
> Make all arizona codec drivers for which drivers/mfd/arizona-core.c used
> to instantiate a "arizona-extcon" child-device use the new arizona-jack.c
> library for jack-detection.
>
> This has been tested on a Lenovo Yoga Tablet 2 1051L with a WM5102 codec.

Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

> Signed-off-by: Hans de Goede <hdegoede@...hat.com>
> ---
>  sound/soc/codecs/wm5102.c | 12 +++++++++++-
>  sound/soc/codecs/wm5110.c | 12 +++++++++++-
>  sound/soc/codecs/wm8997.c | 14 ++++++++++++--
>  sound/soc/codecs/wm8998.c |  9 +++++++++
>  4 files changed, 43 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
> index 70d353b63fe0..b77595fb3ea8 100644
> --- a/sound/soc/codecs/wm5102.c
> +++ b/sound/soc/codecs/wm5102.c
> @@ -2004,6 +2004,7 @@ static const struct snd_soc_component_driver soc_component_dev_wm5102 = {
>         .remove                 = wm5102_component_remove,
>         .set_sysclk             = arizona_set_sysclk,
>         .set_pll                = wm5102_set_fll,
> +       .set_jack               = arizona_jack_set_jack,
>         .name                   = DRV_NAME,
>         .compress_ops           = &wm5102_compress_ops,
>         .controls               = wm5102_snd_controls,
> @@ -2057,6 +2058,11 @@ static int wm5102_probe(struct platform_device *pdev)
>         if (ret != 0)
>                 return ret;
>
> +       /* This may return -EPROBE_DEFER, so do this early on */
> +       ret = arizona_jack_codec_dev_probe(&wm5102->core, &pdev->dev);
> +       if (ret)
> +               return ret;
> +
>         for (i = 0; i < ARRAY_SIZE(wm5102->fll); i++)
>                 wm5102->fll[i].vco_mult = 1;
>
> @@ -2089,7 +2095,7 @@ static int wm5102_probe(struct platform_device *pdev)
>                                   wm5102);
>         if (ret != 0) {
>                 dev_err(&pdev->dev, "Failed to request DSP IRQ: %d\n", ret);
> -               return ret;
> +               goto err_jack_codec_dev;
>         }
>
>         ret = arizona_set_irq_wake(arizona, ARIZONA_IRQ_DSP_IRQ1, 1);
> @@ -2123,6 +2129,8 @@ static int wm5102_probe(struct platform_device *pdev)
>  err_dsp_irq:
>         arizona_set_irq_wake(arizona, ARIZONA_IRQ_DSP_IRQ1, 0);
>         arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, wm5102);
> +err_jack_codec_dev:
> +       arizona_jack_codec_dev_remove(&wm5102->core);
>
>         return ret;
>  }
> @@ -2141,6 +2149,8 @@ static int wm5102_remove(struct platform_device *pdev)
>         arizona_set_irq_wake(arizona, ARIZONA_IRQ_DSP_IRQ1, 0);
>         arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, wm5102);
>
> +       arizona_jack_codec_dev_remove(&wm5102->core);
> +
>         return 0;
>  }
>
> diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
> index 4238929b2375..ef22051a3599 100644
> --- a/sound/soc/codecs/wm5110.c
> +++ b/sound/soc/codecs/wm5110.c
> @@ -2370,6 +2370,7 @@ static const struct snd_soc_component_driver soc_component_dev_wm5110 = {
>         .remove                 = wm5110_component_remove,
>         .set_sysclk             = arizona_set_sysclk,
>         .set_pll                = wm5110_set_fll,
> +       .set_jack               = arizona_jack_set_jack,
>         .name                   = DRV_NAME,
>         .compress_ops           = &wm5110_compress_ops,
>         .controls               = wm5110_snd_controls,
> @@ -2424,6 +2425,11 @@ static int wm5110_probe(struct platform_device *pdev)
>                         return ret;
>         }
>
> +       /* This may return -EPROBE_DEFER, so do this early on */
> +       ret = arizona_jack_codec_dev_probe(&wm5110->core, &pdev->dev);
> +       if (ret)
> +               return ret;
> +
>         for (i = 0; i < ARRAY_SIZE(wm5110->fll); i++)
>                 wm5110->fll[i].vco_mult = 3;
>
> @@ -2456,7 +2462,7 @@ static int wm5110_probe(struct platform_device *pdev)
>                                   wm5110);
>         if (ret != 0) {
>                 dev_err(&pdev->dev, "Failed to request DSP IRQ: %d\n", ret);
> -               return ret;
> +               goto err_jack_codec_dev;
>         }
>
>         ret = arizona_set_irq_wake(arizona, ARIZONA_IRQ_DSP_IRQ1, 1);
> @@ -2490,6 +2496,8 @@ static int wm5110_probe(struct platform_device *pdev)
>  err_dsp_irq:
>         arizona_set_irq_wake(arizona, ARIZONA_IRQ_DSP_IRQ1, 0);
>         arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, wm5110);
> +err_jack_codec_dev:
> +       arizona_jack_codec_dev_remove(&wm5110->core);
>
>         return ret;
>  }
> @@ -2510,6 +2518,8 @@ static int wm5110_remove(struct platform_device *pdev)
>         arizona_set_irq_wake(arizona, ARIZONA_IRQ_DSP_IRQ1, 0);
>         arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, wm5110);
>
> +       arizona_jack_codec_dev_remove(&wm5110->core);
> +
>         return 0;
>  }
>
> diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c
> index 229f2986cd96..4f5a848960e0 100644
> --- a/sound/soc/codecs/wm8997.c
> +++ b/sound/soc/codecs/wm8997.c
> @@ -1096,6 +1096,7 @@ static const struct snd_soc_component_driver soc_component_dev_wm8997 = {
>         .remove                 = wm8997_component_remove,
>         .set_sysclk             = arizona_set_sysclk,
>         .set_pll                = wm8997_set_fll,
> +       .set_jack               = arizona_jack_set_jack,
>         .controls               = wm8997_snd_controls,
>         .num_controls           = ARRAY_SIZE(wm8997_snd_controls),
>         .dapm_widgets           = wm8997_dapm_widgets,
> @@ -1132,6 +1133,11 @@ static int wm8997_probe(struct platform_device *pdev)
>
>         arizona_init_dvfs(&wm8997->core);
>
> +       /* This may return -EPROBE_DEFER, so do this early on */
> +       ret = arizona_jack_codec_dev_probe(&wm8997->core, &pdev->dev);
> +       if (ret)
> +               return ret;
> +
>         for (i = 0; i < ARRAY_SIZE(wm8997->fll); i++)
>                 wm8997->fll[i].vco_mult = 1;
>
> @@ -1163,10 +1169,10 @@ static int wm8997_probe(struct platform_device *pdev)
>
>         ret = arizona_init_vol_limit(arizona);
>         if (ret < 0)
> -               return ret;
> +               goto err_jack_codec_dev;
>         ret = arizona_init_spk_irqs(arizona);
>         if (ret < 0)
> -               return ret;
> +               goto err_jack_codec_dev;
>
>         ret = devm_snd_soc_register_component(&pdev->dev,
>                                               &soc_component_dev_wm8997,
> @@ -1181,6 +1187,8 @@ static int wm8997_probe(struct platform_device *pdev)
>
>  err_spk_irqs:
>         arizona_free_spk_irqs(arizona);
> +err_jack_codec_dev:
> +       arizona_jack_codec_dev_remove(&wm8997->core);
>
>         return ret;
>  }
> @@ -1194,6 +1202,8 @@ static int wm8997_remove(struct platform_device *pdev)
>
>         arizona_free_spk_irqs(arizona);
>
> +       arizona_jack_codec_dev_remove(&wm8997->core);
> +
>         return 0;
>  }
>
> diff --git a/sound/soc/codecs/wm8998.c b/sound/soc/codecs/wm8998.c
> index 5413254295b7..f74af1c46933 100644
> --- a/sound/soc/codecs/wm8998.c
> +++ b/sound/soc/codecs/wm8998.c
> @@ -1316,6 +1316,7 @@ static const struct snd_soc_component_driver soc_component_dev_wm8998 = {
>         .remove                 = wm8998_component_remove,
>         .set_sysclk             = arizona_set_sysclk,
>         .set_pll                = wm8998_set_fll,
> +       .set_jack               = arizona_jack_set_jack,
>         .controls               = wm8998_snd_controls,
>         .num_controls           = ARRAY_SIZE(wm8998_snd_controls),
>         .dapm_widgets           = wm8998_dapm_widgets,
> @@ -1350,6 +1351,11 @@ static int wm8998_probe(struct platform_device *pdev)
>         wm8998->core.arizona = arizona;
>         wm8998->core.num_inputs = 3;    /* IN1L, IN1R, IN2 */
>
> +       /* This may return -EPROBE_DEFER, so do this early on */
> +       ret = arizona_jack_codec_dev_probe(&wm8998->core, &pdev->dev);
> +       if (ret)
> +               return ret;
> +
>         for (i = 0; i < ARRAY_SIZE(wm8998->fll); i++)
>                 wm8998->fll[i].vco_mult = 1;
>
> @@ -1392,6 +1398,7 @@ static int wm8998_probe(struct platform_device *pdev)
>         arizona_free_spk_irqs(arizona);
>  err_pm_disable:
>         pm_runtime_disable(&pdev->dev);
> +       arizona_jack_codec_dev_remove(&wm8998->core);
>
>         return ret;
>  }
> @@ -1405,6 +1412,8 @@ static int wm8998_remove(struct platform_device *pdev)
>
>         arizona_free_spk_irqs(arizona);
>
> +       arizona_jack_codec_dev_remove(&wm8998->core);
> +
>         return 0;
>  }
>
> --
> 2.28.0
>


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ