Re: [PATCH 4/5] regulator: Support regulators where the voltage selector spans two registers
From: Mark Brown
Date: Thu Oct 22 2026 - 13:21:48 EST
On Wed, Oct 21, 2026 at 12:27:45PM +0200, Paul Louvel wrote:
> Some devices uses 8-bit registers to store the voltage selector across
> two registers: one for the least significant bits and one for the most
> significant bits.
> +static int set_oversize_voltage_sel(struct regulator_dev *rdev, unsigned int sel)
> +{
> + int val_bytes = regmap_get_val_bytes(rdev->regmap);
> + __le16 val;
> +
> + if (val_bytes != 1)
> + return -EINVAL;
> +
> + val = cpu_to_le16(sel);
> +
> + return regmap_bulk_write(rdev->regmap, rdev->desc->vsel_reg, &val, 2);
> +}
This ignores the shift and mask but the get still pays attention to them
due to code sharing. Either there should be checks that reject them
like we have for val_bytes or there should be a read/modify/write here,
obviously the former is much easier and that'd be totally fine. IIRC
there's some existing drivers we could convert but that's a separate
thing.
Attachment:
signature.asc
Description: PGP signature