@@ -116,16 +116,12 @@ static void amd_gpio_set_value(struct gpio_chip *gc, unsigned offset, int value)
116
116
raw_spin_unlock_irqrestore (& gpio_dev -> lock , flags );
117
117
}
118
118
119
- static int amd_gpio_set_debounce (struct gpio_chip * gc , unsigned offset ,
120
- unsigned debounce )
119
+ static int amd_gpio_set_debounce (struct amd_gpio * gpio_dev , unsigned int offset ,
120
+ unsigned int debounce )
121
121
{
122
122
u32 time ;
123
123
u32 pin_reg ;
124
124
int ret = 0 ;
125
- unsigned long flags ;
126
- struct amd_gpio * gpio_dev = gpiochip_get_data (gc );
127
-
128
- raw_spin_lock_irqsave (& gpio_dev -> lock , flags );
129
125
130
126
/* Use special handling for Pin0 debounce */
131
127
if (offset == 0 ) {
@@ -184,7 +180,6 @@ static int amd_gpio_set_debounce(struct gpio_chip *gc, unsigned offset,
184
180
pin_reg &= ~(DB_CNTRl_MASK << DB_CNTRL_OFF );
185
181
}
186
182
writel (pin_reg , gpio_dev -> base + offset * 4 );
187
- raw_spin_unlock_irqrestore (& gpio_dev -> lock , flags );
188
183
189
184
return ret ;
190
185
}
@@ -782,9 +777,8 @@ static int amd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
782
777
783
778
switch (param ) {
784
779
case PIN_CONFIG_INPUT_DEBOUNCE :
785
- pin_reg &= ~DB_TMR_OUT_MASK ;
786
- pin_reg |= arg & DB_TMR_OUT_MASK ;
787
- break ;
780
+ ret = amd_gpio_set_debounce (gpio_dev , pin , arg );
781
+ goto out_unlock ;
788
782
789
783
case PIN_CONFIG_BIAS_PULL_DOWN :
790
784
pin_reg &= ~BIT (PULL_DOWN_ENABLE_OFF );
@@ -811,6 +805,7 @@ static int amd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
811
805
812
806
writel (pin_reg , gpio_dev -> base + pin * 4 );
813
807
}
808
+ out_unlock :
814
809
raw_spin_unlock_irqrestore (& gpio_dev -> lock , flags );
815
810
816
811
return ret ;
@@ -857,12 +852,6 @@ static int amd_gpio_set_config(struct gpio_chip *gc, unsigned int pin,
857
852
{
858
853
struct amd_gpio * gpio_dev = gpiochip_get_data (gc );
859
854
860
- if (pinconf_to_config_param (config ) == PIN_CONFIG_INPUT_DEBOUNCE ) {
861
- u32 debounce = pinconf_to_config_argument (config );
862
-
863
- return amd_gpio_set_debounce (gc , pin , debounce );
864
- }
865
-
866
855
return amd_pinconf_set (gpio_dev -> pctrl , pin , & config , 1 );
867
856
}
868
857
0 commit comments