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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pinctrl-v6.5-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pin control fixes from Linus Walleij:
"Here are some Renesas and AMD driver fixes, the AMD fix affects
important laptops in the wild so this one is pretty important. It
seems a bit tough to get this right.

- Fix DT parsing and related locking in the Renesas driver.

- Fix wakeup IRQs in the AMD driver once again. Really tricky this
one"

* tag 'pinctrl-v6.5-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
pinctrl: amd: Mask wake bits on probe again
pinctrl: renesas: rza2: Add lock around pinctrl_generic{{add,remove}_group,{add,remove}_function}
pinctrl: renesas: rzv2m: Fix NULL pointer dereference in rzv2m_dt_subnode_to_map()
pinctrl: renesas: rzg2l: Fix NULL pointer dereference in rzg2l_dt_subnode_to_map()

+68 -7
+30
drivers/pinctrl/pinctrl-amd.c
··· 862 862 .pin_config_group_set = amd_pinconf_group_set, 863 863 }; 864 864 865 + static void amd_gpio_irq_init(struct amd_gpio *gpio_dev) 866 + { 867 + struct pinctrl_desc *desc = gpio_dev->pctrl->desc; 868 + unsigned long flags; 869 + u32 pin_reg, mask; 870 + int i; 871 + 872 + mask = BIT(WAKE_CNTRL_OFF_S0I3) | BIT(WAKE_CNTRL_OFF_S3) | 873 + BIT(WAKE_CNTRL_OFF_S4); 874 + 875 + for (i = 0; i < desc->npins; i++) { 876 + int pin = desc->pins[i].number; 877 + const struct pin_desc *pd = pin_desc_get(gpio_dev->pctrl, pin); 878 + 879 + if (!pd) 880 + continue; 881 + 882 + raw_spin_lock_irqsave(&gpio_dev->lock, flags); 883 + 884 + pin_reg = readl(gpio_dev->base + pin * 4); 885 + pin_reg &= ~mask; 886 + writel(pin_reg, gpio_dev->base + pin * 4); 887 + 888 + raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); 889 + } 890 + } 891 + 865 892 #ifdef CONFIG_PM_SLEEP 866 893 static bool amd_gpio_should_save(struct amd_gpio *gpio_dev, unsigned int pin) 867 894 { ··· 1125 1098 dev_err(&pdev->dev, "Couldn't register pinctrl driver\n"); 1126 1099 return PTR_ERR(gpio_dev->pctrl); 1127 1100 } 1101 + 1102 + /* Disable and mask interrupts */ 1103 + amd_gpio_irq_init(gpio_dev); 1128 1104 1129 1105 girq = &gpio_dev->gc.irq; 1130 1106 gpio_irq_chip_set_chip(girq, &amd_gpio_irqchip);
+15 -2
drivers/pinctrl/renesas/pinctrl-rza2.c
··· 14 14 #include <linux/gpio/driver.h> 15 15 #include <linux/io.h> 16 16 #include <linux/module.h> 17 + #include <linux/mutex.h> 17 18 #include <linux/of_device.h> 18 19 #include <linux/pinctrl/pinmux.h> 19 20 ··· 47 46 struct pinctrl_dev *pctl; 48 47 struct pinctrl_gpio_range gpio_range; 49 48 int npins; 49 + struct mutex mutex; /* serialize adding groups and functions */ 50 50 }; 51 51 52 52 #define RZA2_PDR(port) (0x0000 + (port) * 2) /* Direction 16-bit */ ··· 360 358 psel_val[i] = MUX_FUNC(value); 361 359 } 362 360 361 + mutex_lock(&priv->mutex); 362 + 363 363 /* Register a single pin group listing all the pins we read from DT */ 364 364 gsel = pinctrl_generic_add_group(pctldev, np->name, pins, npins, NULL); 365 - if (gsel < 0) 366 - return gsel; 365 + if (gsel < 0) { 366 + ret = gsel; 367 + goto unlock; 368 + } 367 369 368 370 /* 369 371 * Register a single group function where the 'data' is an array PSEL ··· 396 390 (*map)->data.mux.function = np->name; 397 391 *num_maps = 1; 398 392 393 + mutex_unlock(&priv->mutex); 394 + 399 395 return 0; 400 396 401 397 remove_function: ··· 405 397 406 398 remove_group: 407 399 pinctrl_generic_remove_group(pctldev, gsel); 400 + 401 + unlock: 402 + mutex_unlock(&priv->mutex); 408 403 409 404 dev_err(priv->dev, "Unable to parse DT node %s\n", np->name); 410 405 ··· 483 472 priv->base = devm_platform_ioremap_resource(pdev, 0); 484 473 if (IS_ERR(priv->base)) 485 474 return PTR_ERR(priv->base); 475 + 476 + mutex_init(&priv->mutex); 486 477 487 478 platform_set_drvdata(pdev, priv); 488 479
+12 -3
drivers/pinctrl/renesas/pinctrl-rzg2l.c
··· 11 11 #include <linux/interrupt.h> 12 12 #include <linux/io.h> 13 13 #include <linux/module.h> 14 + #include <linux/mutex.h> 14 15 #include <linux/of_device.h> 15 16 #include <linux/of_irq.h> 16 17 #include <linux/seq_file.h> ··· 150 149 struct gpio_chip gpio_chip; 151 150 struct pinctrl_gpio_range gpio_range; 152 151 DECLARE_BITMAP(tint_slot, RZG2L_TINT_MAX_INTERRUPT); 153 - spinlock_t bitmap_lock; 152 + spinlock_t bitmap_lock; /* protect tint_slot bitmap */ 154 153 unsigned int hwirq[RZG2L_TINT_MAX_INTERRUPT]; 155 154 156 - spinlock_t lock; 155 + spinlock_t lock; /* lock read/write registers */ 156 + struct mutex mutex; /* serialize adding groups and functions */ 157 157 }; 158 158 159 159 static const unsigned int iolh_groupa_mA[] = { 2, 4, 8, 12 }; ··· 364 362 name = np->name; 365 363 } 366 364 365 + mutex_lock(&pctrl->mutex); 366 + 367 367 /* Register a single pin group listing all the pins we read from DT */ 368 368 gsel = pinctrl_generic_add_group(pctldev, name, pins, num_pinmux, NULL); 369 369 if (gsel < 0) { 370 370 ret = gsel; 371 - goto done; 371 + goto unlock; 372 372 } 373 373 374 374 /* ··· 384 380 goto remove_group; 385 381 } 386 382 383 + mutex_unlock(&pctrl->mutex); 384 + 387 385 maps[idx].type = PIN_MAP_TYPE_MUX_GROUP; 388 386 maps[idx].data.mux.group = name; 389 387 maps[idx].data.mux.function = name; ··· 397 391 398 392 remove_group: 399 393 pinctrl_generic_remove_group(pctldev, gsel); 394 + unlock: 395 + mutex_unlock(&pctrl->mutex); 400 396 done: 401 397 *index = idx; 402 398 kfree(configs); ··· 1517 1509 1518 1510 spin_lock_init(&pctrl->lock); 1519 1511 spin_lock_init(&pctrl->bitmap_lock); 1512 + mutex_init(&pctrl->mutex); 1520 1513 1521 1514 platform_set_drvdata(pdev, pctrl); 1522 1515
+11 -2
drivers/pinctrl/renesas/pinctrl-rzv2m.c
··· 14 14 #include <linux/gpio/driver.h> 15 15 #include <linux/io.h> 16 16 #include <linux/module.h> 17 + #include <linux/mutex.h> 17 18 #include <linux/of_device.h> 18 19 #include <linux/spinlock.h> 19 20 ··· 124 123 struct gpio_chip gpio_chip; 125 124 struct pinctrl_gpio_range gpio_range; 126 125 127 - spinlock_t lock; 126 + spinlock_t lock; /* lock read/write registers */ 127 + struct mutex mutex; /* serialize adding groups and functions */ 128 128 }; 129 129 130 130 static const unsigned int drv_1_8V_group2_uA[] = { 1800, 3800, 7800, 11000 }; ··· 324 322 name = np->name; 325 323 } 326 324 325 + mutex_lock(&pctrl->mutex); 326 + 327 327 /* Register a single pin group listing all the pins we read from DT */ 328 328 gsel = pinctrl_generic_add_group(pctldev, name, pins, num_pinmux, NULL); 329 329 if (gsel < 0) { 330 330 ret = gsel; 331 - goto done; 331 + goto unlock; 332 332 } 333 333 334 334 /* ··· 344 340 goto remove_group; 345 341 } 346 342 343 + mutex_unlock(&pctrl->mutex); 344 + 347 345 maps[idx].type = PIN_MAP_TYPE_MUX_GROUP; 348 346 maps[idx].data.mux.group = name; 349 347 maps[idx].data.mux.function = name; ··· 357 351 358 352 remove_group: 359 353 pinctrl_generic_remove_group(pctldev, gsel); 354 + unlock: 355 + mutex_unlock(&pctrl->mutex); 360 356 done: 361 357 *index = idx; 362 358 kfree(configs); ··· 1079 1071 } 1080 1072 1081 1073 spin_lock_init(&pctrl->lock); 1074 + mutex_init(&pctrl->mutex); 1082 1075 1083 1076 platform_set_drvdata(pdev, pctrl); 1084 1077