Skip to content

Commit

Permalink
drivers: wm8904: Fix audio input configuration
Browse files Browse the repository at this point in the history
Change erroneous mask in wm8904_volume_config. Extend
WM8904_REGVAL_INSEL. Unflip register mask and value parameters.

Signed-off-by: Vit Stanicek <[email protected]>
  • Loading branch information
VitekST authored and kartben committed Feb 18, 2025
1 parent 6c3b617 commit 5a31ac1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions drivers/audio/wm8904.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,17 +264,17 @@ 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)
{
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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/audio/wm8904.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5a31ac1

Please sign in to comment.