24 Jun, 2015

1 commit

  • …erry.reding/linux-pwm

    Pull pwm updates from Thierry Reding:
    "This has a couple of fixes for Atmel, Samsung and Broadcom drivers.

    Some preparatory patches for more upcoming Intel work is included as
    well"

    * tag 'pwm/for-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
    pwm: lpss: pci: Add support for Broxton platform
    pwm: bcm-kona: Don't set polarity in probe
    pwm: Add pwmchip_add_with_polarity() API
    pwm: atmel: Fix incorrect CDTY value after disabling
    pwm: atmel: Fix incorrect CDTY value after enabling
    pwm: samsung: Use MODULE_DEVICE_TABLE() to include OF modalias
    pwm: Add support to remove registered consumer lookup tables

    Linus Torvalds
     

12 Jun, 2015

5 commits

  • Add PCI device IDs for Broxton platform.

    Signed-off-by: Qipeng Zha
    Acked-by: Mika Westerberg
    Signed-off-by: Thierry Reding

    Qipeng Zha
     
  • Omit setting the polarity to normal during probe and instead use the new
    pwmchip_add_with_polarity() function to register a PWM chip with inverse
    polarity by default for all channels to reflect the hardware default.

    Signed-off-by: Arun Ramamurthy
    Reviewed-by: Ray Jui
    Signed-off-by: Scott Branden
    Signed-off-by: Tim Kryger
    Signed-off-by: Jonathan Richardson
    [thierry.reding@gmail.com: use pwmchip_add_with_polarity()]
    Signed-off-by: Thierry Reding

    Arun Ramamurthy
     
  • Add a new function to register a PWM chip with channels that have their
    initial polarity as specified by an additional parameter. This benefits
    drivers of controllers that by default operate with inversed polarity
    by removing the need to modify the polarity during initialization.

    Signed-off-by: Tim Kryger
    Signed-off-by: Jonathan Richardson
    [thierry.reding@gmail.com: export pwmchip_add_with_polarity()]
    Signed-off-by: Thierry Reding

    Tim Kryger
     
  • pwm-leds calls .config() and .disable() in a row. This exhibits that it
    may happen that the channel gets disabled before CDTY has been updated
    with CUPD. The issue gets quite worse with long periods. So, ensure that
    at least one period has past before disabling the channel by polling
    ISR.

    Signed-off-by: Alexandre Belloni
    Acked-by: Nicolas Ferre
    Tested-by: Gaël PORTAY
    Signed-off-by: Thierry Reding

    Alexandre Belloni
     
  • CUPD is not flushed before enabling the channel so it will update
    CDTY/CPRD just after one period. So we always set CUPD, even when the
    channel is not enabled.

    Signed-off-by: Alexandre Belloni
    Acked-by: Nicolas Ferre
    Signed-off-by: Thierry Reding

    Alexandre Belloni
     

21 May, 2015

1 commit


19 May, 2015

1 commit

  • The PWM hardware on Pistachio platform has a maximum timebase steps
    value to 255. To fix it, let's introduce a compatible-specific
    data structure to contain the SoC-specific details and use it to
    specify a maximum timebase.

    Also, let's limit the minimum timebase to 16 steps, to allow a sane
    range of duty cycle steps.

    Fixes: 277bb6a29e00 ("pwm: Imagination Technologies PWM DAC driver")
    Signed-off-by: Naidu Tellapati
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Thierry Reding

    Naidu Tellapati
     

06 May, 2015

1 commit


23 Apr, 2015

1 commit

  • For platforms that don't support DT, some early MFD modules can register
    lookup tables. Remove the __init annotation so that this works. This is
    similar to gpio_add_lookup_table() which allows late additions.

    CC: Samuel Ortiz
    Cc: Linus Walleij
    Cc: Alexandre Courbot
    Cc: Thierry Reding
    Signed-off-by: Shobhit Kumar
    Signed-off-by: Thierry Reding

    Shobhit Kumar
     

27 Mar, 2015

1 commit

  • When disabling the Samsung PWM the output state remains at the level it
    was at the end of a PWM cycle. In other words, calling pwm_disable()
    when at 100% duty cycle will keep the output active, while at all other
    settings the output will go/stay inactive. On top of that the Samsung
    PWM settings are double-buffered, which means the new settings only get
    applied at the start of a new PWM cycle.

    This results in a race if the PWM is at 100% duty cycle and a driver
    calls:

    pwm_config(pwm, 0, period);
    pwm_disable(pwm);

    In this case the PWMs output will unexpectedly stay active, unless a new
    PWM cycle happened to start between the register writes in pwm_config()
    and pwm_disable(). As far as I can tell this is a regression introduced
    by 3bdf878, before that a call to pwm_config() would call
    pwm_samsung_enable() which, while heavy-handed, made sure the expected
    settings were live.

    To resolve this, while not re-introducing the issues 3bdf878 (flickering
    as the PWM got reset while in a PWM cycle) fixed, only force an update
    of the settings when at 100% duty cycle, which shouldn't have any
    noticeable effect on the output but is enough to ensure the behaviour is
    as expected on disable.

    Signed-off-by: Sjoerd Simons
    Reviewed-by: Javier Martinez Canillas
    Acked-by: Lukasz Majewski
    Signed-off-by: Thierry Reding

    Sjoerd Simons
     

11 Mar, 2015

3 commits

  • The driver computes which clock divider it sould be using from the
    requested period. This computation assumes that the link between the
    register value and the actual divider value is raising 2 to the power of
    the registry value.

    div = 1 << regvalue

    This is true only for the first 5 values out of 8. Next values are 64,
    256 and, 1024 - instead of 32, 64, 128.
    This affects only the users requesting a period > 0.04369s.

    Replace the computation with a look-up table.

    Signed-off-by: Gaetan Hug
    Acked-by: Shawn Guo
    Signed-off-by: Thierry Reding

    Gaetan Hug
     
  • sama5d4 SoC also has an errata on the HLCDC PWM. It is the same as the
    sama5d3 that is forbidding the use of div1 prescaler.

    Signed-off-by: Nicolas Ferre
    Acked-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Nicolas Ferre
     
  • The regmap_config struct may be const because it is not modified by the
    driver and regmap_init() accepts pointer to const.

    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Thierry Reding

    Krzysztof Kozlowski
     

18 Feb, 2015

1 commit


03 Feb, 2015

1 commit


30 Jan, 2015

5 commits

  • The Pistachio SOC from Imagination Technologies includes a Pulse Width
    Modulation DAC which produces 1 to 4 digital bit-outputs which represent
    digital waveforms. These PWM outputs are primarily in charge of controlling
    backlight LED devices.

    Reviewed-by: Andrew Bresticker
    Signed-off-by: Naidu Tellapati
    Signed-off-by: Sai Masarapu
    Signed-off-by: Ezequiel Garcia
    Reviewed-by: Vladimir Zapolskiy
    [thierry.reding: fixup license header as discussed on list]
    Signed-off-by: Thierry Reding

    Naidu Tellapati
     
  • This patch introduces a bitmap which is used to keep track of the
    pwm channels which have been configured in a pwm chip.

    The method used earlier to find the number of configured channels,
    was to count the pwmdevices with PWMF_REQUESTED field set
    and period value configured. This was not correct and failed
    when of_pwm_get()/pwm_get() and then pwm_config() was used.

    Signed-off-by: Ajit Pal Singh
    Signed-off-by: Thierry Reding

    Ajit Pal Singh
     
  • This adds a generic PWM framework driver for the PWM controller
    found on Allwinner SoCs.

    Signed-off-by: Alexandre Belloni
    Acked-by: Maxime Ripard
    Signed-off-by: Thierry Reding

    Alexandre Belloni
     
  • The slow and system clock should never return a rate of zero, but this
    might happen if the clocks property defined in the DT is referencing the
    wrong clocks.

    Prevent any division by zero from happening by testing the clk_freq
    value before calling do_div().

    Signed-off-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Boris BREZILLON
     
  • The include/linux/clk.h header defines dummy implementations for the
    various clk_*() functions if HAVE_CLK is not selected to improve build
    coverage in randconfig builds.

    The dummy implementation of clk_get_rate() returns 0, which causes the
    Atmel HLCDC PWM driver's atmel_hlcdc_pwm_config() implementation to end
    up calling:

    do_div(clk_period_ns, 0)

    On x86, do_div(n, base) will end up evaluating to this:

    n >>= ilog2(base)

    with base = 0, the implementation of ilog2() will call ____ilog2_NaN(),
    which is purposely undefined and results in a linker failure:

    ERROR: "____ilog2_NaN" [drivers/pwm/pwm-atmel-hlcdc.ko] undefined!

    The implementation of do_div() checks that base is a power of 2 before
    calling ilog2(). The compiler doesn't optimize this away, presumably
    because is_power_of_2() is an inline function and the compiler doesn't
    or can't inspect it closely enough. ilog2() being a macro it still ends
    up generating the ____ilog2_NaN() because of the constant 0.

    The root of the problem is that the driver really should be checking
    before possibly dividing by zero. That should eventually be fixed, but
    for now just assume that the clock runs at a sensible frequency when
    available.

    Reported-by: Jim Davis
    Acked-by: Boris Brezillon
    Signed-off-by: Thierry Reding

    Thierry Reding
     

18 Dec, 2014

1 commit

  • …ierry.reding/linux-pwm

    Pull pwm updates from Thierry Reding:
    "There are two new drivers, one for the BCM2835 (Raspberry Pi) and one
    used in conjunction with the LCD controller on various Atmel SoCs.
    The Samsung PWM driver can now be built for 64-bit ARM (Exynos7).

    A couple of fixes have been applied to the FTM PWM driver and system
    sleep support was added"

    * tag 'pwm/for-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
    pwm: atmel-hlcdc: add at91sam9x5 and sama5d3 errata handling
    pwm: ftm: Add Power Management support for FTM PWM
    pwm: ftm: Add regmap rbtree type cache support
    pwm: ftm: Correctly track usage count
    pwm: samsung: Allow Samsung PWM driver to be enabled on Exynos7
    pwm: add DT bindings documentation for atmel-hlcdc-pwm driver
    pwm: add support for atmel-hlcdc-pwm device
    pwm: Add BCM2835 PWM driver

    Linus Torvalds
     

04 Dec, 2014

1 commit


01 Dec, 2014

3 commits


17 Nov, 2014

3 commits


04 Nov, 2014

1 commit


21 Oct, 2014

1 commit

  • …ierry.reding/linux-pwm

    Pull pwm changes from Thierry Reding:
    "There are no new drivers here, only a couple of fixes all over the
    place"

    * tag 'pwm/for-3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
    pwm: Let PWM_CLPS711X depend on HAS_IOMEM
    pwm: atmel: Fix calculation of prescale value
    pwm: Fix uninitialized warnings in pwm_get()
    pwm: rockchip: Allow polarity invert on rk3288
    pwm: imx: Avoid sample FIFO overflow for i.MX PWM version2
    pwm: imx: Cleanup indentation for register definitions
    pwm: imx: Fix the macro MX3_PWMCR_PRESCALER(x) definition
    pwm: Fix possible ZERO_SIZE_PTR pointer dereferencing error.
    pwm: lpss: make it buildable only on X86
    pwm: lpss: use c99 initializers in structures
    pwm: lpss: Fix build failure on PowerPC
    pwm: lpss: pci: Move to use pcim_enable_device()
    pwm: lpss: Properly split driver to parts
    pwm: lpss: Add ACPI and PCI IDs for Intel Braswell
    pwm: fsl-ftm: Select REGMAP_MMIO
    pwm: fsl-ftm: Document 'big-endian' property
    pwm: fsl-ftm: Convert to direct regmap API usage
    pwm: fsl-ftm: Clean up the code

    Linus Torvalds
     

20 Oct, 2014

2 commits


25 Sep, 2014

1 commit

  • The prescale value used for calculating the period was incremented
    afterwards, thus the resulting prescale value is by one too high.
    This resulted in a PWM frequency only half as high as requested.

    This patch moves the 64 bit division out of the prescale loop to
    correct the above issue and make the calculation more efficient.

    Signed-off-by: Nikolaus Voss
    Tested-by: Bo Shen
    Acked-by: Bo Shen
    Signed-off-by: Thierry Reding

    Nikolaus Voss
     

09 Sep, 2014

1 commit

  • Pull "Second batch of AT91 cleanup for 3.18" from Nicolas Ferre:
    - Timer Counter (TC) fixup and cleanup:
    - fix segmentation fault when kexec-ing a kernel by masking
    TC interrupts at shutdown and probe time
    - use modern driver model: devm_*, probe function, sanitize IRQ request

    Signed-off-by: Arnd Bergmann

    * tag 'at91-cleanup2' of git://github.com/at91linux/linux-at91:
    clocksource: tcb_clksrc: sanitize IRQ request
    ARM: at91/tclib: mask interruptions at shutdown and probe
    ARM: at91/tclib: move initialization from alloc to probe
    ARM: at91/tclib: prefer using of devm_* functions

    Arnd Bergmann
     

08 Sep, 2014

1 commit

  • Move resource retrieval from atmel_tc_alloc to tc_probe to avoid lately
    reporting resource related issues when a TC block user request a TC block.

    Moreover, resources retrieval are usually done in the probe function,
    thus moving them add some consistency with other drivers.

    Initialization is done once, ie not every time a tc block is requested.
    If it fails, the device is not appended to the list of tc blocks.

    Furhermore, the device id is retrieved at probe as well, avoiding parsing
    DT every time the user requests of tc block.

    Signed-off-by: Gaël PORTAY
    Acked-by: Thierry Reding
    Acked-by: Boris Brezillon
    Signed-off-by: Nicolas Ferre

    Gaël PORTAY
     

29 Aug, 2014

1 commit

  • With some versions of gcc (e.g. 4.1.2):

    drivers/pwm/core.c: In function ‘pwm_get’:
    drivers/pwm/core.c:610: warning: ‘polarity’ may be used uninitialized in this function
    drivers/pwm/core.c:609: warning: ‘period’ may be used uninitialized in this function

    While these are false positives, we can get rid of them by refactoring
    the code to store a pointer to the best match, as suggested before by
    Thierry Reding. This does require moving the mutex_unlock() down.

    Fixes: d717ea73e36dd565 ("pwm: Fix period and polarity in pwm_get() for non-perfect matches")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Thierry Reding

    Geert Uytterhoeven
     

26 Aug, 2014

1 commit


25 Aug, 2014

2 commits

  • The i.MX PWM version2 is embedded in several i.MX SoCs, such as i.MX27,
    i.MX51 and i.MX6SL. There is a 4-word (16 bit) sample FIFO in this IP.
    Each FIFO slot determines the duty period of a PWM waveform in one full
    cycle. The IP spec mentions that we should not write a fourth sample
    because the FIFO will become full and triggers a FIFO write error (FWE)
    which will prevent the PWM from starting once it is enabled. In order
    to avoid any sample FIFO overflow issue, this patch clears all sample
    FIFO by doing software reset in the configuration hook when the
    controller is disabled or waits for a full PWM cycle to get a
    relinquished FIFO slot when the controller is enabled and the FIFO is
    fully loaded.

    The FIFO overflow issue can be reproduced by the following commands on
    the i.MX6SL EVK platform, assuming we use PWM2 for the debug LED which
    is driven by the pin HSIC_STROBE and the maximal brightness is 255.

    echo 0 > /sys/class/leds/user/brightness
    echo 0 > /sys/class/leds/user/brightness
    echo 0 > /sys/class/leds/user/brightness
    echo 0 > /sys/class/leds/user/brightness
    echo 255 > /sys/class/leds/user/brightness

    Here, FWE happens (PWMSR register reads 0x58) and the LED can not be
    lighten.

    Another way to reproduce the FIFO overflow issue is to run this script:

    while true;
    do echo 255 > /sys/class/leds/user/brightness;
    done

    Cc: Thierry Reding
    Cc: Sascha Hauer
    Cc: Shawn Guo
    Cc: Lothar Waßmann
    Cc: linux-pwm@vger.kernel.org
    Cc: linux-arm-kernel@lists.infradead.org
    Signed-off-by: Liu Ying
    Acked-by: Shawn Guo
    Signed-off-by: Thierry Reding

    Liu Ying
     
  • This patch contains no logic change to cleanup indentation for register
    definitions only.

    Cc: Thierry Reding
    Cc: Sascha Hauer
    Cc: Shawn Guo
    Cc: Lothar Waßmann
    Cc: linux-pwm@vger.kernel.org
    Cc: linux-arm-kernel@lists.infradead.org
    Signed-off-by: Liu Ying
    Acked-by: Shawn Guo
    Signed-off-by: Thierry Reding

    Liu Ying