Re: [PATCH v5 3/5] drm: panel: Add a panel driver for the Summit display

From: Dmitry Baryshkov
Date: Wed Feb 05 2025 - 22:11:51 EST


On Wed, Feb 05, 2025 at 11:10:52PM +0100, Sasha Finkelstein via B4 Relay wrote:
> From: Sasha Finkelstein <fnkl.kernel@xxxxxxxxx>
>
> This is the display panel used for the touchbar on laptops that have it.
>
> Co-developed-by: Nick Chan <towinchenmi@xxxxxxxxx>
> Signed-off-by: Nick Chan <towinchenmi@xxxxxxxxx>
> Signed-off-by: Sasha Finkelstein <fnkl.kernel@xxxxxxxxx>
> ---
> drivers/gpu/drm/panel/Kconfig | 9 +++
> drivers/gpu/drm/panel/Makefile | 1 +
> drivers/gpu/drm/panel/panel-summit.c | 132 +++++++++++++++++++++++++++++++++++
> 3 files changed, 142 insertions(+)
>
> +
> +static int summit_get_modes(struct drm_panel *panel,
> + struct drm_connector *connector)
> +{
> + struct drm_display_mode *mode = drm_mode_create(connector->dev);
> +
> + connector->display_info.non_desktop = true;
> + drm_object_property_set_value(&connector->base,
> + connector->dev->mode_config.non_desktop_property,
> + connector->display_info.non_desktop);
> +
> + mode->vdisplay = 2008;
> + mode->hdisplay = 60;
> + mode->hsync_start = mode->hdisplay + 8;
> + mode->hsync_end = mode->hsync_start + 80;
> + mode->htotal = mode->hsync_end + 40;
> + mode->vsync_start = mode->vdisplay + 1;
> + mode->vsync_end = mode->vsync_start + 15;
> + mode->vtotal = mode->vsync_end + 6;
> + mode->clock = (mode->vtotal * mode->htotal * 60) / 1000;
> + mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> + mode->flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC;
> + drm_mode_set_name(mode);
> + drm_mode_probed_add(connector, mode);
> + return 1;
> +}

I think most of the drivers store mode in a static var and then use
drm_connector_helper_get_modes_fixed(). It's a matter of taste, but I
think the latter one is a nice helper.

Other than that:

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>

> +static const struct drm_panel_funcs summit_panel_funcs = {
> + .get_modes = summit_get_modes,
> +};
> +

--
With best wishes
Dmitry