diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c index 803e934f3bf0..414d601bf216 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c @@ -395,7 +395,7 @@ static const struct file_operations dw_hdmi_cec_file_operations = { .owner = THIS_MODULE, }; -void dw_hdmi_hpd_wake_up(struct platform_device *pdev) +static void dw_hdmi_cec_hpd_wake_up(struct platform_device *pdev) { struct dw_hdmi_cec *cec = platform_get_drvdata(pdev); @@ -415,7 +415,10 @@ void dw_hdmi_hpd_wake_up(struct platform_device *pdev) input_sync(cec->devinput); mutex_unlock(&cec->wake_lock); } -EXPORT_SYMBOL_GPL(dw_hdmi_hpd_wake_up); + +static const struct dw_hdmi_cec_wake_ops cec_ops = { + .hpd_wake_up = dw_hdmi_cec_hpd_wake_up, +}; static int dw_hdmi_cec_probe(struct platform_device *pdev) { @@ -519,6 +522,8 @@ static int dw_hdmi_cec_probe(struct platform_device *pdev) ret = misc_register(&cec->misc_dev); + dw_hdmi_cec_wake_ops_register(cec->hdmi, &cec_ops); + return ret; } diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 215d62ed4e59..3918df0ffb58 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -260,6 +260,7 @@ struct dw_hdmi { struct hdmi_data_info hdmi_data; const struct dw_hdmi_plat_data *plat_data; + const struct dw_hdmi_cec_wake_ops *cec_ops; struct dw_hdcp *hdcp; int vic; @@ -3244,7 +3245,11 @@ void dw_hdmi_set_hpd_wake(struct dw_hdmi *hdmi) if (!hdmi->cec) return; - dw_hdmi_hpd_wake_up(hdmi->cec); + if (!hdmi->cec_ops) + return; + + if (hdmi->cec_ops->hpd_wake_up) + hdmi->cec_ops->hpd_wake_up(hdmi->cec); } EXPORT_SYMBOL_GPL(dw_hdmi_set_hpd_wake); @@ -4476,6 +4481,17 @@ static int get_force_logo_property(struct dw_hdmi *hdmi) return 0; } +void +dw_hdmi_cec_wake_ops_register(struct dw_hdmi *hdmi, const struct dw_hdmi_cec_wake_ops *cec_ops) +{ + if (!cec_ops || !hdmi) + return; + + hdmi->cec_ops = cec_ops; +} +EXPORT_SYMBOL_GPL(dw_hdmi_cec_wake_ops_register); + + /* ----------------------------------------------------------------------------- * Probe/remove API, used from platforms based on the DRM bridge API. */ diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index 761687a457fe..5a2352981d24 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -260,6 +260,10 @@ struct dw_hdmi_plat_data { struct drm_connector *connector; }; +struct dw_hdmi_cec_wake_ops { + void (*hpd_wake_up)(struct platform_device *pdev); +}; + struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, const struct dw_hdmi_plat_data *plat_data); void dw_hdmi_remove(struct dw_hdmi *hdmi); @@ -332,5 +336,7 @@ void dw_hdmi_qp_set_output_type(struct dw_hdmi_qp *hdmi, u64 val); bool dw_hdmi_qp_get_output_whether_hdmi(struct dw_hdmi_qp *hdmi); int dw_hdmi_qp_get_output_type_cap(struct dw_hdmi_qp *hdmi); void dw_hdmi_set_hpd_wake(struct dw_hdmi *hdmi); +void dw_hdmi_cec_wake_ops_register(struct dw_hdmi *hdmi, + const struct dw_hdmi_cec_wake_ops *cec_ops); #endif /* __IMX_HDMI_H__ */