rk_hdmi.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
  4. */
  5. #ifndef __RK_HDMI_H__
  6. #define __RK_HDMI_H__
  7. struct rkhdmi_driverdata {
  8. /* configuration */
  9. u8 i2c_clk_high;
  10. u8 i2c_clk_low;
  11. const char * const *regulator_names;
  12. u32 regulator_names_cnt;
  13. /* setters/getters */
  14. int (*set_input_vop)(struct udevice *dev);
  15. int (*clk_config)(struct udevice *dev);
  16. };
  17. struct rk_hdmi_priv {
  18. struct dw_hdmi hdmi;
  19. void *grf;
  20. };
  21. /**
  22. * rk_hdmi_read_edid() - read the attached HDMI/DVI monitor's EDID
  23. *
  24. * N.B.: The buffer should be large enough to hold 2 EDID blocks, as
  25. * this function calls dw_hdmi_read_edid, which ignores buf_size
  26. * argument and assumes that there's always enough space for 2
  27. * EDID blocks.
  28. *
  29. * @dev: device
  30. * @buf: output buffer for the EDID
  31. * @buf_size: number of bytes in the buffer
  32. * @return number of bytes read if OK, -ve if something went wrong
  33. */
  34. int rk_hdmi_read_edid(struct udevice *dev, u8 *buf, int buf_size);
  35. /**
  36. * rk_hdmi_probe_regulators() - probe (autoset + enable) regulators
  37. *
  38. * Probes a list of regulators by performing autoset and enable
  39. * operations on them. The list of regulators is an array of string
  40. * pointers and any individual regulator-probe may fail without
  41. * counting as an error.
  42. *
  43. * @dev: device
  44. * @names: array of string-pointers to regulator names to probe
  45. * @cnt: number of elements in the 'names' array
  46. */
  47. void rk_hdmi_probe_regulators(struct udevice *dev,
  48. const char * const *names, int cnt);
  49. /**
  50. * rk_hdmi_of_to_plat() - common of_to_plat implementation
  51. *
  52. * @dev: device
  53. * @return 0 if OK, -ve if something went wrong
  54. */
  55. int rk_hdmi_of_to_plat(struct udevice *dev);
  56. /**
  57. * rk_hdmi_probe() - common probe implementation
  58. *
  59. * Performs the following, common initialisation steps:
  60. * 1. checks for HPD (i.e. a HDMI monitor being attached)
  61. * 2. initialises the Designware HDMI core
  62. * 3. initialises the Designware HDMI PHY
  63. *
  64. * @dev: device
  65. * @return 0 if OK, -ve if something went wrong
  66. */
  67. int rk_hdmi_probe(struct udevice *dev);
  68. #endif