iio: accel: bmc150: Refactor bmc150_apply_acpi_orientation()
Factor the BOSC0200 ACPI HID handling out into a new bmc150_apply_bosc0200_acpi_orientation() function and make bmc150_apply_acpi_orientation() call that when dealing with a BOSC0200 ACPI device (and make it return false otherwise). This is a preparation patch for adding special handling for other ACPI HIDs (the "DUAL250E" HID). Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210523170103.176958-9-hdegoede@redhat.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
addab6febc
commit
61ddd0a75d
1 changed files with 13 additions and 5 deletions
|
@ -383,8 +383,8 @@ static int bmc150_accel_set_power_state(struct bmc150_accel_data *data, bool on)
|
||||||
* Onda V80 plus
|
* Onda V80 plus
|
||||||
* Predia Basic Tablet
|
* Predia Basic Tablet
|
||||||
*/
|
*/
|
||||||
static bool bmc150_apply_acpi_orientation(struct device *dev,
|
static bool bmc150_apply_bosc0200_acpi_orientation(struct device *dev,
|
||||||
struct iio_mount_matrix *orientation)
|
struct iio_mount_matrix *orientation)
|
||||||
{
|
{
|
||||||
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||||
|
@ -394,9 +394,6 @@ static bool bmc150_apply_acpi_orientation(struct device *dev,
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
int i, j, val[3];
|
int i, j, val[3];
|
||||||
|
|
||||||
if (!adev || !acpi_dev_hid_uid_match(adev, "BOSC0200", NULL))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (strcmp(dev_name(dev), "i2c-BOSC0200:base") == 0) {
|
if (strcmp(dev_name(dev), "i2c-BOSC0200:base") == 0) {
|
||||||
alt_name = "ROMK";
|
alt_name = "ROMK";
|
||||||
label = "accel-base";
|
label = "accel-base";
|
||||||
|
@ -452,6 +449,17 @@ unknown_format:
|
||||||
kfree(buffer.pointer);
|
kfree(buffer.pointer);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool bmc150_apply_acpi_orientation(struct device *dev,
|
||||||
|
struct iio_mount_matrix *orientation)
|
||||||
|
{
|
||||||
|
struct acpi_device *adev = ACPI_COMPANION(dev);
|
||||||
|
|
||||||
|
if (adev && acpi_dev_hid_uid_match(adev, "BOSC0200", NULL))
|
||||||
|
return bmc150_apply_bosc0200_acpi_orientation(dev, orientation);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
static bool bmc150_apply_acpi_orientation(struct device *dev,
|
static bool bmc150_apply_acpi_orientation(struct device *dev,
|
||||||
struct iio_mount_matrix *orientation)
|
struct iio_mount_matrix *orientation)
|
||||||
|
|
Loading…
Add table
Reference in a new issue