Skip to contentSkip to conversation

patch "iio: potentiometer: mcp4131: fix double application of wiper shift" added to char-misc-linus

PATCH [email protected] 1 participant 1 message Feb 26

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

iio: potentiometer: mcp4131: fix double application of wiper shift

to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From 85e4614524dca6c0a43874f475a17de2b9725648 Mon Sep 17 00:00:00 2001
From: Lukas Schmid <[email protected]>
Date: Mon, 2 Feb 2026 21:15:35 +0100
Subject: iio: potentiometer: mcp4131: fix double application of wiper shift

The MCP4131 wiper address is shifted twice when preparing the SPI command in mcp4131_write_raw().

The address is already shifted when assigned to the local variable "address", but is then shifted again when written to data->buf[0]. This results in an incorrect command being sent to the device and breaks wiper writes to the second channel.

Remove the second shift and use the pre-shifted address directly when composing the SPI transfer.

Fixes 22d199a53910 ("iio: potentiometer: add driver for Microchip MCP413X/414X/415X/416X/423X/424X/425X/426X")
---
 drivers/iio/potentiometer/mcp4131.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/potentiometer/mcp4131.c +1 -1
index ad082827aad5..56c9111ef5e8 100644
@@ -221,7 +221,7 @@ static int mcp4131_write_raw(struct iio_dev *indio_dev,
 
 	mutex_lock(&data->lock);
 
-	data->buf[0] = address << MCP4131_WIPER_SHIFT;
+	data->buf[0] = address;
 	data->buf[0] |= MCP4131_WRITE | (val >> 8);
 	data->buf[1] = val & 0xFF; /* 8 bits here */
 
Signature · 1 line
2.53.0