From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 4/5] drm/i915/hdmi: Refactor force_audio -> has_audio coupling Date: Wed, 3 Sep 2014 10:48:36 +0200 Message-ID: <20140903084836.GI15520@phenom.ffwll.local> References: <1409684643-1569-1-git-send-email-chris@chris-wilson.co.uk> <1409684643-1569-4-git-send-email-chris@chris-wilson.co.uk> <20140902190820.GI25238@nuc-i3427.alporthouse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com [74.125.82.46]) by gabe.freedesktop.org (Postfix) with ESMTP id 454D16E321 for ; Wed, 3 Sep 2014 01:48:15 -0700 (PDT) Received: by mail-wg0-f46.google.com with SMTP id x13so8089722wgg.29 for ; Wed, 03 Sep 2014 01:48:14 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20140902190820.GI25238@nuc-i3427.alporthouse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Chris Wilson , intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Tue, Sep 02, 2014 at 08:08:20PM +0100, Chris Wilson wrote: > On Tue, Sep 02, 2014 at 08:04:02PM +0100, Chris Wilson wrote: > > The routines for deciding whether we have audio (depending upon > > force_audio and the associated EDID) are common between detection and > > set-property. Refactor the code to remove the duplication. > > > > Signed-off-by: Chris Wilson > > --- > > drivers/gpu/drm/i915/intel_hdmi.c | 60 ++++++++++++++++++--------------------- > > 1 file changed, 27 insertions(+), 33 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c > > index 3b21a769ef54..ad7b523d39a8 100644 > > --- a/drivers/gpu/drm/i915/intel_hdmi.c > > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > > @@ -976,6 +976,30 @@ intel_hdmi_unset_edid(struct drm_connector *connector) > > } > > > > static bool > > +intel_hdmi_update_audio(struct drm_connector *connector) > > +{ > > + struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); > > + struct edid *edid = to_intel_connector(connector)->detect_edid; > > + bool has_audio, has_sink; > > + bool changed = false; > > + > > + if (intel_hdmi->force_audio == HDMI_AUDIO_AUTO) > > + has_audio = drm_detect_monitor_audio(edid); > > + else > > + has_audio = intel_hdmi->force_audio == HDMI_AUDIO_ON; > > + changed |= intel_hdmi->has_audio |= has_audio; > > Oh dear, it is obviously time to give up. Aside of that I like the general direction, since we need to refactor this stuff a bit anyway to make Thomas' EDID injection work for audio. And hopefully we'll have atomic modeset this century so that we can finally ditch all that fragile "has this set_prop resulted in an actual change" logic ... Pulled in the first 3 patches from this series, thanks. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch