* [PATCH v1 0/2] patches to add support for rockchip rt5640 card
@ 2016-02-22 7:56 Sugar Zhang
2016-02-22 7:56 ` [PATCH v1 1/2] ASoC: rockchip: i2s: add default values for registers Sugar Zhang
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Sugar Zhang @ 2016-02-22 7:56 UTC (permalink / raw)
To: broonie, heiko
Cc: Sugar Zhang, Jaroslav Kysela, devicetree, alsa-devel,
linux-rockchip, Oder Chiou, linux-kernel, Kumar Gala,
Ian Campbell, Takashi Iwai, Liam Girdwood, Pawel Moll,
Rob Herring, Mark Rutland, Bard Liao, linux-arm-kernel
add default values for i2s registers from TRM.
rt5640: add master clock handing.
Sugar Zhang (2):
ASoC: rockchip: i2s: add default values for registers
ASoC: rt5640: add master clock handling for rt5640
Documentation/devicetree/bindings/sound/rt5640.txt | 3 +++
sound/soc/codecs/rt5640.c | 31 ++++++++++++++++++++++
sound/soc/codecs/rt5640.h | 2 ++
sound/soc/rockchip/rockchip_i2s.c | 10 +++++++
4 files changed, 46 insertions(+)
--
1.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1 1/2] ASoC: rockchip: i2s: add default values for registers
2016-02-22 7:56 [PATCH v1 0/2] patches to add support for rockchip rt5640 card Sugar Zhang
@ 2016-02-22 7:56 ` Sugar Zhang
2016-02-22 11:13 ` Applied "ASoC: rockchip: i2s: add default values for registers" to the asoc tree Mark Brown
2016-02-22 7:56 ` [PATCH v1 2/2] ASoC: rt5640: add master clock handling for rt5640 Sugar Zhang
[not found] ` <1456127815-68575-1-git-send-email-sugar.zhang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2 siblings, 1 reply; 7+ messages in thread
From: Sugar Zhang @ 2016-02-22 7:56 UTC (permalink / raw)
To: broonie, heiko
Cc: Sugar Zhang, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
alsa-devel, linux-arm-kernel, linux-rockchip, linux-kernel
this patch add default values for registers according description from TRM.
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
---
sound/soc/rockchip/rockchip_i2s.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index 6561c4c..a0b0942 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -440,11 +440,21 @@ static bool rockchip_i2s_precious_reg(struct device *dev, unsigned int reg)
}
}
+static const struct reg_default rockchip_i2s_reg_defaults[] = {
+ {0x00, 0x0000000f},
+ {0x04, 0x0000000f},
+ {0x08, 0x00071f1f},
+ {0x10, 0x001f0000},
+ {0x14, 0x01f00000},
+};
+
static const struct regmap_config rockchip_i2s_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
.max_register = I2S_RXDR,
+ .reg_defaults = rockchip_i2s_reg_defaults,
+ .num_reg_defaults = ARRAY_SIZE(rockchip_i2s_reg_defaults),
.writeable_reg = rockchip_i2s_wr_reg,
.readable_reg = rockchip_i2s_rd_reg,
.volatile_reg = rockchip_i2s_volatile_reg,
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v1 2/2] ASoC: rt5640: add master clock handling for rt5640
2016-02-22 7:56 [PATCH v1 0/2] patches to add support for rockchip rt5640 card Sugar Zhang
2016-02-22 7:56 ` [PATCH v1 1/2] ASoC: rockchip: i2s: add default values for registers Sugar Zhang
@ 2016-02-22 7:56 ` Sugar Zhang
2016-02-22 11:13 ` Applied "ASoC: rt5640: add master clock handling for rt5640" to the asoc tree Mark Brown
[not found] ` <1456127815-68575-1-git-send-email-sugar.zhang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2 siblings, 1 reply; 7+ messages in thread
From: Sugar Zhang @ 2016-02-22 7:56 UTC (permalink / raw)
To: broonie, heiko
Cc: Sugar Zhang, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Bard Liao, Oder Chiou, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, devicetree, linux-kernel, alsa-devel
enable/disable master clock when codec is active or not.
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
---
Documentation/devicetree/bindings/sound/rt5640.txt | 3 +++
sound/soc/codecs/rt5640.c | 31 ++++++++++++++++++++++
sound/soc/codecs/rt5640.h | 2 ++
3 files changed, 36 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/rt5640.txt b/Documentation/devicetree/bindings/sound/rt5640.txt
index 9e62f6e..57fe646 100644
--- a/Documentation/devicetree/bindings/sound/rt5640.txt
+++ b/Documentation/devicetree/bindings/sound/rt5640.txt
@@ -12,6 +12,9 @@ Required properties:
Optional properties:
+- clocks: The phandle of the master clock to the CODEC
+- clock-names: Should be "mclk"
+
- realtek,in1-differential
- realtek,in2-differential
- realtek,in3-differential
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index 11d032c..6cd84fb 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -1949,7 +1949,33 @@ static int rt5640_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
static int rt5640_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level)
{
+ struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
+ int ret;
+
switch (level) {
+ case SND_SOC_BIAS_ON:
+ break;
+
+ case SND_SOC_BIAS_PREPARE:
+ /*
+ * SND_SOC_BIAS_PREPARE is called while preparing for a
+ * transition to ON or away from ON. If current bias_level
+ * is SND_SOC_BIAS_ON, then it is preparing for a transition
+ * away from ON. Disable the clock in that case, otherwise
+ * enable it.
+ */
+ if (IS_ERR(rt5640->mclk))
+ break;
+
+ if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_ON) {
+ clk_disable_unprepare(rt5640->mclk);
+ } else {
+ ret = clk_prepare_enable(rt5640->mclk);
+ if (ret)
+ return ret;
+ }
+ break;
+
case SND_SOC_BIAS_STANDBY:
if (SND_SOC_BIAS_OFF == snd_soc_codec_get_bias_level(codec)) {
snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
@@ -2088,6 +2114,11 @@ static int rt5640_probe(struct snd_soc_codec *codec)
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
+ /* Check if MCLK provided */
+ rt5640->mclk = devm_clk_get(codec->dev, "mclk");
+ if (PTR_ERR(rt5640->mclk) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+
rt5640->codec = codec;
snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/rt5640.h b/sound/soc/codecs/rt5640.h
index 83a7150..1761c3a9 100644
--- a/sound/soc/codecs/rt5640.h
+++ b/sound/soc/codecs/rt5640.h
@@ -12,6 +12,7 @@
#ifndef _RT5640_H
#define _RT5640_H
+#include <linux/clk.h>
#include <sound/rt5640.h>
/* Info */
@@ -2097,6 +2098,7 @@ struct rt5640_priv {
struct snd_soc_codec *codec;
struct rt5640_platform_data pdata;
struct regmap *regmap;
+ struct clk *mclk;
int sysclk;
int sysclk_src;
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v1 0/2] patches to add support for rockchip rt5640 card
[not found] ` <1456127815-68575-1-git-send-email-sugar.zhang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
@ 2016-02-22 11:04 ` Mark Brown
2016-02-23 0:57 ` sugar
0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2016-02-22 11:04 UTC (permalink / raw)
To: Sugar Zhang
Cc: heiko-4mtYJXux2i+zQB+pC5nmwQ, Jaroslav Kysela,
devicetree-u79uwXL29TY76Z2rM5mHXA,
alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Oder Chiou,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Kumar Gala, Ian Campbell,
Takashi Iwai, Liam Girdwood, Pawel Moll, Rob Herring,
Mark Rutland, Bard Liao,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
[-- Attachment #1: Type: text/plain, Size: 421 bytes --]
On Mon, Feb 22, 2016 at 03:56:53PM +0800, Sugar Zhang wrote:
> Sugar Zhang (2):
> ASoC: rockchip: i2s: add default values for registers
> ASoC: rt5640: add master clock handling for rt5640
These appear to be commpletly unrelated patches so should each be sent
individually rather than as a series - that way there is no confusion
about them possibly depending on each other and they are easier to
review and apply.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Applied "ASoC: rt5640: add master clock handling for rt5640" to the asoc tree
2016-02-22 7:56 ` [PATCH v1 2/2] ASoC: rt5640: add master clock handling for rt5640 Sugar Zhang
@ 2016-02-22 11:13 ` Mark Brown
0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2016-02-22 11:13 UTC (permalink / raw)
To: Sugar Zhang, Mark Brown; +Cc: alsa-devel
The patch
ASoC: rt5640: add master clock handling for rt5640
has been applied to the asoc tree at
git://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 6049af00fc2fac8d27f8bd064ff68b16991a80f7 Mon Sep 17 00:00:00 2001
From: Sugar Zhang <sugar.zhang@rock-chips.com>
Date: Mon, 22 Feb 2016 15:56:55 +0800
Subject: [PATCH] ASoC: rt5640: add master clock handling for rt5640
enable/disable master clock when codec is active or not.
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
Documentation/devicetree/bindings/sound/rt5640.txt | 3 +++
sound/soc/codecs/rt5640.c | 31 ++++++++++++++++++++++
sound/soc/codecs/rt5640.h | 2 ++
3 files changed, 36 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/rt5640.txt b/Documentation/devicetree/bindings/sound/rt5640.txt
index 9e62f6eb348f..57fe64643050 100644
--- a/Documentation/devicetree/bindings/sound/rt5640.txt
+++ b/Documentation/devicetree/bindings/sound/rt5640.txt
@@ -12,6 +12,9 @@ Required properties:
Optional properties:
+- clocks: The phandle of the master clock to the CODEC
+- clock-names: Should be "mclk"
+
- realtek,in1-differential
- realtek,in2-differential
- realtek,in3-differential
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index 11d032cdc658..6cd84fb2196a 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -1949,7 +1949,33 @@ static int rt5640_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
static int rt5640_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level)
{
+ struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
+ int ret;
+
switch (level) {
+ case SND_SOC_BIAS_ON:
+ break;
+
+ case SND_SOC_BIAS_PREPARE:
+ /*
+ * SND_SOC_BIAS_PREPARE is called while preparing for a
+ * transition to ON or away from ON. If current bias_level
+ * is SND_SOC_BIAS_ON, then it is preparing for a transition
+ * away from ON. Disable the clock in that case, otherwise
+ * enable it.
+ */
+ if (IS_ERR(rt5640->mclk))
+ break;
+
+ if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_ON) {
+ clk_disable_unprepare(rt5640->mclk);
+ } else {
+ ret = clk_prepare_enable(rt5640->mclk);
+ if (ret)
+ return ret;
+ }
+ break;
+
case SND_SOC_BIAS_STANDBY:
if (SND_SOC_BIAS_OFF == snd_soc_codec_get_bias_level(codec)) {
snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
@@ -2088,6 +2114,11 @@ static int rt5640_probe(struct snd_soc_codec *codec)
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
+ /* Check if MCLK provided */
+ rt5640->mclk = devm_clk_get(codec->dev, "mclk");
+ if (PTR_ERR(rt5640->mclk) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+
rt5640->codec = codec;
snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF);
diff --git a/sound/soc/codecs/rt5640.h b/sound/soc/codecs/rt5640.h
index 83a7150ddc24..1761c3a98b76 100644
--- a/sound/soc/codecs/rt5640.h
+++ b/sound/soc/codecs/rt5640.h
@@ -12,6 +12,7 @@
#ifndef _RT5640_H
#define _RT5640_H
+#include <linux/clk.h>
#include <sound/rt5640.h>
/* Info */
@@ -2097,6 +2098,7 @@ struct rt5640_priv {
struct snd_soc_codec *codec;
struct rt5640_platform_data pdata;
struct regmap *regmap;
+ struct clk *mclk;
int sysclk;
int sysclk_src;
--
2.7.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Applied "ASoC: rockchip: i2s: add default values for registers" to the asoc tree
2016-02-22 7:56 ` [PATCH v1 1/2] ASoC: rockchip: i2s: add default values for registers Sugar Zhang
@ 2016-02-22 11:13 ` Mark Brown
0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2016-02-22 11:13 UTC (permalink / raw)
To: Sugar Zhang, Mark Brown; +Cc: alsa-devel
The patch
ASoC: rockchip: i2s: add default values for registers
has been applied to the asoc tree at
git://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 ea2e5b96bd6e835052981b777253def60cfd905f Mon Sep 17 00:00:00 2001
From: Sugar Zhang <sugar.zhang@rock-chips.com>
Date: Mon, 22 Feb 2016 15:56:54 +0800
Subject: [PATCH] ASoC: rockchip: i2s: add default values for registers
this patch add default values for registers according description from TRM.
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/rockchip/rockchip_i2s.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index 531a6d201d2e..2f8e20416bd3 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -440,11 +440,21 @@ static bool rockchip_i2s_precious_reg(struct device *dev, unsigned int reg)
}
}
+static const struct reg_default rockchip_i2s_reg_defaults[] = {
+ {0x00, 0x0000000f},
+ {0x04, 0x0000000f},
+ {0x08, 0x00071f1f},
+ {0x10, 0x001f0000},
+ {0x14, 0x01f00000},
+};
+
static const struct regmap_config rockchip_i2s_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
.max_register = I2S_RXDR,
+ .reg_defaults = rockchip_i2s_reg_defaults,
+ .num_reg_defaults = ARRAY_SIZE(rockchip_i2s_reg_defaults),
.writeable_reg = rockchip_i2s_wr_reg,
.readable_reg = rockchip_i2s_rd_reg,
.volatile_reg = rockchip_i2s_volatile_reg,
--
2.7.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v1 0/2] patches to add support for rockchip rt5640 card
2016-02-22 11:04 ` [PATCH v1 0/2] patches to add support for rockchip rt5640 card Mark Brown
@ 2016-02-23 0:57 ` sugar
0 siblings, 0 replies; 7+ messages in thread
From: sugar @ 2016-02-23 0:57 UTC (permalink / raw)
To: Mark Brown
Cc: Oder Chiou, devicetree, alsa-devel, heiko, Pawel Moll,
Ian Campbell, Liam Girdwood, Takashi Iwai, linux-kernel,
linux-rockchip, Rob Herring, Kumar Gala, Bard Liao, Mark Rutland,
linux-arm-kernel
在 2/22/2016 19:04, Mark Brown 写道:
> On Mon, Feb 22, 2016 at 03:56:53PM +0800, Sugar Zhang wrote:
>
>> Sugar Zhang (2):
>> ASoC: rockchip: i2s: add default values for registers
>> ASoC: rt5640: add master clock handling for rt5640
>
> These appear to be commpletly unrelated patches so should each be sent
> individually rather than as a series - that way there is no confusion
> about them possibly depending on each other and they are easier to
> review and apply.
>
Got it, thanks.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-02-23 0:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22 7:56 [PATCH v1 0/2] patches to add support for rockchip rt5640 card Sugar Zhang
2016-02-22 7:56 ` [PATCH v1 1/2] ASoC: rockchip: i2s: add default values for registers Sugar Zhang
2016-02-22 11:13 ` Applied "ASoC: rockchip: i2s: add default values for registers" to the asoc tree Mark Brown
2016-02-22 7:56 ` [PATCH v1 2/2] ASoC: rt5640: add master clock handling for rt5640 Sugar Zhang
2016-02-22 11:13 ` Applied "ASoC: rt5640: add master clock handling for rt5640" to the asoc tree Mark Brown
[not found] ` <1456127815-68575-1-git-send-email-sugar.zhang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-02-22 11:04 ` [PATCH v1 0/2] patches to add support for rockchip rt5640 card Mark Brown
2016-02-23 0:57 ` sugar
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).