Skip to content

Commit 13deee8

Browse files
dlechnotro
authored andcommitted
drm/tinydrm: export mipi_dbi_buf_copy and mipi_dbi_spi_cmd_max_speed
This exports the mipi_dbi_buf_copy() and mipi_dbi_spi_cmd_max_speed() functions so that they can be shared with other drivers. Signed-off-by: David Lechner <david@lechnology.com> Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/1511122328-31133-4-git-send-email-david@lechnology.com
1 parent 3fd8d9e commit 13deee8

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

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

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,18 @@ int mipi_dbi_command_buf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len)
154154
}
155155
EXPORT_SYMBOL(mipi_dbi_command_buf);
156156

157-
static int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
158-
struct drm_clip_rect *clip, bool swap)
157+
/**
158+
* mipi_dbi_buf_copy - Copy a framebuffer, transforming it if necessary
159+
* @dst: The destination buffer
160+
* @fb: The source framebuffer
161+
* @clip: Clipping rectangle of the area to be copied
162+
* @swap: When true, swap MSB/LSB of 16-bit values
163+
*
164+
* Returns:
165+
* Zero on success, negative error code on failure.
166+
*/
167+
int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
168+
struct drm_clip_rect *clip, bool swap)
159169
{
160170
struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
161171
struct dma_buf_attachment *import_attach = cma_obj->base.import_attach;
@@ -192,6 +202,7 @@ static int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
192202
DMA_FROM_DEVICE);
193203
return ret;
194204
}
205+
EXPORT_SYMBOL(mipi_dbi_buf_copy);
195206

196207
static int mipi_dbi_fb_dirty(struct drm_framebuffer *fb,
197208
struct drm_file *file_priv,
@@ -444,18 +455,23 @@ EXPORT_SYMBOL(mipi_dbi_display_is_on);
444455

445456
#if IS_ENABLED(CONFIG_SPI)
446457

447-
/*
458+
/**
459+
* mipi_dbi_spi_cmd_max_speed - get the maximum SPI bus speed
460+
* @spi: SPI device
461+
* @len: The transfer buffer length.
462+
*
448463
* Many controllers have a max speed of 10MHz, but can be pushed way beyond
449464
* that. Increase reliability by running pixel data at max speed and the rest
450465
* at 10MHz, preventing transfer glitches from messing up the init settings.
451466
*/
452-
static u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len)
467+
u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len)
453468
{
454469
if (len > 64)
455470
return 0; /* use default */
456471

457472
return min_t(u32, 10000000, spi->max_speed_hz);
458473
}
474+
EXPORT_SYMBOL(mipi_dbi_spi_cmd_max_speed);
459475

460476
/*
461477
* MIPI DBI Type C Option 1

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ void mipi_dbi_pipe_enable(struct drm_simple_display_pipe *pipe,
7272
void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe);
7373
void mipi_dbi_hw_reset(struct mipi_dbi *mipi);
7474
bool mipi_dbi_display_is_on(struct mipi_dbi *mipi);
75+
u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len);
7576

7677
int mipi_dbi_command_read(struct mipi_dbi *mipi, u8 cmd, u8 *val);
7778
int mipi_dbi_command_buf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len);
78-
79+
int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
80+
struct drm_clip_rect *clip, bool swap);
7981
/**
8082
* mipi_dbi_command - MIPI DCS command with optional parameter(s)
8183
* @mipi: MIPI structure

0 commit comments

Comments
 (0)