lkml.org 
[lkml]   [2015]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] modify pl011 driver to let it work as wakeup source
On Thu, Sep 17, 2015 at 04:31:56PM +0800, Zhaoyang Huang wrote:
> +struct uart_match {
> + struct uart_port *port;
> + struct uart_driver *driver;
> +};
> +
> +static int match_uart_port(struct device *dev, void *data)
> +{
> + struct uart_match *match = data;
> +
> + dev_t devt = MKDEV(match->driver->major, match->driver->minor) +
> + match->port->line;
> +
> + pr_info("the match data of ttyAMA0 is %d %d\n",
> + (int)devt, (int)dev->devt);
> +
> + return dev->devt == devt; /* Actually, only one tty per port */
> +}
...
> + ret = pl011_register_port(uap);
> +
> + if (!of_find_property(dev->dev.of_node, "linux,wakeup", NULL)) {
> + uart_dev = NULL;
> + return ret;
> + }
> +
> + match.port = &uap->port;
> + match.driver = &amba_reg;
> +
> + uart_dev = device_find_child(&dev->dev, &match, match_uart_port);
> +
> + if (uart_dev) {
> + device_init_wakeup(uart_dev, true);
> + dev_pm_set_wake_irq(uart_dev, uap->port.irq);
> + }
> +
> + return ret;

I can only describe this code as a hack. This looks like something
which should be handled by generic infrastructure at an appropriate
point (somewhere inside uart_add_one_port()), not by hacky code in
each driver.

--
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


\
 
 \ /
  Last update: 2015-09-17 12:41    [W:0.060 / U:2.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site