hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/iio/magnetometer/mmc35240.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * MMC35240 - MEMSIC 3-axis Magnetic Sensor
34 *
45 * Copyright (c) 2015, Intel Corporation.
5
- *
6
- * This file is subject to the terms and conditions of version 2 of
7
- * the GNU General Public License. See the file COPYING in the main
8
- * directory of this archive for more details.
96 *
107 * IIO driver for MMC35240 (7-bit I2C slave address 0x30).
118 *
....@@ -56,7 +53,7 @@
5653 #define MMC35240_CTRL1_BW_SHIFT 0
5754
5855 #define MMC35240_WAIT_CHARGE_PUMP 50000 /* us */
59
-#define MMC53240_WAIT_SET_RESET 1000 /* us */
56
+#define MMC35240_WAIT_SET_RESET 1000 /* us */
6057
6158 /*
6259 * Memsic OTP process code piece is put here for reference:
....@@ -228,7 +225,7 @@
228225 ret = mmc35240_hw_set(data, true);
229226 if (ret < 0)
230227 return ret;
231
- usleep_range(MMC53240_WAIT_SET_RESET, MMC53240_WAIT_SET_RESET + 1);
228
+ usleep_range(MMC35240_WAIT_SET_RESET, MMC35240_WAIT_SET_RESET + 1);
232229
233230 ret = mmc35240_hw_set(data, false);
234231 if (ret < 0)
....@@ -242,7 +239,7 @@
242239 return ret;
243240
244241 ret = regmap_bulk_read(data->regmap, MMC35240_OTP_START_ADDR,
245
- (u8 *)otp_data, sizeof(otp_data));
242
+ otp_data, sizeof(otp_data));
246243 if (ret < 0)
247244 return ret;
248245
....@@ -298,13 +295,13 @@
298295 if (ret < 0)
299296 return ret;
300297
301
- return regmap_bulk_read(data->regmap, MMC35240_REG_XOUT_L, (u8 *)buf,
298
+ return regmap_bulk_read(data->regmap, MMC35240_REG_XOUT_L, buf,
302299 3 * sizeof(__le16));
303300 }
304301
305302 /**
306303 * mmc35240_raw_to_mgauss - convert raw readings to milli gauss. Also apply
307
- compensation for output value.
304
+ * compensation for output value.
308305 *
309306 * @data: device private data
310307 * @index: axis index for which we want the conversion
....@@ -462,7 +459,7 @@
462459 }
463460 }
464461
465
-static struct reg_default mmc35240_reg_defaults[] = {
462
+static const struct reg_default mmc35240_reg_defaults[] = {
466463 { MMC35240_REG_CTRL0, 0x00 },
467464 { MMC35240_REG_CTRL1, 0x00 },
468465 };
....@@ -510,7 +507,6 @@
510507
511508 mutex_init(&data->mutex);
512509
513
- indio_dev->dev.parent = &client->dev;
514510 indio_dev->info = &mmc35240_info;
515511 indio_dev->name = MMC35240_DRV_NAME;
516512 indio_dev->channels = mmc35240_channels;