From 0ab0e5a383a78a9e3bd9a02a1b06237fe75fd6a1 Mon Sep 17 00:00:00 2001
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: Wed, 6 Feb 2019 10:10:12 -0800
Subject: [PATCH] Input: tm2-touchkey - acknowledge that setting brightness is
a blocking call
Git-commit: 0ab0e5a383a78a9e3bd9a02a1b06237fe75fd6a1
Patch-mainline: v5.1
References: bsc#1129770
We need to access I2C bus when switching brightness, and that may block,
therefore we have to set stmfts_brightness_set() as LED's
brightness_set_blocking() method.
Fixes: 72d1f2346ded ("Input: tm2-touchkey - add touchkey driver support for TM2")
Acked-by: Andi Shyti <andi@etezian.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
drivers/input/keyboard/tm2-touchkey.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/drivers/input/keyboard/tm2-touchkey.c
+++ b/drivers/input/keyboard/tm2-touchkey.c
@@ -48,7 +48,7 @@ struct tm2_touchkey_data {
struct regulator_bulk_data regulators[2];
};
-static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev,
+static int tm2_touchkey_led_brightness_set(struct led_classdev *led_dev,
enum led_brightness brightness)
{
struct tm2_touchkey_data *touchkey =
@@ -65,7 +65,7 @@ static void tm2_touchkey_led_brightness_
}
regulator_set_voltage(touchkey->vdd, volt, volt);
- i2c_smbus_write_byte_data(touchkey->client,
+ return i2c_smbus_write_byte_data(touchkey->client,
TM2_TOUCHKEY_BASE_REG, data);
}
@@ -214,7 +214,8 @@ static int tm2_touchkey_probe(struct i2c
touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME;
touchkey->led_dev.brightness = LED_FULL;
touchkey->led_dev.max_brightness = LED_ON;
- touchkey->led_dev.brightness_set = tm2_touchkey_led_brightness_set;
+ touchkey->led_dev.brightness_set_blocking =
+ tm2_touchkey_led_brightness_set;
error = devm_led_classdev_register(&client->dev, &touchkey->led_dev);
if (error) {