forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/iio/common/st_sensors/st_sensors_buffer.c
....@@ -1,11 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * STMicroelectronics sensors buffer library driver
34 *
45 * Copyright 2012-2013 STMicroelectronics Inc.
56 *
67 * Denis Ciocca <denis.ciocca@st.com>
7
- *
8
- * Licensed under the GPL-2.
98 */
109
1110 #include <linux/kernel.h>
....@@ -18,15 +17,16 @@
1817 #include <linux/iio/trigger_consumer.h>
1918 #include <linux/iio/triggered_buffer.h>
2019 #include <linux/irqreturn.h>
20
+#include <linux/regmap.h>
2121
2222 #include <linux/iio/common/st_sensors.h>
2323
2424
2525 static int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf)
2626 {
27
- int i;
2827 struct st_sensor_data *sdata = iio_priv(indio_dev);
2928 unsigned int num_data_channels = sdata->num_data_channels;
29
+ int i;
3030
3131 for_each_set_bit(i, indio_dev->active_scan_mask, num_data_channels) {
3232 const struct iio_chan_spec *channel = &indio_dev->channels[i];
....@@ -37,11 +37,8 @@
3737 channel->scan_type.storagebits >> 3;
3838
3939 buf = PTR_ALIGN(buf, storage_bytes);
40
- if (sdata->tf->read_multiple_byte(&sdata->tb, sdata->dev,
41
- channel->address,
42
- bytes_to_read, buf,
43
- sdata->multiread_bit) <
44
- bytes_to_read)
40
+ if (regmap_bulk_read(sdata->regmap, channel->address,
41
+ buf, bytes_to_read) < 0)
4542 return -EIO;
4643
4744 /* Advance the buffer pointer */