Skip to contentSkip to conversation

S3C64XX I2S: Return correct codec clock

PATCH New Jassi 3 participants 7 messages Sep 15, 2009 – Sep 16, 2009

Subsystems (3)
lore
Share & tools
lore

Jassi

author
#0 lore raw

PATCH 8/10 S3C64XX I2S: Return correct codec clock

When I2S controller is driven by PCLK, instead of SCLK_AUDIO, we like to have iis_pclk.
Check the source clock selected and return appropriate clock pointer.

---
 sound/soc/s3c24xx/s3c64xx-i2s.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
sound/soc/s3c24xx/s3c64xx-i2s.c +5 -1
index 62a7fce..66f4ded 100644
@@ -133,8 +133,12 @@ static int s3c64xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai,
 struct clk *s3c64xx_i2s_get_clock(struct snd_soc_dai *dai)
 {
 	struct s3c_i2sv2_info *i2s = to_info(dai);
+	u32 iismod = readl(i2s->regs + S3C2412_IISMOD);
 
-	return i2s->iis_cclk;
+	if(iismod & S3C64XX_IISMOD_IMS_SYSMUX)
+		return i2s->iis_cclk;
+	else
+		return i2s->iis_pclk;
 }
 EXPORT_SYMBOL_GPL(s3c64xx_i2s_get_clock);
 
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 8/10 S3C64XX I2S: Return correct codec clock

sound/soc/s3c24xx/s3c64xx-i2s.c static int s3c64xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, · line 141

Quoted 5 lines · Jassi
sound/soc/s3c24xx/s3c64xx-i2s.c +4 -1
-	return i2s->iis_cclk;
+	if(iismod & S3C64XX_IISMOD_IMS_SYSMUX)
+		return i2s->iis_cclk;
+	else
+		return i2s->iis_pclk;

There's three possible clocks here according to the datasheet - PCLK, CLKAUDIO and I2SCLK - so this will still give the wrong clock some of the time. Also, please use checkpatch.

Ideally we wouldn't have to export the clock at all, of course.

#2 lore raw

PATCH 8/10 S3C64XX I2S: Return correct codec clock

Quoted 11 lines · Mark Brown
Quoted 5 lines · Jassi

- ? ? return i2s->iis_cclk;
+ ? ? if(iismod & S3C64XX_IISMOD_IMS_SYSMUX)
+ ? ? ? ? ? ? return i2s->iis_cclk;
+ ? ? else
+ ? ? ? ? ? ? return i2s->iis_pclk;

There's three possible clocks here according to the datasheet - PCLK, CLKAUDIO and I2SCLK - so this will still give the wrong clock some of the time. ?Also, please use checkpatch

Yes, but the existing code doesn't consider I2SCLK at all. The infra isn't there to provide the clock pointer anyhow. Will use checkpatch, thanks.

#3 lore raw

PATCH 8/10 S3C64XX I2S: Return correct codec clock

Quoted 8 lines · jassi brar

On Tue, Sep 15, 2009 at 8:06 PM, Mark Brown

Quoted 3 lines

There's three possible clocks here according to the datasheet - PCLK, CLKAUDIO and I2SCLK - so this will still give the wrong clock some of the time. ?Also, please use checkpatch

Yes, but the existing code doesn't consider I2SCLK at all. The infra isn't there to provide the clock pointer anyhow.

Please put a comment there explaining that, or ideally code that returns an error in those cases, to make it clearer what's being done.

#4 lore raw

PATCH 8/10 S3C64XX I2S: Return correct codec clock

Quoted 7 lines · Mark Brown
Quoted 5 lines · jassi brar

On Tue, Sep 15, 2009 at 8:06 PM, Mark Brown

Quoted 3 lines

There's three possible clocks here according to the datasheet - PCLK, CLKAUDIO and I2SCLK - so this will still give the wrong clock some of the time. ?Also, please use checkpatch

Quoted 5 lines
Quoted 2 lines

Yes, but the existing code doesn't consider I2SCLK at all. The infra isn't there to provide the clock pointer anyhow.

Please put a comment there explaining that, or ideally code that returns an error in those cases, to make it clearer what's being done.

Wait, there is no option for selecting I2SCLK in the manual. That is behind the MUX along with Mpll/Epll Out etc.
In the driver we actually have all the correct options : PCLK or CLKAUDIO(which is the output of the MUX).

The IMS bit can select only either PCLK or CLKAUDIO.So, i guess
the patch is fine as it is.

#5 lore raw

PATCH 8/10 S3C64XX I2S: Return correct codec clock

Quoted 6 lines · jassi brar

Wait, there is no option for selecting I2SCLK in the manual. That is behind the MUX along with Mpll/Epll Out etc.
In the driver we actually have all the correct options : PCLK or CLKAUDIO(which is the output of the MUX).

The IMS bit can select only either PCLK or CLKAUDIO.So, i guess

The datasheet I have says an IMS setting of 11 selects I2SCLK and an IMS setting of 01 selects CLKAUDIOx. This seems odd to say the least but is consistent with the move to a 2 bit register field for IMS rather than adding a second register field for selection of master mode clock. Could just be poor documentation, but it could be a restriction on the clock that can be used in slave mode or an error in the diagram.

Quoted 1 line

the patch is fine as it is.

It at least needs checkpatch issues fixing.

#6 lore raw

PATCH 8/10 S3C64XX I2S: Return correct codec clock

Quoted 7 lines · Mark Brown
Quoted 4 lines · jassi brar

Wait, there is no option for selecting I2SCLK in the manual. That is behind the MUX along with Mpll/Epll Out etc.
In the driver we actually have all the correct options : PCLK or CLKAUDIO(which is the output of the MUX).

Quoted 8 lines
Quoted 1 line

The IMS bit can select only either PCLK or CLKAUDIO.So, i guess

The datasheet I have says an IMS setting of 11 selects I2SCLK and an IMS setting of 01 selects CLKAUDIOx. ?This seems odd to say the least but is consistent with the move to a 2 bit register field for IMS rather than adding a second register field for selection of master mode clock. Could just be poor documentation, but it could be a restriction on the clock that can be used in slave mode or an error in the diagram.

Poor documentation, i guess, for i am myself unaware of any such limitation. Revamping documentation is another part of the initiative.

Quoted 3 lines
Quoted 1 line

?the patch is fine as it is.

It at least needs checkpatch issues fixing.

Ok, will resend. thanks.