Jonathan writes: First set of new device support, features and cleanups for IIO in the 5.4 cycle Note includes a merge from i3c tree to get support needed for stm_lsm6dsx driver support for l3c devices. Done from immutable branch. A counter subsystem patche in here as well. Alongside the new device support (which is always good), Chuhong's work on using devres managed APIs has cleaned up a number of drivers. New device support * adis16460 - New driver based on ADIS framework which needed addition of support for cs_change_delay. Includes device tree binding. * cros_ec - Support fo the veyron-minnie which uses an older interface. * lsm6dsx - Support for LSM6DSTR-C gyro + magnetometer sensor (new IDs mainly) - Support for ISM330DHCX acc + gyro sensor (extensive rework needed!) * Maxim 5432 - New driver support MAX5432-MAX5435 family of potentiometers. * noa1305 - New driver for this ON Semiconductor Ambient light sensor. Features and cleanups * tree wide - Drop error prints after platform_get_irq as already prints errors internally if any occur. * docs - Document mounting matrix. - Fix a missing newline at end of file. * ad2s1210 - Switch to device managed APIs for all of probe and drop explicit remove. * ad7192 - Add of_device_id array to explicity handling DT bindings. * ad7606 - Lots of rework leading to support for software configure modes in ad7616 parts. - Debugfs register access support. * am2315 - Switch to device managed APIs for all of probe and drop explicit remove. * apds9960 - Typo in module description. * cm36651 - Convert to i2c_new_dummy_device. - Swithc to device managed APIs for all of probe adn drop explicit remove. * cros_ec - Calibscale support for accel, gyro and magnetometer. - Tidy up some error codes to return the error from the stack rather than -EIO. - Determine protocol version. - Add a sign vector to the core to fix sensor rotation if necessary. Cannot just be done with mount matrix as already in use in many devices. - Tidy up INFO_SCALE being in both the separate and shared lists. - Drop a lot of dplicate code from the cros-ec-accel-legacy driver and use the core provided code instead. - Make frequency range available to userspace. * counter / ftm-quaddec - Switch to device managed APIs for all of probe adn drop explicit remove. * hdc100x - Switch to device managed APIs for all of probe and drop explicit remove. * hi8435 - Use gpiod_set_value_cansleep as we don't care here and there is a board out there where it needs to sleep. - Switch to device managed APIs for all of probe and drop explict remove. * hp03 - Convert to i2c_new_dummy_device. * maxim thermocouple - Switch to device managed APIs for all of probe and drop explicit remove. * mmc35240 - Fix typo in constant naming. * mpu6050 - Use devm_add_action_or_reset in place of explicit error handling. - Make text in Kconfig more explicit about which parts are supported. * mxc4005 - Switch to device managed APIs for all of probe and drop explicit remove. * pms7003 - Convert device tree bindings to yaml. - Add a MAINTAINERS entry * sc27xx - Introduce a local struct device *dev pointer to avoid lots of deref. - Use devm_add_action_or_reset in place of explicit error handling. * sca3000 - Typo fix in naming. * si1145 - Switch to device managed APIs for all of probe and drop explicit remove. * st_sensors - Lots of rework to enable switch to regmap. - Regmap conversion at the end. - Tidy up some inconsistencies in buffer setup ops. - Tidy up an oddity by dropping get_irq_data_ready function in favour of direct access. - Stop allocating buffer in buffer enable in favour of just embedding a large enough constant size buffer in the iio_priv accessed structure. * st_lsm6dsx - l3c device support (LSM6DSO and LSM6DSR) - tidy up irq return logic which was strangely written. - fix up an ABI quirk where this driver used separate scale attributes, even though they were always shared by type. * stk33xx - Device tree bindings include manufacturer ID. * stm32-adc - Add control for supply to analog switches including DT bindings. * stm32 timer - Drop the quadrature mode support. Believed there were no users so take this opportunity to drop this unwanted ABI. * tsl2772 - Switch to device mangage APIs for all of probe and drop explicit remove. - Use regulator_bulk_* APIs to reduce repitition. * veml6070 - Convert to i2c_new_dummy_device. * tag 'iio-for-5.4a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (84 commits) iio: hi8435: Drop hi8435_remove() by using devres for remaining elements iio: hi8435: Use gpiod_set_value_cansleep() iio:st_sensors: remove buffer allocation at each buffer enable iio: imu: inv_mpu6050: be more explicit on supported chips iio: light: noa1305: Add support for NOA1305 dt-bindings: Add binding document for NOA1305 iio: remove get_irq_data_ready() function pointer and use IRQ number directly iio: imu: st_lsm6dsx: make IIO_CHAN_INFO_SCALE shared by type iio: tsl2772: Use regulator_bulk_() APIs iio: tsl2772: Use devm_iio_device_register iio: tsl2772: Use devm_add_action_or_reset for tsl2772_chip_off iio: tsl2772: Use devm_add_action_or_reset iio: Remove dev_err() usage after platform_get_irq() iio: light: si1145: Use device-managed APIs iio:pressure: preenable/postenable/predisable fixup for ST press buffer iio:magn: preenable/postenable/predisable fixup for ST magn buffer iio:gyro: preenable/postenable/predisable fixup for ST gyro buffer iio:accel: preenable/postenable/predisable fixup for ST accel buffer dt-bindings: iio: imu: st_lsm6dsx: add ism330dhcx device bindings iio: imu: st_lsm6dsx: add support to ISM330DHCX ...
Showing the changes to include/linux (6 of 114 files). Show all
Unified · Split
| @@ -188,6 +188,10 @@ static inline struct i3c_driver *drv_to_i3cdrv(struct device_driver *drv) · 187 unmodified lines | ||
| 188 | 188 | struct device *i3cdev_to_dev(struct i3c_device *i3cdev); |
| 189 | 189 | struct i3c_device *dev_to_i3cdev(struct device *dev); |
| 190 | 190 | |
| 191 | +const struct i3c_device_id * | |
| 192 | +i3c_device_match_id(struct i3c_device *i3cdev, | |
| 193 | + const struct i3c_device_id *id_table); | |
| 194 | + | |
| 191 | 195 | static inline void i3cdev_set_drvdata(struct i3c_device *i3cdev, |
| 192 | 196 | void *data) |
| 193 | 197 | { |
| @@ -62,14 +62,20 @@ struct cros_ec_sensors_core_state { · 61 unmodified lines | ||
| 62 | 62 | enum motionsensor_type type; |
| 63 | 63 | enum motionsensor_location loc; |
| 64 | 64 | |
| 65 | − s16 calib[CROS_EC_SENSOR_MAX_AXIS]; | |
| 66 | − | |
| 65 | + struct calib_data { | |
| 66 | + s16 offset; | |
| 67 | + u16 scale; | |
| 68 | + } calib[CROS_EC_SENSOR_MAX_AXIS]; | |
| 69 | + s8 sign[CROS_EC_SENSOR_MAX_AXIS]; | |
| 67 | 70 | u8 samples[CROS_EC_SAMPLE_SIZE]; |
| 68 | 71 | |
| 69 | 72 | int (*read_ec_sensors_data)(struct iio_dev *indio_dev, |
| 70 | 73 | unsigned long scan_mask, s16 *data); |
| 71 | 74 | |
| 72 | 75 | int curr_sampl_freq; |
| 76 | + | |
| 77 | + /* Table of known available frequencies : 0, Min and Max in mHz */ | |
| 78 | + int frequencies[3]; | |
| 73 | 79 | }; |
| 74 | 80 | |
| 75 | 81 | /** |
| @@ -150,6 +156,24 @@ int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st, · 74 unmodified lines | ||
| 150 | 156 | struct iio_chan_spec const *chan, |
| 151 | 157 | int *val, int *val2, long mask); |
| 152 | 158 | |
| 159 | +/** | |
| 160 | + * cros_ec_sensors_core_read_avail() - get available values | |
| 161 | + * @indio_dev: pointer to state information for device | |
| 162 | + * @chan: channel specification structure table | |
| 163 | + * @vals: list of available values | |
| 164 | + * @type: type of data returned | |
| 165 | + * @length: number of data returned in the array | |
| 166 | + * @mask: specifies which values to be requested | |
| 167 | + * | |
| 168 | + * Return: an error code, IIO_AVAIL_RANGE or IIO_AVAIL_LIST | |
| 169 | + */ | |
| 170 | +int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev, | |
| 171 | + struct iio_chan_spec const *chan, | |
| 172 | + const int **vals, | |
| 173 | + int *type, | |
| 174 | + int *length, | |
| 175 | + long mask); | |
| 176 | + | |
| 153 | 177 | /** |
| 154 | 178 | * cros_ec_sensors_core_write() - function to write a value to the sensor |
| 155 | 179 | * @st: pointer to state information for device |
| @@ -16,11 +16,16 @@ · 15 unmodified lines | ||
| 16 | 16 | #include <linux/iio/trigger.h> |
| 17 | 17 | #include <linux/bitops.h> |
| 18 | 18 | #include <linux/regulator/consumer.h> |
| 19 | +#include <linux/regmap.h> | |
| 19 | 20 | |
| 20 | 21 | #include <linux/platform_data/st_sensors_pdata.h> |
| 21 | 22 | |
| 22 | −#define ST_SENSORS_TX_MAX_LENGTH 2 | |
| 23 | −#define ST_SENSORS_RX_MAX_LENGTH 6 | |
| 23 | +/* | |
| 24 | + * Buffer size max case: 2bytes per channel, 3 channels in total + | |
| 25 | + * 8bytes timestamp channel (s64) | |
| 26 | + */ | |
| 27 | +#define ST_SENSORS_MAX_BUFFER_SIZE (ALIGN(2 * 3, sizeof(s64)) + \ | |
| 28 | + sizeof(s64)) | |
| 24 | 29 | |
| 25 | 30 | #define ST_SENSORS_ODR_LIST_MAX 10 |
| 26 | 31 | #define ST_SENSORS_FULLSCALE_AVL_MAX 10 |
| @@ -169,36 +174,6 @@ struct st_sensor_data_ready_irq { · 142 unmodified lines | ||
| 169 | 174 | } ig1; |
| 170 | 175 | }; |
| 171 | 176 | |
| 172 | −/** | |
| 173 | − * struct st_sensor_transfer_buffer - ST sensor device I/O buffer | |
| 174 | − * @buf_lock: Mutex to protect rx and tx buffers. | |
| 175 | − * @tx_buf: Buffer used by SPI transfer function to send data to the sensors. | |
| 176 | − * This buffer is used to avoid DMA not-aligned issue. | |
| 177 | − * @rx_buf: Buffer used by SPI transfer to receive data from sensors. | |
| 178 | − * This buffer is used to avoid DMA not-aligned issue. | |
| 179 | − */ | |
| 180 | −struct st_sensor_transfer_buffer { | |
| 181 | − struct mutex buf_lock; | |
| 182 | − u8 rx_buf[ST_SENSORS_RX_MAX_LENGTH]; | |
| 183 | − u8 tx_buf[ST_SENSORS_TX_MAX_LENGTH] ____cacheline_aligned; | |
| 184 | −}; | |
| 185 | − | |
| 186 | −/** | |
| 187 | − * struct st_sensor_transfer_function - ST sensor device I/O function | |
| 188 | − * @read_byte: Function used to read one byte. | |
| 189 | − * @write_byte: Function used to write one byte. | |
| 190 | − * @read_multiple_byte: Function used to read multiple byte. | |
| 191 | − */ | |
| 192 | −struct st_sensor_transfer_function { | |
| 193 | − int (*read_byte) (struct st_sensor_transfer_buffer *tb, | |
| 194 | − struct device *dev, u8 reg_addr, u8 *res_byte); | |
| 195 | − int (*write_byte) (struct st_sensor_transfer_buffer *tb, | |
| 196 | − struct device *dev, u8 reg_addr, u8 data); | |
| 197 | − int (*read_multiple_byte) (struct st_sensor_transfer_buffer *tb, | |
| 198 | − struct device *dev, u8 reg_addr, int len, u8 *data, | |
| 199 | − bool multiread_bit); | |
| 200 | −}; | |
| 201 | − | |
| 202 | 177 | /** |
| 203 | 178 | * struct st_sensor_settings - ST specific sensor settings |
| 204 | 179 | * @wai: Contents of WhoAmI register. |
| @@ -242,19 +217,17 @@ struct st_sensor_settings { · 37 unmodified lines | ||
| 242 | 217 | * @current_fullscale: Maximum range of measure by the sensor. |
| 243 | 218 | * @vdd: Pointer to sensor's Vdd power supply |
| 244 | 219 | * @vdd_io: Pointer to sensor's Vdd-IO power supply |
| 220 | + * @regmap: Pointer to specific sensor regmap configuration. | |
| 245 | 221 | * @enabled: Status of the sensor (false->off, true->on). |
| 246 | − * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread. | |
| 247 | − * @buffer_data: Data used by buffer part. | |
| 248 | 222 | * @odr: Output data rate of the sensor [Hz]. |
| 249 | 223 | * num_data_channels: Number of data channels used in buffer. |
| 250 | 224 | * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2). |
| 251 | 225 | * @int_pin_open_drain: Set the interrupt/DRDY to open drain. |
| 252 | − * @get_irq_data_ready: Function to get the IRQ used for data ready signal. | |
| 253 | − * @tf: Transfer function structure used by I/O operations. | |
| 254 | − * @tb: Transfer buffers and mutex used by I/O operations. | |
| 226 | + * @irq: the IRQ number. | |
| 255 | 227 | * @edge_irq: the IRQ triggers on edges and need special handling. |
| 256 | 228 | * @hw_irq_trigger: if we're using the hardware interrupt on the sensor. |
| 257 | 229 | * @hw_timestamp: Latest timestamp from the interrupt handler, when in use. |
| 230 | + * @buffer_data: Data used by buffer part. | |
| 258 | 231 | */ |
| 259 | 232 | struct st_sensor_data { |
| 260 | 233 | struct device *dev; |
| @@ -264,26 +237,22 @@ struct st_sensor_data { · 3 unmodified lines | ||
| 264 | 237 | struct st_sensor_fullscale_avl *current_fullscale; |
| 265 | 238 | struct regulator *vdd; |
| 266 | 239 | struct regulator *vdd_io; |
| 240 | + struct regmap *regmap; | |
| 267 | 241 | |
| 268 | 242 | bool enabled; |
| 269 | − bool multiread_bit; | |
| 270 | − | |
| 271 | − char *buffer_data; | |
| 272 | 243 | |
| 273 | 244 | unsigned int odr; |
| 274 | 245 | unsigned int num_data_channels; |
| 275 | 246 | |
| 276 | 247 | u8 drdy_int_pin; |
| 277 | 248 | bool int_pin_open_drain; |
| 278 | − | |
| 279 | − unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev); | |
| 280 | − | |
| 281 | − const struct st_sensor_transfer_function *tf; | |
| 282 | − struct st_sensor_transfer_buffer tb; | |
| 249 | + int irq; | |
| 283 | 250 | |
| 284 | 251 | bool edge_irq; |
| 285 | 252 | bool hw_irq_trigger; |
| 286 | 253 | s64 hw_timestamp; |
| 254 | + | |
| 255 | + char buffer_data[ST_SENSORS_MAX_BUFFER_SIZE] ____cacheline_aligned; | |
| 287 | 256 | }; |
| 288 | 257 | |
| 289 | 258 | #ifdef CONFIG_IIO_BUFFER |
| @@ -334,8 +303,11 @@ int st_sensors_set_fullscale_by_gain(struct iio_dev *indio_dev, int scale); · 44 unmodified lines | ||
| 334 | 303 | int st_sensors_read_info_raw(struct iio_dev *indio_dev, |
| 335 | 304 | struct iio_chan_spec const *ch, int *val); |
| 336 | 305 | |
| 337 | −int st_sensors_check_device_support(struct iio_dev *indio_dev, | |
| 338 | − int num_sensors_list, const struct st_sensor_settings *sensor_settings); | |
| 306 | +int st_sensors_get_settings_index(const char *name, | |
| 307 | + const struct st_sensor_settings *list, | |
| 308 | + const int list_length); | |
| 309 | + | |
| 310 | +int st_sensors_verify_id(struct iio_dev *indio_dev); | |
| 339 | 311 | |
| 340 | 312 | ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev, |
| 341 | 313 | struct device_attribute *attr, char *buf); |
| @@ -14,8 +14,8 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <linux/iio/common/st_sensors.h> |
| 15 | 15 | #include <linux/of.h> |
| 16 | 16 | |
| 17 | −void st_sensors_i2c_configure(struct iio_dev *indio_dev, | |
| 18 | − struct i2c_client *client, struct st_sensor_data *sdata); | |
| 17 | +int st_sensors_i2c_configure(struct iio_dev *indio_dev, | |
| 18 | + struct i2c_client *client); | |
| 19 | 19 | |
| 20 | 20 | #ifdef CONFIG_ACPI |
| 21 | 21 | int st_sensors_match_acpi_device(struct device *dev); |
| @@ -13,7 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <linux/spi/spi.h> |
| 14 | 14 | #include <linux/iio/common/st_sensors.h> |
| 15 | 15 | |
| 16 | −void st_sensors_spi_configure(struct iio_dev *indio_dev, | |
| 17 | − struct spi_device *spi, struct st_sensor_data *sdata); | |
| 16 | +int st_sensors_spi_configure(struct iio_dev *indio_dev, | |
| 17 | + struct spi_device *spi); | |
| 18 | 18 | |
| 19 | 19 | #endif /* ST_SENSORS_SPI_H */ |
| @@ -26,6 +26,7 @@ struct adis_burst; · 25 unmodified lines | ||
| 26 | 26 | * struct adis_data - ADIS chip variant specific data |
| 27 | 27 | * @read_delay: SPI delay for read operations in us |
| 28 | 28 | * @write_delay: SPI delay for write operations in us |
| 29 | + * @cs_change_delay: SPI delay between CS changes in us | |
| 29 | 30 | * @glob_cmd_reg: Register address of the GLOB_CMD register |
| 30 | 31 | * @msc_ctrl_reg: Register address of the MSC_CTRL register |
| 31 | 32 | * @diag_stat_reg: Register address of the DIAG_STAT register |
| @@ -35,6 +36,7 @@ struct adis_burst; · 3 unmodified lines | ||
| 35 | 36 | struct adis_data { |
| 36 | 37 | unsigned int read_delay; |
| 37 | 38 | unsigned int write_delay; |
| 39 | + unsigned int cs_change_delay; | |
| 38 | 40 | |
| 39 | 41 | unsigned int glob_cmd_reg; |
| 40 | 42 | unsigned int msc_ctrl_reg; |