Commit 0ce8ddd8 authored by Sam Ravnborg's avatar Sam Ravnborg

drm/panel: add drm_connector argument to get_modes()

Today the bridge creates the drm_connector, but that is planned
to be moved to the display drivers.
To facilitate this, update drm_panel_funcs.get_modes() to
take drm_connector as an argument.
All panel drivers implementing get_modes() are updated.

v2:
  - drop accidental change (Laurent)
  - update docs for get_modes (Laurent)
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Stefan Mavrodiev <stefan@olimex.com>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: "Guido Günther" <agx@sigxcpu.org>
Cc: Purism Kernel Team <kernel@puri.sm>
Link: https://patchwork.freedesktop.org/patch/msgid/20191207140353.23967-6-sam@ravnborg.org
parent d383fb5f
......@@ -263,7 +263,7 @@ int drm_panel_get_modes(struct drm_panel *panel)
return -EINVAL;
if (panel->funcs && panel->funcs->get_modes)
return panel->funcs->get_modes(panel);
return panel->funcs->get_modes(panel, panel->connector);
return -EOPNOTSUPP;
}
......
......@@ -260,9 +260,9 @@ static int versatile_panel_enable(struct drm_panel *panel)
return 0;
}
static int versatile_panel_get_modes(struct drm_panel *panel)
static int versatile_panel_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct versatile_panel *vpanel = to_versatile_panel(panel);
struct drm_display_mode *mode;
......
......@@ -162,9 +162,9 @@ static const struct drm_display_mode feiyang_default_mode = {
.type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
};
static int feiyang_get_modes(struct drm_panel *panel)
static int feiyang_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct feiyang *ctx = panel_to_feiyang(panel);
struct drm_display_mode *mode;
......
......@@ -641,9 +641,9 @@ static const struct drm_display_mode itu_r_bt_656_720_mode = {
.flags = 0,
};
static int ili9322_get_modes(struct drm_panel *panel)
static int ili9322_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct ili9322 *ili = panel_to_ili9322(panel);
struct drm_display_mode *mode;
struct drm_display_info *info;
......
......@@ -387,9 +387,9 @@ static const struct drm_display_mode bananapi_default_mode = {
.vtotal = 1280 + 10 + 10 + 20,
};
static int ili9881c_get_modes(struct drm_panel *panel)
static int ili9881c_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct ili9881c *ctx = panel_to_ili9881c(panel);
struct drm_display_mode *mode;
......@@ -407,8 +407,8 @@ static int ili9881c_get_modes(struct drm_panel *panel)
mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
drm_mode_probed_add(connector, mode);
panel->connector->display_info.width_mm = 62;
panel->connector->display_info.height_mm = 110;
connector->display_info.width_mm = 62;
connector->display_info.height_mm = 110;
return 1;
}
......
......@@ -403,7 +403,8 @@ static const struct panel_desc innolux_p097pfg_panel_desc = {
.sleep_mode_delay = 100, /* T15 */
};
static int innolux_panel_get_modes(struct drm_panel *panel)
static int innolux_panel_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct innolux_panel *innolux = to_innolux_panel(panel);
const struct drm_display_mode *m = innolux->desc->mode;
......@@ -418,13 +419,11 @@ static int innolux_panel_get_modes(struct drm_panel *panel)
drm_mode_set_name(mode);
drm_mode_probed_add(panel->connector, mode);
drm_mode_probed_add(connector, mode);
panel->connector->display_info.width_mm =
innolux->desc->size.width;
panel->connector->display_info.height_mm =
innolux->desc->size.height;
panel->connector->display_info.bpc = innolux->desc->bpc;
connector->display_info.width_mm = innolux->desc->size.width;
connector->display_info.height_mm = innolux->desc->size.height;
connector->display_info.bpc = innolux->desc->bpc;
return 1;
}
......
......@@ -300,7 +300,8 @@ static const struct drm_display_mode default_mode = {
.flags = 0,
};
static int jdi_panel_get_modes(struct drm_panel *panel)
static int jdi_panel_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_display_mode *mode;
struct jdi_panel *jdi = to_jdi_panel(panel);
......@@ -316,10 +317,10 @@ static int jdi_panel_get_modes(struct drm_panel *panel)
drm_mode_set_name(mode);
drm_mode_probed_add(panel->connector, mode);
drm_mode_probed_add(connector, mode);
panel->connector->display_info.width_mm = 95;
panel->connector->display_info.height_mm = 151;
connector->display_info.width_mm = 95;
connector->display_info.height_mm = 151;
return 1;
}
......
......@@ -333,7 +333,8 @@ static const struct drm_display_mode default_mode = {
.vrefresh = 60,
};
static int kingdisplay_panel_get_modes(struct drm_panel *panel)
static int kingdisplay_panel_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_display_mode *mode;
......@@ -347,11 +348,11 @@ static int kingdisplay_panel_get_modes(struct drm_panel *panel)
drm_mode_set_name(mode);
drm_mode_probed_add(panel->connector, mode);
drm_mode_probed_add(connector, mode);
panel->connector->display_info.width_mm = 147;
panel->connector->display_info.height_mm = 196;
panel->connector->display_info.bpc = 8;
connector->display_info.width_mm = 147;
connector->display_info.height_mm = 196;
connector->display_info.bpc = 8;
return 1;
}
......
......@@ -141,9 +141,9 @@ static const struct drm_display_mode lb035q02_mode = {
.height_mm = 53,
};
static int lb035q02_get_modes(struct drm_panel *panel)
static int lb035q02_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct drm_display_mode *mode;
mode = drm_mode_duplicate(panel->drm, &lb035q02_mode);
......
......@@ -209,9 +209,9 @@ static const struct drm_display_mode default_mode = {
.vrefresh = 60,
};
static int lg4573_get_modes(struct drm_panel *panel)
static int lg4573_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct drm_display_mode *mode;
mode = drm_mode_duplicate(panel->drm, &default_mode);
......@@ -227,8 +227,8 @@ static int lg4573_get_modes(struct drm_panel *panel)
mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
drm_mode_probed_add(connector, mode);
panel->connector->display_info.width_mm = 61;
panel->connector->display_info.height_mm = 103;
connector->display_info.width_mm = 61;
connector->display_info.height_mm = 103;
return 1;
}
......
......@@ -106,10 +106,10 @@ static int panel_lvds_enable(struct drm_panel *panel)
return 0;
}
static int panel_lvds_get_modes(struct drm_panel *panel)
static int panel_lvds_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct panel_lvds *lvds = to_panel_lvds(panel);
struct drm_connector *connector = lvds->panel.connector;
struct drm_display_mode *mode;
mode = drm_mode_create(lvds->panel.drm);
......
......@@ -123,9 +123,9 @@ static const struct drm_display_mode nl8048_mode = {
.height_mm = 53,
};
static int nl8048_get_modes(struct drm_panel *panel)
static int nl8048_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct drm_display_mode *mode;
mode = drm_mode_duplicate(panel->drm, &nl8048_mode);
......
......@@ -206,11 +206,11 @@ static int nt39016_disable(struct drm_panel *drm_panel)
return 0;
}
static int nt39016_get_modes(struct drm_panel *drm_panel)
static int nt39016_get_modes(struct drm_panel *drm_panel,
struct drm_connector *connector)
{
struct nt39016 *panel = to_nt39016(drm_panel);
const struct nt39016_panel_info *panel_info = panel->panel_info;
struct drm_connector *connector = drm_panel->connector;
struct drm_display_mode *mode;
mode = drm_mode_duplicate(drm_panel->drm, &panel_info->display_mode);
......
......@@ -141,10 +141,10 @@ static int lcd_olinuxino_enable(struct drm_panel *panel)
return 0;
}
static int lcd_olinuxino_get_modes(struct drm_panel *panel)
static int lcd_olinuxino_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct lcd_olinuxino *lcd = to_lcd_olinuxino(panel);
struct drm_connector *connector = lcd->panel.connector;
struct lcd_olinuxino_info *lcd_info = &lcd->eeprom.info;
struct drm_device *drm = lcd->panel.drm;
struct lcd_olinuxino_mode *lcd_mode;
......
......@@ -349,7 +349,8 @@ static int otm8009a_enable(struct drm_panel *panel)
return 0;
}
static int otm8009a_get_modes(struct drm_panel *panel)
static int otm8009a_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_display_mode *mode;
......@@ -364,10 +365,10 @@ static int otm8009a_get_modes(struct drm_panel *panel)
drm_mode_set_name(mode);
mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
drm_mode_probed_add(panel->connector, mode);
drm_mode_probed_add(connector, mode);
panel->connector->display_info.width_mm = mode->width_mm;
panel->connector->display_info.height_mm = mode->height_mm;
connector->display_info.width_mm = mode->width_mm;
connector->display_info.height_mm = mode->height_mm;
return 1;
}
......
......@@ -112,7 +112,8 @@ static const struct drm_display_mode default_mode_osd101t2587 = {
.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
};
static int osd101t2587_panel_get_modes(struct drm_panel *panel)
static int osd101t2587_panel_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel);
struct drm_display_mode *mode;
......@@ -128,10 +129,10 @@ static int osd101t2587_panel_get_modes(struct drm_panel *panel)
drm_mode_set_name(mode);
drm_mode_probed_add(panel->connector, mode);
drm_mode_probed_add(connector, mode);
panel->connector->display_info.width_mm = 217;
panel->connector->display_info.height_mm = 136;
connector->display_info.width_mm = 217;
connector->display_info.height_mm = 136;
return 1;
}
......
......@@ -166,7 +166,8 @@ static const struct drm_display_mode default_mode = {
.vrefresh = 60,
};
static int wuxga_nt_panel_get_modes(struct drm_panel *panel)
static int wuxga_nt_panel_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_display_mode *mode;
......@@ -180,10 +181,10 @@ static int wuxga_nt_panel_get_modes(struct drm_panel *panel)
drm_mode_set_name(mode);
drm_mode_probed_add(panel->connector, mode);
drm_mode_probed_add(connector, mode);
panel->connector->display_info.width_mm = 217;
panel->connector->display_info.height_mm = 136;
connector->display_info.width_mm = 217;
connector->display_info.height_mm = 136;
return 1;
}
......
......@@ -309,9 +309,9 @@ static int rpi_touchscreen_enable(struct drm_panel *panel)
return 0;
}
static int rpi_touchscreen_get_modes(struct drm_panel *panel)
static int rpi_touchscreen_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct drm_device *drm = panel->drm;
unsigned int i, num = 0;
static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
......
......@@ -436,9 +436,9 @@ static int rad_panel_disable(struct drm_panel *panel)
return 0;
}
static int rad_panel_get_modes(struct drm_panel *panel)
static int rad_panel_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct drm_display_mode *mode;
mode = drm_mode_duplicate(panel->drm, &default_mode);
......@@ -451,7 +451,7 @@ static int rad_panel_get_modes(struct drm_panel *panel)
drm_mode_set_name(mode);
mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
drm_mode_probed_add(panel->connector, mode);
drm_mode_probed_add(connector, mode);
connector->display_info.width_mm = mode->width_mm;
connector->display_info.height_mm = mode->height_mm;
......
......@@ -335,7 +335,8 @@ static int rm68200_enable(struct drm_panel *panel)
return 0;
}
static int rm68200_get_modes(struct drm_panel *panel)
static int rm68200_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_display_mode *mode;
......@@ -350,10 +351,10 @@ static int rm68200_get_modes(struct drm_panel *panel)
drm_mode_set_name(mode);
mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
drm_mode_probed_add(panel->connector, mode);
drm_mode_probed_add(connector, mode);
panel->connector->display_info.width_mm = mode->width_mm;
panel->connector->display_info.height_mm = mode->height_mm;
connector->display_info.width_mm = mode->width_mm;
connector->display_info.height_mm = mode->height_mm;
return 1;
}
......
......@@ -230,7 +230,8 @@ static const struct drm_display_mode default_mode = {
.height_mm = 130,
};
static int jh057n_get_modes(struct drm_panel *panel)
static int jh057n_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct jh057n *ctx = panel_to_jh057n(panel);
struct drm_display_mode *mode;
......@@ -246,9 +247,9 @@ static int jh057n_get_modes(struct drm_panel *panel)
drm_mode_set_name(mode);
mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
panel->connector->display_info.width_mm = mode->width_mm;
panel->connector->display_info.height_mm = mode->height_mm;
drm_mode_probed_add(panel->connector, mode);
connector->display_info.width_mm = mode->width_mm;
connector->display_info.height_mm = mode->height_mm;
drm_mode_probed_add(connector, mode);
return 1;
}
......
......@@ -120,9 +120,9 @@ static const struct drm_display_mode default_mode = {
.height_mm = 85,
};
static int rb070d30_panel_get_modes(struct drm_panel *panel)
static int rb070d30_panel_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);
struct drm_display_mode *mode;
static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
......@@ -140,9 +140,9 @@ static int rb070d30_panel_get_modes(struct drm_panel *panel)
mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
drm_mode_probed_add(connector, mode);
panel->connector->display_info.bpc = 8;
panel->connector->display_info.width_mm = mode->width_mm;
panel->connector->display_info.height_mm = mode->height_mm;
connector->display_info.bpc = 8;
connector->display_info.width_mm = mode->width_mm;
connector->display_info.height_mm = mode->height_mm;
drm_display_info_set_bus_formats(&connector->display_info,
&bus_format, 1);
......
......@@ -261,9 +261,9 @@ static int ld9040_enable(struct drm_panel *panel)
return 0;
}
static int ld9040_get_modes(struct drm_panel *panel)
static int ld9040_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct ld9040 *ctx = panel_to_ld9040(panel);
struct drm_display_mode *mode;
......
......@@ -143,9 +143,9 @@ static int s6d16d0_disable(struct drm_panel *panel)
return 0;
}
static int s6d16d0_get_modes(struct drm_panel *panel)
static int s6d16d0_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct drm_display_mode *mode;
mode = drm_mode_duplicate(panel->drm, &samsung_s6d16d0_mode);
......
......@@ -645,9 +645,9 @@ static const struct s6e3ha2_panel_desc samsung_s6e3hf2 = {
.type = HF2_TYPE,
};
static int s6e3ha2_get_modes(struct drm_panel *panel)
static int s6e3ha2_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
struct drm_display_mode *mode;
......
......@@ -400,9 +400,9 @@ static int s6e63j0x03_enable(struct drm_panel *panel)
return 0;
}
static int s6e63j0x03_get_modes(struct drm_panel *panel)
static int s6e63j0x03_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct drm_display_mode *mode;
mode = drm_mode_duplicate(panel->drm, &default_mode);
......
......@@ -362,9 +362,9 @@ static int s6e63m0_enable(struct drm_panel *panel)
return 0;
}
static int s6e63m0_get_modes(struct drm_panel *panel)
static int s6e63m0_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct drm_display_mode *mode;
mode = drm_mode_duplicate(panel->drm, &default_mode);
......
......@@ -920,9 +920,9 @@ static int s6e8aa0_enable(struct drm_panel *panel)
return 0;
}
static int s6e8aa0_get_modes(struct drm_panel *panel)
static int s6e8aa0_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct s6e8aa0 *ctx = panel_to_s6e8aa0(panel);
struct drm_display_mode *mode;
......
......@@ -56,9 +56,9 @@ static inline struct seiko_panel *to_seiko_panel(struct drm_panel *panel)
return container_of(panel, struct seiko_panel, base);
}
static int seiko_panel_get_fixed_modes(struct seiko_panel *panel)
static int seiko_panel_get_fixed_modes(struct seiko_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->base.connector;
struct drm_device *drm = panel->base.drm;
struct drm_display_mode *mode;
unsigned int i, num = 0;
......@@ -208,12 +208,13 @@ static int seiko_panel_enable(struct drm_panel *panel)
return 0;
}
static int seiko_panel_get_modes(struct drm_panel *panel)
static int seiko_panel_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct seiko_panel *p = to_seiko_panel(panel);
/* add hard-coded panel modes */
return seiko_panel_get_fixed_modes(p);
return seiko_panel_get_fixed_modes(p, connector);
}
static int seiko_panel_get_timings(struct drm_panel *panel,
......
......@@ -278,7 +278,8 @@ static const struct drm_display_mode default_mode = {
.vrefresh = 60,
};
static int sharp_panel_get_modes(struct drm_panel *panel)
static int sharp_panel_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_display_mode *mode;
......@@ -292,10 +293,10 @@ static int sharp_panel_get_modes(struct drm_panel *panel)
drm_mode_set_name(mode);
drm_mode_probed_add(panel->connector, mode);
drm_mode_probed_add(connector, mode);
panel->connector->display_info.width_mm = 217;
panel->connector->display_info.height_mm = 136;
connector->display_info.width_mm = 217;
connector->display_info.height_mm = 136;
return 1;
}
......
......@@ -100,9 +100,9 @@ static const struct drm_display_mode ls037v7dw01_mode = {
.height_mm = 75,
};
static int ls037v7dw01_get_modes(struct drm_panel *panel)
static int ls037v7dw01_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct drm_display_mode *mode;
mode = drm_mode_duplicate(panel->drm, &ls037v7dw01_mode);
......
......@@ -210,7 +210,8 @@ static const struct drm_display_mode default_mode = {
.vrefresh = 60,
};
static int sharp_nt_panel_get_modes(struct drm_panel *panel)
static int sharp_nt_panel_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_display_mode *mode;
......@@ -224,10 +225,10 @@ static int sharp_nt_panel_get_modes(struct drm_panel *panel)
drm_mode_set_name(mode);
drm_mode_probed_add(panel->connector, mode);
drm_mode_probed_add(connector, mode);
panel->connector->display_info.width_mm = 54;
panel->connector->display_info.height_mm = 95;
connector->display_info.width_mm = 54;
connector->display_info.height_mm = 95;
return 1;
}
......
......@@ -117,9 +117,9 @@ static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
return container_of(panel, struct panel_simple, base);
}
static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel)
static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->base.connector;
struct drm_device *drm = panel->base.drm;
struct drm_display_mode *mode;
unsigned int i, num = 0;
......@@ -150,9 +150,9 @@ static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel)
return num;
}
static unsigned int panel_simple_get_display_modes(struct panel_simple *panel)
static unsigned int panel_simple_get_display_modes(struct panel_simple *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->base.connector;
struct drm_device *drm = panel->base.drm;
struct drm_display_mode *mode;
unsigned int i, num = 0;
......@@ -181,9 +181,9 @@ static unsigned int panel_simple_get_display_modes(struct panel_simple *panel)
return num;
}
static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
static int panel_simple_get_non_edid_modes(struct panel_simple *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->base.connector;
struct drm_device *drm = panel->base.drm;
struct drm_display_mode *mode;
bool has_override = panel->override_mode.type;
......@@ -204,7 +204,7 @@ static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
/* Only add timings if override was not there or failed to validate */
if (num == 0 && panel->desc->num_timings)
num = panel_simple_get_timings_modes(panel);
num = panel_simple_get_timings_modes(panel, connector);
/*
* Only add fixed modes if timings/override added no mode.
......@@ -214,7 +214,7 @@ static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
*/
WARN_ON(panel->desc->num_timings && panel->desc->num_modes);
if (num == 0)
num = panel_simple_get_display_modes(panel);
num = panel_simple_get_display_modes(panel, connector);
connector->display_info.bpc = panel->desc->bpc;
connector->display_info.width_mm = panel->desc->size.width;
......@@ -304,23 +304,25 @@ static int panel_simple_enable(struct drm_panel *panel)
return 0;
}
static int panel_simple_get_modes(struct drm_panel *panel)
static int panel_simple_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct panel_simple *p = to_panel_simple(panel);
int num = 0;
/* probe EDID if a DDC bus is available */
if (p->ddc) {
struct edid *edid = drm_get_edid(panel->connector, p->ddc);
drm_connector_update_edid_property(panel->connector, edid);
struct edid *edid = drm_get_edid(connector, p->ddc);
drm_connector_update_edid_property(connector, edid);
if (edid) {
num += drm_add_edid_modes(panel->connector, edid);
num += drm_add_edid_modes(connector, edid);
kfree(edid);
}
}
/* add hard-coded panel modes */
num += panel_simple_get_non_edid_modes(p);
num += panel_simple_get_non_edid_modes(p, connector);
return num;
}
......
......@@ -264,7 +264,8 @@ static int st7701_unprepare(struct drm_panel *panel)
return 0;
}
static int st7701_get_modes(struct drm_panel *panel)
static int st7701_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct st7701 *st7701 = panel_to_st7701(panel);
const struct drm_display_mode *desc_mode = st7701->desc->mode;
......@@ -280,10 +281,10 @@ static int st7701_get_modes(struct drm_panel *panel)
}
drm_mode_set_name(mode);
drm_mode_probed_add(panel->connector, mode);
drm_mode_probed_add(connector, mode);
panel->connector->display_info.width_mm = desc_mode->width_mm;
panel->connector->display_info.height_mm = desc_mode->height_mm;
connector->display_info.width_mm = desc_mode->width_mm;
connector->display_info.height_mm = desc_mode->height_mm;
return 1;
}
......
......@@ -170,9 +170,9 @@ static const struct drm_display_mode default_mode = {
.vrefresh = 60,
};
static int st7789v_get_modes(struct drm_panel *panel)
static int st7789v_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct drm_display_mode *mode;
mode = drm_mode_duplicate(panel->drm, &default_mode);
......@@ -188,8 +188,8 @@ static int st7789v_get_modes(struct drm_panel *panel)
mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
drm_mode_probed_add(connector, mode);
panel->connector->display_info.width_mm = 61;
panel->connector->display_info.height_mm = 103;
connector->display_info.width_mm = 61;
connector->display_info.height_mm = 103;
return 1;
}
......
......@@ -521,9 +521,9 @@ static const struct drm_display_mode acx565akm_mode = {
.height_mm = 46,
};
static int acx565akm_get_modes(struct drm_panel *panel)
static int acx565akm_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct drm_display_mode *mode;
mode = drm_mode_duplicate(panel->drm, &acx565akm_mode);
......
......@@ -287,9 +287,9 @@ static const struct drm_display_mode td028ttec1_mode = {
.height_mm = 58,
};
static int td028ttec1_get_modes(struct drm_panel *panel)
static int td028ttec1_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct drm_display_mode *mode;
mode = drm_mode_duplicate(panel->drm, &td028ttec1_mode);
......
......@@ -346,9 +346,9 @@ static const struct drm_display_mode td043mtea1_mode = {
.height_mm = 56,
};
static int td043mtea1_get_modes(struct drm_panel *panel)
static int td043mtea1_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct drm_display_mode *mode;
mode = drm_mode_duplicate(panel->drm, &td043mtea1_mode);
......
......@@ -384,9 +384,9 @@ static int tpg110_enable(struct drm_panel *panel)
* presents the mode that is configured for the system under use,
* and which is detected by reading the registers of the display.
*/
static int tpg110_get_modes(struct drm_panel *panel)
static int tpg110_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct tpg110 *tpg = to_tpg110(panel);
struct drm_display_mode *mode;
......
......@@ -454,9 +454,9 @@ static int truly_nt35597_enable(struct drm_panel *panel)
return 0;
}
static int truly_nt35597_get_modes(struct drm_panel *panel)
static int truly_nt35597_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_connector *connector = panel->connector;
struct truly_nt35597 *ctx = panel_to_ctx(panel);
struct drm_display_mode *mode;
const struct nt35597_config *config;
......
......@@ -110,7 +110,8 @@ struct drm_panel_funcs {
*
* This function is mandatory.
*/
int (*get_modes)(struct drm_panel *panel);
int (*get_modes)(struct drm_panel *panel,
struct drm_connector *connector);
/**
* @get_timings:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment