1bbbe775eSNeil Armstrong /* 2bbbe775eSNeil Armstrong * Copyright (C) 2016 BayLibre, SAS 3bbbe775eSNeil Armstrong * Author: Neil Armstrong <narmstrong@baylibre.com> 4bbbe775eSNeil Armstrong * 5bbbe775eSNeil Armstrong * This program is free software; you can redistribute it and/or 6bbbe775eSNeil Armstrong * modify it under the terms of the GNU General Public License as 7bbbe775eSNeil Armstrong * published by the Free Software Foundation; either version 2 of the 8bbbe775eSNeil Armstrong * License, or (at your option) any later version. 9bbbe775eSNeil Armstrong * 10bbbe775eSNeil Armstrong * This program is distributed in the hope that it will be useful, but 11bbbe775eSNeil Armstrong * WITHOUT ANY WARRANTY; without even the implied warranty of 12bbbe775eSNeil Armstrong * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13bbbe775eSNeil Armstrong * General Public License for more details. 14bbbe775eSNeil Armstrong * 15bbbe775eSNeil Armstrong * You should have received a copy of the GNU General Public License 16bbbe775eSNeil Armstrong * along with this program; if not, see <http://www.gnu.org/licenses/>. 17bbbe775eSNeil Armstrong */ 18bbbe775eSNeil Armstrong 19bbbe775eSNeil Armstrong #ifndef __MESON_DRV_H 20bbbe775eSNeil Armstrong #define __MESON_DRV_H 21bbbe775eSNeil Armstrong 22bbbe775eSNeil Armstrong #include <linux/platform_device.h> 23bbbe775eSNeil Armstrong #include <linux/regmap.h> 24bbbe775eSNeil Armstrong #include <linux/of.h> 2566cae477SMaxime Jourdan #include <linux/soc/amlogic/meson-canvas.h> 26bbbe775eSNeil Armstrong #include <drm/drmP.h> 27bbbe775eSNeil Armstrong 28bbbe775eSNeil Armstrong struct meson_drm { 29bbbe775eSNeil Armstrong struct device *dev; 30bbbe775eSNeil Armstrong void __iomem *io_base; 31bbbe775eSNeil Armstrong struct regmap *hhi; 32bbbe775eSNeil Armstrong struct regmap *dmc; 33bbbe775eSNeil Armstrong int vsync_irq; 34bbbe775eSNeil Armstrong 3566cae477SMaxime Jourdan struct meson_canvas *canvas; 3666cae477SMaxime Jourdan u8 canvas_id_osd1; 37*f9a23481SNeil Armstrong u8 canvas_id_vd1_0; 38*f9a23481SNeil Armstrong u8 canvas_id_vd1_1; 39*f9a23481SNeil Armstrong u8 canvas_id_vd1_2; 4066cae477SMaxime Jourdan 41bbbe775eSNeil Armstrong struct drm_device *drm; 42bbbe775eSNeil Armstrong struct drm_crtc *crtc; 43bbbe775eSNeil Armstrong struct drm_plane *primary_plane; 44*f9a23481SNeil Armstrong struct drm_plane *overlay_plane; 45bbbe775eSNeil Armstrong 46bbbe775eSNeil Armstrong /* Components Data */ 47bbbe775eSNeil Armstrong struct { 48bbbe775eSNeil Armstrong bool osd1_enabled; 49bbbe775eSNeil Armstrong bool osd1_interlace; 50bbbe775eSNeil Armstrong bool osd1_commit; 51bbbe775eSNeil Armstrong uint32_t osd1_ctrl_stat; 52bbbe775eSNeil Armstrong uint32_t osd1_blk0_cfg[5]; 53e88230a3SNeil Armstrong uint32_t osd1_addr; 54e88230a3SNeil Armstrong uint32_t osd1_stride; 55e88230a3SNeil Armstrong uint32_t osd1_height; 56*f9a23481SNeil Armstrong 57*f9a23481SNeil Armstrong bool vd1_enabled; 58*f9a23481SNeil Armstrong bool vd1_commit; 59*f9a23481SNeil Armstrong unsigned int vd1_planes; 60*f9a23481SNeil Armstrong uint32_t vd1_if0_gen_reg; 61*f9a23481SNeil Armstrong uint32_t vd1_if0_luma_x0; 62*f9a23481SNeil Armstrong uint32_t vd1_if0_luma_y0; 63*f9a23481SNeil Armstrong uint32_t vd1_if0_chroma_x0; 64*f9a23481SNeil Armstrong uint32_t vd1_if0_chroma_y0; 65*f9a23481SNeil Armstrong uint32_t vd1_if0_repeat_loop; 66*f9a23481SNeil Armstrong uint32_t vd1_if0_luma0_rpt_pat; 67*f9a23481SNeil Armstrong uint32_t vd1_if0_chroma0_rpt_pat; 68*f9a23481SNeil Armstrong uint32_t vd1_range_map_y; 69*f9a23481SNeil Armstrong uint32_t vd1_range_map_cb; 70*f9a23481SNeil Armstrong uint32_t vd1_range_map_cr; 71*f9a23481SNeil Armstrong uint32_t viu_vd1_fmt_w; 72*f9a23481SNeil Armstrong uint32_t vd1_if0_canvas0; 73*f9a23481SNeil Armstrong uint32_t vd1_if0_gen_reg2; 74*f9a23481SNeil Armstrong uint32_t viu_vd1_fmt_ctrl; 75*f9a23481SNeil Armstrong uint32_t vd1_addr0; 76*f9a23481SNeil Armstrong uint32_t vd1_addr1; 77*f9a23481SNeil Armstrong uint32_t vd1_addr2; 78*f9a23481SNeil Armstrong uint32_t vd1_stride0; 79*f9a23481SNeil Armstrong uint32_t vd1_stride1; 80*f9a23481SNeil Armstrong uint32_t vd1_stride2; 81*f9a23481SNeil Armstrong uint32_t vd1_height0; 82*f9a23481SNeil Armstrong uint32_t vd1_height1; 83*f9a23481SNeil Armstrong uint32_t vd1_height2; 84*f9a23481SNeil Armstrong uint32_t vpp_pic_in_height; 85*f9a23481SNeil Armstrong uint32_t vpp_postblend_vd1_h_start_end; 86*f9a23481SNeil Armstrong uint32_t vpp_postblend_vd1_v_start_end; 87*f9a23481SNeil Armstrong uint32_t vpp_hsc_region12_startp; 88*f9a23481SNeil Armstrong uint32_t vpp_hsc_region34_startp; 89*f9a23481SNeil Armstrong uint32_t vpp_hsc_region4_endp; 90*f9a23481SNeil Armstrong uint32_t vpp_hsc_start_phase_step; 91*f9a23481SNeil Armstrong uint32_t vpp_hsc_region1_phase_slope; 92*f9a23481SNeil Armstrong uint32_t vpp_hsc_region3_phase_slope; 93*f9a23481SNeil Armstrong uint32_t vpp_line_in_length; 94*f9a23481SNeil Armstrong uint32_t vpp_preblend_h_size; 95*f9a23481SNeil Armstrong uint32_t vpp_vsc_region12_startp; 96*f9a23481SNeil Armstrong uint32_t vpp_vsc_region34_startp; 97*f9a23481SNeil Armstrong uint32_t vpp_vsc_region4_endp; 98*f9a23481SNeil Armstrong uint32_t vpp_vsc_start_phase_step; 99*f9a23481SNeil Armstrong uint32_t vpp_vsc_ini_phase; 100*f9a23481SNeil Armstrong uint32_t vpp_vsc_phase_ctrl; 101*f9a23481SNeil Armstrong uint32_t vpp_hsc_phase_ctrl; 102*f9a23481SNeil Armstrong uint32_t vpp_blend_vd2_h_start_end; 103*f9a23481SNeil Armstrong uint32_t vpp_blend_vd2_v_start_end; 104bbbe775eSNeil Armstrong } viu; 105bbbe775eSNeil Armstrong 106bbbe775eSNeil Armstrong struct { 107bbbe775eSNeil Armstrong unsigned int current_mode; 1083f68be7dSNeil Armstrong bool hdmi_repeat; 1093f68be7dSNeil Armstrong bool venc_repeat; 1103f68be7dSNeil Armstrong bool hdmi_use_enci; 111bbbe775eSNeil Armstrong } venc; 112bbbe775eSNeil Armstrong }; 113bbbe775eSNeil Armstrong 114bbbe775eSNeil Armstrong static inline int meson_vpu_is_compatible(struct meson_drm *priv, 115bbbe775eSNeil Armstrong const char *compat) 116bbbe775eSNeil Armstrong { 117bbbe775eSNeil Armstrong return of_device_is_compatible(priv->dev->of_node, compat); 118bbbe775eSNeil Armstrong } 119bbbe775eSNeil Armstrong 120bbbe775eSNeil Armstrong #endif /* __MESON_DRV_H */ 121