Re: [PATCH v7] drm/panel: Add driver for Sony ACX424AKP panel
Hi Linus. On Sat, Jan 04, 2020 at 01:10:26AM +0100, Linus Walleij wrote: > The Sony ACX424AKP is a command/videomode DSI panel for > mobile devices. It is used on the ST-Ericsson HREF520 > reference design. We support video mode by default, but > it is possible to switch the panel into command mode > by using the bool property "dsi-command-mode". > > Cc: Stephan Gerhold > Signed-off-by: Linus Walleij Driver looks good but there are a few issues yet to address: It does not build on top of drm-misc-next due to changes to the drm_panel code. And then there is a few checkpatch warnings that needs to be looked at: -:25: WARNING:CONFIG_DESCRIPTION: please write a paragraph that describes the config symbol fully #25: FILE: drivers/gpu/drm/panel/Kconfig:330: +config DRM_PANEL_SONY_ACX424AKP -:52: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #52: new file mode 100644 -:307: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #307: FILE: drivers/gpu/drm/panel/panel-sony-acx424akp.c:251: + udelay(20); -:310: WARNING:MSLEEP: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.rst #310: FILE: drivers/gpu/drm/panel/panel-sony-acx424akp.c:254: + msleep(11); -:319: WARNING:MSLEEP: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.rst #319: FILE: drivers/gpu/drm/panel/panel-sony-acx424akp.c:263: + msleep(11); -:543: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #543: FILE: drivers/gpu/drm/panel/panel-sony-acx424akp.c:487: + acx->reset_gpio = devm_gpiod_get_optional(dev, "reset", +GPIOD_OUT_HIGH); The build errors was easy to fix - but please have a look at the other warnings. I did the following changes locally to fix the build. But I did not try to look into the delay stuff. Sam diff --git a/drivers/gpu/drm/panel/panel-sony-acx424akp.c b/drivers/gpu/drm/panel/panel-sony-acx424akp.c index fe33f97cd812..38c83f5b16d5 100644 --- a/drivers/gpu/drm/panel/panel-sony-acx424akp.c +++ b/drivers/gpu/drm/panel/panel-sony-acx424akp.c @@ -407,17 +407,17 @@ static int acx424akp_disable(struct drm_panel *panel) return 0; } -static int acx424akp_get_modes(struct drm_panel *panel) +static int acx424akp_get_modes(struct drm_panel *panel, + struct drm_connector *connector) { struct acx424akp *acx = panel_to_acx424akp(panel); - struct drm_connector *connector = panel->connector; struct drm_display_mode *mode; if (acx->video_mode) - mode = drm_mode_duplicate(panel->drm, + mode = drm_mode_duplicate(connector->dev, _acx424akp_vid_mode); else - mode = drm_mode_duplicate(panel->drm, + mode = drm_mode_duplicate(connector->dev, _acx424akp_cmd_mode); if (!mode) { DRM_ERROR("bad mode or failed to add mode\n"); @@ -484,7 +484,7 @@ static int acx424akp_probe(struct mipi_dsi_device *dsi) /* This asserts RESET by default */ acx->reset_gpio = devm_gpiod_get_optional(dev, "reset", -GPIOD_OUT_HIGH); + GPIOD_OUT_HIGH); if (IS_ERR(acx->reset_gpio)) { ret = PTR_ERR(acx->reset_gpio); if (ret != -EPROBE_DEFER) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v7] drm/panel: Add driver for Sony ACX424AKP panel
The Sony ACX424AKP is a command/videomode DSI panel for mobile devices. It is used on the ST-Ericsson HREF520 reference design. We support video mode by default, but it is possible to switch the panel into command mode by using the bool property "dsi-command-mode". Cc: Stephan Gerhold Signed-off-by: Linus Walleij --- ChangeLog v6->v7: - Add some Kconfig help text. - Sort includes alphabetically. - Move the struct drm_panel first in the state container struct since we are subclassing the panel class. - Put an explicit /* sentinel */ text in the NULL entry for compatible. - Move MTP ID readout to the .prepare() callback. - Add a verbose comment about the MDDI setting so others understand what may be going on. - Explain why the backlight follows the display and cannot be turned on/off ChangeLog v5->v6: - Move the "set MDDI" command back to this file. It is a local pecularity, we suspect there is a Novatek controller inside this display. ChangeLog v4->v5: - Bindings were iterated separately so a jump in versioning. - Add Stephan as reviewer. ChangeLog v3->v4: - No changes just resending with the new binding updates. ChangeLog v2->v3: - No changes just resending with the new binding updates. ChangeLog v1->v2: - Fix up the ID read function to split into reading header, version and ID, store the version in the struct. - Get rid of a surplus semicolon found by the build robot while rewriting the above code. - Use unsigned int in probe() loop. - Set vrefresh to 60Hz, as good as any, the measured vrefresh in continous command mode is ~117 Hz. - Use a different for() idiom while retrying to read ID 5 times. - Drop the sync pulse setting, we are not using this, this panel uses an event. - Use the generic "enforce-video-mode" for video mode enforcement. --- drivers/gpu/drm/panel/Kconfig| 11 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-sony-acx424akp.c | 550 +++ 3 files changed, 562 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-sony-acx424akp.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index f152bc4eeb53..7ef8d095aae6 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -316,6 +316,17 @@ config DRM_PANEL_SITRONIX_ST7789V Say Y here if you want to enable support for the Sitronix ST7789V controller for 240x320 LCD panels +config DRM_PANEL_SONY_ACX424AKP + tristate "Sony ACX424AKP DSI command mode panel" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + select VIDEOMODE_HELPERS + help + Say Y here if you want to enable the Sony ACX424 display + panel. This panel supports DSI in both command and video + mode. + config DRM_PANEL_SONY_ACX565AKM tristate "Sony ACX565AKM panel" depends on GPIOLIB && OF && SPI diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index b6cd39fe0f20..0b51793e3b43 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -33,6 +33,7 @@ obj-$(CONFIG_DRM_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7701) += panel-sitronix-st7701.o obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o +obj-$(CONFIG_DRM_PANEL_SONY_ACX424AKP) += panel-sony-acx424akp.o obj-$(CONFIG_DRM_PANEL_SONY_ACX565AKM) += panel-sony-acx565akm.o obj-$(CONFIG_DRM_PANEL_TPO_TD028TTEC1) += panel-tpo-td028ttec1.o obj-$(CONFIG_DRM_PANEL_TPO_TD043MTEA1) += panel-tpo-td043mtea1.o diff --git a/drivers/gpu/drm/panel/panel-sony-acx424akp.c b/drivers/gpu/drm/panel/panel-sony-acx424akp.c new file mode 100644 index ..fe33f97cd812 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-sony-acx424akp.c @@ -0,0 +1,550 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * MIPI-DSI Sony ACX424AKP panel driver. This is a 480x864 + * AMOLED panel with a command-only DSI interface. + * + * Copyright (C) Linaro Ltd. 2019 + * Author: Linus Walleij + * Based on code and know-how from Marcus Lorentzon + * Copyright (C) ST-Ericsson SA 2010 + */ +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#define ACX424_DCS_READ_ID10xDA +#define ACX424_DCS_READ_ID20xDB +#define ACX424_DCS_READ_ID30xDC +#define ACX424_DCS_SET_MDDI0xAE + +/* + * Sony seems to use vendor ID 0x81 + */ +#define DISPLAY_SONY_ACX424AKP_ID1 0x811b +#define DISPLAY_SONY_ACX424AKP_ID2 0x811a +/* + * The third ID looks like a bug, vendor IDs begin at 0x80 + * and panel 00 ... seems like default values. + */ +#define DISPLAY_SONY_ACX424AKP_ID3 0x8000 + +struct acx424akp { + struct drm_panel panel; + struct device *dev; + struct backlight_device *bl; +