lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 28 May 2021 13:53:23 +0200
From:   Stephan Gerhold <stephan@...hold.net>
To:     Vincent Knecht <vincent.knecht@...loo.org>
Cc:     Mark Brown <broonie@...nel.org>, phone-devel@...r.kernel.org,
        ~postmarketos/upstreaming@...ts.sr.ht,
        Liam Girdwood <lgirdwood@...il.com>,
        Rob Herring <robh+dt@...nel.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
Subject: Re: [PATCH v1 2/4] ASoC: codecs: tfa989x: Add support for tfa9897

On Fri, May 28, 2021 at 12:50:59PM +0200, Vincent Knecht wrote:
> Add specific init function to poke needed registers & values for this IC
> 
> Signed-off-by: Vincent Knecht <vincent.knecht@...loo.org>
> ---
>  sound/soc/codecs/tfa989x.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/sound/soc/codecs/tfa989x.c b/sound/soc/codecs/tfa989x.c
> index 408e26eee108..6d94865c534b 100644
> --- a/sound/soc/codecs/tfa989x.c
> +++ b/sound/soc/codecs/tfa989x.c
> @@ -44,6 +44,7 @@
>  #define TFA989X_CURRENTSENSE4		0x49
>  
>  #define TFA9895_REVISION		0x12
> +#define TFA9897_REVISION		0x97
>  
>  struct tfa989x_rev {
>  	unsigned int rev;
> @@ -175,6 +176,29 @@ static const struct tfa989x_rev tfa9895_rev = {
>  	.init	= tfa9895_init,
>  };
>  
> +static int tfa9897_init(struct regmap *regmap)
> +{
> +	int ret;
> +
> +	/* Reduce slewrate by clearing iddqtestbst to avoid booster damage */
> +	ret = regmap_write(regmap, TFA989X_CURRENTSENSE3, 0x0300);
> +	if (ret)
> +		return ret;
> +
> +	/* Enable clipping */
> +	ret = regmap_clear_bits(regmap, TFA989X_CURRENTSENSE4, 0x1);
> +	if (ret)
> +		return ret;
> +
> +	/* Set required TDM configuration */
> +	return regmap_write(regmap, 0x14, 0x0);

For reference:

Sadly we didn't manage to figure out what exactly this register does.
There are several TDM related registers but they are not really
documented. Devices usually have fixed register values specified in some
configuration file, but it's not clear how to set these in a generic way
(e.g. based on dai->set_tdm_slot(), dai->set_tdm_slot() etc).

On the device where we tested TFA9897 it's just used with standard I2S
so we didn't need any special TDM configuration(?). I suppose we can
leave this open for future improvements if someone needs something
different here.

So:
Reviewed-by: Stephan Gerhold <stephan@...hold.net>

Thanks!
Stephan

> +}
> +
> +static const struct tfa989x_rev tfa9897_rev = {
> +	.rev	= TFA9897_REVISION,
> +	.init	= tfa9897_init,
> +};
> +
>  /*
>   * Note: At the moment this driver bypasses the "CoolFlux DSP" built into the
>   * TFA989X amplifiers. Unfortunately, there seems to be absolutely
> @@ -280,6 +304,7 @@ static int tfa989x_i2c_probe(struct i2c_client *i2c)
>  
>  static const struct of_device_id tfa989x_of_match[] = {
>  	{ .compatible = "nxp,tfa9895", .data = &tfa9895_rev },
> +	{ .compatible = "nxp,tfa9897", .data = &tfa9897_rev },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, tfa989x_of_match);
> -- 
> 2.31.1
> 
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ