1. 06 Jul, 2017 1 commit
  2. 17 May, 2016 1 commit
  3. 21 May, 2014 1 commit
  4. 28 Apr, 2014 1 commit
  5. 24 Oct, 2013 1 commit
  6. 21 Jun, 2013 1 commit
    • H Hartley Sweeten's avatar
      pwm: Add sysfs interface · 76abbdde
      H Hartley Sweeten authored
      Add a simple sysfs interface to the generic PWM framework.
      
        /sys/class/pwm/
        `-- pwmchipN/           for each PWM chip
            |-- export          (w/o) ask the kernel to export a PWM channel
            |-- npwm            (r/o) number of PWM channels in this PWM chip
            |-- pwmX/           for each exported PWM channel
            |   |-- duty_cycle  (r/w) duty cycle (in nanoseconds)
            |   |-- enable      (r/w) enable/disable PWM
            |   |-- period      (r/w) period (in nanoseconds)
            |   `-- polarity    (r/w) polarity of PWM (normal/inversed)
            `-- unexport        (w/o) return a PWM channel to the kernel
      
      Based on work by Lars Poeschel.
      Signed-off-by: 's avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Lars Poeschel <poeschel@lemonage.de>
      Cc: Ryan Mallon <rmallon@gmail.com>
      Cc: Rob Landley <rob@landley.net>
      Signed-off-by: 's avatarThierry Reding <thierry.reding@gmail.com>
      76abbdde
  7. 10 Sep, 2012 1 commit
  8. 15 Jun, 2012 3 commits
    • Thierry Reding's avatar
      pwm: Add table-based lookup for static mappings · 8138d2dd
      Thierry Reding authored
      In order to get rid of the global namespace for PWM devices, this commit
      provides an alternative method, similar to that of the regulator or
      clock frameworks, for registering a static mapping for PWM devices. This
      works by providing a table with a provider/consumer map in the board
      setup code.
      
      With the new pwm_get() and pwm_put() functions available, usage of
      pwm_request() and pwm_free() becomes deprecated.
      Reviewed-by: 's avatarShawn Guo <shawn.guo@linaro.org>
      Reviewed-by: 's avatarMark Brown <broonie@opensource.wolfsonmicro.com>
      Signed-off-by: 's avatarThierry Reding <thierry.reding@avionic-design.de>
      8138d2dd
    • Thierry Reding's avatar
      pwm: Allow chips to support multiple PWMs · f051c466
      Thierry Reding authored
      Many PWM controllers provide access to more than a single PWM output and
      may even share some resource among them. Allowing a PWM chip to provide
      multiple PWM devices enables better sharing of those resources. As a
      side-effect this change allows easy integration with the device tree
      where a given PWM can be looked up based on the PWM chip's phandle and a
      corresponding index.
      
      This commit modifies the PWM core to support multiple PWMs per struct
      pwm_chip. It achieves this in a similar way to how gpiolib works, by
      allowing PWM ranges to be requested dynamically (pwm_chip.base == -1) or
      starting at a given offset (pwm_chip.base >= 0). A chip specifies how
      many PWMs it controls using the npwm member. Each of the functions in
      the pwm_ops structure gets an additional argument that specified the PWM
      number (it can be converted to a per-chip index by subtracting the
      chip's base).
      
      The total maximum number of PWM devices is currently fixed to 1024 while
      the data is actually stored in a radix tree, thus saving resources if
      not all of them are used.
      Reviewed-by: 's avatarMark Brown <broonie@opensource.wolfsonmicro.com>
      Reviewed-by: 's avatarShawn Guo <shawn.guo@linaro.org>
      [eric@eukrea.com: fix error handling in pwmchip_add]
      Signed-off-by: 's avatarEric Bénard <eric@eukrea.com>
      Signed-off-by: 's avatarThierry Reding <thierry.reding@avionic-design.de>
      f051c466
    • Sascha Hauer's avatar
      pwm: Add PWM framework support · 0c2498f1
      Sascha Hauer authored
      This patch adds framework support for PWM (pulse width modulation) devices.
      
      The is a barebone PWM API already in the kernel under include/linux/pwm.h,
      but it does not allow for multiple drivers as each of them implements the
      pwm_*() functions.
      
      There are other PWM framework patches around from Bill Gatliff. Unlike
      his framework this one does not change the existing API for PWMs so that
      this framework can act as a drop in replacement for the existing API.
      
      Why another framework?
      
      Several people argue that there should not be another framework for PWMs
      but they should be integrated into one of the existing frameworks like led
      or hwmon. Unlike these frameworks the PWM framework is agnostic to the
      purpose of the PWM. In fact, a PWM can drive a LED, but this makes the
      LED framework a user of a PWM, like already done in leds-pwm.c. The gpio
      framework also is not suitable for PWMs. Every gpio could be turned into
      a PWM using timer based toggling, but on the other hand not every PWM hardware
      device can be turned into a gpio due to the lack of hardware capabilities.
      
      This patch does not try to improve the PWM API yet, this could be done in
      subsequent patches.
      Signed-off-by: 's avatarSascha Hauer <s.hauer@pengutronix.de>
      Acked-by: 's avatarKurt Van Dijck <kurt.van.dijck@eia.be>
      Reviewed-by: 's avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: 's avatarMatthias Kaehlcke <matthias@kaehlcke.net>
      Reviewed-by: 's avatarMark Brown <broonie@opensource.wolfsonmicro.com>
      Reviewed-by: 's avatarShawn Guo <shawn.guo@linaro.org>
      [thierry.reding@avionic-design.de: fixup typos, kerneldoc comments]
      Signed-off-by: 's avatarThierry Reding <thierry.reding@avionic-design.de>
      0c2498f1