* [PATCH 00/19] Update and clean up on sound/arm/omap/omap-alsa*[c,h] (take #2) @ 2008-04-18 8:00 Eduardo Valentin 2008-04-18 8:00 ` [PATCH 01/19] Update audio driver for H2 board Eduardo Valentin 2008-04-23 23:57 ` [PATCH 00/19] Update and clean up on sound/arm/omap/omap-alsa*[c,h] (take #2) Tony Lindgren 0 siblings, 2 replies; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:00 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Hi all, This patch series cleans up most of the errors and warnings reported by checkpatch.pl on sound/arm/omap/omap-alsa*[c,h]. Some checks reported by checkpatch.pl were ignored, such as removing #if 0 codes. Not all were eligible for remotion. There is also one patch that updates the alsa driver for H2. Since tsc2101 i2c driver was updated, this alsa driver stop working. Cheers, --- Eduardo Valentin Eduardo Valentin (19): Update audio driver for H2 board Code clean-up for include/asm-arm/arch-omap/omap-alsa.h Code clean-up for sound/arm/omap/omap-alsa-aic23.c Code clean-up for sound/arm/omap/omap-alsa-aic23.h Code clean-up for sound/arm/omap/omap-alsa-aic23-mixer.c Code clean-up for sound/arm/omap/omap-alsa-dma.c Code clean-up for sound/arm/omap/omap-alsa-dma.h Code clean-up for sound/arm/omap/omap-alsa-sx1-mixer.c Code clean-up for sound/arm/omap/omap-alsa-sx1-mixer.h Code clean-up for sound/arm/omap/omap-alsa-sx1.c Code clean-up for sound/arm/omap/omap-alsa-sx1.h Code clean-up for sound/arm/omap/omap-alsa-tsc2101-mixer.c Code clean-up for sound/arm/omap/omap-alsa-tsc2101-mixer.h Code clean-up for sound/arm/omap/omap-alsa-tsc2101.c Code clean-up for sound/arm/omap/omap-alsa-tsc2101.h Code clean-up for sound/arm/omap/omap-alsa-tsc2102-mixer.c Code clean-up for sound/arm/omap/omap-alsa-tsc2102.c Code clean-up for sound/arm/omap/omap-alsa-tsc2102.h Code clean-up for sound/arm/omap/omap-alsa.c arch/arm/mach-omap1/board-h2.c | 71 ++-- include/asm-arm/arch-omap/omap-alsa.h | 29 +- sound/arm/omap/omap-alsa-aic23-mixer.c | 144 ++++--- sound/arm/omap/omap-alsa-aic23.c | 59 ++-- sound/arm/omap/omap-alsa-aic23.h | 12 +- sound/arm/omap/omap-alsa-dma.c | 171 ++++----- sound/arm/omap/omap-alsa-dma.h | 22 +- sound/arm/omap/omap-alsa-sx1-mixer.c | 22 +- sound/arm/omap/omap-alsa-sx1-mixer.h | 6 +- sound/arm/omap/omap-alsa-sx1.c | 72 +++- sound/arm/omap/omap-alsa-sx1.h | 3 +- sound/arm/omap/omap-alsa-tsc2101-mixer.c | 631 ++++++++++++++++-------------- sound/arm/omap/omap-alsa-tsc2101-mixer.h | 31 +- sound/arm/omap/omap-alsa-tsc2101.c | 320 ++++++++++----- sound/arm/omap/omap-alsa-tsc2101.h | 11 +- sound/arm/omap/omap-alsa-tsc2102-mixer.c | 14 +- sound/arm/omap/omap-alsa-tsc2102.c | 70 ++-- sound/arm/omap/omap-alsa-tsc2102.h | 2 +- sound/arm/omap/omap-alsa.c | 163 ++++---- 19 files changed, 1056 insertions(+), 797 deletions(-) ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 01/19] Update audio driver for H2 board 2008-04-18 8:00 [PATCH 00/19] Update and clean up on sound/arm/omap/omap-alsa*[c,h] (take #2) Eduardo Valentin @ 2008-04-18 8:00 ` Eduardo Valentin 2008-04-18 8:00 ` [PATCH 02/19] Code clean-up for include/asm-arm/arch-omap/omap-alsa.h Eduardo Valentin 2008-04-23 23:57 ` [PATCH 00/19] Update and clean up on sound/arm/omap/omap-alsa*[c,h] (take #2) Tony Lindgren 1 sibling, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:00 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> This patch updates the audio driver based on tsc2101 chip for H2 board. tsc2101 driver was updated against new spi framework, but its audio driver for H2 wasn't. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- arch/arm/mach-omap1/board-h2.c | 71 +++++++++++++++--------------- sound/arm/omap/omap-alsa-tsc2101-mixer.c | 7 ++- sound/arm/omap/omap-alsa-tsc2101-mixer.h | 2 + sound/arm/omap/omap-alsa-tsc2101.c | 28 ++++++++++-- sound/arm/omap/omap-alsa-tsc2101.h | 5 ++ 5 files changed, 70 insertions(+), 43 deletions(-) diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index aa1f8af..4f8e6da 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c @@ -320,6 +320,40 @@ static void h2_lcd_dev_init(struct spi_device *tsc2101) platform_device_register(&h2_lcd_device); } +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, +}; + +static struct platform_device h2_mcbsp1_device = { + .name = "omap_alsa_mcbsp", + .id = 1, + .dev = { + .platform_data = &alsa_config, + }, +}; + +static void h2_audio_dev_init(struct spi_device *tsc2101) +{ + h2_mcbsp1_device.dev.platform_data = tsc2101; + platform_device_register(&h2_mcbsp1_device); +} + static int h2_tsc2101_init(struct spi_device *spi) { int r; @@ -344,6 +378,7 @@ static int h2_tsc2101_init(struct spi_device *spi) omap_cfg_reg(N15_1610_UWIRE_CS1); h2_lcd_dev_init(spi); + h2_audio_dev_init(spi); return 0; err: @@ -386,48 +421,12 @@ static struct spi_board_info h2_spi_board_info[] __initdata = { }, }; -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 = NULL, /* tsc2101_configure, */ - .codec_set_samplerate = NULL, /* tsc2101_set_samplerate, */ - .codec_clock_setup = NULL, /* tsc2101_clock_setup, */ - .codec_clock_on = NULL, /* tsc2101_clock_on, */ - .codec_clock_off = NULL, /* tsc2101_clock_off, */ - .get_default_samplerate = NULL, /* 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, &h2_smc91x_device, &h2_irda_device, &h2_kp_device, - &h2_mcbsp1_device, }; static void __init h2_init_smc91x(void) diff --git a/sound/arm/omap/omap-alsa-tsc2101-mixer.c b/sound/arm/omap/omap-alsa-tsc2101-mixer.c index 8faba95..09257d7 100644 --- a/sound/arm/omap/omap-alsa-tsc2101-mixer.c +++ b/sound/arm/omap/omap-alsa-tsc2101-mixer.c @@ -43,6 +43,7 @@ #include "omap-alsa-tsc2101.h" #include "omap-alsa-tsc2101-mixer.h" +#include <linux/spi/tsc2101.h> #include <linux/types.h> #include <sound/initval.h> #include <sound/control.h> @@ -68,7 +69,8 @@ static int current_rec_src = REC_SRC_SINGLE_ENDED_MICIN_HED; */ inline void omap_tsc2101_audio_write(u8 address, u16 data) { - omap_tsc2101_write(PAGE2_AUDIO_CODEC_REGISTERS, address, data); + tsc2101_write_sync(mcbsp_dev.tsc2101_dev, PAGE2_AUDIO_CODEC_REGISTERS, + address, data); } /* @@ -76,7 +78,8 @@ inline void omap_tsc2101_audio_write(u8 address, u16 data) */ inline u16 omap_tsc2101_audio_read(u8 address) { - return (omap_tsc2101_read(PAGE2_AUDIO_CODEC_REGISTERS, address)); + return (tsc2101_read_sync(mcbsp_dev.tsc2101_dev, + PAGE2_AUDIO_CODEC_REGISTERS, address)); } /* diff --git a/sound/arm/omap/omap-alsa-tsc2101-mixer.h b/sound/arm/omap/omap-alsa-tsc2101-mixer.h index 513614c..b110b36 100644 --- a/sound/arm/omap/omap-alsa-tsc2101-mixer.h +++ b/sound/arm/omap/omap-alsa-tsc2101-mixer.h @@ -76,4 +76,6 @@ #define TSC2101_AUDIO_CODEC_REGISTERS_PAGE2 (2) +extern struct mcbsp_dev_info mcbsp_dev; + #endif /*OMAPALSATSC2101MIXER_H_*/ diff --git a/sound/arm/omap/omap-alsa-tsc2101.c b/sound/arm/omap/omap-alsa-tsc2101.c index 88ed046..1d8adc1 100644 --- a/sound/arm/omap/omap-alsa-tsc2101.c +++ b/sound/arm/omap/omap-alsa-tsc2101.c @@ -22,6 +22,7 @@ #include <linux/soundcard.h> #include <linux/platform_device.h> #include <linux/clk.h> +#include <linux/spi/tsc2101.h> #include <asm/io.h> #include <asm/arch/mcbsp.h> @@ -38,6 +39,8 @@ #include <asm/arch/omap-alsa.h> #include "omap-alsa-tsc2101.h" +struct mcbsp_dev_info mcbsp_dev; + static struct clk *tsc2101_mclk = 0; //#define DUMP_TSC2101_AUDIO_REGISTERS @@ -143,7 +146,8 @@ static struct snd_pcm_hardware tsc2101_snd_omap_alsa_capture = { */ inline void tsc2101_audio_write(u8 address, u16 data) { - omap_tsc2101_write(PAGE2_AUDIO_CODEC_REGISTERS, address, data); + tsc2101_write_sync(mcbsp_dev.tsc2101_dev, PAGE2_AUDIO_CODEC_REGISTERS, + address, data); } /* @@ -151,7 +155,8 @@ inline void tsc2101_audio_write(u8 address, u16 data) */ inline u16 tsc2101_audio_read(u8 address) { - return (omap_tsc2101_read(PAGE2_AUDIO_CODEC_REGISTERS, address)); + return (tsc2101_read_sync(mcbsp_dev.tsc2101_dev, + PAGE2_AUDIO_CODEC_REGISTERS, address)); } #ifdef DUMP_TSC2101_AUDIO_REGISTERS @@ -341,9 +346,9 @@ int tsc2101_clock_on(void) err); // Now turn the audio on - omap_tsc2101_write(PAGE2_AUDIO_CODEC_REGISTERS, - TSC2101_CODEC_POWER_CTRL, - 0x0000); + tsc2101_write_sync(mcbsp_dev.tsc2101_dev, PAGE2_AUDIO_CODEC_REGISTERS, + TSC2101_CODEC_POWER_CTRL, + 0x0000); return 0; } @@ -382,9 +387,22 @@ int tsc2101_get_default_samplerate(void) static int __devinit snd_omap_alsa_tsc2101_probe(struct platform_device *pdev) { + struct spi_device *tsc2101; int ret; struct omap_alsa_codec_config *codec_cfg; + tsc2101 = dev_get_drvdata(&pdev->dev); + if (tsc2101 == NULL) { + dev_err(&pdev->dev, "no platform data\n"); + return -ENODEV; + } + if (strncmp(tsc2101->modalias, "tsc2101", 8) != 0) { + dev_err(&pdev->dev, "tsc2101 not found\n"); + return -EINVAL; + } + mcbsp_dev.mcbsp_dev = pdev; + mcbsp_dev.tsc2101_dev = tsc2101; + codec_cfg = pdev->dev.platform_data; if (codec_cfg != NULL) { codec_cfg->hw_constraints_rates = &tsc2101_hw_constraints_rates; diff --git a/sound/arm/omap/omap-alsa-tsc2101.h b/sound/arm/omap/omap-alsa-tsc2101.h index 85dccbb..73999a0 100644 --- a/sound/arm/omap/omap-alsa-tsc2101.h +++ b/sound/arm/omap/omap-alsa-tsc2101.h @@ -42,6 +42,11 @@ #define PAGE2_AUDIO_CODEC_REGISTERS (2) +struct mcbsp_dev_info { + struct platform_device *mcbsp_dev; + struct spi_device *tsc2101_dev; +}; + struct tsc2101_samplerate_reg_info { u16 sample_rate; u8 divisor; -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 02/19] Code clean-up for include/asm-arm/arch-omap/omap-alsa.h 2008-04-18 8:00 ` [PATCH 01/19] Update audio driver for H2 board Eduardo Valentin @ 2008-04-18 8:00 ` Eduardo Valentin 2008-04-18 8:00 ` [PATCH 03/19] Code clean-up for sound/arm/omap/omap-alsa-aic23.c Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:00 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- include/asm-arm/arch-omap/omap-alsa.h | 29 +++++++++++++++++++---------- 1 files changed, 19 insertions(+), 10 deletions(-) diff --git a/include/asm-arm/arch-omap/omap-alsa.h b/include/asm-arm/arch-omap/omap-alsa.h index 0f8a7d3..9eaa7f2 100644 --- a/include/asm-arm/arch-omap/omap-alsa.h +++ b/include/asm-arm/arch-omap/omap-alsa.h @@ -49,15 +49,23 @@ * Debug functions */ #undef DEBUG -//#define DEBUG +/* #define DEBUG */ -#define ERR(ARGS...) printk(KERN_ERR "{%s}-ERROR: ", __FUNCTION__);printk(ARGS); +#define ERR(ARGS...) \ + do { \ + printk(KERN_ERR "{%s}-ERROR: ", __func__); \ + printk(ARGS); \ + } while (0) #ifdef DEBUG -#define DPRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) -#define ADEBUG() printk("XXX Alsa debug f:%s, l:%d\n", __FUNCTION__, __LINE__) -#define FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) -#define FN_OUT(n) printk(KERN_INFO "[%s]: end(%u)\n",__FUNCTION__, n) +#define DPRINTK(ARGS...) \ + do { \ + printk(KERN_INFO "<%s>: ", __func__); \ + printk(ARGS); \ + } while (0) +#define ADEBUG() printk("XXX Alsa debug f:%s, l:%d\n", __func__, __LINE__) +#define FN_IN printk(KERN_INFO "[%s]: start\n", __func__) +#define FN_OUT(n) printk(KERN_INFO "[%s]: end(%u)\n", __func__, n) #else #define DPRINTK(ARGS...) /* nop */ #define ADEBUG() /* nop */ @@ -81,12 +89,12 @@ struct audio_stream { char dma_q_count; /* DMA Channel Q Count */ int active:1; /* we are using this stream for transfer now */ int period; /* current transfer period */ - int periods; /* current count of periods registerd in the DMA engine */ + int periods; /* current registered periods in DMA engine */ spinlock_t dma_lock; /* for locking in DMA operations */ struct snd_pcm_substream *stream; /* the pcm stream */ unsigned linked:1; /* dma channels linked */ - int offset; /* store start position of the last period in the alsa buffer */ - int (*hw_start)(void); /* interface to start HW interface, e.g. McBSP */ + int offset; /* start position of last period in alsa buf */ + int (*hw_start)(void); /* interface to start HW interface, (McBSP) */ int (*hw_stop)(void); /* interface to stop HW interface, e.g. McBSP */ }; @@ -127,7 +135,8 @@ void snd_omap_suspend_mixer(void); void snd_omap_resume_mixer(void); #endif -int snd_omap_alsa_post_probe(struct platform_device *pdev, struct omap_alsa_codec_config *config); +int snd_omap_alsa_post_probe(struct platform_device *pdev, + struct omap_alsa_codec_config *config); int snd_omap_alsa_remove(struct platform_device *pdev); #ifdef CONFIG_PM int snd_omap_alsa_suspend(struct platform_device *pdev, pm_message_t state); -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 03/19] Code clean-up for sound/arm/omap/omap-alsa-aic23.c 2008-04-18 8:00 ` [PATCH 02/19] Code clean-up for include/asm-arm/arch-omap/omap-alsa.h Eduardo Valentin @ 2008-04-18 8:00 ` Eduardo Valentin 2008-04-18 8:00 ` [PATCH 04/19] Code clean-up for sound/arm/omap/omap-alsa-aic23.h Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:00 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-aic23.c | 59 ++++++++++++++++++++------------------ sound/arm/omap/omap-alsa-aic23.h | 2 + 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/sound/arm/omap/omap-alsa-aic23.c b/sound/arm/omap/omap-alsa-aic23.c index 4d67fa3..1e43608 100644 --- a/sound/arm/omap/omap-alsa-aic23.c +++ b/sound/arm/omap/omap-alsa-aic23.c @@ -1,6 +1,6 @@ /* * arch/arm/mach-omap1/omap-alsa-aic23.c - * + * * Alsa codec Driver for AIC23 chip on OSK5912 platform board * * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil @@ -8,7 +8,7 @@ * {daniel.petrini, david.cohen, anderson.briglia}@indt.org.br * * Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi> - * + * * Based in former alsa driver for osk and oss driver * * This program is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ #include <asm/arch/omap-alsa.h> #include "omap-alsa-aic23.h" -static struct clk *aic23_mclk = 0; +static struct clk *aic23_mclk; /* aic23 related */ static const struct aic23_samplerate_reg_info @@ -48,7 +48,7 @@ static const struct aic23_samplerate_reg_info /* * Hardware capabilities */ - + /* * DAC USB-mode sampling rates (MCLK = 12 MHz) * The rates and rate_reg_into MUST be in the same order @@ -67,7 +67,7 @@ static struct snd_pcm_hw_constraint_list aic23_hw_constraints_rates = { static struct snd_pcm_hardware aic23_snd_omap_alsa_playback = { .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), + SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), .formats = (SNDRV_PCM_FMTBIT_S16_LE), .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | @@ -112,8 +112,6 @@ static struct snd_pcm_hardware aic23_snd_omap_alsa_capture = { * codec dependent code. */ -extern int aic23_write_value(u8 reg, u16 value); - /* TLV320AIC23 is a write only device */ void audio_aic23_write(u8 address, u16 data) { @@ -172,8 +170,12 @@ inline void aic23_configure(void) /* Initialize the AIC23 internal state */ - /* Analog audio path control, DAC selected, delete INSEL_MIC for line in */ - audio_aic23_write(ANALOG_AUDIO_CONTROL_ADDR, DEFAULT_ANALOG_AUDIO_CONTROL); + /* + * Analog audio path control, DAC selected, + * delete INSEL_MIC for line-in + */ + audio_aic23_write(ANALOG_AUDIO_CONTROL_ADDR, + DEFAULT_ANALOG_AUDIO_CONTROL); /* Digital audio path control, de-emphasis control 44.1kHz */ audio_aic23_write(DIGITAL_AUDIO_CONTROL_ADDR, DEEMP_44K); @@ -191,11 +193,11 @@ inline void aic23_configure(void) } /* - * Omap MCBSP clock configuration and Power Management - * - * Here we have some functions that allows clock to be enabled and - * disabled only when needed. Besides doing clock configuration - * it allows turn on/turn off audio when necessary. + * OMAP MCBSP clock configuration and Power Management + * + * Here we have some functions that allow clock to be enabled and + * disabled only when needed. Besides doing clock configuration + * it allows turn on/turn off audio when necessary. */ /* * Do clock framework mclk search @@ -207,7 +209,7 @@ void aic23_clock_setup(void) /* * Do some sanity check, set clock rate, starts it and - * turn codec audio on + * turn codec audio on */ int aic23_clock_on(void) { @@ -236,9 +238,9 @@ int aic23_clock_on(void) clk_get_usecount(aic23_mclk)); /* Now turn the audio on */ - audio_aic23_write(POWER_DOWN_CONTROL_ADDR, + audio_aic23_write(POWER_DOWN_CONTROL_ADDR, ~DEVICE_POWER_OFF & ~OUT_OFF & ~DAC_OFF & - ~ADC_OFF & ~MIC_OFF & ~LINE_OFF); + ~ADC_OFF & ~MIC_OFF & ~LINE_OFF); return 0; } @@ -248,7 +250,7 @@ int aic23_clock_on(void) */ int aic23_clock_off(void) { - if (clk_get_usecount(aic23_mclk) > 0) { + if (clk_get_usecount(aic23_mclk) > 0) { if (clk_get_rate(aic23_mclk) != CODEC_CLOCK) { printk(KERN_WARNING "MCLK for audio should be %d Hz. But is %d Hz\n", @@ -258,10 +260,10 @@ int aic23_clock_off(void) clk_disable(aic23_mclk); } - + audio_aic23_write(POWER_DOWN_CONTROL_ADDR, DEVICE_POWER_OFF | OUT_OFF | DAC_OFF | - ADC_OFF | MIC_OFF | LINE_OFF); + ADC_OFF | MIC_OFF | LINE_OFF); return 0; } @@ -274,21 +276,22 @@ static int __devinit snd_omap_alsa_aic23_probe(struct platform_device *pdev) { int ret; struct omap_alsa_codec_config *codec_cfg; - + codec_cfg = pdev->dev.platform_data; if (codec_cfg != NULL) { codec_cfg->hw_constraints_rates = &aic23_hw_constraints_rates; - codec_cfg->snd_omap_alsa_playback = &aic23_snd_omap_alsa_playback; - codec_cfg->snd_omap_alsa_capture = &aic23_snd_omap_alsa_capture; + codec_cfg->snd_omap_alsa_playback = + &aic23_snd_omap_alsa_playback; + codec_cfg->snd_omap_alsa_capture = &aic23_snd_omap_alsa_capture; codec_cfg->codec_configure_dev = aic23_configure; codec_cfg->codec_set_samplerate = aic23_set_samplerate; codec_cfg->codec_clock_setup = aic23_clock_setup; codec_cfg->codec_clock_on = aic23_clock_on; codec_cfg->codec_clock_off = aic23_clock_off; - codec_cfg->get_default_samplerate = aic23_get_default_samplerate; + codec_cfg->get_default_samplerate = + aic23_get_default_samplerate; ret = snd_omap_alsa_post_probe(pdev, codec_cfg); - } - else + } else ret = -ENODEV; return ret; } @@ -306,7 +309,7 @@ static struct platform_driver omap_alsa_driver = { static int __init omap_alsa_aic23_init(void) { int err; - + ADEBUG(); err = platform_driver_register(&omap_alsa_driver); @@ -316,7 +319,7 @@ static int __init omap_alsa_aic23_init(void) static void __exit omap_alsa_aic23_exit(void) { ADEBUG(); - + platform_driver_unregister(&omap_alsa_driver); } diff --git a/sound/arm/omap/omap-alsa-aic23.h b/sound/arm/omap/omap-alsa-aic23.h index e2e2d59..8b11a69 100644 --- a/sound/arm/omap/omap-alsa-aic23.h +++ b/sound/arm/omap/omap-alsa-aic23.h @@ -67,6 +67,8 @@ struct aic23_samplerate_reg_info { u8 divider; /* if 0 CLKIN = MCLK, if 1 CLKIN = MCLK/2 */ }; +extern int aic23_write_value(u8 reg, u16 value); + /* * Defines codec specific functions pointers that can be used from the * common omap-alse base driver for all omap codecs. (tsc2101 and aic23) -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 04/19] Code clean-up for sound/arm/omap/omap-alsa-aic23.h 2008-04-18 8:00 ` [PATCH 03/19] Code clean-up for sound/arm/omap/omap-alsa-aic23.c Eduardo Valentin @ 2008-04-18 8:00 ` Eduardo Valentin 2008-04-18 8:00 ` [PATCH 05/19] Code clean-up for sound/arm/omap/omap-alsa-aic23-mixer.c Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:00 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-aic23.h | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sound/arm/omap/omap-alsa-aic23.h b/sound/arm/omap/omap-alsa-aic23.h index 8b11a69..66dc56b 100644 --- a/sound/arm/omap/omap-alsa-aic23.h +++ b/sound/arm/omap/omap-alsa-aic23.h @@ -1,6 +1,6 @@ /* * sound/arm/omap-alsa-aic23.h - * + * * Alsa Driver for AIC23 codec on OSK5912 platform board * * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil @@ -59,7 +59,8 @@ #define SIDETONE_12 0x080 #define SIDETONE_18 0x0c0 -#define DEFAULT_ANALOG_AUDIO_CONTROL DAC_SELECTED | STE_ENABLED | BYPASS_ON | INSEL_MIC | MICB_20DB +#define DEFAULT_ANALOG_AUDIO_CONTROL (DAC_SELECTED | STE_ENABLED | \ + BYPASS_ON | INSEL_MIC | MICB_20DB) struct aic23_samplerate_reg_info { u32 sample_rate; @@ -70,8 +71,8 @@ struct aic23_samplerate_reg_info { extern int aic23_write_value(u8 reg, u16 value); /* - * Defines codec specific functions pointers that can be used from the - * common omap-alse base driver for all omap codecs. (tsc2101 and aic23) + * Defines codec specific function pointers that can be used from the + * common omap-alsa base driver for all omap codecs. (tsc2101 and aic23) */ void define_codec_functions(struct omap_alsa_codec_config *codec_config); inline void aic23_configure(void); -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 05/19] Code clean-up for sound/arm/omap/omap-alsa-aic23-mixer.c 2008-04-18 8:00 ` [PATCH 04/19] Code clean-up for sound/arm/omap/omap-alsa-aic23.h Eduardo Valentin @ 2008-04-18 8:00 ` Eduardo Valentin 2008-04-18 8:00 ` [PATCH 06/19] Code clean-up for sound/arm/omap/omap-alsa-dma.c Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:00 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-aic23-mixer.c | 144 ++++++++++++++++++------------- sound/arm/omap/omap-alsa-aic23.h | 1 + 2 files changed, 85 insertions(+), 60 deletions(-) diff --git a/sound/arm/omap/omap-alsa-aic23-mixer.c b/sound/arm/omap/omap-alsa-aic23-mixer.c index ce55824..7f06582 100644 --- a/sound/arm/omap/omap-alsa-aic23-mixer.c +++ b/sound/arm/omap/omap-alsa-aic23-mixer.c @@ -46,7 +46,9 @@ #include <sound/initval.h> #include <sound/control.h> -MODULE_AUTHOR("David Cohen, Daniel Petrini - INdT"); +MODULE_AUTHOR("David Cohen"); +MODULE_AUTHOR("Daniel Petrini"); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("OMAP Alsa mixer driver for ALSA"); @@ -55,9 +57,8 @@ MODULE_DESCRIPTION("OMAP Alsa mixer driver for ALSA"); */ /* Codec AIC23 */ -#if defined(CONFIG_SENSORS_TLV320AIC23) || defined (CONFIG_SENSORS_TLV320AIC23_MODULE) - -extern void audio_aic23_write(u8, u16); +#if defined(CONFIG_SENSORS_TLV320AIC23) || \ + defined(CONFIG_SENSORS_TLV320AIC23_MODULE) #define MIXER_NAME "Mixer AIC23" #define SND_OMAP_WRITE(reg, val) audio_aic23_write(reg, val) @@ -73,7 +74,8 @@ extern void audio_aic23_write(u8, u16); .info = snd_omap_info_bool, \ .get = snd_omap_get_bool, \ .put = snd_omap_put_bool, \ - .private_value = reg | (reg_index << 8) | (invert << 10) | (mask << 12) \ + .private_value = reg | (reg_index << 8) | (invert << 10) | \ + (mask << 12) \ } #define OMAP_MUX(xname, reg, reg_index, mask) \ @@ -94,7 +96,8 @@ extern void audio_aic23_write(u8, u16); .info = snd_omap_info_single, \ .get = snd_omap_get_single, \ .put = snd_omap_put_single, \ - .private_value = reg | (reg_val << 8) | (reg_index << 16) | (mask << 18) \ + .private_value = reg | (reg_val << 8) | (reg_index << 16) |\ + (mask << 18) \ } #define OMAP_DOUBLE(xname, xindex, left_reg, right_reg, reg_index, mask) \ @@ -105,7 +108,8 @@ extern void audio_aic23_write(u8, u16); .info = snd_omap_info_double, \ .get = snd_omap_get_double, \ .put = snd_omap_put_double, \ - .private_value = left_reg | (right_reg << 8) | (reg_index << 16) | (mask << 18) \ + .private_value = left_reg | (right_reg << 8) | (reg_index << 16) | \ + (mask << 18) \ } /* Local Registers */ @@ -141,7 +145,7 @@ u16 snd_sidetone[6] = { /* Begin Bool Functions */ static int snd_omap_info_bool(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info * uinfo) + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; @@ -151,8 +155,8 @@ static int snd_omap_info_bool(struct snd_kcontrol *kcontrol, return 0; } -static int snd_omap_get_bool(struct snd_kcontrol * kcontrol, - struct snd_ctl_elem_value * ucontrol) +static int snd_omap_get_bool(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { int mic_index = (kcontrol->private_value >> 8) & 0x03; u16 mask = (kcontrol->private_value >> 12) & 0xff; @@ -168,8 +172,8 @@ static int snd_omap_get_bool(struct snd_kcontrol * kcontrol, return 0; } -static int snd_omap_put_bool(struct snd_kcontrol * kcontrol, - struct snd_ctl_elem_value * ucontrol) +static int snd_omap_put_bool(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { int mic_index = (kcontrol->private_value >> 8) & 0x03; u16 mask = (kcontrol->private_value >> 12) & 0xff; @@ -199,7 +203,7 @@ static int snd_omap_put_bool(struct snd_kcontrol * kcontrol, /* Begin Mux Functions */ static int snd_omap_info_mux(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info * uinfo) + struct snd_ctl_elem_info *uinfo) { /* Mic = 0 * Line = 1 */ @@ -218,20 +222,20 @@ static int snd_omap_info_mux(struct snd_kcontrol *kcontrol, return 0; } -static int snd_omap_get_mux(struct snd_kcontrol * kcontrol, - struct snd_ctl_elem_value * ucontrol) +static int snd_omap_get_mux(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { u16 mask = (kcontrol->private_value >> 10) & 0xff; - int mux_index = (kcontrol->private_value >> 8) & 0x03; + int mux_idx = (kcontrol->private_value >> 8) & 0x03; ucontrol->value.enumerated.item[0] = - (omap_regs[mux_index].l_reg & mask) ? 0 /* Mic */ : 1 /* Line */; + (omap_regs[mux_idx].l_reg & mask) ? 0 /* Mic */ : 1 /* Line */; return 0; } -static int snd_omap_put_mux(struct snd_kcontrol * kcontrol, - struct snd_ctl_elem_value * ucontrol) +static int snd_omap_put_mux(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { u16 reg = kcontrol->private_value & 0xff; u16 mask = (kcontrol->private_value >> 10) & 0xff; @@ -254,7 +258,7 @@ static int snd_omap_put_mux(struct snd_kcontrol * kcontrol, /* Begin Single Functions */ static int snd_omap_info_single(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info * uinfo) + struct snd_ctl_elem_info *uinfo) { int mask = (kcontrol->private_value >> 18) & 0xff; int reg_val = (kcontrol->private_value >> 8) & 0xff; @@ -268,8 +272,8 @@ static int snd_omap_info_single(struct snd_kcontrol *kcontrol, return 0; } -static int snd_omap_get_single(struct snd_kcontrol * kcontrol, - struct snd_ctl_elem_value * ucontrol) +static int snd_omap_get_single(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { u16 reg_val = (kcontrol->private_value >> 8) & 0xff; @@ -278,8 +282,8 @@ static int snd_omap_get_single(struct snd_kcontrol * kcontrol, return 0; } -static int snd_omap_put_single(struct snd_kcontrol * kcontrol, - struct snd_ctl_elem_value * ucontrol) +static int snd_omap_put_single(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { u16 reg_index = (kcontrol->private_value >> 16) & 0x03; u16 mask = (kcontrol->private_value >> 18) & 0x1ff; @@ -311,10 +315,12 @@ static int snd_omap_put_single(struct snd_kcontrol * kcontrol, /* Begin Double Functions */ static int snd_omap_info_double(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info * uinfo) + struct snd_ctl_elem_info *uinfo) { - /* mask == 0 : Switch - * mask != 0 : Volume */ + /* + * mask == 0 : Switch + * mask != 0 : Volume + */ int mask = (kcontrol->private_value >> 18) & 0xff; uinfo->type = mask ? SNDRV_CTL_ELEM_TYPE_INTEGER : @@ -326,11 +332,13 @@ static int snd_omap_info_double(struct snd_kcontrol *kcontrol, return 0; } -static int snd_omap_get_double(struct snd_kcontrol * kcontrol, - struct snd_ctl_elem_value * ucontrol) +static int snd_omap_get_double(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - /* mask == 0 : Switch - * mask != 0 : Volume */ + /* + * mask == 0 : Switch + * mask != 0 : Volume + */ int mask = (kcontrol->private_value >> 18) & 0xff; int vol_index = (kcontrol->private_value >> 16) & 0x03; @@ -346,8 +354,8 @@ static int snd_omap_get_double(struct snd_kcontrol * kcontrol, return 0; } -static int snd_omap_put_double(struct snd_kcontrol * kcontrol, - struct snd_ctl_elem_value * ucontrol) +static int snd_omap_put_double(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { /* mask == 0 : Switch * mask != 0 : Volume */ @@ -371,8 +379,10 @@ static int snd_omap_put_double(struct snd_kcontrol * kcontrol, omap_regs[vol_index].sw = ucontrol->value.integer.value[0]; } else { /* Volume */ - if ((omap_regs[vol_index].l_reg != (ucontrol->value.integer.value[0] & mask)) || - (omap_regs[vol_index].r_reg != (ucontrol->value.integer.value[1] & mask))) { + if ((omap_regs[vol_index].l_reg != + (ucontrol->value.integer.value[0] & mask)) || + (omap_regs[vol_index].r_reg != + (ucontrol->value.integer.value[1] & mask))) { changed = 1; omap_regs[vol_index].l_reg &= ~mask; @@ -383,11 +393,12 @@ static int snd_omap_put_double(struct snd_kcontrol * kcontrol, (ucontrol->value.integer.value[1] & mask); if (omap_regs[vol_index].sw) { /* write to registers only if sw is actived */ - SND_OMAP_WRITE(left_reg, omap_regs[vol_index].l_reg); - SND_OMAP_WRITE(right_reg, omap_regs[vol_index].r_reg); + SND_OMAP_WRITE(left_reg, + omap_regs[vol_index].l_reg); + SND_OMAP_WRITE(right_reg, + omap_regs[vol_index].r_reg); } - } - else { + } else { changed = 0; } } @@ -398,20 +409,27 @@ static int snd_omap_put_double(struct snd_kcontrol * kcontrol, /* End Double Functions */ static struct snd_kcontrol_new snd_omap_controls[] = { - OMAP_DOUBLE("PCM Playback Switch", 0, LEFT_CHANNEL_VOLUME_ADDR, RIGHT_CHANNEL_VOLUME_ADDR, - PCM_INDEX, 0x00), - OMAP_DOUBLE("PCM Playback Volume", 0, LEFT_CHANNEL_VOLUME_ADDR, RIGHT_CHANNEL_VOLUME_ADDR, - PCM_INDEX, OUTPUT_VOLUME_MASK), - OMAP_BOOL("Line Playback Switch", 0, ANALOG_AUDIO_CONTROL_ADDR, AAC_INDEX, BYPASS_ON, 0), - OMAP_DOUBLE("Line Capture Switch", 0, LEFT_LINE_VOLUME_ADDR, RIGHT_LINE_VOLUME_ADDR, - LINE_INDEX, 0x00), - OMAP_DOUBLE("Line Capture Volume", 0, LEFT_LINE_VOLUME_ADDR, RIGHT_LINE_VOLUME_ADDR, - LINE_INDEX, INPUT_VOLUME_MASK), - OMAP_BOOL("Mic Playback Switch", 0, ANALOG_AUDIO_CONTROL_ADDR, AAC_INDEX, STE_ENABLED, 0), - OMAP_SINGLE("Mic Playback Volume", 0, ANALOG_AUDIO_CONTROL_ADDR, AAC_INDEX, 5, SIDETONE_MASK), - OMAP_BOOL("Mic Capture Switch", 0, ANALOG_AUDIO_CONTROL_ADDR, AAC_INDEX, MICM_MUTED, 1), - OMAP_BOOL("Mic Booster Playback Switch", 0, ANALOG_AUDIO_CONTROL_ADDR, AAC_INDEX, MICB_20DB, 0), - OMAP_MUX("Capture Source", ANALOG_AUDIO_CONTROL_ADDR, AAC_INDEX, INSEL_MIC), + OMAP_DOUBLE("PCM Playback Switch", 0, LEFT_CHANNEL_VOLUME_ADDR, + RIGHT_CHANNEL_VOLUME_ADDR, PCM_INDEX, 0x00), + OMAP_DOUBLE("PCM Playback Volume", 0, LEFT_CHANNEL_VOLUME_ADDR, + RIGHT_CHANNEL_VOLUME_ADDR, PCM_INDEX, + OUTPUT_VOLUME_MASK), + OMAP_BOOL("Line Playback Switch", 0, ANALOG_AUDIO_CONTROL_ADDR, + AAC_INDEX, BYPASS_ON, 0), + OMAP_DOUBLE("Line Capture Switch", 0, LEFT_LINE_VOLUME_ADDR, + RIGHT_LINE_VOLUME_ADDR, LINE_INDEX, 0x00), + OMAP_DOUBLE("Line Capture Volume", 0, LEFT_LINE_VOLUME_ADDR, + RIGHT_LINE_VOLUME_ADDR, LINE_INDEX, INPUT_VOLUME_MASK), + OMAP_BOOL("Mic Playback Switch", 0, ANALOG_AUDIO_CONTROL_ADDR, + AAC_INDEX, STE_ENABLED, 0), + OMAP_SINGLE("Mic Playback Volume", 0, ANALOG_AUDIO_CONTROL_ADDR, + AAC_INDEX, 5, SIDETONE_MASK), + OMAP_BOOL("Mic Capture Switch", 0, ANALOG_AUDIO_CONTROL_ADDR, + AAC_INDEX, MICM_MUTED, 1), + OMAP_BOOL("Mic Booster Playback Switch", 0, ANALOG_AUDIO_CONTROL_ADDR, + AAC_INDEX, MICB_20DB, 0), + OMAP_MUX("Capture Source", ANALOG_AUDIO_CONTROL_ADDR, AAC_INDEX, + INSEL_MIC), }; #ifdef CONFIG_PM @@ -447,8 +465,10 @@ void snd_omap_resume_mixer(void) omap_regs[PCM_INDEX].l_reg = omap_pm_regs[PCM_INDEX].l_reg; omap_regs[PCM_INDEX].r_reg = omap_pm_regs[PCM_INDEX].r_reg; omap_regs[PCM_INDEX].sw = omap_pm_regs[PCM_INDEX].sw; - SND_OMAP_WRITE(LEFT_CHANNEL_VOLUME_ADDR, omap_pm_regs[PCM_INDEX].l_reg); - SND_OMAP_WRITE(RIGHT_CHANNEL_VOLUME_ADDR, omap_pm_regs[PCM_INDEX].r_reg); + SND_OMAP_WRITE(LEFT_CHANNEL_VOLUME_ADDR, + omap_pm_regs[PCM_INDEX].l_reg); + SND_OMAP_WRITE(RIGHT_CHANNEL_VOLUME_ADDR, + omap_pm_regs[PCM_INDEX].r_reg); } #endif @@ -460,8 +480,10 @@ void snd_omap_init_mixer(void) omap_regs[LINE_INDEX].l_reg = DEFAULT_INPUT_VOLUME & INPUT_VOLUME_MASK; omap_regs[LINE_INDEX].r_reg = DEFAULT_INPUT_VOLUME & INPUT_VOLUME_MASK; omap_regs[LINE_INDEX].sw = 0; - SND_OMAP_WRITE(LEFT_LINE_VOLUME_ADDR, DEFAULT_INPUT_VOLUME & INPUT_VOLUME_MASK); - SND_OMAP_WRITE(RIGHT_LINE_VOLUME_ADDR, DEFAULT_INPUT_VOLUME & INPUT_VOLUME_MASK); + SND_OMAP_WRITE(LEFT_LINE_VOLUME_ADDR, + DEFAULT_INPUT_VOLUME & INPUT_VOLUME_MASK); + SND_OMAP_WRITE(RIGHT_LINE_VOLUME_ADDR, + DEFAULT_INPUT_VOLUME & INPUT_VOLUME_MASK); /* Analog Audio Control's default values */ omap_regs[AAC_INDEX].l_reg = DEFAULT_ANALOG_AUDIO_CONTROL; @@ -490,10 +512,12 @@ int snd_omap_mixer(struct snd_card_omap_codec *chip) strcpy(card->mixername, MIXER_NAME); /* Registering alsa mixer controls */ - for (idx = 0; idx < ARRAY_SIZE(snd_omap_controls); idx++) - if ((err = snd_ctl_add(card, - snd_ctl_new1(&snd_omap_controls[idx], chip))) < 0) + for (idx = 0; idx < ARRAY_SIZE(snd_omap_controls); idx++) { + err = snd_ctl_add(card, + snd_ctl_new1(&snd_omap_controls[idx], chip)); + if (err < 0) return err; + } return 0; } diff --git a/sound/arm/omap/omap-alsa-aic23.h b/sound/arm/omap/omap-alsa-aic23.h index 66dc56b..e7dfc15 100644 --- a/sound/arm/omap/omap-alsa-aic23.h +++ b/sound/arm/omap/omap-alsa-aic23.h @@ -74,6 +74,7 @@ extern int aic23_write_value(u8 reg, u16 value); * Defines codec specific function pointers that can be used from the * common omap-alsa base driver for all omap codecs. (tsc2101 and aic23) */ +void audio_aic23_write(u8 address, u16 data); void define_codec_functions(struct omap_alsa_codec_config *codec_config); inline void aic23_configure(void); void aic23_set_samplerate(long rate); -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 06/19] Code clean-up for sound/arm/omap/omap-alsa-dma.c 2008-04-18 8:00 ` [PATCH 05/19] Code clean-up for sound/arm/omap/omap-alsa-aic23-mixer.c Eduardo Valentin @ 2008-04-18 8:00 ` Eduardo Valentin 2008-04-18 8:00 ` [PATCH 07/19] Code clean-up for sound/arm/omap/omap-alsa-dma.h Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:00 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-dma.c | 171 +++++++++++++++++++-------------------- 1 files changed, 83 insertions(+), 88 deletions(-) diff --git a/sound/arm/omap/omap-alsa-dma.c b/sound/arm/omap/omap-alsa-dma.c index 00359cb..3f9ff68 100644 --- a/sound/arm/omap/omap-alsa-dma.c +++ b/sound/arm/omap/omap-alsa-dma.c @@ -6,7 +6,7 @@ * Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi> * * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil - * + * * Copyright (C) 2004 Texas Instruments, Inc. * * Copyright (C) 2000, 2001 Nicolas Pitre <nico@cam.org> @@ -21,24 +21,30 @@ * * History: * - * 2004-06-07 Sriram Kannan - Created new file from omap_audio_dma_intfc.c. This file - * will contain only the DMA interface and buffer handling of OMAP - * audio driver. + * 2004-06-07 Sriram Kannan - Created new file from omap_audio_dma_intfc.c. + * This file will contain only the DMA interface + * and buffer handling of OMAP audio driver. + * + * 2004-06-22 Sriram Kannan - removed legacy code (auto-init). Self-linking + * of DMA logical channel. * - * 2004-06-22 Sriram Kannan - removed legacy code (auto-init). Self-linking of DMA logical channel. + * 2004-08-12 Nishanth Menon - Modified to integrate Audio requirements on + * 1610, 1710 platforms * - * 2004-08-12 Nishanth Menon - Modified to integrate Audio requirements on 1610,1710 platforms + * 2004-11-01 Nishanth Menon - 16xx platform code base modified to support + * multi channel chaining. * - * 2004-11-01 Nishanth Menon - 16xx platform code base modified to support multi channel chaining. + * 2004-12-15 Nishanth Menon - Improved 16xx platform channel logic + * introduced - tasklets, queue handling updated * - * 2004-12-15 Nishanth Menon - Improved 16xx platform channel logic introduced - tasklets, queue handling updated - * - * 2005-07-19 INdT Kernel Team - Alsa port. Creation of new file omap-alsa-dma.c based in - * omap-audio-dma-intfc.c oss file. Support for aic23 codec. - * Removal of buffer handling (Alsa does that), modifications - * in dma handling and port to alsa structures. + * 2005-07-19 INdT Kernel Team - Alsa port. Creation of new file + * omap-alsa-dma.c based in omap-audio-dma-intfc.c + * oss file. Support for aic23 codec. Removal of + * buffer handling (Alsa does that), modifications + * in dma handling and port to alsa structures. * - * 2005-12-18 Dirk Behme - Added L/R Channel Interchange fix as proposed by Ajaya Babu + * 2005-12-18 Dirk Behme - Added L/R Channel Interchange fix as proposed + * by Ajaya Babu */ #include <linux/module.h> @@ -56,24 +62,21 @@ #include <linux/sysrq.h> #include <linux/interrupt.h> #include <linux/dma-mapping.h> +#include <linux/io.h> +#include <linux/uaccess.h> -#include <asm/uaccess.h> -#include <asm/io.h> #include <asm/hardware.h> #include <asm/semaphore.h> - #include <asm/arch/dma.h> -#include "omap-alsa-dma.h" - #include <asm/arch/mcbsp.h> - #include <asm/arch/omap-alsa.h> -#undef DEBUG +#include "omap-alsa-dma.h" -#define ERR(ARGS...) printk(KERN_ERR "{%s}-ERROR: ", __FUNCTION__);printk(ARGS); +#undef DEBUG -/* Channel Queue Handling macros +/* + * Channel Queue Handling macros * tail always points to the current free entry * Head always points to the current entry being used * end is either head or tail @@ -83,13 +86,21 @@ #define AUDIO_QUEUE_FULL(s) (nr_linked_channels == s->dma_q_count) #define AUDIO_QUEUE_LAST(s) (1 == s->dma_q_count) #define AUDIO_QUEUE_EMPTY(s) (0 == s->dma_q_count) -#define __AUDIO_INCREMENT_QUEUE(end) ((end)=((end)+1) % nr_linked_channels) -#define AUDIO_INCREMENT_HEAD(s) __AUDIO_INCREMENT_QUEUE(s->dma_q_head); s->dma_q_count--; -#define AUDIO_INCREMENT_TAIL(s) __AUDIO_INCREMENT_QUEUE(s->dma_q_tail); s->dma_q_count++; +#define __AUDIO_INCREMENT_QUEUE(end) ((end) = ((end)+1) % nr_linked_channels) +#define AUDIO_INCREMENT_HEAD(s) \ + do { \ + __AUDIO_INCREMENT_QUEUE(s->dma_q_head); \ + s->dma_q_count--; \ + } while (0) +#define AUDIO_INCREMENT_TAIL(s) \ + do { \ + __AUDIO_INCREMENT_QUEUE(s->dma_q_tail); \ + s->dma_q_count++; \ + } while (0) /* DMA buffer fragmentation sizes */ #define MAX_DMA_SIZE 0x1000000 /* todo: sync with alsa */ -//#define CUT_DMA_SIZE 0x1000 +/* #define CUT_DMA_SIZE 0x1000 */ /* TODO: To be moved to more appropriate location */ #define DCSR_ERROR 0x3 #define DCSR_END_BLOCK (1 << 5) @@ -100,7 +111,7 @@ #define DCCR_EN (1 << 7) #define DCCR_AI (1 << 8) #define DCCR_REPEAT (1 << 9) -/* if 0 the channel works in 3.1 compatible mode*/ +/* if 0 the channel works in 3.1 compatible mode */ #define DCCR_N31COMP (1 << 10) #define DCCR_EP (1 << 11) #define DCCR_SRC_AMODE_BIT 12 @@ -112,26 +123,22 @@ #define AMODE_SINGLE_INDEX 0x2 #define AMODE_DOUBLE_INDEX 0x3 -/**************************** DATA STRUCTURES *****************************************/ - -static spinlock_t dma_list_lock = SPIN_LOCK_UNLOCKED; - +/* Data structures */ +DEFINE_SPINLOCK(dma_list_lock); static char nr_linked_channels = 1; -/*********************************** MODULE SPECIFIC FUNCTIONS ***********************/ +/* Module specific functions */ static void sound_dma_irq_handler(int lch, u16 ch_status, void *data); static int audio_set_dma_params_play(int channel, dma_addr_t dma_ptr, u_int dma_size); static int audio_set_dma_params_capture(int channel, dma_addr_t dma_ptr, u_int dma_size); -static int audio_start_dma_chain(struct audio_stream * s); +static int audio_start_dma_chain(struct audio_stream *s); -/*************************************************************************************** - * +/* * DMA channel requests - * - **************************************************************************************/ + */ static void omap_sound_dma_link_lch(void *data) { @@ -166,8 +173,7 @@ int omap_request_alsa_sound_dma(int device_id, const char *device_name, return -EPERM; } /* Try allocate memory for the num channels */ - *channels = - (int *) kmalloc(sizeof(int) * nr_linked_channels, GFP_KERNEL); + *channels = kmalloc(sizeof(int) * nr_linked_channels, GFP_KERNEL); chan = *channels; if (NULL == chan) { ERR("No Memory for channel allocs!\n"); @@ -176,18 +182,19 @@ int omap_request_alsa_sound_dma(int device_id, const char *device_name, } spin_lock(&dma_list_lock); for (i = 0; i < nr_linked_channels; i++) { - err = omap_request_dma(device_id, + err = omap_request_dma(device_id, device_name, - sound_dma_irq_handler, + sound_dma_irq_handler, data, &chan[i]); /* Handle Failure condition here */ if (err < 0) { int j; - for (j = 0; j < i; j++) { + + for (j = 0; j < i; j++) omap_free_dma(chan[j]); - } + spin_unlock(&dma_list_lock); kfree(chan); *channels = NULL; @@ -206,12 +213,11 @@ int omap_request_alsa_sound_dma(int device_id, const char *device_name, FN_OUT(0); return 0; } +EXPORT_SYMBOL(omap_request_alsa_sound_dma); -/*************************************************************************************** - * +/* * DMA channel requests Freeing - * - **************************************************************************************/ + */ static void omap_sound_dma_unlink_lch(void *data) { struct audio_stream *s = (struct audio_stream *)data; @@ -238,7 +244,7 @@ int omap_free_alsa_sound_dma(void *data, int **channels) { int i; int *chan = NULL; - + FN_IN; if (unlikely(NULL == channels)) { BUG(); @@ -262,17 +268,16 @@ int omap_free_alsa_sound_dma(void *data, int **channels) FN_OUT(0); return 0; } +EXPORT_SYMBOL(omap_free_alsa_sound_dma); -/*************************************************************************************** - * +/* * Stop all the DMA channels of the stream - * - **************************************************************************************/ + */ void omap_stop_alsa_sound_dma(struct audio_stream *s) { int *chan = s->lch; int i; - + FN_IN; if (unlikely(NULL == chan)) { BUG(); @@ -286,31 +291,30 @@ void omap_stop_alsa_sound_dma(struct audio_stream *s) FN_OUT(0); return; } -/*************************************************************************************** - * +EXPORT_SYMBOL(omap_stop_alsa_sound_dma); + +/* * Clear any pending transfers - * - **************************************************************************************/ -void omap_clear_alsa_sound_dma(struct audio_stream * s) + */ +void omap_clear_alsa_sound_dma(struct audio_stream *s) { FN_IN; omap_clear_dma(s->lch[s->dma_q_head]); FN_OUT(0); return; } +EXPORT_SYMBOL(omap_clear_alsa_sound_dma); -/*************************************************************************************** - * +/* * DMA related functions - * - **************************************************************************************/ + */ static int audio_set_dma_params_play(int channel, dma_addr_t dma_ptr, u_int dma_size) { int dt = 0x1; /* data type 16 */ int cen = 32; /* Stereo */ int cfn = dma_size / (2 * cen); - + FN_IN; omap_set_dma_dest_params(channel, 0x05, 0x00, (OMAP1510_MCBSP1_BASE + 0x06), @@ -328,7 +332,7 @@ static int audio_set_dma_params_capture(int channel, dma_addr_t dma_ptr, int dt = 0x1; /* data type 16 */ int cen = 32; /* stereo */ int cfn = dma_size / (2 * cen); - + FN_IN; omap_set_dma_src_params(channel, 0x05, 0x00, (OMAP1510_MCBSP1_BASE + 0x02), @@ -344,7 +348,7 @@ static int audio_start_dma_chain(struct audio_stream *s) int channel = s->lch[s->dma_q_head]; FN_IN; if (!s->started) { - s->hw_stop(); /* stops McBSP Interface */ + s->hw_stop(); /* stops McBSP Interface */ omap_start_dma(channel); s->started = 1; s->hw_start(); /* start McBSP interface */ @@ -355,12 +359,13 @@ static int audio_start_dma_chain(struct audio_stream *s) return 0; } -/* Start DMA - +/* + * Start DMA - * Do the initial set of work to initialize all the channels as required. * We shall then initate a transfer */ -int omap_start_alsa_sound_dma(struct audio_stream *s, - dma_addr_t dma_ptr, +int omap_start_alsa_sound_dma(struct audio_stream *s, + dma_addr_t dma_ptr, u_int dma_size) { int ret = -EPERM; @@ -372,13 +377,9 @@ int omap_start_alsa_sound_dma(struct audio_stream *s, MAX_DMA_SIZE); return -EOVERFLOW; } - //if (AUDIO_QUEUE_FULL(s)) { - // ret = -2; - // goto sound_out; - //} if (s->stream_id == SNDRV_PCM_STREAM_PLAYBACK) { - /*playback */ + /* playback */ ret = audio_set_dma_params_play(s->lch[s->dma_q_tail], dma_ptr, dma_size); @@ -393,17 +394,18 @@ int omap_start_alsa_sound_dma(struct audio_stream *s, } AUDIO_INCREMENT_TAIL(s); ret = audio_start_dma_chain(s); - if (ret) { + if (ret) ERR("dma start failed"); - } - sound_out: + +sound_out: FN_OUT(ret); return ret; } +EXPORT_SYMBOL(omap_start_alsa_sound_dma); -/* - * ISRs have to be short and smart.. +/* + * ISRs have to be short and smart.. * Here we call alsa handling, after some error checking */ static void sound_dma_irq_handler(int sound_curr_lch, u16 ch_status, @@ -413,9 +415,7 @@ static void sound_dma_irq_handler(int sound_curr_lch, u16 ch_status, struct audio_stream *s = (struct audio_stream *) data; FN_IN; - /* - * some register checkings - */ + /* some register checking */ DPRINTK("lch=%d,status=0x%x, dma_status=%d, data=%p\n", sound_curr_lch, ch_status, dma_status, data); @@ -426,7 +426,7 @@ static void sound_dma_irq_handler(int sound_curr_lch, u16 ch_status, return; } - if (ch_status & DCSR_END_BLOCK) + if (ch_status & DCSR_END_BLOCK) callback_omap_alsa_sound_dma(s); FN_OUT(0); return; @@ -436,8 +436,3 @@ MODULE_AUTHOR("Texas Instruments"); MODULE_DESCRIPTION("Common DMA handling for Audio driver on OMAP processors"); MODULE_LICENSE("GPL"); -EXPORT_SYMBOL(omap_start_alsa_sound_dma); -EXPORT_SYMBOL(omap_clear_alsa_sound_dma); -EXPORT_SYMBOL(omap_request_alsa_sound_dma); -EXPORT_SYMBOL(omap_free_alsa_sound_dma); -EXPORT_SYMBOL(omap_stop_alsa_sound_dma); -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 07/19] Code clean-up for sound/arm/omap/omap-alsa-dma.h 2008-04-18 8:00 ` [PATCH 06/19] Code clean-up for sound/arm/omap/omap-alsa-dma.c Eduardo Valentin @ 2008-04-18 8:00 ` Eduardo Valentin 2008-04-18 8:00 ` [PATCH 08/19] Code clean-up for sound/arm/omap/omap-alsa-sx1-mixer.c Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:00 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-dma.h | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sound/arm/omap/omap-alsa-dma.h b/sound/arm/omap/omap-alsa-dma.h index 1cecc8a..2f0e4e8 100644 --- a/sound/arm/omap/omap-alsa-dma.h +++ b/sound/arm/omap/omap-alsa-dma.h @@ -1,4 +1,4 @@ -/* +/* * linux/sound/arm/omap/omap-alsa-dma.h * * Common audio DMA handling for the OMAP processors @@ -6,7 +6,7 @@ * Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi> * * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil - * + * * Copyright (C) 2004 Texas Instruments, Inc. * * Copyright (C) 2000, 2001 Nicolas Pitre <nico@cam.org> @@ -21,8 +21,9 @@ * * History: * - * - * 2004/08/12 Nishanth Menon - Modified to integrate Audio requirements on 1610,1710 platforms + * + * 2004/08/12 Nishanth Menon - Modified to integrate Audio requirements on + * 1610, 1710 platforms * * 2005/07/25 INdT Kernel Team - Renamed to omap-alsa-dma.h. Ported to Alsa. */ @@ -30,23 +31,22 @@ #ifndef __OMAP_AUDIO_ALSA_DMA_H #define __OMAP_AUDIO_ALSA_DMA_H -/************************** INCLUDES *************************************/ - #include <asm/arch/omap-alsa.h> -/************************** GLOBAL DATA STRUCTURES *********************************/ +/* Global data structures */ typedef void (*dma_callback_t) (int lch, u16 ch_status, void *data); -/**************** ARCH SPECIFIC FUNCIONS *******************************************/ +/* arch specific functions */ -void omap_clear_alsa_sound_dma(struct audio_stream * s); +void omap_clear_alsa_sound_dma(struct audio_stream *s); int omap_request_alsa_sound_dma(int device_id, const char *device_name, - void *data, int **channels); + void *data, int **channels); int omap_free_alsa_sound_dma(void *data, int **channels); -int omap_start_alsa_sound_dma(struct audio_stream *s, dma_addr_t dma_ptr, u_int dma_size); +int omap_start_alsa_sound_dma(struct audio_stream *s, dma_addr_t dma_ptr, + u_int dma_size); void omap_stop_alsa_sound_dma(struct audio_stream *s); -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 08/19] Code clean-up for sound/arm/omap/omap-alsa-sx1-mixer.c 2008-04-18 8:00 ` [PATCH 07/19] Code clean-up for sound/arm/omap/omap-alsa-dma.h Eduardo Valentin @ 2008-04-18 8:00 ` Eduardo Valentin 2008-04-18 8:00 ` [PATCH 09/19] Code clean-up for sound/arm/omap/omap-alsa-sx1-mixer.h Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:00 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-sx1-mixer.c | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sound/arm/omap/omap-alsa-sx1-mixer.c b/sound/arm/omap/omap-alsa-sx1-mixer.c index 631b080..d0c3322 100644 --- a/sound/arm/omap/omap-alsa-sx1-mixer.c +++ b/sound/arm/omap/omap-alsa-sx1-mixer.c @@ -111,9 +111,9 @@ static int pcm_playback_target_info(struct snd_kcontrol *kcontrol, uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; uinfo->value.enumerated.items = PLAYBACK_TARGET_COUNT; - if (uinfo->value.enumerated.item > PLAYBACK_TARGET_COUNT - 1) { + if (uinfo->value.enumerated.item > PLAYBACK_TARGET_COUNT - 1) uinfo->value.enumerated.item = PLAYBACK_TARGET_COUNT - 1; - } + strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); return 0; @@ -210,14 +210,14 @@ static int headset_playback_volume_info(struct snd_kcontrol *kcontrol, } static int headset_playback_volume_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) + struct snd_ctl_elem_value *ucontrol) { ucontrol->value.integer.value[0] = current_volume; return 0; } static int headset_playback_volume_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) + struct snd_ctl_elem_value *ucontrol) { return set_mixer_volume(ucontrol->value.integer.value[0]); } @@ -233,14 +233,14 @@ static int headset_playback_switch_info(struct snd_kcontrol *kcontrol, } static int headset_playback_switch_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) + struct snd_ctl_elem_value *ucontrol) { ucontrol->value.integer.value[0] = 1; return 0; } static int headset_playback_switch_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) + struct snd_ctl_elem_value *ucontrol) { /* mute/unmute headset */ #if 0 @@ -262,14 +262,14 @@ static int fmradio_playback_volume_info(struct snd_kcontrol *kcontrol, } static int fmradio_playback_volume_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) + struct snd_ctl_elem_value *ucontrol) { ucontrol->value.integer.value[0] = current_fm_volume; return 0; } static int fmradio_playback_volume_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) + struct snd_ctl_elem_value *ucontrol) { int ret = current_fm_volume != ucontrol->value.integer.value[0]; int i; @@ -291,14 +291,14 @@ static int fmradio_playback_switch_info(struct snd_kcontrol *kcontrol, } static int fmradio_playback_switch_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) + struct snd_ctl_elem_value *ucontrol) { ucontrol->value.integer.value[0] = 1; return 0; } static int fmradio_playback_switch_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) + struct snd_ctl_elem_value *ucontrol) { /* mute/unmute FM radio */ if (ucontrol->value.integer.value[0]) @@ -460,7 +460,7 @@ int snd_omap_mixer(struct snd_card_omap_codec *egold) if (!egold) return -EINVAL; - for (i=0; i < ARRAY_SIZE(egold_control); i++) { + for (i = 0; i < ARRAY_SIZE(egold_control); i++) { err = snd_ctl_add(egold->card, snd_ctl_new1(&egold_control[i], egold->card)); if (err < 0) -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 09/19] Code clean-up for sound/arm/omap/omap-alsa-sx1-mixer.h 2008-04-18 8:00 ` [PATCH 08/19] Code clean-up for sound/arm/omap/omap-alsa-sx1-mixer.c Eduardo Valentin @ 2008-04-18 8:00 ` Eduardo Valentin 2008-04-18 8:00 ` [PATCH 10/19] Code clean-up for sound/arm/omap/omap-alsa-sx1.c Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:00 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-sx1-mixer.h | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/arm/omap/omap-alsa-sx1-mixer.h b/sound/arm/omap/omap-alsa-sx1-mixer.h index 686b81c..7d55388 100644 --- a/sound/arm/omap/omap-alsa-sx1-mixer.h +++ b/sound/arm/omap/omap-alsa-sx1-mixer.h @@ -31,8 +31,10 @@ /* following are used for register 03h Mixer PGA control bits D7-D5 for selecting record source */ #define REC_SRC_TARGET_COUNT 0x08 -#define REC_SRC_SINGLE_ENDED_MICIN_HED 0x00 /* oss code referred to MIXER_LINE */ -#define REC_SRC_SINGLE_ENDED_MICIN_HND 0x01 /* oss code referred to MIXER_MIC */ +/* OSS code referred to MIXER_LINE */ +#define REC_SRC_SINGLE_ENDED_MICIN_HED 0x00 +/* OSS code referred to MIXER_MIC */ +#define REC_SRC_SINGLE_ENDED_MICIN_HND 0x01 #define REC_SRC_SINGLE_ENDED_AUX1 0x02 #define REC_SRC_SINGLE_ENDED_AUX2 0x03 #define REC_SRC_MICIN_HED_AND_AUX1 0x04 -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 10/19] Code clean-up for sound/arm/omap/omap-alsa-sx1.c 2008-04-18 8:00 ` [PATCH 09/19] Code clean-up for sound/arm/omap/omap-alsa-sx1-mixer.h Eduardo Valentin @ 2008-04-18 8:00 ` Eduardo Valentin 2008-04-18 8:00 ` [PATCH 11/19] Code clean-up for sound/arm/omap/omap-alsa-sx1.h Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:00 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-sx1.c | 72 +++++++++++++++++++++++++++------------ 1 files changed, 50 insertions(+), 22 deletions(-) diff --git a/sound/arm/omap/omap-alsa-sx1.c b/sound/arm/omap/omap-alsa-sx1.c index c4691cd..efcabff 100644 --- a/sound/arm/omap/omap-alsa-sx1.c +++ b/sound/arm/omap/omap-alsa-sx1.c @@ -14,19 +14,18 @@ #include <linux/soundcard.h> #include <linux/platform_device.h> #include <linux/clk.h> -#include <asm/io.h> -#include <asm/arch/mcbsp.h> - +#include <linux/io.h> +#include <linux/connector.h> #include <linux/slab.h> #include <linux/pm.h> + #include <asm/arch/dma.h> #include <asm/arch/clock.h> #include <asm/arch/gpio.h> - +#include <asm/arch/mcbsp.h> #include <asm/arch/omap-alsa.h> -#include "omap-alsa-sx1.h" -#include <linux/connector.h> +#include "omap-alsa-sx1.h" /* Connector implementation */ static struct cb_id cn_sx1snd_id = { CN_IDX_SX1SND, CN_VAL_SX1SND }; @@ -36,9 +35,10 @@ static void cn_sx1snd_callback(void *data) { struct cn_msg *msg = (struct cn_msg *)data; - printk("%s: %lu: idx=%x, val=%x, seq=%u, ack=%u, len=%d: %s.\n", - __func__, jiffies, msg->id.idx, msg->id.val, - msg->seq, msg->ack, msg->len, (char *)msg->data); + printk(KERN_INFO + "%s: %lu: idx=%x, val=%x, seq=%u, ack=%u, len=%d: %s.\n", + __func__, jiffies, msg->id.idx, msg->id.val, + msg->seq, msg->ack, msg->len, (char *)msg->data); } /* Send IPC message to sound server */ @@ -63,7 +63,7 @@ int cn_sx1snd_send(unsigned int cmd, unsigned int arg1, unsigned int arg2) memcpy(m + 1, data, m->len); err = cn_netlink_send(m, CN_IDX_SX1SND, gfp_any()); - snd_printd("sent= %02X %02X %02X, err=%d\n", cmd,arg1,arg2,err); + snd_printd("sent= %02X %02X %02X, err=%d\n", cmd, arg1, arg2, err); kfree(m); if (err == -ESRCH) @@ -150,15 +150,42 @@ static void egold_set_samplerate(long sample_rate) clkgdv = CODEC_CLOCK / (sample_rate * (DEFAULT_BITPERSAMPLE * 2 - 1)); #endif switch (sample_rate) { - case 8000: clkgdv = 71; egold_rate = FRQ_8000; break; - case 11025: clkgdv = 51; egold_rate = FRQ_11025; break; - case 12000: clkgdv = 47; egold_rate = FRQ_12000; break; - case 16000: clkgdv = 35; egold_rate = FRQ_16000; break; - case 22050: clkgdv = 25; egold_rate = FRQ_22050; break; - case 24000: clkgdv = 23; egold_rate = FRQ_24000; break; - case 32000: clkgdv = 17; egold_rate = FRQ_32000; break; - case 44100: clkgdv = 12; egold_rate = FRQ_44100; break; - case 48000: clkgdv = 11; egold_rate = FRQ_48000; break; + case 8000: + clkgdv = 71; + egold_rate = FRQ_8000; + break; + case 11025: + clkgdv = 51; + egold_rate = FRQ_11025; + break; + case 12000: + clkgdv = 47; + egold_rate = FRQ_12000; + break; + case 16000: + clkgdv = 35; + egold_rate = FRQ_16000; + break; + case 22050: + clkgdv = 25; + egold_rate = FRQ_22050; + break; + case 24000: + clkgdv = 23; + egold_rate = FRQ_24000; + break; + case 32000: + clkgdv = 17; + egold_rate = FRQ_32000; + break; + case 44100: + clkgdv = 12; + egold_rate = FRQ_44100; + break; + case 48000: + clkgdv = 11; + egold_rate = FRQ_48000; + break; } srgr1 = (FWID(DEFAULT_BITPERSAMPLE - 1) | CLKGDV(clkgdv)); @@ -234,8 +261,8 @@ static int __init snd_omap_alsa_egold_probe(struct platform_device *pdev) return -ENODEV; codec_cfg->hw_constraints_rates = &egold_hw_constraints_rates; - codec_cfg->snd_omap_alsa_playback= &egold_snd_omap_alsa_playback; - codec_cfg->snd_omap_alsa_capture = &egold_snd_omap_alsa_capture; + codec_cfg->snd_omap_alsa_playback = &egold_snd_omap_alsa_playback; + codec_cfg->snd_omap_alsa_capture = &egold_snd_omap_alsa_capture; codec_cfg->codec_configure_dev = egold_configure; codec_cfg->codec_set_samplerate = egold_set_samplerate; codec_cfg->codec_clock_setup = egold_clock_setup; @@ -262,7 +289,8 @@ static int __init omap_alsa_egold_init(void) { int retval; - retval = cn_add_callback(&cn_sx1snd_id, cn_sx1snd_name, cn_sx1snd_callback); + retval = cn_add_callback(&cn_sx1snd_id, cn_sx1snd_name, + cn_sx1snd_callback); if (retval) printk(KERN_WARNING "cn_sx1snd failed to register\n"); return platform_driver_register(&omap_alsa_driver); -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 11/19] Code clean-up for sound/arm/omap/omap-alsa-sx1.h 2008-04-18 8:00 ` [PATCH 10/19] Code clean-up for sound/arm/omap/omap-alsa-sx1.c Eduardo Valentin @ 2008-04-18 8:00 ` Eduardo Valentin 2008-04-18 8:00 ` [PATCH 12/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101-mixer.c Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:00 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-sx1.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/sound/arm/omap/omap-alsa-sx1.h b/sound/arm/omap/omap-alsa-sx1.h index af7a409..9e11e0a 100644 --- a/sound/arm/omap/omap-alsa-sx1.h +++ b/sound/arm/omap/omap-alsa-sx1.h @@ -35,7 +35,8 @@ #define OSC_EN 2 /* Send IPC message to sound server */ -extern int cn_sx1snd_send(unsigned int cmd, unsigned int arg1, unsigned int arg2); +extern int cn_sx1snd_send(unsigned int cmd, unsigned int arg1, + unsigned int arg2); /* cmd for IPC_GROUP_DAC */ #define DAC_VOLUME_UPDATE 0 #define DAC_SETAUDIODEVICE 1 -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 12/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101-mixer.c 2008-04-18 8:00 ` [PATCH 11/19] Code clean-up for sound/arm/omap/omap-alsa-sx1.h Eduardo Valentin @ 2008-04-18 8:00 ` Eduardo Valentin 2008-04-18 8:01 ` [PATCH 13/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101-mixer.h Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:00 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=unknown-8bit, Size: 43599 bytes --] From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-tsc2101-mixer.c | 624 ++++++++++++++++-------------- 1 files changed, 342 insertions(+), 282 deletions(-) diff --git a/sound/arm/omap/omap-alsa-tsc2101-mixer.c b/sound/arm/omap/omap-alsa-tsc2101-mixer.c index 09257d7..d443342 100644 --- a/sound/arm/omap/omap-alsa-tsc2101-mixer.c +++ b/sound/arm/omap/omap-alsa-tsc2101-mixer.c @@ -1,15 +1,15 @@ /* * sound/arm/omap/omap-alsa-tsc2101-mixer.c - * + * * Alsa Driver for TSC2101 codec for OMAP platform boards. * - * Copyright (C) 2005 Mika Laitio <lamikr@cc.jyu.fi> and + * Copyright (C) 2005 Mika Laitio <lamikr@cc.jyu.fi> and * Everett Coleman II <gcc80x86@fuzzyneural.net> * * Board initialization code is based on the code in TSC2101 OSS driver. * Copyright (C) 2004 Texas Instruments, Inc. * Written by Nishanth Menon and Sriram Kannan - * + * * 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 @@ -33,13 +33,13 @@ * History: * * 2006-03-01 Mika Laitio - Mixer for the tsc2101 driver used in omap boards. - * Can switch between headset and loudspeaker playback, + * Can switch between headset and loudspeaker playback, * mute and unmute dgc, set dgc volume. Record source switch, - * keyclick, buzzer and headset volume and handset volume control + * keyclick, buzzer and headset volume and handset volume control * are still missing. - * + * */ - + #include "omap-alsa-tsc2101.h" #include "omap-alsa-tsc2101-mixer.h" @@ -48,8 +48,15 @@ #include <sound/initval.h> #include <sound/control.h> -//#define M_DPRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) +#ifdef DEBUG +#define M_DPRINTK(ARGS...) \ + do { \ + printk(KERN_INFO "<%s>: ", __func__); \ + printk(ARGS); \ + } while (0) +#else #define M_DPRINTK(ARGS...) /* nop */ +#endif #define CHECK_BIT(INDX, ARG) (((ARG) & TSC2101_BIT(INDX)) >> INDX) #define IS_UNMUTED(INDX, ARG) (((CHECK_BIT(INDX, ARG)) == 0)) @@ -64,7 +71,7 @@ static int current_playback_target = PLAYBACK_TARGET_LOUDSPEAKER; static int current_rec_src = REC_SRC_SINGLE_ENDED_MICIN_HED; -/* +/* * Simplified write for the tsc2101 audio registers. */ inline void omap_tsc2101_audio_write(u8 address, u16 data) @@ -73,7 +80,7 @@ inline void omap_tsc2101_audio_write(u8 address, u16 data) address, data); } -/* +/* * Simplified read for the tsc2101 audio registers. */ inline u16 omap_tsc2101_audio_read(u8 address) @@ -88,8 +95,9 @@ inline u16 omap_tsc2101_audio_read(u8 address) static void set_record_source(int val) { u16 data; - - /* Mute Analog Sidetone + + /* + * Mute Analog Sidetone * Analog sidetone gain db? * Input selected by MICSEL connected to ADC */ @@ -98,77 +106,84 @@ static void set_record_source(int val) data |= MPC_MICSEL(val); data |= MPC_MICADC; omap_tsc2101_audio_write(TSC2101_MIXER_PGA_CTRL, data); - + current_rec_src = val; } /* - * Converts the Alsa mixer volume (0 - 100) to real + * Converts the Alsa mixer volume (0 - 100) to real * Digital Gain Control (DGC) value that can be written * or read from the TSC2101 registry. - * + * * Note that the number "OUTPUT_VOLUME_MAX" is smaller than OUTPUT_VOLUME_MIN * because DGC works as a volume decreaser. (The more bigger value is put * to DGC, the more the volume of controlled channel is decreased) - * - * In addition the TCS2101 chip would allow the maximum volume reduction be 63.5 DB + * + * In addition the TCS2101 chip would allow the maximum + * volume reduction be 63.5 DB * but according to some tests user can not hear anything with this chip * when the volume is set to be less than 25 db. - * Therefore this function will return a value that means 38.5 db (63.5 db - 25 db) + * Therefore this function will return a value + * that means 38.5 db (63.5 db - 25 db) * reduction in the channel volume, when mixer is set to 0. - * For mixer value 100, this will return a value that means 0 db volume reduction. + * For mixer value 100, this will return a value that means + * 0 db volume reduction. * ([mute_left_bit]0000000[mute_right_bit]0000000) -*/ + */ int get_mixer_volume_as_dac_gain_control_volume(int vol) { u16 retVal; /* Convert 0 -> 100 volume to 0x7F(min) -> y(max) volume range */ - retVal = ((vol * OUTPUT_VOLUME_RANGE) / 100) + OUTPUT_VOLUME_MAX; + retVal = ((vol * OUTPUT_VOLUME_RANGE) / 100) + OUTPUT_VOLUME_MAX; /* invert the value for getting the proper range 0 min and 100 max */ - retVal = OUTPUT_VOLUME_MIN - retVal; - + retVal = OUTPUT_VOLUME_MIN - retVal; + return retVal; } /* - * Converts the Alsa mixer volume (0 - 100) to TSC2101 + * Converts the Alsa mixer volume (0 - 100) to TSC2101 * Digital Gain Control (DGC) volume. Alsa mixer volume 0 * is converted to value meaning the volume reduction of -38.5 db * and Alsa mixer volume 100 is converted to value meaning the * reduction of 0 db. */ -int set_mixer_volume_as_dac_gain_control_volume(int mixerVolL, int mixerVolR) +int set_mixer_volume_as_dac_gain_control_volume(int mixerVolL, int mixerVolR) { u16 val; int retVal; int volL; int volR; - - if ((mixerVolL < 0) || + + if ((mixerVolL < 0) || (mixerVolL > 100) || (mixerVolR < 0) || (mixerVolR > 100)) { - printk(KERN_ERR "Trying a bad mixer volume as dac gain control volume value, left (%d), right (%d)!\n", mixerVolL, mixerVolR); + printk(KERN_ERR "Trying a bad mixer volume as dac gain control" + " volume value, left (%d), right (%d)!\n", mixerVolL, + mixerVolR); return -EPERM; } - M_DPRINTK("mixer volume left = %d, right = %d\n", mixerVolL, mixerVolR); + M_DPRINTK("mixer volume left = %d, right = %d\n", mixerVolL, mixerVolR); volL = get_mixer_volume_as_dac_gain_control_volume(mixerVolL); volR = get_mixer_volume_as_dac_gain_control_volume(mixerVolR); - + val = omap_tsc2101_audio_read(TSC2101_DAC_GAIN_CTRL); /* keep the old mute bit settings */ - val &= ~(DGC_DALVL(OUTPUT_VOLUME_MIN) | DGC_DARVL(OUTPUT_VOLUME_MIN)); + val &= ~(DGC_DALVL(OUTPUT_VOLUME_MIN) | + DGC_DARVL(OUTPUT_VOLUME_MIN)); val |= DGC_DALVL(volL) | DGC_DARVL(volR); retVal = 2; - if (retVal) { + if (retVal) omap_tsc2101_audio_write(TSC2101_DAC_GAIN_CTRL, val); - } - M_DPRINTK("to registry: left = %d, right = %d, total = %d\n", DGC_DALVL_EXTRACT(val), DGC_DARVL_EXTRACT(val), val); + + M_DPRINTK("to registry: left = %d, right = %d, total = %d\n", + DGC_DALVL_EXTRACT(val), DGC_DARVL_EXTRACT(val), val); return retVal; } -/** +/* * If unmuteLeft/unmuteRight == 0 --> mute * If unmuteLeft/unmuteRight == 1 --> unmute */ @@ -179,15 +194,16 @@ int dac_gain_control_unmute(int unmuteLeft, int unmuteRight) count = 0; val = omap_tsc2101_audio_read(TSC2101_DAC_GAIN_CTRL); - /* in alsa mixer 1 --> on, 0 == off. In tsc2101 registry 1 --> off, 0 --> on - * so if values are same, it's time to change the registry value. + /* + * in alsa mixer 1 --> on, 0 == off. In tsc2101 registry 1 --> off, + * 0 --> on so if values are same, it's time to change the registry + * value. */ if (unmuteLeft != IS_UNMUTED(15, val)) { if (unmuteLeft == 0) { /* mute --> turn bit on */ val = val | DGC_DALMU; - } - else { + } else { /* unmute --> turn bit off */ val = val & ~DGC_DALMU; } @@ -197,69 +213,71 @@ int dac_gain_control_unmute(int unmuteLeft, int unmuteRight) if (unmuteRight == 0) { /* mute --> turn bit on */ val = val | DGC_DARMU; - } - else { + } else { /* unmute --> turn bit off */ val = val & ~DGC_DARMU; - } + } count++; } /* R */ if (count) { omap_tsc2101_audio_write(TSC2101_DAC_GAIN_CTRL, val); - M_DPRINTK("changed value, is_unmuted left = %d, right = %d\n", + M_DPRINTK("changed value, is_unmuted left = %d, right = %d\n", IS_UNMUTED(15, val), IS_UNMUTED(7, val)); } - return count; + return count; } -/** +/* * unmute: 0 --> mute, 1 --> unmute * page2RegIndx: Registry index in tsc2101 page2. - * muteBitIndx: Index number for the bit in registry that indicates whether muted or unmuted. + * muteBitIndx: Index number for the bit in registry that indicates whether + * muted or unmuted. */ int adc_pga_unmute_control(int unmute, int page2regIndx, int muteBitIndx) { int count; u16 val; - + count = 0; val = omap_tsc2101_audio_read(page2regIndx); - /* in alsa mixer 1 --> on, 0 == off. In tsc2101 registry 1 --> off, 0 --> on - * so if the values are same, it's time to change the registry value... + /* + * in alsa mixer 1 --> on, 0 == off. In tsc2101 registry 1 --> off, + * 0 --> on so if the values are same, it's time to change the + * registry value... */ if (unmute != IS_UNMUTED(muteBitIndx, val)) { if (unmute == 0) { /* mute --> turn bit on */ val = val | TSC2101_BIT(muteBitIndx); - } - else { + } else { /* unmute --> turn bit off */ val = val & ~TSC2101_BIT(muteBitIndx); } - M_DPRINTK("changed value, is_unmuted = %d\n", IS_UNMUTED(muteBitIndx, val)); + M_DPRINTK("changed value, is_unmuted = %d\n", + IS_UNMUTED(muteBitIndx, val)); count++; } - if (count) { + if (count) omap_tsc2101_audio_write(page2regIndx, val); - } + return count; } /* - * Converts the DGC registry value read from the TSC2101 registry to + * Converts the DGC registry value read from the TSC2101 registry to * Alsa mixer volume format (0 - 100). */ -int get_dac_gain_control_volume_as_mixer_volume(u16 vol) +int get_dac_gain_control_volume_as_mixer_volume(u16 vol) { - u16 retVal; + u16 retVal; retVal = OUTPUT_VOLUME_MIN - vol; retVal = ((retVal - OUTPUT_VOLUME_MAX) * 100) / OUTPUT_VOLUME_RANGE; /* fix scaling error */ - if ((retVal > 0) && (retVal < 100)) { + if ((retVal > 0) && (retVal < 100)) retVal++; - } + return retVal; } @@ -267,10 +285,10 @@ int get_dac_gain_control_volume_as_mixer_volume(u16 vol) * Converts the headset gain control volume (0 - 63.5 db) * to Alsa mixer volume (0 - 100) */ -int get_headset_gain_control_volume_as_mixer_volume(u16 registerVal) +int get_headset_gain_control_volume_as_mixer_volume(u16 registerVal) { u16 retVal; - + retVal = ((registerVal * 100) / INPUT_VOLUME_RANGE); return retVal; } @@ -279,71 +297,78 @@ int get_headset_gain_control_volume_as_mixer_volume(u16 registerVal) * Converts the handset gain control volume (0 - 63.5 db) * to Alsa mixer volume (0 - 100) */ -int get_handset_gain_control_volume_as_mixer_volume(u16 registerVal) +int get_handset_gain_control_volume_as_mixer_volume(u16 registerVal) { return get_headset_gain_control_volume_as_mixer_volume(registerVal); } /* - * Converts the Alsa mixer volume (0 - 100) to + * Converts the Alsa mixer volume (0 - 100) to * headset gain control volume (0 - 63.5 db) */ -int get_mixer_volume_as_headset_gain_control_volume(u16 mixerVal) +int get_mixer_volume_as_headset_gain_control_volume(u16 mixerVal) { u16 retVal; - - retVal = ((mixerVal * INPUT_VOLUME_RANGE) / 100) + INPUT_VOLUME_MIN; + + retVal = ((mixerVal * INPUT_VOLUME_RANGE) / 100) + INPUT_VOLUME_MIN; return retVal; } /* * Writes Alsa mixer volume (0 - 100) to TSC2101 headset volume registry in * a TSC2101 format. (0 - 63.5 db) - * In TSC2101 OSS driver this functionality was controlled with "SET_LINE" parameter. + * In TSC2101 OSS driver this functionality was controlled with "SET_LINE" + * parameter. */ -int set_mixer_volume_as_headset_gain_control_volume(int mixerVol) +int set_mixer_volume_as_headset_gain_control_volume(int mixerVol) { int volume; int retVal; u16 val; if (mixerVol < 0 || mixerVol > 100) { - M_DPRINTK("Trying a bad headset mixer volume value(%d)!\n", mixerVol); + M_DPRINTK("Trying a bad headset mixer volume value(%d)!\n", + mixerVol); return -EPERM; } M_DPRINTK("mixer volume = %d\n", mixerVol); - /* Convert 0 -> 100 volume to 0x0(min) -> 0x7D(max) volume range */ - /* NOTE: 0 is minimum volume and not mute */ - volume = get_mixer_volume_as_headset_gain_control_volume(mixerVol); + /* + * Convert 0 -> 100 volume to 0x0(min) -> 0x7D(max) volume range + * NOTE: 0 is minimum volume and not mute + */ + volume = get_mixer_volume_as_headset_gain_control_volume(mixerVol); val = omap_tsc2101_audio_read(TSC2101_HEADSET_GAIN_CTRL); /* preserve the old mute settings */ val &= ~(HGC_ADPGA_HED(INPUT_VOLUME_MAX)); val |= HGC_ADPGA_HED(volume); - omap_tsc2101_audio_write(TSC2101_HEADSET_GAIN_CTRL, val); + omap_tsc2101_audio_write(TSC2101_HEADSET_GAIN_CTRL, val); retVal = 1; - - M_DPRINTK("to registry = %d\n", val); + + M_DPRINTK("to registry = %d\n", val); return retVal; } /* * Writes Alsa mixer volume (0 - 100) to TSC2101 handset volume registry in * a TSC2101 format. (0 - 63.5 db) - * In TSC2101 OSS driver this functionality was controlled with "SET_MIC" parameter. + * In TSC2101 OSS driver this functionality was controlled with + * "SET_MIC" parameter. */ -int set_mixer_volume_as_handset_gain_control_volume(int mixerVol) +int set_mixer_volume_as_handset_gain_control_volume(int mixerVol) { int volume; int retVal; - u16 val; + u16 val; if (mixerVol < 0 || mixerVol > 100) { - M_DPRINTK("Trying a bad mic mixer volume value(%d)!\n", mixerVol); + M_DPRINTK("Trying a bad mic mixer volume value(%d)!\n", + mixerVol); return -EPERM; } M_DPRINTK("mixer volume = %d\n", mixerVol); - /* Convert 0 -> 100 volume to 0x0(min) -> 0x7D(max) volume range - * NOTE: 0 is minimum volume and not mute + /* + * Convert 0 -> 100 volume to 0x0(min) -> 0x7D(max) volume range + * NOTE: 0 is minimum volume and not mute */ volume = get_mixer_volume_as_headset_gain_control_volume(mixerVol); val = omap_tsc2101_audio_read(TSC2101_HANDSET_GAIN_CTRL); @@ -352,8 +377,8 @@ int set_mixer_volume_as_handset_gain_control_volume(int mixerVol) val |= HNGC_ADPGA_HND(volume); omap_tsc2101_audio_write(TSC2101_HANDSET_GAIN_CTRL, val); retVal = 1; - - M_DPRINTK("to registry = %d\n", val); + + M_DPRINTK("to registry = %d\n", val); return retVal; } @@ -361,27 +386,31 @@ void set_loudspeaker_to_playback_target(void) { /* power down SPK1, SPK2 and loudspeaker */ omap_tsc2101_audio_write(TSC2101_CODEC_POWER_CTRL, - CPC_SP1PWDN | CPC_SP2PWDN | CPC_LDAPWDF); - /* ADC, DAC, Analog Sidetone, cellphone, buzzer softstepping enabled + CPC_SP1PWDN | CPC_SP2PWDN | CPC_LDAPWDF); + /* + * ADC, DAC, Analog Sidetone, cellphone, buzzer softstepping enabled * 1dB AGC hysteresis * MICes bias 2V */ omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_4, AC4_MB_HED(0)); - /* DAC left and right routed to SPK1/SPK2 + /* + * DAC left and right routed to SPK1/SPK2 * SPK1/SPK2 unmuted * Keyclicks routed to SPK1/SPK2 */ - omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_5, + omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_5, AC5_DIFFIN | AC5_DAC2SPK1(3) | AC5_AST2SPK1 | AC5_KCL2SPK1 | AC5_DAC2SPK2(3) | AC5_AST2SPK2 | AC5_KCL2SPK2); - - /* routing selected to SPK1 goes also to OUT8P/OUT8N. (loudspeaker) + + /* + * routing selected to SPK1 goes also to OUT8P/OUT8N. (loudspeaker) * analog sidetone routed to loudspeaker * buzzer pga routed to loudspeaker * keyclick routing to loudspeaker * cellphone input routed to loudspeaker - * mic selection (control register 04h/page2) routed to cell phone output (CP_OUT) + * mic selection (control register 04h/page2) routed to cell phone + * output (CP_OUT) * routing selected for SPK1 goes also to cellphone output (CP_OUT) * OUT8P/OUT8N (loudspeakers) unmuted (0 = unmuted) * Cellphone output is not muted (0 = unmuted) @@ -399,19 +428,23 @@ void set_headphone_to_playback_target(void) /* power down SPK1, SPK2 and loudspeaker */ omap_tsc2101_audio_write(TSC2101_CODEC_POWER_CTRL, CPC_SP1PWDN | CPC_SP2PWDN | CPC_LDAPWDF); - /* ADC, DAC, Analog Sidetone, cellphone, buzzer softstepping enabled */ - /* 1dB AGC hysteresis */ - /* MICes bias 2V */ + /* + * ADC, DAC, Analog Sidetone, cellphone, buzzer softstepping enabled + * 1dB AGC hysteresis + * MICes bias 2V + */ omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_4, AC4_MB_HED(0)); - - /* DAC left and right routed to SPK1/SPK2 + + /* + * DAC left and right routed to SPK1/SPK2 * SPK1/SPK2 unmuted - * Keyclicks routed to SPK1/SPK2 */ + * Keyclicks routed to SPK1/SPK2 + */ omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_5, AC5_DAC2SPK1(3) | AC5_AST2SPK1 | AC5_KCL2SPK1 | AC5_DAC2SPK2(3) | AC5_AST2SPK2 | AC5_KCL2SPK2 | AC5_HDSCPTC); - + /* OUT8P/OUT8N muted, CPOUT muted */ omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_6, AC6_MUTLSPK | AC6_MUTSPK2 | AC6_LDSCPTC | @@ -421,45 +454,47 @@ void set_headphone_to_playback_target(void) void set_telephone_to_playback_target(void) { - /* + /* * 0110 1101 0101 1100 - * power down MICBIAS_HED, Analog sidetone, SPK2, DAC, + * power down MICBIAS_HED, Analog sidetone, SPK2, DAC, * Driver virtual ground, loudspeaker. Values D2-d5 are flags. - */ + */ omap_tsc2101_audio_write(TSC2101_CODEC_POWER_CTRL, CPC_MBIAS_HED | CPC_ASTPWD | CPC_SP2PWDN | CPC_DAPWDN | CPC_VGPWDN | CPC_LSPWDN); - - /* + + /* * 0010 1010 0100 0000 * ADC, DAC, Analog Sidetone, cellphone, buzzer softstepping enabled * 1dB AGC hysteresis * MICes bias 2V */ omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_4, - AC4_MB_HND | AC4_MB_HED(0) | AC4_AGCHYS(1) | + AC4_MB_HND | AC4_MB_HED(0) | AC4_AGCHYS(1) | AC4_BISTPD | AC4_ASSTPD | AC4_DASTPD); - printk("set_telephone_to_playback_target(), TSC2101_AUDIO_CTRL_4 = %d\n", omap_tsc2101_audio_read(TSC2101_AUDIO_CTRL_4)); - - /* + printk(KERN_INFO "set_telephone_to_playback_target(), " + "TSC2101_AUDIO_CTRL_4 = %d\n", + omap_tsc2101_audio_read(TSC2101_AUDIO_CTRL_4)); + + /* * 1110 0010 0000 0010 * DAC left and right routed to SPK1/SPK2 * SPK1/SPK2 unmuted * keyclicks routed to SPK1/SPK2 - */ + */ omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_5, - AC5_DIFFIN | AC5_DAC2SPK1(3) | - AC5_CPI2SPK1 | AC5_MUTSPK2); - + AC5_DIFFIN | AC5_DAC2SPK1(3) | + AC5_CPI2SPK1 | AC5_MUTSPK2); + omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_6, - AC6_MIC2CPO | AC6_MUTLSPK | + AC6_MIC2CPO | AC6_MUTLSPK | AC6_LDSCPTC | AC6_VGNDSCPTC | AC6_CAPINTF); current_playback_target = PLAYBACK_TARGET_CELLPHONE; } /* * 1100 0101 1101 0000 - * + * * #define MPC_ASTMU TSC2101_BIT(15) * #define MPC_ASTG(ARG) (((ARG) & 0x7F) << 8) * #define MPC_MICSEL(ARG) (((ARG) & 0x07) << 5) @@ -470,14 +505,14 @@ void set_telephone_to_playback_target(void) static void set_telephone_to_record_source(void) { u16 val; - - /* - * D0 = 0: + + /* + * D0 = 0: * --> AGC is off for handset input. * --> ADC PGA is controlled by the ADMUT_HDN + ADPGA_HND * (D15, D14-D8) - * D4 - D1 = 0000 - * --> AGC time constant for handset input, + * D4 - D1 = 0000 + * --> AGC time constant for handset input, * attack time = 8 mc, decay time = 100 ms * D7 - D5 = 000 * --> AGC Target gain for handset input = -5.5 db @@ -486,33 +521,36 @@ static void set_telephone_to_record_source(void) * D15 = 0 * --> Handset input ON (unmuted) */ - val = 0x3c00; // 0011 1100 0000 0000 = 60 = 30 + val = 0x3c00; /* 0011 1100 0000 0000 = 60 = 30 */ omap_tsc2101_audio_write(TSC2101_HANDSET_GAIN_CTRL, val); - + /* * D0 = 0 * --> AGC is off for headset/Aux input - * --> ADC headset/Aux PGA is contoller by ADMUT_HED + ADPGA_HED + * --> ADC headset/Aux PGA is contoller by + * ADMUT_HED + ADPGA_HED * (D15, D14-D8) - * D4 - D1 = 0000 + * D4 - D1 = 0000 * --> Agc constant for headset/Aux input, - * attack time = 8 mc, decay time = 100 ms + * attack time = 8 mc, decay time = 100 ms * D7 - D5 = 000 * --> AGC target gain for headset input = -5.5 db * D14 - D8 = 000 0000 * --> Adc headset/AUX pga settings = 0 db * D15 = 1 * --> Headset/AUX input muted - * + * * Mute headset aux input */ - val = 0x8000; // 1000 0000 0000 0000 + val = 0x8000; /* 1000 0000 0000 0000 */ omap_tsc2101_audio_write(TSC2101_HEADSET_GAIN_CTRL, val); set_record_source(REC_SRC_MICIN_HND_AND_AUX1); - // hacks start - /* D0 = flag, Headset/Aux or handset PGA flag - * --> & with 1 (= 1 -->gain applied == pga register settings) + /* + * hacks start + * D0 = flag, Headset/Aux or handset PGA flag + * --> & with 1 (= 1 -->gain applied == pga + * register settings) * D1 = 0, DAC channel PGA soft stepping control * --> 0.5 db change every WCLK * D2 = flag, DAC right channel PGA flag @@ -521,8 +559,8 @@ static void set_telephone_to_record_source(void) * -- > & with 1 * D7 - D4 = 0001, keyclick length * --> 4 periods key clicks - * D10 - D8 = 100, keyclick frequenzy - * --> 1 kHz, + * D10 - D8 = 100, keyclick frequency + * --> 1 kHz, * D11 = 0, Headset/Aux or handset soft stepping control * --> 0,5 db change every WCLK or ADWS * D14 -D12 = 100, Keyclick applitude control @@ -531,7 +569,7 @@ static void set_telephone_to_record_source(void) */ val = omap_tsc2101_audio_read(TSC2101_AUDIO_CTRL_2); val = val & 0x441d; - val = val | 0x4410; // D14, D10, D4 bits == 1 + val = val | 0x4410; /* D14, D10, D4 bits == 1 */ omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_2, val); /* @@ -543,24 +581,28 @@ static void set_telephone_to_record_source(void) * --> MICBIAS_HND = 2.0 v * D8 - D7 = 00 * --> MICBIAS_HED = 3.3 v - * D10 - D9 = 01, + * D10 - D9 = 01, * --> Mic AGC hysteric selection = 2 db - * D11 = 1, + * D11 = 1, * --> Disable buzzer PGA soft stepping * D12 = 0, * --> Enable CELL phone PGA soft stepping control * D13 = 1 - * --> Disable analog sidetone soft stepping control + * --> Disable analog sidetone soft + * stepping control * D14 = 0 * --> Enable DAC PGA soft stepping control * D15 = 0, - * --> Enable headset/Aux or Handset soft stepping control + * --> Enable headset/Aux or Handset soft + * stepping control */ val = omap_tsc2101_audio_read(TSC2101_AUDIO_CTRL_4); - val = val & 0x2a42; // 0010 1010 0100 0010 - val = val | 0x2a40; // bits D13, D11, D9, D6 == 1 + val = val & 0x2a42; /* 0010 1010 0100 0010 */ + val = val | 0x2a40; /* bits D13, D11, D9, D6 == 1 */ omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_4, val); - printk("set_telephone_to_record_source(), TSC2101_AUDIO_CTRL_4 = %d\n", omap_tsc2101_audio_read(TSC2101_AUDIO_CTRL_4)); + printk(KERN_INFO "set_telephone_to_record_source(), " + "TSC2101_AUDIO_CTRL_4 = %d\n", + omap_tsc2101_audio_read(TSC2101_AUDIO_CTRL_4)); /* * D0 = 0 * --> reserved, write always = 0 @@ -579,10 +621,12 @@ static void set_telephone_to_record_source(void) */ val = omap_tsc2101_audio_read(TSC2101_BUZZER_GAIN_CTRL); val = val & 0x5dfe; - val = val | 0x5dfe; // bits, D14, D12, D11, D10, D8, D6, D5,D4,D3,D2 + /* bits, D14, D12, D11, D10, D8, D6, D5,D4,D3,D2 */ + val = val | 0x5dfe; omap_tsc2101_audio_write(TSC2101_BUZZER_GAIN_CTRL, val); - - /* D6 - D0 = 000 1001 + + /* + * D6 - D0 = 000 1001 * --> -4.5 db for DAC right channel volume control * D7 = 1 * --> DAC right channel muted @@ -591,12 +635,13 @@ static void set_telephone_to_record_source(void) * D15 = 1 * --> DAC left channel muted */ - //val = omap_tsc2101_audio_read(TSC2101_DAC_GAIN_CTRL); + /* val = omap_tsc2101_audio_read(TSC2101_DAC_GAIN_CTRL); */ val = 0x8989; - omap_tsc2101_audio_write(TSC2101_DAC_GAIN_CTRL, val); - - /* 0000 0000 0100 0000 - * + omap_tsc2101_audio_write(TSC2101_DAC_GAIN_CTRL, val); + + /* + * 0000 0000 0100 0000 + * * D1 - D0 = 0 * --> GPIO 1 pin output is three stated * D2 = 0 @@ -610,18 +655,18 @@ static void set_telephone_to_record_source(void) * --> 8 ms clitch detection * D8 = reserved, write only 0 * D10 -D9 = 00 - * --> 16 ms de bouncing programmatitily + * --> 16 ms de-bouncing * for glitch detection during headset detection * D11 = flag for button press * D12 = flag for headset detection * D14-D13 = 00 - * --> type of headset detected = 00 == no stereo headset deected + * --> type of headset detected = 00 == no stereo + * headset deected * D15 = 0 * --> Disable headset detection - * - * */ + */ val = 0x40; - omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_7, val); + omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_7, val); } /* @@ -637,17 +682,17 @@ u16 get_headset_detected(void) u16 curDetected; u16 curType; u16 curVal; - + curType = 0; /* not detected */ curVal = omap_tsc2101_audio_read(TSC2101_AUDIO_CTRL_7); curDetected = curVal & AC7_HDDETFL; if (curDetected) { - printk("headset detected, checking type from %d \n", curVal); + printk(KERN_INFO "headset detected, checking type from %d \n", + curVal); curType = ((curVal & 0x6000) >> 13); - printk("headset type detected = %d \n", curType); - } - else { - printk("headset not detected\n"); + printk(KERN_INFO "headset type detected = %d \n", curType); + } else { + printk(KERN_INFO "headset not detected\n"); } return curType; } @@ -657,40 +702,46 @@ void init_playback_targets(void) u16 val; set_loudspeaker_to_playback_target(); - /* Left line input volume control + /* + * Left line input volume control * = SET_LINE in the OSS driver */ set_mixer_volume_as_headset_gain_control_volume(DEFAULT_INPUT_VOLUME); - /* Set headset to be controllable by handset mixer + /* + * Set headset to be controllable by handset mixer * AGC enable for handset input * Handset input not muted */ val = omap_tsc2101_audio_read(TSC2101_HANDSET_GAIN_CTRL); - val = val | HNGC_AGCEN_HND; + val = val | HNGC_AGCEN_HND; val = val & ~HNGC_ADMUT_HND; - omap_tsc2101_audio_write(TSC2101_HANDSET_GAIN_CTRL, val); - - /* mic input volume control - * SET_MIC in the OSS driver + omap_tsc2101_audio_write(TSC2101_HANDSET_GAIN_CTRL, val); + + /* + * mic input volume control + * SET_MIC in the OSS driver */ set_mixer_volume_as_handset_gain_control_volume(DEFAULT_INPUT_VOLUME); - /* Left/Right headphone channel volume control + /* + * Left/Right headphone channel volume control * Zero-cross detect on */ - set_mixer_volume_as_dac_gain_control_volume(DEFAULT_OUTPUT_VOLUME, DEFAULT_OUTPUT_VOLUME); + set_mixer_volume_as_dac_gain_control_volume(DEFAULT_OUTPUT_VOLUME, + DEFAULT_OUTPUT_VOLUME); /* unmute */ dac_gain_control_unmute(1, 1); } /* - * Initializes tsc2101 recourd source (to line) and playback target (to loudspeaker) + * Initializes tsc2101 recourd source (to line) and playback target + * (to loudspeaker) */ void snd_omap_init_mixer(void) -{ +{ FN_IN; - + /* Headset/Hook switch detect enabled */ omap_tsc2101_audio_write(TSC2101_AUDIO_CTRL_7, AC7_DETECT); @@ -706,17 +757,17 @@ static int __pcm_playback_target_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static char *texts[PLAYBACK_TARGET_COUNT] = { - "Loudspeaker", "Headphone", "Cellphone" + "Loudspeaker", "Headphone", "Cellphone" }; uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; uinfo->value.enumerated.items = PLAYBACK_TARGET_COUNT; - if (uinfo->value.enumerated.item > PLAYBACK_TARGET_COUNT - 1) { - uinfo->value.enumerated.item = PLAYBACK_TARGET_COUNT - 1; - } + if (uinfo->value.enumerated.item > PLAYBACK_TARGET_COUNT - 1) + uinfo->value.enumerated.item = PLAYBACK_TARGET_COUNT - 1; + strcpy(uinfo->value.enumerated.name, - texts[uinfo->value.enumerated.item]); + texts[uinfo->value.enumerated.item]); return 0; } @@ -732,28 +783,26 @@ static int __pcm_playback_target_put(struct snd_kcontrol *kcontrol, { int retVal; int curVal; - + retVal = 0; curVal = ucontrol->value.integer.value[0]; if ((curVal >= 0) && (curVal < PLAYBACK_TARGET_COUNT) && - (curVal != current_playback_target)) { + (curVal != current_playback_target)) { if (curVal == PLAYBACK_TARGET_LOUDSPEAKER) { set_record_source(REC_SRC_SINGLE_ENDED_MICIN_HED); set_loudspeaker_to_playback_target(); - } - else if (curVal == PLAYBACK_TARGET_HEADPHONE) { + } else if (curVal == PLAYBACK_TARGET_HEADPHONE) { set_record_source(REC_SRC_SINGLE_ENDED_MICIN_HND); set_headphone_to_playback_target(); - } - else if (curVal == PLAYBACK_TARGET_CELLPHONE) { + } else if (curVal == PLAYBACK_TARGET_CELLPHONE) { set_telephone_to_record_source(); set_telephone_to_playback_target(); } retVal = 1; } return retVal; -} +} static int __pcm_playback_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) @@ -766,16 +815,16 @@ static int __pcm_playback_volume_info(struct snd_kcontrol *kcontrol, } /* - * Alsa mixer interface function for getting the volume read from the DGC in a + * Alsa mixer interface function for getting the volume read from the DGC in a * 0 -100 alsa mixer format. */ static int __pcm_playback_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u16 volL; - u16 volR; + u16 volR; u16 val; - + val = omap_tsc2101_audio_read(TSC2101_DAC_GAIN_CTRL); M_DPRINTK("registry value = %d!\n", val); volL = DGC_DALVL_EXTRACT(val); @@ -786,19 +835,22 @@ static int __pcm_playback_volume_get(struct snd_kcontrol *kcontrol, volL = get_dac_gain_control_volume_as_mixer_volume(volL); volR = get_dac_gain_control_volume_as_mixer_volume(volR); - + ucontrol->value.integer.value[0] = volL; /* L */ ucontrol->value.integer.value[1] = volR; /* R */ - - M_DPRINTK("mixer volume left = %ld, right = %ld\n", ucontrol->value.integer.value[0], ucontrol->value.integer.value[1]); + + M_DPRINTK("mixer volume left = %ld, right = %ld\n", + ucontrol->value.integer.value[0], + ucontrol->value.integer.value[1]); return 0; } static int __pcm_playback_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - return set_mixer_volume_as_dac_gain_control_volume(ucontrol->value.integer.value[0], - ucontrol->value.integer.value[1]); + return set_mixer_volume_as_dac_gain_control_volume( + ucontrol->value.integer.value[0], + ucontrol->value.integer.value[1]); } static int __pcm_playback_switch_info(struct snd_kcontrol *kcontrol, @@ -811,7 +863,7 @@ static int __pcm_playback_switch_info(struct snd_kcontrol *kcontrol, return 0; } -/* +/* * When DGC_DALMU (bit 15) is 1, the left channel is muted. * When DGC_DALMU is 0, left channel is not muted. * Same logic apply also for the right channel. @@ -820,16 +872,16 @@ static int __pcm_playback_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u16 val = omap_tsc2101_audio_read(TSC2101_DAC_GAIN_CTRL); - - ucontrol->value.integer.value[0] = IS_UNMUTED(15, val); // left - ucontrol->value.integer.value[1] = IS_UNMUTED(7, val); // right + + ucontrol->value.integer.value[0] = IS_UNMUTED(15, val); /* left */ + ucontrol->value.integer.value[1] = IS_UNMUTED(7, val); /* right */ return 0; } static int __pcm_playback_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - return dac_gain_control_unmute(ucontrol->value.integer.value[0], + return dac_gain_control_unmute(ucontrol->value.integer.value[0], ucontrol->value.integer.value[1]); } @@ -848,7 +900,7 @@ static int __headset_playback_volume_get(struct snd_kcontrol *kcontrol, { u16 val; u16 vol; - + val = omap_tsc2101_audio_read(TSC2101_HEADSET_GAIN_CTRL); M_DPRINTK("registry value = %d\n", val); vol = HGC_ADPGA_HED_EXTRACT(val); @@ -856,15 +908,17 @@ static int __headset_playback_volume_get(struct snd_kcontrol *kcontrol, vol = get_headset_gain_control_volume_as_mixer_volume(vol); ucontrol->value.integer.value[0] = vol; - - M_DPRINTK("mixer volume returned = %ld\n", ucontrol->value.integer.value[0]); + + M_DPRINTK("mixer volume returned = %ld\n", + ucontrol->value.integer.value[0]); return 0; } static int __headset_playback_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - return set_mixer_volume_as_headset_gain_control_volume(ucontrol->value.integer.value[0]); + return set_mixer_volume_as_headset_gain_control_volume( + ucontrol->value.integer.value[0]); } static int __headset_playback_switch_info(struct snd_kcontrol *kcontrol, @@ -877,7 +931,8 @@ static int __headset_playback_switch_info(struct snd_kcontrol *kcontrol, return 0; } -/* When HGC_ADMUT_HED (bit 15) is 1, the headset is muted. +/* + * When HGC_ADMUT_HED (bit 15) is 1, the headset is muted. * When HGC_ADMUT_HED is 0, headset is not muted. */ static int __headset_playback_switch_get(struct snd_kcontrol *kcontrol, @@ -891,7 +946,7 @@ static int __headset_playback_switch_get(struct snd_kcontrol *kcontrol, static int __headset_playback_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - // mute/unmute headset + /* mute/unmute headset */ return adc_pga_unmute_control(ucontrol->value.integer.value[0], TSC2101_HEADSET_GAIN_CTRL, 15); @@ -912,22 +967,24 @@ static int __handset_playback_volume_get(struct snd_kcontrol *kcontrol, { u16 val; u16 vol; - + val = omap_tsc2101_audio_read(TSC2101_HANDSET_GAIN_CTRL); M_DPRINTK("registry value = %d\n", val); vol = HNGC_ADPGA_HND_EXTRACT(val); vol = vol & ~HNGC_ADMUT_HND; vol = get_handset_gain_control_volume_as_mixer_volume(vol); ucontrol->value.integer.value[0] = vol; - - M_DPRINTK("mixer volume returned = %ld\n", ucontrol->value.integer.value[0]); + + M_DPRINTK("mixer volume returned = %ld\n", + ucontrol->value.integer.value[0]); return 0; } static int __handset_playback_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - return set_mixer_volume_as_handset_gain_control_volume(ucontrol->value.integer.value[0]); + return set_mixer_volume_as_handset_gain_control_volume( + ucontrol->value.integer.value[0]); } static int __handset_playback_switch_info(struct snd_kcontrol *kcontrol, @@ -940,7 +997,8 @@ static int __handset_playback_switch_info(struct snd_kcontrol *kcontrol, return 0; } -/* When HNGC_ADMUT_HND (bit 15) is 1, the handset is muted. +/* + * When HNGC_ADMUT_HND (bit 15) is 1, the handset is muted. * When HNGC_ADMUT_HND is 0, handset is not muted. */ static int __handset_playback_switch_get(struct snd_kcontrol *kcontrol, @@ -954,7 +1012,7 @@ static int __handset_playback_switch_get(struct snd_kcontrol *kcontrol, static int __handset_playback_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - // handset mute/unmute + /* handset mute/unmute */ return adc_pga_unmute_control(ucontrol->value.integer.value[0], TSC2101_HANDSET_GAIN_CTRL, 15); @@ -970,7 +1028,8 @@ static int __cellphone_input_switch_info(struct snd_kcontrol *kcontrol, return 0; } -/* When BGC_MUT_CP (bit 15) = 1, power down cellphone input pga. +/* + * When BGC_MUT_CP (bit 15) = 1, power down cellphone input pga. * When BGC_MUT_CP = 0, power up cellphone input pga. */ static int __cellphone_input_switch_get(struct snd_kcontrol *kcontrol, @@ -986,7 +1045,7 @@ static int __cellphone_input_switch_put(struct snd_kcontrol *kcontrol, { return adc_pga_unmute_control(ucontrol->value.integer.value[0], TSC2101_BUZZER_GAIN_CTRL, - 15); + 15); } static int __buzzer_input_switch_info(struct snd_kcontrol *kcontrol, @@ -999,7 +1058,8 @@ static int __buzzer_input_switch_info(struct snd_kcontrol *kcontrol, return 0; } -/* When BGC_MUT_BU (bit 6) = 1, power down cellphone input pga. +/* + * When BGC_MUT_BU (bit 6) = 1, power down cellphone input pga. * When BGC_MUT_BU = 0, power up cellphone input pga. */ static int __buzzer_input_switch_get(struct snd_kcontrol *kcontrol, @@ -1015,82 +1075,82 @@ static int __buzzer_input_switch_put(struct snd_kcontrol *kcontrol, { return adc_pga_unmute_control(ucontrol->value.integer.value[0], TSC2101_BUZZER_GAIN_CTRL, - 6); + 6); } static struct snd_kcontrol_new tsc2101_control[] __devinitdata = { { - .name = "Target Playback Route", - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .index = 0, - .access= SNDRV_CTL_ELEM_ACCESS_READWRITE, - .info = __pcm_playback_target_info, - .get = __pcm_playback_target_get, - .put = __pcm_playback_target_put, + .name = "Target Playback Route", + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .index = 0, + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = __pcm_playback_target_info, + .get = __pcm_playback_target_get, + .put = __pcm_playback_target_put, }, { - .name = "Master Playback Volume", - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .index = 0, - .access= SNDRV_CTL_ELEM_ACCESS_READWRITE, - .info = __pcm_playback_volume_info, - .get = __pcm_playback_volume_get, - .put = __pcm_playback_volume_put, + .name = "Master Playback Volume", + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .index = 0, + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = __pcm_playback_volume_info, + .get = __pcm_playback_volume_get, + .put = __pcm_playback_volume_put, }, { - .name = "Master Playback Switch", - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .index = 0, - .access= SNDRV_CTL_ELEM_ACCESS_READWRITE, - .info = __pcm_playback_switch_info, - .get = __pcm_playback_switch_get, - .put = __pcm_playback_switch_put, + .name = "Master Playback Switch", + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .index = 0, + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = __pcm_playback_switch_info, + .get = __pcm_playback_switch_get, + .put = __pcm_playback_switch_put, }, { - .name = "Headset Playback Volume", - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .index = 0, - .access= SNDRV_CTL_ELEM_ACCESS_READWRITE, - .info = __headset_playback_volume_info, - .get = __headset_playback_volume_get, - .put = __headset_playback_volume_put, + .name = "Headset Playback Volume", + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .index = 0, + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = __headset_playback_volume_info, + .get = __headset_playback_volume_get, + .put = __headset_playback_volume_put, }, { - .name = "Headset Playback Switch", - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .index = 0, - .access= SNDRV_CTL_ELEM_ACCESS_READWRITE, - .info = __headset_playback_switch_info, - .get = __headset_playback_switch_get, - .put = __headset_playback_switch_put, + .name = "Headset Playback Switch", + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .index = 0, + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = __headset_playback_switch_info, + .get = __headset_playback_switch_get, + .put = __headset_playback_switch_put, }, { - .name = "Handset Playback Volume", - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .index = 0, - .access= SNDRV_CTL_ELEM_ACCESS_READWRITE, - .info = __handset_playback_volume_info, - .get = __handset_playback_volume_get, - .put = __handset_playback_volume_put, + .name = "Handset Playback Volume", + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .index = 0, + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = __handset_playback_volume_info, + .get = __handset_playback_volume_get, + .put = __handset_playback_volume_put, }, { - .name = "Handset Playback Switch", - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .index = 0, - .access= SNDRV_CTL_ELEM_ACCESS_READWRITE, - .info = __handset_playback_switch_info, - .get = __handset_playback_switch_get, - .put = __handset_playback_switch_put, + .name = "Handset Playback Switch", + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .index = 0, + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = __handset_playback_switch_info, + .get = __handset_playback_switch_get, + .put = __handset_playback_switch_put, }, { - .name = "Cellphone Input Switch", - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .index = 0, - .access= SNDRV_CTL_ELEM_ACCESS_READWRITE, - .info = __cellphone_input_switch_info, - .get = __cellphone_input_switch_get, - .put = __cellphone_input_switch_put, + .name = "Cellphone Input Switch", + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .index = 0, + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = __cellphone_input_switch_info, + .get = __cellphone_input_switch_get, + .put = __cellphone_input_switch_put, }, { - .name = "Buzzer Input Switch", - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .index = 0, - .access= SNDRV_CTL_ELEM_ACCESS_READWRITE, - .info = __buzzer_input_switch_info, - .get = __buzzer_input_switch_get, - .put = __buzzer_input_switch_put, + .name = "Buzzer Input Switch", + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .index = 0, + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, + .info = __buzzer_input_switch_info, + .get = __buzzer_input_switch_get, + .put = __buzzer_input_switch_put, } }; @@ -1106,20 +1166,20 @@ void snd_omap_resume_mixer(void) } #endif -int snd_omap_mixer(struct snd_card_omap_codec *tsc2101) +int snd_omap_mixer(struct snd_card_omap_codec *tsc2101) { - int i=0; - int err=0; + int i = 0; + int err = 0; - if (!tsc2101) { + if (!tsc2101) return -EINVAL; - } - for (i=0; i < ARRAY_SIZE(tsc2101_control); i++) { - if ((err = snd_ctl_add(tsc2101->card, - snd_ctl_new1(&tsc2101_control[i], - tsc2101->card))) < 0) { + + for (i = 0; i < ARRAY_SIZE(tsc2101_control); i++) { + err = snd_ctl_add(tsc2101->card, + snd_ctl_new1(&tsc2101_control[i], + tsc2101->card)); + if (err < 0) return err; - } } return 0; } -- 1.5.5-rc3.GIT -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 13/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101-mixer.h 2008-04-18 8:00 ` [PATCH 12/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101-mixer.c Eduardo Valentin @ 2008-04-18 8:01 ` Eduardo Valentin 2008-04-18 8:01 ` [PATCH 14/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101.c Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-tsc2101-mixer.h | 29 ++++++++++++++++++----------- 1 files changed, 18 insertions(+), 11 deletions(-) diff --git a/sound/arm/omap/omap-alsa-tsc2101-mixer.h b/sound/arm/omap/omap-alsa-tsc2101-mixer.h index b110b36..c0d9b23 100644 --- a/sound/arm/omap/omap-alsa-tsc2101-mixer.h +++ b/sound/arm/omap/omap-alsa-tsc2101-mixer.h @@ -1,9 +1,9 @@ /* * sound/arm/omap/omap-alsa-tsc2101-mixer.h - * + * * Alsa Driver for TSC2101 codec for OMAP platform boards. * - * Copyright (C) 2005 Mika Laitio <lamikr@cc.jyu.fi> and + * Copyright (C) 2005 Mika Laitio <lamikr@cc.jyu.fi> and * Everett Coleman II <gcc80x86@fuzzyneural.net> * * Based on the ideas in omap-aic23.c and sa11xx-uda1341.c @@ -33,9 +33,9 @@ * History: * * 2006-03-01 Mika Laitio - Mixer for the tsc2101 driver used in omap boards. - * Can switch between headset and loudspeaker playback, + * Can switch between headset and loudspeaker playback, * mute and unmute dgc, set dgc volume. Record source switch, - * keyclick, buzzer and headset volume and handset volume control + * keyclick, buzzer and headset volume and handset volume control * are still missing. */ @@ -46,8 +46,8 @@ #include "omap-alsa-dma.h" /* tsc2101 DAC gain control volume specific */ -#define OUTPUT_VOLUME_MIN 0x7F // 1111111 = -63.5 DB -#define OUTPUT_VOLUME_MAX 0x32 // 110010 +#define OUTPUT_VOLUME_MIN 0x7F /* 1111111 = -63.5 DB */ +#define OUTPUT_VOLUME_MAX 0x32 /* 110010 */ #define OUTPUT_VOLUME_RANGE (OUTPUT_VOLUME_MIN - OUTPUT_VOLUME_MAX) /* use input vol of 75 for 0dB gain */ @@ -60,10 +60,15 @@ #define PLAYBACK_TARGET_HEADPHONE 0x01 #define PLAYBACK_TARGET_CELLPHONE 0x02 -/* following are used for register 03h Mixer PGA control bits D7-D5 for selecting record source */ +/* + * Following are used for register 03h Mixer PGA control bits D7-D5 for + * selecting record source + */ #define REC_SRC_TARGET_COUNT 0x08 -#define REC_SRC_SINGLE_ENDED_MICIN_HED 0x00 // oss code referred to MIXER_LINE -#define REC_SRC_SINGLE_ENDED_MICIN_HND 0x01 // oss code referred to MIXER_MIC +/* oss code referred to MIXER_LINE */ +#define REC_SRC_SINGLE_ENDED_MICIN_HED 0x00 +/* oss code referred to MIXER_MIC */ +#define REC_SRC_SINGLE_ENDED_MICIN_HND 0x01 #define REC_SRC_SINGLE_ENDED_AUX1 0x02 #define REC_SRC_SINGLE_ENDED_AUX2 0x03 #define REC_SRC_MICIN_HED_AND_AUX1 0x04 @@ -71,8 +76,10 @@ #define REC_SRC_MICIN_HND_AND_AUX1 0x06 #define REC_SRC_MICIN_HND_AND_AUX2 0x07 -#define DEFAULT_OUTPUT_VOLUME 90 // default output volume to dac dgc -#define DEFAULT_INPUT_VOLUME 20 // default record volume +/* default output volume to dac dgc */ +#define DEFAULT_OUTPUT_VOLUME 90 +/* default record volume */ +#define DEFAULT_INPUT_VOLUME 20 #define TSC2101_AUDIO_CODEC_REGISTERS_PAGE2 (2) -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 14/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101.c 2008-04-18 8:01 ` [PATCH 13/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101-mixer.h Eduardo Valentin @ 2008-04-18 8:01 ` Eduardo Valentin 2008-04-18 8:01 ` [PATCH 15/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101.h Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-tsc2101.c | 292 +++++++++++++++++++++++------------- 1 files changed, 190 insertions(+), 102 deletions(-) diff --git a/sound/arm/omap/omap-alsa-tsc2101.c b/sound/arm/omap/omap-alsa-tsc2101.c index 1d8adc1..8a7e770 100644 --- a/sound/arm/omap/omap-alsa-tsc2101.c +++ b/sound/arm/omap/omap-alsa-tsc2101.c @@ -1,15 +1,15 @@ /* * sound/arm/omap/omap-alsa-tsc2101.c - * - * Alsa codec Driver for TSC2101 chip for OMAP platform boards. + * + * Alsa codec Driver for TSC2101 chip for OMAP platform boards. * Code obtained from oss omap drivers * * Copyright (C) 2004 Texas Instruments, Inc. * Written by Nishanth Menon and Sriram Kannan - * + * * Copyright (C) 2006 Instituto Nokia de Tecnologia - INdT - Manaus Brazil * Alsa modularization by Daniel Petrini (d.pensator@gmail.com) - * + * * Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi> * * This program is free software; you can redistribute it and/or modify it @@ -23,31 +23,30 @@ #include <linux/platform_device.h> #include <linux/clk.h> #include <linux/spi/tsc2101.h> -#include <asm/io.h> -#include <asm/arch/mcbsp.h> - +#include <linux/io.h> #include <linux/slab.h> #ifdef CONFIG_PM #include <linux/pm.h> #endif + #include <asm/mach-types.h> #include <asm/arch/dma.h> #include <asm/arch/clock.h> - +#include <asm/arch/mcbsp.h> #include <asm/hardware/tsc2101.h> - #include <asm/arch/omap-alsa.h> + #include "omap-alsa-tsc2101.h" struct mcbsp_dev_info mcbsp_dev; -static struct clk *tsc2101_mclk = 0; +static struct clk *tsc2101_mclk; -//#define DUMP_TSC2101_AUDIO_REGISTERS +/* #define DUMP_TSC2101_AUDIO_REGISTERS */ #undef DUMP_TSC2101_AUDIO_REGISTERS /* - * Hardware capabilities + * Hardware capabilities */ /* @@ -77,7 +76,7 @@ static const struct tsc2101_samplerate_reg_info {8727, 6, 0}, /* Div 5 */ {8820, 5, 1}, - {9600, 5, 0}, + {9600, 5, 0}, /* Div 4 */ {11025, 4, 1}, {12000, 4, 0}, @@ -92,22 +91,22 @@ static const struct tsc2101_samplerate_reg_info {32000, 1, 0}, /* Div 1 */ {44100, 0, 1}, - {48000, 0, 0}, + {48000, 0, 0}, }; static struct snd_pcm_hardware tsc2101_snd_omap_alsa_playback = { - .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), + .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID, #ifdef CONFIG_MACH_OMAP_H6300 - .formats = (SNDRV_PCM_FMTBIT_S8), + .formats = SNDRV_PCM_FMTBIT_S8, #else - .formats = (SNDRV_PCM_FMTBIT_S16_LE), + .formats = SNDRV_PCM_FMTBIT_S16_LE, #endif - .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | + .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | - SNDRV_PCM_RATE_KNOT), + SNDRV_PCM_RATE_KNOT, .rate_min = 7350, .rate_max = 48000, .channels_min = 2, @@ -121,14 +120,14 @@ static struct snd_pcm_hardware tsc2101_snd_omap_alsa_playback = { }; static struct snd_pcm_hardware tsc2101_snd_omap_alsa_capture = { - .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), - .formats = (SNDRV_PCM_FMTBIT_S16_LE), - .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | + .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | - SNDRV_PCM_RATE_KNOT), + SNDRV_PCM_RATE_KNOT, .rate_min = 7350, .rate_max = 48000, .channels_min = 2, @@ -141,7 +140,7 @@ static struct snd_pcm_hardware tsc2101_snd_omap_alsa_capture = { .fifo_size = 0, }; -/* +/* * Simplified write for tsc2101 audio registers. */ inline void tsc2101_audio_write(u8 address, u16 data) @@ -150,7 +149,7 @@ inline void tsc2101_audio_write(u8 address, u16 data) address, data); } -/* +/* * Simplified read for tsc2101 audio registers. */ inline u16 tsc2101_audio_read(u8 address) @@ -160,49 +159,130 @@ inline u16 tsc2101_audio_read(u8 address) } #ifdef DUMP_TSC2101_AUDIO_REGISTERS -void dump_tsc2101_audio_reg(void) { - printk("TSC2101_AUDIO_CTRL_1 = 0x%04x\n", tsc2101_audio_read(TSC2101_AUDIO_CTRL_1)); - printk("TSC2101_HEADSET_GAIN_CTRL = 0x%04x\n", tsc2101_audio_read(TSC2101_HEADSET_GAIN_CTRL)); - printk("TSC2101_DAC_GAIN_CTRL = 0x%04x\n", tsc2101_audio_read(TSC2101_DAC_GAIN_CTRL)); - printk("TSC2101_MIXER_PGA_CTRL = 0x%04x\n", tsc2101_audio_read(TSC2101_MIXER_PGA_CTRL)); - printk("TSC2101_AUDIO_CTRL_2 = 0x%04x\n", tsc2101_audio_read(TSC2101_AUDIO_CTRL_2)); - printk("TSC2101_CODEC_POWER_CTRL = 0x%04x\n", tsc2101_audio_read(TSC2101_CODEC_POWER_CTRL)); - printk("TSC2101_AUDIO_CTRL_3 = 0x%04x\n", tsc2101_audio_read(TSC2101_AUDIO_CTRL_3)); - printk("TSC2101_LCH_BASS_BOOST_N0 = 0x%04x\n", tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_N0)); - printk("TSC2101_LCH_BASS_BOOST_N1 = 0x%04x\n", tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_N1)); - printk("TSC2101_LCH_BASS_BOOST_N2 = 0x%04x\n", tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_N2)); - printk("TSC2101_LCH_BASS_BOOST_N3 = 0x%04x\n", tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_N3)); - printk("TSC2101_LCH_BASS_BOOST_N4 = 0x%04x\n", tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_N4)); - printk("TSC2101_LCH_BASS_BOOST_N5 = 0x%04x\n", tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_N5)); - printk("TSC2101_LCH_BASS_BOOST_D1 = 0x%04x\n", tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_D1)); - printk("TSC2101_LCH_BASS_BOOST_D2 = 0x%04x\n", tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_D2)); - printk("TSC2101_LCH_BASS_BOOST_D4 = 0x%04x\n", tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_D4)); - printk("TSC2101_LCH_BASS_BOOST_D5 = 0x%04x\n", tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_D5)); - - printk("TSC2101_RCH_BASS_BOOST_N0 = 0x%04x\n", tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_N0)); - printk("TSC2101_RCH_BASS_BOOST_N1 = 0x%04x\n", tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_N1)); - printk("TSC2101_RCH_BASS_BOOST_N2 = 0x%04x\n", tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_N2)); - printk("TSC2101_RCH_BASS_BOOST_N3 = 0x%04x\n", tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_N3)); - printk("TSC2101_RCH_BASS_BOOST_N4 = 0x%04x\n", tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_N4)); - printk("TSC2101_RCH_BASS_BOOST_N5 = 0x%04x\n", tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_N5)); - printk("TSC2101_RCH_BASS_BOOST_D1 = 0x%04x\n", tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_D1)); - printk("TSC2101_RCH_BASS_BOOST_D2 = 0x%04x\n", tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_D2)); - printk("TSC2101_RCH_BASS_BOOST_D4 = 0x%04x\n", tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_D4)); - printk("TSC2101_RCH_BASS_BOOST_D5 = 0x%04x\n", tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_D5)); - - printk("TSC2101_PLL_PROG_1 = 0x%04x\n", tsc2101_audio_read(TSC2101_PLL_PROG_1)); - printk("TSC2101_PLL_PROG_1 = 0x%04x\n", tsc2101_audio_read(TSC2101_PLL_PROG_2)); - printk("TSC2101_AUDIO_CTRL_4 = 0x%04x\n", tsc2101_audio_read(TSC2101_AUDIO_CTRL_4)); - printk("TSC2101_HANDSET_GAIN_CTRL = 0x%04x\n", tsc2101_audio_read(TSC2101_HANDSET_GAIN_CTRL)); - printk("TSC2101_BUZZER_GAIN_CTRL = 0x%04x\n", tsc2101_audio_read(TSC2101_BUZZER_GAIN_CTRL)); - printk("TSC2101_AUDIO_CTRL_5 = 0x%04x\n", tsc2101_audio_read(TSC2101_AUDIO_CTRL_5)); - printk("TSC2101_AUDIO_CTRL_6 = 0x%04x\n", tsc2101_audio_read(TSC2101_AUDIO_CTRL_6)); - printk("TSC2101_AUDIO_CTRL_7 = 0x%04x\n", tsc2101_audio_read(TSC2101_AUDIO_CTRL_7)); - printk("TSC2101_GPIO_CTRL = 0x%04x\n", tsc2101_audio_read(TSC2101_GPIO_CTRL)); - printk("TSC2101_AGC_CTRL = 0x%04x\n", tsc2101_audio_read(TSC2101_AGC_CTRL)); - printk("TSC2101_POWERDOWN_STS = 0x%04x\n", tsc2101_audio_read(TSC2101_POWERDOWN_STS)); - printk("TSC2101_MIC_AGC_CONTROL = 0x%04x\n", tsc2101_audio_read(TSC2101_MIC_AGC_CONTROL)); - printk("TSC2101_CELL_AGC_CONTROL = 0x%04x\n", tsc2101_audio_read(TSC2101_CELL_AGC_CONTROL)); +void dump_tsc2101_audio_reg(void) +{ + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_AUDIO_CTRL_1 = 0x%04x\n", + tsc2101_audio_read(TSC2101_AUDIO_CTRL_1)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_HEADSET_GAIN_CTRL = 0x%04x\n", + tsc2101_audio_read(TSC2101_HEADSET_GAIN_CTRL)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_DAC_GAIN_CTRL = 0x%04x\n", + tsc2101_audio_read(TSC2101_DAC_GAIN_CTRL)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_MIXER_PGA_CTRL = 0x%04x\n", + tsc2101_audio_read(TSC2101_MIXER_PGA_CTRL)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_AUDIO_CTRL_2 = 0x%04x\n", + tsc2101_audio_read(TSC2101_AUDIO_CTRL_2)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_CODEC_POWER_CTRL = 0x%04x\n", + tsc2101_audio_read(TSC2101_CODEC_POWER_CTRL)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_AUDIO_CTRL_3 = 0x%04x\n", + tsc2101_audio_read(TSC2101_AUDIO_CTRL_3)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_LCH_BASS_BOOST_N0 = 0x%04x\n", + tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_N0)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_LCH_BASS_BOOST_N1 = 0x%04x\n", + tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_N1)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_LCH_BASS_BOOST_N2 = 0x%04x\n", + tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_N2)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_LCH_BASS_BOOST_N3 = 0x%04x\n", + tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_N3)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_LCH_BASS_BOOST_N4 = 0x%04x\n", + tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_N4)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_LCH_BASS_BOOST_N5 = 0x%04x\n", + tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_N5)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_LCH_BASS_BOOST_D1 = 0x%04x\n", + tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_D1)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_LCH_BASS_BOOST_D2 = 0x%04x\n", + tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_D2)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_LCH_BASS_BOOST_D4 = 0x%04x\n", + tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_D4)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_LCH_BASS_BOOST_D5 = 0x%04x\n", + tsc2101_audio_read(TSC2101_LCH_BASS_BOOST_D5)); + + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_RCH_BASS_BOOST_N0 = 0x%04x\n", + tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_N0)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_RCH_BASS_BOOST_N1 = 0x%04x\n", + tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_N1)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_RCH_BASS_BOOST_N2 = 0x%04x\n", + tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_N2)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_RCH_BASS_BOOST_N3 = 0x%04x\n", + tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_N3)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_RCH_BASS_BOOST_N4 = 0x%04x\n", + tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_N4)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_RCH_BASS_BOOST_N5 = 0x%04x\n", + tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_N5)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_RCH_BASS_BOOST_D1 = 0x%04x\n", + tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_D1)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_RCH_BASS_BOOST_D2 = 0x%04x\n", + tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_D2)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_RCH_BASS_BOOST_D4 = 0x%04x\n", + tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_D4)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_RCH_BASS_BOOST_D5 = 0x%04x\n", + tsc2101_audio_read(TSC2101_RCH_BASS_BOOST_D5)); + + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_PLL_PROG_1 = 0x%04x\n", + tsc2101_audio_read(TSC2101_PLL_PROG_1)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_PLL_PROG_1 = 0x%04x\n", + tsc2101_audio_read(TSC2101_PLL_PROG_2)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_AUDIO_CTRL_4 = 0x%04x\n", + tsc2101_audio_read(TSC2101_AUDIO_CTRL_4)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_HANDSET_GAIN_CTRL = 0x%04x\n", + tsc2101_audio_read(TSC2101_HANDSET_GAIN_CTRL)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_BUZZER_GAIN_CTRL = 0x%04x\n", + tsc2101_audio_read(TSC2101_BUZZER_GAIN_CTRL)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_AUDIO_CTRL_5 = 0x%04x\n", + tsc2101_audio_read(TSC2101_AUDIO_CTRL_5)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_AUDIO_CTRL_6 = 0x%04x\n", + tsc2101_audio_read(TSC2101_AUDIO_CTRL_6)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_AUDIO_CTRL_7 = 0x%04x\n", + tsc2101_audio_read(TSC2101_AUDIO_CTRL_7)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_GPIO_CTRL = 0x%04x\n", + tsc2101_audio_read(TSC2101_GPIO_CTRL)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_AGC_CTRL = 0x%04x\n", + tsc2101_audio_read(TSC2101_AGC_CTRL)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_POWERDOWN_STS = 0x%04x\n", + tsc2101_audio_read(TSC2101_POWERDOWN_STS)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_MIC_AGC_CONTROL = 0x%04x\n", + tsc2101_audio_read(TSC2101_MIC_AGC_CONTROL)); + dev_dbg(&mcbsp_dev.mcbsp_dev->dev, + "TSC2101_CELL_AGC_CONTROL = 0x%04x\n", + tsc2101_audio_read(TSC2101_CELL_AGC_CONTROL)); } #endif @@ -233,14 +313,14 @@ void tsc2101_set_samplerate(long sample_rate) if (count == NUMBER_SAMPLE_RATES_SUPPORTED) { printk(KERN_ERR "Invalid Sample Rate %d requested\n", (int) sample_rate); - return; // -EPERM; + return; } /* Set AC1 */ data = tsc2101_audio_read(TSC2101_AUDIO_CTRL_1); /* Clear prev settings */ data &= ~(AC1_DACFS(0x07) | AC1_ADCFS(0x07)); - data |= AC1_DACFS(rate_reg_info[count].divisor) | + data |= AC1_DACFS(rate_reg_info[count].divisor) | AC1_ADCFS(rate_reg_info[count].divisor); tsc2101_audio_write(TSC2101_AUDIO_CTRL_1, data); @@ -254,20 +334,25 @@ void tsc2101_set_samplerate(long sample_rate) #endif /* #ifdef TSC_MASTER */ tsc2101_audio_write(TSC2101_AUDIO_CTRL_3, data); - /* Program the PLLs. This code assumes that the 12 Mhz MCLK is in use. - * If MCLK rate is something else, these values must be changed. + /* + * Program the PLLs. This code assumes that the 12 Mhz MCLK is in use. + * If MCLK rate is something else, these values must be changed. * See the tsc2101 specification for the details. */ if (rate_reg_info[count].fs_44kHz) { /* samplerate = (44.1kHZ / x), where x is int. */ tsc2101_audio_write(TSC2101_PLL_PROG_1, PLL1_PLLSEL | - PLL1_PVAL(1) | PLL1_I_VAL(7)); /* PVAL 1; I_VAL 7 */ - tsc2101_audio_write(TSC2101_PLL_PROG_2, PLL2_D_VAL(0x1490)); /* D_VAL 5264 */ + /* PVAL 1; I_VAL 7 */ + PLL1_PVAL(1) | PLL1_I_VAL(7)); + /* D_VAL 5264 */ + tsc2101_audio_write(TSC2101_PLL_PROG_2, PLL2_D_VAL(0x1490)); } else { /* samplerate = (48.kHZ / x), where x is int. */ tsc2101_audio_write(TSC2101_PLL_PROG_1, PLL1_PLLSEL | - PLL1_PVAL(1) | PLL1_I_VAL(8)); /* PVAL 1; I_VAL 8 */ - tsc2101_audio_write(TSC2101_PLL_PROG_2, PLL2_D_VAL(0x780)); /* D_VAL 1920 */ + /* PVAL 1; I_VAL 8 */ + PLL1_PVAL(1) | PLL1_I_VAL(8)); + /* D_VAL 1920 */ + tsc2101_audio_write(TSC2101_PLL_PROG_2, PLL2_D_VAL(0x780)); } /* Set the sample rate */ @@ -295,12 +380,12 @@ void tsc2101_configure(void) /* * Omap MCBSP clock and Power Management configuration - * + * * Here we have some functions that allows clock to be enabled and - * disabled only when needed. Besides doing clock configuration - * it allows turn on/turn off audio when necessary. + * disabled only when needed. Besides doing clock configuration + * it allows turn on/turn off audio when necessary. */ - + /* * Do clock framework mclk search */ @@ -312,7 +397,7 @@ void tsc2101_clock_setup(void) /* * Do some sanity check, set clock rate, starts it and turn codec audio on */ -int tsc2101_clock_on(void) +int tsc2101_clock_on(void) { int curUseCount; uint curRate; @@ -321,7 +406,7 @@ int tsc2101_clock_on(void) curUseCount = clk_get_usecount(tsc2101_mclk); DPRINTK("clock use count = %d\n", curUseCount); if (curUseCount > 0) { - // MCLK is already in use + /* MCLK is already in use */ printk(KERN_WARNING "MCLK already in use at %d Hz. We change it to %d Hz\n", (uint) clk_get_rate(tsc2101_mclk), @@ -331,8 +416,8 @@ int tsc2101_clock_on(void) if (curRate != CODEC_CLOCK) { err = clk_set_rate(tsc2101_mclk, CODEC_CLOCK); if (err) { - printk(KERN_WARNING - "Cannot set MCLK clock rate for TSC2101 CODEC, error code = %d\n", err); + printk(KERN_WARNING "Cannot set MCLK clock rate for " + "TSC2101 CODEC, error code = %d\n", err); return -ECANCELED; } } @@ -340,22 +425,22 @@ int tsc2101_clock_on(void) curRate = (uint)clk_get_rate(tsc2101_mclk); curUseCount = clk_get_usecount(tsc2101_mclk); DPRINTK("MCLK = %d [%d], usecount = %d, clk_enable retval = %d\n", - curRate, + curRate, CODEC_CLOCK, curUseCount, err); - // Now turn the audio on + /* Now turn the audio on */ tsc2101_write_sync(mcbsp_dev.tsc2101_dev, PAGE2_AUDIO_CODEC_REGISTERS, TSC2101_CODEC_POWER_CTRL, 0x0000); - return 0; + return 0; } /* * Do some sanity check, turn clock off and then turn codec audio off */ -int tsc2101_clock_off(void) +int tsc2101_clock_off(void) { int curUseCount; int curRate; @@ -377,7 +462,7 @@ int tsc2101_clock_off(void) tsc2101_audio_write(TSC2101_CODEC_POWER_CTRL, ~(CPC_SP1PWDN | CPC_SP2PWDN | CPC_BASSBC)); DPRINTK("audio codec off\n"); - return 0; + return 0; } int tsc2101_get_default_samplerate(void) @@ -390,7 +475,7 @@ static int __devinit snd_omap_alsa_tsc2101_probe(struct platform_device *pdev) struct spi_device *tsc2101; int ret; struct omap_alsa_codec_config *codec_cfg; - + tsc2101 = dev_get_drvdata(&pdev->dev); if (tsc2101 == NULL) { dev_err(&pdev->dev, "no platform data\n"); @@ -405,18 +490,21 @@ static int __devinit snd_omap_alsa_tsc2101_probe(struct platform_device *pdev) codec_cfg = pdev->dev.platform_data; if (codec_cfg != NULL) { - codec_cfg->hw_constraints_rates = &tsc2101_hw_constraints_rates; - codec_cfg->snd_omap_alsa_playback = &tsc2101_snd_omap_alsa_playback; - codec_cfg->snd_omap_alsa_capture = &tsc2101_snd_omap_alsa_capture; + codec_cfg->hw_constraints_rates = + &tsc2101_hw_constraints_rates; + codec_cfg->snd_omap_alsa_playback = + &tsc2101_snd_omap_alsa_playback; + codec_cfg->snd_omap_alsa_capture = + &tsc2101_snd_omap_alsa_capture; codec_cfg->codec_configure_dev = tsc2101_configure; codec_cfg->codec_set_samplerate = tsc2101_set_samplerate; codec_cfg->codec_clock_setup = tsc2101_clock_setup; codec_cfg->codec_clock_on = tsc2101_clock_on; codec_cfg->codec_clock_off = tsc2101_clock_off; - codec_cfg->get_default_samplerate = tsc2101_get_default_samplerate; - ret = snd_omap_alsa_post_probe(pdev, codec_cfg); - } - else + codec_cfg->get_default_samplerate = + tsc2101_get_default_samplerate; + ret = snd_omap_alsa_post_probe(pdev, codec_cfg); + } else ret = -ENODEV; return ret; } @@ -432,10 +520,10 @@ static struct platform_driver omap_alsa_driver = { }; static int __init omap_alsa_tsc2101_init(void) -{ +{ ADEBUG(); #ifdef DUMP_TSC2101_AUDIO_REGISTERS - printk("omap_alsa_tsc2101_init()\n"); + printk(KERN_INFO "omap_alsa_tsc2101_init()\n"); dump_tsc2101_audio_reg(); #endif return platform_driver_register(&omap_alsa_driver); @@ -445,7 +533,7 @@ static void __exit omap_alsa_tsc2101_exit(void) { ADEBUG(); #ifdef DUMP_TSC2101_AUDIO_REGISTERS - printk("omap_alsa_tsc2101_exit()\n"); + printk(KERN_INFO "omap_alsa_tsc2101_exit()\n"); dump_tsc2101_audio_reg(); #endif platform_driver_unregister(&omap_alsa_driver); -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 15/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101.h 2008-04-18 8:01 ` [PATCH 14/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101.c Eduardo Valentin @ 2008-04-18 8:01 ` Eduardo Valentin 2008-04-18 8:01 ` [PATCH 16/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2102-mixer.c Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-tsc2101.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/arm/omap/omap-alsa-tsc2101.h b/sound/arm/omap/omap-alsa-tsc2101.h index 73999a0..fb03801 100644 --- a/sound/arm/omap/omap-alsa-tsc2101.h +++ b/sound/arm/omap/omap-alsa-tsc2101.h @@ -1,6 +1,6 @@ /* * sound/arm/omap/omap-alsa-tsc2101.h - * + * * Alsa Driver for TSC2101 codec for OMAP platform boards. * * Based on former omap-aic23.h and tsc2101 OSS drivers. @@ -9,7 +9,7 @@ * * Copyright (C) 2006 Instituto Nokia de Tecnologia - INdT - Manaus Brazil * Alsa modularization by Daniel Petrini (d.pensator@gmail.com) - * + * * Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi> * * This program is free software; you can redistribute it and/or modify it @@ -54,7 +54,7 @@ struct tsc2101_samplerate_reg_info { }; /* - * Defines codec specific functions pointers that can be used from the + * Defines codec specific function pointers that can be used from the * common omap-alse base driver for all omap codecs. (tsc2101 and aic23) */ inline void tsc2101_configure(void); -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 16/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2102-mixer.c 2008-04-18 8:01 ` [PATCH 15/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101.h Eduardo Valentin @ 2008-04-18 8:01 ` Eduardo Valentin 2008-04-18 8:01 ` [PATCH 17/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2102.c Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-tsc2102-mixer.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sound/arm/omap/omap-alsa-tsc2102-mixer.c b/sound/arm/omap/omap-alsa-tsc2102-mixer.c index 99b1a1d..cf1f852 100644 --- a/sound/arm/omap/omap-alsa-tsc2102-mixer.c +++ b/sound/arm/omap/omap-alsa-tsc2102-mixer.c @@ -82,8 +82,10 @@ void init_playback_targets(void) /* Unmute */ tsc2102_set_mute(0, 0); - mute[0] = mute[1] = 0; - filter[0] = filter[1] = 0; + mute[0] = 0; + mute[1] = 0; + filter[0] = 0; + filter[1] = 0; } /* @@ -146,7 +148,7 @@ static int __pcm_playback_switch_get(struct snd_kcontrol *kcontrol, } static int __pcm_playback_switch_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) + struct snd_ctl_elem_value *ucontrol) { mute[0] = (ucontrol->value.integer.value[0] == 0); /* L */ mute[1] = (ucontrol->value.integer.value[1] == 0); /* R */ @@ -173,7 +175,7 @@ static int __pcm_playback_deemphasis_get(struct snd_kcontrol *kcontrol, } static int __pcm_playback_deemphasis_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) + struct snd_ctl_elem_value *ucontrol) { filter[0] = (ucontrol->value.integer.value[0] > 0); @@ -199,7 +201,7 @@ static int __pcm_playback_bassboost_get(struct snd_kcontrol *kcontrol, } static int __pcm_playback_bassboost_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) + struct snd_ctl_elem_value *ucontrol) { filter[1] = (ucontrol->value.integer.value[0] > 0); @@ -270,7 +272,7 @@ int snd_omap_mixer(struct snd_card_omap_codec *tsc2102) if (!tsc2102) return -EINVAL; - for (i = 0; i < ARRAY_SIZE(tsc2102_controls); i ++) { + for (i = 0; i < ARRAY_SIZE(tsc2102_controls); i++) { err = snd_ctl_add(tsc2102->card, snd_ctl_new1(&tsc2102_controls[i], tsc2102->card)); -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 17/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2102.c 2008-04-18 8:01 ` [PATCH 16/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2102-mixer.c Eduardo Valentin @ 2008-04-18 8:01 ` Eduardo Valentin 2008-04-18 8:01 ` [PATCH 18/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2102.h Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-tsc2102.c | 70 ++++++++++++++++++------------------ 1 files changed, 35 insertions(+), 35 deletions(-) diff --git a/sound/arm/omap/omap-alsa-tsc2102.c b/sound/arm/omap/omap-alsa-tsc2102.c index 1ca5ba9..911e776 100644 --- a/sound/arm/omap/omap-alsa-tsc2102.c +++ b/sound/arm/omap/omap-alsa-tsc2102.c @@ -1,6 +1,6 @@ /* * sound/arm/omap/omap-alsa-tsc2102.c - * + * * Alsa codec driver for TSC2102 chip for OMAP platforms. * * Copyright (c) 2006 Andrzej Zaborowski <balrog@zabor.org> @@ -17,17 +17,16 @@ #include <linux/platform_device.h> #include <linux/clk.h> #include <linux/module.h> +#include <linux/io.h> #include <linux/spi/tsc2102.h> -#include <asm/io.h> - #include <asm/arch/dma.h> #include <asm/arch/clock.h> #include <asm/arch/omap-alsa.h> #include "omap-alsa-tsc2102.h" -static struct clk *tsc2102_bclk = 0; +static struct clk *tsc2102_bclk; /* * Hardware capabilities @@ -67,62 +66,63 @@ static struct snd_pcm_hardware tsc2102_snd_omap_alsa_playback = { }; #ifdef DUMP_TSC2102_AUDIO_REGISTERS -static void dump_tsc2102_audio_regs(void) { - printk("TSC2102_AUDIO1_CTRL = 0x%04x\n", +static void dump_tsc2102_audio_regs(void) +{ + printk(KERN_INFO "TSC2102_AUDIO1_CTRL = 0x%04x\n", tsc2102_read_sync(TSC2102_AUDIO1_CTRL)); - printk("TSC2102_DAC_GAIN_CTRL = 0x%04x\n", + printk(KERN_INFO "TSC2102_DAC_GAIN_CTRL = 0x%04x\n", tsc2102_read_sync(TSC2102_DAC_GAIN_CTRL)); - printk("TSC2102_AUDIO2_CTRL = 0x%04x\n", + printk(KERN_INFO "TSC2102_AUDIO2_CTRL = 0x%04x\n", tsc2102_read_sync(TSC2102_AUDIO2_CTRL)); - printk("TSC2102_DAC_POWER_CTRL = 0x%04x\n", + printk(KERN_INFO "TSC2102_DAC_POWER_CTRL = 0x%04x\n", tsc2102_read_sync(TSC2102_DAC_POWER_CTRL)); - printk("TSC2102_AUDIO3_CTRL = 0x%04x\n", + printk(KERN_INFO "TSC2102_AUDIO3_CTRL = 0x%04x\n", tsc2102_read_sync(TSC2102_AUDIO_CTRL_3)); - printk("TSC2102_LCH_BASS_BOOST_N0 = 0x%04x\n", + printk(KERN_INFO "TSC2102_LCH_BASS_BOOST_N0 = 0x%04x\n", tsc2102_read_sync(TSC2102_LCH_BASS_BOOST_N0)); - printk("TSC2102_LCH_BASS_BOOST_N1 = 0x%04x\n", + printk(KERN_INFO "TSC2102_LCH_BASS_BOOST_N1 = 0x%04x\n", tsc2102_read_sync(TSC2102_LCH_BASS_BOOST_N1)); - printk("TSC2102_LCH_BASS_BOOST_N2 = 0x%04x\n", + printk(KERN_INFO "TSC2102_LCH_BASS_BOOST_N2 = 0x%04x\n", tsc2102_read_sync(TSC2102_LCH_BASS_BOOST_N2)); - printk("TSC2102_LCH_BASS_BOOST_N3 = 0x%04x\n", + printk(KERN_INFO "TSC2102_LCH_BASS_BOOST_N3 = 0x%04x\n", tsc2102_read_sync(TSC2102_LCH_BASS_BOOST_N3)); - printk("TSC2102_LCH_BASS_BOOST_N4 = 0x%04x\n", + printk(KERN_INFO "TSC2102_LCH_BASS_BOOST_N4 = 0x%04x\n", tsc2102_read_sync(TSC2102_LCH_BASS_BOOST_N4)); - printk("TSC2102_LCH_BASS_BOOST_N5 = 0x%04x\n", + printk(KERN_INFO "TSC2102_LCH_BASS_BOOST_N5 = 0x%04x\n", tsc2102_read_sync(TSC2102_LCH_BASS_BOOST_N5)); - printk("TSC2102_LCH_BASS_BOOST_D1 = 0x%04x\n", + printk(KERN_INFO "TSC2102_LCH_BASS_BOOST_D1 = 0x%04x\n", tsc2102_read_sync(TSC2102_LCH_BASS_BOOST_D1)); - printk("TSC2102_LCH_BASS_BOOST_D2 = 0x%04x\n", + printk(KERN_INFO "TSC2102_LCH_BASS_BOOST_D2 = 0x%04x\n", tsc2102_read_sync(TSC2102_LCH_BASS_BOOST_D2)); - printk("TSC2102_LCH_BASS_BOOST_D4 = 0x%04x\n", + printk(KERN_INFO "TSC2102_LCH_BASS_BOOST_D4 = 0x%04x\n", tsc2102_read_sync(TSC2102_LCH_BASS_BOOST_D4)); - printk("TSC2102_LCH_BASS_BOOST_D5 = 0x%04x\n", + printk(KERN_INFO "TSC2102_LCH_BASS_BOOST_D5 = 0x%04x\n", tsc2102_read_sync(TSC2102_LCH_BASS_BOOST_D5)); - printk("TSC2102_RCH_BASS_BOOST_N0 = 0x%04x\n", + printk(KERN_INFO "TSC2102_RCH_BASS_BOOST_N0 = 0x%04x\n", tsc2102_read_sync(TSC2102_RCH_BASS_BOOST_N0)); - printk("TSC2102_RCH_BASS_BOOST_N1 = 0x%04x\n", + printk(KERN_INFO "TSC2102_RCH_BASS_BOOST_N1 = 0x%04x\n", tsc2102_read_sync(TSC2102_RCH_BASS_BOOST_N1)); - printk("TSC2102_RCH_BASS_BOOST_N2 = 0x%04x\n", + printk(KERN_INFO "TSC2102_RCH_BASS_BOOST_N2 = 0x%04x\n", tsc2102_read_sync(TSC2102_RCH_BASS_BOOST_N2)); - printk("TSC2102_RCH_BASS_BOOST_N3 = 0x%04x\n", + printk(KERN_INFO "TSC2102_RCH_BASS_BOOST_N3 = 0x%04x\n", tsc2102_read_sync(TSC2102_RCH_BASS_BOOST_N3)); - printk("TSC2102_RCH_BASS_BOOST_N4 = 0x%04x\n", + printk(KERN_INFO "TSC2102_RCH_BASS_BOOST_N4 = 0x%04x\n", tsc2102_read_sync(TSC2102_RCH_BASS_BOOST_N4)); - printk("TSC2102_RCH_BASS_BOOST_N5 = 0x%04x\n", + printk(KERN_INFO "TSC2102_RCH_BASS_BOOST_N5 = 0x%04x\n", tsc2102_read_sync(TSC2102_RCH_BASS_BOOST_N5)); - printk("TSC2102_RCH_BASS_BOOST_D1 = 0x%04x\n", + printk(KERN_INFO "TSC2102_RCH_BASS_BOOST_D1 = 0x%04x\n", tsc2102_read_sync(TSC2102_RCH_BASS_BOOST_D1)); - printk("TSC2102_RCH_BASS_BOOST_D2 = 0x%04x\n", + printk(KERN_INFO "TSC2102_RCH_BASS_BOOST_D2 = 0x%04x\n", tsc2102_read_sync(TSC2102_RCH_BASS_BOOST_D2)); - printk("TSC2102_RCH_BASS_BOOST_D4 = 0x%04x\n", + printk(KERN_INFO "TSC2102_RCH_BASS_BOOST_D4 = 0x%04x\n", tsc2102_read_sync(TSC2102_RCH_BASS_BOOST_D4)); - printk("TSC2102_RCH_BASS_BOOST_D5 = 0x%04x\n", + printk(KERN_INFO "TSC2102_RCH_BASS_BOOST_D5 = 0x%04x\n", tsc2102_read_sync(TSC2102_RCH_BASS_BOOST_D5)); - printk("TSC2102_PLL1_CTRL = 0x%04x\n", + printk(KERN_INFO "TSC2102_PLL1_CTRL = 0x%04x\n", tsc2102_read_sync(TSC2102_PLL1_CTRL)); - printk("TSC2102_PLL2_CTRL = 0x%04x\n", + printk(KERN_INFO "TSC2102_PLL2_CTRL = 0x%04x\n", tsc2102_read_sync(TSC2102_PLL2_CTRL)); - printk("TSC2102_AUDIO4_CTRL = 0x%04x\n", + printk(KERN_INFO "TSC2102_AUDIO4_CTRL = 0x%04x\n", tsc2102_read_sync(TSC2102_AUDIO4_CTRL)); } #endif @@ -131,7 +131,7 @@ static void dump_tsc2102_audio_regs(void) { * ALSA operations according to board file */ -static long current_rate = 0; +static long current_rate; /* * Sample rate changing @@ -180,7 +180,7 @@ static void tsc2102_configure(void) /* * Omap McBSP clock and Power Management configuration - * + * * Here we have some functions that allow clock to be enabled and * disabled only when needed. Besides doing clock configuration * they allow turn audio on and off when necessary. -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 18/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2102.h 2008-04-18 8:01 ` [PATCH 17/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2102.c Eduardo Valentin @ 2008-04-18 8:01 ` Eduardo Valentin 2008-04-18 8:01 ` [PATCH 19/19] Code clean-up for sound/arm/omap/omap-alsa.c Eduardo Valentin 0 siblings, 1 reply; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa-tsc2102.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/sound/arm/omap/omap-alsa-tsc2102.h b/sound/arm/omap/omap-alsa-tsc2102.h index cee2839..0e0c097 100644 --- a/sound/arm/omap/omap-alsa-tsc2102.h +++ b/sound/arm/omap/omap-alsa-tsc2102.h @@ -1,6 +1,6 @@ /* * sound/arm/omap/omap-alsa-tsc2102.h - * + * * Alsa codec driver for TSC2102 chip for OMAP platforms. * * Copyright (c) 2006 Andrzej Zaborowski <balrog@zabor.org> -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 19/19] Code clean-up for sound/arm/omap/omap-alsa.c 2008-04-18 8:01 ` [PATCH 18/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2102.h Eduardo Valentin @ 2008-04-18 8:01 ` Eduardo Valentin 0 siblings, 0 replies; 21+ messages in thread From: Eduardo Valentin @ 2008-04-18 8:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Ragner Magalhaes, Eduardo Valentin From: Eduardo Valentin <eduardo.valentin@indt.org.br> Removed lots of whitespaces and a few errors and warnings reported by checkpatch.pl. Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> --- sound/arm/omap/omap-alsa.c | 163 +++++++++++++++++++++++--------------------- 1 files changed, 86 insertions(+), 77 deletions(-) diff --git a/sound/arm/omap/omap-alsa.c b/sound/arm/omap/omap-alsa.c index 30c7942..8693942 100644 --- a/sound/arm/omap/omap-alsa.c +++ b/sound/arm/omap/omap-alsa.c @@ -1,6 +1,6 @@ /* * sound/arm/omap-alsa.c - * + * * Alsa Driver for OMAP * * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil @@ -9,7 +9,7 @@ * * Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi> * - * Based on sa11xx-uda1341.c, + * Based on sa11xx-uda1341.c, * Copyright (C) 2002 Tomas Kasparek <tomas.kasparek@seznam.cz> * * This program is free software; you can redistribute it and/or modify it @@ -34,10 +34,10 @@ * * History: * - * 2005-07-29 INdT Kernel Team - Alsa driver for omap osk. Creation of new + * 2005-07-29 INdT Kernel Team - Alsa driver for omap osk. Creation of new * file omap-aic23.c - * - * 2005-12-18 Dirk Behme - Added L/R Channel Interchange fix as proposed + * + * 2005-12-18 Dirk Behme - Added L/R Channel Interchange fix as proposed * by Ajaya Babu * */ @@ -52,14 +52,18 @@ #include <asm/arch/omap-alsa.h> #include "omap-alsa-dma.h" -MODULE_AUTHOR("Mika Laitio, Daniel Petrini, David Cohen, Anderson Briglia - INdT"); +MODULE_AUTHOR("Mika Laitio"); +MODULE_AUTHOR("Daniel Petrini"); +MODULE_AUTHOR("David Cohen"); +MODULE_AUTHOR("Anderson Briglia"); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("OMAP driver for ALSA"); MODULE_ALIAS("omap_alsa_mcbsp.1"); -static char *id = NULL; -static struct snd_card_omap_codec *alsa_codec = NULL; -static struct omap_alsa_codec_config *alsa_codec_config = NULL; +static char *id; +static struct snd_card_omap_codec *alsa_codec; +static struct omap_alsa_codec_config *alsa_codec_config; /* * HW interface start and stop helper functions @@ -100,10 +104,9 @@ static void omap_alsa_audio_init(struct snd_card_omap_codec *omap_alsa) audio_ifc_stop; } -/* - * DMA functions +/* + * DMA functions * Depends on omap-alsa-dma.c functions and (omap) dma.c - * */ static int audio_dma_request(struct audio_stream *s, void (*callback) (void *)) @@ -151,7 +154,8 @@ static u_int audio_get_dma_pos(struct audio_stream *s) spin_unlock_irqrestore(&s->dma_lock, flags); /* Now, the position related to the end of that period */ - offset = bytes_to_frames(runtime, s->offset) - bytes_to_frames(runtime, count); + offset = bytes_to_frames(runtime, s->offset) - + bytes_to_frames(runtime, count); if (offset >= runtime->buffer_size) offset = 0; @@ -190,29 +194,28 @@ static void audio_process_dma(struct audio_stream *s) unsigned int dma_size; unsigned int offset; int ret; - + ADEBUG(); runtime = substream->runtime; if (s->active) { dma_size = frames_to_bytes(runtime, runtime->period_size); offset = dma_size * s->period; - snd_assert(dma_size <= DMA_BUF_SIZE,); + snd_assert(dma_size <= DMA_BUF_SIZE, return); /* * On omap1510 based devices, we need to call the stop_dma * before calling the start_dma or we will not receive the * irq from DMA after the first transfered/played buffer. * (invocation of callback_omap_alsa_sound_dma() method). */ - if (cpu_is_omap1510()) { + if (cpu_is_omap1510()) omap_stop_alsa_sound_dma(s); - } + ret = omap_start_alsa_sound_dma(s, (dma_addr_t)runtime->dma_area + offset, dma_size); if (ret) { - printk(KERN_ERR - "audio_process_dma: cannot queue DMA buffer (%i)\n", - ret); + printk(KERN_ERR "audio_process_dma: cannot" + " queue DMA buffer (%i)\n", ret); return; } @@ -223,15 +226,15 @@ static void audio_process_dma(struct audio_stream *s) } } -/* +/* * This is called when dma IRQ occurs at the end of each transmited block */ void callback_omap_alsa_sound_dma(void *data) { struct audio_stream *s = data; - + ADEBUG(); - /* + /* * If we are getting a callback for an active stream then we inform * the PCM middle layer we've finished a period */ @@ -239,25 +242,25 @@ void callback_omap_alsa_sound_dma(void *data) snd_pcm_period_elapsed(s->stream); spin_lock(&s->dma_lock); - if (s->periods > 0) + if (s->periods > 0) s->periods--; - + audio_process_dma(s); spin_unlock(&s->dma_lock); } -/* +/* * Alsa section * PCM settings and callbacks */ -static int snd_omap_alsa_trigger(struct snd_pcm_substream * substream, int cmd) +static int snd_omap_alsa_trigger(struct snd_pcm_substream *substream, int cmd) { struct snd_card_omap_codec *chip = snd_pcm_substream_chip(substream); int stream_id = substream->pstr->stream; struct audio_stream *s = &chip->s[stream_id]; int err = 0; - + ADEBUG(); /* note local interrupts are already disabled in the midlevel code */ spin_lock(&s->dma_lock); @@ -276,16 +279,16 @@ static int snd_omap_alsa_trigger(struct snd_pcm_substream * substream, int cmd) break; } spin_unlock(&s->dma_lock); - + return err; } -static int snd_omap_alsa_prepare(struct snd_pcm_substream * substream) +static int snd_omap_alsa_prepare(struct snd_pcm_substream *substream) { struct snd_card_omap_codec *chip = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; struct audio_stream *s = &chip->s[substream->pstr->stream]; - + ADEBUG(); /* set requested samplerate */ alsa_codec_config->codec_set_samplerate(runtime->rate); @@ -297,63 +300,64 @@ static int snd_omap_alsa_prepare(struct snd_pcm_substream * substream) return 0; } -static snd_pcm_uframes_t snd_omap_alsa_pointer(struct snd_pcm_substream *substream) +static snd_pcm_uframes_t +snd_omap_alsa_pointer(struct snd_pcm_substream *substream) { struct snd_card_omap_codec *chip = snd_pcm_substream_chip(substream); - ADEBUG(); + ADEBUG(); return audio_get_dma_pos(&chip->s[substream->pstr->stream]); } -static int snd_card_omap_alsa_open(struct snd_pcm_substream * substream) +static int snd_card_omap_alsa_open(struct snd_pcm_substream *substream) { struct snd_card_omap_codec *chip = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; int stream_id = substream->pstr->stream; int err; - + ADEBUG(); chip->s[stream_id].stream = substream; alsa_codec_config->codec_clock_on(); - if (stream_id == SNDRV_PCM_STREAM_PLAYBACK) + if (stream_id == SNDRV_PCM_STREAM_PLAYBACK) runtime->hw = *(alsa_codec_config->snd_omap_alsa_playback); - else + else runtime->hw = *(alsa_codec_config->snd_omap_alsa_capture); - - if ((err = snd_pcm_hw_constraint_integer(runtime, - SNDRV_PCM_HW_PARAM_PERIODS)) < 0) + + err = snd_pcm_hw_constraint_integer(runtime, + SNDRV_PCM_HW_PARAM_PERIODS); + if (err < 0) return err; - - if ((err = snd_pcm_hw_constraint_list(runtime, - 0, - SNDRV_PCM_HW_PARAM_RATE, - alsa_codec_config->hw_constraints_rates)) < 0) + + err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + alsa_codec_config->hw_constraints_rates); + if (err < 0) return err; - + return 0; } -static int snd_card_omap_alsa_close(struct snd_pcm_substream * substream) +static int snd_card_omap_alsa_close(struct snd_pcm_substream *substream) { struct snd_card_omap_codec *chip = snd_pcm_substream_chip(substream); - + ADEBUG(); alsa_codec_config->codec_clock_off(); chip->s[substream->pstr->stream].stream = NULL; - + return 0; } /* HW params & free */ -static int snd_omap_alsa_hw_params(struct snd_pcm_substream * substream, - struct snd_pcm_hw_params * hw_params) +static int snd_omap_alsa_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); } -static int snd_omap_alsa_hw_free(struct snd_pcm_substream * substream) +static int snd_omap_alsa_hw_free(struct snd_pcm_substream *substream) { return snd_pcm_lib_free_pages(substream); } @@ -383,17 +387,17 @@ static struct snd_pcm_ops snd_card_omap_alsa_capture_ops = { /* * Alsa init and exit section - * * Inits pcm alsa structures, allocate the alsa buffer, suspend, resume */ -static int __init snd_card_omap_alsa_pcm(struct snd_card_omap_codec *omap_alsa, +static int __init snd_card_omap_alsa_pcm(struct snd_card_omap_codec *omap_alsa, int device) { struct snd_pcm *pcm; int err; - + ADEBUG(); - if ((err = snd_pcm_new(omap_alsa->card, "OMAP PCM", device, 1, 1, &pcm)) < 0) + err = snd_pcm_new(omap_alsa->card, "OMAP PCM", device, 1, 1, &pcm); + if (err < 0) return err; /* sets up initial buffer with continuous allocation */ @@ -433,11 +437,12 @@ int snd_omap_alsa_suspend(struct platform_device *pdev, pm_message_t state) { struct snd_card_omap_codec *chip; struct snd_card *card = platform_get_drvdata(pdev); - + if (card->power_state != SNDRV_CTL_POWER_D3hot) { chip = card->private_data; if (chip->card->power_state != SNDRV_CTL_POWER_D3hot) { - snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); + snd_power_change_state(chip->card, + SNDRV_CTL_POWER_D3hot); snd_pcm_suspend_all(chip->pcm); /* Mutes and turn clock off */ alsa_codec_config->codec_clock_off(); @@ -452,7 +457,7 @@ int snd_omap_alsa_resume(struct platform_device *pdev) struct snd_card_omap_codec *chip; struct snd_card *card = platform_get_drvdata(pdev); - if (card->power_state != SNDRV_CTL_POWER_D0) { + if (card->power_state != SNDRV_CTL_POWER_D0) { chip = card->private_data; if (chip->card->power_state != SNDRV_CTL_POWER_D0) { snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0); @@ -465,11 +470,11 @@ int snd_omap_alsa_resume(struct platform_device *pdev) #endif /* CONFIG_PM */ -void snd_omap_alsa_free(struct snd_card * card) +void snd_omap_alsa_free(struct snd_card *card) { struct snd_card_omap_codec *chip = card->private_data; ADEBUG(); - + /* * Turn off codec after it is done. * Can't do it immediately, since it may still have @@ -486,27 +491,28 @@ void snd_omap_alsa_free(struct snd_card * card) /* module init & exit */ -/* +/* * Inits alsa soudcard structure. * Called by the probe method in codec after function pointers has been set. */ -int snd_omap_alsa_post_probe(struct platform_device *pdev, struct omap_alsa_codec_config *config) +int snd_omap_alsa_post_probe(struct platform_device *pdev, + struct omap_alsa_codec_config *config) { int err = 0; int def_rate; struct snd_card *card; - + ADEBUG(); alsa_codec_config = config; alsa_codec_config->codec_clock_setup(); - alsa_codec_config->codec_clock_on(); + alsa_codec_config->codec_clock_on(); omap_mcbsp_request(AUDIO_MCBSP); omap_mcbsp_stop(AUDIO_MCBSP); omap_mcbsp_config(AUDIO_MCBSP, alsa_codec_config->mcbsp_regs_alsa); omap_mcbsp_start(AUDIO_MCBSP); - + if (alsa_codec_config && alsa_codec_config->codec_configure_dev) alsa_codec_config->codec_configure_dev(); @@ -525,18 +531,20 @@ int snd_omap_alsa_post_probe(struct platform_device *pdev, struct omap_alsa_code card->private_free = snd_omap_alsa_free; alsa_codec->card = card; - def_rate = alsa_codec_config->get_default_samplerate(); + def_rate = alsa_codec_config->get_default_samplerate(); alsa_codec->samplerate = def_rate; spin_lock_init(&alsa_codec->s[0].dma_lock); spin_lock_init(&alsa_codec->s[1].dma_lock); /* mixer */ - if ((err = snd_omap_mixer(alsa_codec)) < 0) + err = snd_omap_mixer(alsa_codec); + if (err < 0) goto nodev3; /* PCM */ - if ((err = snd_card_omap_alsa_pcm(alsa_codec, 0)) < 0) + err = snd_card_omap_alsa_pcm(alsa_codec, 0); + if (err < 0) goto nodev3; strcpy(card->driver, "OMAP_ALSA"); @@ -545,16 +553,17 @@ int snd_omap_alsa_post_probe(struct platform_device *pdev, struct omap_alsa_code snd_omap_init_mixer(); snd_card_set_dev(card, &pdev->dev); - - if ((err = snd_card_register(card)) == 0) { + + err = snd_card_register(card); + if (err == 0) { printk(KERN_INFO "audio support initialized\n"); platform_set_drvdata(pdev, card); return 0; } - + nodev3: - kfree(alsa_codec); -nodev2: + kfree(alsa_codec); +nodev2: snd_card_free(card); nodev1: omap_mcbsp_stop(AUDIO_MCBSP); @@ -567,14 +576,14 @@ int snd_omap_alsa_remove(struct platform_device *pdev) { struct snd_card *card = platform_get_drvdata(pdev); struct snd_card_omap_codec *chip = card->private_data; - + snd_card_free(card); alsa_codec = NULL; card->private_data = NULL; kfree(chip); - + platform_set_drvdata(pdev, NULL); - + return 0; } -- 1.5.5-rc3.GIT ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 00/19] Update and clean up on sound/arm/omap/omap-alsa*[c,h] (take #2) 2008-04-18 8:00 [PATCH 00/19] Update and clean up on sound/arm/omap/omap-alsa*[c,h] (take #2) Eduardo Valentin 2008-04-18 8:00 ` [PATCH 01/19] Update audio driver for H2 board Eduardo Valentin @ 2008-04-23 23:57 ` Tony Lindgren 1 sibling, 0 replies; 21+ messages in thread From: Tony Lindgren @ 2008-04-23 23:57 UTC (permalink / raw) To: Eduardo Valentin Cc: linux-omap, Felipe Balbi, Ragner Magalhaes, Eduardo Valentin * Eduardo Valentin <edubezval@gmail.com> [080418 01:03]: > From: Eduardo Valentin <eduardo.valentin@indt.org.br> > > Hi all, > > This patch series cleans up most of the errors and warnings reported > by checkpatch.pl on sound/arm/omap/omap-alsa*[c,h]. Some checks reported > by checkpatch.pl were ignored, such as removing #if 0 codes. Not all were > eligible for remotion. > > There is also one patch that updates the alsa driver for H2. > Since tsc2101 i2c driver was updated, this alsa driver stop > working. Pushing this today, you might want to talk with Jarkko Nikula on converting things to use the asoc driver :) Tony > > Cheers, > > --- > Eduardo Valentin > > Eduardo Valentin (19): > Update audio driver for H2 board > Code clean-up for include/asm-arm/arch-omap/omap-alsa.h > Code clean-up for sound/arm/omap/omap-alsa-aic23.c > Code clean-up for sound/arm/omap/omap-alsa-aic23.h > Code clean-up for sound/arm/omap/omap-alsa-aic23-mixer.c > Code clean-up for sound/arm/omap/omap-alsa-dma.c > Code clean-up for sound/arm/omap/omap-alsa-dma.h > Code clean-up for sound/arm/omap/omap-alsa-sx1-mixer.c > Code clean-up for sound/arm/omap/omap-alsa-sx1-mixer.h > Code clean-up for sound/arm/omap/omap-alsa-sx1.c > Code clean-up for sound/arm/omap/omap-alsa-sx1.h > Code clean-up for sound/arm/omap/omap-alsa-tsc2101-mixer.c > Code clean-up for sound/arm/omap/omap-alsa-tsc2101-mixer.h > Code clean-up for sound/arm/omap/omap-alsa-tsc2101.c > Code clean-up for sound/arm/omap/omap-alsa-tsc2101.h > Code clean-up for sound/arm/omap/omap-alsa-tsc2102-mixer.c > Code clean-up for sound/arm/omap/omap-alsa-tsc2102.c > Code clean-up for sound/arm/omap/omap-alsa-tsc2102.h > Code clean-up for sound/arm/omap/omap-alsa.c > > arch/arm/mach-omap1/board-h2.c | 71 ++-- > include/asm-arm/arch-omap/omap-alsa.h | 29 +- > sound/arm/omap/omap-alsa-aic23-mixer.c | 144 ++++--- > sound/arm/omap/omap-alsa-aic23.c | 59 ++-- > sound/arm/omap/omap-alsa-aic23.h | 12 +- > sound/arm/omap/omap-alsa-dma.c | 171 ++++----- > sound/arm/omap/omap-alsa-dma.h | 22 +- > sound/arm/omap/omap-alsa-sx1-mixer.c | 22 +- > sound/arm/omap/omap-alsa-sx1-mixer.h | 6 +- > sound/arm/omap/omap-alsa-sx1.c | 72 +++- > sound/arm/omap/omap-alsa-sx1.h | 3 +- > sound/arm/omap/omap-alsa-tsc2101-mixer.c | 631 ++++++++++++++++-------------- > sound/arm/omap/omap-alsa-tsc2101-mixer.h | 31 +- > sound/arm/omap/omap-alsa-tsc2101.c | 320 ++++++++++----- > sound/arm/omap/omap-alsa-tsc2101.h | 11 +- > sound/arm/omap/omap-alsa-tsc2102-mixer.c | 14 +- > sound/arm/omap/omap-alsa-tsc2102.c | 70 ++-- > sound/arm/omap/omap-alsa-tsc2102.h | 2 +- > sound/arm/omap/omap-alsa.c | 163 ++++---- > 19 files changed, 1056 insertions(+), 797 deletions(-) > > -- > To unsubscribe from this list: send the line "unsubscribe linux-omap" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2008-04-23 23:57 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-04-18 8:00 [PATCH 00/19] Update and clean up on sound/arm/omap/omap-alsa*[c,h] (take #2) Eduardo Valentin 2008-04-18 8:00 ` [PATCH 01/19] Update audio driver for H2 board Eduardo Valentin 2008-04-18 8:00 ` [PATCH 02/19] Code clean-up for include/asm-arm/arch-omap/omap-alsa.h Eduardo Valentin 2008-04-18 8:00 ` [PATCH 03/19] Code clean-up for sound/arm/omap/omap-alsa-aic23.c Eduardo Valentin 2008-04-18 8:00 ` [PATCH 04/19] Code clean-up for sound/arm/omap/omap-alsa-aic23.h Eduardo Valentin 2008-04-18 8:00 ` [PATCH 05/19] Code clean-up for sound/arm/omap/omap-alsa-aic23-mixer.c Eduardo Valentin 2008-04-18 8:00 ` [PATCH 06/19] Code clean-up for sound/arm/omap/omap-alsa-dma.c Eduardo Valentin 2008-04-18 8:00 ` [PATCH 07/19] Code clean-up for sound/arm/omap/omap-alsa-dma.h Eduardo Valentin 2008-04-18 8:00 ` [PATCH 08/19] Code clean-up for sound/arm/omap/omap-alsa-sx1-mixer.c Eduardo Valentin 2008-04-18 8:00 ` [PATCH 09/19] Code clean-up for sound/arm/omap/omap-alsa-sx1-mixer.h Eduardo Valentin 2008-04-18 8:00 ` [PATCH 10/19] Code clean-up for sound/arm/omap/omap-alsa-sx1.c Eduardo Valentin 2008-04-18 8:00 ` [PATCH 11/19] Code clean-up for sound/arm/omap/omap-alsa-sx1.h Eduardo Valentin 2008-04-18 8:00 ` [PATCH 12/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101-mixer.c Eduardo Valentin 2008-04-18 8:01 ` [PATCH 13/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101-mixer.h Eduardo Valentin 2008-04-18 8:01 ` [PATCH 14/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101.c Eduardo Valentin 2008-04-18 8:01 ` [PATCH 15/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2101.h Eduardo Valentin 2008-04-18 8:01 ` [PATCH 16/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2102-mixer.c Eduardo Valentin 2008-04-18 8:01 ` [PATCH 17/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2102.c Eduardo Valentin 2008-04-18 8:01 ` [PATCH 18/19] Code clean-up for sound/arm/omap/omap-alsa-tsc2102.h Eduardo Valentin 2008-04-18 8:01 ` [PATCH 19/19] Code clean-up for sound/arm/omap/omap-alsa.c Eduardo Valentin 2008-04-23 23:57 ` [PATCH 00/19] Update and clean up on sound/arm/omap/omap-alsa*[c,h] (take #2) Tony Lindgren
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox