summaryrefslogtreecommitdiff
path: root/sound/soc/samsung/i2s.c
diff options
context:
space:
mode:
authorPadmavathi Venna <padma.v@samsung.com>2013-01-18 17:17:00 +0530
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-24 14:40:13 +0800
commit7c62eebbf7d1cdaec68ab9d2d4017007f9312391 (patch)
tree7e8e661b6ffa1e77474ed63f38920db8040dfcf2 /sound/soc/samsung/i2s.c
parent7d1f9aeff1ee4a20b1aeb377dd0f579fe9647619 (diff)
ASoC: samsung: Rename samsung i2s secondary device name
All Samsung SoCs has max 3 i2s controllers. So the i2s secondary fifo interface device id was named as samsung-i2s.4. Renaming this to "samsung-i2s-sec" to support device tree in i2s driver. Signed-off-by: Padmavathi Venna <padma.v@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/samsung/i2s.c')
-rw-r--r--sound/soc/samsung/i2s.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index d2d124f1dd1b..ed5eeae6a48f 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -29,6 +29,11 @@
#define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t)
+enum samsung_dai_type {
+ TYPE_PRI,
+ TYPE_SEC,
+};
+
struct i2s_dai {
/* Platform device for this DAI */
struct platform_device *pdev;
@@ -981,8 +986,7 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS;
} else { /* Create a new platform_device for Secondary */
i2s->pdev = platform_device_register_resndata(NULL,
- pdev->name, pdev->id + SAMSUNG_I2S_SECOFF,
- NULL, 0, NULL, 0);
+ "samsung-i2s-sec", -1, NULL, 0, NULL, 0);
if (IS_ERR(i2s->pdev))
return NULL;
}
@@ -993,6 +997,11 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
return i2s;
}
+static inline int samsung_i2s_get_driver_data(struct platform_device *pdev)
+{
+ return platform_get_device_id(pdev)->driver_data;
+}
+
static int samsung_i2s_probe(struct platform_device *pdev)
{
u32 dma_pl_chan, dma_cp_chan, dma_pl_sec_chan;
@@ -1001,10 +1010,13 @@ static int samsung_i2s_probe(struct platform_device *pdev)
struct samsung_i2s *i2s_cfg;
struct resource *res;
u32 regs_base, quirks;
+ enum samsung_dai_type samsung_dai_type;
int ret = 0;
/* Call during Seconday interface registration */
- if (pdev->id >= SAMSUNG_I2S_SECOFF) {
+ samsung_dai_type = samsung_i2s_get_driver_data(pdev);
+
+ if (samsung_dai_type == TYPE_SEC) {
sec_dai = dev_get_drvdata(&pdev->dev);
snd_soc_register_dai(&sec_dai->pdev->dev,
&sec_dai->i2s_dai_drv);
@@ -1143,9 +1155,22 @@ static int samsung_i2s_remove(struct platform_device *pdev)
return 0;
}
+static struct platform_device_id samsung_i2s_driver_ids[] = {
+ {
+ .name = "samsung-i2s",
+ .driver_data = TYPE_PRI,
+ }, {
+ .name = "samsung-i2s-sec",
+ .driver_data = TYPE_SEC,
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(platform, samsung-i2s-driver-ids);
+
static struct platform_driver samsung_i2s_driver = {
.probe = samsung_i2s_probe,
.remove = samsung_i2s_remove,
+ .id_table = samsung_i2s_driver_ids,
.driver = {
.name = "samsung-i2s",
.owner = THIS_MODULE,