Commit 33ee617f authored by Liam Girdwood's avatar Liam Girdwood

Merge remote branch 'tiwai/topic/asoc' into for-2.6.38

parents 0a27f050 9e3be1ed
#ifndef _INCLUDE_SOUND_ALC5623_H
#define _INCLUDE_SOUND_ALC5623_H
struct alc5623_platform_data {
/* configure : */
/* Lineout/Speaker Amps Vmid ratio control */
/* enable/disable adc/dac high pass filters */
unsigned int add_ctrl;
/* configure : */
/* output to enable when jack is low */
/* output to enable when jack is high */
/* jack detect (gpio/nc/jack detect [12] */
unsigned int jack_det_ctrl;
};
#endif
...@@ -22,11 +22,13 @@ config SND_SOC_ALL_CODECS ...@@ -22,11 +22,13 @@ config SND_SOC_ALL_CODECS
select SND_SOC_AK4535 if I2C select SND_SOC_AK4535 if I2C
select SND_SOC_AK4642 if I2C select SND_SOC_AK4642 if I2C
select SND_SOC_AK4671 if I2C select SND_SOC_AK4671 if I2C
select SND_SOC_ALC5623 if I2C
select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC
select SND_SOC_CS42L51 if I2C select SND_SOC_CS42L51 if I2C
select SND_SOC_CS4270 if I2C select SND_SOC_CS4270 if I2C
select SND_SOC_CX20442
select SND_SOC_DA7210 if I2C select SND_SOC_DA7210 if I2C
select SND_SOC_JZ4740 if SOC_JZ4740 select SND_SOC_JZ4740_CODEC if SOC_JZ4740
select SND_SOC_MAX98088 if I2C select SND_SOC_MAX98088 if I2C
select SND_SOC_MAX9877 if I2C select SND_SOC_MAX9877 if I2C
select SND_SOC_PCM3008 select SND_SOC_PCM3008
...@@ -129,6 +131,9 @@ config SND_SOC_AK4642 ...@@ -129,6 +131,9 @@ config SND_SOC_AK4642
config SND_SOC_AK4671 config SND_SOC_AK4671
tristate tristate
config SND_SOC_ALC5623
tristate
config SND_SOC_CQ0093VC config SND_SOC_CQ0093VC
tristate tristate
...@@ -317,3 +322,4 @@ config SND_SOC_WM2000 ...@@ -317,3 +322,4 @@ config SND_SOC_WM2000
config SND_SOC_WM9090 config SND_SOC_WM9090
tristate tristate
...@@ -17,6 +17,7 @@ snd-soc-da7210-objs := da7210.o ...@@ -17,6 +17,7 @@ snd-soc-da7210-objs := da7210.o
snd-soc-l3-objs := l3.o snd-soc-l3-objs := l3.o
snd-soc-max98088-objs := max98088.o snd-soc-max98088-objs := max98088.o
snd-soc-pcm3008-objs := pcm3008.o snd-soc-pcm3008-objs := pcm3008.o
snd-soc-alc5623-objs := alc5623.o
snd-soc-spdif-objs := spdif_transciever.o snd-soc-spdif-objs := spdif_transciever.o
snd-soc-ssm2602-objs := ssm2602.o snd-soc-ssm2602-objs := ssm2602.o
snd-soc-stac9766-objs := stac9766.o snd-soc-stac9766-objs := stac9766.o
...@@ -92,6 +93,7 @@ obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o ...@@ -92,6 +93,7 @@ obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o
obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o
obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o
obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o
obj-$(CONFIG_SND_SOC_ALC5623) += snd-soc-alc5623.o
obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif.o obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif.o
obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o
obj-$(CONFIG_SND_SOC_STAC9766) += snd-soc-stac9766.o obj-$(CONFIG_SND_SOC_STAC9766) += snd-soc-stac9766.o
......
This diff is collapsed.
/*
* alc5623.h -- alc562[123] ALSA Soc Audio driver
*
* Copyright 2008 Realtek Microelectronics
* Copyright 2010 Arnaud Patard <arnaud.patard@rtp-net.org>
*
* Author: flove <flove@realtek.com>
* Arnaud Patard <arnaud.patard@rtp-net.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#ifndef _ALC5623_H
#define _ALC5623_H
#define ALC5623_RESET 0x00
/* 5621 5622 5623 */
/* speaker output vol 2 2 */
/* line output vol 4 2 */
/* HP output vol 4 0 4 */
#define ALC5623_SPK_OUT_VOL 0x02
#define ALC5623_HP_OUT_VOL 0x04
#define ALC5623_MONO_AUX_OUT_VOL 0x06
#define ALC5623_AUXIN_VOL 0x08
#define ALC5623_LINE_IN_VOL 0x0A
#define ALC5623_STEREO_DAC_VOL 0x0C
#define ALC5623_MIC_VOL 0x0E
#define ALC5623_MIC_ROUTING_CTRL 0x10
#define ALC5623_ADC_REC_GAIN 0x12
#define ALC5623_ADC_REC_MIXER 0x14
#define ALC5623_SOFT_VOL_CTRL_TIME 0x16
/* ALC5623_OUTPUT_MIXER_CTRL : */
/* same remark as for reg 2 line vs speaker */
#define ALC5623_OUTPUT_MIXER_CTRL 0x1C
#define ALC5623_MIC_CTRL 0x22
#define ALC5623_DAI_CONTROL 0x34
#define ALC5623_DAI_SDP_MASTER_MODE (0 << 15)
#define ALC5623_DAI_SDP_SLAVE_MODE (1 << 15)
#define ALC5623_DAI_I2S_PCM_MODE (1 << 14)
#define ALC5623_DAI_MAIN_I2S_BCLK_POL_CTRL (1 << 7)
#define ALC5623_DAI_ADC_DATA_L_R_SWAP (1 << 5)
#define ALC5623_DAI_DAC_DATA_L_R_SWAP (1 << 4)
#define ALC5623_DAI_I2S_DL_MASK (3 << 2)
#define ALC5623_DAI_I2S_DL_32 (3 << 2)
#define ALC5623_DAI_I2S_DL_24 (2 << 2)
#define ALC5623_DAI_I2S_DL_20 (1 << 2)
#define ALC5623_DAI_I2S_DL_16 (0 << 2)
#define ALC5623_DAI_I2S_DF_PCM (3 << 0)
#define ALC5623_DAI_I2S_DF_LEFT (2 << 0)
#define ALC5623_DAI_I2S_DF_RIGHT (1 << 0)
#define ALC5623_DAI_I2S_DF_I2S (0 << 0)
#define ALC5623_STEREO_AD_DA_CLK_CTRL 0x36
#define ALC5623_COMPANDING_CTRL 0x38
#define ALC5623_PWR_MANAG_ADD1 0x3A
#define ALC5623_PWR_ADD1_MAIN_I2S_EN (1 << 15)
#define ALC5623_PWR_ADD1_ZC_DET_PD_EN (1 << 14)
#define ALC5623_PWR_ADD1_MIC1_BIAS_EN (1 << 11)
#define ALC5623_PWR_ADD1_SHORT_CURR_DET_EN (1 << 10)
#define ALC5623_PWR_ADD1_SOFTGEN_EN (1 << 8) /* rsvd on 5622 */
#define ALC5623_PWR_ADD1_DEPOP_BUF_HP (1 << 6) /* rsvd on 5622 */
#define ALC5623_PWR_ADD1_HP_OUT_AMP (1 << 5)
#define ALC5623_PWR_ADD1_HP_OUT_ENH_AMP (1 << 4) /* rsvd on 5622 */
#define ALC5623_PWR_ADD1_DEPOP_BUF_AUX (1 << 2)
#define ALC5623_PWR_ADD1_AUX_OUT_AMP (1 << 1)
#define ALC5623_PWR_ADD1_AUX_OUT_ENH_AMP (1 << 0) /* rsvd on 5622 */
#define ALC5623_PWR_MANAG_ADD2 0x3C
#define ALC5623_PWR_ADD2_LINEOUT (1 << 15) /* rt5623 */
#define ALC5623_PWR_ADD2_CLASS_AB (1 << 15) /* rt5621 */
#define ALC5623_PWR_ADD2_CLASS_D (1 << 14) /* rt5621 */
#define ALC5623_PWR_ADD2_VREF (1 << 13)
#define ALC5623_PWR_ADD2_PLL (1 << 12)
#define ALC5623_PWR_ADD2_DAC_REF_CIR (1 << 10)
#define ALC5623_PWR_ADD2_L_DAC_CLK (1 << 9)
#define ALC5623_PWR_ADD2_R_DAC_CLK (1 << 8)
#define ALC5623_PWR_ADD2_L_ADC_CLK_GAIN (1 << 7)
#define ALC5623_PWR_ADD2_R_ADC_CLK_GAIN (1 << 6)
#define ALC5623_PWR_ADD2_L_HP_MIXER (1 << 5)
#define ALC5623_PWR_ADD2_R_HP_MIXER (1 << 4)
#define ALC5623_PWR_ADD2_SPK_MIXER (1 << 3)
#define ALC5623_PWR_ADD2_MONO_MIXER (1 << 2)
#define ALC5623_PWR_ADD2_L_ADC_REC_MIXER (1 << 1)
#define ALC5623_PWR_ADD2_R_ADC_REC_MIXER (1 << 0)
#define ALC5623_PWR_MANAG_ADD3 0x3E
#define ALC5623_PWR_ADD3_MAIN_BIAS (1 << 15)
#define ALC5623_PWR_ADD3_AUXOUT_L_VOL_AMP (1 << 14)
#define ALC5623_PWR_ADD3_AUXOUT_R_VOL_AMP (1 << 13)
#define ALC5623_PWR_ADD3_SPK_OUT (1 << 12)
#define ALC5623_PWR_ADD3_HP_L_OUT_VOL (1 << 10)
#define ALC5623_PWR_ADD3_HP_R_OUT_VOL (1 << 9)
#define ALC5623_PWR_ADD3_LINEIN_L_VOL (1 << 7)
#define ALC5623_PWR_ADD3_LINEIN_R_VOL (1 << 6)
#define ALC5623_PWR_ADD3_AUXIN_L_VOL (1 << 5)
#define ALC5623_PWR_ADD3_AUXIN_R_VOL (1 << 4)
#define ALC5623_PWR_ADD3_MIC1_FUN_CTRL (1 << 3)
#define ALC5623_PWR_ADD3_MIC2_FUN_CTRL (1 << 2)
#define ALC5623_PWR_ADD3_MIC1_BOOST_AD (1 << 1)
#define ALC5623_PWR_ADD3_MIC2_BOOST_AD (1 << 0)
#define ALC5623_ADD_CTRL_REG 0x40
#define ALC5623_GLOBAL_CLK_CTRL_REG 0x42
#define ALC5623_GBL_CLK_SYS_SOUR_SEL_PLL (1 << 15)
#define ALC5623_GBL_CLK_SYS_SOUR_SEL_MCLK (0 << 15)
#define ALC5623_GBL_CLK_PLL_SOUR_SEL_BITCLK (1 << 14)
#define ALC5623_GBL_CLK_PLL_SOUR_SEL_MCLK (0 << 14)
#define ALC5623_GBL_CLK_PLL_DIV_RATIO_DIV8 (3 << 1)
#define ALC5623_GBL_CLK_PLL_DIV_RATIO_DIV4 (2 << 1)
#define ALC5623_GBL_CLK_PLL_DIV_RATIO_DIV2 (1 << 1)
#define ALC5623_GBL_CLK_PLL_DIV_RATIO_DIV1 (0 << 1)
#define ALC5623_GBL_CLK_PLL_PRE_DIV2 (1 << 0)
#define ALC5623_GBL_CLK_PLL_PRE_DIV1 (0 << 0)
#define ALC5623_PLL_CTRL 0x44
#define ALC5623_PLL_CTRL_N_VAL(n) (((n)&0xff) << 8)
#define ALC5623_PLL_CTRL_K_VAL(k) (((k)&0x7) << 4)
#define ALC5623_PLL_CTRL_M_VAL(m) ((m)&0xf)
#define ALC5623_GPIO_OUTPUT_PIN_CTRL 0x4A
#define ALC5623_GPIO_PIN_CONFIG 0x4C
#define ALC5623_GPIO_PIN_POLARITY 0x4E
#define ALC5623_GPIO_PIN_STICKY 0x50
#define ALC5623_GPIO_PIN_WAKEUP 0x52
#define ALC5623_GPIO_PIN_STATUS 0x54
#define ALC5623_GPIO_PIN_SHARING 0x56
#define ALC5623_OVER_CURR_STATUS 0x58
#define ALC5623_JACK_DET_CTRL 0x5A
#define ALC5623_MISC_CTRL 0x5E
#define ALC5623_MISC_DISABLE_FAST_VREG (1 << 15)
#define ALC5623_MISC_SPK_CLASS_AB_OC_PD (1 << 13) /* 5621 */
#define ALC5623_MISC_SPK_CLASS_AB_OC_DET (1 << 12) /* 5621 */
#define ALC5623_MISC_HP_DEPOP_MODE3_EN (1 << 10)
#define ALC5623_MISC_HP_DEPOP_MODE2_EN (1 << 9)
#define ALC5623_MISC_HP_DEPOP_MODE1_EN (1 << 8)
#define ALC5623_MISC_AUXOUT_DEPOP_MODE3_EN (1 << 6)
#define ALC5623_MISC_AUXOUT_DEPOP_MODE2_EN (1 << 5)
#define ALC5623_MISC_AUXOUT_DEPOP_MODE1_EN (1 << 4)
#define ALC5623_MISC_M_DAC_L_INPUT (1 << 3)
#define ALC5623_MISC_M_DAC_R_INPUT (1 << 2)
#define ALC5623_MISC_IRQOUT_INV_CTRL (1 << 0)
#define ALC5623_PSEDUEO_SPATIAL_CTRL 0x60
#define ALC5623_EQ_CTRL 0x62
#define ALC5623_EQ_MODE_ENABLE 0x66
#define ALC5623_AVC_CTRL 0x68
#define ALC5623_HID_CTRL_INDEX 0x6A
#define ALC5623_HID_CTRL_DATA 0x6C
#define ALC5623_VENDOR_ID1 0x7C
#define ALC5623_VENDOR_ID2 0x7E
#define ALC5623_PLL_FR_MCLK 0
#define ALC5623_PLL_FR_BCK 1
#endif
...@@ -186,7 +186,6 @@ static int wm8900_volatile_register(unsigned int reg) ...@@ -186,7 +186,6 @@ static int wm8900_volatile_register(unsigned int reg)
{ {
switch (reg) { switch (reg) {
case WM8900_REG_ID: case WM8900_REG_ID:
case WM8900_REG_POWER1:
return 1; return 1;
default: default:
return 0; return 0;
...@@ -1200,11 +1199,6 @@ static int wm8900_probe(struct snd_soc_codec *codec) ...@@ -1200,11 +1199,6 @@ static int wm8900_probe(struct snd_soc_codec *codec)
return -ENODEV; return -ENODEV;
} }
/* Read back from the chip */
reg = snd_soc_read(codec, WM8900_REG_POWER1);
reg = (reg >> 12) & 0xf;
dev_info(codec->dev, "WM8900 revision %d\n", reg);
wm8900_reset(codec); wm8900_reset(codec);
/* Turn the chip on */ /* Turn the chip on */
......
...@@ -735,6 +735,7 @@ static int class_w_put(struct snd_kcontrol *kcontrol, ...@@ -735,6 +735,7 @@ static int class_w_put(struct snd_kcontrol *kcontrol,
0); 0);
} }
wm8993->class_w_users++; wm8993->class_w_users++;
wm8993->hubs_data.class_w = true;
} }
/* Implement the change */ /* Implement the change */
...@@ -751,6 +752,7 @@ static int class_w_put(struct snd_kcontrol *kcontrol, ...@@ -751,6 +752,7 @@ static int class_w_put(struct snd_kcontrol *kcontrol,
WM8993_CP_DYN_V); WM8993_CP_DYN_V);
} }
wm8993->class_w_users--; wm8993->class_w_users--;
wm8993->hubs_data.class_w = false;
} }
dev_dbg(codec->dev, "Indirect DAC use count now %d\n", dev_dbg(codec->dev, "Indirect DAC use count now %d\n",
......
...@@ -2228,6 +2228,7 @@ static int clk_sys_event(struct snd_soc_dapm_widget *w, ...@@ -2228,6 +2228,7 @@ static int clk_sys_event(struct snd_soc_dapm_widget *w,
static void wm8994_update_class_w(struct snd_soc_codec *codec) static void wm8994_update_class_w(struct snd_soc_codec *codec)
{ {
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
int enable = 1; int enable = 1;
int source = 0; /* GCC flow analysis can't track enable */ int source = 0; /* GCC flow analysis can't track enable */
int reg, reg_r; int reg, reg_r;
...@@ -2278,11 +2279,13 @@ static void wm8994_update_class_w(struct snd_soc_codec *codec) ...@@ -2278,11 +2279,13 @@ static void wm8994_update_class_w(struct snd_soc_codec *codec)
WM8994_CP_DYN_PWR | WM8994_CP_DYN_PWR |
WM8994_CP_DYN_SRC_SEL_MASK, WM8994_CP_DYN_SRC_SEL_MASK,
source | WM8994_CP_DYN_PWR); source | WM8994_CP_DYN_PWR);
wm8994->hubs.class_w = true;
} else { } else {
dev_dbg(codec->dev, "Class W disabled\n"); dev_dbg(codec->dev, "Class W disabled\n");
snd_soc_update_bits(codec, WM8994_CLASS_W_1, snd_soc_update_bits(codec, WM8994_CLASS_W_1,
WM8994_CP_DYN_PWR, 0); WM8994_CP_DYN_PWR, 0);
wm8994->hubs.class_w = false;
} }
} }
......
...@@ -94,6 +94,18 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec) ...@@ -94,6 +94,18 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec)
struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
u16 reg, reg_l, reg_r, dcs_cfg; u16 reg, reg_l, reg_r, dcs_cfg;
/* If we're using a digital only path and have a previously
* callibrated DC servo offset stored then use that. */
if (hubs->class_w && hubs->class_w_dcs) {
dev_dbg(codec->dev, "Using cached DC servo offset %x\n",
hubs->class_w_dcs);
snd_soc_write(codec, WM8993_DC_SERVO_3, hubs->class_w_dcs);
wait_for_dc_servo(codec,
WM8993_DCS_TRIG_DAC_WR_0 |
WM8993_DCS_TRIG_DAC_WR_1);
return;
}
/* Set for 32 series updates */ /* Set for 32 series updates */
snd_soc_update_bits(codec, WM8993_DC_SERVO_1, snd_soc_update_bits(codec, WM8993_DC_SERVO_1,
WM8993_DCS_SERIES_NO_01_MASK, WM8993_DCS_SERIES_NO_01_MASK,
...@@ -101,34 +113,34 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec) ...@@ -101,34 +113,34 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec)
wait_for_dc_servo(codec, wait_for_dc_servo(codec,
WM8993_DCS_TRIG_SERIES_0 | WM8993_DCS_TRIG_SERIES_1); WM8993_DCS_TRIG_SERIES_0 | WM8993_DCS_TRIG_SERIES_1);
/* Different chips in the family support different readback
* methods.
*/
switch (hubs->dcs_readback_mode) {
case 0:
reg_l = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_1)
& WM8993_DCS_INTEG_CHAN_0_MASK;;
reg_r = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_2)
& WM8993_DCS_INTEG_CHAN_1_MASK;
break;
case 1:
reg = snd_soc_read(codec, WM8993_DC_SERVO_3);
reg_l = (reg & WM8993_DCS_DAC_WR_VAL_1_MASK)
>> WM8993_DCS_DAC_WR_VAL_1_SHIFT;
reg_r = reg & WM8993_DCS_DAC_WR_VAL_0_MASK;
break;
default:
WARN(1, "Unknown DCS readback method\n");
break;
}
dev_dbg(codec->dev, "DCS input: %x %x\n", reg_l, reg_r);
/* Apply correction to DC servo result */ /* Apply correction to DC servo result */
if (hubs->dcs_codes) { if (hubs->dcs_codes) {
dev_dbg(codec->dev, "Applying %d code DC servo correction\n", dev_dbg(codec->dev, "Applying %d code DC servo correction\n",
hubs->dcs_codes); hubs->dcs_codes);
/* Different chips in the family support different
* readback methods.
*/
switch (hubs->dcs_readback_mode) {
case 0:
reg_l = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_1)
& WM8993_DCS_INTEG_CHAN_0_MASK;;
reg_r = snd_soc_read(codec, WM8993_DC_SERVO_READBACK_2)
& WM8993_DCS_INTEG_CHAN_1_MASK;
break;
case 1:
reg = snd_soc_read(codec, WM8993_DC_SERVO_3);
reg_l = (reg & WM8993_DCS_DAC_WR_VAL_1_MASK)
>> WM8993_DCS_DAC_WR_VAL_1_SHIFT;
reg_r = reg & WM8993_DCS_DAC_WR_VAL_0_MASK;
break;
default:
WARN(1, "Unknown DCS readback method");
break;
}
dev_dbg(codec->dev, "DCS input: %x %x\n", reg_l, reg_r);
/* HPOUT1L */ /* HPOUT1L */
if (reg_l + hubs->dcs_codes > 0 && if (reg_l + hubs->dcs_codes > 0 &&
reg_l + hubs->dcs_codes < 0xff) reg_l + hubs->dcs_codes < 0xff)
...@@ -148,7 +160,15 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec) ...@@ -148,7 +160,15 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec)
wait_for_dc_servo(codec, wait_for_dc_servo(codec,
WM8993_DCS_TRIG_DAC_WR_0 | WM8993_DCS_TRIG_DAC_WR_0 |
WM8993_DCS_TRIG_DAC_WR_1); WM8993_DCS_TRIG_DAC_WR_1);
} else {
dcs_cfg = reg_l << WM8993_DCS_DAC_WR_VAL_1_SHIFT;
dcs_cfg |= reg_r;
} }
/* Save the callibrated offset if we're in class W mode and
* therefore don't have any analogue signal mixed in. */
if (hubs->class_w)
hubs->class_w_dcs = dcs_cfg;
} }
/* /*
...@@ -163,6 +183,9 @@ static int wm8993_put_dc_servo(struct snd_kcontrol *kcontrol, ...@@ -163,6 +183,9 @@ static int wm8993_put_dc_servo(struct snd_kcontrol *kcontrol,
ret = snd_soc_put_volsw_2r(kcontrol, ucontrol); ret = snd_soc_put_volsw_2r(kcontrol, ucontrol);
/* Updating the analogue gains invalidates the DC servo cache */
hubs->class_w_dcs = 0;
/* If we're applying an offset correction then updating the /* If we're applying an offset correction then updating the
* callibration would be likely to introduce further offsets. */ * callibration would be likely to introduce further offsets. */
if (hubs->dcs_codes) if (hubs->dcs_codes)
......
...@@ -23,6 +23,9 @@ struct wm_hubs_data { ...@@ -23,6 +23,9 @@ struct wm_hubs_data {
int dcs_codes; int dcs_codes;
int dcs_readback_mode; int dcs_readback_mode;
int hp_startup_mode; int hp_startup_mode;
bool class_w;
u16 class_w_dcs;
}; };
extern int wm_hubs_add_analogue_controls(struct snd_soc_codec *); extern int wm_hubs_add_analogue_controls(struct snd_soc_codec *);
......
...@@ -18,3 +18,12 @@ config SND_KIRKWOOD_SOC_OPENRD ...@@ -18,3 +18,12 @@ config SND_KIRKWOOD_SOC_OPENRD
Say Y if you want to add support for SoC audio on Say Y if you want to add support for SoC audio on
Openrd Client. Openrd Client.
config SND_KIRKWOOD_SOC_T5325
tristate "SoC Audio support for HP t5325"
depends on SND_KIRKWOOD_SOC && MACH_T5325
select SND_KIRKWOOD_SOC_I2S
select SND_SOC_ALC5623
help
Say Y if you want to add support for SoC audio on
the HP t5325 thin client.
...@@ -5,5 +5,7 @@ obj-$(CONFIG_SND_KIRKWOOD_SOC) += snd-soc-kirkwood.o ...@@ -5,5 +5,7 @@ obj-$(CONFIG_SND_KIRKWOOD_SOC) += snd-soc-kirkwood.o
obj-$(CONFIG_SND_KIRKWOOD_SOC_I2S) += snd-soc-kirkwood-i2s.o obj-$(CONFIG_SND_KIRKWOOD_SOC_I2S) += snd-soc-kirkwood-i2s.o
snd-soc-openrd-objs := kirkwood-openrd.o snd-soc-openrd-objs := kirkwood-openrd.o
snd-soc-t5325-objs := kirkwood-t5325.o
obj-$(CONFIG_SND_KIRKWOOD_SOC_OPENRD) += snd-soc-openrd.o obj-$(CONFIG_SND_KIRKWOOD_SOC_OPENRD) += snd-soc-openrd.o
obj-$(CONFIG_SND_KIRKWOOD_SOC_T5325) += snd-soc-t5325.o
/*
* kirkwood-t5325.c
*
* (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <mach/kirkwood.h>
#include <plat/audio.h>
#include <asm/mach-types.h>
#include "../codecs/alc5623.h"
static int t5325_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int ret;
unsigned int freq, fmt;
fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS;
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
if (ret < 0)
return ret;
ret = snd_soc_dai_set_fmt(codec_dai, fmt);
if (ret < 0)
return ret;
freq = params_rate(params) * 256;
return snd_soc_dai_set_sysclk(codec_dai, 0, freq, SND_SOC_CLOCK_IN);
}
static struct snd_soc_ops t5325_ops = {
.hw_params = t5325_hw_params,
};
static const struct snd_soc_dapm_widget t5325_dapm_widgets[] = {
SND_SOC_DAPM_HP("Headphone Jack", NULL),
SND_SOC_DAPM_SPK("Speaker", NULL),
SND_SOC_DAPM_MIC("Mic Jack", NULL),
};
static const struct snd_soc_dapm_route t5325_route[] = {
{ "Headphone Jack", NULL, "HPL" },
{ "Headphone Jack", NULL, "HPR" },
{"Speaker", NULL, "SPKOUT"},
{"Speaker", NULL, "SPKOUTN"},
{ "MIC1", NULL, "Mic Jack" },
{ "MIC2", NULL, "Mic Jack" },
};
static int t5325_dai_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
snd_soc_dapm_new_controls(codec, t5325_dapm_widgets,
ARRAY_SIZE(t5325_dapm_widgets));
snd_soc_dapm_add_routes(codec, t5325_route, ARRAY_SIZE(t5325_route));
snd_soc_dapm_enable_pin(codec, "Mic Jack");
snd_soc_dapm_enable_pin(codec, "Headphone Jack");
snd_soc_dapm_enable_pin(codec, "Speaker");
snd_soc_dapm_sync(codec);
return 0;
}
static struct snd_soc_dai_link t5325_dai[] = {
{
.name = "ALC5621",
.stream_name = "ALC5621 HiFi",
.cpu_dai_name = "kirkwood-i2s",
.platform_name = "kirkwood-pcm-audio",
.codec_dai_name = "alc5621-hifi",
.codec_name = "alc562x-codec.0-001a",
.ops = &t5325_ops,
.init = t5325_dai_init,
},
};
static struct snd_soc_card t5325 = {
.name = "t5325",
.dai_link = t5325_dai,
.num_links = ARRAY_SIZE(t5325_dai),
};
static struct platform_device *t5325_snd_device;
static int __init t5325_init(void)
{
int ret;
if (!machine_is_t5325())
return 0;
t5325_snd_device = platform_device_alloc("soc-audio", -1);
if (!t5325_snd_device)
return -ENOMEM;
platform_set_drvdata(t5325_snd_device,
&t5325);
ret = platform_device_add(t5325_snd_device);
if (ret) {
printk(KERN_ERR "%s: platform_device_add failed\n", __func__);
platform_device_put(t5325_snd_device);
}
return ret;
}
module_init(t5325_init);
static void __exit t5325_exit(void)
{
platform_device_unregister(t5325_snd_device);
}
module_exit(t5325_exit);
MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
MODULE_DESCRIPTION("ALSA SoC t5325 audio client");
MODULE_LICENSE("GPL");
...@@ -79,7 +79,7 @@ static void tosa_ext_control(struct snd_soc_codec *codec) ...@@ -79,7 +79,7 @@ static void tosa_ext_control(struct snd_soc_codec *codec)
static int tosa_startup(struct snd_pcm_substream *substream) static int tosa_startup(struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_codec *codec = rtd->card->codec; struct snd_soc_codec *codec = rtd->codec;
/* check the jack status at stream startup */ /* check the jack status at stream startup */
tosa_ext_control(codec); tosa_ext_control(codec);
......
...@@ -165,8 +165,11 @@ static ssize_t pmdown_time_set(struct device *dev, ...@@ -165,8 +165,11 @@ static ssize_t pmdown_time_set(struct device *dev,
{ {
struct snd_soc_pcm_runtime *rtd = struct snd_soc_pcm_runtime *rtd =
container_of(dev, struct snd_soc_pcm_runtime, dev); container_of(dev, struct snd_soc_pcm_runtime, dev);
int ret;
strict_strtol(buf, 10, &rtd->pmdown_time); ret = strict_strtol(buf, 10, &rtd->pmdown_time);
if (ret)
return ret;
return count; return count;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment