[alsa-devel] [PATCH v2 1/4] imx-ssi.c: add new choices to platform configuration
* introduce 3 new flags to allow a more detailed configuration of the SSI link : IMX_SSI_NET : enable Network Mode IMX_SSI_SYN : enable Synchronous Mode IMX_SSI_USE_I2S_SLAVE : enable I2S Slave Mode * new platform can use these settings without breaking actual platforms.
Signed-off-by: Eric Bénard eric@eukrea.com Cc: Sascha Hauer s.hauer@pengutronix.de Cc: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Liam Girdwood lrg@slimlogic.co.uk --- arch/arm/plat-mxc/include/mach/ssi.h | 3 +++ sound/soc/imx/imx-ssi.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/arm/plat-mxc/include/mach/ssi.h b/arch/arm/plat-mxc/include/mach/ssi.h index c34ded5..63f3c28 100644 --- a/arch/arm/plat-mxc/include/mach/ssi.h +++ b/arch/arm/plat-mxc/include/mach/ssi.h @@ -10,6 +10,9 @@ struct imx_ssi_platform_data { unsigned int flags; #define IMX_SSI_DMA (1 << 0) #define IMX_SSI_USE_AC97 (1 << 1) +#define IMX_SSI_NET (1 << 2) +#define IMX_SSI_SYN (1 << 3) +#define IMX_SSI_USE_I2S_SLAVE (1 << 4) void (*ac97_reset) (struct snd_ac97 *ac97); void (*ac97_warm_reset)(struct snd_ac97 *ac97); }; diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index 80b4fee..50f5162 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c @@ -83,8 +83,6 @@ static int imx_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, /* * SSI DAI format configuration. * Should only be called when port is inactive (i.e. SSIEN = 0). - * Note: We don't use the I2S modes but instead manually configure the - * SSI for I2S because the I2S mode is only a register preset. */ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) { @@ -99,6 +97,10 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) /* data on rising edge of bclk, frame low 1clk before data */ strcr |= SSI_STCR_TFSI | SSI_STCR_TEFS | SSI_STCR_TXBIT0; scr |= SSI_SCR_NET; + if (ssi->flags & IMX_SSI_USE_I2S_SLAVE) { + scr &= ~SSI_I2S_MODE_MASK; + scr |= SSI_SCR_I2S_MODE_SLAVE; + } break; case SND_SOC_DAIFMT_LEFT_J: /* data on rising edge of bclk, frame high with data */ @@ -143,6 +145,11 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
strcr |= SSI_STCR_TFEN0;
+ if (ssi->flags & IMX_SSI_NET) + scr |= SSI_SCR_NET; + if (ssi->flags & IMX_SSI_SYN) + scr |= SSI_SCR_SYN; + writel(strcr, ssi->base + SSI_STCR); writel(strcr, ssi->base + SSI_SRCR); writel(scr, ssi->base + SSI_SCR);
Add the necessary files to support the TLV320AIC23B wired in I2S on our i.MX platforms.
Signed-off-by: Eric Bénard eric@eukrea.com Cc: Sascha Hauer s.hauer@pengutronix.de Cc: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Liam Girdwood lrg@slimlogic.co.uk --- sound/soc/imx/Kconfig | 8 +++ sound/soc/imx/Makefile | 2 + sound/soc/imx/eukrea-tlv320.c | 135 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 145 insertions(+), 0 deletions(-) create mode 100644 sound/soc/imx/eukrea-tlv320.c
diff --git a/sound/soc/imx/Kconfig b/sound/soc/imx/Kconfig index 7174b4c..3e27b16 100644 --- a/sound/soc/imx/Kconfig +++ b/sound/soc/imx/Kconfig @@ -11,3 +11,11 @@ config SND_IMX_SOC config SND_MXC_SOC_SSI tristate
+config SND_SOC_EUKREA_TLV320 + bool "Eukrea TLV320" + depends on MACH_EUKREA_MBIMX27_BASEBOARD + select SND_IMX_SOC + select SND_SOC_TLV320AIC23 + help + Enable I2S based access to the TLV320AIC23B codec attached + to the SSI4 interface diff --git a/sound/soc/imx/Makefile b/sound/soc/imx/Makefile index 9f8bb92..28d4b1e 100644 --- a/sound/soc/imx/Makefile +++ b/sound/soc/imx/Makefile @@ -10,3 +10,5 @@ obj-$(CONFIG_SND_IMX_SOC) += snd-soc-imx.o # i.MX Machine Support snd-soc-phycore-ac97-objs := phycore-ac97.o obj-$(CONFIG_SND_SOC_PHYCORE_AC97) += snd-soc-phycore-ac97.o +snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o +obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c new file mode 100644 index 0000000..968380a --- /dev/null +++ b/sound/soc/imx/eukrea-tlv320.c @@ -0,0 +1,135 @@ +/* + * eukrea-tlv320.c -- SoC audio for eukrea_cpuimxXX in I2S mode + * + * Copyright 2010 Eric Bénard, Eukréa Electromatique eric@eukrea.com + * + * based on sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c + * which is Copyright 2009 Simtec Electronics + * and on sound/soc/imx/phycore-ac97.c which is + * Copyright 2009 Sascha Hauer, Pengutronix s.hauer@pengutronix.de + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/device.h> +#include <linux/i2c.h> +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/soc.h> +#include <sound/soc-dapm.h> +#include <asm/mach-types.h> + +#include "../codecs/tlv320aic23.h" +#include "imx-ssi.h" + +#define CODEC_CLOCK 12000000 + +static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; + int ret; + + ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBM_CFM); + if (ret) { + pr_err("%s: failed set cpu dai format\n", __func__); + return ret; + } + + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBM_CFM); + if (ret) { + pr_err("%s: failed set codec dai format\n", __func__); + return ret; + } + + ret = snd_soc_dai_set_sysclk(codec_dai, 0, + CODEC_CLOCK, SND_SOC_CLOCK_OUT); + if (ret) { + pr_err("%s: failed setting codec sysclk\n", __func__); + return ret; + } + + ret = snd_soc_dai_set_sysclk(cpu_dai, IMX_SSP_SYS_CLK, 0, + SND_SOC_CLOCK_IN); + if (ret) { + pr_err("can't set CPU system clock IMX_SSP_SYS_CLK\n"); + return ret; + } + + return 0; +} + +static struct snd_soc_ops eukrea_tlv320_snd_ops = { + .hw_params = eukrea_tlv320_hw_params, +}; + +static struct snd_soc_dai_link eukrea_tlv320_dai = { + .name = "tlv320aic23", + .stream_name = "TLV320AIC23", + .codec_dai = &tlv320aic23_dai, + .ops = &eukrea_tlv320_snd_ops, +}; + +static struct snd_soc_card eukrea_tlv320 = { + .name = "cpuimx-audio", + .platform = &imx_soc_platform, + .dai_link = &eukrea_tlv320_dai, + .num_links = 1, +}; + +static struct snd_soc_device eukrea_tlv320_snd_devdata = { + .card = &eukrea_tlv320, + .codec_dev = &soc_codec_dev_tlv320aic23, +}; + +static struct platform_device *eukrea_tlv320_snd_device; + +static int __init eukrea_tlv320_init(void) +{ + int ret; + + if (!machine_is_eukrea_cpuimx27()) + /* return happy. We might run on a totally different machine */ + return 0; + + eukrea_tlv320_snd_device = platform_device_alloc("soc-audio", -1); + if (!eukrea_tlv320_snd_device) + return -ENOMEM; + + eukrea_tlv320_dai.cpu_dai = &imx_ssi_pcm_dai[0]; + + platform_set_drvdata(eukrea_tlv320_snd_device, &eukrea_tlv320_snd_devdata); + eukrea_tlv320_snd_devdata.dev = &eukrea_tlv320_snd_device->dev; + ret = platform_device_add(eukrea_tlv320_snd_device); + + if (ret) { + printk(KERN_ERR "ASoC: Platform device allocation failed\n"); + platform_device_put(eukrea_tlv320_snd_device); + } + + return ret; +} + +static void __exit eukrea_tlv320_exit(void) +{ + platform_device_unregister(eukrea_tlv320_snd_device); +} + +module_init(eukrea_tlv320_init); +module_exit(eukrea_tlv320_exit); + +MODULE_AUTHOR("Eric Bénard eric@eukrea.com"); +MODULE_DESCRIPTION("CPUIMX ALSA SoC driver"); +MODULE_LICENSE("GPL");
Signed-off-by: Eric Bénard eric@eukrea.com Cc: Sascha Hauer s.hauer@pengutronix.de Cc: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Liam Girdwood lrg@slimlogic.co.uk --- arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c | 44 +++++++++++++++++++++++++- 1 files changed, 43 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c b/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c index 9038e1f..e7fd65a 100644 --- a/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c +++ b/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Eric Benard - eric@eukrea.com + * Copyright (C) 2009-2010 Eric Benard - eric@eukrea.com * * Based on pcm970-baseboard.c which is : * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) @@ -37,6 +37,8 @@ #include <mach/mmc.h> #include <mach/imx-uart.h> #include <mach/spi.h> +#include <mach/ssi.h> +#include <mach/audmux.h>
#include "devices.h"
@@ -93,6 +95,13 @@ static int eukrea_mbimx27_pins[] = { PD29_PF_CSPI1_SCLK, PD30_PF_CSPI1_MISO, PD31_PF_CSPI1_MOSI, + /* SSI4 */ +#if defined(CONFIG_SND_SOC_EUKREA_TLV320) + PC16_PF_SSI4_FS, + PC17_PF_SSI4_RXD | GPIO_PUEN, + PC18_PF_SSI4_TXD | GPIO_PUEN, + PC19_PF_SSI4_CLK, +#endif };
static const uint32_t eukrea_mbimx27_keymap[] = { @@ -292,6 +301,12 @@ static struct spi_board_info eukrea_mbimx27_spi_board_info[] __initdata = { }, };
+static struct i2c_board_info eukrea_mbimx27_i2c_devices[] = { + { + I2C_BOARD_INFO("tlv320aic23", 0x1a), + }, +}; + static int eukrea_mbimx27_spi_cs[] = {GPIO_PORTD | 28};
static struct spi_imx_master eukrea_mbimx27_spi_0_data = { @@ -308,6 +323,10 @@ static struct imxmmc_platform_data sdhc_pdata = { .dat3_card_detect = 1, };
+struct imx_ssi_platform_data eukrea_mbimx27_ssi_pdata = { + .flags = IMX_SSI_DMA | IMX_SSI_USE_I2S_SLAVE, +}; + /* * system init for baseboard usage. Will be called by cpuimx27 init. * @@ -319,6 +338,24 @@ void __init eukrea_mbimx27_baseboard_init(void) mxc_gpio_setup_multiple_pins(eukrea_mbimx27_pins, ARRAY_SIZE(eukrea_mbimx27_pins), "MBIMX27");
+#if defined(CONFIG_SND_SOC_EUKREA_TLV320) + /* SSI unit master I2S codec connected to SSI_PINS_4*/ + mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0, + MXC_AUDMUX_V1_PCR_SYN | + MXC_AUDMUX_V1_PCR_TFSDIR | + MXC_AUDMUX_V1_PCR_TCLKDIR | + MXC_AUDMUX_V1_PCR_RFSDIR | + MXC_AUDMUX_V1_PCR_RCLKDIR | + MXC_AUDMUX_V1_PCR_TFCSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4) | + MXC_AUDMUX_V1_PCR_RFCSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4) | + MXC_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4) + ); + mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR3_SSI_PINS_4, + MXC_AUDMUX_V1_PCR_SYN | + MXC_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0) + ); +#endif + mxc_register_device(&mxc_uart_device1, &uart_pdata[0]); mxc_register_device(&mxc_uart_device2, &uart_pdata[1]); #if !defined(MACH_EUKREA_CPUIMX27_USEUART4) @@ -328,6 +365,11 @@ void __init eukrea_mbimx27_baseboard_init(void) mxc_register_device(&mxc_fb_device, &eukrea_mbimx27_fb_data); mxc_register_device(&mxc_sdhc_device0, &sdhc_pdata);
+ i2c_register_board_info(0, eukrea_mbimx27_i2c_devices, + ARRAY_SIZE(eukrea_mbimx27_i2c_devices)); + + mxc_register_device(&imx_ssi_device0, &eukrea_mbimx27_ssi_pdata); + #if defined(CONFIG_TOUCHSCREEN_ADS7846) \ || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) /* ADS7846 Touchscreen controller init */
Signed-off-by: Eric Bénard eric@eukrea.com --- arch/arm/configs/mx27_defconfig | 49 +++++++++++++++++++++++++++++++++++++- 1 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/arch/arm/configs/mx27_defconfig b/arch/arm/configs/mx27_defconfig index e6b1310..8c3331d 100644 --- a/arch/arm/configs/mx27_defconfig +++ b/arch/arm/configs/mx27_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.34 -# Wed May 19 18:36:55 2010 +# Wed May 26 21:45:42 2010 # CONFIG_ARM=y CONFIG_HAVE_PWM=y @@ -21,6 +21,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y CONFIG_GENERIC_HWEIGHT=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_FIQ=y CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y CONFIG_VECTORS_BASE=0xffff0000 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" @@ -790,6 +791,7 @@ CONFIG_TOUCHSCREEN_ADS7846=y # CONFIG_TOUCHSCREEN_PENMOUNT is not set # CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set # CONFIG_TOUCHSCREEN_TOUCHWIN is not set +# CONFIG_TOUCHSCREEN_WM97XX is not set # CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set # CONFIG_TOUCHSCREEN_TOUCHIT213 is not set # CONFIG_TOUCHSCREEN_TSC2007 is not set @@ -969,6 +971,7 @@ CONFIG_SSB_POSSIBLE=y # CONFIG_HTC_EGPIO is not set # CONFIG_HTC_PASIC3 is not set # CONFIG_HTC_I2CPLD is not set +# CONFIG_UCB1400_CORE is not set # CONFIG_TPS65010 is not set # CONFIG_TWL4030_CORE is not set # CONFIG_MFD_TMIO is not set @@ -1064,7 +1067,49 @@ CONFIG_LOGO=y # CONFIG_LOGO_LINUX_MONO is not set # CONFIG_LOGO_LINUX_VGA16 is not set CONFIG_LOGO_LINUX_CLUT224=y -# CONFIG_SOUND is not set +CONFIG_SOUND=y +CONFIG_SOUND_OSS_CORE=y +CONFIG_SOUND_OSS_CORE_PRECLAIM=y +CONFIG_SND=y +CONFIG_SND_TIMER=y +CONFIG_SND_PCM=y +CONFIG_SND_JACK=y +CONFIG_SND_SEQUENCER=y +# CONFIG_SND_SEQ_DUMMY is not set +CONFIG_SND_OSSEMUL=y +CONFIG_SND_MIXER_OSS=y +CONFIG_SND_PCM_OSS=y +CONFIG_SND_PCM_OSS_PLUGINS=y +# CONFIG_SND_SEQUENCER_OSS is not set +# CONFIG_SND_HRTIMER is not set +# CONFIG_SND_DYNAMIC_MINORS is not set +CONFIG_SND_SUPPORT_OLD_API=y +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +# CONFIG_SND_RAWMIDI_SEQ is not set +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +# CONFIG_SND_SBAWE_SEQ is not set +# CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_DRIVERS=y +# CONFIG_SND_DUMMY is not set +# CONFIG_SND_VIRMIDI is not set +# CONFIG_SND_MTPAV is not set +# CONFIG_SND_SERIAL_U16550 is not set +# CONFIG_SND_MPU401 is not set +# CONFIG_SND_ARM is not set +# CONFIG_SND_SPI is not set +# CONFIG_SND_USB is not set +CONFIG_SND_SOC=y +CONFIG_SND_SOC_AC97_BUS=y +CONFIG_SND_IMX_SOC=y +CONFIG_SND_SOC_EUKREA_TLV320=y +CONFIG_SND_SOC_I2C_AND_SPI=y +# CONFIG_SND_SOC_ALL_CODECS is not set +CONFIG_SND_SOC_TLV320AIC23=y +# CONFIG_SOUND_PRIME is not set +CONFIG_AC97_BUS=y # CONFIG_HID_SUPPORT is not set CONFIG_USB_SUPPORT=y CONFIG_USB_ARCH_HAS_HCD=y
On Thu, 2010-05-27 at 10:58 +0200, Eric Bénard wrote:
Signed-off-by: Eric Bénard eric@eukrea.com Cc: Sascha Hauer s.hauer@pengutronix.de Cc: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Liam Girdwood lrg@slimlogic.co.uk
arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c | 44 +++++++++++++++++++++++++- 1 files changed, 43 insertions(+), 1 deletions(-)
Acked-by: Liam Girdwood lrg@slimlogic.co.uk
Hi Eric,
The patch does not apply on current master. Can you please rebase it? It's better we delay the defconfig patch until the code is merged, so give me a ping when it's done.
Two comments inline.
Sascha
On Thu, May 27, 2010 at 10:58:56AM +0200, Eric Bénard wrote:
Signed-off-by: Eric Bénard eric@eukrea.com Cc: Sascha Hauer s.hauer@pengutronix.de Cc: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Liam Girdwood lrg@slimlogic.co.uk
arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c | 44 +++++++++++++++++++++++++- 1 files changed, 43 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c b/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c index 9038e1f..e7fd65a 100644 --- a/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c +++ b/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c @@ -1,5 +1,5 @@ /*
- Copyright (C) 2009 Eric Benard - eric@eukrea.com
- Copyright (C) 2009-2010 Eric Benard - eric@eukrea.com
- Based on pcm970-baseboard.c which is :
- Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
@@ -37,6 +37,8 @@ #include <mach/mmc.h> #include <mach/imx-uart.h> #include <mach/spi.h> +#include <mach/ssi.h> +#include <mach/audmux.h>
#include "devices.h"
@@ -93,6 +95,13 @@ static int eukrea_mbimx27_pins[] = { PD29_PF_CSPI1_SCLK, PD30_PF_CSPI1_MISO, PD31_PF_CSPI1_MOSI,
- /* SSI4 */
+#if defined(CONFIG_SND_SOC_EUKREA_TLV320)
- PC16_PF_SSI4_FS,
- PC17_PF_SSI4_RXD | GPIO_PUEN,
- PC18_PF_SSI4_TXD | GPIO_PUEN,
- PC19_PF_SSI4_CLK,
+#endif
You should remove the ifdefs. The pin muxer should not depend on compile time options.
};
static const uint32_t eukrea_mbimx27_keymap[] = { @@ -292,6 +301,12 @@ static struct spi_board_info eukrea_mbimx27_spi_board_info[] __initdata = { }, };
+static struct i2c_board_info eukrea_mbimx27_i2c_devices[] = {
- {
I2C_BOARD_INFO("tlv320aic23", 0x1a),
- },
+};
static int eukrea_mbimx27_spi_cs[] = {GPIO_PORTD | 28};
static struct spi_imx_master eukrea_mbimx27_spi_0_data = { @@ -308,6 +323,10 @@ static struct imxmmc_platform_data sdhc_pdata = { .dat3_card_detect = 1, };
+struct imx_ssi_platform_data eukrea_mbimx27_ssi_pdata = {
- .flags = IMX_SSI_DMA | IMX_SSI_USE_I2S_SLAVE,
+};
/*
- system init for baseboard usage. Will be called by cpuimx27 init.
@@ -319,6 +338,24 @@ void __init eukrea_mbimx27_baseboard_init(void) mxc_gpio_setup_multiple_pins(eukrea_mbimx27_pins, ARRAY_SIZE(eukrea_mbimx27_pins), "MBIMX27");
+#if defined(CONFIG_SND_SOC_EUKREA_TLV320)
- /* SSI unit master I2S codec connected to SSI_PINS_4*/
- mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0,
MXC_AUDMUX_V1_PCR_SYN |
MXC_AUDMUX_V1_PCR_TFSDIR |
MXC_AUDMUX_V1_PCR_TCLKDIR |
MXC_AUDMUX_V1_PCR_RFSDIR |
MXC_AUDMUX_V1_PCR_RCLKDIR |
MXC_AUDMUX_V1_PCR_TFCSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4) |
MXC_AUDMUX_V1_PCR_RFCSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4) |
MXC_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4)
- );
- mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR3_SSI_PINS_4,
MXC_AUDMUX_V1_PCR_SYN |
MXC_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0)
- );
+#endif
Does it hurt to go without the ifdefs?
- mxc_register_device(&mxc_uart_device1, &uart_pdata[0]); mxc_register_device(&mxc_uart_device2, &uart_pdata[1]);
#if !defined(MACH_EUKREA_CPUIMX27_USEUART4) @@ -328,6 +365,11 @@ void __init eukrea_mbimx27_baseboard_init(void) mxc_register_device(&mxc_fb_device, &eukrea_mbimx27_fb_data); mxc_register_device(&mxc_sdhc_device0, &sdhc_pdata);
- i2c_register_board_info(0, eukrea_mbimx27_i2c_devices,
ARRAY_SIZE(eukrea_mbimx27_i2c_devices));
- mxc_register_device(&imx_ssi_device0, &eukrea_mbimx27_ssi_pdata);
#if defined(CONFIG_TOUCHSCREEN_ADS7846) \ || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) /* ADS7846 Touchscreen controller init */ -- 1.6.3.3
Hi Sascha,
Le 28/05/2010 08:58, Sascha Hauer a écrit :
Hi Eric,
The patch does not apply on current master. Can you please rebase it? It's better we delay the defconfig patch until the code is merged, so give me a ping when it's done.
in fact it's based on top of my patchset which updates our board's support : http://lists.infradead.org/pipermail/linux-arm-kernel/2010-May/thread.html#1...
I can rebase it but maybe you can also get most of the patches of this thread ?
On Thu, May 27, 2010 at 10:58:56AM +0200, Eric Bénard wrote:
Signed-off-by: Eric Bénarderic@eukrea.com Cc: Sascha Hauers.hauer@pengutronix.de Cc: Mark Brownbroonie@opensource.wolfsonmicro.com Cc: Liam Girdwoodlrg@slimlogic.co.uk
arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c | 44 +++++++++++++++++++++++++- 1 files changed, 43 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c b/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c index 9038e1f..e7fd65a 100644 --- a/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c +++ b/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c @@ -1,5 +1,5 @@ /*
- Copyright (C) 2009 Eric Benard - eric@eukrea.com
- Copyright (C) 2009-2010 Eric Benard - eric@eukrea.com
- Based on pcm970-baseboard.c which is :
- Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
@@ -37,6 +37,8 @@ #include<mach/mmc.h> #include<mach/imx-uart.h> #include<mach/spi.h> +#include<mach/ssi.h> +#include<mach/audmux.h>
#include "devices.h"
@@ -93,6 +95,13 @@ static int eukrea_mbimx27_pins[] = { PD29_PF_CSPI1_SCLK, PD30_PF_CSPI1_MISO, PD31_PF_CSPI1_MOSI,
- /* SSI4 */
+#if defined(CONFIG_SND_SOC_EUKREA_TLV320)
- PC16_PF_SSI4_FS,
- PC17_PF_SSI4_RXD | GPIO_PUEN,
- PC18_PF_SSI4_TXD | GPIO_PUEN,
- PC19_PF_SSI4_CLK,
+#endif
You should remove the ifdefs. The pin muxer should not depend on compile time options.
well on this kind of board yes as the IO can be used as plain GPIO if the codec is not mounted.
};
static const uint32_t eukrea_mbimx27_keymap[] = { @@ -292,6 +301,12 @@ static struct spi_board_info eukrea_mbimx27_spi_board_info[] __initdata = { }, };
+static struct i2c_board_info eukrea_mbimx27_i2c_devices[] = {
- {
I2C_BOARD_INFO("tlv320aic23", 0x1a),
- },
+};
static int eukrea_mbimx27_spi_cs[] = {GPIO_PORTD | 28};
static struct spi_imx_master eukrea_mbimx27_spi_0_data = {
@@ -308,6 +323,10 @@ static struct imxmmc_platform_data sdhc_pdata = { .dat3_card_detect = 1, };
+struct imx_ssi_platform_data eukrea_mbimx27_ssi_pdata = {
- .flags = IMX_SSI_DMA | IMX_SSI_USE_I2S_SLAVE,
+};
- /*
- system init for baseboard usage. Will be called by cpuimx27 init.
@@ -319,6 +338,24 @@ void __init eukrea_mbimx27_baseboard_init(void) mxc_gpio_setup_multiple_pins(eukrea_mbimx27_pins, ARRAY_SIZE(eukrea_mbimx27_pins), "MBIMX27");
+#if defined(CONFIG_SND_SOC_EUKREA_TLV320)
- /* SSI unit master I2S codec connected to SSI_PINS_4*/
- mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0,
MXC_AUDMUX_V1_PCR_SYN |
MXC_AUDMUX_V1_PCR_TFSDIR |
MXC_AUDMUX_V1_PCR_TCLKDIR |
MXC_AUDMUX_V1_PCR_RFSDIR |
MXC_AUDMUX_V1_PCR_RCLKDIR |
MXC_AUDMUX_V1_PCR_TFCSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4) |
MXC_AUDMUX_V1_PCR_RFCSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4) |
MXC_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4)
- );
- mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR3_SSI_PINS_4,
MXC_AUDMUX_V1_PCR_SYN |
MXC_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0)
- );
+#endif
Does it hurt to go without the ifdefs?
same thing as for the IOMUX.
Thanks, Eric
On Thu, 2010-05-27 at 10:58 +0200, Eric Bénard wrote:
Add the necessary files to support the TLV320AIC23B wired in I2S on our i.MX platforms.
Signed-off-by: Eric Bénard eric@eukrea.com Cc: Sascha Hauer s.hauer@pengutronix.de Cc: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Liam Girdwood lrg@slimlogic.co.uk
sound/soc/imx/Kconfig | 8 +++ sound/soc/imx/Makefile | 2 + sound/soc/imx/eukrea-tlv320.c | 135 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 145 insertions(+), 0 deletions(-) create mode 100644 sound/soc/imx/eukrea-tlv320.c
diff --git a/sound/soc/imx/Kconfig b/sound/soc/imx/Kconfig index 7174b4c..3e27b16 100644 --- a/sound/soc/imx/Kconfig +++ b/sound/soc/imx/Kconfig @@ -11,3 +11,11 @@ config SND_IMX_SOC config SND_MXC_SOC_SSI tristate
+config SND_SOC_EUKREA_TLV320
- bool "Eukrea TLV320"
- depends on MACH_EUKREA_MBIMX27_BASEBOARD
- select SND_IMX_SOC
- select SND_SOC_TLV320AIC23
- help
Enable I2S based access to the TLV320AIC23B codec attached
to the SSI4 interface
diff --git a/sound/soc/imx/Makefile b/sound/soc/imx/Makefile index 9f8bb92..28d4b1e 100644 --- a/sound/soc/imx/Makefile +++ b/sound/soc/imx/Makefile @@ -10,3 +10,5 @@ obj-$(CONFIG_SND_IMX_SOC) += snd-soc-imx.o # i.MX Machine Support snd-soc-phycore-ac97-objs := phycore-ac97.o obj-$(CONFIG_SND_SOC_PHYCORE_AC97) += snd-soc-phycore-ac97.o +snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o +obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c new file mode 100644 index 0000000..968380a --- /dev/null +++ b/sound/soc/imx/eukrea-tlv320.c @@ -0,0 +1,135 @@ +/*
- eukrea-tlv320.c -- SoC audio for eukrea_cpuimxXX in I2S mode
- Copyright 2010 Eric Bénard, Eukréa Electromatique eric@eukrea.com
- based on sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c
- which is Copyright 2009 Simtec Electronics
- and on sound/soc/imx/phycore-ac97.c which is
- Copyright 2009 Sascha Hauer, Pengutronix s.hauer@pengutronix.de
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
- */
+#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/device.h> +#include <linux/i2c.h> +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/soc.h> +#include <sound/soc-dapm.h> +#include <asm/mach-types.h>
+#include "../codecs/tlv320aic23.h" +#include "imx-ssi.h"
+#define CODEC_CLOCK 12000000
+static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
+{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
- int ret;
- ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM);
- if (ret) {
pr_err("%s: failed set cpu dai format\n", __func__);
return ret;
- }
- ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM);
- if (ret) {
pr_err("%s: failed set codec dai format\n", __func__);
return ret;
- }
- ret = snd_soc_dai_set_sysclk(codec_dai, 0,
CODEC_CLOCK, SND_SOC_CLOCK_OUT);
- if (ret) {
pr_err("%s: failed setting codec sysclk\n", __func__);
return ret;
- }
- ret = snd_soc_dai_set_sysclk(cpu_dai, IMX_SSP_SYS_CLK, 0,
SND_SOC_CLOCK_IN);
- if (ret) {
pr_err("can't set CPU system clock IMX_SSP_SYS_CLK\n");
return ret;
- }
- return 0;
+}
+static struct snd_soc_ops eukrea_tlv320_snd_ops = {
- .hw_params = eukrea_tlv320_hw_params,
+};
+static struct snd_soc_dai_link eukrea_tlv320_dai = {
- .name = "tlv320aic23",
- .stream_name = "TLV320AIC23",
- .codec_dai = &tlv320aic23_dai,
- .ops = &eukrea_tlv320_snd_ops,
+};
+static struct snd_soc_card eukrea_tlv320 = {
- .name = "cpuimx-audio",
- .platform = &imx_soc_platform,
- .dai_link = &eukrea_tlv320_dai,
- .num_links = 1,
+};
+static struct snd_soc_device eukrea_tlv320_snd_devdata = {
- .card = &eukrea_tlv320,
- .codec_dev = &soc_codec_dev_tlv320aic23,
+};
+static struct platform_device *eukrea_tlv320_snd_device;
+static int __init eukrea_tlv320_init(void) +{
- int ret;
- if (!machine_is_eukrea_cpuimx27())
/* return happy. We might run on a totally different machine */
return 0;
- eukrea_tlv320_snd_device = platform_device_alloc("soc-audio", -1);
- if (!eukrea_tlv320_snd_device)
return -ENOMEM;
- eukrea_tlv320_dai.cpu_dai = &imx_ssi_pcm_dai[0];
Any reason why this is not defined above ?
Thanks
Liam
Hi Liam,
Le 27/05/2010 15:50, Liam Girdwood a écrit :
- eukrea_tlv320_dai.cpu_dai =&imx_ssi_pcm_dai[0];
Any reason why this is not defined above ?
I plan to reuse this driver for iMX25, 35 & 51 based boards so this parameter may change depending on machine_is_xxx macro.
Eric
On Thu, 2010-05-27 at 16:04 +0200, Eric Bénard wrote:
Hi Liam,
Le 27/05/2010 15:50, Liam Girdwood a écrit :
- eukrea_tlv320_dai.cpu_dai =&imx_ssi_pcm_dai[0];
Any reason why this is not defined above ?
I plan to reuse this driver for iMX25, 35 & 51 based boards so this parameter may change depending on machine_is_xxx macro.
Ok, I see. You will have a machine_is_blah() statement to select the correct DAI.
Acked-by: Liam Girdwood lrg@slimlogic.co.uk
On Thu, 2010-05-27 at 10:58 +0200, Eric Bénard wrote:
- introduce 3 new flags to allow a more detailed configuration
of the SSI link : IMX_SSI_NET : enable Network Mode IMX_SSI_SYN : enable Synchronous Mode IMX_SSI_USE_I2S_SLAVE : enable I2S Slave Mode
- new platform can use these settings without breaking actual
platforms.
Signed-off-by: Eric Bénard eric@eukrea.com Cc: Sascha Hauer s.hauer@pengutronix.de Cc: Mark Brown broonie@opensource.wolfsonmicro.com Cc: Liam Girdwood lrg@slimlogic.co.uk
Acked-by: Liam Girdwood lrg@slimlogic.co.uk
On Thu, May 27, 2010 at 10:58:54AM +0200, Eric B??nard wrote:
- introduce 3 new flags to allow a more detailed configuration
of the SSI link : IMX_SSI_NET : enable Network Mode IMX_SSI_SYN : enable Synchronous Mode IMX_SSI_USE_I2S_SLAVE : enable I2S Slave Mode
- new platform can use these settings without breaking actual
platforms.
Signed-off-by: Eric B??nard eric@eukrea.com Cc: Sascha Hauer s.hauer@pengutronix.de
Sascha, any comments on the first couple of patches here?
On Tue, Jun 01, 2010 at 07:05:28PM +0100, Mark Brown wrote:
On Thu, May 27, 2010 at 10:58:54AM +0200, Eric B??nard wrote:
- introduce 3 new flags to allow a more detailed configuration
of the SSI link : IMX_SSI_NET : enable Network Mode IMX_SSI_SYN : enable Synchronous Mode IMX_SSI_USE_I2S_SLAVE : enable I2S Slave Mode
- new platform can use these settings without breaking actual
platforms.
Signed-off-by: Eric B??nard eric@eukrea.com Cc: Sascha Hauer s.hauer@pengutronix.de
Sascha, any comments on the first couple of patches here?
Acked-by: Sascha Hauer s.hauer@pengutronix.de
On Thu, Jun 03, 2010 at 10:19:26AM +0200, Sascha Hauer wrote:
On Tue, Jun 01, 2010 at 07:05:28PM +0100, Mark Brown wrote:
Sascha, any comments on the first couple of patches here?
Acked-by: Sascha Hauer s.hauer@pengutronix.de
Applied both, though I had to hand edit the Makefile and Kconfig for the machine driver - not sure what it was generated against but it didn't seem terribly mainline.
participants (4)
-
Eric Bénard
-
Liam Girdwood
-
Mark Brown
-
Sascha Hauer