diff options
author | Roderick Colenbrander <roderick@gaikai.com> | 2022-10-29 11:48:45 -0700 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2022-11-11 11:07:09 +0100 |
commit | 316f57fb3f0c83d15b7c682a7b0e0a63f31cbea5 (patch) | |
tree | e8c961dac0129df9ff095394d2310945fe71e77a /drivers/hid | |
parent | 4e463ec4ba839af9758366573b32e20df1ea2e47 (diff) | |
download | linux-stable-316f57fb3f0c83d15b7c682a7b0e0a63f31cbea5.tar.gz linux-stable-316f57fb3f0c83d15b7c682a7b0e0a63f31cbea5.tar.bz2 linux-stable-316f57fb3f0c83d15b7c682a7b0e0a63f31cbea5.zip |
HID: playstation: make LED brightness adjustable in ps_led_register.
Make the max_brightness adjustable through ps_led_info struct. This
paves the way for a next DualShock4 patch to allow larger brightness
values.
Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-playstation.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c index 319f400dd946..662c6f220571 100644 --- a/drivers/hid/hid-playstation.c +++ b/drivers/hid/hid-playstation.c @@ -60,6 +60,7 @@ struct ps_calibration_data { struct ps_led_info { const char *name; const char *color; + int max_brightness; enum led_brightness (*brightness_get)(struct led_classdev *cdev); int (*brightness_set)(struct led_classdev *cdev, enum led_brightness); }; @@ -703,7 +704,7 @@ static int ps_led_register(struct ps_device *ps_dev, struct led_classdev *led, return -ENOMEM; led->brightness = 0; - led->max_brightness = 1; + led->max_brightness = led_info->max_brightness; led->flags = LED_CORE_SUSPENDRESUME; led->brightness_get = led_info->brightness_get; led->brightness_set_blocking = led_info->brightness_set; @@ -1459,15 +1460,15 @@ static struct ps_device *dualsense_create(struct hid_device *hdev) int i, ret; static const struct ps_led_info player_leds_info[] = { - { LED_FUNCTION_PLAYER1, "white", dualsense_player_led_get_brightness, + { LED_FUNCTION_PLAYER1, "white", 1, dualsense_player_led_get_brightness, dualsense_player_led_set_brightness }, - { LED_FUNCTION_PLAYER2, "white", dualsense_player_led_get_brightness, + { LED_FUNCTION_PLAYER2, "white", 1, dualsense_player_led_get_brightness, dualsense_player_led_set_brightness }, - { LED_FUNCTION_PLAYER3, "white", dualsense_player_led_get_brightness, + { LED_FUNCTION_PLAYER3, "white", 1, dualsense_player_led_get_brightness, dualsense_player_led_set_brightness }, - { LED_FUNCTION_PLAYER4, "white", dualsense_player_led_get_brightness, + { LED_FUNCTION_PLAYER4, "white", 1, dualsense_player_led_get_brightness, dualsense_player_led_set_brightness }, - { LED_FUNCTION_PLAYER5, "white", dualsense_player_led_get_brightness, + { LED_FUNCTION_PLAYER5, "white", 1, dualsense_player_led_get_brightness, dualsense_player_led_set_brightness } }; |