Martino Fontana 928276075f HID: nintendo: cleanup LED code
- Support player LED patterns up to 8 players.
  (Note that the behavior still consinsts in increasing the player number
  every time a controller is connected, never decreasing it. It should be
  as is described in https://bugzilla.kernel.org/show_bug.cgi?id=216225.
  However, any implementation here would stop making sense as soon as a
  non-Nintendo controller is connected, which is why I'm not bothering.)

- Split part of `joycon_home_led_brightness_set` (which is called by hid)
  into `joycon_set_home_led` (which is what actually sets the LEDs), for
  consistency with player LEDs.

- `joycon_player_led_brightness_set` won't try it to "determine which
  player led this is" anymore: it's already looking at every LED
  brightness value.

- Instead of first registering the `led_classdev`, then attempting to set
  the LED and unregistering the `led_classdev` if it fails, first attempt
  to set the LED, then register the `led_classdev` only if it succeeds
  (the class is still filled up in either case).

- If setting the player LEDs fails, still attempt setting the home LED.
  (I don't know there's a third party controller where this may actually
  happen, but who knows...)

- Use `JC_NUM_LEDS` where appropriate instead of 4.

- Print return codes in more places.

- Use spinlock instead of mutex for `input_num`. Copy its value to a local
  variable, so that it can be unlocked immediately.

- `input_num` starts counting from 0

- Less holding of mutexes in general.

Signed-off-by: Martino Fontana <tinozzo123@gmail.com>
Reviewed-by: Daniel J. Ogorchock <djogorchock@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2023-10-04 21:07:04 +02:00
..
2023-08-24 07:26:06 +10:00
2023-08-11 21:12:45 +02:00
2023-09-01 09:53:54 -07:00
2023-08-22 15:50:57 +02:00
2023-08-30 13:34:34 -07:00
2023-09-01 09:43:18 -07:00
2023-08-29 20:21:42 -07:00
2023-09-01 09:53:54 -07:00
2023-09-01 09:53:54 -07:00
2023-08-28 14:12:05 +02:00
2023-08-31 12:43:10 -07:00
2023-08-24 16:20:30 -07:00
2023-08-30 13:34:34 -07:00
2023-08-30 19:23:00 -07:00
2023-08-30 16:42:21 -07:00
2023-08-29 10:21:56 -07:00
2023-09-01 09:38:00 -07:00
2023-10-04 21:07:04 +02:00
2023-09-01 12:21:32 -07:00
2023-08-28 16:35:01 -07:00
2023-09-01 09:53:54 -07:00
2023-08-29 11:33:01 -07:00
2023-08-11 21:12:47 +02:00
2023-08-30 20:41:37 -07:00
2023-09-01 09:16:47 -07:00
2023-08-31 12:43:10 -07:00
2023-08-29 20:21:42 -07:00
2023-09-01 12:21:32 -07:00
2023-08-29 09:47:33 -07:00
2023-09-01 09:53:54 -07:00
2023-09-01 09:38:00 -07:00
2023-08-31 12:47:15 +02:00
2023-09-01 09:38:00 -07:00
2023-08-29 20:21:42 -07:00
2023-08-30 16:59:03 -07:00
2023-08-18 10:55:49 +05:30
2023-08-31 12:43:10 -07:00
2023-08-29 09:40:16 -07:00
2023-08-29 20:21:42 -07:00
2023-08-29 09:47:33 -07:00
2023-09-01 12:21:32 -07:00
2023-09-01 09:38:00 -07:00
2023-09-01 09:38:00 -07:00
2023-08-30 20:41:37 -07:00
2023-08-24 16:20:18 -07:00
2023-08-29 20:32:10 -07:00
2023-08-21 13:27:44 +02:00