aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tlv320aic32x4-spi.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sound/soc/codecs/tlv320aic32x4-spi.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/sound/soc/codecs/tlv320aic32x4-spi.c b/sound/soc/codecs/tlv320aic32x4-spi.c
index a22e7700bfc8..03cce8d6404f 100644
--- a/sound/soc/codecs/tlv320aic32x4-spi.c
+++ b/sound/soc/codecs/tlv320aic32x4-spi.c
@@ -16,6 +16,8 @@
#include "tlv320aic32x4.h"
+static const struct of_device_id aic32x4_of_id[];
+
static int aic32x4_spi_probe(struct spi_device *spi)
{
struct regmap *regmap;
@@ -28,24 +30,37 @@ static int aic32x4_spi_probe(struct spi_device *spi)
config.read_flag_mask = 0x01;
regmap = devm_regmap_init_spi(spi, &config);
+
+ if (spi->dev.of_node) {
+ const struct of_device_id *oid;
+
+ oid = of_match_node(aic32x4_of_id, spi->dev.of_node);
+ dev_set_drvdata(&spi->dev, (void *)oid->data);
+ } else {
+ const struct spi_device_id *id_entry;
+
+ id_entry = spi_get_device_id(spi);
+ dev_set_drvdata(&spi->dev, (void *)id_entry->driver_data);
+ }
+
return aic32x4_probe(&spi->dev, regmap);
}
-static int aic32x4_spi_remove(struct spi_device *spi)
+static void aic32x4_spi_remove(struct spi_device *spi)
{
- return aic32x4_remove(&spi->dev);
+ aic32x4_remove(&spi->dev);
}
static const struct spi_device_id aic32x4_spi_id[] = {
- { "tlv320aic32x4", 0 },
- { "tlv320aic32x6", 1 },
+ { "tlv320aic32x4", (kernel_ulong_t)AIC32X4_TYPE_AIC32X4 },
+ { "tlv320aic32x6", (kernel_ulong_t)AIC32X4_TYPE_AIC32X6 },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(spi, aic32x4_spi_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);