imx51_ipuv3var.h revision 1.2.4.1 1 1.2.4.1 skrll /* $NetBSD: imx51_ipuv3var.h,v 1.2.4.1 2015/12/27 12:09:30 skrll 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 #ifndef _ARM_IMX_IMX51_IPUV3_H
30 1.1 bsh #define _ARM_IMX_IMX51_IPUV3_H
31 1.1 bsh
32 1.2.4.1 skrll #include <dev/wscons/wsconsio.h>
33 1.2.4.1 skrll #include <dev/wscons/wsdisplayvar.h>
34 1.2.4.1 skrll
35 1.1 bsh #include <sys/bus.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 bsh };
55 1.1 bsh
56 1.1 bsh struct lcd_panel_geometry {
57 1.2.4.1 skrll int depth;
58 1.2.4.1 skrll
59 1.1 bsh short panel_width;
60 1.1 bsh short panel_height;
61 1.1 bsh
62 1.1 bsh uint32_t pixel_clk;
63 1.1 bsh
64 1.1 bsh short hsync_width;
65 1.1 bsh short left;
66 1.1 bsh short right;
67 1.1 bsh
68 1.1 bsh short vsync_width;
69 1.1 bsh short upper;
70 1.1 bsh short lower;
71 1.1 bsh
72 1.1 bsh short panel_info;
73 1.1 bsh #define IPUV3PANEL_SHARP (1<<0) /* sharp panel */
74 1.1 bsh uint32_t panel_sig_pol;
75 1.1 bsh };
76 1.1 bsh
77 1.1 bsh struct imx51_ipuv3_softc {
78 1.1 bsh device_t dev;
79 1.1 bsh
80 1.1 bsh /* control register */
81 1.1 bsh bus_space_tag_t iot;
82 1.1 bsh bus_space_handle_t cm_ioh; /* CM */
83 1.1 bsh bus_space_handle_t dmfc_ioh; /* DMFC */
84 1.1 bsh bus_space_handle_t di0_ioh; /* DI 0 */
85 1.1 bsh bus_space_handle_t dp_ioh; /* DP */
86 1.1 bsh bus_space_handle_t dc_ioh; /* DC */
87 1.1 bsh bus_space_handle_t idmac_ioh; /* IDMAC */
88 1.1 bsh bus_space_handle_t cpmem_ioh; /* CPMEM */
89 1.1 bsh bus_space_handle_t dctmpl_ioh; /* DCTMPL */
90 1.1 bsh bus_dma_tag_t dma_tag;
91 1.1 bsh
92 1.1 bsh uint32_t flags;
93 1.1 bsh #define FLAG_NOUSE_ACBIAS (1U<<0)
94 1.1 bsh
95 1.1 bsh const struct lcd_panel_geometry *geometry;
96 1.1 bsh
97 1.1 bsh int n_screens;
98 1.1 bsh LIST_HEAD(, imx51_ipuv3_screen) screens;
99 1.1 bsh struct imx51_ipuv3_screen *active;
100 1.1 bsh void *ih; /* interrupt handler */
101 1.1 bsh
102 1.2.4.1 skrll device_t fbdev;
103 1.1 bsh };
104 1.1 bsh
105 1.1 bsh struct imx51_ipuv3_softc;
106 1.1 bsh
107 1.1 bsh void imx51_ipuv3_attach_sub(struct imx51_ipuv3_softc *,
108 1.2.4.1 skrll struct axi_attach_args *, const struct lcd_panel_geometry *);
109 1.2.4.1 skrll int imx51_ipuv3_cnattach(bool);
110 1.1 bsh void imx51_ipuv3_start_dma(struct imx51_ipuv3_softc *,
111 1.1 bsh struct imx51_ipuv3_screen *);
112 1.1 bsh
113 1.1 bsh void imx51_ipuv3_geometry(struct imx51_ipuv3_softc *,
114 1.1 bsh const struct lcd_panel_geometry *);
115 1.2.4.1 skrll int imx51_ipuv3_new_screen(struct imx51_ipuv3_softc *,
116 1.1 bsh struct imx51_ipuv3_screen **);
117 1.1 bsh
118 1.2 hkenken int imx51_ipuv3_show_screen(void *, void *, int, void (*)(void *, int, int),
119 1.2 hkenken void *);
120 1.1 bsh
121 1.1 bsh #endif /* _ARM_IMX_IMX51_IPUV3_H */
122