devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] ASoC: samsung: Add HDMI sound support for tm2 board
       [not found] <CGME20180205154421epcas2p16072f713ea81f72b3f8230f6a9d412cf@epcas2p1.samsung.com>
@ 2018-02-05 15:43 ` Sylwester Nawrocki
       [not found]   ` <CGME20180205154511epcas1p14dccb00b68fdb688f2c427c56e01c052@epcas1p1.samsung.com>
                     ` (6 more replies)
  0 siblings, 7 replies; 29+ messages in thread
From: Sylwester Nawrocki @ 2018-02-05 15:43 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, alsa-devel, robh+dt, devicetree, linux-samsung-soc,
	krzk, jcsing.lee, sbkim73, linux-kernel, b.zolnierkie,
	m.szyprowski, Sylwester Nawrocki

This series adds support for HDMI audio on exynos5433 tm2 board, it
includes a few fixes for the I2S driver and an extension of the existing
card driver to support the I2S1<->HDMI transmitter path.

Sylwester Nawrocki (8):
  ASoC: samsung: i2s: Ensure the RCLK rate is properly determined
  ASoC: samsung: i2s: Ensure names of supplied clocks are unique
  ASoC: samsung: i2s: Prevent external abort on exynos5433 I2S1 access
  ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK
  ASoC: samsung: Add support for HDMI audio on TM2 board
  ASoC: samsung: i2s: Update clock-output-names property documentation
  ASoC: samsung: Add missing #sound-dai-cells property documentation
  ASoC: samsung,tm2-audio DT binding documentation update

 .../bindings/sound/samsung,tm2-audio.txt           |  14 +-
 .../devicetree/bindings/sound/samsung-i2s.txt      |  22 +--
 sound/soc/samsung/i2s-regs.h                       |  11 +-
 sound/soc/samsung/i2s.c                            |  50 ++++--
 sound/soc/samsung/i2s.h                            |  11 +-
 sound/soc/samsung/tm2_wm5110.c                     | 180 ++++++++++++++++++---
 6 files changed, 229 insertions(+), 59 deletions(-)

--
2.14.2

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH 1/8] ASoC: samsung: i2s: Ensure the RCLK rate is properly determined
       [not found]     ` <20180205154403.13520-1-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2018-02-05 15:43       ` Sylwester Nawrocki
       [not found]         ` <20180205154403.13520-2-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
  2018-02-12 12:52         ` Applied "ASoC: samsung: i2s: Ensure the RCLK rate is properly determined" to the asoc tree Mark Brown
  2018-02-05 15:43       ` [PATCH 4/8] ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK Sylwester Nawrocki
  1 sibling, 2 replies; 29+ messages in thread
From: Sylwester Nawrocki @ 2018-02-05 15:43 UTC (permalink / raw)
  To: broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
	krzk-DgEjT+Ai2ygdnm+yROfE0A, jcsing.lee-Sze3O3UU22JBDgjK7y7TUQ,
	sbkim73-Sze3O3UU22JBDgjK7y7TUQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ,
	m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ, Sylwester Nawrocki

If the RCLK mux clock configuration is specified in DT and no set_sysclk()
callback is used in the sound card driver the sclk_srcrate field will remain
set to 0, leading to an incorrect PSR divider setting.
To fix this the frequency value is retrieved from the CLK_I2S_RCLK_SRC clock,
so the actual RCLK mux selection is taken into account.

Signed-off-by: Sylwester Nawrocki <s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
 sound/soc/samsung/i2s.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 233f1c9a4b6c..aeba0ae890ea 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -656,8 +656,12 @@ static int i2s_set_fmt(struct snd_soc_dai *dai,
 		tmp |= mod_slave;
 		break;
 	case SND_SOC_DAIFMT_CBS_CFS:
-		/* Set default source clock in Master mode */
-		if (i2s->rclk_srcrate == 0)
+		/*
+		 * Set default source clock in Master mode, only when the
+		 * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any
+		 * clock configuration assigned in DT is not overwritten.
+		 */
+		if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL)
 			i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0,
 							0, SND_SOC_CLOCK_IN);
 		break;
@@ -881,6 +885,11 @@ static int config_setup(struct i2s_dai *i2s)
 		return 0;
 
 	if (!(i2s->quirks & QUIRK_NO_MUXPSR)) {
+		struct clk *rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC];
+
+		if (i2s->rclk_srcrate == 0 && rclksrc && !IS_ERR(rclksrc))
+			i2s->rclk_srcrate = clk_get_rate(rclksrc);
+
 		psr = i2s->rclk_srcrate / i2s->frmclk / rfs;
 		writel(((psr - 1) << 8) | PSR_PSREN, i2s->addr + I2SPSR);
 		dev_dbg(&i2s->pdev->dev,
-- 
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 2/8] ASoC: samsung: i2s: Ensure names of supplied clocks are unique
       [not found]   ` <CGME20180205154511epcas1p14dccb00b68fdb688f2c427c56e01c052@epcas1p1.samsung.com>
@ 2018-02-05 15:43     ` Sylwester Nawrocki
  2018-02-06 12:20       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 29+ messages in thread
From: Sylwester Nawrocki @ 2018-02-05 15:43 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, alsa-devel, robh+dt, devicetree, linux-samsung-soc,
	krzk, jcsing.lee, sbkim73, linux-kernel, b.zolnierkie,
	m.szyprowski, Sylwester Nawrocki

In order to support multiple instances of the I2S IP block the platform
device name is prepended to each clock registered by the driver.
The clock-output-names property is now not used, this should not cause
any issues as, for example, CDCLK clock is referenced through DT 'clocks'
property, not by name.

This change allows to have both I2S0 and I2S1 enabled simultaneously
on exynos5433 and working properly when #clock-cells property is specified
in respective DT nodes.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 sound/soc/samsung/i2s.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index aeba0ae890ea..b7d25a63da8b 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1193,11 +1193,13 @@ static void i2s_unregister_clock_provider(struct platform_device *pdev)
 
 static int i2s_register_clock_provider(struct platform_device *pdev)
 {
-	struct device *dev = &pdev->dev;
-	struct i2s_dai *i2s = dev_get_drvdata(dev);
+	const char * const i2s_clk_desc[] = { "cdclk", "rclk_src", "prescaler" };
 	const char *clk_name[2] = { "i2s_opclk0", "i2s_opclk1" };
 	const char *p_names[2] = { NULL };
+	struct device *dev = &pdev->dev;
+	struct i2s_dai *i2s = dev_get_drvdata(dev);
 	const struct samsung_i2s_variant_regs *reg_info = i2s->variant_regs;
+	const char *i2s_clk_name[ARRAY_SIZE(i2s_clk_desc)];
 	struct clk *rclksrc;
 	int ret, i;
 
@@ -1214,30 +1216,35 @@ static int i2s_register_clock_provider(struct platform_device *pdev)
 		clk_put(rclksrc);
 	}
 
+	for (i = 0; i < ARRAY_SIZE(i2s_clk_desc); i++)
+		i2s_clk_name[i] = devm_kasprintf(dev, GFP_KERNEL, "%s_%s",
+						dev_name(dev), i2s_clk_desc[i]);
+
 	if (!(i2s->quirks & QUIRK_NO_MUXPSR)) {
 		/* Activate the prescaler */
 		u32 val = readl(i2s->addr + I2SPSR);
 		writel(val | PSR_PSREN, i2s->addr + I2SPSR);
 
 		i2s->clk_table[CLK_I2S_RCLK_SRC] = clk_register_mux(dev,
-				"i2s_rclksrc", p_names, ARRAY_SIZE(p_names),
+				i2s_clk_name[CLK_I2S_RCLK_SRC], p_names,
+				ARRAY_SIZE(p_names),
 				CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT,
 				i2s->addr + I2SMOD, reg_info->rclksrc_off,
 				1, 0, i2s->lock);
 
 		i2s->clk_table[CLK_I2S_RCLK_PSR] = clk_register_divider(dev,
-				"i2s_presc", "i2s_rclksrc",
+				i2s_clk_name[CLK_I2S_RCLK_PSR],
+				i2s_clk_name[CLK_I2S_RCLK_SRC],
 				CLK_SET_RATE_PARENT,
 				i2s->addr + I2SPSR, 8, 6, 0, i2s->lock);
 
-		p_names[0] = "i2s_presc";
+		p_names[0] = i2s_clk_name[CLK_I2S_RCLK_PSR];
 		i2s->clk_data.clk_num = 2;
 	}
-	of_property_read_string_index(dev->of_node,
-				"clock-output-names", 0, &clk_name[0]);
 
-	i2s->clk_table[CLK_I2S_CDCLK] = clk_register_gate(dev, clk_name[0],
-				p_names[0], CLK_SET_RATE_PARENT,
+	i2s->clk_table[CLK_I2S_CDCLK] = clk_register_gate(dev,
+				i2s_clk_name[CLK_I2S_CDCLK], p_names[0],
+				CLK_SET_RATE_PARENT,
 				i2s->addr + I2SMOD, reg_info->cdclkcon_off,
 				CLK_GATE_SET_TO_DISABLE, i2s->lock);
 
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 3/8] ASoC: samsung: i2s: Prevent external abort on exynos5433 I2S1 access
       [not found]   ` <CGME20180205154516epcas1p39c5977145e7b32879b935087ee3865f8@epcas1p3.samsung.com>
@ 2018-02-05 15:43     ` Sylwester Nawrocki
  2018-02-06 12:22       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 29+ messages in thread
From: Sylwester Nawrocki @ 2018-02-05 15:43 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, alsa-devel, robh+dt, devicetree, linux-samsung-soc,
	krzk, jcsing.lee, sbkim73, linux-kernel, b.zolnierkie,
	m.szyprowski, Sylwester Nawrocki

It seems both PCLK_I2S1 and SCLK_I2S1 clocks need to be enabled before
I2S1 control registers can be accessed on exynos5433, if SCLK clock
is disabled an exception is triggered. To fix this parent clock of
the RCLK_SRC clock is assigned to pri_dai->op_clk so required gate
clock is handled by the runtime PM ops.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 sound/soc/samsung/i2s.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index b7d25a63da8b..1c05170e4999 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1328,6 +1328,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failed to enable clock: %d\n", ret);
 		return ret;
 	}
+
 	pri_dai->dma_playback.addr = regs_base + I2STXD;
 	pri_dai->dma_capture.addr = regs_base + I2SRXD;
 	pri_dai->dma_playback.chan_name = "tx";
@@ -1401,9 +1402,14 @@ static int samsung_i2s_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 
 	ret = i2s_register_clock_provider(pdev);
-	if (!ret)
-		return 0;
+	if (ret < 0)
+		goto err_disable_pm;
+
+	pri_dai->op_clk = clk_get_parent(pri_dai->clk_table[CLK_I2S_RCLK_SRC]);
+
+	return 0;
 
+err_disable_pm:
 	pm_runtime_disable(&pdev->dev);
 err_disable_clk:
 	clk_disable_unprepare(pri_dai->clk);
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 4/8] ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK
       [not found]     ` <20180205154403.13520-1-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
  2018-02-05 15:43       ` [PATCH 1/8] ASoC: samsung: i2s: Ensure the RCLK rate is properly determined Sylwester Nawrocki
@ 2018-02-05 15:43       ` Sylwester Nawrocki
  2018-02-06 12:26         ` Krzysztof Kozlowski
  2018-02-14 13:29         ` Applied "ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK" to the asoc tree Mark Brown
  1 sibling, 2 replies; 29+ messages in thread
From: Sylwester Nawrocki @ 2018-02-05 15:43 UTC (permalink / raw)
  To: broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
	krzk-DgEjT+Ai2ygdnm+yROfE0A, jcsing.lee-Sze3O3UU22JBDgjK7y7TUQ,
	sbkim73-Sze3O3UU22JBDgjK7y7TUQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ,
	m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ, Sylwester Nawrocki

The SAMSUNG_I2S_OPCLK is not currently used by any card driver thus we can
safely change semantics of 'dir' argument of the I2S set_sysclk() callback.
Now an anumeration is exported instead of directly using register bitfield
values.

Signed-off-by: Sylwester Nawrocki <s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
 sound/soc/samsung/i2s-regs.h | 11 ++++++-----
 sound/soc/samsung/i2s.c      |  2 +-
 sound/soc/samsung/i2s.h      | 11 ++++++++---
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/sound/soc/samsung/i2s-regs.h b/sound/soc/samsung/i2s-regs.h
index fe6914005494..964985ea2e80 100644
--- a/sound/soc/samsung/i2s-regs.h
+++ b/sound/soc/samsung/i2s-regs.h
@@ -65,11 +65,12 @@
 #define CON_RXDMA_ACTIVE	(1 << 1)
 #define CON_ACTIVE		(1 << 0)
 
-#define MOD_OPCLK_CDCLK_OUT	(0 << 30)
-#define MOD_OPCLK_CDCLK_IN	(1 << 30)
-#define MOD_OPCLK_BCLK_OUT	(2 << 30)
-#define MOD_OPCLK_PCLK		(3 << 30)
-#define MOD_OPCLK_MASK		(3 << 30)
+#define MOD_OPCLK_SHIFT		30
+#define MOD_OPCLK_CDCLK_OUT	(0 << MOD_OPCLK_SHIFT)
+#define MOD_OPCLK_CDCLK_IN	(1 << MOD_OPCLK_SHIFT)
+#define MOD_OPCLK_BCLK_OUT	(2 << MOD_OPCLK_SHIFT)
+#define MOD_OPCLK_PCLK		(3 << MOD_OPCLK_SHIFT)
+#define MOD_OPCLK_MASK		(3 << MOD_OPCLK_SHIFT)
 #define MOD_TXS_IDMA		(1 << 28) /* Sec_TXFIFO use I-DMA */
 
 #define MOD_BLCS_SHIFT		26
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 1c05170e4999..6d768cdb4326 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -489,7 +489,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
 	switch (clk_id) {
 	case SAMSUNG_I2S_OPCLK:
 		mask = MOD_OPCLK_MASK;
-		val = dir;
+		val = (dir << MOD_OPCLK_SHIFT) & MOD_OPCLK_MASK;
 		break;
 	case SAMSUNG_I2S_CDCLK:
 		mask = 1 << i2s_regs->cdclkcon_off;
diff --git a/sound/soc/samsung/i2s.h b/sound/soc/samsung/i2s.h
index 79781de2f247..a9832a9555cb 100644
--- a/sound/soc/samsung/i2s.h
+++ b/sound/soc/samsung/i2s.h
@@ -16,11 +16,16 @@
 #define SAMSUNG_I2S_DAI        "samsung-i2s"
 #define SAMSUNG_I2S_DAI_SEC    "samsung-i2s-sec"
 
-#define SAMSUNG_I2S_DIV_BCLK	1
+#define SAMSUNG_I2S_DIV_BCLK		1
 
-#define SAMSUNG_I2S_RCLKSRC_0	0
-#define SAMSUNG_I2S_RCLKSRC_1	1
+#define SAMSUNG_I2S_RCLKSRC_0		0
+#define SAMSUNG_I2S_RCLKSRC_1		1
 #define SAMSUNG_I2S_CDCLK		2
+/* Operation clock for IIS logic */
 #define SAMSUNG_I2S_OPCLK		3
+#define  SAMSUNG_I2S_OPCLK_CDCLK_OUT	0	/* CODEC clock out */
+#define  SAMSUNG_I2S_OPCLK_CDCLK_IN	1	/* CODEC clock in */
+#define  SAMSUNG_I2S_OPCLK_BCLK_OUT	2	/* Bit clock out */
+#define  SAMSUNG_I2S_OPCLK_PCLK		3	/* Audio bus clock */
 
 #endif /* __SND_SOC_SAMSUNG_I2S_H */
-- 
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 5/8] ASoC: samsung: Add support for HDMI audio on TM2 board
       [not found]   ` <CGME20180205154524epcas1p35874552d9056837a162dc59d847d1930@epcas1p3.samsung.com>
@ 2018-02-05 15:44     ` Sylwester Nawrocki
  2018-02-06 12:57       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 29+ messages in thread
From: Sylwester Nawrocki @ 2018-02-05 15:44 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, alsa-devel, robh+dt, devicetree, linux-samsung-soc,
	krzk, jcsing.lee, sbkim73, linux-kernel, b.zolnierkie,
	m.szyprowski, Sylwester Nawrocki

This patch defines I2S1 - HDMI DAI link and implements related
hw_params callback. The AUD PLL frequency is configured through
the CLK_SCLK_I2S1 leaf clock, the exynos5433 clock tree
definitions are updated in a separate patch.

The device tree parsing part is changed is a way it supports older
DTBs with just a single CPU DAI specified, without the HDMI link.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 sound/soc/samsung/tm2_wm5110.c | 180 +++++++++++++++++++++++++++++++++++------
 1 file changed, 157 insertions(+), 23 deletions(-)

diff --git a/sound/soc/samsung/tm2_wm5110.c b/sound/soc/samsung/tm2_wm5110.c
index a55d18703fe7..eafa14a97c61 100644
--- a/sound/soc/samsung/tm2_wm5110.c
+++ b/sound/soc/samsung/tm2_wm5110.c
@@ -34,6 +34,7 @@ struct tm2_machine_priv {
 	struct snd_soc_codec *codec;
 	unsigned int sysclk_rate;
 	struct gpio_desc *gpio_mic_bias;
+	struct clk *sclk_i2s1;
 };
 
 static int tm2_start_sysclk(struct snd_soc_card *card)
@@ -210,6 +211,76 @@ static struct snd_soc_ops tm2_aif2_ops = {
 	.hw_free = tm2_aif2_hw_free,
 };
 
+static int tm2_hdmi_hw_params(struct snd_pcm_substream *substream,
+			      struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct tm2_machine_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	unsigned long fpll;
+	unsigned int bfs;
+	int bitwidth, ret;
+
+	bitwidth = snd_pcm_format_width(params_format(params));
+	if (bitwidth < 0) {
+		dev_err(rtd->card->dev, "Invalid bit-width: %d\n", bitwidth);
+		return bitwidth;
+	}
+
+	switch (bitwidth) {
+	case 48:
+		bfs = 64;
+		break;
+	case 16:
+		bfs = 32;
+		break;
+	default:
+		dev_err(rtd->card->dev, "Unsupported bit-width: %d\n", bitwidth);
+		return -EINVAL;
+	}
+
+	switch (params_rate(params)) {
+	case 32000:
+	case 64000:
+		fpll = 131072006U;
+		break;
+	case 44100:
+	case 88200:
+	case 176400:
+		fpll = 180633609U;
+		break;
+	case 48000:
+	case 96000:
+	case 192000:
+		fpll = 196608001U;
+		break;
+	default:
+		dev_err(rtd->card->dev, "Unsupported sample rate: %d\n",
+			params_rate(params));
+		return -EINVAL;
+	}
+
+	/* Set AUD PLL frequency at least fs * bfs * 8 */
+	ret = clk_set_rate(priv->sclk_i2s1, (fpll + 1) / 2);
+	if (ret < 0)
+		return ret;
+
+	ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_OPCLK,
+					0, SAMSUNG_I2S_OPCLK_PCLK);
+	if (ret < 0)
+		return ret;
+
+	ret = snd_soc_dai_set_clkdiv(cpu_dai, SAMSUNG_I2S_DIV_BCLK, bfs);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
+static struct snd_soc_ops tm2_hdmi_ops = {
+	.hw_params = tm2_hdmi_hw_params,
+};
+
 static int tm2_mic_bias(struct snd_soc_dapm_widget *w,
 				struct snd_kcontrol *kcontrol, int event)
 {
@@ -405,6 +476,12 @@ static struct snd_soc_dai_link tm2_dai_links[] = {
 		.dai_fmt	= SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
 				  SND_SOC_DAIFMT_CBM_CFM,
 		.ignore_suspend = 1,
+	}, {
+		.name		= "HDMI",
+		.stream_name	= "i2s1",
+		.ops		= &tm2_hdmi_ops,
+		.dai_fmt	= SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+				  SND_SOC_DAIFMT_CBS_CFS,
 	}
 };
 
@@ -412,7 +489,6 @@ static struct snd_soc_card tm2_card = {
 	.owner			= THIS_MODULE,
 
 	.dai_link		= tm2_dai_links,
-	.num_links		= ARRAY_SIZE(tm2_dai_links),
 	.controls		= tm2_controls,
 	.num_controls		= ARRAY_SIZE(tm2_controls),
 	.dapm_widgets		= tm2_dapm_widgets,
@@ -426,11 +502,14 @@ static struct snd_soc_card tm2_card = {
 
 static int tm2_probe(struct platform_device *pdev)
 {
+	struct device_node *cpu_dai_node[2] = {};
+	struct device_node *codec_dai_node[2] = {};
+	const char *cells_name = NULL;
 	struct device *dev = &pdev->dev;
 	struct snd_soc_card *card = &tm2_card;
 	struct tm2_machine_priv *priv;
-	struct device_node *cpu_dai_node, *codec_dai_node;
-	int ret, i;
+	struct of_phandle_args args;
+	int num_codecs, ret, i;
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -464,47 +543,102 @@ static int tm2_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	cpu_dai_node = of_parse_phandle(dev->of_node, "i2s-controller", 0);
-	if (!cpu_dai_node) {
-		dev_err(dev, "i2s-controllers property invalid or missing\n");
-		ret = -EINVAL;
-		goto amp_node_put;
+	num_codecs = of_count_phandle_with_args(dev->of_node, "audio-codec",
+						 NULL);
+
+	/* Skip the HDMI link if not specified in DT */
+	if (num_codecs > 1) {
+		card->num_links = ARRAY_SIZE(tm2_dai_links);
+		cells_name = "#sound-dai-cells";
+	} else {
+		card->num_links = ARRAY_SIZE(tm2_dai_links) - 1;
 	}
 
-	codec_dai_node = of_parse_phandle(dev->of_node, "audio-codec", 0);
-	if (!codec_dai_node) {
-		dev_err(dev, "audio-codec property invalid or missing\n");
-		ret = -EINVAL;
-		goto cpu_dai_node_put;
+	for (i = 0; i < num_codecs; i++) {
+		struct of_phandle_args args;
+
+		ret = of_parse_phandle_with_args(dev->of_node, "i2s-controller",
+						 cells_name, i, &args);
+		if (!args.np) {
+			dev_err(dev, "i2s-controller property parse error: %d\n", i);
+			ret = -EINVAL;
+			goto dai_node_put;
+		}
+		cpu_dai_node[i] = args.np;
+
+		codec_dai_node[i] = of_parse_phandle(dev->of_node,
+						     "audio-codec", i);
+		if (!codec_dai_node[i]) {
+			dev_err(dev, "audio-codec property parse error\n");
+			ret = -EINVAL;
+			goto dai_node_put;
+		}
 	}
 
+	/* Initialize WM5110 - I2S and HDMI - I2S1 DAI links */
 	for (i = 0; i < card->num_links; i++) {
+		unsigned int dai_index = 0; /* WM5110 */
+
 		card->dai_link[i].cpu_name = NULL;
 		card->dai_link[i].platform_name = NULL;
-		card->dai_link[i].codec_of_node = codec_dai_node;
-		card->dai_link[i].cpu_of_node = cpu_dai_node;
-		card->dai_link[i].platform_of_node = cpu_dai_node;
+
+		if (num_codecs > 1 && i == card->num_links - 1)
+			dai_index = 1; /* HDMI */
+
+		card->dai_link[i].codec_of_node = codec_dai_node[dai_index];
+		card->dai_link[i].cpu_of_node = cpu_dai_node[dai_index];
+		card->dai_link[i].platform_of_node = cpu_dai_node[dai_index];
+	}
+
+	if (num_codecs > 1) {
+		/* HDMI DAI link (I2S1) */
+		i = card->num_links - 1;
+
+		ret = of_parse_phandle_with_fixed_args(dev->of_node,
+						"audio-codec", 0, 1, &args);
+		if (ret) {
+			dev_err(dev, "audio-codec property parse error\n");
+			goto dai_node_put;
+		}
+
+		ret = snd_soc_get_dai_name(&args, &card->dai_link[i].codec_dai_name);
+		if (ret) {
+			dev_err(dev, "Unable to get codec_dai_name\n");
+			goto dai_node_put;
+		}
+
+		priv->sclk_i2s1 = of_clk_get_by_name(cpu_dai_node[1], "i2s_opclk1");
+		if (IS_ERR(priv->sclk_i2s1)) {
+			ret = PTR_ERR(priv->sclk_i2s1);
+			goto dai_node_put;
+		}
 	}
 
 	ret = devm_snd_soc_register_component(dev, &tm2_component,
 				tm2_ext_dai, ARRAY_SIZE(tm2_ext_dai));
 	if (ret < 0) {
 		dev_err(dev, "Failed to register component: %d\n", ret);
-		goto codec_dai_node_put;
+		goto err_put_sclk;
 	}
 
 	ret = devm_snd_soc_register_card(dev, card);
 	if (ret < 0) {
 		dev_err(dev, "Failed to register card: %d\n", ret);
-		goto codec_dai_node_put;
+		goto err_put_sclk;
+	}
+
+	goto dai_node_put;
+
+err_put_sclk:
+	clk_put(priv->sclk_i2s1);
+dai_node_put:
+	for (i = 0; i < num_codecs; i++) {
+		of_node_put(codec_dai_node[i]);
+		of_node_put(cpu_dai_node[i]);
 	}
 
-codec_dai_node_put:
-	of_node_put(codec_dai_node);
-cpu_dai_node_put:
-	of_node_put(cpu_dai_node);
-amp_node_put:
 	of_node_put(card->aux_dev[0].codec_of_node);
+
 	return ret;
 }
 
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 6/8] ASoC: samsung: i2s: Update clock-output-names property documentation
       [not found]   ` <CGME20180205154529epcas2p3478546ef61294ac06cd9d8ed3d7e12c9@epcas2p3.samsung.com>
@ 2018-02-05 15:44     ` Sylwester Nawrocki
  2018-02-06 12:59       ` Krzysztof Kozlowski
  2018-02-09  2:36       ` Rob Herring
  0 siblings, 2 replies; 29+ messages in thread
From: Sylwester Nawrocki @ 2018-02-05 15:44 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, alsa-devel, robh+dt, devicetree, linux-samsung-soc,
	krzk, jcsing.lee, sbkim73, linux-kernel, b.zolnierkie,
	m.szyprowski, Sylwester Nawrocki

The clock-output-names property is marked as deprecated. While at it,
#clock-cells property's value is corrected in the example snippet
and few typos are fixed.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 .../devicetree/bindings/sound/samsung-i2s.txt          | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/samsung-i2s.txt b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
index bf100cd0d0f7..5d7bb2735824 100644
--- a/Documentation/devicetree/bindings/sound/samsung-i2s.txt
+++ b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
@@ -7,7 +7,7 @@ Required SoC Specific Properties:
    - samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with
      secondary fifo, s/w reset control and internal mux for root clk src.
    - samsung,exynos5420-i2s: for 8/16/24bit multichannel(5.1) I2S for
-     playback, sterio channel capture, secondary fifo using internal
+     playback, stereo channel capture, secondary fifo using internal
      or external dma, s/w reset control, internal mux for root clk src
      and 7.1 channel TDM support for playback. TDM (Time division multiplexing)
      is to allow transfer of multiple channel audio data on single data line.
@@ -25,7 +25,7 @@ Required SoC Specific Properties:
   These strings correspond 1:1 with the ordered pairs in dmas.
 - clocks: Handle to iis clock and RCLK source clk.
 - clock-names:
-  i2s0 uses some base clks from CMU and some are from audio subsystem internal
+  i2s0 uses some base clocks from CMU and some are from audio subsystem internal
   clock controller. The clock names for i2s0 should be "iis", "i2s_opclk0" and
   "i2s_opclk1" as shown in the example below.
   i2s1 and i2s2 uses clocks from CMU. The clock names for i2s1 and i2s2 should
@@ -36,8 +36,8 @@ Required SoC Specific Properties:
 - #clock-cells: should be 1, this property must be present if the I2S device
   is a clock provider in terms of the common clock bindings, described in
   ../clock/clock-bindings.txt.
-- clock-output-names: from the common clock bindings, names of the CDCLK
-  I2S output clocks, suggested values are "i2s_cdclk0", "i2s_cdclk1",
+- clock-output-names (deprecated): from the common clock bindings, names of
+  the CDCLK I2S output clocks, suggested values are "i2s_cdclk0", "i2s_cdclk1",
   "i2s_cdclk3" for the I2S0, I2S1, I2S2 devices recpectively.
 
 There are following clocks available at the I2S device nodes:
@@ -49,9 +49,10 @@ There are following clocks available at the I2S device nodes:
 
 Refer to the SoC datasheet for availability of the above clocks.
 The CLK_I2S_RCLK_PSR and CLK_I2S_RCLK_SRC clocks are usually only available
-in the IIS Multi Audio Interface (I2S0).
-Note: Old DTs may not have the #clock-cells, clock-output-names properties
-and then not use the I2S node as a clock supplier.
+in the IIS Multi Audio Interface.
+
+Note: Old DTs may not have the #clock-cells property and then not use the I2S
+node as a clock supplier.
 
 Optional SoC Specific Properties:
 
@@ -74,8 +75,7 @@ i2s0: i2s@3830000 {
 		<&clock_audss EXYNOS_I2S_BUS>,
 		<&clock_audss EXYNOS_SCLK_I2S>;
 	clock-names = "iis", "i2s_opclk0", "i2s_opclk1";
-	#clock-cells;
-	clock-output-names = "i2s_cdclk0";
+	#clock-cells = <1>;
 	samsung,idma-addr = <0x03000000>;
 	pinctrl-names = "default";
 	pinctrl-0 = <&i2s0_bus>;
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 7/8] ASoC: samsung: Add missing #sound-dai-cells property documentation
       [not found]   ` <CGME20180205154533epcas2p2d0ed58188cf7f29751c08cd804f6fb0d@epcas2p2.samsung.com>
@ 2018-02-05 15:44     ` Sylwester Nawrocki
  2018-02-06 13:02       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 29+ messages in thread
From: Sylwester Nawrocki @ 2018-02-05 15:44 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, alsa-devel, robh+dt, devicetree, linux-samsung-soc,
	krzk, jcsing.lee, sbkim73, linux-kernel, b.zolnierkie,
	m.szyprowski, Sylwester Nawrocki

The #sound-dai-cells property might be helpful in selecting primary
or secondary CPU DAI and it's already present in i2s nodes for some
exynos SoCs so let's add it to the DT binding documentation.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 Documentation/devicetree/bindings/sound/samsung-i2s.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/samsung-i2s.txt b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
index 5d7bb2735824..dd1b6e329941 100644
--- a/Documentation/devicetree/bindings/sound/samsung-i2s.txt
+++ b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
@@ -54,6 +54,9 @@ in the IIS Multi Audio Interface.
 Note: Old DTs may not have the #clock-cells property and then not use the I2S
 node as a clock supplier.
 
+ - #sound-dai-cells: should be 1.
+
+
 Optional SoC Specific Properties:
 
 - samsung,idma-addr: Internal DMA register base address of the audio
@@ -79,4 +82,5 @@ i2s0: i2s@3830000 {
 	samsung,idma-addr = <0x03000000>;
 	pinctrl-names = "default";
 	pinctrl-0 = <&i2s0_bus>;
+	#sound-dai-cells = <1>;
 };
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 8/8] ASoC: samsung,tm2-audio DT binding documentation update
       [not found]   ` <CGME20180205154537epcas1p10a9a30a574e3f472358e7dacf3cb0489@epcas1p1.samsung.com>
@ 2018-02-05 15:44     ` Sylwester Nawrocki
  2018-02-06 13:05       ` Krzysztof Kozlowski
                         ` (2 more replies)
  0 siblings, 3 replies; 29+ messages in thread
From: Sylwester Nawrocki @ 2018-02-05 15:44 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, alsa-devel, robh+dt, devicetree, linux-samsung-soc,
	krzk, jcsing.lee, sbkim73, linux-kernel, b.zolnierkie,
	m.szyprowski, Sylwester Nawrocki

This patch documents additional entries of the audio-codec and
i2s-controller properties required for the HDMI audio support.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 .../devicetree/bindings/sound/samsung,tm2-audio.txt        | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt b/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
index 94442e5673b3..f5ccc12ddc00 100644
--- a/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
+++ b/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
@@ -4,9 +4,13 @@ Required properties:
 
  - compatible		 : "samsung,tm2-audio"
  - model		 : the user-visible name of this sound complex
- - audio-codec		 : the phandle of the wm5110 audio codec node,
-			   as described in ../mfd/arizona.txt
- - i2s-controller	 : the phandle of the I2S controller
+ - audio-codec		 : the first entry should be phandle of the wm5110 audio
+			   codec node, as described in ../mfd/arizona.txt;
+			   the second entry should be phandle of the HDMI
+			   transmitter node
+ - i2s-controller	 : the list of phandle and argument tuples pointing to
+			   I2S controllers, the first entry should be I2S0 and
+			   the second one I2S1
  - audio-amplifier	 : the phandle of the MAX98504 amplifier
  - samsung,audio-routing : a list of the connections between audio components;
 			   each entry is a pair of strings, the first being the
@@ -22,8 +26,8 @@ Example:
 
 sound {
 	compatible = "samsung,tm2-audio";
-	audio-codec = <&wm5110>;
-	i2s-controller = <&i2s0>;
+	audio-codec = <&wm5110>, <&hdmi>;
+	i2s-controller = <&i2s0 0>, <&i2s1 0>;
 	audio-amplifier = <&max98504>;
 	mic-bias-gpios = <&gpr3 2 0>;
 	model = "wm5110";
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [PATCH 1/8] ASoC: samsung: i2s: Ensure the RCLK rate is properly determined
       [not found]         ` <20180205154403.13520-2-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2018-02-06 12:15           ` Krzysztof Kozlowski
  0 siblings, 0 replies; 29+ messages in thread
From: Krzysztof Kozlowski @ 2018-02-06 12:15 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
	jcsing.lee-Sze3O3UU22JBDgjK7y7TUQ,
	sbkim73-Sze3O3UU22JBDgjK7y7TUQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Bartłomiej Żołnierkiewicz, Marek Szyprowski

On Mon, Feb 5, 2018 at 4:43 PM, Sylwester Nawrocki
<s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:
> If the RCLK mux clock configuration is specified in DT and no set_sysclk()
> callback is used in the sound card driver the sclk_srcrate field will remain
> set to 0, leading to an incorrect PSR divider setting.
> To fix this the frequency value is retrieved from the CLK_I2S_RCLK_SRC clock,
> so the actual RCLK mux selection is taken into account.
>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
>  sound/soc/samsung/i2s.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>

Acked-by: Krzysztof Kozlowski <krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 2/8] ASoC: samsung: i2s: Ensure names of supplied clocks are unique
  2018-02-05 15:43     ` [PATCH 2/8] ASoC: samsung: i2s: Ensure names of supplied clocks are unique Sylwester Nawrocki
@ 2018-02-06 12:20       ` Krzysztof Kozlowski
  2018-02-07 15:20         ` Sylwester Nawrocki
  0 siblings, 1 reply; 29+ messages in thread
From: Krzysztof Kozlowski @ 2018-02-06 12:20 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: broonie, lgirdwood, alsa-devel, robh+dt, devicetree,
	linux-samsung-soc, jcsing.lee, sbkim73, linux-kernel,
	Bartłomiej Żołnierkiewicz, Marek Szyprowski

On Mon, Feb 5, 2018 at 4:43 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> In order to support multiple instances of the I2S IP block the platform
> device name is prepended to each clock registered by the driver.
> The clock-output-names property is now not used, this should not cause
> any issues as, for example, CDCLK clock is referenced through DT 'clocks'
> property, not by name.
>
> This change allows to have both I2S0 and I2S1 enabled simultaneously
> on exynos5433 and working properly when #clock-cells property is specified
> in respective DT nodes.
>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  sound/soc/samsung/i2s.c | 25 ++++++++++++++++---------
>  1 file changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
> index aeba0ae890ea..b7d25a63da8b 100644
> --- a/sound/soc/samsung/i2s.c
> +++ b/sound/soc/samsung/i2s.c
> @@ -1193,11 +1193,13 @@ static void i2s_unregister_clock_provider(struct platform_device *pdev)
>
>  static int i2s_register_clock_provider(struct platform_device *pdev)
>  {
> -       struct device *dev = &pdev->dev;
> -       struct i2s_dai *i2s = dev_get_drvdata(dev);
> +       const char * const i2s_clk_desc[] = { "cdclk", "rclk_src", "prescaler" };
>         const char *clk_name[2] = { "i2s_opclk0", "i2s_opclk1" };
>         const char *p_names[2] = { NULL };
> +       struct device *dev = &pdev->dev;
> +       struct i2s_dai *i2s = dev_get_drvdata(dev);
>         const struct samsung_i2s_variant_regs *reg_info = i2s->variant_regs;
> +       const char *i2s_clk_name[ARRAY_SIZE(i2s_clk_desc)];
>         struct clk *rclksrc;
>         int ret, i;
>
> @@ -1214,30 +1216,35 @@ static int i2s_register_clock_provider(struct platform_device *pdev)
>                 clk_put(rclksrc);
>         }
>
> +       for (i = 0; i < ARRAY_SIZE(i2s_clk_desc); i++)
> +               i2s_clk_name[i] = devm_kasprintf(dev, GFP_KERNEL, "%s_%s",
> +                                               dev_name(dev), i2s_clk_desc[i]);

kasprintf() might return NULL and later it is being used as clock
name. I think you should handle such error.

Best regards,
Krzysztof

> +
>         if (!(i2s->quirks & QUIRK_NO_MUXPSR)) {
>                 /* Activate the prescaler */
>                 u32 val = readl(i2s->addr + I2SPSR);
>                 writel(val | PSR_PSREN, i2s->addr + I2SPSR);
>
>                 i2s->clk_table[CLK_I2S_RCLK_SRC] = clk_register_mux(dev,
> -                               "i2s_rclksrc", p_names, ARRAY_SIZE(p_names),
> +                               i2s_clk_name[CLK_I2S_RCLK_SRC], p_names,
> +                               ARRAY_SIZE(p_names),
>                                 CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT,
>                                 i2s->addr + I2SMOD, reg_info->rclksrc_off,
>                                 1, 0, i2s->lock);
>
>                 i2s->clk_table[CLK_I2S_RCLK_PSR] = clk_register_divider(dev,
> -                               "i2s_presc", "i2s_rclksrc",
> +                               i2s_clk_name[CLK_I2S_RCLK_PSR],
> +                               i2s_clk_name[CLK_I2S_RCLK_SRC],
>                                 CLK_SET_RATE_PARENT,
>                                 i2s->addr + I2SPSR, 8, 6, 0, i2s->lock);
>
> -               p_names[0] = "i2s_presc";
> +               p_names[0] = i2s_clk_name[CLK_I2S_RCLK_PSR];
>                 i2s->clk_data.clk_num = 2;
>         }
> -       of_property_read_string_index(dev->of_node,
> -                               "clock-output-names", 0, &clk_name[0]);
>
> -       i2s->clk_table[CLK_I2S_CDCLK] = clk_register_gate(dev, clk_name[0],
> -                               p_names[0], CLK_SET_RATE_PARENT,
> +       i2s->clk_table[CLK_I2S_CDCLK] = clk_register_gate(dev,
> +                               i2s_clk_name[CLK_I2S_CDCLK], p_names[0],
> +                               CLK_SET_RATE_PARENT,
>                                 i2s->addr + I2SMOD, reg_info->cdclkcon_off,
>                                 CLK_GATE_SET_TO_DISABLE, i2s->lock);
>
> --
> 2.14.2
>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 3/8] ASoC: samsung: i2s: Prevent external abort on exynos5433 I2S1 access
  2018-02-05 15:43     ` [PATCH 3/8] ASoC: samsung: i2s: Prevent external abort on exynos5433 I2S1 access Sylwester Nawrocki
@ 2018-02-06 12:22       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 29+ messages in thread
From: Krzysztof Kozlowski @ 2018-02-06 12:22 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: devicetree, alsa-devel, linux-samsung-soc,
	Bartłomiej Żołnierkiewicz, sbkim73, jcsing.lee,
	lgirdwood, robh+dt, linux-kernel, broonie, Marek Szyprowski

On Mon, Feb 5, 2018 at 4:43 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> It seems both PCLK_I2S1 and SCLK_I2S1 clocks need to be enabled before
> I2S1 control registers can be accessed on exynos5433, if SCLK clock

Full stop before "if"?

> is disabled an exception is triggered. To fix this parent clock of
> the RCLK_SRC clock is assigned to pri_dai->op_clk so required gate
> clock is handled by the runtime PM ops.
>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  sound/soc/samsung/i2s.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
> index b7d25a63da8b..1c05170e4999 100644
> --- a/sound/soc/samsung/i2s.c
> +++ b/sound/soc/samsung/i2s.c
> @@ -1328,6 +1328,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
>                 dev_err(&pdev->dev, "failed to enable clock: %d\n", ret);
>                 return ret;
>         }
> +

This should not be part of this patch. Beside that looks okay.

Best regards,
Krzysztof

>         pri_dai->dma_playback.addr = regs_base + I2STXD;
>         pri_dai->dma_capture.addr = regs_base + I2SRXD;
>         pri_dai->dma_playback.chan_name = "tx";
> @@ -1401,9 +1402,14 @@ static int samsung_i2s_probe(struct platform_device *pdev)
>         pm_runtime_enable(&pdev->dev);
>
>         ret = i2s_register_clock_provider(pdev);
> -       if (!ret)
> -               return 0;
> +       if (ret < 0)
> +               goto err_disable_pm;
> +
> +       pri_dai->op_clk = clk_get_parent(pri_dai->clk_table[CLK_I2S_RCLK_SRC]);
> +
> +       return 0;
>
> +err_disable_pm:
>         pm_runtime_disable(&pdev->dev);
>  err_disable_clk:
>         clk_disable_unprepare(pri_dai->clk);
> --
> 2.14.2
>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 4/8] ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK
  2018-02-05 15:43       ` [PATCH 4/8] ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK Sylwester Nawrocki
@ 2018-02-06 12:26         ` Krzysztof Kozlowski
  2018-02-07 16:23           ` Sylwester Nawrocki
  2018-02-14 13:29         ` Applied "ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK" to the asoc tree Mark Brown
  1 sibling, 1 reply; 29+ messages in thread
From: Krzysztof Kozlowski @ 2018-02-06 12:26 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: devicetree, alsa-devel, linux-samsung-soc,
	Bartłomiej Żołnierkiewicz, sbkim73, jcsing.lee,
	lgirdwood, robh+dt, linux-kernel, broonie, Marek Szyprowski

On Mon, Feb 5, 2018 at 4:43 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> The SAMSUNG_I2S_OPCLK is not currently used by any card driver thus we can
> safely change semantics of 'dir' argument of the I2S set_sysclk() callback.
> Now an anumeration is exported instead of directly using register bitfield
> values.
>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  sound/soc/samsung/i2s-regs.h | 11 ++++++-----
>  sound/soc/samsung/i2s.c      |  2 +-
>  sound/soc/samsung/i2s.h      | 11 ++++++++---
>  3 files changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/sound/soc/samsung/i2s-regs.h b/sound/soc/samsung/i2s-regs.h
> index fe6914005494..964985ea2e80 100644
> --- a/sound/soc/samsung/i2s-regs.h
> +++ b/sound/soc/samsung/i2s-regs.h
> @@ -65,11 +65,12 @@
>  #define CON_RXDMA_ACTIVE       (1 << 1)
>  #define CON_ACTIVE             (1 << 0)
>
> -#define MOD_OPCLK_CDCLK_OUT    (0 << 30)
> -#define MOD_OPCLK_CDCLK_IN     (1 << 30)
> -#define MOD_OPCLK_BCLK_OUT     (2 << 30)
> -#define MOD_OPCLK_PCLK         (3 << 30)
> -#define MOD_OPCLK_MASK         (3 << 30)
> +#define MOD_OPCLK_SHIFT                30
> +#define MOD_OPCLK_CDCLK_OUT    (0 << MOD_OPCLK_SHIFT)
> +#define MOD_OPCLK_CDCLK_IN     (1 << MOD_OPCLK_SHIFT)
> +#define MOD_OPCLK_BCLK_OUT     (2 << MOD_OPCLK_SHIFT)
> +#define MOD_OPCLK_PCLK         (3 << MOD_OPCLK_SHIFT)
> +#define MOD_OPCLK_MASK         (3 << MOD_OPCLK_SHIFT)
>  #define MOD_TXS_IDMA           (1 << 28) /* Sec_TXFIFO use I-DMA */
>
>  #define MOD_BLCS_SHIFT         26
> diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
> index 1c05170e4999..6d768cdb4326 100644
> --- a/sound/soc/samsung/i2s.c
> +++ b/sound/soc/samsung/i2s.c
> @@ -489,7 +489,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
>         switch (clk_id) {
>         case SAMSUNG_I2S_OPCLK:
>                 mask = MOD_OPCLK_MASK;
> -               val = dir;
> +               val = (dir << MOD_OPCLK_SHIFT) & MOD_OPCLK_MASK;
>                 break;
>         case SAMSUNG_I2S_CDCLK:
>                 mask = 1 << i2s_regs->cdclkcon_off;
> diff --git a/sound/soc/samsung/i2s.h b/sound/soc/samsung/i2s.h
> index 79781de2f247..a9832a9555cb 100644
> --- a/sound/soc/samsung/i2s.h
> +++ b/sound/soc/samsung/i2s.h
> @@ -16,11 +16,16 @@
>  #define SAMSUNG_I2S_DAI        "samsung-i2s"
>  #define SAMSUNG_I2S_DAI_SEC    "samsung-i2s-sec"
>
> -#define SAMSUNG_I2S_DIV_BCLK   1
> +#define SAMSUNG_I2S_DIV_BCLK           1
>
> -#define SAMSUNG_I2S_RCLKSRC_0  0
> -#define SAMSUNG_I2S_RCLKSRC_1  1
> +#define SAMSUNG_I2S_RCLKSRC_0          0
> +#define SAMSUNG_I2S_RCLKSRC_1          1
>  #define SAMSUNG_I2S_CDCLK              2
> +/* Operation clock for IIS logic */
>  #define SAMSUNG_I2S_OPCLK              3
> +#define  SAMSUNG_I2S_OPCLK_CDCLK_OUT   0       /* CODEC clock out */
> +#define  SAMSUNG_I2S_OPCLK_CDCLK_IN    1       /* CODEC clock in */
> +#define  SAMSUNG_I2S_OPCLK_BCLK_OUT    2       /* Bit clock out */
> +#define  SAMSUNG_I2S_OPCLK_PCLK                3       /* Audio bus clock */
>
>  #endif /* __SND_SOC_SAMSUNG_I2S_H */

This part of patch seems to be unrelated (and it includes some cleanups).

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 5/8] ASoC: samsung: Add support for HDMI audio on TM2 board
  2018-02-05 15:44     ` [PATCH 5/8] ASoC: samsung: Add support for HDMI audio on TM2 board Sylwester Nawrocki
@ 2018-02-06 12:57       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 29+ messages in thread
From: Krzysztof Kozlowski @ 2018-02-06 12:57 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: devicetree, alsa-devel, linux-samsung-soc,
	Bartłomiej Żołnierkiewicz, sbkim73, jcsing.lee,
	lgirdwood, robh+dt, linux-kernel, broonie, Marek Szyprowski

On Mon, Feb 5, 2018 at 4:44 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> This patch defines I2S1 - HDMI DAI link and implements related
> hw_params callback. The AUD PLL frequency is configured through
> the CLK_SCLK_I2S1 leaf clock, the exynos5433 clock tree
> definitions are updated in a separate patch.
>
> The device tree parsing part is changed is a way it supports older
> DTBs with just a single CPU DAI specified, without the HDMI link.
>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  sound/soc/samsung/tm2_wm5110.c | 180 +++++++++++++++++++++++++++++++++++------
>  1 file changed, 157 insertions(+), 23 deletions(-)
>

Looks okay for me but the bindings should be also updated.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 6/8] ASoC: samsung: i2s: Update clock-output-names property documentation
  2018-02-05 15:44     ` [PATCH 6/8] ASoC: samsung: i2s: Update clock-output-names property documentation Sylwester Nawrocki
@ 2018-02-06 12:59       ` Krzysztof Kozlowski
  2018-02-06 12:59         ` Krzysztof Kozlowski
  2018-02-09  2:36       ` Rob Herring
  1 sibling, 1 reply; 29+ messages in thread
From: Krzysztof Kozlowski @ 2018-02-06 12:59 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: devicetree, alsa-devel, linux-samsung-soc,
	Bartłomiej Żołnierkiewicz, sbkim73, jcsing.lee,
	lgirdwood, robh+dt, linux-kernel, broonie, Marek Szyprowski

On Mon, Feb 5, 2018 at 4:44 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> The clock-output-names property is marked as deprecated. While at it,
> #clock-cells property's value is corrected in the example snippet
> and few typos are fixed.
>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  .../devicetree/bindings/sound/samsung-i2s.txt          | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)

As with all bindings, this should go before changing the driver.


>
> diff --git a/Documentation/devicetree/bindings/sound/samsung-i2s.txt b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
> index bf100cd0d0f7..5d7bb2735824 100644
> --- a/Documentation/devicetree/bindings/sound/samsung-i2s.txt
> +++ b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
> @@ -7,7 +7,7 @@ Required SoC Specific Properties:
>     - samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with
>       secondary fifo, s/w reset control and internal mux for root clk src.
>     - samsung,exynos5420-i2s: for 8/16/24bit multichannel(5.1) I2S for
> -     playback, sterio channel capture, secondary fifo using internal
> +     playback, stereo channel capture, secondary fifo using internal
>       or external dma, s/w reset control, internal mux for root clk src
>       and 7.1 channel TDM support for playback. TDM (Time division multiplexing)
>       is to allow transfer of multiple channel audio data on single data line.
> @@ -25,7 +25,7 @@ Required SoC Specific Properties:
>    These strings correspond 1:1 with the ordered pairs in dmas.
>  - clocks: Handle to iis clock and RCLK source clk.
>  - clock-names:
> -  i2s0 uses some base clks from CMU and some are from audio subsystem internal
> +  i2s0 uses some base clocks from CMU and some are from audio subsystem internal
>    clock controller. The clock names for i2s0 should be "iis", "i2s_opclk0" and
>    "i2s_opclk1" as shown in the example below.
>    i2s1 and i2s2 uses clocks from CMU. The clock names for i2s1 and i2s2 should
> @@ -36,8 +36,8 @@ Required SoC Specific Properties:
>  - #clock-cells: should be 1, this property must be present if the I2S device
>    is a clock provider in terms of the common clock bindings, described in
>    ../clock/clock-bindings.txt.
> -- clock-output-names: from the common clock bindings, names of the CDCLK
> -  I2S output clocks, suggested values are "i2s_cdclk0", "i2s_cdclk1",
> +- clock-output-names (deprecated): from the common clock bindings, names of
> +  the CDCLK I2S output clocks, suggested values are "i2s_cdclk0", "i2s_cdclk1",
>    "i2s_cdclk3" for the I2S0, I2S1, I2S2 devices recpectively.
>
>  There are following clocks available at the I2S device nodes:
> @@ -49,9 +49,10 @@ There are following clocks available at the I2S device nodes:
>
>  Refer to the SoC datasheet for availability of the above clocks.
>  The CLK_I2S_RCLK_PSR and CLK_I2S_RCLK_SRC clocks are usually only available
> -in the IIS Multi Audio Interface (I2S0).
> -Note: Old DTs may not have the #clock-cells, clock-output-names properties
> -and then not use the I2S node as a clock supplier.
> +in the IIS Multi Audio Interface.
> +
> +Note: Old DTs may not have the #clock-cells property and then not use the I2S
> +node as a clock supplier.
>
>  Optional SoC Specific Properties:
>
> @@ -74,8 +75,7 @@ i2s0: i2s@3830000 {
>                 <&clock_audss EXYNOS_I2S_BUS>,
>                 <&clock_audss EXYNOS_SCLK_I2S>;
>         clock-names = "iis", "i2s_opclk0", "i2s_opclk1";
> -       #clock-cells;
> -       clock-output-names = "i2s_cdclk0";
> +       #clock-cells = <1>;
>         samsung,idma-addr = <0x03000000>;
>         pinctrl-names = "default";
>         pinctrl-0 = <&i2s0_bus>;
> --
> 2.14.2
>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 6/8] ASoC: samsung: i2s: Update clock-output-names property documentation
  2018-02-06 12:59       ` Krzysztof Kozlowski
@ 2018-02-06 12:59         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 29+ messages in thread
From: Krzysztof Kozlowski @ 2018-02-06 12:59 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: devicetree, alsa-devel, linux-samsung-soc,
	Bartłomiej Żołnierkiewicz, sbkim73, jcsing.lee,
	lgirdwood, robh+dt, linux-kernel, broonie, Marek Szyprowski

On Tue, Feb 6, 2018 at 1:59 PM, Krzysztof Kozlowski <krzk@kernel.org> wrote:
> On Mon, Feb 5, 2018 at 4:44 PM, Sylwester Nawrocki
> <s.nawrocki@samsung.com> wrote:
>> The clock-output-names property is marked as deprecated. While at it,
>> #clock-cells property's value is corrected in the example snippet
>> and few typos are fixed.
>>
>> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
>> ---
>>  .../devicetree/bindings/sound/samsung-i2s.txt          | 18 +++++++++---------
>>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> As with all bindings, this should go before changing the driver.

Ah, too fast in pressing return. I missed:
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 7/8] ASoC: samsung: Add missing #sound-dai-cells property documentation
  2018-02-05 15:44     ` [PATCH 7/8] ASoC: samsung: Add missing #sound-dai-cells " Sylwester Nawrocki
@ 2018-02-06 13:02       ` Krzysztof Kozlowski
  2018-02-07 16:37         ` Sylwester Nawrocki
  0 siblings, 1 reply; 29+ messages in thread
From: Krzysztof Kozlowski @ 2018-02-06 13:02 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: broonie, lgirdwood, alsa-devel, robh+dt, devicetree,
	linux-samsung-soc, jcsing.lee, sbkim73, linux-kernel,
	Bartłomiej Żołnierkiewicz, Marek Szyprowski

On Mon, Feb 5, 2018 at 4:44 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> The #sound-dai-cells property might be helpful in selecting primary
> or secondary CPU DAI and it's already present in i2s nodes for some
> exynos SoCs so let's add it to the DT binding documentation.

The description above looks like you are documenting existing optional
property but you added it as a required property.

Best regards,
Krzysztof

>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  Documentation/devicetree/bindings/sound/samsung-i2s.txt | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/sound/samsung-i2s.txt b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
> index 5d7bb2735824..dd1b6e329941 100644
> --- a/Documentation/devicetree/bindings/sound/samsung-i2s.txt
> +++ b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
> @@ -54,6 +54,9 @@ in the IIS Multi Audio Interface.
>  Note: Old DTs may not have the #clock-cells property and then not use the I2S
>  node as a clock supplier.
>
> + - #sound-dai-cells: should be 1.
> +
> +
>  Optional SoC Specific Properties:
>
>  - samsung,idma-addr: Internal DMA register base address of the audio
> @@ -79,4 +82,5 @@ i2s0: i2s@3830000 {
>         samsung,idma-addr = <0x03000000>;
>         pinctrl-names = "default";
>         pinctrl-0 = <&i2s0_bus>;
> +       #sound-dai-cells = <1>;
>  };
> --
> 2.14.2
>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 8/8] ASoC: samsung,tm2-audio DT binding documentation update
  2018-02-05 15:44     ` [PATCH 8/8] ASoC: samsung,tm2-audio DT binding documentation update Sylwester Nawrocki
@ 2018-02-06 13:05       ` Krzysztof Kozlowski
       [not found]         ` <CAJKOXPeRFgJQpUTeJeYYo+qqAxkT1iZczSJQzRzn3O3bXmvOZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2018-02-09  2:39       ` Rob Herring
  2018-02-14 13:29       ` Applied "ASoC: samsung,tm2-audio DT binding documentation update" to the asoc tree Mark Brown
  2 siblings, 1 reply; 29+ messages in thread
From: Krzysztof Kozlowski @ 2018-02-06 13:05 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: broonie, lgirdwood, alsa-devel, robh+dt, devicetree,
	linux-samsung-soc, jcsing.lee, sbkim73, linux-kernel,
	Bartłomiej Żołnierkiewicz, Marek Szyprowski

On Mon, Feb 5, 2018 at 4:44 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> This patch documents additional entries of the audio-codec and
> i2s-controller properties required for the HDMI audio support.
>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  .../devicetree/bindings/sound/samsung,tm2-audio.txt        | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt b/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
> index 94442e5673b3..f5ccc12ddc00 100644
> --- a/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
> +++ b/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
> @@ -4,9 +4,13 @@ Required properties:
>
>   - compatible           : "samsung,tm2-audio"
>   - model                : the user-visible name of this sound complex
> - - audio-codec          : the phandle of the wm5110 audio codec node,
> -                          as described in ../mfd/arizona.txt
> - - i2s-controller       : the phandle of the I2S controller
> + - audio-codec          : the first entry should be phandle of the wm5110 audio
> +                          codec node, as described in ../mfd/arizona.txt;
> +                          the second entry should be phandle of the HDMI

AFAIU, this property is still optional so the wording should be
different. Maybe just add "optional properties" paragraph?

Best regards,
Krzysztof

> +                          transmitter node
> + - i2s-controller       : the list of phandle and argument tuples pointing to
> +                          I2S controllers, the first entry should be I2S0 and
> +                          the second one I2S1
>   - audio-amplifier      : the phandle of the MAX98504 amplifier
>   - samsung,audio-routing : a list of the connections between audio components;
>                            each entry is a pair of strings, the first being the
> @@ -22,8 +26,8 @@ Example:
>
>  sound {
>         compatible = "samsung,tm2-audio";
> -       audio-codec = <&wm5110>;
> -       i2s-controller = <&i2s0>;
> +       audio-codec = <&wm5110>, <&hdmi>;
> +       i2s-controller = <&i2s0 0>, <&i2s1 0>;
>         audio-amplifier = <&max98504>;
>         mic-bias-gpios = <&gpr3 2 0>;
>         model = "wm5110";
> --
> 2.14.2
>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 2/8] ASoC: samsung: i2s: Ensure names of supplied clocks are unique
  2018-02-06 12:20       ` Krzysztof Kozlowski
@ 2018-02-07 15:20         ` Sylwester Nawrocki
  0 siblings, 0 replies; 29+ messages in thread
From: Sylwester Nawrocki @ 2018-02-07 15:20 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: broonie, lgirdwood, alsa-devel, robh+dt, devicetree,
	linux-samsung-soc, jcsing.lee, sbkim73, linux-kernel,
	Bartłomiej Żołnierkiewicz, Marek Szyprowski

On 02/06/2018 01:20 PM, Krzysztof Kozlowski wrote:
>> @@ -1214,30 +1216,35 @@ static int i2s_register_clock_provider(struct platform_device *pdev)
>>                 clk_put(rclksrc);
>>         }
>>
>> +       for (i = 0; i < ARRAY_SIZE(i2s_clk_desc); i++)
>> +               i2s_clk_name[i] = devm_kasprintf(dev, GFP_KERNEL, "%s_%s",
>> +                                               dev_name(dev), i2s_clk_desc[i]);
>
> kasprintf() might return NULL and later it is being used as clock
> name. I think you should handle such error.

Right, I will fix that in next version, thanks for your review.

-- 
Regards,
Sylwester

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 4/8] ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK
  2018-02-06 12:26         ` Krzysztof Kozlowski
@ 2018-02-07 16:23           ` Sylwester Nawrocki
  2018-02-12 10:00             ` Krzysztof Kozlowski
  0 siblings, 1 reply; 29+ messages in thread
From: Sylwester Nawrocki @ 2018-02-07 16:23 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: broonie, lgirdwood, alsa-devel, robh+dt, devicetree,
	linux-samsung-soc, jcsing.lee, sbkim73, linux-kernel,
	Bartłomiej Żołnierkiewicz, Marek Szyprowski

On 02/06/2018 01:26 PM, Krzysztof Kozlowski wrote:
> On Mon, Feb 5, 2018 at 4:43 PM, Sylwester Nawrocki
> <s.nawrocki@samsung.com> wrote:

>> diff --git a/sound/soc/samsung/i2s.h b/sound/soc/samsung/i2s.h
>> index 79781de2f247..a9832a9555cb 100644
>> --- a/sound/soc/samsung/i2s.h
>> +++ b/sound/soc/samsung/i2s.h
>> @@ -16,11 +16,16 @@
>>  #define SAMSUNG_I2S_DAI        "samsung-i2s"
>>  #define SAMSUNG_I2S_DAI_SEC    "samsung-i2s-sec"
>>
>> -#define SAMSUNG_I2S_DIV_BCLK   1
>> +#define SAMSUNG_I2S_DIV_BCLK           1
>>
>> -#define SAMSUNG_I2S_RCLKSRC_0  0
>> -#define SAMSUNG_I2S_RCLKSRC_1  1
>> +#define SAMSUNG_I2S_RCLKSRC_0          0
>> +#define SAMSUNG_I2S_RCLKSRC_1          1
>>  #define SAMSUNG_I2S_CDCLK              2
>> +/* Operation clock for IIS logic */
>>  #define SAMSUNG_I2S_OPCLK              3
>> +#define  SAMSUNG_I2S_OPCLK_CDCLK_OUT   0       /* CODEC clock out */
>> +#define  SAMSUNG_I2S_OPCLK_CDCLK_IN    1       /* CODEC clock in */
>> +#define  SAMSUNG_I2S_OPCLK_BCLK_OUT    2       /* Bit clock out */
>> +#define  SAMSUNG_I2S_OPCLK_PCLK                3       /* Audio bus clock */
>>
>>  #endif /* __SND_SOC_SAMSUNG_I2S_H */
> 
> This part of patch seems to be unrelated (and it includes some cleanups).

This is actually the main part of the patch, an API exported to other
drivers.  The whitespace changes are for keeping the alignment uniform,
I could just drop them.

-- 
Regards,
Sylwester

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 8/8] ASoC: samsung,tm2-audio DT binding documentation update
       [not found]         ` <CAJKOXPeRFgJQpUTeJeYYo+qqAxkT1iZczSJQzRzn3O3bXmvOZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-02-07 16:31           ` Sylwester Nawrocki
       [not found]             ` <67a9f473-0eba-b3d0-ae92-5602658b6958-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 29+ messages in thread
From: Sylwester Nawrocki @ 2018-02-07 16:31 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
	jcsing.lee-Sze3O3UU22JBDgjK7y7TUQ,
	sbkim73-Sze3O3UU22JBDgjK7y7TUQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Bartłomiej Żołnierkiewicz, Marek Szyprowski

On 02/06/2018 02:05 PM, Krzysztof Kozlowski wrote:
> On Mon, Feb 5, 2018 at 4:44 PM, Sylwester Nawrocki
> <s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:
>> This patch documents additional entries of the audio-codec and
>> i2s-controller properties required for the HDMI audio support.
>>
>> Signed-off-by: Sylwester Nawrocki <s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
>> ---
>>  .../devicetree/bindings/sound/samsung,tm2-audio.txt        | 14 +++++++++-----
>>  1 file changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt b/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
>> index 94442e5673b3..f5ccc12ddc00 100644
>> --- a/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
>> +++ b/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
>> @@ -4,9 +4,13 @@ Required properties:
>>
>>   - compatible           : "samsung,tm2-audio"
>>   - model                : the user-visible name of this sound complex
>> - - audio-codec          : the phandle of the wm5110 audio codec node,
>> -                          as described in ../mfd/arizona.txt
>> - - i2s-controller       : the phandle of the I2S controller
>> + - audio-codec          : the first entry should be phandle of the wm5110 audio
>> +                          codec node, as described in ../mfd/arizona.txt;
>> +                          the second entry should be phandle of the HDMI
>
> AFAIU, this property is still optional so the wording should be
> different. Maybe just add "optional properties" paragraph?

I'd like to keep the second entries required in the documentation,
and the driver would still be handling the case with just single 
entries.

-- 
Regards,
Sylwester
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 7/8] ASoC: samsung: Add missing #sound-dai-cells property documentation
  2018-02-06 13:02       ` Krzysztof Kozlowski
@ 2018-02-07 16:37         ` Sylwester Nawrocki
  0 siblings, 0 replies; 29+ messages in thread
From: Sylwester Nawrocki @ 2018-02-07 16:37 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: broonie, lgirdwood, alsa-devel, robh+dt, devicetree,
	linux-samsung-soc, jcsing.lee, sbkim73, linux-kernel,
	Bartłomiej Żołnierkiewicz, Marek Szyprowski

On 02/06/2018 02:02 PM, Krzysztof Kozlowski wrote:
> On Mon, Feb 5, 2018 at 4:44 PM, Sylwester Nawrocki
> <s.nawrocki@samsung.com> wrote:
>> The #sound-dai-cells property might be helpful in selecting primary
>> or secondary CPU DAI and it's already present in i2s nodes for some
>> exynos SoCs so let's add it to the DT binding documentation.
>
> The description above looks like you are documenting existing optional
> property but you added it as a required property.

Actually, it would be better to have it as a required property, but
that could be done with any new device bindings. For the exisitng ones 
I will move this property to the "Optional SoC Specific Properties"
paragraph.

-- 
Regards,
Sylwester

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 6/8] ASoC: samsung: i2s: Update clock-output-names property documentation
  2018-02-05 15:44     ` [PATCH 6/8] ASoC: samsung: i2s: Update clock-output-names property documentation Sylwester Nawrocki
  2018-02-06 12:59       ` Krzysztof Kozlowski
@ 2018-02-09  2:36       ` Rob Herring
  1 sibling, 0 replies; 29+ messages in thread
From: Rob Herring @ 2018-02-09  2:36 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: broonie, lgirdwood, alsa-devel, devicetree, linux-samsung-soc,
	krzk, jcsing.lee, sbkim73, linux-kernel, b.zolnierkie,
	m.szyprowski

On Mon, Feb 05, 2018 at 04:44:01PM +0100, Sylwester Nawrocki wrote:
> The clock-output-names property is marked as deprecated. While at it,
> #clock-cells property's value is corrected in the example snippet
> and few typos are fixed.
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  .../devicetree/bindings/sound/samsung-i2s.txt          | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 8/8] ASoC: samsung,tm2-audio DT binding documentation update
  2018-02-05 15:44     ` [PATCH 8/8] ASoC: samsung,tm2-audio DT binding documentation update Sylwester Nawrocki
  2018-02-06 13:05       ` Krzysztof Kozlowski
@ 2018-02-09  2:39       ` Rob Herring
  2018-02-14 13:29       ` Applied "ASoC: samsung,tm2-audio DT binding documentation update" to the asoc tree Mark Brown
  2 siblings, 0 replies; 29+ messages in thread
From: Rob Herring @ 2018-02-09  2:39 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: broonie, lgirdwood, alsa-devel, devicetree, linux-samsung-soc,
	krzk, jcsing.lee, sbkim73, linux-kernel, b.zolnierkie,
	m.szyprowski

On Mon, Feb 05, 2018 at 04:44:03PM +0100, Sylwester Nawrocki wrote:
> This patch documents additional entries of the audio-codec and
> i2s-controller properties required for the HDMI audio support.
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  .../devicetree/bindings/sound/samsung,tm2-audio.txt        | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 8/8] ASoC: samsung,tm2-audio DT binding documentation update
       [not found]             ` <67a9f473-0eba-b3d0-ae92-5602658b6958-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2018-02-12  9:19               ` Krzysztof Kozlowski
  0 siblings, 0 replies; 29+ messages in thread
From: Krzysztof Kozlowski @ 2018-02-12  9:19 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
	jcsing.lee-Sze3O3UU22JBDgjK7y7TUQ,
	sbkim73-Sze3O3UU22JBDgjK7y7TUQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Bartłomiej Żołnierkiewicz, Marek Szyprowski

On Wed, Feb 7, 2018 at 5:31 PM, Sylwester Nawrocki
<s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:
> On 02/06/2018 02:05 PM, Krzysztof Kozlowski wrote:
>> On Mon, Feb 5, 2018 at 4:44 PM, Sylwester Nawrocki
>> <s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:
>>> This patch documents additional entries of the audio-codec and
>>> i2s-controller properties required for the HDMI audio support.
>>>
>>> Signed-off-by: Sylwester Nawrocki <s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
>>> ---
>>>  .../devicetree/bindings/sound/samsung,tm2-audio.txt        | 14 +++++++++-----
>>>  1 file changed, 9 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt b/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
>>> index 94442e5673b3..f5ccc12ddc00 100644
>>> --- a/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
>>> +++ b/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
>>> @@ -4,9 +4,13 @@ Required properties:
>>>
>>>   - compatible           : "samsung,tm2-audio"
>>>   - model                : the user-visible name of this sound complex
>>> - - audio-codec          : the phandle of the wm5110 audio codec node,
>>> -                          as described in ../mfd/arizona.txt
>>> - - i2s-controller       : the phandle of the I2S controller
>>> + - audio-codec          : the first entry should be phandle of the wm5110 audio
>>> +                          codec node, as described in ../mfd/arizona.txt;
>>> +                          the second entry should be phandle of the HDMI
>>
>> AFAIU, this property is still optional so the wording should be
>> different. Maybe just add "optional properties" paragraph?
>
> I'd like to keep the second entries required in the documentation,
> and the driver would still be handling the case with just single
> entries.

I understand.
Acked-by: Krzysztof Kozlowski <krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH 4/8] ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK
  2018-02-07 16:23           ` Sylwester Nawrocki
@ 2018-02-12 10:00             ` Krzysztof Kozlowski
  0 siblings, 0 replies; 29+ messages in thread
From: Krzysztof Kozlowski @ 2018-02-12 10:00 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: broonie, lgirdwood, alsa-devel, robh+dt, devicetree,
	linux-samsung-soc, jcsing.lee, sbkim73, linux-kernel,
	Bartłomiej Żołnierkiewicz, Marek Szyprowski

On Wed, Feb 7, 2018 at 5:23 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> On 02/06/2018 01:26 PM, Krzysztof Kozlowski wrote:
>> On Mon, Feb 5, 2018 at 4:43 PM, Sylwester Nawrocki
>> <s.nawrocki@samsung.com> wrote:
>
>>> diff --git a/sound/soc/samsung/i2s.h b/sound/soc/samsung/i2s.h
>>> index 79781de2f247..a9832a9555cb 100644
>>> --- a/sound/soc/samsung/i2s.h
>>> +++ b/sound/soc/samsung/i2s.h
>>> @@ -16,11 +16,16 @@
>>>  #define SAMSUNG_I2S_DAI        "samsung-i2s"
>>>  #define SAMSUNG_I2S_DAI_SEC    "samsung-i2s-sec"
>>>
>>> -#define SAMSUNG_I2S_DIV_BCLK   1
>>> +#define SAMSUNG_I2S_DIV_BCLK           1
>>>
>>> -#define SAMSUNG_I2S_RCLKSRC_0  0
>>> -#define SAMSUNG_I2S_RCLKSRC_1  1
>>> +#define SAMSUNG_I2S_RCLKSRC_0          0
>>> +#define SAMSUNG_I2S_RCLKSRC_1          1
>>>  #define SAMSUNG_I2S_CDCLK              2
>>> +/* Operation clock for IIS logic */
>>>  #define SAMSUNG_I2S_OPCLK              3
>>> +#define  SAMSUNG_I2S_OPCLK_CDCLK_OUT   0       /* CODEC clock out */
>>> +#define  SAMSUNG_I2S_OPCLK_CDCLK_IN    1       /* CODEC clock in */
>>> +#define  SAMSUNG_I2S_OPCLK_BCLK_OUT    2       /* Bit clock out */
>>> +#define  SAMSUNG_I2S_OPCLK_PCLK                3       /* Audio bus clock */
>>>
>>>  #endif /* __SND_SOC_SAMSUNG_I2S_H */
>>
>> This part of patch seems to be unrelated (and it includes some cleanups).
>
> This is actually the main part of the patch, an API exported to other
> drivers.

You are right, I looked at it without the context of 5/8 and I assumed
you are changing existing user of the defines...

> The whitespace changes are for keeping the alignment uniform,
> I could just drop them.

Let it be then.

Acked-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Applied "ASoC: samsung: i2s: Ensure the RCLK rate is properly determined" to the asoc tree
  2018-02-05 15:43       ` [PATCH 1/8] ASoC: samsung: i2s: Ensure the RCLK rate is properly determined Sylwester Nawrocki
       [not found]         ` <20180205154403.13520-2-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2018-02-12 12:52         ` Mark Brown
  1 sibling, 0 replies; 29+ messages in thread
From: Mark Brown @ 2018-02-12 12:52 UTC (permalink / raw)
  To: Sylwester Nawrocki; +Cc: Krzysztof Kozlowski, Mark Brown

The patch

   ASoC: samsung: i2s: Ensure the RCLK rate is properly determined

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 647d04f8e07afc7c3b7a42b3ee01a8b28db29631 Mon Sep 17 00:00:00 2001
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
Date: Mon, 5 Feb 2018 16:43:56 +0100
Subject: [PATCH] ASoC: samsung: i2s: Ensure the RCLK rate is properly
 determined

If the RCLK mux clock configuration is specified in DT and no set_sysclk()
callback is used in the sound card driver the sclk_srcrate field will remain
set to 0, leading to an incorrect PSR divider setting.
To fix this the frequency value is retrieved from the CLK_I2S_RCLK_SRC clock,
so the actual RCLK mux selection is taken into account.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/samsung/i2s.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 233f1c9a4b6c..aeba0ae890ea 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -656,8 +656,12 @@ static int i2s_set_fmt(struct snd_soc_dai *dai,
 		tmp |= mod_slave;
 		break;
 	case SND_SOC_DAIFMT_CBS_CFS:
-		/* Set default source clock in Master mode */
-		if (i2s->rclk_srcrate == 0)
+		/*
+		 * Set default source clock in Master mode, only when the
+		 * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any
+		 * clock configuration assigned in DT is not overwritten.
+		 */
+		if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL)
 			i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0,
 							0, SND_SOC_CLOCK_IN);
 		break;
@@ -881,6 +885,11 @@ static int config_setup(struct i2s_dai *i2s)
 		return 0;
 
 	if (!(i2s->quirks & QUIRK_NO_MUXPSR)) {
+		struct clk *rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC];
+
+		if (i2s->rclk_srcrate == 0 && rclksrc && !IS_ERR(rclksrc))
+			i2s->rclk_srcrate = clk_get_rate(rclksrc);
+
 		psr = i2s->rclk_srcrate / i2s->frmclk / rfs;
 		writel(((psr - 1) << 8) | PSR_PSREN, i2s->addr + I2SPSR);
 		dev_dbg(&i2s->pdev->dev,
-- 
2.16.1

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Applied "ASoC: samsung,tm2-audio DT binding documentation update" to the asoc tree
  2018-02-05 15:44     ` [PATCH 8/8] ASoC: samsung,tm2-audio DT binding documentation update Sylwester Nawrocki
  2018-02-06 13:05       ` Krzysztof Kozlowski
  2018-02-09  2:39       ` Rob Herring
@ 2018-02-14 13:29       ` Mark Brown
  2 siblings, 0 replies; 29+ messages in thread
From: Mark Brown @ 2018-02-14 13:29 UTC (permalink / raw)
  To: Sylwester Nawrocki; +Cc: Krzysztof Kozlowski, Mark Brown

The patch

   ASoC: samsung,tm2-audio DT binding documentation update

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 3a3ac1ea898399f14748a358dd33262c97a9a86b Mon Sep 17 00:00:00 2001
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
Date: Mon, 12 Feb 2018 17:15:36 +0100
Subject: [PATCH] ASoC: samsung,tm2-audio DT binding documentation update

This patch documents additional entries of the audio-codec and
i2s-controller properties required for the HDMI audio support.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 .../devicetree/bindings/sound/samsung,tm2-audio.txt        | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt b/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
index 94442e5673b3..f5ccc12ddc00 100644
--- a/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
+++ b/Documentation/devicetree/bindings/sound/samsung,tm2-audio.txt
@@ -4,9 +4,13 @@ Required properties:
 
  - compatible		 : "samsung,tm2-audio"
  - model		 : the user-visible name of this sound complex
- - audio-codec		 : the phandle of the wm5110 audio codec node,
-			   as described in ../mfd/arizona.txt
- - i2s-controller	 : the phandle of the I2S controller
+ - audio-codec		 : the first entry should be phandle of the wm5110 audio
+			   codec node, as described in ../mfd/arizona.txt;
+			   the second entry should be phandle of the HDMI
+			   transmitter node
+ - i2s-controller	 : the list of phandle and argument tuples pointing to
+			   I2S controllers, the first entry should be I2S0 and
+			   the second one I2S1
  - audio-amplifier	 : the phandle of the MAX98504 amplifier
  - samsung,audio-routing : a list of the connections between audio components;
 			   each entry is a pair of strings, the first being the
@@ -22,8 +26,8 @@ Example:
 
 sound {
 	compatible = "samsung,tm2-audio";
-	audio-codec = <&wm5110>;
-	i2s-controller = <&i2s0>;
+	audio-codec = <&wm5110>, <&hdmi>;
+	i2s-controller = <&i2s0 0>, <&i2s1 0>;
 	audio-amplifier = <&max98504>;
 	mic-bias-gpios = <&gpr3 2 0>;
 	model = "wm5110";
-- 
2.16.1

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Applied "ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK" to the asoc tree
  2018-02-05 15:43       ` [PATCH 4/8] ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK Sylwester Nawrocki
  2018-02-06 12:26         ` Krzysztof Kozlowski
@ 2018-02-14 13:29         ` Mark Brown
  1 sibling, 0 replies; 29+ messages in thread
From: Mark Brown @ 2018-02-14 13:29 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: devicetree, alsa-devel, linux-samsung-soc, b.zolnierkie, sbkim73,
	jcsing.lee, lgirdwood, krzk, linux-kernel, robh+dt, broonie,
	m.szyprowski

The patch

   ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 45ae70e8b60e1d1bbc71eeccaef4026c5e6638a3 Mon Sep 17 00:00:00 2001
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
Date: Mon, 12 Feb 2018 17:15:35 +0100
Subject: [PATCH] ASoC: samsung: i2s: Define the parameters list for
 SAMSUNG_I2S_OPCLK

The SAMSUNG_I2S_OPCLK is not currently used by any card driver thus we can
safely change semantics of 'dir' argument of the I2S set_sysclk() callback.
Now an enumeration is exported instead of directly using register bit field
values.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/samsung/i2s-regs.h | 11 ++++++-----
 sound/soc/samsung/i2s.c      |  2 +-
 sound/soc/samsung/i2s.h      | 11 ++++++++---
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/sound/soc/samsung/i2s-regs.h b/sound/soc/samsung/i2s-regs.h
index fe6914005494..964985ea2e80 100644
--- a/sound/soc/samsung/i2s-regs.h
+++ b/sound/soc/samsung/i2s-regs.h
@@ -65,11 +65,12 @@
 #define CON_RXDMA_ACTIVE	(1 << 1)
 #define CON_ACTIVE		(1 << 0)
 
-#define MOD_OPCLK_CDCLK_OUT	(0 << 30)
-#define MOD_OPCLK_CDCLK_IN	(1 << 30)
-#define MOD_OPCLK_BCLK_OUT	(2 << 30)
-#define MOD_OPCLK_PCLK		(3 << 30)
-#define MOD_OPCLK_MASK		(3 << 30)
+#define MOD_OPCLK_SHIFT		30
+#define MOD_OPCLK_CDCLK_OUT	(0 << MOD_OPCLK_SHIFT)
+#define MOD_OPCLK_CDCLK_IN	(1 << MOD_OPCLK_SHIFT)
+#define MOD_OPCLK_BCLK_OUT	(2 << MOD_OPCLK_SHIFT)
+#define MOD_OPCLK_PCLK		(3 << MOD_OPCLK_SHIFT)
+#define MOD_OPCLK_MASK		(3 << MOD_OPCLK_SHIFT)
 #define MOD_TXS_IDMA		(1 << 28) /* Sec_TXFIFO use I-DMA */
 
 #define MOD_BLCS_SHIFT		26
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 7b57ad11ca15..b6407fbabdd1 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -489,7 +489,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
 	switch (clk_id) {
 	case SAMSUNG_I2S_OPCLK:
 		mask = MOD_OPCLK_MASK;
-		val = dir;
+		val = (dir << MOD_OPCLK_SHIFT) & MOD_OPCLK_MASK;
 		break;
 	case SAMSUNG_I2S_CDCLK:
 		mask = 1 << i2s_regs->cdclkcon_off;
diff --git a/sound/soc/samsung/i2s.h b/sound/soc/samsung/i2s.h
index 79781de2f247..a9832a9555cb 100644
--- a/sound/soc/samsung/i2s.h
+++ b/sound/soc/samsung/i2s.h
@@ -16,11 +16,16 @@
 #define SAMSUNG_I2S_DAI        "samsung-i2s"
 #define SAMSUNG_I2S_DAI_SEC    "samsung-i2s-sec"
 
-#define SAMSUNG_I2S_DIV_BCLK	1
+#define SAMSUNG_I2S_DIV_BCLK		1
 
-#define SAMSUNG_I2S_RCLKSRC_0	0
-#define SAMSUNG_I2S_RCLKSRC_1	1
+#define SAMSUNG_I2S_RCLKSRC_0		0
+#define SAMSUNG_I2S_RCLKSRC_1		1
 #define SAMSUNG_I2S_CDCLK		2
+/* Operation clock for IIS logic */
 #define SAMSUNG_I2S_OPCLK		3
+#define  SAMSUNG_I2S_OPCLK_CDCLK_OUT	0	/* CODEC clock out */
+#define  SAMSUNG_I2S_OPCLK_CDCLK_IN	1	/* CODEC clock in */
+#define  SAMSUNG_I2S_OPCLK_BCLK_OUT	2	/* Bit clock out */
+#define  SAMSUNG_I2S_OPCLK_PCLK		3	/* Audio bus clock */
 
 #endif /* __SND_SOC_SAMSUNG_I2S_H */
-- 
2.16.1

^ permalink raw reply related	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2018-02-14 13:29 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180205154421epcas2p16072f713ea81f72b3f8230f6a9d412cf@epcas2p1.samsung.com>
2018-02-05 15:43 ` [PATCH 0/8] ASoC: samsung: Add HDMI sound support for tm2 board Sylwester Nawrocki
     [not found]   ` <CGME20180205154511epcas1p14dccb00b68fdb688f2c427c56e01c052@epcas1p1.samsung.com>
2018-02-05 15:43     ` [PATCH 2/8] ASoC: samsung: i2s: Ensure names of supplied clocks are unique Sylwester Nawrocki
2018-02-06 12:20       ` Krzysztof Kozlowski
2018-02-07 15:20         ` Sylwester Nawrocki
     [not found]   ` <CGME20180205154516epcas1p39c5977145e7b32879b935087ee3865f8@epcas1p3.samsung.com>
2018-02-05 15:43     ` [PATCH 3/8] ASoC: samsung: i2s: Prevent external abort on exynos5433 I2S1 access Sylwester Nawrocki
2018-02-06 12:22       ` Krzysztof Kozlowski
     [not found]   ` <CGME20180205154453epcas1p10046e1103497692c86c0899a5ef11781@epcas1p1.samsung.com>
     [not found]     ` <20180205154403.13520-1-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2018-02-05 15:43       ` [PATCH 1/8] ASoC: samsung: i2s: Ensure the RCLK rate is properly determined Sylwester Nawrocki
     [not found]         ` <20180205154403.13520-2-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2018-02-06 12:15           ` Krzysztof Kozlowski
2018-02-12 12:52         ` Applied "ASoC: samsung: i2s: Ensure the RCLK rate is properly determined" to the asoc tree Mark Brown
2018-02-05 15:43       ` [PATCH 4/8] ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK Sylwester Nawrocki
2018-02-06 12:26         ` Krzysztof Kozlowski
2018-02-07 16:23           ` Sylwester Nawrocki
2018-02-12 10:00             ` Krzysztof Kozlowski
2018-02-14 13:29         ` Applied "ASoC: samsung: i2s: Define the parameters list for SAMSUNG_I2S_OPCLK" to the asoc tree Mark Brown
     [not found]   ` <CGME20180205154524epcas1p35874552d9056837a162dc59d847d1930@epcas1p3.samsung.com>
2018-02-05 15:44     ` [PATCH 5/8] ASoC: samsung: Add support for HDMI audio on TM2 board Sylwester Nawrocki
2018-02-06 12:57       ` Krzysztof Kozlowski
     [not found]   ` <CGME20180205154529epcas2p3478546ef61294ac06cd9d8ed3d7e12c9@epcas2p3.samsung.com>
2018-02-05 15:44     ` [PATCH 6/8] ASoC: samsung: i2s: Update clock-output-names property documentation Sylwester Nawrocki
2018-02-06 12:59       ` Krzysztof Kozlowski
2018-02-06 12:59         ` Krzysztof Kozlowski
2018-02-09  2:36       ` Rob Herring
     [not found]   ` <CGME20180205154533epcas2p2d0ed58188cf7f29751c08cd804f6fb0d@epcas2p2.samsung.com>
2018-02-05 15:44     ` [PATCH 7/8] ASoC: samsung: Add missing #sound-dai-cells " Sylwester Nawrocki
2018-02-06 13:02       ` Krzysztof Kozlowski
2018-02-07 16:37         ` Sylwester Nawrocki
     [not found]   ` <CGME20180205154537epcas1p10a9a30a574e3f472358e7dacf3cb0489@epcas1p1.samsung.com>
2018-02-05 15:44     ` [PATCH 8/8] ASoC: samsung,tm2-audio DT binding documentation update Sylwester Nawrocki
2018-02-06 13:05       ` Krzysztof Kozlowski
     [not found]         ` <CAJKOXPeRFgJQpUTeJeYYo+qqAxkT1iZczSJQzRzn3O3bXmvOZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-07 16:31           ` Sylwester Nawrocki
     [not found]             ` <67a9f473-0eba-b3d0-ae92-5602658b6958-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2018-02-12  9:19               ` Krzysztof Kozlowski
2018-02-09  2:39       ` Rob Herring
2018-02-14 13:29       ` Applied "ASoC: samsung,tm2-audio DT binding documentation update" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).