diff options
| -rw-r--r-- | Documentation/devicetree/bindings/sound/mxs-audio-sgtl5000.txt | 33 | ||||
| -rw-r--r-- | sound/soc/mxs/mxs-sgtl5000.c | 20 |
2 files changed, 49 insertions, 4 deletions
diff --git a/Documentation/devicetree/bindings/sound/mxs-audio-sgtl5000.txt b/Documentation/devicetree/bindings/sound/mxs-audio-sgtl5000.txt index 601c518eddaa..4eb980bd0287 100644 --- a/Documentation/devicetree/bindings/sound/mxs-audio-sgtl5000.txt +++ b/Documentation/devicetree/bindings/sound/mxs-audio-sgtl5000.txt | |||
| @@ -1,10 +1,31 @@ | |||
| 1 | * Freescale MXS audio complex with SGTL5000 codec | 1 | * Freescale MXS audio complex with SGTL5000 codec |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible: "fsl,mxs-audio-sgtl5000" | 4 | - compatible : "fsl,mxs-audio-sgtl5000" |
| 5 | - model: The user-visible name of this sound complex | 5 | - model : The user-visible name of this sound complex |
| 6 | - saif-controllers: The phandle list of the MXS SAIF controller | 6 | - saif-controllers : The phandle list of the MXS SAIF controller |
| 7 | - audio-codec: The phandle of the SGTL5000 audio codec | 7 | - audio-codec : The phandle of the SGTL5000 audio codec |
| 8 | - audio-routing : A list of the connections between audio components. | ||
| 9 | Each entry is a pair of strings, the first being the | ||
| 10 | connection's sink, the second being the connection's | ||
| 11 | source. Valid names could be power supplies, SGTL5000 | ||
| 12 | pins, and the jacks on the board: | ||
| 13 | |||
| 14 | Power supplies: | ||
| 15 | * Mic Bias | ||
| 16 | |||
| 17 | SGTL5000 pins: | ||
| 18 | * MIC_IN | ||
| 19 | * LINE_IN | ||
| 20 | * HP_OUT | ||
| 21 | * LINE_OUT | ||
| 22 | |||
| 23 | Board connectors: | ||
| 24 | * Mic Jack | ||
| 25 | * Line In Jack | ||
| 26 | * Headphone Jack | ||
| 27 | * Line Out Jack | ||
| 28 | * Ext Spk | ||
| 8 | 29 | ||
| 9 | Example: | 30 | Example: |
| 10 | 31 | ||
| @@ -14,4 +35,8 @@ sound { | |||
| 14 | model = "imx28-evk-sgtl5000"; | 35 | model = "imx28-evk-sgtl5000"; |
| 15 | saif-controllers = <&saif0 &saif1>; | 36 | saif-controllers = <&saif0 &saif1>; |
| 16 | audio-codec = <&sgtl5000>; | 37 | audio-codec = <&sgtl5000>; |
| 38 | audio-routing = | ||
| 39 | "MIC_IN", "Mic Jack", | ||
| 40 | "Mic Jack", "Mic Bias", | ||
| 41 | "Headphone Jack", "HP_OUT"; | ||
| 17 | }; | 42 | }; |
diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c index 2ed3240cc682..b593f76212e0 100644 --- a/sound/soc/mxs/mxs-sgtl5000.c +++ b/sound/soc/mxs/mxs-sgtl5000.c | |||
| @@ -93,6 +93,14 @@ static struct snd_soc_dai_link mxs_sgtl5000_dai[] = { | |||
| 93 | }, | 93 | }, |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | static const struct snd_soc_dapm_widget mxs_sgtl5000_dapm_widgets[] = { | ||
| 97 | SND_SOC_DAPM_MIC("Mic Jack", NULL), | ||
| 98 | SND_SOC_DAPM_LINE("Line In Jack", NULL), | ||
| 99 | SND_SOC_DAPM_HP("Headphone Jack", NULL), | ||
| 100 | SND_SOC_DAPM_SPK("Line Out Jack", NULL), | ||
| 101 | SND_SOC_DAPM_SPK("Ext Spk", NULL), | ||
| 102 | }; | ||
| 103 | |||
| 96 | static struct snd_soc_card mxs_sgtl5000 = { | 104 | static struct snd_soc_card mxs_sgtl5000 = { |
| 97 | .name = "mxs_sgtl5000", | 105 | .name = "mxs_sgtl5000", |
| 98 | .owner = THIS_MODULE, | 106 | .owner = THIS_MODULE, |
| @@ -141,6 +149,18 @@ static int mxs_sgtl5000_probe(struct platform_device *pdev) | |||
| 141 | 149 | ||
| 142 | card->dev = &pdev->dev; | 150 | card->dev = &pdev->dev; |
| 143 | 151 | ||
| 152 | if (of_find_property(np, "audio-routing", NULL)) { | ||
| 153 | card->dapm_widgets = mxs_sgtl5000_dapm_widgets; | ||
| 154 | card->num_dapm_widgets = ARRAY_SIZE(mxs_sgtl5000_dapm_widgets); | ||
| 155 | |||
| 156 | ret = snd_soc_of_parse_audio_routing(card, "audio-routing"); | ||
| 157 | if (ret) { | ||
| 158 | dev_err(&pdev->dev, "failed to parse audio-routing (%d)\n", | ||
| 159 | ret); | ||
| 160 | return ret; | ||
| 161 | } | ||
| 162 | } | ||
| 163 | |||
| 144 | ret = devm_snd_soc_register_card(&pdev->dev, card); | 164 | ret = devm_snd_soc_register_card(&pdev->dev, card); |
| 145 | if (ret) { | 165 | if (ret) { |
| 146 | dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", | 166 | dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", |
