Re: [alsa-devel] [PATCH V3 2/2] ASoC: samsung: Add machine driver for Odroid X2/U3

2014-07-14 Thread Daniel Drake
On Thu, Jul 10, 2014 at 5:15 PM, Sylwester Nawrocki
 wrote:
> On 08/07/14 11:15, Daniel Drake wrote:
>> Testing on ODROID-U2, v3 is not quite working for me, but v2 of the
>> patch was fine.
>> I boot up, run:
>> # speaker-test -c 2 -t wav
>>
>> As soon as I hear the word "front" I press ctrl+c and then run the
>> command again.
>> Now the command hangs with no audible output.
>>
>> Any ideas? Let me know if you have trouble reproducing.
>
> I just posted a patch addressing this, please let me know
> if there are any further issues.


Sorry for not testing sooner. Your patch solves the issue.

Thanks
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [alsa-devel] [PATCH V3 2/2] ASoC: samsung: Add machine driver for Odroid X2/U3

2014-07-10 Thread Sylwester Nawrocki
Hi Daniel,

On 08/07/14 11:15, Daniel Drake wrote:
> Testing on ODROID-U2, v3 is not quite working for me, but v2 of the
> patch was fine.
> I boot up, run:
> # speaker-test -c 2 -t wav
> 
> As soon as I hear the word "front" I press ctrl+c and then run the
> command again.
> Now the command hangs with no audible output.
> 
> Any ideas? Let me know if you have trouble reproducing.

I just posted a patch addressing this, please let me know
if there are any further issues.

-- 
Thanks,
Sylwester
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [alsa-devel] [PATCH V3 2/2] ASoC: samsung: Add machine driver for Odroid X2/U3

2014-07-09 Thread Sylwester Nawrocki
Hi,

On 08/07/14 11:15, Daniel Drake wrote:
> On Fri, Jul 4, 2014 at 2:13 PM, Sylwester Nawrocki
>  wrote:
>> This patch adds the sound subsystem driver for Odroid-X2 and
>> Odroid-U3 boards. The codec works in I2S master mode; there
>> are two separate audio routing paths defined, as there are
>> differences in the signal routing between the X2 and U3 boards,
>> i.e. U3 uses single jack for headphones and microphone.
>>
>> Signed-off-by: Chen Zhen 
>> Signed-off-by: Sylwester Nawrocki 
> 
> Testing on ODROID-U2, v3 is not quite working for me, but v2 of the
> patch was fine.
> I boot up, run:
> # speaker-test -c 2 -t wav
> 
> As soon as I hear the word "front" I press ctrl+c and then run the
> command again.
> Now the command hangs with no audible output.
> 
> Any ideas? Let me know if you have trouble reproducing.

Thanks the feedback, we have also noticed this issue.
It sounds like a bug in the Samsung I2S driver, which sets the
CDCLK pin to input mode in the i2s_shutdown callback and never
restores it. AFAICS this setting should not be lost after a call
to struct soc_snd_dai_ops::shutdown().
I'm going will prepare a proper patch soon, until then you could
try and see if this fixes the problem for you:

---8<---
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index d80121e..42c4f3e 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -724,10 +724,6 @@ static void i2s_shutdown(struct snd_pcm_substream 
*substream,

spin_unlock_irqrestore(&lock, flags);

-   /* Gate CDCLK by default */
-   if (!is_opened(other))
-   i2s_set_sysclk(dai, SAMSUNG_I2S_CDCLK,
-   0, SND_SOC_CLOCK_IN);
 }
--->8---

--
Thanks,
Sylwester
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V3 2/2] ASoC: samsung: Add machine driver for Odroid X2/U3

2014-07-08 Thread Daniel Drake
Hi Sylwester,

On Fri, Jul 4, 2014 at 2:13 PM, Sylwester Nawrocki
 wrote:
> This patch adds the sound subsystem driver for Odroid-X2 and
> Odroid-U3 boards. The codec works in I2S master mode; there
> are two separate audio routing paths defined, as there are
> differences in the signal routing between the X2 and U3 boards,
> i.e. U3 uses single jack for headphones and microphone.
>
> Signed-off-by: Chen Zhen 
> Signed-off-by: Sylwester Nawrocki 

Testing on ODROID-U2, v3 is not quite working for me, but v2 of the
patch was fine.
I boot up, run:
# speaker-test -c 2 -t wav

As soon as I hear the word "front" I press ctrl+c and then run the
command again.
Now the command hangs with no audible output.

Any ideas? Let me know if you have trouble reproducing.

Thanks
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V3 2/2] ASoC: samsung: Add machine driver for Odroid X2/U3

2014-07-04 Thread Sylwester Nawrocki
This patch adds the sound subsystem driver for Odroid-X2 and
Odroid-U3 boards. The codec works in I2S master mode; there
are two separate audio routing paths defined, as there are
differences in the signal routing between the X2 and U3 boards,
i.e. U3 uses single jack for headphones and microphone.

Signed-off-by: Chen Zhen 
Signed-off-by: Sylwester Nawrocki 
---
Changes since v2:
 - clock settings moved to late_probe, odroidx2_ops removed;
 - added missing driver.pm ops initialization;
 - minor cleanups.
---
 sound/soc/samsung/Kconfig |8 ++
 sound/soc/samsung/Makefile|2 +
 sound/soc/samsung/odroidx2_max98090.c |  177 +
 3 files changed, 187 insertions(+)
 create mode 100644 sound/soc/samsung/odroidx2_max98090.c

diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig
index 3be49cd..333d645 100644
--- a/sound/soc/samsung/Kconfig
+++ b/sound/soc/samsung/Kconfig
@@ -237,3 +237,11 @@ config SND_SOC_SNOW
help
  Say Y if you want to add audio support for various Snow
  boards based on Exynos5 series of SoCs.
+
+config SND_SOC_ODROIDX2
+   tristate "Audio support for Odroid-X2 and Odroid-U3"
+   depends on SND_SOC_SAMSUNG
+   select SND_SOC_MAX98090
+   select SND_SAMSUNG_I2S
+   help
+ Say Y here to enable audio support for the Odroid-X2/U3.
diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile
index 6469199..e8d9ccd 100644
--- a/sound/soc/samsung/Makefile
+++ b/sound/soc/samsung/Makefile
@@ -44,6 +44,7 @@ snd-soc-tobermory-objs := tobermory.o
 snd-soc-lowland-objs := lowland.o
 snd-soc-littlemill-objs := littlemill.o
 snd-soc-bells-objs := bells.o
+snd-soc-odroidx2-max98090-objs := odroidx2_max98090.o

 obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o
 obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o
@@ -69,3 +70,4 @@ obj-$(CONFIG_SND_SOC_TOBERMORY) += snd-soc-tobermory.o
 obj-$(CONFIG_SND_SOC_LOWLAND) += snd-soc-lowland.o
 obj-$(CONFIG_SND_SOC_LITTLEMILL) += snd-soc-littlemill.o
 obj-$(CONFIG_SND_SOC_BELLS) += snd-soc-bells.o
+obj-$(CONFIG_SND_SOC_ODROIDX2) += snd-soc-odroidx2-max98090.o
diff --git a/sound/soc/samsung/odroidx2_max98090.c 
b/sound/soc/samsung/odroidx2_max98090.c
new file mode 100644
index 000..278edf9
--- /dev/null
+++ b/sound/soc/samsung/odroidx2_max98090.c
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include "i2s.h"
+
+struct odroidx2_drv_data {
+   const struct snd_soc_dapm_widget *dapm_widgets;
+   unsigned int num_dapm_widgets;
+};
+
+/* The I2S CDCLK output clock frequency for the MAX98090 codec */
+#define MAX98090_MCLK 1920
+
+static int odroidx2_late_probe(struct snd_soc_card *card)
+{
+   struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
+   struct snd_soc_dai *cpu_dai = card->rtd[0].cpu_dai;
+   int ret;
+
+   ret = snd_soc_dai_set_sysclk(codec_dai, 0, MAX98090_MCLK,
+   SND_SOC_CLOCK_IN);
+   if (ret < 0)
+   return ret;
+
+   /* Set the cpu DAI configuration in order to use CDCLK */
+   return snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_CDCLK,
+   0, SND_SOC_CLOCK_OUT);
+}
+
+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",
+   .stream_name= "MAX98090 PCM",
+   .codec_dai_name = "HiFi",
+   .dai_fmt= SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM,
+   }
+};
+
+static struct snd_soc_card odroidx2 = {
+   .owner  = THIS_MODULE,
+   .dai_link   = odroidx2_dai,
+   .num_links  = ARRAY_SIZE(odroidx2_dai),
+   .fully_routed   = true,
+   .late_probe = odroidx2_late_probe,
+};
+
+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_widg