* [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836
@ 2011-05-05 17:52 Lars-Peter Clausen
2011-05-05 17:52 ` [PATCH 2/4] ASoC: Do not swap upper and lower byte in snd_soc_4_12_spi_write Lars-Peter Clausen
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Lars-Peter Clausen @ 2011-05-05 17:52 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Mike Frysinger
Cc: device-driver-devel, uclinux-dist-devel, alsa-devel,
Lars-Peter Clausen
Currently there is a special case for the ad1836 in the ASoC generic spi write
functions, which swaps the upper and the lower byte for 4/12 transfers.
This was done, because the 4/12 spi write function was added for the ad1836
for which all of the users are configured to use use 16-bit transfers.
In order to be able to get rid of this special casing switch all users of
ad1836 to 8-bit transfers.
Since 8-bit, no-dma transfers is the default configuration we can remove the
bfin5xx_spi_chip struct for the ad1836 altogether.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
arch/blackfin/mach-bf527/boards/ad7160eval.c | 9 ---------
arch/blackfin/mach-bf527/boards/cm_bf527.c | 9 ---------
arch/blackfin/mach-bf527/boards/ezkit.c | 9 ---------
arch/blackfin/mach-bf533/boards/H8606.c | 8 --------
arch/blackfin/mach-bf533/boards/cm_bf533.c | 8 --------
arch/blackfin/mach-bf533/boards/ezkit.c | 8 --------
arch/blackfin/mach-bf533/boards/stamp.c | 8 --------
arch/blackfin/mach-bf537/boards/cm_bf537e.c | 8 --------
arch/blackfin/mach-bf537/boards/cm_bf537u.c | 8 --------
arch/blackfin/mach-bf537/boards/pnav10.c | 9 ---------
arch/blackfin/mach-bf537/boards/stamp.c | 9 ---------
arch/blackfin/mach-bf537/boards/tcm_bf537.c | 8 --------
arch/blackfin/mach-bf548/boards/ezkit.c | 9 ---------
arch/blackfin/mach-bf561/boards/cm_bf561.c | 8 --------
arch/blackfin/mach-bf561/boards/ezkit.c | 9 ---------
15 files changed, 0 insertions(+), 127 deletions(-)
diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c
index ccab4c6..eb712ce 100644
--- a/arch/blackfin/mach-bf527/boards/ad7160eval.c
+++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c
@@ -269,14 +269,6 @@ static struct bfin5xx_spi_chip spi_flash_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
- || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
static struct bfin5xx_spi_chip mmc_spi_chip_info = {
.enable_dma = 0,
@@ -328,7 +320,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
.bus_num = 0,
.chip_select = 4,
- .controller_data = &ad1836_spi_chip_info,
},
#endif
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
diff --git a/arch/blackfin/mach-bf527/boards/cm_bf527.c b/arch/blackfin/mach-bf527/boards/cm_bf527.c
index c9d6dc8..ccdf2e7 100644
--- a/arch/blackfin/mach-bf527/boards/cm_bf527.c
+++ b/arch/blackfin/mach-bf527/boards/cm_bf527.c
@@ -367,14 +367,6 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
- || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
static struct bfin5xx_spi_chip mmc_spi_chip_info = {
.enable_dma = 0,
@@ -452,7 +444,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
.bus_num = 0,
.chip_select = 4,
- .controller_data = &ad1836_spi_chip_info,
},
#endif
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index 2cd2ff6..503837b 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -460,14 +460,6 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
- || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
static struct bfin5xx_spi_chip mmc_spi_chip_info = {
.enable_dma = 0,
@@ -583,7 +575,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
.bus_num = 0,
.chip_select = 4,
- .controller_data = &ad1836_spi_chip_info,
},
#endif
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
diff --git a/arch/blackfin/mach-bf533/boards/H8606.c b/arch/blackfin/mach-bf533/boards/H8606.c
index d4bfcea..41c9329 100644
--- a/arch/blackfin/mach-bf533/boards/H8606.c
+++ b/arch/blackfin/mach-bf533/boards/H8606.c
@@ -171,13 +171,6 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
/* Notice: for blackfin, the speed_hz is the value of register
* SPI_BAUD, not the real baudrate */
static struct spi_board_info bfin_spi_board_info[] __initdata = {
@@ -212,7 +205,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.max_speed_hz = 16,
.bus_num = 1,
.chip_select = 4,
- .controller_data = &ad1836_spi_chip_info,
},
#endif
diff --git a/arch/blackfin/mach-bf533/boards/cm_bf533.c b/arch/blackfin/mach-bf533/boards/cm_bf533.c
index 4d5604e..2506703 100644
--- a/arch/blackfin/mach-bf533/boards/cm_bf533.c
+++ b/arch/blackfin/mach-bf533/boards/cm_bf533.c
@@ -71,13 +71,6 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
static struct bfin5xx_spi_chip mmc_spi_chip_info = {
.enable_dma = 0,
@@ -116,7 +109,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
.bus_num = 0,
.chip_select = 4,
- .controller_data = &ad1836_spi_chip_info,
},
#endif
diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c
index b67b91d..7d82463 100644
--- a/arch/blackfin/mach-bf533/boards/ezkit.c
+++ b/arch/blackfin/mach-bf533/boards/ezkit.c
@@ -222,13 +222,6 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
static struct bfin5xx_spi_chip spidev_chip_info = {
.enable_dma = 0,
@@ -267,7 +260,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
.bus_num = 0,
.chip_select = 4,
- .controller_data = &ad1836_spi_chip_info,
},
#endif
#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index 43224ef..32091b8 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -184,13 +184,6 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
static struct bfin5xx_spi_chip spidev_chip_info = {
.enable_dma = 0,
@@ -258,7 +251,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.bus_num = 0,
.chip_select = 4,
.platform_data = "ad1836", /* only includes chip name for the moment */
- .controller_data = &ad1836_spi_chip_info,
.mode = SPI_MODE_3,
},
#endif
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537e.c b/arch/blackfin/mach-bf537/boards/cm_bf537e.c
index d582b81..cb0a34e 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537e.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537e.c
@@ -73,13 +73,6 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
static struct bfin5xx_spi_chip mmc_spi_chip_info = {
.enable_dma = 0,
@@ -118,7 +111,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
.bus_num = 0,
.chip_select = 4,
- .controller_data = &ad1836_spi_chip_info,
},
#endif
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537u.c b/arch/blackfin/mach-bf537/boards/cm_bf537u.c
index cbb8098..197a77c 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537u.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537u.c
@@ -74,13 +74,6 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
static struct bfin5xx_spi_chip mmc_spi_chip_info = {
.enable_dma = 0,
@@ -119,7 +112,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
.bus_num = 0,
.chip_select = 4,
- .controller_data = &ad1836_spi_chip_info,
},
#endif
diff --git a/arch/blackfin/mach-bf537/boards/pnav10.c b/arch/blackfin/mach-bf537/boards/pnav10.c
index 9389f03..7037128 100644
--- a/arch/blackfin/mach-bf537/boards/pnav10.c
+++ b/arch/blackfin/mach-bf537/boards/pnav10.c
@@ -197,14 +197,6 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
- || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
static struct bfin5xx_spi_chip mmc_spi_chip_info = {
.enable_dma = 0,
@@ -267,7 +259,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
.bus_num = 0,
.chip_select = 4,
- .controller_data = &ad1836_spi_chip_info,
},
#endif
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 3fa3354..343f969 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -549,14 +549,6 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
- || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_SND_BF5XX_SOC_AD193X) \
|| defined(CONFIG_SND_BF5XX_SOC_AD193X_MODULE)
static struct bfin5xx_spi_chip ad1938_spi_chip_info = {
@@ -1076,7 +1068,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.bus_num = 0,
.chip_select = 4,
.platform_data = "ad1836", /* only includes chip name for the moment */
- .controller_data = &ad1836_spi_chip_info,
.mode = SPI_MODE_3,
},
#endif
diff --git a/arch/blackfin/mach-bf537/boards/tcm_bf537.c b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
index 164a7e0..b720fec 100644
--- a/arch/blackfin/mach-bf537/boards/tcm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
@@ -74,13 +74,6 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
static struct bfin5xx_spi_chip mmc_spi_chip_info = {
.enable_dma = 0,
@@ -119,7 +112,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
.bus_num = 0,
.chip_select = 4,
- .controller_data = &ad1836_spi_chip_info,
},
#endif
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index 93e19a5..002e0f9 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -1013,14 +1013,6 @@ static struct bfin5xx_spi_chip spi_flash_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
- || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
.enable_dma = 0,
@@ -1077,7 +1069,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
.bus_num = 1,
.chip_select = 4,
- .controller_data = &ad1836_spi_chip_info,
},
#endif
#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c
index 87595cd..1418053 100644
--- a/arch/blackfin/mach-bf561/boards/cm_bf561.c
+++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c
@@ -72,13 +72,6 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
static struct bfin5xx_spi_chip mmc_spi_chip_info = {
.enable_dma = 0,
@@ -117,7 +110,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
.bus_num = 0,
.chip_select = 4,
- .controller_data = &ad1836_spi_chip_info,
},
#endif
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c
index f667e77..9f58605 100644
--- a/arch/blackfin/mach-bf561/boards/ezkit.c
+++ b/arch/blackfin/mach-bf561/boards/ezkit.c
@@ -275,14 +275,6 @@ static struct platform_device ezkit_flash_device = {
};
#endif
-#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
- || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
-static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
- .enable_dma = 0,
- .bits_per_word = 16,
-};
-#endif
-
#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
static struct bfin5xx_spi_chip spidev_chip_info = {
.enable_dma = 0,
@@ -337,7 +329,6 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
.bus_num = 0,
.chip_select = 4,
.platform_data = "ad1836", /* only includes chip name for the moment */
- .controller_data = &ad1836_spi_chip_info,
.mode = SPI_MODE_3,
},
#endif
--
1.7.2.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/4] ASoC: Do not swap upper and lower byte in snd_soc_4_12_spi_write
2011-05-05 17:52 [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836 Lars-Peter Clausen
@ 2011-05-05 17:52 ` Lars-Peter Clausen
2011-05-05 17:52 ` [PATCH 3/4] ASoC: Get rid of snd_soc_*_*_spi_write wrapper functions Lars-Peter Clausen
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: Lars-Peter Clausen @ 2011-05-05 17:52 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Mike Frysinger
Cc: device-driver-devel, uclinux-dist-devel, alsa-devel,
Lars-Peter Clausen
snd_soc_4_12_spi_write swaps the upper and the lower byte of the to be
transferred data. The function was added for the ad1836, which was used in
16bit mode on the blackfin boards. In this mode the blackfin SPI core swaps the
upper and the lower byte before putting them on the wire (i.e interprets the
word as litte-endian), so the data had to be passed in reversed, so it would
appear in correct order on the wire.
Since this behaviour not necessarily applicable to other configurations
remove the special case.
The blackfin boards using the ad1836 were changed to used 8-bit mode in the
previous commit.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/soc-cache.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index a217db2..080fab2 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -115,8 +115,8 @@ static int snd_soc_4_12_spi_write(void *control_data, const char *data,
{
u8 msg[2];
- msg[0] = data[1];
- msg[1] = data[0];
+ msg[0] = data[0];
+ msg[1] = data[1];
return do_spi_write(control_data, msg, len);
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/4] ASoC: Get rid of snd_soc_*_*_spi_write wrapper functions
2011-05-05 17:52 [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836 Lars-Peter Clausen
2011-05-05 17:52 ` [PATCH 2/4] ASoC: Do not swap upper and lower byte in snd_soc_4_12_spi_write Lars-Peter Clausen
@ 2011-05-05 17:52 ` Lars-Peter Clausen
2011-05-12 12:25 ` Barry Song
2011-05-05 17:52 ` [PATCH 4/4] ASoC: Use spi_write in do_spi_write Lars-Peter Clausen
2011-05-05 22:56 ` [uclinux-dist-devel] [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836 Mike Frysinger
3 siblings, 1 reply; 12+ messages in thread
From: Lars-Peter Clausen @ 2011-05-05 17:52 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Mike Frysinger
Cc: device-driver-devel, uclinux-dist-devel, alsa-devel,
Lars-Peter Clausen
All the different snd_soc_*_*_spi_write functions are nothing but mere wrappers
around do_spi_write().
This patch removes them and uses do_spi_write directly as the codecs hw_write
callback instead.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/soc-cache.c | 108 ++-----------------------------------------------
1 files changed, 4 insertions(+), 104 deletions(-)
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 080fab2..f1ee207 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -21,7 +21,7 @@
#include <trace/events/asoc.h>
#if defined(CONFIG_SPI_MASTER)
-static int do_spi_write(void *control_data, const void *msg,
+static int do_spi_write(void *control_data, const char *msg,
int len)
{
struct spi_device *spi = control_data;
@@ -42,6 +42,8 @@ static int do_spi_write(void *control_data, const void *msg,
return len;
}
+#else
+#define do_spi_write NULL
#endif
static int do_hw_write(struct snd_soc_codec *codec, unsigned int reg,
@@ -109,21 +111,6 @@ static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg,
return do_hw_write(codec, reg, value, data, 2);
}
-#if defined(CONFIG_SPI_MASTER)
-static int snd_soc_4_12_spi_write(void *control_data, const char *data,
- int len)
-{
- u8 msg[2];
-
- msg[0] = data[0];
- msg[1] = data[1];
-
- return do_spi_write(control_data, msg, len);
-}
-#else
-#define snd_soc_4_12_spi_write NULL
-#endif
-
static unsigned int snd_soc_7_9_read(struct snd_soc_codec *codec,
unsigned int reg)
{
@@ -141,21 +128,6 @@ static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg,
return do_hw_write(codec, reg, value, data, 2);
}
-#if defined(CONFIG_SPI_MASTER)
-static int snd_soc_7_9_spi_write(void *control_data, const char *data,
- int len)
-{
- u8 msg[2];
-
- msg[0] = data[0];
- msg[1] = data[1];
-
- return do_spi_write(control_data, msg, len);
-}
-#else
-#define snd_soc_7_9_spi_write NULL
-#endif
-
static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg,
unsigned int value)
{
@@ -174,21 +146,6 @@ static unsigned int snd_soc_8_8_read(struct snd_soc_codec *codec,
return do_hw_read(codec, reg);
}
-#if defined(CONFIG_SPI_MASTER)
-static int snd_soc_8_8_spi_write(void *control_data, const char *data,
- int len)
-{
- u8 msg[2];
-
- msg[0] = data[0];
- msg[1] = data[1];
-
- return do_spi_write(control_data, msg, len);
-}
-#else
-#define snd_soc_8_8_spi_write NULL
-#endif
-
static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg,
unsigned int value)
{
@@ -207,22 +164,6 @@ static unsigned int snd_soc_8_16_read(struct snd_soc_codec *codec,
return do_hw_read(codec, reg);
}
-#if defined(CONFIG_SPI_MASTER)
-static int snd_soc_8_16_spi_write(void *control_data, const char *data,
- int len)
-{
- u8 msg[3];
-
- msg[0] = data[0];
- msg[1] = data[1];
- msg[2] = data[2];
-
- return do_spi_write(control_data, msg, len);
-}
-#else
-#define snd_soc_8_16_spi_write NULL
-#endif
-
#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
static unsigned int do_i2c_read(struct snd_soc_codec *codec,
void *reg, int reglen,
@@ -324,22 +265,6 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg,
return do_hw_write(codec, reg, value, data, 3);
}
-#if defined(CONFIG_SPI_MASTER)
-static int snd_soc_16_8_spi_write(void *control_data, const char *data,
- int len)
-{
- u8 msg[3];
-
- msg[0] = data[0];
- msg[1] = data[1];
- msg[2] = data[2];
-
- return do_spi_write(control_data, msg, len);
-}
-#else
-#define snd_soc_16_8_spi_write NULL
-#endif
-
#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
static unsigned int snd_soc_16_16_read_i2c(struct snd_soc_codec *codec,
unsigned int r)
@@ -376,23 +301,6 @@ static int snd_soc_16_16_write(struct snd_soc_codec *codec, unsigned int reg,
return do_hw_write(codec, reg, value, data, 4);
}
-#if defined(CONFIG_SPI_MASTER)
-static int snd_soc_16_16_spi_write(void *control_data, const char *data,
- int len)
-{
- u8 msg[4];
-
- msg[0] = data[0];
- msg[1] = data[1];
- msg[2] = data[2];
- msg[3] = data[3];
-
- return do_spi_write(control_data, msg, len);
-}
-#else
-#define snd_soc_16_16_spi_write NULL
-#endif
-
/* Primitive bulk write support for soc-cache. The data pointed to by
* `data' needs to already be in the form the hardware expects
* including any leading register specific data. Any data written
@@ -440,43 +348,36 @@ static struct {
int addr_bits;
int data_bits;
int (*write)(struct snd_soc_codec *codec, unsigned int, unsigned int);
- int (*spi_write)(void *, const char *, int);
unsigned int (*read)(struct snd_soc_codec *, unsigned int);
unsigned int (*i2c_read)(struct snd_soc_codec *, unsigned int);
} io_types[] = {
{
.addr_bits = 4, .data_bits = 12,
.write = snd_soc_4_12_write, .read = snd_soc_4_12_read,
- .spi_write = snd_soc_4_12_spi_write,
},
{
.addr_bits = 7, .data_bits = 9,
.write = snd_soc_7_9_write, .read = snd_soc_7_9_read,
- .spi_write = snd_soc_7_9_spi_write,
},
{
.addr_bits = 8, .data_bits = 8,
.write = snd_soc_8_8_write, .read = snd_soc_8_8_read,
.i2c_read = snd_soc_8_8_read_i2c,
- .spi_write = snd_soc_8_8_spi_write,
},
{
.addr_bits = 8, .data_bits = 16,
.write = snd_soc_8_16_write, .read = snd_soc_8_16_read,
.i2c_read = snd_soc_8_16_read_i2c,
- .spi_write = snd_soc_8_16_spi_write,
},
{
.addr_bits = 16, .data_bits = 8,
.write = snd_soc_16_8_write, .read = snd_soc_16_8_read,
.i2c_read = snd_soc_16_8_read_i2c,
- .spi_write = snd_soc_16_8_spi_write,
},
{
.addr_bits = 16, .data_bits = 16,
.write = snd_soc_16_16_write, .read = snd_soc_16_16_read,
.i2c_read = snd_soc_16_16_read_i2c,
- .spi_write = snd_soc_16_16_spi_write,
},
};
@@ -537,8 +438,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
break;
case SND_SOC_SPI:
- if (io_types[i].spi_write)
- codec->hw_write = io_types[i].spi_write;
+ codec->hw_write = do_spi_write;
codec->control_data = container_of(codec->dev,
struct spi_device,
--
1.7.2.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/4] ASoC: Use spi_write in do_spi_write
2011-05-05 17:52 [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836 Lars-Peter Clausen
2011-05-05 17:52 ` [PATCH 2/4] ASoC: Do not swap upper and lower byte in snd_soc_4_12_spi_write Lars-Peter Clausen
2011-05-05 17:52 ` [PATCH 3/4] ASoC: Get rid of snd_soc_*_*_spi_write wrapper functions Lars-Peter Clausen
@ 2011-05-05 17:52 ` Lars-Peter Clausen
2011-05-05 22:56 ` [uclinux-dist-devel] [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836 Mike Frysinger
3 siblings, 0 replies; 12+ messages in thread
From: Lars-Peter Clausen @ 2011-05-05 17:52 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Mike Frysinger
Cc: device-driver-devel, uclinux-dist-devel, alsa-devel,
Lars-Peter Clausen
Instead of open-coding the spi transfer use spi_write.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/soc-cache.c | 14 ++++----------
1 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index f1ee207..3897d4a 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -25,20 +25,14 @@ static int do_spi_write(void *control_data, const char *msg,
int len)
{
struct spi_device *spi = control_data;
- struct spi_transfer t;
- struct spi_message m;
+ int ret;
if (len <= 0)
return 0;
- spi_message_init(&m);
- memset(&t, 0, sizeof t);
-
- t.tx_buf = msg;
- t.len = len;
-
- spi_message_add_tail(&t, &m);
- spi_sync(spi, &m);
+ ret = spi_write(spi, msg, len);
+ if (ret < 0)
+ return ret;
return len;
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [uclinux-dist-devel] [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836
2011-05-05 17:52 [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836 Lars-Peter Clausen
` (2 preceding siblings ...)
2011-05-05 17:52 ` [PATCH 4/4] ASoC: Use spi_write in do_spi_write Lars-Peter Clausen
@ 2011-05-05 22:56 ` Mike Frysinger
2011-05-06 12:28 ` Lars-Peter Clausen
3 siblings, 1 reply; 12+ messages in thread
From: Mike Frysinger @ 2011-05-05 22:56 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: device-driver-devel, uclinux-dist-devel, alsa-devel, Mark Brown,
Liam Girdwood
On Thu, May 5, 2011 at 13:52, Lars-Peter Clausen wrote:
> Currently there is a special case for the ad1836 in the ASoC generic spi write
> functions, which swaps the upper and the lower byte for 4/12 transfers.
> This was done, because the 4/12 spi write function was added for the ad1836
> for which all of the users are configured to use use 16-bit transfers.
> In order to be able to get rid of this special casing switch all users of
> ad1836 to 8-bit transfers.
16bit spi transfers are inherently less overhead than 8bit transfers.
so if the codec supports it, we should use it rather than drop 16bit
support everywhere because 8bit is simpler. am i missing something
obvious ?
-mike
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [uclinux-dist-devel] [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836
2011-05-05 22:56 ` [uclinux-dist-devel] [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836 Mike Frysinger
@ 2011-05-06 12:28 ` Lars-Peter Clausen
2011-05-06 12:48 ` Mark Brown
0 siblings, 1 reply; 12+ messages in thread
From: Lars-Peter Clausen @ 2011-05-06 12:28 UTC (permalink / raw)
To: Mike Frysinger
Cc: uclinux-dist-devel, alsa-devel, Mark Brown, device-drivers-devel,
Liam Girdwood
On 05/06/2011 12:56 AM, Mike Frysinger wrote:
> On Thu, May 5, 2011 at 13:52, Lars-Peter Clausen wrote:
>> Currently there is a special case for the ad1836 in the ASoC generic spi write
>> functions, which swaps the upper and the lower byte for 4/12 transfers.
>> This was done, because the 4/12 spi write function was added for the ad1836
>> for which all of the users are configured to use use 16-bit transfers.
>> In order to be able to get rid of this special casing switch all users of
>> ad1836 to 8-bit transfers.
>
> 16bit spi transfers are inherently less overhead than 8bit transfers.
> so if the codec supports it, we should use it rather than drop 16bit
> support everywhere because 8bit is simpler. am i missing something
> obvious ?
> -mike
At some point the codec driver used u16 for the type of the data to be
transferred, so 16bit transfers where fine then.
But at some point the driver was updated to use the snd_soc_cache
infrastructure, which uses a u8[2] array for the data to be transferred.
The snd_soc_cache infrastructure has several helper functions for writing spi
on a spi bus. The one used by the ad1836 was specifically added for the ad1836
and is special compared to the other spi helper functions in the regard that it
swaps the upper and the lower byte of the to be transferred data.
While this works on blackfin which is litte-endian this scheme will obviously
fail on big-endian machines. Also this might not work for other codecs which
want to reuse the same helper function.
And furthermore it disallows more generalization of the spi write functions in
snd_soc_cache, which is done in the follow-up patches.
If we wanted to use 16-bit spi transfers we would have to add something generic
to the do_spi_write function, which swaps the upper and the lower byte of each
short to be transferred if the host is little-endian.
- Lars
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [uclinux-dist-devel] [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836
2011-05-06 12:28 ` Lars-Peter Clausen
@ 2011-05-06 12:48 ` Mark Brown
2011-05-06 13:12 ` [Device-drivers-devel] " Mike Frysinger
2011-05-06 13:19 ` Lars-Peter Clausen
0 siblings, 2 replies; 12+ messages in thread
From: Mark Brown @ 2011-05-06 12:48 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: uclinux-dist-devel, alsa-devel, Mike Frysinger,
device-drivers-devel, Liam Girdwood
On Fri, May 06, 2011 at 02:28:32PM +0200, Lars-Peter Clausen wrote:
> The snd_soc_cache infrastructure has several helper functions for writing spi
> on a spi bus. The one used by the ad1836 was specifically added for the ad1836
> and is special compared to the other spi helper functions in the regard that it
> swaps the upper and the lower byte of the to be transferred data.
> While this works on blackfin which is litte-endian this scheme will obviously
> fail on big-endian machines. Also this might not work for other codecs which
> want to reuse the same helper function.
So clearly the cache stuff ought to be using cpu_to_be16 for this stuff.
At present we've been lazy about this as on most CPUs the swap boils
down to a noop. If we do end up needing both swaps then we just add
this as another parameter in the cache infrastructure.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Device-drivers-devel] [uclinux-dist-devel] [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836
2011-05-06 12:48 ` Mark Brown
@ 2011-05-06 13:12 ` Mike Frysinger
2011-05-06 13:19 ` Lars-Peter Clausen
1 sibling, 0 replies; 12+ messages in thread
From: Mike Frysinger @ 2011-05-06 13:12 UTC (permalink / raw)
To: Mark Brown
Cc: uclinux-dist-devel, alsa-devel, Lars-Peter Clausen,
device-drivers-devel, Liam Girdwood
On Fri, May 6, 2011 at 08:48, Mark Brown wrote:
> On Fri, May 06, 2011 at 02:28:32PM +0200, Lars-Peter Clausen wrote:
>> The snd_soc_cache infrastructure has several helper functions for writing spi
>> on a spi bus. The one used by the ad1836 was specifically added for the ad1836
>> and is special compared to the other spi helper functions in the regard that it
>> swaps the upper and the lower byte of the to be transferred data.
>> While this works on blackfin which is litte-endian this scheme will obviously
>> fail on big-endian machines. Also this might not work for other codecs which
>> want to reuse the same helper function.
>
> So clearly the cache stuff ought to be using cpu_to_be16 for this stuff.
> At present we've been lazy about this as on most CPUs the swap boils
> down to a noop. If we do end up needing both swaps then we just add
> this as another parameter in the cache infrastructure.
indeed ... this is the direction i'd rather head rather than drop all
the existing stuff down to 8bit only.
-mike
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [uclinux-dist-devel] [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836
2011-05-06 12:48 ` Mark Brown
2011-05-06 13:12 ` [Device-drivers-devel] " Mike Frysinger
@ 2011-05-06 13:19 ` Lars-Peter Clausen
2011-05-06 13:26 ` Mark Brown
1 sibling, 1 reply; 12+ messages in thread
From: Lars-Peter Clausen @ 2011-05-06 13:19 UTC (permalink / raw)
To: Mark Brown
Cc: uclinux-dist-devel, alsa-devel, Mike Frysinger,
device-drivers-devel, Liam Girdwood
On 05/06/2011 02:48 PM, Mark Brown wrote:
> On Fri, May 06, 2011 at 02:28:32PM +0200, Lars-Peter Clausen wrote:
>
>> The snd_soc_cache infrastructure has several helper functions for writing spi
>> on a spi bus. The one used by the ad1836 was specifically added for the ad1836
>> and is special compared to the other spi helper functions in the regard that it
>> swaps the upper and the lower byte of the to be transferred data.
>> While this works on blackfin which is litte-endian this scheme will obviously
>> fail on big-endian machines. Also this might not work for other codecs which
>> want to reuse the same helper function.
>
> So clearly the cache stuff ought to be using cpu_to_be16 for this stuff.
> At present we've been lazy about this as on most CPUs the swap boils
> down to a noop. If we do end up needing both swaps then we just add
> this as another parameter in the cache infrastructure.
Currently everything is stored as big endian.
The easiest way to support 16-bit spi writes on little endian systems, would be
to add a do_spi_write16 which would be used for those devices. On big-endian
systems it would be an alias to do_spi_write, on litte-endian systems it would
perform a byte swap on the buffer.
An alternative would be to provide litte-endian versions of snd_soc_x_y_write.
This would amount to more code, but less runtime overhead since we can store it
in litte-endian format right away instead of having to swap the bytes.
- Lars
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [uclinux-dist-devel] [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836
2011-05-06 13:19 ` Lars-Peter Clausen
@ 2011-05-06 13:26 ` Mark Brown
2011-05-06 13:31 ` Lars-Peter Clausen
0 siblings, 1 reply; 12+ messages in thread
From: Mark Brown @ 2011-05-06 13:26 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: uclinux-dist-devel, alsa-devel, Mike Frysinger,
device-drivers-devel, Liam Girdwood
On Fri, May 06, 2011 at 03:19:51PM +0200, Lars-Peter Clausen wrote:
> On 05/06/2011 02:48 PM, Mark Brown wrote:
> > So clearly the cache stuff ought to be using cpu_to_be16 for this stuff.
> > At present we've been lazy about this as on most CPUs the swap boils
> > down to a noop. If we do end up needing both swaps then we just add
> > this as another parameter in the cache infrastructure.
> Currently everything is stored as big endian.
What do you mean? The cache is CPU native.
> The easiest way to support 16-bit spi writes on little endian systems, would be
> to add a do_spi_write16 which would be used for those devices. On big-endian
> systems it would be an alias to do_spi_write, on litte-endian systems it would
> perform a byte swap on the buffer.
> An alternative would be to provide litte-endian versions of snd_soc_x_y_write.
> This would amount to more code, but less runtime overhead since we can store it
> in litte-endian format right away instead of having to swap the bytes.
This would also support bulk operations direct from cache.
Either of these would be an example of using cpu_to_() as I suggested.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [uclinux-dist-devel] [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836
2011-05-06 13:26 ` Mark Brown
@ 2011-05-06 13:31 ` Lars-Peter Clausen
0 siblings, 0 replies; 12+ messages in thread
From: Lars-Peter Clausen @ 2011-05-06 13:31 UTC (permalink / raw)
To: Mark Brown
Cc: uclinux-dist-devel, alsa-devel, Mike Frysinger,
device-drivers-devel, Liam Girdwood
On 05/06/2011 03:26 PM, Mark Brown wrote:
> On Fri, May 06, 2011 at 03:19:51PM +0200, Lars-Peter Clausen wrote:
>> On 05/06/2011 02:48 PM, Mark Brown wrote:
>
>>> So clearly the cache stuff ought to be using cpu_to_be16 for this stuff.
>>> At present we've been lazy about this as on most CPUs the swap boils
>>> down to a noop. If we do end up needing both swaps then we just add
>>> this as another parameter in the cache infrastructure.
>
>> Currently everything is stored as big endian.
>
> What do you mean? The cache is CPU native.
>
Sorry, I meant the buffer which is transmitted not the cache it-self.
- Lars
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/4] ASoC: Get rid of snd_soc_*_*_spi_write wrapper functions
2011-05-05 17:52 ` [PATCH 3/4] ASoC: Get rid of snd_soc_*_*_spi_write wrapper functions Lars-Peter Clausen
@ 2011-05-12 12:25 ` Barry Song
0 siblings, 0 replies; 12+ messages in thread
From: Barry Song @ 2011-05-12 12:25 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: alsa-devel, Mike Frysinger, Mark Brown, device-driver-devel,
uclinux-dist-devel, Liam Girdwood
2011/5/6 Lars-Peter Clausen <lars@metafoo.de>:
> All the different snd_soc_*_*_spi_write functions are nothing but mere wrappers
> around do_spi_write().
> This patch removes them and uses do_spi_write directly as the codecs hw_write
> callback instead.
i don't know whether something has changed. i remember i once wrote
some callbacks due to different hardware register layout or other
hardware issues.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
> sound/soc/soc-cache.c | 108 ++-----------------------------------------------
> 1 files changed, 4 insertions(+), 104 deletions(-)
>
> diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
> index 080fab2..f1ee207 100644
> --- a/sound/soc/soc-cache.c
> +++ b/sound/soc/soc-cache.c
> @@ -21,7 +21,7 @@
> #include <trace/events/asoc.h>
>
> #if defined(CONFIG_SPI_MASTER)
> -static int do_spi_write(void *control_data, const void *msg,
> +static int do_spi_write(void *control_data, const char *msg,
> int len)
> {
> struct spi_device *spi = control_data;
> @@ -42,6 +42,8 @@ static int do_spi_write(void *control_data, const void *msg,
>
> return len;
> }
> +#else
> +#define do_spi_write NULL
> #endif
>
> static int do_hw_write(struct snd_soc_codec *codec, unsigned int reg,
> @@ -109,21 +111,6 @@ static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg,
> return do_hw_write(codec, reg, value, data, 2);
> }
>
> -#if defined(CONFIG_SPI_MASTER)
> -static int snd_soc_4_12_spi_write(void *control_data, const char *data,
> - int len)
> -{
> - u8 msg[2];
> -
> - msg[0] = data[0];
> - msg[1] = data[1];
> -
> - return do_spi_write(control_data, msg, len);
> -}
> -#else
> -#define snd_soc_4_12_spi_write NULL
> -#endif
> -
> static unsigned int snd_soc_7_9_read(struct snd_soc_codec *codec,
> unsigned int reg)
> {
> @@ -141,21 +128,6 @@ static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg,
> return do_hw_write(codec, reg, value, data, 2);
> }
>
> -#if defined(CONFIG_SPI_MASTER)
> -static int snd_soc_7_9_spi_write(void *control_data, const char *data,
> - int len)
> -{
> - u8 msg[2];
> -
> - msg[0] = data[0];
> - msg[1] = data[1];
> -
> - return do_spi_write(control_data, msg, len);
> -}
> -#else
> -#define snd_soc_7_9_spi_write NULL
> -#endif
> -
> static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg,
> unsigned int value)
> {
> @@ -174,21 +146,6 @@ static unsigned int snd_soc_8_8_read(struct snd_soc_codec *codec,
> return do_hw_read(codec, reg);
> }
>
> -#if defined(CONFIG_SPI_MASTER)
> -static int snd_soc_8_8_spi_write(void *control_data, const char *data,
> - int len)
> -{
> - u8 msg[2];
> -
> - msg[0] = data[0];
> - msg[1] = data[1];
> -
> - return do_spi_write(control_data, msg, len);
> -}
> -#else
> -#define snd_soc_8_8_spi_write NULL
> -#endif
> -
> static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg,
> unsigned int value)
> {
> @@ -207,22 +164,6 @@ static unsigned int snd_soc_8_16_read(struct snd_soc_codec *codec,
> return do_hw_read(codec, reg);
> }
>
> -#if defined(CONFIG_SPI_MASTER)
> -static int snd_soc_8_16_spi_write(void *control_data, const char *data,
> - int len)
> -{
> - u8 msg[3];
> -
> - msg[0] = data[0];
> - msg[1] = data[1];
> - msg[2] = data[2];
> -
> - return do_spi_write(control_data, msg, len);
> -}
> -#else
> -#define snd_soc_8_16_spi_write NULL
> -#endif
> -
> #if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
> static unsigned int do_i2c_read(struct snd_soc_codec *codec,
> void *reg, int reglen,
> @@ -324,22 +265,6 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg,
> return do_hw_write(codec, reg, value, data, 3);
> }
>
> -#if defined(CONFIG_SPI_MASTER)
> -static int snd_soc_16_8_spi_write(void *control_data, const char *data,
> - int len)
> -{
> - u8 msg[3];
> -
> - msg[0] = data[0];
> - msg[1] = data[1];
> - msg[2] = data[2];
> -
> - return do_spi_write(control_data, msg, len);
> -}
> -#else
> -#define snd_soc_16_8_spi_write NULL
> -#endif
> -
> #if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
> static unsigned int snd_soc_16_16_read_i2c(struct snd_soc_codec *codec,
> unsigned int r)
> @@ -376,23 +301,6 @@ static int snd_soc_16_16_write(struct snd_soc_codec *codec, unsigned int reg,
> return do_hw_write(codec, reg, value, data, 4);
> }
>
> -#if defined(CONFIG_SPI_MASTER)
> -static int snd_soc_16_16_spi_write(void *control_data, const char *data,
> - int len)
> -{
> - u8 msg[4];
> -
> - msg[0] = data[0];
> - msg[1] = data[1];
> - msg[2] = data[2];
> - msg[3] = data[3];
> -
> - return do_spi_write(control_data, msg, len);
> -}
> -#else
> -#define snd_soc_16_16_spi_write NULL
> -#endif
> -
> /* Primitive bulk write support for soc-cache. The data pointed to by
> * `data' needs to already be in the form the hardware expects
> * including any leading register specific data. Any data written
> @@ -440,43 +348,36 @@ static struct {
> int addr_bits;
> int data_bits;
> int (*write)(struct snd_soc_codec *codec, unsigned int, unsigned int);
> - int (*spi_write)(void *, const char *, int);
> unsigned int (*read)(struct snd_soc_codec *, unsigned int);
> unsigned int (*i2c_read)(struct snd_soc_codec *, unsigned int);
> } io_types[] = {
> {
> .addr_bits = 4, .data_bits = 12,
> .write = snd_soc_4_12_write, .read = snd_soc_4_12_read,
> - .spi_write = snd_soc_4_12_spi_write,
> },
> {
> .addr_bits = 7, .data_bits = 9,
> .write = snd_soc_7_9_write, .read = snd_soc_7_9_read,
> - .spi_write = snd_soc_7_9_spi_write,
> },
> {
> .addr_bits = 8, .data_bits = 8,
> .write = snd_soc_8_8_write, .read = snd_soc_8_8_read,
> .i2c_read = snd_soc_8_8_read_i2c,
> - .spi_write = snd_soc_8_8_spi_write,
> },
> {
> .addr_bits = 8, .data_bits = 16,
> .write = snd_soc_8_16_write, .read = snd_soc_8_16_read,
> .i2c_read = snd_soc_8_16_read_i2c,
> - .spi_write = snd_soc_8_16_spi_write,
> },
> {
> .addr_bits = 16, .data_bits = 8,
> .write = snd_soc_16_8_write, .read = snd_soc_16_8_read,
> .i2c_read = snd_soc_16_8_read_i2c,
> - .spi_write = snd_soc_16_8_spi_write,
> },
> {
> .addr_bits = 16, .data_bits = 16,
> .write = snd_soc_16_16_write, .read = snd_soc_16_16_read,
> .i2c_read = snd_soc_16_16_read_i2c,
> - .spi_write = snd_soc_16_16_spi_write,
> },
> };
>
> @@ -537,8 +438,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
> break;
>
> case SND_SOC_SPI:
> - if (io_types[i].spi_write)
> - codec->hw_write = io_types[i].spi_write;
> + codec->hw_write = do_spi_write;
>
> codec->control_data = container_of(codec->dev,
> struct spi_device,
> --
> 1.7.2.5
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-05-12 12:25 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-05 17:52 [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836 Lars-Peter Clausen
2011-05-05 17:52 ` [PATCH 2/4] ASoC: Do not swap upper and lower byte in snd_soc_4_12_spi_write Lars-Peter Clausen
2011-05-05 17:52 ` [PATCH 3/4] ASoC: Get rid of snd_soc_*_*_spi_write wrapper functions Lars-Peter Clausen
2011-05-12 12:25 ` Barry Song
2011-05-05 17:52 ` [PATCH 4/4] ASoC: Use spi_write in do_spi_write Lars-Peter Clausen
2011-05-05 22:56 ` [uclinux-dist-devel] [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836 Mike Frysinger
2011-05-06 12:28 ` Lars-Peter Clausen
2011-05-06 12:48 ` Mark Brown
2011-05-06 13:12 ` [Device-drivers-devel] " Mike Frysinger
2011-05-06 13:19 ` Lars-Peter Clausen
2011-05-06 13:26 ` Mark Brown
2011-05-06 13:31 ` Lars-Peter Clausen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).