From: Kevin Hilman <khilman@ti.com>
To: "Manuel, Lesly Arackal" <leslyam@ti.com>
Cc: linux-omap@vger.kernel.org, Nishanth Menon <nm@ti.com>,
David Derrick <dderrick@ti.com>,
Samuel Ortiz <sameo@linux.intel.com>
Subject: Re: [PATCH v10 4/7] MFD: TWL4030: power scripts for OMAP3 boards
Date: Mon, 06 Jun 2011 09:08:30 -0700 [thread overview]
Message-ID: <878vtf7xj5.fsf@ti.com> (raw)
In-Reply-To: <BANLkTikU+tgnECLmTqOgXJ1wmvbG0tVT0g@mail.gmail.com> (Lesly Arackal Manuel's message of "Mon, 6 Jun 2011 19:33:07 +0530")
"Manuel, Lesly Arackal" <leslyam@ti.com> writes:
> Hi Kevin,
>
> On Thu, Jun 2, 2011 at 11:59 PM, Kevin Hilman <khilman@ti.com> wrote:
>> Lesly A M <leslyam@ti.com> writes:
>>
>>> Power bus message sequence for TWL4030 to enter sleep/wakeup/warm_reset.
>>>
>>> TWL4030 power scripts which can be used by different OMAP3 boards
>>> with the power companion chip (TWL4030 series).
>>>
>>> The twl4030 generic script can be used by any board file to update
>>> the power data in twl4030_platform_data.
>>
>> What about existing board files that are using their own scripts?
>>
>> On n900 for example, board-rx51-peripherals.c has its own custom
>> scripts which are registered at board init time. These are then
>> over written by your new driver which loads later.
>>
>> So first, can you verify if the n900 scripts can/should be replaced by
>> these generic ones. And second, please find a way for board files to
>> override these scripts at runtime instead of using a Kconfig.
>
> Customer boards have to modify the script for their board
> (may be using modem which is not present in SDP).
> Is it ok to add a flag to check whether the board file has already
> initialized the script.
Sounds fine.
>>> Since the TWL4030 power script has dependency with APIs in twl4030-power.c
>>> removing the __init for these APIs.
>>
>> I think separating this part out into a separate patch, with a better
>> description would make the rest of this patch much more readable. As it
>> is, it doesn't make much sense since all the script functions and data
>> are __init or __initdata.
> Ok
>
>> These changes also introduce a new complier warning:
>>
>> CC drivers/mfd/twl4030-power.o
>> /work/kernel/omap/pm/drivers/mfd/twl4030-power.c: In function 'twl4030_power_init':
>> /work/kernel/omap/pm/drivers/mfd/twl4030-power.c:457:5: warning: 'err' may be used uninitialized in this function
>> /work/kernel/omap/pm/drivers/mfd/twl4030-power.c:171:6: note: 'err' was declared here
>
> Ok, I will fix it
>>
>>> For more information please see:
>>> http://omapedia.org/wiki/TWL4030_power_scripts
>>
>> This is an excellent wiki, thank for the detailed description!
>>
>>> Signed-off-by: Lesly A M <leslyam@ti.com>
>>> Cc: Nishanth Menon <nm@ti.com>
>>> Cc: David Derrick <dderrick@ti.com>
>>> Cc: Samuel Ortiz <sameo@linux.intel.com>
>>> ---
>>> arch/arm/configs/omap2plus_defconfig | 1 +
>>> arch/arm/mach-omap2/devices.c | 15 ++
>>> drivers/mfd/Kconfig | 11 +
>>> drivers/mfd/Makefile | 1 +
>>> drivers/mfd/twl4030-power.c | 31 ++--
>>> drivers/mfd/twl4030-script-omap.c | 373 ++++++++++++++++++++++++++++++++++
>>> include/linux/i2c/twl.h | 41 ++++-
>>> 7 files changed, 454 insertions(+), 19 deletions(-)
>>> create mode 100644 drivers/mfd/twl4030-script-omap.c
>>>
>>> diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
>>> index 076db52..d9b9858 100644
>>> --- a/arch/arm/configs/omap2plus_defconfig
>>> +++ b/arch/arm/configs/omap2plus_defconfig
>>> @@ -184,6 +184,7 @@ CONFIG_TWL4030_WATCHDOG=y
>>> CONFIG_MENELAUS=y
>>> CONFIG_TWL4030_CORE=y
>>> CONFIG_TWL4030_POWER=y
>>> +CONFIG_TWL4030_SCRIPT=m
>>> CONFIG_REGULATOR=y
>>> CONFIG_REGULATOR_TWL4030=y
>>> CONFIG_REGULATOR_TPS65023=y
>>> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
>>> index 7b85585..7653329 100644
>>> --- a/arch/arm/mach-omap2/devices.c
>>> +++ b/arch/arm/mach-omap2/devices.c
>>> @@ -329,6 +329,20 @@ static void omap_init_audio(void)
>>> static inline void omap_init_audio(void) {}
>>> #endif
>>>
>>> +#ifdef CONFIG_ARCH_OMAP3
>>
>> Shouldn't this depend on CONFIG_TWL4030_SCRIPT ?
> Ok
>
>>> +static struct platform_device omap_twl4030_script = {
>>> + .name = "twl4030_script",
>>> + .id = -1,
>>> +};
>>> +
>>> +static void omap_init_twl4030_script(void)
>>> +{
>>> + platform_device_register(&omap_twl4030_script);
>>> +}
>>> +#else
>>> +static inline void omap_init_twl4030_script(void) {}
>>> +#endif
>>
>> I guess this gets to the debate about whether these scripts should be in
>> drivers/mfd or in arch/arm/mach-omap2, but wherever the script data
>> lives, this platform_device definition and register should be also.
>>
>> IOW, there's not a clean separation between driver and device currently.
>> IMO, The platform_driver part should just be part of twl4030-power.c,
>> and all the scripts and platform_device creation/registration should be
>> part of the script file.
>>
>> As far as where the script device data should go, I'd vote for
>> drivers/mfd, where it can be compiled as a module along with the rest of
>> the twl4030 code.
>
> Any final conclusion ?
>
>>> #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
>>>
>>> #include <plat/mcspi.h>
>>> @@ -691,6 +705,7 @@ static int __init omap2_init_devices(void)
>>> omap_init_sham();
>>> omap_init_aes();
>>> omap_init_vout();
>>> + omap_init_twl4030_script();
>>>
>>> return 0;
>>> }
>>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>>> index 3ed3ff0..bed88ce 100644
>>> --- a/drivers/mfd/Kconfig
>>> +++ b/drivers/mfd/Kconfig
>>> @@ -204,6 +204,17 @@ config TWL4030_POWER
>>> and load scripts controlling which resources are switched off/on
>>> or reset when a sleep, wakeup or warm reset event occurs.
>>>
>>> +config TWL4030_SCRIPT
>>> + tristate "Support TWL4030 script for OMAP3 boards"
>>> + depends on TWL4030_CORE && TWL4030_POWER
>>> + help
>>> + Say yes here if you want to use the twl4030 power scripts
>>> + for OMAP3 boards. Power bus message sequence for
>>> + TWL4030 to enter sleep/wakeup/warm_reset.
>>> +
>>> + TWL4030 power scripts which can be used by different
>>> + OMAP3 boards with the power companion chip (TWL4030 series).
>>> +
>>
>> Why do we need another Kconfig for this? It should be enabled and
>> overridden at runtime via board files.
>
> Kconfig option was added when script was changed to insert-able module,
> which was suggested by Tony as comment for last version.
Yes, it needs to be a loadable module, but doesn't need Kconfig.
IMO, it should just be build whenever CONFIG_TWL4030_POWER=y && CONFIG_ARCH_OMAP2PLUS=y
Adding another build option means needing to ensure more build-option
testing coverage.
Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-06-06 16:08 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-06 13:17 [PATCH v10 0/7] MFD: TWL4030: power script and workaround for erratum 27 Lesly A M
2011-05-06 13:17 ` [PATCH v10 1/7] MFD: TWL4030: Fix for the TWL4030 sleep/wakeup sequence Lesly A M
2011-05-13 12:40 ` Kevin Hilman
2011-05-13 17:14 ` Samuel Ortiz
2011-05-06 13:17 ` [PATCH v10 2/7] MFD: TWL4030: Correct the warning print during script loading Lesly A M
2011-05-13 17:19 ` Samuel Ortiz
2011-05-06 13:17 ` [PATCH v10 3/7] MFD: TWL4030: Modifying the macro name Main_Ref to all caps Lesly A M
2011-05-12 10:42 ` Tony Lindgren
2011-05-13 7:12 ` Manuel, Lesly Arackal
2011-05-13 17:20 ` Samuel Ortiz
2011-05-06 13:17 ` [PATCH v10 4/7] MFD: TWL4030: power scripts for OMAP3 boards Lesly A M
2011-05-12 10:56 ` Tony Lindgren
2011-05-13 7:53 ` Manuel, Lesly Arackal
2011-05-13 18:39 ` Samuel Ortiz
2011-05-17 13:40 ` Manuel, Lesly Arackal
2011-05-22 21:40 ` Samuel Ortiz
2011-05-24 12:17 ` Manuel, Lesly Arackal
2011-06-02 18:29 ` Kevin Hilman
2011-06-06 14:03 ` Manuel, Lesly Arackal
2011-06-06 16:08 ` Kevin Hilman [this message]
2011-05-06 13:17 ` [PATCH v10 5/7] MFD: TWL4030: TWL version checking Lesly A M
2011-05-13 17:22 ` Samuel Ortiz
2011-05-06 13:17 ` [PATCH v10 6/7] MFD: TWL4030: workaround changes for Erratum 27 Lesly A M
2011-05-06 13:17 ` [PATCH v10 7/7] MFD: TWL4030: optimizing resource configuration Lesly A M
2011-06-02 15:36 ` [PATCH v10 0/7] MFD: TWL4030: power script and workaround for erratum 27 Steve Sakoman
2011-06-02 17:12 ` Steve Sakoman
2011-06-03 0:31 ` Kevin Hilman
2011-06-06 14:05 ` Manuel, Lesly Arackal
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=878vtf7xj5.fsf@ti.com \
--to=khilman@ti.com \
--cc=dderrick@ti.com \
--cc=leslyam@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
--cc=sameo@linux.intel.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.