--- zzzz-none-000/linux-3.10.107/drivers/gpu/drm/omapdrm/omap_connector.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/gpu/drm/omapdrm/omap_connector.c 2021-02-04 17:41:59.000000000 +0000 @@ -17,10 +17,11 @@ * this program. If not, see . */ -#include "omap_drv.h" +#include +#include +#include -#include "drm_crtc.h" -#include "drm_crtc_helper.h" +#include "omap_drv.h" /* * connector funcs @@ -32,12 +33,20 @@ struct drm_connector base; struct omap_dss_device *dssdev; struct drm_encoder *encoder; + bool hdmi_mode; }; +bool omap_connector_get_hdmi_mode(struct drm_connector *connector) +{ + struct omap_connector *omap_connector = to_omap_connector(connector); + + return omap_connector->hdmi_mode; +} + void copy_timings_omap_to_drm(struct drm_display_mode *mode, struct omap_video_timings *timings) { - mode->clock = timings->pixel_clock; + mode->clock = timings->pixelclock / 1000; mode->hdisplay = timings->x_res; mode->hsync_start = mode->hdisplay + timings->hfp; @@ -68,7 +77,7 @@ void copy_timings_drm_to_omap(struct omap_video_timings *timings, struct drm_display_mode *mode) { - timings->pixel_clock = mode->clock; + timings->pixelclock = mode->clock * 1000; timings->x_res = mode->hdisplay; timings->hfp = mode->hsync_start - mode->hdisplay; @@ -94,7 +103,7 @@ timings->data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE; timings->de_level = OMAPDSS_SIG_ACTIVE_HIGH; - timings->sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES; + timings->sync_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE; } static enum drm_connector_status omap_connector_detect( @@ -130,7 +139,7 @@ struct omap_dss_device *dssdev = omap_connector->dssdev; DBG("%s", omap_connector->dssdev->name); - drm_sysfs_connector_remove(connector); + drm_connector_unregister(connector); drm_connector_cleanup(connector); kfree(omap_connector); @@ -162,10 +171,14 @@ drm_mode_connector_update_edid_property( connector, edid); n = drm_add_edid_modes(connector, edid); + + omap_connector->hdmi_mode = + drm_detect_hdmi_monitor(edid); } else { drm_mode_connector_update_edid_property( connector, NULL); } + kfree(edid); } else { struct drm_display_mode *mode = drm_mode_create(dev); @@ -220,7 +233,7 @@ if (!r) { /* check if vrefresh is still valid */ new_mode = drm_mode_duplicate(dev, mode); - new_mode->clock = timings.pixel_clock; + new_mode->clock = timings.pixelclock / 1000; new_mode->vrefresh = 0; if (mode->vrefresh == drm_mode_vrefresh(new_mode)) ret = MODE_OK; @@ -247,10 +260,13 @@ } static const struct drm_connector_funcs omap_connector_funcs = { - .dpms = drm_helper_connector_dpms, + .dpms = drm_atomic_helper_connector_dpms, + .reset = drm_atomic_helper_connector_reset, .detect = omap_connector_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = omap_connector_destroy, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; static const struct drm_connector_helper_funcs omap_connector_helper_funcs = { @@ -259,18 +275,6 @@ .best_encoder = omap_connector_attached_encoder, }; -/* flush an area of the framebuffer (in case of manual update display that - * is not automatically flushed) - */ -void omap_connector_flush(struct drm_connector *connector, - int x, int y, int w, int h) -{ - struct omap_connector *omap_connector = to_omap_connector(connector); - - /* TODO: enable when supported in dss */ - VERB("%s: %d,%d, %dx%d", omap_connector->dssdev->name, x, y, w, h); -} - /* initialize connector */ struct drm_connector *omap_connector_init(struct drm_device *dev, int connector_type, struct omap_dss_device *dssdev, @@ -307,7 +311,7 @@ connector->interlace_allowed = 1; connector->doublescan_allowed = 0; - drm_sysfs_connector_add(connector); + drm_connector_register(connector); return connector;