11 Jul, 2016

27 commits

  • Use of_device_get_match_data() instead of an open-coded variant.

    Signed-off-by: Thierry Reding

    Thierry Reding
     
  • Avoid an overly long line by moving a comment around, and remove a use
    of else-after-return.

    Signed-off-by: Thierry Reding

    Thierry Reding
     
  • When disabling a PWM channel, the PWM clock was being stopped
    immediately after writing to PWM_DIS. As a result, the disabling
    of the PWM channel did not complete properly, and the PWM output
    might be left at the wrong level.

    Fix this by waiting for the channel to be effectively disabled
    (by checking the PWM_SR register) before disabling the clock.

    Signed-off-by: Guillermo Rodriguez
    Acked-by: Alexandre Belloni
    Signed-off-by: Thierry Reding

    Guillermo Rodriguez
     
  • Add device tree bindings for the PWM controller found on R-Car H3 SoCs.
    The controller is compatible with the one found in earlier generations
    of R-Car SoCs.

    Signed-off-by: Ulrich Hecht
    Acked-by: Geert Uytterhoeven
    Acked-by: Simon Horman
    Signed-off-by: Thierry Reding

    Ulrich Hecht
     
  • Replace ARCH_RCAR_GEN{1,2} with ARCH_RENESAS in order to support R-Car Gen3.

    Signed-off-by: Ryo Kodama
    Signed-off-by: Harunobu Kurokawa
    Signed-off-by: Ulrich Hecht
    Acked-by: Geert Uytterhoeven
    Acked-by: Simon Horman
    Signed-off-by: Thierry Reding

    Ryo Kodama
     
  • Tegra186 has multiple PWM controllers with only one output instead of
    one controller with four outputs in earlier SoC generations.

    Add support for Tegra186 and detect the number of PWM outputs using
    device tree match data.

    Signed-off-by: Laxman Dewangan
    Reviewed-by: Alexandre Courbot
    Signed-off-by: Thierry Reding

    Laxman Dewangan
     
  • Tegra186 has 8 different PWM controllers and each controller has only
    one output. Earlier SoC generations have 4 PWM outputs per controller.

    Add a device tree compatible string for Tegra186 to be able to
    differentiate between the two.

    Signed-off-by: Laxman Dewangan
    Signed-off-by: Thierry Reding

    Laxman Dewangan
     
  • duty_ns * (1 << PWM_DUTY_WIDTH) could overflow in integer calculation
    when the PWM rate is low. Hence do all calculation on unsigned long long
    to avoid overflow.

    Signed-off-by: Hyong Bin Kim
    Signed-off-by: Laxman Dewangan
    Signed-off-by: Thierry Reding

    Hyong Bin Kim
     
  • To get 100 % duty cycle (always high), pulse width needs to be set to
    256.

    Signed-off-by: Victor(Weiguo) Pan
    Signed-off-by: Laxman Dewangan
    Signed-off-by: Thierry Reding

    Victor(Weiguo) Pan
     
  • Add reset control of the PWM controller to reset it before
    accessing the PWM register.

    Signed-off-by: Rohith Seelaboyina
    Signed-off-by: Laxman Dewangan
    Signed-off-by: Thierry Reding

    Rohith Seelaboyina
     
  • The former is much longer to type and is ambiguous because the value
    stored in the field is not the (physical) base address of the memory-
    mapped I/O registers, but the virtual address of those registers as
    mapped through the MMU.

    Signed-off-by: Thierry Reding

    Thierry Reding
     
  • Use single spaces to separate data type from field names in structure
    definitions.

    Signed-off-by: Thierry Reding

    Thierry Reding
     
  • This macro is used to initialize the ->npwm field of the PWM chip. Use a
    literal instead and make all other places rely on ->npwm.

    Signed-off-by: Thierry Reding

    Thierry Reding
     
  • The PWM_PIN_LEVEL bit is leave unset by the kernel PWM driver.

    Prior to commit 08ee77b5a5de27ad63c92262ebcb4efe0da93b58,
    the PWM_PIN_LEVEL bit was always clear when the PWM was disable
    and a 0 logic level was apply to the output.

    According to the LPC32x0 User Manual [1],
    the default value for bit 30 (PWM_PIN_LEVEL) is 0.

    This change initialize the pin level to 0 (default value) and
    update the register value accordingly.

    [1] http://www.nxp.com/documents/user_manual/UM10326.pdf

    Signed-off-by: Sylvain Lemieux
    Signed-off-by: Thierry Reding

    Sylvain Lemieux
     
  • This adds a driver for the PWM block found in chips of the STMPE 24xx
    series of multi-purpose I2C expanders. (I think STMPE means ST
    Microelectronics Multi-Purpose Expander.) This PWM was designed in
    accordance with Nokia specifications and is kind of weird and usually
    just switched between max and zero duty cycle. However it is indeed a
    PWM so it needs to live in the PWM subsystem.

    This PWM is mostly used for white LED backlight.

    Cc: Lee Jones
    Signed-off-by: Linus Walleij
    Signed-off-by: Thierry Reding

    Linus Walleij
     
  • This adds fairly standard device tree bindings for the STMPE PWM found
    in STMPE24xx multi-purpose expanders.

    Cc: devicetree@vger.kernel.org
    Acked-by: Rob Herring
    Signed-off-by: Linus Walleij
    Signed-off-by: Thierry Reding

    Linus Walleij
     
  • Implement the ->apply() function to add support for atomic update.

    Signed-off-by: Boris Brezillon
    Tested-by: Heiko Stuebner
    Reviewed-by: Brian Norris
    Tested-by: Brian Norris
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • The current logic will disable the PWM clk even if the PWM was left
    enabled by the bootloader (because it's controlling a critical device
    like a regulator for example).
    Keep the PWM clk enabled if the PWM is enabled to avoid any glitches.

    Signed-off-by: Boris Brezillon
    Reviewed-by: Brian Norris
    Tested-by: Brian Norris
    Tested-by: Heiko Stuebner
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • Implement the ->get_state() function to expose initial state.

    Signed-off-by: Boris Brezillon
    Reviewed-by: Brian Norris
    Tested-by: Brian Norris
    Tested-by: Heiko Stuebner
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • The current implementation always round down the duty and period values,
    while it would be better to round them to the closest integer.

    These changes are needed in preparation of atomic update support to
    prevent a period/duty cycle drift when executing several times the
    'pwm_get_state() / modify / pwm_apply_state()' sequence.

    Say you have an expected period of 3.333 us and a clk rate of
    112.666667 MHz -- the clock frequency doesn't divide evenly, so the
    period (stashed in nanoseconds) shrinks when we convert to the register
    value and back, as follows:

    pwm_apply_state(): register = period * 112666667 / 1000000000;
    pwm_get_state(): period = register * 1000000000 / 112666667;

    or in other words:

    period = period * 112666667 / 1000000000 * 1000000000 / 112666667;

    which yields a sequence like:

    3333 -> 3328
    3328 -> 3319
    3319 -> 3310
    3310 -> 3301
    3301 -> 3292
    3292 -> ... (etc) ...

    With this patch, we'd see instead:

    period = div_round_closest(period * 112666667, 1000000000) *
    1000000000 / 112666667;

    which yields a stable sequence:

    3333 -> 3337
    3337 -> 3337
    3337 -> ... (etc) ...

    Signed-off-by: Boris Brezillon
    Reviewed-by: Brian Norris
    Tested-by: Brian Norris
    Tested-by: Heiko Stuebner
    Signed-off-by: Thierry Reding

    Boris Brezillon
     
  • Add support for the PWM controller present in Broadcom's iProc family of
    SoCs. It has been tested on the Northstar+ bcm958625HR board.

    Signed-off-by: Yendapally Reddy Dhananjaya Reddy
    [thierry.reding@gmail.com: bunch of coding style fixes, cleanups]
    Signed-off-by: Thierry Reding

    Yendapally Reddy Dhananjaya Reddy
     
  • Add a device tree binding for Broadcom iProc PWM controller.

    Signed-off-by: Yendapally Reddy Dhananjaya Reddy
    Acked-by: Rob Herring
    Signed-off-by: Thierry Reding

    Yendapally Reddy Dhananjaya Reddy
     
  • There is no need to check each time if the clk_rate defined or not when we call
    pwm_lpss_config(). Move the check to ->probe() instead.

    Signed-off-by: Andy Shevchenko
    Signed-off-by: Thierry Reding

    Andy Shevchenko
     
  • Intel Edison has 4 PWM channels on the die with the same IP as in
    Broxton. Enable it.

    Signed-off-by: Andy Shevchenko
    Signed-off-by: Thierry Reding

    Andy Shevchenko
     
  • If duty_ns is large enough multiplying it by 255 overflows and results
    wrong duty cycle value being programmed. For example with 10ms duty when
    period is 20ms (50%) we get

    255 * 10000000 / 20000000 = -87

    because 255 * 10000000 overlows int. Whereas correct value should be

    255 * 10000000 / 20000000 = 127

    Fix this by using unsigned long long as type for on_time_div and changing
    integer literals to use proper type annotation.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Thierry Reding

    Mika Westerberg
     
  • The base_unit calculation applies an offset of 0x2 which adds
    significant error for lower frequencies and doesn't appear to be
    warranted - rounding the division result gives a correct value.

    Also, the upper limit check for base_unit is off-by-one; the upper
    nibble of base_unit is invalid if >=128 according to the Table 88
    in the Z8000 Processor Series Datasheet Volume 1 (Rev. 2).

    Verified on UP Board (Cherry Trail) and Minnowboard Max (Bay Trail).

    Signed-off-by: Dan O'Donovan
    Acked-by: Mika Westerberg
    Signed-off-by: Thierry Reding

    Dan O'Donovan
     
  • The PWMSS local clock gating registers have no real purpose on OMAP ARM
    devices. These registers were left over registers from DSP IP where the
    PRCM doesn't exist. There is a silicon bug where gating and ungating clocks
    don't function properly. TRMs will be update to indicate that these
    registers shouldn't be touched.

    Therefore, all code that accesses the PWMSS_CLKCONFIG or PWMSS_CLKSTATUS
    will be removed by this patch with zero loss of functionality by the ECAP
    and EPWM drivers.

    Signed-off-by: Franklin S Cooper Jr
    Signed-off-by: Thierry Reding

    Cooper Jr., Franklin
     

08 Jul, 2016

2 commits


30 May, 2016

1 commit


29 May, 2016

10 commits

  • The self-test was updated to cover zero-length strings; the function
    needs to be updated, too.

    Reported-by: Geert Uytterhoeven
    Signed-off-by: George Spelvin
    Fixes: fcfd2fbf22d2 ("fs/namei.c: Add hashlen_string() function")
    Signed-off-by: Linus Torvalds

    George Spelvin
     
  • The original name was simply hash_string(), but that conflicted with a
    function with that name in drivers/base/power/trace.c, and I decided
    that calling it "hashlen_" was better anyway.

    But you have to do it in two places.

    [ This caused build errors for architectures that don't define
    CONFIG_DCACHE_WORD_ACCESS - Linus ]

    Signed-off-by: George Spelvin
    Reported-by: Guenter Roeck
    Fixes: fcfd2fbf22d2 ("fs/namei.c: Add hashlen_string() function")
    Signed-off-by: Linus Torvalds

    George Spelvin
     
  • The HPFS filesystem used generic_show_options to produce string that is
    displayed in /proc/mounts. However, there is a problem that the options
    may disappear after remount. If we mount the filesystem with option1
    and then remount it with option2, /proc/mounts should show both option1
    and option2, however it only shows option2 because the whole option
    string is replaced with replace_mount_options in hpfs_remount_fs.

    To fix this bug, implement the hpfs_show_options function that prints
    options that are currently selected.

    Signed-off-by: Mikulas Patocka
    Cc: stable@vger.kernel.org
    Signed-off-by: Linus Torvalds

    Mikulas Patocka
     
  • Commit c8f33d0bec99 ("affs: kstrdup() memory handling") checks if the
    kstrdup function returns NULL due to out-of-memory condition.

    However, if we are remounting a filesystem with no change to
    filesystem-specific options, the parameter data is NULL. In this case,
    kstrdup returns NULL (because it was passed NULL parameter), although no
    out of memory condition exists. The mount syscall then fails with
    ENOMEM.

    This patch fixes the bug. We fail with ENOMEM only if data is non-NULL.

    The patch also changes the call to replace_mount_options - if we didn't
    pass any filesystem-specific options, we don't call
    replace_mount_options (thus we don't erase existing reported options).

    Fixes: c8f33d0bec99 ("affs: kstrdup() memory handling")
    Signed-off-by: Mikulas Patocka
    Cc: stable@vger.kernel.org # v4.1+
    Signed-off-by: Linus Torvalds

    Mikulas Patocka
     
  • Commit ce657611baf9 ("hpfs: kstrdup() out of memory handling") checks if
    the kstrdup function returns NULL due to out-of-memory condition.

    However, if we are remounting a filesystem with no change to
    filesystem-specific options, the parameter data is NULL. In this case,
    kstrdup returns NULL (because it was passed NULL parameter), although no
    out of memory condition exists. The mount syscall then fails with
    ENOMEM.

    This patch fixes the bug. We fail with ENOMEM only if data is non-NULL.

    The patch also changes the call to replace_mount_options - if we didn't
    pass any filesystem-specific options, we don't call
    replace_mount_options (thus we don't erase existing reported options).

    Fixes: ce657611baf9 ("hpfs: kstrdup() out of memory handling")
    Signed-off-by: Mikulas Patocka
    Cc: stable@vger.kernel.org
    Signed-off-by: Linus Torvalds

    Mikulas Patocka
     
  • Pull more MIPS updates from Ralf Baechle:
    "This is the secondnd batch of MIPS patches for 4.7. Summary:

    CPS:
    - Copy EVA configuration when starting secondary VPs.

    EIC:
    - Clear Status IPL.

    Lasat:
    - Fix a few off by one bugs.

    lib:
    - Mark intrinsics notrace. Not only are the intrinsics
    uninteresting, it would cause infinite recursion.

    MAINTAINERS:
    - Add file patterns for MIPS BRCM device tree bindings.
    - Add file patterns for mips device tree bindings.

    MT7628:
    - Fix MT7628 pinmux typos.
    - wled_an pinmux gpio.
    - EPHY LEDs pinmux support.

    Pistachio:
    - Enable KASLR

    VDSO:
    - Build microMIPS VDSO for microMIPS kernels.
    - Fix aliasing warning by building with `-fno-strict-aliasing' for
    debugging but also tracing them might result in recursion.

    Misc:
    - Add missing FROZEN hotplug notifier transitions.
    - Fix clk binding example for varioius PIC32 devices.
    - Fix cpu interrupt controller node-names in the DT files.
    - Fix XPA CPU feature separation.
    - Fix write_gc0_* macros when writing zero.
    - Add inline asm encoding helpers.
    - Add missing VZ accessor microMIPS encodings.
    - Fix little endian microMIPS MSA encodings.
    - Add 64-bit HTW fields and fix its configuration.
    - Fix sigreturn via VDSO on microMIPS kernel.
    - Lots of typo fixes.
    - Add definitions of SegCtl registers and use them"

    * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (49 commits)
    MIPS: Add missing FROZEN hotplug notifier transitions
    MIPS: Build microMIPS VDSO for microMIPS kernels
    MIPS: Fix sigreturn via VDSO on microMIPS kernel
    MIPS: devicetree: fix cpu interrupt controller node-names
    MIPS: VDSO: Build with `-fno-strict-aliasing'
    MIPS: Pistachio: Enable KASLR
    MIPS: lib: Mark intrinsics notrace
    MIPS: Fix 64-bit HTW configuration
    MIPS: Add 64-bit HTW fields
    MAINTAINERS: Add file patterns for mips device tree bindings
    MAINTAINERS: Add file patterns for mips brcm device tree bindings
    MIPS: Simplify DSP instruction encoding macros
    MIPS: Add missing tlbinvf/XPA microMIPS encodings
    MIPS: Fix little endian microMIPS MSA encodings
    MIPS: Add missing VZ accessor microMIPS encodings
    MIPS: Add inline asm encoding helpers
    MIPS: Spelling fix lets -> let's
    MIPS: VR41xx: Fix typo
    MIPS: oprofile: Fix typo
    MIPS: math-emu: Fix typo
    ...

    Linus Torvalds
     
  • Various builds (such as i386:allmodconfig) fail with

    fs/binfmt_aout.c:133:2: error: expected identifier or '(' before 'return'
    fs/binfmt_aout.c:134:1: error: expected identifier or '(' before '}' token

    [ Oops. My bad, I had stupidly thought that "allmodconfig" covered this
    on x86-64 too, but it obviously doesn't. Egg on my face. - Linus ]

    Fixes: 5d22fc25d4fc ("mm: remove more IS_ERR_VALUE abuses")
    Signed-off-by: Guenter Roeck
    Signed-off-by: Linus Torvalds

    Guenter Roeck
     
  • Pull string hash improvements from George Spelvin:
    "This series does several related things:

    - Makes the dcache hash (fs/namei.c) useful for general kernel use.

    (Thanks to Bruce for noticing the zero-length corner case)

    - Converts the string hashes in to use the
    above.

    - Avoids 64-bit multiplies in hash_64() on 32-bit platforms. Two
    32-bit multiplies will do well enough.

    - Rids the world of the bad hash multipliers in hash_32.

    This finishes the job started in commit 689de1d6ca95 ("Minimal
    fix-up of bad hashing behavior of hash_64()")

    The vast majority of Linux architectures have hardware support for
    32x32-bit multiply and so derive no benefit from "simplified"
    multipliers.

    The few processors that do not (68000, h8/300 and some models of
    Microblaze) have arch-specific implementations added. Those
    patches are last in the series.

    - Overhauls the dcache hash mixing.

    The patch in commit 0fed3ac866ea ("namei: Improve hash mixing if
    CONFIG_DCACHE_WORD_ACCESS") was an off-the-cuff suggestion.
    Replaced with a much more careful design that's simultaneously
    faster and better. (My own invention, as there was noting suitable
    in the literature I could find. Comments welcome!)

    - Modify the hash_name() loop to skip the initial HASH_MIX(). This
    would let us salt the hash if we ever wanted to.

    - Sort out partial_name_hash().

    The hash function is declared as using a long state, even though
    it's truncated to 32 bits at the end and the extra internal state
    contributes nothing to the result. And some callers do odd things:

    - fs/hfs/string.c only allocates 32 bits of state
    - fs/hfsplus/unicode.c uses it to hash 16-bit unicode symbols not bytes

    - Modify bytemask_from_count to handle inputs of 1..sizeof(long)
    rather than 0..sizeof(long)-1. This would simplify users other
    than full_name_hash"

    Special thanks to Bruce Fields for testing and finding bugs in v1. (I
    learned some humbling lessons about "obviously correct" code.)

    On the arch-specific front, the m68k assembly has been tested in a
    standalone test harness, I've been in contact with the Microblaze
    maintainers who mostly don't care, as the hardware multiplier is never
    omitted in real-world applications, and I haven't heard anything from
    the H8/300 world"

    * 'hash' of git://ftp.sciencehorizons.net/linux:
    h8300: Add
    microblaze: Add
    m68k: Add
    : Add support for architecture-specific functions
    fs/namei.c: Improve dcache hash function
    Eliminate bad hash multipliers from hash_32() and hash_64()
    Change hash_64() return value to 32 bits
    : Define hash_str() in terms of hashlen_string()
    fs/namei.c: Add hashlen_string() function
    Pull out string hash to

    Linus Torvalds
     
  • This will improve the performance of hash_32() and hash_64(), but due
    to complete lack of multi-bit shift instructions on H8, performance will
    still be bad in surrounding code.

    Designing H8-specific hash algorithms to work around that is a separate
    project. (But if the maintainers would like to get in touch...)

    Signed-off-by: George Spelvin
    Cc: Yoshinori Sato
    Cc: uclinux-h8-devel@lists.sourceforge.jp

    George Spelvin
     
  • Microblaze is an FPGA soft core that can be configured various ways.

    If it is configured without a multiplier, the standard __hash_32()
    will require a call to __mulsi3, which is a slow software loop.

    Instead, use a shift-and-add sequence for the constant multiply.
    GCC knows how to do this, but it's not as clever as some.

    Signed-off-by: George Spelvin
    Cc: Alistair Francis
    Cc: Michal Simek

    George Spelvin