summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2014-06-12 19:29:44 +0200
committerInki Dae <inki.dae@samsung.com>2014-07-03 09:54:39 +0900
commit34d5ac56133c19b5a6c2a357916ee8cd70ea75af (patch)
treebe2e0cad408d2550fd42f32f5387e7c37dd88889
parent05e3d49278ba0409d288369490bc7a77743f38ea (diff)
downloadlinux-3.10-34d5ac56133c19b5a6c2a357916ee8cd70ea75af.tar.gz
linux-3.10-34d5ac56133c19b5a6c2a357916ee8cd70ea75af.tar.bz2
linux-3.10-34d5ac56133c19b5a6c2a357916ee8cd70ea75af.zip
ASoC: odroidx2_max98090: Support audio routing specified in DT
This patch adds support for specifying the audio routing in device tree. Change-Id: Iebbd8d4dff79afba888f4e7620cbf1f2debc81de Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
-rw-r--r--Documentation/devicetree/bindings/sound/samsung,odroidx2-max98090.txt13
-rw-r--r--sound/soc/samsung/odroidx2_max98090.c58
2 files changed, 64 insertions, 7 deletions
diff --git a/Documentation/devicetree/bindings/sound/samsung,odroidx2-max98090.txt b/Documentation/devicetree/bindings/sound/samsung,odroidx2-max98090.txt
index 7e1d0a7ae4a..e4bb694398a 100644
--- a/Documentation/devicetree/bindings/sound/samsung,odroidx2-max98090.txt
+++ b/Documentation/devicetree/bindings/sound/samsung,odroidx2-max98090.txt
@@ -6,6 +6,19 @@ Required properties:
- samsung,model : the user-visible name of this sound complex.
- samsung,i2s-controller : the phandle of the I2S controller
- samsung,audio-codec : the phandle of the MAX98090 audio codec
+ - samsung,audio-routing : a list of the connections between audio
+ components; each entry is a pair of strings, the first being the
+ connection's sink, the second being the connection's source;
+ valid names for sources and sinks are the MAX98090's pins (as
+ documented in its binding), and the jacks on the board;
+ For Odroid X2:
+ * Headphone Jack
+ * Mic Jack
+ * DMIC
+
+ For Odroid U3:
+ * Headphone Jack
+ * Speakers
Example:
diff --git a/sound/soc/samsung/odroidx2_max98090.c b/sound/soc/samsung/odroidx2_max98090.c
index 6a83f609691..e11ff25b4ff 100644
--- a/sound/soc/samsung/odroidx2_max98090.c
+++ b/sound/soc/samsung/odroidx2_max98090.c
@@ -13,6 +13,11 @@
#include <sound/pcm_params.h>
#include "i2s.h"
+struct odroidx2_drv_data {
+ const struct snd_soc_dapm_widget *dapm_widgets;
+ unsigned int num_dapm_widgets;
+};
+
/* Config I2S CDCLK output 19.2MHZ clock to Max98090 */
#define MAX98090_MCLK 19200000
@@ -49,6 +54,17 @@ static struct snd_soc_ops odroidx2_ops = {
.hw_params = odroidx2_hw_params,
};
+static const struct snd_soc_dapm_widget odroidx2_dapm_widgets[] = {
+ SND_SOC_DAPM_HP("Headphone Jack", NULL),
+ SND_SOC_DAPM_MIC("Mic Jack", NULL),
+ SND_SOC_DAPM_MIC("DMIC", NULL),
+};
+
+static const struct snd_soc_dapm_widget odroidu3_dapm_widgets[] = {
+ SND_SOC_DAPM_HP("Headphone Jack", NULL),
+ SND_SOC_DAPM_SPK("Speakers", NULL),
+};
+
static struct snd_soc_dai_link odroidx2_dai[] = {
{
.name = "MAX98090",
@@ -73,20 +89,55 @@ static struct snd_soc_card odroidx2 = {
.owner = THIS_MODULE,
.dai_link = odroidx2_dai,
.num_links = ARRAY_SIZE(odroidx2_dai),
+ .fully_routed = true,
+};
+
+struct odroidx2_drv_data odroidx2_drvdata = {
+ .dapm_widgets = odroidx2_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(odroidx2_dapm_widgets),
+};
+
+struct odroidx2_drv_data odroidu3_drvdata = {
+ .dapm_widgets = odroidu3_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(odroidu3_dapm_widgets),
+};
+
+static const struct of_device_id odroidx2_audio_of_match[] = {
+ {
+ .compatible = "samsung,odroidx2-audio",
+ .data = &odroidx2_drvdata,
+ }, {
+ .compatible = "samsung,odroidu3-audio",
+ .data = &odroidu3_drvdata,
+ },
+ { },
};
+MODULE_DEVICE_TABLE(of, odroid_audio_of_match);
static int odroidx2_audio_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct snd_soc_card *card = &odroidx2;
+ struct odroidx2_drv_data *dd;
+ const struct of_device_id *of_id;
int ret;
card->dev = &pdev->dev;
+ of_id = of_match_node(odroidx2_audio_of_match, np);
+ dd = (struct odroidx2_drv_data *)of_id->data;
+
+ card->dapm_widgets = dd->dapm_widgets;
+ card->num_dapm_widgets = dd->num_dapm_widgets;
+
ret = snd_soc_of_parse_card_name(card, "samsung,model");
if (ret < 0)
return ret;
+ ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing");
+ if (ret < 0)
+ return ret;
+
odroidx2_dai[0].codec_of_node = of_parse_phandle(np,
"samsung,audio-codec", 0);
if (!odroidx2_dai[0].codec_of_node) {
@@ -136,13 +187,6 @@ static int odroidx2_audio_remove(struct platform_device *pdev)
return 0;
}
-static const struct of_device_id odroidx2_audio_of_match[] = {
- { .compatible = "samsung,odroidx2-audio", },
- { .compatible = "samsung,odroidu3-audio", },
- { },
-};
-MODULE_DEVICE_TABLE(of, odroid_audio_of_match);
-
static struct platform_driver odroidx2_audio_driver = {
.driver = {
.name = "odroidx2-audio",