alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] ASoC: atmel_ssc_dai: add option to choose clock
@ 2014-02-10  6:09 Bo Shen
  2014-02-10  6:09 ` [PATCH v3 1/2] ASoC: atmel_ssc_dai: make " Bo Shen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bo Shen @ 2014-02-10  6:09 UTC (permalink / raw)
  To: broonie
  Cc: Mark Rutland, alsa-devel, Stephen Warren, linux-doc,
	Takashi Iwai, nicolas.ferre, Bo Shen, Chas Williams,
	Lars-Peter Clausen, Pawel Moll, linux-atm-general, plagnioj,
	devicetree, Arnd Bergmann, Ian Campbell, linux-sound,
	Rob Herring, linux-arm-kernel, Richard Genoud,
	Greg Kroah-Hartman, Liam Girdwood, linux-kernel, Rob Landley,
	netdev, Mark Brown

When SSC work in slave mode, the clock can come from TK pin and also
can come from RK pin, this is hardware design decided. So, make it
available to choose where the clock from.

Changes in v3:
  - Move the property from card to ssc device
Series-changes: 2
  - using "-" replace "_" in binding document

Bo Shen (2):
  ASoC: atmel_ssc_dai: make option to choose clock
  Binding: atmel-ssc: add option to choose clock

 Documentation/devicetree/bindings/misc/atmel-ssc.txt |  8 ++++++++
 drivers/misc/atmel-ssc.c                             |  6 ++++++
 include/linux/atmel-ssc.h                            |  1 +
 sound/soc/atmel/atmel_ssc_dai.c                      | 13 +++++++++----
 4 files changed, 24 insertions(+), 4 deletions(-)

-- 
1.8.5.2

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

* [PATCH v3 1/2] ASoC: atmel_ssc_dai: make option to choose clock
  2014-02-10  6:09 [PATCH v3 0/2] ASoC: atmel_ssc_dai: add option to choose clock Bo Shen
@ 2014-02-10  6:09 ` Bo Shen
  2014-02-10  9:22   ` Nicolas Ferre
  2014-02-10  6:09 ` [PATCH v3 2/2] Binding: atmel-ssc: add " Bo Shen
  2014-02-12 17:23 ` [PATCH v3 0/2] ASoC: atmel_ssc_dai: " Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Bo Shen @ 2014-02-10  6:09 UTC (permalink / raw)
  To: broonie
  Cc: Chas Williams, alsa-devel, Lars-Peter Clausen, linux-kernel,
	Arnd Bergmann, Takashi Iwai, Greg Kroah-Hartman,
	linux-atm-general, nicolas.ferre, Liam Girdwood, linux-sound,
	Bo Shen, netdev, plagnioj, linux-arm-kernel

When SSC works in slave mode, according to the hardware design, the
clock can get from TK pin, also can get from RK pin. So, add one
parameter to choose where the clock from.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
Changes in v3:
  - New, move clk-from-rk-pin property from card to ssc device

 drivers/misc/atmel-ssc.c        |  6 ++++++
 include/linux/atmel-ssc.h       |  1 +
 sound/soc/atmel/atmel_ssc_dai.c | 13 +++++++++----
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index 5be80840..22de137 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -150,6 +150,12 @@ static int ssc_probe(struct platform_device *pdev)
 		return -ENODEV;
 	ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat;
 
+	if (pdev->dev.of_node) {
+		struct device_node *np = pdev->dev.of_node;
+		ssc->clk_from_rk_pin =
+			of_property_read_bool(np, "atmel,clk-from-rk-pin");
+	}
+
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	ssc->regs = devm_ioremap_resource(&pdev->dev, regs);
 	if (IS_ERR(ssc->regs))
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index 66a0e53..571a12e 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -18,6 +18,7 @@ struct ssc_device {
 	struct clk		*clk;
 	int			user;
 	int			irq;
+	bool			clk_from_rk_pin;
 };
 
 struct ssc_device * __must_check ssc_request(unsigned int ssc_num);
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index 8697ced..ca1d8a3 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -341,6 +341,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
 {
 	int id = dai->id;
 	struct atmel_ssc_info *ssc_p = &ssc_info[id];
+	struct ssc_device *ssc = ssc_p->ssc;
 	struct atmel_pcm_dma_params *dma_params;
 	int dir, channels, bits;
 	u32 tfmr, rfmr, tcmr, rcmr;
@@ -466,7 +467,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
 			| SSC_BF(RCMR_START, start_event)
 			| SSC_BF(RCMR_CKI, SSC_CKI_RISING)
 			| SSC_BF(RCMR_CKO, SSC_CKO_NONE)
-			| SSC_BF(RCMR_CKS, SSC_CKS_CLOCK);
+			| SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
+					   SSC_CKS_PIN : SSC_CKS_CLOCK);
 
 		rfmr =	  SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
 			| SSC_BF(RFMR_FSOS, SSC_FSOS_NONE)
@@ -481,7 +483,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
 			| SSC_BF(TCMR_START, start_event)
 			| SSC_BF(TCMR_CKI, SSC_CKI_FALLING)
 			| SSC_BF(TCMR_CKO, SSC_CKO_NONE)
-			| SSC_BF(TCMR_CKS, SSC_CKS_PIN);
+			| SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ?
+					   SSC_CKS_CLOCK : SSC_CKS_PIN);
 
 		tfmr =	  SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
 			| SSC_BF(TFMR_FSDEN, 0)
@@ -550,7 +553,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
 			| SSC_BF(RCMR_START, SSC_START_RISING_RF)
 			| SSC_BF(RCMR_CKI, SSC_CKI_RISING)
 			| SSC_BF(RCMR_CKO, SSC_CKO_NONE)
-			| SSC_BF(RCMR_CKS, SSC_CKS_PIN);
+			| SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
+					   SSC_CKS_PIN : SSC_CKS_CLOCK);
 
 		rfmr =	  SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
 			| SSC_BF(RFMR_FSOS, SSC_FSOS_NONE)
@@ -565,7 +569,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
 			| SSC_BF(TCMR_START, SSC_START_RISING_RF)
 			| SSC_BF(TCMR_CKI, SSC_CKI_FALLING)
 			| SSC_BF(TCMR_CKO, SSC_CKO_NONE)
-			| SSC_BF(TCMR_CKS, SSC_CKS_PIN);
+			| SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
+					   SSC_CKS_CLOCK : SSC_CKS_PIN);
 
 		tfmr =	  SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
 			| SSC_BF(TFMR_FSDEN, 0)
-- 
1.8.5.2

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

* [PATCH v3 2/2] Binding: atmel-ssc: add option to choose clock
  2014-02-10  6:09 [PATCH v3 0/2] ASoC: atmel_ssc_dai: add option to choose clock Bo Shen
  2014-02-10  6:09 ` [PATCH v3 1/2] ASoC: atmel_ssc_dai: make " Bo Shen
@ 2014-02-10  6:09 ` Bo Shen
  2014-02-10  9:21   ` Nicolas Ferre
  2014-02-12 17:23 ` [PATCH v3 0/2] ASoC: atmel_ssc_dai: " Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Bo Shen @ 2014-02-10  6:09 UTC (permalink / raw)
  To: broonie
  Cc: Mark Rutland, devicetree, alsa-devel, Rob Landley, Pawel Moll,
	Stephen Warren, Richard Genoud, linux-kernel, Ian Campbell,
	nicolas.ferre, Mark Brown, linux-sound, linux-doc, Rob Herring,
	Bo Shen, plagnioj, linux-arm-kernel

Add the option to choose clock on which pin input to SSC (as slave).
Default is on TK pin to SSC, add "atmel,clk-from-rk-pin" option to
specify the clock is on RK pin to SSC.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
Changes in v3:
  - None
Series-changes: 2
  - using "-" replace "_" in binding document

 Documentation/devicetree/bindings/misc/atmel-ssc.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/misc/atmel-ssc.txt b/Documentation/devicetree/bindings/misc/atmel-ssc.txt
index a45ae08..5c1e14e 100644
--- a/Documentation/devicetree/bindings/misc/atmel-ssc.txt
+++ b/Documentation/devicetree/bindings/misc/atmel-ssc.txt
@@ -14,6 +14,14 @@ Required properties for devices compatible with "atmel,at91sam9g45-ssc":
   See Documentation/devicetree/bindings/dma/atmel-dma.txt for details.
 - dma-names: Must be "tx", "rx".
 
+Optional properties:
+  - atmel,clk-from-rk-pin: bool property.
+     - When SSC works in slave mode, according to the hardware design, the
+       clock can get from TK pin, and also can get from RK pin. So, add
+       this parameter to choose where the clock from.
+     - By default the clock is from TK pin, if the clock from RK pin, this
+       property is needed.
+
 Examples:
 - PDC transfer:
 ssc0: ssc@fffbc000 {
-- 
1.8.5.2

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

* Re: [PATCH v3 2/2] Binding: atmel-ssc: add option to choose clock
  2014-02-10  6:09 ` [PATCH v3 2/2] Binding: atmel-ssc: add " Bo Shen
@ 2014-02-10  9:21   ` Nicolas Ferre
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Ferre @ 2014-02-10  9:21 UTC (permalink / raw)
  To: Bo Shen, broonie
  Cc: plagnioj, linux-sound, alsa-devel, linux-arm-kernel, Rob Herring,
	Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell,
	Rob Landley, Mark Brown, Richard Genoud, devicetree, linux-doc,
	linux-kernel

On 10/02/2014 07:09, Bo Shen :
> Add the option to choose clock on which pin input to SSC (as slave).
> Default is on TK pin to SSC, add "atmel,clk-from-rk-pin" option to
> specify the clock is on RK pin to SSC.
> 
> Signed-off-by: Bo Shen <voice.shen@atmel.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
> Changes in v3:
>   - None
> Series-changes: 2
>   - using "-" replace "_" in binding document
> 
>  Documentation/devicetree/bindings/misc/atmel-ssc.txt | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/misc/atmel-ssc.txt b/Documentation/devicetree/bindings/misc/atmel-ssc.txt
> index a45ae08..5c1e14e 100644
> --- a/Documentation/devicetree/bindings/misc/atmel-ssc.txt
> +++ b/Documentation/devicetree/bindings/misc/atmel-ssc.txt
> @@ -14,6 +14,14 @@ Required properties for devices compatible with "atmel,at91sam9g45-ssc":
>    See Documentation/devicetree/bindings/dma/atmel-dma.txt for details.
>  - dma-names: Must be "tx", "rx".
>  
> +Optional properties:
> +  - atmel,clk-from-rk-pin: bool property.
> +     - When SSC works in slave mode, according to the hardware design, the
> +       clock can get from TK pin, and also can get from RK pin. So, add
> +       this parameter to choose where the clock from.
> +     - By default the clock is from TK pin, if the clock from RK pin, this
> +       property is needed.
> +
>  Examples:
>  - PDC transfer:
>  ssc0: ssc@fffbc000 {
> 


-- 
Nicolas Ferre

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

* Re: [PATCH v3 1/2] ASoC: atmel_ssc_dai: make option to choose clock
  2014-02-10  6:09 ` [PATCH v3 1/2] ASoC: atmel_ssc_dai: make " Bo Shen
@ 2014-02-10  9:22   ` Nicolas Ferre
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Ferre @ 2014-02-10  9:22 UTC (permalink / raw)
  To: Bo Shen, broonie
  Cc: plagnioj, linux-sound, alsa-devel, linux-arm-kernel,
	Arnd Bergmann, Greg Kroah-Hartman, Chas Williams, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Lars-Peter Clausen, linux-kernel,
	linux-atm-general, netdev

On 10/02/2014 07:09, Bo Shen :
> When SSC works in slave mode, according to the hardware design, the
> clock can get from TK pin, also can get from RK pin. So, add one
> parameter to choose where the clock from.
> 
> Signed-off-by: Bo Shen <voice.shen@atmel.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
> Changes in v3:
>   - New, move clk-from-rk-pin property from card to ssc device
> 
>  drivers/misc/atmel-ssc.c        |  6 ++++++
>  include/linux/atmel-ssc.h       |  1 +
>  sound/soc/atmel/atmel_ssc_dai.c | 13 +++++++++----
>  3 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
> index 5be80840..22de137 100644
> --- a/drivers/misc/atmel-ssc.c
> +++ b/drivers/misc/atmel-ssc.c
> @@ -150,6 +150,12 @@ static int ssc_probe(struct platform_device *pdev)
>  		return -ENODEV;
>  	ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat;
>  
> +	if (pdev->dev.of_node) {
> +		struct device_node *np = pdev->dev.of_node;
> +		ssc->clk_from_rk_pin =
> +			of_property_read_bool(np, "atmel,clk-from-rk-pin");
> +	}
> +
>  	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	ssc->regs = devm_ioremap_resource(&pdev->dev, regs);
>  	if (IS_ERR(ssc->regs))
> diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
> index 66a0e53..571a12e 100644
> --- a/include/linux/atmel-ssc.h
> +++ b/include/linux/atmel-ssc.h
> @@ -18,6 +18,7 @@ struct ssc_device {
>  	struct clk		*clk;
>  	int			user;
>  	int			irq;
> +	bool			clk_from_rk_pin;
>  };
>  
>  struct ssc_device * __must_check ssc_request(unsigned int ssc_num);
> diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
> index 8697ced..ca1d8a3 100644
> --- a/sound/soc/atmel/atmel_ssc_dai.c
> +++ b/sound/soc/atmel/atmel_ssc_dai.c
> @@ -341,6 +341,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
>  {
>  	int id = dai->id;
>  	struct atmel_ssc_info *ssc_p = &ssc_info[id];
> +	struct ssc_device *ssc = ssc_p->ssc;
>  	struct atmel_pcm_dma_params *dma_params;
>  	int dir, channels, bits;
>  	u32 tfmr, rfmr, tcmr, rcmr;
> @@ -466,7 +467,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
>  			| SSC_BF(RCMR_START, start_event)
>  			| SSC_BF(RCMR_CKI, SSC_CKI_RISING)
>  			| SSC_BF(RCMR_CKO, SSC_CKO_NONE)
> -			| SSC_BF(RCMR_CKS, SSC_CKS_CLOCK);
> +			| SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
> +					   SSC_CKS_PIN : SSC_CKS_CLOCK);
>  
>  		rfmr =	  SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
>  			| SSC_BF(RFMR_FSOS, SSC_FSOS_NONE)
> @@ -481,7 +483,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
>  			| SSC_BF(TCMR_START, start_event)
>  			| SSC_BF(TCMR_CKI, SSC_CKI_FALLING)
>  			| SSC_BF(TCMR_CKO, SSC_CKO_NONE)
> -			| SSC_BF(TCMR_CKS, SSC_CKS_PIN);
> +			| SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ?
> +					   SSC_CKS_CLOCK : SSC_CKS_PIN);
>  
>  		tfmr =	  SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
>  			| SSC_BF(TFMR_FSDEN, 0)
> @@ -550,7 +553,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
>  			| SSC_BF(RCMR_START, SSC_START_RISING_RF)
>  			| SSC_BF(RCMR_CKI, SSC_CKI_RISING)
>  			| SSC_BF(RCMR_CKO, SSC_CKO_NONE)
> -			| SSC_BF(RCMR_CKS, SSC_CKS_PIN);
> +			| SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
> +					   SSC_CKS_PIN : SSC_CKS_CLOCK);
>  
>  		rfmr =	  SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
>  			| SSC_BF(RFMR_FSOS, SSC_FSOS_NONE)
> @@ -565,7 +569,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
>  			| SSC_BF(TCMR_START, SSC_START_RISING_RF)
>  			| SSC_BF(TCMR_CKI, SSC_CKI_FALLING)
>  			| SSC_BF(TCMR_CKO, SSC_CKO_NONE)
> -			| SSC_BF(TCMR_CKS, SSC_CKS_PIN);
> +			| SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
> +					   SSC_CKS_CLOCK : SSC_CKS_PIN);
>  
>  		tfmr =	  SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
>  			| SSC_BF(TFMR_FSDEN, 0)
> 


-- 
Nicolas Ferre

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

* Re: [PATCH v3 0/2] ASoC: atmel_ssc_dai: add option to choose clock
  2014-02-10  6:09 [PATCH v3 0/2] ASoC: atmel_ssc_dai: add option to choose clock Bo Shen
  2014-02-10  6:09 ` [PATCH v3 1/2] ASoC: atmel_ssc_dai: make " Bo Shen
  2014-02-10  6:09 ` [PATCH v3 2/2] Binding: atmel-ssc: add " Bo Shen
@ 2014-02-12 17:23 ` Mark Brown
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2014-02-12 17:23 UTC (permalink / raw)
  To: Bo Shen
  Cc: Mark Rutland, alsa-devel, Stephen Warren, linux-doc,
	Takashi Iwai, nicolas.ferre, Liam Girdwood, Chas Williams,
	Lars-Peter Clausen, Arnd Bergmann, linux-atm-general, plagnioj,
	devicetree, Pawel Moll, Ian Campbell, linux-sound, Rob Herring,
	linux-arm-kernel, Richard Genoud, Greg Kroah-Hartman,
	linux-kernel, Rob Landley, netdev


[-- Attachment #1.1: Type: text/plain, Size: 259 bytes --]

On Mon, Feb 10, 2014 at 02:09:44PM +0800, Bo Shen wrote:
> When SSC work in slave mode, the clock can come from TK pin and also
> can come from RK pin, this is hardware design decided. So, make it
> available to choose where the clock from.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2014-02-12 17:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-10  6:09 [PATCH v3 0/2] ASoC: atmel_ssc_dai: add option to choose clock Bo Shen
2014-02-10  6:09 ` [PATCH v3 1/2] ASoC: atmel_ssc_dai: make " Bo Shen
2014-02-10  9:22   ` Nicolas Ferre
2014-02-10  6:09 ` [PATCH v3 2/2] Binding: atmel-ssc: add " Bo Shen
2014-02-10  9:21   ` Nicolas Ferre
2014-02-12 17:23 ` [PATCH v3 0/2] ASoC: atmel_ssc_dai: " 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).