^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* Copyright (c) 2014, The Linux Foundation. All rights reserved. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #ifndef __QCOM_CLK_REGMAP_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #define __QCOM_CLK_REGMAP_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/clk-provider.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) struct regmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * struct clk_regmap - regmap supporting clock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * @hw: handle between common and hardware-specific interfaces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * @regmap: regmap to use for regmap helpers and/or by providers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * @enable_reg: register when using regmap enable/disable ops
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * @enable_mask: mask when using regmap enable/disable ops
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * @enable_is_inverted: flag to indicate set enable_mask bits to disable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * when using clock_enable_regmap and friends APIs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct clk_regmap {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct clk_hw hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct regmap *regmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) unsigned int enable_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) unsigned int enable_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) bool enable_is_inverted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static inline struct clk_regmap *to_clk_regmap(struct clk_hw *hw)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) return container_of(hw, struct clk_regmap, hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int clk_is_enabled_regmap(struct clk_hw *hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int clk_enable_regmap(struct clk_hw *hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) void clk_disable_regmap(struct clk_hw *hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int devm_clk_register_regmap(struct device *dev, struct clk_regmap *rclk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #endif