1*e54cb226Shkenken /* $NetBSD: imx51_ipuv3var.h,v 1.3 2015/12/21 04:26:28 hkenken Exp $ */ 240bd57efSbsh 340bd57efSbsh /* 440bd57efSbsh * Copyright (c) 2009, 2011, 2012 Genetec Corporation. All rights reserved. 540bd57efSbsh * Written by Hashimoto Kenichi for Genetec Corporation. 640bd57efSbsh * 740bd57efSbsh * Redistribution and use in source and binary forms, with or without 840bd57efSbsh * modification, are permitted provided that the following conditions 940bd57efSbsh * are met: 1040bd57efSbsh * 1. Redistributions of source code must retain the above copyright 1140bd57efSbsh * notice, this list of conditions and the following disclaimer. 1240bd57efSbsh * 2. Redistributions in binary form must reproduce the above copyright 1340bd57efSbsh * notice, this list of conditions and the following disclaimer in the 1440bd57efSbsh * documentation and/or other materials provided with the distribution. 1540bd57efSbsh * 1640bd57efSbsh * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND 1740bd57efSbsh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 1840bd57efSbsh * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1940bd57efSbsh * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION 2040bd57efSbsh * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2140bd57efSbsh * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2240bd57efSbsh * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2340bd57efSbsh * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2440bd57efSbsh * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2540bd57efSbsh * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2640bd57efSbsh * POSSIBILITY OF SUCH DAMAGE. 2740bd57efSbsh */ 2840bd57efSbsh 2940bd57efSbsh #ifndef _ARM_IMX_IMX51_IPUV3_H 3040bd57efSbsh #define _ARM_IMX_IMX51_IPUV3_H 3140bd57efSbsh 32*e54cb226Shkenken #include <dev/wscons/wsconsio.h> 33*e54cb226Shkenken #include <dev/wscons/wsdisplayvar.h> 34*e54cb226Shkenken 3540bd57efSbsh #include <sys/bus.h> 3640bd57efSbsh 3740bd57efSbsh /* IPUV3 Contoroller */ 3840bd57efSbsh struct imx51_ipuv3_screen { 3940bd57efSbsh LIST_ENTRY(imx51_ipuv3_screen) link; 4040bd57efSbsh 4140bd57efSbsh /* Frame buffer */ 4240bd57efSbsh bus_dmamap_t dma; 4340bd57efSbsh bus_dma_segment_t segs[1]; 4440bd57efSbsh int nsegs; 4540bd57efSbsh size_t buf_size; 4640bd57efSbsh size_t map_size; 4740bd57efSbsh void *buf_va; 4840bd57efSbsh int depth; 4940bd57efSbsh int stride; 5040bd57efSbsh 5140bd57efSbsh /* DMA frame descriptor */ 5240bd57efSbsh struct ipuv3_dma_descriptor *dma_desc; 5340bd57efSbsh paddr_t dma_desc_pa; 5440bd57efSbsh }; 5540bd57efSbsh 5640bd57efSbsh struct lcd_panel_geometry { 57*e54cb226Shkenken int depth; 58*e54cb226Shkenken 5940bd57efSbsh short panel_width; 6040bd57efSbsh short panel_height; 6140bd57efSbsh 6240bd57efSbsh uint32_t pixel_clk; 6340bd57efSbsh 6440bd57efSbsh short hsync_width; 6540bd57efSbsh short left; 6640bd57efSbsh short right; 6740bd57efSbsh 6840bd57efSbsh short vsync_width; 6940bd57efSbsh short upper; 7040bd57efSbsh short lower; 7140bd57efSbsh 7240bd57efSbsh short panel_info; 7340bd57efSbsh #define IPUV3PANEL_SHARP (1<<0) /* sharp panel */ 7440bd57efSbsh uint32_t panel_sig_pol; 7540bd57efSbsh }; 7640bd57efSbsh 7740bd57efSbsh struct imx51_ipuv3_softc { 7840bd57efSbsh device_t dev; 7940bd57efSbsh 8040bd57efSbsh /* control register */ 8140bd57efSbsh bus_space_tag_t iot; 8240bd57efSbsh bus_space_handle_t cm_ioh; /* CM */ 8340bd57efSbsh bus_space_handle_t dmfc_ioh; /* DMFC */ 8440bd57efSbsh bus_space_handle_t di0_ioh; /* DI 0 */ 8540bd57efSbsh bus_space_handle_t dp_ioh; /* DP */ 8640bd57efSbsh bus_space_handle_t dc_ioh; /* DC */ 8740bd57efSbsh bus_space_handle_t idmac_ioh; /* IDMAC */ 8840bd57efSbsh bus_space_handle_t cpmem_ioh; /* CPMEM */ 8940bd57efSbsh bus_space_handle_t dctmpl_ioh; /* DCTMPL */ 9040bd57efSbsh bus_dma_tag_t dma_tag; 9140bd57efSbsh 9240bd57efSbsh uint32_t flags; 9340bd57efSbsh #define FLAG_NOUSE_ACBIAS (1U<<0) 9440bd57efSbsh 9540bd57efSbsh const struct lcd_panel_geometry *geometry; 9640bd57efSbsh 9740bd57efSbsh int n_screens; 9840bd57efSbsh LIST_HEAD(, imx51_ipuv3_screen) screens; 9940bd57efSbsh struct imx51_ipuv3_screen *active; 10040bd57efSbsh void *ih; /* interrupt handler */ 10140bd57efSbsh 102*e54cb226Shkenken device_t fbdev; 10340bd57efSbsh }; 10440bd57efSbsh 10540bd57efSbsh struct imx51_ipuv3_softc; 10640bd57efSbsh 10740bd57efSbsh void imx51_ipuv3_attach_sub(struct imx51_ipuv3_softc *, 10840bd57efSbsh struct axi_attach_args *, const struct lcd_panel_geometry *); 109*e54cb226Shkenken int imx51_ipuv3_cnattach(bool); 11040bd57efSbsh void imx51_ipuv3_start_dma(struct imx51_ipuv3_softc *, 11140bd57efSbsh struct imx51_ipuv3_screen *); 11240bd57efSbsh 11340bd57efSbsh void imx51_ipuv3_geometry(struct imx51_ipuv3_softc *, 11440bd57efSbsh const struct lcd_panel_geometry *); 115*e54cb226Shkenken int imx51_ipuv3_new_screen(struct imx51_ipuv3_softc *, 11640bd57efSbsh struct imx51_ipuv3_screen **); 11740bd57efSbsh 1184af04cbaShkenken int imx51_ipuv3_show_screen(void *, void *, int, void (*)(void *, int, int), 1194af04cbaShkenken void *); 12040bd57efSbsh 12140bd57efSbsh #endif /* _ARM_IMX_IMX51_IPUV3_H */ 122