Alan Kwong | 4aacd53 | 2017-02-04 18:51:33 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 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 Ip | c475b08 | 2016-06-26 09:27:23 -0400 | [diff] [blame] | 18 | #include "sde_hw_util.h" |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 19 | |
| 20 | struct sde_hw_intf; |
| 21 | |
| 22 | /* intf timing settings */ |
| 23 | struct 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 | |
| 42 | struct intf_prog_fetch { |
| 43 | u8 enable; |
| 44 | /* vsync counter for the front porch pixel line */ |
| 45 | u32 fetch_start; |
| 46 | }; |
| 47 | |
| 48 | struct 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 Kwong | 4aacd53 | 2017-02-04 18:51:33 -0800 | [diff] [blame] | 59 | * @ setup_rot_start : enables/disables the rotator start trigger |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 60 | * @ enable_timing: enable/disable timing engine |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 61 | * @ get_status: returns if timing engine is enabled or not |
Jayant Shekhar | 1d50ed2 | 2016-11-04 18:41:12 +0530 | [diff] [blame] | 62 | * @ setup_misr: enables/disables MISR in HW register |
| 63 | * @ collect_misr: reads and stores MISR data from HW register |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 64 | */ |
| 65 | struct sde_hw_intf_ops { |
| 66 | void (*setup_timing_gen)(struct sde_hw_intf *intf, |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 67 | const struct intf_timing_params *p, |
| 68 | const struct sde_format *fmt); |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 69 | |
| 70 | void (*setup_prg_fetch)(struct sde_hw_intf *intf, |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 71 | const struct intf_prog_fetch *fetch); |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 72 | |
Alan Kwong | 4aacd53 | 2017-02-04 18:51:33 -0800 | [diff] [blame] | 73 | void (*setup_rot_start)(struct sde_hw_intf *intf, |
| 74 | const struct intf_prog_fetch *fetch); |
| 75 | |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 76 | void (*enable_timing)(struct sde_hw_intf *intf, |
| 77 | u8 enable); |
| 78 | |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 79 | void (*get_status)(struct sde_hw_intf *intf, |
| 80 | struct intf_status *status); |
Jayant Shekhar | 1d50ed2 | 2016-11-04 18:41:12 +0530 | [diff] [blame] | 81 | |
| 82 | void (*setup_misr)(struct sde_hw_intf *intf, |
Dhaval Patel | f9245d6 | 2017-03-28 16:24:00 -0700 | [diff] [blame] | 83 | bool enable, u32 frame_count); |
Jayant Shekhar | 1d50ed2 | 2016-11-04 18:41:12 +0530 | [diff] [blame] | 84 | |
Dhaval Patel | f9245d6 | 2017-03-28 16:24:00 -0700 | [diff] [blame] | 85 | u32 (*collect_misr)(struct sde_hw_intf *intf); |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 86 | }; |
| 87 | |
| 88 | struct 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 Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 95 | const struct sde_mdss_cfg *mdss; |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 96 | |
| 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 | */ |
| 108 | struct sde_hw_intf *sde_hw_intf_init(enum sde_intf idx, |
| 109 | void __iomem *addr, |
| 110 | struct sde_mdss_cfg *m); |
| 111 | |
Lloyd Atkinson | 6b3b9dd | 2016-08-10 18:45:31 -0400 | [diff] [blame] | 112 | /** |
| 113 | * sde_hw_intf_destroy(): Destroys INTF driver context |
| 114 | * @intf: Pointer to INTF driver context |
| 115 | */ |
| 116 | void sde_hw_intf_destroy(struct sde_hw_intf *intf); |
Abhijit Kulkarni | 3e3e0d2 | 2016-06-24 17:56:13 -0400 | [diff] [blame] | 117 | |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 118 | #endif /*_SDE_HW_INTF_H */ |