devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan@gerhold.net>
To: Alexander Martinz <amartinz@shiftphones.com>
Cc: ~postmarketos/upstreaming@lists.sr.ht,
	phone-devel@vger.kernel.org, Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Caleb Connolly <caleb@connolly.tech>,
	Dylan Van Assche <me@dylanvanassche.be>
Subject: Re: [PATCH 1/2] ASoC: codecs: tfa989x: Add support for tfa9890
Date: Fri, 3 Jun 2022 20:20:28 +0200	[thread overview]
Message-ID: <YppQ7BiqlBDMNsuc@gerhold.net> (raw)
In-Reply-To: <20220602164504.261361-1-amartinz@shiftphones.com>

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@shiftphones.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@gerhold.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

  parent reply	other threads:[~2022-06-03 18:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02 16:45 [PATCH 1/2] ASoC: codecs: tfa989x: Add support for tfa9890 Alexander Martinz
2022-06-02 16:45 ` [PATCH 2/2] ASoC: dt-bindings: nxp,tfa989x: Add tfa9890 support Alexander Martinz
2022-06-03 18:06   ` Stephan Gerhold
2022-06-05 22:44   ` Rob Herring
2022-06-03 18:20 ` Stephan Gerhold [this message]
2022-06-07 10:45 ` [PATCH 1/2] ASoC: codecs: tfa989x: Add support for tfa9890 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=YppQ7BiqlBDMNsuc@gerhold.net \
    --to=stephan@gerhold.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=amartinz@shiftphones.com \
    --cc=broonie@kernel.org \
    --cc=caleb@connolly.tech \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@dylanvanassche.be \
    --cc=perex@perex.cz \
    --cc=phone-devel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tiwai@suse.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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).