Skip to content

Commit 68ea788

Browse files
committed
drivers: wm8904: Fix audio input configuration
Change erroneous mask in wm8904_volume_config. Extend WM8904_REGVAL_INSEL. Unflip register mask and value parameters. Signed-off-by: Vit Stanicek <[email protected]>
1 parent ab7dd9b commit 68ea788

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

drivers/audio/wm8904.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,17 @@ static int wm8904_in_update(
264264
static int wm8904_in_volume_config(const struct device *dev, audio_channel_t channel, int volume)
265265
{
266266
const uint16_t val = WM8904_REGVAL_IN_VOL(0, volume);
267-
const uint16_t mask = WM8904_REGMASK_IN_MUTE;
267+
const uint16_t mask = WM8904_REGMASK_IN_VOLUME;
268268

269-
return wm8904_in_update(dev, channel, val, mask);
269+
return wm8904_in_update(dev, channel, mask, val);
270270
}
271271

272272
static int wm8904_in_mute_config(const struct device *dev, audio_channel_t channel, bool mute)
273273
{
274274
const uint16_t val = WM8904_REGVAL_IN_VOL(mute, 0);
275275
const uint16_t mask = WM8904_REGMASK_IN_MUTE;
276276

277-
return wm8904_in_update(dev, channel, val, mask);
277+
return wm8904_in_update(dev, channel, mask, val);
278278
}
279279

280280
static int wm8904_route_input(const struct device *dev, audio_channel_t channel, uint32_t input)

drivers/audio/wm8904.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
* [1:0] - x_MODE: Input mode
103103
*/
104104
#define WM8904_REGVAL_INSEL(cm, nin, pin, mode) \
105-
(((cm) & 0b1) << 6) | (((nin) & 0b11) << 4)
105+
(((cm) & 0b1) << 6) | (((nin) & 0b11) << 4) | (((pin) & 0b11) << 2)
106106
#define WM8904_REGMASK_INSEL_CMENA 0b01000000
107107
#define WM8904_REGMASK_INSEL_IP_SEL_N 0b00110000
108108
#define WM8904_REGMASK_INSEL_IP_SEL_P 0b00001100

0 commit comments

Comments
 (0)