diff mbox series

pinctrl: k210: Fix bias-pull-up

Message ID 20220209182822.640905-1-seanga2@gmail.com (mailing list archive)
State New, archived
Headers show
Series pinctrl: k210: Fix bias-pull-up | expand

Commit Message

Sean Anderson Feb. 9, 2022, 6:28 p.m. UTC
Using bias-pull-up would actually cause the pin to have its pull-down
enabled. Fix this.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

 drivers/pinctrl/pinctrl-k210.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sean Anderson Feb. 9, 2022, 6:29 p.m. UTC | #1
On 2/9/22 1:28 PM, Sean Anderson wrote:
> Using bias-pull-up would actually cause the pin to have its pull-down
> enabled. Fix this.
> 
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> ---
> 
>   drivers/pinctrl/pinctrl-k210.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c
> index 49e32684dbb2..1ad61b32ec88 100644
> --- a/drivers/pinctrl/pinctrl-k210.c
> +++ b/drivers/pinctrl/pinctrl-k210.c
> @@ -527,7 +527,7 @@ static int k210_pinconf_set_param(struct pinctrl_dev *pctldev,
>   	case PIN_CONFIG_BIAS_PULL_UP:
>   		if (!arg)
>   			return -EINVAL;
> -		val |= K210_PC_PD;
> +		val |= K210_PC_PU;
>   		break;
>   	case PIN_CONFIG_DRIVE_STRENGTH:
>   		arg *= 1000;
> 

This should have

Fixes: d4c34d09ab03 ("pinctrl: Add RISC-V Canaan Kendryte K210 FPIOA driver")
Damien Le Moal Feb. 9, 2022, 11:34 p.m. UTC | #2
On 2/10/22 03:28, Sean Anderson wrote:
> Using bias-pull-up would actually cause the pin to have its pull-down
> enabled. Fix this.
> 
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> ---
> 
>  drivers/pinctrl/pinctrl-k210.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c
> index 49e32684dbb2..1ad61b32ec88 100644
> --- a/drivers/pinctrl/pinctrl-k210.c
> +++ b/drivers/pinctrl/pinctrl-k210.c
> @@ -527,7 +527,7 @@ static int k210_pinconf_set_param(struct pinctrl_dev *pctldev,
>  	case PIN_CONFIG_BIAS_PULL_UP:
>  		if (!arg)
>  			return -EINVAL;
> -		val |= K210_PC_PD;
> +		val |= K210_PC_PU;
>  		break;
>  	case PIN_CONFIG_DRIVE_STRENGTH:
>  		arg *= 1000;

Ooops... My bad :)

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Sean Anderson Feb. 9, 2022, 11:52 p.m. UTC | #3
On 2/9/22 6:34 PM, Damien Le Moal wrote:
> On 2/10/22 03:28, Sean Anderson wrote:
>> Using bias-pull-up would actually cause the pin to have its pull-down
>> enabled. Fix this.
>>
>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
>> ---
>>
>>   drivers/pinctrl/pinctrl-k210.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c
>> index 49e32684dbb2..1ad61b32ec88 100644
>> --- a/drivers/pinctrl/pinctrl-k210.c
>> +++ b/drivers/pinctrl/pinctrl-k210.c
>> @@ -527,7 +527,7 @@ static int k210_pinconf_set_param(struct pinctrl_dev *pctldev,
>>   	case PIN_CONFIG_BIAS_PULL_UP:
>>   		if (!arg)
>>   			return -EINVAL;
>> -		val |= K210_PC_PD;
>> +		val |= K210_PC_PU;
>>   		break;
>>   	case PIN_CONFIG_DRIVE_STRENGTH:
>>   		arg *= 1000;
> 
> Ooops... My bad :)

(This is in U-Boot as well, so it looks like it's my bad)
Damien Le Moal Feb. 9, 2022, 11:59 p.m. UTC | #4
On 2022/02/10 8:52, Sean Anderson wrote:
> On 2/9/22 6:34 PM, Damien Le Moal wrote:
>> On 2/10/22 03:28, Sean Anderson wrote:
>>> Using bias-pull-up would actually cause the pin to have its pull-down
>>> enabled. Fix this.
>>>
>>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
>>> ---
>>>
>>>   drivers/pinctrl/pinctrl-k210.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c
>>> index 49e32684dbb2..1ad61b32ec88 100644
>>> --- a/drivers/pinctrl/pinctrl-k210.c
>>> +++ b/drivers/pinctrl/pinctrl-k210.c
>>> @@ -527,7 +527,7 @@ static int k210_pinconf_set_param(struct pinctrl_dev *pctldev,
>>>   	case PIN_CONFIG_BIAS_PULL_UP:
>>>   		if (!arg)
>>>   			return -EINVAL;
>>> -		val |= K210_PC_PD;
>>> +		val |= K210_PC_PU;
>>>   		break;
>>>   	case PIN_CONFIG_DRIVE_STRENGTH:
>>>   		arg *= 1000;
>>
>> Ooops... My bad :)
> 
> (This is in U-Boot as well, so it looks like it's my bad)

I copy-pasted a bug, still my bad :)
Linus Walleij Feb. 11, 2022, 1:20 a.m. UTC | #5
On Wed, Feb 9, 2022 at 7:28 PM Sean Anderson <seanga2@gmail.com> wrote:

> Using bias-pull-up would actually cause the pin to have its pull-down
> enabled. Fix this.
>
> Signed-off-by: Sean Anderson <seanga2@gmail.com>

Patch applied for fixes.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c
index 49e32684dbb2..1ad61b32ec88 100644
--- a/drivers/pinctrl/pinctrl-k210.c
+++ b/drivers/pinctrl/pinctrl-k210.c
@@ -527,7 +527,7 @@  static int k210_pinconf_set_param(struct pinctrl_dev *pctldev,
 	case PIN_CONFIG_BIAS_PULL_UP:
 		if (!arg)
 			return -EINVAL;
-		val |= K210_PC_PD;
+		val |= K210_PC_PU;
 		break;
 	case PIN_CONFIG_DRIVE_STRENGTH:
 		arg *= 1000;