Skip to content

Commit 0aab5dc

Browse files
ejdea-intelachrisan
authored andcommitted
drm/kmb: Enable LCD DMA for low TVDDCV
There's an undocumented dependency between LCD layer enable bits [2-5] and the AXI pipelined read enable bit [28] in the LCD_CONTROL register. The proper order of operation is: 1) Clear AXI pipelined read enable bit 2) Set LCD layers 3) Set AXI pipelined read enable bit With this update, LCD can start DMA when TVDDCV is reduced down to 700mV. Fixes: 7f7b96a ("drm/kmb: Add support for KeemBay Display") Signed-off-by: Edmund Dea <edmund.j.dea@intel.com> Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210728003126.1425028-1-anitha.chrisanthus@intel.com
1 parent 8ee18e7 commit 0aab5dc

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

drivers/gpu/drm/kmb/kmb_drv.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ static irqreturn_t handle_lcd_irq(struct drm_device *dev)
203203
unsigned long status, val, val1;
204204
int plane_id, dma0_state, dma1_state;
205205
struct kmb_drm_private *kmb = to_kmb(dev);
206+
u32 ctrl = 0;
206207

207208
status = kmb_read_lcd(kmb, LCD_INT_STATUS);
208209

@@ -227,6 +228,19 @@ static irqreturn_t handle_lcd_irq(struct drm_device *dev)
227228
kmb_clr_bitmask_lcd(kmb, LCD_CONTROL,
228229
kmb->plane_status[plane_id].ctrl);
229230

231+
ctrl = kmb_read_lcd(kmb, LCD_CONTROL);
232+
if (!(ctrl & (LCD_CTRL_VL1_ENABLE |
233+
LCD_CTRL_VL2_ENABLE |
234+
LCD_CTRL_GL1_ENABLE |
235+
LCD_CTRL_GL2_ENABLE))) {
236+
/* If no LCD layers are using DMA,
237+
* then disable DMA pipelined AXI read
238+
* transactions.
239+
*/
240+
kmb_clr_bitmask_lcd(kmb, LCD_CONTROL,
241+
LCD_CTRL_PIPELINE_DMA);
242+
}
243+
230244
kmb->plane_status[plane_id].disable = false;
231245
}
232246
}

drivers/gpu/drm/kmb/kmb_plane.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,14 @@ static void kmb_plane_atomic_update(struct drm_plane *plane,
427427

428428
kmb_set_bitmask_lcd(kmb, LCD_CONTROL, ctrl);
429429

430-
/* FIXME no doc on how to set output format,these values are
431-
* taken from the Myriadx tests
430+
/* Enable pipeline AXI read transactions for the DMA
431+
* after setting graphics layers. This must be done
432+
* in a separate write cycle.
433+
*/
434+
kmb_set_bitmask_lcd(kmb, LCD_CONTROL, LCD_CTRL_PIPELINE_DMA);
435+
436+
/* FIXME no doc on how to set output format, these values are taken
437+
* from the Myriadx tests
432438
*/
433439
out_format |= LCD_OUTF_FORMAT_RGB888;
434440

@@ -526,6 +532,11 @@ struct kmb_plane *kmb_plane_init(struct drm_device *drm)
526532
plane->id = i;
527533
}
528534

535+
/* Disable pipeline AXI read transactions for the DMA
536+
* prior to setting graphics layers
537+
*/
538+
kmb_clr_bitmask_lcd(kmb, LCD_CONTROL, LCD_CTRL_PIPELINE_DMA);
539+
529540
return primary;
530541
cleanup:
531542
drmm_kfree(drm, plane);

0 commit comments

Comments
 (0)