BigW Consortium Gitlab

Commit 0f32c807 by David Frey

bmi160: merge in updates from kernel v4.18.1

parent 36e8895a
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef BMI160_H_ #ifndef BMI160_H_
#define BMI160_H_ #define BMI160_H_
......
...@@ -565,9 +565,9 @@ static int bmi160_get_data(struct bmi160_data *data, int chan_type, ...@@ -565,9 +565,9 @@ static int bmi160_get_data(struct bmi160_data *data, int chan_type,
__le16 sample; __le16 sample;
enum bmi160_sensor_type t = bmi160_to_sensor(chan_type); enum bmi160_sensor_type t = bmi160_to_sensor(chan_type);
reg = bmi160_regs[t].data + (axis - IIO_MOD_X) * sizeof(__le16); reg = bmi160_regs[t].data + (axis - IIO_MOD_X) * sizeof(sample);
ret = regmap_bulk_read(data->regmap, reg, &sample, sizeof(__le16)); ret = regmap_bulk_read(data->regmap, reg, &sample, sizeof(sample));
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -632,8 +632,8 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p) ...@@ -632,8 +632,8 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p)
for_each_set_bit(i, indio_dev->active_scan_mask, for_each_set_bit(i, indio_dev->active_scan_mask,
indio_dev->masklength) { indio_dev->masklength) {
ret = regmap_bulk_read(data->regmap, base + i * sizeof(__le16), ret = regmap_bulk_read(data->regmap, base + i * sizeof(sample),
&sample, sizeof(__le16)); &sample, sizeof(sample));
if (ret < 0) if (ret < 0)
goto done; goto done;
buf[j++] = sample; buf[j++] = sample;
...@@ -851,7 +851,6 @@ static const struct attribute_group bmi160_attrs_group = { ...@@ -851,7 +851,6 @@ static const struct attribute_group bmi160_attrs_group = {
}; };
static const struct iio_info bmi160_info = { static const struct iio_info bmi160_info = {
.driver_module = THIS_MODULE,
.read_raw = bmi160_read_raw, .read_raw = bmi160_read_raw,
.write_raw = bmi160_write_raw, .write_raw = bmi160_write_raw,
.attrs = &bmi160_attrs_group, .attrs = &bmi160_attrs_group,
......
...@@ -11,10 +11,11 @@ ...@@ -11,10 +11,11 @@
* - 0x68 if SDO is pulled to GND * - 0x68 if SDO is pulled to GND
* - 0x69 if SDO is pulled to VDDIO * - 0x69 if SDO is pulled to VDDIO
*/ */
#include <linux/module.h> #include <linux/acpi.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/acpi.h>
#include "bmi160.h" #include "bmi160.h"
...@@ -56,10 +57,19 @@ static const struct acpi_device_id bmi160_acpi_match[] = { ...@@ -56,10 +57,19 @@ static const struct acpi_device_id bmi160_acpi_match[] = {
}; };
MODULE_DEVICE_TABLE(acpi, bmi160_acpi_match); MODULE_DEVICE_TABLE(acpi, bmi160_acpi_match);
#ifdef CONFIG_OF
static const struct of_device_id bmi160_of_match[] = {
{ .compatible = "bosch,bmi160" },
{ },
};
MODULE_DEVICE_TABLE(of, bmi160_of_match);
#endif
static struct i2c_driver bmi160_i2c_driver = { static struct i2c_driver bmi160_i2c_driver = {
.driver = { .driver = {
.name = "bmi160_i2c", .name = "bmi160_i2c",
.acpi_match_table = ACPI_PTR(bmi160_acpi_match), .acpi_match_table = ACPI_PTR(bmi160_acpi_match),
.of_match_table = of_match_ptr(bmi160_of_match),
}, },
.probe = bmi160_i2c_probe, .probe = bmi160_i2c_probe,
.remove = bmi160_i2c_remove, .remove = bmi160_i2c_remove,
......
...@@ -7,10 +7,11 @@ ...@@ -7,10 +7,11 @@
* the GNU General Public License. See the file COPYING in the main * the GNU General Public License. See the file COPYING in the main
* directory of this archive for more details. * directory of this archive for more details.
*/ */
#include <linux/acpi.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/spi/spi.h> #include <linux/of.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/acpi.h> #include <linux/spi/spi.h>
#include "bmi160.h" #include "bmi160.h"
...@@ -47,13 +48,22 @@ static const struct acpi_device_id bmi160_acpi_match[] = { ...@@ -47,13 +48,22 @@ static const struct acpi_device_id bmi160_acpi_match[] = {
}; };
MODULE_DEVICE_TABLE(acpi, bmi160_acpi_match); MODULE_DEVICE_TABLE(acpi, bmi160_acpi_match);
#ifdef CONFIG_OF
static const struct of_device_id bmi160_of_match[] = {
{ .compatible = "bosch,bmi160" },
{ },
};
MODULE_DEVICE_TABLE(of, bmi160_of_match);
#endif
static struct spi_driver bmi160_spi_driver = { static struct spi_driver bmi160_spi_driver = {
.probe = bmi160_spi_probe, .probe = bmi160_spi_probe,
.remove = bmi160_spi_remove, .remove = bmi160_spi_remove,
.id_table = bmi160_spi_id, .id_table = bmi160_spi_id,
.driver = { .driver = {
.acpi_match_table = ACPI_PTR(bmi160_acpi_match), .acpi_match_table = ACPI_PTR(bmi160_acpi_match),
.name = "bmi160_spi", .of_match_table = of_match_ptr(bmi160_of_match),
.name = "bmi160_spi",
}, },
}; };
module_spi_driver(bmi160_spi_driver); module_spi_driver(bmi160_spi_driver);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment