From: Mallikarjun Kasoju Date: Tue, 7 Jan 2014 08:40:56 +0000 (+0530) Subject: pinctrl: as3722: Set pin to output mode for some function X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=f8720e5ec752c33259c7c14349945d5feb069229;p=openwrt%2Fstaging%2Fblogic.git pinctrl: as3722: Set pin to output mode for some function If pins are used for function output like pwm, clk32k, power good etc then set it as output mode default. Signed-off-by: Mallikarjun Kasoju Signed-off-by: Laxman Dewangan Acked-by: Lee Jones Signed-off-by: Linus Walleij --- diff --git a/drivers/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3722.c index 01bffc1d52fd..3be47ae34d3a 100644 --- a/drivers/pinctrl/pinctrl-as3722.c +++ b/drivers/pinctrl/pinctrl-as3722.c @@ -250,6 +250,26 @@ static int as3722_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned function, return ret; } as_pci->gpio_control[group].io_function = function; + + switch (val) { + case AS3722_GPIO_IOSF_SD0_OUT: + case AS3722_GPIO_IOSF_PWR_GOOD_OUT: + case AS3722_GPIO_IOSF_Q32K_OUT: + case AS3722_GPIO_IOSF_PWM_OUT: + case AS3722_GPIO_IOSF_SD6_LOW_VOLT_LOW: + ret = as3722_update_bits(as_pci->as3722, gpio_cntr_reg, + AS3722_GPIO_MODE_MASK, AS3722_GPIO_MODE_OUTPUT_VDDH); + if (ret < 0) { + dev_err(as_pci->dev, "GPIO%d_CTRL update failed %d\n", + group, ret); + return ret; + } + as_pci->gpio_control[group].mode_prop = + AS3722_GPIO_MODE_OUTPUT_VDDH; + break; + default: + break; + } return ret; } diff --git a/include/linux/mfd/as3722.h b/include/linux/mfd/as3722.h index 16bf8a0dcd97..f654a7a42260 100644 --- a/include/linux/mfd/as3722.h +++ b/include/linux/mfd/as3722.h @@ -314,6 +314,7 @@ #define AS3722_GPIO_IOSF_GPIO_INTERRUPT_IN AS3722_GPIO_IOSF_VAL(3) #define AS3722_GPIO_IOSF_ISINK_PWM_IN AS3722_GPIO_IOSF_VAL(4) #define AS3722_GPIO_IOSF_VOLTAGE_STBY AS3722_GPIO_IOSF_VAL(5) +#define AS3722_GPIO_IOSF_SD0_OUT AS3722_GPIO_IOSF_VAL(6) #define AS3722_GPIO_IOSF_PWR_GOOD_OUT AS3722_GPIO_IOSF_VAL(7) #define AS3722_GPIO_IOSF_Q32K_OUT AS3722_GPIO_IOSF_VAL(8) #define AS3722_GPIO_IOSF_WATCHDOG_IN AS3722_GPIO_IOSF_VAL(9)