提交 a10c88bf 编写于 作者: D Dmitry Torokhov 提交者: Greg Kroah-Hartman

Input: stmfts - acknowledge that setting brightness is a blocking call

commit 937c4e552fd1174784045684740edfcea536159d upstream.

We need to turn regulators on and off when switching brightness, and
that may block, therefore we have to set stmfts_brightness_set() as
LED's brightness_set_blocking() method.

Fixes: 78bcac7b ("Input: add support for the STMicroelectronics FingerTip touchscreen")
Acked-by: NAndi Shyti <andi@etezian.org>
Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 a99b9c82
...@@ -106,27 +106,29 @@ struct stmfts_data { ...@@ -106,27 +106,29 @@ struct stmfts_data {
bool running; bool running;
}; };
static void stmfts_brightness_set(struct led_classdev *led_cdev, static int stmfts_brightness_set(struct led_classdev *led_cdev,
enum led_brightness value) enum led_brightness value)
{ {
struct stmfts_data *sdata = container_of(led_cdev, struct stmfts_data *sdata = container_of(led_cdev,
struct stmfts_data, led_cdev); struct stmfts_data, led_cdev);
int err; int err;
if (value == sdata->led_status || !sdata->ledvdd) if (value != sdata->led_status && sdata->ledvdd) {
return; if (!value) {
regulator_disable(sdata->ledvdd);
if (!value) { } else {
regulator_disable(sdata->ledvdd); err = regulator_enable(sdata->ledvdd);
} else { if (err) {
err = regulator_enable(sdata->ledvdd); dev_warn(&sdata->client->dev,
if (err) "failed to disable ledvdd regulator: %d\n",
dev_warn(&sdata->client->dev, err);
"failed to disable ledvdd regulator: %d\n", return err;
err); }
}
sdata->led_status = value;
} }
sdata->led_status = value; return 0;
} }
static enum led_brightness stmfts_brightness_get(struct led_classdev *led_cdev) static enum led_brightness stmfts_brightness_get(struct led_classdev *led_cdev)
...@@ -608,7 +610,7 @@ static int stmfts_enable_led(struct stmfts_data *sdata) ...@@ -608,7 +610,7 @@ static int stmfts_enable_led(struct stmfts_data *sdata)
sdata->led_cdev.name = STMFTS_DEV_NAME; sdata->led_cdev.name = STMFTS_DEV_NAME;
sdata->led_cdev.max_brightness = LED_ON; sdata->led_cdev.max_brightness = LED_ON;
sdata->led_cdev.brightness = LED_OFF; sdata->led_cdev.brightness = LED_OFF;
sdata->led_cdev.brightness_set = stmfts_brightness_set; sdata->led_cdev.brightness_set_blocking = stmfts_brightness_set;
sdata->led_cdev.brightness_get = stmfts_brightness_get; sdata->led_cdev.brightness_get = stmfts_brightness_get;
err = devm_led_classdev_register(&sdata->client->dev, &sdata->led_cdev); err = devm_led_classdev_register(&sdata->client->dev, &sdata->led_cdev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册