* [PATCH v5 2/5] soc: qcom: smem: Switch to EXPORT_SYMBOL_GPL()
2023-05-26 20:47 [PATCH v5 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header Robert Marko
@ 2023-05-26 20:47 ` Robert Marko
2023-05-26 20:48 ` [PATCH v5 3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id() Robert Marko
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Robert Marko @ 2023-05-26 20:47 UTC (permalink / raw)
To: agross, andersson, konrad.dybcio, ilia.lin, rafael, viresh.kumar,
linux-kernel, linux-arm-msm, linux-pm
Cc: ansuelsmth, Robert Marko, Trilok Soni
SMEM has been GPL licensed from the start, and there is no reason to use
EXPORT_SYMBOL() so switch to the GPL version.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Trilok Soni <quic_tsoni@quicinc.com>
---
drivers/soc/qcom/smem.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index 6be7ea93c78c..bc98520c4969 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -500,7 +500,7 @@ int qcom_smem_alloc(unsigned host, unsigned item, size_t size)
return ret;
}
-EXPORT_SYMBOL(qcom_smem_alloc);
+EXPORT_SYMBOL_GPL(qcom_smem_alloc);
static void *qcom_smem_get_global(struct qcom_smem *smem,
unsigned item,
@@ -674,7 +674,7 @@ void *qcom_smem_get(unsigned host, unsigned item, size_t *size)
return ptr;
}
-EXPORT_SYMBOL(qcom_smem_get);
+EXPORT_SYMBOL_GPL(qcom_smem_get);
/**
* qcom_smem_get_free_space() - retrieve amount of free space in a partition
@@ -719,7 +719,7 @@ int qcom_smem_get_free_space(unsigned host)
return ret;
}
-EXPORT_SYMBOL(qcom_smem_get_free_space);
+EXPORT_SYMBOL_GPL(qcom_smem_get_free_space);
static bool addr_in_range(void __iomem *base, size_t size, void *addr)
{
@@ -770,7 +770,7 @@ phys_addr_t qcom_smem_virt_to_phys(void *p)
return 0;
}
-EXPORT_SYMBOL(qcom_smem_virt_to_phys);
+EXPORT_SYMBOL_GPL(qcom_smem_virt_to_phys);
static int qcom_smem_get_sbl_version(struct qcom_smem *smem)
{
--
2.40.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v5 3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id()
2023-05-26 20:47 [PATCH v5 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header Robert Marko
2023-05-26 20:47 ` [PATCH v5 2/5] soc: qcom: smem: Switch to EXPORT_SYMBOL_GPL() Robert Marko
@ 2023-05-26 20:48 ` Robert Marko
2023-05-26 21:05 ` Konrad Dybcio
2023-05-27 3:58 ` Kathiravan T
2023-05-26 20:48 ` [PATCH v5 4/5] cpufreq: qcom-nvmem: use SoC ID-s from bindings Robert Marko
` (2 subsequent siblings)
4 siblings, 2 replies; 9+ messages in thread
From: Robert Marko @ 2023-05-26 20:48 UTC (permalink / raw)
To: agross, andersson, konrad.dybcio, ilia.lin, rafael, viresh.kumar,
linux-kernel, linux-arm-msm, linux-pm
Cc: ansuelsmth, Robert Marko
Introduce a helper to return the SoC SMEM ID, which is used to identify the
exact SoC model as there may be differences in the same SoC family.
Currently, cpufreq-nvmem does this completely in the driver and there has
been more interest expresed for other drivers to use this information so
lets expose a common helper to prevent redoing it in individual drivers
since this field is present on every SMEM table version.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
Changes in v5:
* Convert the __le32 ID to CPU endinaness
Changes in v4:
* Change helper name to qcom_smem_get_soc_id()
* Remove len and just pass NULL, that is sufficient here
Changes in v3:
* Change export to EXPORT_SYMBOL_GPL
* Use an argument for returning SoC ID
* Update kerneldoc
---
drivers/soc/qcom/smem.c | 23 +++++++++++++++++++++++
include/linux/soc/qcom/smem.h | 2 ++
2 files changed, 25 insertions(+)
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index bc98520c4969..b0d59e815c3b 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -14,6 +14,7 @@
#include <linux/sizes.h>
#include <linux/slab.h>
#include <linux/soc/qcom/smem.h>
+#include <linux/soc/qcom/socinfo.h>
/*
* The Qualcomm shared memory system is a allocate only heap structure that
@@ -772,6 +773,28 @@ phys_addr_t qcom_smem_virt_to_phys(void *p)
}
EXPORT_SYMBOL_GPL(qcom_smem_virt_to_phys);
+/**
+ * qcom_smem_get_soc_id() - return the SoC ID
+ * @id: On success, we return the SoC ID here.
+ *
+ * Look up SoC ID from HW/SW build ID and return it.
+ *
+ * Return: 0 on success, negative errno on failure.
+ */
+int qcom_smem_get_soc_id(u32 *id)
+{
+ struct socinfo *info;
+
+ info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, NULL);
+ if (IS_ERR(info))
+ return PTR_ERR(info);
+
+ *id = __le32_to_cpu(info->id);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(qcom_smem_get_soc_id);
+
static int qcom_smem_get_sbl_version(struct qcom_smem *smem)
{
struct smem_header *header;
diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h
index 86e1b358688a..223db6a9c733 100644
--- a/include/linux/soc/qcom/smem.h
+++ b/include/linux/soc/qcom/smem.h
@@ -11,4 +11,6 @@ int qcom_smem_get_free_space(unsigned host);
phys_addr_t qcom_smem_virt_to_phys(void *p);
+int qcom_smem_get_soc_id(u32 *id);
+
#endif
--
2.40.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v5 3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id()
2023-05-26 20:48 ` [PATCH v5 3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id() Robert Marko
@ 2023-05-26 21:05 ` Konrad Dybcio
2023-05-27 3:58 ` Kathiravan T
1 sibling, 0 replies; 9+ messages in thread
From: Konrad Dybcio @ 2023-05-26 21:05 UTC (permalink / raw)
To: Robert Marko, agross, andersson, ilia.lin, rafael, viresh.kumar,
linux-kernel, linux-arm-msm, linux-pm
Cc: ansuelsmth
On 26.05.2023 22:48, Robert Marko wrote:
> Introduce a helper to return the SoC SMEM ID, which is used to identify the
> exact SoC model as there may be differences in the same SoC family.
>
> Currently, cpufreq-nvmem does this completely in the driver and there has
> been more interest expresed for other drivers to use this information so
> lets expose a common helper to prevent redoing it in individual drivers
> since this field is present on every SMEM table version.
>
> Signed-off-by: Robert Marko <robimarko@gmail.com>
> ---
> Changes in v5:
> * Convert the __le32 ID to CPU endinaness
Sorry for the confusion in my previous reviews.
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Konrad
>
> Changes in v4:
> * Change helper name to qcom_smem_get_soc_id()
> * Remove len and just pass NULL, that is sufficient here
>
> Changes in v3:
> * Change export to EXPORT_SYMBOL_GPL
> * Use an argument for returning SoC ID
> * Update kerneldoc
> ---
> drivers/soc/qcom/smem.c | 23 +++++++++++++++++++++++
> include/linux/soc/qcom/smem.h | 2 ++
> 2 files changed, 25 insertions(+)
>
> diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
> index bc98520c4969..b0d59e815c3b 100644
> --- a/drivers/soc/qcom/smem.c
> +++ b/drivers/soc/qcom/smem.c
> @@ -14,6 +14,7 @@
> #include <linux/sizes.h>
> #include <linux/slab.h>
> #include <linux/soc/qcom/smem.h>
> +#include <linux/soc/qcom/socinfo.h>
>
> /*
> * The Qualcomm shared memory system is a allocate only heap structure that
> @@ -772,6 +773,28 @@ phys_addr_t qcom_smem_virt_to_phys(void *p)
> }
> EXPORT_SYMBOL_GPL(qcom_smem_virt_to_phys);
>
> +/**
> + * qcom_smem_get_soc_id() - return the SoC ID
> + * @id: On success, we return the SoC ID here.
> + *
> + * Look up SoC ID from HW/SW build ID and return it.
> + *
> + * Return: 0 on success, negative errno on failure.
> + */
> +int qcom_smem_get_soc_id(u32 *id)
> +{
> + struct socinfo *info;
> +
> + info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, NULL);
> + if (IS_ERR(info))
> + return PTR_ERR(info);
> +
> + *id = __le32_to_cpu(info->id);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(qcom_smem_get_soc_id);
> +
> static int qcom_smem_get_sbl_version(struct qcom_smem *smem)
> {
> struct smem_header *header;
> diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h
> index 86e1b358688a..223db6a9c733 100644
> --- a/include/linux/soc/qcom/smem.h
> +++ b/include/linux/soc/qcom/smem.h
> @@ -11,4 +11,6 @@ int qcom_smem_get_free_space(unsigned host);
>
> phys_addr_t qcom_smem_virt_to_phys(void *p);
>
> +int qcom_smem_get_soc_id(u32 *id);
> +
> #endif
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v5 3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id()
2023-05-26 20:48 ` [PATCH v5 3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id() Robert Marko
2023-05-26 21:05 ` Konrad Dybcio
@ 2023-05-27 3:58 ` Kathiravan T
1 sibling, 0 replies; 9+ messages in thread
From: Kathiravan T @ 2023-05-27 3:58 UTC (permalink / raw)
To: Robert Marko, agross, andersson, konrad.dybcio, ilia.lin, rafael,
viresh.kumar, linux-kernel, linux-arm-msm, linux-pm
Cc: ansuelsmth
On 5/27/2023 2:18 AM, Robert Marko wrote:
> Introduce a helper to return the SoC SMEM ID, which is used to identify the
> exact SoC model as there may be differences in the same SoC family.
>
> Currently, cpufreq-nvmem does this completely in the driver and there has
> been more interest expresed for other drivers to use this information so
> lets expose a common helper to prevent redoing it in individual drivers
> since this field is present on every SMEM table version.
LGTM,
Reviewed-by: Kathiravan T <quic_kathirav@quicinc.com>
>
> Signed-off-by: Robert Marko <robimarko@gmail.com>
> ---
> Changes in v5:
> * Convert the __le32 ID to CPU endinaness
>
> Changes in v4:
> * Change helper name to qcom_smem_get_soc_id()
> * Remove len and just pass NULL, that is sufficient here
>
> Changes in v3:
> * Change export to EXPORT_SYMBOL_GPL
> * Use an argument for returning SoC ID
> * Update kerneldoc
> ---
> drivers/soc/qcom/smem.c | 23 +++++++++++++++++++++++
> include/linux/soc/qcom/smem.h | 2 ++
> 2 files changed, 25 insertions(+)
>
> diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
> index bc98520c4969..b0d59e815c3b 100644
> --- a/drivers/soc/qcom/smem.c
> +++ b/drivers/soc/qcom/smem.c
> @@ -14,6 +14,7 @@
> #include <linux/sizes.h>
> #include <linux/slab.h>
> #include <linux/soc/qcom/smem.h>
> +#include <linux/soc/qcom/socinfo.h>
>
> /*
> * The Qualcomm shared memory system is a allocate only heap structure that
> @@ -772,6 +773,28 @@ phys_addr_t qcom_smem_virt_to_phys(void *p)
> }
> EXPORT_SYMBOL_GPL(qcom_smem_virt_to_phys);
>
> +/**
> + * qcom_smem_get_soc_id() - return the SoC ID
> + * @id: On success, we return the SoC ID here.
> + *
> + * Look up SoC ID from HW/SW build ID and return it.
> + *
> + * Return: 0 on success, negative errno on failure.
> + */
> +int qcom_smem_get_soc_id(u32 *id)
> +{
> + struct socinfo *info;
> +
> + info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, NULL);
> + if (IS_ERR(info))
> + return PTR_ERR(info);
> +
> + *id = __le32_to_cpu(info->id);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(qcom_smem_get_soc_id);
> +
> static int qcom_smem_get_sbl_version(struct qcom_smem *smem)
> {
> struct smem_header *header;
> diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h
> index 86e1b358688a..223db6a9c733 100644
> --- a/include/linux/soc/qcom/smem.h
> +++ b/include/linux/soc/qcom/smem.h
> @@ -11,4 +11,6 @@ int qcom_smem_get_free_space(unsigned host);
>
> phys_addr_t qcom_smem_virt_to_phys(void *p);
>
> +int qcom_smem_get_soc_id(u32 *id);
> +
> #endif
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v5 4/5] cpufreq: qcom-nvmem: use SoC ID-s from bindings
2023-05-26 20:47 [PATCH v5 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header Robert Marko
2023-05-26 20:47 ` [PATCH v5 2/5] soc: qcom: smem: Switch to EXPORT_SYMBOL_GPL() Robert Marko
2023-05-26 20:48 ` [PATCH v5 3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id() Robert Marko
@ 2023-05-26 20:48 ` Robert Marko
2023-05-26 20:48 ` [PATCH v5 5/5] cpufreq: qcom-nvmem: use helper to get SMEM SoC ID Robert Marko
2023-05-27 4:00 ` (subset) [PATCH v5 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header Bjorn Andersson
4 siblings, 0 replies; 9+ messages in thread
From: Robert Marko @ 2023-05-26 20:48 UTC (permalink / raw)
To: agross, andersson, konrad.dybcio, ilia.lin, rafael, viresh.kumar,
linux-kernel, linux-arm-msm, linux-pm
Cc: ansuelsmth, Robert Marko, Bjorn Andersson
SMEM SoC ID-s are now stored in DT bindings so lets use those instead of
defining them in the driver again.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/qcom-cpufreq-nvmem.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index a577586b23be..60e99be2d3db 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -31,12 +31,7 @@
#define MSM_ID_SMEM 137
-enum _msm_id {
- MSM8996V3 = 0xF6ul,
- APQ8096V3 = 0x123ul,
- MSM8996SG = 0x131ul,
- APQ8096SG = 0x138ul,
-};
+#include <dt-bindings/arm/qcom,ids.h>
enum _msm8996_version {
MSM8996_V3,
@@ -154,12 +149,12 @@ static enum _msm8996_version qcom_cpufreq_get_msm_id(void)
msm_id++;
switch ((enum _msm_id)*msm_id) {
- case MSM8996V3:
- case APQ8096V3:
+ case QCOM_ID_MSM8996:
+ case QCOM_ID_APQ8096:
version = MSM8996_V3;
break;
- case MSM8996SG:
- case APQ8096SG:
+ case QCOM_ID_MSM8996SG:
+ case QCOM_ID_APQ8096SG:
version = MSM8996_SG;
break;
default:
--
2.40.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v5 5/5] cpufreq: qcom-nvmem: use helper to get SMEM SoC ID
2023-05-26 20:47 [PATCH v5 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header Robert Marko
` (2 preceding siblings ...)
2023-05-26 20:48 ` [PATCH v5 4/5] cpufreq: qcom-nvmem: use SoC ID-s from bindings Robert Marko
@ 2023-05-26 20:48 ` Robert Marko
2023-05-26 21:06 ` Konrad Dybcio
2023-05-27 4:00 ` (subset) [PATCH v5 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header Bjorn Andersson
4 siblings, 1 reply; 9+ messages in thread
From: Robert Marko @ 2023-05-26 20:48 UTC (permalink / raw)
To: agross, andersson, konrad.dybcio, ilia.lin, rafael, viresh.kumar,
linux-kernel, linux-arm-msm, linux-pm
Cc: ansuelsmth, Robert Marko
Now that SMEM exports a helper to get the SMEM SoC ID lets utilize it.
Currently qcom_cpufreq_get_msm_id() is encoding the returned SMEM SoC ID
into an enum, however there is no reason to do so and we can just match
directly on the SMEM SoC ID as returned by qcom_smem_get_soc_id().
Signed-off-by: Robert Marko <robimarko@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
Changes in v4:
* Adapt to name change to qcom_smem_get_soc_id()
Changes in v3:
* Adapt to helper using argument now
Changes in v2:
* Utilize helper exported by SMEM instead of refactoring
qcom_cpufreq_get_msm_id()
---
drivers/cpufreq/qcom-cpufreq-nvmem.c | 56 +++++-----------------------
1 file changed, 10 insertions(+), 46 deletions(-)
diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index 60e99be2d3db..a88b6fe5db50 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -29,16 +29,8 @@
#include <linux/slab.h>
#include <linux/soc/qcom/smem.h>
-#define MSM_ID_SMEM 137
-
#include <dt-bindings/arm/qcom,ids.h>
-enum _msm8996_version {
- MSM8996_V3,
- MSM8996_SG,
- NUM_OF_MSM8996_VERSIONS,
-};
-
struct qcom_cpufreq_drv;
struct qcom_cpufreq_match_data {
@@ -135,60 +127,32 @@ static void get_krait_bin_format_b(struct device *cpu_dev,
dev_dbg(cpu_dev, "PVS version: %d\n", *pvs_ver);
}
-static enum _msm8996_version qcom_cpufreq_get_msm_id(void)
-{
- size_t len;
- u32 *msm_id;
- enum _msm8996_version version;
-
- msm_id = qcom_smem_get(QCOM_SMEM_HOST_ANY, MSM_ID_SMEM, &len);
- if (IS_ERR(msm_id))
- return NUM_OF_MSM8996_VERSIONS;
-
- /* The first 4 bytes are format, next to them is the actual msm-id */
- msm_id++;
-
- switch ((enum _msm_id)*msm_id) {
- case QCOM_ID_MSM8996:
- case QCOM_ID_APQ8096:
- version = MSM8996_V3;
- break;
- case QCOM_ID_MSM8996SG:
- case QCOM_ID_APQ8096SG:
- version = MSM8996_SG;
- break;
- default:
- version = NUM_OF_MSM8996_VERSIONS;
- }
-
- return version;
-}
-
static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev,
struct nvmem_cell *speedbin_nvmem,
char **pvs_name,
struct qcom_cpufreq_drv *drv)
{
size_t len;
+ u32 msm_id;
u8 *speedbin;
- enum _msm8996_version msm8996_version;
+ int ret;
*pvs_name = NULL;
- msm8996_version = qcom_cpufreq_get_msm_id();
- if (NUM_OF_MSM8996_VERSIONS == msm8996_version) {
- dev_err(cpu_dev, "Not Snapdragon 820/821!");
- return -ENODEV;
- }
+ ret = qcom_smem_get_soc_id(&msm_id);
+ if (ret)
+ return ret;
speedbin = nvmem_cell_read(speedbin_nvmem, &len);
if (IS_ERR(speedbin))
return PTR_ERR(speedbin);
- switch (msm8996_version) {
- case MSM8996_V3:
+ switch (msm_id) {
+ case QCOM_ID_MSM8996:
+ case QCOM_ID_APQ8096:
drv->versions = 1 << (unsigned int)(*speedbin);
break;
- case MSM8996_SG:
+ case QCOM_ID_MSM8996SG:
+ case QCOM_ID_APQ8096SG:
drv->versions = 1 << ((unsigned int)(*speedbin) + 4);
break;
default:
--
2.40.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v5 5/5] cpufreq: qcom-nvmem: use helper to get SMEM SoC ID
2023-05-26 20:48 ` [PATCH v5 5/5] cpufreq: qcom-nvmem: use helper to get SMEM SoC ID Robert Marko
@ 2023-05-26 21:06 ` Konrad Dybcio
0 siblings, 0 replies; 9+ messages in thread
From: Konrad Dybcio @ 2023-05-26 21:06 UTC (permalink / raw)
To: Robert Marko, agross, andersson, ilia.lin, rafael, viresh.kumar,
linux-kernel, linux-arm-msm, linux-pm
Cc: ansuelsmth
On 26.05.2023 22:48, Robert Marko wrote:
> Now that SMEM exports a helper to get the SMEM SoC ID lets utilize it.
> Currently qcom_cpufreq_get_msm_id() is encoding the returned SMEM SoC ID
> into an enum, however there is no reason to do so and we can just match
> directly on the SMEM SoC ID as returned by qcom_smem_get_soc_id().
>
> Signed-off-by: Robert Marko <robimarko@gmail.com>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> Changes in v4:
> * Adapt to name change to qcom_smem_get_soc_id()
>
> Changes in v3:
> * Adapt to helper using argument now
>
> Changes in v2:
> * Utilize helper exported by SMEM instead of refactoring
> qcom_cpufreq_get_msm_id()
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Konrad
> drivers/cpufreq/qcom-cpufreq-nvmem.c | 56 +++++-----------------------
> 1 file changed, 10 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> index 60e99be2d3db..a88b6fe5db50 100644
> --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
> +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> @@ -29,16 +29,8 @@
> #include <linux/slab.h>
> #include <linux/soc/qcom/smem.h>
>
> -#define MSM_ID_SMEM 137
> -
> #include <dt-bindings/arm/qcom,ids.h>
>
> -enum _msm8996_version {
> - MSM8996_V3,
> - MSM8996_SG,
> - NUM_OF_MSM8996_VERSIONS,
> -};
> -
> struct qcom_cpufreq_drv;
>
> struct qcom_cpufreq_match_data {
> @@ -135,60 +127,32 @@ static void get_krait_bin_format_b(struct device *cpu_dev,
> dev_dbg(cpu_dev, "PVS version: %d\n", *pvs_ver);
> }
>
> -static enum _msm8996_version qcom_cpufreq_get_msm_id(void)
> -{
> - size_t len;
> - u32 *msm_id;
> - enum _msm8996_version version;
> -
> - msm_id = qcom_smem_get(QCOM_SMEM_HOST_ANY, MSM_ID_SMEM, &len);
> - if (IS_ERR(msm_id))
> - return NUM_OF_MSM8996_VERSIONS;
> -
> - /* The first 4 bytes are format, next to them is the actual msm-id */
> - msm_id++;
> -
> - switch ((enum _msm_id)*msm_id) {
> - case QCOM_ID_MSM8996:
> - case QCOM_ID_APQ8096:
> - version = MSM8996_V3;
> - break;
> - case QCOM_ID_MSM8996SG:
> - case QCOM_ID_APQ8096SG:
> - version = MSM8996_SG;
> - break;
> - default:
> - version = NUM_OF_MSM8996_VERSIONS;
> - }
> -
> - return version;
> -}
> -
> static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev,
> struct nvmem_cell *speedbin_nvmem,
> char **pvs_name,
> struct qcom_cpufreq_drv *drv)
> {
> size_t len;
> + u32 msm_id;
> u8 *speedbin;
> - enum _msm8996_version msm8996_version;
> + int ret;
> *pvs_name = NULL;
>
> - msm8996_version = qcom_cpufreq_get_msm_id();
> - if (NUM_OF_MSM8996_VERSIONS == msm8996_version) {
> - dev_err(cpu_dev, "Not Snapdragon 820/821!");
> - return -ENODEV;
> - }
> + ret = qcom_smem_get_soc_id(&msm_id);
> + if (ret)
> + return ret;
>
> speedbin = nvmem_cell_read(speedbin_nvmem, &len);
> if (IS_ERR(speedbin))
> return PTR_ERR(speedbin);
>
> - switch (msm8996_version) {
> - case MSM8996_V3:
> + switch (msm_id) {
> + case QCOM_ID_MSM8996:
> + case QCOM_ID_APQ8096:
> drv->versions = 1 << (unsigned int)(*speedbin);
> break;
> - case MSM8996_SG:
> + case QCOM_ID_MSM8996SG:
> + case QCOM_ID_APQ8096SG:
> drv->versions = 1 << ((unsigned int)(*speedbin) + 4);
> break;
> default:
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: (subset) [PATCH v5 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header
2023-05-26 20:47 [PATCH v5 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header Robert Marko
` (3 preceding siblings ...)
2023-05-26 20:48 ` [PATCH v5 5/5] cpufreq: qcom-nvmem: use helper to get SMEM SoC ID Robert Marko
@ 2023-05-27 4:00 ` Bjorn Andersson
4 siblings, 0 replies; 9+ messages in thread
From: Bjorn Andersson @ 2023-05-27 4:00 UTC (permalink / raw)
To: linux-pm, konrad.dybcio, viresh.kumar, ilia.lin, rafael,
linux-kernel, linux-arm-msm, Robert Marko, agross
Cc: ansuelsmth
On Fri, 26 May 2023 22:47:58 +0200, Robert Marko wrote:
> Move SMEM item struct and related defines to a header in order to be able
> to reuse them in the SMEM driver instead of duplicating them.
>
>
Applied, thanks!
[1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header
commit: ec001bb71e4476f7f5be9db693d5f43e65b9d8cb
[2/5] soc: qcom: smem: Switch to EXPORT_SYMBOL_GPL()
commit: 10615007483b6938da9df290fe5bf460f6a07c60
[3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id()
commit: 17051d2c3cd696439adb900e9af547ba162fb982
[4/5] cpufreq: qcom-nvmem: use SoC ID-s from bindings
commit: 865d7e719262e9845a3c847040fbd4d84c8b5bd9
[5/5] cpufreq: qcom-nvmem: use helper to get SMEM SoC ID
commit: 7d0f03d104e576da2a7689d0eb8560c67efc03ff
Best regards,
--
Bjorn Andersson <andersson@kernel.org>
^ permalink raw reply [flat|nested] 9+ messages in thread