dpu_io_util.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #ifndef __DPU_IO_UTIL_H__
  13. #define __DPU_IO_UTIL_H__
  14. #include <linux/gpio.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/types.h>
  17. #define DEV_DBG(fmt, args...) pr_debug(fmt, ##args)
  18. #define DEV_INFO(fmt, args...) pr_info(fmt, ##args)
  19. #define DEV_WARN(fmt, args...) pr_warn(fmt, ##args)
  20. #define DEV_ERR(fmt, args...) pr_err(fmt, ##args)
  21. struct dss_gpio {
  22. unsigned int gpio;
  23. unsigned int value;
  24. char gpio_name[32];
  25. };
  26. enum dss_clk_type {
  27. DSS_CLK_AHB, /* no set rate. rate controlled through rpm */
  28. DSS_CLK_PCLK,
  29. };
  30. struct dss_clk {
  31. struct clk *clk; /* clk handle */
  32. char clk_name[32];
  33. enum dss_clk_type type;
  34. unsigned long rate;
  35. unsigned long max_rate;
  36. };
  37. struct dss_module_power {
  38. unsigned int num_gpio;
  39. struct dss_gpio *gpio_config;
  40. unsigned int num_clk;
  41. struct dss_clk *clk_config;
  42. };
  43. int msm_dss_get_clk(struct device *dev, struct dss_clk *clk_arry, int num_clk);
  44. void msm_dss_put_clk(struct dss_clk *clk_arry, int num_clk);
  45. int msm_dss_clk_set_rate(struct dss_clk *clk_arry, int num_clk);
  46. int msm_dss_enable_clk(struct dss_clk *clk_arry, int num_clk, int enable);
  47. int msm_dss_parse_clock(struct platform_device *pdev,
  48. struct dss_module_power *mp);
  49. #endif /* __DPU_IO_UTIL_H__ */