devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/4] Patches to fix some problem for rockchip i2s
@ 2017-06-09  8:52 Sugar Zhang
  2017-06-09  8:52 ` [PATCH v1 2/4] ASoC: rockchip: i2s: add support for i2s bclk fs configuration Sugar Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Sugar Zhang @ 2017-06-09  8:52 UTC (permalink / raw)
  To: heiko, broonie
  Cc: Mark Rutland, devicetree, alsa-devel, Liam Girdwood, Takashi Iwai,
	linux-kernel, Sugar Zhang, linux-rockchip, Rob Herring,
	linux-arm-kernel

These patches to fix some problem for rockchip i2s.


Sugar Zhang (3):
  ASoC: rockchip: i2s: add a delay before i2s clear
  ASoC: rockchip: i2s: add support for i2s bclk fs configuration
  ASoC: rockchip: i2s: fixup clk div

zhangjun (1):
  ASoC: rockchip: i2s: add other configurable formats

 .../devicetree/bindings/sound/rockchip-i2s.txt     |  2 +
 sound/soc/rockchip/rockchip_i2s.c                  | 45 +++++++++++++++++++---
 sound/soc/rockchip/rockchip_i2s.h                  |  3 ++
 3 files changed, 45 insertions(+), 5 deletions(-)

-- 
1.9.1

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

* [PATCH v1 2/4] ASoC: rockchip: i2s: add support for i2s bclk fs configuration
  2017-06-09  8:52 [PATCH v1 0/4] Patches to fix some problem for rockchip i2s Sugar Zhang
@ 2017-06-09  8:52 ` Sugar Zhang
       [not found]   ` <1496998369-30556-3-git-send-email-sugar.zhang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Sugar Zhang @ 2017-06-09  8:52 UTC (permalink / raw)
  To: heiko, broonie
  Cc: Mark Rutland, devicetree, alsa-devel, linux-kernel, Takashi Iwai,
	Liam Girdwood, Sugar Zhang, linux-rockchip, Rob Herring,
	linux-arm-kernel

this patch add support for i2s bclk fs configuration, we can
configure bclk_fs by devicetree as required.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
---

 Documentation/devicetree/bindings/sound/rockchip-i2s.txt | 2 ++
 sound/soc/rockchip/rockchip_i2s.c                        | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
index 206aba1..de3cbbe 100644
--- a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
+++ b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
@@ -23,6 +23,7 @@ Required properties:
    - "i2s_clk" : clock for I2S controller
 - rockchip,playback-channels: max playback channels, if not set, 8 channels default.
 - rockchip,capture-channels: max capture channels, if not set, 2 channels default.
+- rockchip,bclk-fs: configure the i2s bclk fs.
 
 Required properties for controller which support multi channels
 playback/capture:
@@ -41,4 +42,5 @@ i2s@ff890000 {
 	clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>;
 	rockchip,playback-channels = <8>;
 	rockchip,capture-channels = <2>;
+	rockchip,bclk-fs = <128>;
 };
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index f548433..220232b 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -51,6 +51,7 @@ struct rk_i2s_dev {
 	bool rx_start;
 	bool is_master_mode;
 	const struct rk_i2s_pins *pins;
+	unsigned int bclk_fs;
 };
 
 static int i2s_runtime_suspend(struct device *dev)
@@ -254,7 +255,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
 
 	if (i2s->is_master_mode) {
 		mclk_rate = clk_get_rate(i2s->mclk);
-		bclk_rate = 2 * 32 * params_rate(params);
+		bclk_rate = i2s->bclk_fs * params_rate(params);
 		if (bclk_rate && mclk_rate % bclk_rate)
 			return -EINVAL;
 
@@ -633,6 +634,12 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
 			soc_dai->capture.channels_max = val;
 	}
 
+	i2s->bclk_fs = 64;
+	if (!of_property_read_u32(node, "rockchip,bclk-fs", &val)) {
+		if ((val >= 32) && (val % 2 == 0))
+			i2s->bclk_fs = val;
+	}
+
 	ret = devm_snd_soc_register_component(&pdev->dev,
 					      &rockchip_i2s_component,
 					      soc_dai, 1);
-- 
1.9.1

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

* Re: [PATCH v1 2/4] ASoC: rockchip: i2s: add support for i2s bclk fs configuration
       [not found]   ` <1496998369-30556-3-git-send-email-sugar.zhang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
@ 2017-06-13 20:46     ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2017-06-13 20:46 UTC (permalink / raw)
  To: Sugar Zhang
  Cc: heiko-4mtYJXux2i+zQB+pC5nmwQ,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Liam Girdwood,
	Rob Herring, Mark Rutland, Jaroslav Kysela, Takashi Iwai,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

On Fri, Jun 09, 2017 at 04:52:47PM +0800, Sugar Zhang wrote:

> +- rockchip,bclk-fs: configure the i2s bclk fs.

Rather than having a driver DT property for this the device should
implement a set_bclk_ratio() operation and let the ratio be set by the
machine driver.  The simple and graph cards may need extending for that,
I know they have MCLK configuration support already.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2017-06-13 20:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-09  8:52 [PATCH v1 0/4] Patches to fix some problem for rockchip i2s Sugar Zhang
2017-06-09  8:52 ` [PATCH v1 2/4] ASoC: rockchip: i2s: add support for i2s bclk fs configuration Sugar Zhang
     [not found]   ` <1496998369-30556-3-git-send-email-sugar.zhang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-06-13 20:46     ` 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).