[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <45b4a493-875a-4c9c-aa45-a6f32f74b865@baylibre.com>
Date: Fri, 19 Jul 2024 10:03:08 +0200
From: Alexandre Mergnat <amergnat@...libre.com>
To: Mark Brown <broonie@...nel.org>
Cc: Liam Girdwood <lgirdwood@...il.com>, Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>, Matthias Brugger
<matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Lee Jones <lee@...nel.org>, Flora Fu <flora.fu@...iatek.com>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
Sumit Semwal <sumit.semwal@...aro.org>,
Christian König <christian.koenig@....com>,
Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
linux-sound@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-media@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linaro-mm-sig@...ts.linaro.org,
Nicolas Belin <nbelin@...libre.com>
Subject: Re: [PATCH v6 12/16] ASoC: codecs: add MT6357 support
On 21/06/2024 14:44, Mark Brown wrote:
> On Wed, Jun 19, 2024 at 04:46:48PM +0200, amergnat@...libre.com wrote:
>
>> + /* gain default values*/
>> + regmap_update_bits(priv->regmap, MT6357_AUDENC_ANA_CON0, MT6357_AUDPREAMPLGAIN_MASK,
>> + UL_GAIN_0DB << MT6357_AUDPREAMPLGAIN_SFT);
>> + regmap_update_bits(priv->regmap, MT6357_AUDENC_ANA_CON1, MT6357_AUDPREAMPRGAIN_MASK,
>> + UL_GAIN_0DB << MT6357_AUDPREAMPRGAIN_SFT);
>> +
>> + regmap_update_bits(priv->regmap, MT6357_ZCD_CON1,
>> + MT6357_AUD_LOL_GAIN_MASK |
>> + MT6357_AUD_LOR_GAIN_MASK,
>> + DL_GAIN_0DB << MT6357_AUD_LOL_GAIN_SFT |
>> + DL_GAIN_0DB << MT6357_AUD_LOR_GAIN_SFT);
>> +
>> + regmap_update_bits(priv->regmap, MT6357_ZCD_CON2,
>> + MT6357_AUD_HPL_GAIN_MASK |
>> + MT6357_AUD_HPR_GAIN_MASK,
>> + DL_GAIN_0DB << MT6357_AUD_HPL_GAIN_SFT |
>> + DL_GAIN_0DB << MT6357_AUD_HPR_GAIN_SFT);
>> +
>> + regmap_update_bits(priv->regmap, MT6357_ZCD_CON3,
>> + MT6357_AUD_HS_GAIN_MASK, DL_GAIN_0DB);
>
> We generally leave everything at chip defaults, why is this different?
Ok, after test, it isn't a problem to leave at chip defaults.
>
>> +static int mt6357_codec_probe(struct snd_soc_component *codec)
>> +{
>> + struct mt6357_priv *priv = snd_soc_component_get_drvdata(codec);
>> +
>> + mt6357_codec_init(priv);
>> + return 0;
>> +}
>
> Why not just inline mt6357_codec_init() into the one user?
You're right.
>
>> +static unsigned int mt6357_read(struct snd_soc_component *codec, unsigned int reg)
>> +{
>> + struct mt6357_priv *priv = snd_soc_component_get_drvdata(codec);
>> + unsigned int val;
>> +
>> + regmap_read(priv->regmap, reg, &val);
>> + return val;
>> +}
>> +
>> +static int mt6357_write(struct snd_soc_component *codec, unsigned int reg, unsigned int value)
>> +{
>> + struct mt6357_priv *priv = snd_soc_component_get_drvdata(codec);
>> +
>> + return regmap_update_bits(priv->regmap, reg, 0xffff, value);
>> +}
>
> Why open code these, the core has standard adaptors for regmap?
You're right. snd_soc_component_write/read should be used instead
>
>> +static const u32 micbias_values[MT6357_MICBIAS_ARRAY_SIZE] = {
>> + 1700000, 1800000, 1900000, 2000000,
>> + 2100000, 2500000, 2600000, 2700000
>> +};
>
> Just use ARRAY_SIZE() for the size then the number can't be out of sync.
>
You're right.
--
Regards,
Alexandre
Powered by blists - more mailing lists