alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: wm8960: Clocking tweaks
@ 2023-07-31 10:47 Mark Brown
  2023-07-31 10:47 ` [PATCH 1/2] ASoC: wm8960: Read initial MCLK rate from clock API Mark Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mark Brown @ 2023-07-31 10:47 UTC (permalink / raw)
  To: Liam Girdwood, Jaroslav Kysela, Takashi Iwai
  Cc: patches, alsa-devel, linux-kernel, Mark Brown

A couple of minor clocking improvements that make the wm8960 driver work
a bit better with generic cards.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
Mark Brown (2):
      ASoC: wm8960: Read initial MCLK rate from clock API
      ASoC: wm8960: Make automatic the default clocking mode

 sound/soc/codecs/wm8960.c | 8 ++++++++
 sound/soc/codecs/wm8960.h | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)
---
base-commit: 5d0c230f1de8c7515b6567d9afba1f196fb4e2f4
change-id: 20230730-asoc-wm8960-clk-6c7415ee22b4

Best regards,
-- 
Mark Brown <broonie@kernel.org>


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

* [PATCH 1/2] ASoC: wm8960: Read initial MCLK rate from clock API
  2023-07-31 10:47 [PATCH 0/2] ASoC: wm8960: Clocking tweaks Mark Brown
@ 2023-07-31 10:47 ` Mark Brown
  2023-07-31 15:08   ` Charles Keepax
  2023-07-31 10:47 ` [PATCH 2/2] ASoC: wm8960: Make automatic the default clocking mode Mark Brown
  2023-07-31 22:26 ` [PATCH 0/2] ASoC: wm8960: Clocking tweaks Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2023-07-31 10:47 UTC (permalink / raw)
  To: Liam Girdwood, Jaroslav Kysela, Takashi Iwai
  Cc: patches, alsa-devel, linux-kernel, Mark Brown

When we have a MCLK provided by the clock API read the rate at startup
and store it so that there's something set before the machine driver has
done clocking configuration (eg, if it only configures clocking based on
sample rate).

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/wm8960.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 366f5d769d6d..c0ce1ef75a74 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -1425,6 +1425,14 @@ static int wm8960_i2c_probe(struct i2c_client *i2c)
 	if (IS_ERR(wm8960->mclk)) {
 		if (PTR_ERR(wm8960->mclk) == -EPROBE_DEFER)
 			return -EPROBE_DEFER;
+	} else {
+		ret = clk_get_rate(wm8960->mclk);
+		if (ret >= 0) {
+			wm8960->freq_in = ret;
+		} else {
+			dev_err(&i2c->dev, "Failed to read MCLK rate: %d\n",
+				ret);
+		}
 	}
 
 	wm8960->regmap = devm_regmap_init_i2c(i2c, &wm8960_regmap);

-- 
2.39.2


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

* [PATCH 2/2] ASoC: wm8960: Make automatic the default clocking mode
  2023-07-31 10:47 [PATCH 0/2] ASoC: wm8960: Clocking tweaks Mark Brown
  2023-07-31 10:47 ` [PATCH 1/2] ASoC: wm8960: Read initial MCLK rate from clock API Mark Brown
@ 2023-07-31 10:47 ` Mark Brown
  2023-07-31 15:08   ` Charles Keepax
  2023-07-31 22:26 ` [PATCH 0/2] ASoC: wm8960: Clocking tweaks Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2023-07-31 10:47 UTC (permalink / raw)
  To: Liam Girdwood, Jaroslav Kysela, Takashi Iwai
  Cc: patches, alsa-devel, linux-kernel, Mark Brown

The wm8960 driver supports an automatic clocking mode which will use the
MCLK directly where possible and fall back to the PLL if there is no
suitable configuration directly using the MCLK.  Clock 0 will be used by
the generic cards when configuring things, currently this is a MCLK only
mode but using AUTO mode would be more functional.  Since the driver
still prefers to use MCLK directly where possible there should be no
negative impact on systems which are able to use MCLK directly.

As far as I can see nothing is using the system clock as part of the
ABI, the only reference I can see to a mode in a machine driver is the
Freescale i.MX card which uses the automatic mode with an explicit in
kernel call using the constant so will be unaffected.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/wm8960.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8960.h b/sound/soc/codecs/wm8960.h
index 63ba6c03c488..e8ff33b188e9 100644
--- a/sound/soc/codecs/wm8960.h
+++ b/sound/soc/codecs/wm8960.h
@@ -77,9 +77,9 @@
 #define WM8960_SYSCLK_DIV_1		(0 << 1)
 #define WM8960_SYSCLK_DIV_2		(2 << 1)
 
-#define WM8960_SYSCLK_MCLK		(0 << 0)
+#define WM8960_SYSCLK_AUTO		(0 << 0)
 #define WM8960_SYSCLK_PLL		(1 << 0)
-#define WM8960_SYSCLK_AUTO		(2 << 0)
+#define WM8960_SYSCLK_MCLK		(2 << 0)
 
 #define WM8960_DAC_DIV_1		(0 << 3)
 #define WM8960_DAC_DIV_1_5		(1 << 3)

-- 
2.39.2


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

* Re: [PATCH 1/2] ASoC: wm8960: Read initial MCLK rate from clock API
  2023-07-31 10:47 ` [PATCH 1/2] ASoC: wm8960: Read initial MCLK rate from clock API Mark Brown
@ 2023-07-31 15:08   ` Charles Keepax
  0 siblings, 0 replies; 6+ messages in thread
From: Charles Keepax @ 2023-07-31 15:08 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, patches, alsa-devel,
	linux-kernel

On Mon, Jul 31, 2023 at 11:47:02AM +0100, Mark Brown wrote:
> When we have a MCLK provided by the clock API read the rate at startup
> and store it so that there's something set before the machine driver has
> done clocking configuration (eg, if it only configures clocking based on
> sample rate).
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [PATCH 2/2] ASoC: wm8960: Make automatic the default clocking mode
  2023-07-31 10:47 ` [PATCH 2/2] ASoC: wm8960: Make automatic the default clocking mode Mark Brown
@ 2023-07-31 15:08   ` Charles Keepax
  0 siblings, 0 replies; 6+ messages in thread
From: Charles Keepax @ 2023-07-31 15:08 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, patches, alsa-devel,
	linux-kernel

On Mon, Jul 31, 2023 at 11:47:03AM +0100, Mark Brown wrote:
> The wm8960 driver supports an automatic clocking mode which will use the
> MCLK directly where possible and fall back to the PLL if there is no
> suitable configuration directly using the MCLK.  Clock 0 will be used by
> the generic cards when configuring things, currently this is a MCLK only
> mode but using AUTO mode would be more functional.  Since the driver
> still prefers to use MCLK directly where possible there should be no
> negative impact on systems which are able to use MCLK directly.
> 
> As far as I can see nothing is using the system clock as part of the
> ABI, the only reference I can see to a mode in a machine driver is the
> Freescale i.MX card which uses the automatic mode with an explicit in
> kernel call using the constant so will be unaffected.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [PATCH 0/2] ASoC: wm8960: Clocking tweaks
  2023-07-31 10:47 [PATCH 0/2] ASoC: wm8960: Clocking tweaks Mark Brown
  2023-07-31 10:47 ` [PATCH 1/2] ASoC: wm8960: Read initial MCLK rate from clock API Mark Brown
  2023-07-31 10:47 ` [PATCH 2/2] ASoC: wm8960: Make automatic the default clocking mode Mark Brown
@ 2023-07-31 22:26 ` Mark Brown
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2023-07-31 22:26 UTC (permalink / raw)
  To: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Mark Brown
  Cc: patches, alsa-devel, linux-kernel

On Mon, 31 Jul 2023 11:47:01 +0100, Mark Brown wrote:
> A couple of minor clocking improvements that make the wm8960 driver work
> a bit better with generic cards.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: wm8960: Read initial MCLK rate from clock API
      commit: 0169cc3f200cbd737a57592fc478b24ff3cec3c5
[2/2] ASoC: wm8960: Make automatic the default clocking mode
      commit: 2bbc2df46e67be1a26b9c2b18a581b83e17ccb19

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


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

end of thread, other threads:[~2023-07-31 22:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-31 10:47 [PATCH 0/2] ASoC: wm8960: Clocking tweaks Mark Brown
2023-07-31 10:47 ` [PATCH 1/2] ASoC: wm8960: Read initial MCLK rate from clock API Mark Brown
2023-07-31 15:08   ` Charles Keepax
2023-07-31 10:47 ` [PATCH 2/2] ASoC: wm8960: Make automatic the default clocking mode Mark Brown
2023-07-31 15:08   ` Charles Keepax
2023-07-31 22:26 ` [PATCH 0/2] ASoC: wm8960: Clocking tweaks 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).