Fix n5x6 sound drivers

SVN-Revision: 22776
This commit is contained in:
Lars-Peter Clausen 2010-08-22 23:21:11 +00:00
parent f313fa0bd7
commit b584c5f0f0
2 changed files with 13 additions and 42 deletions

View file

@ -21,7 +21,7 @@ Subject: [PATCH] Add N516 sound SoC board driver
+ tristate "SoC Audio support for Hanvon N516 eBook reader" + tristate "SoC Audio support for Hanvon N516 eBook reader"
+ depends on SND_JZ4740_SOC && JZ4740_N516 + depends on SND_JZ4740_SOC && JZ4740_N516
+ select SND_JZ4740_SOC_I2S + select SND_JZ4740_SOC_I2S
+ select SND_SOC_JZCODEC + select SND_SOC_JZ4740_CODEC
+ help + help
+ Say Y if you want to enable support for SoC audio on the Hanvon N516. + Say Y if you want to enable support for SoC audio on the Hanvon N516.
--- a/sound/soc/jz4740/Makefile --- a/sound/soc/jz4740/Makefile
@ -36,7 +36,7 @@ Subject: [PATCH] Add N516 sound SoC board driver
+obj-$(CONFIG_SND_JZ4740_SOC_N516) += snd-soc-n516.o +obj-$(CONFIG_SND_JZ4740_SOC_N516) += snd-soc-n516.o
--- /dev/null --- /dev/null
+++ b/sound/soc/jz4740/n516.c +++ b/sound/soc/jz4740/n516.c
@@ -0,0 +1,303 @@ @@ -0,0 +1,288 @@
+/* +/*
+ * Copyright (C) 2009, Yauhen Kharuzhy <jekhor@gmail.com> + * Copyright (C) 2009, Yauhen Kharuzhy <jekhor@gmail.com>
+ * OpenInkpot project + * OpenInkpot project
@ -63,7 +63,7 @@ Subject: [PATCH] Add N516 sound SoC board driver
+#include <linux/gpio.h> +#include <linux/gpio.h>
+#include <linux/workqueue.h> +#include <linux/workqueue.h>
+ +
+#include "../codecs/jzcodec.h" +#include "../codecs/jz4740.h"
+#include "jz4740-pcm.h" +#include "jz4740-pcm.h"
+#include "jz4740-i2s.h" +#include "jz4740-i2s.h"
+ +
@ -178,32 +178,18 @@ Subject: [PATCH] Add N516 sound SoC board driver
+{ +{
+ int ret; + int ret;
+ struct snd_soc_dai *cpu_dai = codec->socdev->card->dai_link->cpu_dai; + struct snd_soc_dai *cpu_dai = codec->socdev->card->dai_link->cpu_dai;
+ struct snd_soc_dai *codec_dai = codec->socdev->card->dai_link->codec_dai;
+ +
+ n516_codec = codec; + n516_codec = codec;
+ +
+ snd_soc_dapm_nc_pin(codec, "LIN"); + snd_soc_dapm_nc_pin(codec, "LIN");
+ snd_soc_dapm_nc_pin(codec, "RIN"); + snd_soc_dapm_nc_pin(codec, "RIN");
+ +
+ ret = snd_soc_dai_set_fmt(codec_dai, N516_DAIFMT);
+ if (ret < 0) {
+ dev_err(codec->dev, "Failed to set codec dai format: %d\n", ret);
+ return ret;
+ }
+
+ ret = snd_soc_dai_set_fmt(cpu_dai, N516_DAIFMT); + ret = snd_soc_dai_set_fmt(cpu_dai, N516_DAIFMT);
+ if (ret < 0) { + if (ret < 0) {
+ dev_err(codec->dev, "Failed to set cpu dai format: %d\n", ret); + dev_err(codec->dev, "Failed to set cpu dai format: %d\n", ret);
+ return ret; + return ret;
+ } + }
+ +
+ ret = snd_soc_dai_set_sysclk(codec_dai, JZCODEC_SYSCLK, 111,
+ SND_SOC_CLOCK_IN);
+ if (ret < 0) {
+ dev_err(codec->dev, "Failed to set codec dai sysclk: %d\n", ret);
+ return ret;
+ }
+
+ ret = snd_soc_add_controls(codec, n516_controls, + ret = snd_soc_add_controls(codec, n516_controls,
+ ARRAY_SIZE(n516_controls)); + ARRAY_SIZE(n516_controls));
+ if (ret) { + if (ret) {
@ -211,7 +197,6 @@ Subject: [PATCH] Add N516 sound SoC board driver
+ return ret; + return ret;
+ } + }
+ +
+
+ ret = snd_soc_dapm_new_controls(codec, n516_widgets, + ret = snd_soc_dapm_new_controls(codec, n516_widgets,
+ ARRAY_SIZE(n516_widgets)); + ARRAY_SIZE(n516_widgets));
+ if (ret) { + if (ret) {
@ -232,9 +217,9 @@ Subject: [PATCH] Add N516 sound SoC board driver
+ +
+static struct snd_soc_dai_link n516_dai = { +static struct snd_soc_dai_link n516_dai = {
+ .name = "jz-codec", + .name = "jz-codec",
+ .stream_name = "JZCODEC", + .stream_name = "jz4740",
+ .cpu_dai = &jz4740_i2s_dai, + .cpu_dai = &jz4740_i2s_dai,
+ .codec_dai = &jz_codec_dai, + .codec_dai = &jz4740_codec_dai,
+ .init = n516_codec_init, + .init = n516_codec_init,
+}; +};
+ +
@ -247,7 +232,7 @@ Subject: [PATCH] Add N516 sound SoC board driver
+ +
+static struct snd_soc_device n516_snd_devdata = { +static struct snd_soc_device n516_snd_devdata = {
+ .card = &n516_card, + .card = &n516_card,
+ .codec_dev = &soc_codec_dev_jzcodec, + .codec_dev = &soc_codec_dev_jz4740_codec,
+}; +};
+ +
+static struct platform_device *n516_snd_device; +static struct platform_device *n516_snd_device;

View file

@ -13,7 +13,7 @@ Subject: [PATCH] Add N526 sound SoC board driver
--- a/sound/soc/jz4740/Kconfig --- a/sound/soc/jz4740/Kconfig
+++ b/sound/soc/jz4740/Kconfig +++ b/sound/soc/jz4740/Kconfig
@@ -29,3 +29,11 @@ config SND_JZ4740_SOC_N516 @@ -29,3 +29,11 @@ config SND_JZ4740_SOC_N516
select SND_SOC_JZCODEC select SND_SOC_JZ4740_CODEC
help help
Say Y if you want to enable support for SoC audio on the Hanvon N516. Say Y if you want to enable support for SoC audio on the Hanvon N516.
+ +
@ -21,7 +21,7 @@ Subject: [PATCH] Add N526 sound SoC board driver
+ tristate "SoC Audio support for Hanvon N526 eBook reader" + tristate "SoC Audio support for Hanvon N526 eBook reader"
+ depends on SND_JZ4740_SOC && JZ4740_N526 + depends on SND_JZ4740_SOC && JZ4740_N526
+ select SND_JZ4740_SOC_I2S + select SND_JZ4740_SOC_I2S
+ select SND_SOC_JZCODEC + select SND_SOC_JZ4740_CODEC
+ help + help
+ Say Y if you want to enable support for SoC audio on the Hanvon N526. + Say Y if you want to enable support for SoC audio on the Hanvon N526.
--- a/sound/soc/jz4740/Makefile --- a/sound/soc/jz4740/Makefile
@ -37,7 +37,7 @@ Subject: [PATCH] Add N526 sound SoC board driver
+obj-$(CONFIG_SND_JZ4740_SOC_N526) += snd-soc-n526.o +obj-$(CONFIG_SND_JZ4740_SOC_N526) += snd-soc-n526.o
--- /dev/null --- /dev/null
+++ b/sound/soc/jz4740/n526.c +++ b/sound/soc/jz4740/n526.c
@@ -0,0 +1,169 @@ @@ -0,0 +1,155 @@
+/* +/*
+ * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de> + * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de>
+ * + *
@ -62,7 +62,7 @@ Subject: [PATCH] Add N526 sound SoC board driver
+#include <sound/soc-dapm.h> +#include <sound/soc-dapm.h>
+#include <linux/gpio.h> +#include <linux/gpio.h>
+ +
+#include "../codecs/jzcodec.h" +#include "../codecs/jz4740.h"
+#include "jz4740-pcm.h" +#include "jz4740-pcm.h"
+#include "jz4740-i2s.h" +#include "jz4740-i2s.h"
+ +
@ -101,30 +101,16 @@ Subject: [PATCH] Add N526 sound SoC board driver
+{ +{
+ int ret; + int ret;
+ struct snd_soc_dai *cpu_dai = codec->socdev->card->dai_link->cpu_dai; + struct snd_soc_dai *cpu_dai = codec->socdev->card->dai_link->cpu_dai;
+ struct snd_soc_dai *codec_dai = codec->socdev->card->dai_link->codec_dai;
+ +
+ snd_soc_dapm_nc_pin(codec, "LIN"); + snd_soc_dapm_nc_pin(codec, "LIN");
+ snd_soc_dapm_nc_pin(codec, "RIN"); + snd_soc_dapm_nc_pin(codec, "RIN");
+ +
+ ret = snd_soc_dai_set_fmt(codec_dai, N526_DAIFMT);
+ if (ret < 0) {
+ dev_err(codec->dev, "Failed to set codec dai format: %d\n", ret);
+ return ret;
+ }
+
+ ret = snd_soc_dai_set_fmt(cpu_dai, N526_DAIFMT); + ret = snd_soc_dai_set_fmt(cpu_dai, N526_DAIFMT);
+ if (ret < 0) { + if (ret < 0) {
+ dev_err(codec->dev, "Failed to set cpu dai format: %d\n", ret); + dev_err(codec->dev, "Failed to set cpu dai format: %d\n", ret);
+ return ret; + return ret;
+ } + }
+ +
+ ret = snd_soc_dai_set_sysclk(codec_dai, JZCODEC_SYSCLK, 111,
+ SND_SOC_CLOCK_IN);
+ if (ret < 0) {
+ dev_err(codec->dev, "Failed to set codec dai sysclk: %d\n", ret);
+ return ret;
+ }
+
+ snd_soc_dapm_new_controls(codec, n526_widgets, ARRAY_SIZE(n526_widgets)); + snd_soc_dapm_new_controls(codec, n526_widgets, ARRAY_SIZE(n526_widgets));
+ +
+ snd_soc_add_controls(codec, n526_controls, + snd_soc_add_controls(codec, n526_controls,
@ -139,9 +125,9 @@ Subject: [PATCH] Add N526 sound SoC board driver
+ +
+static struct snd_soc_dai_link n526_dai = { +static struct snd_soc_dai_link n526_dai = {
+ .name = "jz-codec", + .name = "jz-codec",
+ .stream_name = "JZCODEC", + .stream_name = "jz4740",
+ .cpu_dai = &jz4740_i2s_dai, + .cpu_dai = &jz4740_i2s_dai,
+ .codec_dai = &jz_codec_dai, + .codec_dai = &jz4740_codec_dai,
+ .init = n526_codec_init, + .init = n526_codec_init,
+}; +};
+ +
@ -154,7 +140,7 @@ Subject: [PATCH] Add N526 sound SoC board driver
+ +
+static struct snd_soc_device n526_snd_devdata = { +static struct snd_soc_device n526_snd_devdata = {
+ .card = &n526, + .card = &n526,
+ .codec_dev = &soc_codec_dev_jzcodec, + .codec_dev = &soc_codec_dev_jz4740_codec,
+}; +};
+ +
+static struct platform_device *n526_snd_device; +static struct platform_device *n526_snd_device;