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

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

Merge "drivers: thermal: cpu_cooling: Add a notifier for max level transitions"

parents 395f735d 547ecd3b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -635,3 +635,12 @@ config QMP_DEBUGFS_CLIENT
	help
	  This options enables a driver which allows clients to send messages
	  to Alway On processor using QMP transport.

config QCOM_HYP_CORE_CTL
	bool "CPU reservation scheme for Hypervisor"
	depends on OKL4_GUEST
	help
	  This driver reserve the specified CPUS by isolating them. The reserved
	  CPUs can be assigned to the other guest OS by the hypervisor.
	  An offline CPU is considered as a reserved CPU since this OS can't use
	  it.
+1 −0
Original line number Diff line number Diff line
@@ -69,3 +69,4 @@ obj-$(CONFIG_QTI_RPM_STATS_LOG) += rpmh_master_stat.o
obj-$(CONFIG_QTI_RPM_STATS_LOG) += rpm_stats.o
obj-$(CONFIG_QCOM_MEM_OFFLINE) += mem-offline.o
obj-$(CONFIG_QMP_DEBUGFS_CLIENT) += qmp-debugfs-client.o
obj-$(CONFIG_QCOM_HYP_CORE_CTL) += hyp_core_ctl.o
+895 −0

File added.

Preview size limit exceeded, changes collapsed.

+25 −0
Original line number Diff line number Diff line
@@ -129,6 +129,24 @@ static DEFINE_IDA(cpufreq_ida);
static DEFINE_MUTEX(cooling_list_lock);
static LIST_HEAD(cpufreq_cdev_list);

static struct cpumask cpus_in_max_cooling_level;
static BLOCKING_NOTIFIER_HEAD(cpu_max_cooling_level_notifer);

void cpu_cooling_max_level_notifier_register(struct notifier_block *n)
{
	blocking_notifier_chain_register(&cpu_max_cooling_level_notifer, n);
}

void cpu_cooling_max_level_notifier_unregister(struct notifier_block *n)
{
	blocking_notifier_chain_unregister(&cpu_max_cooling_level_notifer, n);
}

const struct cpumask *cpu_cooling_get_max_level_cpumask(void)
{
	return &cpus_in_max_cooling_level;
}

/* Below code defines functions to be used for cpufreq as cooling device */

/**
@@ -621,6 +639,9 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
				cpumask_clear_cpu(cpu,
					&cpus_isolated_by_thermal);
		}
		cpumask_set_cpu(cpu, &cpus_in_max_cooling_level);
		blocking_notifier_call_chain(&cpu_max_cooling_level_notifer,
					     1, (void *)(long)cpu);
		return ret;
	} else if ((prev_state == cpufreq_cdev->max_level)
			&& (state < cpufreq_cdev->max_level)) {
@@ -634,6 +655,9 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
			&cpus_isolated_by_thermal)) {
			sched_unisolate_cpu(cpu);
		}
		cpumask_clear_cpu(cpu, &cpus_in_max_cooling_level);
		blocking_notifier_call_chain(&cpu_max_cooling_level_notifer,
					     0, (void *)(long)cpu);
	}
update_frequency:
	clip_freq = cpufreq_cdev->freq_table[state].frequency;
@@ -990,6 +1014,7 @@ __cpufreq_cooling_register(struct device_node *np,
		register_pm_notifier(&cpufreq_cooling_pm_nb);
		cpumask_clear(&cpus_pending_online);
		cpumask_clear(&cpus_isolated_by_thermal);
		cpumask_clear(&cpus_in_max_cooling_level);
		INIT_WORK(&cpuhp_register_work, register_cdev);
		queue_work(system_wq, &cpuhp_register_work);
	}
+18 −0
Original line number Diff line number Diff line
@@ -54,6 +54,9 @@ cpufreq_platform_cooling_register(const struct cpumask *clip_cpus,
 */
void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);

extern void cpu_cooling_max_level_notifier_register(struct notifier_block *n);
extern void cpu_cooling_max_level_notifier_unregister(struct notifier_block *n);
extern const struct cpumask *cpu_cooling_get_max_level_cpumask(void);
#else /* !CONFIG_CPU_THERMAL */
static inline struct thermal_cooling_device *
cpufreq_cooling_register(struct cpufreq_policy *policy)
@@ -88,6 +91,21 @@ cpufreq_platform_cooling_register(const struct cpumask *clip_cpus,
{
	return NULL;
}

static inline
void cpu_cooling_max_level_notifier_register(struct notifier_block *n)
{
}

static inline
void cpu_cooling_max_level_notifier_unregister(struct notifier_block *n)
{
}

static inline const struct cpumask *cpu_cooling_get_max_level_cpumask(void)
{
	return cpu_none_mask;
}
#endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */

#endif /* __CPU_COOLING_H__ */
Loading