[PATCH v2 5/5] iio: accel: mc3230: add mc3510c support

From: Vasiliy Doylov via B4 Relay
Date: Sun Jan 12 2025 - 07:07:21 EST


From: Vasiliy Doylov <nekodevelopper@xxxxxxxxx>

This commit integrates support for the mc3510c into the mc3230 driver.

Tested on Huawei MediaPad T3 10 (huawei-agassi)

Signed-off-by: Vasiliy Doylov <nekodevelopper@xxxxxxxxx>
---
drivers/iio/accel/mc3230.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/iio/accel/mc3230.c b/drivers/iio/accel/mc3230.c
index ef9c4bcabb0b77518fe2a124e31ec5e7ca66816f..ca6f87d27b0f179ca33528b7e82471f1d13ebd5b 100644
--- a/drivers/iio/accel/mc3230.c
+++ b/drivers/iio/accel/mc3230.c
@@ -46,6 +46,14 @@ static struct mc3230_chip_info mc3230_chip_info = {
.scale = 115411765,
};

+static struct mc3230_chip_info mc3510c_chip_info = {
+ .chip_id = 0x23,
+ .name = "mc3510c",
+ .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", &c3230_chip_info },
+ { .compatible = "mcube,mc3510c", &mc3510c_chip_info },
{}
};
MODULE_DEVICE_TABLE(of, mc3230_of_match);

--
2.47.1