From patchwork Wed Feb 25 11:55:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kim kyuwon X-Patchwork-Id: 8732 X-Patchwork-Delegate: me@felipebalbi.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1PBtjNn017659 for ; Wed, 25 Feb 2009 11:55:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757425AbZBYLzp (ORCPT ); Wed, 25 Feb 2009 06:55:45 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757368AbZBYLzp (ORCPT ); Wed, 25 Feb 2009 06:55:45 -0500 Received: from rv-out-0506.google.com ([209.85.198.230]:40591 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757269AbZBYLzo (ORCPT ); Wed, 25 Feb 2009 06:55:44 -0500 Received: by rv-out-0506.google.com with SMTP id g37so2993317rvb.1 for ; Wed, 25 Feb 2009 03:55:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=ZVPLVNSWuLae/9AxPD5LVNGJt+HkytCx5EEyTDz6n80=; b=h14ir3h/pO909I2cwBYvrZNR5gKxXxLM2kEZ8x+Eo22pEdrWy2ei1v0LDytzT6TmaE DI6ixZQFnONBwrT2zYxKHiXqxsjBzt1Ay12ET+Vk4adpFoETYYQ2pdMwcdtZoD3mfC+4 e/IBWCLW6O06h1lapPNeCZLYLira616xTuGwI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=eAxF9lrqgnB2LlB2vo5ljgx5ipGIMtvL0LIhrKW0RLiJS6S4VN+d9wE90o7UhNLLry XQoShw6LHiRNIFMJoON4qfo259e+AP7ZcC6xUEM7TLcffxJWWWTHm1oMy+2IfFXwS6DI i9dgYCx+z6E531RthjvPsmx0xBXqZgA2amArY= MIME-Version: 1.0 Received: by 10.142.113.19 with SMTP id l19mr27993wfc.10.1235562941769; Wed, 25 Feb 2009 03:55:41 -0800 (PST) Date: Wed, 25 Feb 2009 20:55:41 +0900 Message-ID: <4d34a0a70902250355q4b8c54e4rc9bbc1f40539e486@mail.gmail.com> Subject: [PATCH 2/2] twl: usb: Add the resume() and suspend() methods to twl4030-usb.c From: Kim Kyuwon To: linux-usb@vger.kernel.org Cc: OMAP , David Brownell , me@felipebalbi.com, q1.kim@samsung.com, Minkyu Kang Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Minkyu Kang The MPU module can be waked up by the unexpected USB interrupt(HSUSB_MC_NINT). For instance, if the MUSB is working as peripheral mode and connected to a host PC, it can never enter the low power mode due to interrupts from the host PC. This patch added the feature that a board specific file can determines that TWL4030 supplies the USB power or not in the low power mode. Disabling the USB power may save the power consumption. Signed-off-by: Minkyu Kang Signed-off-by: Kim Kyuwon --- drivers/usb/otg/twl4030-usb.c | 25 +++++++++++++++++++++++++ include/linux/i2c/twl4030.h | 1 + 2 files changed, 26 insertions(+), 0 deletions(-) diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c index 416e441..0d65a8d 100644 --- a/drivers/usb/otg/twl4030-usb.c +++ b/drivers/usb/otg/twl4030-usb.c @@ -256,6 +256,7 @@ struct twl4030_usb { u8 linkstat; u8 asleep; bool irq_enabled; + bool suspend_enabled; }; /* internal define on top of container_of */ @@ -618,6 +619,7 @@ static int __init twl4030_usb_probe(struct platform_device *pdev) twl->otg.set_suspend = twl4030_set_suspend; twl->usb_mode = pdata->usb_mode; twl->asleep = 1; + twl->suspend_enabled = pdata->suspend_enabled; /* init spinlock for workqueue */ spin_lock_init(&twl->lock); @@ -694,9 +696,32 @@ static int __exit twl4030_usb_remove(struct platform_device *pdev) return 0; } +int twl4030_usb_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct twl4030_usb *twl = platform_get_drvdata(pdev); + + if (!twl->suspend_enabled) + return 0; + + twl->otg.set_suspend(&twl->otg, 1); + + return 0; +} + +int twl4030_usb_resume(struct platform_device *pdev) +{ + struct twl4030_usb *twl = platform_get_drvdata(pdev); + + twl->otg.set_suspend(&twl->otg, 0); + + return 0; +} + static struct platform_driver twl4030_usb_driver = { .probe = twl4030_usb_probe, .remove = __exit_p(twl4030_usb_remove), + .suspend = twl4030_usb_suspend, + .resume = twl4030_usb_resume, .driver = { .name = "twl4030_usb", .owner = THIS_MODULE, diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h index c89d33b..0b12509 100644 --- a/include/linux/i2c/twl4030.h +++ b/include/linux/i2c/twl4030.h @@ -325,6 +325,7 @@ enum twl4030_usb_mode { struct twl4030_usb_data { enum twl4030_usb_mode usb_mode; + bool suspend_enabled; }; struct twl4030_ins {