]> Git Repo - linux.git/commitdiff
Merge tag 'leds-next-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
authorLinus Torvalds <[email protected]>
Wed, 22 May 2024 17:49:54 +0000 (10:49 -0700)
committerLinus Torvalds <[email protected]>
Wed, 22 May 2024 17:49:54 +0000 (10:49 -0700)
Pull LED updates from Lee Jones:
 "Core Frameworks:
   - Ensure seldom updated triggers have a brightness value before first
     update

  New Device Support:
   - Add support for Simatic IPC Device BX_59A to IPC LEDs Core
   - Add support for Qualcomm PMI8950 PWM to LPG Core

  New Functionality:
   - Add a bunch of new LED function identifiers
   - Add support for High Resolution Timers in LED Trigger Patten

  Fix-ups:
   - Shift out Audio Trigger to the Sound subsystem
   - Convert suitable calls to devm_* managed resources
   - Device Tree binding adaptions/conversions/creation
   - Remove superfluous code/variables/attributes and simplify overall
   - Use/convert to new/better APIs/helpers/MACROs instead of
     hand-rolling implementations

  Bug Fixes:
   - Repair enabling Torch Mode from V4L2 on the second LED
   - Ensure PWM is disabled when suspending"

* tag 'leds-next-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (28 commits)
  leds: mt6370: Remove unused field 'reg_cfgs' from 'struct mt6370_priv'
  leds: lp50xx: Remove unused field 'num_of_banked_leds' from 'struct lp50xx'
  leds: lp50xx: Remove unused field 'bank_modules' from 'struct lp50xx_led'
  leds: aat1290: Remove unused field 'torch_brightness' from 'struct aat1290_led'
  leds: sun50i-a100: Use match_string() helper to simplify the code
  leds: pwm: Disable PWM when going to suspend
  leds: trigger: pattern: Add support for hrtimer
  leds: mt6360: Fix the second LED can not enable torch mode by V4L2
  dt-bindings: leds: leds-qcom-lpg: Add support for PMI8950 PWM
  leds: qcom-lpg: Add support for PMI8950 PWM
  leds: apu: Remove duplicate DMI lookup data
  leds: trigger: netdev: Remove not needed call to led_set_brightness in deactivate
  dt-bindings: leds: Add LED_FUNCTION_SPEED_* for link speed on LAN/WAN
  dt-bindings: leds: Add LED_FUNCTION_MOBILE for mobile network
  leds: simatic-ipc-leds-gpio: Add support for module BX-59A
  dt-bindings: leds: qcom-lpg: Document PM6150L compatible
  dt-bindings: leds: pca963x: Convert text bindings to YAML
  leds: an30259a: Use devm_mutex_init() for mutex initialization
  leds: mlxreg: Use devm_mutex_init() for mutex initialization
  leds: nic78bx: Use devm API to cleanup module's resources
  ...

1  2 
include/dt-bindings/leds/common.h
sound/core/control_led.c

index d7c980bdf3834bacc5f322f3d025fdb2a58ab4a9,82a5769725ce599c49e5df04ea11da7515a93a47..4f017bea01233f008a9dcb24af250b9723769ce4
@@@ -46,7 -46,6 +46,7 @@@
  #define LED_FUNCTION_CAPSLOCK "capslock"
  #define LED_FUNCTION_SCROLLLOCK "scrolllock"
  #define LED_FUNCTION_NUMLOCK "numlock"
 +#define LED_FUNCTION_FNLOCK "fnlock"
  /*   Obsolete equivalents: "tpacpi::thinklight" (IBM/Lenovo Thinkpads),
       "lp5523:kb{1,2,3,4,5,6}" (Nokia N900) */
  #define LED_FUNCTION_KBD_BACKLIGHT "kbd_backlight"
  #define LED_FUNCTION_INDICATOR "indicator"
  #define LED_FUNCTION_LAN "lan"
  #define LED_FUNCTION_MAIL "mail"
+ #define LED_FUNCTION_MOBILE "mobile"
  #define LED_FUNCTION_MTD "mtd"
  #define LED_FUNCTION_PANIC "panic"
  #define LED_FUNCTION_PROGRAMMING "programming"
  #define LED_FUNCTION_RX "rx"
  #define LED_FUNCTION_SD "sd"
+ #define LED_FUNCTION_SPEED_LAN "speed-lan"
+ #define LED_FUNCTION_SPEED_WAN "speed-wan"
  #define LED_FUNCTION_STANDBY "standby"
  #define LED_FUNCTION_TORCH "torch"
  #define LED_FUNCTION_TX "tx"
diff --combined sound/core/control_led.c
index ac19d14bd574568e752fe438d2bde5d9b0ee145c,061a8ea233408e0629da9d30dd7b313d42a42838..804805a95e2f0472f61e4186434fdd2fe09e0c7d
@@@ -53,6 -53,7 +53,7 @@@ struct snd_ctl_led_ctl 
  
  static DEFINE_MUTEX(snd_ctl_led_mutex);
  static bool snd_ctl_led_card_valid[SNDRV_CARDS];
+ static struct led_trigger *snd_ctl_ledtrig_audio[NUM_AUDIO_LEDS];
  static struct snd_ctl_led snd_ctl_leds[MAX_LED] = {
        {
                .name = "speaker",
@@@ -174,8 -175,11 +175,11 @@@ static void snd_ctl_led_set_state(struc
        case MODE_FOLLOW_ROUTE: if (route >= 0) route ^= 1; break;
        case MODE_FOLLOW_MUTE:  /* noop */ break;
        }
-       if (route >= 0)
-               ledtrig_audio_set(led->trigger_type, route ? LED_OFF : LED_ON);
+       if (route >= 0) {
+               struct led_trigger *trig = snd_ctl_ledtrig_audio[led->trigger_type];
+               led_trigger_event(trig, route ? LED_OFF : LED_ON);
+       }
  }
  
  static struct snd_ctl_led_ctl *snd_ctl_led_find(struct snd_kcontrol *kctl, unsigned int ioff)
@@@ -285,22 -289,25 +289,22 @@@ static void snd_ctl_led_ctl_destroy(str
  static void snd_ctl_led_clean(struct snd_card *card)
  {
        unsigned int group;
 +      struct snd_ctl_led_ctl *lctl, *_lctl;
        struct snd_ctl_led *led;
 -      struct snd_ctl_led_ctl *lctl;
  
        for (group = 0; group < MAX_LED; group++) {
                led = &snd_ctl_leds[group];
 -repeat:
 -              list_for_each_entry(lctl, &led->controls, list)
 -                      if (!card || lctl->card == card) {
 +              list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
 +                      if (!card || lctl->card == card)
                                snd_ctl_led_ctl_destroy(lctl);
 -                              goto repeat;
 -                      }
        }
  }
  
  static int snd_ctl_led_reset(int card_number, unsigned int group)
  {
        struct snd_card *card __free(snd_card_unref) = NULL;
 +      struct snd_ctl_led_ctl *lctl, *_lctl;
        struct snd_ctl_led *led;
 -      struct snd_ctl_led_ctl *lctl;
        struct snd_kcontrol_volatile *vd;
        bool change = false;
  
                if (!snd_ctl_led_card_valid[card_number])
                        return -ENXIO;
                led = &snd_ctl_leds[group];
 -repeat:
 -              list_for_each_entry(lctl, &led->controls, list)
 +              list_for_each_entry_safe(lctl, _lctl, &led->controls, list)
                        if (lctl->card == card) {
                                vd = &lctl->kctl->vd[lctl->index_offset];
                                vd->access &= ~group_to_access(group);
                                snd_ctl_led_ctl_destroy(lctl);
                                change = true;
 -                              goto repeat;
                        }
        }
        if (change)
@@@ -420,8 -429,9 +424,9 @@@ static ssize_t brightness_show(struct d
                               struct device_attribute *attr, char *buf)
  {
        struct snd_ctl_led *led = container_of(dev, struct snd_ctl_led, dev);
+       struct led_trigger *trig = snd_ctl_ledtrig_audio[led->trigger_type];
  
-       return sysfs_emit(buf, "%u\n", ledtrig_audio_get(led->trigger_type));
+       return sysfs_emit(buf, "%u\n", led_trigger_get_brightness(trig));
  }
  
  static DEVICE_ATTR_RW(mode);
@@@ -711,6 -721,9 +716,9 @@@ static int __init snd_ctl_led_init(void
        struct snd_ctl_led *led;
        unsigned int group;
  
+       led_trigger_register_simple("audio-mute", &snd_ctl_ledtrig_audio[LED_AUDIO_MUTE]);
+       led_trigger_register_simple("audio-micmute", &snd_ctl_ledtrig_audio[LED_AUDIO_MICMUTE]);
        device_initialize(&snd_ctl_led_dev);
        snd_ctl_led_dev.class = &sound_class;
        snd_ctl_led_dev.release = snd_ctl_led_dev_release;
@@@ -763,7 -776,13 +771,13 @@@ static void __exit snd_ctl_led_exit(voi
        }
        device_unregister(&snd_ctl_led_dev);
        snd_ctl_led_clean(NULL);
+       led_trigger_unregister_simple(snd_ctl_ledtrig_audio[LED_AUDIO_MUTE]);
+       led_trigger_unregister_simple(snd_ctl_ledtrig_audio[LED_AUDIO_MICMUTE]);
  }
  
  module_init(snd_ctl_led_init)
  module_exit(snd_ctl_led_exit)
+ MODULE_ALIAS("ledtrig:audio-mute");
+ MODULE_ALIAS("ledtrig:audio-micmute");
This page took 0.098149 seconds and 4 git commands to generate.