Home | History | Annotate | Line # | Download | only in imx
imx51_ipuv3var.h revision 1.1.6.1
      1      1.1  bsh /*	$NetBSD: imx51_ipuv3var.h,v 1.1.6.1 2014/08/20 00:02:46 tls Exp $	*/
      2      1.1  bsh 
      3      1.1  bsh /*
      4      1.1  bsh  * Copyright (c) 2009, 2011, 2012  Genetec Corporation.  All rights reserved.
      5      1.1  bsh  * Written by Hashimoto Kenichi for Genetec Corporation.
      6      1.1  bsh  *
      7      1.1  bsh  * Redistribution and use in source and binary forms, with or without
      8      1.1  bsh  * modification, are permitted provided that the following conditions
      9      1.1  bsh  * are met:
     10      1.1  bsh  * 1. Redistributions of source code must retain the above copyright
     11      1.1  bsh  *    notice, this list of conditions and the following disclaimer.
     12      1.1  bsh  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1  bsh  *    notice, this list of conditions and the following disclaimer in the
     14      1.1  bsh  *    documentation and/or other materials provided with the distribution.
     15      1.1  bsh  *
     16      1.1  bsh  * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
     17      1.1  bsh  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18      1.1  bsh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19      1.1  bsh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
     20      1.1  bsh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21      1.1  bsh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22      1.1  bsh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23      1.1  bsh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24      1.1  bsh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25      1.1  bsh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26      1.1  bsh  * POSSIBILITY OF SUCH DAMAGE.
     27      1.1  bsh  */
     28      1.1  bsh 
     29      1.1  bsh 
     30      1.1  bsh #ifndef _ARM_IMX_IMX51_IPUV3_H
     31      1.1  bsh #define _ARM_IMX_IMX51_IPUV3_H
     32      1.1  bsh 
     33      1.1  bsh #include <sys/bus.h>
     34      1.1  bsh #include <dev/rasops/rasops.h>
     35      1.1  bsh #include <dev/wscons/wsdisplay_vconsvar.h>
     36      1.1  bsh 
     37      1.1  bsh /* IPUV3 Contoroller */
     38      1.1  bsh struct imx51_ipuv3_screen {
     39      1.1  bsh 	LIST_ENTRY(imx51_ipuv3_screen) link;
     40      1.1  bsh 
     41      1.1  bsh 	/* Frame buffer */
     42      1.1  bsh 	bus_dmamap_t dma;
     43      1.1  bsh 	bus_dma_segment_t segs[1];
     44      1.1  bsh 	int 	nsegs;
     45      1.1  bsh 	size_t  buf_size;
     46      1.1  bsh 	size_t  map_size;
     47      1.1  bsh 	void 	*buf_va;
     48      1.1  bsh 	int	depth;
     49      1.1  bsh 	int	stride;
     50      1.1  bsh 
     51      1.1  bsh 	/* DMA frame descriptor */
     52      1.1  bsh 	struct	ipuv3_dma_descriptor *dma_desc;
     53      1.1  bsh 	paddr_t	dma_desc_pa;
     54  1.1.6.1  tls 
     55  1.1.6.1  tls 	/* rasterop */
     56  1.1.6.1  tls 	struct rasops_info rinfo;
     57      1.1  bsh };
     58      1.1  bsh 
     59      1.1  bsh struct lcd_panel_geometry {
     60      1.1  bsh 	short panel_width;
     61      1.1  bsh 	short panel_height;
     62      1.1  bsh 
     63      1.1  bsh 	uint32_t pixel_clk;
     64      1.1  bsh 
     65      1.1  bsh 	short hsync_width;
     66      1.1  bsh 	short left;
     67      1.1  bsh 	short right;
     68      1.1  bsh 
     69      1.1  bsh 	short vsync_width;
     70      1.1  bsh 	short upper;
     71      1.1  bsh 	short lower;
     72      1.1  bsh 
     73      1.1  bsh 	short panel_info;
     74      1.1  bsh #define IPUV3PANEL_SHARP	(1<<0)		/* sharp panel */
     75      1.1  bsh 	uint32_t panel_sig_pol;
     76      1.1  bsh };
     77      1.1  bsh 
     78      1.1  bsh struct imx51_ipuv3_softc {
     79      1.1  bsh 	device_t		dev;
     80      1.1  bsh 
     81      1.1  bsh 	/* control register */
     82      1.1  bsh 	bus_space_tag_t  	iot;
     83      1.1  bsh 	bus_space_handle_t	cm_ioh;		/* CM */
     84      1.1  bsh 	bus_space_handle_t	dmfc_ioh;	/* DMFC */
     85      1.1  bsh 	bus_space_handle_t	di0_ioh;	/* DI 0 */
     86      1.1  bsh 	bus_space_handle_t	dp_ioh;		/* DP */
     87      1.1  bsh 	bus_space_handle_t	dc_ioh;		/* DC */
     88      1.1  bsh 	bus_space_handle_t	idmac_ioh;	/* IDMAC */
     89      1.1  bsh 	bus_space_handle_t	cpmem_ioh;	/* CPMEM */
     90      1.1  bsh 	bus_space_handle_t	dctmpl_ioh;	/* DCTMPL */
     91      1.1  bsh 	bus_dma_tag_t    	dma_tag;
     92      1.1  bsh 
     93      1.1  bsh 	uint32_t		flags;
     94      1.1  bsh #define FLAG_NOUSE_ACBIAS	(1U<<0)
     95      1.1  bsh 
     96      1.1  bsh 	const struct lcd_panel_geometry *geometry;
     97      1.1  bsh 
     98      1.1  bsh 	int n_screens;
     99      1.1  bsh 	LIST_HEAD(, imx51_ipuv3_screen) screens;
    100      1.1  bsh 	struct imx51_ipuv3_screen *active;
    101      1.1  bsh 	void *ih;			/* interrupt handler */
    102      1.1  bsh 
    103      1.1  bsh 	/* virtual console support */
    104      1.1  bsh 	struct vcons_data vd;
    105      1.1  bsh 	struct vcons_screen console;
    106      1.1  bsh 	int mode;
    107      1.1  bsh };
    108      1.1  bsh 
    109      1.1  bsh /*
    110      1.1  bsh  * we need bits-per-pixel value to configure wsdisplay screen
    111      1.1  bsh  */
    112      1.1  bsh struct imx51_wsscreen_descr {
    113      1.1  bsh 	struct wsscreen_descr  c;	/* standard descriptor */
    114      1.1  bsh 	int depth;			/* bits per pixel */
    115      1.1  bsh 	int flags;			/* rasops flags */
    116      1.1  bsh };
    117      1.1  bsh 
    118      1.1  bsh struct imx51_ipuv3_softc;
    119      1.1  bsh 
    120      1.1  bsh void	imx51_ipuv3_attach_sub(struct imx51_ipuv3_softc *,
    121      1.1  bsh 	    struct axi_attach_args *, const struct lcd_panel_geometry *);
    122  1.1.6.1  tls int	imx51_ipuv3_cnattach(bool, struct imx51_wsscreen_descr *,
    123  1.1.6.1  tls 	    struct wsdisplay_accessops *,
    124  1.1.6.1  tls 	    const struct lcd_panel_geometry *);
    125      1.1  bsh void	imx51_ipuv3_start_dma(struct imx51_ipuv3_softc *,
    126      1.1  bsh 	    struct imx51_ipuv3_screen *);
    127      1.1  bsh 
    128      1.1  bsh void	imx51_ipuv3_geometry(struct imx51_ipuv3_softc *,
    129      1.1  bsh 	    const struct lcd_panel_geometry *);
    130      1.1  bsh int	imx51_ipuv3_new_screen(struct imx51_ipuv3_softc *, int,
    131      1.1  bsh 	    struct imx51_ipuv3_screen **);
    132      1.1  bsh 
    133  1.1.6.1  tls int	imx51_ipuv3_alloc_screen(void *, const struct wsscreen_descr *,
    134  1.1.6.1  tls 	    void **, int *, int *, long *);
    135  1.1.6.1  tls void	imx51_ipuv3_free_screen(void *, void *);
    136      1.1  bsh int	imx51_ipuv3_ioctl(void *, void *, u_long, void *, int, struct lwp *);
    137      1.1  bsh paddr_t	imx51_ipuv3_mmap(void *, void *, off_t, int);
    138  1.1.6.1  tls int	imx51_ipuv3_show_screen(void *, void *, int, void (*)(void *, int, int),
    139  1.1.6.1  tls 	    void *);
    140      1.1  bsh 
    141      1.1  bsh extern const struct wsdisplay_emulops imx51_ipuv3_emulops;
    142      1.1  bsh 
    143      1.1  bsh #endif /* _ARM_IMX_IMX51_IPUV3_H */
    144