Skip to content

Commit

Permalink
drm/mgag200: Abstract pixel PLL via struct mgag200_pll
Browse files Browse the repository at this point in the history
Move all PLL compute and update functions into mgag200_pll.c. No
functional changes to the rsp algorithms.

Introduce struct mgag200_pll and mgag200_pll_funcs. The data strutures
abstract the details of each revision's PLL. Perform calls to compute
and update functionality via function pointers. Init the PLL once as
part of the driver initialization.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210714142240.21979-11-tzimmermann@suse.de
  • Loading branch information
Thomas Zimmermann committed Aug 8, 2021
1 parent 8fb60d1 commit 2545ac9
Show file tree
Hide file tree
Showing 4 changed files with 1,019 additions and 903 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/mgag200/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
mgag200-y := mgag200_drv.o mgag200_i2c.o mgag200_mm.o mgag200_mode.o
mgag200-y := mgag200_drv.o mgag200_i2c.o mgag200_mm.o mgag200_mode.o mgag200_pll.o

obj-$(CONFIG_DRM_MGAG200) += mgag200.o
19 changes: 18 additions & 1 deletion drivers/gpu/drm/mgag200/mgag200_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
#define MGAG200_MAX_FB_HEIGHT 4096
#define MGAG200_MAX_FB_WIDTH 4096

struct mga_device;
struct mgag200_pll;

/*
* Stores parameters for programming the PLLs
*
Expand All @@ -143,6 +146,17 @@ struct mgag200_pll_values {
unsigned int s;
};

struct mgag200_pll_funcs {
int (*compute)(struct mgag200_pll *pll, long clock, struct mgag200_pll_values *pllc);
void (*update)(struct mgag200_pll *pll, const struct mgag200_pll_values *pllc);
};

struct mgag200_pll {
struct mga_device *mdev;

const struct mgag200_pll_funcs *funcs;
};

#define to_mga_connector(x) container_of(x, struct mga_connector, base)

struct mga_i2c_chan {
Expand Down Expand Up @@ -213,8 +227,8 @@ struct mga_device {
} g200se;
} model;


struct mga_connector connector;
struct mgag200_pll pixpll;
struct drm_simple_display_pipe display_pipe;
};

Expand All @@ -233,4 +247,7 @@ void mgag200_i2c_destroy(struct mga_i2c_chan *i2c);
/* mgag200_mm.c */
int mgag200_mm_init(struct mga_device *mdev);

/* mgag200_pll.c */
int mgag200_pixpll_init(struct mgag200_pll *pixpll, struct mga_device *mdev);

#endif /* __MGAG200_DRV_H__ */
Loading

0 comments on commit 2545ac9

Please sign in to comment.