@@ -23,6 +23,8 @@
#include <drm/drm_fb_helper.h>
#include <drm/drm_crtc_helper.h>
#include <linux/videodev2.h>
+#include <video/videomode.h>
+#include <video/of_display_timing.h>
#include "imx-drm.h"
@@ -74,11 +76,25 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
if (np) {
struct drm_display_mode *mode = drm_mode_create(connector->dev);
- of_get_drm_display_mode(np, &imxpd->mode, 0);
- drm_mode_copy(mode, &imxpd->mode);
- mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
- drm_mode_probed_add(connector, mode);
- num_modes++;
+ struct display_timings *timings;
+ struct videomode vm;
+ int np_num_mode;
+
+ timings = of_get_display_timings(np);
+ if (!timings)
+ return num_modes;
+ for (np_num_mode = 0; np_num_mode < timings->num_timings;
+ np_num_mode++, num_modes++) {
+ if (videomode_from_timings(timings, &vm, np_num_mode))
+ break;
+ drm_display_mode_from_videomode(&vm, mode);
+ mode->type = DRM_MODE_TYPE_DRIVER;
+ if (timings->native_mode == np_num_mode)
+ mode->type |= DRM_MODE_TYPE_PREFERRED;
+
+ drm_mode_set_name(mode);
+ drm_mode_probed_add(connector, mode);
+ }
}
return num_modes;
The comment on top of of_get_drm_display_mode says: * This function is expensive and should only be used, if only one mode is to be * read from DT. To get multiple modes start with of_get_display_timings and * work with that instead. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: driverdev-devel@linuxdriverproject.org Cc: David Airlie <airlied@linux.ie> Cc: dri-devel@lists.freedesktop.org Cc: linux-arm-kernel@lists.infradead.org Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Sascha Hauer <kernel@pengutronix.de> Cc: linux-arm-kernel@lists.infradead.org Cc: Eric BĂ©nard <eric@eukrea.com> Signed-off-by: Denis Carikli <denis@eukrea.com> --- drivers/staging/imx-drm/parallel-display.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)