mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 08:07:32 -04:00
modules: mmi_info: use smem.c, delete socinfo
Use the smem.c modules to access shared memory, qcom has removed the msm_smem.c api. Also delete socinfo. It requires too many exports in the kernel and l(CR) won't be missed. Change-Id: Icd31bf4862b45758ced4c98f7fe35112a092b56e Signed-off-by: Ryan Lattrel <ryanl@motorola.com> Reviewed-on: https://gerrit.mot.com/1201411 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Kenneth Kessler <kennykessler@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
208ec3f1d6
commit
e88aad3983
6 changed files with 45 additions and 107 deletions
|
|
@ -2,7 +2,6 @@
|
|||
EXTRA_CFLAGS += -Wall
|
||||
EXTRA_CFLAGS += -I$(TOP)/motorola/kernel/modules/include
|
||||
|
||||
mmi_info-objs += mmi_soc_info.o
|
||||
mmi_info-objs += mmi_storage_info.o
|
||||
mmi_info-objs += mmi_ram_info.o
|
||||
mmi_info-objs += mmi_unit_info.o
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
int mmi_storage_info_init(void);
|
||||
void mmi_storage_info_exit(void);
|
||||
int mmi_soc_info_init(void);
|
||||
void mmi_soc_info_exit(void);
|
||||
int mmi_ram_info_init(void);
|
||||
void mmi_ram_info_exit(void);
|
||||
int mmi_unit_info_init(void);
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ static int __init mmi_hw_info_init(void)
|
|||
{
|
||||
mmi_of_populate_setup();
|
||||
mmi_storage_info_init();
|
||||
mmi_soc_info_init();
|
||||
mmi_ram_info_init();
|
||||
mmi_unit_info_init();
|
||||
mmi_boot_info_init();
|
||||
|
|
@ -102,7 +101,6 @@ static int __init mmi_hw_info_init(void)
|
|||
static void mmi_hw_info_exit(void)
|
||||
{
|
||||
mmi_storage_info_exit();
|
||||
mmi_soc_info_exit();
|
||||
mmi_ram_info_exit();
|
||||
mmi_unit_info_exit();
|
||||
mmi_boot_info_exit();
|
||||
|
|
|
|||
|
|
@ -13,11 +13,20 @@
|
|||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <soc/qcom/smsm.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/mmi_annotate.h>
|
||||
#include "mmi_info.h"
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
|
||||
#include <linux/soc/qcom/smem.h>
|
||||
/* Match to
|
||||
* vendor/qcom/nonhlos/boot_images/QcomPkg/SDMPkg/Include/smem_type.h
|
||||
*/
|
||||
#define SMEM_SDRAM_INFO 135
|
||||
#else
|
||||
#include <soc/qcom/smsm.h>
|
||||
#define SMEM_SDRAM_INFO SMEM_ID_VENDOR1
|
||||
#endif
|
||||
|
||||
static struct {
|
||||
unsigned int mr5;
|
||||
|
|
@ -133,10 +142,20 @@ int mmi_ram_info_init(void)
|
|||
"Reserved"
|
||||
};
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
|
||||
ssize_t ddr_info_size;
|
||||
smem_ddr_info = qcom_smem_get(QCOM_SMEM_HOST_ANY,
|
||||
SMEM_SDRAM_INFO,
|
||||
&ddr_info_size);
|
||||
|
||||
if (smem_ddr_info != NULL &&
|
||||
sizeof(*smem_ddr_info) == ddr_info_size) {
|
||||
#else
|
||||
smem_ddr_info = smem_alloc(SMEM_SDRAM_INFO, sizeof(*smem_ddr_info), 0,
|
||||
SMEM_ANY_HOST_FLAG);
|
||||
|
||||
if (smem_ddr_info != NULL) {
|
||||
#endif
|
||||
/* identify vendor */
|
||||
vid = smem_ddr_info->mr5 & 0xFF;
|
||||
if (vid < ARRAY_SIZE(vendors))
|
||||
|
|
|
|||
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013 - 2015 Motorola Mobility LLC
|
||||
* Copyright (C) 2018 Motorola Mobility LLC
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <soc/qcom/socinfo.h>
|
||||
#include <linux/mmi_annotate.h>
|
||||
#include "mmi_info.h"
|
||||
|
||||
static ssize_t version_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, 32, "%u.%u\n",
|
||||
SOCINFO_VERSION_MAJOR(socinfo_get_version()),
|
||||
SOCINFO_VERSION_MINOR(socinfo_get_version()));
|
||||
}
|
||||
|
||||
SYSFS_SIMPLE_SHOW(id, socinfo_get_id(), "%u", 32)
|
||||
SYSFS_SIMPLE_SHOW(raw_id, socinfo_get_raw_id(), "%u", 32)
|
||||
SYSFS_SIMPLE_SHOW(raw_version, socinfo_get_raw_version(), "%u", 32)
|
||||
SYSFS_SIMPLE_SHOW(platform_type, socinfo_get_platform_type(), "%u", 32)
|
||||
SYSFS_SIMPLE_SHOW(platform_version, socinfo_get_platform_version(), "%u", 32)
|
||||
SYSFS_SIMPLE_SHOW(platform_subtype, socinfo_get_platform_subtype(), "%u", 32)
|
||||
|
||||
SYSFS_ATTRIBUTE(version, 0444)
|
||||
SYSFS_ATTRIBUTE(id, 0444)
|
||||
SYSFS_ATTRIBUTE(raw_id, 0444)
|
||||
SYSFS_ATTRIBUTE(raw_version, 0444)
|
||||
SYSFS_ATTRIBUTE(platform_type, 0444)
|
||||
SYSFS_ATTRIBUTE(platform_version, 0444)
|
||||
SYSFS_ATTRIBUTE(platform_subtype, 0444)
|
||||
|
||||
static struct attribute *soc_info_properties_attrs[] = {
|
||||
&id_attr.attr,
|
||||
&version_attr.attr,
|
||||
&raw_id_attr.attr,
|
||||
&raw_version_attr.attr,
|
||||
&platform_type_attr.attr,
|
||||
&platform_version_attr.attr,
|
||||
&platform_subtype_attr.attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct attribute_group soc_info_properties_attr_group = {
|
||||
.attrs = soc_info_properties_attrs,
|
||||
};
|
||||
|
||||
static struct kobject *soc_info_properties_kobj;
|
||||
|
||||
static void annotate_soc_info(void)
|
||||
{
|
||||
mmi_annotate_persist("socinfo: id=%u, ", socinfo_get_id());
|
||||
mmi_annotate_persist("ver=%u.%u, ",
|
||||
SOCINFO_VERSION_MAJOR(socinfo_get_version()),
|
||||
SOCINFO_VERSION_MINOR(socinfo_get_version()));
|
||||
mmi_annotate_persist("raw_id=%u, ", socinfo_get_raw_id());
|
||||
mmi_annotate_persist("raw_ver=%u, ", socinfo_get_raw_version());
|
||||
mmi_annotate_persist("hw_plat=%u, ", socinfo_get_platform_type());
|
||||
mmi_annotate_persist("hw_plat_ver=%u, ", socinfo_get_platform_version());
|
||||
mmi_annotate_persist("hw_plat_subtype=%u\n", socinfo_get_platform_subtype());
|
||||
}
|
||||
|
||||
int mmi_soc_info_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
int status = 0;
|
||||
|
||||
annotate_soc_info();
|
||||
|
||||
soc_info_properties_kobj = kobject_create_and_add("soc", NULL);
|
||||
if (soc_info_properties_kobj)
|
||||
status = sysfs_create_group(soc_info_properties_kobj,
|
||||
&soc_info_properties_attr_group);
|
||||
|
||||
if (!soc_info_properties_kobj || status) {
|
||||
pr_err("%s: failed to create /sys/soc\n", __func__);
|
||||
ret = 1;
|
||||
goto err;
|
||||
}
|
||||
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void mmi_soc_info_exit(void)
|
||||
{
|
||||
sysfs_remove_group(soc_info_properties_kobj,
|
||||
&soc_info_properties_attr_group);
|
||||
kobject_del(soc_info_properties_kobj);
|
||||
}
|
||||
|
|
@ -13,9 +13,9 @@
|
|||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <asm/setup.h>
|
||||
#include <soc/qcom/smem.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <asm/system_misc.h>
|
||||
|
|
@ -25,6 +25,16 @@
|
|||
#include <asm/mach/arch.h>
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
|
||||
#include <linux/soc/qcom/smem.h>
|
||||
/* Match to
|
||||
* vendor/qcom/nonhlos/boot_images/QcomPkg/SDMPkg/Include/smem_type.h
|
||||
*/
|
||||
#define SMEM_ID_VENDOR0 134
|
||||
#else
|
||||
#include <soc/qcom/smem.h>
|
||||
#endif
|
||||
|
||||
#define SMEM_KERNEL_RESERVE SMEM_ID_VENDOR0
|
||||
|
||||
static struct proc_dir_entry *unitinfo_procfs_file;
|
||||
|
|
@ -83,6 +93,9 @@ static int mmi_unit_smem_setup(void)
|
|||
{
|
||||
int ret = 0;
|
||||
struct mmi_unit_info *mui_copy;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
|
||||
ssize_t mui_size;
|
||||
#endif
|
||||
|
||||
#define SMEM_KERNEL_RESERVE_SIZE 1024
|
||||
mui_copy = kzalloc(SMEM_KERNEL_RESERVE_SIZE, GFP_KERNEL);
|
||||
|
|
@ -125,10 +138,21 @@ static int mmi_unit_smem_setup(void)
|
|||
mui_copy->baseband, mui_copy->carrier,
|
||||
mui_copy->powerup_reason);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
|
||||
if(!qcom_smem_alloc(QCOM_SMEM_HOST_ANY,
|
||||
SMEM_KERNEL_RESERVE,
|
||||
SMEM_KERNEL_RESERVE_SIZE))
|
||||
mui = qcom_smem_get(QCOM_SMEM_HOST_ANY,
|
||||
SMEM_KERNEL_RESERVE,
|
||||
&mui_size);
|
||||
|
||||
if (!mui || mui_size != SMEM_KERNEL_RESERVE_SIZE) {
|
||||
#else
|
||||
mui = (struct mmi_unit_info *) smem_alloc(SMEM_KERNEL_RESERVE,
|
||||
SMEM_KERNEL_RESERVE_SIZE, 0, SMEM_ANY_HOST_FLAG);
|
||||
|
||||
if (!mui) {
|
||||
#endif
|
||||
pr_err("%s: failed to allocate mmi_unit_info in SMEM\n",
|
||||
__func__);
|
||||
ret = 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue