Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758589Ab3DAN5t (ORCPT ); Mon, 1 Apr 2013 09:57:49 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:25155 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758529Ab3DAN5n (ORCPT ); Mon, 1 Apr 2013 09:57:43 -0400 X-AuditID: cbfee68f-b7f4a6d000001436-9f-515992558ce0 From: Vivek Gautam To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-omap@vger.kernel.org Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, balbi@ti.com, stern@rowland.harvard.edu, sarah.a.sharp@linux.intel.com, rob.herring@calxeda.com, kgene.kim@samsung.com, kishon@ti.com, dianders@chromium.org, t.figa@samsung.com, p.paneri@samsung.com Subject: [PATCH v3 01/11] usb: phy: Add APIs for runtime power management Date: Mon, 01 Apr 2013 19:24:00 +0530 Message-id: <1364824448-14732-2-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.6.5 In-reply-to: <1364824448-14732-1-git-send-email-gautam.vivek@samsung.com> References: <1364824448-14732-1-git-send-email-gautam.vivek@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCIsWRmVeSWpSXmKPExsWyRsSkWjd0UmSgwcfXEhYH79dbnF12kM2i efF6NoveBVfZLC487WGzuLxrDpvF7CX9LBYzzu9jsli0rJXZ4vyWTiaLwysOMFk0nzjFbDHh 9wU2i/UzXrM48Hks+HyF3WN2w0UWj3knAz32z10D5N39wejRt2UVo8fxG9uZPD5vkgvgiOKy SUnNySxLLdK3S+DK+L9uLkvBetmKzz0zGRsYH4l3MXJySAiYSEz92sIOYYtJXLi3nq2LkYtD SGApo8SSRceZYIq2b93ICpFYxCgxra+PHcKZwiTxbPZURpAqNgFdiaa3u4BsDg4RgTiJzROE QcLMAl1MEkuPgm0TFvCU2PlnDlgJi4CqRN/lPJAw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Si/Pii0pzU4kOM yUBHTWSWEk3OB6aPvJJ4Q2MTc1NjU0sTCxMzS9KElcR5D7ZaBwoJpCeWpGanphakFsFsYeLg lGpgtLQzt1PjjJ0g9eWzuuODwxXlajYVLLNS8+ev+rRU3EhxwdKWUN3fCYI1RgLdD303may/ U6OwxePCqvO9m++I5J+5rr6szXB9yUcjmeLaz1NEr29mOpTfOKnz9aKzMl+nrVi50zzXZvG/ fT+v9FWqCVd73HvwMvfTvr6ket7M7V5us44VPy7sVWIpzkg01GIuKk4EAN4rngMVAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3842 Lines: 167 Adding APIs to handle runtime power management on PHY devices. PHY consumers may need to wake-up/suspend PHYs when they work across autosuspend. Signed-off-by: Vivek Gautam --- include/linux/usb/phy.h | 141 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 141 insertions(+), 0 deletions(-) diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index 6b5978f..01bf9c1 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -297,4 +297,145 @@ static inline const char *usb_phy_type_string(enum usb_phy_type type) return "UNKNOWN PHY TYPE"; } } + +static inline void usb_phy_autopm_enable(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return; + } + + pm_runtime_enable(x->dev); +} + +static inline void usb_phy_autopm_disable(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return; + } + + pm_runtime_disable(x->dev); +} + +static inline int usb_phy_autopm_get(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return -ENODEV; + } + + return pm_runtime_get(x->dev); +} + +static inline int usb_phy_autopm_get_sync(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return -ENODEV; + } + + return pm_runtime_get_sync(x->dev); +} + +static inline int usb_phy_autopm_put(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return -ENODEV; + } + + return pm_runtime_put(x->dev); +} + +static inline int usb_phy_autopm_put_sync(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return -ENODEV; + } + + return pm_runtime_put_sync(x->dev); +} + +static inline void usb_phy_autopm_allow(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return; + } + + pm_runtime_allow(x->dev); +} + +static inline void usb_phy_autopm_forbid(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return; + } + + pm_runtime_forbid(x->dev); +} + +static inline int usb_phy_autopm_set_active(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return -ENODEV; + } + + return pm_runtime_set_active(x->dev); +} + +static inline void usb_phy_autopm_set_suspended(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return; + } + + pm_runtime_set_suspended(x->dev); +} + +static inline bool usb_phy_autopm_suspended(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return 0; + } + + return pm_runtime_suspended(x->dev); +} + +static inline bool usb_phy_autopm_active(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return 0; + } + + return pm_runtime_active(x->dev); +} + +static inline int usb_phy_autopm_suspend(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return -ENODEV; + } + + return pm_runtime_suspend(x->dev); +} + +static inline int usb_phy_autopm_resume(struct usb_phy *x) +{ + if (!x || !x->dev) { + dev_err(x->dev, "no PHY or attached device available\n"); + return -ENODEV; + } + + return pm_runtime_resume(x->dev); +} + #endif /* __LINUX_USB_PHY_H */ -- 1.7.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/