]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[mirror_ubuntu-jammy-kernel.git] / drivers / gpu / drm / msm / disp / dpu1 / dpu_hw_pingpong.h
CommitLineData
97fb5e8d 1/* SPDX-License-Identifier: GPL-2.0-only */
25fdd593 2/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
25fdd593
JS
3 */
4
5#ifndef _DPU_HW_PINGPONG_H
6#define _DPU_HW_PINGPONG_H
7
8#include "dpu_hw_catalog.h"
9#include "dpu_hw_mdss.h"
10#include "dpu_hw_util.h"
11#include "dpu_hw_blk.h"
12
13struct dpu_hw_pingpong;
14
15struct dpu_hw_tear_check {
16 /*
17 * This is ratio of MDP VSYNC clk freq(Hz) to
18 * refresh rate divided by no of lines
19 */
20 u32 vsync_count;
21 u32 sync_cfg_height;
22 u32 vsync_init_val;
23 u32 sync_threshold_start;
24 u32 sync_threshold_continue;
25 u32 start_pos;
26 u32 rd_ptr_irq;
27 u8 hw_vsync_mode;
28};
29
30struct dpu_hw_pp_vsync_info {
31 u32 rd_ptr_init_val; /* value of rd pointer at vsync edge */
32 u32 rd_ptr_frame_count; /* num frames sent since enabling interface */
33 u32 rd_ptr_line_count; /* current line on panel (rd ptr) */
34 u32 wr_ptr_line_count; /* current line within pp fifo (wr ptr) */
35};
36
37/**
38 *
39 * struct dpu_hw_pingpong_ops : Interface to the pingpong Hw driver functions
40 * Assumption is these functions will be called after clocks are enabled
41 * @setup_tearcheck : program tear check values
42 * @enable_tearcheck : enables tear check
43 * @get_vsync_info : retries timing info of the panel
44 * @setup_dither : function to program the dither hw block
45 * @get_line_count: obtain current vertical line counter
46 */
47struct dpu_hw_pingpong_ops {
48 /**
49 * enables vysnc generation and sets up init value of
50 * read pointer and programs the tear check cofiguration
51 */
52 int (*setup_tearcheck)(struct dpu_hw_pingpong *pp,
53 struct dpu_hw_tear_check *cfg);
54
55 /**
56 * enables tear check block
57 */
58 int (*enable_tearcheck)(struct dpu_hw_pingpong *pp,
59 bool enable);
60
61 /**
62 * read, modify, write to either set or clear listening to external TE
63 * @Return: 1 if TE was originally connected, 0 if not, or -ERROR
64 */
65 int (*connect_external_te)(struct dpu_hw_pingpong *pp,
66 bool enable_external_te);
67
68 /**
69 * provides the programmed and current
70 * line_count
71 */
72 int (*get_vsync_info)(struct dpu_hw_pingpong *pp,
73 struct dpu_hw_pp_vsync_info *info);
74
75 /**
76 * poll until write pointer transmission starts
77 * @Return: 0 on success, -ETIMEDOUT on timeout
78 */
79 int (*poll_timeout_wr_ptr)(struct dpu_hw_pingpong *pp, u32 timeout_us);
80
81 /**
82 * Obtain current vertical line counter
83 */
84 u32 (*get_line_count)(struct dpu_hw_pingpong *pp);
85};
86
87struct dpu_hw_pingpong {
88 struct dpu_hw_blk base;
89 struct dpu_hw_blk_reg_map hw;
90
91 /* pingpong */
92 enum dpu_pingpong idx;
93 const struct dpu_pingpong_cfg *caps;
94
95 /* ops */
96 struct dpu_hw_pingpong_ops ops;
97};
98
25fdd593
JS
99/**
100 * dpu_hw_pingpong_init - initializes the pingpong driver for the passed
101 * pingpong idx.
102 * @idx: Pingpong index for which driver object is required
103 * @addr: Mapped register io address of MDP
104 * @m: Pointer to mdss catalog data
105 * Returns: Error code or allocated dpu_hw_pingpong context
106 */
107struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx,
108 void __iomem *addr,
109 struct dpu_mdss_cfg *m);
110
111/**
112 * dpu_hw_pingpong_destroy - destroys pingpong driver context
113 * should be called to free the context
114 * @pp: Pointer to PP driver context returned by dpu_hw_pingpong_init
115 */
116void dpu_hw_pingpong_destroy(struct dpu_hw_pingpong *pp);
117
118#endif /*_DPU_HW_PINGPONG_H */