From patchwork Tue Jan 17 00:52:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9519707 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 8133D601C3 for ; Tue, 17 Jan 2017 00:53:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C60128339 for ; Tue, 17 Jan 2017 00:53:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FCFA28441; Tue, 17 Jan 2017 00:53:07 +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 1186528339 for ; Tue, 17 Jan 2017 00:53:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DBE876E59A; Tue, 17 Jan 2017 00:53:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x229.google.com (mail-pg0-x229.google.com [IPv6:2607:f8b0:400e:c05::229]) by gabe.freedesktop.org (Postfix) with ESMTPS id D6D196E596 for ; Tue, 17 Jan 2017 00:53:00 +0000 (UTC) Received: by mail-pg0-x229.google.com with SMTP id 14so19506237pgg.1 for ; Mon, 16 Jan 2017 16:53:00 -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=1me1kxc2VHdSs9ZT4sONgJl7NhDEx71ICkTmujbt3DI=; b=IT7+Rx/Bdi84k58ET3ii8x0G8NnJorRgX/pyTouWQOspxbiH00eAXpmnNB70lIZTmf WeeWZmka59wmBn5nM+6A9NppIpYDkvFYwHFGfrR5qa99/48Tit0Q1WoXbYuFE9ccB4RB JOx7ENhiLQFZuwwNPGSbC32dZ2StZxZNxOXPg= 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=1me1kxc2VHdSs9ZT4sONgJl7NhDEx71ICkTmujbt3DI=; b=o8HF2ciGAXYQ3OYMiwj3+WeXySrOl8WLDIJPhW8lZIJvI36pzZfkbEQtA7XbGDu0BR aEyhwJepomAhinuaJI37elo+l/EEPPOGOApZ8W9+nnES8PHQQAMbaCGPkj5ecC0BcEev Yprb9OqoQRJyNjXI12SnLrmUUnSw31ci+Xby+GFkgAwIGqHh6zECwM+GbUxFovbrTmj6 /BXDDxLBNfwaJJdKxCNO7UP5ztyFprW3K8iG8KdMqbEOSSjlDbyjiTfeDGLgVW9GmNIE K61wuW1ZtjXSO8BLhxrOzea1fM+4ADWQz2CegNqSljovWWrmwSlZORJXM98lNAab+UWt +Z9Q== X-Gm-Message-State: AIkVDXLJvlbN0ftbYAV+q4a7o5ECCZlvNeGain8d81qUyOCBV5IDyPv8YeezNEFKad5BqQx6 X-Received: by 10.98.8.11 with SMTP id c11mr40407728pfd.135.1484614380473; Mon, 16 Jan 2017 16:53:00 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id q19sm50220516pfl.21.2017.01.16.16.52.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Jan 2017 16:53:00 -0800 (PST) From: John Stultz To: lkml Subject: [PATCH 4/6] drm/bridge: adv7511: Rework adv7511_power_on/off() so they can be reused internally Date: Mon, 16 Jan 2017 16:52:50 -0800 Message-Id: <1484614372-15342-5-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484614372-15342-1-git-send-email-john.stultz@linaro.org> References: <1484614372-15342-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 In chasing down issues with EDID probing, I found some duplicated but incomplete logic used to power the chip on and off. This patch refactors the adv7511_power_on/off functions, so they can be used for internal needs. 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 Reviewed-by: Laurent Pinchart --- v4: Move the regcache_sync() call outside the shared implementation as we don't want to call it on EDID probing, as suggested by Laurent --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 405e460..12f2876 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -325,7 +325,7 @@ static void adv7511_set_link_config(struct adv7511 *adv7511, adv7511->rgb = config->input_colorspace == HDMI_COLORSPACE_RGB; } -static void adv7511_power_on(struct adv7511 *adv7511) +static void __adv7511_power_on(struct adv7511 *adv7511) { adv7511->current_edid_segment = -1; @@ -354,6 +354,11 @@ static void adv7511_power_on(struct adv7511 *adv7511) regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, ADV7511_REG_POWER2_HPD_SRC_MASK, ADV7511_REG_POWER2_HPD_SRC_NONE); +} + +static void adv7511_power_on(struct adv7511 *adv7511) +{ + __adv7511_power_on(adv7511); /* * Most of the registers are reset during power down or when HPD is low. @@ -362,21 +367,23 @@ static void adv7511_power_on(struct adv7511 *adv7511) if (adv7511->type == ADV7533) adv7533_dsi_power_on(adv7511); - adv7511->powered = true; } -static void adv7511_power_off(struct adv7511 *adv7511) +static void __adv7511_power_off(struct adv7511 *adv7511) { /* TODO: setup additional power down modes */ regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER, ADV7511_POWER_POWER_DOWN, ADV7511_POWER_POWER_DOWN); regcache_mark_dirty(adv7511->regmap); +} +static void adv7511_power_off(struct adv7511 *adv7511) +{ + __adv7511_power_off(adv7511); if (adv7511->type == ADV7533) adv7533_dsi_power_off(adv7511); - adv7511->powered = false; }