| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2016 InforceComputing |
|---|
| 3 | 4 | * Author: Vinay Simha BN <simhavcs@gmail.com> |
|---|
| .. | .. |
|---|
| 8 | 9 | * From internet archives, the panel for Nexus 7 2nd Gen, 2013 model is a |
|---|
| 9 | 10 | * JDI model LT070ME05000, and its data sheet is at: |
|---|
| 10 | 11 | * http://panelone.net/en/7-0-inch/JDI_LT070ME05000_7.0_inch-datasheet |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 13 | | - * under the terms of the GNU General Public License version 2 as published by |
|---|
| 14 | | - * the Free Software Foundation. |
|---|
| 15 | | - * |
|---|
| 16 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 17 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 18 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 19 | | - * more details. |
|---|
| 20 | | - * |
|---|
| 21 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 22 | | - * this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 23 | 12 | */ |
|---|
| 13 | + |
|---|
| 24 | 14 | #include <linux/backlight.h> |
|---|
| 15 | +#include <linux/delay.h> |
|---|
| 25 | 16 | #include <linux/gpio/consumer.h> |
|---|
| 26 | 17 | #include <linux/module.h> |
|---|
| 27 | 18 | #include <linux/of.h> |
|---|
| 28 | 19 | #include <linux/regulator/consumer.h> |
|---|
| 29 | 20 | |
|---|
| 30 | | -#include <drm/drmP.h> |
|---|
| 21 | +#include <video/mipi_display.h> |
|---|
| 22 | + |
|---|
| 31 | 23 | #include <drm/drm_crtc.h> |
|---|
| 32 | 24 | #include <drm/drm_mipi_dsi.h> |
|---|
| 25 | +#include <drm/drm_modes.h> |
|---|
| 33 | 26 | #include <drm/drm_panel.h> |
|---|
| 34 | | - |
|---|
| 35 | | -#include <video/mipi_display.h> |
|---|
| 36 | 27 | |
|---|
| 37 | 28 | static const char * const regulator_names[] = { |
|---|
| 38 | 29 | "vddp", |
|---|
| .. | .. |
|---|
| 305 | 296 | .vsync_start = 1920 + 3, |
|---|
| 306 | 297 | .vsync_end = 1920 + 3 + 5, |
|---|
| 307 | 298 | .vtotal = 1920 + 3 + 5 + 6, |
|---|
| 308 | | - .vrefresh = 60, |
|---|
| 309 | 299 | .flags = 0, |
|---|
| 310 | 300 | }; |
|---|
| 311 | 301 | |
|---|
| 312 | | -static int jdi_panel_get_modes(struct drm_panel *panel) |
|---|
| 302 | +static int jdi_panel_get_modes(struct drm_panel *panel, |
|---|
| 303 | + struct drm_connector *connector) |
|---|
| 313 | 304 | { |
|---|
| 314 | 305 | struct drm_display_mode *mode; |
|---|
| 315 | 306 | struct jdi_panel *jdi = to_jdi_panel(panel); |
|---|
| 316 | 307 | struct device *dev = &jdi->dsi->dev; |
|---|
| 317 | 308 | |
|---|
| 318 | | - mode = drm_mode_duplicate(panel->drm, &default_mode); |
|---|
| 309 | + mode = drm_mode_duplicate(connector->dev, &default_mode); |
|---|
| 319 | 310 | if (!mode) { |
|---|
| 320 | 311 | dev_err(dev, "failed to add mode %ux%ux@%u\n", |
|---|
| 321 | 312 | default_mode.hdisplay, default_mode.vdisplay, |
|---|
| 322 | | - default_mode.vrefresh); |
|---|
| 313 | + drm_mode_vrefresh(&default_mode)); |
|---|
| 323 | 314 | return -ENOMEM; |
|---|
| 324 | 315 | } |
|---|
| 325 | 316 | |
|---|
| 326 | 317 | drm_mode_set_name(mode); |
|---|
| 327 | 318 | |
|---|
| 328 | | - drm_mode_probed_add(panel->connector, mode); |
|---|
| 319 | + drm_mode_probed_add(connector, mode); |
|---|
| 329 | 320 | |
|---|
| 330 | | - panel->connector->display_info.width_mm = 95; |
|---|
| 331 | | - panel->connector->display_info.height_mm = 151; |
|---|
| 321 | + connector->display_info.width_mm = 95; |
|---|
| 322 | + connector->display_info.height_mm = 151; |
|---|
| 332 | 323 | |
|---|
| 333 | 324 | return 1; |
|---|
| 334 | 325 | } |
|---|
| .. | .. |
|---|
| 446 | 437 | return ret; |
|---|
| 447 | 438 | } |
|---|
| 448 | 439 | |
|---|
| 449 | | - drm_panel_init(&jdi->base); |
|---|
| 450 | | - jdi->base.funcs = &jdi_panel_funcs; |
|---|
| 451 | | - jdi->base.dev = &jdi->dsi->dev; |
|---|
| 440 | + drm_panel_init(&jdi->base, &jdi->dsi->dev, &jdi_panel_funcs, |
|---|
| 441 | + DRM_MODE_CONNECTOR_DSI); |
|---|
| 452 | 442 | |
|---|
| 453 | | - ret = drm_panel_add(&jdi->base); |
|---|
| 443 | + drm_panel_add(&jdi->base); |
|---|
| 454 | 444 | |
|---|
| 455 | | - return ret; |
|---|
| 445 | + return 0; |
|---|
| 456 | 446 | } |
|---|
| 457 | 447 | |
|---|
| 458 | 448 | static void jdi_panel_del(struct jdi_panel *jdi) |
|---|