.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * 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. |
---|
7 | 4 | * |
---|
8 | 5 | * Copyright (c) 2009 Jonathan Cameron <jic23@kernel.org> |
---|
9 | 6 | * |
---|
.. | .. |
---|
114 | 111 | /* Currently unsupported */ |
---|
115 | 112 | #define SCA3000_MD_CTRL_AND_Y BIT(3) |
---|
116 | 113 | #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) |
---|
118 | 115 | |
---|
119 | 116 | /* |
---|
120 | 117 | * Some control registers of complex access methods requiring this register to |
---|
.. | .. |
---|
189 | 186 | * @option_mode_2_freq: option mode 2 sampling frequency |
---|
190 | 187 | * @option_mode_2_3db_freq: 3db cutoff frequency of the low pass filter for |
---|
191 | 188 | * 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 |
---|
193 | 190 | * 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 |
---|
195 | 192 | * for motion detection in the y axis. |
---|
196 | 193 | * |
---|
197 | 194 | * This structure is used to hold information about the functionality of a given |
---|
.. | .. |
---|
862 | 859 | */ |
---|
863 | 860 | static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(sca3000_read_av_freq); |
---|
864 | 861 | |
---|
865 | | -/** |
---|
| 862 | +/* |
---|
866 | 863 | * sca3000_read_event_value() - query of a threshold or period |
---|
867 | | - **/ |
---|
| 864 | + */ |
---|
868 | 865 | static int sca3000_read_event_value(struct iio_dev *indio_dev, |
---|
869 | 866 | const struct iio_chan_spec *chan, |
---|
870 | 867 | enum iio_event_type type, |
---|
.. | .. |
---|
872 | 869 | enum iio_event_info info, |
---|
873 | 870 | int *val, int *val2) |
---|
874 | 871 | { |
---|
875 | | - int ret, i; |
---|
876 | 872 | struct sca3000_state *st = iio_priv(indio_dev); |
---|
| 873 | + long ret; |
---|
| 874 | + int i; |
---|
877 | 875 | |
---|
878 | 876 | switch (info) { |
---|
879 | 877 | case IIO_EV_INFO_VALUE: |
---|
.. | .. |
---|
885 | 883 | return ret; |
---|
886 | 884 | *val = 0; |
---|
887 | 885 | if (chan->channel2 == IIO_MOD_Y) |
---|
888 | | - for_each_set_bit(i, (unsigned long *)&ret, |
---|
| 886 | + for_each_set_bit(i, &ret, |
---|
889 | 887 | ARRAY_SIZE(st->info->mot_det_mult_y)) |
---|
890 | 888 | *val += st->info->mot_det_mult_y[i]; |
---|
891 | 889 | else |
---|
892 | | - for_each_set_bit(i, (unsigned long *)&ret, |
---|
| 890 | + for_each_set_bit(i, &ret, |
---|
893 | 891 | ARRAY_SIZE(st->info->mot_det_mult_xz)) |
---|
894 | 892 | *val += st->info->mot_det_mult_xz[i]; |
---|
895 | 893 | |
---|
.. | .. |
---|
1102 | 1100 | return IRQ_HANDLED; |
---|
1103 | 1101 | } |
---|
1104 | 1102 | |
---|
1105 | | -/** |
---|
| 1103 | +/* |
---|
1106 | 1104 | * sca3000_read_event_config() what events are enabled |
---|
1107 | | - **/ |
---|
| 1105 | + */ |
---|
1108 | 1106 | static int sca3000_read_event_config(struct iio_dev *indio_dev, |
---|
1109 | 1107 | const struct iio_chan_spec *chan, |
---|
1110 | 1108 | enum iio_event_type type, |
---|
.. | .. |
---|
1469 | 1467 | st->info = &sca3000_spi_chip_info_tbl[spi_get_device_id(spi) |
---|
1470 | 1468 | ->driver_data]; |
---|
1471 | 1469 | |
---|
1472 | | - indio_dev->dev.parent = &spi->dev; |
---|
1473 | 1470 | indio_dev->name = spi_get_device_id(spi)->name; |
---|
1474 | 1471 | indio_dev->info = &sca3000_info; |
---|
1475 | 1472 | if (st->info->temp_output) { |
---|