Skip to content

Commit f0fba2a

Browse files
author
Liam Girdwood
committed
ASoC: multi-component - ASoC Multi-Component Support
This patch extends the ASoC API to allow sound cards to have more than one CODEC and more than one platform DMA controller. This is achieved by dividing some current ASoC structures that contain both driver data and device data into structures that only either contain device data or driver data. i.e. struct snd_soc_codec ---> struct snd_soc_codec (device data) +-> struct snd_soc_codec_driver (driver data) struct snd_soc_platform ---> struct snd_soc_platform (device data) +-> struct snd_soc_platform_driver (driver data) struct snd_soc_dai ---> struct snd_soc_dai (device data) +-> struct snd_soc_dai_driver (driver data) struct snd_soc_device ---> deleted This now allows ASoC to be more tightly aligned with the Linux driver model and also means that every ASoC codec, platform and (platform) DAI is a kernel device. ASoC component private data is now stored as device private data. The ASoC sound card struct snd_soc_card has also been updated to store lists of it's components rather than a pointer to a codec and platform. The PCM runtime struct soc_pcm_runtime now has pointers to all its components. This patch adds DAPM support for ASoC multi-component and removes struct snd_soc_socdev from DAPM core. All DAPM calls are now made on a card, codec or runtime PCM level basis rather than using snd_soc_socdev. Other notable multi-component changes:- * Stream operations now de-reference less structures. * close_delayed work() now runs on a DAI basis rather than looping all DAIs in a card. * PM suspend()/resume() operations can now handle N CODECs and Platforms per sound card. * Added soc_bind_dai_link() to bind the component devices to the sound card. * Added soc_dai_link_probe() and soc_dai_link_remove() to probe and remove DAI link components. * sysfs entries can now be registered per component per card. * snd_soc_new_pcms() functionailty rolled into dai_link_probe(). * snd_soc_register_codec() now does all the codec list and mutex init. This patch changes the probe() and remove() of the CODEC drivers as follows:- o Make CODEC driver a platform driver o Moved all struct snd_soc_codec list, mutex, etc initialiasation to core. o Removed all static codec pointers (drivers now support > 1 codec dev) o snd_soc_register_pcms() now done by core. o snd_soc_register_dai() folded into snd_soc_register_codec(). CS4270 portions: Acked-by: Timur Tabi <[email protected]> Some TLV320aic23 and Cirrus platform fixes. Signed-off-by: Ryan Mallon <[email protected]> TI CODEC and OMAP fixes Signed-off-by: Peter Ujfalusi <[email protected]> Signed-off-by: Janusz Krzysztofik <[email protected]> Signed-off-by: Jarkko Nikula <[email protected]> Samsung platform and misc fixes :- Signed-off-by: Chanwoo Choi <[email protected]> Signed-off-by: Joonyoung Shim <[email protected]> Signed-off-by: Kyungmin Park <[email protected]> Reviewed-by: Jassi Brar <[email protected]> Signed-off-by: Seungwhan Youn <[email protected]> MPC8610 and PPC fixes. Signed-off-by: Timur Tabi <[email protected]> i.MX fixes and some core fixes. Signed-off-by: Sascha Hauer <[email protected]> J4740 platform fixes:- Signed-off-by: Lars-Peter Clausen <[email protected]> CC: Tony Lindgren <[email protected]> CC: Nicolas Ferre <[email protected]> CC: Kevin Hilman <[email protected]> CC: Sascha Hauer <[email protected]> CC: Atsushi Nemoto <[email protected]> CC: Kuninori Morimoto <[email protected]> CC: Daniel Gloeckner <[email protected]> CC: Manuel Lauss <[email protected]> CC: Mike Frysinger <[email protected]> CC: Arnaud Patard <[email protected]> CC: Wan ZongShun <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
1 parent bda7d2a commit f0fba2a

File tree

334 files changed

+8543
-13316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

334 files changed

+8543
-13316
lines changed

arch/arm/mach-davinci/devices.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,18 @@ static void davinci_init_wdt(void)
295295

296296
/*-------------------------------------------------------------------------*/
297297

298+
struct platform_device davinci_pcm_device = {
299+
.name = "davinci-pcm-audio",
300+
.id = -1,
301+
};
302+
303+
static void davinci_init_pcm(void)
304+
{
305+
platform_device_register(&davinci_pcm_device);
306+
}
307+
308+
/*-------------------------------------------------------------------------*/
309+
298310
struct davinci_timer_instance davinci_timer_instance[2] = {
299311
{
300312
.base = DAVINCI_TIMER0_BASE,
@@ -315,6 +327,7 @@ static int __init davinci_init_devices(void)
315327
/* please keep these calls, and their implementations above,
316328
* in alphabetical order so they're easier to sort through.
317329
*/
330+
davinci_init_pcm();
318331
davinci_init_wdt();
319332

320333
return 0;

arch/arm/mach-ep93xx/core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,9 +732,15 @@ static struct platform_device ep93xx_i2s_device = {
732732
.resource = ep93xx_i2s_resource,
733733
};
734734

735+
static struct platform_device ep93xx_pcm_device = {
736+
.name = "ep93xx-pcm-audio",
737+
.id = -1,
738+
};
739+
735740
void __init ep93xx_register_i2s(void)
736741
{
737742
platform_device_register(&ep93xx_i2s_device);
743+
platform_device_register(&ep93xx_pcm_device);
738744
}
739745

740746
#define EP93XX_SYSCON_DEVCFG_I2S_MASK (EP93XX_SYSCON_DEVCFG_I2SONSSP | \

arch/arm/mach-kirkwood/common.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,10 +896,16 @@ static struct platform_device kirkwood_i2s_device = {
896896
},
897897
};
898898

899+
static struct platform_device kirkwood_pcm_device = {
900+
.name = "kirkwood-pcm",
901+
.id = -1,
902+
};
903+
899904
void __init kirkwood_audio_init(void)
900905
{
901906
kirkwood_clk_ctrl |= CGC_AUDIO;
902907
platform_device_register(&kirkwood_i2s_device);
908+
platform_device_register(&kirkwood_pcm_device);
903909
}
904910

905911
/*****************************************************************************

arch/arm/mach-mx2/clock_imx27.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,8 @@ static struct clk_lookup lookups[] = {
653653
_REGISTER_CLOCK("mxc-ehci.1", "usb_ahb", usb_clk1)
654654
_REGISTER_CLOCK("mxc-ehci.2", "usb", usb_clk)
655655
_REGISTER_CLOCK("mxc-ehci.2", "usb_ahb", usb_clk1)
656-
_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
657-
_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
656+
_REGISTER_CLOCK("imx-ssi-dai.0", NULL, ssi1_clk)
657+
_REGISTER_CLOCK("imx-ssi-dai.1", NULL, ssi2_clk)
658658
_REGISTER_CLOCK("mxc_nand.0", NULL, nfc_clk)
659659
_REGISTER_CLOCK(NULL, "vpu", vpu_clk)
660660
_REGISTER_CLOCK(NULL, "dma", dma_clk)

arch/arm/mach-mx2/devices.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ struct platform_device mxc_usbh2 = {
415415
}; \
416416
\
417417
struct platform_device imx_ssi_device ## n = { \
418-
.name = "imx-ssi", \
418+
.name = "imx-ssi-dai", \
419419
.id = n, \
420420
.num_resources = ARRAY_SIZE(imx_ssi_resources ## n), \
421421
.resource = imx_ssi_resources ## n, \

arch/arm/mach-mx3/clock-imx31.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ static struct clk_lookup lookups[] = {
558558
_REGISTER_CLOCK("mxc_w1.0", NULL, owire_clk)
559559
_REGISTER_CLOCK("mxc-mmc.0", NULL, sdhc1_clk)
560560
_REGISTER_CLOCK("mxc-mmc.1", NULL, sdhc2_clk)
561-
_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
562-
_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
561+
_REGISTER_CLOCK("imx-ssi-dai.0", NULL, ssi1_clk)
562+
_REGISTER_CLOCK("imx-ssi-dai.1", NULL, ssi2_clk)
563563
_REGISTER_CLOCK(NULL, "firi", firi_clk)
564564
_REGISTER_CLOCK(NULL, "ata", ata_clk)
565565
_REGISTER_CLOCK(NULL, "rtic", rtic_clk)

arch/arm/mach-mx3/clock-imx35.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ static struct clk_lookup lookups[] = {
464464
_REGISTER_CLOCK(NULL, "sdma", sdma_clk)
465465
_REGISTER_CLOCK(NULL, "spba", spba_clk)
466466
_REGISTER_CLOCK(NULL, "spdif", spdif_clk)
467-
_REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
468-
_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
467+
_REGISTER_CLOCK("imx-ssi-dai.0", NULL, ssi1_clk)
468+
_REGISTER_CLOCK("imx-ssi-dai.1", NULL, ssi2_clk)
469469
_REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk)
470470
_REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk)
471471
_REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk)

arch/arm/mach-mx3/devices.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,14 +562,14 @@ static struct resource imx_ssi_resources1[] = {
562562
};
563563

564564
struct platform_device imx_ssi_device0 = {
565-
.name = "imx-ssi",
565+
.name = "imx-ssi-dai",
566566
.id = 0,
567567
.num_resources = ARRAY_SIZE(imx_ssi_resources0),
568568
.resource = imx_ssi_resources0,
569569
};
570570

571571
struct platform_device imx_ssi_device1 = {
572-
.name = "imx-ssi",
572+
.name = "imx-ssi-dai",
573573
.id = 1,
574574
.num_resources = ARRAY_SIZE(imx_ssi_resources1),
575575
.resource = imx_ssi_resources1,

arch/arm/mach-omap1/devices.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <mach/gpio.h>
2626
#include <plat/mmc.h>
2727
#include <plat/omap7xx.h>
28+
#include <plat/mcbsp.h>
2829

2930
/*-------------------------------------------------------------------------*/
3031

@@ -267,6 +268,30 @@ static inline void omap_init_sti(void)
267268
static inline void omap_init_sti(void) {}
268269
#endif
269270

271+
#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
272+
273+
static struct platform_device omap_pcm = {
274+
.name = "omap-pcm-audio",
275+
.id = -1,
276+
};
277+
278+
OMAP_MCBSP_PLATFORM_DEVICE(1);
279+
OMAP_MCBSP_PLATFORM_DEVICE(2);
280+
OMAP_MCBSP_PLATFORM_DEVICE(3);
281+
282+
static void omap_init_audio(void)
283+
{
284+
platform_device_register(&omap_mcbsp1);
285+
platform_device_register(&omap_mcbsp2);
286+
if (!cpu_is_omap7xx())
287+
platform_device_register(&omap_mcbsp3);
288+
platform_device_register(&omap_pcm);
289+
}
290+
291+
#else
292+
static inline void omap_init_audio(void) {}
293+
#endif
294+
270295
/*-------------------------------------------------------------------------*/
271296

272297
/*
@@ -299,6 +324,7 @@ static int __init omap1_init_devices(void)
299324
omap_init_rtc();
300325
omap_init_spi100k();
301326
omap_init_sti();
327+
omap_init_audio();
302328

303329
return 0;
304330
}

arch/arm/mach-omap2/board-n8x0.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/i2c.h>
2121
#include <linux/spi/spi.h>
2222
#include <linux/usb/musb.h>
23+
#include <sound/tlv320aic3x.h>
2324

2425
#include <asm/mach/arch.h>
2526
#include <asm/mach-types.h>
@@ -612,11 +613,25 @@ static int n8x0_menelaus_late_init(struct device *dev)
612613
return 0;
613614
}
614615

616+
static struct aic3x_setup_data n810_aic33_setup = {
617+
.gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED,
618+
.gpio_func[1] = AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT,
619+
};
620+
621+
static struct aic3x_pdata n810_aic33_data = {
622+
.setup = &n810_aic33_setup,
623+
.gpio_reset = -1,
624+
};
625+
615626
static struct i2c_board_info __initdata n8x0_i2c_board_info_1[] = {
616627
{
617628
I2C_BOARD_INFO("menelaus", 0x72),
618629
.irq = INT_24XX_SYS_NIRQ,
619630
},
631+
{
632+
I2C_BOARD_INFO("tlv320aic3x", 0x1b),
633+
.platform_data = &n810_aic33_data,
634+
},
620635
};
621636

622637
static struct menelaus_platform_data n8x0_menelaus_platform_data = {

arch/arm/mach-omap2/board-rx51-peripherals.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/gpio.h>
2424
#include <linux/gpio_keys.h>
2525
#include <linux/mmc/host.h>
26+
#include <sound/tlv320aic3x.h>
2627

2728
#include <plat/mcspi.h>
2829
#include <plat/mux.h>
@@ -686,7 +687,6 @@ static struct twl4030_power_data rx51_t2scripts_data __initdata = {
686687
};
687688

688689

689-
690690
static struct twl4030_platform_data rx51_twldata __initdata = {
691691
.irq_base = TWL4030_IRQ_BASE,
692692
.irq_end = TWL4030_IRQ_END,
@@ -716,9 +716,21 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = {
716716
},
717717
};
718718

719+
/* Audio setup data */
720+
static struct aic3x_setup_data rx51_aic34_setup = {
721+
.gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED,
722+
.gpio_func[1] = AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT,
723+
};
724+
725+
static struct aic3x_pdata rx51_aic34_data = {
726+
.setup = &rx51_aic34_setup,
727+
.gpio_reset = 60,
728+
};
729+
719730
static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
720731
{
721732
I2C_BOARD_INFO("tlv320aic3x", 0x18),
733+
.platform_data = &rx51_aic34_data,
722734
},
723735
};
724736

arch/arm/mach-omap2/board-zoom2.c

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/platform_device.h>
1515
#include <linux/input.h>
1616
#include <linux/gpio.h>
17+
#include <linux/i2c/twl.h>
1718

1819
#include <asm/mach-types.h>
1920
#include <asm/mach/arch.h>
@@ -34,15 +35,21 @@ static void __init omap_zoom2_init_irq(void)
3435
omap_gpio_init();
3536
}
3637

37-
/* REVISIT: These audio entries can be removed once MFD code is merged */
38-
#if 0
38+
/* EXTMUTE callback function */
39+
void zoom2_set_hs_extmute(int mute)
40+
{
41+
gpio_set_value(ZOOM2_HEADSET_EXTMUTE_GPIO, mute);
42+
}
3943

4044
static struct twl4030_madc_platform_data zoom2_madc_data = {
4145
.irq_line = 1,
4246
};
4347

4448
static struct twl4030_codec_audio_data zoom2_audio_data = {
4549
.audio_mclk = 26000000,
50+
.ramp_delay_value = 3, /* 161 ms */
51+
.hs_extmute = 1,
52+
.set_hs_extmute = zoom2_set_hs_extmute,
4653
};
4754

4855
static struct twl4030_codec_data zoom2_codec_data = {
@@ -64,10 +71,24 @@ static struct twl4030_platform_data zoom2_twldata = {
6471
.vmmc1 = &zoom2_vmmc1,
6572
.vmmc2 = &zoom2_vmmc2,
6673
.vsim = &zoom2_vsim,
74+
};
6775

76+
static struct i2c_board_info __initdata zoom2_i2c_boardinfo[] = {
77+
{
78+
I2C_BOARD_INFO("twl4030", 0x48),
79+
.flags = I2C_CLIENT_WAKE,
80+
.irq = INT_34XX_SYS_NIRQ,
81+
.platform_data = &zoom2_twldata,
82+
},
6883
};
6984

70-
#endif
85+
static int __init omap3_zoom2_i2c_init(void)
86+
{
87+
omap_register_i2c_bus(1, 2600, zoom2_i2c_boardinfo,
88+
ARRAY_SIZE(zoom2_i2c_boardinfo));
89+
return 0;
90+
}
91+
7192

7293
#ifdef CONFIG_OMAP_MUX
7394
static struct omap_board_mux board_mux[] __initdata = {
@@ -81,6 +102,7 @@ static void __init omap_zoom2_init(void)
81102
{
82103
omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
83104
zoom_peripherals_init();
105+
omap3_zoom2_i2c_init();
84106
zoom_debugboard_init();
85107
}
86108

arch/arm/mach-omap2/devices.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <mach/gpio.h>
3030
#include <plat/mmc.h>
3131
#include <plat/dma.h>
32+
#include <plat/mcbsp.h>
3233

3334
#include "mux.h"
3435

@@ -289,6 +290,43 @@ static inline void omap_init_sti(void)
289290
static inline void omap_init_sti(void) {}
290291
#endif
291292

293+
#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
294+
295+
static struct platform_device omap_pcm = {
296+
.name = "omap-pcm-audio",
297+
.id = -1,
298+
};
299+
300+
/*
301+
* OMAP2420 has 2 McBSP ports
302+
* OMAP2430 has 5 McBSP ports
303+
* OMAP3 has 5 McBSP ports
304+
* OMAP4 has 4 McBSP ports
305+
*/
306+
OMAP_MCBSP_PLATFORM_DEVICE(1);
307+
OMAP_MCBSP_PLATFORM_DEVICE(2);
308+
OMAP_MCBSP_PLATFORM_DEVICE(3);
309+
OMAP_MCBSP_PLATFORM_DEVICE(4);
310+
OMAP_MCBSP_PLATFORM_DEVICE(5);
311+
312+
static void omap_init_audio(void)
313+
{
314+
platform_device_register(&omap_mcbsp1);
315+
platform_device_register(&omap_mcbsp2);
316+
if (cpu_is_omap243x() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
317+
platform_device_register(&omap_mcbsp3);
318+
platform_device_register(&omap_mcbsp4);
319+
}
320+
if (cpu_is_omap243x() || cpu_is_omap34xx())
321+
platform_device_register(&omap_mcbsp5);
322+
323+
platform_device_register(&omap_pcm);
324+
}
325+
326+
#else
327+
static inline void omap_init_audio(void) {}
328+
#endif
329+
292330
#if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
293331

294332
#include <plat/mcspi.h>
@@ -901,6 +939,7 @@ static int __init omap2_init_devices(void)
901939
* in alphabetical order so they're easier to sort through.
902940
*/
903941
omap_hsmmc_reset();
942+
omap_init_audio();
904943
omap_init_camera();
905944
omap_init_mbox();
906945
omap_init_mcspi();

arch/arm/mach-omap2/include/mach/board-zoom.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
*/
44
extern int __init zoom_debugboard_init(void);
55
extern void __init zoom_peripherals_init(void);
6+
7+
#define ZOOM2_HEADSET_EXTMUTE_GPIO 153

0 commit comments

Comments
 (0)