blob: 133990ddf1ea4ed4ed5b49e02938bdd2d91c5c67 [file] [log] [blame]
Narendra Muppalla1b0b3352015-09-29 10:16:51 -07001/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef _SDE_HW_INTF_H
14#define _SDE_HW_INTF_H
15
16#include "sde_hw_catalog.h"
17#include "sde_hw_mdss.h"
Clarence Ipc475b082016-06-26 09:27:23 -040018#include "sde_hw_util.h"
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070019
20struct sde_hw_intf;
21
22/* intf timing settings */
23struct intf_timing_params {
24 u32 width; /* active width */
25 u32 height; /* active height */
26 u32 xres; /* Display panel width */
27 u32 yres; /* Display panel height */
28
29 u32 h_back_porch;
30 u32 h_front_porch;
31 u32 v_back_porch;
32 u32 v_front_porch;
33 u32 hsync_pulse_width;
34 u32 vsync_pulse_width;
35 u32 hsync_polarity;
36 u32 vsync_polarity;
37 u32 border_clr;
38 u32 underflow_clr;
39 u32 hsync_skew;
40};
41
42struct intf_prog_fetch {
43 u8 enable;
44 /* vsync counter for the front porch pixel line */
45 u32 fetch_start;
46};
47
48struct intf_status {
49 u8 is_en; /* interface timing engine is enabled or not */
50 u32 frame_count; /* frame count since timing engine enabled */
51 u32 line_count; /* current line count including blanking */
52};
53
54/**
55 * struct sde_hw_intf_ops : Interface to the interface Hw driver functions
56 * Assumption is these functions will be called after clocks are enabled
57 * @ setup_timing_gen : programs the timing engine
58 * @ setup_prog_fetch : enables/disables the programmable fetch logic
59 * @ enable_timing: enable/disable timing engine
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070060 * @ get_status: returns if timing engine is enabled or not
61 */
62struct sde_hw_intf_ops {
63 void (*setup_timing_gen)(struct sde_hw_intf *intf,
Lloyd Atkinson9a673492016-07-05 11:41:57 -040064 const struct intf_timing_params *p,
65 const struct sde_format *fmt);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070066
67 void (*setup_prg_fetch)(struct sde_hw_intf *intf,
Lloyd Atkinson9a673492016-07-05 11:41:57 -040068 const struct intf_prog_fetch *fetch);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070069
70 void (*enable_timing)(struct sde_hw_intf *intf,
71 u8 enable);
72
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070073 void (*get_status)(struct sde_hw_intf *intf,
74 struct intf_status *status);
75};
76
77struct sde_hw_intf {
78 /* base */
79 struct sde_hw_blk_reg_map hw;
80
81 /* intf */
82 enum sde_intf idx;
83 const struct sde_intf_cfg *cap;
Abhijit Kulkarni94954d52016-06-24 18:27:48 -040084 const struct sde_mdss_cfg *mdss;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070085
86 /* ops */
87 struct sde_hw_intf_ops ops;
88};
89
90/**
91 * sde_hw_intf_init(): Initializes the intf driver for the passed
92 * interface idx.
93 * @idx: interface index for which driver object is required
94 * @addr: mapped register io address of MDP
95 * @m : pointer to mdss catalog data
96 */
97struct sde_hw_intf *sde_hw_intf_init(enum sde_intf idx,
98 void __iomem *addr,
99 struct sde_mdss_cfg *m);
100
Lloyd Atkinson6b3b9dd2016-08-10 18:45:31 -0400101/**
102 * sde_hw_intf_destroy(): Destroys INTF driver context
103 * @intf: Pointer to INTF driver context
104 */
105void sde_hw_intf_destroy(struct sde_hw_intf *intf);
Abhijit Kulkarni3e3e0d22016-06-24 17:56:13 -0400106
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700107#endif /*_SDE_HW_INTF_H */