soc: rockchip: Add config option for rockchip_system_monitor.c

Change-Id: Ic8d2cb645d29d2ea13e04584d22051b02364bd10
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This commit is contained in:
Finley Xiao
2019-04-23 17:20:09 +08:00
committed by Tao Huang
parent 436c635926
commit e481df4d37
5 changed files with 115 additions and 17 deletions

View File

@@ -90,4 +90,10 @@ config ROCKCHIP_SUSPEND_MODE
help
Say Y here if you want to set the suspend mode to the ATF.
config ROCKCHIP_SYSTEM_MONITOR
bool "Rockchip system monitor support"
default y
help
Say y here to enable rockchip system monitor support.
endif

View File

@@ -13,7 +13,7 @@ obj-$(CONFIG_ROCKCHIP_IPA) += rockchip_ipa.o
obj-$(CONFIG_ROCKCHIP_OPP) += rockchip_opp_select.o
obj-$(CONFIG_ROCKCHIP_PVTM) += rockchip_pvtm.o
obj-$(CONFIG_ROCKCHIP_SUSPEND_MODE) += rockchip_pm_config.o
obj-$(CONFIG_ROCKCHIP_SYSTEM_MONITOR) += rockchip_system_monitor.o
obj-$(CONFIG_ROCK_CHIP_SOC_CAMERA) += rk_camera.o
obj-y += rk_vendor_storage.o
obj-y += rockchip_system_monitor.o

View File

@@ -698,6 +698,18 @@ int rockchip_monitor_cpu_high_temp_adjust(struct monitor_dev_info *info,
}
EXPORT_SYMBOL(rockchip_monitor_cpu_high_temp_adjust);
static int rockchip_monitor_update_devfreq(struct devfreq *df)
{
int ret = 0;
#ifdef CONFIG_PM_DEVFREQ
mutex_lock(&df->lock);
ret = update_devfreq(df);
mutex_unlock(&df->lock);
#endif
return ret;
};
int rockchip_monitor_dev_low_temp_adjust(struct monitor_dev_info *info,
bool is_low)
{
@@ -712,9 +724,7 @@ int rockchip_monitor_dev_low_temp_adjust(struct monitor_dev_info *info,
if (info->devp && info->devp->data) {
df = (struct devfreq *)info->devp->data;
mutex_lock(&df->lock);
update_devfreq(df);
mutex_unlock(&df->lock);
rockchip_monitor_update_devfreq(df);
}
return 0;
@@ -735,9 +745,7 @@ int rockchip_monitor_dev_high_temp_adjust(struct monitor_dev_info *info,
if (info->devp && info->devp->data) {
df = (struct devfreq *)info->devp->data;
mutex_lock(&df->lock);
update_devfreq(df);
mutex_unlock(&df->lock);
rockchip_monitor_update_devfreq(df);
}
return 0;

View File

@@ -1,18 +1,12 @@
/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
/*
* Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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.
* Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd
*/
#ifndef __SOC_ROCKCHIP_SYSTEM_STATUS_H
#define __SOC_ROCKCHIP_SYSTEM_STATUS_H
#ifdef CONFIG_ROCKCHIP_SYSTEM_MONITOR
int rockchip_register_system_status_notifier(struct notifier_block *nb);
int rockchip_unregister_system_status_notifier(struct notifier_block *nb);
void rockchip_set_system_status(unsigned long status);
@@ -20,5 +14,40 @@ void rockchip_clear_system_status(unsigned long status);
unsigned long rockchip_get_system_status(void);
int rockchip_add_system_status_interface(struct device *dev);
void rockchip_update_system_status(const char *buf);
#else
static inline int
rockchip_register_system_status_notifier(struct notifier_block *nb)
{
return -ENOTSUPP;
};
static inline int
rockchip_unregister_system_status_notifier(struct notifier_block *nb)
{
return -ENOTSUPP;
};
static inline void rockchip_set_system_status(unsigned long status)
{
};
static inline void rockchip_clear_system_status(unsigned long status)
{
};
static inline unsigned long rockchip_get_system_status(void)
{
return 0;
};
static inline int rockchip_add_system_status_interface(struct device *dev)
{
return -ENOTSUPP;
};
static inline void rockchip_update_system_status(const char *buf)
{
};
#endif /* CONFIG_ROCKCHIP_SYSTEM_MONITOR */
#endif

View File

@@ -103,6 +103,7 @@ struct monitor_dev_profile {
struct cpumask allowed_cpus;
};
#ifdef CONFIG_ROCKCHIP_SYSTEM_MONITOR
struct monitor_dev_info *
rockchip_system_monitor_register(struct device *dev,
struct monitor_dev_profile *devp);
@@ -119,4 +120,58 @@ int rockchip_monitor_suspend_low_temp_adjust(struct monitor_dev_info *info);
int
rockchip_system_monitor_adjust_cdev_state(struct thermal_cooling_device *cdev,
int temp, unsigned long *state);
#else
static inline struct monitor_dev_info *
rockchip_system_monitor_register(struct device *dev,
struct monitor_dev_profile *devp)
{
return ERR_PTR(-ENOTSUPP);
};
static inline void
rockchip_system_monitor_unregister(struct monitor_dev_info *info)
{
}
static inline int
rockchip_monitor_cpu_low_temp_adjust(struct monitor_dev_info *info, bool is_low)
{
return 0;
};
static inline int
rockchip_monitor_cpu_high_temp_adjust(struct monitor_dev_info *info,
bool is_high)
{
return 0;
};
static inline int
rockchip_monitor_dev_low_temp_adjust(struct monitor_dev_info *info, bool is_low)
{
return 0;
};
static inline int
rockchip_monitor_dev_high_temp_adjust(struct monitor_dev_info *info,
bool is_high)
{
return 0;
};
static inline int
rockchip_monitor_suspend_low_temp_adjust(struct monitor_dev_info *info)
{
return 0;
};
static inline int
rockchip_system_monitor_adjust_cdev_state(struct thermal_cooling_device *cdev,
int temp, unsigned long *state)
{
return 0;
}
#endif /* CONFIG_ROCKCHIP_SYSTEM_MONITOR */
#endif