Commit 5a31ac1d authored by Vit Stanicek's avatar Vit Stanicek Committed by Benjamin Cabé
Browse files

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: default avatarVit Stanicek <vit.stanicek@nxp.com>
parent 6c3b617b
Loading
Loading
Loading
Loading
+3 −3
Changes for drivers/audio/wm8904.c: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -264,9 +264,9 @@ static int wm8904_in_update(
static int wm8904_in_volume_config(const struct device *dev, audio_channel_t channel, int volume)
{
	const uint16_t val = WM8904_REGVAL_IN_VOL(0, volume);
	const uint16_t mask = WM8904_REGMASK_IN_MUTE;
	const uint16_t mask = WM8904_REGMASK_IN_VOLUME;

	return wm8904_in_update(dev, channel, val, mask);
	return wm8904_in_update(dev, channel, mask, val);
}

static int wm8904_in_mute_config(const struct device *dev, audio_channel_t channel, bool mute)
@@ -274,7 +274,7 @@ static int wm8904_in_mute_config(const struct device *dev, audio_channel_t chann
	const uint16_t val = WM8904_REGVAL_IN_VOL(mute, 0);
	const uint16_t mask = WM8904_REGMASK_IN_MUTE;

	return wm8904_in_update(dev, channel, val, mask);
	return wm8904_in_update(dev, channel, mask, val);
}

static int wm8904_route_input(const struct device *dev, audio_channel_t channel, uint32_t input)
+1 −1
Changes for drivers/audio/wm8904.h: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@
 * [1:0] - x_MODE: Input mode
 */
#define WM8904_REGVAL_INSEL(cm, nin, pin, mode) \
	(((cm) & 0b1) << 6) | (((nin) & 0b11) << 4)
	(((cm) & 0b1) << 6) | (((nin) & 0b11) << 4) | (((pin) & 0b11) << 2)
#define WM8904_REGMASK_INSEL_CMENA		0b01000000
#define WM8904_REGMASK_INSEL_IP_SEL_N	0b00110000
#define WM8904_REGMASK_INSEL_IP_SEL_P	0b00001100