blob: 1afe1bb03c7b93b996345157e6972cd7a3f38385 [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_KMS_H__
14#define __SDE_KMS_H__
15
16#include "msm_drv.h"
17#include "msm_kms.h"
18#include "mdp/mdp_kms.h"
19#include "sde_hw_catalog.h"
20#include "sde_hw_mdss.h"
21
22struct sde_kms {
23 struct mdp_kms base;
24 struct drm_device *dev;
25 int rev;
26 struct sde_mdss_cfg *catalog;
27
28 struct msm_mmu *mmu;
29
30 /* io/register spaces: */
31 void __iomem *mmio, *vbif;
32
33 struct regulator *vdd;
34 struct regulator *mmagic;
35 struct regulator *venus;
36
37 struct clk *axi_clk;
38 struct clk *ahb_clk;
39 struct clk *src_clk;
40 struct clk *core_clk;
41 struct clk *lut_clk;
42 struct clk *mmagic_clk;
43 struct clk *iommu_clk;
44 struct clk *vsync_clk;
45
46 struct {
47 unsigned long enabled_mask;
48 struct irq_domain *domain;
49 } irqcontroller;
50};
51
52#define to_sde_kms(x) container_of(x, struct sde_kms, base)
53
54struct sde_plane_state {
55 struct drm_plane_state base;
56
57 /* aligned with property */
58 uint8_t premultiplied;
59 uint8_t zpos;
60 uint8_t alpha;
61
62 /* assigned by crtc blender */
63 enum sde_stage stage;
64
65 /* some additional transactional status to help us know in the
66 * apply path whether we need to update SMP allocation, and
67 * whether current update is still pending:
68 */
69 bool mode_changed : 1;
70 bool pending : 1;
71};
72
73#define to_sde_plane_state(x) \
74 container_of(x, struct sde_plane_state, base)
75
76int sde_disable(struct sde_kms *sde_kms);
77int sde_enable(struct sde_kms *sde_kms);
78
79void sde_set_irqmask(struct mdp_kms *mdp_kms, uint32_t irqmask,
80 uint32_t old_irqmask);
81void sde_irq_preinstall(struct msm_kms *kms);
82int sde_irq_postinstall(struct msm_kms *kms);
83void sde_irq_uninstall(struct msm_kms *kms);
84irqreturn_t sde_irq(struct msm_kms *kms);
85int sde_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc);
86void sde_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc);
87
88enum sde_sspp sde_plane_pipe(struct drm_plane *plane);
89void sde_plane_install_properties(struct drm_plane *plane,
90 struct drm_mode_object *obj);
91void sde_plane_set_scanout(struct drm_plane *plane,
92 struct drm_framebuffer *fb);
93int sde_plane_mode_set(struct drm_plane *plane,
94 struct drm_crtc *crtc, struct drm_framebuffer *fb,
95 int crtc_x, int crtc_y,
96 unsigned int crtc_w, unsigned int crtc_h,
97 uint32_t src_x, uint32_t src_y,
98 uint32_t src_w, uint32_t src_h);
99void sde_plane_complete_flip(struct drm_plane *plane);
100struct drm_plane *sde_plane_init(struct drm_device *dev, bool private_plane);
101
102uint32_t sde_crtc_vblank(struct drm_crtc *crtc);
103
104void sde_crtc_cancel_pending_flip(struct drm_crtc *crtc, struct drm_file *file);
105void sde_crtc_attach(struct drm_crtc *crtc, struct drm_plane *plane);
106void sde_crtc_detach(struct drm_crtc *crtc, struct drm_plane *plane);
107struct drm_crtc *sde_crtc_init(struct drm_device *dev,
108 struct drm_encoder *encoder,
109 struct drm_plane *plane, int id);
110
111struct drm_encoder *sde_encoder_init(struct drm_device *dev, int intf);
112
113int sde_irq_domain_init(struct sde_kms *sde_kms);
114int sde_irq_domain_fini(struct sde_kms *sde_kms);
115
116#endif /* __sde_kms_H__ */