From: Sam Ravnborg <sam@ravnborg.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>,
Sebastian Reichel <sebastian.reichel@collabora.com>,
dri-devel@lists.freedesktop.org,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
Thierry Reding <thierry.reding@gmail.com>,
Sean Paul <sean@poorly.run>
Subject: Re: [PATCH 19/60] drm/panel: Add driver for the LG Philips LB035Q02 panel
Date: Mon, 8 Jul 2019 20:51:29 +0200 [thread overview]
Message-ID: <20190708185129.GA4363@ravnborg.org> (raw)
In-Reply-To: <20190707181937.6250-16-laurent.pinchart@ideasonboard.com>
Hi Laurent.
Good to move omapdrm to a more standard way to do things.
> new file mode 100644
> index 000000000000..d8a8c3a3a8c5
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> @@ -0,0 +1,235 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * LG.Philips LB035Q02 LCD Panel Driver
Looks like a typo. As far as I know LG and Philips are not the same.
But I can see this is used in several places, so I need to check up on
actual status here and driver is likely OK.
Google... this is fine. Some joint venture in 2001.
> + * Based on the omapdrm-specific panel-lg-lb035q02 driver
Will we have two drivers with the same name, or are this above already
disabled from the build?
> + unsigned int i;
index to arrays are default "int" IIRC.
Not that it matters but noticed it.
> + int ret;
> +
> + for (i = 0; i < ARRAY_SIZE(init_data); ++i) {
> + ret = lb035q02_write(lcd, init_data[i].index,
> + init_data[i].value);
> + if (ret < 0)
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static const struct drm_display_mode lb035q02_mode = {
> + .clock = 6500,
> + .hdisplay = 320,
> + .hsync_start = 320 + 20,
> + .hsync_end = 320 + 20 + 2,
> + .htotal = 320 + 20 + 2 + 68,
> + .vdisplay = 240,
> + .vsync_start = 240 + 4,
> + .vsync_end = 240 + 4 + 2,
> + .vtotal = 240 + 4 + 2 + 18,
> + .vrefresh = 60,
> + .type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
> + .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
> +};
We already specify all the timing details.
Consider to use display_mode to specify the width/height too.
So the panel specificatiosn are hardcoded only in one place.
> +
> +static int lb035q02_get_modes(struct drm_panel *panel)
> +{
> + struct drm_connector *connector = panel->connector;
> + struct drm_display_mode *mode;
> +
> + mode = drm_mode_duplicate(panel->drm, &lb035q02_mode);
> + if (!mode)
> + return -ENOMEM;
> +
> + drm_mode_set_name(mode);
> + drm_mode_probed_add(connector, mode);
> +
> + connector->display_info.width_mm = 70;
> + connector->display_info.height_mm = 53;
So we avoid hardcoding height/width here, but do it with the timing
above.
> + /*
> + * FIXME: According to the datasheet pixel data is sampled on the
> + * rising edge of the clock, but the code running on the Gumstix Overo
> + * Palo35 indicates sampling on the negative edge. This should be
> + * tested on a real device.
> + */
> + connector->display_info.bus_flags = DRM_BUS_FLAG_DE_HIGH
> + | DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE
> + | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE;
> +
> + return 1;
> +}
> +
> +static const struct drm_panel_funcs lb035q02_funcs = {
> + .disable = lb035q02_disable,
> + .enable = lb035q02_enable,
> + .get_modes = lb035q02_get_modes,
> +};
> +
> +static int lb035q02_probe(struct spi_device *spi)
> +{
> + struct lb035q02_device *lcd;
> + int ret;
> +
> + lcd = devm_kzalloc(&spi->dev, sizeof(*lcd), GFP_KERNEL);
> + if (lcd == NULL)
> + return -ENOMEM;
> +
> + spi_set_drvdata(spi, lcd);
> + lcd->spi = spi;
> +
> + lcd->enable_gpio = devm_gpiod_get(&spi->dev, "enable", GPIOD_OUT_LOW);
> + if (IS_ERR(lcd->enable_gpio)) {
> + dev_err(&spi->dev, "failed to parse enable gpio\n");
> + return PTR_ERR(lcd->enable_gpio);
> + }
> +
> + ret = lb035q02_init(lcd);
> + if (ret < 0)
> + return ret;
> +
> + drm_panel_init(&lcd->panel);
> + lcd->panel.dev = &lcd->spi->dev;
> + lcd->panel.funcs = &lb035q02_funcs;
> +
> + return drm_panel_add(&lcd->panel);
> +}
> +
> +static int lb035q02_remove(struct spi_device *spi)
> +{
> + struct lb035q02_device *lcd = spi_get_drvdata(spi);
> +
> + drm_panel_remove(&lcd->panel);
> + lb035q02_disable(&lcd->panel);
Use drm_panel_disable() so the driver will benefit when we move more
functionality to the drm_panel_disable() function.
> +
> + return 0;
> +}
> +
> +static const struct of_device_id lb035q02_of_match[] = {
> + { .compatible = "lgphilips,lb035q02", },
> + {},
Some drivers use { /* sentinel */ }, to document this is on purpose the
last entry.
> +};
> +
> +MODULE_DEVICE_TABLE(of, lb035q02_of_match);
> +
> +static struct spi_driver lb035q02_driver = {
> + .probe = lb035q02_probe,
> + .remove = lb035q02_remove,
> + .driver = {
> + .name = "panel-lg-lb035q02",
> + .of_match_table = lb035q02_of_match,
> + },
> +};
> +
> +module_spi_driver(lb035q02_driver);
> +
> +MODULE_ALIAS("spi:lgphilips,lb035q02");
> +MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
> +MODULE_DESCRIPTION("LG.Philips LB035Q02 LCD Panel driver");
> +MODULE_LICENSE("GPL");
This should be "GPL v2" if I read https://www.kernel.org/doc/html/latest/process/license-rules.html
correct. See "MODULE_LICENSE" table.
With the above comments addressed/considered:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Sam
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-07-08 18:51 UTC|newest]
Thread overview: 166+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-07 18:07 [PATCH 00/60] drm/omap: Replace custom display drivers with drm_bridge and drm_panel Laurent Pinchart
2019-07-07 18:07 ` [PATCH 01/60] drm/edid: Add flag to drm_display_info to identify HDMI sinks Laurent Pinchart
2019-07-09 13:20 ` Andrzej Hajda
2019-07-10 15:41 ` Daniel Vetter
2019-07-10 15:59 ` Ville Syrjälä
2019-07-07 18:07 ` [PATCH 02/60] video: hdmi: Change return type of hdmi_avi_infoframe_init() to void Laurent Pinchart
2019-07-07 18:14 ` Laurent Pinchart
2019-07-07 18:21 ` Ilia Mirkin
2019-07-09 13:22 ` Andrzej Hajda
2019-07-07 18:07 ` [PATCH 03/60] drm/bridge: dumb-vga-dac: Rename internal symbols to simple-bridge Laurent Pinchart
2019-07-09 13:34 ` Andrzej Hajda
2019-07-07 18:18 ` [PATCH 04/60] drm/bridge: dumb-vga-dac: Rename driver " Laurent Pinchart
2019-07-07 18:18 ` [PATCH 05/60] drm/bridge: simple-bridge: Add support for non-VGA bridges Laurent Pinchart
2019-07-09 14:08 ` Andrzej Hajda
2019-07-26 13:24 ` Stefan Agner
2019-07-07 18:18 ` [PATCH 06/60] drm/bridge: simple-bridge: Add support for enable GPIO Laurent Pinchart
2019-07-09 14:32 ` Andrzej Hajda
2019-07-26 13:19 ` Stefan Agner
2019-07-07 18:18 ` [PATCH 07/60] drm/bridge: simple-bridge: Add support for the TI OP362 Laurent Pinchart
2019-07-09 14:32 ` Andrzej Hajda
2019-08-27 6:16 ` Tomi Valkeinen
2019-07-07 18:18 ` [PATCH 08/60] drm/bridge: Extend bridge API to disable connector creation Laurent Pinchart
2019-07-17 6:39 ` Andrzej Hajda
2019-08-08 14:25 ` Laurent Pinchart
2019-08-08 17:36 ` Andrzej Hajda
2019-08-08 18:50 ` Laurent Pinchart
2019-08-14 8:18 ` Daniel Vetter
2019-08-14 9:55 ` Laurent Pinchart
2019-08-14 12:24 ` Daniel Vetter
2019-07-07 18:18 ` [PATCH 09/60] drm/bridge: Add connector-related bridge operations and data Laurent Pinchart
2019-07-10 12:12 ` Andrzej Hajda
2019-07-11 7:35 ` Daniel Vetter
2019-07-11 12:41 ` Andrzej Hajda
2019-07-11 13:18 ` Daniel Vetter
2019-07-11 15:12 ` Andrzej Hajda
2019-07-11 15:50 ` Daniel Vetter
2019-07-12 9:01 ` Andrzej Hajda
2019-07-16 9:00 ` Daniel Vetter
2019-07-16 13:57 ` Andrzej Hajda
2019-08-08 19:32 ` Laurent Pinchart
2019-08-09 11:55 ` Andrzej Hajda
2019-08-10 22:43 ` Laurent Pinchart
2019-08-14 6:23 ` Andrzej Hajda
2019-08-14 10:04 ` Laurent Pinchart
2019-08-14 12:40 ` Daniel Vetter
2019-08-19 8:38 ` Andrzej Hajda
2019-08-19 22:45 ` Laurent Pinchart
2019-08-22 12:17 ` Andrzej Hajda
2019-08-26 16:27 ` Laurent Pinchart
2019-08-29 16:48 ` Andrzej Hajda
2019-12-02 15:40 ` Laurent Pinchart
2019-08-14 12:35 ` Daniel Vetter
2019-08-19 22:32 ` Laurent Pinchart
2019-08-20 8:30 ` Daniel Vetter
2019-08-26 15:57 ` Laurent Pinchart
2019-08-08 18:19 ` Laurent Pinchart
2019-08-08 18:36 ` Laurent Pinchart
2019-08-14 13:03 ` Daniel Vetter
2019-08-14 13:30 ` Laurent Pinchart
2019-08-14 17:02 ` Daniel Vetter
2019-08-16 23:30 ` Laurent Pinchart
2019-08-17 0:14 ` Laurent Pinchart
2019-08-19 2:37 ` Laurent Pinchart
2019-08-20 8:41 ` Daniel Vetter
2019-08-14 12:43 ` Daniel Vetter
2019-08-14 12:56 ` Laurent Pinchart
2019-07-07 18:18 ` [PATCH 10/60] drm/bridge: Add bridge driver for display connectors Laurent Pinchart
2019-07-16 9:28 ` Sam Ravnborg
2019-08-08 16:41 ` Laurent Pinchart
2019-09-30 11:15 ` Tomi Valkeinen
2019-10-01 20:08 ` Laurent Pinchart
2019-10-02 12:38 ` Tomi Valkeinen
2019-07-07 18:18 ` [PATCH 11/60] drm/bridge: Add driver for the TI TPD12S015 HDMI level shifter Laurent Pinchart
[not found] ` <3347b6c8-6f2d-17d6-3dc8-e62a3bac634b@ti.com>
2019-08-27 7:30 ` Laurent Pinchart
2019-07-07 18:18 ` [PATCH 12/60] drm/bridge: panel: Implement bridge connector operations Laurent Pinchart
2019-07-16 11:08 ` drm_panel_get_modes() should take the connector as an argument [Was: drm/bridge: panel: Implement bridge ...] Sam Ravnborg
2019-08-08 16:07 ` Laurent Pinchart
2019-08-08 16:52 ` Sam Ravnborg
2019-08-08 18:37 ` Laurent Pinchart
2019-07-07 18:18 ` [PATCH 13/60] drm/bridge: tfp410: Don't include drmP.h Laurent Pinchart
[not found] ` <3bb82dc4-434a-aaac-8ea1-3aff0991e790@ti.com>
2019-08-27 7:47 ` Laurent Pinchart
2019-07-07 18:18 ` [PATCH 14/60] drm/bridge: tfp410: Replace manual connector handling with bridge Laurent Pinchart
2019-07-07 18:18 ` [PATCH 15/60] drm/bridge: tfp410: Allow operation without drm_connector Laurent Pinchart
2019-07-07 18:18 ` [PATCH 16/60] dt-bindings: Add vendor prefix for LG Display Laurent Pinchart
2019-07-24 16:22 ` Rob Herring
2019-07-07 18:18 ` [PATCH 17/60] dt-bindings: Add legacy 'toppoly' vendor prefix Laurent Pinchart
2019-07-08 19:00 ` Rob Herring
2019-07-09 1:00 ` Laurent Pinchart
2019-07-09 1:35 ` Rob Herring
2019-07-07 18:18 ` [PATCH 18/60] dt-bindings: display: panel: Add bindings for NEC NL8048HL11 panel Laurent Pinchart
2019-07-07 18:18 ` [PATCH 19/60] drm/panel: Add driver for the LG Philips LB035Q02 panel Laurent Pinchart
2019-07-08 18:51 ` Sam Ravnborg [this message]
2019-07-09 0:56 ` Laurent Pinchart
2019-07-09 5:47 ` Sam Ravnborg
2019-07-07 18:18 ` [PATCH 20/60] drm/panel: Add driver for the NEC NL8048HL11 panel Laurent Pinchart
2019-07-08 19:10 ` Sam Ravnborg
2019-07-08 19:26 ` Sam Ravnborg
2019-08-08 15:17 ` Laurent Pinchart
2019-07-07 18:18 ` [PATCH 21/60] drm/panel: Add driver for the Sharp LS037V7DW01 panel Laurent Pinchart
2019-07-08 19:44 ` Sam Ravnborg
2019-07-08 19:47 ` Sam Ravnborg
2019-08-08 15:31 ` Laurent Pinchart
2019-07-07 18:18 ` [PATCH 22/60] drm/panel: Add driver for the Sony ACX565AKM panel Laurent Pinchart
2019-07-07 18:19 ` [PATCH 23/60] drm/panel: Add driver for the Toppology TD028TTEC1 panel Laurent Pinchart
2019-07-10 7:48 ` Sam Ravnborg
2019-08-08 15:43 ` Laurent Pinchart
2019-07-07 18:19 ` [PATCH 24/60] drm/panel: Add driver for the Toppology TD043MTEA1 panel Laurent Pinchart
2019-07-10 13:09 ` Sam Ravnborg
2019-08-08 15:54 ` Laurent Pinchart
2019-08-09 13:33 ` Sam Ravnborg
2019-08-09 17:51 ` Laurent Pinchart
2019-07-07 18:19 ` [PATCH 25/60] drm: Add helper to create a connector for a chain of bridges Laurent Pinchart
2019-07-18 17:01 ` Daniel Vetter
2019-08-08 19:48 ` Laurent Pinchart
2019-08-14 15:01 ` Daniel Vetter
2019-08-19 22:16 ` Laurent Pinchart
2019-07-07 18:19 ` [PATCH 26/60] drm/omap: Detach from panels at remove time Laurent Pinchart
2019-08-13 7:28 ` Tomi Valkeinen
2019-08-13 13:50 ` Laurent Pinchart
2019-07-07 18:19 ` [PATCH 27/60] drm/omap: Simplify HDMI mode and infoframe configuration Laurent Pinchart
2019-08-13 7:29 ` Tomi Valkeinen
2019-07-07 18:19 ` [PATCH 28/60] drm/omap: Factor out display type to connector type conversion Laurent Pinchart
2019-08-13 7:32 ` Tomi Valkeinen
2019-08-13 15:18 ` Laurent Pinchart
2019-07-07 18:19 ` [PATCH 29/60] drm/omap: Use the drm_panel_bridge API Laurent Pinchart
2019-08-13 7:36 ` Tomi Valkeinen
2019-07-07 18:19 ` [PATCH 30/60] drm/omap: dss: Fix output next device lookup in DT Laurent Pinchart
2019-08-13 7:38 ` Tomi Valkeinen
2019-07-07 18:19 ` [PATCH 31/60] drm/omap: Add infrastructure to support drm_bridge local to DSS outputs Laurent Pinchart
2019-07-07 18:19 ` [PATCH 32/60] drm/omap: dss: Make omap_dss_device_ops optional Laurent Pinchart
2019-08-13 7:48 ` Tomi Valkeinen
2019-08-13 13:55 ` Laurent Pinchart
2019-07-07 18:19 ` [PATCH 33/60] drm/omap: hdmi: Allocate EDID in the .read_edid() operation Laurent Pinchart
2019-08-13 7:52 ` Tomi Valkeinen
2019-07-07 18:19 ` [PATCH 34/60] drm/omap: hdmi4: Rework EDID read to isolate data read Laurent Pinchart
2019-07-07 18:19 ` [PATCH 35/60] drm/omap: hdmi5: " Laurent Pinchart
2019-07-07 18:19 ` [PATCH 36/60] drm/omap: hdmi4: Register a drm_bridge for EDID read Laurent Pinchart
2019-07-07 18:19 ` [PATCH 37/60] drm/omap: hdmi5: " Laurent Pinchart
2019-07-07 18:19 ` [PATCH 38/60] drm/omap: hdmi4: Move mode set, enable and disable operations to bridge Laurent Pinchart
2019-07-07 18:19 ` [PATCH 39/60] drm/omap: hdmi5: " Laurent Pinchart
2019-07-07 18:19 ` [PATCH 40/60] drm/omap: hdmi4: Implement drm_bridge .lost_hotplug() operation Laurent Pinchart
2019-07-07 18:19 ` [PATCH 41/60] drm/omap: dss: Remove .set_hdmi_mode() and .set_infoframe() operations Laurent Pinchart
2019-07-07 18:19 ` [PATCH 42/60] drm/omap: venc: Register a drm_bridge Laurent Pinchart
2019-07-07 18:19 ` [PATCH 43/60] drm/omap: Create connector for bridges Laurent Pinchart
2019-07-07 18:19 ` [PATCH 44/60] drm/omap: Switch the HDMI and VENC outputs to drm_bridge Laurent Pinchart
2019-07-07 18:19 ` [PATCH 45/60] drm/omap: Remove HPD, detect and EDID omapdss operations Laurent Pinchart
2019-07-07 18:19 ` [PATCH 46/60] drm/omap: hdmi: Remove omap_dss_device operations Laurent Pinchart
2019-07-07 18:19 ` [PATCH 47/60] drm/omap: venc: " Laurent Pinchart
2019-07-07 18:19 ` [PATCH 48/60] drm/omap: hdmi4: Simplify EDID read Laurent Pinchart
2019-07-07 18:19 ` [PATCH 49/60] drm/omap: hdmi5: " Laurent Pinchart
2019-07-07 18:19 ` [PATCH 50/60] drm/omap: displays: Remove unused panel drivers Laurent Pinchart
2019-07-07 18:19 ` [PATCH 51/60] drm/omap: dpi: Sort includes alphabetically Laurent Pinchart
2019-07-07 18:19 ` [PATCH 52/60] drm/omap: dpi: Reorder functions in sections Laurent Pinchart
2019-07-07 18:19 ` [PATCH 53/60] drm/omap: dpi: Simplify clock setting API Laurent Pinchart
2019-07-07 18:19 ` [PATCH 54/60] drm/omap: dpi: Register a drm_bridge Laurent Pinchart
2019-07-07 18:19 ` [PATCH 55/60] drm/omap: sdi: Sort includes alphabetically Laurent Pinchart
2019-07-07 18:19 ` [PATCH 56/60] drm/omap: sdi: Register a drm_bridge Laurent Pinchart
2019-07-07 18:19 ` [PATCH 57/60] drm/omap: Simplify connector implementation Laurent Pinchart
2019-07-07 18:19 ` [PATCH 58/60] drm/omap: dss: Remove unused omap_dss_device operations Laurent Pinchart
2019-07-07 18:19 ` [PATCH 59/60] drm/omap: dss: Inline the omapdss_display_get() function Laurent Pinchart
2019-07-07 18:19 ` [PATCH 60/60] drm/omap: dss: Remove unused omapdss_of_find_connected_device() function Laurent Pinchart
2019-07-09 13:35 ` [PATCH 04/60] drm/bridge: dumb-vga-dac: Rename driver to simple-bridge Andrzej Hajda
2019-07-11 7:37 ` [PATCH 00/60] drm/omap: Replace custom display drivers with drm_bridge and drm_panel Daniel Vetter
2019-07-11 11:59 ` Sebastian Reichel
2019-08-08 14:26 ` Laurent Pinchart
2019-08-08 14:31 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190708185129.GA4363@ravnborg.org \
--to=sam@ravnborg.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=maxime.ripard@bootlin.com \
--cc=sean@poorly.run \
--cc=sebastian.reichel@collabora.com \
--cc=thierry.reding@gmail.com \
--cc=tomi.valkeinen@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox