Hi Alvin, Thank you for the patch. On Mon, Feb 19, 2024 at 09:12:58PM +0100, Alvin Šipraga wrote: > From: Alvin Šipraga <alsi@xxxxxxxxxxxxxxx> > > In preparation for calling EDID helpers from the hotplug work, move the > hotplug work below the EDID helper section. No functional change. > > Reviewed-by: Robert Foss <rfoss@xxxxxxxxxx> > Signed-off-by: Alvin Šipraga <alsi@xxxxxxxxxxxxxxx> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 120 ++++++++++++++------------- > 1 file changed, 62 insertions(+), 58 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > index 8be235144f6d..5ffc5904bd59 100644 > --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > @@ -406,64 +406,6 @@ static void adv7511_power_off(struct adv7511 *adv7511) > * Interrupt and hotplug detection > */ > > -static bool adv7511_hpd(struct adv7511 *adv7511) > -{ > - unsigned int irq0; > - int ret; > - > - ret = regmap_read(adv7511->regmap, ADV7511_REG_INT(0), &irq0); > - if (ret < 0) > - return false; > - > - if (irq0 & ADV7511_INT0_HPD) { > - regmap_write(adv7511->regmap, ADV7511_REG_INT(0), > - ADV7511_INT0_HPD); > - return true; > - } > - > - return false; > -} > - > -static void adv7511_hpd_work(struct work_struct *work) > -{ > - struct adv7511 *adv7511 = container_of(work, struct adv7511, hpd_work); > - enum drm_connector_status status; > - unsigned int val; > - int ret; > - > - ret = regmap_read(adv7511->regmap, ADV7511_REG_STATUS, &val); > - if (ret < 0) > - status = connector_status_disconnected; > - else if (val & ADV7511_STATUS_HPD) > - status = connector_status_connected; > - else > - status = connector_status_disconnected; > - > - /* > - * The bridge resets its registers on unplug. So when we get a plug > - * event and we're already supposed to be powered, cycle the bridge to > - * restore its state. > - */ > - if (status == connector_status_connected && > - adv7511->connector.status == connector_status_disconnected && > - adv7511->powered) { > - regcache_mark_dirty(adv7511->regmap); > - adv7511_power_on(adv7511); > - } > - > - if (adv7511->connector.status != status) { > - adv7511->connector.status = status; > - > - if (adv7511->connector.dev) { > - if (status == connector_status_disconnected) > - cec_phys_addr_invalidate(adv7511->cec_adap); > - drm_kms_helper_hotplug_event(adv7511->connector.dev); > - } else { > - drm_bridge_hpd_notify(&adv7511->bridge, status); > - } > - } > -} > - > static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd) > { > unsigned int irq0, irq1; > @@ -600,6 +542,68 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block, > return 0; > } > > +/* ----------------------------------------------------------------------------- > + * Hotplug handling > + */ > + > +static bool adv7511_hpd(struct adv7511 *adv7511) > +{ > + unsigned int irq0; > + int ret; > + > + ret = regmap_read(adv7511->regmap, ADV7511_REG_INT(0), &irq0); > + if (ret < 0) > + return false; > + > + if (irq0 & ADV7511_INT0_HPD) { > + regmap_write(adv7511->regmap, ADV7511_REG_INT(0), > + ADV7511_INT0_HPD); > + return true; > + } > + > + return false; > +} > + > +static void adv7511_hpd_work(struct work_struct *work) > +{ > + struct adv7511 *adv7511 = container_of(work, struct adv7511, hpd_work); > + enum drm_connector_status status; > + unsigned int val; > + int ret; > + > + ret = regmap_read(adv7511->regmap, ADV7511_REG_STATUS, &val); > + if (ret < 0) > + status = connector_status_disconnected; > + else if (val & ADV7511_STATUS_HPD) > + status = connector_status_connected; > + else > + status = connector_status_disconnected; > + > + /* > + * The bridge resets its registers on unplug. So when we get a plug > + * event and we're already supposed to be powered, cycle the bridge to > + * restore its state. > + */ > + if (status == connector_status_connected && > + adv7511->connector.status == connector_status_disconnected && > + adv7511->powered) { > + regcache_mark_dirty(adv7511->regmap); > + adv7511_power_on(adv7511); > + } > + > + if (adv7511->connector.status != status) { > + adv7511->connector.status = status; > + > + if (adv7511->connector.dev) { > + if (status == connector_status_disconnected) > + cec_phys_addr_invalidate(adv7511->cec_adap); > + drm_kms_helper_hotplug_event(adv7511->connector.dev); > + } else { > + drm_bridge_hpd_notify(&adv7511->bridge, status); > + } > + } > +} > + > /* ----------------------------------------------------------------------------- > * ADV75xx helpers > */ -- Regards, Laurent Pinchart