diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2022-01-03 12:38:22 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2022-02-21 00:31:24 +0100 |
commit | de45f0a3bef63a754839f008bb0cae86d8f501c1 (patch) | |
tree | e06000e114f8e2dbbe88e774d57d9f2ddcbaccf3 /drivers/gpu/drm/panel | |
parent | e78089da45093e0f421b933849c56b7bc21108c0 (diff) | |
download | linux-de45f0a3bef63a754839f008bb0cae86d8f501c1.tar.bz2 |
drm/panel: nt35560: Support also ACX424AKM
Add some code and config to also support the ACX424AKM used in
some Sony (Ericsson) Mobile phones.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220103113822.654592-3-linus.walleij@linaro.org
Diffstat (limited to 'drivers/gpu/drm/panel')
-rw-r--r-- | drivers/gpu/drm/panel/panel-novatek-nt35560.c | 72 |
1 files changed, 69 insertions, 3 deletions
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35560.c b/drivers/gpu/drm/panel/panel-novatek-nt35560.c index 498f17581690..1b6042321ea1 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt35560.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt35560.c @@ -10,12 +10,15 @@ * Author: Linus Walleij * Based on code and know-how from Marcus Lorentzon * Copyright (C) ST-Ericsson SA 2010 + * Based on code and know-how from Johan Olson and Joakim Wesslen + * Copyright (C) Sony Ericsson Mobile Communications 2010 */ #include <linux/backlight.h> #include <linux/delay.h> #include <linux/gpio/consumer.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/of_device.h> #include <linux/regulator/consumer.h> #include <video/mipi_display.h> @@ -41,7 +44,13 @@ */ #define DISPLAY_SONY_ACX424AKP_ID4 0x8000 +struct nt35560_config { + const struct drm_display_mode *vid_mode; + const struct drm_display_mode *cmd_mode; +}; + struct nt35560 { + const struct nt35560_config *conf; struct drm_panel panel; struct device *dev; struct regulator *supply; @@ -86,6 +95,49 @@ static const struct drm_display_mode sony_acx424akp_cmd_mode = { .height_mm = 84, }; +static const struct nt35560_config sony_acx424akp_data = { + .vid_mode = &sony_acx424akp_vid_mode, + .cmd_mode = &sony_acx424akp_cmd_mode, +}; + +static const struct drm_display_mode sony_acx424akm_vid_mode = { + .clock = 27234, + .hdisplay = 480, + .hsync_start = 480 + 15, + .hsync_end = 480 + 15 + 0, + .htotal = 480 + 15 + 0 + 15, + .vdisplay = 854, + .vsync_start = 854 + 14, + .vsync_end = 854 + 14 + 1, + .vtotal = 854 + 14 + 1 + 11, + .width_mm = 46, + .height_mm = 82, + .flags = DRM_MODE_FLAG_PVSYNC, +}; + +/* + * The timings are not very helpful as the display is used in + * command mode using the maximum HS frequency. + */ +static const struct drm_display_mode sony_acx424akm_cmd_mode = { + .clock = 35478, + .hdisplay = 480, + .hsync_start = 480 + 154, + .hsync_end = 480 + 154 + 16, + .htotal = 480 + 154 + 16 + 32, + .vdisplay = 854, + .vsync_start = 854 + 1, + .vsync_end = 854 + 1 + 1, + .vtotal = 854 + 1 + 1 + 1, + .width_mm = 46, + .height_mm = 82, +}; + +static const struct nt35560_config sony_acx424akm_data = { + .vid_mode = &sony_acx424akm_vid_mode, + .cmd_mode = &sony_acx424akm_cmd_mode, +}; + static inline struct nt35560 *panel_to_nt35560(struct drm_panel *panel) { return container_of(panel, struct nt35560, panel); @@ -369,14 +421,15 @@ static int nt35560_get_modes(struct drm_panel *panel, struct drm_connector *connector) { struct nt35560 *nt = panel_to_nt35560(panel); + const struct nt35560_config *conf = nt->conf; struct drm_display_mode *mode; if (nt->video_mode) mode = drm_mode_duplicate(connector->dev, - &sony_acx424akp_vid_mode); + conf->vid_mode); else mode = drm_mode_duplicate(connector->dev, - &sony_acx424akp_cmd_mode); + conf->cmd_mode); if (!mode) { dev_err(panel->dev, "bad mode or failed to add mode\n"); return -EINVAL; @@ -413,6 +466,12 @@ static int nt35560_probe(struct mipi_dsi_device *dsi) mipi_dsi_set_drvdata(dsi, nt); nt->dev = dev; + nt->conf = of_device_get_match_data(dev); + if (!nt->conf) { + dev_err(dev, "missing device configuration\n"); + return -ENODEV; + } + dsi->lanes = 2; dsi->format = MIPI_DSI_FMT_RGB888; /* @@ -475,7 +534,14 @@ static int nt35560_remove(struct mipi_dsi_device *dsi) } static const struct of_device_id nt35560_of_match[] = { - { .compatible = "sony,acx424akp" }, + { + .compatible = "sony,acx424akp", + .data = &sony_acx424akp_data, + }, + { + .compatible = "sony,acx424akm", + .data = &sony_acx424akm_data, + }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, nt35560_of_match); |