Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
| 3 | * Copyright (C) STMicroelectronics SA 2017 |
| 4 | * |
| 5 | * Authors: Philippe Cornu <philippe.cornu@st.com> |
| 6 | * Yannick Fertre <yannick.fertre@st.com> |
| 7 | * Fabien Dessenne <fabien.dessenne@st.com> |
| 8 | * Mickael Reulier <mickael.reulier@st.com> |
| 9 | */ |
| 10 | |
| 11 | #ifndef _LTDC_H_ |
| 12 | #define _LTDC_H_ |
| 13 | |
| 14 | struct ltdc_caps { |
| 15 | u32 hw_version; /* hardware version */ |
| 16 | u32 nb_layers; /* number of supported layers */ |
| 17 | u32 reg_ofs; /* register offset for applicable regs */ |
| 18 | u32 bus_width; /* bus width (32 or 64 bits) */ |
| 19 | const u32 *pix_fmt_hw; /* supported pixel formats */ |
| 20 | bool non_alpha_only_l1; /* non-native no-alpha formats on layer 1 */ |
| 21 | int pad_max_freq_hz; /* max frequency supported by pad */ |
| 22 | }; |
| 23 | |
| 24 | #define LTDC_MAX_LAYER 4 |
| 25 | |
| 26 | struct fps_info { |
| 27 | unsigned int counter; |
| 28 | ktime_t last_timestamp; |
| 29 | }; |
| 30 | |
| 31 | struct ltdc_device { |
| 32 | void __iomem *regs; |
| 33 | struct clk *pixel_clk; /* lcd pixel clock */ |
| 34 | struct mutex err_lock; /* protecting error_status */ |
| 35 | struct ltdc_caps caps; |
| 36 | u32 error_status; |
| 37 | u32 irq_status; |
| 38 | struct fps_info plane_fpsi[LTDC_MAX_LAYER]; |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 39 | struct drm_atomic_state *suspend_state; |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 40 | }; |
| 41 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 42 | bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, |
| 43 | bool in_vblank_irq, int *vpos, int *hpos, |
| 44 | ktime_t *stime, ktime_t *etime, |
| 45 | const struct drm_display_mode *mode); |
| 46 | |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 47 | int ltdc_load(struct drm_device *ddev); |
| 48 | void ltdc_unload(struct drm_device *ddev); |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 49 | void ltdc_suspend(struct drm_device *ddev); |
| 50 | int ltdc_resume(struct drm_device *ddev); |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 51 | |
| 52 | #endif |