Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2a8fe4d authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "defconfig: Add l2 reuse sysfs driver for bengal"

parents 67765b38 232efb6d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -537,6 +537,7 @@ CONFIG_MSM_CDSP_LOADER=y
CONFIG_QCOM_SMCINVOKE=y
CONFIG_MSM_EVENT_TIMER=y
CONFIG_MSM_PM=y
CONFIG_QTI_L2_REUSE=y
CONFIG_QTI_RPM_STATS_LOG=y
CONFIG_QTEE_SHM_BRIDGE=y
CONFIG_MEM_SHARE_QMI_SERVICE=y
+1 −0
Original line number Diff line number Diff line
@@ -561,6 +561,7 @@ CONFIG_MSM_CDSP_LOADER=y
CONFIG_QCOM_SMCINVOKE=y
CONFIG_MSM_EVENT_TIMER=y
CONFIG_MSM_PM=y
CONFIG_QTI_L2_REUSE=y
CONFIG_QTI_RPM_STATS_LOG=y
CONFIG_QTEE_SHM_BRIDGE=y
CONFIG_MEM_SHARE_QMI_SERVICE=y
+8 −0
Original line number Diff line number Diff line
@@ -747,6 +747,14 @@ config MSM_SUSPEND_STATS_FIRST_BUCKET
endif # MSM_IDLE_STATS
endif # MSM_PM

config QTI_L2_REUSE
	bool "Qualcomm Technologies Inc (QTI) L2 reuse"
	depends on ARCH_QCOM
	help
	  This module allows to configure the L2 reuse feature dynamically
	  to let the power collapsed cluster's L2 cache usage by the active
	  cluster cpu. Use sysfs interface to control enabling this feature.

config QTI_RPM_STATS_LOG
	bool "Qualcomm Technologies RPM Stats Driver"
	depends on QCOM_RPMH || MSM_RPM_SMD
+1 −0
Original line number Diff line number Diff line
@@ -97,3 +97,4 @@ obj-$(CONFIG_ICNSS) += icnss.o
obj-$(CONFIG_ICNSS_QMI) += icnss_qmi.o wlan_firmware_service_v01.o
obj-$(CONFIG_RMNET_CTL) += rmnet_ctl/
obj-$(CONFIG_QCOM_CX_IPEAK) += cx_ipeak.o
obj-$(CONFIG_QTI_L2_REUSE) += l2_reuse.o
+71 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/arm-smccc.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/uaccess.h>
#include <linux/sysfs.h>
#include <linux/kobject.h>

#define L2_REUSE_SMC_ID 0x02001F01

static bool l2_reuse_enable = true;
static struct kobject *l2_reuse_kobj;

static ssize_t sysfs_show(struct kobject *kobj,
		struct kobj_attribute *attr, char *buf)
{
	return scnprintf(buf, PAGE_SIZE, "%u\n", l2_reuse_enable);
}

static ssize_t sysfs_store(struct kobject *kobj,
		struct kobj_attribute *attr, const char *buf, size_t count)
{
	struct arm_smccc_res res;
	int ret;

	ret = kstrtobool(buf, &l2_reuse_enable);
	if (ret) {
		pr_err("Invalid argument passed\n");
		return ret;
	}

	arm_smccc_smc(L2_REUSE_SMC_ID, l2_reuse_enable, 1, 0, 0, 0, 0, 0, &res);
	return count;
}

struct kobj_attribute l2_reuse_attr = __ATTR(l2_reuse_enable, 0660,
		sysfs_show, sysfs_store);

static int __init l2_reuse_driver_init(void)
{
	l2_reuse_kobj = kobject_create_and_add("l2_reuse_enable", power_kobj);

	if (!l2_reuse_kobj) {
		pr_info("kobj creation for l2_reuse failed\n");
		return 0;
	}

	if (sysfs_create_file(l2_reuse_kobj, &l2_reuse_attr.attr))
		kobject_put(l2_reuse_kobj);

	return 0;
}

void __exit l2_reuse_driver_exit(void)
{
	if (l2_reuse_kobj) {
		sysfs_remove_file(power_kobj, &l2_reuse_attr.attr);
		kobject_put(l2_reuse_kobj);
	}
}

module_init(l2_reuse_driver_init);
module_exit(l2_reuse_driver_exit);

MODULE_DESCRIPTION("Qualcomm Technologies Inc L2 REUSE Module");
MODULE_LICENSE("GPL v2");