lsdc_gfxpll.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2023 Loongson Technology Corporation Limited
  4. */
  5. #ifndef __LSDC_GFXPLL_H__
  6. #define __LSDC_GFXPLL_H__
  7. #include <drm/drm_device.h>
  8. struct loongson_gfxpll;
  9. struct loongson_gfxpll_parms {
  10. unsigned int ref_clock;
  11. unsigned int div_ref;
  12. unsigned int loopc;
  13. unsigned int div_out_dc;
  14. unsigned int div_out_gmc;
  15. unsigned int div_out_gpu;
  16. };
  17. struct loongson_gfxpll_funcs {
  18. int (*init)(struct loongson_gfxpll * const this);
  19. int (*update)(struct loongson_gfxpll * const this,
  20. struct loongson_gfxpll_parms const *pin);
  21. void (*get_rates)(struct loongson_gfxpll * const this,
  22. unsigned int *dc, unsigned int *gmc, unsigned int *gpu);
  23. void (*print)(struct loongson_gfxpll * const this,
  24. struct drm_printer *printer, bool verbose);
  25. };
  26. struct loongson_gfxpll {
  27. struct drm_device *ddev;
  28. void __iomem *mmio;
  29. /* PLL register offset */
  30. u32 reg_base;
  31. /* PLL register size in bytes */
  32. u32 reg_size;
  33. const struct loongson_gfxpll_funcs *funcs;
  34. struct loongson_gfxpll_parms parms;
  35. };
  36. int loongson_gfxpll_create(struct drm_device *ddev,
  37. struct loongson_gfxpll **ppout);
  38. #endif