Commit 41594663 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 6ace1c7e 128f71fe
...@@ -709,32 +709,35 @@ static int mtk_pinconf_bias_set_rsel(struct mtk_pinctrl *hw, ...@@ -709,32 +709,35 @@ static int mtk_pinconf_bias_set_rsel(struct mtk_pinctrl *hw,
{ {
int err, rsel_val; int err, rsel_val;
if (!pullup && arg == MTK_DISABLE)
return 0;
if (hw->rsel_si_unit) { if (hw->rsel_si_unit) {
/* find pin rsel_index from pin_rsel array*/ /* find pin rsel_index from pin_rsel array*/
err = mtk_hw_pin_rsel_lookup(hw, desc, pullup, arg, &rsel_val); err = mtk_hw_pin_rsel_lookup(hw, desc, pullup, arg, &rsel_val);
if (err) if (err)
goto out; return err;
} else { } else {
if (arg < MTK_PULL_SET_RSEL_000 || if (arg < MTK_PULL_SET_RSEL_000 || arg > MTK_PULL_SET_RSEL_111)
arg > MTK_PULL_SET_RSEL_111) { return -EINVAL;
err = -EINVAL;
goto out;
}
rsel_val = arg - MTK_PULL_SET_RSEL_000; rsel_val = arg - MTK_PULL_SET_RSEL_000;
} }
err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_RSEL, rsel_val); return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_RSEL, rsel_val);
if (err) }
goto out;
err = mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, MTK_ENABLE); static int mtk_pinconf_bias_set_pu_pd_rsel(struct mtk_pinctrl *hw,
const struct mtk_pin_desc *desc,
u32 pullup, u32 arg)
{
u32 enable = arg == MTK_DISABLE ? MTK_DISABLE : MTK_ENABLE;
int err;
out: if (arg != MTK_DISABLE) {
return err; err = mtk_pinconf_bias_set_rsel(hw, desc, pullup, arg);
if (err)
return err;
}
return mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, enable);
} }
int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw, int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw,
...@@ -750,22 +753,22 @@ int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw, ...@@ -750,22 +753,22 @@ int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw,
try_all_type = MTK_PULL_TYPE_MASK; try_all_type = MTK_PULL_TYPE_MASK;
if (try_all_type & MTK_PULL_RSEL_TYPE) { if (try_all_type & MTK_PULL_RSEL_TYPE) {
err = mtk_pinconf_bias_set_rsel(hw, desc, pullup, arg); err = mtk_pinconf_bias_set_pu_pd_rsel(hw, desc, pullup, arg);
if (!err) if (!err)
return err; return 0;
} }
if (try_all_type & MTK_PULL_PU_PD_TYPE) { if (try_all_type & MTK_PULL_PU_PD_TYPE) {
err = mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, arg); err = mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, arg);
if (!err) if (!err)
return err; return 0;
} }
if (try_all_type & MTK_PULL_PULLSEL_TYPE) { if (try_all_type & MTK_PULL_PULLSEL_TYPE) {
err = mtk_pinconf_bias_set_pullsel_pullen(hw, desc, err = mtk_pinconf_bias_set_pullsel_pullen(hw, desc,
pullup, arg); pullup, arg);
if (!err) if (!err)
return err; return 0;
} }
if (try_all_type & MTK_PULL_PUPD_R1R0_TYPE) if (try_all_type & MTK_PULL_PUPD_R1R0_TYPE)
...@@ -803,9 +806,9 @@ static int mtk_rsel_get_si_unit(struct mtk_pinctrl *hw, ...@@ -803,9 +806,9 @@ static int mtk_rsel_get_si_unit(struct mtk_pinctrl *hw,
return 0; return 0;
} }
static int mtk_pinconf_bias_get_rsel(struct mtk_pinctrl *hw, static int mtk_pinconf_bias_get_pu_pd_rsel(struct mtk_pinctrl *hw,
const struct mtk_pin_desc *desc, const struct mtk_pin_desc *desc,
u32 *pullup, u32 *enable) u32 *pullup, u32 *enable)
{ {
int pu, pd, rsel, err; int pu, pd, rsel, err;
...@@ -939,22 +942,22 @@ int mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw, ...@@ -939,22 +942,22 @@ int mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw,
try_all_type = MTK_PULL_TYPE_MASK; try_all_type = MTK_PULL_TYPE_MASK;
if (try_all_type & MTK_PULL_RSEL_TYPE) { if (try_all_type & MTK_PULL_RSEL_TYPE) {
err = mtk_pinconf_bias_get_rsel(hw, desc, pullup, enable); err = mtk_pinconf_bias_get_pu_pd_rsel(hw, desc, pullup, enable);
if (!err) if (!err)
return err; return 0;
} }
if (try_all_type & MTK_PULL_PU_PD_TYPE) { if (try_all_type & MTK_PULL_PU_PD_TYPE) {
err = mtk_pinconf_bias_get_pu_pd(hw, desc, pullup, enable); err = mtk_pinconf_bias_get_pu_pd(hw, desc, pullup, enable);
if (!err) if (!err)
return err; return 0;
} }
if (try_all_type & MTK_PULL_PULLSEL_TYPE) { if (try_all_type & MTK_PULL_PULLSEL_TYPE) {
err = mtk_pinconf_bias_get_pullsel_pullen(hw, desc, err = mtk_pinconf_bias_get_pullsel_pullen(hw, desc,
pullup, enable); pullup, enable);
if (!err) if (!err)
return err; return 0;
} }
if (try_all_type & MTK_PULL_PUPD_R1R0_TYPE) if (try_all_type & MTK_PULL_PUPD_R1R0_TYPE)
......
...@@ -1403,8 +1403,11 @@ static int at91_pinctrl_probe(struct platform_device *pdev) ...@@ -1403,8 +1403,11 @@ static int at91_pinctrl_probe(struct platform_device *pdev)
/* We will handle a range of GPIO pins */ /* We will handle a range of GPIO pins */
for (i = 0; i < gpio_banks; i++) for (i = 0; i < gpio_banks; i++)
if (gpio_chips[i]) if (gpio_chips[i]) {
pinctrl_add_gpio_range(info->pctl, &gpio_chips[i]->range); pinctrl_add_gpio_range(info->pctl, &gpio_chips[i]->range);
gpiochip_add_pin_range(&gpio_chips[i]->chip, dev_name(info->pctl->dev), 0,
gpio_chips[i]->range.pin_base, gpio_chips[i]->range.npins);
}
dev_info(dev, "initialized AT91 pinctrl driver\n"); dev_info(dev, "initialized AT91 pinctrl driver\n");
......
...@@ -3795,7 +3795,7 @@ static struct rockchip_pin_bank rk3328_pin_banks[] = { ...@@ -3795,7 +3795,7 @@ static struct rockchip_pin_bank rk3328_pin_banks[] = {
PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", 0, 0, 0, 0), PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", 0, 0, 0, 0),
PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0), PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0),
PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0, PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0,
0, IOMUX_WIDTH_2BIT,
IOMUX_WIDTH_3BIT, IOMUX_WIDTH_3BIT,
0), 0),
PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3", PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3",
......
...@@ -345,6 +345,8 @@ static int pcs_get_function(struct pinctrl_dev *pctldev, unsigned pin, ...@@ -345,6 +345,8 @@ static int pcs_get_function(struct pinctrl_dev *pctldev, unsigned pin,
return -ENOTSUPP; return -ENOTSUPP;
fselector = setting->func; fselector = setting->func;
function = pinmux_generic_get_function(pctldev, fselector); function = pinmux_generic_get_function(pctldev, fselector);
if (!function)
return -EINVAL;
*func = function->data; *func = function->data;
if (!(*func)) { if (!(*func)) {
dev_err(pcs->dev, "%s could not find function%i\n", dev_err(pcs->dev, "%s could not find function%i\n",
......
...@@ -1805,26 +1805,29 @@ static const struct msm_pingroup x1e80100_groups[] = { ...@@ -1805,26 +1805,29 @@ static const struct msm_pingroup x1e80100_groups[] = {
[235] = PINGROUP(235, aon_cci, qdss_gpio, _, _, _, _, _, _, _), [235] = PINGROUP(235, aon_cci, qdss_gpio, _, _, _, _, _, _, _),
[236] = PINGROUP(236, aon_cci, qdss_gpio, _, _, _, _, _, _, _), [236] = PINGROUP(236, aon_cci, qdss_gpio, _, _, _, _, _, _, _),
[237] = PINGROUP(237, _, _, _, _, _, _, _, _, _), [237] = PINGROUP(237, _, _, _, _, _, _, _, _, _),
[238] = UFS_RESET(ufs_reset, 0x1f9000), [238] = UFS_RESET(ufs_reset, 0xf9000),
[239] = SDC_QDSD_PINGROUP(sdc2_clk, 0x1f2000, 14, 6), [239] = SDC_QDSD_PINGROUP(sdc2_clk, 0xf2000, 14, 6),
[240] = SDC_QDSD_PINGROUP(sdc2_cmd, 0x1f2000, 11, 3), [240] = SDC_QDSD_PINGROUP(sdc2_cmd, 0xf2000, 11, 3),
[241] = SDC_QDSD_PINGROUP(sdc2_data, 0x1f2000, 9, 0), [241] = SDC_QDSD_PINGROUP(sdc2_data, 0xf2000, 9, 0),
}; };
static const struct msm_gpio_wakeirq_map x1e80100_pdc_map[] = { static const struct msm_gpio_wakeirq_map x1e80100_pdc_map[] = {
{ 0, 72 }, { 2, 70 }, { 3, 71 }, { 6, 123 }, { 7, 67 }, { 11, 85 }, { 0, 72 }, { 2, 70 }, { 3, 71 }, { 6, 123 }, { 7, 67 }, { 11, 85 },
{ 15, 68 }, { 18, 122 }, { 19, 69 }, { 21, 158 }, { 23, 143 }, { 26, 129 }, { 13, 86 }, { 15, 68 }, { 18, 122 }, { 19, 69 }, { 21, 158 }, { 23, 143 },
{ 27, 144 }, { 28, 77 }, { 29, 78 }, { 30, 92 }, { 32, 145 }, { 33, 115 }, { 24, 126 }, { 26, 129 }, { 27, 144 }, { 28, 77 }, { 29, 78 }, { 30, 92 },
{ 34, 130 }, { 35, 146 }, { 36, 147 }, { 39, 80 }, { 43, 148 }, { 47, 149 }, { 31, 159 }, { 32, 145 }, { 33, 115 }, { 34, 130 }, { 35, 146 }, { 36, 147 },
{ 51, 79 }, { 53, 89 }, { 59, 87 }, { 64, 90 }, { 65, 106 }, { 66, 142 }, { 38, 113 }, { 39, 80 }, { 43, 148 }, { 47, 149 }, { 51, 79 }, { 53, 89 },
{ 67, 88 }, { 71, 91 }, { 75, 152 }, { 79, 153 }, { 80, 125 }, { 81, 128 }, { 55, 81 }, { 59, 87 }, { 64, 90 }, { 65, 106 }, { 66, 142 }, { 67, 88 },
{ 84, 137 }, { 85, 155 }, { 87, 156 }, { 91, 157 }, { 92, 138 }, { 94, 140 }, { 68, 151 }, { 71, 91 }, { 75, 152 }, { 79, 153 }, { 80, 125 }, { 81, 128 },
{ 95, 141 }, { 113, 84 }, { 121, 73 }, { 123, 74 }, { 129, 76 }, { 131, 82 }, { 83, 154 }, { 84, 137 }, { 85, 155 }, { 87, 156 }, { 91, 157 }, { 92, 138 },
{ 134, 83 }, { 141, 93 }, { 144, 94 }, { 147, 96 }, { 148, 97 }, { 150, 102 }, { 93, 139 }, { 94, 140 }, { 95, 141 }, { 113, 84 }, { 121, 73 }, { 123, 74 },
{ 151, 103 }, { 153, 104 }, { 156, 105 }, { 157, 107 }, { 163, 98 }, { 166, 112 }, { 125, 75 }, { 129, 76 }, { 131, 82 }, { 134, 83 }, { 141, 93 }, { 144, 94 },
{ 172, 99 }, { 181, 101 }, { 184, 116 }, { 193, 40 }, { 193, 117 }, { 196, 108 }, { 145, 95 }, { 147, 96 }, { 148, 97 }, { 150, 102 }, { 151, 103 }, { 153, 104 },
{ 203, 133 }, { 212, 120 }, { 213, 150 }, { 214, 121 }, { 215, 118 }, { 217, 109 }, { 154, 100 }, { 156, 105 }, { 157, 107 }, { 163, 98 }, { 166, 112 }, { 172, 99 },
{ 220, 110 }, { 221, 111 }, { 222, 124 }, { 224, 131 }, { 225, 132 }, { 175, 114 }, { 181, 101 }, { 184, 116 }, { 193, 117 }, { 196, 108 }, { 203, 133 },
{ 208, 134 }, { 212, 120 }, { 213, 150 }, { 214, 121 }, { 215, 118 }, { 217, 109 },
{ 219, 119 }, { 220, 110 }, { 221, 111 }, { 222, 124 }, { 224, 131 }, { 225, 132 },
{ 228, 135 }, { 230, 136 }, { 232, 162 },
}; };
static const struct msm_pinctrl_soc_data x1e80100_pinctrl = { static const struct msm_pinctrl_soc_data x1e80100_pinctrl = {
......
...@@ -793,12 +793,12 @@ static int jh7110_irq_set_type(struct irq_data *d, unsigned int trigger) ...@@ -793,12 +793,12 @@ static int jh7110_irq_set_type(struct irq_data *d, unsigned int trigger)
case IRQ_TYPE_LEVEL_HIGH: case IRQ_TYPE_LEVEL_HIGH:
irq_type = 0; /* 0: level triggered */ irq_type = 0; /* 0: level triggered */
edge_both = 0; /* 0: ignored */ edge_both = 0; /* 0: ignored */
polarity = mask; /* 1: high level */ polarity = 0; /* 0: high level */
break; break;
case IRQ_TYPE_LEVEL_LOW: case IRQ_TYPE_LEVEL_LOW:
irq_type = 0; /* 0: level triggered */ irq_type = 0; /* 0: level triggered */
edge_both = 0; /* 0: ignored */ edge_both = 0; /* 0: ignored */
polarity = 0; /* 0: low level */ polarity = mask; /* 1: low level */
break; break;
default: default:
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment