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: 91594 Delivered-To: patches@linaro.org Received: by 10.140.20.99 with SMTP id 90csp267304qgi; Mon, 16 Jan 2017 16:53:00 -0800 (PST) X-Received: by 10.99.112.13 with SMTP id l13mr43303097pgc.7.1484614380741; Mon, 16 Jan 2017 16:53:00 -0800 (PST) Return-Path: Received: from mail-pg0-x22f.google.com (mail-pg0-x22f.google.com. [2607:f8b0:400e:c05::22f]) by mx.google.com with ESMTPS id l25si5163953pgc.199.2017.01.16.16.53.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jan 2017 16:53:00 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22f as permitted sender) client-ip=2607:f8b0:400e:c05::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:c05::22f 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-x22f.google.com with SMTP id 194so19504897pgd.2 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=h8RCtQEjbOzNPIDN0CP2dX1mg2Ma9skbtFL3IileSXN3jPeVKJFZX207otNuzLq7PI 68QSnMnFJCPz7eUqg8ySS274b6i7knUE1Zh1QILTHWRB7+uP/Obt2/pT48FcqMhKO4hL EdH2MIdAmzNPsqAEr5N4I+ufFVraKyjDYgoN+nVO52isFpa9KO5s9TayZ68+XK/VKpzP 5UGM3tc7ldQADI2ZqdoYUIUoP2NR6z6BOpCT/5iFxya4cl3CNTpLwZgRzbZ25FgEnRrf 7ZM39ff1wgP/6sYPIhm88EPqu0LYq+4RrLH95FIo8zJZIDUewQK0VTDuLWUJkYwRb89T DB8A== X-Gm-Message-State: AIkVDXLBLp0lnuWYEyuBLxtylLw8wo/eWUtsCBvzmp1K+twXje6R6XjmYjDRF35A/uRb0kMrP1g= X-Received: by 10.98.8.11 with SMTP id c11mr40407728pfd.135.1484614380473; Mon, 16 Jan 2017 16:53:00 -0800 (PST) Return-Path: 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 Cc: John Stultz , David Airlie , Archit Taneja , Wolfram Sang , Lars-Peter Clausen , Laurent Pinchart , dri-devel@lists.freedesktop.org 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> 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 --- 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(-) -- 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..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; }