[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YppQ7BiqlBDMNsuc@gerhold.net>
Date: Fri, 3 Jun 2022 20:20:28 +0200
From: Stephan Gerhold <stephan@...hold.net>
To: Alexander Martinz <amartinz@...ftphones.com>
Cc: ~postmarketos/upstreaming@...ts.sr.ht, phone-devel@...r.kernel.org,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Caleb Connolly <caleb@...nolly.tech>,
Dylan Van Assche <me@...anvanassche.be>
Subject: Re: [PATCH 1/2] ASoC: codecs: tfa989x: Add support for tfa9890
On Thu, Jun 02, 2022 at 06:45:03PM +0200, Alexander Martinz wrote:
> The initialization sequence is taken from the version provided
> by the supplier [1].
>
> This allows speakers using the TFA9890 amplifier to work, which are
> used by various mobile phones such as the SHIFT6mq.
>
> [1]: https://source.codeaurora.org/external/mas/tfa98xx/tree/src/tfa_init.c?id=d2cd12931fbc48df988b62931fb9960d4e9dc05d#n1827
>
> Signed-off-by: Alexander Martinz <amartinz@...ftphones.com>
> ---
> sound/soc/codecs/tfa989x.c | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/sound/soc/codecs/tfa989x.c b/sound/soc/codecs/tfa989x.c
> index dc86852752c5..8ab2656de750 100644
> --- a/sound/soc/codecs/tfa989x.c
> +++ b/sound/soc/codecs/tfa989x.c
...
> @@ -188,6 +190,33 @@ static struct snd_soc_dai_driver tfa989x_dai = {
> .ops = &tfa989x_dai_ops,
> };
>
> +static int tfa9890_init(struct regmap *regmap)
> +{
> + int ret;
> +
> + /* unhide keys to allow updating them */
Nitpick: I think the magic number is the "key" to hide/unhide certain
*registers*. This comment implies that you are hiding *keys*.
Maybe just write something like
/* temporarily allow access to hidden registers */
...
/* hide registers again */
With that fixed, feel free to add my
Reviewed-by: Stephan Gerhold <stephan@...hold.net>
Thanks!
Stephan
> + ret = regmap_write(regmap, TFA989X_HIDE_UNHIDE_KEY, 0x5a6b);
> + if (ret)
> + return ret;
> +
> + /* update PLL registers */
> + ret = regmap_set_bits(regmap, 0x59, 0x3);
> + if (ret)
> + return ret;
> +
> + /* hide keys again */
> + ret = regmap_write(regmap, TFA989X_HIDE_UNHIDE_KEY, 0x0000);
> + if (ret)
> + return ret;
> +
> + return regmap_write(regmap, TFA989X_CURRENTSENSE2, 0x7BE1);
> +}
> +
> +static const struct tfa989x_rev tfa9890_rev = {
> + .rev = TFA9890_REVISION,
> + .init = tfa9890_init,
> +};
> +
k
Powered by blists - more mailing lists