2021-10-07 10:00:30

by Maulik Shah

[permalink] [raw]
Subject: [PATCH v11 0/5] Introduce SoC sleep stats driver

Changes in v10:
- Address Bjorn's comments from v10
- Add a case for RPM based targets dynamic offset in driver
- Update commit messages to use qcom sleep stats instead of soc sleep stats
- Drop individual target dtsi changes for sc7180 and sc7280
- Add single change to enable sleep stats for RPMh based targets
- Add single change to enable sleep stats for RPM based targets

Changes in v10:
- Updated device node name to use memory instead of aop_msgram
- Remove Lina's email from maintainers
- Rename driver to qcom_sleep_stats. Update makefile, Kconfig accordingly
- Address Bjorn's comments from v9

Changes in v9:
- Remove soft dependency on smem module
- Return -EIO to userspace in case of error
- Make struct sleep_stats *stat a const pointer
- Remove the driver from soc_sleep_stats_driver name
- Remove offset address and directly mention the msgram address in dtsi
- Use devm_platform_get_and_ioremap_resource() to ioremap dtsi address
- Update device node name to mention aop_msgram instead rpmh-sleep-stats
- Update dtsi and documentation accordingly but retain the reviews

Changes in v8:
- Addressed bjorn's comments in driver from v7
- Update aoss_qmp device node reg size for sc7280

Changes in v7:
- Fix example in bindings documentation as per #address/size-cells = <1>.
- Add comment in driver from where 'ddr' subsystems name is read.
- Update comment in driver to s/beside/besides and others from v6.
- Rename debugfs_create_entries() from v6.
- Drop use of memcpy_fromio() to find the name.
- Use sizeof(*prv_data) in devm_kzalloc().
- Add change to define readq() if its not yet defined for compile support.
- Add wpss subsystem in the list of subsystems.
- Add module soft dependency on smem module.
- Add new change to add device node for sc7280.

Changes in v6:
- Address stephen's comments from v5 which includes below
- Pad 0 in documentation example to make address 8 digit
- define macro to calculate offset in driver
- Add appended_stats_avail to prv_data instead of using entire stats_config
- make array subsystems[] as const
- Add comment for SSR case
- Use memcpy_fromio() and devm_kcalloc() during probe
- Change file permission mode from 444 to 400

- Address guenter's comments to add depends on QCOM_SMEM

- Add adsp_island and cdsp_island subsystems
- Use strim() to remove whitespace in stat name

Changes in v5:
- Remove underscore from node name in Documentation and DTSI change
- Remove global config from driver change

Changes in v4:
- Address bjorn's comments from v3 on change 2.
- Add bjorn's Reviewed-by on change 3 and 4.

Changes in v3:
- Address stephen's comments from v2 in change 1 and 2.
- Address bjorn's comments from v2 in change 3 and 4.
- Add Rob and bjorn's Reviewed-by on YAML change.

Changes in v2:
- Convert Documentation to YAML.
- Address stephen's comments from v1.
- Use debugfs instead of sysfs.
- Add sc7180 dts changes for sleep stats
- Add defconfig changes to enable driver
- Include subsystem stats from [1] in this single stats driver.
- Address stephen's comments from [1]
- Update cover letter inline to mention [1]

Qualcomm Technologies, Inc. (QTI)'s chipsets support SoC level low power
modes. SoCs Always On Processor/Resource Power Manager produces statistics
of the SoC sleep modes involving lowering or powering down of the rails and
the oscillator clock.

Additionally multiple subsystems present on SoC like modem, spss, adsp,
cdsp maintains their low power mode statistics in shared memory (SMEM).

Statistics includes SoC sleep mode type, number of times LPM entered, time
of last entry, exit, and accumulated sleep duration in seconds.

This series adds a driver to read the stats and export to debugfs.

[1] https://lore.kernel.org/patchwork/patch/1149381/

Mahesh Sivasubramanian (2):
dt-bindings: Introduce QCOM Sleep stats bindings
soc: qcom: Add Sleep stats driver

Maulik Shah (3):
arm64: defconfig: Enable Sleep stats driver
arm64: dts: qcom: Enable RPMh Sleep stats
arm64: dts: qcom: Enable RPM Sleep stats

.../bindings/soc/qcom/qcom-sleep-stats.yaml | 47 ++++
arch/arm64/boot/dts/qcom/msm8996.dtsi | 5 +
arch/arm64/boot/dts/qcom/msm8998.dtsi | 5 +
arch/arm64/boot/dts/qcom/qcs404.dtsi | 5 +
arch/arm64/boot/dts/qcom/sc7180.dtsi | 7 +-
arch/arm64/boot/dts/qcom/sc7280.dtsi | 7 +-
arch/arm64/boot/dts/qcom/sdm630.dtsi | 5 +
arch/arm64/boot/dts/qcom/sm6125.dtsi | 5 +
arch/arm64/boot/dts/qcom/sm8150.dtsi | 7 +-
arch/arm64/boot/dts/qcom/sm8250.dtsi | 7 +-
arch/arm64/boot/dts/qcom/sm8350.dtsi | 7 +-
arch/arm64/configs/defconfig | 1 +
drivers/soc/qcom/Kconfig | 10 +
drivers/soc/qcom/Makefile | 1 +
drivers/soc/qcom/qcom_sleep_stats.c | 259 +++++++++++++++++++++
15 files changed, 373 insertions(+), 5 deletions(-)
create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom-sleep-stats.yaml
create mode 100644 drivers/soc/qcom/qcom_sleep_stats.c

--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


2021-10-07 10:00:46

by Maulik Shah

[permalink] [raw]
Subject: [PATCH v11 5/5] arm64: dts: qcom: Enable RPM Sleep stats

Add device node for Sleep stats driver which provides various
low power mode stats on msm8996, msm8998, qcs404, sdm630 and
sm6125.

Cc: [email protected]
Signed-off-by: Maulik Shah <[email protected]>
---
arch/arm64/boot/dts/qcom/msm8996.dtsi | 5 +++++
arch/arm64/boot/dts/qcom/msm8998.dtsi | 5 +++++
arch/arm64/boot/dts/qcom/qcs404.dtsi | 5 +++++
arch/arm64/boot/dts/qcom/sdm630.dtsi | 5 +++++
arch/arm64/boot/dts/qcom/sm6125.dtsi | 5 +++++
5 files changed, 25 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi
index eb3ec5f..d647382 100644
--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
@@ -1523,6 +1523,11 @@
};
};

+ sram@290000 {
+ compatible = "qcom,rpm-sleep-stats";
+ reg = <0x00290000 0x400>;
+ };
+
spmi_bus: qcom,spmi@400f000 {
compatible = "qcom,spmi-pmic-arb";
reg = <0x0400f000 0x1000>,
diff --git a/arch/arm64/boot/dts/qcom/msm8998.dtsi b/arch/arm64/boot/dts/qcom/msm8998.dtsi
index 3c1f133..895806e 100644
--- a/arch/arm64/boot/dts/qcom/msm8998.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi
@@ -2022,6 +2022,11 @@
};
};

+ sram@290000 {
+ compatible = "qcom,rpm-sleep-stats";
+ reg = <0x00290000 0x400>;
+ };
+
spmi_bus: spmi@800f000 {
compatible = "qcom,spmi-pmic-arb";
reg = <0x0800f000 0x1000>,
diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi
index 339790b..45e6eae 100644
--- a/arch/arm64/boot/dts/qcom/qcs404.dtsi
+++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi
@@ -719,6 +719,11 @@
reg = <0x01937000 0x25000>;
};

+ sram@290000 {
+ compatible = "qcom,rpm-sleep-stats";
+ reg = <0x00290000 0x400>;
+ };
+
spmi_bus: spmi@200f000 {
compatible = "qcom,spmi-pmic-arb";
reg = <0x0200f000 0x001000>,
diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qcom/sdm630.dtsi
index 9c7f87e..4044a5b 100644
--- a/arch/arm64/boot/dts/qcom/sdm630.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi
@@ -1176,6 +1176,11 @@
status = "disabled";
};

+ sram@290000 {
+ compatible = "qcom,rpm-sleep-stats";
+ reg = <0x00290000 0x400>;
+ };
+
spmi_bus: spmi@800f000 {
compatible = "qcom,spmi-pmic-arb";
reg = <0x0800f000 0x1000>,
diff --git a/arch/arm64/boot/dts/qcom/sm6125.dtsi b/arch/arm64/boot/dts/qcom/sm6125.dtsi
index c2317dd..c90491a3 100644
--- a/arch/arm64/boot/dts/qcom/sm6125.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm6125.dtsi
@@ -460,6 +460,11 @@
};
};

+ sram@4690000 {
+ compatible = "qcom,rpm-sleep-stats";
+ reg = <0x04690000 0x400>;
+ };
+
spmi_bus: spmi@1c40000 {
compatible = "qcom,spmi-pmic-arb";
reg = <0x01c40000 0x1100>,
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

2021-10-07 10:02:40

by Maulik Shah

[permalink] [raw]
Subject: [PATCH v11 4/5] arm64: dts: qcom: Enable RPMh Sleep stats

Add device node for Sleep stats driver which provides various
low power mode stats on sc7180, sc7280, sm8150, sm8250 and sm8350.

Also update the reg size of aoss_qmp device to 0x400.

Cc: [email protected]
Signed-off-by: Maulik Shah <[email protected]>
---
arch/arm64/boot/dts/qcom/sc7180.dtsi | 7 ++++++-
arch/arm64/boot/dts/qcom/sc7280.dtsi | 7 ++++++-
arch/arm64/boot/dts/qcom/sm8150.dtsi | 7 ++++++-
arch/arm64/boot/dts/qcom/sm8250.dtsi | 7 ++++++-
arch/arm64/boot/dts/qcom/sm8350.dtsi | 7 ++++++-
5 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index f10217c..e849810 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -3219,13 +3219,18 @@

aoss_qmp: power-controller@c300000 {
compatible = "qcom,sc7180-aoss-qmp";
- reg = <0 0x0c300000 0 0x100000>;
+ reg = <0 0x0c300000 0 0x400>;
interrupts = <GIC_SPI 389 IRQ_TYPE_EDGE_RISING>;
mboxes = <&apss_shared 0>;

#clock-cells = <0>;
};

+ sram@c3f0000 {
+ compatible = "qcom,rpmh-sleep-stats";
+ reg = <0 0x0c3f0000 0 0x400>;
+ };
+
spmi_bus: spmi@c440000 {
compatible = "qcom,spmi-pmic-arb";
reg = <0 0x0c440000 0 0x1100>,
diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi
index 39635da..b21c55a 100644
--- a/arch/arm64/boot/dts/qcom/sc7280.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi
@@ -2637,7 +2637,7 @@

aoss_qmp: power-controller@c300000 {
compatible = "qcom,sc7280-aoss-qmp";
- reg = <0 0x0c300000 0 0x100000>;
+ reg = <0 0x0c300000 0 0x400>;
interrupts-extended = <&ipcc IPCC_CLIENT_AOP
IPCC_MPROC_SIGNAL_GLINK_QMP
IRQ_TYPE_EDGE_RISING>;
@@ -2647,6 +2647,11 @@
#clock-cells = <0>;
};

+ sram@c3f0000 {
+ compatible = "qcom,rpmh-sleep-stats";
+ reg = <0 0x0c3f0000 0 0x400>;
+ };
+
spmi_bus: spmi@c440000 {
compatible = "qcom,spmi-pmic-arb";
reg = <0 0x0c440000 0 0x1100>,
diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qcom/sm8150.dtsi
index 8a03569..bde3776 100644
--- a/arch/arm64/boot/dts/qcom/sm8150.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi
@@ -3170,13 +3170,18 @@

aoss_qmp: power-controller@c300000 {
compatible = "qcom,sm8150-aoss-qmp";
- reg = <0x0 0x0c300000 0x0 0x100000>;
+ reg = <0x0 0x0c300000 0x0 0x400>;
interrupts = <GIC_SPI 389 IRQ_TYPE_EDGE_RISING>;
mboxes = <&apss_shared 0>;

#clock-cells = <0>;
};

+ sram@c3f0000 {
+ compatible = "qcom,rpmh-sleep-stats";
+ reg = <0 0x0c3f0000 0 0x400>;
+ };
+
tsens0: thermal-sensor@c263000 {
compatible = "qcom,sm8150-tsens", "qcom,tsens-v2";
reg = <0 0x0c263000 0 0x1ff>, /* TM */
diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi
index 2796b27..a815101 100644
--- a/arch/arm64/boot/dts/qcom/sm8250.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi
@@ -2899,7 +2899,7 @@

aoss_qmp: power-controller@c300000 {
compatible = "qcom,sm8250-aoss-qmp";
- reg = <0 0x0c300000 0 0x100000>;
+ reg = <0 0x0c300000 0 0x400>;
interrupts-extended = <&ipcc IPCC_CLIENT_AOP
IPCC_MPROC_SIGNAL_GLINK_QMP
IRQ_TYPE_EDGE_RISING>;
@@ -2909,6 +2909,11 @@
#clock-cells = <0>;
};

+ sram@c3f0000 {
+ compatible = "qcom,rpmh-sleep-stats";
+ reg = <0 0x0c3f0000 0 0x400>;
+ };
+
spmi_bus: spmi@c440000 {
compatible = "qcom,spmi-pmic-arb";
reg = <0x0 0x0c440000 0x0 0x0001100>,
diff --git a/arch/arm64/boot/dts/qcom/sm8350.dtsi b/arch/arm64/boot/dts/qcom/sm8350.dtsi
index 6c83cd5..778a4b6 100644
--- a/arch/arm64/boot/dts/qcom/sm8350.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8350.dtsi
@@ -788,7 +788,7 @@

aoss_qmp: power-controller@c300000 {
compatible = "qcom,sm8350-aoss-qmp";
- reg = <0 0x0c300000 0 0x100000>;
+ reg = <0 0x0c300000 0 0x400>;
interrupts-extended = <&ipcc IPCC_CLIENT_AOP IPCC_MPROC_SIGNAL_GLINK_QMP
IRQ_TYPE_EDGE_RISING>;
mboxes = <&ipcc IPCC_CLIENT_AOP IPCC_MPROC_SIGNAL_GLINK_QMP>;
@@ -796,6 +796,11 @@
#clock-cells = <0>;
};

+ sram@c3f0000 {
+ compatible = "qcom,rpmh-sleep-stats";
+ reg = <0 0x0c3f0000 0 0x400>;
+ };
+
spmi_bus: spmi@c440000 {
compatible = "qcom,spmi-pmic-arb";
reg = <0x0 0xc440000 0x0 0x1100>,
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation