mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-04 13:04:22 +00:00
0be05de577
This backports patches leds: turris-omnia: Use sysfs_emit() instead of sprintf() leds: turris-omnia: Drop unnecessary mutex locking leds: turris-omnia: Do not use SMBUS calls leds: turris-omnia: Make set_brightness() more efficient leds: turris-omnia: Support HW controlled mode via private trigger leds: turris-omnia: Add support for enabling/disabling HW gamma correction leds: turris-omnia: Fix brightness setting and trigger activating into backport-6.1. The above patches replace: leds: turris-omnia: support HW controlled mode via private trigger leds: turris-omnia: initialize multi-intensity to full leds: turris-omnia: change max brightness from 255 to 1 from mvebu/patches-6.1. Signed-off-by: Marek Mojík <marek.mojik@nic.cz>
65 lines
2.0 KiB
Diff
65 lines
2.0 KiB
Diff
From 8f3d612a5c949489b2860b74ff34c5914a9216dd Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Marek=20Beh=C3=BAn?= <kabel@kernel.org>
|
|
Date: Wed, 2 Aug 2023 18:07:43 +0200
|
|
Subject: [PATCH 2/6] leds: turris-omnia: Drop unnecessary mutex locking
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Do not lock driver mutex in the global LED panel brightness sysfs
|
|
accessors brightness_show() and brightness_store().
|
|
|
|
The mutex locking is unnecessary here. The I2C transfers are guarded by
|
|
I2C core locking mechanism, and the LED commands itself do not interfere
|
|
with other commands.
|
|
|
|
Fixes: 089381b27abe ("leds: initial support for Turris Omnia LEDs")
|
|
Signed-off-by: Marek Behún <kabel@kernel.org>
|
|
Reviewed-by: Lee Jones <lee@kernel.org>
|
|
Link: https://lore.kernel.org/r/20230802160748.11208-2-kabel@kernel.org
|
|
Signed-off-by: Lee Jones <lee@kernel.org>
|
|
---
|
|
drivers/leds/leds-turris-omnia.c | 11 +----------
|
|
1 file changed, 1 insertion(+), 10 deletions(-)
|
|
|
|
--- a/drivers/leds/leds-turris-omnia.c
|
|
+++ b/drivers/leds/leds-turris-omnia.c
|
|
@@ -156,12 +156,9 @@ static ssize_t brightness_show(struct de
|
|
char *buf)
|
|
{
|
|
struct i2c_client *client = to_i2c_client(dev);
|
|
- struct omnia_leds *leds = i2c_get_clientdata(client);
|
|
int ret;
|
|
|
|
- mutex_lock(&leds->lock);
|
|
ret = i2c_smbus_read_byte_data(client, CMD_LED_GET_BRIGHTNESS);
|
|
- mutex_unlock(&leds->lock);
|
|
|
|
if (ret < 0)
|
|
return ret;
|
|
@@ -173,7 +170,6 @@ static ssize_t brightness_store(struct d
|
|
const char *buf, size_t count)
|
|
{
|
|
struct i2c_client *client = to_i2c_client(dev);
|
|
- struct omnia_leds *leds = i2c_get_clientdata(client);
|
|
unsigned long brightness;
|
|
int ret;
|
|
|
|
@@ -183,15 +179,10 @@ static ssize_t brightness_store(struct d
|
|
if (brightness > 100)
|
|
return -EINVAL;
|
|
|
|
- mutex_lock(&leds->lock);
|
|
ret = i2c_smbus_write_byte_data(client, CMD_LED_SET_BRIGHTNESS,
|
|
(u8)brightness);
|
|
- mutex_unlock(&leds->lock);
|
|
|
|
- if (ret < 0)
|
|
- return ret;
|
|
-
|
|
- return count;
|
|
+ return ret < 0 ? ret : count;
|
|
}
|
|
static DEVICE_ATTR_RW(brightness);
|
|
|