drm/ast: Connector cleanups and polling
Subsystems (3)
Thomas Zimmermann
maintainerv3 cover drm/ast: Connector cleanups and polling
Various cleanups to ast's connector code. Simplifies the code, adds support for using VGA and ASTDP connectors at the same time, and initializes polling of the connector status.
Patch 1 was first posted at [1], so this patchset starts at version
2. The implementation of detect_ctx in patch 3 has been added to DRM helpers as it will be useful for other drivers, such as mgag200 and udl.
v3:
* clarify docs for .detext_ctx helper (Patrik)
* use macros for TX-chip BITS() (Patrik)
Thomas Zimmermann (5):
drm/ast: Support multiple outputs
drm/ast: Fix updating the connector's EDID property drm/ast: Support output polling
drm/ast: Fail probing if DCC channel could not be initialized drm/ast: Remove struct ast_{vga,sil164}_connector
drivers/gpu/drm/ast/ast_dp.c | 5 +- drivers/gpu/drm/ast/ast_dp501.c | 2 +- drivers/gpu/drm/ast/ast_drv.h | 35 ++---- drivers/gpu/drm/ast/ast_i2c.c | 7 +- drivers/gpu/drm/ast/ast_main.c | 21 ++-- drivers/gpu/drm/ast/ast_mode.c | 165 ++++++++++------------------- drivers/gpu/drm/ast/ast_post.c | 2 +- drivers/gpu/drm/drm_probe_helper.c | 40 +++++++ include/drm/drm_probe_helper.h | 3 + 9 files changed, 126 insertions(+), 154 deletions(-)
base-commit: 6034ccb11971698ace6b3af2f6ac02de120a2dc2
Signature · 1 line
2.36.1
Thomas Zimmermann
maintainerPATCH v3 1/5 drm/ast: Support multiple outputs
Systems with AST graphics can have multiple output; typically VGA plus some other port. Record detected output chips in a bitmask and initialize each output on its own.
Assume a VGA output by default and use SIL164 and DP501 if available. For ASTDP assume that it can run in parallel with VGA.
Tested on AST2100.
v3:
* define a macro for each BIT(ast_tx_chip) (Patrik)
v2:
* make VGA/SIL164/DP501 mutually exclusive
--- drivers/gpu/drm/ast/ast_dp.c | 5 ++--- drivers/gpu/drm/ast/ast_dp501.c | 2 +- drivers/gpu/drm/ast/ast_drv.h | 9 ++++++-- drivers/gpu/drm/ast/ast_main.c | 21 ++++++++---------- drivers/gpu/drm/ast/ast_mode.c | 38 ++++++++++++++++++--------------- drivers/gpu/drm/ast/ast_post.c | 2 +- 6 files changed, 41 insertions(+), 36 deletions(-)
drivers/gpu/drm/ast/ast_dp.c +2 -3
@@ -160,13 +160,12 @@ void ast_dp_launch(struct drm_device *dev, u8 bPower) }if (bDPExecute) - ast->tx_chip_type =AST_TX_ASTDP ; + ast->tx_chip_types |=BIT (AST_TX_ASTDP );ast_set_index_reg_mask (ast,AST_IO_CRTC_PORT ,0xE5 , (u8 ) ~ASTDP_HOST_EDID_READ_DONE_MASK ,ASTDP_HOST_EDID_READ_DONE ); - }else - ast->tx_chip_type =AST_TX_NONE ; + } }
drivers/gpu/drm/ast/ast_dp501.c +1 -1
@@ -450,7 +450,7 @@ void ast_init_3rdtx(struct drm_device *dev)ast_init_dvo (dev);break ;default : -if (ast->tx_chip_type ==AST_TX_SIL164 ) +if (ast->tx_chip_types &BIT (AST_TX_SIL164 ))ast_init_dvo (dev);else ast_init_analog (dev);
drivers/gpu/drm/ast/ast_drv.h +7 -2
@@ -73,6 +73,11 @@ enum ast_tx_chip { AST_TX_ASTDP, }; +#define AST_TX_NONE_BIT BIT(AST_TX_NONE) +#define AST_TX_SIL164_BIT BIT(AST_TX_SIL164) +#define AST_TX_DP501_BIT BIT(AST_TX_DP501) +#define AST_TX_ASTDP_BIT BIT(AST_TX_ASTDP) +#define AST_DRAM_512Mx16 0#define AST_DRAM_1Gx16 1#define AST_DRAM_512Mx32 2
@@ -173,7 +178,7 @@ struct ast_private {struct drm_plane primary_plane;struct ast_cursor_plane cursor_plane;struct drm_crtc crtc; - union { + struct { struct { struct drm_encoder encoder; struct ast_vga_connector vga_connector;
@@ -199,7 +204,7 @@ struct ast_private { ast_use_defaults } config_mode; -enum ast_tx_chip tx_chip_type; +unsigned long tx_chip_types;/* bitfield of enum ast_chip_type */ u8 *dp501_fw_addr;const struct firmware *dp501_fw;/* dp501 fw */ };
drivers/gpu/drm/ast/ast_main.c +9 -12
@@ -216,7 +216,7 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) }/* Check 3rd Tx option (digital output afaik) */ - ast->tx_chip_type =AST_TX_NONE ; + ast->tx_chip_types |=AST_TX_NONE_BIT ;/* * VGACRA3 Enhanced Color Mode Register, check if DVO is already
@@ -229,7 +229,7 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post)if (!*need_post) { jreg =ast_get_index_reg_mask (ast,AST_IO_CRTC_PORT ,0xa3 ,0xff );if (jreg &0x80 ) - ast->tx_chip_type =AST_TX_SIL164 ; + ast->tx_chip_types =AST_TX_SIL164_BIT ; }if ((ast->chip ==AST2300 ) || (ast->chip ==AST2400 ) || (ast->chip ==AST2500 )) {
@@ -241,7 +241,7 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) jreg =ast_get_index_reg_mask (ast,AST_IO_CRTC_PORT ,0xd1 ,0xff );switch (jreg) {case 0x04 : - ast->tx_chip_type =AST_TX_SIL164 ; + ast->tx_chip_types =AST_TX_SIL164_BIT ;break ;case 0x08 : ast->dp501_fw_addr =drmm_kzalloc (dev,32 *1024 ,GFP_KERNEL );
@@ -254,22 +254,19 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post) } fallthrough;case 0x0c : - ast->tx_chip_type =AST_TX_DP501 ; + ast->tx_chip_types =AST_TX_DP501_BIT ; } }else if (ast->chip ==AST2600 )ast_dp_launch (&ast->base,0 );/* Print stuff for diagnostic purposes */ -switch (ast->tx_chip_type) { -case AST_TX_SIL164 : +if (ast->tx_chip_types &AST_TX_NONE_BIT ) +drm_info (dev,"Using analog VGA\n" ); +if (ast->tx_chip_types &AST_TX_SIL164_BIT )drm_info (dev,"Using Sil164 TMDS transmitter\n" ); -break ; -case AST_TX_DP501 : +if (ast->tx_chip_types &AST_TX_DP501_BIT )drm_info (dev,"Using DP501 DisplayPort transmitter\n" ); -break ; -default : -drm_info (dev,"Analog VGA only\n" ); - } +return 0 ; }
drivers/gpu/drm/ast/ast_mode.c +21 -17
@@ -997,10 +997,10 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)case DRM_MODE_DPMS_ON :ast_set_index_reg_mask (ast,AST_IO_SEQ_PORT ,0x01 ,0xdf ,0 );ast_set_index_reg_mask (ast,AST_IO_CRTC_PORT ,0xb6 ,0xfc ,0 ); -if (ast->tx_chip_type ==AST_TX_DP501 ) +if (ast->tx_chip_types &AST_TX_DP501_BIT )ast_set_dp501_video_output (crtc->dev,1 ); -if (ast->tx_chip_type ==AST_TX_ASTDP ) { +if (ast->tx_chip_types &AST_TX_ASTDP_BIT ) {ast_dp_power_on_off (crtc->dev,AST_DP_POWER_ON );ast_wait_for_vretrace (ast);ast_dp_set_on_off (crtc->dev,1 );
@@ -1012,17 +1012,17 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)case DRM_MODE_DPMS_SUSPEND :case DRM_MODE_DPMS_OFF : ch = mode; -if (ast->tx_chip_type ==AST_TX_DP501 ) +if (ast->tx_chip_types &AST_TX_DP501_BIT )ast_set_dp501_video_output (crtc->dev,0 ); -break ; -if (ast->tx_chip_type ==AST_TX_ASTDP ) { +if (ast->tx_chip_types &AST_TX_ASTDP_BIT ) {ast_dp_set_on_off (crtc->dev,0 );ast_dp_power_on_off (crtc->dev,AST_DP_POWER_OFF ); }ast_set_index_reg_mask (ast,AST_IO_SEQ_PORT ,0x01 ,0xdf ,0x20 );ast_set_index_reg_mask (ast,AST_IO_CRTC_PORT ,0xb6 ,0xfc , ch); +break ; } }
@@ -1155,7 +1155,7 @@ ast_crtc_helper_atomic_flush(struct drm_crtc *crtc,ast_crtc_load_lut (ast, crtc);//Set Aspeed Display-Port -if (ast->tx_chip_type ==AST_TX_ASTDP ) +if (ast->tx_chip_types &AST_TX_ASTDP_BIT )ast_dp_set_mode (crtc, vbios_mode_info);mutex_unlock (&ast->ioregs_lock);
@@ -1739,22 +1739,26 @@ int ast_mode_config_init(struct ast_private *ast)ast_crtc_init (dev); -switch (ast->tx_chip_type) { -case AST_TX_NONE : +if (ast->tx_chip_types &AST_TX_NONE_BIT ) { ret =ast_vga_output_init (ast); -break ; -case AST_TX_SIL164 : +if (ret) +return ret; + } +if (ast->tx_chip_types &AST_TX_SIL164_BIT ) { ret =ast_sil164_output_init (ast); -break ; -case AST_TX_DP501 : +if (ret) +return ret; + } +if (ast->tx_chip_types &AST_TX_DP501_BIT ) { ret =ast_dp501_output_init (ast); -break ; -case AST_TX_ASTDP : +if (ret) +return ret; + } +if (ast->tx_chip_types &AST_TX_ASTDP_BIT ) { ret =ast_astdp_output_init (ast); -break ; +if (ret) +return ret; } -if (ret) -return ret;drm_mode_config_reset (dev);
drivers/gpu/drm/ast/ast_post.c +1 -1
@@ -391,7 +391,7 @@ void ast_post_gpu(struct drm_device *dev)ast_init_3rdtx (dev); }else { -if (ast->tx_chip_type !=AST_TX_NONE ) +if (ast->tx_chip_types &AST_TX_SIL164_BIT )ast_set_index_reg_mask (ast,AST_IO_CRTC_PORT ,0xa3 ,0xcf ,0x80 );/* Enable DVO */ } }
Signature · 1 line
2.36.1
Thomas Zimmermann
maintainerPATCH v3 2/5 drm/ast: Fix updating the connector's EDID property
In reply to Thomas ZimmermannRead the display modes from the connectors DDC helper, which also updates the connector's EDID property. The code for the connector's .get_modes helper is now shared between VGA and SIL164.
--- drivers/gpu/drm/ast/ast_mode.c | 57 ++-------------------------------- 1 file changed, 2 insertions(+), 55 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +2 -55
@@ -1302,37 +1302,19 @@ static int ast_crtc_init(struct drm_device *dev)static int ast_vga_connector_helper_get_modes (struct drm_connector *connector) { -struct ast_vga_connector *ast_vga_connector =to_ast_vga_connector (connector);struct drm_device *dev = connector->dev;struct ast_private *ast =to_ast_private (dev); -struct edid *edid;int count; -if (!ast_vga_connector->i2c) - goto err_drm_connector_update_edid_property; -/* * Protect access to I/O registers from concurrent modesetting * by acquiring the I/O-register lock. */ mutex_lock (&ast->ioregs_lock); - - edid =drm_get_edid (connector, &ast_vga_connector->i2c->adapter); -if (!edid) - goto err_mutex_unlock; - + count =drm_connector_helper_get_modes_from_ddc (connector);mutex_unlock (&ast->ioregs_lock); - count =drm_add_edid_modes (connector, edid); -kfree (edid); -return count; - -err_mutex_unlock: -mutex_unlock (&ast->ioregs_lock); -err_drm_connector_update_edid_property: -drm_connector_update_edid_property (connector,NULL ); -return 0 ; }static const struct drm_connector_helper_funcs ast_vga_connector_helper_funcs = {
@@ -1406,43 +1388,8 @@ static int ast_vga_output_init(struct ast_private *ast)* SIL164 Connector */ -static int ast_sil164_connector_helper_get_modes (struct drm_connector *connector) -{ -struct ast_sil164_connector *ast_sil164_connector =to_ast_sil164_connector (connector); -struct drm_device *dev = connector->dev; -struct ast_private *ast =to_ast_private (dev); -struct edid *edid; -int count; - -if (!ast_sil164_connector->i2c) - goto err_drm_connector_update_edid_property; - -/* -* Protect access to I/O registers from concurrent modesetting -* by acquiring the I/O-register lock. -*/ -mutex_lock (&ast->ioregs_lock); - - edid =drm_get_edid (connector, &ast_sil164_connector->i2c->adapter); -if (!edid) - goto err_mutex_unlock; - -mutex_unlock (&ast->ioregs_lock); - - count =drm_add_edid_modes (connector, edid); -kfree (edid); - -return count; - -err_mutex_unlock: -mutex_unlock (&ast->ioregs_lock); -err_drm_connector_update_edid_property: -drm_connector_update_edid_property (connector,NULL ); -return 0 ; -} -static const struct drm_connector_helper_funcs ast_sil164_connector_helper_funcs = { - .get_modes = ast_sil164_connector_helper_get_modes, + .get_modes = ast_vga_connector_helper_get_modes,// same as VGA connector };static const struct drm_connector_funcs ast_sil164_connector_funcs = {
Signature · 1 line
2.36.1
Thomas Zimmermann
maintainerPATCH v3 3/5 drm/ast: Support output polling
In reply to Thomas ZimmermannEnable output polling for all connectors. VGA always uses EDID for this. As there's currently no interrupt handling for the ast devices, we have to use that trick for the various DP and DVI ports as well.
v3:
* clearly state in the docs that the EDID needs to be updated on each call to .detect_ctx (Patrik)
--- drivers/gpu/drm/ast/ast_mode.c | 14 ++++++++--- drivers/gpu/drm/drm_probe_helper.c | 40 ++++++++++++++++++++++++++++++ include/drm/drm_probe_helper.h | 3 +++ 3 files changed, 53 insertions(+), 4 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +10 -4
@@ -1319,6 +1319,7 @@ static int ast_vga_connector_helper_get_modes(struct drm_connector *connector)static const struct drm_connector_helper_funcs ast_vga_connector_helper_funcs = { .get_modes = ast_vga_connector_helper_get_modes, + .detect_ctx = drm_connector_helper_detect_ctx_from_edid, };static const struct drm_connector_funcs ast_vga_connector_funcs = {
@@ -1354,7 +1355,7 @@ static int ast_vga_connector_init(struct drm_device *dev, connector->interlace_allowed =0 ; connector->doublescan_allowed =0 ; - connector->polled =DRM_CONNECTOR_POLL_CONNECT ; + connector->polled =DRM_CONNECTOR_POLL_CONNECT |DRM_CONNECTOR_POLL_DISCONNECT ;return 0 ; }
@@ -1390,6 +1391,7 @@ static int ast_vga_output_init(struct ast_private *ast)static const struct drm_connector_helper_funcs ast_sil164_connector_helper_funcs = { .get_modes = ast_vga_connector_helper_get_modes,// same as VGA connector + .detect_ctx = drm_connector_helper_detect_ctx_from_edid, };static const struct drm_connector_funcs ast_sil164_connector_funcs = {
@@ -1425,7 +1427,7 @@ static int ast_sil164_connector_init(struct drm_device *dev, connector->interlace_allowed =0 ; connector->doublescan_allowed =0 ; - connector->polled =DRM_CONNECTOR_POLL_CONNECT ; + connector->polled =DRM_CONNECTOR_POLL_CONNECT |DRM_CONNECTOR_POLL_DISCONNECT ;return 0 ; }
@@ -1488,6 +1490,7 @@ static int ast_dp501_connector_helper_get_modes(struct drm_connector *connector)static const struct drm_connector_helper_funcs ast_dp501_connector_helper_funcs = { .get_modes = ast_dp501_connector_helper_get_modes, + .detect_ctx = drm_connector_helper_detect_ctx_from_edid, };static const struct drm_connector_funcs ast_dp501_connector_funcs = {
@@ -1512,7 +1515,7 @@ static int ast_dp501_connector_init(struct drm_device *dev, struct drm_connector connector->interlace_allowed =0 ; connector->doublescan_allowed =0 ; - connector->polled =DRM_CONNECTOR_POLL_CONNECT ; + connector->polled =DRM_CONNECTOR_POLL_CONNECT |DRM_CONNECTOR_POLL_DISCONNECT ;return 0 ; }
@@ -1575,6 +1578,7 @@ static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector)static const struct drm_connector_helper_funcs ast_astdp_connector_helper_funcs = { .get_modes = ast_astdp_connector_helper_get_modes, + .detect_ctx = drm_connector_helper_detect_ctx_from_edid, };static const struct drm_connector_funcs ast_astdp_connector_funcs = {
@@ -1599,7 +1603,7 @@ static int ast_astdp_connector_init(struct drm_device *dev, struct drm_connector connector->interlace_allowed =0 ; connector->doublescan_allowed =0 ; - connector->polled =DRM_CONNECTOR_POLL_CONNECT ; + connector->polled =DRM_CONNECTOR_POLL_CONNECT |DRM_CONNECTOR_POLL_DISCONNECT ;return 0 ; }
@@ -1709,5 +1713,7 @@ int ast_mode_config_init(struct ast_private *ast)drm_mode_config_reset (dev); +drm_kms_helper_poll_init (dev); +return 0 ; }
drivers/gpu/drm/drm_probe_helper.c +40 -0
@@ -1031,3 +1031,43 @@ int drm_connector_helper_get_modes_from_ddc(struct drm_connector *connector)return count; }EXPORT_SYMBOL (drm_connector_helper_get_modes_from_ddc); + +/** +* drm_connector_helper_detect_ctx_from_edid - +* Updates the connector's status by reading EDID data +* @connector: The connector. +* @ctx: The lock-acquisition context. +* @force: True if the operation was requested by userspace, false otherwise. +* +* Returns: +* The connector's status as enum drm_connector_status. +* +* Updates the connector's EDID property by reading the display modes +* and returns the connector's status. If the EDID property is set, the +* connector is assumed to be connected; and disconnected otherwise. +* The function relies on the get_modes helper to update the EDID +* information on each call. If the EDID data has been cached or provided +* at the kernel's command-line the connector-state detection is +* unreliable. +* +* If the get_modes helper is missing, the default status is 'unknown'. +* +* See struct drm_connector_helper_funcs.detect_ctx. +*/ +int drm_connector_helper_detect_ctx_from_edid (struct drm_connector *connector, +struct drm_modeset_acquire_ctx *ctx, +bool force) +{ +const struct drm_connector_helper_funcs *helper_funcs = connector->helper_private; + +if (!helper_funcs || !helper_funcs->get_modes) +return connector_status_unknown; + + helper_funcs->get_modes (connector); + +if (!connector->edid_blob_ptr) +return connector_status_disconnected; + +return connector_status_connected; +} +EXPORT_SYMBOL (drm_connector_helper_detect_ctx_from_edid);
include/drm/drm_probe_helper.h +3 -0
@@ -27,5 +27,8 @@ void drm_kms_helper_poll_enable(struct drm_device *dev);bool drm_kms_helper_is_poll_worker (void );int drm_connector_helper_get_modes_from_ddc (struct drm_connector *connector); +int drm_connector_helper_detect_ctx_from_edid (struct drm_connector *connector, +struct drm_modeset_acquire_ctx *ctx, +bool force);#endif
Signature · 1 line
2.36.1
Thomas Zimmermann
maintainerPATCH v3 4/5 drm/ast: Fail probing if DCC channel could not be initialized
In reply to Thomas ZimmermannExpect the hardware to provide a DDC channel. Fail probing if its initialization fails.
--- drivers/gpu/drm/ast/ast_drv.h | 2 -- drivers/gpu/drm/ast/ast_i2c.c | 7 ++++--- drivers/gpu/drm/ast/ast_mode.c | 38 ++++++++++++++++------------------ 3 files changed, 22 insertions(+), 25 deletions(-)
drivers/gpu/drm/ast/ast_drv.h +0 -2
@@ -137,7 +137,6 @@ struct ast_i2c_chan {struct ast_vga_connector {struct drm_connector base; -struct ast_i2c_chan *i2c; }; static inline struct ast_vga_connector *
@@ -148,7 +147,6 @@ to_ast_vga_connector(struct drm_connector *connector)struct ast_sil164_connector {struct drm_connector base; -struct ast_i2c_chan *i2c; }; static inline struct ast_sil164_connector *
drivers/gpu/drm/ast/ast_i2c.c +4 -3
@@ -117,7 +117,7 @@ struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev) i2c =kzalloc (sizeof (struct ast_i2c_chan ),GFP_KERNEL );if (!i2c) -return NULL ; +return ERR_PTR (-ENOMEM ); i2c->adapter.owner =THIS_MODULE ; i2c->adapter.class =I2C_CLASS_DDC ;
@@ -143,10 +143,11 @@ struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev) ret =drmm_add_action_or_reset (dev, ast_i2c_release, i2c);if (ret) -return NULL ; +return ERR_PTR (ret); +return i2c; out_kfree:kfree (i2c); -return NULL ; +return ERR_PTR (ret); }
drivers/gpu/drm/ast/ast_mode.c +18 -20
@@ -1334,19 +1334,18 @@ static int ast_vga_connector_init(struct drm_device *dev, struct ast_vga_connector *ast_vga_connector) {struct drm_connector *connector = &ast_vga_connector->base; +struct ast_i2c_chan *i2c;int ret; - ast_vga_connector->i2c =ast_i2c_create (dev); -if (!ast_vga_connector->i2c) -drm_err (dev,"failed to add ddc bus for connector\n" ); + i2c =ast_i2c_create (dev); +if (IS_ERR (i2c)) { + ret =PTR_ERR (i2c); +drm_err (dev,"failed to add ddc bus for connector; ret=%d\n" , ret); +return ret; + } -if (ast_vga_connector->i2c) - ret =drm_connector_init_with_ddc (dev, connector, &ast_vga_connector_funcs, -DRM_MODE_CONNECTOR_VGA , - &ast_vga_connector->i2c->adapter); -else - ret =drm_connector_init (dev, connector, &ast_vga_connector_funcs, -DRM_MODE_CONNECTOR_VGA ); + ret =drm_connector_init_with_ddc (dev, connector, &ast_vga_connector_funcs, +DRM_MODE_CONNECTOR_VGA , &i2c->adapter);if (ret)return ret;
@@ -1406,19 +1405,18 @@ static int ast_sil164_connector_init(struct drm_device *dev, struct ast_sil164_connector *ast_sil164_connector) {struct drm_connector *connector = &ast_sil164_connector->base; +struct ast_i2c_chan *i2c;int ret; - ast_sil164_connector->i2c =ast_i2c_create (dev); -if (!ast_sil164_connector->i2c) -drm_err (dev,"failed to add ddc bus for connector\n" ); + i2c =ast_i2c_create (dev); +if (IS_ERR (i2c)) { + ret =PTR_ERR (i2c); +drm_err (dev,"failed to add ddc bus for connector; ret=%d\n" , ret); +return ret; + } -if (ast_sil164_connector->i2c) - ret =drm_connector_init_with_ddc (dev, connector, &ast_sil164_connector_funcs, -DRM_MODE_CONNECTOR_DVII , - &ast_sil164_connector->i2c->adapter); -else - ret =drm_connector_init (dev, connector, &ast_sil164_connector_funcs, -DRM_MODE_CONNECTOR_DVII ); + ret =drm_connector_init_with_ddc (dev, connector, &ast_sil164_connector_funcs, +DRM_MODE_CONNECTOR_DVII , &i2c->adapter);if (ret)return ret;
Signature · 1 line
2.36.1
Thomas Zimmermann
maintainerPATCH v3 5/5 drm/ast: Remove struct ast_{vga,sil164}_connector
In reply to Thomas ZimmermannBoth, struct ast_vga_connector and struct ast_sil164_connector, are now wrappers around struct drm_connector. Remove them.
--- drivers/gpu/drm/ast/ast_drv.h | 24 ++---------------------- drivers/gpu/drm/ast/ast_mode.c | 18 ++++++------------ 2 files changed, 8 insertions(+), 34 deletions(-)
drivers/gpu/drm/ast/ast_drv.h +2 -22
@@ -135,26 +135,6 @@ struct ast_i2c_chan {struct i2c_algo_bit_data bit; }; -struct ast_vga_connector { -struct drm_connector base; -}; - -static inline struct ast_vga_connector * -to_ast_vga_connector (struct drm_connector *connector) -{ - return container_of(connector, struct ast_vga_connector, base); -} - -struct ast_sil164_connector { -struct drm_connector base; -}; - -static inline struct ast_sil164_connector * -to_ast_sil164_connector (struct drm_connector *connector) -{ - return container_of(connector, struct ast_sil164_connector, base); -} -/* * Device */
@@ -179,11 +159,11 @@ struct ast_private {struct {struct {struct drm_encoder encoder; -struct ast_vga_connector vga_connector; +struct drm_connector connector; } vga;struct {struct drm_encoder encoder; -struct ast_sil164_connector sil164_connector; +struct drm_connector connector; } sil164;struct {struct drm_encoder encoder;
drivers/gpu/drm/ast/ast_mode.c +6 -12
@@ -1330,10 +1330,8 @@ static const struct drm_connector_funcs ast_vga_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static int ast_vga_connector_init (struct drm_device *dev, -struct ast_vga_connector *ast_vga_connector) +static int ast_vga_connector_init (struct drm_device *dev,struct drm_connector *connector) { -struct drm_connector *connector = &ast_vga_connector->base;struct ast_i2c_chan *i2c;int ret;
@@ -1364,8 +1362,7 @@ static int ast_vga_output_init(struct ast_private *ast)struct drm_device *dev = &ast->base;struct drm_crtc *crtc = &ast->crtc;struct drm_encoder *encoder = &ast->output.vga.encoder; -struct ast_vga_connector *ast_vga_connector = &ast->output.vga.vga_connector; -struct drm_connector *connector = &ast_vga_connector->base; +struct drm_connector *connector = &ast->output.vga.connector;int ret; ret =drm_simple_encoder_init (dev, encoder,DRM_MODE_ENCODER_DAC );
@@ -1373,7 +1370,7 @@ static int ast_vga_output_init(struct ast_private *ast)return ret; encoder->possible_crtcs =drm_crtc_mask (crtc); - ret =ast_vga_connector_init (dev, ast_vga_connector); + ret =ast_vga_connector_init (dev, connector);if (ret)return ret;
@@ -1401,10 +1398,8 @@ static const struct drm_connector_funcs ast_sil164_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static int ast_sil164_connector_init (struct drm_device *dev, -struct ast_sil164_connector *ast_sil164_connector) +static int ast_sil164_connector_init (struct drm_device *dev,struct drm_connector *connector) { -struct drm_connector *connector = &ast_sil164_connector->base;struct ast_i2c_chan *i2c;int ret;
@@ -1435,8 +1430,7 @@ static int ast_sil164_output_init(struct ast_private *ast)struct drm_device *dev = &ast->base;struct drm_crtc *crtc = &ast->crtc;struct drm_encoder *encoder = &ast->output.sil164.encoder; -struct ast_sil164_connector *ast_sil164_connector = &ast->output.sil164.sil164_connector; -struct drm_connector *connector = &ast_sil164_connector->base; +struct drm_connector *connector = &ast->output.sil164.connector;int ret; ret =drm_simple_encoder_init (dev, encoder,DRM_MODE_ENCODER_TMDS );
@@ -1444,7 +1438,7 @@ static int ast_sil164_output_init(struct ast_private *ast)return ret; encoder->possible_crtcs =drm_crtc_mask (crtc); - ret =ast_sil164_connector_init (dev, ast_sil164_connector); + ret =ast_sil164_connector_init (dev, connector);if (ret)return ret;
Signature · 1 line
2.36.1