Index: linux-2.6.17/sound/soc/pxa/Kconfig
===================================================================
--- linux-2.6.17.orig/sound/soc/pxa/Kconfig	2006-07-26 15:23:12.000000000 +0100
+++ linux-2.6.17/sound/soc/pxa/Kconfig	2006-07-26 15:23:13.000000000 +0100
@@ -90,35 +90,35 @@
 	  with the WM9712.
 
 config SND_PXA2xx_SOC_CORGI
-	tristate "SoC Audio support for Corgi"
-	depends on SND_PXA2xx_SOC
+	tristate "SoC Audio support for Sharp Zaurus SL-C7x0"
+	depends on SND_PXA2xx_SOC && PXA_SHARP_C7xx
 	select SND_PXA2xx_SOC_I2S
 	help
 	  Say Y if you want to add support for SoC audio on Sharp
-	  Zaurus SL-C7x0 models.
+	  Zaurus SL-C7x0 models (Corgi, Shepherd, Husky).
 
 config SND_PXA2xx_SOC_SPITZ
-	tristate "SoC Audio support for Spitz"
-	depends on SND_PXA2xx_SOC
+	tristate "SoC Audio support for Sharp Zaurus SL-Cxx00"
+	depends on SND_PXA2xx_SOC && PXA_SHARP_Cxx00
 	select SND_PXA2xx_SOC_I2S
 	help
 	  Say Y if you want to add support for SoC audio on Sharp
-	  Zaurus SL-Cxx00 models.
+	  Zaurus SL-Cxx00 models (Spitz, Borzoi and Akita).
 
 config SND_PXA2xx_SOC_POODLE
 	tristate "SoC Audio support for Poodle"
-	depends on SND_PXA2xx_SOC
+	depends on SND_PXA2xx_SOC && MACH_POODLE
 	select SND_PXA2xx_SOC_I2S
 	help
 	  Say Y if you want to add support for SoC audio on Sharp
-	  Zaurus SL-5600 models.
+	  Zaurus SL-5600 model (Poodle).
 
 config SND_PXA2xx_SOC_TOSA
 	tristate "SoC AC97 Audio support for Tosa"
-	depends on SND_PXA2xx_SOC
+	depends on SND_PXA2xx_SOC && MACH_TOSA
 	select SND_PXA2xx_SOC_AC97
 	help
 	  Say Y if you want to add support for SoC audio on Sharp
-	  Zaurus SL-C6000x models.
+	  Zaurus SL-C6000x models (Tosa).
 
 endmenu
Index: linux-2.6.17/sound/soc/pxa/corgi.c
===================================================================
--- linux-2.6.17.orig/sound/soc/pxa/corgi.c	2006-07-26 15:23:12.000000000 +0100
+++ linux-2.6.17/sound/soc/pxa/corgi.c	2006-07-26 15:34:13.000000000 +0100
@@ -30,6 +30,7 @@
 #include <sound/soc.h>
 #include <sound/soc-dapm.h>
 
+#include <asm/mach-types.h>
 #include <asm/hardware/scoop.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/hardware.h>
@@ -44,9 +45,8 @@
 #define CORGI_LINE      2
 #define CORGI_HEADSET   3
 #define CORGI_HP_OFF    4
-#define CORGI_SPK_AUTO  0
-#define CORGI_SPK_ON    1
-#define CORGI_SPK_OFF   2
+#define CORGI_SPK_ON    0
+#define CORGI_SPK_OFF   1
 
  /* audio clock in Hz - rounded from 12.235MHz */
 #define CORGI_AUDIO_CLOCK 12288000
@@ -54,8 +54,6 @@
 static int corgi_jack_func = 0;
 static int corgi_spk_func = 0;
 
-#define READ_GPIO_BIT(x)    (GPLR(x) & GPIO_bit(x))
-
 static void corgi_ext_control(struct snd_soc_codec *codec)
 {
 	int spk = 0, mic = 0, line = 0, hp = 0, hs = 0;
@@ -87,8 +85,7 @@
 		break;
 	}
 
-	if ((READ_GPIO_BIT(CORGI_GPIO_AK_INT) && (corgi_spk_func == CORGI_SPK_AUTO))
-			|| (corgi_spk_func == CORGI_SPK_ON))
+	if (corgi_spk_func == CORGI_SPK_ON)
 		spk = 1;
 
 	/* set the enpoints to their new connetion states */
@@ -198,10 +195,10 @@
 };
 
 static const char* jack_function[] = {"Headphone", "Mic", "Line", "Headset", "Off"};
-static const char* spk_function[] = {"Auto", "On", "Off"};
+static const char* spk_function[] = {"On", "Off"};
 static const struct soc_enum corgi_enum[] = {
 	SOC_ENUM_SINGLE_EXT(5, jack_function),
-	SOC_ENUM_SINGLE_EXT(3, spk_function),
+	SOC_ENUM_SINGLE_EXT(2, spk_function),
 };
 
 static const snd_kcontrol_new_t wm8731_corgi_controls[] = {
@@ -301,7 +298,8 @@
 {
 	int ret;
 
-	pxa_gpio_mode(CORGI_GPIO_AK_INT | GPIO_IN);
+	if (!(machine_is_corgi() || machine_is_shepherd() || machine_is_husky()))
+		return -ENODEV;
 
 	corgi_snd_device = platform_device_alloc("soc-audio", -1);
 	if (!corgi_snd_device)
Index: linux-2.6.17/sound/soc/pxa/poodle.c
===================================================================
--- linux-2.6.17.orig/sound/soc/pxa/poodle.c	2006-07-26 15:23:12.000000000 +0100
+++ linux-2.6.17/sound/soc/pxa/poodle.c	2006-07-26 15:23:13.000000000 +0100
@@ -27,6 +27,7 @@
 #include <sound/soc.h>
 #include <sound/soc-dapm.h>
 
+#include <asm/mach-types.h>
 #include <asm/hardware/locomo.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/hardware.h>
@@ -38,9 +39,8 @@
 
 #define POODLE_HP        0
 #define POODLE_HP_OFF    1
-#define POODLE_SPK_AUTO  0
-#define POODLE_SPK_ON    1
-#define POODLE_SPK_OFF   2
+#define POODLE_SPK_ON    0
+#define POODLE_SPK_OFF   1
 
  /* audio clock in Hz - rounded from 12.235MHz */
 #define POODLE_AUDIO_CLOCK 12288000
@@ -48,8 +48,6 @@
 static int poodle_jack_func = 0;
 static int poodle_spk_func = 0;
 
-#define READ_GPIO_BIT(x)    (GPLR(x) & GPIO_bit(x))
-
 static void poodle_ext_control(struct snd_soc_codec *codec)
 {
 	int spk = 0;
@@ -121,9 +119,9 @@
 static int poodle_amp_event(struct snd_soc_dapm_widget* w, int event)
 {
 	if (SND_SOC_DAPM_EVENT_ON(event))
-		locomo_gpio_write2(&poodle_locomo_device, POODLE_LOCOMO_GPIO_AMP_ON, 1);
-	else
 		locomo_gpio_write2(&poodle_locomo_device, POODLE_LOCOMO_GPIO_AMP_ON, 0);
+	else
+		locomo_gpio_write2(&poodle_locomo_device, POODLE_LOCOMO_GPIO_AMP_ON, 1);
 
 	return 0;
 }
@@ -149,10 +147,10 @@
 };
 
 static const char* jack_function[] = {"Headphone", "Off"};
-static const char* spk_function[] = {"Auto", "On", "Off"};
+static const char* spk_function[] = {"On", "Off"};
 static const struct soc_enum poodle_enum[] = {
 	SOC_ENUM_SINGLE_EXT(2, jack_function),
-	SOC_ENUM_SINGLE_EXT(3, spk_function),
+	SOC_ENUM_SINGLE_EXT(2, spk_function),
 };
 
 static const snd_kcontrol_new_t wm8731_poodle_controls[] = {
@@ -252,7 +250,8 @@
 {
 	int ret;
 
-	/*pxa_gpio_mode(POODLE_GPIO_AK_INT | GPIO_IN);*/
+	if (!machine_is_poodle())
+		return -ENODEV;
 
 	locomo_gpio_set_dir2(&poodle_locomo_device, POODLE_LOCOMO_GPIO_AMP_ON, 0);
 	locomo_gpio_set_dir2(&poodle_locomo_device, POODLE_LOCOMO_GPIO_MUTE_L, 0);
Index: linux-2.6.17/sound/soc/pxa/spitz.c
===================================================================
--- linux-2.6.17.orig/sound/soc/pxa/spitz.c	2006-07-26 15:23:12.000000000 +0100
+++ linux-2.6.17/sound/soc/pxa/spitz.c	2006-07-26 15:23:13.000000000 +0100
@@ -30,6 +30,7 @@
 #include <sound/soc.h>
 #include <sound/soc-dapm.h>
 
+#include <asm/mach-types.h>
 #include <asm/hardware/scoop.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/hardware.h>
@@ -44,9 +45,8 @@
 #define SPITZ_LINE      2
 #define SPITZ_HEADSET   3
 #define SPITZ_HP_OFF    4
-#define SPITZ_SPK_AUTO  0
-#define SPITZ_SPK_ON    1
-#define SPITZ_SPK_OFF   2
+#define SPITZ_SPK_ON    0
+#define SPITZ_SPK_OFF   1
 
  /* audio clock in Hz - rounded from 12.235MHz */
 #define SPITZ_AUDIO_CLOCK 12288000
@@ -54,12 +54,9 @@
 static int spitz_jack_func = 0;
 static int spitz_spk_func = 0;
 
-#define READ_GPIO_BIT(x)    (GPLR(x) & GPIO_bit(x))
-
 static void spitz_ext_control(struct snd_soc_codec *codec)
 {
-	if ((spitz_spk_func == SPITZ_SPK_ON) || ((spitz_spk_func == SPITZ_SPK_AUTO)
-			&& READ_GPIO_BIT(SPITZ_GPIO_AK_INT)))
+	if (spitz_spk_func == SPITZ_SPK_ON)
 		snd_soc_dapm_set_endpoint(codec, "Ext Spk", 1);
 	else
 		snd_soc_dapm_set_endpoint(codec, "Ext Spk", 0);
@@ -212,10 +209,10 @@
 };
 
 static const char* jack_function[] = {"Headphone", "Mic", "Line", "Headset", "Off"};
-static const char* spk_function[] = {"Auto", "On", "Off"};
+static const char* spk_function[] = {"On", "Off"};
 static const struct soc_enum spitz_enum[] = {
 	SOC_ENUM_SINGLE_EXT(5, jack_function),
-	SOC_ENUM_SINGLE_EXT(3, spk_function),
+	SOC_ENUM_SINGLE_EXT(2, spk_function),
 };
 
 static const snd_kcontrol_new_t wm8750_spitz_controls[] = {
@@ -323,7 +320,8 @@
 {
 	int ret;
 
-	pxa_gpio_mode(SPITZ_GPIO_AK_INT | GPIO_IN);
+	if (!(machine_is_spitz() || machine_is_borzoi() || machine_is_akita()))
+		return -ENODEV;
 
 	spitz_snd_device = platform_device_alloc("soc-audio", -1);
 	if (!spitz_snd_device)
Index: linux-2.6.17/sound/soc/pxa/tosa.c
===================================================================
--- linux-2.6.17.orig/sound/soc/pxa/tosa.c	2006-07-26 15:23:12.000000000 +0100
+++ linux-2.6.17/sound/soc/pxa/tosa.c	2006-07-26 15:23:13.000000000 +0100
@@ -33,6 +33,7 @@
 #include <sound/soc.h>
 #include <sound/soc-dapm.h>
 
+#include <asm/mach-types.h>
 #include <asm/hardware/tmio.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/hardware.h>
@@ -48,15 +49,12 @@
 #define TOSA_MIC_INT   1
 #define TOSA_HEADSET   2
 #define TOSA_HP_OFF    3
-#define TOSA_SPK_AUTO  0
-#define TOSA_SPK_ON    1
-#define TOSA_SPK_OFF   2
+#define TOSA_SPK_ON    0
+#define TOSA_SPK_OFF   1
 
 static int tosa_jack_func;
 static int tosa_spk_func;
 
-#define READ_GPIO_BIT(x)    (GPLR(x) & GPIO_bit(x))
-
 static void tosa_ext_control(struct snd_soc_codec *codec)
 {
 	int spk = 0, mic_int = 0, hp = 0, hs = 0;
@@ -74,8 +72,7 @@
 		break;
 	}
 
-	if ((READ_GPIO_BIT(TOSA_GPIO_EAR_IN ) && (tosa_spk_func == TOSA_SPK_AUTO))
-			|| (tosa_spk_func == TOSA_SPK_ON))
+	if (tosa_spk_func == TOSA_SPK_ON)
 		spk = 1;
 
 	snd_soc_dapm_set_endpoint(codec, "Speaker", spk);
@@ -171,10 +168,10 @@
 };
 
 static const char* jack_function[] = {"Headphone", "Mic", "Line", "Headset", "Off"};
-static const char* spk_function[] = {"Auto", "On", "Off"};
+static const char* spk_function[] = {"On", "Off"};
 static const struct soc_enum tosa_enum[] = {
 	SOC_ENUM_SINGLE_EXT(5, jack_function),
-	SOC_ENUM_SINGLE_EXT(3, spk_function),
+	SOC_ENUM_SINGLE_EXT(2, spk_function),
 };
 
 static const snd_kcontrol_new_t tosa_controls[] = {
@@ -245,7 +242,8 @@
 {
 	int ret;
 
-	pxa_gpio_mode(TOSA_GPIO_EAR_IN | GPIO_IN);
+	if (! machine_is_tosa())
+		return -ENODEV;
 
 	tosa_snd_device = platform_device_alloc("soc-audio", -1);
 	if (!tosa_snd_device)
Index: linux-2.6.17/sound/soc/soc-core.c
===================================================================
--- linux-2.6.17.orig/sound/soc/soc-core.c	2006-07-26 15:23:12.000000000 +0100
+++ linux-2.6.17/sound/soc/soc-core.c	2006-07-26 15:23:13.000000000 +0100
@@ -1118,7 +1118,7 @@
 		return 0;
 
 	count += sprintf(buf, "%s registers\n", codec->name);
-	for(i = 0; i < codec->reg_cache_size; i +=2) {
+	for(i = 0; i < codec->reg_cache_size; i++) {
 		count += sprintf(buf + count, "%2x: %4x\n", i, codec->read(codec, i));
 	}
 
