soc: qcom: socinfo: add support for newer socinfo data
Subsystems (2)
PATCH 1/4 soc: qcom: socinfo: add support for newer socinfo data
Add support for newer Qualcomm SoC info structures (up to version 0.15).
--- drivers/soc/qcom/socinfo.c | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
drivers/soc/qcom/socinfo.c +55 -0
@@ -24,6 +24,7 @@#define SOCINFO_VERSION (maj, min) ((((maj) & 0xffff) << 16)|((min) & 0xffff))#define SMEM_SOCINFO_BUILD_ID_LENGTH 32 +#define SMEM_SOCINFO_CHIP_ID_LENGTH 32/* * SMEM item id, used to acquire handles to respective
@@ -121,6 +122,16 @@ struct socinfo {__le32 chip_family;__le32 raw_device_family;__le32 raw_device_num; +/* Version 13 */ +__le32 nproduct_id; +char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH ]; +/* Version 14 */ +__le32 num_clusters; +__le32 ncluster_array_offset; +__le32 num_defective_parts; +__le32 ndefective_parts_array_offset; +/* Version 15 */ +__le32 nmodem_supported; };#ifdef CONFIG_DEBUG_FS
@@ -135,6 +146,12 @@ struct socinfo_params {u32 raw_ver;u32 hw_plat;u32 fmt; +u32 nproduct_id; +u32 num_clusters; +u32 ncluster_array_offset; +u32 num_defective_parts; +u32 ndefective_parts_array_offset; +u32 nmodem_supported; };struct smem_image_version {
@@ -268,9 +285,19 @@ static int qcom_show_pmic_die_revision(struct seq_file *seq, void *p)return 0 ; } +static int qcom_show_chip_id (struct seq_file *seq,void *p) +{ +struct socinfo *socinfo = seq->private; + +seq_printf (seq,"%s\n" , socinfo->chip_id); + +return 0 ; +} +QCOM_OPEN (build_id, qcom_show_build_id);QCOM_OPEN (pmic_model, qcom_show_pmic_model);QCOM_OPEN (pmic_die_rev, qcom_show_pmic_die_revision); +QCOM_OPEN (chip_id, qcom_show_chip_id);#define DEFINE_IMAGE_OPS (type) \ static int show_image_##type(struct seq_file *seq, void *p) \
@@ -309,6 +336,34 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo, qcom_socinfo->info.fmt =__le32_to_cpu (info->fmt);switch (qcom_socinfo->info.fmt) { +case SOCINFO_VERSION (0 ,15 ): + qcom_socinfo->info.nmodem_supported =__le32_to_cpu (info->nmodem_supported); + +debugfs_create_u32 ("nmodem_supported" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.nmodem_supported); +/* Fall through */ +case SOCINFO_VERSION (0 ,14 ): + qcom_socinfo->info.num_clusters =__le32_to_cpu (info->num_clusters); + qcom_socinfo->info.ncluster_array_offset =__le32_to_cpu (info->ncluster_array_offset); + qcom_socinfo->info.num_defective_parts =__le32_to_cpu (info->num_defective_parts); + qcom_socinfo->info.ndefective_parts_array_offset =__le32_to_cpu (info->ndefective_parts_array_offset); + +debugfs_create_u32 ("num_clusters" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.num_clusters); +debugfs_create_u32 ("ncluster_array_offset" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.ncluster_array_offset); +debugfs_create_u32 ("num_defective_parts" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.num_defective_parts); +debugfs_create_u32 ("ndefective_parts_array_offset" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.ndefective_parts_array_offset); +/* Fall through */ +case SOCINFO_VERSION (0 ,13 ): + qcom_socinfo->info.nproduct_id =__le32_to_cpu (info->nproduct_id); + +debugfs_create_u32 ("nproduct_id" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.nproduct_id); +DEBUGFS_ADD (info, chip_id); +/* Fall through */ case SOCINFO_VERSION (0 ,12 ): qcom_socinfo->info.chip_family =__le32_to_cpu (info->chip_family);
Signature · 1 line
2.26.2
PATCH 2/4 soc: qcom: socinfo: fix printing of pmic_model
Print sensible string instead of just "(null)" for unknown PMIC models. Also as we are at it, do not let debugfs handler access past pmic_models array.
--- drivers/soc/qcom/socinfo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/soc/qcom/socinfo.c +4 -1
@@ -269,7 +269,10 @@ static int qcom_show_pmic_model(struct seq_file *seq, void *p)if (model <0 )return -EINVAL ; -seq_printf (seq,"%s\n" , pmic_models[model]); +if (model <=ARRAY_SIZE (pmic_models) && pmic_models[model]) +seq_printf (seq,"%s\n" , pmic_models[model]); +else +seq_printf (seq,"unknown (%d)\n" , model);return 0 ; }
Signature · 1 line
2.26.2
Re: [PATCH 2/4] soc: qcom: socinfo: fix printing of pmic_model
Quoted 4 lines · Dmitry Baryshkov
Print sensible string instead of just "(null)" for unknown PMIC models. Also as we are at it, do not let debugfs handler access past
pmic_modelsarray.
Regards,
Bjorn
Quoted 24 lines
Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/soc/qcom/socinfo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/soc/qcom/socinfo.c +4
-1@@ -269,7 +269,10 @@ static int qcom_show_pmic_model(struct seq_file *seq, void *p)if (model <0 )return -EINVAL ; -seq_printf (seq,"%s\n" , pmic_models[model]); +if (model <=ARRAY_SIZE (pmic_models) && pmic_models[model]) +seq_printf (seq,"%s\n" , pmic_models[model]); +else +seq_printf (seq,"unknown (%d)\n" , model);return 0 ; }Signature · 1 line
2.26.2
PATCH 3/4 soc: qcom: socinfo: add file with SoC info format version
In reply to Dmitry BaryshkovTo ease debugging socinfo driver for newer chips add debugfs file returning SoC info format version.
--- drivers/soc/qcom/socinfo.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/soc/qcom/socinfo.c +3 -0
@@ -338,6 +338,9 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo, qcom_socinfo->info.fmt =__le32_to_cpu (info->fmt); +debugfs_create_x32 ("info_fmt" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.fmt); +switch (qcom_socinfo->info.fmt) {case SOCINFO_VERSION (0 ,15 ): qcom_socinfo->info.nmodem_supported =__le32_to_cpu (info->nmodem_supported);
Signature · 1 line
2.26.2
Re: [PATCH 3/4] soc: qcom: socinfo: add file with SoC info format version
Quoted 3 lines · Dmitry Baryshkov
To ease debugging socinfo driver for newer chips add debugfs file returning SoC info format version.
Regards,
Bjorn
Quoted 22 lines
Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/soc/qcom/socinfo.c | 3 +++ 1 file changed, 3 insertions(+)drivers/soc/qcom/socinfo.c +3
-0@@ -338,6 +338,9 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo, qcom_socinfo->info.fmt =__le32_to_cpu (info->fmt); +debugfs_create_x32 ("info_fmt" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.fmt); +switch (qcom_socinfo->info.fmt) {case SOCINFO_VERSION (0 ,15 ): qcom_socinfo->info.nmodem_supported =__le32_to_cpu (info->nmodem_supported);Signature · 1 line
2.26.2
PATCH 4/4 soc: qcom: socinfo: add SM8250 entry to soc_id array
In reply to Dmitry BaryshkovAdd an entry for SM8250 SoC.
--- drivers/soc/qcom/socinfo.c | 1 + 1 file changed, 1 insertion(+)
drivers/soc/qcom/socinfo.c +1 -0
@@ -217,6 +217,7 @@ static const struct soc_id soc_id[] = { { 312, "APQ8096SG" }, { 321, "SDM845" }, { 341, "SDA845" }, + { 356, "SM8250" }, };static const char *socinfo_machine (struct device *dev,unsigned int id)
Signature · 1 line
2.26.2
Re: [PATCH 4/4] soc: qcom: socinfo: add SM8250 entry to soc_id array
Quoted 2 lines · Dmitry Baryshkov
Add an entry for SM8250 SoC.
Regards,
Bjorn
Quoted 20 lines
Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/soc/qcom/socinfo.c | 1 + 1 file changed, 1 insertion(+)drivers/soc/qcom/socinfo.c +1
-0@@ -217,6 +217,7 @@ static const struct soc_id soc_id[] = { { 312, "APQ8096SG" }, { 321, "SDM845" }, { 341, "SDA845" }, + { 356, "SM8250" }, };static const char *socinfo_machine (struct device *dev,unsigned int id)Signature · 1 line
2.26.2
Quoted 2 lines · Dmitry Baryshkov
Add support for newer Qualcomm SoC info structures (up to version 0.15).
Regards,
Bjorn
Quoted 105 lines
Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/soc/qcom/socinfo.c | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)drivers/soc/qcom/socinfo.c +55
-0@@ -24,6 +24,7 @@#define SOCINFO_VERSION (maj, min) ((((maj) & 0xffff) << 16)|((min) & 0xffff))#define SMEM_SOCINFO_BUILD_ID_LENGTH 32 +#define SMEM_SOCINFO_CHIP_ID_LENGTH 32/* * SMEM item id, used to acquire handles to respective @@ -121,6 +122,16 @@ struct socinfo {__le32 chip_family;__le32 raw_device_family;__le32 raw_device_num; +/* Version 13 */ +__le32 nproduct_id; +char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH ]; +/* Version 14 */ +__le32 num_clusters; +__le32 ncluster_array_offset; +__le32 num_defective_parts; +__le32 ndefective_parts_array_offset; +/* Version 15 */ +__le32 nmodem_supported; };#ifdef CONFIG_DEBUG_FS @@ -135,6 +146,12 @@ struct socinfo_params {u32 raw_ver;u32 hw_plat;u32 fmt; +u32 nproduct_id; +u32 num_clusters; +u32 ncluster_array_offset; +u32 num_defective_parts; +u32 ndefective_parts_array_offset; +u32 nmodem_supported; };struct smem_image_version {@@ -268,9 +285,19 @@ static int qcom_show_pmic_die_revision(struct seq_file *seq, void *p)return 0 ; } +static int qcom_show_chip_id (struct seq_file *seq,void *p) +{ +struct socinfo *socinfo = seq->private; + +seq_printf (seq,"%s\n" , socinfo->chip_id); + +return 0 ; +} +QCOM_OPEN (build_id, qcom_show_build_id);QCOM_OPEN (pmic_model, qcom_show_pmic_model);QCOM_OPEN (pmic_die_rev, qcom_show_pmic_die_revision); +QCOM_OPEN (chip_id, qcom_show_chip_id);#define DEFINE_IMAGE_OPS (type) \ static int show_image_##type(struct seq_file *seq, void *p) \@@ -309,6 +336,34 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo, qcom_socinfo->info.fmt =__le32_to_cpu (info->fmt);switch (qcom_socinfo->info.fmt) { +case SOCINFO_VERSION (0 ,15 ): + qcom_socinfo->info.nmodem_supported =__le32_to_cpu (info->nmodem_supported); + +debugfs_create_u32 ("nmodem_supported" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.nmodem_supported); +/* Fall through */ +case SOCINFO_VERSION (0 ,14 ): + qcom_socinfo->info.num_clusters =__le32_to_cpu (info->num_clusters); + qcom_socinfo->info.ncluster_array_offset =__le32_to_cpu (info->ncluster_array_offset); + qcom_socinfo->info.num_defective_parts =__le32_to_cpu (info->num_defective_parts); + qcom_socinfo->info.ndefective_parts_array_offset =__le32_to_cpu (info->ndefective_parts_array_offset); + +debugfs_create_u32 ("num_clusters" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.num_clusters); +debugfs_create_u32 ("ncluster_array_offset" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.ncluster_array_offset); +debugfs_create_u32 ("num_defective_parts" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.num_defective_parts); +debugfs_create_u32 ("ndefective_parts_array_offset" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.ndefective_parts_array_offset); +/* Fall through */ +case SOCINFO_VERSION (0 ,13 ): + qcom_socinfo->info.nproduct_id =__le32_to_cpu (info->nproduct_id); + +debugfs_create_u32 ("nproduct_id" ,0400 , qcom_socinfo->dbg_root, + &qcom_socinfo->info.nproduct_id); +DEBUGFS_ADD (info, chip_id); +/* Fall through */ case SOCINFO_VERSION (0 ,12 ): qcom_socinfo->info.chip_family =__le32_to_cpu (info->chip_family);Signature · 1 line
2.26.2
Quoted 7 lines · Bjorn Andersson
Quoted 2 lines · Dmitry Baryshkov
Add support for newer Qualcomm SoC info structures (up to version 0.15).
Reviewed-by Bjorn Andersson <[email protected]>
Gratuitous ping for these four patches.
Signature · 2 lines
With best wishes Dmitry
Quoted 12 lines · Dmitry Baryshkov
Quoted 7 lines · Bjorn Andersson
Quoted 2 lines · Dmitry Baryshkov
Add support for newer Qualcomm SoC info structures (up to version 0.15).
Reviewed-by Bjorn Andersson <[email protected]>Gratuitous ping for these four patches.
Thanks for the ping, series now applied.