From patchwork Thu Nov 12 08:37:03 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: 11902719 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=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,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 083DBC63697 for ; Fri, 13 Nov 2020 08:38:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95E2B20B80 for ; Fri, 13 Nov 2020 08:38:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ZIy2GJjc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95E2B20B80 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 913B06E483; Fri, 13 Nov 2020 08:38:29 +0000 (UTC) Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by gabe.freedesktop.org (Postfix) with ESMTPS id BEB5489836 for ; Thu, 12 Nov 2020 08:37:12 +0000 (UTC) Received: by mail-pl1-x644.google.com with SMTP id u2so2417563pls.10 for ; Thu, 12 Nov 2020 00:37:12 -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=zaUoYSUdJvqs+oll9H2A29HKqXrBBwjsOfx6mYBumWY=; b=ZIy2GJjcCFwfpMy4062YJvaK8zi7aYisftRctVk23KTPa3ygyvwW66WOCvtqPsaigT hEdxxfH4ogvdpV784/xVKofdQEIdDBvODGryVZX2nUzd6D+Ib3vP9ENoKqsxhg9PGFcd 9fDP3/og/lYko6eh0JgM/HAm6rSMSGFIbu+eg= 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=zaUoYSUdJvqs+oll9H2A29HKqXrBBwjsOfx6mYBumWY=; b=e+2zze5xGADLdigmqDs3rjBNwzVD2ZRq9cFV9ZygKEb3+d81twjcYEy27QJJnSTQTl wpq6aOWA5myAX7BLYd8h0JGJBIqIPMgxdH6cHZOsn3bPIj56BxtCufl2ylq2q7JBiXN6 D+sdDwBW8bmfnjOMTz0qGjIunAxPYABLM99SahG5Gnx9NDozJv1LSTKvFGUvXTQqgplf 3L2rvp9Dx++ISU33BW6G4+8dYU2HZ09Na9qot41bKn2Qqrf2Zl81SUROkh/LQ4VateDb 2arh2moOy6vka3YlW0RYvNQEv97IYUSHr2jQiPaGU899hc97YrmLrtUiEBx4G9PJd1LR s7wQ== X-Gm-Message-State: AOAM532vg55lhfz7WkX+s78UAjeDxFBCkjJiVe9lRwsZALv0hIY4qgOW 6o9dpw5UPf6mHaVsGFUU3e1aJg== X-Google-Smtp-Source: ABdhPJy7XEDWu/EeS5RAKL2jFwMrhKq4BgMz3vXq/F1wjzEjdEFSG4EeubSX7/hJRR+IOJD+bpF1bg== X-Received: by 2002:a17:902:7c14:b029:d4:d894:7eed with SMTP id x20-20020a1709027c14b02900d4d8947eedmr22255515pll.81.1605170232380; Thu, 12 Nov 2020 00:37:12 -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 a8sm4328404pfa.132.2020.11.12.00.37.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 00:37:11 -0800 (PST) From: Hsin-Yi Wang To: Xin Ji , Sam Ravnborg , Rob Herring Subject: [PATCH 1/2] dt-bindings: drm/bridge: anx7625: Add power supplies Date: Thu, 12 Nov 2020 16:37:03 +0800 Message-Id: <20201112083704.1173908-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8-goog MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 13 Nov 2020 08:38:02 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Jernej Skrabec , Neil Armstrong , David Airlie , Jonas Karlman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Andrzej Hajda , Laurent Pinchart , Hsin-Yi Wang Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" anx7625 requires 3 power supply regulators. Signed-off-by: Hsin-Yi Wang Reviewed-by: Xin Ji --- .../display/bridge/analogix,anx7625.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml index 60585a4fc22b..1aa08f10d894 100644 --- a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml +++ b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml @@ -34,6 +34,18 @@ properties: description: used for reset chip control, RESET_N pin B7. maxItems: 1 + vdd10-supply: + description: Regulator that provides the supply 1.0V power. + maxItems: 1 + + vdd18-supply: + description: Regulator that provides the supply 1.8V power. + maxItems: 1 + + vdd33-supply: + description: Regulator that provides the supply 3.3V power. + maxItems: 1 + ports: type: object @@ -55,6 +67,9 @@ properties: required: - compatible - reg + - vdd10-supply + - vdd18-supply + - vdd33-supply - ports additionalProperties: false @@ -72,6 +87,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 Thu Nov 12 08:37:04 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: 11902731 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=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 CC7C2C388F7 for ; Fri, 13 Nov 2020 08:38:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5FBA220B80 for ; Fri, 13 Nov 2020 08:38:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ml7vZ3vR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5FBA220B80 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EBEF06E47B; Fri, 13 Nov 2020 08:38:28 +0000 (UTC) Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD2656E03E for ; Thu, 12 Nov 2020 08:37:16 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id r186so3609760pgr.0 for ; Thu, 12 Nov 2020 00:37:16 -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=NNXh/Tn3kD4tEzF0+OhmTB/ikjusVNJKy38i4uzggqs=; b=ml7vZ3vRecPBdlyJx/kLR/FM8rkGZuvsHuSC/r0Feam0Ducyhd7lTNCiY7WnGKpD/P CJ/R/Qj6up21Gu/vDjayKylVhctUs8us+MZ8SPG4hD2vRRhDQ13nsA6Ie/tn5PpE5O2m MyFPMGXRuH4AGLhacFuPklUl1S8oPLp6IAlLk= 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=NNXh/Tn3kD4tEzF0+OhmTB/ikjusVNJKy38i4uzggqs=; b=hQWRvWhuZ7buzFFCfsLNTCWA1Yho2+JVAIpT7Cg96V2Y4boQRU7w86jyO+fTxvHRiw EsI3+YwCXj6xRnB+VBmCMHf4TCzzRMp4xDnegX/D2Lm9kf9SdXVW1I3p/P8heZFv4Gz7 mlJ7Qi96c4Db0ij2eZvKNO/kfpiWSlKIo1GcNY5b+yCFCYJTdGwU60RTO86OE493sDw1 EUebHjnvRb0Aj713htwgkTcm2cabj6Pxs5JYOEUIbdhEIXHaivYFmKHoaywQom+4UTyG PQiiucaN2SNCkponriexVhqIkaOCbwb72p9a+j1msd3pMqot+BsUOywthiOT8T53Lapf PKjw== X-Gm-Message-State: AOAM530ayh5/JyJRI4n3h7/SsDJoNr1k0wvx1yywobpouWDiQV/SbwJ6 hCoBosPyZ+QQKD8yByK9c73VQjHcOUohgA== X-Google-Smtp-Source: ABdhPJx22TIGYpOcZK5jJydSD4PvS+tYFUZ3d+L1zEx/gTsCn9Ou+rqAQCn5ob9yJ4i0hZr7u48c0w== X-Received: by 2002:aa7:9ece:0:b029:18b:ac4c:ac94 with SMTP id r14-20020aa79ece0000b029018bac4cac94mr25844884pfq.5.1605170236307; Thu, 12 Nov 2020 00:37:16 -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 a8sm4328404pfa.132.2020.11.12.00.37.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 00:37:15 -0800 (PST) From: Hsin-Yi Wang To: Xin Ji , Sam Ravnborg , Rob Herring Subject: [PATCH 2/2] drm/bridge: anx7625: disable regulators when power off Date: Thu, 12 Nov 2020 16:37:04 +0800 Message-Id: <20201112083704.1173908-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8-goog In-Reply-To: <20201112083704.1173908-1-hsinyi@chromium.org> References: <20201112083704.1173908-1-hsinyi@chromium.org> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 13 Nov 2020 08:38:02 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Jernej Skrabec , Neil Armstrong , David Airlie , Jonas Karlman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Andrzej Hajda , Laurent Pinchart , Hsin-Yi Wang Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Reviewed-by: Xin Ji --- 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;