From patchwork Tue Nov 29 05:04:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9450953 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E62A66074E for ; Tue, 29 Nov 2016 05:05:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC45A201BD for ; Tue, 29 Nov 2016 05:05:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFC4327F46; Tue, 29 Nov 2016 05:05:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 88C7D201BD for ; Tue, 29 Nov 2016 05:05:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A5F5A6E51F; Tue, 29 Nov 2016 05:05:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x233.google.com (mail-pf0-x233.google.com [IPv6:2607:f8b0:400e:c00::233]) by gabe.freedesktop.org (Postfix) with ESMTPS id 53B186E359 for ; Tue, 29 Nov 2016 05:04:57 +0000 (UTC) Received: by mail-pf0-x233.google.com with SMTP id c4so29441977pfb.1 for ; Mon, 28 Nov 2016 21:04:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=g6thxLD1rm8EvWnIhbFRLoCnMwritJGcdBDB7vUgTFA=; b=HIuXr7rDuxfosq9UlmVwM8XDbTMHvvevI5U1NlF2MteME6FXYgqu/Ey5Kzwd+O/Vvv TjF/MMezVsM76b+z4+GORy4cnmm8hKTFpgJotllqK6VNHlVJpSv/jz5nB6nnavGT5RhH sa2A5sjb1iIhw9ZG+j8cJ/tNVIL4EgKftjB3I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=g6thxLD1rm8EvWnIhbFRLoCnMwritJGcdBDB7vUgTFA=; b=kh4zOqGQWVdGCIGcvwiC9IV84A9x5GePRZPaCcl157T3AfidHUJiBajjLRQNXopL2E lyoT/AYh8zA4FBnMDR9t01sS7AZ7/WUbEthO4tGfg8XxhQiGbO4KCHkQIVUuVsKoTTys F0FdDUUaOeOXoGLHiRvvtrpVKkQ9m+obL/FsGJIdllWMPJv0MvpFd8SttNvPLwPtBV97 F25uZd+58RZ8Y3V50TvdOyV/eFbY1St6MDUYP73gMjVhz91qgLyReWCoR1Ip2IrLBo6Z CvNB0QmHtn/IrokMMqoLOsbb1xHbm2ZumUGadN9vl0mQ+JGNZkGcVwbychpj02QLNySC gG5w== X-Gm-Message-State: AKaTC02nraAFijjZvd0q6M39tWHDLO7hz8pJnUp4b39s0Zi6q2+Tl0AuxNjKqM6iJis0k79y X-Received: by 10.84.218.7 with SMTP id q7mr57829758pli.18.1480395896762; Mon, 28 Nov 2016 21:04:56 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id b29sm73191498pgn.48.2016.11.28.21.04.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Nov 2016 21:04:56 -0800 (PST) From: John Stultz To: lkml Subject: [RFC][PATCH 5/5 v2] drm/bridge: adv7511: Reuse __adv7511_power_on/off() when probing EDID Date: Mon, 28 Nov 2016 21:04:44 -0800 Message-Id: <1480395884-5471-6-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480395884-5471-1-git-send-email-john.stultz@linaro.org> References: <1480395884-5471-1-git-send-email-john.stultz@linaro.org> Cc: dri-devel@lists.freedesktop.org, Wolfram Sang , Laurent Pinchart X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP I've found that by just turning the chip on and off via the POWER_DOWN register, I end up getting i2c_transfer errors on HiKey. Investigating further, it seems some of the register state in the regmap cache is somehow getting lost. Using the logic in __adv7511_power_on/off() which syncs and dirtys the cache avoids this issue. Thus this patch changes the EDID probing logic so that we re-use the __adv7511_power_on/off() calls. Cc: David Airlie Cc: Archit Taneja Cc: Wolfram Sang Cc: Lars-Peter Clausen Cc: Laurent Pinchart Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz --- v2: Split into two patches to make the change more clear. Also provided more rational as to why the change is important. drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 1948968..487b33d 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -559,24 +559,13 @@ static int adv7511_get_modes(struct adv7511 *adv7511, unsigned int count; /* Reading the EDID only works if the device is powered */ - if (!adv7511->powered) { - regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER, - ADV7511_POWER_POWER_DOWN, 0); - if (adv7511->i2c_main->irq) { - regmap_write(adv7511->regmap, ADV7511_REG_INT_ENABLE(0), - ADV7511_INT0_EDID_READY); - regmap_write(adv7511->regmap, ADV7511_REG_INT_ENABLE(1), - ADV7511_INT1_DDC_ERROR); - } - adv7511->current_edid_segment = -1; - } + if (!adv7511->powered) + __adv7511_power_on(adv7511); edid = drm_do_get_edid(connector, adv7511_get_edid_block, adv7511); if (!adv7511->powered) - regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER, - ADV7511_POWER_POWER_DOWN, - ADV7511_POWER_POWER_DOWN); + __adv7511_power_off(adv7511); kfree(adv7511->edid); adv7511->edid = edid;