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 'gpio-v4.16-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO fix from Linus Walleij:
"This is a single GPIO fix for the v4.16 series affecting the Renesas
driver, and fixes wakeup from external stuff"

* tag 'gpio-v4.16-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
gpio: rcar: Use wakeup_path i.s.o. explicit clock handling

+16 -22
+16 -22
drivers/gpio/gpio-rcar.c
··· 14 14 * GNU General Public License for more details. 15 15 */ 16 16 17 - #include <linux/clk.h> 18 17 #include <linux/err.h> 19 18 #include <linux/gpio.h> 20 19 #include <linux/init.h> ··· 36 37 struct platform_device *pdev; 37 38 struct gpio_chip gpio_chip; 38 39 struct irq_chip irq_chip; 39 - struct clk *clk; 40 40 unsigned int irq_parent; 41 + atomic_t wakeup_path; 41 42 bool has_both_edge_trigger; 42 - bool needs_clk; 43 43 }; 44 44 45 45 #define IOINTSEL 0x00 /* General IO/Interrupt Switching Register */ ··· 184 186 } 185 187 } 186 188 187 - if (!p->clk) 188 - return 0; 189 - 190 189 if (on) 191 - clk_enable(p->clk); 190 + atomic_inc(&p->wakeup_path); 192 191 else 193 - clk_disable(p->clk); 192 + atomic_dec(&p->wakeup_path); 194 193 195 194 return 0; 196 195 } ··· 325 330 326 331 struct gpio_rcar_info { 327 332 bool has_both_edge_trigger; 328 - bool needs_clk; 329 333 }; 330 334 331 335 static const struct gpio_rcar_info gpio_rcar_info_gen1 = { 332 336 .has_both_edge_trigger = false, 333 - .needs_clk = false, 334 337 }; 335 338 336 339 static const struct gpio_rcar_info gpio_rcar_info_gen2 = { 337 340 .has_both_edge_trigger = true, 338 - .needs_clk = true, 339 341 }; 340 342 341 343 static const struct of_device_id gpio_rcar_of_table[] = { ··· 395 403 ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args); 396 404 *npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK; 397 405 p->has_both_edge_trigger = info->has_both_edge_trigger; 398 - p->needs_clk = info->needs_clk; 399 406 400 407 if (*npins == 0 || *npins > RCAR_MAX_GPIO_PER_BANK) { 401 408 dev_warn(&p->pdev->dev, ··· 430 439 return ret; 431 440 432 441 platform_set_drvdata(pdev, p); 433 - 434 - p->clk = devm_clk_get(dev, NULL); 435 - if (IS_ERR(p->clk)) { 436 - if (p->needs_clk) { 437 - dev_err(dev, "unable to get clock\n"); 438 - ret = PTR_ERR(p->clk); 439 - goto err0; 440 - } 441 - p->clk = NULL; 442 - } 443 442 444 443 pm_runtime_enable(dev); 445 444 ··· 512 531 return 0; 513 532 } 514 533 534 + static int __maybe_unused gpio_rcar_suspend(struct device *dev) 535 + { 536 + struct gpio_rcar_priv *p = dev_get_drvdata(dev); 537 + 538 + if (atomic_read(&p->wakeup_path)) 539 + device_set_wakeup_path(dev); 540 + 541 + return 0; 542 + } 543 + 544 + static SIMPLE_DEV_PM_OPS(gpio_rcar_pm_ops, gpio_rcar_suspend, NULL); 545 + 515 546 static struct platform_driver gpio_rcar_device_driver = { 516 547 .probe = gpio_rcar_probe, 517 548 .remove = gpio_rcar_remove, 518 549 .driver = { 519 550 .name = "gpio_rcar", 551 + .pm = &gpio_rcar_pm_ops, 520 552 .of_match_table = of_match_ptr(gpio_rcar_of_table), 521 553 } 522 554 };