forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/staging/fbtft/fbtft-io.c
....@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0
22 #include <linux/export.h>
33 #include <linux/errno.h>
4
-#include <linux/gpio.h>
4
+#include <linux/gpio/consumer.h>
55 #include <linux/spi/spi.h>
66 #include "fbtft.h"
77
....@@ -14,7 +14,7 @@
1414 struct spi_message m;
1515
1616 fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len,
17
- "%s(len=%d): ", __func__, len);
17
+ "%s(len=%zu): ", __func__, len);
1818
1919 if (!par->spi) {
2020 dev_err(par->info->device,
....@@ -47,7 +47,7 @@
4747 u64 val, dc, tmp;
4848
4949 fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len,
50
- "%s(len=%d): ", __func__, len);
50
+ "%s(len=%zu): ", __func__, len);
5151
5252 if (!par->extra) {
5353 dev_err(par->info->device, "%s: error: par->extra is NULL\n",
....@@ -109,7 +109,7 @@
109109 txbuf[0] = par->startbyte | 0x3;
110110 t.tx_buf = txbuf;
111111 fbtft_par_dbg_hex(DEBUG_READ, par, par->info->device, u8,
112
- txbuf, len, "%s(len=%d) txbuf => ",
112
+ txbuf, len, "%s(len=%zu) txbuf => ",
113113 __func__, len);
114114 }
115115
....@@ -117,7 +117,7 @@
117117 spi_message_add_tail(&t, &m);
118118 ret = spi_sync(par->spi, &m);
119119 fbtft_par_dbg_hex(DEBUG_READ, par, par->info->device, u8, buf, len,
120
- "%s(len=%d) buf <= ", __func__, len);
120
+ "%s(len=%zu) buf <= ", __func__, len);
121121
122122 return ret;
123123 }
....@@ -136,36 +136,36 @@
136136 #endif
137137
138138 fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len,
139
- "%s(len=%d): ", __func__, len);
139
+ "%s(len=%zu): ", __func__, len);
140140
141141 while (len--) {
142142 data = *(u8 *)buf;
143143
144144 /* Start writing by pulling down /WR */
145
- gpio_set_value(par->gpio.wr, 0);
145
+ gpiod_set_value(par->gpio.wr, 1);
146146
147147 /* Set data */
148148 #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO
149149 if (data == prev_data) {
150
- gpio_set_value(par->gpio.wr, 0); /* used as delay */
150
+ gpiod_set_value(par->gpio.wr, 1); /* used as delay */
151151 } else {
152152 for (i = 0; i < 8; i++) {
153153 if ((data & 1) != (prev_data & 1))
154
- gpio_set_value(par->gpio.db[i],
155
- data & 1);
154
+ gpiod_set_value(par->gpio.db[i],
155
+ data & 1);
156156 data >>= 1;
157157 prev_data >>= 1;
158158 }
159159 }
160160 #else
161161 for (i = 0; i < 8; i++) {
162
- gpio_set_value(par->gpio.db[i], data & 1);
162
+ gpiod_set_value(par->gpio.db[i], data & 1);
163163 data >>= 1;
164164 }
165165 #endif
166166
167167 /* Pullup /WR */
168
- gpio_set_value(par->gpio.wr, 1);
168
+ gpiod_set_value(par->gpio.wr, 0);
169169
170170 #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO
171171 prev_data = *(u8 *)buf;
....@@ -186,36 +186,36 @@
186186 #endif
187187
188188 fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len,
189
- "%s(len=%d): ", __func__, len);
189
+ "%s(len=%zu): ", __func__, len);
190190
191191 while (len) {
192192 data = *(u16 *)buf;
193193
194194 /* Start writing by pulling down /WR */
195
- gpio_set_value(par->gpio.wr, 0);
195
+ gpiod_set_value(par->gpio.wr, 1);
196196
197197 /* Set data */
198198 #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO
199199 if (data == prev_data) {
200
- gpio_set_value(par->gpio.wr, 0); /* used as delay */
200
+ gpiod_set_value(par->gpio.wr, 1); /* used as delay */
201201 } else {
202202 for (i = 0; i < 16; i++) {
203203 if ((data & 1) != (prev_data & 1))
204
- gpio_set_value(par->gpio.db[i],
205
- data & 1);
204
+ gpiod_set_value(par->gpio.db[i],
205
+ data & 1);
206206 data >>= 1;
207207 prev_data >>= 1;
208208 }
209209 }
210210 #else
211211 for (i = 0; i < 16; i++) {
212
- gpio_set_value(par->gpio.db[i], data & 1);
212
+ gpiod_set_value(par->gpio.db[i], data & 1);
213213 data >>= 1;
214214 }
215215 #endif
216216
217217 /* Pullup /WR */
218
- gpio_set_value(par->gpio.wr, 1);
218
+ gpiod_set_value(par->gpio.wr, 0);
219219
220220 #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO
221221 prev_data = *(u16 *)buf;