1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (C) 2023 Loongson Technology Corporation Limited
6 #ifndef __LSDC_GFXPLL_H__
7 #define __LSDC_GFXPLL_H__
9 #include <drm/drm_device.h>
11 struct loongson_gfxpll;
13 struct loongson_gfxpll_parms {
14 unsigned int ref_clock;
17 unsigned int div_out_dc;
18 unsigned int div_out_gmc;
19 unsigned int div_out_gpu;
22 struct loongson_gfxpll_funcs {
23 int (*init)(struct loongson_gfxpll * const this);
25 int (*update)(struct loongson_gfxpll * const this,
26 struct loongson_gfxpll_parms const *pin);
28 void (*get_rates)(struct loongson_gfxpll * const this,
29 unsigned int *dc, unsigned int *gmc, unsigned int *gpu);
31 void (*print)(struct loongson_gfxpll * const this,
32 struct drm_printer *printer, bool verbose);
35 struct loongson_gfxpll {
36 struct drm_device *ddev;
39 /* PLL register offset */
41 /* PLL register size in bytes */
44 const struct loongson_gfxpll_funcs *funcs;
46 struct loongson_gfxpll_parms parms;
49 int loongson_gfxpll_create(struct drm_device *ddev,
50 struct loongson_gfxpll **ppout);