1d219673dSBenjamin Gaignard /* 2d219673dSBenjamin Gaignard * Copyright (C) STMicroelectronics SA 2014 3d219673dSBenjamin Gaignard * Authors: Benjamin Gaignard <benjamin.gaignard@st.com> 4d219673dSBenjamin Gaignard * Fabien Dessenne <fabien.dessenne@st.com> 5d219673dSBenjamin Gaignard * for STMicroelectronics. 6d219673dSBenjamin Gaignard * License terms: GNU General Public License (GPL), version 2 7d219673dSBenjamin Gaignard */ 8d219673dSBenjamin Gaignard 9d219673dSBenjamin Gaignard #ifndef _STI_COMPOSITOR_H_ 10d219673dSBenjamin Gaignard #define _STI_COMPOSITOR_H_ 11d219673dSBenjamin Gaignard 12d219673dSBenjamin Gaignard #include <linux/clk.h> 13d219673dSBenjamin Gaignard #include <linux/kernel.h> 14d219673dSBenjamin Gaignard 15d219673dSBenjamin Gaignard #include "sti_mixer.h" 169e1f05b2SVincent Abriou #include "sti_plane.h" 17d219673dSBenjamin Gaignard 18d219673dSBenjamin Gaignard #define WAIT_NEXT_VSYNC_MS 50 /*ms*/ 19d219673dSBenjamin Gaignard 20d219673dSBenjamin Gaignard #define STI_MAX_MIXER 2 21871bcdfeSVincent Abriou #define STI_MAX_VID 1 22d219673dSBenjamin Gaignard 23d219673dSBenjamin Gaignard enum sti_compositor_subdev_type { 24d219673dSBenjamin Gaignard STI_MIXER_MAIN_SUBDEV, 25d219673dSBenjamin Gaignard STI_MIXER_AUX_SUBDEV, 26d219673dSBenjamin Gaignard STI_GPD_SUBDEV, 27d219673dSBenjamin Gaignard STI_VID_SUBDEV, 28d219673dSBenjamin Gaignard STI_CURSOR_SUBDEV, 29d219673dSBenjamin Gaignard }; 30d219673dSBenjamin Gaignard 31d219673dSBenjamin Gaignard struct sti_compositor_subdev_descriptor { 32d219673dSBenjamin Gaignard enum sti_compositor_subdev_type type; 33d219673dSBenjamin Gaignard int id; 34d219673dSBenjamin Gaignard unsigned int offset; 35d219673dSBenjamin Gaignard }; 36d219673dSBenjamin Gaignard 37d219673dSBenjamin Gaignard /** 38d219673dSBenjamin Gaignard * STI Compositor data structure 39d219673dSBenjamin Gaignard * 40d219673dSBenjamin Gaignard * @nb_subdev: number of subdevices supported by the compositor 41d219673dSBenjamin Gaignard * @subdev_desc: subdev list description 42d219673dSBenjamin Gaignard */ 43d219673dSBenjamin Gaignard #define MAX_SUBDEV 9 44d219673dSBenjamin Gaignard struct sti_compositor_data { 45d219673dSBenjamin Gaignard unsigned int nb_subdev; 46d219673dSBenjamin Gaignard struct sti_compositor_subdev_descriptor subdev_desc[MAX_SUBDEV]; 47d219673dSBenjamin Gaignard }; 48d219673dSBenjamin Gaignard 49d219673dSBenjamin Gaignard /** 50d219673dSBenjamin Gaignard * STI Compositor structure 51d219673dSBenjamin Gaignard * 52d219673dSBenjamin Gaignard * @dev: driver device 53d219673dSBenjamin Gaignard * @regs: registers (main) 54d219673dSBenjamin Gaignard * @data: device data 55d219673dSBenjamin Gaignard * @clk_compo_main: clock for main compo 56d219673dSBenjamin Gaignard * @clk_compo_aux: clock for aux compo 57d219673dSBenjamin Gaignard * @clk_pix_main: pixel clock for main path 58d219673dSBenjamin Gaignard * @clk_pix_aux: pixel clock for aux path 59d219673dSBenjamin Gaignard * @rst_main: reset control of the main path 60d219673dSBenjamin Gaignard * @rst_aux: reset control of the aux path 61d219673dSBenjamin Gaignard * @mixer: array of mixers 62871bcdfeSVincent Abriou * @vid: array of vids 63*ffdbb82cSFabien Dessenne * @vtg: array of vtgs 64ae217850SFabien Dessenne * @vtg_vblank_nb: array of callbacks for VTG VSYNC notification 65d219673dSBenjamin Gaignard */ 66d219673dSBenjamin Gaignard struct sti_compositor { 67d219673dSBenjamin Gaignard struct device *dev; 68d219673dSBenjamin Gaignard void __iomem *regs; 69d219673dSBenjamin Gaignard struct sti_compositor_data data; 70d219673dSBenjamin Gaignard struct clk *clk_compo_main; 71d219673dSBenjamin Gaignard struct clk *clk_compo_aux; 72d219673dSBenjamin Gaignard struct clk *clk_pix_main; 73d219673dSBenjamin Gaignard struct clk *clk_pix_aux; 74d219673dSBenjamin Gaignard struct reset_control *rst_main; 75d219673dSBenjamin Gaignard struct reset_control *rst_aux; 76d219673dSBenjamin Gaignard struct sti_mixer *mixer[STI_MAX_MIXER]; 77871bcdfeSVincent Abriou struct sti_vid *vid[STI_MAX_VID]; 78*ffdbb82cSFabien Dessenne struct sti_vtg *vtg[STI_MAX_MIXER]; 79ae217850SFabien Dessenne struct notifier_block vtg_vblank_nb[STI_MAX_MIXER]; 80d219673dSBenjamin Gaignard }; 81d219673dSBenjamin Gaignard 8283af0a48SBenjamin Gaignard int sti_compositor_debufs_init(struct sti_compositor *compo, 8383af0a48SBenjamin Gaignard struct drm_minor *minor); 8483af0a48SBenjamin Gaignard 85d219673dSBenjamin Gaignard #endif 86