blob: d24e83a6897bdb69d921b49c86a0f08b97de3911 [file] [log] [blame]
Alan Kwong4aacd532017-02-04 18:51:33 -08001/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
Narendra Muppalla1b0b3352015-09-29 10:16:51 -07002 *
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
Alan Kwong4aacd532017-02-04 18:51:33 -080059 * @ setup_rot_start : enables/disables the rotator start trigger
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070060 * @ enable_timing: enable/disable timing engine
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070061 * @ get_status: returns if timing engine is enabled or not
Jayant Shekhar1d50ed22016-11-04 18:41:12 +053062 * @ setup_misr: enables/disables MISR in HW register
63 * @ collect_misr: reads and stores MISR data from HW register
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070064 */
65struct sde_hw_intf_ops {
66 void (*setup_timing_gen)(struct sde_hw_intf *intf,
Lloyd Atkinson9a673492016-07-05 11:41:57 -040067 const struct intf_timing_params *p,
68 const struct sde_format *fmt);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070069
70 void (*setup_prg_fetch)(struct sde_hw_intf *intf,
Lloyd Atkinson9a673492016-07-05 11:41:57 -040071 const struct intf_prog_fetch *fetch);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070072
Alan Kwong4aacd532017-02-04 18:51:33 -080073 void (*setup_rot_start)(struct sde_hw_intf *intf,
74 const struct intf_prog_fetch *fetch);
75
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070076 void (*enable_timing)(struct sde_hw_intf *intf,
77 u8 enable);
78
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070079 void (*get_status)(struct sde_hw_intf *intf,
80 struct intf_status *status);
Jayant Shekhar1d50ed22016-11-04 18:41:12 +053081
82 void (*setup_misr)(struct sde_hw_intf *intf,
Dhaval Patelf9245d62017-03-28 16:24:00 -070083 bool enable, u32 frame_count);
Jayant Shekhar1d50ed22016-11-04 18:41:12 +053084
Dhaval Patelf9245d62017-03-28 16:24:00 -070085 u32 (*collect_misr)(struct sde_hw_intf *intf);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070086};
87
88struct sde_hw_intf {
89 /* base */
90 struct sde_hw_blk_reg_map hw;
91
92 /* intf */
93 enum sde_intf idx;
94 const struct sde_intf_cfg *cap;
Abhijit Kulkarni94954d52016-06-24 18:27:48 -040095 const struct sde_mdss_cfg *mdss;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070096
97 /* ops */
98 struct sde_hw_intf_ops ops;
99};
100
101/**
102 * sde_hw_intf_init(): Initializes the intf driver for the passed
103 * interface idx.
104 * @idx: interface index for which driver object is required
105 * @addr: mapped register io address of MDP
106 * @m : pointer to mdss catalog data
107 */
108struct sde_hw_intf *sde_hw_intf_init(enum sde_intf idx,
109 void __iomem *addr,
110 struct sde_mdss_cfg *m);
111
Lloyd Atkinson6b3b9dd2016-08-10 18:45:31 -0400112/**
113 * sde_hw_intf_destroy(): Destroys INTF driver context
114 * @intf: Pointer to INTF driver context
115 */
116void sde_hw_intf_destroy(struct sde_hw_intf *intf);
Abhijit Kulkarni3e3e0d22016-06-24 17:56:13 -0400117
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700118#endif /*_SDE_HW_INTF_H */