Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756513AbcKVSxz (ORCPT ); Tue, 22 Nov 2016 13:53:55 -0500 Received: from mail-oi0-f41.google.com ([209.85.218.41]:35515 "EHLO mail-oi0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751288AbcKVSxx (ORCPT ); Tue, 22 Nov 2016 13:53:53 -0500 MIME-Version: 1.0 In-Reply-To: <3450618.hbnl5lRf5h@avalon> References: <1479775052-28194-1-git-send-email-john.stultz@linaro.org> <3450618.hbnl5lRf5h@avalon> From: John Stultz Date: Tue, 22 Nov 2016 10:53:52 -0800 Message-ID: Subject: Re: [RFC][PATCH 2/3] drm/bridge: adv7511: Add 200ms delay on power-on To: Laurent Pinchart Cc: lkml , David Airlie , Archit Taneja , Wolfram Sang , Lars-Peter Clausen , "dri-devel@lists.freedesktop.org" , Daniel Vetter Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3595 Lines: 82 On Tue, Nov 22, 2016 at 10:23 AM, Laurent Pinchart wrote: > On Tuesday 22 Nov 2016 10:07:53 John Stultz wrote: >> On Tue, Nov 22, 2016 at 9:38 AM, John Stultz wrote: >> > Interestingly, without the msleep added in this patch, removing the >> > wait_event_interruptible_timeout() method in adv7511_wait_for_edid() >> > and using the polling loop seems to make things just as reliable. So >> > maybe something is off with the irq handling here instead? >> >> Ahhhh.. So I think the trouble here is the that when we fail waiting >> for the irq, the backtrace is as follows: >> >> [ 8.318654] [] dump_backtrace+0x0/0x1a0 >> [ 8.318661] [] show_stack+0x14/0x20 >> [ 8.318671] [] dump_stack+0x90/0xb0 >> [ 8.318680] [] adv7511_get_edid_block+0x2c8/0x320 >> [ 8.318687] [] drm_do_get_edid+0x78/0x280 >> [ 8.318693] [] adv7511_get_modes+0x80/0xd8 >> [ 8.318700] [] adv7511_connector_get_modes+0x14/0x20 >> [ 8.318710] [] >> drm_helper_probe_single_connector_modes+0x2bc/0x500 >> [ 8.318718] [] drm_fb_helper_hotplug_event+0x130/0x188 >> [ 8.318726] [] drm_fbdev_cma_hotplug_event+0x10/0x20 >> [ 8.318733] [] >> kirin_fbdev_output_poll_changed+0x20/0x58 >> [ 8.318740] [] drm_kms_helper_hotplug_event+0x28/0x38 >> [ 8.318748] [] drm_helper_hpd_irq_event+0x138/0x180 >> [ 8.318754] [] adv7511_irq_process+0x78/0xd8 >> [ 8.318761] [] adv7511_irq_handler+0x14/0x28 >> [ 8.318769] [] irq_thread_fn+0x28/0x68 >> [ 8.318775] [] irq_thread+0x128/0x1e8 >> [ 8.318782] [] kthread+0xd0/0xe8 >> [ 8.318788] [] ret_from_fork+0x10/0x50 >> >> So we're actually in irq handling the hotplug interrupt, which is why >> we never get the irq notification when the edid is read. >> >> I suspect we need to use a workqueue to do the hotplug handling out of irq. So yea, using schedule_work on a work_struct to defer the hotplug handling seems to solve this issue. Thanks again for pushing back on the msleep approach. :) > Lovely :-) > > Quoting the DRM documentation: > > /** > * drm_helper_hpd_irq_event - hotplug processing > * @dev: drm_device > * > * Drivers can use this helper function to run a detect cycle on all > connectors > * which have the DRM_CONNECTOR_POLL_HPD flag set in their &polled member. All > * other connectors are ignored, which is useful to avoid reprobing fixed > * panels. > * > * This helper function is useful for drivers which can't or don't track > hotplug > * interrupts for each connector. > * > * Drivers which support hotplug interrupts for each connector individually > and > * which have a more fine-grained detect logic should bypass this code and > * directly call drm_kms_helper_hotplug_event() in case the connector state > * changed. > * > * This function must be called from process context with no mode > * setting locks held. > * > * Note that a connector can be both polled and probed from the hotplug > handler, > * in case the hotplug interrupt is known to be unreliable. > */ > > So it looks like we should use drm_kms_helper_hotplug_event() instead. Ok. I'll switch to this in my patch set as well. It doesn't seem to have any behavioral effect that I can see right off. thanks -john