From: Mark Brown <broonie@kernel.org>
To: mengdong.lin@intel.com
Cc: vinod.koul@intel.com, alsa-devel@alsa-project.org,
subhransu.s.prusty@intel.com
Subject: Re: [PATCH] ASoC: Intel: Add Cherrytrail & Braswell machine driver cht_bsw_rt5672
Date: Fri, 24 Oct 2014 17:24:04 +0100 [thread overview]
Message-ID: <20141024162404.GJ3729@sirena.org.uk> (raw)
In-Reply-To: <c59847b1110e5302ec0a82700d4e318bef2a3f66.1414148860.git.mengdong.lin@intel.com>
[-- Attachment #1.1: Type: text/plain, Size: 3299 bytes --]
On Fri, Oct 24, 2014 at 07:14:07PM +0800, mengdong.lin@intel.com wrote:
> From: Mengdong Lin <mengdong.lin@intel.com>
>
> Add machine driver for two Intel Cherryview-based platforms, Cherrytrail and
> Braswell, with RT5672 codec.
This doesn't seem to have any ACPI stuff - how does the driver get
loaded?
> +static int cht_aif1_hw_params(struct snd_pcm_substream *substream,
> + struct snd_pcm_hw_params *params)
> +{
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct snd_soc_dai *codec_dai = rtd->codec_dai;
> + int ret;
> + unsigned int fmt;
> +
> + if (strncmp(codec_dai->name, "rt5670-aif1", 11))
> + return 0;
> +
> + /* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */
> + ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xF, 0xF, 4,
> + SNDRV_PCM_FORMAT_GSM);
> + if (ret < 0) {
> + dev_err(rtd->dev, "can't set codec TDM slot %d\n", ret);
> + return ret;
> + }
> +
This doesn't depend on the parameters so should be set on init and your
use of SNDRV_PCM_FORMAT_GSM doesn't seem to make much sense here -
what's going on?
> + /* TDM slave Mode */
> + fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF
> + | SND_SOC_DAIFMT_CBS_CFS;
> + ret = snd_soc_dai_set_fmt(codec_dai, fmt);
> + if (ret < 0) {
> + dev_err(rtd->dev, "can't set codec DAI fmt %d\n", ret);
> + return ret;
> + }
Likewise, set on init (in the dai_link)
> +static int cht_set_bias_level(struct snd_soc_card *card,
> + struct snd_soc_dapm_context *dapm,
> + enum snd_soc_bias_level level)
> +{
> + switch (level) {
> + case SND_SOC_BIAS_ON:
> + case SND_SOC_BIAS_PREPARE:
> + case SND_SOC_BIAS_STANDBY:
> + case SND_SOC_BIAS_OFF:
> + break;
> + default:
> + dev_err(card->dev, "Invalid bias level=%d\n", level);
> + return -EINVAL;
> + }
> + card->dapm.bias_level = level;
> + return 0;
> +}
This does nothing and can be removed.
> +static int cht_init(struct snd_soc_pcm_runtime *runtime)
> +{
> + int ret;
> + struct snd_soc_card *card = runtime->card;
> +
> + /* Set card bias level */
> + cht_set_bias_level(card, &card->dapm, SND_SOC_BIAS_OFF);
> + card->dapm.idle_bias_off = true;
> +
> + ret = snd_soc_dapm_sync(&card->dapm);
> + if (ret) {
> + dev_err(card->dev, "unable to sync dapm\n");
> + return ret;
> + }
> + return ret;
> +}
This also does nothing and can be removed.
> +static struct snd_pcm_hw_constraint_list constraints_48000 = {
> + .count = ARRAY_SIZE(rates_48000),
> + .list = rates_48000,
> +};
> +
> +static int cht_aif1_startup(struct snd_pcm_substream *substream)
> +{
> + return snd_pcm_hw_constraint_list(substream->runtime, 0,
> + SNDRV_PCM_HW_PARAM_RATE,
> + &constraints_48000);
> +}
If the rates are restricted to 48kHz then is there any need for rate
dependent code in hw_params() at all?
> +static int snd_cht_mc_remove(struct platform_device *pdev)
> +{
> + struct snd_soc_card *soc_card = platform_get_drvdata(pdev);
> +
> + snd_soc_card_set_drvdata(soc_card, NULL);
> + snd_soc_unregister_card(soc_card);
> + platform_set_drvdata(pdev, NULL);
> + return 0;
> +}
No need to set the driver data to NULL, the driver core will do it
anyway and it's buggy to look at the driver data for unbound devices.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2014-10-24 16:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-24 11:14 [PATCH] ASoC: Intel: Add Cherrytrail & Braswell machine driver cht_bsw_rt5672 mengdong.lin
2014-10-24 16:24 ` Mark Brown [this message]
2014-10-27 10:47 ` Lin, Mengdong
2014-10-28 11:30 ` [PATCH v2] " mengdong.lin
2014-10-28 16:48 ` Mark Brown
2014-10-29 6:45 ` Lin, Mengdong
2014-10-29 10:30 ` Mark Brown
2014-10-31 12:48 ` Lin, Mengdong
2014-10-31 12:54 ` Mark Brown
2014-11-03 12:11 ` Lin, Mengdong
2014-11-04 9:45 ` Lin, Mengdong
2014-11-04 10:23 ` Vinod Koul
2014-11-05 1:37 ` Lin, Mengdong
2014-11-04 11:47 ` Mark Brown
2014-11-05 1:44 ` Lin, Mengdong
2014-11-03 12:20 ` [PATCH v3] " mengdong.lin
2014-11-17 9:34 ` [PATCH v4 1/2] " mengdong.lin
2014-11-17 15:35 ` Vinod Koul
2014-11-18 4:57 ` Lin, Mengdong
2014-11-17 9:34 ` [PATCH v4 2/2] ASoC: Intel: add support for Cherrytrail and Braswell in SST driver mengdong.lin
2014-11-17 15:36 ` Vinod Koul
2014-11-18 5:01 ` [PATCH v5 1/2] ASoC: Intel: Add Cherrytrail & Braswell machine driver cht_bsw_rt5672 mengdong.lin
2014-11-21 8:08 ` [PATCH v6 " mengdong.lin
2014-11-21 19:23 ` Mark Brown
2014-11-21 8:09 ` [PATCH v6 2/2] ASoC: Intel: add support for Cherrytrail and Braswell in SST driver mengdong.lin
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=20141024162404.GJ3729@sirena.org.uk \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=mengdong.lin@intel.com \
--cc=subhransu.s.prusty@intel.com \
--cc=vinod.koul@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox