diff options
-rw-r--r-- | include/sound/saif.h | 4 | ||||
-rw-r--r-- | sound/soc/mxs/mxs-saif.c | 20 |
2 files changed, 11 insertions, 13 deletions
diff --git a/include/sound/saif.h b/include/sound/saif.h index d0e0de7984ec..f22f3e16edf4 100644 --- a/include/sound/saif.h +++ b/include/sound/saif.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #define __SOUND_SAIF_H__ | 10 | #define __SOUND_SAIF_H__ |
11 | 11 | ||
12 | struct mxs_saif_platform_data { | 12 | struct mxs_saif_platform_data { |
13 | int (*init) (void); | 13 | bool master_mode; /* if true use master mode */ |
14 | int (*get_master_id) (unsigned int saif_id); | 14 | int master_id; /* id of the master if in slave mode */ |
15 | }; | 15 | }; |
16 | #endif | 16 | #endif |
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index 76dc74d24fc2..1ef697fe1731 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c | |||
@@ -625,13 +625,6 @@ static int mxs_saif_probe(struct platform_device *pdev) | |||
625 | if (pdev->id >= ARRAY_SIZE(mxs_saif)) | 625 | if (pdev->id >= ARRAY_SIZE(mxs_saif)) |
626 | return -EINVAL; | 626 | return -EINVAL; |
627 | 627 | ||
628 | pdata = pdev->dev.platform_data; | ||
629 | if (pdata && pdata->init) { | ||
630 | ret = pdata->init(); | ||
631 | if (ret) | ||
632 | return ret; | ||
633 | } | ||
634 | |||
635 | saif = kzalloc(sizeof(*saif), GFP_KERNEL); | 628 | saif = kzalloc(sizeof(*saif), GFP_KERNEL); |
636 | if (!saif) | 629 | if (!saif) |
637 | return -ENOMEM; | 630 | return -ENOMEM; |
@@ -639,12 +632,17 @@ static int mxs_saif_probe(struct platform_device *pdev) | |||
639 | mxs_saif[pdev->id] = saif; | 632 | mxs_saif[pdev->id] = saif; |
640 | saif->id = pdev->id; | 633 | saif->id = pdev->id; |
641 | 634 | ||
642 | saif->master_id = saif->id; | 635 | pdata = pdev->dev.platform_data; |
643 | if (pdata && pdata->get_master_id) { | 636 | if (pdata && !pdata->master_mode) { |
644 | saif->master_id = pdata->get_master_id(saif->id); | 637 | saif->master_id = pdata->master_id; |
645 | if (saif->master_id < 0 || | 638 | if (saif->master_id < 0 || |
646 | saif->master_id >= ARRAY_SIZE(mxs_saif)) | 639 | saif->master_id >= ARRAY_SIZE(mxs_saif) || |
640 | saif->master_id == saif->id) { | ||
641 | dev_err(&pdev->dev, "get wrong master id\n"); | ||
647 | return -EINVAL; | 642 | return -EINVAL; |
643 | } | ||
644 | } else { | ||
645 | saif->master_id = saif->id; | ||
648 | } | 646 | } |
649 | 647 | ||
650 | saif->clk = clk_get(&pdev->dev, NULL); | 648 | saif->clk = clk_get(&pdev->dev, NULL); |