forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/gpu/drm/gma500/mdfld_device.c
....@@ -1,29 +1,20 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /**************************************************************************
23 * Copyright (c) 2011, Intel Corporation.
34 * All Rights Reserved.
45 *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms and conditions of the GNU General Public License,
7
- * version 2, as published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
13
- *
14
- * You should have received a copy of the GNU General Public License along with
15
- * this program; if not, write to the Free Software Foundation, Inc.,
16
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17
- *
186 **************************************************************************/
197
20
-#include "psb_drv.h"
21
-#include "mid_bios.h"
22
-#include "mdfld_output.h"
23
-#include "mdfld_dsi_output.h"
24
-#include "tc35876x-dsi-lvds.h"
8
+#include <linux/delay.h>
9
+#include <linux/gpio/machine.h>
2510
2611 #include <asm/intel_scu_ipc.h>
12
+
13
+#include "mdfld_dsi_output.h"
14
+#include "mdfld_output.h"
15
+#include "mid_bios.h"
16
+#include "psb_drv.h"
17
+#include "tc35876x-dsi-lvds.h"
2718
2819 #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
2920
....@@ -342,7 +333,7 @@
342333
343334 if (pipenum == 1) {
344335 /* restore palette (gamma) */
345
- /*DRM_UDELAY(50000); */
336
+ /* udelay(50000); */
346337 for (i = 0; i < 256; i++)
347338 PSB_WVDC32(pipe->palette[i], map->palette + (i << 2));
348339
....@@ -404,7 +395,7 @@
404395 PSB_WVDC32(pipe->conf, map->conf);
405396
406397 /* restore palette (gamma) */
407
- /*DRM_UDELAY(50000); */
398
+ /* udelay(50000); */
408399 for (i = 0; i < 256; i++)
409400 PSB_WVDC32(pipe->palette[i], map->palette + (i << 2));
410401
....@@ -515,12 +506,31 @@
515506 },
516507 };
517508
509
+/*
510
+ * The GPIO lines for resetting DSI pipe 0 and 2 are available in the
511
+ * PCI device 0000:00:0c.0 on the Medfield.
512
+ */
513
+static struct gpiod_lookup_table mdfld_dsi_pipe_gpio_table = {
514
+ .table = {
515
+ GPIO_LOOKUP("0000:00:0c.0", 128, "dsi-pipe0-reset",
516
+ GPIO_ACTIVE_HIGH),
517
+ GPIO_LOOKUP("0000:00:0c.0", 34, "dsi-pipe2-reset",
518
+ GPIO_ACTIVE_HIGH),
519
+ { },
520
+ },
521
+};
522
+
518523 static int mdfld_chip_setup(struct drm_device *dev)
519524 {
520525 struct drm_psb_private *dev_priv = dev->dev_private;
521526 if (pci_enable_msi(dev->pdev))
522527 dev_warn(dev->dev, "Enabling MSI failed!\n");
523528 dev_priv->regmap = mdfld_regmap;
529
+
530
+ /* Associate the GPIO lines with the DRM device */
531
+ mdfld_dsi_pipe_gpio_table.dev_id = dev_name(dev->dev);
532
+ gpiod_add_lookup_table(&mdfld_dsi_pipe_gpio_table);
533
+
524534 return mid_chip_setup(dev);
525535 }
526536