diff mbox

[V3,1/2] spmi: remove wakeup command before slave probe

Message ID 1423522272-24472-2-git-send-email-gavidov@codeaurora.org (mailing list archive)
State New, archived
Headers show

Commit Message

Gilad Avidov Feb. 9, 2015, 10:51 p.m. UTC
According to spmi spec a slave powers up into startup state and then
transitions into active state. Thus, the wakeup command is not required
before calling the slave's probe. The wakeup command is only needed for
slaves that are in sleep state after receiving the sleep command.

This is a bug since spmi master controllers, such as spmi-pmic-arb,
which have no support for wakeup command return an error on that
command and thus fail before reaching a slave driver probe.

Cc: galak@codeaurora.org
Reviewed-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
---
 drivers/spmi/spmi.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Josh Cartwright Feb. 18, 2015, 3:39 p.m. UTC | #1
On Mon, Feb 09, 2015 at 03:51:11PM -0700, Gilad Avidov wrote:
> According to spmi spec a slave powers up into startup state and then
> transitions into active state. Thus, the wakeup command is not required
> before calling the slave's probe. The wakeup command is only needed for
> slaves that are in sleep state after receiving the sleep command.
>
> This is a bug since spmi master controllers, such as spmi-pmic-arb,
> which have no support for wakeup command return an error on that
> command and thus fail before reaching a slave driver probe.

If masters are required by the spec to support all commands as Stephen
mentions, then I'd argue this is not a bug in the core code at all, but
in the spmi-pmic-arb driver.  But, unfortunately, having lost access to
the spec, I'll defer.

Regardless, I think this is useful as an optimization, just with dubious
justification.

Therefore,

Acked-by: Josh Cartwright <joshc@eso.teric.us>

  Josh
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Boyd Feb. 18, 2015, 7:17 p.m. UTC | #2
On 02/18/15 07:39, Josh Cartwright wrote:
> On Mon, Feb 09, 2015 at 03:51:11PM -0700, Gilad Avidov wrote:
>> According to spmi spec a slave powers up into startup state and then
>> transitions into active state. Thus, the wakeup command is not required
>> before calling the slave's probe. The wakeup command is only needed for
>> slaves that are in sleep state after receiving the sleep command.
>>
>> This is a bug since spmi master controllers, such as spmi-pmic-arb,
>> which have no support for wakeup command return an error on that
>> command and thus fail before reaching a slave driver probe.
> If masters are required by the spec to support all commands as Stephen
> mentions, then I'd argue this is not a bug in the core code at all, but
> in the spmi-pmic-arb driver.  But, unfortunately, having lost access to
> the spec, I'll defer.
>
> Regardless, I think this is useful as an optimization, just with dubious
> justification.
>
> Therefore,
>
> Acked-by: Josh Cartwright <joshc@eso.teric.us>
>
>

Agreed, it's mostly an optimization and aligns the code more with the
spec. How about we drop the "This is a bug" part?

With that done,

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Gilad Avidov Feb. 19, 2015, 7:23 p.m. UTC | #3
On Wed, 18 Feb 2015 11:17:13 -0800
Stephen Boyd <sboyd@codeaurora.org> wrote:

> On 02/18/15 07:39, Josh Cartwright wrote:
> > On Mon, Feb 09, 2015 at 03:51:11PM -0700, Gilad Avidov wrote:
> >> According to spmi spec a slave powers up into startup state and
> >> then transitions into active state. Thus, the wakeup command is
> >> not required before calling the slave's probe. The wakeup command
> >> is only needed for slaves that are in sleep state after receiving
> >> the sleep command.
> >>
> >> This is a bug since spmi master controllers, such as spmi-pmic-arb,
> >> which have no support for wakeup command return an error on that
> >> command and thus fail before reaching a slave driver probe.
> > If masters are required by the spec to support all commands as
> > Stephen mentions, then I'd argue this is not a bug in the core code
> > at all, but in the spmi-pmic-arb driver.  But, unfortunately,
> > having lost access to the spec, I'll defer.
> >
> > Regardless, I think this is useful as an optimization, just with
> > dubious justification.
> >
> > Therefore,
> >
> > Acked-by: Josh Cartwright <joshc@eso.teric.us>
> >
> >
> 
> Agreed, it's mostly an optimization and aligns the code more with the
> spec. How about we drop the "This is a bug" part?
> 

As Stephen suggested, I'll drop the bug part.

Thank you for the reviews,
Gilad

> With that done,
> 
> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c
index 1d92f51..9493843 100644
--- a/drivers/spmi/spmi.c
+++ b/drivers/spmi/spmi.c
@@ -1,4 +1,5 @@ 
-/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+/*
+ * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -316,11 +317,6 @@  static int spmi_drv_probe(struct device *dev)
 	struct spmi_device *sdev = to_spmi_device(dev);
 	int err;
 
-	/* Ensure the slave is in ACTIVE state */
-	err = spmi_command_wakeup(sdev);
-	if (err)
-		goto fail_wakeup;
-
 	pm_runtime_get_noresume(dev);
 	pm_runtime_set_active(dev);
 	pm_runtime_enable(dev);
@@ -335,7 +331,6 @@  fail_probe:
 	pm_runtime_disable(dev);
 	pm_runtime_set_suspended(dev);
 	pm_runtime_put_noidle(dev);
-fail_wakeup:
 	return err;
 }