Message ID | 20231027071426.17724-2-Linhua.xu@unisoc.com |
---|---|
State | New |
Headers | show |
Series | pinctrl: sprd: Modification of UNIOC Platform pinctrl Driver | expand |
On Fri, Oct 27, 2023 at 03:14:21PM +0800, Linhua Xu wrote: > From: Linhua Xu <Linhua.Xu@unisoc.com> > > For UNISOC pin controller, there are three different configurations of > pull-up drive current. Modify the 20K pull-up resistor configuration and > add the 1.8K pull-up resistor configuration. > Fixes:<1fb4b907e808> ("pinctrl: sprd: Add Spreadtrum pin control driver") > > Signed-off-by: Linhua Xu <Linhua.Xu@unisoc.com> I guess I already pointed out that there must not be blank lines in the tag block, besides that read "Submitting Patches" document to see how properly format the Fixes: tag. ... > -#define PULL_UP_4_7K (BIT(12) | BIT(7)) > +#define PULL_UP_1_8K (BIT(12) | BIT(7)) > +#define PULL_UP_4_7K BIT(12) > #define PULL_UP_20K BIT(7) > #define PULL_UP_MASK 0x21 > #define PULL_UP_SHIFT 7 Basically these two repeat the above 1.8K case. But I see that you try to take care in the next patch about them. Still, the better is to use those _MASKs and _SHIFTs in the code. See below. ... > if ((reg & (SLEEP_PULL_DOWN | SLEEP_PULL_UP)) || > - (reg & (PULL_DOWN | PULL_UP_4_7K | PULL_UP_20K))) > + (reg & (PULL_DOWN | PULL_UP_4_7K | PULL_UP_20K | PULL_UP_1_8K))) if ((reg & (SLEEP_PULL_DOWN | SLEEP_PULL_UP)) || (reg & (PULL_DOWN | (PULL_UP_MASK << PULL_UP_SHIFT)))) > return -EINVAL; ... > mask = PULL_DOWN | PULL_UP_20K | > - PULL_UP_4_7K; > + PULL_UP_4_7K | PULL_UP_1_8K; mask = PULL_DOWN | (PULL_UP_MASK << PULL_UP_SHIFT); Ditto.
diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c index ca9659f4e4b1..74d8f8c3b9b6 100644 --- a/drivers/pinctrl/sprd/pinctrl-sprd.c +++ b/drivers/pinctrl/sprd/pinctrl-sprd.c @@ -71,7 +71,8 @@ #define SLEEP_PULL_UP_MASK 0x1 #define SLEEP_PULL_UP_SHIFT 3 -#define PULL_UP_4_7K (BIT(12) | BIT(7)) +#define PULL_UP_1_8K (BIT(12) | BIT(7)) +#define PULL_UP_4_7K BIT(12) #define PULL_UP_20K BIT(7) #define PULL_UP_MASK 0x21 #define PULL_UP_SHIFT 7 @@ -497,7 +498,7 @@ static int sprd_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin_id, break; case PIN_CONFIG_BIAS_DISABLE: if ((reg & (SLEEP_PULL_DOWN | SLEEP_PULL_UP)) || - (reg & (PULL_DOWN | PULL_UP_4_7K | PULL_UP_20K))) + (reg & (PULL_DOWN | PULL_UP_4_7K | PULL_UP_20K | PULL_UP_1_8K))) return -EINVAL; arg = 1; @@ -699,6 +700,8 @@ static int sprd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin_id, val |= PULL_UP_20K; else if (arg == 4700) val |= PULL_UP_4_7K; + else if (arg == 1800) + val |= PULL_UP_1_8K; mask = PULL_UP_MASK; shift = PULL_UP_SHIFT; @@ -711,7 +714,7 @@ static int sprd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin_id, } else { val = shift = 0; mask = PULL_DOWN | PULL_UP_20K | - PULL_UP_4_7K; + PULL_UP_4_7K | PULL_UP_1_8K; } break; case PIN_CONFIG_SLEEP_HARDWARE_STATE: