From patchwork Mon Jan 16 23:16:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9519649 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 416526020B for ; Mon, 16 Jan 2017 23:17:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FE1A28447 for ; Mon, 16 Jan 2017 23:17:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22EBE2844C; Mon, 16 Jan 2017 23:17:06 +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 630EC28447 for ; Mon, 16 Jan 2017 23:17:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1318D6E577; Mon, 16 Jan 2017 23:17:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x233.google.com (mail-pg0-x233.google.com [IPv6:2607:f8b0:400e:c05::233]) by gabe.freedesktop.org (Postfix) with ESMTPS id 152526E577 for ; Mon, 16 Jan 2017 23:17:01 +0000 (UTC) Received: by mail-pg0-x233.google.com with SMTP id 194so18926115pgd.2 for ; Mon, 16 Jan 2017 15:17:01 -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=iRm0NztSrTR6mmaYgGGU4DlwcQsSC8jAV6CdZB0aMYg=; b=HH3ZB2z3vqSvYtxSPQzv53pllH82MA06u4Qu2VGKL3nu6p61LLXhyiCrDlT6fi+K+3 IhzqenaR01f3N/i+nPxbvkmtyDunj6yOiLLiOsdcZ2xJ0vHpUtD6kZTdMWmOAuxn0Dj9 MPd5BeeypuRv1tKPYvjyeWgFe82XpTWVO3xQ4= 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=iRm0NztSrTR6mmaYgGGU4DlwcQsSC8jAV6CdZB0aMYg=; b=E7lK8dOEU8oxYvXqTNsOcu7aNWL7U09Wcx/Nq+n52j5eEIVMjlSwcKAwAy+7hgKBEo Sqb2usBSt7A9JHxIeMIDov7L3gpzKCUXLsKIQpjxQBebKTzA3ik/68ZPPAH2TPciBTzZ w8FPqK7hGBuKORCbJfoUHAYo9tRP35Vcw32J8Kc+H+vbKt4j0aLx0HocJKUnBLms9yZl O3jmIuoo/dMvLuGIRtL0Pa16LtmbVOoRU9nevbDCglUdYL6LShW5gDPAYaXwj4ehiCNY eV77PNtrppACVHa1Gdy/+Wux3G7tj6gA5ivPZtXur1xZCfvAVTdz1r5itRkUlHQs2m02 E35g== X-Gm-Message-State: AIkVDXKmXA8uyiOODDPzXg16mUzXTDaq0z9lmD5JBTbkdkuM+D8X+9BYNVzvcOQBmKzPrx4R X-Received: by 10.98.223.66 with SMTP id u63mr33878951pfg.39.1484608621496; Mon, 16 Jan 2017 15:17:01 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id s5sm50390100pgj.19.2017.01.16.15.17.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Jan 2017 15:17:00 -0800 (PST) From: John Stultz To: lkml Subject: [RFC][PATCH] drm/bridge: adv7511: Re-write the i2c address as it may have been lost Date: Mon, 16 Jan 2017 15:16:51 -0800 Message-Id: <1484608611-10956-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1668382.5d9jBvLc1l@avalon> References: <1668382.5d9jBvLc1l@avalon> 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 Laurent: Would something like the following be preferred? Seems to work as well for me.. thanks -john 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, likely as the device registers were reset during power off. Thus this patch simply re-writes the i2c address to the ADV7511_REG_EDID_I2C_ADDR register to ensure its properly set before we try to read the EDID data. 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 405e460..32c59cb 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -567,6 +567,8 @@ static int adv7511_get_modes(struct adv7511 *adv7511, /* Reading the EDID only works if the device is powered */ if (!adv7511->powered) { + unsigned int edid_i2c_addr = (adv7511->i2c_main->addr << 1) + 4; + regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER, ADV7511_POWER_POWER_DOWN, 0); if (adv7511->i2c_main->irq) { @@ -576,6 +578,9 @@ static int adv7511_get_modes(struct adv7511 *adv7511, ADV7511_INT1_DDC_ERROR); } adv7511->current_edid_segment = -1; + + /* Reset the EDID_I2C_ADDR register as it may have been cleared */ + regmap_write(adv7511->regmap, ADV7511_REG_EDID_I2C_ADDR, edid_i2c_addr); } edid = drm_do_get_edid(connector, adv7511_get_edid_block, adv7511);