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: 91589 Delivered-To: patches@linaro.org Received: by 10.140.20.99 with SMTP id 90csp240568qgi; Mon, 16 Jan 2017 15:17:01 -0800 (PST) X-Received: by 10.84.210.130 with SMTP id a2mr54253892pli.106.1484608621912; Mon, 16 Jan 2017 15:17:01 -0800 (PST) Return-Path: Received: from mail-pg0-x230.google.com (mail-pg0-x230.google.com. [2607:f8b0:400e:c05::230]) by mx.google.com with ESMTPS id w26si22943195pfj.91.2017.01.16.15.17.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jan 2017 15:17:01 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::230 as permitted sender) client-ip=2607:f8b0:400e:c05::230; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::230 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-pg0-x230.google.com with SMTP id t6so13667633pgt.3 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=mQbKoPoGkB5P3FzCaZjyV1o2kE4mSmxeS9skCsR5oaoweda4PtIlCFYkvtJEshL7PO /gKBcprD4qykYXVqbWYMyv+rfFJ5QMbCZfE4XwgD760DnP4I0rZd5ycyMPjqRCa0umxm joBGnS0MUK/W9JGeigIsjym0UYSRgYmybgnLyTSpHG1HvkdiKrV6jPg2c3+rZvt14FWD PKk8CkazwSwCuZUm3Zm2jT/AcBola+w7cM7YQ7HM4HHs3HVjoCrignuQDJfsofXh7ThV ZCloefLrl/cWeRw1pkxPmIr3sFtA8LJPg5mc4t5BGWVYJq18LQR5tnqK847AUyqdP1s7 B5nw== X-Gm-Message-State: AIkVDXLKDCRiux6Q4DAuXJOHm/f5jXZl4rm8yrQ/Hl2HOi1HPvFGSvg1CgbutZrMCK/CiClT60s= X-Received: by 10.98.223.66 with SMTP id u63mr33878951pfg.39.1484608621496; Mon, 16 Jan 2017 15:17:01 -0800 (PST) Return-Path: 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 Cc: John Stultz , David Airlie , Archit Taneja , Wolfram Sang , Lars-Peter Clausen , Laurent Pinchart , dri-devel@lists.freedesktop.org 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> 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(+) -- 2.7.4 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);