diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-10-23 17:01:17 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-10-23 17:01:17 +0200 |
commit | b11bdb5254ff17cb63e4ae5088b73fdcd2cc2602 (patch) | |
tree | b5d57f358bf83d31ccdad3604b4a6e82a47ff612 /sound/soc/codecs | |
parent | 4428bc0990ba545e2ef0dea8ec1b90c256b22958 (diff) | |
parent | 84eae18c867fcb7ce43d5830e23377ed33e45df9 (diff) | |
download | linux-b11bdb5254ff17cb63e4ae5088b73fdcd2cc2602.tar.gz linux-b11bdb5254ff17cb63e4ae5088b73fdcd2cc2602.tar.xz |
Merge branch 'for-2.6.37' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/asoc-2.6 into topic/asoc
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r-- | sound/soc/codecs/tlv320dac33.c | 28 | ||||
-rw-r--r-- | sound/soc/codecs/tpa6130a2.c | 28 |
2 files changed, 46 insertions, 10 deletions
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index bf6d01f4a45a..d251ff54a2d3 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c @@ -524,6 +524,22 @@ static const struct soc_enum dac33_fifo_mode_enum = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(dac33_fifo_mode_texts), dac33_fifo_mode_texts); +/* L/R Line Output Gain */ +static const char *lr_lineout_gain_texts[] = { + "Line -12dB DAC 0dB", "Line -6dB DAC 6dB", + "Line 0dB DAC 12dB", "Line 6dB DAC 18dB", +}; + +static const struct soc_enum l_lineout_gain_enum = + SOC_ENUM_SINGLE(DAC33_LDAC_PWR_CTRL, 0, + ARRAY_SIZE(lr_lineout_gain_texts), + lr_lineout_gain_texts); + +static const struct soc_enum r_lineout_gain_enum = + SOC_ENUM_SINGLE(DAC33_RDAC_PWR_CTRL, 0, + ARRAY_SIZE(lr_lineout_gain_texts), + lr_lineout_gain_texts); + /* * DACL/R digital volume control: * from 0 dB to -63.5 in 0.5 dB steps @@ -541,6 +557,8 @@ static const struct snd_kcontrol_new dac33_snd_controls[] = { DAC33_LDAC_DIG_VOL_CTRL, DAC33_RDAC_DIG_VOL_CTRL, 7, 1, 1), SOC_DOUBLE_R("Line to Line Out Volume", DAC33_LINEL_TO_LLO_VOL, DAC33_LINER_TO_RLO_VOL, 0, 127, 1), + SOC_ENUM("Left Line Output Gain", l_lineout_gain_enum), + SOC_ENUM("Right Line Output Gain", r_lineout_gain_enum), }; static const struct snd_kcontrol_new dac33_mode_snd_controls[] = { @@ -651,6 +669,7 @@ static int dac33_set_bias_level(struct snd_soc_codec *codec, static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33) { struct snd_soc_codec *codec = dac33->codec; + unsigned int delay; switch (dac33->fifo_mode) { case DAC33_FIFO_MODE1: @@ -666,8 +685,9 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33) dac33_write16(codec, DAC33_PREFILL_MSB, DAC33_THRREG(dac33->alarm_threshold)); /* Enable Alarm Threshold IRQ with a delay */ - udelay(SAMPLES_TO_US(dac33->burst_rate, - dac33->alarm_threshold)); + delay = SAMPLES_TO_US(dac33->burst_rate, + dac33->alarm_threshold) + 1000; + usleep_range(delay, delay + 500); dac33_write(codec, DAC33_FIFO_IRQ_MASK, DAC33_MAT); break; case DAC33_FIFO_MODE7: @@ -767,11 +787,11 @@ static irqreturn_t dac33_interrupt_handler(int irq, void *dev) static void dac33_oscwait(struct snd_soc_codec *codec) { - int timeout = 20; + int timeout = 60; u8 reg; do { - msleep(1); + usleep_range(1000, 2000); dac33_read(codec, DAC33_INT_OSC_STATUS, ®); } while (((reg & 0x03) != DAC33_OSCSTATUS_NORMAL) && timeout--); if ((reg & 0x03) != DAC33_OSCSTATUS_NORMAL) diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 99b70e5978a2..329acc1a2074 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c @@ -98,16 +98,21 @@ static u8 tpa6130a2_read(int reg) return data->regs[reg]; } -static void tpa6130a2_initialize(void) +static int tpa6130a2_initialize(void) { struct tpa6130a2_data *data; - int i; + int i, ret = 0; BUG_ON(tpa6130a2_client == NULL); data = i2c_get_clientdata(tpa6130a2_client); - for (i = 1; i < TPA6130A2_REG_VERSION; i++) - tpa6130a2_i2c_write(i, data->regs[i]); + for (i = 1; i < TPA6130A2_REG_VERSION; i++) { + ret = tpa6130a2_i2c_write(i, data->regs[i]); + if (ret < 0) + break; + } + + return ret; } static int tpa6130a2_power(int power) @@ -133,7 +138,16 @@ static int tpa6130a2_power(int power) } data->power_state = 1; - tpa6130a2_initialize(); + ret = tpa6130a2_initialize(); + if (ret < 0) { + dev_err(&tpa6130a2_client->dev, + "Failed to initialize chip\n"); + if (data->power_gpio >= 0) + gpio_set_value(data->power_gpio, 0); + regulator_disable(data->supply); + data->power_state = 0; + goto exit; + } /* Clear SWS */ val = tpa6130a2_read(TPA6130A2_REG_CONTROL); @@ -375,7 +389,9 @@ int tpa6130a2_add_controls(struct snd_soc_codec *codec) { struct tpa6130a2_data *data; - BUG_ON(tpa6130a2_client == NULL); + if (tpa6130a2_client == NULL) + return -ENODEV; + data = i2c_get_clientdata(tpa6130a2_client); snd_soc_dapm_new_controls(codec, tpa6130a2_dapm_widgets, |