aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tinydrm/core
diff options
context:
space:
mode:
authorNoralf Trønnes <noralf@tronnes.org>2019-07-19 17:59:12 +0200
committerNoralf Trønnes <noralf@tronnes.org>2019-07-23 15:47:33 +0200
commitd23d4d4dac0119c7bfba63342a86a68b38c01779 (patch)
tree1478832fab43424a1759f4528d384baaa35a4956 /drivers/gpu/drm/tinydrm/core
parentdrm/tinydrm: Clean up tinydrm_spi_transfer() (diff)
downloadlinux-dev-d23d4d4dac0119c7bfba63342a86a68b38c01779.tar.xz
linux-dev-d23d4d4dac0119c7bfba63342a86a68b38c01779.zip
drm/tinydrm: Move tinydrm_spi_transfer()
This is only used by mipi-dbi drivers so move it there. The reason this isn't moved to the SPI subsystem is that it will in a later patch pass a dummy rx buffer for SPI controllers that need this. Low memory boards (64MB) can run into a problem allocating such a "large" contiguous buffer on every transfer after a long up time. This leaves a very specific use case, so we'll keep the function here. mipi-dbi will first go through a refactoring though, before this will be done. Remove SPI todo entry now that we're done with the tinydrm.ko SPI code. v2: Drop moving the mipi_dbi_spi_init() declaration (Sam) Cc: David Lechner <david@lechnology.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Acked-by: : David Lechner <david@lechnology.com> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/20190719155916.62465-8-noralf@tronnes.org
Diffstat (limited to 'drivers/gpu/drm/tinydrm/core')
-rw-r--r--drivers/gpu/drm/tinydrm/core/Makefile2
-rw-r--r--drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c70
-rw-r--r--drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c4
3 files changed, 5 insertions, 71 deletions
diff --git a/drivers/gpu/drm/tinydrm/core/Makefile b/drivers/gpu/drm/tinydrm/core/Makefile
index 01065e920aea..78e179127e55 100644
--- a/drivers/gpu/drm/tinydrm/core/Makefile
+++ b/drivers/gpu/drm/tinydrm/core/Makefile
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
-tinydrm-y := tinydrm-pipe.o tinydrm-helpers.o
+tinydrm-y := tinydrm-pipe.o
obj-$(CONFIG_DRM_TINYDRM) += tinydrm.o
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
deleted file mode 100644
index d95eb50fa9d4..000000000000
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
+++ /dev/null
@@ -1,70 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2016 Noralf Trønnes
- */
-
-#include <linux/backlight.h>
-#include <linux/dma-buf.h>
-#include <linux/module.h>
-#include <linux/pm.h>
-#include <linux/spi/spi.h>
-#include <linux/swab.h>
-
-#include <drm/drm_device.h>
-#include <drm/drm_drv.h>
-#include <drm/drm_fourcc.h>
-#include <drm/drm_framebuffer.h>
-#include <drm/drm_print.h>
-#include <drm/drm_rect.h>
-#include <drm/tinydrm/tinydrm-helpers.h>
-
-#if IS_ENABLED(CONFIG_SPI)
-
-/**
- * tinydrm_spi_transfer - SPI transfer helper
- * @spi: SPI device
- * @speed_hz: Override speed (optional)
- * @bpw: Bits per word
- * @buf: Buffer to transfer
- * @len: Buffer length
- *
- * This SPI transfer helper breaks up the transfer of @buf into chunks which
- * the SPI controller driver can handle.
- *
- * Returns:
- * Zero on success, negative error code on failure.
- */
-int tinydrm_spi_transfer(struct spi_device *spi, u32 speed_hz,
- u8 bpw, const void *buf, size_t len)
-{
- size_t max_chunk = spi_max_transfer_size(spi);
- struct spi_transfer tr = {
- .bits_per_word = bpw,
- .speed_hz = speed_hz,
- };
- struct spi_message m;
- size_t chunk;
- int ret;
-
- spi_message_init_with_transfers(&m, &tr, 1);
-
- while (len) {
- chunk = min(len, max_chunk);
-
- tr.tx_buf = buf;
- tr.len = chunk;
- buf += chunk;
- len -= chunk;
-
- ret = spi_sync(spi, &m);
- if (ret)
- return ret;
- }
-
- return 0;
-}
-EXPORT_SYMBOL(tinydrm_spi_transfer);
-
-#endif /* CONFIG_SPI */
-
-MODULE_LICENSE("GPL");
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
index ed798fd95152..a62d1dfe87f8 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
@@ -3,6 +3,8 @@
* Copyright (C) 2016 Noralf Trønnes
*/
+#include <linux/module.h>
+
#include <drm/drm_atomic_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_gem_framebuffer_helper.h>
@@ -177,3 +179,5 @@ int tinydrm_display_pipe_init(struct drm_device *drm,
format_count, modifiers, connector);
}
EXPORT_SYMBOL(tinydrm_display_pipe_init);
+
+MODULE_LICENSE("GPL");