Skip to content

Commit 1e210f4

Browse files
committed
Merge remote-tracking branch 'qcom/[email protected]' into msm-next-robclark
Merge qcom drivers to pick up dependency for SMEM based speedbin. Signed-off-by: Rob Clark <[email protected]>
2 parents 399af57 + 81bbb2b commit 1e210f4

File tree

4 files changed

+68
-8
lines changed

4 files changed

+68
-8
lines changed

drivers/soc/qcom/smem.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,39 @@ int qcom_smem_get_soc_id(u32 *id)
795795
}
796796
EXPORT_SYMBOL_GPL(qcom_smem_get_soc_id);
797797

798+
/**
799+
* qcom_smem_get_feature_code() - return the feature code
800+
* @code: On success, return the feature code here.
801+
*
802+
* Look up the feature code identifier from SMEM and return it.
803+
*
804+
* Return: 0 on success, negative errno on failure.
805+
*/
806+
int qcom_smem_get_feature_code(u32 *code)
807+
{
808+
struct socinfo *info;
809+
u32 raw_code;
810+
811+
info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, NULL);
812+
if (IS_ERR(info))
813+
return PTR_ERR(info);
814+
815+
/* This only makes sense for socinfo >= 16 */
816+
if (__le32_to_cpu(info->fmt) < SOCINFO_VERSION(0, 16))
817+
return -EOPNOTSUPP;
818+
819+
raw_code = __le32_to_cpu(info->feature_code);
820+
821+
/* Ensure the value makes sense */
822+
if (raw_code > SOCINFO_FC_INT_MAX)
823+
raw_code = SOCINFO_FC_UNKNOWN;
824+
825+
*code = raw_code;
826+
827+
return 0;
828+
}
829+
EXPORT_SYMBOL_GPL(qcom_smem_get_feature_code);
830+
798831
static int qcom_smem_get_sbl_version(struct qcom_smem *smem)
799832
{
800833
struct smem_header *header;

drivers/soc/qcom/socinfo.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@
2121

2222
#include <dt-bindings/arm/qcom,ids.h>
2323

24-
/*
25-
* SoC version type with major number in the upper 16 bits and minor
26-
* number in the lower 16 bits.
27-
*/
28-
#define SOCINFO_MAJOR(ver) (((ver) >> 16) & 0xffff)
29-
#define SOCINFO_MINOR(ver) ((ver) & 0xffff)
30-
#define SOCINFO_VERSION(maj, min) ((((maj) & 0xffff) << 16)|((min) & 0xffff))
31-
3224
/* Helper macros to create soc_id table */
3325
#define qcom_board_id(id) QCOM_ID_ ## id, __stringify(id)
3426
#define qcom_board_id_named(id, name) QCOM_ID_ ## id, (name)

include/linux/soc/qcom/smem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ int qcom_smem_get_free_space(unsigned host);
1313
phys_addr_t qcom_smem_virt_to_phys(void *p);
1414

1515
int qcom_smem_get_soc_id(u32 *id);
16+
int qcom_smem_get_feature_code(u32 *code);
1617

1718
#endif

include/linux/soc/qcom/socinfo.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#ifndef __QCOM_SOCINFO_H__
44
#define __QCOM_SOCINFO_H__
55

6+
#include <linux/types.h>
7+
68
/*
79
* SMEM item id, used to acquire handles to respective
810
* SMEM region.
@@ -12,6 +14,14 @@
1214
#define SMEM_SOCINFO_BUILD_ID_LENGTH 32
1315
#define SMEM_SOCINFO_CHIP_ID_LENGTH 32
1416

17+
/*
18+
* SoC version type with major number in the upper 16 bits and minor
19+
* number in the lower 16 bits.
20+
*/
21+
#define SOCINFO_MAJOR(ver) (((ver) >> 16) & 0xffff)
22+
#define SOCINFO_MINOR(ver) ((ver) & 0xffff)
23+
#define SOCINFO_VERSION(maj, min) ((((maj) & 0xffff) << 16)|((min) & 0xffff))
24+
1525
/* Socinfo SMEM item structure */
1626
struct socinfo {
1727
__le32 fmt;
@@ -74,4 +84,28 @@ struct socinfo {
7484
__le32 boot_core;
7585
};
7686

87+
/* Internal feature codes */
88+
enum qcom_socinfo_feature_code {
89+
/* External feature codes */
90+
SOCINFO_FC_UNKNOWN = 0x0,
91+
SOCINFO_FC_AA,
92+
SOCINFO_FC_AB,
93+
SOCINFO_FC_AC,
94+
SOCINFO_FC_AD,
95+
SOCINFO_FC_AE,
96+
SOCINFO_FC_AF,
97+
SOCINFO_FC_AG,
98+
SOCINFO_FC_AH,
99+
};
100+
101+
/* Internal feature codes */
102+
/* Valid values: 0 <= n <= 0xf */
103+
#define SOCINFO_FC_Yn(n) (0xf1 + (n))
104+
#define SOCINFO_FC_INT_MAX SOCINFO_FC_Yn(0xf)
105+
106+
/* Product codes */
107+
#define SOCINFO_PC_UNKNOWN 0
108+
#define SOCINFO_PCn(n) ((n) + 1)
109+
#define SOCINFO_PC_RESERVE (BIT(31) - 1)
110+
77111
#endif

0 commit comments

Comments
 (0)