| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ld9040 AMOLED LCD drm_panel driver. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * Derived from drivers/video/backlight/ld9040.c |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Andrzej Hajda <a.hajda@samsung.com> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 11 | | - * published by the Free Software Foundation. |
|---|
| 12 | 9 | */ |
|---|
| 13 | 10 | |
|---|
| 14 | | -#include <drm/drmP.h> |
|---|
| 15 | | -#include <drm/drm_panel.h> |
|---|
| 16 | | - |
|---|
| 11 | +#include <linux/delay.h> |
|---|
| 17 | 12 | #include <linux/gpio/consumer.h> |
|---|
| 13 | +#include <linux/module.h> |
|---|
| 14 | +#include <linux/of.h> |
|---|
| 18 | 15 | #include <linux/regulator/consumer.h> |
|---|
| 19 | 16 | #include <linux/spi/spi.h> |
|---|
| 20 | 17 | |
|---|
| 21 | 18 | #include <video/mipi_display.h> |
|---|
| 22 | 19 | #include <video/of_videomode.h> |
|---|
| 23 | 20 | #include <video/videomode.h> |
|---|
| 21 | + |
|---|
| 22 | +#include <drm/drm_modes.h> |
|---|
| 23 | +#include <drm/drm_panel.h> |
|---|
| 24 | 24 | |
|---|
| 25 | 25 | /* Manufacturer Command Set */ |
|---|
| 26 | 26 | #define MCS_MANPWR 0xb0 |
|---|
| .. | .. |
|---|
| 260 | 260 | return 0; |
|---|
| 261 | 261 | } |
|---|
| 262 | 262 | |
|---|
| 263 | | -static int ld9040_get_modes(struct drm_panel *panel) |
|---|
| 263 | +static int ld9040_get_modes(struct drm_panel *panel, |
|---|
| 264 | + struct drm_connector *connector) |
|---|
| 264 | 265 | { |
|---|
| 265 | | - struct drm_connector *connector = panel->connector; |
|---|
| 266 | 266 | struct ld9040 *ctx = panel_to_ld9040(panel); |
|---|
| 267 | 267 | struct drm_display_mode *mode; |
|---|
| 268 | 268 | |
|---|
| 269 | 269 | mode = drm_mode_create(connector->dev); |
|---|
| 270 | 270 | if (!mode) { |
|---|
| 271 | | - DRM_ERROR("failed to create a new display mode\n"); |
|---|
| 271 | + dev_err(panel->dev, "failed to create a new display mode\n"); |
|---|
| 272 | 272 | return 0; |
|---|
| 273 | 273 | } |
|---|
| 274 | 274 | |
|---|
| .. | .. |
|---|
| 350 | 350 | return ret; |
|---|
| 351 | 351 | } |
|---|
| 352 | 352 | |
|---|
| 353 | | - drm_panel_init(&ctx->panel); |
|---|
| 354 | | - ctx->panel.dev = dev; |
|---|
| 355 | | - ctx->panel.funcs = &ld9040_drm_funcs; |
|---|
| 353 | + drm_panel_init(&ctx->panel, dev, &ld9040_drm_funcs, |
|---|
| 354 | + DRM_MODE_CONNECTOR_DPI); |
|---|
| 356 | 355 | |
|---|
| 357 | | - return drm_panel_add(&ctx->panel); |
|---|
| 356 | + drm_panel_add(&ctx->panel); |
|---|
| 357 | + |
|---|
| 358 | + return 0; |
|---|
| 358 | 359 | } |
|---|
| 359 | 360 | |
|---|
| 360 | 361 | static int ld9040_remove(struct spi_device *spi) |
|---|
| .. | .. |
|---|
| 373 | 374 | }; |
|---|
| 374 | 375 | MODULE_DEVICE_TABLE(of, ld9040_of_match); |
|---|
| 375 | 376 | |
|---|
| 377 | +static const struct spi_device_id ld9040_ids[] = { |
|---|
| 378 | + { "ld9040", }, |
|---|
| 379 | + { /* sentinel */ } |
|---|
| 380 | +}; |
|---|
| 381 | +MODULE_DEVICE_TABLE(spi, ld9040_ids); |
|---|
| 382 | + |
|---|
| 376 | 383 | static struct spi_driver ld9040_driver = { |
|---|
| 377 | 384 | .probe = ld9040_probe, |
|---|
| 378 | 385 | .remove = ld9040_remove, |
|---|