From: Alexandre Mergnat <amergnat@baylibre.com>
To: Mark Brown <broonie@kernel.org>
Cc: "Liam Girdwood" <lgirdwood@gmail.com>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Lee Jones" <lee@kernel.org>, "Flora Fu" <flora.fu@mediatek.com>,
"Jaroslav Kysela" <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>, "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-media@vger.kernel.org,
dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
"Nicolas Belin" <nbelin@baylibre.com>
Subject: Re: [PATCH v6 12/16] ASoC: codecs: add MT6357 support
Date: Fri, 19 Jul 2024 10:03:08 +0200 [thread overview]
Message-ID: <45b4a493-875a-4c9c-aa45-a6f32f74b865@baylibre.com> (raw)
In-Reply-To: <1ca27c79-a83a-42a7-9e9b-766da0064c73@sirena.org.uk>
On 21/06/2024 14:44, Mark Brown wrote:
> On Wed, Jun 19, 2024 at 04:46:48PM +0200, amergnat@baylibre.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
next prev parent reply other threads:[~2024-07-19 8:03 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 14:46 [PATCH v6 00/16] Add audio support for the MediaTek Genio 350-evk board Alexandre Mergnat
2024-06-19 14:46 ` [PATCH v6 01/16] ASoC: dt-bindings: mediatek,mt8365-afe: Add audio afe document Alexandre Mergnat
2024-06-19 14:46 ` [PATCH v6 02/16] ASoC: dt-bindings: mediatek,mt8365-mt6357: Add audio sound card document Alexandre Mergnat
2024-06-19 14:46 ` [PATCH v6 03/16] dt-bindings: mfd: mediatek: Add codec property for MT6357 PMIC Alexandre Mergnat
2024-06-21 15:00 ` Krzysztof Kozlowski
2024-06-25 9:23 ` Alexandre Mergnat
2024-06-25 13:44 ` Krzysztof Kozlowski
2024-06-26 8:30 ` Alexandre Mergnat
2024-06-26 9:12 ` Krzysztof Kozlowski
2024-06-26 9:14 ` Krzysztof Kozlowski
2024-06-19 14:46 ` [PATCH v6 04/16] ASoC: mediatek: mt8365: Add common header Alexandre Mergnat
2024-06-19 14:46 ` [PATCH v6 05/16] ASoC: mediatek: mt8365: Add audio clock control support Alexandre Mergnat
2024-06-19 14:46 ` [PATCH v6 06/16] ASoC: mediatek: mt8365: Add I2S DAI support Alexandre Mergnat
2024-06-19 14:46 ` [PATCH v6 07/16] ASoC: mediatek: mt8365: Add ADDA " Alexandre Mergnat
2024-06-19 14:46 ` [PATCH v6 08/16] ASoC: mediatek: mt8365: Add DMIC " Alexandre Mergnat
2024-06-19 14:46 ` [PATCH v6 09/16] ASoC: mediatek: mt8365: Add PCM " Alexandre Mergnat
2024-06-19 14:46 ` [PATCH v6 10/16] ASoc: mediatek: mt8365: Add a specific soundcard for EVK amergnat
2024-06-19 14:46 ` [PATCH v6 11/16] ASoC: mediatek: mt8365: Add the AFE driver support Alexandre Mergnat
2024-06-19 14:46 ` [PATCH v6 12/16] ASoC: codecs: add MT6357 support amergnat
2024-06-19 15:01 ` AngeloGioacchino Del Regno
2024-06-21 12:44 ` Mark Brown
2024-07-19 8:03 ` Alexandre Mergnat [this message]
2024-06-21 14:58 ` Mark Brown
2024-06-19 14:46 ` [PATCH v6 13/16] ASoC: mediatek: Add MT8365 support Alexandre Mergnat
2024-06-19 14:46 ` [PATCH v6 14/16] arm64: defconfig: enable mt8365 sound Alexandre Mergnat
2024-06-19 14:46 ` [PATCH v6 15/16] arm64: dts: mediatek: add afe support for mt8365 SoC Alexandre Mergnat
2024-06-19 14:46 ` [PATCH v6 16/16] arm64: dts: mediatek: add audio support for mt8365-evk Alexandre Mergnat
2024-06-19 14:58 ` AngeloGioacchino Del Regno
2024-09-04 11:16 ` (subset) [PATCH v6 00/16] Add audio support for the MediaTek Genio 350-evk board 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=45b4a493-875a-4c9c-aa45-a6f32f74b865@baylibre.com \
--to=amergnat@baylibre.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=christian.koenig@amd.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=flora.fu@mediatek.com \
--cc=krzk+dt@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-sound@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=nbelin@baylibre.com \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=robh@kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=tiwai@suse.com \
--cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®