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

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

Merge "firmware: psci: setup OSI mode at init"

parents 1f6de244 fe547ce1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ config ARM_QCOM_LPM_CPUIDLE
	select CPU_IDLE_MULTIPLE_DRIVERS
	select MSM_PM
	select QGKI_LPM_IPI_CHECK if QGKI
	select QGKI_PSCI_OSI_SUPPORT if QGKI
	tristate "Qualcomm Technologies, Inc. (QTI) Power Management Drivers"
	help
	  Platform specific power driver to manage cores and cluster low power
+3 −0
Original line number Diff line number Diff line
@@ -12,3 +12,6 @@ config ARM_PSCI_CHECKER
	  The torture tests may interfere with the PSCI checker by turning CPUs
	  on and off through hotplug, so for now torture tests and PSCI checker
	  are mutually exclusive.

config QGKI_PSCI_OSI_SUPPORT
	bool "Set PSCI OSI mode"
+29 −0
Original line number Diff line number Diff line
@@ -536,6 +536,27 @@ static int __init psci_0_1_init(struct device_node *np)
	return 0;
}

#ifdef CONFIG_QGKI_PSCI_OSI_SUPPORT
static int psci_set_osi_mode(void)
{
	int err;

	/*
	 * If SET_SUSPEND_MODE is not supported,
	 * assume HYP/firmware are defaulting to OSI
	 */
	err = psci_features(PSCI_1_0_FN_SET_SUSPEND_MODE);
	if (err == PSCI_RET_NOT_SUPPORTED) {
		pr_info("Assuming FW runs OSI.\n");
		return 0;
	}

	err = invoke_psci_fn(PSCI_1_0_FN_SET_SUSPEND_MODE,
			     PSCI_1_0_SUSPEND_MODE_OSI, 0, 0);
	return psci_to_linux_errno(err);
}
#endif /* CONFIG_QGKI_PSCI_OSI_SUPPORT */

static int __init psci_1_0_init(struct device_node *np)
{
	int err;
@@ -544,8 +565,16 @@ static int __init psci_1_0_init(struct device_node *np)
	if (err)
		return err;

#ifdef CONFIG_QGKI_PSCI_OSI_SUPPORT
	if (psci_has_osi_support()) {
		pr_info("OSI mode supported.\n");
		if (!psci_set_osi_mode())
			pr_info("Switched to OSI mode.\n");
	}
#else
	if (psci_has_osi_support())
		pr_info("OSI mode supported.\n");
#endif /* CONFIG_QGKI_PSCI_OSI_SUPPORT */

	return 0;
}