From patchwork Mon Jan 21 14:33:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10773943 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7E5C746 for ; Mon, 21 Jan 2019 14:33:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7A0D29B46 for ; Mon, 21 Jan 2019 14:33:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB92429B4D; Mon, 21 Jan 2019 14:33:52 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FD8329B46 for ; Mon, 21 Jan 2019 14:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729299AbfAUOdv (ORCPT ); Mon, 21 Jan 2019 09:33:51 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:36629 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729046AbfAUOdv (ORCPT ); Mon, 21 Jan 2019 09:33:51 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190121143348euoutp018b54f7f77b31bdbda61b95fe3dcb3d82~746zzFchy0035200352euoutp01K; Mon, 21 Jan 2019 14:33:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190121143348euoutp018b54f7f77b31bdbda61b95fe3dcb3d82~746zzFchy0035200352euoutp01K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1548081228; bh=Pii6HNOsiqIfyD9/k5i/uGMutKWEIOKoqjjVqMULYbg=; h=From:To:Cc:Subject:Date:References:From; b=m03qMj7PQLU86TjE7YfIKV4kRn9nBiQhBwCitvmsA7kdYgbkpbhaFsVBORj5ptMAB Yb1AK/oC2X0jR4mX1O1vZMK1FuV4u3BYIon0QIyXEwcDUe8z+qcGTXvvHBMKRrTSyi WpaPcydlbLpzsSIUCcAy+RFXrjpIit0t6hgvLyW0= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190121143348eucas1p2bf1d92840352704433c94a5f77be0ef2~746zWwL6Y0897108971eucas1p2a; Mon, 21 Jan 2019 14:33:48 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 59.DF.04806.C48D54C5; Mon, 21 Jan 2019 14:33:48 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190121143347eucas1p117a10d4cd94fdc9b6d82fecf4d5dd373~746yfiT6T3171131711eucas1p1p; Mon, 21 Jan 2019 14:33:47 +0000 (GMT) X-AuditID: cbfec7f5-79db79c0000012c6-f9-5c45d84c8fcf Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 90.A0.04284.B48D54C5; Mon, 21 Jan 2019 14:33:47 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PLO008N2R47PG10@eusync4.samsung.com>; Mon, 21 Jan 2019 14:33:47 +0000 (GMT) From: Marek Szyprowski To: linux-usb@vger.kernel.org Cc: Marek Szyprowski , Greg Kroah-Hartman , Bartlomiej Zolnierkiewicz Subject: [PATCH] usb: misc: usb3503: Add system sleep support in non-I2C mode Date: Mon, 21 Jan 2019 15:33:35 +0100 Message-id: <20190121143335.22702-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRmVeSWpSXmKPExsWy7djPc7o+N1xjDJZ0sFlsnLGe1aJ58Xo2 i0XLWpkt1h65y+7A4rF/7hp2j74tqxg9Pm+SC2CO4rJJSc3JLEst0rdL4MrYM7+HqaBNtOLD 1r3sDYzXBbsYOTkkBEwkmm7PY+xi5OIQEljBKHHr2UU2COczo8TLOwtZYKrOXvnDDpFYxijx 6/oNqKoGJokzG/eyglSxCRhKdL3tYgOxRQRkJQ5f+c0MUsQsMItR4uPWR2BFwgL+EvOe3GcH sVkEVCVuzF3BCGLzCthKLF49hw1inbzE6g0HwJolBE6ySszt38YMkXCRuHH9KSuELSPR2XGQ CaKomVGifcYsdginh1Fi65wdUKOsJQ4fvwjWwSzAJzFp23SgSRxAcV6JjjYhiBIPiV1dE8AW CAnEShzqXs86gVF8ASPDKkbx1NLi3PTUYuO81HK94sTc4tK8dL3k/NxNjMAYOf3v+NcdjPv+ JB1iFOBgVOLh5TjnGiPEmlhWXJl7iFGCg1lJhPe1O1CINyWxsiq1KD++qDQntfgQozQHi5I4 bzXDg2ghgfTEktTs1NSC1CKYLBMHp1QD4+pTs9rcnkUXrHaLZthisTyv3aejYZr7va97Di77 94p5yq1wlz6d04tXPvTX2eIscmFG8F0WkYg5XpZtvK2H7gS4i9YbcEtsZg1ik4s+YbtIVM99 ziKzB88spyklaRhsr5rfEJYyXfDKw/qqVcY6BUGW3sFLGn+HTgutusm6Q3CT55vKvXf0lFiK MxINtZiLihMBb9TpII0CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOJMWRmVeSWpSXmKPExsVy+t/xa7reN1xjDJaulrTYOGM9q0Xz4vVs FouWtTJbrD1yl92BxWP/3DXsHn1bVjF6fN4kF8AcxWWTkpqTWZZapG+XwJWxZ34PU0GbaMWH rXvZGxivC3YxcnJICJhInL3yh72LkYtDSGAJo0T3ndeMEE4Tk8SPVR3sIFVsAoYSXW+72EBs EQFZicNXfjODFDELzGKU6HnfCVYkLOArcfhzFzOIzSKgKnFj7gpGEJtXwFZi8eo5bBDr5CVW bzjAPIGRawEjwypGkdTS4tz03GJDveLE3OLSvHS95PzcTYxA72479nPzDsZLG4MPMQpwMCrx 8HKcc40RYk0sK67MPcQowcGsJML72h0oxJuSWFmVWpQfX1Sak1p8iFGag0VJnPe8QWWUkEB6 YklqdmpqQWoRTJaJg1OqgVGkeSXfA/ZAUZ/jdo/XtJg92RIvc/HEClXVVcZ6bxU67v3Jka0K WLLopP/24NipdZbWZq4nt4Q3r3A5+kz5bcT3GtZ/515ZVfP/PrtofX3ktOlOhsn9slobY//J TOARt3319bXXibWB37+KMSx02z2PLcO6v+7b0QfZd+Z1nvMv2Tvp9JOzmjeVWIozEg21mIuK EwE0kNbw6gEAAA== X-CMS-MailID: 20190121143347eucas1p117a10d4cd94fdc9b6d82fecf4d5dd373 CMS-TYPE: 201P X-CMS-RootMailID: 20190121143347eucas1p117a10d4cd94fdc9b6d82fecf4d5dd373 References: Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP USB3503 chip can be used without any I2C connection, what is handled by a simple platform device driver. Add support for resetting the chip (via GPIO lines) during system suspend/resume cycle by adding calls to existing suspend/resume functions used for E2C device. Signed-off-by: Marek Szyprowski --- drivers/usb/misc/usb3503.c | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c index f723f7b8c9ac..d5141aa79dd4 100644 --- a/drivers/usb/misc/usb3503.c +++ b/drivers/usb/misc/usb3503.c @@ -355,11 +355,8 @@ static int usb3503_platform_remove(struct platform_device *pdev) } #ifdef CONFIG_PM_SLEEP -static int usb3503_i2c_suspend(struct device *dev) +static int usb3503_suspend(struct usb3503 *hub) { - struct i2c_client *client = to_i2c_client(dev); - struct usb3503 *hub = i2c_get_clientdata(client); - usb3503_switch_mode(hub, USB3503_MODE_STANDBY); if (hub->clk) @@ -368,11 +365,8 @@ static int usb3503_i2c_suspend(struct device *dev) return 0; } -static int usb3503_i2c_resume(struct device *dev) +static int usb3503_resume(struct usb3503 *hub) { - struct i2c_client *client = to_i2c_client(dev); - struct usb3503 *hub = i2c_get_clientdata(client); - if (hub->clk) clk_prepare_enable(hub->clk); @@ -380,11 +374,38 @@ static int usb3503_i2c_resume(struct device *dev) return 0; } + +static int usb3503_i2c_suspend(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + + return usb3503_suspend(i2c_get_clientdata(client)); +} + +static int usb3503_i2c_resume(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + + return usb3503_resume(i2c_get_clientdata(client)); +} + +static int usb3503_platform_suspend(struct device *dev) +{ + return usb3503_suspend(dev_get_drvdata(dev)); +} + +static int usb3503_platform_resume(struct device *dev) +{ + return usb3503_resume(dev_get_drvdata(dev)); +} #endif static SIMPLE_DEV_PM_OPS(usb3503_i2c_pm_ops, usb3503_i2c_suspend, usb3503_i2c_resume); +static SIMPLE_DEV_PM_OPS(usb3503_platform_pm_ops, usb3503_platform_suspend, + usb3503_platform_resume); + static const struct i2c_device_id usb3503_id[] = { { USB3503_I2C_NAME, 0 }, { } @@ -415,6 +436,7 @@ static struct platform_driver usb3503_platform_driver = { .driver = { .name = USB3503_I2C_NAME, .of_match_table = of_match_ptr(usb3503_of_match), + .pm = &usb3503_platform_pm_ops, }, .probe = usb3503_platform_probe, .remove = usb3503_platform_remove,