| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /************************************************************************** |
|---|
| 2 | 3 | * Copyright (c) 2011, Intel Corporation. |
|---|
| 3 | 4 | * All Rights Reserved. |
|---|
| 4 | 5 | * |
|---|
| 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 | | - * |
|---|
| 18 | 6 | **************************************************************************/ |
|---|
| 19 | 7 | |
|---|
| 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> |
|---|
| 25 | 10 | |
|---|
| 26 | 11 | #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" |
|---|
| 27 | 18 | |
|---|
| 28 | 19 | #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE |
|---|
| 29 | 20 | |
|---|
| .. | .. |
|---|
| 342 | 333 | |
|---|
| 343 | 334 | if (pipenum == 1) { |
|---|
| 344 | 335 | /* restore palette (gamma) */ |
|---|
| 345 | | - /*DRM_UDELAY(50000); */ |
|---|
| 336 | + /* udelay(50000); */ |
|---|
| 346 | 337 | for (i = 0; i < 256; i++) |
|---|
| 347 | 338 | PSB_WVDC32(pipe->palette[i], map->palette + (i << 2)); |
|---|
| 348 | 339 | |
|---|
| .. | .. |
|---|
| 404 | 395 | PSB_WVDC32(pipe->conf, map->conf); |
|---|
| 405 | 396 | |
|---|
| 406 | 397 | /* restore palette (gamma) */ |
|---|
| 407 | | - /*DRM_UDELAY(50000); */ |
|---|
| 398 | + /* udelay(50000); */ |
|---|
| 408 | 399 | for (i = 0; i < 256; i++) |
|---|
| 409 | 400 | PSB_WVDC32(pipe->palette[i], map->palette + (i << 2)); |
|---|
| 410 | 401 | |
|---|
| .. | .. |
|---|
| 515 | 506 | }, |
|---|
| 516 | 507 | }; |
|---|
| 517 | 508 | |
|---|
| 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 | + |
|---|
| 518 | 523 | static int mdfld_chip_setup(struct drm_device *dev) |
|---|
| 519 | 524 | { |
|---|
| 520 | 525 | struct drm_psb_private *dev_priv = dev->dev_private; |
|---|
| 521 | 526 | if (pci_enable_msi(dev->pdev)) |
|---|
| 522 | 527 | dev_warn(dev->dev, "Enabling MSI failed!\n"); |
|---|
| 523 | 528 | 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 | + |
|---|
| 524 | 534 | return mid_chip_setup(dev); |
|---|
| 525 | 535 | } |
|---|
| 526 | 536 | |
|---|