[PATCH v12 2/2] iio: magnetometer: Add mmc5633 sensor

Jonathan Cameron jic23 at kernel.org
Sun Dec 21 11:13:16 PST 2025


On Mon, 15 Dec 2025 11:51:11 -0500
Frank Li <Frank.Li at nxp.com> wrote:

> Add mmc5633 sensor basic support.
> - Support read 20 bits X/Y/Z magnetic.
> - Support I3C HDR mode to send start measurememt command.
> - Support I3C HDR mode to read all sensors data by one command.
> 
> Co-developed-by: Carlos Song <carlos.song at nxp.com>
> Signed-off-by: Carlos Song <carlos.song at nxp.com>
> Co-developed-by: Adrian Fluturel <fluturel.adrian at gmail.com>
> Signed-off-by: Adrian Fluturel <fluturel.adrian at gmail.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko at intel.com>
> Signed-off-by: Frank Li <Frank.Li at nxp.com>

drivers/iio/magnetometer/mmc5633.c:87:5: warning: symbol 'mmc5633_samp_freq' was not declared. Should it be static?
(I fixed up)

With that and the trivial stuff below tidied up whilst applying, applied to the togreg
branch of iio.git. I'll initially push out as testing however to let the
bots take a first look before I annoy linux-next 

Jonathan


> diff --git a/drivers/iio/magnetometer/mmc5633.c b/drivers/iio/magnetometer/mmc5633.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..7b20ff3b063b026ab2ae0170fd8c021973428dea
> --- /dev/null
> +++ b/drivers/iio/magnetometer/mmc5633.c

> +static int mmc5633_write_raw(struct iio_dev *indio_dev,
> +			     struct iio_chan_spec const *chan, int val,
> +			     int val2, long mask)
> +{
> +	struct mmc5633_data *data = iio_priv(indio_dev);
> +	int ret;
> +
> +	switch (mask) {
> +	case IIO_CHAN_INFO_SAMP_FREQ:

This is the missing scope thing from the bot report.  {}
needed in a switch to define scope for local variables like the one guard()
is using under the hood.

> +		ret = mmc5633_get_samp_freq_index(data, val, val2);
> +		if (ret < 0)
> +			return ret;
> +
> +		guard(mutex)(&data->mutex);
> +
> +		return regmap_update_bits(data->regmap, MMC5633_REG_CTRL1,
> +					  MMC5633_CTRL1_BW_MASK,
> +					  FIELD_PREP(MMC5633_CTRL1_BW_MASK, ret));
> +	default:
> +		return -EINVAL;
> +	}
> +}

> +
> +static struct i2c_driver mmc5633_i2c_driver = {
> +	.driver = {
> +		.name = "mmc5633_i2c",
> +		.of_match_table = mmc5633_of_match,
> +		.pm = pm_sleep_ptr(&mmc5633_pm_ops),
> +	},
> +	.probe = mmc5633_i2c_probe,
> +	.id_table =  mmc5633_i2c_id,
Bonus space after =

> +};



More information about the linux-i3c mailing list