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: 156203 Delivered-To: patch@linaro.org Received: by 2002:ac9:7558:0:0:0:0:0 with SMTP id r24csp6278641oct; Mon, 21 Jan 2019 06:33:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN493T8lwKekRLxVfAN85ap6kUH6o/fN+nCRVtCkQJQVVhPRsz0FQaAR3H01FLxn7yLkIiz/ X-Received: by 2002:a63:a41:: with SMTP id z1mr28241729pgk.117.1548081232137; Mon, 21 Jan 2019 06:33:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548081232; cv=none; d=google.com; s=arc-20160816; b=a44WuAxAch5zL6BUUfEe4D79QVfWOd4yYcv8475PJwnBskD/2KcLiWVebjXjrCbOY3 Z6Lw73177k+e5nnagFSv8Q4S5y9BnqH2KApSigqziW0wptu0T57DjZZY0uk1zFvF4+Fs 8XLUu2m04STTrjlbawTNxNHh1LTqVug6mhoaNhKjiVD2tVWmEb6nvX7zrN4waIk+FZ0r sNDdKI2H+yzQbKJVA8bfEXd91sIuxgqaXuMYgSiPKvJN7oVXUEo1kBVbfKLG8cxuL2TO FUPl6pisHAkFilWJmVi4bqSS1qfdJNXd/HdJXwIAqqjhjsH1qG8evWHMY0Nk9uNRE5Ii OBMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=Pii6HNOsiqIfyD9/k5i/uGMutKWEIOKoqjjVqMULYbg=; b=p+uSxhh2x+8ko45Ius+7FXJmhGwIEhyyp57xPLPhKuglAXmzwvk1FX3RECMO3ly9Yr vwt/yiceR8KZ94Tdu8SZc2JvH1xLu/sK3rvnf64sp5Re/GmdHvRLIMh+TA4QO3RMHUEf IxUsOQ7U7kBaK+8w2mQyRAT/HFyxXTV+MvWj/SnpP1eVv3MnidqY+KWkhzpySeC3IwGR zkWEb9Mm8qChOVvlhIPUy5jVk2ju/jXgKKdawLmQpXIhMhPk41SnwDenHTRwO/Ddjx97 JwT2L6IkPKuqyESXP0Bir/nl3MO45CHdjD5YDY4OipGDE/ZTVheg4J3fLC2JcaeE7dSd +1bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=m03qMj7P; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v7si12701409plo.12.2019.01.21.06.33.51; Mon, 21 Jan 2019 06:33:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=m03qMj7P; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729299AbfAUOdv (ORCPT + 5 others); 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 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(-) -- 2.17.1 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,