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

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

Merge "drivers: lpm-levels-legacy: Allow rpm handshake only with cluster LPM"

parents 34698073 1d5af357
Loading
Loading
Loading
Loading
+22 −6
Original line number Diff line number Diff line
/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2019  The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -234,7 +234,7 @@ static void msm_spm_config_slpreq(struct msm_spm_device *dev,
}

static int msm_spm_dev_set_low_power_mode(struct msm_spm_device *dev,
		unsigned int mode, bool notify_rpm)
		unsigned int mode, bool notify_rpm, bool set_spm_enable)
{
	uint32_t i;
	int ret = -EINVAL;
@@ -251,9 +251,11 @@ static int msm_spm_dev_set_low_power_mode(struct msm_spm_device *dev,
	if (!dev->num_modes)
		return 0;

	if (mode == MSM_SPM_MODE_DISABLED) {
	if (mode == MSM_SPM_MODE_DISABLED && set_spm_enable) {
		ret = msm_spm_drv_set_spm_enable(&dev->reg_data, false);
	} else if (!msm_spm_drv_set_spm_enable(&dev->reg_data, true)) {
	} else {
		if (set_spm_enable)
			ret = msm_spm_drv_set_spm_enable(&dev->reg_data, true);
		for (i = 0; i < dev->num_modes; i++) {
			if (dev->modes[i].mode != mode)
				continue;
@@ -539,10 +541,24 @@ int msm_spm_set_low_power_mode(unsigned int mode, bool notify_rpm)
{
	struct msm_spm_device *dev = this_cpu_ptr(&msm_cpu_spm_device);

	return msm_spm_dev_set_low_power_mode(dev, mode, notify_rpm);
	return msm_spm_dev_set_low_power_mode(dev, mode, notify_rpm, true);
}
EXPORT_SYMBOL(msm_spm_set_low_power_mode);

void msm_spm_set_rpm_hs(bool allow_rpm_hs)
{
	struct msm_spm_device *dev = this_cpu_ptr(&msm_cpu_spm_device);

	dev->allow_rpm_hs = allow_rpm_hs;
}
EXPORT_SYMBOL(msm_spm_set_rpm_hs);

int msm_spm_config_low_power_mode_addr(struct msm_spm_device *dev,
		unsigned int mode, bool notify_rpm)
{
	return msm_spm_dev_set_low_power_mode(dev, mode, notify_rpm, false);
}

/**
 * msm_spm_init(): Board initalization function
 * @data: platform specific SPM register configuration data
@@ -586,7 +602,7 @@ struct msm_spm_device *msm_spm_get_device_by_name(const char *name)
int msm_spm_config_low_power_mode(struct msm_spm_device *dev,
		unsigned int mode, bool notify_rpm)
{
	return msm_spm_dev_set_low_power_mode(dev, mode, notify_rpm);
	return msm_spm_dev_set_low_power_mode(dev, mode, notify_rpm, true);
}
#ifdef CONFIG_MSM_L2_SPM

+13 −1
Original line number Diff line number Diff line
/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2017,2019 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -35,6 +35,7 @@ struct device_node;
#if defined(CONFIG_MSM_SPM)

int msm_spm_set_low_power_mode(unsigned int mode, bool notify_rpm);
void msm_spm_set_rpm_hs(bool allow_rpm_hs);
int msm_spm_probe_done(void);
int msm_spm_set_vdd(unsigned int cpu, unsigned int vlevel);
int msm_spm_get_vdd(unsigned int cpu);
@@ -43,6 +44,8 @@ int msm_spm_turn_on_cpu_rail(struct device_node *l2ccc_node,
struct msm_spm_device *msm_spm_get_device_by_name(const char *name);
int msm_spm_config_low_power_mode(struct msm_spm_device *dev,
		unsigned int mode, bool notify_rpm);
int msm_spm_config_low_power_mode_addr(struct msm_spm_device *dev,
		unsigned int mode, bool notify_rpm);
int msm_spm_device_init(void);
bool msm_spm_is_mode_avail(unsigned int mode);
void msm_spm_dump_regs(unsigned int cpu);
@@ -80,6 +83,8 @@ static inline int msm_spm_set_low_power_mode(unsigned int mode, bool notify_rpm)
	return -ENODEV;
}

static inline void msm_spm_set_rpm_hs(bool allow_rpm_hs) {}

static inline int msm_spm_probe_done(void)
{
	return -ENODEV;
@@ -114,6 +119,13 @@ static inline int msm_spm_config_low_power_mode(struct msm_spm_device *dev,
{
	return -ENODEV;
}

static inline int msm_spm_config_low_power_mode_addr(
	struct msm_spm_device *dev, unsigned int mode, bool notify_rpm)
{
	return -ENODEV;
}

static inline struct msm_spm_device *msm_spm_get_device_by_name(
				const char *name)
{