From patchwork Tue Dec 10 10:55:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 3317301 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E6154C0D4A for ; Tue, 10 Dec 2013 10:56:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CAA2020221 for ; Tue, 10 Dec 2013 10:56:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ADB0620220 for ; Tue, 10 Dec 2013 10:56:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752387Ab3LJK4Q (ORCPT ); Tue, 10 Dec 2013 05:56:16 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:64330 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752342Ab3LJK4I (ORCPT ); Tue, 10 Dec 2013 05:56:08 -0500 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MXL00LAN7PE2050@mailout2.samsung.com>; Tue, 10 Dec 2013 19:56:02 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 54.FD.12557.143F6A25; Tue, 10 Dec 2013 19:56:01 +0900 (KST) X-AuditID: cbfee690-b7f676d00000310d-3f-52a6f3412729 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 95.D6.15903.143F6A25; Tue, 10 Dec 2013 19:56:01 +0900 (KST) Received: from vivekkumarg-linuxpc.sisodomain.com ([107.108.214.169]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MXL00FRH7P6F400@mmp2.samsung.com>; Tue, 10 Dec 2013 19:56:01 +0900 (KST) From: Vivek Gautam To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, balbi@ti.com, sarah.a.sharp@linux.intel.com, kgene.kim@samsung.com, kishon@ti.com, jg1.han@samsung.com, jwerner@chromium.org Subject: [PATCH RFC 1/4] phy: Add provision for tuning phy. Date: Tue, 10 Dec 2013 16:25:23 +0530 Message-id: <1386672926-26885-2-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.6.5 In-reply-to: <1386672926-26885-1-git-send-email-gautam.vivek@samsung.com> References: <1386672926-26885-1-git-send-email-gautam.vivek@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeLIzCtJLcpLzFFi42JZI2JSrev4eVmQQeciE4uD9+stmhevZ7O4 vPASq0XHocdMFr0LrrJZXHjaAxTbNYfNYvaSfhaLGef3MVksWtbKbNF84hSzA7fH7IaLLB7z TgZ67J+7ht2jb8sqRo/jN7YzeXzeJBfAFsVlk5Kak1mWWqRvl8CVsbNxEnPBBIGKN1/a2BsY u3m7GDk5JARMJE4tn8gKYYtJXLi3nq2LkYtDSGApo8SXvQvZYYp2zt/PCGILCUxnlDjaLANR NIVJ4vqrnywgCTYBXYmmt7vAikQEHCSWLL0DNolZ4BajRMvUDrAVwgLWEp9vPgKbyiKgKjHj /AIgm4ODV8BD4u7KFIhlChJvbj9jBrE5BTwllncdYIVY7CHRdf8+M8hMCYFD7BLXpz1ihpgj IPFt8iEWkDkSArISmw4wQ8yRlDi44gbLBEbhBYwMqxhFUwuSC4qT0otM9IoTc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QjbsN72z3s/gdPexwJt24snXfExC3uvi5Hft7ynZOWdgpWOS86yjt9TzXL6rht y0MNLN89Tz3/NmhC1i8phZ8KWbOzcsXPPVxxr/fZkgk7Nu69NJ9R1zW/VeFqx5q4egnlg9z1 W0+8f+EtxK3EUpyRaKjFXFScCAA6ha2V/QIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some PHY controllers may need to tune PHY post-initialization, so that the PHY consumers can call phy-tuning at appropriate point of time. Signed-off-by: vivek Gautam --- drivers/phy/phy-core.c | 20 ++++++++++++++++++++ include/linux/phy/phy.h | 7 +++++++ 2 files changed, 27 insertions(+), 0 deletions(-) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 03cf8fb..68dbb90 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -239,6 +239,26 @@ out: } EXPORT_SYMBOL_GPL(phy_power_off); +int phy_tune(struct phy *phy) +{ + int ret = -ENOTSUPP; + + mutex_lock(&phy->mutex); + if (phy->ops->tune) { + ret = phy->ops->tune(phy); + if (ret < 0) { + dev_err(&phy->dev, "phy tuning failed --> %d\n", ret); + goto out; + } + } + +out: + mutex_unlock(&phy->mutex); + + return ret; +} +EXPORT_SYMBOL_GPL(phy_tune); + /** * of_phy_get() - lookup and obtain a reference to a phy by phandle * @dev: device that requests this phy diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 6d72269..d3b32b0 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -34,6 +34,7 @@ struct phy_ops { int (*exit)(struct phy *phy); int (*power_on)(struct phy *phy); int (*power_off)(struct phy *phy); + int (*tune)(struct phy *phy); struct module *owner; }; @@ -127,6 +128,7 @@ int phy_init(struct phy *phy); int phy_exit(struct phy *phy); int phy_power_on(struct phy *phy); int phy_power_off(struct phy *phy); +int phy_tune(struct phy *phy); struct phy *phy_get(struct device *dev, const char *string); struct phy *devm_phy_get(struct device *dev, const char *string); void phy_put(struct phy *phy); @@ -199,6 +201,11 @@ static inline int phy_power_off(struct phy *phy) return -ENOSYS; } +static inline int phy_tune(struct phy *phy) +{ + return -ENOSYS; +} + static inline struct phy *phy_get(struct device *dev, const char *string) { return ERR_PTR(-ENOSYS);