drm: bridge: dw-hdmi: Pass private data pointer to .mode_valid()
Platform glue drivers for dw_hdmi may need to access device-specific data from their .mode_valid() implementation. They currently have no clean way to do so, and one driver hacks around it by accessing the dev_private data of the drm_device retrieved from the connector. Add a priv_data void pointer to the dw_hdmi_plat_data structure, and pass it to the .mode_valid() function. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200526011505.31884-12-laurent.pinchart+renesas@ideasonboard.com
This commit is contained in:
parent
12c683e12c
commit
96591a4b93
|
@ -2771,6 +2771,7 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
|
|||
const struct drm_display_mode *mode)
|
||||
{
|
||||
struct dw_hdmi *hdmi = bridge->driver_private;
|
||||
const struct dw_hdmi_plat_data *pdata = hdmi->plat_data;
|
||||
struct drm_connector *connector = &hdmi->connector;
|
||||
enum drm_mode_status mode_status = MODE_OK;
|
||||
|
||||
|
@ -2778,8 +2779,9 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
|
|||
if (mode->flags & DRM_MODE_FLAG_DBLCLK)
|
||||
return MODE_BAD;
|
||||
|
||||
if (hdmi->plat_data->mode_valid)
|
||||
mode_status = hdmi->plat_data->mode_valid(connector, mode);
|
||||
if (pdata->mode_valid)
|
||||
mode_status = pdata->mode_valid(hdmi, pdata->priv_data,
|
||||
connector, mode);
|
||||
|
||||
return mode_status;
|
||||
}
|
||||
|
|
|
@ -145,7 +145,8 @@ static const struct drm_encoder_helper_funcs dw_hdmi_imx_encoder_helper_funcs =
|
|||
};
|
||||
|
||||
static enum drm_mode_status
|
||||
imx6q_hdmi_mode_valid(struct drm_connector *con,
|
||||
imx6q_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data,
|
||||
struct drm_connector *con,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
if (mode->clock < 13500)
|
||||
|
@ -158,7 +159,8 @@ imx6q_hdmi_mode_valid(struct drm_connector *con,
|
|||
}
|
||||
|
||||
static enum drm_mode_status
|
||||
imx6dl_hdmi_mode_valid(struct drm_connector *con,
|
||||
imx6dl_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data,
|
||||
struct drm_connector *con,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
if (mode->clock < 13500)
|
||||
|
|
|
@ -630,7 +630,8 @@ static irqreturn_t dw_hdmi_top_thread_irq(int irq, void *dev_id)
|
|||
}
|
||||
|
||||
static enum drm_mode_status
|
||||
dw_hdmi_mode_valid(struct drm_connector *connector,
|
||||
dw_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data,
|
||||
struct drm_connector *connector,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
struct meson_drm *priv = connector->dev->dev_private;
|
||||
|
|
|
@ -38,7 +38,8 @@ static const struct rcar_hdmi_phy_params rcar_hdmi_phy_params[] = {
|
|||
};
|
||||
|
||||
static enum drm_mode_status
|
||||
rcar_hdmi_mode_valid(struct drm_connector *connector,
|
||||
rcar_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data,
|
||||
struct drm_connector *connector,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -220,7 +220,8 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
|
|||
}
|
||||
|
||||
static enum drm_mode_status
|
||||
dw_hdmi_rockchip_mode_valid(struct drm_connector *connector,
|
||||
dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data,
|
||||
struct drm_connector *connector,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
const struct dw_hdmi_mpll_config *mpll_cfg = rockchip_mpll_cfg;
|
||||
|
|
|
@ -31,7 +31,8 @@ sun8i_dw_hdmi_encoder_helper_funcs = {
|
|||
};
|
||||
|
||||
static enum drm_mode_status
|
||||
sun8i_dw_hdmi_mode_valid_a83t(struct drm_connector *connector,
|
||||
sun8i_dw_hdmi_mode_valid_a83t(struct dw_hdmi *hdmi, void *data,
|
||||
struct drm_connector *connector,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
if (mode->clock > 297000)
|
||||
|
@ -41,7 +42,8 @@ sun8i_dw_hdmi_mode_valid_a83t(struct drm_connector *connector,
|
|||
}
|
||||
|
||||
static enum drm_mode_status
|
||||
sun8i_dw_hdmi_mode_valid_h6(struct drm_connector *connector,
|
||||
sun8i_dw_hdmi_mode_valid_h6(struct dw_hdmi *hdmi, void *data,
|
||||
struct drm_connector *connector,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -176,7 +176,8 @@ struct sun8i_hdmi_phy {
|
|||
};
|
||||
|
||||
struct sun8i_dw_hdmi_quirks {
|
||||
enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
|
||||
enum drm_mode_status (*mode_valid)(struct dw_hdmi *hdmi, void *data,
|
||||
struct drm_connector *connector,
|
||||
const struct drm_display_mode *mode);
|
||||
unsigned int set_rate : 1;
|
||||
unsigned int use_drm_infoframe : 1;
|
||||
|
|
|
@ -124,13 +124,23 @@ struct dw_hdmi_phy_ops {
|
|||
|
||||
struct dw_hdmi_plat_data {
|
||||
struct regmap *regm;
|
||||
enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
|
||||
const struct drm_display_mode *mode);
|
||||
|
||||
unsigned long input_bus_format;
|
||||
unsigned long input_bus_encoding;
|
||||
bool use_drm_infoframe;
|
||||
bool ycbcr_420_allowed;
|
||||
|
||||
/*
|
||||
* Private data passed to all the .mode_valid() and .configure_phy()
|
||||
* callback functions.
|
||||
*/
|
||||
void *priv_data;
|
||||
|
||||
/* Platform-specific mode validation (optional). */
|
||||
enum drm_mode_status (*mode_valid)(struct dw_hdmi *hdmi, void *data,
|
||||
struct drm_connector *connector,
|
||||
const struct drm_display_mode *mode);
|
||||
|
||||
/* Vendor PHY support */
|
||||
const struct dw_hdmi_phy_ops *phy_ops;
|
||||
const char *phy_name;
|
||||
|
|
Loading…
Reference in a new issue