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

Commit c6667bed authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge changes I958faf8a,Ia67373ee,I08fcb174 into msm-next

* changes:
  arm64: Kconfig: Select COMMON_CLK_QCOM for SDM855
  clk: Add support to set custom flags with clk_set_flags
  clk: qcom: clk-dummy: Add a dummy clock provider
parents 4aca867d e74c80dd
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
Qualcomm Technologies, Inc. Dummy Clock controller

Qualcomm Technologies, Inc. dummy clock controller devices provide
clock API support for driver development during pre-silicon stage.
The clock driver always returns a dummy clock that has no effect on
hardware.

Required properties:
- compatible:		Must be "qcom,dummycc"
- #clock-cells:		Must be <1>. This will allow the common clock device
			tree framework to recognize _this_ device node as a
			clock provider.

Optional properties:
- clock-output-names:	Name of the clock or the clock type.
- #reset-cells:		Must be <1>. This will allow the common reset device
			tree framework to recognize _this_ device node as a
			reset controller provider.

Example:
	clock_gcc: qcom,gcc {
		compatible = "qcom,dummycc";
		clock-output-names = "gcc_clocks";
		#clock-cells = <1>;
		#reset-cells = <1>;
	};
+1 −0
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ config ARCH_QCOM
config ARCH_SDM855
	bool "Enable Support for Qualcomm SDM855"
	depends on ARCH_QCOM
	select COMMON_CLK_QCOM
	help
	  This enables support for the SDM855 chipset. If you do not
	  wish to build a kernel that runs on this chipset, say 'N' here.
+12 −0
Original line number Diff line number Diff line
@@ -1979,6 +1979,18 @@ bool clk_is_match(const struct clk *p, const struct clk *q)
}
EXPORT_SYMBOL_GPL(clk_is_match);

int clk_set_flags(struct clk *clk, unsigned long flags)
{
	if (!clk)
		return 0;

	if (!clk->core->ops->set_flags)
		return -EINVAL;

	return clk->core->ops->set_flags(clk->core->hw, flags);
}
EXPORT_SYMBOL_GPL(clk_set_flags);

/***        debugfs support        ***/

#ifdef CONFIG_DEBUG_FS
+1 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ clk-qcom-y += clk-branch.o
clk-qcom-y += clk-regmap-divider.o
clk-qcom-y += clk-regmap-mux.o
clk-qcom-y += reset.o
clk-qcom-y += clk-dummy.o
clk-qcom-$(CONFIG_QCOM_GDSC) += gdsc.o

# Keep alphabetically sorted by config
+49 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013, 2017, The Linux Foundation. All rights reserved.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
@@ -122,15 +122,62 @@ static int clk_branch_enable(struct clk_hw *hw)
	return clk_branch_toggle(hw, true, clk_branch_check_halt);
}

static int clk_cbcr_set_flags(struct regmap *regmap, unsigned int reg,
				unsigned long flags)
{
	u32 cbcr_val;

	regmap_read(regmap, reg, &cbcr_val);

	switch (flags) {
	case CLKFLAG_PERIPH_OFF_SET:
		cbcr_val |= BIT(12);
		break;
	case CLKFLAG_PERIPH_OFF_CLEAR:
		cbcr_val &= ~BIT(12);
		break;
	case CLKFLAG_RETAIN_PERIPH:
		cbcr_val |= BIT(13);
		break;
	case CLKFLAG_NORETAIN_PERIPH:
		cbcr_val &= ~BIT(13);
		break;
	case CLKFLAG_RETAIN_MEM:
		cbcr_val |= BIT(14);
		break;
	case CLKFLAG_NORETAIN_MEM:
		cbcr_val &= ~BIT(14);
		break;
	default:
		return -EINVAL;
	}

	regmap_write(regmap, reg, cbcr_val);

	/* Make sure power is enabled/disabled before returning. */
	mb();
	udelay(1);

	return 0;
}

static void clk_branch_disable(struct clk_hw *hw)
{
	clk_branch_toggle(hw, false, clk_branch_check_halt);
}

static int clk_branch_set_flags(struct clk_hw *hw, unsigned int flags)
{
	struct clk_branch *br = to_clk_branch(hw);

	return clk_cbcr_set_flags(br->clkr.regmap, br->halt_reg, flags);
}

const struct clk_ops clk_branch_ops = {
	.enable = clk_branch_enable,
	.disable = clk_branch_disable,
	.is_enabled = clk_is_enabled_regmap,
	.set_flags = clk_branch_set_flags,
};
EXPORT_SYMBOL_GPL(clk_branch_ops);

@@ -148,6 +195,7 @@ const struct clk_ops clk_branch2_ops = {
	.enable = clk_branch2_enable,
	.disable = clk_branch2_disable,
	.is_enabled = clk_is_enabled_regmap,
	.set_flags = clk_branch_set_flags,
};
EXPORT_SYMBOL_GPL(clk_branch2_ops);

Loading