Alsa modularisations and support for tsc2101 4/7
Subsystems (3)
PATCH 1/1 Alsa modularisations and support for tsc2101 4/7
ALSA Omap Patch
This patch includes the platform device support for the new proposed approach. For OSK and H2.
signed-off by Daniel Petrini <[email protected]> signed-off by Mika Laitio <[email protected]>
Daniel Petrini
--
INdT - Manaus - Brazil
ALSA Omap Patch
This patch includes the platform device support for the new proposed approach. For OSK and H2.
signed-off by Daniel Petrini <[email protected]> signed-off by Mika Laitio <[email protected]>
arch/arm/mach-omap1/board-osk.c +33 -1
@@ -47,6 +47,8 @@#include <asm/arch/tc.h> #include <asm/arch/keypad.h> #include <asm/arch/common.h> +#include <asm/arch/mcbsp.h> +#include <asm/arch/omap-alsa.h> static int osk_keymap[] = {KEY (0 ,0 ,KEY_F1 ),
@@ -149,9 +151,39 @@ static struct platform_device osk5912_cf .resource = osk5912_cf_resources, }; +#define DEFAULT_BITPERSAMPLE 16 +static struct omap_mcbsp_reg_cfg mcbsp_regs = { + .spcr2 =FREE |FRST |GRST |XRST |XINTM (3 ), + .spcr1 =RINTM (3 ) |RRST , + .rcr2 =RPHASE |RFRLEN2 (OMAP_MCBSP_WORD_8 ) | +RWDLEN2 (OMAP_MCBSP_WORD_16 ) |RDATDLY (0 ), + .rcr1 =RFRLEN1 (OMAP_MCBSP_WORD_8 ) |RWDLEN1 (OMAP_MCBSP_WORD_16 ), + .xcr2 =XPHASE |XFRLEN2 (OMAP_MCBSP_WORD_8 ) | +XWDLEN2 (OMAP_MCBSP_WORD_16 ) |XDATDLY (0 ) |XFIG , + .xcr1 =XFRLEN1 (OMAP_MCBSP_WORD_8 ) |XWDLEN1 (OMAP_MCBSP_WORD_16 ), + .srgr1 =FWID (DEFAULT_BITPERSAMPLE -1 ), + .srgr2 =GSYNC |CLKSP |FSGM |FPER (DEFAULT_BITPERSAMPLE *2 -1 ), +/*.pcr0 = FSXM | FSRM | CLKXM | CLKRM | CLKXP | CLKRP,*/ /* mcbsp: master */ + .pcr0 =CLKXP |CLKRP ,/* mcbsp: slave */ +}; + +static struct omap_alsa_codec_config alsa_config = { + .name ="OSK AIC23" , + .mcbsp_regs_alsa = &mcbsp_regs, + .codec_configure_dev = aic23_configure, + .codec_set_samplerate = aic23_set_samplerate, + .codec_clock_setup = aic23_clock_setup, + .codec_clock_on = aic23_clock_on, + .codec_clock_off = aic23_clock_off, + .get_default_samplerate = aic23_get_default_samplerate, +}; +static struct platform_device osk5912_mcbsp1_device = { - .name ="omap_mcbsp" , + .name ="omap_alsa_mcbsp" , .id =1 , + .dev = { + .platform_data = &alsa_config, + }, };static struct resource osk5912_kp_resources[] = {
arch/arm/mach-omap1/board-h2.c +38 -0
@@ -41,6 +41,8 @@#include <asm/arch/usb.h> #include <asm/arch/keypad.h> #include <asm/arch/common.h> +#include <asm/arch/mcbsp.h> +#include <asm/arch/omap-alsa.h> extern int omap_gpio_init (void );
@@ -276,6 +278,41 @@ static struct platform_device h2_lcd_dev .id = -1, }; +static struct omap_mcbsp_reg_cfg mcbsp_regs = { + .spcr2 =FREE |FRST |GRST |XRST |XINTM (3 ), + .spcr1 =RINTM (3 ) |RRST , + .rcr2 =RPHASE |RFRLEN2 (OMAP_MCBSP_WORD_8 ) | +RWDLEN2 (OMAP_MCBSP_WORD_16 ) |RDATDLY (1 ), + .rcr1 =RFRLEN1 (OMAP_MCBSP_WORD_8 ) |RWDLEN1 (OMAP_MCBSP_WORD_16 ), + .xcr2 =XPHASE |XFRLEN2 (OMAP_MCBSP_WORD_8 ) | +XWDLEN2 (OMAP_MCBSP_WORD_16 ) |XDATDLY (1 ) |XFIG , + .xcr1 =XFRLEN1 (OMAP_MCBSP_WORD_8 ) |XWDLEN1 (OMAP_MCBSP_WORD_16 ), + .srgr1 =FWID (15 ), + .srgr2 =GSYNC |CLKSP |FSGM |FPER (31 ), + + .pcr0 =CLKXM |CLKRM |FSXP |FSRP |CLKXP |CLKRP , +//.pcr0 = CLKXP | CLKRP, /* mcbsp: slave */ + }; + +static struct omap_alsa_codec_config alsa_config = { + .name ="H2 TSC2101" , + .mcbsp_regs_alsa = &mcbsp_regs, + .codec_configure_dev = tsc2101_configure, + .codec_set_samplerate = tsc2101_set_samplerate, + .codec_clock_setup = tsc2101_clock_setup, + .codec_clock_on = tsc2101_clock_on, + .codec_clock_off = tsc2101_clock_off, + .get_default_samplerate = tsc2101_get_default_samplerate, +}; + +static struct platform_device h2_mcbsp1_device = { + .name ="omap_alsa_mcbsp" , + .id =1 , + .dev = { + .platform_data = &alsa_config, + }, + }; +static struct platform_device *h2_devices[]__initdata = { &h2_nor_device, &h2_nand_device,
@@ -283,6 +320,7 @@ static struct platform_device *h2_device &h2_irda_device, &h2_kp_device, &h2_lcd_device, + &h2_mcbsp1_device, };static void __init h2_init_smc91x (void )
+#define DEFAULT_BITPERSAMPLE 16
+static struct omap_mcbsp_reg_cfg mcbsp_regs = {
+ .spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
+ .spcr1 = RINTM(3) | RRST,
the default bitspersample might vary for codecs - some codecs have support for 24 bit too(and mcbsp as 32bit wordlen if bitspersample is 24bit). this was not supported in oss, but with alsa.. we have scope.
One interesting observations about the new platform device support. on SDP2430, we can plug in the codec we'd desire. the combination of codec and mcbsp settings are useful, not mcbsp settings remaining remaining constant.
i can see we can do it here and a lot cleaner :)
Regards,
Nishanth Menon
________________________________
From: [email protected] on behalf of Daniel Petrini
Sent: Mon 2/20/2006 11:53 AM
To: OMAP-Linux
Subject: [PATCH] Alsa modularisations and support for tsc2101 4/7
ALSA Omap Patch
This patch includes the platform device support for the new proposed approach. For OSK and H2.
signed-off by Daniel Petrini <[email protected]> signed-off by Mika Laitio <[email protected]>
Daniel Petrini
--
INdT - Manaus - Brazil
Quoted 7 lines · Nishanth
One interesting observations about the new platform device support. on SDP2430, we can plug in the codec we'd desire. the combination of codec and mcbsp settings are useful, not mcbsp settings remaining remaining constant.
i can see we can do it here and a lot cleaner :)
I am not able to understand this. Could you please explain?
Does it mean, that you have added the code in 2430 port which does above stuff, means dynamic setting for McBSP from platform data? _or_ You want to mention that McBSP settings for particular board and codec combination remains same.
---Komal Shah
http://komalshah.blogspot.com/
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Quoted 5 lines
Does it mean, that you have added the code in 2430 port which does above stuff, means dynamic setting for McBSP from platform data? _or_ You want to mention that McBSP settings for particular board and codec combination remains same.
yes. the touple (mcbsp config,codec, board) remains constant. the probe of the codec should take care of detecting if the device is actually present or not. dynamic settings from mcbsp default settings defined in platform data is required for the following cases:
1. when the device switches mode of data transfer - such as moving from 16 bit to 24 bit
2. trying to do "pseudo" mono data transfer where the input data is in mono and this needs to be duplicated at i2s level so that the codec does a stereo output.
Regards,
Nishanth Menon