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

Merge tag 'intel-pinctrl-v6.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel into devel

intel-pinctrl for v6.8-1

* New agnostic driver to support Lunar Lake and newer platforms
* New driver for Intel Meteor Point-S (PCH for Meteor Lake-S)
* Update drivers to use new PM helpers
* Use RAII for locking in a few drivers (Raag, Andy)
* Reduce locking scope in some functions (Raag)
* Miscellaneous cleanups (Raag)

The following is an automated git shortlog grouped by driver:

alderlake:
- Switch to use Intel pin control PM ops

baytrail:
- Simplify code with cleanup helpers
- Move default strength assignment to a switch-case
- Factor out byt_gpio_force_input_mode()
- Fix types of config value in byt_pin_config_set()

broxton:
- Switch to use Intel pin control PM ops

cannonlake:
- Switch to use Intel pin control PM ops

cedarfork:
- Switch to use Intel pin control PM ops

denverton:
- Switch to use Intel pin control PM ops

elkhartlake:
- Switch to use Intel pin control PM ops

emmitsburg:
- Switch to use Intel pin control PM ops

geminilake:
- Switch to use Intel pin control PM ops

icelake:
- Switch to use Intel pin control PM ops

intel:
- Add Intel Meteor Point pin controller and GPIO support
- use the correct _PM_OPS() export macro
- Add a generic Intel pin control platform driver
- Revert "Unexport intel_pinctrl_probe()"
- allow independent COMPILE_TEST
- Refactor intel_pinctrl_get_soc_data()
- Move default strength assignment to a switch-case
- Make PM ops functions static
- Provide Intel pin control wide PM ops structure

jasperlake:
- Switch to use Intel pin control PM ops

lakefield:
- Switch to use Intel pin control PM ops

lewisburg:
- Switch to use Intel pin control PM ops

lynxpoint:
- Simplify code with cleanup helpers

meteorlake:
- Switch to use Intel pin control PM ops

sunrisepoint:
- Switch to use Intel pin control PM ops

tangier:
- simplify locking using cleanup helpers
- Move default strength assignment to a switch-case
- Enable 910 Ohm bias

tigerlake:
- Switch to use Intel pin control PM ops

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+888 -279
+20 -1
drivers/pinctrl/intel/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # Intel pin control drivers 3 3 menu "Intel pinctrl drivers" 4 - depends on ACPI && (X86 || COMPILE_TEST) 4 + depends on (ACPI && X86) || COMPILE_TEST 5 5 6 6 config PINCTRL_BAYTRAIL 7 7 bool "Intel Baytrail GPIO pin control" ··· 36 36 select GENERIC_PINCONF 37 37 select GPIOLIB 38 38 select GPIOLIB_IRQCHIP 39 + 40 + config PINCTRL_INTEL_PLATFORM 41 + tristate "Intel pinctrl and GPIO platform driver" 42 + depends on ACPI 43 + select PINCTRL_INTEL 44 + help 45 + This pinctrl driver provides an interface that allows configuring 46 + of Intel PCH pins and using them as GPIOs. Currently the following 47 + Intel SoCs / platforms require this to be functional: 48 + - Lunar Lake 39 49 40 50 config PINCTRL_ALDERLAKE 41 51 tristate "Intel Alder Lake pinctrl and GPIO driver" ··· 137 127 help 138 128 This pinctrl driver provides an interface that allows configuring 139 129 of Intel Meteor Lake pins and using them as GPIOs. 130 + 131 + config PINCTRL_METEORPOINT 132 + tristate "Intel Meteor Point pinctrl and GPIO driver" 133 + depends on ACPI 134 + select PINCTRL_INTEL 135 + help 136 + Meteor Point is the PCH of Intel Meteor Lake. This pinctrl driver 137 + provides an interface that allows configuring of PCH pins and 138 + using them as GPIOs. 140 139 141 140 config PINCTRL_SUNRISEPOINT 142 141 tristate "Intel Sunrisepoint pinctrl and GPIO driver"
+2
drivers/pinctrl/intel/Makefile
··· 8 8 obj-$(CONFIG_PINCTRL_MERRIFIELD) += pinctrl-merrifield.o 9 9 obj-$(CONFIG_PINCTRL_MOOREFIELD) += pinctrl-moorefield.o 10 10 obj-$(CONFIG_PINCTRL_INTEL) += pinctrl-intel.o 11 + obj-$(CONFIG_PINCTRL_INTEL_PLATFORM) += pinctrl-intel-platform.o 11 12 obj-$(CONFIG_PINCTRL_ALDERLAKE) += pinctrl-alderlake.o 12 13 obj-$(CONFIG_PINCTRL_BROXTON) += pinctrl-broxton.o 13 14 obj-$(CONFIG_PINCTRL_CANNONLAKE) += pinctrl-cannonlake.o ··· 22 21 obj-$(CONFIG_PINCTRL_LAKEFIELD) += pinctrl-lakefield.o 23 22 obj-$(CONFIG_PINCTRL_LEWISBURG) += pinctrl-lewisburg.o 24 23 obj-$(CONFIG_PINCTRL_METEORLAKE) += pinctrl-meteorlake.o 24 + obj-$(CONFIG_PINCTRL_METEORPOINT) += pinctrl-meteorpoint.o 25 25 obj-$(CONFIG_PINCTRL_SUNRISEPOINT) += pinctrl-sunrisepoint.o 26 26 obj-$(CONFIG_PINCTRL_TIGERLAKE) += pinctrl-tigerlake.o
+2 -3
drivers/pinctrl/intel/pinctrl-alderlake.c
··· 9 9 #include <linux/mod_devicetable.h> 10 10 #include <linux/module.h> 11 11 #include <linux/platform_device.h> 12 + #include <linux/pm.h> 12 13 13 14 #include <linux/pinctrl/pinctrl.h> 14 15 ··· 734 733 }; 735 734 MODULE_DEVICE_TABLE(acpi, adl_pinctrl_acpi_match); 736 735 737 - static INTEL_PINCTRL_PM_OPS(adl_pinctrl_pm_ops); 738 - 739 736 static struct platform_driver adl_pinctrl_driver = { 740 737 .probe = intel_pinctrl_probe_by_hid, 741 738 .driver = { 742 739 .name = "alderlake-pinctrl", 743 740 .acpi_match_table = adl_pinctrl_acpi_match, 744 - .pm = &adl_pinctrl_pm_ops, 741 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 745 742 }, 746 743 }; 747 744 module_platform_driver(adl_pinctrl_driver);
+91 -138
drivers/pinctrl/intel/pinctrl-baytrail.c
··· 588 588 const struct intel_pingroup group, 589 589 unsigned int func) 590 590 { 591 - unsigned long flags; 592 591 int i; 593 592 594 - raw_spin_lock_irqsave(&byt_lock, flags); 593 + guard(raw_spinlock_irqsave)(&byt_lock); 595 594 596 595 for (i = 0; i < group.grp.npins; i++) { 597 596 void __iomem *padcfg0; ··· 608 609 value |= func; 609 610 writel(value, padcfg0); 610 611 } 611 - 612 - raw_spin_unlock_irqrestore(&byt_lock, flags); 613 612 } 614 613 615 614 static void byt_set_group_mixed_mux(struct intel_pinctrl *vg, 616 615 const struct intel_pingroup group, 617 616 const unsigned int *func) 618 617 { 619 - unsigned long flags; 620 618 int i; 621 619 622 - raw_spin_lock_irqsave(&byt_lock, flags); 620 + guard(raw_spinlock_irqsave)(&byt_lock); 623 621 624 622 for (i = 0; i < group.grp.npins; i++) { 625 623 void __iomem *padcfg0; ··· 634 638 value |= func[i]; 635 639 writel(value, padcfg0); 636 640 } 637 - 638 - raw_spin_unlock_irqrestore(&byt_lock, flags); 639 641 } 640 642 641 643 static int byt_set_mux(struct pinctrl_dev *pctldev, unsigned int func_selector, ··· 671 677 static void byt_gpio_clear_triggering(struct intel_pinctrl *vg, unsigned int offset) 672 678 { 673 679 void __iomem *reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG); 674 - unsigned long flags; 675 680 u32 value; 676 681 677 - raw_spin_lock_irqsave(&byt_lock, flags); 682 + guard(raw_spinlock_irqsave)(&byt_lock); 683 + 678 684 value = readl(reg); 679 685 680 686 /* Do not clear direct-irq enabled IRQs (from gpio_disable_free) */ ··· 682 688 value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL); 683 689 684 690 writel(value, reg); 685 - raw_spin_unlock_irqrestore(&byt_lock, flags); 686 691 } 687 692 688 693 static int byt_gpio_request_enable(struct pinctrl_dev *pctl_dev, ··· 691 698 struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctl_dev); 692 699 void __iomem *reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG); 693 700 u32 value, gpio_mux; 694 - unsigned long flags; 695 701 696 - raw_spin_lock_irqsave(&byt_lock, flags); 702 + guard(raw_spinlock_irqsave)(&byt_lock); 697 703 698 704 /* 699 705 * In most cases, func pin mux 000 means GPIO function. ··· 705 713 */ 706 714 value = readl(reg) & BYT_PIN_MUX; 707 715 gpio_mux = byt_get_gpio_mux(vg, offset); 708 - if (gpio_mux != value) { 709 - value = readl(reg) & ~BYT_PIN_MUX; 710 - value |= gpio_mux; 711 - writel(value, reg); 716 + if (gpio_mux == value) 717 + return 0; 712 718 713 - dev_warn(vg->dev, FW_BUG "Pin %i: forcibly re-configured as GPIO\n", offset); 714 - } 719 + value = readl(reg) & ~BYT_PIN_MUX; 720 + value |= gpio_mux; 721 + writel(value, reg); 715 722 716 - raw_spin_unlock_irqrestore(&byt_lock, flags); 723 + dev_warn(vg->dev, FW_BUG "Pin %i: forcibly re-configured as GPIO\n", offset); 717 724 718 725 return 0; 719 726 } ··· 750 759 { 751 760 struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctl_dev); 752 761 void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); 753 - unsigned long flags; 754 762 u32 value; 755 763 756 - raw_spin_lock_irqsave(&byt_lock, flags); 764 + guard(raw_spinlock_irqsave)(&byt_lock); 757 765 758 766 value = readl(val_reg); 759 767 value &= ~BYT_DIR_MASK; ··· 762 772 byt_gpio_direct_irq_check(vg, offset); 763 773 764 774 writel(value, val_reg); 765 - 766 - raw_spin_unlock_irqrestore(&byt_lock, flags); 767 775 768 776 return 0; 769 777 } ··· 799 811 *reg &= ~BYT_PULL_STR_MASK; 800 812 801 813 switch (strength) { 814 + case 1: /* Set default strength value in case none is given */ 802 815 case 2000: 803 816 *reg |= BYT_PULL_STR_2K; 804 817 break; ··· 819 830 return 0; 820 831 } 821 832 833 + static void byt_gpio_force_input_mode(struct intel_pinctrl *vg, unsigned int offset) 834 + { 835 + void __iomem *reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); 836 + u32 value; 837 + 838 + value = readl(reg); 839 + if (!(value & BYT_INPUT_EN)) 840 + return; 841 + 842 + /* 843 + * Pull assignment is only applicable in input mode. If 844 + * chip is not in input mode, set it and warn about it. 845 + */ 846 + value &= ~BYT_INPUT_EN; 847 + writel(value, reg); 848 + dev_warn(vg->dev, "Pin %i: forcibly set to input mode\n", offset); 849 + } 850 + 822 851 static int byt_pin_config_get(struct pinctrl_dev *pctl_dev, unsigned int offset, 823 852 unsigned long *config) 824 853 { ··· 845 838 void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG); 846 839 void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); 847 840 void __iomem *db_reg = byt_gpio_reg(vg, offset, BYT_DEBOUNCE_REG); 848 - unsigned long flags; 849 841 u32 conf, pull, val, debounce; 850 842 u16 arg = 0; 851 843 852 - raw_spin_lock_irqsave(&byt_lock, flags); 853 - conf = readl(conf_reg); 844 + scoped_guard(raw_spinlock_irqsave, &byt_lock) { 845 + conf = readl(conf_reg); 846 + val = readl(val_reg); 847 + } 848 + 854 849 pull = conf & BYT_PULL_ASSIGN_MASK; 855 - val = readl(val_reg); 856 - raw_spin_unlock_irqrestore(&byt_lock, flags); 857 850 858 851 switch (param) { 859 852 case PIN_CONFIG_BIAS_DISABLE: ··· 880 873 if (!(conf & BYT_DEBOUNCE_EN)) 881 874 return -EINVAL; 882 875 883 - raw_spin_lock_irqsave(&byt_lock, flags); 884 - debounce = readl(db_reg); 885 - raw_spin_unlock_irqrestore(&byt_lock, flags); 876 + scoped_guard(raw_spinlock_irqsave, &byt_lock) 877 + debounce = readl(db_reg); 886 878 887 879 switch (debounce & BYT_DEBOUNCE_PULSE_MASK) { 888 880 case BYT_DEBOUNCE_PULSE_375US: ··· 925 919 unsigned int num_configs) 926 920 { 927 921 struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctl_dev); 928 - unsigned int param, arg; 929 922 void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG); 930 - void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); 931 923 void __iomem *db_reg = byt_gpio_reg(vg, offset, BYT_DEBOUNCE_REG); 932 - u32 conf, val, db_pulse, debounce; 933 - unsigned long flags; 934 - int i, ret = 0; 924 + u32 conf, db_pulse, debounce; 925 + enum pin_config_param param; 926 + int i, ret; 927 + u32 arg; 935 928 936 - raw_spin_lock_irqsave(&byt_lock, flags); 929 + guard(raw_spinlock_irqsave)(&byt_lock); 937 930 938 931 conf = readl(conf_reg); 939 - val = readl(val_reg); 940 932 941 933 for (i = 0; i < num_configs; i++) { 942 934 param = pinconf_to_config_param(configs[i]); ··· 945 941 conf &= ~BYT_PULL_ASSIGN_MASK; 946 942 break; 947 943 case PIN_CONFIG_BIAS_PULL_DOWN: 948 - /* Set default strength value in case none is given */ 949 - if (arg == 1) 950 - arg = 2000; 951 - 952 - /* 953 - * Pull assignment is only applicable in input mode. If 954 - * chip is not in input mode, set it and warn about it. 955 - */ 956 - if (val & BYT_INPUT_EN) { 957 - val &= ~BYT_INPUT_EN; 958 - writel(val, val_reg); 959 - dev_warn(vg->dev, "Pin %i: forcibly set to input mode\n", offset); 960 - } 944 + byt_gpio_force_input_mode(vg, offset); 961 945 962 946 conf &= ~BYT_PULL_ASSIGN_MASK; 963 947 conf |= BYT_PULL_ASSIGN_DOWN; 964 948 ret = byt_set_pull_strength(&conf, arg); 949 + if (ret) 950 + return ret; 965 951 966 952 break; 967 953 case PIN_CONFIG_BIAS_PULL_UP: 968 - /* Set default strength value in case none is given */ 969 - if (arg == 1) 970 - arg = 2000; 971 - 972 - /* 973 - * Pull assignment is only applicable in input mode. If 974 - * chip is not in input mode, set it and warn about it. 975 - */ 976 - if (val & BYT_INPUT_EN) { 977 - val &= ~BYT_INPUT_EN; 978 - writel(val, val_reg); 979 - dev_warn(vg->dev, "Pin %i: forcibly set to input mode\n", offset); 980 - } 954 + byt_gpio_force_input_mode(vg, offset); 981 955 982 956 conf &= ~BYT_PULL_ASSIGN_MASK; 983 957 conf |= BYT_PULL_ASSIGN_UP; 984 958 ret = byt_set_pull_strength(&conf, arg); 959 + if (ret) 960 + return ret; 985 961 986 962 break; 987 963 case PIN_CONFIG_INPUT_DEBOUNCE: 988 - if (arg) { 989 - conf |= BYT_DEBOUNCE_EN; 990 - } else { 991 - conf &= ~BYT_DEBOUNCE_EN; 992 - 993 - /* 994 - * No need to update the pulse value. 995 - * Debounce is going to be disabled. 996 - */ 997 - break; 998 - } 999 - 1000 964 switch (arg) { 965 + case 0: 966 + db_pulse = 0; 967 + break; 1001 968 case 375: 1002 969 db_pulse = BYT_DEBOUNCE_PULSE_375US; 1003 970 break; ··· 991 1016 db_pulse = BYT_DEBOUNCE_PULSE_24MS; 992 1017 break; 993 1018 default: 994 - if (arg) 995 - ret = -EINVAL; 996 - break; 1019 + return -EINVAL; 997 1020 } 998 1021 999 - if (ret) 1000 - break; 1022 + if (db_pulse) { 1023 + debounce = readl(db_reg); 1024 + debounce = (debounce & ~BYT_DEBOUNCE_PULSE_MASK) | db_pulse; 1025 + writel(debounce, db_reg); 1001 1026 1002 - debounce = readl(db_reg); 1003 - debounce = (debounce & ~BYT_DEBOUNCE_PULSE_MASK) | db_pulse; 1004 - writel(debounce, db_reg); 1027 + conf |= BYT_DEBOUNCE_EN; 1028 + } else { 1029 + conf &= ~BYT_DEBOUNCE_EN; 1030 + } 1005 1031 1006 1032 break; 1007 1033 default: 1008 - ret = -ENOTSUPP; 1034 + return -ENOTSUPP; 1009 1035 } 1010 - 1011 - if (ret) 1012 - break; 1013 1036 } 1014 1037 1015 - if (!ret) 1016 - writel(conf, conf_reg); 1038 + writel(conf, conf_reg); 1017 1039 1018 - raw_spin_unlock_irqrestore(&byt_lock, flags); 1019 - 1020 - return ret; 1040 + return 0; 1021 1041 } 1022 1042 1023 1043 static const struct pinconf_ops byt_pinconf_ops = { ··· 1032 1062 { 1033 1063 struct intel_pinctrl *vg = gpiochip_get_data(chip); 1034 1064 void __iomem *reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); 1035 - unsigned long flags; 1036 1065 u32 val; 1037 1066 1038 - raw_spin_lock_irqsave(&byt_lock, flags); 1039 - val = readl(reg); 1040 - raw_spin_unlock_irqrestore(&byt_lock, flags); 1067 + scoped_guard(raw_spinlock_irqsave, &byt_lock) 1068 + val = readl(reg); 1041 1069 1042 1070 return !!(val & BYT_LEVEL); 1043 1071 } ··· 1043 1075 static void byt_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) 1044 1076 { 1045 1077 struct intel_pinctrl *vg = gpiochip_get_data(chip); 1046 - void __iomem *reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); 1047 - unsigned long flags; 1078 + void __iomem *reg; 1048 1079 u32 old_val; 1049 1080 1081 + reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); 1050 1082 if (!reg) 1051 1083 return; 1052 1084 1053 - raw_spin_lock_irqsave(&byt_lock, flags); 1085 + guard(raw_spinlock_irqsave)(&byt_lock); 1086 + 1054 1087 old_val = readl(reg); 1055 1088 if (value) 1056 1089 writel(old_val | BYT_LEVEL, reg); 1057 1090 else 1058 1091 writel(old_val & ~BYT_LEVEL, reg); 1059 - raw_spin_unlock_irqrestore(&byt_lock, flags); 1060 1092 } 1061 1093 1062 1094 static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) 1063 1095 { 1064 1096 struct intel_pinctrl *vg = gpiochip_get_data(chip); 1065 - void __iomem *reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); 1066 - unsigned long flags; 1097 + void __iomem *reg; 1067 1098 u32 value; 1068 1099 1100 + reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); 1069 1101 if (!reg) 1070 1102 return -EINVAL; 1071 1103 1072 - raw_spin_lock_irqsave(&byt_lock, flags); 1073 - value = readl(reg); 1074 - raw_spin_unlock_irqrestore(&byt_lock, flags); 1104 + scoped_guard(raw_spinlock_irqsave, &byt_lock) 1105 + value = readl(reg); 1075 1106 1076 1107 if (!(value & BYT_OUTPUT_EN)) 1077 1108 return GPIO_LINE_DIRECTION_OUT; ··· 1084 1117 { 1085 1118 struct intel_pinctrl *vg = gpiochip_get_data(chip); 1086 1119 void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); 1087 - unsigned long flags; 1088 1120 u32 reg; 1089 1121 1090 - raw_spin_lock_irqsave(&byt_lock, flags); 1122 + guard(raw_spinlock_irqsave)(&byt_lock); 1091 1123 1092 1124 reg = readl(val_reg); 1093 1125 reg &= ~BYT_DIR_MASK; 1094 1126 reg |= BYT_OUTPUT_EN; 1095 1127 writel(reg, val_reg); 1096 1128 1097 - raw_spin_unlock_irqrestore(&byt_lock, flags); 1098 1129 return 0; 1099 1130 } 1100 1131 ··· 1107 1142 { 1108 1143 struct intel_pinctrl *vg = gpiochip_get_data(chip); 1109 1144 void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); 1110 - unsigned long flags; 1111 1145 u32 reg; 1112 1146 1113 - raw_spin_lock_irqsave(&byt_lock, flags); 1147 + guard(raw_spinlock_irqsave)(&byt_lock); 1114 1148 1115 1149 byt_gpio_direct_irq_check(vg, offset); 1116 1150 ··· 1122 1158 1123 1159 writel(reg, val_reg); 1124 1160 1125 - raw_spin_unlock_irqrestore(&byt_lock, flags); 1126 1161 return 0; 1127 1162 } 1128 1163 ··· 1136 1173 void __iomem *conf_reg, *val_reg; 1137 1174 const char *pull_str = NULL; 1138 1175 const char *pull = NULL; 1139 - unsigned long flags; 1140 1176 unsigned int pin; 1141 1177 1142 1178 pin = vg->soc->pins[i].number; ··· 1152 1190 continue; 1153 1191 } 1154 1192 1155 - raw_spin_lock_irqsave(&byt_lock, flags); 1156 - conf0 = readl(conf_reg); 1157 - val = readl(val_reg); 1158 - raw_spin_unlock_irqrestore(&byt_lock, flags); 1193 + scoped_guard(raw_spinlock_irqsave, &byt_lock) { 1194 + conf0 = readl(conf_reg); 1195 + val = readl(val_reg); 1196 + } 1159 1197 1160 1198 comm = intel_get_community(vg, pin); 1161 1199 if (!comm) { ··· 1240 1278 if (!reg) 1241 1279 return; 1242 1280 1243 - raw_spin_lock(&byt_lock); 1281 + guard(raw_spinlock)(&byt_lock); 1282 + 1244 1283 writel(BIT(hwirq % 32), reg); 1245 - raw_spin_unlock(&byt_lock); 1246 1284 } 1247 1285 1248 1286 static void byt_irq_mask(struct irq_data *d) ··· 1260 1298 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 1261 1299 struct intel_pinctrl *vg = gpiochip_get_data(gc); 1262 1300 irq_hw_number_t hwirq = irqd_to_hwirq(d); 1263 - unsigned long flags; 1264 1301 void __iomem *reg; 1265 1302 u32 value; 1266 1303 ··· 1269 1308 if (!reg) 1270 1309 return; 1271 1310 1272 - raw_spin_lock_irqsave(&byt_lock, flags); 1311 + guard(raw_spinlock_irqsave)(&byt_lock); 1312 + 1273 1313 value = readl(reg); 1274 1314 1275 1315 switch (irqd_get_trigger_type(d)) { ··· 1292 1330 } 1293 1331 1294 1332 writel(value, reg); 1295 - 1296 - raw_spin_unlock_irqrestore(&byt_lock, flags); 1297 1333 } 1298 1334 1299 1335 static int byt_irq_type(struct irq_data *d, unsigned int type) 1300 1336 { 1301 1337 struct intel_pinctrl *vg = gpiochip_get_data(irq_data_get_irq_chip_data(d)); 1302 1338 irq_hw_number_t hwirq = irqd_to_hwirq(d); 1303 - u32 value; 1304 - unsigned long flags; 1305 1339 void __iomem *reg; 1340 + u32 value; 1306 1341 1307 1342 reg = byt_gpio_reg(vg, hwirq, BYT_CONF0_REG); 1308 1343 if (!reg) 1309 1344 return -EINVAL; 1310 1345 1311 - raw_spin_lock_irqsave(&byt_lock, flags); 1346 + guard(raw_spinlock_irqsave)(&byt_lock); 1347 + 1312 1348 value = readl(reg); 1313 1349 1314 1350 WARN(value & BYT_DIRECT_IRQ_EN, ··· 1327 1367 irq_set_handler_locked(d, handle_edge_irq); 1328 1368 else if (type & IRQ_TYPE_LEVEL_MASK) 1329 1369 irq_set_handler_locked(d, handle_level_irq); 1330 - 1331 - raw_spin_unlock_irqrestore(&byt_lock, flags); 1332 1370 1333 1371 return 0; 1334 1372 } ··· 1359 1401 continue; 1360 1402 } 1361 1403 1362 - raw_spin_lock(&byt_lock); 1363 - pending = readl(reg); 1364 - raw_spin_unlock(&byt_lock); 1404 + scoped_guard(raw_spinlock, &byt_lock) 1405 + pending = readl(reg); 1365 1406 for_each_set_bit(pin, &pending, 32) 1366 1407 generic_handle_domain_irq(vg->chip.irq.domain, base + pin); 1367 1408 } ··· 1623 1666 static int byt_gpio_suspend(struct device *dev) 1624 1667 { 1625 1668 struct intel_pinctrl *vg = dev_get_drvdata(dev); 1626 - unsigned long flags; 1627 1669 int i; 1628 1670 1629 - raw_spin_lock_irqsave(&byt_lock, flags); 1671 + guard(raw_spinlock_irqsave)(&byt_lock); 1630 1672 1631 1673 for (i = 0; i < vg->soc->npins; i++) { 1632 1674 void __iomem *reg; ··· 1649 1693 vg->context.pads[i].val = value; 1650 1694 } 1651 1695 1652 - raw_spin_unlock_irqrestore(&byt_lock, flags); 1653 1696 return 0; 1654 1697 } 1655 1698 1656 1699 static int byt_gpio_resume(struct device *dev) 1657 1700 { 1658 1701 struct intel_pinctrl *vg = dev_get_drvdata(dev); 1659 - unsigned long flags; 1660 1702 int i; 1661 1703 1662 - raw_spin_lock_irqsave(&byt_lock, flags); 1704 + guard(raw_spinlock_irqsave)(&byt_lock); 1663 1705 1664 1706 for (i = 0; i < vg->soc->npins; i++) { 1665 1707 void __iomem *reg; ··· 1697 1743 } 1698 1744 } 1699 1745 1700 - raw_spin_unlock_irqrestore(&byt_lock, flags); 1701 1746 return 0; 1702 1747 } 1703 1748
+2 -3
drivers/pinctrl/intel/pinctrl-broxton.c
··· 9 9 #include <linux/mod_devicetable.h> 10 10 #include <linux/module.h> 11 11 #include <linux/platform_device.h> 12 + #include <linux/pm.h> 12 13 13 14 #include <linux/pinctrl/pinctrl.h> 14 15 ··· 1001 1000 }; 1002 1001 MODULE_DEVICE_TABLE(platform, bxt_pinctrl_platform_ids); 1003 1002 1004 - static INTEL_PINCTRL_PM_OPS(bxt_pinctrl_pm_ops); 1005 - 1006 1003 static struct platform_driver bxt_pinctrl_driver = { 1007 1004 .probe = intel_pinctrl_probe_by_uid, 1008 1005 .driver = { 1009 1006 .name = "broxton-pinctrl", 1010 1007 .acpi_match_table = bxt_pinctrl_acpi_match, 1011 - .pm = &bxt_pinctrl_pm_ops, 1008 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 1012 1009 }, 1013 1010 .id_table = bxt_pinctrl_platform_ids, 1014 1011 };
+2 -3
drivers/pinctrl/intel/pinctrl-cannonlake.c
··· 10 10 #include <linux/mod_devicetable.h> 11 11 #include <linux/module.h> 12 12 #include <linux/platform_device.h> 13 + #include <linux/pm.h> 13 14 14 15 #include <linux/pinctrl/pinctrl.h> 15 16 ··· 825 824 }; 826 825 MODULE_DEVICE_TABLE(acpi, cnl_pinctrl_acpi_match); 827 826 828 - static INTEL_PINCTRL_PM_OPS(cnl_pinctrl_pm_ops); 829 - 830 827 static struct platform_driver cnl_pinctrl_driver = { 831 828 .probe = intel_pinctrl_probe_by_hid, 832 829 .driver = { 833 830 .name = "cannonlake-pinctrl", 834 831 .acpi_match_table = cnl_pinctrl_acpi_match, 835 - .pm = &cnl_pinctrl_pm_ops, 832 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 836 833 }, 837 834 }; 838 835 module_platform_driver(cnl_pinctrl_driver);
+2 -3
drivers/pinctrl/intel/pinctrl-cedarfork.c
··· 9 9 #include <linux/mod_devicetable.h> 10 10 #include <linux/module.h> 11 11 #include <linux/platform_device.h> 12 + #include <linux/pm.h> 12 13 13 14 #include <linux/pinctrl/pinctrl.h> 14 15 ··· 320 319 .ncommunities = ARRAY_SIZE(cdf_communities), 321 320 }; 322 321 323 - static INTEL_PINCTRL_PM_OPS(cdf_pinctrl_pm_ops); 324 - 325 322 static const struct acpi_device_id cdf_pinctrl_acpi_match[] = { 326 323 { "INTC3001", (kernel_ulong_t)&cdf_soc_data }, 327 324 { } ··· 331 332 .driver = { 332 333 .name = "cedarfork-pinctrl", 333 334 .acpi_match_table = cdf_pinctrl_acpi_match, 334 - .pm = &cdf_pinctrl_pm_ops, 335 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 335 336 }, 336 337 }; 337 338
+2 -3
drivers/pinctrl/intel/pinctrl-denverton.c
··· 9 9 #include <linux/mod_devicetable.h> 10 10 #include <linux/module.h> 11 11 #include <linux/platform_device.h> 12 + #include <linux/pm.h> 12 13 13 14 #include <linux/pinctrl/pinctrl.h> 14 15 ··· 250 249 .ncommunities = ARRAY_SIZE(dnv_communities), 251 250 }; 252 251 253 - static INTEL_PINCTRL_PM_OPS(dnv_pinctrl_pm_ops); 254 - 255 252 static const struct acpi_device_id dnv_pinctrl_acpi_match[] = { 256 253 { "INTC3000", (kernel_ulong_t)&dnv_soc_data }, 257 254 { } ··· 267 268 .driver = { 268 269 .name = "denverton-pinctrl", 269 270 .acpi_match_table = dnv_pinctrl_acpi_match, 270 - .pm = &dnv_pinctrl_pm_ops, 271 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 271 272 }, 272 273 .id_table = dnv_pinctrl_platform_ids, 273 274 };
+2 -3
drivers/pinctrl/intel/pinctrl-elkhartlake.c
··· 9 9 #include <linux/mod_devicetable.h> 10 10 #include <linux/module.h> 11 11 #include <linux/platform_device.h> 12 + #include <linux/pm.h> 12 13 13 14 #include <linux/pinctrl/pinctrl.h> 14 15 ··· 486 485 }; 487 486 MODULE_DEVICE_TABLE(acpi, ehl_pinctrl_acpi_match); 488 487 489 - static INTEL_PINCTRL_PM_OPS(ehl_pinctrl_pm_ops); 490 - 491 488 static struct platform_driver ehl_pinctrl_driver = { 492 489 .probe = intel_pinctrl_probe_by_uid, 493 490 .driver = { 494 491 .name = "elkhartlake-pinctrl", 495 492 .acpi_match_table = ehl_pinctrl_acpi_match, 496 - .pm = &ehl_pinctrl_pm_ops, 493 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 497 494 }, 498 495 }; 499 496 module_platform_driver(ehl_pinctrl_driver);
+2 -3
drivers/pinctrl/intel/pinctrl-emmitsburg.c
··· 9 9 #include <linux/mod_devicetable.h> 10 10 #include <linux/module.h> 11 11 #include <linux/platform_device.h> 12 + #include <linux/pm.h> 12 13 13 14 #include <linux/pinctrl/pinctrl.h> 14 15 ··· 359 358 }; 360 359 MODULE_DEVICE_TABLE(acpi, ebg_pinctrl_acpi_match); 361 360 362 - static INTEL_PINCTRL_PM_OPS(ebg_pinctrl_pm_ops); 363 - 364 361 static struct platform_driver ebg_pinctrl_driver = { 365 362 .probe = intel_pinctrl_probe_by_hid, 366 363 .driver = { 367 364 .name = "emmitsburg-pinctrl", 368 365 .acpi_match_table = ebg_pinctrl_acpi_match, 369 - .pm = &ebg_pinctrl_pm_ops, 366 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 370 367 }, 371 368 }; 372 369 module_platform_driver(ebg_pinctrl_driver);
+2 -3
drivers/pinctrl/intel/pinctrl-geminilake.c
··· 9 9 #include <linux/mod_devicetable.h> 10 10 #include <linux/module.h> 11 11 #include <linux/platform_device.h> 12 + #include <linux/pm.h> 12 13 13 14 #include <linux/pinctrl/pinctrl.h> 14 15 ··· 448 447 }; 449 448 MODULE_DEVICE_TABLE(acpi, glk_pinctrl_acpi_match); 450 449 451 - static INTEL_PINCTRL_PM_OPS(glk_pinctrl_pm_ops); 452 - 453 450 static struct platform_driver glk_pinctrl_driver = { 454 451 .probe = intel_pinctrl_probe_by_uid, 455 452 .driver = { 456 453 .name = "geminilake-pinctrl", 457 454 .acpi_match_table = glk_pinctrl_acpi_match, 458 - .pm = &glk_pinctrl_pm_ops, 455 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 459 456 }, 460 457 }; 461 458
+2 -3
drivers/pinctrl/intel/pinctrl-icelake.c
··· 10 10 #include <linux/acpi.h> 11 11 #include <linux/module.h> 12 12 #include <linux/platform_device.h> 13 + #include <linux/pm.h> 13 14 14 15 #include <linux/pinctrl/pinctrl.h> 15 16 ··· 669 668 .ncommunities = ARRAY_SIZE(icln_communities), 670 669 }; 671 670 672 - static INTEL_PINCTRL_PM_OPS(icl_pinctrl_pm_ops); 673 - 674 671 static const struct acpi_device_id icl_pinctrl_acpi_match[] = { 675 672 { "INT3455", (kernel_ulong_t)&icllp_soc_data }, 676 673 { "INT34C3", (kernel_ulong_t)&icln_soc_data }, ··· 681 682 .driver = { 682 683 .name = "icelake-pinctrl", 683 684 .acpi_match_table = icl_pinctrl_acpi_match, 684 - .pm = &icl_pinctrl_pm_ops, 685 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 685 686 }, 686 687 }; 687 688 module_platform_driver(icl_pinctrl_driver);
+225
drivers/pinctrl/intel/pinctrl-intel-platform.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Intel PCH pinctrl/GPIO driver 4 + * 5 + * Copyright (C) 2021-2023, Intel Corporation 6 + * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 7 + */ 8 + 9 + #include <linux/mod_devicetable.h> 10 + #include <linux/module.h> 11 + #include <linux/platform_device.h> 12 + #include <linux/pm.h> 13 + #include <linux/property.h> 14 + #include <linux/string_helpers.h> 15 + 16 + #include <linux/pinctrl/pinctrl.h> 17 + 18 + #include "pinctrl-intel.h" 19 + 20 + struct intel_platform_pins { 21 + struct pinctrl_pin_desc *pins; 22 + size_t npins; 23 + }; 24 + 25 + static int intel_platform_pinctrl_prepare_pins(struct device *dev, size_t base, 26 + const char *name, u32 size, 27 + struct intel_platform_pins *pins) 28 + { 29 + struct pinctrl_pin_desc *descs; 30 + char **pin_names; 31 + unsigned int i; 32 + 33 + pin_names = devm_kasprintf_strarray(dev, name, size); 34 + if (IS_ERR(pin_names)) 35 + return PTR_ERR(pin_names); 36 + 37 + descs = devm_krealloc_array(dev, pins->pins, base + size, sizeof(*descs), GFP_KERNEL); 38 + if (!descs) 39 + return -ENOMEM; 40 + 41 + for (i = 0; i < size; i++) { 42 + unsigned int pin_number = base + i; 43 + char *pin_name = pin_names[i]; 44 + struct pinctrl_pin_desc *desc; 45 + 46 + /* Unify delimiter for pin name */ 47 + strreplace(pin_name, '-', '_'); 48 + 49 + desc = &descs[pin_number]; 50 + desc->number = pin_number; 51 + desc->name = pin_name; 52 + } 53 + 54 + pins->pins = descs; 55 + pins->npins = base + size; 56 + 57 + return 0; 58 + } 59 + 60 + static int intel_platform_pinctrl_prepare_group(struct device *dev, 61 + struct fwnode_handle *child, 62 + struct intel_padgroup *gpp, 63 + struct intel_platform_pins *pins) 64 + { 65 + size_t base = pins->npins; 66 + const char *name; 67 + u32 size; 68 + int ret; 69 + 70 + ret = fwnode_property_read_string(child, "intc-gpio-group-name", &name); 71 + if (ret) 72 + return ret; 73 + 74 + ret = fwnode_property_read_u32(child, "intc-gpio-pad-count", &size); 75 + if (ret) 76 + return ret; 77 + 78 + ret = intel_platform_pinctrl_prepare_pins(dev, base, name, size, pins); 79 + if (ret) 80 + return ret; 81 + 82 + gpp->base = base; 83 + gpp->size = size; 84 + gpp->gpio_base = INTEL_GPIO_BASE_MATCH; 85 + 86 + return 0; 87 + } 88 + 89 + static int intel_platform_pinctrl_prepare_community(struct device *dev, 90 + struct intel_community *community, 91 + struct intel_platform_pins *pins) 92 + { 93 + struct fwnode_handle *child; 94 + struct intel_padgroup *gpps; 95 + unsigned int group; 96 + size_t ngpps; 97 + u32 offset; 98 + int ret; 99 + 100 + ret = device_property_read_u32(dev, "intc-gpio-pad-ownership-offset", &offset); 101 + if (ret) 102 + return ret; 103 + community->padown_offset = offset; 104 + 105 + ret = device_property_read_u32(dev, "intc-gpio-pad-configuration-lock-offset", &offset); 106 + if (ret) 107 + return ret; 108 + community->padcfglock_offset = offset; 109 + 110 + ret = device_property_read_u32(dev, "intc-gpio-host-software-pad-ownership-offset", &offset); 111 + if (ret) 112 + return ret; 113 + community->hostown_offset = offset; 114 + 115 + ret = device_property_read_u32(dev, "intc-gpio-gpi-interrupt-status-offset", &offset); 116 + if (ret) 117 + return ret; 118 + community->is_offset = offset; 119 + 120 + ret = device_property_read_u32(dev, "intc-gpio-gpi-interrupt-enable-offset", &offset); 121 + if (ret) 122 + return ret; 123 + community->ie_offset = offset; 124 + 125 + ngpps = device_get_child_node_count(dev); 126 + if (!ngpps) 127 + return -ENODEV; 128 + 129 + gpps = devm_kcalloc(dev, ngpps, sizeof(*gpps), GFP_KERNEL); 130 + if (!gpps) 131 + return -ENOMEM; 132 + 133 + group = 0; 134 + device_for_each_child_node(dev, child) { 135 + struct intel_padgroup *gpp = &gpps[group]; 136 + 137 + gpp->reg_num = group; 138 + 139 + ret = intel_platform_pinctrl_prepare_group(dev, child, gpp, pins); 140 + if (ret) 141 + return ret; 142 + 143 + group++; 144 + } 145 + 146 + community->ngpps = ngpps; 147 + community->gpps = gpps; 148 + 149 + return 0; 150 + } 151 + 152 + static int intel_platform_pinctrl_prepare_soc_data(struct device *dev, 153 + struct intel_pinctrl_soc_data *data) 154 + { 155 + struct intel_platform_pins pins = {}; 156 + struct intel_community *communities; 157 + size_t ncommunities; 158 + unsigned int i; 159 + int ret; 160 + 161 + /* Version 1.0 of the specification assumes only a single community per device node */ 162 + ncommunities = 1, 163 + communities = devm_kcalloc(dev, ncommunities, sizeof(*communities), GFP_KERNEL); 164 + if (!communities) 165 + return -ENOMEM; 166 + 167 + for (i = 0; i < ncommunities; i++) { 168 + struct intel_community *community = &communities[i]; 169 + 170 + community->barno = i; 171 + community->pin_base = pins.npins; 172 + 173 + ret = intel_platform_pinctrl_prepare_community(dev, community, &pins); 174 + if (ret) 175 + return ret; 176 + 177 + community->npins = pins.npins - community->pin_base; 178 + } 179 + 180 + data->ncommunities = ncommunities; 181 + data->communities = communities; 182 + 183 + data->npins = pins.npins; 184 + data->pins = pins.pins; 185 + 186 + return 0; 187 + } 188 + 189 + static int intel_platform_pinctrl_probe(struct platform_device *pdev) 190 + { 191 + struct intel_pinctrl_soc_data *data; 192 + struct device *dev = &pdev->dev; 193 + int ret; 194 + 195 + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 196 + if (!data) 197 + return -ENOMEM; 198 + 199 + ret = intel_platform_pinctrl_prepare_soc_data(dev, data); 200 + if (ret) 201 + return ret; 202 + 203 + return intel_pinctrl_probe(pdev, data); 204 + } 205 + 206 + static const struct acpi_device_id intel_platform_pinctrl_acpi_match[] = { 207 + { "INTC105F" }, 208 + { } 209 + }; 210 + MODULE_DEVICE_TABLE(acpi, intel_platform_pinctrl_acpi_match); 211 + 212 + static struct platform_driver intel_platform_pinctrl_driver = { 213 + .probe = intel_platform_pinctrl_probe, 214 + .driver = { 215 + .name = "intel-pinctrl", 216 + .acpi_match_table = intel_platform_pinctrl_acpi_match, 217 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 218 + }, 219 + }; 220 + module_platform_driver(intel_platform_pinctrl_driver); 221 + 222 + MODULE_AUTHOR("Andy Shevchenko <andriy.shevchenko@linux.intel.com>"); 223 + MODULE_DESCRIPTION("Intel PCH pinctrl/GPIO driver"); 224 + MODULE_LICENSE("GPL v2"); 225 + MODULE_IMPORT_NS(PINCTRL_INTEL);
+15 -17
drivers/pinctrl/intel/pinctrl-intel.c
··· 677 677 u32 term = 0, up = 0, value; 678 678 void __iomem *padcfg1; 679 679 680 - /* Set default strength value in case none is given */ 681 - if (arg == 1) 682 - arg = 5000; 683 - 684 680 switch (param) { 685 681 case PIN_CONFIG_BIAS_DISABLE: 686 682 break; ··· 686 690 case 20000: 687 691 term = PADCFG1_TERM_20K; 688 692 break; 693 + case 1: /* Set default strength value in case none is given */ 689 694 case 5000: 690 695 term = PADCFG1_TERM_5K; 691 696 break; ··· 713 716 case 20000: 714 717 term = PADCFG1_TERM_20K; 715 718 break; 719 + case 1: /* Set default strength value in case none is given */ 716 720 case 5000: 717 721 term = PADCFG1_TERM_5K; 718 722 break; ··· 897 899 * 898 900 * Return: a GPIO offset, or negative error code if translation can't be done. 899 901 */ 900 - static __maybe_unused int intel_pin_to_gpio(struct intel_pinctrl *pctrl, int pin) 902 + static int intel_pin_to_gpio(struct intel_pinctrl *pctrl, int pin) 901 903 { 902 904 const struct intel_community *community; 903 905 const struct intel_padgroup *padgrp; ··· 1504 1506 return PTR_ERR_OR_ZERO(pwm); 1505 1507 } 1506 1508 1507 - static int intel_pinctrl_probe(struct platform_device *pdev, 1508 - const struct intel_pinctrl_soc_data *soc_data) 1509 + int intel_pinctrl_probe(struct platform_device *pdev, 1510 + const struct intel_pinctrl_soc_data *soc_data) 1509 1511 { 1510 1512 struct device *dev = &pdev->dev; 1511 1513 struct intel_pinctrl *pctrl; ··· 1623 1625 1624 1626 return 0; 1625 1627 } 1628 + EXPORT_SYMBOL_NS_GPL(intel_pinctrl_probe, PINCTRL_INTEL); 1626 1629 1627 1630 int intel_pinctrl_probe_by_hid(struct platform_device *pdev) 1628 1631 { ··· 1652 1653 const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_device *pdev) 1653 1654 { 1654 1655 const struct intel_pinctrl_soc_data * const *table; 1655 - const struct intel_pinctrl_soc_data *data = NULL; 1656 + const struct intel_pinctrl_soc_data *data; 1656 1657 struct device *dev = &pdev->dev; 1657 1658 1658 1659 table = device_get_match_data(dev); ··· 1661 1662 unsigned int i; 1662 1663 1663 1664 for (i = 0; table[i]; i++) { 1664 - if (acpi_dev_uid_match(adev, table[i]->uid)) { 1665 - data = table[i]; 1665 + if (acpi_dev_uid_match(adev, table[i]->uid)) 1666 1666 break; 1667 - } 1668 1667 } 1668 + data = table[i]; 1669 1669 } else { 1670 1670 const struct platform_device_id *id; 1671 1671 ··· 1680 1682 } 1681 1683 EXPORT_SYMBOL_NS_GPL(intel_pinctrl_get_soc_data, PINCTRL_INTEL); 1682 1684 1683 - #ifdef CONFIG_PM_SLEEP 1684 1685 static bool __intel_gpio_is_direct_irq(u32 value) 1685 1686 { 1686 1687 return (value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) && ··· 1725 1728 return false; 1726 1729 } 1727 1730 1728 - int intel_pinctrl_suspend_noirq(struct device *dev) 1731 + static int intel_pinctrl_suspend_noirq(struct device *dev) 1729 1732 { 1730 1733 struct intel_pinctrl *pctrl = dev_get_drvdata(dev); 1731 1734 struct intel_community_context *communities; ··· 1768 1771 1769 1772 return 0; 1770 1773 } 1771 - EXPORT_SYMBOL_GPL(intel_pinctrl_suspend_noirq); 1772 1774 1773 1775 static bool intel_gpio_update_reg(void __iomem *reg, u32 mask, u32 value) 1774 1776 { ··· 1834 1838 dev_dbg(dev, "restored pin %u padcfg%u %#08x\n", pin, n, readl(padcfg)); 1835 1839 } 1836 1840 1837 - int intel_pinctrl_resume_noirq(struct device *dev) 1841 + static int intel_pinctrl_resume_noirq(struct device *dev) 1838 1842 { 1839 1843 struct intel_pinctrl *pctrl = dev_get_drvdata(dev); 1840 1844 const struct intel_community_context *communities; ··· 1878 1882 1879 1883 return 0; 1880 1884 } 1881 - EXPORT_SYMBOL_GPL(intel_pinctrl_resume_noirq); 1882 - #endif 1885 + 1886 + EXPORT_NS_GPL_DEV_SLEEP_PM_OPS(intel_pinctrl_pm_ops, PINCTRL_INTEL) = { 1887 + NOIRQ_SYSTEM_SLEEP_PM_OPS(intel_pinctrl_suspend_noirq, intel_pinctrl_resume_noirq) 1888 + }; 1883 1889 1884 1890 MODULE_AUTHOR("Mathias Nyman <mathias.nyman@linux.intel.com>"); 1885 1891 MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
+4 -10
drivers/pinctrl/intel/pinctrl-intel.h
··· 252 252 int irq; 253 253 }; 254 254 255 + int intel_pinctrl_probe(struct platform_device *pdev, 256 + const struct intel_pinctrl_soc_data *soc_data); 257 + 255 258 int intel_pinctrl_probe_by_hid(struct platform_device *pdev); 256 259 int intel_pinctrl_probe_by_uid(struct platform_device *pdev); 257 260 258 - #ifdef CONFIG_PM_SLEEP 259 - int intel_pinctrl_suspend_noirq(struct device *dev); 260 - int intel_pinctrl_resume_noirq(struct device *dev); 261 - #endif 262 - 263 - #define INTEL_PINCTRL_PM_OPS(_name) \ 264 - const struct dev_pm_ops _name = { \ 265 - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(intel_pinctrl_suspend_noirq, \ 266 - intel_pinctrl_resume_noirq) \ 267 - } 261 + extern const struct dev_pm_ops intel_pinctrl_pm_ops; 268 262 269 263 struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin); 270 264
+2 -3
drivers/pinctrl/intel/pinctrl-jasperlake.c
··· 9 9 #include <linux/mod_devicetable.h> 10 10 #include <linux/module.h> 11 11 #include <linux/platform_device.h> 12 + #include <linux/pm.h> 12 13 13 14 #include <linux/pinctrl/pinctrl.h> 14 15 ··· 327 326 }; 328 327 MODULE_DEVICE_TABLE(acpi, jsl_pinctrl_acpi_match); 329 328 330 - static INTEL_PINCTRL_PM_OPS(jsl_pinctrl_pm_ops); 331 - 332 329 static struct platform_driver jsl_pinctrl_driver = { 333 330 .probe = intel_pinctrl_probe_by_hid, 334 331 .driver = { 335 332 .name = "jasperlake-pinctrl", 336 333 .acpi_match_table = jsl_pinctrl_acpi_match, 337 - .pm = &jsl_pinctrl_pm_ops, 334 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 338 335 }, 339 336 }; 340 337 module_platform_driver(jsl_pinctrl_driver);
+2 -3
drivers/pinctrl/intel/pinctrl-lakefield.c
··· 9 9 #include <linux/mod_devicetable.h> 10 10 #include <linux/module.h> 11 11 #include <linux/platform_device.h> 12 + #include <linux/pm.h> 12 13 13 14 #include <linux/pinctrl/pinctrl.h> 14 15 ··· 348 347 }; 349 348 MODULE_DEVICE_TABLE(acpi, lkf_pinctrl_acpi_match); 350 349 351 - static INTEL_PINCTRL_PM_OPS(lkf_pinctrl_pm_ops); 352 - 353 350 static struct platform_driver lkf_pinctrl_driver = { 354 351 .probe = intel_pinctrl_probe_by_hid, 355 352 .driver = { 356 353 .name = "lakefield-pinctrl", 357 354 .acpi_match_table = lkf_pinctrl_acpi_match, 358 - .pm = &lkf_pinctrl_pm_ops, 355 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 359 356 }, 360 357 }; 361 358 module_platform_driver(lkf_pinctrl_driver);
+2 -3
drivers/pinctrl/intel/pinctrl-lewisburg.c
··· 9 9 #include <linux/mod_devicetable.h> 10 10 #include <linux/module.h> 11 11 #include <linux/platform_device.h> 12 + #include <linux/pm.h> 12 13 13 14 #include <linux/pinctrl/pinctrl.h> 14 15 ··· 302 301 .ncommunities = ARRAY_SIZE(lbg_communities), 303 302 }; 304 303 305 - static INTEL_PINCTRL_PM_OPS(lbg_pinctrl_pm_ops); 306 - 307 304 static const struct acpi_device_id lbg_pinctrl_acpi_match[] = { 308 305 { "INT3536", (kernel_ulong_t)&lbg_soc_data }, 309 306 { } ··· 313 314 .driver = { 314 315 .name = "lewisburg-pinctrl", 315 316 .acpi_match_table = lbg_pinctrl_acpi_match, 316 - .pm = &lbg_pinctrl_pm_ops, 317 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 317 318 }, 318 319 }; 319 320 module_platform_driver(lbg_pinctrl_driver);
+21 -51
drivers/pinctrl/intel/pinctrl-lynxpoint.c
··· 10 10 #include <linux/acpi.h> 11 11 #include <linux/array_size.h> 12 12 #include <linux/bitops.h> 13 + #include <linux/cleanup.h> 13 14 #include <linux/gpio/driver.h> 14 15 #include <linux/interrupt.h> 15 16 #include <linux/io.h> ··· 292 291 { 293 292 struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev); 294 293 const struct intel_pingroup *grp = &lg->soc->groups[group]; 295 - unsigned long flags; 296 294 int i; 297 295 298 - raw_spin_lock_irqsave(&lg->lock, flags); 296 + guard(raw_spinlock_irqsave)(&lg->lock); 299 297 300 298 /* Now enable the mux setting for each pin in the group */ 301 299 for (i = 0; i < grp->grp.npins; i++) { ··· 311 311 312 312 iowrite32(value, reg); 313 313 } 314 - 315 - raw_spin_unlock_irqrestore(&lg->lock, flags); 316 314 317 315 return 0; 318 316 } ··· 332 334 struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev); 333 335 void __iomem *reg = lp_gpio_reg(&lg->chip, pin, LP_CONFIG1); 334 336 void __iomem *conf2 = lp_gpio_reg(&lg->chip, pin, LP_CONFIG2); 335 - unsigned long flags; 336 337 u32 value; 337 338 338 - raw_spin_lock_irqsave(&lg->lock, flags); 339 + guard(raw_spinlock_irqsave)(&lg->lock); 339 340 340 341 /* 341 342 * Reconfigure pin to GPIO mode if needed and issue a warning, ··· 349 352 /* Enable input sensing */ 350 353 lp_gpio_enable_input(conf2); 351 354 352 - raw_spin_unlock_irqrestore(&lg->lock, flags); 353 - 354 355 return 0; 355 356 } 356 357 ··· 358 363 { 359 364 struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev); 360 365 void __iomem *conf2 = lp_gpio_reg(&lg->chip, pin, LP_CONFIG2); 361 - unsigned long flags; 362 366 363 - raw_spin_lock_irqsave(&lg->lock, flags); 367 + guard(raw_spinlock_irqsave)(&lg->lock); 364 368 365 369 /* Disable input sensing */ 366 370 lp_gpio_disable_input(conf2); 367 - 368 - raw_spin_unlock_irqrestore(&lg->lock, flags); 369 371 } 370 372 371 373 static int lp_gpio_set_direction(struct pinctrl_dev *pctldev, ··· 371 379 { 372 380 struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev); 373 381 void __iomem *reg = lp_gpio_reg(&lg->chip, pin, LP_CONFIG1); 374 - unsigned long flags; 375 382 u32 value; 376 383 377 - raw_spin_lock_irqsave(&lg->lock, flags); 384 + guard(raw_spinlock_irqsave)(&lg->lock); 378 385 379 386 value = ioread32(reg); 380 387 value &= ~DIR_BIT; ··· 390 399 "Potential Error: Setting GPIO to output with IOxAPIC redirection"); 391 400 } 392 401 iowrite32(value, reg); 393 - 394 - raw_spin_unlock_irqrestore(&lg->lock, flags); 395 402 396 403 return 0; 397 404 } ··· 410 421 struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev); 411 422 void __iomem *conf2 = lp_gpio_reg(&lg->chip, pin, LP_CONFIG2); 412 423 enum pin_config_param param = pinconf_to_config_param(*config); 413 - unsigned long flags; 414 424 u32 value, pull; 415 425 u16 arg; 416 426 417 - raw_spin_lock_irqsave(&lg->lock, flags); 418 - value = ioread32(conf2); 419 - raw_spin_unlock_irqrestore(&lg->lock, flags); 427 + scoped_guard(raw_spinlock_irqsave, &lg->lock) 428 + value = ioread32(conf2); 420 429 421 430 pull = value & GPIWP_MASK; 422 431 ··· 451 464 struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev); 452 465 void __iomem *conf2 = lp_gpio_reg(&lg->chip, pin, LP_CONFIG2); 453 466 enum pin_config_param param; 454 - unsigned long flags; 455 - int i, ret = 0; 467 + unsigned int i; 456 468 u32 value; 457 469 458 - raw_spin_lock_irqsave(&lg->lock, flags); 470 + guard(raw_spinlock_irqsave)(&lg->lock); 459 471 460 472 value = ioread32(conf2); 461 473 ··· 475 489 value |= GPIWP_UP; 476 490 break; 477 491 default: 478 - ret = -ENOTSUPP; 492 + return -ENOTSUPP; 479 493 } 480 - 481 - if (ret) 482 - break; 483 494 } 484 495 485 - if (!ret) 486 - iowrite32(value, conf2); 496 + iowrite32(value, conf2); 487 497 488 - raw_spin_unlock_irqrestore(&lg->lock, flags); 489 - 490 - return ret; 498 + return 0; 491 499 } 492 500 493 501 static const struct pinconf_ops lptlp_pinconf_ops = { ··· 507 527 { 508 528 struct intel_pinctrl *lg = gpiochip_get_data(chip); 509 529 void __iomem *reg = lp_gpio_reg(chip, offset, LP_CONFIG1); 510 - unsigned long flags; 511 530 512 - raw_spin_lock_irqsave(&lg->lock, flags); 531 + guard(raw_spinlock_irqsave)(&lg->lock); 513 532 514 533 if (value) 515 534 iowrite32(ioread32(reg) | OUT_LVL_BIT, reg); 516 535 else 517 536 iowrite32(ioread32(reg) & ~OUT_LVL_BIT, reg); 518 - 519 - raw_spin_unlock_irqrestore(&lg->lock, flags); 520 537 } 521 538 522 539 static int lp_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) ··· 569 592 struct intel_pinctrl *lg = gpiochip_get_data(gc); 570 593 irq_hw_number_t hwirq = irqd_to_hwirq(d); 571 594 void __iomem *reg = lp_gpio_reg(&lg->chip, hwirq, LP_INT_STAT); 572 - unsigned long flags; 573 595 574 - raw_spin_lock_irqsave(&lg->lock, flags); 596 + guard(raw_spinlock_irqsave)(&lg->lock); 597 + 575 598 iowrite32(BIT(hwirq % 32), reg); 576 - raw_spin_unlock_irqrestore(&lg->lock, flags); 577 599 } 578 600 579 601 static void lp_irq_unmask(struct irq_data *d) ··· 589 613 struct intel_pinctrl *lg = gpiochip_get_data(gc); 590 614 irq_hw_number_t hwirq = irqd_to_hwirq(d); 591 615 void __iomem *reg = lp_gpio_reg(&lg->chip, hwirq, LP_INT_ENABLE); 592 - unsigned long flags; 593 616 594 617 gpiochip_enable_irq(gc, hwirq); 595 618 596 - raw_spin_lock_irqsave(&lg->lock, flags); 597 - iowrite32(ioread32(reg) | BIT(hwirq % 32), reg); 598 - raw_spin_unlock_irqrestore(&lg->lock, flags); 619 + scoped_guard(raw_spinlock_irqsave, &lg->lock) 620 + iowrite32(ioread32(reg) | BIT(hwirq % 32), reg); 599 621 } 600 622 601 623 static void lp_irq_disable(struct irq_data *d) ··· 602 628 struct intel_pinctrl *lg = gpiochip_get_data(gc); 603 629 irq_hw_number_t hwirq = irqd_to_hwirq(d); 604 630 void __iomem *reg = lp_gpio_reg(&lg->chip, hwirq, LP_INT_ENABLE); 605 - unsigned long flags; 606 631 607 - raw_spin_lock_irqsave(&lg->lock, flags); 608 - iowrite32(ioread32(reg) & ~BIT(hwirq % 32), reg); 609 - raw_spin_unlock_irqrestore(&lg->lock, flags); 632 + scoped_guard(raw_spinlock_irqsave, &lg->lock) 633 + iowrite32(ioread32(reg) & ~BIT(hwirq % 32), reg); 610 634 611 635 gpiochip_disable_irq(gc, hwirq); 612 636 } ··· 614 642 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 615 643 struct intel_pinctrl *lg = gpiochip_get_data(gc); 616 644 irq_hw_number_t hwirq = irqd_to_hwirq(d); 617 - unsigned long flags; 618 645 void __iomem *reg; 619 646 u32 value; 620 647 ··· 627 656 return -EBUSY; 628 657 } 629 658 630 - raw_spin_lock_irqsave(&lg->lock, flags); 659 + guard(raw_spinlock_irqsave)(&lg->lock); 660 + 631 661 value = ioread32(reg); 632 662 633 663 /* set both TRIG_SEL and INV bits to 0 for rising edge */ ··· 653 681 irq_set_handler_locked(d, handle_edge_irq); 654 682 else if (type & IRQ_TYPE_LEVEL_MASK) 655 683 irq_set_handler_locked(d, handle_level_irq); 656 - 657 - raw_spin_unlock_irqrestore(&lg->lock, flags); 658 684 659 685 return 0; 660 686 }
+2 -3
drivers/pinctrl/intel/pinctrl-meteorlake.c
··· 9 9 #include <linux/mod_devicetable.h> 10 10 #include <linux/module.h> 11 11 #include <linux/platform_device.h> 12 + #include <linux/pm.h> 12 13 13 14 #include <linux/pinctrl/pinctrl.h> 14 15 ··· 590 589 }; 591 590 MODULE_DEVICE_TABLE(acpi, mtl_pinctrl_acpi_match); 592 591 593 - static INTEL_PINCTRL_PM_OPS(mtl_pinctrl_pm_ops); 594 - 595 592 static struct platform_driver mtl_pinctrl_driver = { 596 593 .probe = intel_pinctrl_probe_by_hid, 597 594 .driver = { 598 595 .name = "meteorlake-pinctrl", 599 596 .acpi_match_table = mtl_pinctrl_acpi_match, 600 - .pm = &mtl_pinctrl_pm_ops, 597 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 601 598 }, 602 599 }; 603 600 module_platform_driver(mtl_pinctrl_driver);
+465
drivers/pinctrl/intel/pinctrl-meteorpoint.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Intel Meteor Point PCH pinctrl/GPIO driver 4 + * 5 + * Copyright (C) 2022-2023, Intel Corporation 6 + * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 7 + */ 8 + 9 + #include <linux/mod_devicetable.h> 10 + #include <linux/module.h> 11 + #include <linux/platform_device.h> 12 + #include <linux/pm.h> 13 + 14 + #include <linux/pinctrl/pinctrl.h> 15 + 16 + #include "pinctrl-intel.h" 17 + 18 + #define MTP_PAD_OWN 0x0b0 19 + #define MTP_PADCFGLOCK 0x110 20 + #define MTP_HOSTSW_OWN 0x150 21 + #define MTP_GPI_IS 0x200 22 + #define MTP_GPI_IE 0x220 23 + 24 + #define MTP_GPP(r, s, e, g) \ 25 + { \ 26 + .reg_num = (r), \ 27 + .base = (s), \ 28 + .size = ((e) - (s) + 1), \ 29 + .gpio_base = (g), \ 30 + } 31 + 32 + #define MTP_COMMUNITY(b, s, e, g) \ 33 + INTEL_COMMUNITY_GPPS(b, s, e, g, MTP) 34 + 35 + /* Meteor Point-S */ 36 + static const struct pinctrl_pin_desc mtps_pins[] = { 37 + /* GPP_D */ 38 + PINCTRL_PIN(0, "GPP_D_0"), 39 + PINCTRL_PIN(1, "GPP_D_1"), 40 + PINCTRL_PIN(2, "GPP_D_2"), 41 + PINCTRL_PIN(3, "GPP_D_3"), 42 + PINCTRL_PIN(4, "GPP_D_4"), 43 + PINCTRL_PIN(5, "CNV_RF_RESET_B"), 44 + PINCTRL_PIN(6, "CRF_CLKREQ"), 45 + PINCTRL_PIN(7, "GPP_D_7"), 46 + PINCTRL_PIN(8, "GPP_D_8"), 47 + PINCTRL_PIN(9, "SML0CLK"), 48 + PINCTRL_PIN(10, "SML0DATA"), 49 + PINCTRL_PIN(11, "GPP_D_11"), 50 + PINCTRL_PIN(12, "GPP_D_12"), 51 + PINCTRL_PIN(13, "GPP_D_13"), 52 + PINCTRL_PIN(14, "GPP_D_14"), 53 + PINCTRL_PIN(15, "GPP_D_15"), 54 + PINCTRL_PIN(16, "GPP_D_16"), 55 + PINCTRL_PIN(17, "GPP_D_17"), 56 + PINCTRL_PIN(18, "GPP_D_18"), 57 + PINCTRL_PIN(19, "GPP_D_19"), 58 + PINCTRL_PIN(20, "GPP_D_20"), 59 + PINCTRL_PIN(21, "GPP_D_21"), 60 + PINCTRL_PIN(22, "GPP_D_22"), 61 + PINCTRL_PIN(23, "GPP_D_23"), 62 + PINCTRL_PIN(24, "GSPI3_CLK_LOOPBK"), 63 + /* GPP_R */ 64 + PINCTRL_PIN(25, "HDA_BCLK"), 65 + PINCTRL_PIN(26, "HDA_SYNC"), 66 + PINCTRL_PIN(27, "HDA_SDO"), 67 + PINCTRL_PIN(28, "HDA_SDI_0"), 68 + PINCTRL_PIN(29, "HDA_RSTB"), 69 + PINCTRL_PIN(30, "GPP_R_5"), 70 + PINCTRL_PIN(31, "GPP_R_6"), 71 + PINCTRL_PIN(32, "GPP_R_7"), 72 + PINCTRL_PIN(33, "GPP_R_8"), 73 + PINCTRL_PIN(34, "GPP_R_9"), 74 + PINCTRL_PIN(35, "GPP_R_10"), 75 + PINCTRL_PIN(36, "GPP_R_11"), 76 + PINCTRL_PIN(37, "GPP_R_12"), 77 + PINCTRL_PIN(38, "GSPI2_CLK_LOOPBK"), 78 + /* GPP_J */ 79 + PINCTRL_PIN(39, "GPP_J_0"), 80 + PINCTRL_PIN(40, "CNV_BRI_DT"), 81 + PINCTRL_PIN(41, "CNV_BRI_RSP"), 82 + PINCTRL_PIN(42, "CNV_RGI_DT"), 83 + PINCTRL_PIN(43, "CNV_RGI_RSP"), 84 + PINCTRL_PIN(44, "GPP_J_5"), 85 + PINCTRL_PIN(45, "GPP_J_6"), 86 + PINCTRL_PIN(46, "BOOTHALT_B"), 87 + PINCTRL_PIN(47, "RTCCLKOUT"), 88 + PINCTRL_PIN(48, "BPKI3C_SDA"), 89 + PINCTRL_PIN(49, "BPKI3C_SCL"), 90 + PINCTRL_PIN(50, "DAM"), 91 + PINCTRL_PIN(51, "HDACPU_SDI"), 92 + PINCTRL_PIN(52, "HDACPU_SDO"), 93 + PINCTRL_PIN(53, "HDACPU_BCLK"), 94 + PINCTRL_PIN(54, "AUX_PWRGD"), 95 + PINCTRL_PIN(55, "GLB_RST_WARN_B"), 96 + PINCTRL_PIN(56, "RESET_SYNCB"), 97 + /* vGPIO */ 98 + PINCTRL_PIN(57, "CNV_BTEN"), 99 + PINCTRL_PIN(58, "CNV_BT_HOST_WAKEB"), 100 + PINCTRL_PIN(59, "CNV_BT_IF_SELECT"), 101 + PINCTRL_PIN(60, "vCNV_BT_UART_TXD"), 102 + PINCTRL_PIN(61, "vCNV_BT_UART_RXD"), 103 + PINCTRL_PIN(62, "vCNV_BT_UART_CTS_B"), 104 + PINCTRL_PIN(63, "vCNV_BT_UART_RTS_B"), 105 + PINCTRL_PIN(64, "vCNV_MFUART1_TXD"), 106 + PINCTRL_PIN(65, "vCNV_MFUART1_RXD"), 107 + PINCTRL_PIN(66, "vCNV_MFUART1_CTS_B"), 108 + PINCTRL_PIN(67, "vCNV_MFUART1_RTS_B"), 109 + PINCTRL_PIN(68, "vUART0_TXD"), 110 + PINCTRL_PIN(69, "vUART0_RXD"), 111 + PINCTRL_PIN(70, "vUART0_CTS_B"), 112 + PINCTRL_PIN(71, "vUART0_RTS_B"), 113 + PINCTRL_PIN(72, "vISH_UART0_TXD"), 114 + PINCTRL_PIN(73, "vISH_UART0_RXD"), 115 + PINCTRL_PIN(74, "vISH_UART0_CTS_B"), 116 + PINCTRL_PIN(75, "vISH_UART0_RTS_B"), 117 + PINCTRL_PIN(76, "vCNV_BT_I2S_BCLK"), 118 + PINCTRL_PIN(77, "vCNV_BT_I2S_WS_SYNC"), 119 + PINCTRL_PIN(78, "vCNV_BT_I2S_SDO"), 120 + PINCTRL_PIN(79, "vCNV_BT_I2S_SDI"), 121 + PINCTRL_PIN(80, "vI2S2_SCLK"), 122 + PINCTRL_PIN(81, "vI2S2_SFRM"), 123 + PINCTRL_PIN(82, "vI2S2_TXD"), 124 + PINCTRL_PIN(83, "vI2S2_RXD"), 125 + PINCTRL_PIN(84, "THC0_WOT_INT"), 126 + PINCTRL_PIN(85, "THC1_WOT_INT"), 127 + PINCTRL_PIN(86, "THC0_WHC_INT"), 128 + PINCTRL_PIN(87, "THC1_WHC_INT"), 129 + /* GPP_A */ 130 + PINCTRL_PIN(88, "ESPI_IO_0"), 131 + PINCTRL_PIN(89, "ESPI_IO_1"), 132 + PINCTRL_PIN(90, "ESPI_IO_2"), 133 + PINCTRL_PIN(91, "ESPI_IO_3"), 134 + PINCTRL_PIN(92, "ESPI_CS0B"), 135 + PINCTRL_PIN(93, "ESPI_CLK"), 136 + PINCTRL_PIN(94, "ESPI_RESETB"), 137 + PINCTRL_PIN(95, "ESPI_CS1B"), 138 + PINCTRL_PIN(96, "ESPI_CS2B"), 139 + PINCTRL_PIN(97, "ESPI_CS3B"), 140 + PINCTRL_PIN(98, "ESPI_ALERT0B"), 141 + PINCTRL_PIN(99, "ESPI_ALERT1B"), 142 + PINCTRL_PIN(100, "ESPI_ALERT2B"), 143 + PINCTRL_PIN(101, "ESPI_ALERT3B"), 144 + PINCTRL_PIN(102, "ESPI_CLK_LOOPBK"), 145 + /* DIR_ESPI */ 146 + PINCTRL_PIN(103, "PWRBTNB_OUT"), 147 + PINCTRL_PIN(104, "DMI_PERSTB"), 148 + PINCTRL_PIN(105, "DMI_CLKREQB"), 149 + PINCTRL_PIN(106, "DIR_ESPI_IO_0"), 150 + PINCTRL_PIN(107, "DIR_ESPI_IO_1"), 151 + PINCTRL_PIN(108, "DIR_ESPI_IO_2"), 152 + PINCTRL_PIN(109, "DIR_ESPI_IO_3"), 153 + PINCTRL_PIN(110, "DIR_ESPI_CSB"), 154 + PINCTRL_PIN(111, "DIR_ESPI_RESETB"), 155 + PINCTRL_PIN(112, "DIR_ESPI_CLK"), 156 + PINCTRL_PIN(113, "DIR_ESPI_RCLK"), 157 + PINCTRL_PIN(114, "DIR_ESPI_ALERTB"), 158 + /* GPP_B */ 159 + PINCTRL_PIN(115, "GPP_B_0"), 160 + PINCTRL_PIN(116, "GPP_B_1"), 161 + PINCTRL_PIN(117, "GPP_B_2"), 162 + PINCTRL_PIN(118, "GPP_B_3"), 163 + PINCTRL_PIN(119, "GPP_B_4"), 164 + PINCTRL_PIN(120, "GPP_B_5"), 165 + PINCTRL_PIN(121, "CLKOUT_48"), 166 + PINCTRL_PIN(122, "GPP_B_7"), 167 + PINCTRL_PIN(123, "GPP_B_8"), 168 + PINCTRL_PIN(124, "GPP_B_9"), 169 + PINCTRL_PIN(125, "GPP_B_10"), 170 + PINCTRL_PIN(126, "GPP_B_11"), 171 + PINCTRL_PIN(127, "SLP_S0B"), 172 + PINCTRL_PIN(128, "PLTRSTB"), 173 + PINCTRL_PIN(129, "GPP_B_14"), 174 + PINCTRL_PIN(130, "GPP_B_15"), 175 + PINCTRL_PIN(131, "GPP_B_16"), 176 + PINCTRL_PIN(132, "GPP_B_17"), 177 + PINCTRL_PIN(133, "GPP_B_18"), 178 + PINCTRL_PIN(134, "FUSA_DIAGTEST_EN"), 179 + PINCTRL_PIN(135, "FUSA_DIAGTEST_MODE"), 180 + PINCTRL_PIN(136, "GPP_B_21"), 181 + /* SPI0 */ 182 + PINCTRL_PIN(137, "SPI0_IO_2"), 183 + PINCTRL_PIN(138, "SPI0_IO_3"), 184 + PINCTRL_PIN(139, "SPI0_MOSI_IO_0"), 185 + PINCTRL_PIN(140, "SPI0_MISO_IO_1"), 186 + PINCTRL_PIN(141, "SPI0_TPM_CSB"), 187 + PINCTRL_PIN(142, "SPI0_FLASH_0_CSB"), 188 + PINCTRL_PIN(143, "SPI0_FLASH_1_CSB"), 189 + PINCTRL_PIN(144, "SPI0_CLK"), 190 + PINCTRL_PIN(145, "SPI0_CLK_LOOPBK"), 191 + /* GPP_C */ 192 + PINCTRL_PIN(146, "SMBCLK"), 193 + PINCTRL_PIN(147, "SMBDATA"), 194 + PINCTRL_PIN(148, "SMBALERTB"), 195 + PINCTRL_PIN(149, "GPP_C_3"), 196 + PINCTRL_PIN(150, "GPP_C_4"), 197 + PINCTRL_PIN(151, "GPP_C_5"), 198 + PINCTRL_PIN(152, "GPP_C_6"), 199 + PINCTRL_PIN(153, "GPP_C_7"), 200 + PINCTRL_PIN(154, "GPP_C_8"), 201 + PINCTRL_PIN(155, "GPP_C_9"), 202 + PINCTRL_PIN(156, "GPP_C_10"), 203 + PINCTRL_PIN(157, "GPP_C_11"), 204 + PINCTRL_PIN(158, "GPP_C_12"), 205 + PINCTRL_PIN(159, "GPP_C_13"), 206 + PINCTRL_PIN(160, "GPP_C_14"), 207 + PINCTRL_PIN(161, "GPP_C_15"), 208 + PINCTRL_PIN(162, "GPP_C_16"), 209 + PINCTRL_PIN(163, "GPP_C_17"), 210 + PINCTRL_PIN(164, "GPP_C_18"), 211 + PINCTRL_PIN(165, "GPP_C_19"), 212 + PINCTRL_PIN(166, "GPP_C_20"), 213 + PINCTRL_PIN(167, "GPP_C_21"), 214 + PINCTRL_PIN(168, "GPP_C_22"), 215 + PINCTRL_PIN(169, "GPP_C_23"), 216 + /* GPP_H */ 217 + PINCTRL_PIN(170, "GPP_H_0"), 218 + PINCTRL_PIN(171, "GPP_H_1"), 219 + PINCTRL_PIN(172, "GPP_H_2"), 220 + PINCTRL_PIN(173, "GPP_H_3"), 221 + PINCTRL_PIN(174, "GPP_H_4"), 222 + PINCTRL_PIN(175, "GPP_H_5"), 223 + PINCTRL_PIN(176, "GPP_H_6"), 224 + PINCTRL_PIN(177, "GPP_H_7"), 225 + PINCTRL_PIN(178, "GPP_H_8"), 226 + PINCTRL_PIN(179, "GPP_H_9"), 227 + PINCTRL_PIN(180, "GPP_H_10"), 228 + PINCTRL_PIN(181, "GPP_H_11"), 229 + PINCTRL_PIN(182, "GPP_H_12"), 230 + PINCTRL_PIN(183, "GPP_H_13"), 231 + PINCTRL_PIN(184, "GPP_H_14"), 232 + PINCTRL_PIN(185, "GPP_H_15"), 233 + PINCTRL_PIN(186, "GPP_H_16"), 234 + PINCTRL_PIN(187, "GPP_H_17"), 235 + PINCTRL_PIN(188, "GPP_H_18"), 236 + PINCTRL_PIN(189, "GPP_H_19"), 237 + /* vGPIO_3 */ 238 + PINCTRL_PIN(190, "CPU_PCIE_LNK_DN_0"), 239 + PINCTRL_PIN(191, "CPU_PCIE_LNK_DN_1"), 240 + PINCTRL_PIN(192, "CPU_PCIE_LNK_DN_2"), 241 + PINCTRL_PIN(193, "CPU_PCIE_LNK_DN_3"), 242 + /* vGPIO_0 */ 243 + PINCTRL_PIN(194, "ESPI_USB_OCB_0"), 244 + PINCTRL_PIN(195, "ESPI_USB_OCB_1"), 245 + PINCTRL_PIN(196, "ESPI_USB_OCB_2"), 246 + PINCTRL_PIN(197, "ESPI_USB_OCB_3"), 247 + PINCTRL_PIN(198, "USB_CPU_OCB_0"), 248 + PINCTRL_PIN(199, "USB_CPU_OCB_1"), 249 + PINCTRL_PIN(200, "USB_CPU_OCB_2"), 250 + PINCTRL_PIN(201, "USB_CPU_OCB_3"), 251 + /* vGPIO_4 */ 252 + PINCTRL_PIN(202, "ESPI_ISCLK_XTAL_CLKREQ"), 253 + PINCTRL_PIN(203, "ISCLK_ESPI_XTAL_CLKACK"), 254 + PINCTRL_PIN(204, "ME_SLPC_FTPM_ENABLE"), 255 + PINCTRL_PIN(205, "GP_SLPC_DTFUS_CORE_SPITPM_DIS"), 256 + PINCTRL_PIN(206, "GP_SLPC_SPI_STRAP_TOS"), 257 + PINCTRL_PIN(207, "GP_SLPC_DTFUS_CORE_SPITPM_DIS_L01"), 258 + PINCTRL_PIN(208, "GP_SLPC_SPI_STRAP_TOS_L01"), 259 + PINCTRL_PIN(209, "LPC_PRR_TS_OVR"), 260 + PINCTRL_PIN(210, "ITSS_KU1_SHTDWN"), 261 + PINCTRL_PIN(211, "vGPIO_SPARE_0"), 262 + PINCTRL_PIN(212, "vGPIO_SPARE_1"), 263 + PINCTRL_PIN(213, "vGPIO_SPARE_2"), 264 + PINCTRL_PIN(214, "vGPIO_SPARE_3"), 265 + PINCTRL_PIN(215, "vGPIO_SPARE_4"), 266 + PINCTRL_PIN(216, "vGPIO_SPARE_5"), 267 + PINCTRL_PIN(217, "vGPIO_SPARE_6"), 268 + PINCTRL_PIN(218, "vGPIO_SPARE_7"), 269 + PINCTRL_PIN(219, "vGPIO_SPARE_8"), 270 + PINCTRL_PIN(220, "vGPIO_SPARE_9"), 271 + PINCTRL_PIN(221, "vGPIO_SPARE_10"), 272 + PINCTRL_PIN(222, "vGPIO_SPARE_11"), 273 + PINCTRL_PIN(223, "vGPIO_SPARE_12"), 274 + PINCTRL_PIN(224, "vGPIO_SPARE_13"), 275 + PINCTRL_PIN(225, "vGPIO_SPARE_14"), 276 + PINCTRL_PIN(226, "vGPIO_SPARE_15"), 277 + PINCTRL_PIN(227, "vGPIO_SPARE_16"), 278 + PINCTRL_PIN(228, "vGPIO_SPARE_17"), 279 + PINCTRL_PIN(229, "vGPIO_SPARE_18"), 280 + PINCTRL_PIN(230, "vGPIO_SPARE_19"), 281 + PINCTRL_PIN(231, "vGPIO_SPARE_20"), 282 + PINCTRL_PIN(232, "vGPIO_SPARE_21"), 283 + /* GPP_S */ 284 + PINCTRL_PIN(233, "GPP_S_0"), 285 + PINCTRL_PIN(234, "GPP_S_1"), 286 + PINCTRL_PIN(235, "GPP_S_2"), 287 + PINCTRL_PIN(236, "GPP_S_3"), 288 + PINCTRL_PIN(237, "GPP_S_4"), 289 + PINCTRL_PIN(238, "GPP_S_5"), 290 + PINCTRL_PIN(239, "GPP_S_6"), 291 + PINCTRL_PIN(240, "GPP_S_7"), 292 + /* GPP_E */ 293 + PINCTRL_PIN(241, "GPP_E_0"), 294 + PINCTRL_PIN(242, "GPP_E_1"), 295 + PINCTRL_PIN(243, "GPP_E_2"), 296 + PINCTRL_PIN(244, "GPP_E_3"), 297 + PINCTRL_PIN(245, "GPP_E_4"), 298 + PINCTRL_PIN(246, "GPP_E_5"), 299 + PINCTRL_PIN(247, "GPP_E_6"), 300 + PINCTRL_PIN(248, "GPP_E_7"), 301 + PINCTRL_PIN(249, "GPP_E_8"), 302 + PINCTRL_PIN(250, "GPP_E_9"), 303 + PINCTRL_PIN(251, "GPP_E_10"), 304 + PINCTRL_PIN(252, "GPP_E_11"), 305 + PINCTRL_PIN(253, "GPP_E_12"), 306 + PINCTRL_PIN(254, "GPP_E_13"), 307 + PINCTRL_PIN(255, "GPP_E_14"), 308 + PINCTRL_PIN(256, "GPP_E_15"), 309 + PINCTRL_PIN(257, "GPP_E_16"), 310 + PINCTRL_PIN(258, "GPP_E_17"), 311 + PINCTRL_PIN(259, "GPP_E_18"), 312 + PINCTRL_PIN(260, "GPP_E_19"), 313 + PINCTRL_PIN(261, "GPP_E_20"), 314 + PINCTRL_PIN(262, "GPP_E_21"), 315 + PINCTRL_PIN(263, "SPI1_CLK_LOOPBK"), 316 + /* GPP_K */ 317 + PINCTRL_PIN(264, "GPP_K_0"), 318 + PINCTRL_PIN(265, "GPP_K_1"), 319 + PINCTRL_PIN(266, "GPP_K_2"), 320 + PINCTRL_PIN(267, "GPP_K_3"), 321 + PINCTRL_PIN(268, "GPP_K_4"), 322 + PINCTRL_PIN(269, "GPP_K_5"), 323 + PINCTRL_PIN(270, "FUSE_SORT_BUMP_0"), 324 + PINCTRL_PIN(271, "FUSE_SORT_BUMP_1"), 325 + PINCTRL_PIN(272, "CORE_VID_0"), 326 + PINCTRL_PIN(273, "CORE_VID_1"), 327 + PINCTRL_PIN(274, "FUSE_SORT_BUMP_2"), 328 + PINCTRL_PIN(275, "MISC_SPARE"), 329 + PINCTRL_PIN(276, "SYS_RESETB"), 330 + PINCTRL_PIN(277, "MLK_RSTB"), 331 + /* GPP_F */ 332 + PINCTRL_PIN(278, "SATAXPCIE_3"), 333 + PINCTRL_PIN(279, "SATAXPCIE_4"), 334 + PINCTRL_PIN(280, "SATAXPCIE_5"), 335 + PINCTRL_PIN(281, "SATAXPCIE_6"), 336 + PINCTRL_PIN(282, "SATAXPCIE_7"), 337 + PINCTRL_PIN(283, "SATA_DEVSLP_3"), 338 + PINCTRL_PIN(284, "SATA_DEVSLP_4"), 339 + PINCTRL_PIN(285, "SATA_DEVSLP_5"), 340 + PINCTRL_PIN(286, "SATA_DEVSLP_6"), 341 + PINCTRL_PIN(287, "GPP_F_9"), 342 + PINCTRL_PIN(288, "GPP_F_10"), 343 + PINCTRL_PIN(289, "GPP_F_11"), 344 + PINCTRL_PIN(290, "GPP_F_12"), 345 + PINCTRL_PIN(291, "GPP_F_13"), 346 + PINCTRL_PIN(292, "GPP_F_14"), 347 + PINCTRL_PIN(293, "GPP_F_15"), 348 + PINCTRL_PIN(294, "GPP_F_16"), 349 + PINCTRL_PIN(295, "GPP_F_17"), 350 + PINCTRL_PIN(296, "GPP_F_18"), 351 + PINCTRL_PIN(297, "DNX_FORCE_RELOAD"), 352 + PINCTRL_PIN(298, "GPP_F_20"), 353 + PINCTRL_PIN(299, "GPP_F_21"), 354 + PINCTRL_PIN(300, "GPP_F_22"), 355 + PINCTRL_PIN(301, "GPP_F_23"), 356 + /* GPP_I */ 357 + PINCTRL_PIN(302, "GPP_I_0"), 358 + PINCTRL_PIN(303, "GPP_I_1"), 359 + PINCTRL_PIN(304, "GPP_I_2"), 360 + PINCTRL_PIN(305, "GPP_I_3"), 361 + PINCTRL_PIN(306, "GPP_I_4"), 362 + PINCTRL_PIN(307, "GPP_I_5"), 363 + PINCTRL_PIN(308, "GPP_I_6"), 364 + PINCTRL_PIN(309, "GPP_I_7"), 365 + PINCTRL_PIN(310, "GPP_I_8"), 366 + PINCTRL_PIN(311, "GPP_I_9"), 367 + PINCTRL_PIN(312, "GPP_I_10"), 368 + PINCTRL_PIN(313, "GPP_I_11"), 369 + PINCTRL_PIN(314, "GPP_I_12"), 370 + PINCTRL_PIN(315, "GPP_I_13"), 371 + PINCTRL_PIN(316, "GPP_I_14"), 372 + PINCTRL_PIN(317, "GPP_I_15"), 373 + PINCTRL_PIN(318, "GPP_I_16"), 374 + PINCTRL_PIN(319, "GSPI0_CLK_LOOPBK"), 375 + PINCTRL_PIN(320, "GSPI1_CLK_LOOPBK"), 376 + PINCTRL_PIN(321, "ISH_I3C0_CLK_LOOPBK"), 377 + PINCTRL_PIN(322, "I3C0_CLK_LOOPBK"), 378 + /* JTAG_CPU */ 379 + PINCTRL_PIN(323, "JTAG_TDO"), 380 + PINCTRL_PIN(324, "JTAGX"), 381 + PINCTRL_PIN(325, "PRDYB"), 382 + PINCTRL_PIN(326, "PREQB"), 383 + PINCTRL_PIN(327, "JTAG_TDI"), 384 + PINCTRL_PIN(328, "JTAG_TMS"), 385 + PINCTRL_PIN(329, "JTAG_TCK"), 386 + PINCTRL_PIN(330, "DBG_PMODE"), 387 + PINCTRL_PIN(331, "CPU_TRSTB"), 388 + PINCTRL_PIN(332, "CPUPWRGD"), 389 + PINCTRL_PIN(333, "PM_SPARE0"), 390 + PINCTRL_PIN(334, "PM_SPARE1"), 391 + PINCTRL_PIN(335, "CRASHLOG_TRIG_N"), 392 + PINCTRL_PIN(336, "TRIGGER_IN"), 393 + PINCTRL_PIN(337, "TRIGGER_OUT"), 394 + PINCTRL_PIN(338, "FBRK_OUT_N"), 395 + }; 396 + 397 + static const struct intel_padgroup mtps_community0_gpps[] = { 398 + MTP_GPP(0, 0, 24, 0), /* GPP_D */ 399 + MTP_GPP(1, 25, 38, 32), /* GPP_R */ 400 + MTP_GPP(2, 39, 56, 64), /* GPP_J */ 401 + MTP_GPP(3, 57, 87, 96), /* vGPIO */ 402 + }; 403 + 404 + static const struct intel_padgroup mtps_community1_gpps[] = { 405 + MTP_GPP(0, 88, 102, 128), /* GPP_A */ 406 + MTP_GPP(1, 103, 114, 160), /* DIR_ESPI */ 407 + MTP_GPP(2, 115, 136, 192), /* GPP_B */ 408 + }; 409 + 410 + static const struct intel_padgroup mtps_community3_gpps[] = { 411 + MTP_GPP(0, 137, 145, 224), /* SPI0 */ 412 + MTP_GPP(1, 146, 169, 256), /* GPP_C */ 413 + MTP_GPP(2, 170, 189, 288), /* GPP_H */ 414 + MTP_GPP(3, 190, 193, 320), /* vGPIO_3 */ 415 + MTP_GPP(4, 194, 201, 352), /* vGPIO_0 */ 416 + MTP_GPP(5, 202, 232, 384), /* vGPIO_4 */ 417 + }; 418 + 419 + static const struct intel_padgroup mtps_community4_gpps[] = { 420 + MTP_GPP(0, 233, 240, 416), /* GPP_S */ 421 + MTP_GPP(1, 241, 263, 448), /* GPP_E */ 422 + MTP_GPP(2, 264, 277, 480), /* GPP_K */ 423 + MTP_GPP(3, 278, 301, 512), /* GPP_F */ 424 + }; 425 + 426 + static const struct intel_padgroup mtps_community5_gpps[] = { 427 + MTP_GPP(0, 302, 322, 544), /* GPP_I */ 428 + MTP_GPP(1, 323, 338, 576), /* JTAG_CPU */ 429 + }; 430 + 431 + static const struct intel_community mtps_communities[] = { 432 + MTP_COMMUNITY(0, 0, 87, mtps_community0_gpps), 433 + MTP_COMMUNITY(1, 88, 136, mtps_community1_gpps), 434 + MTP_COMMUNITY(2, 137, 232, mtps_community3_gpps), 435 + MTP_COMMUNITY(3, 233, 301, mtps_community4_gpps), 436 + MTP_COMMUNITY(4, 302, 338, mtps_community5_gpps), 437 + }; 438 + 439 + static const struct intel_pinctrl_soc_data mtps_soc_data = { 440 + .pins = mtps_pins, 441 + .npins = ARRAY_SIZE(mtps_pins), 442 + .communities = mtps_communities, 443 + .ncommunities = ARRAY_SIZE(mtps_communities), 444 + }; 445 + 446 + static const struct acpi_device_id mtp_pinctrl_acpi_match[] = { 447 + { "INTC1084", (kernel_ulong_t)&mtps_soc_data }, 448 + { } 449 + }; 450 + MODULE_DEVICE_TABLE(acpi, mtp_pinctrl_acpi_match); 451 + 452 + static struct platform_driver mtp_pinctrl_driver = { 453 + .probe = intel_pinctrl_probe_by_hid, 454 + .driver = { 455 + .name = "meteorpoint-pinctrl", 456 + .acpi_match_table = mtp_pinctrl_acpi_match, 457 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 458 + }, 459 + }; 460 + module_platform_driver(mtp_pinctrl_driver); 461 + 462 + MODULE_AUTHOR("Andy Shevchenko <andriy.shevchenko@linux.intel.com>"); 463 + MODULE_DESCRIPTION("Intel Meteor Point PCH pinctrl/GPIO driver"); 464 + MODULE_LICENSE("GPL v2"); 465 + MODULE_IMPORT_NS(PINCTRL_INTEL);
+2 -3
drivers/pinctrl/intel/pinctrl-sunrisepoint.c
··· 10 10 #include <linux/mod_devicetable.h> 11 11 #include <linux/module.h> 12 12 #include <linux/platform_device.h> 13 + #include <linux/pm.h> 13 14 14 15 #include <linux/pinctrl/pinctrl.h> 15 16 ··· 580 579 }; 581 580 MODULE_DEVICE_TABLE(acpi, spt_pinctrl_acpi_match); 582 581 583 - static INTEL_PINCTRL_PM_OPS(spt_pinctrl_pm_ops); 584 - 585 582 static struct platform_driver spt_pinctrl_driver = { 586 583 .probe = intel_pinctrl_probe_by_hid, 587 584 .driver = { 588 585 .name = "sunrisepoint-pinctrl", 589 586 .acpi_match_table = spt_pinctrl_acpi_match, 590 - .pm = &spt_pinctrl_pm_ops, 587 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 591 588 }, 592 589 }; 593 590
+15 -17
drivers/pinctrl/intel/pinctrl-tangier.c
··· 9 9 */ 10 10 11 11 #include <linux/bits.h> 12 + #include <linux/cleanup.h> 12 13 #include <linux/device.h> 13 14 #include <linux/err.h> 14 15 #include <linux/errno.h> ··· 221 220 const struct intel_pingroup *grp = &tp->groups[group]; 222 221 u32 bits = grp->mode << BUFCFG_PINMODE_SHIFT; 223 222 u32 mask = BUFCFG_PINMODE_MASK; 224 - unsigned long flags; 225 223 unsigned int i; 226 224 227 225 /* ··· 232 232 return -EBUSY; 233 233 } 234 234 235 + guard(raw_spinlock_irqsave)(&tp->lock); 236 + 235 237 /* Now enable the mux setting for each pin in the group */ 236 - raw_spin_lock_irqsave(&tp->lock, flags); 237 238 for (i = 0; i < grp->grp.npins; i++) 238 239 tng_update_bufcfg(tp, grp->grp.pins[i], bits, mask); 239 - raw_spin_unlock_irqrestore(&tp->lock, flags); 240 240 241 241 return 0; 242 242 } ··· 248 248 struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev); 249 249 u32 bits = BUFCFG_PINMODE_GPIO << BUFCFG_PINMODE_SHIFT; 250 250 u32 mask = BUFCFG_PINMODE_MASK; 251 - unsigned long flags; 252 251 253 252 if (!tng_buf_available(tp, pin)) 254 253 return -EBUSY; 255 254 256 - raw_spin_lock_irqsave(&tp->lock, flags); 255 + guard(raw_spinlock_irqsave)(&tp->lock); 256 + 257 257 tng_update_bufcfg(tp, pin, bits, mask); 258 - raw_spin_unlock_irqrestore(&tp->lock, flags); 259 258 260 259 return 0; 261 260 } ··· 359 360 unsigned int param = pinconf_to_config_param(config); 360 361 unsigned int arg = pinconf_to_config_argument(config); 361 362 u32 mask, term, value = 0; 362 - unsigned long flags; 363 363 364 364 switch (param) { 365 365 case PIN_CONFIG_BIAS_DISABLE: ··· 366 368 break; 367 369 368 370 case PIN_CONFIG_BIAS_PULL_UP: 369 - /* Set default strength value in case none is given */ 370 - if (arg == 1) 371 - arg = 20000; 372 - 373 371 switch (arg) { 374 372 case 50000: 375 373 term = BUFCFG_PUPD_VAL_50K; 376 374 break; 375 + case 1: /* Set default strength value in case none is given */ 377 376 case 20000: 378 377 term = BUFCFG_PUPD_VAL_20K; 379 378 break; 380 379 case 2000: 381 380 term = BUFCFG_PUPD_VAL_2K; 381 + break; 382 + case 910: 383 + term = BUFCFG_PUPD_VAL_910; 382 384 break; 383 385 default: 384 386 return -EINVAL; ··· 389 391 break; 390 392 391 393 case PIN_CONFIG_BIAS_PULL_DOWN: 392 - /* Set default strength value in case none is given */ 393 - if (arg == 1) 394 - arg = 20000; 395 - 396 394 switch (arg) { 397 395 case 50000: 398 396 term = BUFCFG_PUPD_VAL_50K; 399 397 break; 398 + case 1: /* Set default strength value in case none is given */ 400 399 case 20000: 401 400 term = BUFCFG_PUPD_VAL_20K; 402 401 break; 403 402 case 2000: 404 403 term = BUFCFG_PUPD_VAL_2K; 404 + break; 405 + case 910: 406 + term = BUFCFG_PUPD_VAL_910; 405 407 break; 406 408 default: 407 409 return -EINVAL; ··· 430 432 return -EINVAL; 431 433 } 432 434 433 - raw_spin_lock_irqsave(&tp->lock, flags); 435 + guard(raw_spinlock_irqsave)(&tp->lock); 436 + 434 437 tng_update_bufcfg(tp, pin, value, mask); 435 - raw_spin_unlock_irqrestore(&tp->lock, flags); 436 438 437 439 return 0; 438 440 }
+2 -3
drivers/pinctrl/intel/pinctrl-tigerlake.c
··· 10 10 #include <linux/mod_devicetable.h> 11 11 #include <linux/module.h> 12 12 #include <linux/platform_device.h> 13 + #include <linux/pm.h> 13 14 14 15 #include <linux/pinctrl/pinctrl.h> 15 16 ··· 744 743 }; 745 744 MODULE_DEVICE_TABLE(acpi, tgl_pinctrl_acpi_match); 746 745 747 - static INTEL_PINCTRL_PM_OPS(tgl_pinctrl_pm_ops); 748 - 749 746 static struct platform_driver tgl_pinctrl_driver = { 750 747 .probe = intel_pinctrl_probe_by_hid, 751 748 .driver = { 752 749 .name = "tigerlake-pinctrl", 753 750 .acpi_match_table = tgl_pinctrl_acpi_match, 754 - .pm = &tgl_pinctrl_pm_ops, 751 + .pm = pm_sleep_ptr(&intel_pinctrl_pm_ops), 755 752 }, 756 753 }; 757 754 module_platform_driver(tgl_pinctrl_driver);