Skip to contentSkip to conversation

ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

PATCH Superseded PC Liao 2 participants 8 messages Mar 25, 2016 – Apr 6, 2016

Subsystems (4)

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

PC Liao

author
#0 lore raw

PATCH 1/1 ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver

This patch adds second I2S for rt5650 codec on mt8173-rt5650 machine driver.

---
 .../devicetree/bindings/sound/mt8173-rt5650.txt    |    6 +++
 sound/soc/mediatek/mt8173-rt5650.c                 |   55 ++++++++++++++++++--
 2 files changed, 56 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/sound/mt8173-rt5650.txt +6 -0
index fe5a5ef..0046926 100644
@@ -5,11 +5,17 @@ Required properties:
 - mediatek,audio-codec: the phandles of rt5650 codecs
 - mediatek,platform: the phandle of MT8173 ASoC platform
 
+Optional properties:
+- mediatek,rt5650_i2s: I2S mode of rt5650
+  0: using I2S1 on rt5650 for record
+  1: using I2S2 on rt5650 for record
+
 Example:
 
 	sound {
 		compatible = "mediatek,mt8173-rt5650";
 		mediatek,audio-codec = <&rt5650>;
 		mediatek,platform = <&afe>;
+		mediatek,rt5650_i2s = <0>;
 	};
 
sound/soc/mediatek/mt8173-rt5650.c +50 -5

85 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#1 lore raw

Documentation/devicetree/bindings/sound/mt8173-rt5650.txt Required properties: · line 12

Quoted 5 lines · PC Liao
Documentation/devicetree/bindings/sound/mt8173-rt5650.txt +5 -0
+Optional properties:
+- mediatek,rt5650_i2s: I2S mode of rt5650
+  0: using I2S1 on rt5650 for record
+  1: using I2S2 on rt5650 for record
+

I would expect the machine driver to have a reference to the DAI that is in use rather than a property like this. This is the way pretty much all DT based machine drivers work...

author
#2 lore raw

Hi Mark,

Quoted 11 lines · Mark Brown

Documentation/devicetree/bindings/sound/mt8173-rt5650.txt Required properties: · line 12

Quoted 5 lines · PC Liao
Documentation/devicetree/bindings/sound/mt8173-rt5650.txt +5 -0
+Optional properties:
+- mediatek,rt5650_i2s: I2S mode of rt5650
+  0: using I2S1 on rt5650 for record
+  1: using I2S2 on rt5650 for record
+

I would expect the machine driver to have a reference to the DAI that is in use rather than a property like this. This is the way pretty much all DT based machine drivers work...

Thanks for comment.
I think I need to comment more clearly.
This setting is different connection from MT8173 to rt5650 on hardware.

- mediatek,rt5650_i2s: I2S mode of rt5650
0: Default setting. Playback and record path use same set of I2S. Playback/Record path using same I2S clock connect from MT8173 I2S1 to rt5650 I2S1.
1: Playback and record path use different set of I2S. Playback path connects from MT8173 I2S1 to rt5650 I2S1 and record path connects from MT8173 I2S2 to rt5650 I2S2.

Because we use codec ASRC function and need to initialize on different setting about this parts:
+ switch (mt8173_rt5650_priv.rt5650_i2s) {
+ case MT8173_RT5650_I2S1:
+ rt5645_sel_asrc_clk_src(codec,
+ RT5645_DA_STEREO_FILTER |
+ RT5645_AD_STEREO_FILTER,
+ RT5645_CLK_SEL_I2S1_ASRC);
+ break;
+ case MT8173_RT5650_I2S2:
+ rt5645_sel_asrc_clk_src(codec,
+ RT5645_DA_STEREO_FILTER,
+ RT5645_CLK_SEL_I2S1_ASRC);
+ rt5645_sel_asrc_clk_src(codec,
+ RT5645_AD_STEREO_FILTER,
+ RT5645_CLK_SEL_I2S2_ASRC);
+ break;
+ default:
+ break;
+ }
, we use device tree to determine which connection we choose. Does this explain can be accepted?
Thanks!

maintainer
#3 lore raw
Quoted 10 lines · PC Liao

- mediatek,rt5650_i2s: I2S mode of rt5650
0: Default setting. Playback and record path use same set of I2S. Playback/Record path using same I2S clock connect from MT8173 I2S1 to rt5650 I2S1.
1: Playback and record path use different set of I2S. Playback path connects from MT8173 I2S1 to rt5650 I2S1 and record path connects from MT8173 I2S2 to rt5650 I2S2.

Because we use codec ASRC function and need to initialize on different setting about this parts:

This sort of arrangement is very common - it's often needed to get different sample rates for playback and capture. Normally it'd be represented in the DT by having the two DAI links specified normally and then having the driver look at the DT to see what's connected to work out what mode to use.

author
#4 lore raw

Hi Mark,

Quoted 10 lines · Mark Brown
Quoted 7 lines · PC Liao

- mediatek,rt5650_i2s: I2S mode of rt5650
0: Default setting. Playback and record path use same set of I2S. Playback/Record path using same I2S clock connect from MT8173 I2S1 to rt5650 I2S1.
1: Playback and record path use different set of I2S. Playback path connects from MT8173 I2S1 to rt5650 I2S1 and record path connects from MT8173 I2S2 to rt5650 I2S2.

Quoted 8 lines
Quoted 2 lines

Because we use codec ASRC function and need to initialize on different setting about this parts:

This sort of arrangement is very common - it's often needed to get different sample rates for playback and capture. Normally it'd be represented in the DT by having the two DAI links specified normally and then having the driver look at the DT to see what's connected to work out what mode to use.

Could you please suggest the reference driver about this? Thanks!

maintainer
#5 lore raw
Quoted 9 lines · PC Liao
Quoted 5 lines · Mark Brown

This sort of arrangement is very common - it's often needed to get different sample rates for playback and capture. Normally it'd be represented in the DT by having the two DAI links specified normally and then having the driver look at the DT to see what's connected to work out what mode to use.

Could you please suggest the reference driver about this?

Any driver that can identify an individual DAI within a device by using sound-dai references, even simple-card does this.

author
#6 lore raw

Hi Mark,

Quoted 9 lines · Mark Brown
Quoted 7 lines · PC Liao
Quoted 5 lines · Mark Brown

This sort of arrangement is very common - it's often needed to get different sample rates for playback and capture. Normally it'd be represented in the DT by having the two DAI links specified normally and then having the driver look at the DT to see what's connected to work out what mode to use.

Quoted 4 lines
Quoted 1 line

Could you please suggest the reference driver about this?

Any driver that can identify an individual DAI within a device by using sound-dai references, even simple-card does this.

Thanks for suggestion.
This machine driver is based on DPCM.
Should I add BE DAI and use DAPM, then using ucm-config(mixer control) to control the path?
Or, do I think the wrong direction?
Thanks!

maintainer
#7 lore raw
Quoted 11 lines · PC Liao
Quoted 2 lines · Mark Brown

Any driver that can identify an individual DAI within a device by using sound-dai references, even simple-card does this.

Thanks for suggestion.
This machine driver is based on DPCM.
Should I add BE DAI and use DAPM, then using ucm-config(mixer control) to control the path?
Or, do I think the wrong direction?
Thanks!

It sounds like the configuration is fixed in these systems and can't
be usefully varied at runtime? If that's the case then there's no need
for a userspace control.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160406/ea49fd01/attachment.sig>