diff options
| author | David Lechner <david@lechnology.com> | 2017-11-19 15:12:07 -0500 |
|---|---|---|
| committer | Noralf Trønnes <noralf@tronnes.org> | 2017-12-01 08:07:16 -0500 |
| commit | 13deee8111ed600ecd1809b0bfbab232c82159d9 (patch) | |
| tree | ca34688806d808f06b104757dd4ed8640de85f93 /drivers/gpu/drm/tinydrm | |
| parent | 3fd8d9e00f44b7057aa02a50b06e8320cc822526 (diff) | |
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
Diffstat (limited to 'drivers/gpu/drm/tinydrm')
| -rw-r--r-- | drivers/gpu/drm/tinydrm/mipi-dbi.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c index 347f9b226f26..aa6b6ce56891 100644 --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c | |||
| @@ -154,8 +154,18 @@ int mipi_dbi_command_buf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len) | |||
| 154 | } | 154 | } |
| 155 | EXPORT_SYMBOL(mipi_dbi_command_buf); | 155 | EXPORT_SYMBOL(mipi_dbi_command_buf); |
| 156 | 156 | ||
| 157 | static int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, | 157 | /** |
| 158 | struct drm_clip_rect *clip, bool swap) | 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 | struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0); | 170 | struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0); |
| 161 | struct dma_buf_attachment *import_attach = cma_obj->base.import_attach; | 171 | 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, | |||
| 192 | DMA_FROM_DEVICE); | 202 | DMA_FROM_DEVICE); |
| 193 | return ret; | 203 | return ret; |
| 194 | } | 204 | } |
| 205 | EXPORT_SYMBOL(mipi_dbi_buf_copy); | ||
| 195 | 206 | ||
| 196 | static int mipi_dbi_fb_dirty(struct drm_framebuffer *fb, | 207 | static int mipi_dbi_fb_dirty(struct drm_framebuffer *fb, |
| 197 | struct drm_file *file_priv, | 208 | struct drm_file *file_priv, |
| @@ -444,18 +455,23 @@ EXPORT_SYMBOL(mipi_dbi_display_is_on); | |||
| 444 | 455 | ||
| 445 | #if IS_ENABLED(CONFIG_SPI) | 456 | #if IS_ENABLED(CONFIG_SPI) |
| 446 | 457 | ||
| 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 | * | ||
| 448 | * Many controllers have a max speed of 10MHz, but can be pushed way beyond | 463 | * Many controllers have a max speed of 10MHz, but can be pushed way beyond |
| 449 | * that. Increase reliability by running pixel data at max speed and the rest | 464 | * that. Increase reliability by running pixel data at max speed and the rest |
| 450 | * at 10MHz, preventing transfer glitches from messing up the init settings. | 465 | * at 10MHz, preventing transfer glitches from messing up the init settings. |
| 451 | */ | 466 | */ |
| 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) |
| 453 | { | 468 | { |
| 454 | if (len > 64) | 469 | if (len > 64) |
| 455 | return 0; /* use default */ | 470 | return 0; /* use default */ |
| 456 | 471 | ||
| 457 | return min_t(u32, 10000000, spi->max_speed_hz); | 472 | return min_t(u32, 10000000, spi->max_speed_hz); |
| 458 | } | 473 | } |
| 474 | EXPORT_SYMBOL(mipi_dbi_spi_cmd_max_speed); | ||
| 459 | 475 | ||
| 460 | /* | 476 | /* |
| 461 | * MIPI DBI Type C Option 1 | 477 | * MIPI DBI Type C Option 1 |
