summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorVincent Knecht <vincent.knecht@mailoo.org>2021-05-28 12:50:59 +0200
committerMark Brown <broonie@kernel.org>2021-06-02 12:03:30 +0100
commit1ba1d69d8aa938f64cb07604b320a5074c3bb107 (patch)
treed5df01343948756928a33f287ce10a8ed9125925 /sound
parent513df99993857863e42bf3d7d65d87c191ce9493 (diff)
downloadlinux-1ba1d69d8aa938f64cb07604b320a5074c3bb107.tar.bz2
ASoC: codecs: tfa989x: Add support for tfa9897
Add specific init function to poke needed registers & values for this IC Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org> Reviewed-by: Stephan Gerhold <stephan@gerhold.net> Link: https://lore.kernel.org/r/20210528105101.508254-2-vincent.knecht@mailoo.org Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/tfa989x.c25
1 files changed, 25 insertions, 0 deletions
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);
+}
+
+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);