Skip to content

Commit 22edc8d

Browse files
committed
drm/tinydrm/mipi-dbi: Add mipi_dbi_enable_flush()
Add and use a function for enabling, flushing and turning on backlight. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Reviewed-by: David Lechner <david@lechnology.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180110185940.53841-4-noralf@tronnes.org
1 parent 24e05e7 commit 22edc8d

5 files changed

Lines changed: 24 additions & 11 deletions

File tree

‎drivers/gpu/drm/tinydrm/ili9225.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe,
180180
{
181181
struct tinydrm_device *tdev = pipe_to_tinydrm(pipe);
182182
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
183-
struct drm_framebuffer *fb = pipe->plane.fb;
184183
struct device *dev = tdev->drm->dev;
185184
int ret;
186185
u8 am_id;
@@ -269,10 +268,7 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe,
269268

270269
ili9225_command(mipi, ILI9225_DISPLAY_CONTROL_1, 0x1017);
271270

272-
mipi->enabled = true;
273-
274-
if (fb)
275-
fb->funcs->dirty(fb, NULL, 0, 0, NULL, 0);
271+
mipi_dbi_enable_flush(mipi);
276272
}
277273

278274
static void ili9225_pipe_disable(struct drm_simple_display_pipe *pipe)

‎drivers/gpu/drm/tinydrm/mipi-dbi.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,26 @@ static const struct drm_framebuffer_funcs mipi_dbi_fb_funcs = {
270270
.dirty = mipi_dbi_fb_dirty,
271271
};
272272

273+
/**
274+
* mipi_dbi_enable_flush - MIPI DBI enable helper
275+
* @mipi: MIPI DBI structure
276+
*
277+
* This function sets &mipi_dbi->enabled, flushes the whole framebuffer and
278+
* enables the backlight. Drivers can use this in their
279+
* &drm_simple_display_pipe_funcs->enable callback.
280+
*/
281+
void mipi_dbi_enable_flush(struct mipi_dbi *mipi)
282+
{
283+
struct drm_framebuffer *fb = mipi->tinydrm.pipe.plane.fb;
284+
285+
mipi->enabled = true;
286+
if (fb)
287+
fb->funcs->dirty(fb, NULL, 0, 0, NULL, 0);
288+
289+
tinydrm_enable_backlight(mipi->backlight);
290+
}
291+
EXPORT_SYMBOL(mipi_dbi_enable_flush);
292+
273293
/**
274294
* mipi_dbi_pipe_enable - MIPI DBI pipe enable helper
275295
* @pipe: Display pipe

‎drivers/gpu/drm/tinydrm/st7586.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe,
179179
{
180180
struct tinydrm_device *tdev = pipe_to_tinydrm(pipe);
181181
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
182-
struct drm_framebuffer *fb = pipe->plane.fb;
183182
struct device *dev = tdev->drm->dev;
184183
int ret;
185184
u8 addr_mode;
@@ -241,10 +240,7 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe,
241240

242241
mipi_dbi_command(mipi, MIPI_DCS_SET_DISPLAY_ON);
243242

244-
mipi->enabled = true;
245-
246-
if (fb)
247-
fb->funcs->dirty(fb, NULL, 0, 0, NULL, 0);
243+
mipi_dbi_enable_flush(mipi);
248244
}
249245

250246
static void st7586_pipe_disable(struct drm_simple_display_pipe *pipe)

‎drivers/gpu/drm/tinydrm/st7735r.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe,
102102

103103
msleep(20);
104104

105-
mipi_dbi_pipe_enable(pipe, crtc_state);
105+
mipi_dbi_enable_flush(mipi);
106106
}
107107

108108
static const struct drm_simple_display_pipe_funcs jd_t18003_t01_pipe_funcs = {

‎include/drm/tinydrm/mipi-dbi.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ int mipi_dbi_init(struct device *dev, struct mipi_dbi *mipi,
6767
const struct drm_simple_display_pipe_funcs *pipe_funcs,
6868
struct drm_driver *driver,
6969
const struct drm_display_mode *mode, unsigned int rotation);
70+
void mipi_dbi_enable_flush(struct mipi_dbi *mipi);
7071
void mipi_dbi_pipe_enable(struct drm_simple_display_pipe *pipe,
7172
struct drm_crtc_state *crtc_state);
7273
void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe);

0 commit comments

Comments
 (0)