From patchwork Mon Dec 12 21:00:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9471361 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 C045060573 for ; Mon, 12 Dec 2016 21:01:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3442284CA for ; Mon, 12 Dec 2016 21:01:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A61A12851D; Mon, 12 Dec 2016 21:01:04 +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 4070C284CA for ; Mon, 12 Dec 2016 21:01:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 909576E40E; Mon, 12 Dec 2016 21:00:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x235.google.com (mail-pg0-x235.google.com [IPv6:2607:f8b0:400e:c05::235]) by gabe.freedesktop.org (Postfix) with ESMTPS id 942256E35D for ; Mon, 12 Dec 2016 21:00:50 +0000 (UTC) Received: by mail-pg0-x235.google.com with SMTP id x23so39159707pgx.1 for ; Mon, 12 Dec 2016 13:00:50 -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=Ax80QUMqId4NLw7Il0/zMOBdXwHVJIh1lSyd0ZBTu5s=; b=acXV9cySDiENcCsQNzzlmDS6KppC0C4N1oSqlCn/a/4tedKV31N/CiMshXtq0e2bjC 9E7GrVDMALGrk7Zom3syY/F/Aze0BwsPxi6K3zh8wLzIyOar17tCTvdydAO/bc8tmFPS up5zzoc/iW4Td4TlcYbK7BCZeWZ1iGWbb7v1U= 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=Ax80QUMqId4NLw7Il0/zMOBdXwHVJIh1lSyd0ZBTu5s=; b=TfFX5j34kIyZMMot7ptSspnNgHdjyubI44jUBqyKc3fuWFAXGZv7w2Zq6/G1KVucwG KVttbJuBL7VBpbM7w2aXGeJYpx1kLNzdmeh1exbrv8P9YDRjjNKReo0b4VF22csGvPld GcpdNHren9bvW7EUBVUglccfHkT3FQBbdsCoXmorqgzbnTszM62DpclrfHeiaJ3Q825d tEsl/hkx6toVi8FKWdjZlahmOfdFJ97dxC6PRGB/hSAWA94Hjnm04OQBlDNqrzv05nES XmUkWV2V9bG6b73YEQPFL3vkscF5L8sfxRbFckN83dMbr8ui4O75nmAmXHH2NaRoYfyi GeYA== X-Gm-Message-State: AKaTC02SE7+ufdP5DUQgjjdVj6UC4zz/HPNgUfUbbE+QDV0cWSyCTzY9BNgQJ6v7rtCur3Qa X-Received: by 10.98.194.130 with SMTP id w2mr97657985pfk.143.1481576449961; Mon, 12 Dec 2016 13:00:49 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id f3sm41074078pga.45.2016.12.12.13.00.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Dec 2016 13:00:49 -0800 (PST) From: John Stultz To: lkml Subject: [RFC][PATCH 5/5 v3] drm/bridge: adv7511: Reuse __adv7511_power_on/off() when probing EDID Date: Mon, 12 Dec 2016 13:00:41 -0800 Message-Id: <1481576441-23529-6-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481576441-23529-1-git-send-email-john.stultz@linaro.org> References: <1481576441-23529-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 --- 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 dbdb71c..24573e0 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -572,24 +572,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;