Lines Matching refs:dbi

103 static bool mipi_dbi_command_is_read(struct mipi_dbi *dbi, u8 cmd)  in mipi_dbi_command_is_read()  argument
107 if (!dbi->read_commands) in mipi_dbi_command_is_read()
111 if (!dbi->read_commands[i]) in mipi_dbi_command_is_read()
113 if (cmd == dbi->read_commands[i]) in mipi_dbi_command_is_read()
131 int mipi_dbi_command_read(struct mipi_dbi *dbi, u8 cmd, u8 *val) in mipi_dbi_command_read() argument
133 if (!dbi->read_commands) in mipi_dbi_command_read()
136 if (!mipi_dbi_command_is_read(dbi, cmd)) in mipi_dbi_command_read()
139 return mipi_dbi_command_buf(dbi, cmd, val, 1); in mipi_dbi_command_read()
153 int mipi_dbi_command_buf(struct mipi_dbi *dbi, u8 cmd, u8 *data, size_t len) in mipi_dbi_command_buf() argument
163 mutex_lock(&dbi->cmdlock); in mipi_dbi_command_buf()
164 ret = dbi->command(dbi, cmdbuf, data, len); in mipi_dbi_command_buf()
165 mutex_unlock(&dbi->cmdlock); in mipi_dbi_command_buf()
174 int mipi_dbi_command_stackbuf(struct mipi_dbi *dbi, u8 cmd, const u8 *data, in mipi_dbi_command_stackbuf() argument
184 ret = mipi_dbi_command_buf(dbi, cmd, buf, len); in mipi_dbi_command_stackbuf()
247 struct mipi_dbi *dbi = &dbidev->dbi; in mipi_dbi_set_window_address() local
254 mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, (xs >> 8) & 0xff, in mipi_dbi_set_window_address()
256 mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, (ys >> 8) & 0xff, in mipi_dbi_set_window_address()
267 struct mipi_dbi *dbi = &dbidev->dbi; in mipi_dbi_fb_dirty() local
268 bool swap = dbi->swap_bytes; in mipi_dbi_fb_dirty()
287 if (!dbi->dc || !full || swap || in mipi_dbi_fb_dirty()
300 ret = mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START, tr, in mipi_dbi_fb_dirty()
393 struct mipi_dbi *dbi = &dbidev->dbi; in mipi_dbi_blank() local
403 mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START, in mipi_dbi_blank()
516 if (!dbidev->dbi.command) in mipi_dbi_dev_init_with_formats()
597 void mipi_dbi_hw_reset(struct mipi_dbi *dbi) in mipi_dbi_hw_reset() argument
599 if (!dbi->reset) in mipi_dbi_hw_reset()
602 gpiod_set_value_cansleep(dbi->reset, 0); in mipi_dbi_hw_reset()
604 gpiod_set_value_cansleep(dbi->reset, 1); in mipi_dbi_hw_reset()
621 bool mipi_dbi_display_is_on(struct mipi_dbi *dbi) in mipi_dbi_display_is_on() argument
625 if (mipi_dbi_command_read(dbi, MIPI_DCS_GET_POWER_MODE, &val)) in mipi_dbi_display_is_on()
644 struct mipi_dbi *dbi = &dbidev->dbi; in mipi_dbi_poweron_reset_conditional() local
655 if (cond && mipi_dbi_display_is_on(dbi)) in mipi_dbi_poweron_reset_conditional()
658 mipi_dbi_hw_reset(dbi); in mipi_dbi_poweron_reset_conditional()
659 ret = mipi_dbi_command(dbi, MIPI_DCS_SOFT_RESET); in mipi_dbi_poweron_reset_conditional()
672 if (dbi->reset) in mipi_dbi_poweron_reset_conditional()
761 static int mipi_dbi_spi1e_transfer(struct mipi_dbi *dbi, int dc, in mipi_dbi_spi1e_transfer() argument
766 size_t chunk, max_chunk = dbi->tx_buf9_len; in mipi_dbi_spi1e_transfer()
767 struct spi_device *spi = dbi->spi; in mipi_dbi_spi1e_transfer()
769 .tx_buf = dbi->tx_buf9, in mipi_dbi_spi1e_transfer()
789 dst = dbi->tx_buf9; in mipi_dbi_spi1e_transfer()
809 dst = dbi->tx_buf9; in mipi_dbi_spi1e_transfer()
879 static int mipi_dbi_spi1_transfer(struct mipi_dbi *dbi, int dc, in mipi_dbi_spi1_transfer() argument
883 struct spi_device *spi = dbi->spi; in mipi_dbi_spi1_transfer()
895 return mipi_dbi_spi1e_transfer(dbi, dc, buf, len, bpw); in mipi_dbi_spi1_transfer()
898 max_chunk = dbi->tx_buf9_len; in mipi_dbi_spi1_transfer()
899 dst16 = dbi->tx_buf9; in mipi_dbi_spi1_transfer()
942 static int mipi_dbi_typec1_command_read(struct mipi_dbi *dbi, u8 *cmd, in mipi_dbi_typec1_command_read() argument
945 struct spi_device *spi = dbi->spi; in mipi_dbi_typec1_command_read()
952 .tx_buf = dbi->tx_buf9, in mipi_dbi_typec1_command_read()
983 dst16 = dbi->tx_buf9; in mipi_dbi_typec1_command_read()
995 static int mipi_dbi_typec1_command(struct mipi_dbi *dbi, u8 *cmd, in mipi_dbi_typec1_command() argument
1001 if (mipi_dbi_command_is_read(dbi, *cmd)) in mipi_dbi_typec1_command()
1002 return mipi_dbi_typec1_command_read(dbi, cmd, parameters, num); in mipi_dbi_typec1_command()
1006 ret = mipi_dbi_spi1_transfer(dbi, 0, cmd, 1, 8); in mipi_dbi_typec1_command()
1010 return mipi_dbi_spi1_transfer(dbi, 1, parameters, num, bpw); in mipi_dbi_typec1_command()
1015 static int mipi_dbi_typec3_command_read(struct mipi_dbi *dbi, u8 *cmd, in mipi_dbi_typec3_command_read() argument
1018 struct spi_device *spi = dbi->spi; in mipi_dbi_typec3_command_read()
1055 gpiod_set_value_cansleep(dbi->dc, 0); in mipi_dbi_typec3_command_read()
1079 static int mipi_dbi_typec3_command(struct mipi_dbi *dbi, u8 *cmd, in mipi_dbi_typec3_command() argument
1082 struct spi_device *spi = dbi->spi; in mipi_dbi_typec3_command()
1087 if (mipi_dbi_command_is_read(dbi, *cmd)) in mipi_dbi_typec3_command()
1088 return mipi_dbi_typec3_command_read(dbi, cmd, par, num); in mipi_dbi_typec3_command()
1092 gpiod_set_value_cansleep(dbi->dc, 0); in mipi_dbi_typec3_command()
1098 if (*cmd == MIPI_DCS_WRITE_MEMORY_START && !dbi->swap_bytes) in mipi_dbi_typec3_command()
1101 gpiod_set_value_cansleep(dbi->dc, 1); in mipi_dbi_typec3_command()
1129 int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *dbi, in mipi_dbi_spi_init() argument
1153 dbi->spi = spi; in mipi_dbi_spi_init()
1154 dbi->read_commands = mipi_dbi_dcs_read_commands; in mipi_dbi_spi_init()
1157 dbi->command = mipi_dbi_typec3_command; in mipi_dbi_spi_init()
1158 dbi->dc = dc; in mipi_dbi_spi_init()
1160 dbi->swap_bytes = true; in mipi_dbi_spi_init()
1162 dbi->command = mipi_dbi_typec1_command; in mipi_dbi_spi_init()
1163 dbi->tx_buf9_len = SZ_16K; in mipi_dbi_spi_init()
1164 dbi->tx_buf9 = devm_kmalloc(dev, dbi->tx_buf9_len, GFP_KERNEL); in mipi_dbi_spi_init()
1165 if (!dbi->tx_buf9) in mipi_dbi_spi_init()
1169 mutex_init(&dbi->cmdlock); in mipi_dbi_spi_init()
1282 ret = mipi_dbi_command_buf(&dbidev->dbi, cmd, parameters, i); in mipi_dbi_debugfs_command_write()
1295 struct mipi_dbi *dbi = &dbidev->dbi; in mipi_dbi_debugfs_command_show() local
1304 if (!mipi_dbi_command_is_read(dbi, cmd)) in mipi_dbi_debugfs_command_show()
1324 ret = mipi_dbi_command_buf(dbi, cmd, val, len); in mipi_dbi_debugfs_command_show()
1367 if (dbidev->dbi.read_commands) in mipi_dbi_debugfs_init()