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