forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/gpu/drm/gma500/mdfld_dsi_output.c
....@@ -25,15 +25,18 @@
2525 * Jackie Li<yaodong.li@intel.com>
2626 */
2727
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>
3530 #include <linux/pm_runtime.h>
31
+#include <linux/gpio/consumer.h>
32
+
3633 #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"
3740
3841 /* get the LABC from command line. */
3942 static int LABC_control = 1;
....@@ -364,7 +367,7 @@
364367 /**
365368 * FIXME: current DC has no fitting unit, reject any mode setting
366369 * 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.
368371 **/
369372 if (fixed_mode) {
370373 if (mode->hdisplay != fixed_mode->hdisplay)
....@@ -430,42 +433,42 @@
430433 return 0;
431434 }
432435
433
-int mdfld_dsi_panel_reset(int pipe)
436
+int mdfld_dsi_panel_reset(struct drm_device *ddev, int pipe)
434437 {
435
- unsigned gpio;
436
- int ret = 0;
438
+ struct device *dev = ddev->dev;
439
+ struct gpio_desc *gpiod;
437440
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
+ */
438447 switch (pipe) {
439448 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);
441452 break;
442453 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);
444457 break;
445458 default:
446
- DRM_ERROR("Invalid output\n");
459
+ DRM_DEV_ERROR(dev, "Invalid output pipe\n");
447460 return -EINVAL;
448461 }
462
+ gpiod_put(gpiod);
449463
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);
455470
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;
469472 }
470473
471474 /*
....@@ -496,7 +499,7 @@
496499 return;
497500 }
498501
499
- /*create a new connetor*/
502
+ /*create a new connector*/
500503 dsi_connector = kzalloc(sizeof(struct mdfld_dsi_connector), GFP_KERNEL);
501504 if (!dsi_connector) {
502505 DRM_ERROR("No memory");
....@@ -529,7 +532,7 @@
529532 dsi_config->connector = dsi_connector;
530533
531534 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");
533536 goto dsi_init_err0;
534537 }
535538