From 5c9bdc3f52d20c9bc6c2552c6d3ec5bfa4119f75 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Thu, 16 Feb 2012 19:36:21 +0100 Subject: serial/sirf: fixup for changes to pin control We changed the signature of the pin multiplexing functions to handle any pin business, so fix up the Sirf driver to call this new interface and rename some variables to make the semantics understandable. Cc: linux-serial@vger.kernel.org Acked-by: Greg Kroah-Hartman Acked-by: Barry Song Signed-off-by: Linus Walleij --- drivers/tty/serial/sirfsoc_uart.c | 20 ++++++++++---------- drivers/tty/serial/sirfsoc_uart.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/tty') diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c index a60523fee11b..c1a871eac450 100644 --- a/drivers/tty/serial/sirfsoc_uart.c +++ b/drivers/tty/serial/sirfsoc_uart.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include "sirfsoc_uart.h" @@ -673,12 +673,12 @@ int sirfsoc_uart_probe(struct platform_device *pdev) port->irq = res->start; if (sirfport->hw_flow_ctrl) { - sirfport->pmx = pinmux_get(&pdev->dev, NULL); - ret = IS_ERR(sirfport->pmx); + sirfport->p = pinctrl_get(&pdev->dev, NULL); + ret = IS_ERR(sirfport->p); if (ret) - goto pmx_err; + goto pin_err; - pinmux_enable(sirfport->pmx); + pinctrl_enable(sirfport->p); } port->ops = &sirfsoc_uart_ops; @@ -696,10 +696,10 @@ int sirfsoc_uart_probe(struct platform_device *pdev) port_err: platform_set_drvdata(pdev, NULL); if (sirfport->hw_flow_ctrl) { - pinmux_disable(sirfport->pmx); - pinmux_put(sirfport->pmx); + pinctrl_disable(sirfport->p); + pinctrl_put(sirfport->p); } -pmx_err: +pin_err: irq_err: devm_iounmap(&pdev->dev, port->membase); err: @@ -712,8 +712,8 @@ static int sirfsoc_uart_remove(struct platform_device *pdev) struct uart_port *port = &sirfport->port; platform_set_drvdata(pdev, NULL); if (sirfport->hw_flow_ctrl) { - pinmux_disable(sirfport->pmx); - pinmux_put(sirfport->pmx); + pinctrl_disable(sirfport->p); + pinctrl_put(sirfport->p); } devm_iounmap(&pdev->dev, port->membase); uart_remove_one_port(&sirfsoc_uart_drv, port); diff --git a/drivers/tty/serial/sirfsoc_uart.h b/drivers/tty/serial/sirfsoc_uart.h index fc64260fa93c..6e207fdc2fed 100644 --- a/drivers/tty/serial/sirfsoc_uart.h +++ b/drivers/tty/serial/sirfsoc_uart.h @@ -162,7 +162,7 @@ struct sirfsoc_uart_port { unsigned char ms_enabled; struct uart_port port; - struct pinmux *pmx; + struct pinctrl *p; }; /* Hardware Flow Control */ -- cgit v1.2.1 From 110e4ec5a1cfe20190e7f8c2b8b4eef369de3c99 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Thu, 1 Mar 2012 18:48:33 -0700 Subject: pinctrl: assume map table entries can't have a NULL name field pinctrl_register_mappings() already requires that every mapping table entry have a non-NULL name field. Logically, this makes sense too; drivers should always request a specific named state so they know what they're getting. Relying on getting the first mentioned state in the mapping table is error-prone, and a nasty special case to implement, given that a given the mapping table may define multiple states for a device. Remove a small part of the documentation that talked about optionally requesting a specific state; it's mandatory now. Signed-off-by: Stephen Warren Acked-by: Dong Aisheng Signed-off-by: Linus Walleij --- drivers/tty/serial/sirfsoc_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/tty') diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c index c1a871eac450..3cabb650a1c1 100644 --- a/drivers/tty/serial/sirfsoc_uart.c +++ b/drivers/tty/serial/sirfsoc_uart.c @@ -673,7 +673,7 @@ int sirfsoc_uart_probe(struct platform_device *pdev) port->irq = res->start; if (sirfport->hw_flow_ctrl) { - sirfport->p = pinctrl_get(&pdev->dev, NULL); + sirfport->p = pinctrl_get(&pdev->dev, PINCTRL_STATE_DEFAULT); ret = IS_ERR(sirfport->p); if (ret) goto pin_err; -- cgit v1.2.1 From 6e5e959dde0d92d177f035652aeaa77f9330c9c6 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Fri, 2 Mar 2012 13:05:47 -0700 Subject: pinctrl: API changes to support multiple states per device The API model is changed from: p = pinctrl_get(dev, "state1"); pinctrl_enable(p); ... pinctrl_disable(p); pinctrl_put(p); p = pinctrl_get(dev, "state2"); pinctrl_enable(p); ... pinctrl_disable(p); pinctrl_put(p); to this: p = pinctrl_get(dev); s1 = pinctrl_lookup_state(p, "state1"); s2 = pinctrl_lookup_state(p, "state2"); pinctrl_select_state(p, s1); ... pinctrl_select_state(p, s2); ... pinctrl_put(p); This allows devices to directly transition between states without disabling the pin controller programming and put()/get()ing the configuration data each time. This model will also better suit pinconf programming, which doesn't have a concept of "disable". The special-case hogging feature of pin controllers is re-written to use the regular APIs instead of special-case code. Hence, the pinmux-hogs debugfs file is removed; see the top-level pinctrl-handles files for equivalent data. Signed-off-by: Stephen Warren Acked-by: Dong Aisheng Signed-off-by: Linus Walleij --- drivers/tty/serial/sirfsoc_uart.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'drivers/tty') diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c index 3cabb650a1c1..5b3eda2024fe 100644 --- a/drivers/tty/serial/sirfsoc_uart.c +++ b/drivers/tty/serial/sirfsoc_uart.c @@ -673,12 +673,10 @@ int sirfsoc_uart_probe(struct platform_device *pdev) port->irq = res->start; if (sirfport->hw_flow_ctrl) { - sirfport->p = pinctrl_get(&pdev->dev, PINCTRL_STATE_DEFAULT); + sirfport->p = pinctrl_get_select_default(&pdev->dev); ret = IS_ERR(sirfport->p); if (ret) goto pin_err; - - pinctrl_enable(sirfport->p); } port->ops = &sirfsoc_uart_ops; @@ -695,10 +693,8 @@ int sirfsoc_uart_probe(struct platform_device *pdev) port_err: platform_set_drvdata(pdev, NULL); - if (sirfport->hw_flow_ctrl) { - pinctrl_disable(sirfport->p); + if (sirfport->hw_flow_ctrl) pinctrl_put(sirfport->p); - } pin_err: irq_err: devm_iounmap(&pdev->dev, port->membase); @@ -711,10 +707,8 @@ static int sirfsoc_uart_remove(struct platform_device *pdev) struct sirfsoc_uart_port *sirfport = platform_get_drvdata(pdev); struct uart_port *port = &sirfport->port; platform_set_drvdata(pdev, NULL); - if (sirfport->hw_flow_ctrl) { - pinctrl_disable(sirfport->p); + if (sirfport->hw_flow_ctrl) pinctrl_put(sirfport->p); - } devm_iounmap(&pdev->dev, port->membase); uart_remove_one_port(&sirfsoc_uart_drv, port); return 0; -- cgit v1.2.1