[alsa-devel] [PATCH 0/8] ASoC: samsung: Add HDMI sound support for tm2 board
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
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 --- 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,
On Mon, Feb 5, 2018 at 4:43 PM, Sylwester Nawrocki s.nawrocki@samsung.com 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@samsung.com
sound/soc/samsung/i2s.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
Acked-by: Krzysztof Kozlowski krzk@kernel.org
Best regards, Krzysztof
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,
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);
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
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.
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);
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
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 */
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
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.
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
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 */
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; }
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
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>;
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
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
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
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>; };
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
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.
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";
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
On 02/06/2018 02:05 PM, Krzysztof Kozlowski wrote:
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?
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.
On Wed, Feb 7, 2018 at 5:31 PM, Sylwester Nawrocki s.nawrocki@samsung.com wrote:
On 02/06/2018 02:05 PM, Krzysztof Kozlowski wrote:
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?
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@kernel.org
Best regards, Krzysztof
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
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";
participants (4)
-
Krzysztof Kozlowski
-
Mark Brown
-
Rob Herring
-
Sylwester Nawrocki