Skip to content
  • Kuppuswamy Sathyanarayanan's avatar
    gpio: gpio-wcove: Fix GPIO control register offset calculation · 3a02dc97
    Kuppuswamy Sathyanarayanan authored
    According to Whiskey Cove PMIC GPIO controller specification, for GPIO
    pins 0-12, GPIO input and output register control address range from,
    
    0x4e44-0x4e50 for GPIO outputs control register
    
    0x4e51-0x4e5d for GPIO input control register
    
    But, currently when calculating the GPIO register offsets in to_reg()
    function, all GPIO pins in the same bank uses the same GPIO control
    register address. This logic is incorrect. This patch fixes this
    issue.
    
    This patch also adds support to selectively skip register modification
    for virtual GPIOs.
    
    In case of Whiskey Cove PMIC, ACPI code may use up 94 virtual GPIOs.
    These virtual GPIOs are used by the ACPI code as means to access various
    non GPIO bits of PMIC. So for these virtual GPIOs, we don't need to
    manipulate the physical GPIO pin register. A similar patch has been
    merged recently by Hans for Crystal Cove PMIC GPIO driver. You can
    find more details about it in Commit 9a752b4c
    
     ("gpio: crystalcove:
    Do not write regular gpio registers for virtual GPIOs")
    
    Signed-off-by: default avatarKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
    Reported-by: default avatarJukka Laitinen <jukka.laitinen@intel.com>
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    3a02dc97