diff mbox

[v13,08/12] drm: bridge/dw_hdmi: add mode_valid support

Message ID 1417008811-32308-1-git-send-email-andy.yan@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andy Yan Nov. 26, 2014, 1:33 p.m. UTC
some platform may not support all the display mode,
add mode_valid interface check it

also add drm_connector_register which add a debugfs
interface for dump display modes and edid information

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---

Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c | 17 +++++++++++++++++
 include/drm/bridge/dw_hdmi.h     |  2 ++
 2 files changed, 19 insertions(+)

Comments

Philipp Zabel Nov. 26, 2014, 4:23 p.m. UTC | #1
Am Mittwoch, den 26.11.2014, 21:33 +0800 schrieb Andy Yan:
> some platform may not support all the display mode,
> add mode_valid interface check it
> 
> also add drm_connector_register which add a debugfs
> interface for dump display modes and edid information
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> ---
> 
> Changes in v13: None
> Changes in v12: None
> Changes in v11: None
> Changes in v10: None
> Changes in v9: None
> Changes in v8: None
> Changes in v7: None
> Changes in v6: None
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> 
>  drivers/gpu/drm/bridge/dw_hdmi.c | 17 +++++++++++++++++
>  include/drm/bridge/dw_hdmi.h     |  2 ++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
> index 5e88c8d..b13e782 100644
> --- a/drivers/gpu/drm/bridge/dw_hdmi.c
> +++ b/drivers/gpu/drm/bridge/dw_hdmi.c
> @@ -1406,6 +1406,20 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
>  	return 0;
>  }
>  
> +static enum drm_mode_status
> +dw_hdmi_connector_mode_valid(struct drm_connector *connector,
> +			     struct drm_display_mode *mode)
> +{
> +	struct dw_hdmi *hdmi = container_of(connector,
> +					   struct dw_hdmi, connector);
> +	enum drm_mode_status mode_status = MODE_OK;
> +
> +	if (hdmi->plat_data->mode_valid)
> +		mode_status = hdmi->plat_data->mode_valid(connector, mode);
> +
> +	return mode_status;
> +}
> +
>  static struct drm_encoder *dw_hdmi_connector_best_encoder(struct drm_connector
>  							   *connector)
>  {
> @@ -1430,6 +1444,7 @@ static struct drm_connector_funcs dw_hdmi_connector_funcs = {
>  
>  static struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs = {
>  	.get_modes = dw_hdmi_connector_get_modes,
> +	.mode_valid = dw_hdmi_connector_mode_valid,
>  	.best_encoder = dw_hdmi_connector_best_encoder,
>  };
>  
> @@ -1631,6 +1646,8 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
>  
>  	dev_set_drvdata(dev, hdmi);
>  
> +	drm_connector_register(&hdmi->connector);
> +

This is not right, the connector is registered by the imx-drm core in
the drm_driver .load callback.

regards
Philipp
Andy Yan Nov. 28, 2014, 9:47 a.m. UTC | #2
Hi Philipp:

On 2014?11?27? 00:23, Philipp Zabel wrote:
> Am Mittwoch, den 26.11.2014, 21:33 +0800 schrieb Andy Yan:
>> some platform may not support all the display mode,
>> add mode_valid interface check it
>>
>> also add drm_connector_register which add a debugfs
>> interface for dump display modes and edid information
>>
>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>> ---
>>
>> Changes in v13: None
>> Changes in v12: None
>> Changes in v11: None
>> Changes in v10: None
>> Changes in v9: None
>> Changes in v8: None
>> Changes in v7: None
>> Changes in v6: None
>> Changes in v5: None
>> Changes in v4: None
>> Changes in v3: None
>>
>>   drivers/gpu/drm/bridge/dw_hdmi.c | 17 +++++++++++++++++
>>   include/drm/bridge/dw_hdmi.h     |  2 ++
>>   2 files changed, 19 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
>> index 5e88c8d..b13e782 100644
>> --- a/drivers/gpu/drm/bridge/dw_hdmi.c
>> +++ b/drivers/gpu/drm/bridge/dw_hdmi.c
>> @@ -1406,6 +1406,20 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
>>   	return 0;
>>   }
>>   
>> +static enum drm_mode_status
>> +dw_hdmi_connector_mode_valid(struct drm_connector *connector,
>> +			     struct drm_display_mode *mode)
>> +{
>> +	struct dw_hdmi *hdmi = container_of(connector,
>> +					   struct dw_hdmi, connector);
>> +	enum drm_mode_status mode_status = MODE_OK;
>> +
>> +	if (hdmi->plat_data->mode_valid)
>> +		mode_status = hdmi->plat_data->mode_valid(connector, mode);
>> +
>> +	return mode_status;
>> +}
>> +
>>   static struct drm_encoder *dw_hdmi_connector_best_encoder(struct drm_connector
>>   							   *connector)
>>   {
>> @@ -1430,6 +1444,7 @@ static struct drm_connector_funcs dw_hdmi_connector_funcs = {
>>   
>>   static struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs = {
>>   	.get_modes = dw_hdmi_connector_get_modes,
>> +	.mode_valid = dw_hdmi_connector_mode_valid,
>>   	.best_encoder = dw_hdmi_connector_best_encoder,
>>   };
>>   
>> @@ -1631,6 +1646,8 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
>>   
>>   	dev_set_drvdata(dev, hdmi);
>>   
>> +	drm_connector_register(&hdmi->connector);
>> +
> This is not right, the connector is registered by the imx-drm core in
> the drm_driver .load callback.
     Sorry, I didn't found imx-drm core has did that before.And I found many
connector drivers register it by itself.
    This will be removed in next patch.
> regards
> Philipp
>
>
>
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index 5e88c8d..b13e782 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -1406,6 +1406,20 @@  static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
 	return 0;
 }
 
+static enum drm_mode_status
+dw_hdmi_connector_mode_valid(struct drm_connector *connector,
+			     struct drm_display_mode *mode)
+{
+	struct dw_hdmi *hdmi = container_of(connector,
+					   struct dw_hdmi, connector);
+	enum drm_mode_status mode_status = MODE_OK;
+
+	if (hdmi->plat_data->mode_valid)
+		mode_status = hdmi->plat_data->mode_valid(connector, mode);
+
+	return mode_status;
+}
+
 static struct drm_encoder *dw_hdmi_connector_best_encoder(struct drm_connector
 							   *connector)
 {
@@ -1430,6 +1444,7 @@  static struct drm_connector_funcs dw_hdmi_connector_funcs = {
 
 static struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs = {
 	.get_modes = dw_hdmi_connector_get_modes,
+	.mode_valid = dw_hdmi_connector_mode_valid,
 	.best_encoder = dw_hdmi_connector_best_encoder,
 };
 
@@ -1631,6 +1646,8 @@  int dw_hdmi_bind(struct device *dev, struct device *master,
 
 	dev_set_drvdata(dev, hdmi);
 
+	drm_connector_register(&hdmi->connector);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(dw_hdmi_bind);
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
index 1bbf3ca..1777ab4 100644
--- a/include/drm/bridge/dw_hdmi.h
+++ b/include/drm/bridge/dw_hdmi.h
@@ -48,6 +48,8 @@  struct dw_hdmi_plat_data {
 	const struct mpll_config *mpll_cfg;
 	const struct curr_ctrl *cur_ctr;
 	const struct sym_term *sym_term;
+	enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
+			      struct drm_display_mode *mode);
 };
 
 void dw_hdmi_unbind(struct device *dev, struct device *master, void *data);