drm/komeda: Add komeda_crtc_vblank_enable/disable
authorjames qian wang (Arm Technology China) <james.qian.wang@arm.com>
Tue, 22 Jan 2019 11:11:25 +0000 (11:11 +0000)
committerLiviu Dudau <Liviu.Dudau@arm.com>
Mon, 29 Apr 2019 11:35:57 +0000 (12:35 +0100)
Add a new komeda_dev_func->on_off_vblank to enable/disable HW vblank event

Signed-off-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c
drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
drivers/gpu/drm/arm/display/komeda/komeda_dev.h

index fd43177895c47c92f6cb0c850f0207d89f940e8e..b01b628019baa5ce7536f997c8b8a4c36e7ef7d7 100644 (file)
@@ -243,6 +243,15 @@ static int d71_disable_irq(struct komeda_dev *mdev)
        return 0;
 }
 
+static void d71_on_off_vblank(struct komeda_dev *mdev, int master_pipe, bool on)
+{
+       struct d71_dev *d71 = mdev->chip_data;
+       struct d71_pipeline *pipe = d71->pipes[master_pipe];
+
+       malidp_write32_mask(pipe->dou_addr, BLK_IRQ_MASK,
+                           DOU_IRQ_PL0, on ? DOU_IRQ_PL0 : 0);
+}
+
 static int to_d71_opmode(int core_mode)
 {
        switch (core_mode) {
@@ -500,6 +509,7 @@ static struct komeda_dev_funcs d71_chip_funcs = {
        .irq_handler    = d71_irq_handler,
        .enable_irq     = d71_enable_irq,
        .disable_irq    = d71_disable_irq,
+       .on_off_vblank  = d71_on_off_vblank,
        .change_opmode  = d71_change_opmode,
        .flush          = d71_flush,
 };
index 6c85d36208e0a1aaca9d7294c945873cb29c8c15..015ae217ebc33518e185853bc7dc850dec02ed28 100644 (file)
@@ -351,7 +351,26 @@ struct drm_crtc_helper_funcs komeda_crtc_helper_funcs = {
        .mode_fixup     = komeda_crtc_mode_fixup,
 };
 
+static int komeda_crtc_vblank_enable(struct drm_crtc *crtc)
+{
+       struct komeda_dev *mdev = crtc->dev->dev_private;
+       struct komeda_crtc *kcrtc = to_kcrtc(crtc);
+
+       mdev->funcs->on_off_vblank(mdev, kcrtc->master->id, true);
+       return 0;
+}
+
+static void komeda_crtc_vblank_disable(struct drm_crtc *crtc)
+{
+       struct komeda_dev *mdev = crtc->dev->dev_private;
+       struct komeda_crtc *kcrtc = to_kcrtc(crtc);
+
+       mdev->funcs->on_off_vblank(mdev, kcrtc->master->id, false);
+}
+
 static const struct drm_crtc_funcs komeda_crtc_funcs = {
+       .enable_vblank          = komeda_crtc_vblank_enable,
+       .disable_vblank         = komeda_crtc_vblank_disable,
 };
 
 int komeda_kms_setup_crtcs(struct komeda_kms_dev *kms,
index 1ad1f6e4985406922f06862660028b081734e32d..8acd25afb3e9da8067fe82dc70bce13a07a57aad 100644 (file)
@@ -103,6 +103,9 @@ struct komeda_dev_funcs {
        int (*enable_irq)(struct komeda_dev *mdev);
        /** @disable_irq: disable irq */
        int (*disable_irq)(struct komeda_dev *mdev);
+       /** @on_off_vblank: notify HW to on/off vblank */
+       void (*on_off_vblank)(struct komeda_dev *mdev,
+                             int master_pipe, bool on);
 
        /** @dump_register: Optional, dump registers to seq_file */
        void (*dump_register)(struct komeda_dev *mdev, struct seq_file *seq);