From: Kevin Hilman <khilman@deeprootsystems.com>
To: Charulatha V <charu@ti.com>
Cc: linux-omap@vger.kernel.org, paul@pwsan.com, tony@atomide.com,
rnayak@ti.com, p-basak2@ti.com, b-cousson@ti.com
Subject: Re: [PATCH:v4 12/13] OMAP: GPIO: Implement GPIO as a platform device
Date: Fri, 25 Jun 2010 16:36:18 -0700 [thread overview]
Message-ID: <87lja28z2l.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1277218916-15213-13-git-send-email-charu@ti.com> (Charulatha V.'s message of "Tue, 22 Jun 2010 20:31:55 +0530")
Charulatha V <charu@ti.com> writes:
> This patch implements GPIO as a platform device. Also it
> implements OMAP2PLUS specific GPIO as HWMOD FW adapted device.
> This patch makes GPIO to use runtime APIs.
>
> GPIO APIs are used in machine_init functions. Hence it is
> required to complete GPIO probe before machine_init. Therefore
> GPIO device register and driver register are implemented as
> postcore_initcalls.
>
> Inorder to convert GPIO as platform device, modifications are
> required in clockxxxx_data.c file for OMAP1 so that device names
> can be used to obtain clock instead of getting clocks by
> name/NULL ptr.
>
> omap_gpio_init() does nothing now and this function would be
> removed in the next patch as it's usage is spread across most of
> the board files.
>
> TODO:
> 1. Cleanup the GPIO driver. Use function pointers and register
> offest pointers instead of using hardcoded values
> 2. Remove all cpu_is_ checks and OMAP specific macros
> 3. Remove usage of gpio_bank array so that only
> instance specific information is used in driver code
> 4. Modify save/restore context, gpio_prepare_for_idle,
> and gpio_resume_after_idle functions as instance
> specific function and not for all instances in a single call
init_gpio_info() too.
I think this item (TODO #4) needs to be done as part of this series, as
this new generic driver needs to be completely ignorant of how many
banks are on chip, or currently in use. All operations should be on a
single device (in this case, a single GPIO bank.)
As each hwmod has its own device, it can have it's own independent
suspend/resume. To do this, you should remove the sysdev_class and
sys_device just use the regular device. Here's a little patch[1] on top
of your current series that shows how you would hook up the standard PM
methods. Also, the prepare_for_idle, resume_from_idle should be handled
by the runtime PM callbacks.
With the save/restore context handled on demand (when mod_usage
transitions to/from zero), and the runtime PM calls handled from within
the driver, we could get rid of all the GPIO calls from
omap_sram_idle(). That would be a huge improvement.
Kevin
[1] compile-tested only
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 6dc5e4b..6a5a8f4 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -2091,10 +2091,44 @@ void omap_gpio_restore_context(void)
}
#endif
+static int gpio_bank_suspend(struct device *dev)
+{
+ return 0;
+}
+
+static int gpio_bank_resume(struct device *dev)
+{
+ return 0;
+}
+
+static int gpio_bank_runtime_idle(struct device *dev)
+{
+ return 0;
+}
+
+static int gpio_bank_runtime_suspend(struct device *dev)
+{
+ return 0;
+}
+
+static int gpio_bank_runtime_resume(struct device *dev)
+{
+ return 0;
+}
+
+static struct dev_pm_ops gpio_pm_ops = {
+ .suspend = gpio_bank_suspend,
+ .resume = gpio_bank_resume,
+ .runtime_idle = gpio_bank_runtime_idle,
+ .runtime_suspend = gpio_bank_runtime_suspend,
+ .runtime_resume = gpio_bank_runtime_resume,
+};
+
static struct platform_driver omap_gpio_driver = {
.probe = omap_gpio_probe,
.driver = {
.name = "omap-gpio",
+ .pm = &gpio_pm_ops,
},
};
next prev parent reply other threads:[~2010-06-25 23:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-22 15:01 [PATCH:v4 00/13] OMAP: GPIO: Implement GPIO in HWMOD way Charulatha V
2010-06-22 15:01 ` [PATCH:v4 01/13] OMAP: GPIO: Modify init() in preparation for platform device implementation Charulatha V
2010-06-22 15:01 ` [PATCH:v4 02/13] OMAP: GPIO: Populate GPIO base address in omapxxxx.h Charulatha V
2010-06-22 15:01 ` [PATCH:v4 03/13] OMAP: GPIO: Include platform_data structure for GPIO Charulatha V
2010-06-22 15:01 ` [PATCH:v4 04/13] OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init Charulatha V
2010-06-22 15:01 ` [PATCH:v4 05/13] OMAP: GPIO: Introduce support for OMAP16xx " Charulatha V
2010-06-22 15:01 ` [PATCH:v4 06/13] OMAP: GPIO: Introduce support for OMAP7xx " Charulatha V
2010-06-22 15:01 ` [PATCH:v4 07/13] OMAP: GPIO: add GPIO hwmods structures for OMAP3 Charulatha V
2010-06-22 15:01 ` [PATCH:v4 08/13] OMAP: GPIO: add GPIO hwmods structures for OMAP242X Charulatha V
2010-06-22 15:01 ` [PATCH:v4 09/13] OMAP: GPIO: add GPIO hwmods structures for OMAP243X Charulatha V
2010-06-22 15:01 ` [PATCH:v4 10/13] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct Charulatha V
2010-06-22 15:01 ` [PATCH:v4 11/13] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init Charulatha V
2010-06-22 15:01 ` [PATCH:v4 12/13] OMAP: GPIO: Implement GPIO as a platform device Charulatha V
2010-06-22 15:01 ` [PATCH:v4 13/13] OMAP: GPIO: Remove omap_gpio_init() Charulatha V
2010-06-25 23:36 ` Kevin Hilman [this message]
2010-06-24 7:03 ` [PATCH:v4 03/13] OMAP: GPIO: Include platform_data structure for GPIO DebBarma, Tarun Kanti
2010-07-06 13:17 ` [PATCH:v4 00/13] OMAP: GPIO: Implement GPIO in HWMOD way Tony Lindgren
2010-07-27 11:47 ` Cousson, Benoit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lja28z2l.fsf@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=b-cousson@ti.com \
--cc=charu@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=p-basak2@ti.com \
--cc=paul@pwsan.com \
--cc=rnayak@ti.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.