iio: accel: mc3230: add mc3510c support

This change integrates mc3510c support into the mc3230 driver.
MC3510C uses the same registers as MC3230, but a different value scale.

Tested on Huawei MediaPad T3 10 (huawei-agassi)

Signed-off-by: Vasiliy Doylov <nekodevelopper@gmail.com>
Link: https://patch.msgid.link/20250116-mainlining-mc3510c-v4-5-a41308b85ec2@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Vasiliy Doylov 2025-01-16 16:52:46 +03:00 committed by Jonathan Cameron
parent 4e78ce08db
commit d438fc93ca

View File

@ -46,6 +46,14 @@ static const struct mc3230_chip_info mc3230_chip_info = {
.scale = 115411765,
};
static const struct mc3230_chip_info mc3510c_chip_info = {
.name = "mc3510c",
.chip_id = 0x23,
.product_code = 0x10,
/* Was obtained empirically */
.scale = 625000000,
};
#define MC3230_CHANNEL(reg, axis) { \
.type = IIO_ACCEL, \
.address = reg, \
@ -225,12 +233,14 @@ static DEFINE_SIMPLE_DEV_PM_OPS(mc3230_pm_ops, mc3230_suspend, mc3230_resume);
static const struct i2c_device_id mc3230_i2c_id[] = {
{ "mc3230", (kernel_ulong_t)&mc3230_chip_info },
{ "mc3510c", (kernel_ulong_t)&mc3510c_chip_info },
{ }
};
MODULE_DEVICE_TABLE(i2c, mc3230_i2c_id);
static const struct of_device_id mc3230_of_match[] = {
{ .compatible = "mcube,mc3230", &mc3230_chip_info },
{ .compatible = "mcube,mc3510c", &mc3510c_chip_info },
{ }
};
MODULE_DEVICE_TABLE(of, mc3230_of_match);