aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/gma500
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-08-05 02:22:48 -0400
committerThierry Reding <treding@nvidia.com>2014-11-13 04:44:41 -0500
commit8446956ed2e877f8d725d7e3b59cbf35ee1081f0 (patch)
tree5682290a043fd84c8c557d3de7c01d4af17f2a5e /drivers/gpu/drm/gma500
parent2f7633125a1ca8a03b63bf91b5eca60551141ddb (diff)
drm/gma500: mdfld: Reuse video/mipi_display.h
The GMA500 driver redefines many constants already found in the generic header. Replace uses of the custom defines by the standard ones and get rid of the duplicate defininitions. Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/gma500')
-rw-r--r--drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c75
-rw-r--r--drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.h12
2 files changed, 31 insertions, 56 deletions
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
index 87885d8c06e8..6b43ae3ffd73 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
@@ -25,6 +25,7 @@
25 */ 25 */
26 26
27#include <linux/freezer.h> 27#include <linux/freezer.h>
28#include <video/mipi_display.h>
28 29
29#include "mdfld_dsi_output.h" 30#include "mdfld_dsi_output.h"
30#include "mdfld_dsi_pkg_sender.h" 31#include "mdfld_dsi_pkg_sender.h"
@@ -32,20 +33,6 @@
32 33
33#define MDFLD_DSI_READ_MAX_COUNT 5000 34#define MDFLD_DSI_READ_MAX_COUNT 5000
34 35
35enum data_type {
36 DSI_DT_GENERIC_SHORT_WRITE_0 = 0x03,
37 DSI_DT_GENERIC_SHORT_WRITE_1 = 0x13,
38 DSI_DT_GENERIC_SHORT_WRITE_2 = 0x23,
39 DSI_DT_GENERIC_READ_0 = 0x04,
40 DSI_DT_GENERIC_READ_1 = 0x14,
41 DSI_DT_GENERIC_READ_2 = 0x24,
42 DSI_DT_GENERIC_LONG_WRITE = 0x29,
43 DSI_DT_DCS_SHORT_WRITE_0 = 0x05,
44 DSI_DT_DCS_SHORT_WRITE_1 = 0x15,
45 DSI_DT_DCS_READ = 0x06,
46 DSI_DT_DCS_LONG_WRITE = 0x39,
47};
48
49enum { 36enum {
50 MDFLD_DSI_PANEL_MODE_SLEEP = 0x1, 37 MDFLD_DSI_PANEL_MODE_SLEEP = 0x1,
51}; 38};
@@ -321,9 +308,9 @@ static int send_pkg_prepare(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
321 u8 cmd; 308 u8 cmd;
322 309
323 switch (data_type) { 310 switch (data_type) {
324 case DSI_DT_DCS_SHORT_WRITE_0: 311 case MIPI_DSI_DCS_SHORT_WRITE:
325 case DSI_DT_DCS_SHORT_WRITE_1: 312 case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
326 case DSI_DT_DCS_LONG_WRITE: 313 case MIPI_DSI_DCS_LONG_WRITE:
327 cmd = *data; 314 cmd = *data;
328 break; 315 break;
329 default: 316 default:
@@ -334,12 +321,12 @@ static int send_pkg_prepare(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
334 sender->status = MDFLD_DSI_PKG_SENDER_BUSY; 321 sender->status = MDFLD_DSI_PKG_SENDER_BUSY;
335 322
336 /*wait for 120 milliseconds in case exit_sleep_mode just be sent*/ 323 /*wait for 120 milliseconds in case exit_sleep_mode just be sent*/
337 if (unlikely(cmd == DCS_ENTER_SLEEP_MODE)) { 324 if (unlikely(cmd == MIPI_DCS_ENTER_SLEEP_MODE)) {
338 /*TODO: replace it with msleep later*/ 325 /*TODO: replace it with msleep later*/
339 mdelay(120); 326 mdelay(120);
340 } 327 }
341 328
342 if (unlikely(cmd == DCS_EXIT_SLEEP_MODE)) { 329 if (unlikely(cmd == MIPI_DCS_EXIT_SLEEP_MODE)) {
343 /*TODO: replace it with msleep later*/ 330 /*TODO: replace it with msleep later*/
344 mdelay(120); 331 mdelay(120);
345 } 332 }
@@ -352,9 +339,9 @@ static int send_pkg_done(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
352 u8 cmd; 339 u8 cmd;
353 340
354 switch (data_type) { 341 switch (data_type) {
355 case DSI_DT_DCS_SHORT_WRITE_0: 342 case MIPI_DSI_DCS_SHORT_WRITE:
356 case DSI_DT_DCS_SHORT_WRITE_1: 343 case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
357 case DSI_DT_DCS_LONG_WRITE: 344 case MIPI_DSI_DCS_LONG_WRITE:
358 cmd = *data; 345 cmd = *data;
359 break; 346 break;
360 default: 347 default:
@@ -362,15 +349,15 @@ static int send_pkg_done(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
362 } 349 }
363 350
364 /*update panel status*/ 351 /*update panel status*/
365 if (unlikely(cmd == DCS_ENTER_SLEEP_MODE)) { 352 if (unlikely(cmd == MIPI_DCS_ENTER_SLEEP_MODE)) {
366 sender->panel_mode |= MDFLD_DSI_PANEL_MODE_SLEEP; 353 sender->panel_mode |= MDFLD_DSI_PANEL_MODE_SLEEP;
367 /*TODO: replace it with msleep later*/ 354 /*TODO: replace it with msleep later*/
368 mdelay(120); 355 mdelay(120);
369 } else if (unlikely(cmd == DCS_EXIT_SLEEP_MODE)) { 356 } else if (unlikely(cmd == MIPI_DCS_EXIT_SLEEP_MODE)) {
370 sender->panel_mode &= ~MDFLD_DSI_PANEL_MODE_SLEEP; 357 sender->panel_mode &= ~MDFLD_DSI_PANEL_MODE_SLEEP;
371 /*TODO: replace it with msleep later*/ 358 /*TODO: replace it with msleep later*/
372 mdelay(120); 359 mdelay(120);
373 } else if (unlikely(cmd == DCS_SOFT_RESET)) { 360 } else if (unlikely(cmd == MIPI_DCS_SOFT_RESET)) {
374 /*TODO: replace it with msleep later*/ 361 /*TODO: replace it with msleep later*/
375 mdelay(5); 362 mdelay(5);
376 } 363 }
@@ -405,19 +392,19 @@ static int send_pkg(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
405 } 392 }
406 393
407 switch (data_type) { 394 switch (data_type) {
408 case DSI_DT_GENERIC_SHORT_WRITE_0: 395 case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
409 case DSI_DT_GENERIC_SHORT_WRITE_1: 396 case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
410 case DSI_DT_GENERIC_SHORT_WRITE_2: 397 case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
411 case DSI_DT_GENERIC_READ_0: 398 case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
412 case DSI_DT_GENERIC_READ_1: 399 case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
413 case DSI_DT_GENERIC_READ_2: 400 case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
414 case DSI_DT_DCS_SHORT_WRITE_0: 401 case MIPI_DSI_DCS_SHORT_WRITE:
415 case DSI_DT_DCS_SHORT_WRITE_1: 402 case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
416 case DSI_DT_DCS_READ: 403 case MIPI_DSI_DCS_READ:
417 ret = send_short_pkg(sender, data_type, data[0], data[1], hs); 404 ret = send_short_pkg(sender, data_type, data[0], data[1], hs);
418 break; 405 break;
419 case DSI_DT_GENERIC_LONG_WRITE: 406 case MIPI_DSI_GENERIC_LONG_WRITE:
420 case DSI_DT_DCS_LONG_WRITE: 407 case MIPI_DSI_DCS_LONG_WRITE:
421 ret = send_long_pkg(sender, data_type, data, len, hs); 408 ret = send_long_pkg(sender, data_type, data, len, hs);
422 break; 409 break;
423 } 410 }
@@ -440,7 +427,7 @@ int mdfld_dsi_send_mcs_long(struct mdfld_dsi_pkg_sender *sender, u8 *data,
440 } 427 }
441 428
442 spin_lock_irqsave(&sender->lock, flags); 429 spin_lock_irqsave(&sender->lock, flags);
443 send_pkg(sender, DSI_DT_DCS_LONG_WRITE, data, len, hs); 430 send_pkg(sender, MIPI_DSI_DCS_LONG_WRITE, data, len, hs);
444 spin_unlock_irqrestore(&sender->lock, flags); 431 spin_unlock_irqrestore(&sender->lock, flags);
445 432
446 return 0; 433 return 0;
@@ -461,10 +448,10 @@ int mdfld_dsi_send_mcs_short(struct mdfld_dsi_pkg_sender *sender, u8 cmd,
461 data[0] = cmd; 448 data[0] = cmd;
462 449
463 if (param_num) { 450 if (param_num) {
464 data_type = DSI_DT_DCS_SHORT_WRITE_1; 451 data_type = MIPI_DSI_DCS_SHORT_WRITE_PARAM;
465 data[1] = param; 452 data[1] = param;
466 } else { 453 } else {
467 data_type = DSI_DT_DCS_SHORT_WRITE_0; 454 data_type = MIPI_DSI_DCS_SHORT_WRITE;
468 data[1] = 0; 455 data[1] = 0;
469 } 456 }
470 457
@@ -489,17 +476,17 @@ int mdfld_dsi_send_gen_short(struct mdfld_dsi_pkg_sender *sender, u8 param0,
489 476
490 switch (param_num) { 477 switch (param_num) {
491 case 0: 478 case 0:
492 data_type = DSI_DT_GENERIC_SHORT_WRITE_0; 479 data_type = MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM;
493 data[0] = 0; 480 data[0] = 0;
494 data[1] = 0; 481 data[1] = 0;
495 break; 482 break;
496 case 1: 483 case 1:
497 data_type = DSI_DT_GENERIC_SHORT_WRITE_1; 484 data_type = MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM;
498 data[0] = param0; 485 data[0] = param0;
499 data[1] = 0; 486 data[1] = 0;
500 break; 487 break;
501 case 2: 488 case 2:
502 data_type = DSI_DT_GENERIC_SHORT_WRITE_2; 489 data_type = MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM;
503 data[0] = param0; 490 data[0] = param0;
504 data[1] = param1; 491 data[1] = param1;
505 break; 492 break;
@@ -523,7 +510,7 @@ int mdfld_dsi_send_gen_long(struct mdfld_dsi_pkg_sender *sender, u8 *data,
523 } 510 }
524 511
525 spin_lock_irqsave(&sender->lock, flags); 512 spin_lock_irqsave(&sender->lock, flags);
526 send_pkg(sender, DSI_DT_GENERIC_LONG_WRITE, data, len, hs); 513 send_pkg(sender, MIPI_DSI_GENERIC_LONG_WRITE, data, len, hs);
527 spin_unlock_irqrestore(&sender->lock, flags); 514 spin_unlock_irqrestore(&sender->lock, flags);
528 515
529 return 0; 516 return 0;
@@ -594,7 +581,7 @@ int mdfld_dsi_read_mcs(struct mdfld_dsi_pkg_sender *sender, u8 cmd,
594 return -EINVAL; 581 return -EINVAL;
595 } 582 }
596 583
597 return __read_panel_data(sender, DSI_DT_DCS_READ, &cmd, 1, 584 return __read_panel_data(sender, MIPI_DSI_DCS_READ, &cmd, 1,
598 data, len, hs); 585 data, len, hs);
599} 586}
600 587
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.h b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.h
index 459cd7ea8b81..0478a21c15d5 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.h
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.h
@@ -62,18 +62,6 @@ struct mdfld_dsi_pkg_sender {
62 u32 mipi_cmd_len_reg; 62 u32 mipi_cmd_len_reg;
63}; 63};
64 64
65/* DCS definitions */
66#define DCS_SOFT_RESET 0x01
67#define DCS_ENTER_SLEEP_MODE 0x10
68#define DCS_EXIT_SLEEP_MODE 0x11
69#define DCS_SET_DISPLAY_OFF 0x28
70#define DCS_SET_DISPLAY_ON 0x29
71#define DCS_SET_COLUMN_ADDRESS 0x2a
72#define DCS_SET_PAGE_ADDRESS 0x2b
73#define DCS_WRITE_MEM_START 0x2c
74#define DCS_SET_TEAR_OFF 0x34
75#define DCS_SET_TEAR_ON 0x35
76
77extern int mdfld_dsi_pkg_sender_init(struct mdfld_dsi_connector *dsi_connector, 65extern int mdfld_dsi_pkg_sender_init(struct mdfld_dsi_connector *dsi_connector,
78 int pipe); 66 int pipe);
79extern void mdfld_dsi_pkg_sender_destroy(struct mdfld_dsi_pkg_sender *sender); 67extern void mdfld_dsi_pkg_sender_destroy(struct mdfld_dsi_pkg_sender *sender);