From 94323635cda3c477a74b5e6b49147cf04cb4a838 Mon Sep 17 00:00:00 2001 From: Shyam Krishnan M Date: Wed, 31 Aug 2011 18:48:18 +0530 Subject: Ux500 ASoC: Add codec-driver for AB5500 ST-Ericsson Linux next: Not tested ST-Ericsson ID: 332112 ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10006 Ref: Commit-id: Ic35d9290ab3d938f19b8581c8e82cbd878952f54 Signed-off-by: Avinash A Change-Id: I0f48b74fd7f46f10b45834d74f8167a1a45f1ea7 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/30116 Reviewed-by: Avinash A Tested-by: Avinash A --- sound/soc/codecs/ab5500.c | 13 ++++++++++++- sound/soc/ux500/u5500.c | 18 ++++++++++++++++-- sound/soc/ux500/ux500_msp_dai.c | 10 +++++----- sound/soc/ux500/ux500_msp_dai.h | 10 +++++++--- 4 files changed, 40 insertions(+), 11 deletions(-) mode change 100644 => 100755 sound/soc/ux500/ux500_msp_dai.h (limited to 'sound') diff --git a/sound/soc/codecs/ab5500.c b/sound/soc/codecs/ab5500.c index 1875db4fc77..957b8fa28c2 100644 --- a/sound/soc/codecs/ab5500.c +++ b/sound/soc/codecs/ab5500.c @@ -1107,6 +1107,11 @@ static void power_for_playback(enum enum_power onoff, int ifsel) widget_if0_dld_l : widget_if1_dld_l); power_widget_unlocked(onoff, ifsel == 0 ? widget_if0_dld_r : widget_if1_dld_r); + + mask_set_reg(SPKR1, SPKRx_PWR_MASK, 0x03 << SPKRx_PWR_SHIFT); + mask_set_reg(SPKR1, SPKRx_GAIN_MASK, 0x12 << SPKRx_GAIN_SHIFT); + mask_set_reg(RX3_DPGA, RXx_DPGA_MASK, 0x3F << RXx_DPGA_SHIFT); + mutex_unlock(&ab5500_pm_mutex); } @@ -1447,7 +1452,7 @@ static int ab5500_codec_write_reg(struct snd_soc_codec *codec, */ /* changed between the two amplifier modes */ - if (hweight8(diff & SPKR1_MODE_MASK) == 2) { + if (count_ones(diff & SPKR1_MODE_MASK) == 2) { set_reg(reg, value); break; } @@ -1526,6 +1531,12 @@ static inline void init_playback_route(void) update_widgets_link(LINK, widget_dac2, widget_auxo2, AUXO2_ADDER, DAC2_TO_X_MASK, 0xff); + /* if1_dld_l -> rx3 -> dac3 -> spkr1 */ + update_widgets_link(LINK, widget_if1_dld_l, widget_rx3, RX3, + RXx_DATA_MASK, 0x05 << RXx_DATA_SHIFT); + update_widgets_link(LINK, widget_rx3, widget_dac3, 0, 0, 0); + update_widgets_link(LINK, widget_dac3, widget_spkr1, SPKR1_ADDER, + DAC3_TO_X_MASK, 0xff); } static inline void init_capture_route(void) diff --git a/sound/soc/ux500/u5500.c b/sound/soc/ux500/u5500.c index 11851e0153e..bd5ee83fe99 100644 --- a/sound/soc/ux500/u5500.c +++ b/sound/soc/ux500/u5500.c @@ -39,7 +39,6 @@ static struct platform_device ux500_pcm = { /* Define the whole U5500 soundcard, linking platform to the codec-drivers */ struct snd_soc_dai_link u5500_dai_links[] = { -#ifdef CONFIG_SND_SOC_UX500_AB5500 { .name = "ab5500_0", .stream_name = "ab5500_0", @@ -55,7 +54,22 @@ struct snd_soc_dai_link u5500_dai_links[] = { .hw_params = ux500_ab5500_hw_params, } } -#endif + }, + { + .name = "ab5500_1", + .stream_name = "ab5500_1", + .cpu_dai_name = "i2s.1", + .codec_dai_name = "ab5500-codec-dai.1", + .platform_name = "ux500-pcm.0", + .codec_name = "ab5500-codec.0", + .init = NULL, + .ops = (struct snd_soc_ops[]) { + { + .startup = ux500_ab5500_startup, + .shutdown = ux500_ab5500_shutdown, + .hw_params = ux500_ab5500_hw_params, + } + } } }; diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index 53f3982343b..5efc7adce85 100644 --- a/sound/soc/ux500/ux500_msp_dai.c +++ b/sound/soc/ux500/ux500_msp_dai.c @@ -37,7 +37,7 @@ static struct ux500_platform_drvdata platform_drvdata[UX500_NBR_OF_DAI] = { .capture_active = false, .configured = 0, .data_delay = MSP_DELAY_0, - .master_clk = UX500_MSP_U8500_INTERNAL_CLOCK_FREQ, + .master_clk = UX500_MSP_INTERNAL_CLOCK_FREQ, }, { .i2s = NULL, @@ -50,7 +50,7 @@ static struct ux500_platform_drvdata platform_drvdata[UX500_NBR_OF_DAI] = { .capture_active = false, .configured = 0, .data_delay = MSP_DELAY_0, - .master_clk = UX500_MSP_U8500_INTERNAL_CLOCK_FREQ, + .master_clk = UX500_MSP1_INTERNAL_CLOCK_FREQ, }, { .i2s = NULL, @@ -63,7 +63,7 @@ static struct ux500_platform_drvdata platform_drvdata[UX500_NBR_OF_DAI] = { .capture_active = false, .configured = 0, .data_delay = MSP_DELAY_0, - .master_clk = UX500_MSP_U8500_INTERNAL_CLOCK_FREQ, + .master_clk = UX500_MSP_INTERNAL_CLOCK_FREQ, }, { .i2s = NULL, @@ -76,7 +76,7 @@ static struct ux500_platform_drvdata platform_drvdata[UX500_NBR_OF_DAI] = { .capture_active = false, .configured = 0, .data_delay = MSP_DELAY_0, - .master_clk = UX500_MSP_U8500_INTERNAL_CLOCK_FREQ, + .master_clk = UX500_MSP_INTERNAL_CLOCK_FREQ, }, }; @@ -448,7 +448,7 @@ static void ux500_msp_dai_compile_msp_config(struct snd_pcm_substream *substream memset(msp_config, 0, sizeof(*msp_config)); if (machine_is_u5500()) - msp_config->input_clock_freq = UX500_MSP_U5500_INTERNAL_CLOCK_FREQ; + msp_config->input_clock_freq = UX500_MSP_INTERNAL_CLOCK_FREQ; else msp_config->input_clock_freq = private->master_clk; diff --git a/sound/soc/ux500/ux500_msp_dai.h b/sound/soc/ux500/ux500_msp_dai.h old mode 100644 new mode 100755 index 2ab449a36ce..cff6749760d --- a/sound/soc/ux500/ux500_msp_dai.h +++ b/sound/soc/ux500/ux500_msp_dai.h @@ -35,9 +35,13 @@ #define FRAME_PER_8_SLOTS 138 #define FRAME_PER_16_SLOTS 277 -#define UX500_MSP_U8500_INTERNAL_CLOCK_FREQ 13000000 - -#define UX500_MSP_U5500_INTERNAL_CLOCK_FREQ 40000000 +#ifndef CONFIG_SND_SOC_UX500_AB5500 +#define UX500_MSP_INTERNAL_CLOCK_FREQ 40000000 +#define UX500_MSP1_INTERNAL_CLOCK_FREQ UX500_MSP_INTERNAL_CLOCK_FREQ +#else +#define UX500_MSP_INTERNAL_CLOCK_FREQ 13000000 +#define UX500_MSP1_INTERNAL_CLOCK_FREQ (UX500_MSP_INTERNAL_CLOCK_FREQ * 2) +#endif #define UX500_MSP_MIN_CHANNELS 1 #define UX500_MSP_MAX_CHANNELS 8 -- cgit v1.2.3