Lines Matching +full:msb +full:- +full:justified
1 // SPDX-License-Identifier: GPL-2.0-or-later
19 * spi_write - write command to the SPI port
21 * @data: can be 8/16/32-bit, MSB justified data to write.
27 * %-ETIMEDOUT timeout occurred
35 *(void **) spi_controller_get_devdata(spi->controller); in lcd_spi_write()
40 switch (spi->bits_per_word) { in lcd_spi_write()
51 dev_err(&spi->dev, "Wrong spi bit length\n"); in lcd_spi_write()
64 if (!--timeout) { in lcd_spi_write()
65 ret = -ETIMEDOUT; in lcd_spi_write()
66 dev_err(&spi->dev, "spi cmd send time out\n"); in lcd_spi_write()
84 *(void **) spi_controller_get_devdata(spi->controller); in lcd_spi_setup()
88 CFG_TXBITS(spi->bits_per_word) | in lcd_spi_setup()
112 list_for_each_entry(t, &m->transfers, transfer_list) { in lcd_spi_one_transfer()
113 switch (spi->bits_per_word) { in lcd_spi_one_transfer()
115 for (i = 0; i < t->len; i++) in lcd_spi_one_transfer()
116 lcd_spi_write(spi, ((u8 *)t->tx_buf)[i]); in lcd_spi_one_transfer()
119 for (i = 0; i < t->len/2; i++) in lcd_spi_one_transfer()
120 lcd_spi_write(spi, ((u16 *)t->tx_buf)[i]); in lcd_spi_one_transfer()
123 for (i = 0; i < t->len/4; i++) in lcd_spi_one_transfer()
124 lcd_spi_write(spi, ((u32 *)t->tx_buf)[i]); in lcd_spi_one_transfer()
127 dev_err(&spi->dev, "Wrong spi bit length\n"); in lcd_spi_one_transfer()
131 m->status = 0; in lcd_spi_one_transfer()
132 if (m->complete) in lcd_spi_one_transfer()
133 m->complete(m->context); in lcd_spi_one_transfer()
143 ctlr = spi_alloc_master(ctrl->dev, sizeof(void *)); in lcd_spi_register()
145 dev_err(ctrl->dev, "unable to allocate SPI master\n"); in lcd_spi_register()
146 return -ENOMEM; in lcd_spi_register()
149 *p_regbase = (void __force *)ctrl->reg_base; in lcd_spi_register()
152 ctlr->bus_num = 5; in lcd_spi_register()
153 ctlr->num_chipselect = 1; in lcd_spi_register()
154 ctlr->setup = lcd_spi_setup; in lcd_spi_register()
155 ctlr->transfer = lcd_spi_one_transfer; in lcd_spi_register()
159 dev_err(ctrl->dev, "unable to register SPI master\n"); in lcd_spi_register()
164 dev_info(&ctlr->dev, "registered\n"); in lcd_spi_register()