18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* Copyright (c) 2014, The Linux Foundation. All rights reserved. */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifndef __QCOM_CLK_REGMAP_H__ 58c2ecf20Sopenharmony_ci#define __QCOM_CLK_REGMAP_H__ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/clk-provider.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_cistruct regmap; 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/** 128c2ecf20Sopenharmony_ci * struct clk_regmap - regmap supporting clock 138c2ecf20Sopenharmony_ci * @hw: handle between common and hardware-specific interfaces 148c2ecf20Sopenharmony_ci * @regmap: regmap to use for regmap helpers and/or by providers 158c2ecf20Sopenharmony_ci * @enable_reg: register when using regmap enable/disable ops 168c2ecf20Sopenharmony_ci * @enable_mask: mask when using regmap enable/disable ops 178c2ecf20Sopenharmony_ci * @enable_is_inverted: flag to indicate set enable_mask bits to disable 188c2ecf20Sopenharmony_ci * when using clock_enable_regmap and friends APIs. 198c2ecf20Sopenharmony_ci */ 208c2ecf20Sopenharmony_cistruct clk_regmap { 218c2ecf20Sopenharmony_ci struct clk_hw hw; 228c2ecf20Sopenharmony_ci struct regmap *regmap; 238c2ecf20Sopenharmony_ci unsigned int enable_reg; 248c2ecf20Sopenharmony_ci unsigned int enable_mask; 258c2ecf20Sopenharmony_ci bool enable_is_inverted; 268c2ecf20Sopenharmony_ci}; 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cistatic inline struct clk_regmap *to_clk_regmap(struct clk_hw *hw) 298c2ecf20Sopenharmony_ci{ 308c2ecf20Sopenharmony_ci return container_of(hw, struct clk_regmap, hw); 318c2ecf20Sopenharmony_ci} 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciint clk_is_enabled_regmap(struct clk_hw *hw); 348c2ecf20Sopenharmony_ciint clk_enable_regmap(struct clk_hw *hw); 358c2ecf20Sopenharmony_civoid clk_disable_regmap(struct clk_hw *hw); 368c2ecf20Sopenharmony_ciint devm_clk_register_regmap(struct device *dev, struct clk_regmap *rclk); 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#endif 39