1. 09 1月, 2018 6 次提交
  2. 07 1月, 2018 1 次提交
    • J
      leds: core: Fix regression caused by commit 2b83ff96 · 7b6af2c5
      Jacek Anaszewski 提交于
      Commit 2b83ff96 ("led: core: Fix brightness setting when setting delay_off=0")
      replaced del_timer_sync(&led_cdev->blink_timer) with led_stop_software_blink()
      in led_blink_set(), which additionally clears LED_BLINK_SW flag as well as
      zeroes blink_delay_on and blink_delay_off properties of the struct led_classdev.
      
      Cleansing of the latter ones wasn't required to fix the original issue but
      wasn't considered harmful. It nonetheless turned out to be so in case when
      pointer to one or both props is passed to led_blink_set() like in the
      ledtrig-timer.c. In such cases zeroes are passed later in delay_on and/or
      delay_off arguments to led_blink_setup(), which results either in stopping
      the software blinking or setting blinking frequency always to 1Hz.
      
      Avoid using led_stop_software_blink() and add a single call required
      to clear LED_BLINK_SW flag, which was the only needed modification to
      fix the original issue.
      
      Fixes 2b83ff96 ("led: core: Fix brightness setting when setting delay_off=0")
      Signed-off-by: NJacek Anaszewski <jacek.anaszewski@gmail.com>
      7b6af2c5
  3. 28 12月, 2017 1 次提交
    • M
      led: core: Fix brightness setting when setting delay_off=0 · 2b83ff96
      Matthieu CASTET 提交于
      With the current code, the following sequence won't work :
      echo timer > trigger
      
      echo 0 >  delay_off
      * at this point we call
      ** led_delay_off_store
      ** led_blink_set
      *** stop timer
      ** led_blink_setup
      ** led_set_software_blink
      *** if !delay_on, led off
      *** if !delay_off, set led_set_brightness_nosleep <--- LED_BLINK_SW is set but timer is stop
      *** otherwise start timer/set LED_BLINK_SW flag
      
      echo xxx > brightness
      * led_set_brightness
      ** if LED_BLINK_SW
      *** if brightness=0, led off
      *** else apply brightness if next timer <--- timer is stop, and will never apply new setting
      ** otherwise set led_set_brightness_nosleep
      
      To fix that, when we delete the timer, we should clear LED_BLINK_SW.
      
      Cc: linux-leds@vger.kernel.org
      Signed-off-by: NMatthieu CASTET <matthieu.castet@parrot.com>
      Signed-off-by: NJacek Anaszewski <jacek.anaszewski@gmail.com>
      2b83ff96
  4. 07 11月, 2017 1 次提交
  5. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  6. 31 10月, 2017 1 次提交
  7. 26 10月, 2017 1 次提交
  8. 10 10月, 2017 1 次提交
  9. 07 10月, 2017 3 次提交
    • K
      leds: ledtrig-heartbeat: Convert timers to use timer_setup() · 26c7d6a3
      Kees Cook 提交于
      Instead of using .data directly, convert to from_timer. Since the
      trigger_data is allocated separately, the led_cdev must be explicitly
      tracked for the callback.
      
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Zhang Bo <bo.zhang@nxp.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: linux-leds@vger.kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NJacek Anaszewski <jacek.anaszewski@gmail.com>
      26c7d6a3
    • A
      leds: pca955x: Don't invert requested value in pca955x_gpio_set_value() · 52ca7d0f
      Andrew Jeffery 提交于
      The PCA9552 lines can be used either for driving LEDs or as GPIOs. The
      manual states that for LEDs, the operation is open-drain:
      
               The LSn LED select registers determine the source of the LED data.
      
                 00 = output is set LOW (LED on)
                 01 = output is set high-impedance (LED off; default)
                 10 = output blinks at PWM0 rate
                 11 = output blinks at PWM1 rate
      
      For GPIOs it suggests a pull-up so that the open-case drives the line
      high:
      
               For use as output, connect external pull-up resistor to the pin
               and size it according to the DC recommended operating
               characteristics.  LED output pin is HIGH when the output is
               programmed as high-impedance, and LOW when the output is
               programmed LOW through the ‘LED selector’ register.  The output
               can be pulse-width controlled when PWM0 or PWM1 are used.
      
      Now, I have a hardware design that uses the LED controller to control
      LEDs. However, for $reasons, we're using the leds-gpio driver to drive
      the them. The reasons are here are a tangent but lead to the discovery
      of the inversion, which manifested as the LEDs being set to full
      brightness at boot when we expected them to be off.
      
      As we're driving the LEDs through leds-gpio, this means wending our way
      through the gpiochip abstractions. So with that in mind we need to
      describe an active-low GPIO configuration to drive the LEDs as though
      they were GPIOs.
      
      The set() gpiochip callback in leds-pca955x does the following:
      
               ...
               if (val)
                      pca955x_led_set(&led->led_cdev, LED_FULL);
               else
                      pca955x_led_set(&led->led_cdev, LED_OFF);
               ...
      
      Where LED_FULL = 255. pca955x_led_set() in turn does:
      
               ...
               switch (value) {
               case LED_FULL:
                      ls = pca955x_ledsel(ls, ls_led, PCA955X_LS_LED_ON);
                      break;
               ...
      
      Where PCA955X_LS_LED_ON is defined as:
      
               #define PCA955X_LS_LED_ON	0x0	/* Output LOW */
      
      So here we have some type confusion: We've crossed domains from GPIO
      behaviour to LED behaviour without accounting for possible inversions
      in the process.
      
      Stepping back to leds-gpio for a moment, during probe() we call
      create_gpio_led(), which eventually executes:
      
               if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) {
                      state = gpiod_get_value_cansleep(led_dat->gpiod);
                      if (state < 0)
                              return state;
               } else {
                      state = (template->default_state == LEDS_GPIO_DEFSTATE_ON);
               }
               ...
               ret = gpiod_direction_output(led_dat->gpiod, state);
      
      In the devicetree the GPIO is annotated as active-low, and
      gpiod_get_value_cansleep() handles this for us:
      
               int gpiod_get_value_cansleep(const struct gpio_desc *desc)
               {
                       int value;
      
                       might_sleep_if(extra_checks);
                       VALIDATE_DESC(desc);
                       value = _gpiod_get_raw_value(desc);
                       if (value < 0)
                               return value;
      
                       if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
                               value = !value;
      
                       return value;
               }
      
      _gpiod_get_raw_value() in turn calls through the get() callback for the
      gpiochip implementation, so returning to our get() implementation in
      leds-pca955x we find we extract the raw value from hardware:
      
               static int pca955x_gpio_get_value(struct gpio_chip *gc, unsigned int offset)
               {
                       struct pca955x *pca955x = gpiochip_get_data(gc);
                       struct pca955x_led *led = &pca955x->leds[offset];
                       u8 reg = pca955x_read_input(pca955x->client, led->led_num / 8);
      
                       return !!(reg & (1 << (led->led_num % 8)));
               }
      
      This behaviour is not symmetric with that of set(), where the val is
      inverted by the driver.
      
      Closing the loop on the GPIO_ACTIVE_LOW inversions,
      gpiod_direction_output(), like gpiod_get_value_cansleep(), handles it
      for us:
      
               int gpiod_direction_output(struct gpio_desc *desc, int value)
               {
                        VALIDATE_DESC(desc);
                        if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
                                 value = !value;
                        else
                                 value = !!value;
                        return _gpiod_direction_output_raw(desc, value);
               }
      
      All-in-all, with a value of 'keep' for default-state property in a
      leds-gpio child node, the current state of the hardware will in-fact be
      inverted; precisely the opposite of what was intended.
      
      Rework leds-pca955x so that we avoid the incorrect inversion and clarify
      the semantics with respect to GPIO.
      Signed-off-by: NAndrew Jeffery <andrew@aj.id.au>
      Reviewed-by: NCédric Le Goater <clg@kaod.org>
      Tested-by: NJoel Stanley <joel@jms.id.au>
      Tested-by: NMatt Spinler <mspinler@linux.vnet.ibm.com>
      Signed-off-by: NJacek Anaszewski <jacek.anaszewski@gmail.com>
      52ca7d0f
    • W
      leds: ledtrig-activity: Add a system activity LED trigger · 7df4f9a9
      Willy Tarreau 提交于
      The "activity" trigger was inspired by the heartbeat one, but aims at
      providing instant indication of the immediate CPU usage. Under idle
      condition, it flashes 10ms every second. At 100% usage, it flashes
      90ms every 100ms. The blinking frequency increases from 1 to 10 Hz
      until either the load is high enough to saturate one CPU core or 50%
      load is reached on a single-core system. Then past this point only the
      duty cycle increases from 10 to 90%.
      
      This results in a very visible activity reporting allowing one to
      immediately tell whether a machine is under load or not, making it
      quite suitable to be used in clusters.
      Signed-off-by: NWilly Tarreau <w@1wt.eu>
      Signed-off-by: NJacek Anaszewski <jacek.anaszewski@gmail.com>
      7df4f9a9
  10. 24 9月, 2017 3 次提交
  11. 14 9月, 2017 1 次提交
  12. 06 9月, 2017 1 次提交
  13. 31 8月, 2017 1 次提交
  14. 30 8月, 2017 8 次提交
  15. 27 8月, 2017 2 次提交
  16. 15 8月, 2017 3 次提交
  17. 13 8月, 2017 1 次提交
  18. 05 8月, 2017 1 次提交
  19. 17 7月, 2017 2 次提交
  20. 01 7月, 2017 1 次提交