linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] As the sama5d3xek and at91sam9n12ek have switch to CCF,
@ 2014-06-09  3:31 Bo Shen
  2014-06-09  3:31 ` [PATCH v2 1/5] ASoC: atmel_wm8904: switch to CCF Bo Shen
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Bo Shen @ 2014-06-09  3:31 UTC (permalink / raw)
  To: linux-arm-kernel

in order to support audio, also switch it to CCF.

This patch series based on next-2014-0604 tag.

Changes in v2:
  - wm8904: Remove the mclk checking when try to enable or disable it,
    as it is checked when required.
  - dt: List the clock-names, which need by driver.

Bo Shen (5):
  ASoC: atmel_wm8904: switch to CCF
  ASoC: wm8904: switch to CCF
  dt: wm8904: add device tree binding document
  ARM: atmel: sama5d3xek: switch sound to CCF
  ARM: atmel: at91sam9n12ek: switch sound to CCF

 Documentation/devicetree/bindings/sound/wm8904.txt | 33 ++++++++++++++
 arch/arm/boot/dts/at91sam9n12ek.dts                |  2 +
 arch/arm/boot/dts/sama5d3xmb.dtsi                  |  2 +
 sound/soc/atmel/atmel_wm8904.c                     | 50 ----------------------
 sound/soc/codecs/wm8904.c                          | 11 +++++
 5 files changed, 48 insertions(+), 50 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/wm8904.txt

-- 
1.8.5.2

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

* [PATCH v2 1/5] ASoC: atmel_wm8904: switch to CCF
  2014-06-09  3:31 [PATCH v2 0/5] As the sama5d3xek and at91sam9n12ek have switch to CCF, Bo Shen
@ 2014-06-09  3:31 ` Bo Shen
  2014-06-09 20:14   ` Mark Brown
  2014-06-09  3:31 ` [PATCH v2 2/5] ASoC: wm8904: " Bo Shen
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Bo Shen @ 2014-06-09  3:31 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
Changes in v2:
  - None

 sound/soc/atmel/atmel_wm8904.c | 50 ------------------------------------------
 1 file changed, 50 deletions(-)

diff --git a/sound/soc/atmel/atmel_wm8904.c b/sound/soc/atmel/atmel_wm8904.c
index b4e3690..4052268 100644
--- a/sound/soc/atmel/atmel_wm8904.c
+++ b/sound/soc/atmel/atmel_wm8904.c
@@ -18,10 +18,6 @@
 #include "../codecs/wm8904.h"
 #include "atmel_ssc_dai.h"
 
-#define MCLK_RATE 32768
-
-static struct clk *mclk;
-
 static const struct snd_soc_dapm_widget atmel_asoc_wm8904_dapm_widgets[] = {
 	SND_SOC_DAPM_HP("Headphone Jack", NULL),
 	SND_SOC_DAPM_MIC("Mic", NULL),
@@ -61,26 +57,6 @@ static struct snd_soc_ops atmel_asoc_wm8904_ops = {
 	.hw_params = atmel_asoc_wm8904_hw_params,
 };
 
-static int atmel_set_bias_level(struct snd_soc_card *card,
-		struct snd_soc_dapm_context *dapm,
-		enum snd_soc_bias_level level)
-{
-	if (dapm->bias_level == SND_SOC_BIAS_STANDBY) {
-		switch (level) {
-		case SND_SOC_BIAS_PREPARE:
-			clk_prepare_enable(mclk);
-			break;
-		case SND_SOC_BIAS_OFF:
-			clk_disable_unprepare(mclk);
-			break;
-		default:
-			break;
-		}
-	}
-
-	return 0;
-};
-
 static struct snd_soc_dai_link atmel_asoc_wm8904_dailink = {
 	.name = "WM8904",
 	.stream_name = "WM8904 PCM",
@@ -94,7 +70,6 @@ static struct snd_soc_dai_link atmel_asoc_wm8904_dailink = {
 static struct snd_soc_card atmel_asoc_wm8904_card = {
 	.name = "atmel_asoc_wm8904",
 	.owner = THIS_MODULE,
-	.set_bias_level = atmel_set_bias_level,
 	.dai_link = &atmel_asoc_wm8904_dailink,
 	.num_links = 1,
 	.dapm_widgets = atmel_asoc_wm8904_dapm_widgets,
@@ -153,7 +128,6 @@ static int atmel_asoc_wm8904_probe(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = &atmel_asoc_wm8904_card;
 	struct snd_soc_dai_link *dailink = &atmel_asoc_wm8904_dailink;
-	struct clk *clk_src;
 	int id, ret;
 
 	card->dev = &pdev->dev;
@@ -170,30 +144,6 @@ static int atmel_asoc_wm8904_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	mclk = clk_get(NULL, "pck0");
-	if (IS_ERR(mclk)) {
-		dev_err(&pdev->dev, "failed to get pck0\n");
-		ret = PTR_ERR(mclk);
-		goto err_set_audio;
-	}
-
-	clk_src = clk_get(NULL, "clk32k");
-	if (IS_ERR(clk_src)) {
-		dev_err(&pdev->dev, "failed to get clk32k\n");
-		ret = PTR_ERR(clk_src);
-		goto err_set_audio;
-	}
-
-	ret = clk_set_parent(mclk, clk_src);
-	clk_put(clk_src);
-	if (ret != 0) {
-		dev_err(&pdev->dev, "failed to set MCLK parent\n");
-		goto err_set_audio;
-	}
-
-	dev_info(&pdev->dev, "setting pck0 to %dHz\n", MCLK_RATE);
-	clk_set_rate(mclk, MCLK_RATE);
-
 	ret = snd_soc_register_card(card);
 	if (ret) {
 		dev_err(&pdev->dev, "snd_soc_register_card failed\n");
-- 
1.8.5.2

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

* [PATCH v2 2/5] ASoC: wm8904: switch to CCF
  2014-06-09  3:31 [PATCH v2 0/5] As the sama5d3xek and at91sam9n12ek have switch to CCF, Bo Shen
  2014-06-09  3:31 ` [PATCH v2 1/5] ASoC: atmel_wm8904: switch to CCF Bo Shen
@ 2014-06-09  3:31 ` Bo Shen
  2014-06-09 20:13   ` Mark Brown
  2014-06-09  3:31 ` [PATCH v2 3/5] dt: wm8904: add device tree binding document Bo Shen
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Bo Shen @ 2014-06-09  3:31 UTC (permalink / raw)
  To: linux-arm-kernel

Enable WM8904 to support common clock framework.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
Changes in v2:
  - Remove the mclk checking when try to enable or disable it,
    as it is checked when required.

 sound/soc/codecs/wm8904.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index f7c5499..da46c2a 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -11,6 +11,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/clk.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
@@ -49,6 +50,7 @@ static const char *wm8904_supply_names[WM8904_NUM_SUPPLIES] = {
 /* codec private data */
 struct wm8904_priv {
 	struct regmap *regmap;
+	struct clk *mclk;
 
 	enum wm8904_type devtype;
 
@@ -1828,6 +1830,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
 
 	switch (level) {
 	case SND_SOC_BIAS_ON:
+		clk_prepare_enable(wm8904->mclk);
 		break;
 
 	case SND_SOC_BIAS_PREPARE:
@@ -1894,6 +1897,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
 
 		regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies),
 				       wm8904->supplies);
+		clk_disable_unprepare(wm8904->mclk);
 		break;
 	}
 	codec->dapm.bias_level = level;
@@ -2110,6 +2114,13 @@ static int wm8904_i2c_probe(struct i2c_client *i2c,
 	if (wm8904 == NULL)
 		return -ENOMEM;
 
+	wm8904->mclk = devm_clk_get(&i2c->dev, "mclk");
+	if (IS_ERR(wm8904->mclk)) {
+		ret = PTR_ERR(wm8904->mclk);
+		dev_err(&i2c->dev, "Failed to get MCLK\n");
+		return ret;
+	}
+
 	wm8904->regmap = devm_regmap_init_i2c(i2c, &wm8904_regmap);
 	if (IS_ERR(wm8904->regmap)) {
 		ret = PTR_ERR(wm8904->regmap);
-- 
1.8.5.2

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

* [PATCH v2 3/5] dt: wm8904: add device tree binding document
  2014-06-09  3:31 [PATCH v2 0/5] As the sama5d3xek and at91sam9n12ek have switch to CCF, Bo Shen
  2014-06-09  3:31 ` [PATCH v2 1/5] ASoC: atmel_wm8904: switch to CCF Bo Shen
  2014-06-09  3:31 ` [PATCH v2 2/5] ASoC: wm8904: " Bo Shen
@ 2014-06-09  3:31 ` Bo Shen
  2014-06-09 20:13   ` Mark Brown
  2014-06-09  3:31 ` [PATCH v2 4/5] ARM: atmel: sama5d3xek: switch sound to CCF Bo Shen
  2014-06-09  3:31 ` [PATCH v2 5/5] ARM: atmel: at91sam9n12ek: " Bo Shen
  4 siblings, 1 reply; 11+ messages in thread
From: Bo Shen @ 2014-06-09  3:31 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
Changes in v2:
  - List the clock-names, which need by driver.

 Documentation/devicetree/bindings/sound/wm8904.txt | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/wm8904.txt

diff --git a/Documentation/devicetree/bindings/sound/wm8904.txt b/Documentation/devicetree/bindings/sound/wm8904.txt
new file mode 100644
index 0000000..e99f409
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/wm8904.txt
@@ -0,0 +1,33 @@
+WM8904 audio CODEC
+
+This device supports I2C only.
+
+Required properties:
+  - compatible: "wlf,wm8904"
+  - reg: the I2C address of the device.
+  - clock-names: "mclk"
+  - clocks: reference to
+    <Documentation/devicetree/bindings/clock/clock-bindings.txt>
+
+Pins on the device (for linking into audio routes):
+
+  * IN1L
+  * IN1R
+  * IN2L
+  * IN2R
+  * IN3L
+  * IN3R
+  * HPOUTL
+  * HPOUTR
+  * LINEOUTL
+  * LINEOUTR
+  * MICBIAS
+
+Examples:
+
+codec: wm8904 at 1a {
+	compatible = "wlf,wm8904";
+	reg = <0x1a>;
+	clocks = <&pck0>;
+	clock-names = "mclk";
+};
-- 
1.8.5.2

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

* [PATCH v2 4/5] ARM: atmel: sama5d3xek: switch sound to CCF
  2014-06-09  3:31 [PATCH v2 0/5] As the sama5d3xek and at91sam9n12ek have switch to CCF, Bo Shen
                   ` (2 preceding siblings ...)
  2014-06-09  3:31 ` [PATCH v2 3/5] dt: wm8904: add device tree binding document Bo Shen
@ 2014-06-09  3:31 ` Bo Shen
  2014-06-10 12:27   ` Nicolas Ferre
  2014-06-09  3:31 ` [PATCH v2 5/5] ARM: atmel: at91sam9n12ek: " Bo Shen
  4 siblings, 1 reply; 11+ messages in thread
From: Bo Shen @ 2014-06-09  3:31 UTC (permalink / raw)
  To: linux-arm-kernel

As the sama5d3xek board has switch to CCF, so add clock for wm8904

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Reviwed-by: Mark Brown <broonie@linaro.org>
---
Changes in v2:
  - None

 arch/arm/boot/dts/sama5d3xmb.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi
index 306eef0..b8c6f20 100644
--- a/arch/arm/boot/dts/sama5d3xmb.dtsi
+++ b/arch/arm/boot/dts/sama5d3xmb.dtsi
@@ -45,6 +45,8 @@
 				wm8904: wm8904 at 1a {
 					compatible = "wm8904";
 					reg = <0x1a>;
+					clocks = <&pck0>;
+					clock-names = "mclk";
 				};
 			};
 
-- 
1.8.5.2

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

* [PATCH v2 5/5] ARM: atmel: at91sam9n12ek: switch sound to CCF
  2014-06-09  3:31 [PATCH v2 0/5] As the sama5d3xek and at91sam9n12ek have switch to CCF, Bo Shen
                   ` (3 preceding siblings ...)
  2014-06-09  3:31 ` [PATCH v2 4/5] ARM: atmel: sama5d3xek: switch sound to CCF Bo Shen
@ 2014-06-09  3:31 ` Bo Shen
  2014-06-10 12:27   ` Nicolas Ferre
  4 siblings, 1 reply; 11+ messages in thread
From: Bo Shen @ 2014-06-09  3:31 UTC (permalink / raw)
  To: linux-arm-kernel

As the at91sam9n12ek has switch to CCF, so add clock for wm8904

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Reviwed-by: Mark Brown <broonie@linaro.org>
---
Changes in v2:
  - None

 arch/arm/boot/dts/at91sam9n12ek.dts | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts
index 64bbe46..8ae771d 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -56,6 +56,8 @@
 				wm8904: codec at 1a {
 					compatible = "wm8904";
 					reg = <0x1a>;
+					clocks = <&pck0>;
+					clock-names = "mclk";
 				};
 
 				qt1070: keyboard at 1b {
-- 
1.8.5.2

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

* [PATCH v2 2/5] ASoC: wm8904: switch to CCF
  2014-06-09  3:31 ` [PATCH v2 2/5] ASoC: wm8904: " Bo Shen
@ 2014-06-09 20:13   ` Mark Brown
  0 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2014-06-09 20:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 09, 2014 at 11:31:44AM +0800, Bo Shen wrote:
> Enable WM8904 to support common clock framework.

Applied, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140609/87940c6a/attachment.sig>

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

* [PATCH v2 3/5] dt: wm8904: add device tree binding document
  2014-06-09  3:31 ` [PATCH v2 3/5] dt: wm8904: add device tree binding document Bo Shen
@ 2014-06-09 20:13   ` Mark Brown
  0 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2014-06-09 20:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 09, 2014 at 11:31:45AM +0800, Bo Shen wrote:
> Signed-off-by: Bo Shen <voice.shen@atmel.com>

Applied, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140609/4ff7367f/attachment.sig>

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

* [PATCH v2 1/5] ASoC: atmel_wm8904: switch to CCF
  2014-06-09  3:31 ` [PATCH v2 1/5] ASoC: atmel_wm8904: switch to CCF Bo Shen
@ 2014-06-09 20:14   ` Mark Brown
  0 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2014-06-09 20:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 09, 2014 at 11:31:43AM +0800, Bo Shen wrote:
> Signed-off-by: Bo Shen <voice.shen@atmel.com>

Applied, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140609/370a2cab/attachment.sig>

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

* [PATCH v2 4/5] ARM: atmel: sama5d3xek: switch sound to CCF
  2014-06-09  3:31 ` [PATCH v2 4/5] ARM: atmel: sama5d3xek: switch sound to CCF Bo Shen
@ 2014-06-10 12:27   ` Nicolas Ferre
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Ferre @ 2014-06-10 12:27 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/06/2014 05:31, Bo Shen :
> As the sama5d3xek board has switch to CCF, so add clock for wm8904
> 
> Signed-off-by: Bo Shen <voice.shen@atmel.com>
> Reviwed-by: Mark Brown <broonie@linaro.org>

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

And taken for next "dt" branch (maybe can go in before). Thanks.

> ---
> Changes in v2:
>   - None
> 
>  arch/arm/boot/dts/sama5d3xmb.dtsi | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi
> index 306eef0..b8c6f20 100644
> --- a/arch/arm/boot/dts/sama5d3xmb.dtsi
> +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi
> @@ -45,6 +45,8 @@
>  				wm8904: wm8904 at 1a {
>  					compatible = "wm8904";
>  					reg = <0x1a>;
> +					clocks = <&pck0>;
> +					clock-names = "mclk";
>  				};
>  			};
>  
> 


-- 
Nicolas Ferre

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

* [PATCH v2 5/5] ARM: atmel: at91sam9n12ek: switch sound to CCF
  2014-06-09  3:31 ` [PATCH v2 5/5] ARM: atmel: at91sam9n12ek: " Bo Shen
@ 2014-06-10 12:27   ` Nicolas Ferre
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Ferre @ 2014-06-10 12:27 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/06/2014 05:31, Bo Shen :
> As the at91sam9n12ek has switch to CCF, so add clock for wm8904
> 
> Signed-off-by: Bo Shen <voice.shen@atmel.com>
> Reviwed-by: Mark Brown <broonie@linaro.org>

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

Thanks.

> ---
> Changes in v2:
>   - None
> 
>  arch/arm/boot/dts/at91sam9n12ek.dts | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts
> index 64bbe46..8ae771d 100644
> --- a/arch/arm/boot/dts/at91sam9n12ek.dts
> +++ b/arch/arm/boot/dts/at91sam9n12ek.dts
> @@ -56,6 +56,8 @@
>  				wm8904: codec at 1a {
>  					compatible = "wm8904";
>  					reg = <0x1a>;
> +					clocks = <&pck0>;
> +					clock-names = "mclk";
>  				};
>  
>  				qt1070: keyboard at 1b {
> 


-- 
Nicolas Ferre

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

end of thread, other threads:[~2014-06-10 12:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-09  3:31 [PATCH v2 0/5] As the sama5d3xek and at91sam9n12ek have switch to CCF, Bo Shen
2014-06-09  3:31 ` [PATCH v2 1/5] ASoC: atmel_wm8904: switch to CCF Bo Shen
2014-06-09 20:14   ` Mark Brown
2014-06-09  3:31 ` [PATCH v2 2/5] ASoC: wm8904: " Bo Shen
2014-06-09 20:13   ` Mark Brown
2014-06-09  3:31 ` [PATCH v2 3/5] dt: wm8904: add device tree binding document Bo Shen
2014-06-09 20:13   ` Mark Brown
2014-06-09  3:31 ` [PATCH v2 4/5] ARM: atmel: sama5d3xek: switch sound to CCF Bo Shen
2014-06-10 12:27   ` Nicolas Ferre
2014-06-09  3:31 ` [PATCH v2 5/5] ARM: atmel: at91sam9n12ek: " Bo Shen
2014-06-10 12:27   ` Nicolas Ferre

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).