[PATCH 1/2] pinctrl: sx150x: don't clobber the oscillator source when driving OSCIO
From: Dean Sellers
Date: Wed Nov 18 2026 - 02:03:19 EST
On the 789 models, sx150x_gpio_oscio_set() drives the OSCIO pin as a
static output by writing the whole of RegClock. Only bits [4:0] belong
to OSCIO: bit 4 selects output, and [3:0] select the OSCOUT frequency,
where 0xf is a static high and 0x0 a static low. Bits [6:5] select the
fOSC source, and writing them as 00 turns the oscillator off.
fOSC clocks the input debouncer, the keypad scanner and the LED driver.
The driver does not configure any of those today, but anything that
does, whether firmware or a later driver change, is silently switched
off the first time a consumer drives OSCIO.
Update only bits [4:0].
Fixes: 9e80f9064e73 ("pinctrl: Add SX150X GPIO Extender Pinctrl Driver")
Signed-off-by: Dean Sellers <dean@xxxxxxxxxxxxx>
---
drivers/pinctrl/pinctrl-sx150x.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-sx150x.c b/drivers/pinctrl/pinctrl-sx150x.c
index 04a0e6269e5b..c97e9bc3a33f 100644
--- a/drivers/pinctrl/pinctrl-sx150x.c
+++ b/drivers/pinctrl/pinctrl-sx150x.c
@@ -427,9 +427,14 @@ static int __sx150x_gpio_set(struct sx150x_pinctrl *pctl, unsigned int offset,
static int sx150x_gpio_oscio_set(struct sx150x_pinctrl *pctl,
int value)
{
- return regmap_write(pctl->regmap,
- pctl->data->pri.x789.reg_clock,
- (value ? 0x1f : 0x10));
+ /*
+ * RegClock[4] makes OSCIO an output and [3:0] set OSCOUT, where
+ * 0xf is a static high and 0x0 a static low. Leave the oscillator
+ * source in [6:5] alone.
+ */
+ return regmap_write_bits(pctl->regmap,
+ pctl->data->pri.x789.reg_clock, 0x1f,
+ value ? 0x1f : 0x10);
}
static int sx150x_gpio_set(struct gpio_chip *chip, unsigned int offset,
--
2.43.0