Skip to contentSkip to conversation

add support for pmic_arb v2 and correct framework

PATCH In review Gilad Avidov 4 participants 6 messages Mar 25, 2015 – Mar 26, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v5 cover add support for pmic_arb v2 and correct framework

pmic_arb v2 has no support for spmi non-data commands and thus returns -EOPNOTSUPP on .cmd callback. This causes a failure in spmi_drv_probe() which sends a wakeup command to the slave before probing its driver. This patchset removes the wakeup from spmi_drv_probe() since the spmi spec stipulates that a slaves default state is active and doesn't need a wakeup.

Changes from v3 to v4:
* Remove the claim that this is a bug fix off the commit text
* Unmap the core register space as soon as we know that it will not be used
* Assign the core reg space to a local until we know if it appropriate to use it to configure the controller fields (on v1) or unmap it (on v2).

Changes from v4 to v5:
* remove the unmap added in v4 since it is used again and the mapping is managed.
* correct printf formatting for 64bit compilers.
* correct base address for reading the channel table.

Gilad Avidov (2):
spmi: remove wakeup command before slave probe
spmi: pmic_arb: add support for hw version 2

 .../bindings/spmi/qcom,spmi-pmic-arb.txt           |   6 +-
 drivers/spmi/spmi-pmic-arb.c                       | 319 +++++++++++++++++----
 drivers/spmi/spmi.c                                |   9 +-
 3 files changed, 267 insertions(+), 67 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#1 lore raw

PATCH v5 1/2 spmi: remove wakeup command before slave probe

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.

---
 drivers/spmi/spmi.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/spmi/spmi.c +2 -7
index 1d92f51..9493843 100644
@@ -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;
 }
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#2 lore raw

PATCH v5 2/2 spmi: pmic_arb: add support for hw version 2

In reply to Gilad Avidov

Qualcomm PMIC Arbiter version-2 changes from version-1 are:

- Some different register offsets.
- New channel register space, one per PMIC peripheral (ppid). All tx traffic uses these channels.
- New observer register space. All rx trafic uses this space.
- Different command format for spmi command registers.

---
 .../bindings/spmi/qcom,spmi-pmic-arb.txt           |   6 +-
 drivers/spmi/spmi-pmic-arb.c                       | 319 +++++++++++++++++----
 2 files changed, 265 insertions(+), 60 deletions(-)
Documentation/devicetree/bindings/spmi/qcom,spmi-pmic-arb.txt +5 -1
index 715d099..e16b9b5 100644
@@ -1,6 +1,6 @@
 Qualcomm SPMI Controller (PMIC Arbiter)
 
-The SPMI PMIC Arbiter is found on the Snapdragon 800 Series.  It is an SPMI
+The SPMI PMIC Arbiter is found on Snapdragon chipsets.  It is an SPMI
 controller with wrapping arbitration logic to allow for multiple on-chip
 devices to control a single SPMI master.
 
@@ -19,6 +19,10 @@ Required properties:
      "core" - core registers
      "intr" - interrupt controller registers
      "cnfg" - configuration registers
+   Registers used only for V2 PMIC Arbiter:
+     "chnls"  - tx-channel per virtual slave registers.
+     "obsrvr" - rx-channel (called observer) per virtual slave registers.
+
 - reg : address + size pairs describing the PMIC arb register sets; order must
         correspond with the order of entries in reg-names
 - #address-cells : must be set to 2
drivers/spmi/spmi-pmic-arb.c +260 -59

517 lines not on this page · raw message

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
Tested-by on the v5 series
#3 lore raw
In reply to Gilad Avidov
Quoted 13 lines · Gilad Avidov

pmic_arb v2 has no support for spmi non-data commands and thus returns -EOPNOTSUPP on .cmd callback. This causes a failure in spmi_drv_probe() which sends a wakeup command to the slave before probing its driver. This patchset removes the wakeup from spmi_drv_probe() since the spmi spec stipulates that a slaves default state is active and doesn't need a wakeup.

Changes from v3 to v4:
* Remove the claim that this is a bug fix off the commit text
* Unmap the core register space as soon as we know that it will not be used
* Assign the core reg space to a local until we know if it appropriate to use it to configure the controller fields (on v1) or unmap it (on v2).

Quoted 8 lines

Changes from v4 to v5:
* remove the unmap added in v4 since it is used again and the mapping is managed.
* correct printf formatting for 64bit compilers.
* correct base address for reading the channel table.

Gilad Avidov (2):
spmi: remove wakeup command before slave probe
spmi: pmic_arb: add support for hw version 2

Thank you Gilad. This is fine now. Tested on APQ8084 (controller v1) and MSM8916 (controller v2).

I am wandering which is the appropriate tree to merge this?

Kumar?

#4 lore raw
Quoted 24 lines · Ivan T. Ivanov
Quoted 13 lines · Gilad Avidov

pmic_arb v2 has no support for spmi non-data commands and thus returns -EOPNOTSUPP on .cmd callback. This causes a failure in spmi_drv_probe() which sends a wakeup command to the slave before probing its driver. This patchset removes the wakeup from spmi_drv_probe() since the spmi spec stipulates that a slaves default state is active and doesn't need a wakeup.

Changes from v3 to v4:
* Remove the claim that this is a bug fix off the commit text
* Unmap the core register space as soon as we know that it will not be used
* Assign the core reg space to a local until we know if it appropriate to use it to configure the controller fields (on v1) or unmap it (on v2).

Quoted 8 lines

Changes from v4 to v5:
* remove the unmap added in v4 since it is used again and the mapping is managed.
* correct printf formatting for 64bit compilers.
* correct base address for reading the channel table.

Gilad Avidov (2):
spmi: remove wakeup command before slave probe
spmi: pmic_arb: add support for hw version 2

Quoted 6 lines

Thank you Gilad. This is fine now. Tested on APQ8084 (controller v1) and MSM8916 (controller v2).

I am wandering which is the appropriate tree to merge this?

Kumar?

We’ve been asking Greg to pick up SPMI patches.

- k

Signature · 3 lines
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#5 lore raw
Quoted 27 lines · Kumar Gala
Quoted 24 lines · Ivan T. Ivanov
Quoted 21 lines · Gilad Avidov

pmic_arb v2 has no support for spmi non-data commands and thus returns -EOPNOTSUPP on .cmd callback. This causes a failure in spmi_drv_probe() which sends a wakeup command to the slave before probing its driver. This patchset removes the wakeup from spmi_drv_probe() since the spmi spec stipulates that a slaves default state is active and doesn't need a wakeup.

Changes from v3 to v4:
* Remove the claim that this is a bug fix off the commit text
* Unmap the core register space as soon as we know that it will not be used
* Assign the core reg space to a local until we know if it appropriate to use it to configure the controller fields (on v1) or unmap it (on v2).

Changes from v4 to v5:
* remove the unmap added in v4 since it is used again and the mapping is managed.
* correct printf formatting for 64bit compilers.
* correct base address for reading the channel table.

Gilad Avidov (2):
spmi: remove wakeup command before slave probe
spmi: pmic_arb: add support for hw version 2

Quoted 8 lines
Quoted 6 lines

Thank you Gilad. This is fine now. Tested on APQ8084 (controller v1) and MSM8916 (controller v2).

I am wandering which is the appropriate tree to merge this?

Kumar?

We’ve been asking Greg to pick up SPMI patches.

Yes, I can take them.

thanks,

greg k-h