Skip to content

Commit 4159466

Browse files
committed
Merge tag 'pinctrl-v6.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control fixes from Linus Walleij: - Fix the hwirq map and pin offsets in the Qualcomm X1E80100 driver - Fix the pin range handling in the AT91 driver so it works again - Fix a NULL-dereference risk in pinctrl single - Fix a serious biasing bug in the Mediatek driver - Fix the level trigged IRQ in the StarFive JH7110 - Fix the iomux width in the Rockchip GPIO2-B pin handling * tag 'pinctrl-v6.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: rockchip: correct RK3328 iomux width flag for GPIO2-B pins pinctrl: starfive: jh7110: Correct the level trigger configuration of iev register pinctrl: qcom: x1e80100: Fix special pin offsets pinctrl: mediatek: common-v2: Fix broken bias-disable for PULL_PU_PD_RSEL_TYPE pinctrl: single: fix potential NULL dereference in pcs_get_function() pinctrl: at91: make it work with current gpiolib pinctrl: qcom: x1e80100: Update PDC hwirq map
2 parents 6ace1c7 + 128f71f commit 4159466

File tree

6 files changed

+57
-46
lines changed

6 files changed

+57
-46
lines changed

drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -709,32 +709,35 @@ static int mtk_pinconf_bias_set_rsel(struct mtk_pinctrl *hw,
709709
{
710710
int err, rsel_val;
711711

712-
if (!pullup && arg == MTK_DISABLE)
713-
return 0;
714-
715712
if (hw->rsel_si_unit) {
716713
/* find pin rsel_index from pin_rsel array*/
717714
err = mtk_hw_pin_rsel_lookup(hw, desc, pullup, arg, &rsel_val);
718715
if (err)
719-
goto out;
716+
return err;
720717
} else {
721-
if (arg < MTK_PULL_SET_RSEL_000 ||
722-
arg > MTK_PULL_SET_RSEL_111) {
723-
err = -EINVAL;
724-
goto out;
725-
}
718+
if (arg < MTK_PULL_SET_RSEL_000 || arg > MTK_PULL_SET_RSEL_111)
719+
return -EINVAL;
726720

727721
rsel_val = arg - MTK_PULL_SET_RSEL_000;
728722
}
729723

730-
err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_RSEL, rsel_val);
731-
if (err)
732-
goto out;
724+
return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_RSEL, rsel_val);
725+
}
733726

734-
err = mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, MTK_ENABLE);
727+
static int mtk_pinconf_bias_set_pu_pd_rsel(struct mtk_pinctrl *hw,
728+
const struct mtk_pin_desc *desc,
729+
u32 pullup, u32 arg)
730+
{
731+
u32 enable = arg == MTK_DISABLE ? MTK_DISABLE : MTK_ENABLE;
732+
int err;
735733

736-
out:
737-
return err;
734+
if (arg != MTK_DISABLE) {
735+
err = mtk_pinconf_bias_set_rsel(hw, desc, pullup, arg);
736+
if (err)
737+
return err;
738+
}
739+
740+
return mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, enable);
738741
}
739742

740743
int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw,
@@ -750,22 +753,22 @@ int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw,
750753
try_all_type = MTK_PULL_TYPE_MASK;
751754

752755
if (try_all_type & MTK_PULL_RSEL_TYPE) {
753-
err = mtk_pinconf_bias_set_rsel(hw, desc, pullup, arg);
756+
err = mtk_pinconf_bias_set_pu_pd_rsel(hw, desc, pullup, arg);
754757
if (!err)
755-
return err;
758+
return 0;
756759
}
757760

758761
if (try_all_type & MTK_PULL_PU_PD_TYPE) {
759762
err = mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, arg);
760763
if (!err)
761-
return err;
764+
return 0;
762765
}
763766

764767
if (try_all_type & MTK_PULL_PULLSEL_TYPE) {
765768
err = mtk_pinconf_bias_set_pullsel_pullen(hw, desc,
766769
pullup, arg);
767770
if (!err)
768-
return err;
771+
return 0;
769772
}
770773

771774
if (try_all_type & MTK_PULL_PUPD_R1R0_TYPE)
@@ -803,9 +806,9 @@ static int mtk_rsel_get_si_unit(struct mtk_pinctrl *hw,
803806
return 0;
804807
}
805808

806-
static int mtk_pinconf_bias_get_rsel(struct mtk_pinctrl *hw,
807-
const struct mtk_pin_desc *desc,
808-
u32 *pullup, u32 *enable)
809+
static int mtk_pinconf_bias_get_pu_pd_rsel(struct mtk_pinctrl *hw,
810+
const struct mtk_pin_desc *desc,
811+
u32 *pullup, u32 *enable)
809812
{
810813
int pu, pd, rsel, err;
811814

@@ -939,22 +942,22 @@ int mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw,
939942
try_all_type = MTK_PULL_TYPE_MASK;
940943

941944
if (try_all_type & MTK_PULL_RSEL_TYPE) {
942-
err = mtk_pinconf_bias_get_rsel(hw, desc, pullup, enable);
945+
err = mtk_pinconf_bias_get_pu_pd_rsel(hw, desc, pullup, enable);
943946
if (!err)
944-
return err;
947+
return 0;
945948
}
946949

947950
if (try_all_type & MTK_PULL_PU_PD_TYPE) {
948951
err = mtk_pinconf_bias_get_pu_pd(hw, desc, pullup, enable);
949952
if (!err)
950-
return err;
953+
return 0;
951954
}
952955

953956
if (try_all_type & MTK_PULL_PULLSEL_TYPE) {
954957
err = mtk_pinconf_bias_get_pullsel_pullen(hw, desc,
955958
pullup, enable);
956959
if (!err)
957-
return err;
960+
return 0;
958961
}
959962

960963
if (try_all_type & MTK_PULL_PUPD_R1R0_TYPE)

drivers/pinctrl/pinctrl-at91.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1403,8 +1403,11 @@ static int at91_pinctrl_probe(struct platform_device *pdev)
14031403

14041404
/* We will handle a range of GPIO pins */
14051405
for (i = 0; i < gpio_banks; i++)
1406-
if (gpio_chips[i])
1406+
if (gpio_chips[i]) {
14071407
pinctrl_add_gpio_range(info->pctl, &gpio_chips[i]->range);
1408+
gpiochip_add_pin_range(&gpio_chips[i]->chip, dev_name(info->pctl->dev), 0,
1409+
gpio_chips[i]->range.pin_base, gpio_chips[i]->range.npins);
1410+
}
14081411

14091412
dev_info(dev, "initialized AT91 pinctrl driver\n");
14101413

drivers/pinctrl/pinctrl-rockchip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3795,7 +3795,7 @@ static struct rockchip_pin_bank rk3328_pin_banks[] = {
37953795
PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", 0, 0, 0, 0),
37963796
PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0),
37973797
PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0,
3798-
0,
3798+
IOMUX_WIDTH_2BIT,
37993799
IOMUX_WIDTH_3BIT,
38003800
0),
38013801
PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3",

drivers/pinctrl/pinctrl-single.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ static int pcs_get_function(struct pinctrl_dev *pctldev, unsigned pin,
345345
return -ENOTSUPP;
346346
fselector = setting->func;
347347
function = pinmux_generic_get_function(pctldev, fselector);
348+
if (!function)
349+
return -EINVAL;
348350
*func = function->data;
349351
if (!(*func)) {
350352
dev_err(pcs->dev, "%s could not find function%i\n",

drivers/pinctrl/qcom/pinctrl-x1e80100.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,26 +1805,29 @@ static const struct msm_pingroup x1e80100_groups[] = {
18051805
[235] = PINGROUP(235, aon_cci, qdss_gpio, _, _, _, _, _, _, _),
18061806
[236] = PINGROUP(236, aon_cci, qdss_gpio, _, _, _, _, _, _, _),
18071807
[237] = PINGROUP(237, _, _, _, _, _, _, _, _, _),
1808-
[238] = UFS_RESET(ufs_reset, 0x1f9000),
1809-
[239] = SDC_QDSD_PINGROUP(sdc2_clk, 0x1f2000, 14, 6),
1810-
[240] = SDC_QDSD_PINGROUP(sdc2_cmd, 0x1f2000, 11, 3),
1811-
[241] = SDC_QDSD_PINGROUP(sdc2_data, 0x1f2000, 9, 0),
1808+
[238] = UFS_RESET(ufs_reset, 0xf9000),
1809+
[239] = SDC_QDSD_PINGROUP(sdc2_clk, 0xf2000, 14, 6),
1810+
[240] = SDC_QDSD_PINGROUP(sdc2_cmd, 0xf2000, 11, 3),
1811+
[241] = SDC_QDSD_PINGROUP(sdc2_data, 0xf2000, 9, 0),
18121812
};
18131813

18141814
static const struct msm_gpio_wakeirq_map x1e80100_pdc_map[] = {
18151815
{ 0, 72 }, { 2, 70 }, { 3, 71 }, { 6, 123 }, { 7, 67 }, { 11, 85 },
1816-
{ 15, 68 }, { 18, 122 }, { 19, 69 }, { 21, 158 }, { 23, 143 }, { 26, 129 },
1817-
{ 27, 144 }, { 28, 77 }, { 29, 78 }, { 30, 92 }, { 32, 145 }, { 33, 115 },
1818-
{ 34, 130 }, { 35, 146 }, { 36, 147 }, { 39, 80 }, { 43, 148 }, { 47, 149 },
1819-
{ 51, 79 }, { 53, 89 }, { 59, 87 }, { 64, 90 }, { 65, 106 }, { 66, 142 },
1820-
{ 67, 88 }, { 71, 91 }, { 75, 152 }, { 79, 153 }, { 80, 125 }, { 81, 128 },
1821-
{ 84, 137 }, { 85, 155 }, { 87, 156 }, { 91, 157 }, { 92, 138 }, { 94, 140 },
1822-
{ 95, 141 }, { 113, 84 }, { 121, 73 }, { 123, 74 }, { 129, 76 }, { 131, 82 },
1823-
{ 134, 83 }, { 141, 93 }, { 144, 94 }, { 147, 96 }, { 148, 97 }, { 150, 102 },
1824-
{ 151, 103 }, { 153, 104 }, { 156, 105 }, { 157, 107 }, { 163, 98 }, { 166, 112 },
1825-
{ 172, 99 }, { 181, 101 }, { 184, 116 }, { 193, 40 }, { 193, 117 }, { 196, 108 },
1826-
{ 203, 133 }, { 212, 120 }, { 213, 150 }, { 214, 121 }, { 215, 118 }, { 217, 109 },
1827-
{ 220, 110 }, { 221, 111 }, { 222, 124 }, { 224, 131 }, { 225, 132 },
1816+
{ 13, 86 }, { 15, 68 }, { 18, 122 }, { 19, 69 }, { 21, 158 }, { 23, 143 },
1817+
{ 24, 126 }, { 26, 129 }, { 27, 144 }, { 28, 77 }, { 29, 78 }, { 30, 92 },
1818+
{ 31, 159 }, { 32, 145 }, { 33, 115 }, { 34, 130 }, { 35, 146 }, { 36, 147 },
1819+
{ 38, 113 }, { 39, 80 }, { 43, 148 }, { 47, 149 }, { 51, 79 }, { 53, 89 },
1820+
{ 55, 81 }, { 59, 87 }, { 64, 90 }, { 65, 106 }, { 66, 142 }, { 67, 88 },
1821+
{ 68, 151 }, { 71, 91 }, { 75, 152 }, { 79, 153 }, { 80, 125 }, { 81, 128 },
1822+
{ 83, 154 }, { 84, 137 }, { 85, 155 }, { 87, 156 }, { 91, 157 }, { 92, 138 },
1823+
{ 93, 139 }, { 94, 140 }, { 95, 141 }, { 113, 84 }, { 121, 73 }, { 123, 74 },
1824+
{ 125, 75 }, { 129, 76 }, { 131, 82 }, { 134, 83 }, { 141, 93 }, { 144, 94 },
1825+
{ 145, 95 }, { 147, 96 }, { 148, 97 }, { 150, 102 }, { 151, 103 }, { 153, 104 },
1826+
{ 154, 100 }, { 156, 105 }, { 157, 107 }, { 163, 98 }, { 166, 112 }, { 172, 99 },
1827+
{ 175, 114 }, { 181, 101 }, { 184, 116 }, { 193, 117 }, { 196, 108 }, { 203, 133 },
1828+
{ 208, 134 }, { 212, 120 }, { 213, 150 }, { 214, 121 }, { 215, 118 }, { 217, 109 },
1829+
{ 219, 119 }, { 220, 110 }, { 221, 111 }, { 222, 124 }, { 224, 131 }, { 225, 132 },
1830+
{ 228, 135 }, { 230, 136 }, { 232, 162 },
18281831
};
18291832

18301833
static const struct msm_pinctrl_soc_data x1e80100_pinctrl = {

drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,12 +793,12 @@ static int jh7110_irq_set_type(struct irq_data *d, unsigned int trigger)
793793
case IRQ_TYPE_LEVEL_HIGH:
794794
irq_type = 0; /* 0: level triggered */
795795
edge_both = 0; /* 0: ignored */
796-
polarity = mask; /* 1: high level */
796+
polarity = 0; /* 0: high level */
797797
break;
798798
case IRQ_TYPE_LEVEL_LOW:
799799
irq_type = 0; /* 0: level triggered */
800800
edge_both = 0; /* 0: ignored */
801-
polarity = 0; /* 0: low level */
801+
polarity = mask; /* 1: low level */
802802
break;
803803
default:
804804
return -EINVAL;

0 commit comments

Comments
 (0)