aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tas5720.c
diff options
context:
space:
mode:
authorAndreas Dannenberg <dannenberg@ti.com>2017-12-11 13:01:55 -0600
committerMark Brown <broonie@kernel.org>2017-12-12 12:03:22 +0000
commitd5eb436acc8104b5c789359aa8c923ff5fafcd62 (patch)
tree1dbbb96bee6e23c1f77c9c9e42ec3da471da9683 /sound/soc/codecs/tas5720.c
parentASoC: tas5720: add basic support for TAS5722 devices (diff)
downloadlinux-dev-d5eb436acc8104b5c789359aa8c923ff5fafcd62.tar.xz
linux-dev-d5eb436acc8104b5c789359aa8c923ff5fafcd62.zip
ASoC: tas5720: add TAS5722 register support
Introduce a custom super-set register map and associated bit definitions to allow driver access to all TAS5722 device functionality. Signed-off-by: Andreas Dannenberg <dannenberg@ti.com> Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/tas5720.c')
-rw-r--r--sound/soc/codecs/tas5720.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c
index 5def54d1336d..f3006f301fe8 100644
--- a/sound/soc/codecs/tas5720.c
+++ b/sound/soc/codecs/tas5720.c
@@ -466,6 +466,15 @@ static const struct regmap_config tas5720_regmap_config = {
.volatile_reg = tas5720_is_volatile_reg,
};
+static const struct regmap_config tas5722_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+
+ .max_register = TAS5722_MAX_REG,
+ .cache_type = REGCACHE_RBTREE,
+ .volatile_reg = tas5720_is_volatile_reg,
+};
+
/*
* DAC analog gain. There are four discrete values to select from, ranging
* from 19.2 dB to 26.3dB.
@@ -564,6 +573,7 @@ static int tas5720_probe(struct i2c_client *client,
{
struct device *dev = &client->dev;
struct tas5720_data *data;
+ const struct regmap_config *regmap_config;
int ret;
int i;
@@ -574,7 +584,18 @@ static int tas5720_probe(struct i2c_client *client,
data->tas5720_client = client;
data->devtype = id->driver_data;
- data->regmap = devm_regmap_init_i2c(client, &tas5720_regmap_config);
+ switch (id->driver_data) {
+ case TAS5720:
+ regmap_config = &tas5720_regmap_config;
+ break;
+ case TAS5722:
+ regmap_config = &tas5722_regmap_config;
+ break;
+ default:
+ dev_err(dev, "unexpected private driver data\n");
+ return -EINVAL;
+ }
+ data->regmap = devm_regmap_init_i2c(client, regmap_config);
if (IS_ERR(data->regmap)) {
ret = PTR_ERR(data->regmap);
dev_err(dev, "failed to allocate register map: %d\n", ret);