soc: qcom: Add SoC info driver
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v7 1/2 soc: qcom: Add SoC info driver
The SoC info driver provides information such as Chip ID, Chip family, serial number and other such details about Qualcomm SoCs to user space, so that if needed some user space utility(like antutu) can query such information using sysfs interface.
---
v6 --> v7:
- Some minor style changes
- Rather than showing string for h/w types, just show the number obtained from SMEM. The reader of this number is supposed to parse this into a human readable string as this information may be different for different ODMs
- Create an attribute 'qcom_odm' depending on the presence of corresponding property in SMEM DT entry. This information can be used for ODM specific interpretation of SMEM socinfo content
- Read machine value from DT, rather than using soc-id as index in an ever increasing array of machine names
v5 --> v6:
- use dev_ext_attribute to represent SMEM image items
- Avoid redundant function calls
- Avoid use of unnecessary global variables
- Remove redundant enums
- Avoid redundant checking of socinfo being NULL or not
- Avoid redundant checking of socinfo format version
- Rename show/store function of attributes as _show/_store rather than _get/_set
- Use an array to represent socinfo attributes and create attribute files in a loop depending on the minimum socinfo format version for which these attributes are supported
- if obtained socinfo format version is greater than the maximum known version return an error rather than falling back to maximum known version
v4 --> v5:
- Removed redundant function socinfo_print
v3 --> v4:
- Corrected makefile so that smem and socinfo are treated as one module
- Moved the code snippet to get socinfo smem item into socinfo.c
- Removed redundant use of socinfo major version as it is always zero
- Removed unused enums
- Removed redundant indirections
- Use image_version object to store information about each entry in the smem image table
- Replaced usage of snprintf with sprintf and scnprintf
- Get the address of image version table at the beginning and setup image version attributes only if image version table is available
- Do the same for platform_subtype
- Make different type of image version objects read only or readable/ writable depending on their types. For example apps image attributes can be modified via sysfs but the same can't be done for modem image
- Show PMIC model in a human readable form rather than a numeric number
- Avoid using table in single sysfs entry
- Removed checkpatch warnings about S_IRUGO
v2 --> v3:
- Add support to toss soc information data into entropy pool
- Since socinfo is rolled into smem driver, compile the relevant portion of socinfo driver with smem driver
v1 --> v2:
- Removed inclusion of system_misc.h
- merged socinfo.h into socinfo.c
- made platform type and subtype arrays static
- replaced uint32_t with u32
- made functions static to avoid exposing vendor specific interface
- Replaced usage of IS_ERR_OR_NULL with IS_ERR.
- Remove raw-id attribute usage as human readable soc-id will suffice here
- Avoid using a separate platform driver for socinfo by rolling it into smem driver itself. The sysfs setup is being done in a separate file (socinfo.c)
- Replaced macro BUILD_ID_LENGTH with SMEM_SOCINFO_BUILD_ID_LENGTH.
- For failure cases where socinfo can not be read use a single dummy socinfo with error values.
- Removed usage of early_machine_is_xxx.
drivers/soc/qcom/Kconfig | 1 + drivers/soc/qcom/Makefile | 3 +- drivers/soc/qcom/smem.c | 5 + drivers/soc/qcom/socinfo.c | 514 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 522 insertions(+), 1 deletion(-) create mode 100644 drivers/soc/qcom/socinfo.c
drivers/soc/qcom/Kconfig +1 -0
@@ -24,6 +24,7 @@ config QCOM_SMEM tristate "Qualcomm Shared Memory Manager (SMEM)" depends on ARCH_QCOM depends on HWSPINLOCK + select SOC_BUS help Say y here to enable support for the Qualcomm Shared Memory Manager. The driver provides an interface to items in a heap shared among all
drivers/soc/qcom/Makefile +2 -1
@@ -2,7 +2,8 @@ obj-$(CONFIG_QCOM_GSBI) += qcom_gsbi.o obj-$(CONFIG_QCOM_PM) += spm.o obj-$(CONFIG_QCOM_SMD) += smd.o obj-$(CONFIG_QCOM_SMD_RPM) += smd-rpm.o -obj-$(CONFIG_QCOM_SMEM) += smem.o +obj-$(CONFIG_QCOM_SMEM) += qcom_smem.o +qcom_smem-y := smem.o socinfo.o obj-$(CONFIG_QCOM_SMEM_STATE) += smem_state.o obj-$(CONFIG_QCOM_SMP2P) += smp2p.o obj-$(CONFIG_QCOM_SMSM) += smsm.o
drivers/soc/qcom/smem.c +5 -0
@@ -85,6 +85,9 @@/* Max number of processors/hosts in a system */ #define SMEM_HOST_COUNT 9 + +extern void qcom_socinfo_init (struct platform_device *pdev); +/** * struct smem_proc_comm - proc_comm communication struct (legacy) * @command: current command to be executed
@@ -751,6 +754,8 @@ static int qcom_smem_probe(struct platform_device *pdev) __smem = smem; +qcom_socinfo_init (&pdev->dev); +return 0 ; }
drivers/soc/qcom/socinfo.c new file +514 -0
514 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
kbuild test robot
build boturl: https://github.com/0day-ci/linux/commits/Imran-Khan/soc-qcom-Add-SoC-info-driver/20170104-025038 config: arm64-defconfig (attached as .config) compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9)…
Hi Imran,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.10-rc2 next-20170103]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Imran-Khan/soc-qcom-Add-SoC-info-driver/20170104-025038
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64
All error/warnings (new ones prefixed by >>):
drivers/soc/qcom/smem.c: In function 'qcom_smem_probe':
>> drivers/soc/qcom/smem.c:757:20: error: passing argument 1 of 'qcom_socinfo_init' from incompatible pointer type [-Werror=incompatible-pointer-types]
qcom_socinfo_init(&pdev->dev);
^
drivers/soc/qcom/smem.c:89:13: note: expected 'struct platform_device *' but argument is of type 'struct device *'
extern void qcom_socinfo_init(struct platform_device *pdev);
^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
drivers/soc/qcom/socinfo.c: In function 'qcom_socinfo_init':
>> drivers/soc/qcom/socinfo.c:498:5: warning: ignoring return value of 'sysfs_create_group', declared with attribute warn_unused_result [-Wunused-result]
sysfs_create_group(&dev->kobj, smem_img_tbl[i]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~vim +/qcom_socinfo_init +757 drivers/soc/qcom/smem.c
751 smem->hwlock = hwspin_lock_request_specific(hwlock_id);
752 if (!smem->hwlock)
753 return -ENXIO;
754
755 __smem = smem;
756
> 757 qcom_socinfo_init(&pdev->dev);
758
759 return 0;
760 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH v7 2/2 Documentation/ABI: Add ABI information for QCOM socinfo driver
In reply to a message not in the archiveThe socinfo ABI document describes the information provided by socinfo driver and the corresponding attributes to access that information.
--- Documentation/ABI/stable/sysfs-driver-qcom_socinfo | 147 +++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 Documentation/ABI/stable/sysfs-driver-qcom_socinfo
Documentation/ABI/stable/sysfs-driver-qcom_socinfo new file +147 -0
@@ -0,0 +1,147 @@ +What: /sys/devices/soc0/accessory_chip +Date: January 2017 +Description: + This file shows the id of the accessory chip. + +What: /sys/devices/soc0/adsp_image_crm +What: /sys/devices/soc0/adsp_image_variant +What: /sys/devices/soc0/adsp_image_version +Date: January 2017 +Description: + These files respectively show the crm version, variant and + version of the ADSP image. + +What: /sys/devices/soc0/apps_image_crm +What: /sys/devices/soc0/apps_image_variant +What: /sys/devices/soc0/apps_image_version +Date: January 2017 +Description: + These files respectively show the crm version, variant and + version of the APPS(Linux kernel, rootfs) image. + +What: /sys/devices/soc0/boot_image_crm +What: /sys/devices/soc0/boot_image_variant +What: /sys/devices/soc0/boot_image_version +Date: January 2017 +Description: + These files respectively show the crm version, variant and + version of the Boot(bootloader) image. + +What: /sys/devices/soc0/build_id +Date: January 2017 +Description: + This file shows the unique id of current build being used on + the system. + +What: /sys/devices/soc0/cnss_image_crm +What: /sys/devices/soc0/cnss_image_variant +What: /sys/devices/soc0/cnss_image_version +Date: January 2017 +Description: + These files respectively show the crm version, variant and + version of the CNSS image. + +What: /sys/devices/soc0/family +Date: January 2017 +Description: + This file shows the family(e.g Snapdragon) of the SoC. + +What: /sys/devices/soc0/foundry_id +Date: January 2017 +Description: + This file shows the id of the foundry, where soc was + manufactured. + +What: /sys/devices/soc0/hw_platform +Date: January 2017 +Description: + This file shows the type of hardware platform + (e.g MTP, QRD etc) where SoC is being used. + +What: /sys/devices/soc0/machine +Date: January 2017 +Description: + This file shows the machine name as given in the DT. + +What: /sys/devices/soc0/mpss_image_crm +What: /sys/devices/soc0/mpss_image_variant +What: /sys/devices/soc0/mpss_image_version +Date: January 2017 +Description: + These files respectively show the crm version, variant and + version of the MPSS image. + +What: /sys/devices/soc0/platform_subtype +Date: January 2017 +Description: + This file shows the sub-type of hardware platform + (SKUAA, SKUF etc.) where SoC is being used. + +What: /sys/devices/soc0/platform_version +Date: January 2017 +Description: + This file show the version of the hardware platform. + +What: /sys/devices/soc0/pmic_die_revision +Date: January 2017 +Description: + This file shows revision of PMIC die. + +What: /sys/devices/soc0/pmic_model +Date: January 2017 +Description: + This file shows name of PMIC model. + +What: /sys/devices/soc0/qcom_odm +Date: January 2017 +Description: + This file shows the ODM using the SoC. + +What: /sys/devices/soc0/raw_version +Date: January 2017 +Description: + This file shows raw version of the SoC. + +What: /sys/devices/soc0/revision +Date: January 2017 +Description: + This file shows revision of the SoC. + +What: /sys/devices/soc0/rpm_image_crm +What: /sys/devices/soc0/rpm_image_variant +What: /sys/devices/soc0/rpm_image_version +Date: January 2017 +Description: + These files respectively show the crm version, variant and + version of the RPM image. + +What: /sys/devices/soc0/serial_number +Date: January 2017 +Description: + This file shows serial number of the SoC. + +What: /sys/devices/soc0/soc_id +Date: January 2017 +Description: + This file shows the unique numeric id of a Qualcomm SoC. + +What: /sys/devices/soc0/tz_image_crm +What: /sys/devices/soc0/tz_image_variant +What: /sys/devices/soc0/tz_image_version +Date: January 2017 +Description: + These files respectively show the crm version, variant and + version of the TZ image. + +What: /sys/devices/soc0/vendor +Date: January 2017 +Description: + This file shows the vendor of the SoC. + +What: /sys/devices/soc0/video_image_crm +What: /sys/devices/soc0/video_image_variant +What: /sys/devices/soc0/video_image_version +Date: January 2017 +Description: + These files respectively show the crm version, variant and + version of the video image.
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project