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: 84494 Delivered-To: patches@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1452320qgi; Mon, 28 Nov 2016 21:04:57 -0800 (PST) X-Received: by 10.84.177.129 with SMTP id x1mr53330990plb.105.1480395897055; Mon, 28 Nov 2016 21:04:57 -0800 (PST) Return-Path: Received: from mail-pf0-x22f.google.com (mail-pf0-x22f.google.com. [2607:f8b0:400e:c00::22f]) by mx.google.com with ESMTPS id k72si58206976pge.102.2016.11.28.21.04.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Nov 2016 21:04:57 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::22f as permitted sender) client-ip=2607:f8b0:400e:c00::22f; 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:c00::22f as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-pf0-x22f.google.com with SMTP id i88so29338830pfk.2 for ; Mon, 28 Nov 2016 21:04: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=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=aygLtoFn0uQFMA/QS8C/5ATODk/f0EuXLJs5IHW9snMHEFtzK5xWb4LjPuccTy8BHF xj6NqvlWl7bGwyl/QZjLBX+4dxX0z0Q4nBp9DS/No9ved9CCYHw1amyz0zHWym1IPV1j n+VYCv+1YldonKuW9vulBSSE3MpXo0HHsU3BHQrVTKAmT2GpZBDjl3tH8qO3NTKkz42A 2d0ZpfwvUT//tBN9DMlm5msbYhJiaYOLakCND1gYg+E/tpwi8s3+X0bSZrbs+6+Igwc3 by5Qh7Qn+fycuk7V58pwINJD2DBgBs86LJ3nAq/372r6iKsrf9MbyWny0rCt4H9fbFHS MhUQ== X-Gm-Message-State: AKaTC03l9uQ9TQcRPUexSsmf02uGBhSGq5rM+v2NPyVvpnFdCGz8hTaV3SN6BlIVCyhaQCrYivk= X-Received: by 10.84.218.7 with SMTP id q7mr57829758pli.18.1480395896762; Mon, 28 Nov 2016 21:04:56 -0800 (PST) Return-Path: 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 Cc: John Stultz , David Airlie , Archit Taneja , Wolfram Sang , Lars-Peter Clausen , Laurent Pinchart , dri-devel@lists.freedesktop.org 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> 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(-) -- 2.7.4 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;