summaryrefslogtreecommitdiff
path: root/drivers/iio/imu/bmi160/bmi160_i2c.c
AgeCommit message (Collapse)AuthorFilesLines
2024-02-17Add 10EC5280 to bmi160_i2c ACPI IDs to allow binding on some devicesJesus Gonzalez1-0/+9
"10EC5280" is used by several manufacturers like Lenovo, GPD, or AYA (and probably others) in their ACPI table as the ID for the bmi160 IMU. This means the bmi160_i2c driver won't bind to it, and the IMU is unavailable to the user. Manufacturers have been approached on several occasions to try getting a BIOS with a fixed ID, mostly without actual positive results, and since affected devices are already a few years old, this is not expected to change. This patch enables using the bmi160_i2c driver for the bmi160 IMU on these devices. Here is the relevant extract from the DSDT of a GPD Win Max 2 (AMD 6800U model) with the latest firmware 1.05 installed. GPD sees this as WONTFIX with the argument of the device working with the Windows drivers. Device (BMA2) { Name (_ADR, Zero) // _ADR: Address Name (_HID, "10EC5280") // _HID: Hardware ID Name (_CID, "10EC5280") // _CID: Compatible ID Name (_DDN, "Accelerometer") // _DDN: DOS Device Name Name (_UID, One) // _UID: Unique ID Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings { Name (RBUF, ResourceTemplate () { I2cSerialBusV2 (0x0069, ControllerInitiated, 0x00061A80, AddressingMode7Bit, "\\_SB.I2CC", 0x00, ResourceConsumer, , Exclusive, ) }) Return (RBUF) /* \_SB_.I2CC.BMA2._CRS.RBUF */ } ... } Signed-off-by: Jesus Gonzalez <jesusmgh@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240207195549.37994-2-jesusmgh@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-05-21iio: Switch i2c drivers back to use .probe()Uwe Kleine-König1-1/+1
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type"), all drivers being converted to .probe_new() and then 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert back to (the new) .probe() to be able to eventually drop .probe_new() from struct i2c_driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230515205048.19561-1-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23iio: imu: bmi160/bmi160_i2c: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+3
.probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-108-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-06-21iio: imu: bmi160: Move exported symbols to IIO_BMI160 namespaceJonathan Cameron1-0/+1
Avoid unnecessary pollution of the global symbol namespace by moving library functions in to a specific namespace and import that into the drivers that make use of the functions. For more info: https://lwn.net/Articles/760045/ Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20220220173701.502331-2-jic23@kernel.org Reviewed-By: Joe Simmons-Talbott <joetalbott@gmail.com> Link: https://lore.kernel.org/r/20220604155306.422937-2-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-04-28iio: imu: bmi160: Make use of device propertiesAndy Shevchenko1-7/+6
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. While at it, reuse temporary device pointer in the same function. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220414131804.25227-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio: imu: bmi160_i2c: Use vsprintf extension %pe for symbolic error nameNishant Malpani1-2/+2
Utilize %pe format specifier from vsprintf while printing error logs with dev_err(). Discards the use of unnecessary explicit casting and prints symbolic error name which might prove to be convenient during debugging. Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-09iio:bmi160: add SPDX identifiersMartin Kelly1-4/+1
Add SPDX identifiers (GPL 2) for the BMI160 driver. bmi160.h had an identifier, but the other files did not. Signed-off-by: Martin Kelly <martin@martingkelly.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-11iio: bmi160: use all devm functions in probeMartin Kelly1-8/+0
Currently, we're using the devm version of some but not all functions. Switch to the devm version of iio_triggered_buffer_setup and iio_device_register to simplify the code a bit and decrease the chance of bugs. Signed-off-by: Martin Kelly <martin@martingkelly.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2016-12-30iio: bmi160: Add of device table for i2cMarcin Niestroj1-2/+12
From now on we can add bmi160 device to device-tree by specifying compatible string. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-16iio: imu: Add initial support for Bosch BMI160Daniel Baluta1-0/+72
BMI160 is an Inertial Measurement Unit (IMU) which provides acceleration and angular rate measurement. It also offers a secondary I2C interface for connecting a magnetometer sensor (usually BMM160). Current driver offers support for accelerometer and gyroscope readings via sysfs or via buffer interface using an external trigger (e.g. hrtimer). Data is retrieved from IMU via I2C or SPI interface. Datasheet is at: http://www.mouser.com/ds/2/783/BST-BMI160-DS000-07-786474.pdf Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>