From patchwork Tue Jan 3 19:41:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9495517 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 6B0C1606A9 for ; Tue, 3 Jan 2017 19:45:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53CBE27BE5 for ; Tue, 3 Jan 2017 19:45:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 453C627C0B; Tue, 3 Jan 2017 19:45:18 +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 EB00227BE5 for ; Tue, 3 Jan 2017 19:45:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 219D388E3F; Tue, 3 Jan 2017 19:45:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x236.google.com (mail-pf0-x236.google.com [IPv6:2607:f8b0:400e:c00::236]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0891C6E13E for ; Tue, 3 Jan 2017 19:41:56 +0000 (UTC) Received: by mail-pf0-x236.google.com with SMTP id d2so78291967pfd.0 for ; Tue, 03 Jan 2017 11:41:56 -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=jAR3qpf/RdrsMWzXDgoHadUGnoC4Ugp6+rYlcSETLJ4oOMYWDyCWdbKWrZy2Rl8VhS /oHSvcNe62QhiVSa48E8oWD4UmozWjQLlbl7CtsvV9ZFAr4WXyBv0mMls3jnC6AiHh4D U795On+iGAbYORYZCRmVFZLUrqOe93ud+6e54= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ax80QUMqId4NLw7Il0/zMOBdXwHVJIh1lSyd0ZBTu5s=; b=IAkQZcLf+nCvjtJqUbUkXXUO0wQQ++g6vleXkSHRkKzE+bbPvYY0BwC/kpAgFsmyMh mUSFFLwzM2QE5tSVOo1K5wdxP+lCeu0UWo3tgIc1BZq6iA79Kyn09ZJ+fO35pBxYWk6I O+DjktSnzan9kGzx7xisOOe77RalufWYz6r4RDqtKZ3qtbqljGTBNhKrzvSscIgVSxHZ uPJ/bqJ5vx/Ni/LKqyLUoXFRQnNM0lErEgxKgfFbPeRJFR+60qEmBUX15H5iAhQ6NWlq Dn3Kj6Oq+fllE7Ckx6WnRbAuN6UsRimKXBBB2Q0pP03YV87upbVMx5BfKGUEI836RSKy M+5Q== X-Gm-Message-State: AIkVDXK4fczal1JfpjVUMT3viTHdbp3skelMtUzqEzeH3BgQiYBFzn2WZNnBMXydOBlCJxZ0 X-Received: by 10.84.214.1 with SMTP id h1mr140576505pli.47.1483472515175; Tue, 03 Jan 2017 11:41:55 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id y62sm77865957pfk.52.2017.01.03.11.41.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Jan 2017 11:41:54 -0800 (PST) From: John Stultz To: lkml Subject: [PATCH 5/5 v3] drm/bridge: adv7511: Reuse __adv7511_power_on/off() when probing EDID Date: Tue, 3 Jan 2017 11:41:42 -0800 Message-Id: <1483472502-16403-6-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483472502-16403-1-git-send-email-john.stultz@linaro.org> References: <1483472502-16403-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;