Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 293185
b: refs/heads/master
c: 9b85fc9
h: refs/heads/master
i:
  293183: 87c198d
v: v3
  • Loading branch information
Mark Brown committed Jan 20, 2012
1 parent 9449fc4 commit 1d0dc2f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3b09bb820dda209d5c81e329420ccf36dd30c8eb
refs/heads/master: 9b85fc90634972634a229aaa1c94f8c9a50fddbc
31 changes: 30 additions & 1 deletion trunk/sound/soc/codecs/wm8904.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ static bool wm8904_readable_register(struct device *dev, unsigned int reg)
case WM8904_EQ23:
case WM8904_EQ24:
case WM8904_CONTROL_INTERFACE_TEST_1:
case WM8904_ADC_TEST_0:
case WM8904_ANALOGUE_OUTPUT_BIAS_0:
case WM8904_FLL_NCO_TEST_0:
case WM8904_FLL_NCO_TEST_1:
Expand Down Expand Up @@ -569,6 +570,29 @@ static const char *hpf_mode_text[] = {
static const struct soc_enum hpf_mode =
SOC_ENUM_SINGLE(WM8904_ADC_DIGITAL_0, 5, 4, hpf_mode_text);

static int wm8904_adc_osr_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
unsigned int val;
int ret;

ret = snd_soc_put_volsw(kcontrol, ucontrol);
if (ret < 0)
return ret;

if (ucontrol->value.integer.value[0])
val = 0;
else
val = WM8904_ADC_128_OSR_TST_MODE | WM8904_ADC_BIASX1P5;

snd_soc_update_bits(codec, WM8904_ADC_TEST_0,
WM8904_ADC_128_OSR_TST_MODE | WM8904_ADC_BIASX1P5,
val);

return ret;
}

static const struct snd_kcontrol_new wm8904_adc_snd_controls[] = {
SOC_DOUBLE_R_TLV("Digital Capture Volume", WM8904_ADC_DIGITAL_VOLUME_LEFT,
WM8904_ADC_DIGITAL_VOLUME_RIGHT, 1, 119, 0, digital_tlv),
Expand All @@ -585,7 +609,12 @@ SOC_DOUBLE_R("Capture Switch", WM8904_ANALOGUE_LEFT_INPUT_0,
SOC_SINGLE("High Pass Filter Switch", WM8904_ADC_DIGITAL_0, 4, 1, 0),
SOC_ENUM("High Pass Filter Mode", hpf_mode),

SOC_SINGLE("ADC 128x OSR Switch", WM8904_ANALOGUE_ADC_0, 0, 1, 0),
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "ADC 128x OSR Switch",
.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,
.put = wm8904_adc_osr_put,
.private_value = SOC_SINGLE_VALUE(WM8904_ANALOGUE_ADC_0, 0, 1, 0),
},
};

static const char *drc_path_text[] = {
Expand Down
11 changes: 11 additions & 0 deletions trunk/sound/soc/codecs/wm8904.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
#define WM8904_EQ23 0x9C
#define WM8904_EQ24 0x9D
#define WM8904_CONTROL_INTERFACE_TEST_1 0xA1
#define WM8904_ADC_TEST_0 0xC6
#define WM8904_ANALOGUE_OUTPUT_BIAS_0 0xCC
#define WM8904_FLL_NCO_TEST_0 0xF7
#define WM8904_FLL_NCO_TEST_1 0xF8
Expand Down Expand Up @@ -1556,6 +1557,16 @@
#define WM8904_USER_KEY_SHIFT 1 /* USER_KEY */
#define WM8904_USER_KEY_WIDTH 1 /* USER_KEY */

/*
* R198 (0xC6) - ADC Test 0
*/
#define WM8904_ADC_128_OSR_TST_MODE 0x0004 /* ADC_128_OSR_TST_MODE */
#define WM8904_ADC_128_OSR_TST_MODE_SHIFT 2 /* ADC_128_OSR_TST_MODE */
#define WM8904_ADC_128_OSR_TST_MODE_WIDTH 1 /* ADC_128_OSR_TST_MODE */
#define WM8904_ADC_BIASX1P5 0x0001 /* ADC_BIASX1P5 */
#define WM8904_ADC_BIASX1P5_SHIFT 0 /* ADC_BIASX1P5 */
#define WM8904_ADC_BIASX1P5_WIDTH 1 /* ADC_BIASX1P5 */

/*
* R204 (0xCC) - Analogue Output Bias 0
*/
Expand Down

0 comments on commit 1d0dc2f

Please sign in to comment.