Skip to contentSkip to conversation

ARM: OMAP: Update board-n800-audio.c with fixes done after first release

PATCH New Jarkko Nikula 1 participant 1 message Mar 2, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: OMAP: Update board-n800-audio.c with fixes done after first release

- Update TSC2301 clock function names
- Fix calling order in n800_eac_disable_ext_clocks
- Remove needless codec PLL startup delay. Codec driver will take care of it
- Separate EAC and sys_clkout2 pin multiplexing

---
 arch/arm/mach-omap2/board-n800-audio.c |   59 ++++++++++++++++++-------------
 1 files changed, 34 insertions(+), 25 deletions(-)
arch/arm/mach-omap2/board-n800-audio.c +34 -25
index 8e36691..b5b107d 100644
@@ -23,7 +23,6 @@
 
 #include <linux/err.h>
 #include <linux/clk.h>
-#include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/spi/tsc2301.h>
 
@@ -44,47 +43,63 @@ static int enable_audio;
 static int audio_ok;
 static spinlock_t audio_lock;
 
-
 /*
- * Leaving EAC pins multiplexed to EAC functionality results
- * in about 2 mA extra current leaked. The workaround is to
- * multiplex the EAC pins to protected mode (with pull-ups enabled)
+ * Leaving EAC and sys_clkout2 pins multiplexed to those subsystems results
+ * in about 2 mA extra current leak when audios are powered down. The
+ * workaround is to multiplex them to protected mode (with pull-ups enabled)
  * whenever audio is not being used.
  */
-static int mux_disabled;
+static int eac_mux_disabled = 0;
+static int clkout2_mux_disabled = 0;
 static u32 saved_mux[2];
 
 static void n800_enable_eac_mux(void)
 {
-	if (!mux_disabled)
+	if (!eac_mux_disabled)
 		return;
-	__raw_writel(saved_mux[0], IO_ADDRESS(0x480000e8));
 	__raw_writel(saved_mux[1], IO_ADDRESS(0x48000124));
-	mux_disabled = 0;
+	eac_mux_disabled = 0;
 }
 
 static void n800_disable_eac_mux(void)
 {
+	if (eac_mux_disabled) {
+		WARN_ON(eac_mux_disabled);
+		return;
+	}
+	saved_mux[1] = __raw_readl(IO_ADDRESS(0x48000124));
+	__raw_writel(0x1f1f1f1f, IO_ADDRESS(0x48000124));
+	eac_mux_disabled = 1;
+}
+
+static void n800_enable_clkout2_mux(void)
+{
+	if (!clkout2_mux_disabled)
+		return;
+	__raw_writel(saved_mux[0], IO_ADDRESS(0x480000e8));
+	clkout2_mux_disabled = 0;
+}
+
+static void n800_disable_clkout2_mux(void)
+{
 	u32 l;
 
-	if (mux_disabled) {
-		WARN_ON(mux_disabled);
+	if (clkout2_mux_disabled) {
+		WARN_ON(clkout2_mux_disabled);
 		return;
 	}
 	saved_mux[0] = __raw_readl(IO_ADDRESS(0x480000e8));
-	saved_mux[1] = __raw_readl(IO_ADDRESS(0x48000124));
 	l = saved_mux[0] & ~0xff;
 	l |= 0x1f;
 	__raw_writel(l, IO_ADDRESS(0x480000e8));
-	__raw_writel(0x1f1f1f1f, IO_ADDRESS(0x48000124));
-	mux_disabled = 1;
+	clkout2_mux_disabled = 1;
 }
 
 static int n800_eac_enable_ext_clocks(struct device *dev)
 {
 	BUG_ON(tsc2301_device == NULL);
 	n800_enable_eac_mux();
-	tsc2301_enable_mclk(tsc2301_device);
+	tsc2301_mixer_enable_mclk(tsc2301_device);
 
 	return 0;
 }
@@ -92,8 +107,8 @@ static int n800_eac_enable_ext_clocks(struct device *dev)
 static void n800_eac_disable_ext_clocks(struct device *dev)
 {
 	BUG_ON(tsc2301_device == NULL);
+	tsc2301_mixer_disable_mclk(tsc2301_device);
 	n800_disable_eac_mux();
-	tsc2301_disable_mclk(tsc2301_device);
 }
 
 static int n800_audio_set_power(void *pdata, int dac, int adc)
@@ -199,20 +214,14 @@ static void n800_codec_put_clocks(struct device *dev)
 
 static int n800_codec_enable_clock(struct device *dev)
 {
-	int err;
-
-	err = clk_enable(sys_clkout2);
-	if (err)
-		return err;
-	/* TODO: 'educated' guess for audio codec's PLL startup delay */
-	mdelay(1);
-
-	return 0;
+	n800_enable_clkout2_mux();
+	return clk_enable(sys_clkout2);
 }
 
 static void n800_codec_disable_clock(struct device *dev)
 {
 	clk_disable(sys_clkout2);
+	n800_disable_clkout2_mux();
 }
 
 static int n800_codec_init(struct device *dev)
Signature · 1 line
1.4.4.4