Skip to contentSkip to conversation

kirkwood openrd client audio support - v3

PATCH In review [email protected] 4 participants 18 messages May 25, 2010 – May 27, 2010

lore
Share & tools
lore
#0 lore raw

cover kirkwood openrd client audio support - v3

Hi,

It's a new try to get merged kirkwood openrd client support.

The changes are :
- set window configuration according to dma address
- namespaced all cs42l51 #define
- modified cs42l51_dac_names array according to what proposed Mark Brown
- use SOC_DOUBLE_TLV for mic boost

Arnaud

#4 lore raw

Re: [patch 3/5] cs42l51: add asoc driver

Review

Quoted 4 lines · On Tue, May 25, 2010 at 02:22:39PM +0200, [email protected] wrote:
(quoted diff) +4 -0
+	/* route microphone */
+	ret = snd_soc_write(codec, CS42L51_ADC_INPUT, 0xF0);
+	if (ret < 0)
+		goto error_alloc;

As I said last time this really should be visible to userspace rather than fixed function in the driver.

Quoted 1 line

+#define DAPM_EVENT_PRE_POST_PMD (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)

As I said last time this should be in soc-dapm.h rather than in the driver.

Review

Quoted 6 lines
(quoted diff) +6 -0
+	SND_SOC_DAPM_DAC_E("Left DAC", "Left HiFi Playback",
+		CS42L51_POWER_CTL1, 5, 1,
+		cs42l51_pdn_event, DAPM_EVENT_PRE_POST_PMD),
+	SND_SOC_DAPM_DAC_E("Right DAC", "Right HiFi Playback",
+		CS42L51_POWER_CTL1, 6, 1,
+		cs42l51_pdn_event, DAPM_EVENT_PRE_POST_PMD),

Your event here uses snd_soc_write() so for a stereo enable/disable you'll do extra writes. If you changed it to use snd_soc_update_bits() then these would be suppressed.

Review

Quoted 8 lines
(quoted diff) +8 -0
+	switch (format & SND_SOC_DAIFMT_MASTER_MASK) {
+	case SND_SOC_DAIFMT_CBM_CFM:
+		cs42l51->func = MODE_MASTER;
+		break;
+	default:
+	case SND_SOC_DAIFMT_CBS_CFS:
+		cs42l51->func = MODE_SLAVE_AUTO;
+		break;

Is the device really capable of automatically coping with mixed master buses automatically, or should the default be to return an error?

Review

Quoted 1 line
(quoted diff) +1 -0
+	dev_info(&pdev->dev, "CS42L51 ALSA SoC Codec\n");

I really would prefer to remove this.

Review

Quoted 4 lines
(quoted diff) +4 -0
+struct cs42l51_setup_data {
+	int i2c_bus;
+	unsigned short i2c_address;
+};

This is unused and could be removed.

#5 lore raw

Re: [patch 3/5] cs42l51: add asoc driver

Mark Brown <[email protected]> writes:

Hi,

Quoted 10 lines · On Tue, May 25, 2010 at 02:22:39PM +0200, [email protected] wrote:

Review

Quoted 5 lines
(quoted diff) +4 -0
+	/* route microphone */
+	ret = snd_soc_write(codec, CS42L51_ADC_INPUT, 0xF0);
+	if (ret < 0)
+		goto error_alloc;

As I said last time this really should be visible to userspace rather than fixed function in the driver.

It is visible userspace. Look at the DAPM widgets cs42l51_adcl_mux_controls/cs42l51_adcr_mux_controls. It's there to set a nice default.

Quoted 5 lines
Quoted 1 line

+#define DAPM_EVENT_PRE_POST_PMD (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)

As I said last time this should be in soc-dapm.h rather than in the driver.

You told me it was not so important as I'm the only user so I have been lazy and didn't sent a patch for that. Of course, if it's really important, please say it and I'll be happy to send a patch to soc-dapm.h.

Quoted 11 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+	SND_SOC_DAPM_DAC_E("Left DAC", "Left HiFi Playback",
+		CS42L51_POWER_CTL1, 5, 1,
+		cs42l51_pdn_event, DAPM_EVENT_PRE_POST_PMD),
+	SND_SOC_DAPM_DAC_E("Right DAC", "Right HiFi Playback",
+		CS42L51_POWER_CTL1, 6, 1,
+		cs42l51_pdn_event, DAPM_EVENT_PRE_POST_PMD),

Your event here uses snd_soc_write() so for a stereo enable/disable you'll do extra writes. If you changed it to use snd_soc_update_bits() then these would be suppressed.

ok. I didn't know about snd_soc_update_bits()

Quoted 11 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+	switch (format & SND_SOC_DAIFMT_MASTER_MASK) {
+	case SND_SOC_DAIFMT_CBM_CFM:
+		cs42l51->func = MODE_MASTER;
+		break;
+	default:
+	case SND_SOC_DAIFMT_CBS_CFS:
+		cs42l51->func = MODE_SLAVE_AUTO;
+		break;

Is the device really capable of automatically coping with mixed master buses automatically,

hm... seeing such question means it may be yet an other bad naming. The _AUTO part is refering to the speed mode of the codec. It's to set the AUTO bit of the CS42L51_MIC_POWER_CTL reg and avoid most of the clocks configurations.

Quote from the specs:
"Enables the auto-detect circuitry for detecting the speed mode of the CODEC when operating as a slave.
When AUTO is enabled, the MCLK/LRCK ratio must be implemented according to Table 3 on page 39. The SPEED[1:0] bits are ignored when this bit is enabled. Speed is determined by the MCLK/LRCK ratio."

Quoted 1 line

or should the default be to return an error?

I wanted to make sure things were working even with not supported setting but it looks like it was not a good idea otherwise you wouldn't ask. Will fix to return an error.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +1 -0
+	dev_info(&pdev->dev, "CS42L51 ALSA SoC Codec\n");

I really would prefer to remove this.

I'd like to keep it. Being able to tell from logs if the codec driver has been loaded or not is really nice for debugging purpose.

Quoted 7 lines

Review

Quoted 5 lines
(quoted diff) +4 -0
+struct cs42l51_setup_data {
+	int i2c_bus;
+	unsigned short i2c_address;
+};

This is unused and could be removed.

ok.

Thanks,
Arnaud

#6 lore raw

Re: [patch 3/5] cs42l51: add asoc driver

Quoted 11 lines · Arnaud Patard
Quoted 9 lines · Mark Brown

Review

Quoted 4 lines · apatard at mandriva.com
(quoted diff) +4 -0
+	/* route microphone */
+	ret = snd_soc_write(codec, CS42L51_ADC_INPUT, 0xF0);
+	if (ret < 0)
+		goto error_alloc;

As I said last time this really should be visible to userspace rather than fixed function in the driver.

Quoted 3 lines

It is visible userspace. Look at the DAPM widgets cs42l51_adcl_mux_controls/cs42l51_adcr_mux_controls. It's there to set a nice default.

As discussed last time you should use the hardware defaults. This configuration may not be deisrable on some other boards so best to assume that the hardware default will at worst be non-harmful.

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

+#define DAPM_EVENT_PRE_POST_PMD (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)

As I said last time this should be in soc-dapm.h rather than in the driver.

You told me it was not so important as I'm the only user so I have been lazy and didn't sent a patch for that. Of course, if it's really important, please say it and I'll be happy to send a patch to soc-dapm.h.

It wasn't a reason to reject the driver in and of itself but it is disappointing to see that it wasn't fixed when the patch was respun.

Quoted 16 lines
Quoted 11 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+	switch (format & SND_SOC_DAIFMT_MASTER_MASK) {
+	case SND_SOC_DAIFMT_CBM_CFM:
+		cs42l51->func = MODE_MASTER;
+		break;
+	default:
+	case SND_SOC_DAIFMT_CBS_CFS:
+		cs42l51->func = MODE_SLAVE_AUTO;
+		break;

Is the device really capable of automatically coping with mixed master buses automatically,

hm... seeing such question means it may be yet an other bad naming. The _AUTO part is refering to the speed mode of the codec. It's to set the AUTO bit of the CS42L51_MIC_POWER_CTL reg and avoid most of the clocks configurations.

...

Quoted 5 lines
Quoted 1 line

or should the default be to return an error?

I wanted to make sure things were working even with not supported setting but it looks like it was not a good idea otherwise you wouldn't ask. Will fix to return an error.

If you accept the value then it looks like the setting is supposed to work, which it obviously won't do if the device is not able to support it. This won't help anyone trying to debug a broken clocking setup.

Quoted 6 lines
Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	dev_info(&pdev->dev, "CS42L51 ALSA SoC Codec\n");

I really would prefer to remove this.

I'd like to keep it. Being able to tell from logs if the codec driver has been loaded or not is really nice for debugging purpose.

ASoC already generates debug logs for you when the driver is registered with the core, which is the critical bit here. There's no need to clutter up the console with non-information like this, it just slows things down.

#8 lore raw

Re: [patch 4/5] orion/kirkwood: Add i2s support

Quoted 3 lines · On Tue, 25 May 2010, [email protected] wrote:

This patch enables support for the i2s controller available on orion/kirkwood platforms

The actual Orion processor family has no I2S/audio support. It would be better if all the audio related stuff was renamed to "kirkwood" and "KIRKWOOD_*" instead.

sound/soc/orion/Kconfig line 3

Quoted 8 lines

Index: sound-2.6/sound/soc/orion/Kconfig
===================================================================

sound/soc/orion/Kconfig new file +3 -0
@@ -0,0 +1,11 @@
+config SND_ORION_SOC
+	tristate "SoC Audio for the Marvell Orion/Kirkwood chip"
+	depends on ARCH_KIRKWOOD || ARCH_ARCH_ORION5X

ARCH_ARCH_ORION5X should probably be ARCH_ORION5X. But again, this is wrong to add ARCH_ORION5X anyway.

Nicolas

#9 lore raw

Re: [patch 4/5] orion/kirkwood: Add i2s support

Quoted 9 lines · Nicolas Pitre
Quoted 3 lines · apatard at mandriva.com

This patch enables support for the i2s controller available on orion/kirkwood platforms

The actual Orion processor family has no I2S/audio support. ?It would be better if all the audio related stuff was renamed to "kirkwood" and "KIRKWOOD_*" instead.

This i2s was first included in orion90L (6183).

saeed

#10 lore raw

Re: [patch 4/5] orion/kirkwood: Add i2s support

Quoted 11 lines · saeed bishara
Quoted 9 lines · Nicolas Pitre
Quoted 3 lines · On Tue, 25 May 2010, [email protected] wrote:

This patch enables support for the i2s controller available on orion/kirkwood platforms

The actual Orion processor family has no I2S/audio support.  It would be better if all the audio related stuff was renamed to "kirkwood" and "KIRKWOOD_*" instead.

This i2s was first included in orion90L (6183).

This has no presence in the mainline source tree, nor any hardware that people may care about at this point. So it is probably best to refer to it as being kirkwood related more than orion related.

Nicolas

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#11 lore raw

Re: [patch 4/5] orion/kirkwood: Add i2s support

In reply to Nicolas Pitre

Nicolas Pitre <[email protected]> writes:

Hi,

Quoted 9 lines · On Tue, 25 May 2010, [email protected] wrote:
Quoted 4 lines

This patch enables support for the i2s controller available on orion/kirkwood platforms

The actual Orion processor family has no I2S/audio support. It would be better if all the audio related stuff was renamed to "kirkwood" and "KIRKWOOD_*" instead.

I've been told there was some orion with audio. As I've never looked at the orion family in details, I assumed this is right and I've changed the naming accordingly. I can change again but it would be nice to have an agreement here. Who's/what's right ? orion can or can not have i2s audio ?

Arnaud

#12 lore raw

Re: [patch 4/5] orion/kirkwood: Add i2s support

Quoted 10 lines · Arnaud Patard

Nicolas Pitre <[email protected]> writes:

Hi,

Quoted 6 lines · On Tue, 25 May 2010, [email protected] wrote:
Quoted 4 lines

This patch enables support for the i2s controller available on orion/kirkwood platforms

Quoted 7 lines
Quoted 3 lines

The actual Orion processor family has no I2S/audio support. It would be better if all the audio related stuff was renamed to "kirkwood" and "KIRKWOOD_*" instead.

I've been told there was some orion with audio. As I've never looked at the orion family in details, I assumed this is right and I've changed the naming accordingly.

Most Orion flavours don't. And the one that does is not supported in mainline (most probably because hardware is not widely available/interesting).

Quoted 2 lines

I can change again but it would be nice to have an
agreement here. Who's/what's right ? orion can or can not have i2s audio ?

Given that Kirkwood is the first (and perhaps the only one) SOC to make use of this in mainline Linux, I think it is less confusing to name it "kirkwood". That won't prevent the Orion90L from using Kirkwood I2S if that ever happens.

Nicolas

#14 lore raw
In reply to [email protected]
Quoted 7 lines · apatard at mandriva.com

It's a new try to get merged kirkwood openrd client support.

The changes are :
- set window configuration according to dma address
- namespaced all cs42l51 #define
- modified cs42l51_dac_names array according to what proposed Mark Brown
- use SOC_DOUBLE_TLV for mic boost

This looks mostly OK to me - I had a few comments on the CODEC driver but they're fairly minor. It'd be good to get some input from the Kirkwood guys, particularly with regard to the merge path here.

#15 lore raw
Quoted 10 lines · Mark Brown
Quoted 7 lines · On Tue, May 25, 2010 at 02:22:36PM +0200, [email protected] wrote:

It's a new try to get merged kirkwood openrd client support.

The changes are :
- set window configuration according to dma address
- namespaced all cs42l51 #define
- modified cs42l51_dac_names array according to what proposed Mark Brown
- use SOC_DOUBLE_TLV for mic boost

Quoted 3 lines

This looks mostly OK to me - I had a few comments on the CODEC driver but they're fairly minor. It'd be good to get some input from the Kirkwood guys, particularly with regard to the merge path here.

I don't mind if you wish to carry it through the ASOC tree. The bulk of it is ASOC related anyway. However I think that "orion" names should be "kirkwood" throughout instead, as pure Orion chips have no audio interfaces.

Nicolas

#16 lore raw
Quoted 4 lines · Nicolas Pitre

I don't mind if you wish to carry it through the ASOC tree. The bulk of it is ASOC related anyway. However I think that "orion" names should be "kirkwood" throughout instead, as pure Orion chips have no audio interfaces.

Can I add an ack from you for the patches with the name change, then?

#17 lore raw
Quoted 8 lines · Mark Brown
Quoted 4 lines · Nicolas Pitre

I don't mind if you wish to carry it through the ASOC tree. The bulk of it is ASOC related anyway. However I think that "orion" names should be "kirkwood" throughout instead, as pure Orion chips have no audio interfaces.

Can I add an ack from you for the patches with the name change, then?

I'd like to see it first.

Nicolas