From patchwork Thu Sep 8 05:57:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Zhong X-Patchwork-Id: 9320399 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 080DB60231 for ; Thu, 8 Sep 2016 05:58:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBB4929576 for ; Thu, 8 Sep 2016 05:58:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD7E429583; Thu, 8 Sep 2016 05:58:05 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D86D129576 for ; Thu, 8 Sep 2016 05:58:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhsLY-0006b6-Pn; Thu, 08 Sep 2016 05:58:00 +0000 Received: from mail-pa0-f65.google.com ([209.85.220.65]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhsLV-0006Xh-FB; Thu, 08 Sep 2016 05:57:58 +0000 Received: by mail-pa0-f65.google.com with SMTP id pp5so1921966pac.2; Wed, 07 Sep 2016 22:57:36 -0700 (PDT) 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=JnD3djQlCOV2o/pgsIxaJPSLJnXIh2Vkrz6ITjI57c0=; b=Drm3E4ulGIh2ckVS7ZxfkMopopt/4GYJloZGtAtWyKDllcyfbYgozwRoSEYxuPHVMg 7+q5UQaiwoLbVHxR2xFQtCzFteniWQaRH+4qhCXRmOOtiY8e87GymMsKd1HNmy4wVyo2 nJwTODuWEzbnhQNjDmQ7d+qnBzwR7OJS/YFnvHi1Q10Pqx4o/EtTQgpu+jOaRz6r6enW p80DUxloxN7+cpH8jRXgE9IppIiouwHstPDhgZZLJis3bcqZRvov/dGsfIx+V2RcFwUc 9CgmrkoEH5j0oORai5VeUGzPurUwZCgazeeMSwGr4JJSQD0QXp9WhMVVKHhCQL5Ou1sy rGYg== X-Gm-Message-State: AE9vXwNNAdsIieiZCivvhfBwbk7BisqObuQRNHCJVIf7nsWPsBgOaBF2qQzjbenmOyOFWw== X-Received: by 10.66.139.227 with SMTP id rb3mr87910494pab.26.1473314256309; Wed, 07 Sep 2016 22:57:36 -0700 (PDT) Received: from user5-HP-Z620-Workstation.corp.google.com ([172.22.52.170]) by smtp.gmail.com with ESMTPSA id 81sm52906425pfm.90.2016.09.07.22.57.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Sep 2016 22:57:35 -0700 (PDT) From: Chris Zhong To: kishon@ti.com, groeck@chromium.org, wulf@rock-chips.com, briannorris@chromium.org, heiko@sntech.de, dianders@chromium.org, kever.yang@rock-chips.com Subject: [RESEND PATCH v3 1/2] phy: rockchip-typec: add pm runtime support Date: Wed, 7 Sep 2016 22:57:33 -0700 Message-Id: <1473314253-2646-1-git-send-email-zyw@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <57D0F612.10702@ti.com> References: <57D0F612.10702@ti.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160907_225757_586181_50045837 X-CRM114-Status: GOOD ( 10.89 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chris Zhong , linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Adds pm_runtime support for rockchip Type-C, so that power domain is enabled only when there is a transaction going on to help save power. Signed-off-by: Chris Zhong --- Changes in v3: - use phy_core pm_runtime Changes in v2: - add pm_runtime_put_sync in err case drivers/phy/phy-rockchip-typec.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/phy/phy-rockchip-typec.c b/drivers/phy/phy-rockchip-typec.c index fb58a27..7cfb0f8 100644 --- a/drivers/phy/phy-rockchip-typec.c +++ b/drivers/phy/phy-rockchip-typec.c @@ -960,6 +960,8 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev) return PTR_ERR(tcphy->extcon); } + pm_runtime_enable(dev); + for_each_available_child_of_node(np, child_np) { struct phy *phy; @@ -990,6 +992,13 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev) return 0; } +static int rockchip_typec_phy_remove(struct platform_device *pdev) +{ + pm_runtime_disable(&pdev->dev); + + return 0; +} + static const struct of_device_id rockchip_typec_phy_dt_ids[] = { { .compatible = "rockchip,rk3399-typec-phy" }, {} @@ -999,6 +1008,7 @@ MODULE_DEVICE_TABLE(of, rockchip_typec_phy_dt_ids); static struct platform_driver rockchip_typec_phy_driver = { .probe = rockchip_typec_phy_probe, + .remove = rockchip_typec_phy_remove, .driver = { .name = "rockchip-typec-phy", .of_match_table = rockchip_typec_phy_dt_ids,