Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pinctrl-v5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pin control fixes from Linus Walleij:
"The commits that stand out are the Intel fixes that arrived during the
merge window and I got relayed by pull request from Andy.

Apart from that a minor Kconfig noise.

- Interrupt clearing fix for the Intel pin controllers affecting
touchpads on some laptops.

- Compile Kconfig fix for the STMFX expander pin controller"

* tag 'pinctrl-v5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
pinctrl: stmfx: Fix compile issue when CONFIG_OF_GPIO is not defined
pinctrl: intel: Clear interrupt status in mask/unmask callback
pinctrl: intel: Use GENMASK() consistently

+11 -36
+1 -1
drivers/pinctrl/Kconfig
··· 277 277 config PINCTRL_STMFX 278 278 tristate "STMicroelectronics STMFX GPIO expander pinctrl driver" 279 279 depends on I2C 280 - depends on OF || COMPILE_TEST 280 + depends on OF_GPIO 281 281 select GENERIC_PINCONF 282 282 select GPIOLIB_IRQCHIP 283 283 select MFD_STMFX
+10 -35
drivers/pinctrl/intel/pinctrl-intel.c
··· 33 33 34 34 #define PADOWN_BITS 4 35 35 #define PADOWN_SHIFT(p) ((p) % 8 * PADOWN_BITS) 36 - #define PADOWN_MASK(p) (0xf << PADOWN_SHIFT(p)) 36 + #define PADOWN_MASK(p) (GENMASK(3, 0) << PADOWN_SHIFT(p)) 37 37 #define PADOWN_GPP(p) ((p) / 8) 38 38 39 39 /* Offset from pad_regs */ 40 40 #define PADCFG0 0x000 41 41 #define PADCFG0_RXEVCFG_SHIFT 25 42 - #define PADCFG0_RXEVCFG_MASK (3 << PADCFG0_RXEVCFG_SHIFT) 42 + #define PADCFG0_RXEVCFG_MASK GENMASK(26, 25) 43 43 #define PADCFG0_RXEVCFG_LEVEL 0 44 44 #define PADCFG0_RXEVCFG_EDGE 1 45 45 #define PADCFG0_RXEVCFG_DISABLED 2 ··· 51 51 #define PADCFG0_GPIROUTSMI BIT(18) 52 52 #define PADCFG0_GPIROUTNMI BIT(17) 53 53 #define PADCFG0_PMODE_SHIFT 10 54 - #define PADCFG0_PMODE_MASK (0xf << PADCFG0_PMODE_SHIFT) 54 + #define PADCFG0_PMODE_MASK GENMASK(13, 10) 55 55 #define PADCFG0_GPIORXDIS BIT(9) 56 56 #define PADCFG0_GPIOTXDIS BIT(8) 57 57 #define PADCFG0_GPIORXSTATE BIT(1) ··· 60 60 #define PADCFG1 0x004 61 61 #define PADCFG1_TERM_UP BIT(13) 62 62 #define PADCFG1_TERM_SHIFT 10 63 - #define PADCFG1_TERM_MASK (7 << PADCFG1_TERM_SHIFT) 63 + #define PADCFG1_TERM_MASK GENMASK(12, 10) 64 64 #define PADCFG1_TERM_20K 4 65 65 #define PADCFG1_TERM_2K 3 66 66 #define PADCFG1_TERM_5K 2 ··· 914 914 } 915 915 } 916 916 917 - static void intel_gpio_irq_enable(struct irq_data *d) 918 - { 919 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 920 - struct intel_pinctrl *pctrl = gpiochip_get_data(gc); 921 - const struct intel_community *community; 922 - const struct intel_padgroup *padgrp; 923 - int pin; 924 - 925 - pin = intel_gpio_to_pin(pctrl, irqd_to_hwirq(d), &community, &padgrp); 926 - if (pin >= 0) { 927 - unsigned int gpp, gpp_offset, is_offset; 928 - unsigned long flags; 929 - u32 value; 930 - 931 - gpp = padgrp->reg_num; 932 - gpp_offset = padgroup_offset(padgrp, pin); 933 - is_offset = community->is_offset + gpp * 4; 934 - 935 - raw_spin_lock_irqsave(&pctrl->lock, flags); 936 - /* Clear interrupt status first to avoid unexpected interrupt */ 937 - writel(BIT(gpp_offset), community->regs + is_offset); 938 - 939 - value = readl(community->regs + community->ie_offset + gpp * 4); 940 - value |= BIT(gpp_offset); 941 - writel(value, community->regs + community->ie_offset + gpp * 4); 942 - raw_spin_unlock_irqrestore(&pctrl->lock, flags); 943 - } 944 - } 945 - 946 917 static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask) 947 918 { 948 919 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); ··· 926 955 if (pin >= 0) { 927 956 unsigned int gpp, gpp_offset; 928 957 unsigned long flags; 929 - void __iomem *reg; 958 + void __iomem *reg, *is; 930 959 u32 value; 931 960 932 961 gpp = padgrp->reg_num; 933 962 gpp_offset = padgroup_offset(padgrp, pin); 934 963 935 964 reg = community->regs + community->ie_offset + gpp * 4; 965 + is = community->regs + community->is_offset + gpp * 4; 936 966 937 967 raw_spin_lock_irqsave(&pctrl->lock, flags); 968 + 969 + /* Clear interrupt status first to avoid unexpected interrupt */ 970 + writel(BIT(gpp_offset), is); 971 + 938 972 value = readl(reg); 939 973 if (mask) 940 974 value &= ~BIT(gpp_offset); ··· 1083 1107 1084 1108 static struct irq_chip intel_gpio_irqchip = { 1085 1109 .name = "intel-gpio", 1086 - .irq_enable = intel_gpio_irq_enable, 1087 1110 .irq_ack = intel_gpio_irq_ack, 1088 1111 .irq_mask = intel_gpio_irq_mask, 1089 1112 .irq_unmask = intel_gpio_irq_unmask,