All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] soc: qcom: socinfo: add qrb5165 SoC ID
@ 2020-12-22 13:04 Dmitry Baryshkov
  2020-12-22 13:04 ` [PATCH 2/3] soc: qcom: socinfo: add several PMIC IDs Dmitry Baryshkov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2020-12-22 13:04 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson; +Cc: linux-arm-msm

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

diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c
index b44ede48decc..cbd59937aac5 100644
--- a/drivers/soc/qcom/socinfo.c
+++ b/drivers/soc/qcom/socinfo.c
@@ -228,6 +228,7 @@ static const struct soc_id soc_id[] = {
 	{ 356, "SM8250" },
 	{ 402, "IPQ6018" },
 	{ 425, "SC7180" },
+	{ 455, "QRB5165" },
 };
 
 static const char *socinfo_machine(struct device *dev, unsigned int id)
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] soc: qcom: socinfo: add several PMIC IDs
  2020-12-22 13:04 [PATCH 1/3] soc: qcom: socinfo: add qrb5165 SoC ID Dmitry Baryshkov
@ 2020-12-22 13:04 ` Dmitry Baryshkov
  2020-12-22 13:04 ` [PATCH 3/3] soc: qcom: socinfo: add info from PMIC models array Dmitry Baryshkov
  2021-01-15 15:00 ` [PATCH 1/3] soc: qcom: socinfo: add qrb5165 SoC ID patchwork-bot+linux-arm-msm
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2020-12-22 13:04 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson; +Cc: linux-arm-msm

Add several PMIC IDs found on Qualcomm RB5 platform.

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

diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c
index cbd59937aac5..7229c3c04083 100644
--- a/drivers/soc/qcom/socinfo.c
+++ b/drivers/soc/qcom/socinfo.c
@@ -83,6 +83,11 @@ static const char *const pmic_models[] = {
 	[23] = "PM8038",
 	[24] = "PM8922",
 	[25] = "PM8917",
+	[30] = "PM8150",
+	[31] = "PM8150L",
+	[32] = "PM8150B",
+	[33] = "PMK8002",
+	[36] = "PM8009",
 };
 #endif /* CONFIG_DEBUG_FS */
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] soc: qcom: socinfo: add info from PMIC models array
  2020-12-22 13:04 [PATCH 1/3] soc: qcom: socinfo: add qrb5165 SoC ID Dmitry Baryshkov
  2020-12-22 13:04 ` [PATCH 2/3] soc: qcom: socinfo: add several PMIC IDs Dmitry Baryshkov
@ 2020-12-22 13:04 ` Dmitry Baryshkov
  2021-01-15 15:00 ` [PATCH 1/3] soc: qcom: socinfo: add qrb5165 SoC ID patchwork-bot+linux-arm-msm
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2020-12-22 13:04 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson; +Cc: linux-arm-msm

Add debugfs file showing information from PMIC model array.

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

diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c
index 7229c3c04083..d255034a2b6f 100644
--- a/drivers/soc/qcom/socinfo.c
+++ b/drivers/soc/qcom/socinfo.c
@@ -15,6 +15,8 @@
 #include <linux/sys_soc.h>
 #include <linux/types.h>
 
+#include <asm/unaligned.h>
+
 /*
  * SoC version type with major number in the upper 16 bits and minor
  * number in the lower 16 bits.
@@ -294,6 +296,32 @@ static int qcom_show_pmic_model(struct seq_file *seq, void *p)
 	return 0;
 }
 
+static int qcom_show_pmic_model_array(struct seq_file *seq, void *p)
+{
+	struct socinfo *socinfo = seq->private;
+	unsigned int num_pmics = le32_to_cpu(socinfo->num_pmics);
+	unsigned int pmic_array_offset = le32_to_cpu(socinfo->pmic_array_offset);
+	int i;
+	void *ptr = socinfo;
+
+	ptr += pmic_array_offset;
+
+	/* No need for bounds checking, it happened at socinfo_debugfs_init */
+	for (i = 0; i < num_pmics; i++) {
+		unsigned int model = SOCINFO_MINOR(get_unaligned_le32(ptr + 2 * i * sizeof(u32)));
+		unsigned int die_rev = get_unaligned_le32(ptr + (2 * i + 1) * sizeof(u32));
+
+		if (model <= ARRAY_SIZE(pmic_models) && pmic_models[model])
+			seq_printf(seq, "%s %u.%u\n", pmic_models[model],
+					SOCINFO_MAJOR(le32_to_cpu(die_rev)),
+					SOCINFO_MINOR(le32_to_cpu(die_rev)));
+		else
+			seq_printf(seq, "unknown (%d)\n", model);
+	}
+
+	return 0;
+}
+
 static int qcom_show_pmic_die_revision(struct seq_file *seq, void *p)
 {
 	struct socinfo *socinfo = seq->private;
@@ -316,6 +344,7 @@ static int qcom_show_chip_id(struct seq_file *seq, void *p)
 
 QCOM_OPEN(build_id, qcom_show_build_id);
 QCOM_OPEN(pmic_model, qcom_show_pmic_model);
+QCOM_OPEN(pmic_model_array, qcom_show_pmic_model_array);
 QCOM_OPEN(pmic_die_rev, qcom_show_pmic_die_revision);
 QCOM_OPEN(chip_id, qcom_show_chip_id);
 
@@ -344,12 +373,14 @@ DEFINE_IMAGE_OPS(variant);
 DEFINE_IMAGE_OPS(oem);
 
 static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
-				 struct socinfo *info)
+				 struct socinfo *info, size_t info_size)
 {
 	struct smem_image_version *versions;
 	struct dentry *dentry;
 	size_t size;
 	int i;
+	unsigned int num_pmics;
+	unsigned int pmic_array_offset;
 
 	qcom_socinfo->dbg_root = debugfs_create_dir("qcom_socinfo", NULL);
 
@@ -405,6 +436,11 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
 				   &qcom_socinfo->info.raw_device_num);
 		fallthrough;
 	case SOCINFO_VERSION(0, 11):
+		num_pmics = le32_to_cpu(info->num_pmics);
+		pmic_array_offset = le32_to_cpu(info->pmic_array_offset);
+		if (pmic_array_offset + 2 * num_pmics * sizeof(u32) <= info_size)
+			DEBUGFS_ADD(info, pmic_model_array);
+		fallthrough;
 	case SOCINFO_VERSION(0, 10):
 	case SOCINFO_VERSION(0, 9):
 		qcom_socinfo->info.foundry_id = __le32_to_cpu(info->foundry_id);
@@ -482,7 +518,7 @@ static void socinfo_debugfs_exit(struct qcom_socinfo *qcom_socinfo)
 }
 #else
 static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
-				 struct socinfo *info)
+				 struct socinfo *info, size_t info_size)
 {
 }
 static void socinfo_debugfs_exit(struct qcom_socinfo *qcom_socinfo) {  }
@@ -522,7 +558,7 @@ static int qcom_socinfo_probe(struct platform_device *pdev)
 	if (IS_ERR(qs->soc_dev))
 		return PTR_ERR(qs->soc_dev);
 
-	socinfo_debugfs_init(qs, info);
+	socinfo_debugfs_init(qs, info, item_size);
 
 	/* Feed the soc specific unique data into entropy pool */
 	add_device_randomness(info, item_size);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] soc: qcom: socinfo: add qrb5165 SoC ID
  2020-12-22 13:04 [PATCH 1/3] soc: qcom: socinfo: add qrb5165 SoC ID Dmitry Baryshkov
  2020-12-22 13:04 ` [PATCH 2/3] soc: qcom: socinfo: add several PMIC IDs Dmitry Baryshkov
  2020-12-22 13:04 ` [PATCH 3/3] soc: qcom: socinfo: add info from PMIC models array Dmitry Baryshkov
@ 2021-01-15 15:00 ` patchwork-bot+linux-arm-msm
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2021-01-15 15:00 UTC (permalink / raw)
  To: Dmitry Baryshkov; +Cc: linux-arm-msm

Hello:

This series was applied to qcom/linux.git (refs/heads/for-next):

On Tue, 22 Dec 2020 16:04:46 +0300 you wrote:
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  drivers/soc/qcom/socinfo.c | 1 +
>  1 file changed, 1 insertion(+)

Here is the summary with links:
  - [1/3] soc: qcom: socinfo: add qrb5165 SoC ID
    https://git.kernel.org/qcom/c/0c0d0e56e08c
  - [2/3] soc: qcom: socinfo: add several PMIC IDs
    https://git.kernel.org/qcom/c/4305324208d8
  - [3/3] soc: qcom: socinfo: add info from PMIC models array
    https://git.kernel.org/qcom/c/734c78e7febf

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-15 15:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22 13:04 [PATCH 1/3] soc: qcom: socinfo: add qrb5165 SoC ID Dmitry Baryshkov
2020-12-22 13:04 ` [PATCH 2/3] soc: qcom: socinfo: add several PMIC IDs Dmitry Baryshkov
2020-12-22 13:04 ` [PATCH 3/3] soc: qcom: socinfo: add info from PMIC models array Dmitry Baryshkov
2021-01-15 15:00 ` [PATCH 1/3] soc: qcom: socinfo: add qrb5165 SoC ID patchwork-bot+linux-arm-msm

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.