* [RFC 0/3] i2c: rcar: adapt PM usage to multi master case
@ 2015-12-16 18:44 ` Wolfram Sang
0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2015-12-16 18:44 UTC (permalink / raw)
To: linux-i2c
Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, Wolfram Sang, linux-pm
If we are in a multi-master scenario, we need to block runtime PM so the
arbitration circuit stays awake.
So, we define a new binding and adapt the i2c-rcar driver to have an example
implementation.
This series is RFC because I want to do some more regression testing. The
actual functionality works fine here on my Lager board.
Wolfram Sang (3):
i2c: document binding for multi-master case
i2c: rcar: remove macros dealing with flags
i2c: rcar: disable PM in multi-master mode
Documentation/devicetree/bindings/i2c/i2c.txt | 5 ++++
drivers/i2c/busses/i2c-rcar.c | 39 ++++++++++++++++-----------
2 files changed, 28 insertions(+), 16 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC 0/3] i2c: rcar: adapt PM usage to multi master case
@ 2015-12-16 18:44 ` Wolfram Sang
0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2015-12-16 18:44 UTC (permalink / raw)
To: linux-i2c
Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, Wolfram Sang, linux-pm
If we are in a multi-master scenario, we need to block runtime PM so the
arbitration circuit stays awake.
So, we define a new binding and adapt the i2c-rcar driver to have an example
implementation.
This series is RFC because I want to do some more regression testing. The
actual functionality works fine here on my Lager board.
Wolfram Sang (3):
i2c: document binding for multi-master case
i2c: rcar: remove macros dealing with flags
i2c: rcar: disable PM in multi-master mode
Documentation/devicetree/bindings/i2c/i2c.txt | 5 ++++
drivers/i2c/busses/i2c-rcar.c | 39 ++++++++++++++++-----------
2 files changed, 28 insertions(+), 16 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC 1/3] i2c: document binding for multi-master case
2015-12-16 18:44 ` Wolfram Sang
@ 2015-12-16 18:44 ` Wolfram Sang
-1 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2015-12-16 18:44 UTC (permalink / raw)
To: linux-i2c
Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, Wolfram Sang, linux-pm, devicetree
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
We need this binding because some I2C master drivers will need to adapt
their PM settings for the arbitration circuitry. I skipped the "i2c-"
prefix because I can imagine to be useful outside of i2c.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: devicetree@vger.kernel.org
---
Documentation/devicetree/bindings/i2c/i2c.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt
index a00219f5ee0733..c8d977ed847f3c 100644
--- a/Documentation/devicetree/bindings/i2c/i2c.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c.txt
@@ -54,6 +54,11 @@ wants to support one of the below features, it should adapt the bindings below.
"irq" and "wakeup" names are recognized by I2C core, other names are
left to individual drivers.
+- multi-master
+ states that there is another master active on this bus. The OS can use
+ this information to adapt power management to keep the arbitration awake
+ all the time, for example.
+
- wakeup-source
device can be used as a wakeup source.
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [RFC 1/3] i2c: document binding for multi-master case
@ 2015-12-16 18:44 ` Wolfram Sang
0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2015-12-16 18:44 UTC (permalink / raw)
To: linux-i2c
Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, Wolfram Sang, linux-pm, devicetree
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
We need this binding because some I2C master drivers will need to adapt
their PM settings for the arbitration circuitry. I skipped the "i2c-"
prefix because I can imagine to be useful outside of i2c.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: devicetree@vger.kernel.org
---
Documentation/devicetree/bindings/i2c/i2c.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt
index a00219f5ee0733..c8d977ed847f3c 100644
--- a/Documentation/devicetree/bindings/i2c/i2c.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c.txt
@@ -54,6 +54,11 @@ wants to support one of the below features, it should adapt the bindings below.
"irq" and "wakeup" names are recognized by I2C core, other names are
left to individual drivers.
+- multi-master
+ states that there is another master active on this bus. The OS can use
+ this information to adapt power management to keep the arbitration awake
+ all the time, for example.
+
- wakeup-source
device can be used as a wakeup source.
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [RFC 2/3] i2c: rcar: remove macros dealing with flags
2015-12-16 18:44 ` Wolfram Sang
@ 2015-12-16 18:44 ` Wolfram Sang
-1 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2015-12-16 18:44 UTC (permalink / raw)
To: linux-i2c
Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, Wolfram Sang, linux-pm
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
These macros don't really hide complexity, but C idioms. Removing them
makes the code easier to read IMO and make a planned extension easier.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/i2c/busses/i2c-rcar.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index b2389c492579cf..79fd2aab8fa087 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -122,9 +122,6 @@ struct rcar_i2c_priv {
#define rcar_i2c_priv_to_dev(p) ((p)->adap.dev.parent)
#define rcar_i2c_is_recv(p) ((p)->msg->flags & I2C_M_RD)
-#define rcar_i2c_flags_set(p, f) ((p)->flags |= (f))
-#define rcar_i2c_flags_has(p, f) ((p)->flags & (f))
-
#define LOOP_TIMEOUT 1024
@@ -258,7 +255,7 @@ static void rcar_i2c_prepare_msg(struct rcar_i2c_priv *priv)
priv->pos = 0;
if (priv->msgs_left = 1)
- rcar_i2c_flags_set(priv, ID_LAST_MSG);
+ priv->flags |= ID_LAST_MSG;
rcar_i2c_write(priv, ICMAR, (priv->msg->addr << 1) | read);
/*
@@ -266,7 +263,7 @@ static void rcar_i2c_prepare_msg(struct rcar_i2c_priv *priv)
* of ICMSR and ICMCR depends on whether we issue START or REP_START. Since
* it didn't cause a drawback for me, let's rather be safe than sorry.
*/
- if (rcar_i2c_flags_has(priv, ID_FIRST_MSG)) {
+ if (priv->flags & ID_FIRST_MSG) {
rcar_i2c_write(priv, ICMSR, 0);
rcar_i2c_write(priv, ICMCR, RCAR_BUS_PHASE_START);
} else {
@@ -438,7 +435,7 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
/* Arbitration lost */
if (msr & MAL) {
- rcar_i2c_flags_set(priv, (ID_DONE | ID_ARBLOST));
+ priv->flags |= ID_DONE | ID_ARBLOST;
goto out;
}
@@ -446,14 +443,14 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
if (msr & MNR) {
/* HW automatically sends STOP after received NACK */
rcar_i2c_write(priv, ICMIER, RCAR_IRQ_STOP);
- rcar_i2c_flags_set(priv, ID_NACK);
+ priv->flags |= ID_NACK;
goto out;
}
/* Stop */
if (msr & MST) {
priv->msgs_left--; /* The last message also made it */
- rcar_i2c_flags_set(priv, ID_DONE);
+ priv->flags |= ID_DONE;
goto out;
}
@@ -463,7 +460,7 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
rcar_i2c_irq_send(priv, msr);
out:
- if (rcar_i2c_flags_has(priv, ID_DONE)) {
+ if (priv->flags & ID_DONE) {
rcar_i2c_write(priv, ICMIER, 0);
rcar_i2c_write(priv, ICMSR, 0);
wake_up(&priv->wait);
@@ -501,15 +498,14 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
priv->flags = ID_FIRST_MSG;
rcar_i2c_prepare_msg(priv);
- time_left = wait_event_timeout(priv->wait,
- rcar_i2c_flags_has(priv, ID_DONE),
+ time_left = wait_event_timeout(priv->wait, priv->flags & ID_DONE,
num * adap->timeout);
if (!time_left) {
rcar_i2c_init(priv);
ret = -ETIMEDOUT;
- } else if (rcar_i2c_flags_has(priv, ID_NACK)) {
+ } else if (priv->flags & ID_NACK) {
ret = -ENXIO;
- } else if (rcar_i2c_flags_has(priv, ID_ARBLOST)) {
+ } else if (priv->flags & ID_ARBLOST) {
ret = -EAGAIN;
} else {
ret = num - priv->msgs_left; /* The number of transfer */
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [RFC 2/3] i2c: rcar: remove macros dealing with flags
@ 2015-12-16 18:44 ` Wolfram Sang
0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2015-12-16 18:44 UTC (permalink / raw)
To: linux-i2c
Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, Wolfram Sang, linux-pm
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
These macros don't really hide complexity, but C idioms. Removing them
makes the code easier to read IMO and make a planned extension easier.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/i2c/busses/i2c-rcar.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index b2389c492579cf..79fd2aab8fa087 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -122,9 +122,6 @@ struct rcar_i2c_priv {
#define rcar_i2c_priv_to_dev(p) ((p)->adap.dev.parent)
#define rcar_i2c_is_recv(p) ((p)->msg->flags & I2C_M_RD)
-#define rcar_i2c_flags_set(p, f) ((p)->flags |= (f))
-#define rcar_i2c_flags_has(p, f) ((p)->flags & (f))
-
#define LOOP_TIMEOUT 1024
@@ -258,7 +255,7 @@ static void rcar_i2c_prepare_msg(struct rcar_i2c_priv *priv)
priv->pos = 0;
if (priv->msgs_left == 1)
- rcar_i2c_flags_set(priv, ID_LAST_MSG);
+ priv->flags |= ID_LAST_MSG;
rcar_i2c_write(priv, ICMAR, (priv->msg->addr << 1) | read);
/*
@@ -266,7 +263,7 @@ static void rcar_i2c_prepare_msg(struct rcar_i2c_priv *priv)
* of ICMSR and ICMCR depends on whether we issue START or REP_START. Since
* it didn't cause a drawback for me, let's rather be safe than sorry.
*/
- if (rcar_i2c_flags_has(priv, ID_FIRST_MSG)) {
+ if (priv->flags & ID_FIRST_MSG) {
rcar_i2c_write(priv, ICMSR, 0);
rcar_i2c_write(priv, ICMCR, RCAR_BUS_PHASE_START);
} else {
@@ -438,7 +435,7 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
/* Arbitration lost */
if (msr & MAL) {
- rcar_i2c_flags_set(priv, (ID_DONE | ID_ARBLOST));
+ priv->flags |= ID_DONE | ID_ARBLOST;
goto out;
}
@@ -446,14 +443,14 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
if (msr & MNR) {
/* HW automatically sends STOP after received NACK */
rcar_i2c_write(priv, ICMIER, RCAR_IRQ_STOP);
- rcar_i2c_flags_set(priv, ID_NACK);
+ priv->flags |= ID_NACK;
goto out;
}
/* Stop */
if (msr & MST) {
priv->msgs_left--; /* The last message also made it */
- rcar_i2c_flags_set(priv, ID_DONE);
+ priv->flags |= ID_DONE;
goto out;
}
@@ -463,7 +460,7 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
rcar_i2c_irq_send(priv, msr);
out:
- if (rcar_i2c_flags_has(priv, ID_DONE)) {
+ if (priv->flags & ID_DONE) {
rcar_i2c_write(priv, ICMIER, 0);
rcar_i2c_write(priv, ICMSR, 0);
wake_up(&priv->wait);
@@ -501,15 +498,14 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
priv->flags = ID_FIRST_MSG;
rcar_i2c_prepare_msg(priv);
- time_left = wait_event_timeout(priv->wait,
- rcar_i2c_flags_has(priv, ID_DONE),
+ time_left = wait_event_timeout(priv->wait, priv->flags & ID_DONE,
num * adap->timeout);
if (!time_left) {
rcar_i2c_init(priv);
ret = -ETIMEDOUT;
- } else if (rcar_i2c_flags_has(priv, ID_NACK)) {
+ } else if (priv->flags & ID_NACK) {
ret = -ENXIO;
- } else if (rcar_i2c_flags_has(priv, ID_ARBLOST)) {
+ } else if (priv->flags & ID_ARBLOST) {
ret = -EAGAIN;
} else {
ret = num - priv->msgs_left; /* The number of transfer */
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [RFC 3/3] i2c: rcar: disable PM in multi-master mode
2015-12-16 18:44 ` Wolfram Sang
@ 2015-12-16 18:44 ` Wolfram Sang
-1 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2015-12-16 18:44 UTC (permalink / raw)
To: linux-i2c
Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, Wolfram Sang, linux-pm
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
In multi master mode, the IP core needs to be always active for
arbitration reasons. Get the config from DT and set up PM depending on
the config.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/i2c/busses/i2c-rcar.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 79fd2aab8fa087..7c523dcaee3e48 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -96,6 +96,9 @@
#define ID_DONE (1 << 2)
#define ID_ARBLOST (1 << 3)
#define ID_NACK (1 << 4)
+/* persistent flags */
+#define ID_P_PM_BLOCKED (1 << 31)
+#define ID_P_MASK ID_P_PM_BLOCKED
enum rcar_i2c_type {
I2C_RCAR_GEN1,
@@ -277,7 +280,7 @@ static void rcar_i2c_next_msg(struct rcar_i2c_priv *priv)
{
priv->msg++;
priv->msgs_left--;
- priv->flags = 0;
+ priv->flags &= ID_P_MASK;
rcar_i2c_prepare_msg(priv);
}
@@ -495,7 +498,7 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
/* init first message */
priv->msg = msgs;
priv->msgs_left = num;
- priv->flags = ID_FIRST_MSG;
+ priv->flags = (priv->flags & ID_P_MASK) | ID_FIRST_MSG;
rcar_i2c_prepare_msg(priv);
time_left = wait_event_timeout(priv->wait, priv->flags & ID_DONE,
@@ -630,7 +633,13 @@ static int rcar_i2c_probe(struct platform_device *pdev)
goto out_pm_put;
rcar_i2c_init(priv);
- pm_runtime_put(dev);
+
+ /* Don't suspend when multi-master to keep arbitration working */
+ if (of_get_property(dev->of_node, "multi-master", NULL))
+ priv->flags |= ID_P_PM_BLOCKED;
+ else
+ pm_runtime_put(dev);
+
irq = platform_get_irq(pdev, 0);
ret = devm_request_irq(dev, irq, rcar_i2c_irq, 0, dev_name(dev), priv);
@@ -664,6 +673,8 @@ static int rcar_i2c_remove(struct platform_device *pdev)
struct device *dev = &pdev->dev;
i2c_del_adapter(&priv->adap);
+ if (priv->flags & ID_P_PM_BLOCKED)
+ pm_runtime_put(dev);
pm_runtime_disable(dev);
return 0;
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [RFC 3/3] i2c: rcar: disable PM in multi-master mode
@ 2015-12-16 18:44 ` Wolfram Sang
0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2015-12-16 18:44 UTC (permalink / raw)
To: linux-i2c
Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, Wolfram Sang, linux-pm
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
In multi master mode, the IP core needs to be always active for
arbitration reasons. Get the config from DT and set up PM depending on
the config.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/i2c/busses/i2c-rcar.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 79fd2aab8fa087..7c523dcaee3e48 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -96,6 +96,9 @@
#define ID_DONE (1 << 2)
#define ID_ARBLOST (1 << 3)
#define ID_NACK (1 << 4)
+/* persistent flags */
+#define ID_P_PM_BLOCKED (1 << 31)
+#define ID_P_MASK ID_P_PM_BLOCKED
enum rcar_i2c_type {
I2C_RCAR_GEN1,
@@ -277,7 +280,7 @@ static void rcar_i2c_next_msg(struct rcar_i2c_priv *priv)
{
priv->msg++;
priv->msgs_left--;
- priv->flags = 0;
+ priv->flags &= ID_P_MASK;
rcar_i2c_prepare_msg(priv);
}
@@ -495,7 +498,7 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
/* init first message */
priv->msg = msgs;
priv->msgs_left = num;
- priv->flags = ID_FIRST_MSG;
+ priv->flags = (priv->flags & ID_P_MASK) | ID_FIRST_MSG;
rcar_i2c_prepare_msg(priv);
time_left = wait_event_timeout(priv->wait, priv->flags & ID_DONE,
@@ -630,7 +633,13 @@ static int rcar_i2c_probe(struct platform_device *pdev)
goto out_pm_put;
rcar_i2c_init(priv);
- pm_runtime_put(dev);
+
+ /* Don't suspend when multi-master to keep arbitration working */
+ if (of_get_property(dev->of_node, "multi-master", NULL))
+ priv->flags |= ID_P_PM_BLOCKED;
+ else
+ pm_runtime_put(dev);
+
irq = platform_get_irq(pdev, 0);
ret = devm_request_irq(dev, irq, rcar_i2c_irq, 0, dev_name(dev), priv);
@@ -664,6 +673,8 @@ static int rcar_i2c_remove(struct platform_device *pdev)
struct device *dev = &pdev->dev;
i2c_del_adapter(&priv->adap);
+ if (priv->flags & ID_P_PM_BLOCKED)
+ pm_runtime_put(dev);
pm_runtime_disable(dev);
return 0;
--
2.1.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [RFC 3/3] i2c: rcar: disable PM in multi-master mode
2015-12-16 18:44 ` Wolfram Sang
@ 2015-12-16 18:48 ` Sergei Shtylyov
-1 siblings, 0 replies; 14+ messages in thread
From: Sergei Shtylyov @ 2015-12-16 18:48 UTC (permalink / raw)
To: Wolfram Sang, linux-i2c
Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, linux-pm
Hello.
On 12/16/2015 09:44 PM, Wolfram Sang wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> In multi master mode, the IP core needs to be always active for
> arbitration reasons. Get the config from DT and set up PM depending on
> the config.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> drivers/i2c/busses/i2c-rcar.c | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 79fd2aab8fa087..7c523dcaee3e48 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
[...]
> @@ -630,7 +633,13 @@ static int rcar_i2c_probe(struct platform_device *pdev)
> goto out_pm_put;
>
> rcar_i2c_init(priv);
> - pm_runtime_put(dev);
> +
> + /* Don't suspend when multi-master to keep arbitration working */
> + if (of_get_property(dev->of_node, "multi-master", NULL))
of_property_read_bool(), perhaps?
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC 3/3] i2c: rcar: disable PM in multi-master mode
@ 2015-12-16 18:48 ` Sergei Shtylyov
0 siblings, 0 replies; 14+ messages in thread
From: Sergei Shtylyov @ 2015-12-16 18:48 UTC (permalink / raw)
To: Wolfram Sang, linux-i2c
Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, linux-pm
Hello.
On 12/16/2015 09:44 PM, Wolfram Sang wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> In multi master mode, the IP core needs to be always active for
> arbitration reasons. Get the config from DT and set up PM depending on
> the config.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> drivers/i2c/busses/i2c-rcar.c | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 79fd2aab8fa087..7c523dcaee3e48 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
[...]
> @@ -630,7 +633,13 @@ static int rcar_i2c_probe(struct platform_device *pdev)
> goto out_pm_put;
>
> rcar_i2c_init(priv);
> - pm_runtime_put(dev);
> +
> + /* Don't suspend when multi-master to keep arbitration working */
> + if (of_get_property(dev->of_node, "multi-master", NULL))
of_property_read_bool(), perhaps?
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC 0/3] i2c: rcar: adapt PM usage to multi master case
2015-12-16 18:44 ` Wolfram Sang
@ 2015-12-16 21:26 ` Geert Uytterhoeven
-1 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2015-12-16 21:26 UTC (permalink / raw)
To: Wolfram Sang
Cc: Linux I2C, Linux-sh list, Magnus Damm, Simon Horman,
Laurent Pinchart, Linux PM list
Hi Wolfram,
On Wed, Dec 16, 2015 at 7:44 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
> If we are in a multi-master scenario, we need to block runtime PM so the
> arbitration circuit stays awake.
>
> So, we define a new binding and adapt the i2c-rcar driver to have an example
> implementation.
>
> This series is RFC because I want to do some more regression testing. The
> actual functionality works fine here on my Lager board.
Thanks, looks good to me.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC 0/3] i2c: rcar: adapt PM usage to multi master case
@ 2015-12-16 21:26 ` Geert Uytterhoeven
0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2015-12-16 21:26 UTC (permalink / raw)
To: Wolfram Sang
Cc: Linux I2C, Linux-sh list, Magnus Damm, Simon Horman,
Laurent Pinchart, Linux PM list
Hi Wolfram,
On Wed, Dec 16, 2015 at 7:44 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
> If we are in a multi-master scenario, we need to block runtime PM so the
> arbitration circuit stays awake.
>
> So, we define a new binding and adapt the i2c-rcar driver to have an example
> implementation.
>
> This series is RFC because I want to do some more regression testing. The
> actual functionality works fine here on my Lager board.
Thanks, looks good to me.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC 1/3] i2c: document binding for multi-master case
2015-12-16 18:44 ` Wolfram Sang
@ 2015-12-19 4:18 ` Rob Herring
-1 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2015-12-19 4:18 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c, linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, linux-pm, devicetree
On Wed, Dec 16, 2015 at 07:44:18PM +0100, Wolfram Sang wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> We need this binding because some I2C master drivers will need to adapt
> their PM settings for the arbitration circuitry. I skipped the "i2c-"
> prefix because I can imagine to be useful outside of i2c.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Cc: devicetree@vger.kernel.org
> ---
> Documentation/devicetree/bindings/i2c/i2c.txt | 5 +++++
> 1 file changed, 5 insertions(+)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC 1/3] i2c: document binding for multi-master case
@ 2015-12-19 4:18 ` Rob Herring
0 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2015-12-19 4:18 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c, linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, linux-pm, devicetree
On Wed, Dec 16, 2015 at 07:44:18PM +0100, Wolfram Sang wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> We need this binding because some I2C master drivers will need to adapt
> their PM settings for the arbitration circuitry. I skipped the "i2c-"
> prefix because I can imagine to be useful outside of i2c.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Cc: devicetree@vger.kernel.org
> ---
> Documentation/devicetree/bindings/i2c/i2c.txt | 5 +++++
> 1 file changed, 5 insertions(+)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-12-19 4:18 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-16 18:44 [RFC 0/3] i2c: rcar: adapt PM usage to multi master case Wolfram Sang
2015-12-16 18:44 ` Wolfram Sang
2015-12-16 18:44 ` [RFC 1/3] i2c: document binding for multi-master case Wolfram Sang
2015-12-16 18:44 ` Wolfram Sang
2015-12-19 4:18 ` Rob Herring
2015-12-19 4:18 ` Rob Herring
2015-12-16 18:44 ` [RFC 2/3] i2c: rcar: remove macros dealing with flags Wolfram Sang
2015-12-16 18:44 ` Wolfram Sang
2015-12-16 18:44 ` [RFC 3/3] i2c: rcar: disable PM in multi-master mode Wolfram Sang
2015-12-16 18:44 ` Wolfram Sang
2015-12-16 18:48 ` Sergei Shtylyov
2015-12-16 18:48 ` Sergei Shtylyov
2015-12-16 21:26 ` [RFC 0/3] i2c: rcar: adapt PM usage to multi master case Geert Uytterhoeven
2015-12-16 21:26 ` Geert Uytterhoeven
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.