imx-drm: provide common connector mode validation function
Provide a common connector mode validation function, which can be used to limit the available modes according to other components in the system. Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Shawn Guo <shawn.guo@linaro.org> Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
887eceacc5
commit
baa68c4bfd
|
@ -211,6 +211,13 @@ static const struct file_operations imx_drm_driver_fops = {
|
||||||
.llseek = noop_llseek,
|
.llseek = noop_llseek,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int imx_drm_connector_mode_valid(struct drm_connector *connector,
|
||||||
|
struct drm_display_mode *mode)
|
||||||
|
{
|
||||||
|
return MODE_OK;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(imx_drm_connector_mode_valid);
|
||||||
|
|
||||||
static struct imx_drm_device *imx_drm_device;
|
static struct imx_drm_device *imx_drm_device;
|
||||||
|
|
||||||
static struct imx_drm_device *__imx_drm_device(void)
|
static struct imx_drm_device *__imx_drm_device(void)
|
||||||
|
|
|
@ -68,4 +68,7 @@ int imx_drm_encoder_get_mux_id(struct drm_encoder *encoder);
|
||||||
int imx_drm_encoder_add_possible_crtcs(struct imx_drm_encoder *imx_drm_encoder,
|
int imx_drm_encoder_add_possible_crtcs(struct imx_drm_encoder *imx_drm_encoder,
|
||||||
struct device_node *np);
|
struct device_node *np);
|
||||||
|
|
||||||
|
int imx_drm_connector_mode_valid(struct drm_connector *connector,
|
||||||
|
struct drm_display_mode *mode);
|
||||||
|
|
||||||
#endif /* _IMX_DRM_H_ */
|
#endif /* _IMX_DRM_H_ */
|
||||||
|
|
|
@ -1406,13 +1406,6 @@ static int imx_hdmi_connector_get_modes(struct drm_connector *connector)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int imx_hdmi_connector_mode_valid(struct drm_connector *connector,
|
|
||||||
struct drm_display_mode *mode)
|
|
||||||
{
|
|
||||||
|
|
||||||
return MODE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct drm_encoder *imx_hdmi_connector_best_encoder(struct drm_connector
|
static struct drm_encoder *imx_hdmi_connector_best_encoder(struct drm_connector
|
||||||
*connector)
|
*connector)
|
||||||
{
|
{
|
||||||
|
@ -1501,7 +1494,7 @@ static struct drm_connector_funcs imx_hdmi_connector_funcs = {
|
||||||
|
|
||||||
static struct drm_connector_helper_funcs imx_hdmi_connector_helper_funcs = {
|
static struct drm_connector_helper_funcs imx_hdmi_connector_helper_funcs = {
|
||||||
.get_modes = imx_hdmi_connector_get_modes,
|
.get_modes = imx_hdmi_connector_get_modes,
|
||||||
.mode_valid = imx_hdmi_connector_mode_valid,
|
.mode_valid = imx_drm_connector_mode_valid,
|
||||||
.best_encoder = imx_hdmi_connector_best_encoder,
|
.best_encoder = imx_hdmi_connector_best_encoder,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -120,12 +120,6 @@ static int imx_ldb_connector_get_modes(struct drm_connector *connector)
|
||||||
return num_modes;
|
return num_modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int imx_ldb_connector_mode_valid(struct drm_connector *connector,
|
|
||||||
struct drm_display_mode *mode)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct drm_encoder *imx_ldb_connector_best_encoder(
|
static struct drm_encoder *imx_ldb_connector_best_encoder(
|
||||||
struct drm_connector *connector)
|
struct drm_connector *connector)
|
||||||
{
|
{
|
||||||
|
@ -329,7 +323,7 @@ static struct drm_connector_funcs imx_ldb_connector_funcs = {
|
||||||
static struct drm_connector_helper_funcs imx_ldb_connector_helper_funcs = {
|
static struct drm_connector_helper_funcs imx_ldb_connector_helper_funcs = {
|
||||||
.get_modes = imx_ldb_connector_get_modes,
|
.get_modes = imx_ldb_connector_get_modes,
|
||||||
.best_encoder = imx_ldb_connector_best_encoder,
|
.best_encoder = imx_ldb_connector_best_encoder,
|
||||||
.mode_valid = imx_ldb_connector_mode_valid,
|
.mode_valid = imx_drm_connector_mode_valid,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct drm_encoder_funcs imx_ldb_encoder_funcs = {
|
static struct drm_encoder_funcs imx_ldb_encoder_funcs = {
|
||||||
|
|
|
@ -254,6 +254,11 @@ static int imx_tve_connector_mode_valid(struct drm_connector *connector,
|
||||||
{
|
{
|
||||||
struct imx_tve *tve = con_to_tve(connector);
|
struct imx_tve *tve = con_to_tve(connector);
|
||||||
unsigned long rate;
|
unsigned long rate;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = imx_drm_connector_mode_valid(connector, mode);
|
||||||
|
if (ret != MODE_OK)
|
||||||
|
return ret;
|
||||||
|
|
||||||
/* pixel clock with 2x oversampling */
|
/* pixel clock with 2x oversampling */
|
||||||
rate = clk_round_rate(tve->clk, 2000UL * mode->clock) / 2000;
|
rate = clk_round_rate(tve->clk, 2000UL * mode->clock) / 2000;
|
||||||
|
|
|
@ -85,12 +85,6 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
|
||||||
return num_modes;
|
return num_modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int imx_pd_connector_mode_valid(struct drm_connector *connector,
|
|
||||||
struct drm_display_mode *mode)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct drm_encoder *imx_pd_connector_best_encoder(
|
static struct drm_encoder *imx_pd_connector_best_encoder(
|
||||||
struct drm_connector *connector)
|
struct drm_connector *connector)
|
||||||
{
|
{
|
||||||
|
@ -147,7 +141,7 @@ static struct drm_connector_funcs imx_pd_connector_funcs = {
|
||||||
static struct drm_connector_helper_funcs imx_pd_connector_helper_funcs = {
|
static struct drm_connector_helper_funcs imx_pd_connector_helper_funcs = {
|
||||||
.get_modes = imx_pd_connector_get_modes,
|
.get_modes = imx_pd_connector_get_modes,
|
||||||
.best_encoder = imx_pd_connector_best_encoder,
|
.best_encoder = imx_pd_connector_best_encoder,
|
||||||
.mode_valid = imx_pd_connector_mode_valid,
|
.mode_valid = imx_drm_connector_mode_valid,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct drm_encoder_funcs imx_pd_encoder_funcs = {
|
static struct drm_encoder_funcs imx_pd_encoder_funcs = {
|
||||||
|
|
Loading…
Reference in New Issue