06 Sep, 2016

1 commit

  • From pwm_samsung_calc_tin(), there is routine to find the lowest divider
    possible to generate lower frequency than requested one. But it is
    always possible to generate requested frequency with large enough
    modulation bits except on s3c24xx, so this patch fixes to use lowest div
    for the case. This patch removes following UBSAN warning:

    UBSAN: Undefined behaviour in drivers/pwm/pwm-samsung.c:197:13
    shift exponent 32 is too large for 32-bit type 'long unsigned int'
    [...]
    [] (ubsan_epilogue) from [] (__ubsan_handle_shift_out_of_bounds+0xd8/0x120)
    [] (__ubsan_handle_shift_out_of_bounds) from [] (pwm_samsung_config+0x508/0x6a4)
    [] (pwm_samsung_config) from [] (pwm_apply_state+0x174/0x40c)
    [] (pwm_apply_state) from [] (pwm_fan_probe+0xc8/0x488)
    [] (pwm_fan_probe) from [] (platform_drv_probe+0x70/0x150)
    [...]

    Cc: Tomasz Figa
    Signed-off-by: Seung-Woo Kim
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Thierry Reding

    Seung-Woo Kim
     

21 May, 2015

1 commit


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
     

20 Oct, 2014

1 commit


21 May, 2014

1 commit

  • pwm_samsung_config() sets the manual update bit via a call to the
    pwm_samsung_enable() function even when the channel is already running.
    This causes noticable flicker on display if we try to change the
    backlight brightness from minimum to maximum, continuously.

    So, we remove the call to pwm_samsung_enable() from pwm_samsung_config
    to avoid the flicker and this change doesn't harm normal working since
    the pwm-backlight driver already calls pwm_samsung_enable() where
    needed.

    Signed-off-by: Ajay Kumar
    Reviewed-by: Tomasz Figa
    Signed-off-by: Thierry Reding

    Ajay Kumar
     

26 Feb, 2014

1 commit


01 Nov, 2013

1 commit

  • PWM channel data was set to NULL before freeing it. This caused the
    following kernel warning while unexporting the channel. Set the channel
    data to NULL after freeing it.

    [ 70.495000] WARNING: CPU: 0 PID: 1 at drivers/base/devres.c:805 pwm_put+0x48/0x80()
    [ 70.505000] Modules linked in:
    [ 70.505000] CPU: 0 PID: 1 Comm: sh Not tainted 3.12.0-rc6-next-20131024-00012-gd4aec04-dirty #58
    [ 70.515000] [] (unwind_backtrace+0x0/0xf4) from [] (show_stack+0x10/0x14)
    [ 70.525000] [] (show_stack+0x10/0x14) from [] (dump_stack+0x7c/0xb0)
    [ 70.530000] [] (dump_stack+0x7c/0xb0) from [] (warn_slowpath_common+0x6c/0x88)
    [ 70.540000] [] (warn_slowpath_common+0x6c/0x88) from [] (warn_slowpath_null+0x1c/0x24)
    [ 70.550000] [] (warn_slowpath_null+0x1c/0x24) from [] (pwm_put+0x48/0x80)
    [ 70.560000] [] (pwm_put+0x48/0x80) from [] (pwm_unexport_store+0x94/0xac)
    [ 70.565000] [] (pwm_unexport_store+0x94/0xac) from [] (sysfs_write_file+0x148/0x1d8)
    [ 70.575000] [] (sysfs_write_file+0x148/0x1d8) from [] (vfs_write+0xb4/0x1a0)
    [ 70.585000] [] (vfs_write+0xb4/0x1a0) from [] (SyS_write+0x3c/0x78)
    [ 70.595000] [] (SyS_write+0x3c/0x78) from [] (ret_fast_syscall+0x0/0x30)

    Signed-off-by: Sachin Kamat
    Reviewed-by: Jingoo Han
    Signed-off-by: Thierry Reding

    Sachin Kamat
     

08 Oct, 2013

1 commit


13 Aug, 2013

1 commit

  • This patch introduces new Samsung PWM driver, which is completely
    rewritten to be multiplatform- and DeviceTree-aware.

    In addition, remaining problems of old driver are fixed, such as:
    - proper handling of hardware variants,
    - synchronization on SMP systems,
    - handling of boundary parameter values,
    - hardware sharing with PWM clocksource driver,
    - undefined state of PWM output after stopping PWM channel.

    Signed-off-by: Tomasz Figa
    Reviewed-by: Sylwester Nawrocki
    Tested-by: Heiko Stuebner
    Tested-by: Mark Brown
    Tested-by: Sylwester Nawrocki
    Acked-by: Arnd Bergmann
    Acked-by: Thierry Reding

    Tomasz Figa
     

06 Aug, 2013

1 commit

  • This patch renames the old pwm-samsung driver to pwm-samsung-legacy to
    create place for the new, rewritten, DT-aware pwm-samsung driver.

    Signed-off-by: Tomasz Figa
    Reviewed-by: Sylwester Nawrocki
    Tested-by: Heiko Stuebner
    Tested-by: Mark Brown
    Tested-by: Sylwester Nawrocki
    Acked-by: Arnd Bergmann
    Acked-by: Thierry Reding

    Tomasz Figa
     

08 Mar, 2013

1 commit


20 Dec, 2012

1 commit

  • Pull pwm changes from Thierry Reding:
    "A new driver has been added for the SPEAr platform and the
    TWL4030/6030 driver has been replaced by two drivers that control the
    regular PWMs and the PWM driven LEDs provided by the chips.

    The vt8500, tiecap, tiehrpwm, i.MX, LPC32xx and Samsung drivers have
    all been improved and the device tree bindings now support the PWM
    signal polarity."

    Fix up trivial conflicts due to __devinit/exit removal.

    * tag 'for-3.8-rc1' of git://gitorious.org/linux-pwm/linux-pwm: (21 commits)
    pwm: samsung: add missing s3c->pwm_id assignment
    pwm: lpc32xx: Set the chip base for dynamic allocation
    pwm: lpc32xx: Properly disable the clock on device removal
    pwm: lpc32xx: Fix the PWM polarity
    pwm: i.MX: eliminate build warning
    pwm: Export of_pwm_xlate_with_flags()
    pwm: Remove pwm-twl6030 driver
    pwm: New driver to support PWM driven LEDs on TWL4030/6030 series of PMICs
    pwm: New driver to support PWMs on TWL4030/6030 series of PMICs
    pwm: pwm-tiehrpwm: pinctrl support
    pwm: tiehrpwm: Add device-tree binding
    pwm: pwm-tiehrpwm: Adding TBCLK gating support.
    pwm: pwm-tiecap: pinctrl support
    pwm: tiecap: Add device-tree binding
    pwm: Add TI PWM subsystem driver
    pwm: Device tree support for PWM polarity
    pwm: vt8500: Ensure PWM clock is enabled during pwm_config
    pwm: vt8500: Fix build error
    pwm: spear: Staticize spear_pwm_config()
    pwm: Add SPEAr PWM chip driver support
    ...

    Linus Torvalds
     

14 Dec, 2012

1 commit


29 Nov, 2012

2 commits


06 Oct, 2012

1 commit

  • Make sure the duty-cycle and period passed in are not negative. This
    should eventually be made implicit by making them unsigned. While at
    it, the drivers' .config() implementations can have the equivalent
    checks removed.

    Signed-off-by: Thierry Reding
    Cc: Shawn Guo
    Cc: Mark Brown
    Cc: Arnd Bergmann
    Cc: Sachin Kamat
    Cc: Axel Lin
    Cc: Kukjin Kim
    Cc: Jingoo Han
    Cc: Jonghwan Choi
    Cc: Sascha Hauer
    Cc: "Philip, Avinash"
    Cc: Vaibhav Bedia
    Acked-by: Jingoo Han

    Thierry Reding
     

17 Aug, 2012

1 commit


23 Jul, 2012

2 commits


03 Jul, 2012

1 commit