Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9b0e251 authored by Andrzej Hajda's avatar Andrzej Hajda Committed by Daniel Vetter
Browse files

drm: make mode_valid callback optional



Many drm connectors do not need mode validation.
The patch makes this callback optional and removes dumb implementations.

v2: Rebase:
- imx move to a shared (but still dummy) ->mode_valid implementation.
- probe helpers have been extracted to drm_probe_helper.c

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> (v1)
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 0967e6a5
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1903,7 +1903,7 @@ void intel_crt_init(struct drm_device *dev)
          <para>
            The function filters out modes larger than
            <parameter>max_width</parameter> and <parameter>max_height</parameter>
            if specified. It then calls the connector
            if specified. It then calls the optional connector
            <methodname>mode_valid</methodname> helper operation for each mode in
            the probed list to check whether the mode is valid for the connector.
          </para>
@@ -2265,7 +2265,7 @@ void intel_crt_init(struct drm_device *dev)
          <para>
            Verify whether a mode is valid for the connector. Return MODE_OK for
            supported modes and one of the enum drm_mode_status values (MODE_*)
            for unsupported modes. This operation is mandatory.
            for unsupported modes. This operation is optional.
          </para>
          <para>
            As the mode rejection reason is currently not used beside for
+0 −7
Original line number Diff line number Diff line
@@ -743,12 +743,6 @@ static int ast_get_modes(struct drm_connector *connector)
	return 0;
}

static int ast_mode_valid(struct drm_connector *connector,
			  struct drm_display_mode *mode)
{
	return MODE_OK;
}

static void ast_connector_destroy(struct drm_connector *connector)
{
	struct ast_connector *ast_connector = to_ast_connector(connector);
@@ -765,7 +759,6 @@ ast_connector_detect(struct drm_connector *connector, bool force)
}

static const struct drm_connector_helper_funcs ast_connector_helper_funcs = {
	.mode_valid = ast_mode_valid,
	.get_modes = ast_get_modes,
	.best_encoder = ast_best_single_encoder,
};
+0 −7
Original line number Diff line number Diff line
@@ -225,12 +225,6 @@ out:
	return num_modes;
}

static int ptn3460_mode_valid(struct drm_connector *connector,
		struct drm_display_mode *mode)
{
	return MODE_OK;
}

struct drm_encoder *ptn3460_best_encoder(struct drm_connector *connector)
{
	struct ptn3460_bridge *ptn_bridge;
@@ -242,7 +236,6 @@ struct drm_encoder *ptn3460_best_encoder(struct drm_connector *connector)

struct drm_connector_helper_funcs ptn3460_connector_helper_funcs = {
	.get_modes = ptn3460_get_modes,
	.mode_valid = ptn3460_mode_valid,
	.best_encoder = ptn3460_best_encoder,
};

+0 −8
Original line number Diff line number Diff line
@@ -505,13 +505,6 @@ static int cirrus_vga_get_modes(struct drm_connector *connector)
	return count;
}

static int cirrus_vga_mode_valid(struct drm_connector *connector,
				 struct drm_display_mode *mode)
{
	/* Any mode we've added is valid */
	return MODE_OK;
}

static struct drm_encoder *cirrus_connector_best_encoder(struct drm_connector
						  *connector)
{
@@ -546,7 +539,6 @@ static void cirrus_connector_destroy(struct drm_connector *connector)

struct drm_connector_helper_funcs cirrus_vga_connector_helper_funcs = {
	.get_modes = cirrus_vga_get_modes,
	.mode_valid = cirrus_vga_mode_valid,
	.best_encoder = cirrus_connector_best_encoder,
};

+1 −1
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
	drm_mode_validate_flag(connector, mode_flags);

	list_for_each_entry(mode, &connector->modes, head) {
		if (mode->status == MODE_OK)
		if (mode->status == MODE_OK && connector_funcs->mode_valid)
			mode->status = connector_funcs->mode_valid(connector,
								   mode);
	}
Loading