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

+57 -46
+29 -26
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
··· 709 { 710 int err, rsel_val; 711 712 - if (!pullup && arg == MTK_DISABLE) 713 - return 0; 714 - 715 if (hw->rsel_si_unit) { 716 /* find pin rsel_index from pin_rsel array*/ 717 err = mtk_hw_pin_rsel_lookup(hw, desc, pullup, arg, &rsel_val); 718 if (err) 719 - goto out; 720 } else { 721 - if (arg < MTK_PULL_SET_RSEL_000 || 722 - arg > MTK_PULL_SET_RSEL_111) { 723 - err = -EINVAL; 724 - goto out; 725 - } 726 727 rsel_val = arg - MTK_PULL_SET_RSEL_000; 728 } 729 730 - err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_RSEL, rsel_val); 731 - if (err) 732 - goto out; 733 734 - err = mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, MTK_ENABLE); 735 736 - out: 737 - return err; 738 } 739 740 int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw, ··· 753 try_all_type = MTK_PULL_TYPE_MASK; 754 755 if (try_all_type & MTK_PULL_RSEL_TYPE) { 756 - err = mtk_pinconf_bias_set_rsel(hw, desc, pullup, arg); 757 if (!err) 758 - return err; 759 } 760 761 if (try_all_type & MTK_PULL_PU_PD_TYPE) { 762 err = mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, arg); 763 if (!err) 764 - return err; 765 } 766 767 if (try_all_type & MTK_PULL_PULLSEL_TYPE) { 768 err = mtk_pinconf_bias_set_pullsel_pullen(hw, desc, 769 pullup, arg); 770 if (!err) 771 - return err; 772 } 773 774 if (try_all_type & MTK_PULL_PUPD_R1R0_TYPE) ··· 806 return 0; 807 } 808 809 - static int mtk_pinconf_bias_get_rsel(struct mtk_pinctrl *hw, 810 - const struct mtk_pin_desc *desc, 811 - u32 *pullup, u32 *enable) 812 { 813 int pu, pd, rsel, err; 814 ··· 942 try_all_type = MTK_PULL_TYPE_MASK; 943 944 if (try_all_type & MTK_PULL_RSEL_TYPE) { 945 - err = mtk_pinconf_bias_get_rsel(hw, desc, pullup, enable); 946 if (!err) 947 - return err; 948 } 949 950 if (try_all_type & MTK_PULL_PU_PD_TYPE) { 951 err = mtk_pinconf_bias_get_pu_pd(hw, desc, pullup, enable); 952 if (!err) 953 - return err; 954 } 955 956 if (try_all_type & MTK_PULL_PULLSEL_TYPE) { 957 err = mtk_pinconf_bias_get_pullsel_pullen(hw, desc, 958 pullup, enable); 959 if (!err) 960 - return err; 961 } 962 963 if (try_all_type & MTK_PULL_PUPD_R1R0_TYPE)
··· 709 { 710 int err, rsel_val; 711 712 if (hw->rsel_si_unit) { 713 /* find pin rsel_index from pin_rsel array*/ 714 err = mtk_hw_pin_rsel_lookup(hw, desc, pullup, arg, &rsel_val); 715 if (err) 716 + return err; 717 } else { 718 + if (arg < MTK_PULL_SET_RSEL_000 || arg > MTK_PULL_SET_RSEL_111) 719 + return -EINVAL; 720 721 rsel_val = arg - MTK_PULL_SET_RSEL_000; 722 } 723 724 + return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_RSEL, rsel_val); 725 + } 726 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; 733 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); 741 } 742 743 int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw, ··· 750 try_all_type = MTK_PULL_TYPE_MASK; 751 752 if (try_all_type & MTK_PULL_RSEL_TYPE) { 753 + err = mtk_pinconf_bias_set_pu_pd_rsel(hw, desc, pullup, arg); 754 if (!err) 755 + return 0; 756 } 757 758 if (try_all_type & MTK_PULL_PU_PD_TYPE) { 759 err = mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, arg); 760 if (!err) 761 + return 0; 762 } 763 764 if (try_all_type & MTK_PULL_PULLSEL_TYPE) { 765 err = mtk_pinconf_bias_set_pullsel_pullen(hw, desc, 766 pullup, arg); 767 if (!err) 768 + return 0; 769 } 770 771 if (try_all_type & MTK_PULL_PUPD_R1R0_TYPE) ··· 803 return 0; 804 } 805 806 + static int mtk_pinconf_bias_get_pu_pd_rsel(struct mtk_pinctrl *hw, 807 + const struct mtk_pin_desc *desc, 808 + u32 *pullup, u32 *enable) 809 { 810 int pu, pd, rsel, err; 811 ··· 939 try_all_type = MTK_PULL_TYPE_MASK; 940 941 if (try_all_type & MTK_PULL_RSEL_TYPE) { 942 + err = mtk_pinconf_bias_get_pu_pd_rsel(hw, desc, pullup, enable); 943 if (!err) 944 + return 0; 945 } 946 947 if (try_all_type & MTK_PULL_PU_PD_TYPE) { 948 err = mtk_pinconf_bias_get_pu_pd(hw, desc, pullup, enable); 949 if (!err) 950 + return 0; 951 } 952 953 if (try_all_type & MTK_PULL_PULLSEL_TYPE) { 954 err = mtk_pinconf_bias_get_pullsel_pullen(hw, desc, 955 pullup, enable); 956 if (!err) 957 + return 0; 958 } 959 960 if (try_all_type & MTK_PULL_PUPD_R1R0_TYPE)
+4 -1
drivers/pinctrl/pinctrl-at91.c
··· 1403 1404 /* We will handle a range of GPIO pins */ 1405 for (i = 0; i < gpio_banks; i++) 1406 - if (gpio_chips[i]) 1407 pinctrl_add_gpio_range(info->pctl, &gpio_chips[i]->range); 1408 1409 dev_info(dev, "initialized AT91 pinctrl driver\n"); 1410
··· 1403 1404 /* We will handle a range of GPIO pins */ 1405 for (i = 0; i < gpio_banks; i++) 1406 + if (gpio_chips[i]) { 1407 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 + } 1411 1412 dev_info(dev, "initialized AT91 pinctrl driver\n"); 1413
+1 -1
drivers/pinctrl/pinctrl-rockchip.c
··· 3795 PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", 0, 0, 0, 0), 3796 PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0), 3797 PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0, 3798 - 0, 3799 IOMUX_WIDTH_3BIT, 3800 0), 3801 PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3",
··· 3795 PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", 0, 0, 0, 0), 3796 PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0), 3797 PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0, 3798 + IOMUX_WIDTH_2BIT, 3799 IOMUX_WIDTH_3BIT, 3800 0), 3801 PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3",
+2
drivers/pinctrl/pinctrl-single.c
··· 345 return -ENOTSUPP; 346 fselector = setting->func; 347 function = pinmux_generic_get_function(pctldev, fselector); 348 *func = function->data; 349 if (!(*func)) { 350 dev_err(pcs->dev, "%s could not find function%i\n",
··· 345 return -ENOTSUPP; 346 fselector = setting->func; 347 function = pinmux_generic_get_function(pctldev, fselector); 348 + if (!function) 349 + return -EINVAL; 350 *func = function->data; 351 if (!(*func)) { 352 dev_err(pcs->dev, "%s could not find function%i\n",
+19 -16
drivers/pinctrl/qcom/pinctrl-x1e80100.c
··· 1805 [235] = PINGROUP(235, aon_cci, qdss_gpio, _, _, _, _, _, _, _), 1806 [236] = PINGROUP(236, aon_cci, qdss_gpio, _, _, _, _, _, _, _), 1807 [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), 1812 }; 1813 1814 static const struct msm_gpio_wakeirq_map x1e80100_pdc_map[] = { 1815 { 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 }, 1828 }; 1829 1830 static const struct msm_pinctrl_soc_data x1e80100_pinctrl = {
··· 1805 [235] = PINGROUP(235, aon_cci, qdss_gpio, _, _, _, _, _, _, _), 1806 [236] = PINGROUP(236, aon_cci, qdss_gpio, _, _, _, _, _, _, _), 1807 [237] = PINGROUP(237, _, _, _, _, _, _, _, _, _), 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), 1812 }; 1813 1814 static const struct msm_gpio_wakeirq_map x1e80100_pdc_map[] = { 1815 { 0, 72 }, { 2, 70 }, { 3, 71 }, { 6, 123 }, { 7, 67 }, { 11, 85 }, 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 }, 1831 }; 1832 1833 static const struct msm_pinctrl_soc_data x1e80100_pinctrl = {
+2 -2
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
··· 793 case IRQ_TYPE_LEVEL_HIGH: 794 irq_type = 0; /* 0: level triggered */ 795 edge_both = 0; /* 0: ignored */ 796 - polarity = mask; /* 1: high level */ 797 break; 798 case IRQ_TYPE_LEVEL_LOW: 799 irq_type = 0; /* 0: level triggered */ 800 edge_both = 0; /* 0: ignored */ 801 - polarity = 0; /* 0: low level */ 802 break; 803 default: 804 return -EINVAL;
··· 793 case IRQ_TYPE_LEVEL_HIGH: 794 irq_type = 0; /* 0: level triggered */ 795 edge_both = 0; /* 0: ignored */ 796 + polarity = 0; /* 0: high level */ 797 break; 798 case IRQ_TYPE_LEVEL_LOW: 799 irq_type = 0; /* 0: level triggered */ 800 edge_both = 0; /* 0: ignored */ 801 + polarity = mask; /* 1: low level */ 802 break; 803 default: 804 return -EINVAL;