[alsa-devel] [PATCH v2 0/5] As the sama5d3xek and at91sam9n12ek have switch to CCF,
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
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");
On Mon, Jun 09, 2014 at 11:31:43AM +0800, Bo Shen wrote:
Signed-off-by: Bo Shen voice.shen@atmel.com
Applied, thanks.
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);
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@1a { + compatible = "wlf,wm8904"; + reg = <0x1a>; + clocks = <&pck0>; + clock-names = "mclk"; +};
On Mon, Jun 09, 2014 at 11:31:45AM +0800, Bo Shen wrote:
Signed-off-by: Bo Shen voice.shen@atmel.com
Applied, thanks.
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@1a { compatible = "wm8904"; reg = <0x1a>; + clocks = <&pck0>; + clock-names = "mclk"; }; };
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@1a { compatible = "wm8904"; reg = <0x1a>;
clocks = <&pck0>;
clock-names = "mclk"; }; };
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@1a { compatible = "wm8904"; reg = <0x1a>; + clocks = <&pck0>; + clock-names = "mclk"; };
qt1070: keyboard@1b {
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@1a { compatible = "wm8904"; reg = <0x1a>;
clocks = <&pck0>;
clock-names = "mclk"; }; qt1070: keyboard@1b {
participants (3)
-
Bo Shen
-
Mark Brown
-
Nicolas Ferre