1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

Revert "serial-uartlite: Add runtime support"

This reverts commit 0379b1163e.

As Johan says, this driver needs a lot more work and these changes are
only going in the wrong direction:
    https://lkml.kernel.org/r/20190523091839.GC568@localhost

Reported-by: Johan Hovold <johan@kernel.org>
Cc: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Greg Kroah-Hartman 2019-11-14 06:25:17 +08:00
parent 5042ffbc95
commit 07e5d4ff12

View file

@ -22,7 +22,6 @@
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/pm_runtime.h>
#define ULITE_NAME "ttyUL" #define ULITE_NAME "ttyUL"
#define ULITE_MAJOR 204 #define ULITE_MAJOR 204
@ -55,7 +54,6 @@
#define ULITE_CONTROL_RST_TX 0x01 #define ULITE_CONTROL_RST_TX 0x01
#define ULITE_CONTROL_RST_RX 0x02 #define ULITE_CONTROL_RST_RX 0x02
#define ULITE_CONTROL_IE 0x10 #define ULITE_CONTROL_IE 0x10
#define UART_AUTOSUSPEND_TIMEOUT 3000
/* Static pointer to console port */ /* Static pointer to console port */
#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE #ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
@ -393,12 +391,12 @@ static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser)
static void ulite_pm(struct uart_port *port, unsigned int state, static void ulite_pm(struct uart_port *port, unsigned int state,
unsigned int oldstate) unsigned int oldstate)
{ {
if (!state) { struct uartlite_data *pdata = port->private_data;
pm_runtime_get_sync(port->dev);
} else { if (!state)
pm_runtime_mark_last_busy(port->dev); clk_enable(pdata->clk);
pm_runtime_put_autosuspend(port->dev); else
} clk_disable(pdata->clk);
} }
#ifdef CONFIG_CONSOLE_POLL #ifdef CONFIG_CONSOLE_POLL
@ -745,32 +743,11 @@ static int __maybe_unused ulite_resume(struct device *dev)
return 0; 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;
clk_enable(pdata->clk);
return 0;
}
/* --------------------------------------------------------------------- /* ---------------------------------------------------------------------
* Platform bus binding * Platform bus binding
*/ */
static const struct dev_pm_ops ulite_pm_ops = { static SIMPLE_DEV_PM_OPS(ulite_pm_ops, ulite_suspend, ulite_resume);
SET_SYSTEM_SLEEP_PM_OPS(ulite_suspend, ulite_resume)
SET_RUNTIME_PM_OPS(ulite_runtime_suspend,
ulite_runtime_resume, NULL)
};
#if defined(CONFIG_OF) #if defined(CONFIG_OF)
/* Match table for of_platform binding */ /* Match table for of_platform binding */
@ -843,15 +820,9 @@ static int ulite_probe(struct platform_device *pdev)
return ret; return ret;
} }
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, UART_AUTOSUSPEND_TIMEOUT);
pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
ret = ulite_assign(&pdev->dev, id, res->start, irq, pdata); ret = ulite_assign(&pdev->dev, id, res->start, irq, pdata);
pm_runtime_mark_last_busy(&pdev->dev); clk_disable(pdata->clk);
pm_runtime_put_autosuspend(&pdev->dev);
return ret; return ret;
} }
@ -860,14 +831,9 @@ static int ulite_remove(struct platform_device *pdev)
{ {
struct uart_port *port = dev_get_drvdata(&pdev->dev); struct uart_port *port = dev_get_drvdata(&pdev->dev);
struct uartlite_data *pdata = port->private_data; struct uartlite_data *pdata = port->private_data;
int rc;
clk_disable_unprepare(pdata->clk); clk_disable_unprepare(pdata->clk);
rc = ulite_release(&pdev->dev); return ulite_release(&pdev->dev);
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_dont_use_autosuspend(&pdev->dev);
return rc;
} }
/* work with hotplug and coldplug */ /* work with hotplug and coldplug */