diff --git a/drivers/soc/rockchip/rockchip_system_monitor.c b/drivers/soc/rockchip/rockchip_system_monitor.c index 1c9be3e4eceb..dd0586921d56 100644 --- a/drivers/soc/rockchip/rockchip_system_monitor.c +++ b/drivers/soc/rockchip/rockchip_system_monitor.c @@ -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; diff --git a/include/soc/rockchip/rockchip-system-status.h b/include/soc/rockchip/rockchip-system-status.h index 99e4428ba8f8..8a40ed16f8a8 100644 --- a/include/soc/rockchip/rockchip-system-status.h +++ b/include/soc/rockchip/rockchip-system-status.h @@ -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 diff --git a/include/soc/rockchip/rockchip_system_monitor.h b/include/soc/rockchip/rockchip_system_monitor.h index 6ffd96e0ac80..07f3a48ec0b1 100644 --- a/include/soc/rockchip/rockchip_system_monitor.h +++ b/include/soc/rockchip/rockchip_system_monitor.h @@ -101,6 +101,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); @@ -117,4 +118,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