1 /* Copyright (c) 2012, 2017-2018, The Linux Foundation. All rights reserved. 2 * 3 * This program is free software; you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License version 2 and 5 * only version 2 as published by the Free Software Foundation. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 */ 12 13 #ifndef __DPU_IO_UTIL_H__ 14 #define __DPU_IO_UTIL_H__ 15 16 #include <linux/gpio.h> 17 #include <linux/platform_device.h> 18 #include <linux/types.h> 19 20 #define DEV_DBG(fmt, args...) pr_debug(fmt, ##args) 21 #define DEV_INFO(fmt, args...) pr_info(fmt, ##args) 22 #define DEV_WARN(fmt, args...) pr_warn(fmt, ##args) 23 #define DEV_ERR(fmt, args...) pr_err(fmt, ##args) 24 25 struct dss_gpio { 26 unsigned int gpio; 27 unsigned int value; 28 char gpio_name[32]; 29 }; 30 31 enum dss_clk_type { 32 DSS_CLK_AHB, /* no set rate. rate controlled through rpm */ 33 DSS_CLK_PCLK, 34 }; 35 36 struct dss_clk { 37 struct clk *clk; /* clk handle */ 38 char clk_name[32]; 39 enum dss_clk_type type; 40 unsigned long rate; 41 unsigned long max_rate; 42 }; 43 44 struct dss_module_power { 45 unsigned int num_gpio; 46 struct dss_gpio *gpio_config; 47 unsigned int num_clk; 48 struct dss_clk *clk_config; 49 }; 50 51 int msm_dss_get_clk(struct device *dev, struct dss_clk *clk_arry, int num_clk); 52 void msm_dss_put_clk(struct dss_clk *clk_arry, int num_clk); 53 int msm_dss_clk_set_rate(struct dss_clk *clk_arry, int num_clk); 54 int msm_dss_enable_clk(struct dss_clk *clk_arry, int num_clk, int enable); 55 int msm_dss_parse_clock(struct platform_device *pdev, 56 struct dss_module_power *mp); 57 #endif /* __DPU_IO_UTIL_H__ */ 58