.. | .. |
---|
25 | 25 | * Jackie Li<yaodong.li@intel.com> |
---|
26 | 26 | */ |
---|
27 | 27 | |
---|
28 | | -#include <linux/module.h> |
---|
29 | | - |
---|
30 | | -#include "mdfld_dsi_output.h" |
---|
31 | | -#include "mdfld_dsi_dpi.h" |
---|
32 | | -#include "mdfld_output.h" |
---|
33 | | -#include "mdfld_dsi_pkg_sender.h" |
---|
34 | | -#include "tc35876x-dsi-lvds.h" |
---|
| 28 | +#include <linux/delay.h> |
---|
| 29 | +#include <linux/moduleparam.h> |
---|
35 | 30 | #include <linux/pm_runtime.h> |
---|
| 31 | +#include <linux/gpio/consumer.h> |
---|
| 32 | + |
---|
36 | 33 | #include <asm/intel_scu_ipc.h> |
---|
| 34 | + |
---|
| 35 | +#include "mdfld_dsi_dpi.h" |
---|
| 36 | +#include "mdfld_dsi_output.h" |
---|
| 37 | +#include "mdfld_dsi_pkg_sender.h" |
---|
| 38 | +#include "mdfld_output.h" |
---|
| 39 | +#include "tc35876x-dsi-lvds.h" |
---|
37 | 40 | |
---|
38 | 41 | /* get the LABC from command line. */ |
---|
39 | 42 | static int LABC_control = 1; |
---|
.. | .. |
---|
364 | 367 | /** |
---|
365 | 368 | * FIXME: current DC has no fitting unit, reject any mode setting |
---|
366 | 369 | * request |
---|
367 | | - * Will figure out a way to do up-scaling(pannel fitting) later. |
---|
| 370 | + * Will figure out a way to do up-scaling(panel fitting) later. |
---|
368 | 371 | **/ |
---|
369 | 372 | if (fixed_mode) { |
---|
370 | 373 | if (mode->hdisplay != fixed_mode->hdisplay) |
---|
.. | .. |
---|
430 | 433 | return 0; |
---|
431 | 434 | } |
---|
432 | 435 | |
---|
433 | | -int mdfld_dsi_panel_reset(int pipe) |
---|
| 436 | +int mdfld_dsi_panel_reset(struct drm_device *ddev, int pipe) |
---|
434 | 437 | { |
---|
435 | | - unsigned gpio; |
---|
436 | | - int ret = 0; |
---|
| 438 | + struct device *dev = ddev->dev; |
---|
| 439 | + struct gpio_desc *gpiod; |
---|
437 | 440 | |
---|
| 441 | + /* |
---|
| 442 | + * Raise the GPIO reset line for the corresponding pipe to HIGH, |
---|
| 443 | + * this is probably because it is active low so this takes the |
---|
| 444 | + * respective pipe out of reset. (We have no code to put it back |
---|
| 445 | + * into reset in this driver.) |
---|
| 446 | + */ |
---|
438 | 447 | switch (pipe) { |
---|
439 | 448 | case 0: |
---|
440 | | - gpio = 128; |
---|
| 449 | + gpiod = gpiod_get(dev, "dsi-pipe0-reset", GPIOD_OUT_HIGH); |
---|
| 450 | + if (IS_ERR(gpiod)) |
---|
| 451 | + return PTR_ERR(gpiod); |
---|
441 | 452 | break; |
---|
442 | 453 | case 2: |
---|
443 | | - gpio = 34; |
---|
| 454 | + gpiod = gpiod_get(dev, "dsi-pipe2-reset", GPIOD_OUT_HIGH); |
---|
| 455 | + if (IS_ERR(gpiod)) |
---|
| 456 | + return PTR_ERR(gpiod); |
---|
444 | 457 | break; |
---|
445 | 458 | default: |
---|
446 | | - DRM_ERROR("Invalid output\n"); |
---|
| 459 | + DRM_DEV_ERROR(dev, "Invalid output pipe\n"); |
---|
447 | 460 | return -EINVAL; |
---|
448 | 461 | } |
---|
| 462 | + gpiod_put(gpiod); |
---|
449 | 463 | |
---|
450 | | - ret = gpio_request(gpio, "gfx"); |
---|
451 | | - if (ret) { |
---|
452 | | - DRM_ERROR("gpio_rqueset failed\n"); |
---|
453 | | - return ret; |
---|
454 | | - } |
---|
| 464 | + /* Flush posted writes on the device */ |
---|
| 465 | + gpiod = gpiod_get(dev, "dsi-pipe0-reset", GPIOD_ASIS); |
---|
| 466 | + if (IS_ERR(gpiod)) |
---|
| 467 | + return PTR_ERR(gpiod); |
---|
| 468 | + gpiod_get_value(gpiod); |
---|
| 469 | + gpiod_put(gpiod); |
---|
455 | 470 | |
---|
456 | | - ret = gpio_direction_output(gpio, 1); |
---|
457 | | - if (ret) { |
---|
458 | | - DRM_ERROR("gpio_direction_output failed\n"); |
---|
459 | | - goto gpio_error; |
---|
460 | | - } |
---|
461 | | - |
---|
462 | | - gpio_get_value(128); |
---|
463 | | - |
---|
464 | | -gpio_error: |
---|
465 | | - if (gpio_is_valid(gpio)) |
---|
466 | | - gpio_free(gpio); |
---|
467 | | - |
---|
468 | | - return ret; |
---|
| 471 | + return 0; |
---|
469 | 472 | } |
---|
470 | 473 | |
---|
471 | 474 | /* |
---|
.. | .. |
---|
496 | 499 | return; |
---|
497 | 500 | } |
---|
498 | 501 | |
---|
499 | | - /*create a new connetor*/ |
---|
| 502 | + /*create a new connector*/ |
---|
500 | 503 | dsi_connector = kzalloc(sizeof(struct mdfld_dsi_connector), GFP_KERNEL); |
---|
501 | 504 | if (!dsi_connector) { |
---|
502 | 505 | DRM_ERROR("No memory"); |
---|
.. | .. |
---|
529 | 532 | dsi_config->connector = dsi_connector; |
---|
530 | 533 | |
---|
531 | 534 | if (!dsi_config->fixed_mode) { |
---|
532 | | - DRM_ERROR("No pannel fixed mode was found\n"); |
---|
| 535 | + DRM_ERROR("No panel fixed mode was found\n"); |
---|
533 | 536 | goto dsi_init_err0; |
---|
534 | 537 | } |
---|
535 | 538 | |
---|