20 Dec
2011
20 Dec
'11
1:39 a.m.
On Mon, Dec 19, 2011 at 01:53:30PM -0500, Michael Williamson wrote:
+/* DSD1791 register cache (16 through 23 are used) */ +static const u8 dsd1791_reg[] = {
- [16] = 0xFF,
- [17] = 0xFF,
- [18] = 0x50,
- [19] = 0x00,
- [20] = 0x00,
- [21] = 0x01,
- [22] = 0x00,
- [23] = 0x00,
+};
Use the regmap API.
- reg = snd_soc_read(codec, DSD1791_REG_AUDFMT);
- reg &= ~(DSD1791_FMT_MASK);
- reg |= fmt;
- return snd_soc_write(codec, DSD1791_REG_AUDFMT, reg);
snd_soc_update_bits().
+static const struct snd_kcontrol_new dsd1791_snd_controls[] = {
- SOC_SINGLE("Left Playback Volume", DSD1791_REG_DIGATT_L, 0, 255, 0),
- SOC_SINGLE("Right Playback Volume", DSD1791_REG_DIGATT_R, 0, 255, 0),
This should be a single stereo control and you should supply dB data.
- /* enable attenuation control */
- reg = snd_soc_read(codec, DSD1791_REG_AUDFMT);
- reg |= 0x80;
- snd_soc_write(codec, DSD1791_REG_AUDFMT, reg);
This should probably be runtime controllable, or if it's got a good reason for not being it should be using snd_soc_update_bits().
- snd_soc_add_controls(codec, dsd1791_snd_controls,
ARRAY_SIZE(dsd1791_snd_controls));
Initialize the controls from the driver.