linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ricard Wanderlof <ricardw@axis.com>
To: Dan Murphy <dmurphy@ti.com>
Cc: "lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"perex@perex.cz" <perex@perex.cz>,
	"tiwai@suse.com" <tiwai@suse.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 2/2] ASoC: tlv320adcx140: Add the tlv320adcx140 codec driver family
Date: Wed, 26 Feb 2020 12:18:29 +0100	[thread overview]
Message-ID: <alpine.DEB.2.20.2002261138040.19469@lnxricardw1.se.axis.com> (raw)
In-Reply-To: <20200219125942.22013-3-dmurphy@ti.com>


On Wed, 19 Feb 2020, Dan Murphy wrote:

> Add the tlv320adcx140 codec driver family.
>

...

> +
> +static int adcx140_set_dai_fmt(struct snd_soc_dai *codec_dai,
> +                              unsigned int fmt)
> +{
> +       struct snd_soc_component *component = codec_dai->component;
> +       struct adcx140_priv *adcx140 =
> snd_soc_component_get_drvdata(component);
> +       u8 iface_reg1 = 0;
> +       u8 iface_reg2 = 0;
> +
> +       /* set master/slave audio interface */
> +       switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
> +       case SND_SOC_DAIFMT_CBM_CFM:
> +               iface_reg2 |= ADCX140_BCLK_FSYNC_MASTER;

Although this sets up the codec to be I2S master, there doesn't seem to be 
a way of actually configuring the master clock frequency in master mode, 
as there is no .set_sysclk member in adcx140_dai_ops (and the 
corresponding register field appears never to be touched by the driver).

> +               break;
> +       case SND_SOC_DAIFMT_CBS_CFS:
> +               break;
> +       case SND_SOC_DAIFMT_CBS_CFM:
> +       case SND_SOC_DAIFMT_CBM_CFS:
> +       default:
> +               dev_err(component->dev, "Invalid DAI master/slave interface\n");
> +               return -EINVAL;
> +       }

...

> +
> +static int adcx140_codec_probe(struct snd_soc_component *component)
> +{
> +       struct adcx140_priv *adcx140 =
> snd_soc_component_get_drvdata(component);
> +       int sleep_cfg_val = ADCX140_WAKE_DEV;
> +       u8 bias_source;
> +       u8 vref_source;
> +       int ret;
> +
> +       ret = device_property_read_u8(adcx140->dev, "ti,mic-bias-source",
> +                                     &bias_source);
> +       if (ret)
> +               bias_source = ADCX140_MIC_BIAS_VAL_VREF;
> +
> +       if (bias_source != ADCX140_MIC_BIAS_VAL_VREF &&
> +           bias_source != ADCX140_MIC_BIAS_VAL_VREF_1096 &&
> +           bias_source != ADCX140_MIC_BIAS_VAL_AVDD) {
> +               dev_err(adcx140->dev, "Mic Bias source value is invalid\n");
> +               return -EINVAL;
> +       }
> +
> +       ret = device_property_read_u8(adcx140->dev, "ti,vref-source",
> +                                     &vref_source);
> +       if (ret)
> +               vref_source = ADCX140_MIC_BIAS_VREF_275V;
> +
> +       if (vref_source != ADCX140_MIC_BIAS_VREF_275V &&
> +           vref_source != ADCX140_MIC_BIAS_VREF_25V &&
> +           vref_source != ADCX140_MIC_BIAS_VREF_1375V) {

According to the data sheet, this setting controls the ADC full scale 
setting and has nothing to do with the mic bias voltage, hence using 
MIC_BIAS as part of the macro name is misleaading.

> +               dev_err(adcx140->dev, "Mic Bias source value is invalid\n");

Error text does not reflect the actual error, suggest "VREF value is 
invalid".

> +               return -EINVAL;
> +       }
> +
> +       bias_source |= vref_source;
> +
> +       ret = adcx140_reset(adcx140);
> +       if (ret)
> +               goto out;
> +
> +       if(adcx140->supply_areg == NULL)
> +               sleep_cfg_val |= ADCX140_AREG_INTERNAL;
> +
> +       ret = regmap_write(adcx140->regmap, ADCX140_SLEEP_CFG,
> sleep_cfg_val);
> +       if (ret) {
> +               dev_err(adcx140->dev, "setting sleep config failed %d\n",
> ret);
> +               goto out;
> +       }
> --
> 2.25.0
> 
> 
> 

/Ricard
-- 
Ricard Wolf Wanderlof                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

  parent reply	other threads:[~2020-02-26 11:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19 12:59 [PATCH v3 0/2] Introduce the TLV320ADCx140 codec family Dan Murphy
2020-02-19 12:59 ` [PATCH v3 1/2] dt-bindings: sound: Add TLV320ADCx140 dt bindings Dan Murphy
2020-02-19 12:59 ` [PATCH v3 2/2] ASoC: tlv320adcx140: Add the tlv320adcx140 codec driver family Dan Murphy
2020-02-20 20:48   ` Mark Brown
2020-02-20 20:52     ` Dan Murphy
2020-02-20 21:13       ` Mark Brown
2020-02-26 11:18   ` Ricard Wanderlof [this message]
2020-02-26 12:43     ` Dan Murphy
2020-02-20 19:24 ` [PATCH v3 0/2] Introduce the TLV320ADCx140 codec family Dan Murphy
2020-02-20 19:44   ` Mark Brown

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=alpine.DEB.2.20.2002261138040.19469@lnxricardw1.se.axis.com \
    --to=ricardw@axis.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dmurphy@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.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;
as well as URLs for NNTP newsgroup(s).