From: Matthias Kaehlcke <mka@chromium.org>
To: Judy Hsiao <judyhsiao@chromium.org>
Cc: dianders@chromium.org, judyhsiao@google.com,
Banajit Goswami <bgoswami@codeaurora.org>,
cychiang@google.com, alsa-devel@alsa-project.org,
linux-arm-msm@vger.kernel.org, swboyd@chromium.org,
Takashi Iwai <tiwai@suse.com>,
Liam Girdwood <lgirdwood@gmail.com>,
broonie@kernel.org,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
yuhsuan@chromium.org
Subject: Re: [v1] ASoC: qcom: Add driver support for ALC5682I-VS.
Date: Wed, 30 Mar 2022 10:24:07 -0700 [thread overview]
Message-ID: <YkSSNypRYqM4PtFB@google.com> (raw)
In-Reply-To: <20220330084519.3863856-1-judyhsiao@chromium.org>
On Wed, Mar 30, 2022 at 04:45:19PM +0800, Judy Hsiao wrote:
> Subject: ASoC: qcom: Add driver support for ALC5682I-VS.
nit: drop period from the subject
> Add Machine driver support for ALC5682I-VS codec.
>
> Signed-off-by: Judy Hsiao <judyhsiao@chromium.org>
> ---
> sound/soc/qcom/Kconfig | 2 +
> sound/soc/qcom/sc7280.c | 104 ++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 106 insertions(+)
>
> diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
> index 28d0dfb4033c..750653404ba3 100644
> --- a/sound/soc/qcom/Kconfig
> +++ b/sound/soc/qcom/Kconfig
> @@ -197,6 +197,8 @@ config SND_SOC_SC7280
> select SND_SOC_LPASS_MACRO_COMMON
> imply SND_SOC_LPASS_RX_MACRO
> imply SND_SOC_LPASS_TX_MACRO
> + select SND_SOC_RT5682_I2C
> + select SND_SOC_RT5682S
> help
> Add support for audio on Qualcomm Technologies Inc.
> SC7280 SoC-based systems.
> diff --git a/sound/soc/qcom/sc7280.c b/sound/soc/qcom/sc7280.c
> index bd0bf9c8cb28..a3e6f61e92cb 100644
> --- a/sound/soc/qcom/sc7280.c
> +++ b/sound/soc/qcom/sc7280.c
> @@ -12,14 +12,20 @@
> #include <sound/jack.h>
> #include <sound/pcm.h>
> #include <sound/soc.h>
> +#include <sound/rt5682s.h>
> #include <linux/soundwire/sdw.h>
>
> +#include "../codecs/rt5682.h"
> +#include "../codecs/rt5682s.h"
> #include "common.h"
> #include "lpass.h"
>
> +#define DEFAULT_MCLK_RATE 19200000
> +#define RT5682_PLL1_FREQ (48000 * 512)
> struct sc7280_snd_data {
> struct snd_soc_card card;
> struct sdw_stream_runtime *sruntime[LPASS_MAX_PORTS];
> + u32 pri_mi2s_clk_count;
> struct snd_soc_jack hs_jack;
> struct snd_soc_jack hdmi_jack;
> bool jack_setup;
> @@ -69,6 +75,7 @@ static int sc7280_headset_init(struct snd_soc_pcm_runtime *rtd)
> pdata->jack_setup = true;
> }
> switch (cpu_dai->id) {
> + case MI2S_PRIMARY:
> case LPASS_CDC_DMA_RX0:
> case LPASS_CDC_DMA_TX3:
> for_each_rtd_codec_dais(rtd, i, codec_dai) {
> @@ -110,11 +117,49 @@ static int sc7280_hdmi_init(struct snd_soc_pcm_runtime *rtd)
> return snd_soc_component_set_jack(component, &pdata->hdmi_jack, NULL);
> }
>
> +static int sc7280_rt5682_init(struct snd_soc_pcm_runtime *rtd)
> +{
> + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
> + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
> + struct snd_soc_card *card = rtd->card;
> + struct sc7280_snd_data *data = snd_soc_card_get_drvdata(card);
> + int ret;
> +
> + if (++data->pri_mi2s_clk_count == 1) {
> + snd_soc_dai_set_sysclk(cpu_dai,
> + LPASS_MCLK0,
> + DEFAULT_MCLK_RATE,
> + SNDRV_PCM_STREAM_PLAYBACK);
> + }
> + snd_soc_dai_set_fmt(codec_dai,
> + SND_SOC_DAIFMT_CBS_CFS |
> + SND_SOC_DAIFMT_NB_NF |
> + SND_SOC_DAIFMT_I2S);
> +
> + ret = snd_soc_dai_set_pll(codec_dai, RT5682S_PLL1, RT5682S_PLL_S_BCLK1,
> + 1536000, RT5682_PLL1_FREQ);
> + if (ret) {
> + dev_err(rtd->dev, "can't set codec pll: %d\n", ret);
> + return ret;
> + }
> +
> + ret = snd_soc_dai_set_sysclk(codec_dai, RT5682S_SCLK_S_PLL1,
> + RT5682_PLL1_FREQ,
> + SND_SOC_CLOCK_IN);
> +
> + if (ret)
> + dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n",
> + ret);
With the current code the function would return 0, I imagine that's not
intended.
> +
> + return 0;
> +}
> +
WARNING: multiple messages have this Message-ID (diff)
From: Matthias Kaehlcke <mka@chromium.org>
To: Judy Hsiao <judyhsiao@chromium.org>
Cc: broonie@kernel.org,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Banajit Goswami <bgoswami@codeaurora.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
dianders@chromium.org, cychiang@google.com, yuhsuan@chromium.org,
judyhsiao@google.com, swboyd@chromium.org,
linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org
Subject: Re: [v1] ASoC: qcom: Add driver support for ALC5682I-VS.
Date: Wed, 30 Mar 2022 10:24:07 -0700 [thread overview]
Message-ID: <YkSSNypRYqM4PtFB@google.com> (raw)
In-Reply-To: <20220330084519.3863856-1-judyhsiao@chromium.org>
On Wed, Mar 30, 2022 at 04:45:19PM +0800, Judy Hsiao wrote:
> Subject: ASoC: qcom: Add driver support for ALC5682I-VS.
nit: drop period from the subject
> Add Machine driver support for ALC5682I-VS codec.
>
> Signed-off-by: Judy Hsiao <judyhsiao@chromium.org>
> ---
> sound/soc/qcom/Kconfig | 2 +
> sound/soc/qcom/sc7280.c | 104 ++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 106 insertions(+)
>
> diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
> index 28d0dfb4033c..750653404ba3 100644
> --- a/sound/soc/qcom/Kconfig
> +++ b/sound/soc/qcom/Kconfig
> @@ -197,6 +197,8 @@ config SND_SOC_SC7280
> select SND_SOC_LPASS_MACRO_COMMON
> imply SND_SOC_LPASS_RX_MACRO
> imply SND_SOC_LPASS_TX_MACRO
> + select SND_SOC_RT5682_I2C
> + select SND_SOC_RT5682S
> help
> Add support for audio on Qualcomm Technologies Inc.
> SC7280 SoC-based systems.
> diff --git a/sound/soc/qcom/sc7280.c b/sound/soc/qcom/sc7280.c
> index bd0bf9c8cb28..a3e6f61e92cb 100644
> --- a/sound/soc/qcom/sc7280.c
> +++ b/sound/soc/qcom/sc7280.c
> @@ -12,14 +12,20 @@
> #include <sound/jack.h>
> #include <sound/pcm.h>
> #include <sound/soc.h>
> +#include <sound/rt5682s.h>
> #include <linux/soundwire/sdw.h>
>
> +#include "../codecs/rt5682.h"
> +#include "../codecs/rt5682s.h"
> #include "common.h"
> #include "lpass.h"
>
> +#define DEFAULT_MCLK_RATE 19200000
> +#define RT5682_PLL1_FREQ (48000 * 512)
> struct sc7280_snd_data {
> struct snd_soc_card card;
> struct sdw_stream_runtime *sruntime[LPASS_MAX_PORTS];
> + u32 pri_mi2s_clk_count;
> struct snd_soc_jack hs_jack;
> struct snd_soc_jack hdmi_jack;
> bool jack_setup;
> @@ -69,6 +75,7 @@ static int sc7280_headset_init(struct snd_soc_pcm_runtime *rtd)
> pdata->jack_setup = true;
> }
> switch (cpu_dai->id) {
> + case MI2S_PRIMARY:
> case LPASS_CDC_DMA_RX0:
> case LPASS_CDC_DMA_TX3:
> for_each_rtd_codec_dais(rtd, i, codec_dai) {
> @@ -110,11 +117,49 @@ static int sc7280_hdmi_init(struct snd_soc_pcm_runtime *rtd)
> return snd_soc_component_set_jack(component, &pdata->hdmi_jack, NULL);
> }
>
> +static int sc7280_rt5682_init(struct snd_soc_pcm_runtime *rtd)
> +{
> + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
> + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
> + struct snd_soc_card *card = rtd->card;
> + struct sc7280_snd_data *data = snd_soc_card_get_drvdata(card);
> + int ret;
> +
> + if (++data->pri_mi2s_clk_count == 1) {
> + snd_soc_dai_set_sysclk(cpu_dai,
> + LPASS_MCLK0,
> + DEFAULT_MCLK_RATE,
> + SNDRV_PCM_STREAM_PLAYBACK);
> + }
> + snd_soc_dai_set_fmt(codec_dai,
> + SND_SOC_DAIFMT_CBS_CFS |
> + SND_SOC_DAIFMT_NB_NF |
> + SND_SOC_DAIFMT_I2S);
> +
> + ret = snd_soc_dai_set_pll(codec_dai, RT5682S_PLL1, RT5682S_PLL_S_BCLK1,
> + 1536000, RT5682_PLL1_FREQ);
> + if (ret) {
> + dev_err(rtd->dev, "can't set codec pll: %d\n", ret);
> + return ret;
> + }
> +
> + ret = snd_soc_dai_set_sysclk(codec_dai, RT5682S_SCLK_S_PLL1,
> + RT5682_PLL1_FREQ,
> + SND_SOC_CLOCK_IN);
> +
> + if (ret)
> + dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n",
> + ret);
With the current code the function would return 0, I imagine that's not
intended.
> +
> + return 0;
> +}
> +
next prev parent reply other threads:[~2022-03-30 17:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-30 8:45 [v1] ASoC: qcom: Add driver support for ALC5682I-VS Judy Hsiao
2022-03-30 8:45 ` Judy Hsiao
2022-03-30 11:40 ` Mark Brown
2022-03-30 11:40 ` Mark Brown
2022-03-31 8:15 ` Judy Hsiao
2022-03-31 8:15 ` Judy Hsiao
2022-03-30 17:24 ` Matthias Kaehlcke [this message]
2022-03-30 17:24 ` Matthias Kaehlcke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YkSSNypRYqM4PtFB@google.com \
--to=mka@chromium.org \
--cc=alsa-devel@alsa-project.org \
--cc=bgoswami@codeaurora.org \
--cc=broonie@kernel.org \
--cc=cychiang@google.com \
--cc=dianders@chromium.org \
--cc=judyhsiao@chromium.org \
--cc=judyhsiao@google.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=swboyd@chromium.org \
--cc=tiwai@suse.com \
--cc=yuhsuan@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.