xref: /linux/drivers/gpu/drm/mxsfb/mxsfb_drv.h (revision 63aa581c3019301e998b148c1eb63a108aca365f)
1c942fddfSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
245d59d70SMarek Vasut /*
345d59d70SMarek Vasut  * Copyright (C) 2016 Marek Vasut <marex@denx.de>
445d59d70SMarek Vasut  *
545d59d70SMarek Vasut  * i.MX23/i.MX28/i.MX6SX MXSFB LCD controller driver.
645d59d70SMarek Vasut  */
745d59d70SMarek Vasut 
845d59d70SMarek Vasut #ifndef __MXSFB_DRV_H__
945d59d70SMarek Vasut #define __MXSFB_DRV_H__
1045d59d70SMarek Vasut 
11ae1ed009SLaurent Pinchart #include <drm/drm_crtc.h>
12ae1ed009SLaurent Pinchart #include <drm/drm_device.h>
13ae1ed009SLaurent Pinchart #include <drm/drm_encoder.h>
14ae1ed009SLaurent Pinchart #include <drm/drm_plane.h>
15ae1ed009SLaurent Pinchart 
16ae1ed009SLaurent Pinchart struct clk;
17c42001e3SLaurent Pinchart 
1845d59d70SMarek Vasut struct mxsfb_devdata {
1945d59d70SMarek Vasut 	unsigned int	transfer_count;
2045d59d70SMarek Vasut 	unsigned int	cur_buf;
2145d59d70SMarek Vasut 	unsigned int	next_buf;
2245d59d70SMarek Vasut 	unsigned int	hs_wdth_mask;
2345d59d70SMarek Vasut 	unsigned int	hs_wdth_shift;
24*63aa581cSLaurent Pinchart 	bool		has_overlay;
2545d59d70SMarek Vasut };
2645d59d70SMarek Vasut 
2745d59d70SMarek Vasut struct mxsfb_drm_private {
2845d59d70SMarek Vasut 	const struct mxsfb_devdata	*devdata;
2945d59d70SMarek Vasut 
3045d59d70SMarek Vasut 	void __iomem			*base;	/* registers */
3145d59d70SMarek Vasut 	struct clk			*clk;
3245d59d70SMarek Vasut 	struct clk			*clk_axi;
3345d59d70SMarek Vasut 	struct clk			*clk_disp_axi;
3445d59d70SMarek Vasut 
35c42001e3SLaurent Pinchart 	struct drm_device		*drm;
36*63aa581cSLaurent Pinchart 	struct {
37*63aa581cSLaurent Pinchart 		struct drm_plane	primary;
38*63aa581cSLaurent Pinchart 		struct drm_plane	overlay;
39*63aa581cSLaurent Pinchart 	} planes;
40ae1ed009SLaurent Pinchart 	struct drm_crtc			crtc;
41ae1ed009SLaurent Pinchart 	struct drm_encoder		encoder;
42d0234043SRobert Chiras 	struct drm_connector		*connector;
43d0234043SRobert Chiras 	struct drm_bridge		*bridge;
4445d59d70SMarek Vasut };
4545d59d70SMarek Vasut 
46ae1ed009SLaurent Pinchart static inline struct mxsfb_drm_private *
47ae1ed009SLaurent Pinchart to_mxsfb_drm_private(struct drm_device *drm)
48ae1ed009SLaurent Pinchart {
49ae1ed009SLaurent Pinchart 	return drm->dev_private;
50ae1ed009SLaurent Pinchart }
5145d59d70SMarek Vasut 
5245d59d70SMarek Vasut void mxsfb_enable_axi_clk(struct mxsfb_drm_private *mxsfb);
5345d59d70SMarek Vasut void mxsfb_disable_axi_clk(struct mxsfb_drm_private *mxsfb);
5445d59d70SMarek Vasut 
55ae1ed009SLaurent Pinchart int mxsfb_kms_init(struct mxsfb_drm_private *mxsfb);
5645d59d70SMarek Vasut 
5745d59d70SMarek Vasut #endif /* __MXSFB_DRV_H__ */
58