Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH v1 0/3] db845c/rb3: add i2s playback support
@ 2024-12-05  2:33 Alexey Klimov
  2024-12-05  2:33 ` [PATCH v1 1/3] ASoC: qcom: common: set codecless link to be a backend Alexey Klimov
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Alexey Klimov @ 2024-12-05  2:33 UTC (permalink / raw)
  To: broonie, konradybcio, andersson, srinivas.kandagatla
  Cc: tiwai, lgirdwood, perex, robh, krzk+dt, conor+dt,
	dmitry.baryshkov, linux-sound, linux-arm-msm, devicetree,
	linux-kernel

There are i2s signals provided in low-speed connector on such boards
as required by 96boards spec. Looks like it is possible to actually
playback something via these pins after adding missing parts here
and there.

I tested simple widely available cheap DACs like UDA1334 and PCM5102A
and they works just fine without need for mclk. I guess any DAC that
can handle 48 kHz and 16bit will do.

In theory db845 can work without mezzanine board and this provides
one more use-case to playback sound and not all mezzanines have cosy
audio connectors.

After staring at
https://patchwork.kernel.org/project/linux-arm-kernel/patch/20210621074152.306362-1-judyhsiao@chromium.org/
I suspect that this might not gonna fly since it requires dummy codec.
Or maybe specific half-dummy qcom codec for such use-case is required to
verify hw parameters. Couldn't say.

Alexey Klimov (3):
  ASoC: qcom: common: set codecless link to be a backend
  ASoC: qcom: sdm845: add handling of secondary MI2S clock
  arm64: dts: qcom: sdm845-db845c: add i2s playback support via LS1
    connector

 arch/arm64/boot/dts/qcom/sdm845-db845c.dts | 43 +++++++++++++++++++++-
 sound/soc/qcom/common.c                    |  4 ++
 sound/soc/qcom/sdm845.c                    |  5 ++-
 3 files changed, 48 insertions(+), 4 deletions(-)

-- 
2.45.2


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

* [PATCH v1 1/3] ASoC: qcom: common: set codecless link to be a backend
  2024-12-05  2:33 [PATCH v1 0/3] db845c/rb3: add i2s playback support Alexey Klimov
@ 2024-12-05  2:33 ` Alexey Klimov
  2024-12-16 21:48   ` Mark Brown
  2024-12-05  2:33 ` [PATCH v1 2/3] ASoC: qcom: sdm845: add handling of secondary MI2S clock Alexey Klimov
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Alexey Klimov @ 2024-12-05  2:33 UTC (permalink / raw)
  To: broonie, konradybcio, andersson, srinivas.kandagatla
  Cc: tiwai, lgirdwood, perex, robh, krzk+dt, conor+dt,
	dmitry.baryshkov, linux-sound, linux-arm-msm, devicetree,
	linux-kernel

When codec subnode is missing in DAI link description in DT
the DAI link codec will be set to a dummy codec and link will be
recognised as front end. Any playback attempt will fail since it
will not be able to install hardware parameters. Fix this by
setting codecless link to be a back end.

Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
---
 sound/soc/qcom/common.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index 928cf5cb5999..e8ae15fcb1a3 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -159,6 +159,10 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
 			link->nonatomic = 1;
 		}
 
+		/* set codecless link with dummy codec to be a backend */
+		if (platform && !codec && link->codecs == &snd_soc_dummy_dlc)
+			link->no_pcm = 1;
+
 		link->stream_name = link->name;
 		link++;
 
-- 
2.45.2


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

* [PATCH v1 2/3] ASoC: qcom: sdm845: add handling of secondary MI2S clock
  2024-12-05  2:33 [PATCH v1 0/3] db845c/rb3: add i2s playback support Alexey Klimov
  2024-12-05  2:33 ` [PATCH v1 1/3] ASoC: qcom: common: set codecless link to be a backend Alexey Klimov
@ 2024-12-05  2:33 ` Alexey Klimov
  2024-12-05  2:33 ` [PATCH v1 3/3] arm64: dts: qcom: sdm845-db845c: add i2s playback support via LS1 connector Alexey Klimov
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Alexey Klimov @ 2024-12-05  2:33 UTC (permalink / raw)
  To: broonie, konradybcio, andersson, srinivas.kandagatla
  Cc: tiwai, lgirdwood, perex, robh, krzk+dt, conor+dt,
	dmitry.baryshkov, linux-sound, linux-arm-msm, devicetree,
	linux-kernel

Add handling of clock related to secondary MI2S_RX in startup, shutdown
and hw params routines. The handing of MI2S_TX and SEC_MI2S clock is
already there so this requires only placing SECONDARY_MI2S_RX in the
correct switch-case choices.

Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
---
 sound/soc/qcom/sdm845.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c
index a479d7e5b7fb..fcc7df75346f 100644
--- a/sound/soc/qcom/sdm845.c
+++ b/sound/soc/qcom/sdm845.c
@@ -215,6 +215,7 @@ static int sdm845_snd_hw_params(struct snd_pcm_substream *substream,
 		ret = sdm845_slim_snd_hw_params(substream, params);
 		break;
 	case QUATERNARY_MI2S_RX:
+	case SECONDARY_MI2S_RX:
 		break;
 	default:
 		pr_err("%s: invalid dai id 0x%x\n", __func__, cpu_dai->id);
@@ -356,6 +357,7 @@ static int sdm845_snd_startup(struct snd_pcm_substream *substream)
 		snd_soc_dai_set_fmt(codec_dai, codec_dai_fmt);
 		break;
 
+	case SECONDARY_MI2S_RX:
 	case SECONDARY_MI2S_TX:
 		codec_dai_fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_I2S;
 		if (++(data->sec_mi2s_clk_count) == 1) {
@@ -371,8 +373,6 @@ static int sdm845_snd_startup(struct snd_pcm_substream *substream)
 			Q6AFE_LPASS_CLK_ID_QUAD_MI2S_IBIT,
 			MI2S_BCLK_RATE, SNDRV_PCM_STREAM_PLAYBACK);
 		snd_soc_dai_set_fmt(cpu_dai, fmt);
-
-
 		break;
 
 	case QUATERNARY_TDM_RX_0:
@@ -441,6 +441,7 @@ static void  sdm845_snd_shutdown(struct snd_pcm_substream *substream)
 		}
 		break;
 
+	case SECONDARY_MI2S_RX:
 	case SECONDARY_MI2S_TX:
 		if (--(data->sec_mi2s_clk_count) == 0) {
 			snd_soc_dai_set_sysclk(cpu_dai,
-- 
2.45.2


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

* [PATCH v1 3/3] arm64: dts: qcom: sdm845-db845c: add i2s playback support via LS1 connector
  2024-12-05  2:33 [PATCH v1 0/3] db845c/rb3: add i2s playback support Alexey Klimov
  2024-12-05  2:33 ` [PATCH v1 1/3] ASoC: qcom: common: set codecless link to be a backend Alexey Klimov
  2024-12-05  2:33 ` [PATCH v1 2/3] ASoC: qcom: sdm845: add handling of secondary MI2S clock Alexey Klimov
@ 2024-12-05  2:33 ` Alexey Klimov
  2024-12-13 13:07   ` Konrad Dybcio
  2024-12-05 12:08 ` [PATCH v1 0/3] db845c/rb3: add i2s playback support Mark Brown
  2024-12-17 13:27 ` (subset) " Mark Brown
  4 siblings, 1 reply; 8+ messages in thread
From: Alexey Klimov @ 2024-12-05  2:33 UTC (permalink / raw)
  To: broonie, konradybcio, andersson, srinivas.kandagatla
  Cc: tiwai, lgirdwood, perex, robh, krzk+dt, conor+dt,
	dmitry.baryshkov, linux-sound, linux-arm-msm, devicetree,
	linux-kernel

DB845c board (RB3 board) has i2s signals exported via the first low-speed
connector and this is also required by 96boards specification. Enable
playback support via this connector. Since this is specific only to DB845c
board the pins configuration is also in this board-specific file only.

This playback output is fixed to 16bit, i2s format and 48 kHz and works
with simple DACs.

It was verified with the following commands:
amixer -c0 cset iface=MIXER,name='SEC_MI2S_RX Audio Mixer MultiMedia3' 1
SDL_AUDIODRIVER="alsa" AUDIODEV="hw:0,2" ffplay -autoexit test.mp3

Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
---
 arch/arm64/boot/dts/qcom/sdm845-db845c.dts | 43 +++++++++++++++++++++-
 1 file changed, 41 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sdm845-db845c.dts b/arch/arm64/boot/dts/qcom/sdm845-db845c.dts
index 1cc0f571e1f7..6ca719281788 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-db845c.dts
+++ b/arch/arm64/boot/dts/qcom/sdm845-db845c.dts
@@ -707,12 +707,21 @@ led@5 {
 	};
 };
 
-/* QUAT I2S Uses 4 I2S SD Lines for audio on LT9611 HDMI Bridge */
 &q6afedai {
+	/* QUAT I2S Uses 4 I2S SD Lines for audio on LT9611 HDMI Bridge */
 	dai@22 {
 		reg = <QUATERNARY_MI2S_RX>;
 		qcom,sd-lines = <0 1 2 3>;
 	};
+
+	/*
+	 * Secondary I2S uses 1 I2S SD Line for audio playback on
+	 * LT9611 HDMI Bridge
+	 */
+	dai@18 {
+		reg = <SECONDARY_MI2S_RX>;
+		qcom,sd-lines = <0>;
+	};
 };
 
 &q6asmdai {
@@ -762,7 +771,8 @@ &sound {
 			 &quat_mi2s_sd0_active
 			 &quat_mi2s_sd1_active
 			 &quat_mi2s_sd2_active
-			 &quat_mi2s_sd3_active>;
+			 &quat_mi2s_sd3_active
+			 &sec_mi2s_active>;
 	pinctrl-names = "default";
 	model = "DB845c";
 	audio-routing =
@@ -852,6 +862,17 @@ codec {
 			sound-dai = <&wcd9340 1>;
 		};
 	};
+
+	i2s-sec-dai-link {
+		link-name = "I2S LS1 Playback";
+		cpu {
+			sound-dai = <&q6afedai SECONDARY_MI2S_RX>;
+		};
+
+		platform {
+			sound-dai = <&q6routing>;
+		};
+	};
 };
 
 &spi0 {
@@ -994,6 +1015,24 @@ reset-n-pins {
 		};
 	};
 
+	sec_mi2s_active: sec-mi2s-active {
+		clk-pins {
+			/* sclk and ws */
+			pins = "gpio80", "gpio81";
+			function = "sec_mi2s";
+			drive-strength = <8>;
+			bias-disable;
+			output-high;
+		};
+
+		data-pins {
+			pins = "gpio82", "gpio83";
+			function = "sec_mi2s";
+			drive-strength = <8>;
+			bias-disable;
+		};
+	};
+
 	sdc2_default_state: sdc2-default-state {
 		clk-pins {
 			pins = "sdc2_clk";
-- 
2.45.2


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

* Re: [PATCH v1 0/3] db845c/rb3: add i2s playback support
  2024-12-05  2:33 [PATCH v1 0/3] db845c/rb3: add i2s playback support Alexey Klimov
                   ` (2 preceding siblings ...)
  2024-12-05  2:33 ` [PATCH v1 3/3] arm64: dts: qcom: sdm845-db845c: add i2s playback support via LS1 connector Alexey Klimov
@ 2024-12-05 12:08 ` Mark Brown
  2024-12-17 13:27 ` (subset) " Mark Brown
  4 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2024-12-05 12:08 UTC (permalink / raw)
  To: Alexey Klimov
  Cc: konradybcio, andersson, srinivas.kandagatla, tiwai, lgirdwood,
	perex, robh, krzk+dt, conor+dt, dmitry.baryshkov, linux-sound,
	linux-arm-msm, devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 765 bytes --]

On Thu, Dec 05, 2024 at 02:33:41AM +0000, Alexey Klimov wrote:

> There are i2s signals provided in low-speed connector on such boards
> as required by 96boards spec. Looks like it is possible to actually
> playback something via these pins after adding missing parts here
> and there.

> I tested simple widely available cheap DACs like UDA1334 and PCM5102A
> and they works just fine without need for mclk. I guess any DAC that
> can handle 48 kHz and 16bit will do.

> In theory db845 can work without mezzanine board and this provides
> one more use-case to playback sound and not all mezzanines have cosy
> audio connectors.

I would expect that when something is connected to the DAI there would
also be a DT update describing that CODEC and it's parameters.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v1 3/3] arm64: dts: qcom: sdm845-db845c: add i2s playback support via LS1 connector
  2024-12-05  2:33 ` [PATCH v1 3/3] arm64: dts: qcom: sdm845-db845c: add i2s playback support via LS1 connector Alexey Klimov
@ 2024-12-13 13:07   ` Konrad Dybcio
  0 siblings, 0 replies; 8+ messages in thread
From: Konrad Dybcio @ 2024-12-13 13:07 UTC (permalink / raw)
  To: Alexey Klimov, broonie, konradybcio, andersson,
	srinivas.kandagatla
  Cc: tiwai, lgirdwood, perex, robh, krzk+dt, conor+dt,
	dmitry.baryshkov, linux-sound, linux-arm-msm, devicetree,
	linux-kernel

On 5.12.2024 3:33 AM, Alexey Klimov wrote:
> DB845c board (RB3 board) has i2s signals exported via the first low-speed
> connector and this is also required by 96boards specification. Enable
> playback support via this connector. Since this is specific only to DB845c
> board the pins configuration is also in this board-specific file only.
> 
> This playback output is fixed to 16bit, i2s format and 48 kHz and works
> with simple DACs.
> 
> It was verified with the following commands:
> amixer -c0 cset iface=MIXER,name='SEC_MI2S_RX Audio Mixer MultiMedia3' 1
> SDL_AUDIODRIVER="alsa" AUDIODEV="hw:0,2" ffplay -autoexit test.mp3
> 
> Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

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

* Re: [PATCH v1 1/3] ASoC: qcom: common: set codecless link to be a backend
  2024-12-05  2:33 ` [PATCH v1 1/3] ASoC: qcom: common: set codecless link to be a backend Alexey Klimov
@ 2024-12-16 21:48   ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2024-12-16 21:48 UTC (permalink / raw)
  To: Alexey Klimov
  Cc: konradybcio, andersson, srinivas.kandagatla, tiwai, lgirdwood,
	perex, robh, krzk+dt, conor+dt, dmitry.baryshkov, linux-sound,
	linux-arm-msm, devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 543 bytes --]

On Thu, Dec 05, 2024 at 02:33:42AM +0000, Alexey Klimov wrote:
> When codec subnode is missing in DAI link description in DT
> the DAI link codec will be set to a dummy codec and link will be
> recognised as front end. Any playback attempt will fail since it
> will not be able to install hardware parameters. Fix this by
> setting codecless link to be a back end.

This is intentional, the sound card should be properly described in the
DT - if there's an expansion board used the description for that should
say what sort of CODEC is there.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: (subset) [PATCH v1 0/3] db845c/rb3: add i2s playback support
  2024-12-05  2:33 [PATCH v1 0/3] db845c/rb3: add i2s playback support Alexey Klimov
                   ` (3 preceding siblings ...)
  2024-12-05 12:08 ` [PATCH v1 0/3] db845c/rb3: add i2s playback support Mark Brown
@ 2024-12-17 13:27 ` Mark Brown
  4 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2024-12-17 13:27 UTC (permalink / raw)
  To: konradybcio, andersson, srinivas.kandagatla, Alexey Klimov
  Cc: tiwai, lgirdwood, perex, robh, krzk+dt, conor+dt,
	dmitry.baryshkov, linux-sound, linux-arm-msm, devicetree,
	linux-kernel

On Thu, 05 Dec 2024 02:33:41 +0000, Alexey Klimov wrote:
> There are i2s signals provided in low-speed connector on such boards
> as required by 96boards spec. Looks like it is possible to actually
> playback something via these pins after adding missing parts here
> and there.
> 
> I tested simple widely available cheap DACs like UDA1334 and PCM5102A
> and they works just fine without need for mclk. I guess any DAC that
> can handle 48 kHz and 16bit will do.
> 
> [...]

Applied to

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

Thanks!

[2/3] ASoC: qcom: sdm845: add handling of secondary MI2S clock
      commit: 8bfb66c75cdace542dabe87841152614fd5b8d91

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] 8+ messages in thread

end of thread, other threads:[~2024-12-17 13:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-05  2:33 [PATCH v1 0/3] db845c/rb3: add i2s playback support Alexey Klimov
2024-12-05  2:33 ` [PATCH v1 1/3] ASoC: qcom: common: set codecless link to be a backend Alexey Klimov
2024-12-16 21:48   ` Mark Brown
2024-12-05  2:33 ` [PATCH v1 2/3] ASoC: qcom: sdm845: add handling of secondary MI2S clock Alexey Klimov
2024-12-05  2:33 ` [PATCH v1 3/3] arm64: dts: qcom: sdm845-db845c: add i2s playback support via LS1 connector Alexey Klimov
2024-12-13 13:07   ` Konrad Dybcio
2024-12-05 12:08 ` [PATCH v1 0/3] db845c/rb3: add i2s playback support Mark Brown
2024-12-17 13:27 ` (subset) " Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox