xref: /linux/drivers/gpu/drm/mxsfb/mxsfb_drv.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
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;
2463aa581cSLaurent Pinchart 	bool		has_overlay;
259891cb54SMarek Vasut 	bool		has_ctrl2;
26*05ecc678SMarek Vasut 	bool		has_crc32;
2745d59d70SMarek Vasut };
2845d59d70SMarek Vasut 
2945d59d70SMarek Vasut struct mxsfb_drm_private {
3045d59d70SMarek Vasut 	const struct mxsfb_devdata	*devdata;
3145d59d70SMarek Vasut 
3245d59d70SMarek Vasut 	void __iomem			*base;	/* registers */
3345d59d70SMarek Vasut 	struct clk			*clk;
3445d59d70SMarek Vasut 	struct clk			*clk_axi;
3545d59d70SMarek Vasut 	struct clk			*clk_disp_axi;
3645d59d70SMarek Vasut 
375fc40f41SThomas Zimmermann 	unsigned int			irq;
385fc40f41SThomas Zimmermann 
39c42001e3SLaurent Pinchart 	struct drm_device		*drm;
4063aa581cSLaurent Pinchart 	struct {
4163aa581cSLaurent Pinchart 		struct drm_plane	primary;
4263aa581cSLaurent Pinchart 		struct drm_plane	overlay;
4363aa581cSLaurent Pinchart 	} planes;
44ae1ed009SLaurent Pinchart 	struct drm_crtc			crtc;
45ae1ed009SLaurent Pinchart 	struct drm_encoder		encoder;
46d0234043SRobert Chiras 	struct drm_connector		*connector;
47d0234043SRobert Chiras 	struct drm_bridge		*bridge;
48*05ecc678SMarek Vasut 
49*05ecc678SMarek Vasut 	bool				crc_active;
5045d59d70SMarek Vasut };
5145d59d70SMarek Vasut 
52ae1ed009SLaurent Pinchart static inline struct mxsfb_drm_private *
to_mxsfb_drm_private(struct drm_device * drm)53ae1ed009SLaurent Pinchart to_mxsfb_drm_private(struct drm_device *drm)
54ae1ed009SLaurent Pinchart {
55ae1ed009SLaurent Pinchart 	return drm->dev_private;
56ae1ed009SLaurent Pinchart }
5745d59d70SMarek Vasut 
5845d59d70SMarek Vasut void mxsfb_enable_axi_clk(struct mxsfb_drm_private *mxsfb);
5945d59d70SMarek Vasut void mxsfb_disable_axi_clk(struct mxsfb_drm_private *mxsfb);
6045d59d70SMarek Vasut 
61ae1ed009SLaurent Pinchart int mxsfb_kms_init(struct mxsfb_drm_private *mxsfb);
6245d59d70SMarek Vasut 
6345d59d70SMarek Vasut #endif /* __MXSFB_DRV_H__ */
64