On Thu, Dec 8, 2016 at 3:56 PM, Niklas Söderlund <niklas.soderlund@xxxxxxxxxxxx> wrote: >> > + /* Increased clock usage so device won't be suspended */ >> > + clk_enable(mdp->clk); >> >> Hum, intermixiggn runtime PM with clock API doesn't look good... > > I agree it looks weird but I need a way to increment the usage count for > the clock otherwise the PM code will disable the module clock and WoL > will not work. Note that this call will not enable the clock just > increase the usage count so it won't be disabled when the PM code > decrease it after the sh_eth suspend function is run. > > If you know of a different way of ensuring that the clock is not turned > off I be happy to look at it. I did some investigation into this and > calling clk_enable() directly is for example what happens in the > enable_irq_wake() call path to ensure the clock for the irq_chip is not > turned off if it is a wakeup source, se for example > gpio_rcar_irq_set_wake() in drivers/gpio/gpio-rcar.c. Ideally we want to prevent the PM code from disabling the clock, and from powering down the power area, if present. The latter may matter on other SoCs. But on r8a7740, Ethernet is part of power area A4S, which we already prevent from being powered down because it contains the memory controller. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds