forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/iio/accel/sca3000.c
....@@ -1,9 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * sca3000_core.c -- support VTI sca3000 series accelerometers via SPI
3
- *
4
- * This program is free software; you can redistribute it and/or modify it
5
- * under the terms of the GNU General Public License version 2 as published by
6
- * the Free Software Foundation.
74 *
85 * Copyright (c) 2009 Jonathan Cameron <jic23@kernel.org>
96 *
....@@ -114,7 +111,7 @@
114111 /* Currently unsupported */
115112 #define SCA3000_MD_CTRL_AND_Y BIT(3)
116113 #define SCA3000_MD_CTRL_AND_X BIT(4)
117
-#define SAC3000_MD_CTRL_AND_Z BIT(5)
114
+#define SCA3000_MD_CTRL_AND_Z BIT(5)
118115
119116 /*
120117 * Some control registers of complex access methods requiring this register to
....@@ -189,9 +186,9 @@
189186 * @option_mode_2_freq: option mode 2 sampling frequency
190187 * @option_mode_2_3db_freq: 3db cutoff frequency of the low pass filter for
191188 * the second option mode.
192
- * @mod_det_mult_xz: Bit wise multipliers to calculate the threshold
189
+ * @mot_det_mult_xz: Bit wise multipliers to calculate the threshold
193190 * for motion detection in the x and z axis.
194
- * @mod_det_mult_y: Bit wise multipliers to calculate the threshold
191
+ * @mot_det_mult_y: Bit wise multipliers to calculate the threshold
195192 * for motion detection in the y axis.
196193 *
197194 * This structure is used to hold information about the functionality of a given
....@@ -862,9 +859,9 @@
862859 */
863860 static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(sca3000_read_av_freq);
864861
865
-/**
862
+/*
866863 * sca3000_read_event_value() - query of a threshold or period
867
- **/
864
+ */
868865 static int sca3000_read_event_value(struct iio_dev *indio_dev,
869866 const struct iio_chan_spec *chan,
870867 enum iio_event_type type,
....@@ -872,8 +869,9 @@
872869 enum iio_event_info info,
873870 int *val, int *val2)
874871 {
875
- int ret, i;
876872 struct sca3000_state *st = iio_priv(indio_dev);
873
+ long ret;
874
+ int i;
877875
878876 switch (info) {
879877 case IIO_EV_INFO_VALUE:
....@@ -885,11 +883,11 @@
885883 return ret;
886884 *val = 0;
887885 if (chan->channel2 == IIO_MOD_Y)
888
- for_each_set_bit(i, (unsigned long *)&ret,
886
+ for_each_set_bit(i, &ret,
889887 ARRAY_SIZE(st->info->mot_det_mult_y))
890888 *val += st->info->mot_det_mult_y[i];
891889 else
892
- for_each_set_bit(i, (unsigned long *)&ret,
890
+ for_each_set_bit(i, &ret,
893891 ARRAY_SIZE(st->info->mot_det_mult_xz))
894892 *val += st->info->mot_det_mult_xz[i];
895893
....@@ -1102,9 +1100,9 @@
11021100 return IRQ_HANDLED;
11031101 }
11041102
1105
-/**
1103
+/*
11061104 * sca3000_read_event_config() what events are enabled
1107
- **/
1105
+ */
11081106 static int sca3000_read_event_config(struct iio_dev *indio_dev,
11091107 const struct iio_chan_spec *chan,
11101108 enum iio_event_type type,
....@@ -1469,7 +1467,6 @@
14691467 st->info = &sca3000_spi_chip_info_tbl[spi_get_device_id(spi)
14701468 ->driver_data];
14711469
1472
- indio_dev->dev.parent = &spi->dev;
14731470 indio_dev->name = spi_get_device_id(spi)->name;
14741471 indio_dev->info = &sca3000_info;
14751472 if (st->info->temp_output) {