diff options
-rw-r--r-- | include/sound/saif.h | 16 | ||||
-rw-r--r-- | sound/soc/mxs/mxs-saif.c | 44 |
2 files changed, 16 insertions, 44 deletions
diff --git a/include/sound/saif.h b/include/sound/saif.h deleted file mode 100644 index f22f3e16edf4..000000000000 --- a/include/sound/saif.h +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef __SOUND_SAIF_H__ | ||
10 | #define __SOUND_SAIF_H__ | ||
11 | |||
12 | struct mxs_saif_platform_data { | ||
13 | bool master_mode; /* if true use master mode */ | ||
14 | int master_id; /* id of the master if in slave mode */ | ||
15 | }; | ||
16 | #endif | ||
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index 365d9d27a321..752675da0658 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <sound/pcm.h> | 32 | #include <sound/pcm.h> |
33 | #include <sound/pcm_params.h> | 33 | #include <sound/pcm_params.h> |
34 | #include <sound/soc.h> | 34 | #include <sound/soc.h> |
35 | #include <sound/saif.h> | ||
36 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
37 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
38 | #include <mach/mxs.h> | 37 | #include <mach/mxs.h> |
@@ -662,43 +661,32 @@ static int mxs_saif_probe(struct platform_device *pdev) | |||
662 | struct device_node *np = pdev->dev.of_node; | 661 | struct device_node *np = pdev->dev.of_node; |
663 | struct resource *iores, *dmares; | 662 | struct resource *iores, *dmares; |
664 | struct mxs_saif *saif; | 663 | struct mxs_saif *saif; |
665 | struct mxs_saif_platform_data *pdata; | ||
666 | struct pinctrl *pinctrl; | 664 | struct pinctrl *pinctrl; |
667 | int ret = 0; | 665 | int ret = 0; |
666 | struct device_node *master; | ||
668 | 667 | ||
669 | 668 | if (!np) | |
670 | if (!np && pdev->id >= ARRAY_SIZE(mxs_saif)) | ||
671 | return -EINVAL; | 669 | return -EINVAL; |
672 | 670 | ||
673 | saif = devm_kzalloc(&pdev->dev, sizeof(*saif), GFP_KERNEL); | 671 | saif = devm_kzalloc(&pdev->dev, sizeof(*saif), GFP_KERNEL); |
674 | if (!saif) | 672 | if (!saif) |
675 | return -ENOMEM; | 673 | return -ENOMEM; |
676 | 674 | ||
677 | if (np) { | 675 | saif->id = of_alias_get_id(np, "saif"); |
678 | struct device_node *master; | 676 | if (saif->id < 0) |
679 | saif->id = of_alias_get_id(np, "saif"); | 677 | return saif->id; |
680 | if (saif->id < 0) | 678 | /* |
681 | return saif->id; | 679 | * If there is no "fsl,saif-master" phandle, it's a saif |
682 | /* | 680 | * master. Otherwise, it's a slave and its phandle points |
683 | * If there is no "fsl,saif-master" phandle, it's a saif | 681 | * to the master. |
684 | * master. Otherwise, it's a slave and its phandle points | 682 | */ |
685 | * to the master. | 683 | master = of_parse_phandle(np, "fsl,saif-master", 0); |
686 | */ | 684 | if (!master) { |
687 | master = of_parse_phandle(np, "fsl,saif-master", 0); | 685 | saif->master_id = saif->id; |
688 | if (!master) { | ||
689 | saif->master_id = saif->id; | ||
690 | } else { | ||
691 | saif->master_id = of_alias_get_id(master, "saif"); | ||
692 | if (saif->master_id < 0) | ||
693 | return saif->master_id; | ||
694 | } | ||
695 | } else { | 686 | } else { |
696 | saif->id = pdev->id; | 687 | saif->master_id = of_alias_get_id(master, "saif"); |
697 | pdata = pdev->dev.platform_data; | 688 | if (saif->master_id < 0) |
698 | if (pdata && !pdata->master_mode) | 689 | return saif->master_id; |
699 | saif->master_id = pdata->master_id; | ||
700 | else | ||
701 | saif->master_id = saif->id; | ||
702 | } | 690 | } |
703 | 691 | ||
704 | if (saif->master_id < 0 || saif->master_id >= ARRAY_SIZE(mxs_saif)) { | 692 | if (saif->master_id < 0 || saif->master_id >= ARRAY_SIZE(mxs_saif)) { |