Skip to content

Commit 24e0d2e

Browse files
committed
Merge tag 'pinctrl-v6.7-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control fixes from Linus Walleij: "Some driver fixes for v6.7, all are in drivers, the most interesting one is probably the AMD laptop suspend bug which really needs fixing. Freedestop org has the bug description: https://gitlab.freedesktop.org/drm/amd/-/issues/2812 Summary: - Ignore disabled device tree nodes in the Starfive 7100 and 7100 drivers. - Mask non-wake source pins with interrupt enabled at suspend in the AMD driver, this blocks unnecessary wakeups from misc interrupts. This can be power consuming because in many cases the system doesn't really suspend, it just wakes right back up. - Fix a typo breaking compilation of the cy8c95x0 driver, and fix up bugs in the get/set config callbacks. - Use a dedicated lock class for the PIO4 drivers IRQ. This fixes a crash on suspend" * tag 'pinctrl-v6.7-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: at91-pio4: use dedicated lock class for IRQ pinctrl: cy8c95x0: Fix get_pincfg pinctrl: cy8c95x0: Fix regression pinctrl: cy8c95x0: Fix typo pinctrl: amd: Mask non-wake source pins with interrupt enabled at suspend pinctrl: starfive: jh7100: ignore disabled device tree nodes pinctrl: starfive: jh7110: ignore disabled device tree nodes
2 parents 9a6b294 + 1469417 commit 24e0d2e

File tree

6 files changed

+39
-5
lines changed

6 files changed

+39
-5
lines changed

drivers/pinctrl/pinctrl-amd.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,15 @@ static int amd_gpio_suspend(struct device *dev)
923923

924924
raw_spin_lock_irqsave(&gpio_dev->lock, flags);
925925
gpio_dev->saved_regs[i] = readl(gpio_dev->base + pin * 4) & ~PIN_IRQ_PENDING;
926+
927+
/* mask any interrupts not intended to be a wake source */
928+
if (!(gpio_dev->saved_regs[i] & WAKE_SOURCE)) {
929+
writel(gpio_dev->saved_regs[i] & ~BIT(INTERRUPT_MASK_OFF),
930+
gpio_dev->base + pin * 4);
931+
pm_pr_dbg("Disabling GPIO #%d interrupt for suspend.\n",
932+
pin);
933+
}
934+
926935
raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
927936
}
928937

drivers/pinctrl/pinctrl-amd.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@
8080
#define FUNCTION_MASK GENMASK(1, 0)
8181
#define FUNCTION_INVALID GENMASK(7, 0)
8282

83+
#define WAKE_SOURCE (BIT(WAKE_CNTRL_OFF_S0I3) | \
84+
BIT(WAKE_CNTRL_OFF_S3) | \
85+
BIT(WAKE_CNTRL_OFF_S4) | \
86+
BIT(WAKECNTRL_Z_OFF))
87+
8388
struct amd_function {
8489
const char *name;
8590
const char * const groups[NSELECTS];

drivers/pinctrl/pinctrl-at91-pio4.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,13 @@ static const struct of_device_id atmel_pctrl_of_match[] = {
10681068
}
10691069
};
10701070

1071+
/*
1072+
* This lock class allows to tell lockdep that parent IRQ and children IRQ do
1073+
* not share the same class so it does not raise false positive
1074+
*/
1075+
static struct lock_class_key atmel_lock_key;
1076+
static struct lock_class_key atmel_request_key;
1077+
10711078
static int atmel_pinctrl_probe(struct platform_device *pdev)
10721079
{
10731080
struct device *dev = &pdev->dev;
@@ -1214,6 +1221,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
12141221
irq_set_chip_and_handler(irq, &atmel_gpio_irq_chip,
12151222
handle_simple_irq);
12161223
irq_set_chip_data(irq, atmel_pioctrl);
1224+
irq_set_lockdep_class(irq, &atmel_lock_key, &atmel_request_key);
12171225
dev_dbg(dev,
12181226
"atmel gpio irq domain: hwirq: %d, linux irq: %d\n",
12191227
i, irq);

drivers/pinctrl/pinctrl-cy8c95x0.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ static const char * const cy8c95x0_groups[] = {
308308
"gp77",
309309
};
310310

311+
static int cy8c95x0_pinmux_direction(struct cy8c95x0_pinctrl *chip,
312+
unsigned int pin, bool input);
313+
311314
static inline u8 cypress_get_port(struct cy8c95x0_pinctrl *chip, unsigned int pin)
312315
{
313316
/* Account for GPORT2 which only has 4 bits */
@@ -712,6 +715,8 @@ static int cy8c95x0_gpio_get_pincfg(struct cy8c95x0_pinctrl *chip,
712715
ret = regmap_read(chip->regmap, reg, &reg_val);
713716
if (reg_val & bit)
714717
arg = 1;
718+
if (param == PIN_CONFIG_OUTPUT_ENABLE)
719+
arg = !arg;
715720

716721
*config = pinconf_to_config_packed(param, (u16)arg);
717722
out:
@@ -727,6 +732,7 @@ static int cy8c95x0_gpio_set_pincfg(struct cy8c95x0_pinctrl *chip,
727732
u8 port = cypress_get_port(chip, off);
728733
u8 bit = cypress_get_pin_mask(chip, off);
729734
unsigned long param = pinconf_to_config_param(config);
735+
unsigned long arg = pinconf_to_config_argument(config);
730736
unsigned int reg;
731737
int ret;
732738

@@ -765,6 +771,12 @@ static int cy8c95x0_gpio_set_pincfg(struct cy8c95x0_pinctrl *chip,
765771
case PIN_CONFIG_MODE_PWM:
766772
reg = CY8C95X0_PWMSEL;
767773
break;
774+
case PIN_CONFIG_OUTPUT_ENABLE:
775+
ret = cy8c95x0_pinmux_direction(chip, off, !arg);
776+
goto out;
777+
case PIN_CONFIG_INPUT_ENABLE:
778+
ret = cy8c95x0_pinmux_direction(chip, off, arg);
779+
goto out;
768780
default:
769781
ret = -ENOTSUPP;
770782
goto out;
@@ -822,7 +834,7 @@ static int cy8c95x0_setup_gpiochip(struct cy8c95x0_pinctrl *chip)
822834
gc->get_direction = cy8c95x0_gpio_get_direction;
823835
gc->get_multiple = cy8c95x0_gpio_get_multiple;
824836
gc->set_multiple = cy8c95x0_gpio_set_multiple;
825-
gc->set_config = gpiochip_generic_config,
837+
gc->set_config = gpiochip_generic_config;
826838
gc->can_sleep = true;
827839
gc->add_pin_ranges = cy8c95x0_add_pin_ranges;
828840

drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev,
492492

493493
nmaps = 0;
494494
ngroups = 0;
495-
for_each_child_of_node(np, child) {
495+
for_each_available_child_of_node(np, child) {
496496
int npinmux = of_property_count_u32_elems(child, "pinmux");
497497
int npins = of_property_count_u32_elems(child, "pins");
498498

@@ -527,7 +527,7 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev,
527527
nmaps = 0;
528528
ngroups = 0;
529529
mutex_lock(&sfp->mutex);
530-
for_each_child_of_node(np, child) {
530+
for_each_available_child_of_node(np, child) {
531531
int npins;
532532
int i;
533533

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev,
135135
int ret;
136136

137137
ngroups = 0;
138-
for_each_child_of_node(np, child)
138+
for_each_available_child_of_node(np, child)
139139
ngroups += 1;
140140
nmaps = 2 * ngroups;
141141

@@ -150,7 +150,7 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev,
150150
nmaps = 0;
151151
ngroups = 0;
152152
mutex_lock(&sfp->mutex);
153-
for_each_child_of_node(np, child) {
153+
for_each_available_child_of_node(np, child) {
154154
int npins = of_property_count_u32_elems(child, "pinmux");
155155
int *pins;
156156
u32 *pinmux;

0 commit comments

Comments
 (0)