summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tlv320aic32x4-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/tlv320aic32x4-i2c.c')
-rw-r--r--sound/soc/codecs/tlv320aic32x4-i2c.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/sound/soc/codecs/tlv320aic32x4-i2c.c b/sound/soc/codecs/tlv320aic32x4-i2c.c
index 6d54cbf70a0b..247fb1e13674 100644
--- a/sound/soc/codecs/tlv320aic32x4-i2c.c
+++ b/sound/soc/codecs/tlv320aic32x4-i2c.c
@@ -16,6 +16,8 @@
#include "tlv320aic32x4.h"
+static const struct of_device_id aic32x4_of_id[];
+
static int aic32x4_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
@@ -27,6 +29,16 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c,
config.val_bits = 8;
regmap = devm_regmap_init_i2c(i2c, &config);
+
+ if (i2c->dev.of_node) {
+ const struct of_device_id *oid;
+
+ oid = of_match_node(aic32x4_of_id, i2c->dev.of_node);
+ dev_set_drvdata(&i2c->dev, (void *)oid->data);
+ } else if (id) {
+ dev_set_drvdata(&i2c->dev, (void *)id->driver_data);
+ }
+
return aic32x4_probe(&i2c->dev, regmap);
}
@@ -36,15 +48,15 @@ static int aic32x4_i2c_remove(struct i2c_client *i2c)
}
static const struct i2c_device_id aic32x4_i2c_id[] = {
- { "tlv320aic32x4", 0 },
- { "tlv320aic32x6", 1 },
+ { "tlv320aic32x4", (kernel_ulong_t)AIC32X4_TYPE_AIC32X4 },
+ { "tlv320aic32x6", (kernel_ulong_t)AIC32X4_TYPE_AIC32X6 },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(i2c, aic32x4_i2c_id);
static const struct of_device_id aic32x4_of_id[] = {
- { .compatible = "ti,tlv320aic32x4", },
- { .compatible = "ti,tlv320aic32x6", },
+ { .compatible = "ti,tlv320aic32x4", .data = (void *)AIC32X4_TYPE_AIC32X4 },
+ { .compatible = "ti,tlv320aic32x6", .data = (void *)AIC32X4_TYPE_AIC32X6 },
{ /* senitel */ }
};
MODULE_DEVICE_TABLE(of, aic32x4_of_id);