On Tue, May 25, 2021 at 01:34:04PM +0530, Shubhrajyoti Datta wrote: > Add runtime pm support. We need more than a 4 word changelog text. Please be more descriptive as to why you need this and what it is doing. > +#define UART_AUTOSUSPEND_TIMEOUT 3000 Units? > > /* Static pointer to console port */ > #ifdef CONFIG_SERIAL_UARTLITE_CONSOLE > @@ -390,12 +392,16 @@ static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser) > static void ulite_pm(struct uart_port *port, unsigned int state, > unsigned int oldstate) > { > - struct uartlite_data *pdata = port->private_data; > + int ret; > > - if (!state) > - clk_enable(pdata->clk); > - else > - clk_disable(pdata->clk); > + if (!state) { > + ret = pm_runtime_get_sync(port->dev); > + if (ret < 0) > + dev_err(port->dev, "Failed to enable clocks\n"); > + } else { > + pm_runtime_mark_last_busy(port->dev); > + pm_runtime_put_autosuspend(port->dev); > + } > } > > #ifdef CONFIG_CONSOLE_POLL > @@ -734,11 +740,37 @@ static int __maybe_unused ulite_resume(struct device *dev) > return 0; > } > > +static int __maybe_unused ulite_runtime_suspend(struct device *dev) > +{ > + struct uart_port *port = dev_get_drvdata(dev); > + struct uartlite_data *pdata = port->private_data; > + > + clk_disable(pdata->clk); > + return 0; > +}; > + > +static int __maybe_unused ulite_runtime_resume(struct device *dev) > +{ > + struct uart_port *port = dev_get_drvdata(dev); > + struct uartlite_data *pdata = port->private_data; > + int ret; > + > + ret = clk_enable(pdata->clk); > + if (ret) { > + dev_err(dev, "Cannot enable clock.\n"); > + return ret; > + } > + return 0; > +} > /* --------------------------------------------------------------------- Blank line missing. thanks, greg k-h