From patchwork Mon Nov 23 03:46:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 331603 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60BABC56201 for ; Mon, 23 Nov 2020 03:47:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1898820717 for ; Mon, 23 Nov 2020 03:47:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="JEuH55Ph" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726917AbgKWDrO (ORCPT ); Sun, 22 Nov 2020 22:47:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbgKWDrO (ORCPT ); Sun, 22 Nov 2020 22:47:14 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5698CC061A4C for ; Sun, 22 Nov 2020 19:47:14 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id 81so13008910pgf.0 for ; Sun, 22 Nov 2020 19:47:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NBFTSOV5X132dLJFilDGPY0gccuN+TXfuq0RMp4Oqzw=; b=JEuH55PhaK7IO9cw/CxjGzrdcTknRer/qrRcyHH+scTgYPXovzkSmgH5n9ZJp9T1uY JrbUAqwU2aZHbvaHIjeg5DFe5fhzeBWqivQEKX1vCZNnUKADweCUN0hQuZSeRIzAwKnI pZ8aiN5SLHO6+CQEKtN1cBrHrsfXgAsiSF4QI= 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:mime-version :content-transfer-encoding; bh=NBFTSOV5X132dLJFilDGPY0gccuN+TXfuq0RMp4Oqzw=; b=ADQtlHmYyuDDKKJI8z9Owp3zWnYNSsz6tNWXir7B6cwZr5Z7iGS6BlzwaMXIYWuudN fze49sh8gWW0q718WMG4oOEYs3qxEPSk8bfqEpqCCUQ1O52oXWZuszzJHPxCF/zW/EOa qqZii24KL/KtgRUrZQsx4/JchshsHNV98YnlGFbQ2Cq4HuP7XeohMrZ0aBjsor9Jzk7u ohYjcDIswb0i8w/3T13aydQjDaEVPNll2I7oR4z/c8N0E3g0h4CDN3IPnG9KBV30Kb43 pPLOSlDF4XyCW/w8P6gakxf0MrtO3u6mzNHbKu6cgFuu6DdlNS9IMxvFQii/prYwhmar omdA== X-Gm-Message-State: AOAM530ikYn1FXqvgfmH3Vv7AnFBPUwu+k6+B0HqZubnwHDDZ5O8/EhS o1vnxTABVaG2/wq2RIyodBvW/w== X-Google-Smtp-Source: ABdhPJzpgoMOf+q/nprXjb6p03ctbOnQTmYQujTxfTsmLUeR6e38hwpr+BcyG1jJ5h09Ok3ZKHNC6w== X-Received: by 2002:a17:90b:3647:: with SMTP id nh7mr7221696pjb.114.1606103233806; Sun, 22 Nov 2020 19:47:13 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:1a60:24ff:fe89:3e93]) by smtp.gmail.com with ESMTPSA id m13sm149245pfa.115.2020.11.22.19.47.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2020 19:47:12 -0800 (PST) From: Hsin-Yi Wang To: Xin Ji , Sam Ravnborg , Rob Herring Cc: David Airlie , Daniel Vetter , Hsin-Yi Wang , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Subject: [PATCH v2 1/2] dt-bindings: drm/bridge: anx7625: Add power supplies Date: Mon, 23 Nov 2020 11:46:52 +0800 Message-Id: <20201123034652.3660584-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org anx7625 requires 3 power supply regulators. Signed-off-by: Hsin-Yi Wang Reviewed-by: Rob Herring --- Change: v2: remove maxItems for supplies --- .../bindings/display/bridge/analogix,anx7625.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml index 60585a4fc22b..3ae97d9523e5 100644 --- a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml +++ b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml @@ -34,6 +34,15 @@ properties: description: used for reset chip control, RESET_N pin B7. maxItems: 1 + vdd10-supply: + description: Regulator that provides the supply 1.0V power. + + vdd18-supply: + description: Regulator that provides the supply 1.8V power. + + vdd33-supply: + description: Regulator that provides the supply 3.3V power. + ports: type: object @@ -55,6 +64,9 @@ properties: required: - compatible - reg + - vdd10-supply + - vdd18-supply + - vdd33-supply - ports additionalProperties: false @@ -72,6 +84,9 @@ examples: reg = <0x58>; enable-gpios = <&pio 45 GPIO_ACTIVE_HIGH>; reset-gpios = <&pio 73 GPIO_ACTIVE_HIGH>; + vdd10-supply = <&pp1000_mipibrdg>; + vdd18-supply = <&pp1800_mipibrdg>; + vdd33-supply = <&pp3300_mipibrdg>; ports { #address-cells = <1>; From patchwork Mon Nov 23 03:46:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 330811 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46217C5519F for ; Mon, 23 Nov 2020 03:47:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D7C92151B for ; Mon, 23 Nov 2020 03:47:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="NORWF+ov" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727477AbgKWDrZ (ORCPT ); Sun, 22 Nov 2020 22:47:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbgKWDrY (ORCPT ); Sun, 22 Nov 2020 22:47:24 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2DC5C0613CF for ; Sun, 22 Nov 2020 19:47:24 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id 34so12981713pgp.10 for ; Sun, 22 Nov 2020 19:47:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D107g9ZBNTod+jLTCSbl9CuDKvxuScy2P8EkIE9S/Eo=; b=NORWF+ovtP0SodsjQEdxEAQ2LdrlD3D4BNqeFDITFkM12Bvh1UDsTDi5KtObPCmaaC MgOQ5jdhhA/Tk0AEK/tAg31MdRsFzzeo9O8rYTvMIdOGeGXkSxhuy7sBnM1S2FQ0pswq eGOSumAvHHNsZzsElZiJKT4amStt/ZWrXfPhw= 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:mime-version:content-transfer-encoding; bh=D107g9ZBNTod+jLTCSbl9CuDKvxuScy2P8EkIE9S/Eo=; b=T/eXN2k9Ry7Yiiwrk16JeJKIwLbN98NvWBpoyvBU3O3EC3Op/WCOEFT4EwY9wrTbrH EYp4f9u7VB3PCjTnvlNPOaF0ElkIOwFbduz7K19uwwshgRg7LAOWTegUdgO+VXWCo4hH gQRMLC870i/JRXLUm1HZSerdWTC6EkebGXQ0lxXRxW0V7lrfOKvzkAlurlBFhXkuvBJm to8zCnPR2ssDyyV6iC5jUosiRfHZdbdsnJ46nGUDP08Mwa8nU314Pjb1GS0CWwuLQb3w Tc7lsLAcU9R7XU0a8qetPjsqdk7ceDhnIatIOfexLuIN1YooEpb9YuMKfqEwJwJ3KWMA pSLQ== X-Gm-Message-State: AOAM531OIqUg3sdMOaHpGND3F0eiZbVTLhNsVitVZtzPCIyCAU+XsaPz wd6PYeMHMDDj8jG6382HsIqxgA== X-Google-Smtp-Source: ABdhPJzrYPJfIVIbCKqGaDUUZUhn2bRpKIaSoZTNOX8zHL/bGVGXf4HljtWGezhOz5188uJCqfRhBA== X-Received: by 2002:a62:8cd6:0:b029:18b:ad92:503b with SMTP id m205-20020a628cd60000b029018bad92503bmr23606716pfd.77.1606103244068; Sun, 22 Nov 2020 19:47:24 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:1a60:24ff:fe89:3e93]) by smtp.gmail.com with ESMTPSA id m13sm149245pfa.115.2020.11.22.19.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2020 19:47:23 -0800 (PST) From: Hsin-Yi Wang To: Xin Ji , Sam Ravnborg , Rob Herring Cc: David Airlie , Daniel Vetter , Hsin-Yi Wang , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Subject: [PATCH v2 2/2] drm/bridge: anx7625: disable regulators when power off Date: Mon, 23 Nov 2020 11:46:54 +0800 Message-Id: <20201123034652.3660584-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog In-Reply-To: <20201123034652.3660584-1-hsinyi@chromium.org> References: <20201123034652.3660584-1-hsinyi@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org When suspending the driver, anx7625_power_standby() will be called to turn off reset-gpios and enable-gpios. However, power supplies are not disabled. To save power, the driver can get the power supply regulators and turn off them in anx7625_power_standby(). Signed-off-by: Hsin-Yi Wang --- Change: v2: none --- drivers/gpu/drm/bridge/analogix/anx7625.c | 25 +++++++++++++++++++++++ drivers/gpu/drm/bridge/analogix/anx7625.h | 1 + 2 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 65cc05982f82..eb9c4cc2504a 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -875,12 +876,20 @@ static int sp_tx_edid_read(struct anx7625_data *ctx, static void anx7625_power_on(struct anx7625_data *ctx) { struct device *dev = &ctx->client->dev; + int ret; if (!ctx->pdata.low_power_mode) { DRM_DEV_DEBUG_DRIVER(dev, "not low power mode!\n"); return; } + ret = regulator_bulk_enable(ARRAY_SIZE(ctx->pdata.supplies), + ctx->pdata.supplies); + if (ret < 0) { + DRM_DEV_DEBUG_DRIVER(dev, "cannot enable regulators %d\n", ret); + return; + } + /* Power on pin enable */ gpiod_set_value(ctx->pdata.gpio_p_on, 1); usleep_range(10000, 11000); @@ -894,6 +903,7 @@ static void anx7625_power_on(struct anx7625_data *ctx) static void anx7625_power_standby(struct anx7625_data *ctx) { struct device *dev = &ctx->client->dev; + int ret; if (!ctx->pdata.low_power_mode) { DRM_DEV_DEBUG_DRIVER(dev, "not low power mode!\n"); @@ -904,6 +914,12 @@ static void anx7625_power_standby(struct anx7625_data *ctx) usleep_range(1000, 1100); gpiod_set_value(ctx->pdata.gpio_p_on, 0); usleep_range(1000, 1100); + + ret = regulator_bulk_disable(ARRAY_SIZE(ctx->pdata.supplies), + ctx->pdata.supplies); + if (ret < 0) + DRM_DEV_DEBUG_DRIVER(dev, "cannot disable regulators %d\n", ret); + DRM_DEV_DEBUG_DRIVER(dev, "power down\n"); } @@ -1742,6 +1758,15 @@ static int anx7625_i2c_probe(struct i2c_client *client, platform->client = client; i2c_set_clientdata(client, platform); + pdata->supplies[0].supply = "vdd10"; + pdata->supplies[1].supply = "vdd18"; + pdata->supplies[2].supply = "vdd33"; + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(pdata->supplies), + pdata->supplies); + if (ret) { + DRM_DEV_ERROR(dev, "fail to get power supplies: %d\n", ret); + return ret; + } anx7625_init_gpio(platform); atomic_set(&platform->power_status, 0); diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.h b/drivers/gpu/drm/bridge/analogix/anx7625.h index 193ad86c5450..e4a086b3a3d7 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.h +++ b/drivers/gpu/drm/bridge/analogix/anx7625.h @@ -350,6 +350,7 @@ struct s_edid_data { struct anx7625_platform_data { struct gpio_desc *gpio_p_on; struct gpio_desc *gpio_reset; + struct regulator_bulk_data supplies[3]; struct drm_bridge *panel_bridge; int intp_irq; u32 low_power_mode;