Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame^] | 1 | /* 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 | |
| 22 | struct 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 | |
| 54 | struct 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 | |
| 76 | int sde_disable(struct sde_kms *sde_kms); |
| 77 | int sde_enable(struct sde_kms *sde_kms); |
| 78 | |
| 79 | void sde_set_irqmask(struct mdp_kms *mdp_kms, uint32_t irqmask, |
| 80 | uint32_t old_irqmask); |
| 81 | void sde_irq_preinstall(struct msm_kms *kms); |
| 82 | int sde_irq_postinstall(struct msm_kms *kms); |
| 83 | void sde_irq_uninstall(struct msm_kms *kms); |
| 84 | irqreturn_t sde_irq(struct msm_kms *kms); |
| 85 | int sde_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); |
| 86 | void sde_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); |
| 87 | |
| 88 | enum sde_sspp sde_plane_pipe(struct drm_plane *plane); |
| 89 | void sde_plane_install_properties(struct drm_plane *plane, |
| 90 | struct drm_mode_object *obj); |
| 91 | void sde_plane_set_scanout(struct drm_plane *plane, |
| 92 | struct drm_framebuffer *fb); |
| 93 | int 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); |
| 99 | void sde_plane_complete_flip(struct drm_plane *plane); |
| 100 | struct drm_plane *sde_plane_init(struct drm_device *dev, bool private_plane); |
| 101 | |
| 102 | uint32_t sde_crtc_vblank(struct drm_crtc *crtc); |
| 103 | |
| 104 | void sde_crtc_cancel_pending_flip(struct drm_crtc *crtc, struct drm_file *file); |
| 105 | void sde_crtc_attach(struct drm_crtc *crtc, struct drm_plane *plane); |
| 106 | void sde_crtc_detach(struct drm_crtc *crtc, struct drm_plane *plane); |
| 107 | struct drm_crtc *sde_crtc_init(struct drm_device *dev, |
| 108 | struct drm_encoder *encoder, |
| 109 | struct drm_plane *plane, int id); |
| 110 | |
| 111 | struct drm_encoder *sde_encoder_init(struct drm_device *dev, int intf); |
| 112 | |
| 113 | int sde_irq_domain_init(struct sde_kms *sde_kms); |
| 114 | int sde_irq_domain_fini(struct sde_kms *sde_kms); |
| 115 | |
| 116 | #endif /* __sde_kms_H__ */ |