diff mbox series

[3/4] soc: qcom: stats: support SM8150 platform

Message ID 20231209215601.3543895-3-dmitry.baryshkov@linaro.org
State New
Headers show
Series [1/4] dt-bindings: soc: qcom: stats: add compatible for SM8150 platform | expand

Commit Message

Dmitry Baryshkov Dec. 9, 2023, 9:56 p.m. UTC
On SM8150 the RPMh stats have 3 data records, but no DDR sleep stats,
which demands platform-specific compatible and data.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/soc/qcom/qcom_stats.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Konrad Dybcio Dec. 11, 2023, 9:11 a.m. UTC | #1
On 9.12.2023 22:56, Dmitry Baryshkov wrote:
> On SM8150 the RPMh stats have 3 data records, but no DDR sleep stats,
> which demands platform-specific compatible and data.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
I don't think it makes sense considering the driver could detect the
presence (or possibility of presence) of DDR stats at runtime.

Konrad
Konrad Dybcio Dec. 11, 2023, 10:46 a.m. UTC | #2
On 11.12.2023 10:43, Dmitry Baryshkov wrote:
> On Mon, 11 Dec 2023 at 11:11, Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
>>
>> On 9.12.2023 22:56, Dmitry Baryshkov wrote:
>>> On SM8150 the RPMh stats have 3 data records, but no DDR sleep stats,
>>> which demands platform-specific compatible and data.
>>>
>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>> ---
>> I don't think it makes sense considering the driver could detect the
>> presence (or possibility of presence) of DDR stats at runtime.
> 
> No, it can not really. We have safety nets for checking the offset
> value and then checking the magic number. But I'd prefer to be
> explicit here. It's not that the 'invalid' data at this offset is 0 or
> ~0.
> So, I'd prefer to be explicit here.
I'd say we're quite covered:

if (ddr_stats_offset)
	if (offset is within the range) // your latest patchset
		if (ddr_stats_magic)
			if (entries)
				"show stats"
			else
				"show nothing"
		else
			"no ddr stats"
	else
		"no ddr stats"
else
	"no ddr stats"

Konrad
diff mbox series

Patch

diff --git a/drivers/soc/qcom/qcom_stats.c b/drivers/soc/qcom/qcom_stats.c
index 813c9f3c6bec..dd1b6fee7739 100644
--- a/drivers/soc/qcom/qcom_stats.c
+++ b/drivers/soc/qcom/qcom_stats.c
@@ -438,6 +438,14 @@  static const struct stats_config rpmh_data_sdm845 = {
 	.subsystem_stats_in_smem = true,
 };
 
+static const struct stats_config rpmh_data_sm8150 = {
+	.stats_offset = 0x48,
+	.num_records = 3,
+	.appended_stats_avail = false,
+	.dynamic_offset = false,
+	.subsystem_stats_in_smem = true,
+};
+
 static const struct stats_config rpmh_data = {
 	.stats_offset = 0x48,
 	.num_records = 3,
@@ -455,6 +463,7 @@  static const struct of_device_id qcom_stats_table[] = {
 	{ .compatible = "qcom,rpm-stats", .data = &rpm_data },
 	{ .compatible = "qcom,rpmh-stats", .data = &rpmh_data },
 	{ .compatible = "qcom,sdm845-rpmh-stats", .data = &rpmh_data_sdm845 },
+	{ .compatible = "qcom,sm8150-rpmh-stats", .data = &rpmh_data_sm8150 },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, qcom_stats_table);