drm: struct drm_edid conversions
Subsystems (6)
cover drm: struct drm_edid conversions
Resend of the remaining patches from [1].
BR,
Jani.
[1] https://lore.kernel.org/r/[email protected]
Jani Nikula (6):
drm/bridge/analogix/anx6345: switch to struct drm_edid drm/bridge/analogix/anx78xx: switch to struct drm_edid drm/bridge: anx7625: use struct drm_edid more drm/i2c: tda998x: switch to struct drm_edid drm/bochs: switch to struct drm_edid drm/virtio: switch to struct drm_edid
.../drm/bridge/analogix/analogix-anx6345.c | 15 +++++------ .../drm/bridge/analogix/analogix-anx78xx.c | 23 ++++++++-------- drivers/gpu/drm/bridge/analogix/anx7625.c | 26 ++++++++++++------- drivers/gpu/drm/bridge/analogix/anx7625.h | 10 ++----- drivers/gpu/drm/i2c/tda998x_drv.c | 19 +++++++------- drivers/gpu/drm/tiny/bochs.c | 23 +++++++--------- drivers/gpu/drm/virtio/virtgpu_display.c | 10 +++---- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- drivers/gpu/drm/virtio/virtgpu_vq.c | 12 ++++----- 9 files changed, 69 insertions(+), 71 deletions(-)
Signature · 1 line
2.39.2
PATCH RESEND 1/6 drm/bridge/analogix/anx6345: switch to struct drm_edid
Prefer struct drm_edid based functions over struct edid.
---
--- .../gpu/drm/bridge/analogix/analogix-anx6345.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +7 -8
@@ -47,7 +47,7 @@ struct anx6345 {struct drm_dp_aux aux;struct drm_bridge bridge;struct i2c_client *client; -struct edid *edid; +const struct drm_edid *drm_edid;struct drm_connector connector;struct drm_panel *panel;struct regulator *dvdd12;
@@ -458,7 +458,7 @@ static int anx6345_get_modes(struct drm_connector *connector)mutex_lock (&anx6345->lock); -if (!anx6345->edid) { +if (!anx6345->drm_edid) {if (!anx6345->powered) {anx6345_poweron (anx6345); power_off = true;
@@ -470,19 +470,18 @@ static int anx6345_get_modes(struct drm_connector *connector) goto unlock; } - anx6345->edid =drm_get_edid (connector, &anx6345->aux.ddc); -if (!anx6345->edid) + anx6345->drm_edid =drm_edid_read_ddc (connector, &anx6345->aux.ddc); +if (!anx6345->drm_edid)DRM_ERROR ("Failed to read EDID from panel\n" ); - err =drm_connector_update_edid_property (connector, - anx6345->edid); + err =drm_edid_connector_update (connector, anx6345->drm_edid);if (err) {DRM_ERROR ("Failed to update EDID property: %d\n" , err); goto unlock; } } - num_modes +=drm_add_edid_modes (connector, anx6345->edid); + num_modes +=drm_edid_connector_add_modes (connector);/* Driver currently supports only 6bpc */ connector->display_info.bpc =6 ;
@@ -793,7 +792,7 @@ static void anx6345_i2c_remove(struct i2c_client *client)unregister_i2c_dummy_clients (anx6345); -kfree (anx6345->edid); +drm_edid_free (anx6345->drm_edid);mutex_destroy (&anx6345->lock); }
Signature · 1 line
2.39.2
Re: [RESEND 1/6] drm/bridge/analogix/anx6345: switch to struct drm_edid
Quoted 73 lines · Jani Nikula
Prefer struct
drm_edidbased functions over struct edid.Signed-off-by Jani Nikula <[email protected]>---
Cc Andrzej Hajda <[email protected]>Cc Neil Armstrong <[email protected]>Cc Robert Foss <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Jonas Karlman <[email protected]>Cc Jernej Skrabec <[email protected]>--- .../gpu/drm/bridge/analogix/analogix-anx6345.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +7
-9@@ -47,7 +47,7 @@ struct anx6345 {struct drm_dp_aux aux;struct drm_bridge bridge;struct i2c_client *client; -struct edid *edid; +const struct drm_edid *drm_edid;struct drm_connector connector;struct drm_panel *panel;struct regulator *dvdd12;@@ -458,7 +458,7 @@ static int anx6345_get_modes(struct drm_connector *connector)mutex_lock (&anx6345->lock); -if (!anx6345->edid) { +if (!anx6345->drm_edid) {if (!anx6345->powered) {anx6345_poweron (anx6345); power_off = true;@@ -470,19 +470,18 @@ static int anx6345_get_modes(struct drm_connector *connector) goto unlock; } - anx6345->edid =drm_get_edid (connector, &anx6345->aux.ddc); -if (!anx6345->edid) + anx6345->drm_edid =drm_edid_read_ddc (connector, &anx6345->aux.ddc); +if (!anx6345->drm_edid)DRM_ERROR ("Failed to read EDID from panel\n" ); - err =drm_connector_update_edid_property (connector, - anx6345->edid); + err =drm_edid_connector_update (connector, anx6345->drm_edid);if (err) {DRM_ERROR ("Failed to update EDID property: %d\n" , err); goto unlock; } } - num_modes +=drm_add_edid_modes (connector, anx6345->edid); + num_modes +=drm_edid_connector_add_modes (connector);/* Driver currently supports only 6bpc */ connector->display_info.bpc =6 ;@@ -793,7 +792,7 @@ static void anx6345_i2c_remove(struct i2c_client *client)unregister_i2c_dummy_clients (anx6345); -kfree (anx6345->edid); +drm_edid_free (anx6345->drm_edid);mutex_destroy (&anx6345->lock); } --
Quoted 2 lines
2.39.2
PATCH RESEND 2/6 drm/bridge/analogix/anx78xx: switch to struct drm_edid
In reply to Jani NikulaPrefer struct drm_edid based functions over struct edid.
---
--- .../drm/bridge/analogix/analogix-anx78xx.c | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c +12 -11
@@ -67,7 +67,7 @@ struct anx78xx {struct drm_dp_aux aux;struct drm_bridge bridge;struct i2c_client *client; -struct edid *edid; +const struct drm_edid *drm_edid;struct drm_connector connector;struct anx78xx_platform_data pdata;struct mutex lock;
@@ -830,8 +830,8 @@ static int anx78xx_get_modes(struct drm_connector *connector)if (WARN_ON (!anx78xx->powered))return 0 ; -if (anx78xx->edid) -return drm_add_edid_modes (connector, anx78xx->edid); +if (anx78xx->drm_edid) +return drm_edid_connector_add_modes (connector);mutex_lock (&anx78xx->lock);
@@ -841,20 +841,21 @@ static int anx78xx_get_modes(struct drm_connector *connector) goto unlock; } - anx78xx->edid =drm_get_edid (connector, &anx78xx->aux.ddc); -if (!anx78xx->edid) { + anx78xx->drm_edid =drm_edid_read_ddc (connector, &anx78xx->aux.ddc); + + err =drm_edid_connector_update (connector, anx78xx->drm_edid); + +if (!anx78xx->drm_edid) {DRM_ERROR ("Failed to read EDID\n" ); goto unlock; } - err =drm_connector_update_edid_property (connector, - anx78xx->edid);if (err) {DRM_ERROR ("Failed to update EDID property: %d\n" , err); goto unlock; } - num_modes =drm_add_edid_modes (connector, anx78xx->edid); + num_modes =drm_edid_connector_add_modes (connector); unlock:mutex_unlock (&anx78xx->lock);
@@ -1091,8 +1092,8 @@ static bool anx78xx_handle_common_int_4(struct anx78xx *anx78xx, u8 irq) event = true;anx78xx_poweroff (anx78xx);/* Free cached EDID */ -kfree (anx78xx->edid); - anx78xx->edid =NULL ; +drm_edid_free (anx78xx->drm_edid); + anx78xx->drm_edid =NULL ; }else if (irq &SP_HPD_PLUG ) {DRM_DEBUG_KMS ("IRQ: Hot plug detect - cable plug\n" ); event = true;
@@ -1363,7 +1364,7 @@ static void anx78xx_i2c_remove(struct i2c_client *client)unregister_i2c_dummy_clients (anx78xx); -kfree (anx78xx->edid); +drm_edid_free (anx78xx->drm_edid); }static const struct of_device_id anx78xx_match_table[] = {
Signature · 1 line
2.39.2
Re: [RESEND 2/6] drm/bridge/analogix/anx78xx: switch to struct drm_edid
Quoted 89 lines · Jani Nikula
Prefer struct
drm_edidbased functions over struct edid.Signed-off-by Jani Nikula <[email protected]>---
Cc Andrzej Hajda <[email protected]>Cc Neil Armstrong <[email protected]>Cc Robert Foss <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Jonas Karlman <[email protected]>Cc Jernej Skrabec <[email protected]>--- .../drm/bridge/analogix/analogix-anx78xx.c | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-)drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c +12
-12@@ -67,7 +67,7 @@ struct anx78xx {struct drm_dp_aux aux;struct drm_bridge bridge;struct i2c_client *client; -struct edid *edid; +const struct drm_edid *drm_edid;struct drm_connector connector;struct anx78xx_platform_data pdata;struct mutex lock;@@ -830,8 +830,8 @@ static int anx78xx_get_modes(struct drm_connector *connector)if (WARN_ON (!anx78xx->powered))return 0 ; -if (anx78xx->edid) -return drm_add_edid_modes (connector, anx78xx->edid); +if (anx78xx->drm_edid) +return drm_edid_connector_add_modes (connector);mutex_lock (&anx78xx->lock);@@ -841,20 +841,21 @@ static int anx78xx_get_modes(struct drm_connector *connector) goto unlock; } - anx78xx->edid =drm_get_edid (connector, &anx78xx->aux.ddc); -if (!anx78xx->edid) { + anx78xx->drm_edid =drm_edid_read_ddc (connector, &anx78xx->aux.ddc); + + err =drm_edid_connector_update (connector, anx78xx->drm_edid); + +if (!anx78xx->drm_edid) {DRM_ERROR ("Failed to read EDID\n" ); goto unlock; } - err =drm_connector_update_edid_property (connector, - anx78xx->edid);if (err) {DRM_ERROR ("Failed to update EDID property: %d\n" , err); goto unlock; } - num_modes =drm_add_edid_modes (connector, anx78xx->edid); + num_modes =drm_edid_connector_add_modes (connector); unlock:mutex_unlock (&anx78xx->lock);@@ -1091,8 +1092,8 @@ static bool anx78xx_handle_common_int_4(struct anx78xx *anx78xx, u8 irq) event = true;anx78xx_poweroff (anx78xx);/* Free cached EDID */ -kfree (anx78xx->edid); - anx78xx->edid =NULL ; +drm_edid_free (anx78xx->drm_edid); + anx78xx->drm_edid =NULL ; }else if (irq &SP_HPD_PLUG ) {DRM_DEBUG_KMS ("IRQ: Hot plug detect - cable plug\n" ); event = true;@@ -1363,7 +1364,7 @@ static void anx78xx_i2c_remove(struct i2c_client *client)unregister_i2c_dummy_clients (anx78xx); -kfree (anx78xx->edid); +drm_edid_free (anx78xx->drm_edid); }static const struct of_device_id anx78xx_match_table[] = { --
Quoted 2 lines
2.39.2
PATCH RESEND 3/6 drm/bridge: anx7625: use struct drm_edid more
In reply to Jani NikulaPrefer struct drm_edid based functions over struct edid.
---
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 26 +++++++++++++++-------- drivers/gpu/drm/bridge/analogix/anx7625.h | 10 ++------- 2 files changed, 19 insertions(+), 17 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +17 -9
@@ -464,9 +464,11 @@ static int anx7625_odfc_config(struct anx7625_data *ctx,*/ static int anx7625_set_k_value (struct anx7625_data *ctx) { -struct edid *edid = (struct edid *)ctx->slimport_edid_p.edid_raw_data; +struct drm_edid_product_id id; -if (edid->mfg_id[0 ] ==IVO_MID0 && edid->mfg_id[1 ] ==IVO_MID1 ) +drm_edid_get_product_id (ctx->cached_drm_edid, &id); + +if (be16_to_cpu (id.manufacturer_name) ==IVO_MID )return anx7625_reg_write (ctx, ctx->i2c.rx_p1_client,MIPI_DIGITAL_ADJ_1 ,0x3B );
@@ -1526,7 +1528,8 @@ static int anx7625_wait_hpd_asserted(struct drm_dp_aux *aux,static void anx7625_remove_edid (struct anx7625_data *ctx) { - ctx->slimport_edid_p.edid_block_num =-1 ; +drm_edid_free (ctx->cached_drm_edid); + ctx->cached_drm_edid =NULL ; }static void anx7625_dp_adjust_swing (struct anx7625_data *ctx)
@@ -1787,27 +1790,32 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux,static const struct drm_edid *anx7625_edid_read (struct anx7625_data *ctx) {struct device *dev = ctx->dev; -struct s_edid_data *p_edid = &ctx->slimport_edid_p; +u8 *edid_buf;int edid_num; -if (ctx->slimport_edid_p.edid_block_num >0 ) +if (ctx->cached_drm_edid) goto out; + edid_buf =kmalloc (FOUR_BLOCK_SIZE ,GFP_KERNEL ); +if (!edid_buf) +return NULL ; +pm_runtime_get_sync (dev);_anx7625_hpd_polling (ctx,5000 *100 ); - edid_num =sp_tx_edid_read (ctx, p_edid->edid_raw_data); + edid_num =sp_tx_edid_read (ctx, edid_buf);pm_runtime_put_sync (dev);if (edid_num <1 ) {DRM_DEV_ERROR (dev,"Fail to read EDID: %d\n" , edid_num); +kfree (edid_buf);return NULL ; } - p_edid->edid_block_num = edid_num; + ctx->cached_drm_edid =drm_edid_alloc (edid_buf,FOUR_BLOCK_SIZE ); +kfree (edid_buf); out: -return drm_edid_alloc (ctx->slimport_edid_p.edid_raw_data, -FOUR_BLOCK_SIZE ); +return drm_edid_dup (ctx->cached_drm_edid); }static enum drm_connector_status anx7625_sink_detect (struct anx7625_data *ctx)
drivers/gpu/drm/bridge/analogix/anx7625.h +2 -8
@@ -286,8 +286,7 @@#define MIPI_LANE_CTRL_10 0x0F#define MIPI_DIGITAL_ADJ_1 0x1B -#define IVO_MID0 0x26 -#define IVO_MID1 0xCF +#define IVO_MID 0x26CF#define MIPI_PLL_M_NUM_23_16 0x1E#define MIPI_PLL_M_NUM_15_8 0x1F
@@ -417,11 +416,6 @@ enum audio_wd_len {#define EDID_TRY_CNT 3#define SUPPORT_PIXEL_CLOCK 300000 -struct s_edid_data { -int edid_block_num; -u8 edid_raw_data[FOUR_BLOCK_SIZE ]; -}; -/***************** Display End *****************/ #define MAX_LANES_SUPPORT 4
@@ -466,7 +460,7 @@ struct anx7625_data {struct anx7625_i2c_client i2c;struct i2c_client *last_client;struct timer_list hdcp_timer; -struct s_edid_data slimport_edid_p; +const struct drm_edid *cached_drm_edid;struct device *codec_dev;hdmi_codec_plugged_cb plugged_cb;struct work_struct work;
Signature · 1 line
2.39.2
Re: [RESEND 3/6] drm/bridge: anx7625: use struct drm_edid more
Quoted 121 lines · Jani Nikula
Prefer struct
drm_edidbased functions over struct edid.Signed-off-by Jani Nikula <[email protected]>---
Cc Andrzej Hajda <[email protected]>Cc Neil Armstrong <[email protected]>Cc Robert Foss <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Jonas Karlman <[email protected]>Cc Jernej Skrabec <[email protected]>--- drivers/gpu/drm/bridge/analogix/anx7625.c | 26 +++++++++++++++-------- drivers/gpu/drm/bridge/analogix/anx7625.h | 10 ++------- 2 files changed, 19 insertions(+), 17 deletions(-)drivers/gpu/drm/bridge/analogix/anx7625.c +17
-9@@ -464,9 +464,11 @@ static int anx7625_odfc_config(struct anx7625_data *ctx,*/ static int anx7625_set_k_value (struct anx7625_data *ctx) { -struct edid *edid = (struct edid *)ctx->slimport_edid_p.edid_raw_data; +struct drm_edid_product_id id; -if (edid->mfg_id[0 ] ==IVO_MID0 && edid->mfg_id[1 ] ==IVO_MID1 ) +drm_edid_get_product_id (ctx->cached_drm_edid, &id); + +if (be16_to_cpu (id.manufacturer_name) ==IVO_MID )return anx7625_reg_write (ctx, ctx->i2c.rx_p1_client,MIPI_DIGITAL_ADJ_1 ,0x3B );@@ -1526,7 +1528,8 @@ static int anx7625_wait_hpd_asserted(struct drm_dp_aux *aux,static void anx7625_remove_edid (struct anx7625_data *ctx) { - ctx->slimport_edid_p.edid_block_num =-1 ; +drm_edid_free (ctx->cached_drm_edid); + ctx->cached_drm_edid =NULL ; }static void anx7625_dp_adjust_swing (struct anx7625_data *ctx)@@ -1787,27 +1790,32 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux,static const struct drm_edid *anx7625_edid_read (struct anx7625_data *ctx) {struct device *dev = ctx->dev; -struct s_edid_data *p_edid = &ctx->slimport_edid_p; +u8 *edid_buf;int edid_num; -if (ctx->slimport_edid_p.edid_block_num >0 ) +if (ctx->cached_drm_edid) goto out; + edid_buf =kmalloc (FOUR_BLOCK_SIZE ,GFP_KERNEL ); +if (!edid_buf) +return NULL ; +pm_runtime_get_sync (dev);_anx7625_hpd_polling (ctx,5000 *100 ); - edid_num =sp_tx_edid_read (ctx, p_edid->edid_raw_data); + edid_num =sp_tx_edid_read (ctx, edid_buf);pm_runtime_put_sync (dev);if (edid_num <1 ) {DRM_DEV_ERROR (dev,"Fail to read EDID: %d\n" , edid_num); +kfree (edid_buf);return NULL ; } - p_edid->edid_block_num = edid_num; + ctx->cached_drm_edid =drm_edid_alloc (edid_buf,FOUR_BLOCK_SIZE ); +kfree (edid_buf); out: -return drm_edid_alloc (ctx->slimport_edid_p.edid_raw_data, -FOUR_BLOCK_SIZE ); +return drm_edid_dup (ctx->cached_drm_edid); }static enum drm_connector_status anx7625_sink_detect (struct anx7625_data *ctx)drivers/gpu/drm/bridge/analogix/anx7625.h +2
-9@@ -286,8 +286,7 @@#define MIPI_LANE_CTRL_10 0x0F#define MIPI_DIGITAL_ADJ_1 0x1B -#define IVO_MID0 0x26 -#define IVO_MID1 0xCF +#define IVO_MID 0x26CF#define MIPI_PLL_M_NUM_23_16 0x1E#define MIPI_PLL_M_NUM_15_8 0x1F@@ -417,11 +416,6 @@ enum audio_wd_len {#define EDID_TRY_CNT 3#define SUPPORT_PIXEL_CLOCK 300000 -struct s_edid_data { -int edid_block_num; -u8 edid_raw_data[FOUR_BLOCK_SIZE ]; -}; -/***************** Display End *****************/ #define MAX_LANES_SUPPORT 4@@ -466,7 +460,7 @@ struct anx7625_data {struct anx7625_i2c_client i2c;struct i2c_client *last_client;struct timer_list hdcp_timer; -struct s_edid_data slimport_edid_p; +const struct drm_edid *cached_drm_edid;struct device *codec_dev;hdmi_codec_plugged_cb plugged_cb;struct work_struct work; --
Quoted 2 lines
2.39.2
PATCH RESEND 4/6 drm/i2c: tda998x: switch to struct drm_edid
In reply to Jani NikulaPrefer struct drm_edid based functions over struct edid.
---
--- drivers/gpu/drm/i2c/tda998x_drv.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/gpu/drm/i2c/tda998x_drv.c +10 -9
@@ -1283,7 +1283,7 @@ static int read_edid_block(void *data, u8 *buf, unsigned int blk, size_t length)static int tda998x_connector_get_modes (struct drm_connector *connector) {struct tda998x_priv *priv =conn_to_tda998x_priv (connector); -struct edid *edid; +const struct drm_edid *drm_edid;int n;/*
@@ -1297,25 +1297,26 @@ static int tda998x_connector_get_modes(struct drm_connector *connector)if (priv->rev ==TDA19988 )reg_clear (priv,REG_TX4 ,TX4_PD_RAM ); - edid =drm_do_get_edid (connector, read_edid_block, priv); + drm_edid =drm_edid_read_custom (connector, read_edid_block, priv);if (priv->rev ==TDA19988 )reg_set (priv,REG_TX4 ,TX4_PD_RAM ); -if (!edid) { +drm_edid_connector_update (connector, drm_edid); +cec_notifier_set_phys_addr (priv->cec_notify, + connector->display_info.source_physical_address); + +if (!drm_edid) {dev_warn (&priv->hdmi->dev,"failed to read EDID\n" );return 0 ; } -drm_connector_update_edid_property (connector, edid); -cec_notifier_set_phys_addr_from_edid (priv->cec_notify, edid); -mutex_lock (&priv->audio_mutex); - n =drm_add_edid_modes (connector, edid); - priv->sink_has_audio =drm_detect_monitor_audio (edid); + n =drm_edid_connector_add_modes (connector); + priv->sink_has_audio = connector->display_info.has_audio;mutex_unlock (&priv->audio_mutex); -kfree (edid); +drm_edid_free (drm_edid);return n; }
Signature · 1 line
2.39.2
Re: [RESEND 4/6] drm/i2c: tda998x: switch to struct drm_edid
Quoted 61 lines · Jani Nikula
Prefer struct
drm_edidbased functions over struct edid.Signed-off-by Jani Nikula <[email protected]>---
Cc Russell King <[email protected]>--- drivers/gpu/drm/i2c/tda998x_drv.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)drivers/gpu/drm/i2c/tda998x_drv.c +10
-10@@ -1283,7 +1283,7 @@ static int read_edid_block(void *data, u8 *buf, unsigned int blk, size_t length)static int tda998x_connector_get_modes (struct drm_connector *connector) {struct tda998x_priv *priv =conn_to_tda998x_priv (connector); -struct edid *edid; +const struct drm_edid *drm_edid;int n;/* @@ -1297,25 +1297,26 @@ static int tda998x_connector_get_modes(struct drm_connector *connector)if (priv->rev ==TDA19988 )reg_clear (priv,REG_TX4 ,TX4_PD_RAM ); - edid =drm_do_get_edid (connector, read_edid_block, priv); + drm_edid =drm_edid_read_custom (connector, read_edid_block, priv);if (priv->rev ==TDA19988 )reg_set (priv,REG_TX4 ,TX4_PD_RAM ); -if (!edid) { +drm_edid_connector_update (connector, drm_edid); +cec_notifier_set_phys_addr (priv->cec_notify, + connector->display_info.source_physical_address); + +if (!drm_edid) {dev_warn (&priv->hdmi->dev,"failed to read EDID\n" );return 0 ; } -drm_connector_update_edid_property (connector, edid); -cec_notifier_set_phys_addr_from_edid (priv->cec_notify, edid); -mutex_lock (&priv->audio_mutex); - n =drm_add_edid_modes (connector, edid); - priv->sink_has_audio =drm_detect_monitor_audio (edid); + n =drm_edid_connector_add_modes (connector); + priv->sink_has_audio = connector->display_info.has_audio;mutex_unlock (&priv->audio_mutex); -kfree (edid); +drm_edid_free (drm_edid);return n; } --
Quoted 2 lines
2.39.2
PATCH RESEND 5/6 drm/bochs: switch to struct drm_edid
In reply to Jani NikulaPrefer struct drm_edid based functions over struct edid.
---
--- drivers/gpu/drm/tiny/bochs.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/tiny/bochs.c +10 -13
@@ -85,7 +85,7 @@ struct bochs_device {u16 yres_virtual;u32 stride;u32 bpp; -struct edid *edid; +const struct drm_edid *drm_edid;/* drm */ struct drm_device *dev;
@@ -199,10 +199,10 @@ static int bochs_hw_load_edid(struct bochs_device *bochs)if (drm_edid_header_is_valid (header) !=8 )return -1 ; -kfree (bochs->edid); - bochs->edid =drm_do_get_edid (&bochs->connector, - bochs_get_edid_block, bochs); -if (bochs->edid ==NULL ) +drm_edid_free (bochs->drm_edid); + bochs->drm_edid =drm_edid_read_custom (&bochs->connector, + bochs_get_edid_block, bochs); +if (bochs->drm_edid ==NULL )return -1 ;return 0 ;
@@ -303,7 +303,7 @@ static void bochs_hw_fini(struct drm_device *dev)if (bochs->fb_map)iounmap (bochs->fb_map);pci_release_regions (to_pci_dev (dev->dev)); -kfree (bochs->edid); +drm_edid_free (bochs->drm_edid); }static void bochs_hw_blank (struct bochs_device *bochs,bool blank)
@@ -471,12 +471,9 @@ static const struct drm_simple_display_pipe_funcs bochs_pipe_funcs = {static int bochs_connector_get_modes (struct drm_connector *connector) { -struct bochs_device *bochs = - container_of(connector, struct bochs_device, connector); -int count =0 ; +int count; -if (bochs->edid) - count =drm_add_edid_modes (connector, bochs->edid); + count =drm_edid_connector_add_modes (connector);if (!count) { count =drm_add_modes_noedid (connector,8192 ,8192 );
@@ -507,10 +504,10 @@ static void bochs_connector_init(struct drm_device *dev)drm_connector_helper_add (connector, &bochs_connector_connector_helper_funcs);bochs_hw_load_edid (bochs); -if (bochs->edid) { +if (bochs->drm_edid) {DRM_INFO ("Found EDID data blob.\n" );drm_connector_attach_edid_property (connector); -drm_connector_update_edid_property (connector, bochs->edid); +drm_edid_connector_update (&bochs->connector, bochs->drm_edid); } }
Signature · 1 line
2.39.2
Re: [RESEND 5/6] drm/bochs: switch to struct drm_edid
Quoted 79 lines · Jani Nikula
Prefer struct
drm_edidbased functions over struct edid.Signed-off-by Jani Nikula <[email protected]>---
Cc Gerd Hoffmann <[email protected]>--- drivers/gpu/drm/tiny/bochs.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)drivers/gpu/drm/tiny/bochs.c +10
-14@@ -85,7 +85,7 @@ struct bochs_device {u16 yres_virtual;u32 stride;u32 bpp; -struct edid *edid; +const struct drm_edid *drm_edid;/* drm */ struct drm_device *dev;@@ -199,10 +199,10 @@ static int bochs_hw_load_edid(struct bochs_device *bochs)if (drm_edid_header_is_valid (header) !=8 )return -1 ; -kfree (bochs->edid); - bochs->edid =drm_do_get_edid (&bochs->connector, - bochs_get_edid_block, bochs); -if (bochs->edid ==NULL ) +drm_edid_free (bochs->drm_edid); + bochs->drm_edid =drm_edid_read_custom (&bochs->connector, + bochs_get_edid_block, bochs); +if (bochs->drm_edid ==NULL )return -1 ;return 0 ;@@ -303,7 +303,7 @@ static void bochs_hw_fini(struct drm_device *dev)if (bochs->fb_map)iounmap (bochs->fb_map);pci_release_regions (to_pci_dev (dev->dev)); -kfree (bochs->edid); +drm_edid_free (bochs->drm_edid); }static void bochs_hw_blank (struct bochs_device *bochs,bool blank)@@ -471,12 +471,9 @@ static const struct drm_simple_display_pipe_funcs bochs_pipe_funcs = {static int bochs_connector_get_modes (struct drm_connector *connector) { -struct bochs_device *bochs = - container_of(connector, struct bochs_device, connector); -int count =0 ; +int count; -if (bochs->edid) - count =drm_add_edid_modes (connector, bochs->edid); + count =drm_edid_connector_add_modes (connector);if (!count) { count =drm_add_modes_noedid (connector,8192 ,8192 );@@ -507,10 +504,10 @@ static void bochs_connector_init(struct drm_device *dev)drm_connector_helper_add (connector, &bochs_connector_connector_helper_funcs);bochs_hw_load_edid (bochs); -if (bochs->edid) { +if (bochs->drm_edid) {DRM_INFO ("Found EDID data blob.\n" );drm_connector_attach_edid_property (connector); -drm_connector_update_edid_property (connector, bochs->edid); +drm_edid_connector_update (&bochs->connector, bochs->drm_edid); } } --
Quoted 2 lines
2.39.2
PATCH RESEND 6/6 drm/virtio: switch to struct drm_edid
In reply to Jani NikulaPrefer struct drm_edid based functions over struct edid.
---
--- drivers/gpu/drm/virtio/virtgpu_display.c | 10 ++++------ drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- drivers/gpu/drm/virtio/virtgpu_vq.c | 12 ++++++------ 3 files changed, 11 insertions(+), 13 deletions(-)
drivers/gpu/drm/virtio/virtgpu_display.c +4 -6
@@ -164,11 +164,9 @@ static int virtio_gpu_conn_get_modes(struct drm_connector *connector)struct drm_display_mode *mode =NULL ;int count, width, height; -if (output->edid) { - count =drm_add_edid_modes (connector, output->edid); -if (count) -return count; - } + count =drm_edid_connector_add_modes (connector); +if (count) +return count; width =le32_to_cpu (output->info.r.width); height =le32_to_cpu (output->info.r.height);
@@ -369,5 +367,5 @@ void virtio_gpu_modeset_fini(struct virtio_gpu_device *vgdev)return ;for (i =0 ; i < vgdev->num_scanouts; ++i) -kfree (vgdev->outputs[i].edid); +drm_edid_free (vgdev->outputs[i].drm_edid); }
drivers/gpu/drm/virtio/virtgpu_drv.h +1 -1
@@ -179,7 +179,7 @@ struct virtio_gpu_output {struct drm_encoder enc;struct virtio_gpu_display_one info;struct virtio_gpu_update_cursor cursor; -struct edid *edid; +const struct drm_edid *drm_edid;int cur_x;int cur_y;bool needs_modeset;
drivers/gpu/drm/virtio/virtgpu_vq.c +6 -6
@@ -741,21 +741,21 @@ static void virtio_gpu_cmd_get_edid_cb(struct virtio_gpu_device *vgdev, (struct virtio_gpu_resp_edid *)vbuf->resp_buf;uint32_t scanout =le32_to_cpu (cmd->scanout);struct virtio_gpu_output *output; -struct edid *new_edid, *old_edid; +const struct drm_edid *new_edid, *old_edid;if (scanout >= vgdev->num_scanouts)return ; output = vgdev->outputs + scanout; - new_edid =drm_do_get_edid (&output->conn, virtio_get_edid_block, resp); -drm_connector_update_edid_property (&output->conn, new_edid); + new_edid =drm_edid_read_custom (&output->conn, virtio_get_edid_block, resp); +drm_edid_connector_update (&output->conn, new_edid);spin_lock (&vgdev->display_info_lock); - old_edid = output->edid; - output->edid = new_edid; + old_edid = output->drm_edid; + output->drm_edid = new_edid;spin_unlock (&vgdev->display_info_lock); -kfree (old_edid); +drm_edid_free (old_edid);wake_up (&vgdev->resp_wq); }
Signature · 1 line
2.39.2
Re: [RESEND 6/6] drm/virtio: switch to struct drm_edid
Quoted 90 lines · Jani Nikula
Prefer struct
drm_edidbased functions over struct edid.Signed-off-by Jani Nikula <[email protected]>---
Cc David Airlie <[email protected]>Cc Gerd Hoffmann <[email protected]>Cc Gurchetan Singh <[email protected]>Cc Chia-I Wu <[email protected]>--- drivers/gpu/drm/virtio/virtgpu_display.c | 10 ++++------ drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- drivers/gpu/drm/virtio/virtgpu_vq.c | 12 ++++++------ 3 files changed, 11 insertions(+), 13 deletions(-)drivers/gpu/drm/virtio/virtgpu_display.c +4
-6@@ -164,11 +164,9 @@ static int virtio_gpu_conn_get_modes(struct drm_connector *connector)struct drm_display_mode *mode =NULL ;int count, width, height; -if (output->edid) { - count =drm_add_edid_modes (connector, output->edid); -if (count) -return count; - } + count =drm_edid_connector_add_modes (connector); +if (count) +return count; width =le32_to_cpu (output->info.r.width); height =le32_to_cpu (output->info.r.height);@@ -369,5 +367,5 @@ void virtio_gpu_modeset_fini(struct virtio_gpu_device *vgdev)return ;for (i =0 ; i < vgdev->num_scanouts; ++i) -kfree (vgdev->outputs[i].edid); +drm_edid_free (vgdev->outputs[i].drm_edid); }drivers/gpu/drm/virtio/virtgpu_drv.h +1
-1@@ -179,7 +179,7 @@ struct virtio_gpu_output {struct drm_encoder enc;struct virtio_gpu_display_one info;struct virtio_gpu_update_cursor cursor; -struct edid *edid; +const struct drm_edid *drm_edid;int cur_x;int cur_y;bool needs_modeset;drivers/gpu/drm/virtio/virtgpu_vq.c +6
-7@@ -741,21 +741,21 @@ static void virtio_gpu_cmd_get_edid_cb(struct virtio_gpu_device *vgdev, (struct virtio_gpu_resp_edid *)vbuf->resp_buf;uint32_t scanout =le32_to_cpu (cmd->scanout);struct virtio_gpu_output *output; -struct edid *new_edid, *old_edid; +const struct drm_edid *new_edid, *old_edid;if (scanout >= vgdev->num_scanouts)return ; output = vgdev->outputs + scanout; - new_edid =drm_do_get_edid (&output->conn, virtio_get_edid_block, resp); -drm_connector_update_edid_property (&output->conn, new_edid); + new_edid =drm_edid_read_custom (&output->conn, virtio_get_edid_block, resp); +drm_edid_connector_update (&output->conn, new_edid);spin_lock (&vgdev->display_info_lock); - old_edid = output->edid; - output->edid = new_edid; + old_edid = output->drm_edid; + output->drm_edid = new_edid;spin_unlock (&vgdev->display_info_lock); -kfree (old_edid); +drm_edid_free (old_edid);wake_up (&vgdev->resp_wq); } --
Quoted 2 lines
2.39.2
Quoted 8 lines · Jani Nikula
Resend of the remaining patches from [1].
BR,
Jani.[1] https://lore.kernel.org/r/[email protected]
[...]
Fixed checkpatch issue in "drm/bochs: switch to struct drm_edid"
Applied, thanks!
[1/6] drm/bridge/analogix/anx6345: switch to struct drm_edid
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=37f3821c7cc8 [2/6] drm/bridge/analogix/anx78xx: switch to struct drm_edid https://cgit.freedesktop.org/drm/drm-misc/commit/?id=8aa8781ba3c1 [3/6] drm/bridge: anx7625: use struct drm_edid more https://cgit.freedesktop.org/drm/drm-misc/commit/?id=7c585f9a71aa [4/6] drm/i2c: tda998x: switch to struct drm_edid https://cgit.freedesktop.org/drm/drm-misc/commit/?id=78e90e003b96 [5/6] drm/bochs: switch to struct drm_edid https://cgit.freedesktop.org/drm/drm-misc/commit/?id=5c465601d423 [6/6] drm/virtio: switch to struct drm_edid https://cgit.freedesktop.org/drm/drm-misc/commit/?id=ac15c653fb09
Rob