Commit f729d8d9 authored by Noralf Trønnes's avatar Noralf Trønnes

drm/tinydrm: Move tinydrm_machine_little_endian()

The tinydrm helper is going away so move it into the only user mipi-dbi.
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190719155916.62465-9-noralf@tronnes.org
parent d23d4d4d
...@@ -628,6 +628,15 @@ u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len) ...@@ -628,6 +628,15 @@ u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len)
} }
EXPORT_SYMBOL(mipi_dbi_spi_cmd_max_speed); EXPORT_SYMBOL(mipi_dbi_spi_cmd_max_speed);
static bool mipi_dbi_machine_little_endian(void)
{
#if defined(__LITTLE_ENDIAN)
return true;
#else
return false;
#endif
}
/* /*
* MIPI DBI Type C Option 1 * MIPI DBI Type C Option 1
* *
...@@ -650,7 +659,7 @@ static int mipi_dbi_spi1e_transfer(struct mipi_dbi *mipi, int dc, ...@@ -650,7 +659,7 @@ static int mipi_dbi_spi1e_transfer(struct mipi_dbi *mipi, int dc,
const void *buf, size_t len, const void *buf, size_t len,
unsigned int bpw) unsigned int bpw)
{ {
bool swap_bytes = (bpw == 16 && tinydrm_machine_little_endian()); bool swap_bytes = (bpw == 16 && mipi_dbi_machine_little_endian());
size_t chunk, max_chunk = mipi->tx_buf9_len; size_t chunk, max_chunk = mipi->tx_buf9_len;
struct spi_device *spi = mipi->spi; struct spi_device *spi = mipi->spi;
struct spi_transfer tr = { struct spi_transfer tr = {
...@@ -799,7 +808,7 @@ static int mipi_dbi_spi1_transfer(struct mipi_dbi *mipi, int dc, ...@@ -799,7 +808,7 @@ static int mipi_dbi_spi1_transfer(struct mipi_dbi *mipi, int dc,
size_t chunk = min(len, max_chunk); size_t chunk = min(len, max_chunk);
unsigned int i; unsigned int i;
if (bpw == 16 && tinydrm_machine_little_endian()) { if (bpw == 16 && mipi_dbi_machine_little_endian()) {
for (i = 0; i < (chunk * 2); i += 2) { for (i = 0; i < (chunk * 2); i += 2) {
dst16[i] = *src16 >> 8; dst16[i] = *src16 >> 8;
dst16[i + 1] = *src16++ & 0xFF; dst16[i + 1] = *src16++ & 0xFF;
...@@ -991,7 +1000,7 @@ int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *mipi, ...@@ -991,7 +1000,7 @@ int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *mipi,
if (dc) { if (dc) {
mipi->command = mipi_dbi_typec3_command; mipi->command = mipi_dbi_typec3_command;
mipi->dc = dc; mipi->dc = dc;
if (tinydrm_machine_little_endian() && !spi_is_bpw_supported(spi, 16)) if (mipi_dbi_machine_little_endian() && !spi_is_bpw_supported(spi, 16))
mipi->swap_bytes = true; mipi->swap_bytes = true;
} else { } else {
mipi->command = mipi_dbi_typec1_command; mipi->command = mipi_dbi_typec1_command;
......
...@@ -15,21 +15,6 @@ struct drm_simple_display_pipe; ...@@ -15,21 +15,6 @@ struct drm_simple_display_pipe;
struct drm_simple_display_pipe_funcs; struct drm_simple_display_pipe_funcs;
struct device; struct device;
/**
* tinydrm_machine_little_endian - Machine is little endian
*
* Returns:
* true if *defined(__LITTLE_ENDIAN)*, false otherwise
*/
static inline bool tinydrm_machine_little_endian(void)
{
#if defined(__LITTLE_ENDIAN)
return true;
#else
return false;
#endif
}
int tinydrm_display_pipe_init(struct drm_device *drm, int tinydrm_display_pipe_init(struct drm_device *drm,
struct drm_simple_display_pipe *pipe, struct drm_simple_display_pipe *pipe,
const struct drm_simple_display_pipe_funcs *funcs, const struct drm_simple_display_pipe_funcs *funcs,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment