162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) STMicroelectronics SA 2014 462306a36Sopenharmony_ci * Authors: Benjamin Gaignard <benjamin.gaignard@st.com> 562306a36Sopenharmony_ci * Fabien Dessenne <fabien.dessenne@st.com> 662306a36Sopenharmony_ci * for STMicroelectronics. 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef _STI_COMPOSITOR_H_ 1062306a36Sopenharmony_ci#define _STI_COMPOSITOR_H_ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include <linux/clk.h> 1362306a36Sopenharmony_ci#include <linux/kernel.h> 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#include "sti_mixer.h" 1662306a36Sopenharmony_ci#include "sti_plane.h" 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#define WAIT_NEXT_VSYNC_MS 50 /*ms*/ 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#define STI_MAX_MIXER 2 2162306a36Sopenharmony_ci#define STI_MAX_VID 1 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_cienum sti_compositor_subdev_type { 2462306a36Sopenharmony_ci STI_MIXER_MAIN_SUBDEV, 2562306a36Sopenharmony_ci STI_MIXER_AUX_SUBDEV, 2662306a36Sopenharmony_ci STI_GPD_SUBDEV, 2762306a36Sopenharmony_ci STI_VID_SUBDEV, 2862306a36Sopenharmony_ci STI_CURSOR_SUBDEV, 2962306a36Sopenharmony_ci}; 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_cistruct sti_compositor_subdev_descriptor { 3262306a36Sopenharmony_ci enum sti_compositor_subdev_type type; 3362306a36Sopenharmony_ci int id; 3462306a36Sopenharmony_ci unsigned int offset; 3562306a36Sopenharmony_ci}; 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci/** 3862306a36Sopenharmony_ci * STI Compositor data structure 3962306a36Sopenharmony_ci * 4062306a36Sopenharmony_ci * @nb_subdev: number of subdevices supported by the compositor 4162306a36Sopenharmony_ci * @subdev_desc: subdev list description 4262306a36Sopenharmony_ci */ 4362306a36Sopenharmony_ci#define MAX_SUBDEV 9 4462306a36Sopenharmony_cistruct sti_compositor_data { 4562306a36Sopenharmony_ci unsigned int nb_subdev; 4662306a36Sopenharmony_ci struct sti_compositor_subdev_descriptor subdev_desc[MAX_SUBDEV]; 4762306a36Sopenharmony_ci}; 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci/** 5062306a36Sopenharmony_ci * STI Compositor structure 5162306a36Sopenharmony_ci * 5262306a36Sopenharmony_ci * @dev: driver device 5362306a36Sopenharmony_ci * @regs: registers (main) 5462306a36Sopenharmony_ci * @data: device data 5562306a36Sopenharmony_ci * @clk_compo_main: clock for main compo 5662306a36Sopenharmony_ci * @clk_compo_aux: clock for aux compo 5762306a36Sopenharmony_ci * @clk_pix_main: pixel clock for main path 5862306a36Sopenharmony_ci * @clk_pix_aux: pixel clock for aux path 5962306a36Sopenharmony_ci * @rst_main: reset control of the main path 6062306a36Sopenharmony_ci * @rst_aux: reset control of the aux path 6162306a36Sopenharmony_ci * @mixer: array of mixers 6262306a36Sopenharmony_ci * @vid: array of vids 6362306a36Sopenharmony_ci * @vtg: array of vtgs 6462306a36Sopenharmony_ci * @vtg_vblank_nb: array of callbacks for VTG VSYNC notification 6562306a36Sopenharmony_ci */ 6662306a36Sopenharmony_cistruct sti_compositor { 6762306a36Sopenharmony_ci struct device *dev; 6862306a36Sopenharmony_ci void __iomem *regs; 6962306a36Sopenharmony_ci struct sti_compositor_data data; 7062306a36Sopenharmony_ci struct clk *clk_compo_main; 7162306a36Sopenharmony_ci struct clk *clk_compo_aux; 7262306a36Sopenharmony_ci struct clk *clk_pix_main; 7362306a36Sopenharmony_ci struct clk *clk_pix_aux; 7462306a36Sopenharmony_ci struct reset_control *rst_main; 7562306a36Sopenharmony_ci struct reset_control *rst_aux; 7662306a36Sopenharmony_ci struct sti_mixer *mixer[STI_MAX_MIXER]; 7762306a36Sopenharmony_ci struct sti_vid *vid[STI_MAX_VID]; 7862306a36Sopenharmony_ci struct sti_vtg *vtg[STI_MAX_MIXER]; 7962306a36Sopenharmony_ci struct notifier_block vtg_vblank_nb[STI_MAX_MIXER]; 8062306a36Sopenharmony_ci}; 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_civoid sti_compositor_debugfs_init(struct sti_compositor *compo, 8362306a36Sopenharmony_ci struct drm_minor *minor); 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci#endif 86