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-v4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull Pin control fixes from Linus Walleij:
"Pin control fixes for the v4.5 series, all are individual driver
fixes:

- Fix the PXA2xx driver to export its init function so we do not
break modular compiles.
- Hide unused functions in the Nomadik driver.
- Fix up direction control in the Mediatek driver.
- Toggle the sunxi GPIO lines to input when you read them on the H3
GPIO controller, lest you only get garbage.
- Fix up the number of settings in the MVEBU driver.
- Fix a serious SMP race condition in the Samsung driver"

* tag 'pinctrl-v4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
pinctrl: samsung: fix SMP race condition
pinctrl: mvebu: fix num_settings in mpp group assignment
pinctrl: sunxi: H3 requires irq_read_needs_mux
pinctrl: mediatek: fix direction control issue
pinctrl: nomadik: hide unused functions
pinctrl: pxa: export pxa2xx_pinctrl_init()

+48 -18
+2
drivers/pinctrl/mediatek/pinctrl-mtk-common.c
··· 347 347 ret = mtk_pconf_set_pull_select(pctl, pin, true, false, arg); 348 348 break; 349 349 case PIN_CONFIG_INPUT_ENABLE: 350 + mtk_pmx_gpio_set_direction(pctldev, NULL, pin, true); 350 351 ret = mtk_pconf_set_ies_smt(pctl, pin, arg, param); 351 352 break; 352 353 case PIN_CONFIG_OUTPUT: ··· 355 354 ret = mtk_pmx_gpio_set_direction(pctldev, NULL, pin, false); 356 355 break; 357 356 case PIN_CONFIG_INPUT_SCHMITT_ENABLE: 357 + mtk_pmx_gpio_set_direction(pctldev, NULL, pin, true); 358 358 ret = mtk_pconf_set_ies_smt(pctl, pin, arg, param); 359 359 break; 360 360 case PIN_CONFIG_DRIVE_STRENGTH:
+6 -3
drivers/pinctrl/mvebu/pinctrl-mvebu.c
··· 666 666 struct mvebu_mpp_ctrl_setting *set = &mode->settings[0]; 667 667 struct mvebu_pinctrl_group *grp; 668 668 unsigned num_settings; 669 + unsigned supp_settings; 669 670 670 - for (num_settings = 0; ; set++) { 671 + for (num_settings = 0, supp_settings = 0; ; set++) { 671 672 if (!set->name) 672 673 break; 674 + 675 + num_settings++; 673 676 674 677 /* skip unsupported settings for this variant */ 675 678 if (pctl->variant && !(pctl->variant & set->variant)) 676 679 continue; 677 680 678 - num_settings++; 681 + supp_settings++; 679 682 680 683 /* find gpio/gpo/gpi settings */ 681 684 if (strcmp(set->name, "gpio") == 0) ··· 691 688 } 692 689 693 690 /* skip modes with no settings for this variant */ 694 - if (!num_settings) 691 + if (!supp_settings) 695 692 continue; 696 693 697 694 grp = mvebu_pinctrl_find_group_by_pid(pctl, mode->pid);
+3 -2
drivers/pinctrl/nomadik/pinctrl-abx500.c
··· 191 191 dev_err(pct->dev, "%s write failed (%d)\n", __func__, ret); 192 192 } 193 193 194 + #ifdef CONFIG_DEBUG_FS 194 195 static int abx500_get_pull_updown(struct abx500_pinctrl *pct, int offset, 195 196 enum abx500_gpio_pull_updown *pull_updown) 196 197 { ··· 227 226 228 227 return ret; 229 228 } 229 + #endif 230 230 231 231 static int abx500_set_pull_updown(struct abx500_pinctrl *pct, 232 232 int offset, enum abx500_gpio_pull_updown val) ··· 470 468 return ret; 471 469 } 472 470 471 + #ifdef CONFIG_DEBUG_FS 473 472 static int abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip, 474 473 unsigned gpio) 475 474 { ··· 555 552 dev_err(pct->dev, "%s failed (%d)\n", __func__, ret); 556 553 return ret; 557 554 } 558 - 559 - #ifdef CONFIG_DEBUG_FS 560 555 561 556 #include <linux/seq_file.h> 562 557
+1
drivers/pinctrl/pxa/pinctrl-pxa2xx.c
··· 426 426 427 427 return 0; 428 428 } 429 + EXPORT_SYMBOL(pxa2xx_pinctrl_init); 429 430 430 431 int pxa2xx_pinctrl_exit(struct platform_device *pdev) 431 432 {
+35 -13
drivers/pinctrl/samsung/pinctrl-samsung.c
··· 514 514 .pin_config_group_set = samsung_pinconf_group_set, 515 515 }; 516 516 517 - /* gpiolib gpio_set callback function */ 518 - static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value) 517 + /* 518 + * The samsung_gpio_set_vlaue() should be called with "bank->slock" held 519 + * to avoid race condition. 520 + */ 521 + static void samsung_gpio_set_value(struct gpio_chip *gc, 522 + unsigned offset, int value) 519 523 { 520 524 struct samsung_pin_bank *bank = gpiochip_get_data(gc); 521 525 const struct samsung_pin_bank_type *type = bank->type; 522 - unsigned long flags; 523 526 void __iomem *reg; 524 527 u32 data; 525 528 526 529 reg = bank->drvdata->virt_base + bank->pctl_offset; 527 - 528 - spin_lock_irqsave(&bank->slock, flags); 529 530 530 531 data = readl(reg + type->reg_offset[PINCFG_TYPE_DAT]); 531 532 data &= ~(1 << offset); 532 533 if (value) 533 534 data |= 1 << offset; 534 535 writel(data, reg + type->reg_offset[PINCFG_TYPE_DAT]); 536 + } 535 537 538 + /* gpiolib gpio_set callback function */ 539 + static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value) 540 + { 541 + struct samsung_pin_bank *bank = gpiochip_get_data(gc); 542 + unsigned long flags; 543 + 544 + spin_lock_irqsave(&bank->slock, flags); 545 + samsung_gpio_set_value(gc, offset, value); 536 546 spin_unlock_irqrestore(&bank->slock, flags); 537 547 } 538 548 ··· 563 553 } 564 554 565 555 /* 556 + * The samsung_gpio_set_direction() should be called with "bank->slock" held 557 + * to avoid race condition. 566 558 * The calls to gpio_direction_output() and gpio_direction_input() 567 559 * leads to this function call. 568 560 */ ··· 576 564 struct samsung_pinctrl_drv_data *drvdata; 577 565 void __iomem *reg; 578 566 u32 data, mask, shift; 579 - unsigned long flags; 580 567 581 568 bank = gpiochip_get_data(gc); 582 569 type = bank->type; ··· 592 581 reg += 4; 593 582 } 594 583 595 - spin_lock_irqsave(&bank->slock, flags); 596 - 597 584 data = readl(reg); 598 585 data &= ~(mask << shift); 599 586 if (!input) 600 587 data |= FUNC_OUTPUT << shift; 601 588 writel(data, reg); 602 - 603 - spin_unlock_irqrestore(&bank->slock, flags); 604 589 605 590 return 0; 606 591 } ··· 604 597 /* gpiolib gpio_direction_input callback function. */ 605 598 static int samsung_gpio_direction_input(struct gpio_chip *gc, unsigned offset) 606 599 { 607 - return samsung_gpio_set_direction(gc, offset, true); 600 + struct samsung_pin_bank *bank = gpiochip_get_data(gc); 601 + unsigned long flags; 602 + int ret; 603 + 604 + spin_lock_irqsave(&bank->slock, flags); 605 + ret = samsung_gpio_set_direction(gc, offset, true); 606 + spin_unlock_irqrestore(&bank->slock, flags); 607 + return ret; 608 608 } 609 609 610 610 /* gpiolib gpio_direction_output callback function. */ 611 611 static int samsung_gpio_direction_output(struct gpio_chip *gc, unsigned offset, 612 612 int value) 613 613 { 614 - samsung_gpio_set(gc, offset, value); 615 - return samsung_gpio_set_direction(gc, offset, false); 614 + struct samsung_pin_bank *bank = gpiochip_get_data(gc); 615 + unsigned long flags; 616 + int ret; 617 + 618 + spin_lock_irqsave(&bank->slock, flags); 619 + samsung_gpio_set_value(gc, offset, value); 620 + ret = samsung_gpio_set_direction(gc, offset, false); 621 + spin_unlock_irqrestore(&bank->slock, flags); 622 + 623 + return ret; 616 624 } 617 625 618 626 /*
+1
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
··· 492 492 .pins = sun8i_h3_pins, 493 493 .npins = ARRAY_SIZE(sun8i_h3_pins), 494 494 .irq_banks = 2, 495 + .irq_read_needs_mux = true 495 496 }; 496 497 497 498 static int sun8i_h3_pinctrl_probe(struct platform_device *pdev)