.. | .. |
---|
27 | 27 | */ |
---|
28 | 28 | struct fbtft_gpio { |
---|
29 | 29 | char name[FBTFT_GPIO_NAME_SIZE]; |
---|
30 | | - unsigned int gpio; |
---|
| 30 | + struct gpio_desc *gpio; |
---|
31 | 31 | }; |
---|
32 | 32 | |
---|
33 | 33 | struct fbtft_par; |
---|
.. | .. |
---|
134 | 134 | */ |
---|
135 | 135 | struct fbtft_platform_data { |
---|
136 | 136 | struct fbtft_display display; |
---|
137 | | - const struct fbtft_gpio *gpios; |
---|
138 | 137 | unsigned int rotate; |
---|
139 | 138 | bool bgr; |
---|
140 | 139 | unsigned int fps; |
---|
.. | .. |
---|
207 | 206 | unsigned int dirty_lines_start; |
---|
208 | 207 | unsigned int dirty_lines_end; |
---|
209 | 208 | 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]; |
---|
219 | 218 | } gpio; |
---|
220 | 219 | const s16 *init_sequence; |
---|
221 | 220 | struct { |
---|
.. | .. |
---|
232 | 231 | bool polarity; |
---|
233 | 232 | }; |
---|
234 | 233 | |
---|
235 | | -#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int)) |
---|
| 234 | +#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__}) / sizeof(int)) |
---|
236 | 235 | |
---|
237 | 236 | #define write_reg(par, ...) \ |
---|
238 | 237 | ((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__)) |
---|
239 | 238 | |
---|
240 | 239 | /* fbtft-core.c */ |
---|
241 | 240 | int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc); |
---|
| 241 | +__printf(5, 6) |
---|
242 | 242 | void fbtft_dbg_hex(const struct device *dev, int groupsize, |
---|
243 | 243 | void *buf, size_t len, const char *fmt, ...); |
---|
244 | 244 | struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, |
---|
.. | .. |
---|
309 | 309 | static struct spi_driver fbtft_driver_spi_driver = { \ |
---|
310 | 310 | .driver = { \ |
---|
311 | 311 | .name = _name, \ |
---|
312 | | - .of_match_table = of_match_ptr(dt_ids), \ |
---|
| 312 | + .of_match_table = dt_ids, \ |
---|
313 | 313 | }, \ |
---|
314 | 314 | .probe = fbtft_driver_probe_spi, \ |
---|
315 | 315 | .remove = fbtft_driver_remove_spi, \ |
---|
.. | .. |
---|
319 | 319 | .driver = { \ |
---|
320 | 320 | .name = _name, \ |
---|
321 | 321 | .owner = THIS_MODULE, \ |
---|
322 | | - .of_match_table = of_match_ptr(dt_ids), \ |
---|
| 322 | + .of_match_table = dt_ids, \ |
---|
323 | 323 | }, \ |
---|
324 | 324 | .probe = fbtft_driver_probe_pdev, \ |
---|
325 | 325 | .remove = fbtft_driver_remove_pdev, \ |
---|
.. | .. |
---|
351 | 351 | |
---|
352 | 352 | /* shorthand debug levels */ |
---|
353 | 353 | #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) |
---|
357 | 365 | #define DEBUG_LEVEL_5 (DEBUG_LEVEL_3 | DEBUG_UPDATE_DISPLAY) |
---|
358 | 366 | #define DEBUG_LEVEL_6 (DEBUG_LEVEL_4 | DEBUG_LEVEL_5) |
---|
359 | 367 | #define DEBUG_LEVEL_7 0xFFFFFFFF |
---|
360 | 368 | |
---|
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) |
---|
366 | 374 | |
---|
367 | 375 | /* 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) |
---|
375 | 383 | |
---|
376 | | -#define DEBUG_SYSFS (1<<16) |
---|
| 384 | +#define DEBUG_SYSFS BIT(16) |
---|
377 | 385 | |
---|
378 | 386 | /* 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) |
---|
394 | 402 | |
---|
395 | 403 | #define fbtft_init_dbg(dev, format, arg...) \ |
---|
396 | 404 | do { \ |
---|
.. | .. |
---|
401 | 409 | |
---|
402 | 410 | #define fbtft_par_dbg(level, par, format, arg...) \ |
---|
403 | 411 | 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); \ |
---|
406 | 414 | } while (0) |
---|
407 | 415 | |
---|
408 | 416 | #define fbtft_par_dbg_hex(level, par, dev, type, buf, num, format, arg...) \ |
---|