hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/staging/fbtft/fbtft.h
....@@ -27,7 +27,7 @@
2727 */
2828 struct fbtft_gpio {
2929 char name[FBTFT_GPIO_NAME_SIZE];
30
- unsigned int gpio;
30
+ struct gpio_desc *gpio;
3131 };
3232
3333 struct fbtft_par;
....@@ -134,7 +134,6 @@
134134 */
135135 struct fbtft_platform_data {
136136 struct fbtft_display display;
137
- const struct fbtft_gpio *gpios;
138137 unsigned int rotate;
139138 bool bgr;
140139 unsigned int fps;
....@@ -207,15 +206,15 @@
207206 unsigned int dirty_lines_start;
208207 unsigned int dirty_lines_end;
209208 struct {
210
- int reset;
211
- int dc;
212
- int rd;
213
- int wr;
214
- int latch;
215
- int cs;
216
- int db[16];
217
- int led[16];
218
- int aux[16];
209
+ struct gpio_desc *reset;
210
+ struct gpio_desc *dc;
211
+ struct gpio_desc *rd;
212
+ struct gpio_desc *wr;
213
+ struct gpio_desc *latch;
214
+ struct gpio_desc *cs;
215
+ struct gpio_desc *db[16];
216
+ struct gpio_desc *led[16];
217
+ struct gpio_desc *aux[16];
219218 } gpio;
220219 const s16 *init_sequence;
221220 struct {
....@@ -232,13 +231,14 @@
232231 bool polarity;
233232 };
234233
235
-#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int))
234
+#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__}) / sizeof(int))
236235
237236 #define write_reg(par, ...) \
238237 ((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
239238
240239 /* fbtft-core.c */
241240 int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc);
241
+__printf(5, 6)
242242 void fbtft_dbg_hex(const struct device *dev, int groupsize,
243243 void *buf, size_t len, const char *fmt, ...);
244244 struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
....@@ -309,7 +309,7 @@
309309 static struct spi_driver fbtft_driver_spi_driver = { \
310310 .driver = { \
311311 .name = _name, \
312
- .of_match_table = of_match_ptr(dt_ids), \
312
+ .of_match_table = dt_ids, \
313313 }, \
314314 .probe = fbtft_driver_probe_spi, \
315315 .remove = fbtft_driver_remove_spi, \
....@@ -319,7 +319,7 @@
319319 .driver = { \
320320 .name = _name, \
321321 .owner = THIS_MODULE, \
322
- .of_match_table = of_match_ptr(dt_ids), \
322
+ .of_match_table = dt_ids, \
323323 }, \
324324 .probe = fbtft_driver_probe_pdev, \
325325 .remove = fbtft_driver_remove_pdev, \
....@@ -351,46 +351,54 @@
351351
352352 /* shorthand debug levels */
353353 #define DEBUG_LEVEL_1 DEBUG_REQUEST_GPIOS
354
-#define DEBUG_LEVEL_2 (DEBUG_LEVEL_1 | DEBUG_DRIVER_INIT_FUNCTIONS | DEBUG_TIME_FIRST_UPDATE)
355
-#define DEBUG_LEVEL_3 (DEBUG_LEVEL_2 | DEBUG_RESET | DEBUG_INIT_DISPLAY | DEBUG_BLANK | DEBUG_REQUEST_GPIOS | DEBUG_FREE_GPIOS | DEBUG_VERIFY_GPIOS | DEBUG_BACKLIGHT | DEBUG_SYSFS)
356
-#define DEBUG_LEVEL_4 (DEBUG_LEVEL_2 | DEBUG_FB_READ | DEBUG_FB_WRITE | DEBUG_FB_FILLRECT | DEBUG_FB_COPYAREA | DEBUG_FB_IMAGEBLIT | DEBUG_FB_BLANK)
354
+#define DEBUG_LEVEL_2 (DEBUG_LEVEL_1 | DEBUG_DRIVER_INIT_FUNCTIONS \
355
+ | DEBUG_TIME_FIRST_UPDATE)
356
+#define DEBUG_LEVEL_3 (DEBUG_LEVEL_2 | DEBUG_RESET | DEBUG_INIT_DISPLAY \
357
+ | DEBUG_BLANK | DEBUG_REQUEST_GPIOS \
358
+ | DEBUG_FREE_GPIOS \
359
+ | DEBUG_VERIFY_GPIOS \
360
+ | DEBUG_BACKLIGHT | DEBUG_SYSFS)
361
+#define DEBUG_LEVEL_4 (DEBUG_LEVEL_2 | DEBUG_FB_READ | DEBUG_FB_WRITE \
362
+ | DEBUG_FB_FILLRECT \
363
+ | DEBUG_FB_COPYAREA \
364
+ | DEBUG_FB_IMAGEBLIT | DEBUG_FB_BLANK)
357365 #define DEBUG_LEVEL_5 (DEBUG_LEVEL_3 | DEBUG_UPDATE_DISPLAY)
358366 #define DEBUG_LEVEL_6 (DEBUG_LEVEL_4 | DEBUG_LEVEL_5)
359367 #define DEBUG_LEVEL_7 0xFFFFFFFF
360368
361
-#define DEBUG_DRIVER_INIT_FUNCTIONS (1<<3)
362
-#define DEBUG_TIME_FIRST_UPDATE (1<<4)
363
-#define DEBUG_TIME_EACH_UPDATE (1<<5)
364
-#define DEBUG_DEFERRED_IO (1<<6)
365
-#define DEBUG_FBTFT_INIT_FUNCTIONS (1<<7)
369
+#define DEBUG_DRIVER_INIT_FUNCTIONS BIT(3)
370
+#define DEBUG_TIME_FIRST_UPDATE BIT(4)
371
+#define DEBUG_TIME_EACH_UPDATE BIT(5)
372
+#define DEBUG_DEFERRED_IO BIT(6)
373
+#define DEBUG_FBTFT_INIT_FUNCTIONS BIT(7)
366374
367375 /* fbops */
368
-#define DEBUG_FB_READ (1<<8)
369
-#define DEBUG_FB_WRITE (1<<9)
370
-#define DEBUG_FB_FILLRECT (1<<10)
371
-#define DEBUG_FB_COPYAREA (1<<11)
372
-#define DEBUG_FB_IMAGEBLIT (1<<12)
373
-#define DEBUG_FB_SETCOLREG (1<<13)
374
-#define DEBUG_FB_BLANK (1<<14)
376
+#define DEBUG_FB_READ BIT(8)
377
+#define DEBUG_FB_WRITE BIT(9)
378
+#define DEBUG_FB_FILLRECT BIT(10)
379
+#define DEBUG_FB_COPYAREA BIT(11)
380
+#define DEBUG_FB_IMAGEBLIT BIT(12)
381
+#define DEBUG_FB_SETCOLREG BIT(13)
382
+#define DEBUG_FB_BLANK BIT(14)
375383
376
-#define DEBUG_SYSFS (1<<16)
384
+#define DEBUG_SYSFS BIT(16)
377385
378386 /* fbtftops */
379
-#define DEBUG_BACKLIGHT (1<<17)
380
-#define DEBUG_READ (1<<18)
381
-#define DEBUG_WRITE (1<<19)
382
-#define DEBUG_WRITE_VMEM (1<<20)
383
-#define DEBUG_WRITE_REGISTER (1<<21)
384
-#define DEBUG_SET_ADDR_WIN (1<<22)
385
-#define DEBUG_RESET (1<<23)
386
-#define DEBUG_MKDIRTY (1<<24)
387
-#define DEBUG_UPDATE_DISPLAY (1<<25)
388
-#define DEBUG_INIT_DISPLAY (1<<26)
389
-#define DEBUG_BLANK (1<<27)
390
-#define DEBUG_REQUEST_GPIOS (1<<28)
391
-#define DEBUG_FREE_GPIOS (1<<29)
392
-#define DEBUG_REQUEST_GPIOS_MATCH (1<<30)
393
-#define DEBUG_VERIFY_GPIOS (1<<31)
387
+#define DEBUG_BACKLIGHT BIT(17)
388
+#define DEBUG_READ BIT(18)
389
+#define DEBUG_WRITE BIT(19)
390
+#define DEBUG_WRITE_VMEM BIT(20)
391
+#define DEBUG_WRITE_REGISTER BIT(21)
392
+#define DEBUG_SET_ADDR_WIN BIT(22)
393
+#define DEBUG_RESET BIT(23)
394
+#define DEBUG_MKDIRTY BIT(24)
395
+#define DEBUG_UPDATE_DISPLAY BIT(25)
396
+#define DEBUG_INIT_DISPLAY BIT(26)
397
+#define DEBUG_BLANK BIT(27)
398
+#define DEBUG_REQUEST_GPIOS BIT(28)
399
+#define DEBUG_FREE_GPIOS BIT(29)
400
+#define DEBUG_REQUEST_GPIOS_MATCH BIT(30)
401
+#define DEBUG_VERIFY_GPIOS BIT(31)
394402
395403 #define fbtft_init_dbg(dev, format, arg...) \
396404 do { \
....@@ -401,8 +409,8 @@
401409
402410 #define fbtft_par_dbg(level, par, format, arg...) \
403411 do { \
404
- if (unlikely(par->debug & level)) \
405
- dev_info(par->info->device, format, ##arg); \
412
+ if (unlikely((par)->debug & (level))) \
413
+ dev_info((par)->info->device, format, ##arg); \
406414 } while (0)
407415
408416 #define fbtft_par_dbg_hex(level, par, dev, type, buf, num, format, arg...) \