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

Commit ac279b31 authored by David Collins's avatar David Collins
Browse files

clk: qcom: gdsc-regulator: add support for enabling retention registers



Add support for the RETAIN_FF_ENABLE feature which enables the
usage of retention registers.  These registers maintain their
state after disabling and re-enabling a GDSC.

Change-Id: Iad19bfb2cb73fa76aad230bad6372d68b447b4e2
Signed-off-by: default avatarDavid Collins <collinsd@codeaurora.org>
parent bb3b0cc0
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/kernel.h>
@@ -26,6 +26,7 @@
#define PWR_ON_MASK		BIT(31)
#define CLK_DIS_WAIT_MASK	(0xF << 12)
#define CLK_DIS_WAIT_SHIFT	(12)
#define RETAIN_FF_ENABLE_MASK	BIT(11)
#define SW_OVERRIDE_MASK	BIT(2)
#define HW_CONTROL_MASK		BIT(1)
#define SW_COLLAPSE_MASK	BIT(0)
@@ -57,6 +58,7 @@ struct gdsc {
	bool			toggle_mem;
	bool			toggle_periph;
	bool			toggle_logic;
	bool			retain_ff_enable;
	bool			resets_asserted;
	bool			root_en;
	bool			force_root_en;
@@ -311,6 +313,11 @@ static int gdsc_enable(struct regulator_dev *rdev)
				goto end;
			}
		}

		if (sc->retain_ff_enable && !(regval & RETAIN_FF_ENABLE_MASK)) {
			regval |= RETAIN_FF_ENABLE_MASK;
			regmap_write(sc->regmap, REG_OFFSET, regval);
		}
	} else {
		for (i = 0; i < sc->reset_count; i++)
			reset_control_deassert(sc->reset_clocks[i]);
@@ -735,6 +742,8 @@ static int gdsc_probe(struct platform_device *pdev)
	retain_periph = of_property_read_bool(pdev->dev.of_node,
					    "qcom,retain-periph");
	sc->toggle_periph = !retain_periph;
	sc->retain_ff_enable = of_property_read_bool(pdev->dev.of_node,
						"qcom,retain-regs");
	sc->toggle_logic = !of_property_read_bool(pdev->dev.of_node,
						"qcom,skip-logic-collapse");
	support_hw_trigger = of_property_read_bool(pdev->dev.of_node,