Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

David Lechner and committed by
Noralf Trønnes
13deee81 3fd8d9e0

+23 -5
+20 -4
drivers/gpu/drm/tinydrm/mipi-dbi.c
··· 154 154 } 155 155 EXPORT_SYMBOL(mipi_dbi_command_buf); 156 156 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) 159 169 { 160 170 struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0); 161 171 struct dma_buf_attachment *import_attach = cma_obj->base.import_attach; ··· 202 192 DMA_FROM_DEVICE); 203 193 return ret; 204 194 } 195 + EXPORT_SYMBOL(mipi_dbi_buf_copy); 205 196 206 197 static int mipi_dbi_fb_dirty(struct drm_framebuffer *fb, 207 198 struct drm_file *file_priv, ··· 455 444 456 445 #if IS_ENABLED(CONFIG_SPI) 457 446 458 - /* 447 + /** 448 + * mipi_dbi_spi_cmd_max_speed - get the maximum SPI bus speed 449 + * @spi: SPI device 450 + * @len: The transfer buffer length. 451 + * 459 452 * Many controllers have a max speed of 10MHz, but can be pushed way beyond 460 453 * that. Increase reliability by running pixel data at max speed and the rest 461 454 * at 10MHz, preventing transfer glitches from messing up the init settings. 462 455 */ 463 - static u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len) 456 + u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len) 464 457 { 465 458 if (len > 64) 466 459 return 0; /* use default */ 467 460 468 461 return min_t(u32, 10000000, spi->max_speed_hz); 469 462 } 463 + EXPORT_SYMBOL(mipi_dbi_spi_cmd_max_speed); 470 464 471 465 /* 472 466 * MIPI DBI Type C Option 1
+3 -1
include/drm/tinydrm/mipi-dbi.h
··· 72 72 void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe); 73 73 void mipi_dbi_hw_reset(struct mipi_dbi *mipi); 74 74 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); 75 76 76 77 int mipi_dbi_command_read(struct mipi_dbi *mipi, u8 cmd, u8 *val); 77 78 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); 79 81 /** 80 82 * mipi_dbi_command - MIPI DCS command with optional parameter(s) 81 83 * @mipi: MIPI structure