RE: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code

2010-09-17 Thread Gopinath, Thara


>>-Original Message-
>>From: Kevin Hilman [mailto:khil...@deeprootsystems.com]
>>Sent: Thursday, September 16, 2010 10:46 PM
>>To: Gopinath, Thara
>>Cc: linux-omap@vger.kernel.org; linux-arm-ker...@lists.infradead.org
>>Subject: Re: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code
>>
>>"Gopinath, Thara"  writes:
>>
>>[...]
>>
>>>>>From: Paul Walmsley 
>>>>>
>>>>>The OPP layer code should be independent of the PMIC,
>>>>>introduce the TWL/TPS-specific code out to its own file.
>>>
>>> Hello Kevin,
>>>
>>> I have been using this code for a while now. I really do not think wee
>>> need a separate file for implementing the vsel to voltage in (uV) and
>>> vice versa formulas. Today only voltage layer is interested in these
>>> conversions. Voltage layer has a structure that can be populated with
>>> the information required from the PMIC. We only need to add two more
>>> function pointers to this structure. This info can then be passed from
>>> the actual PMIC driver file. This will make it much more simpler for
>>> OMAP4 where we have different formulas between different revisions of
>>> PMIC. Also in the omap voltage code we will no longer have to hard
>>> code omap_twl_vsel_to_uv and omap_twl_uv_to_vsel.
>>
>>Feel free to post an RFC series for what you're proposing.
>>
>>IMHO, even the voltage layer should not care about these conversions.
>>The voltage layer should care about voltages, and the PMIC layer should
>>handle these conversions.  IOW, this stuff is best abstracted in the
>>PMIC code, or board- or SoC-specific hooks that can be registered with
>>the PMIC.
>>
>>> So please consider dropping this patch from this series.
>>
>>If you pick this up as part of your voltage series (or more likely as a
>>pre-requisite of your voltage series) we can surely drop it from this
>>series, at it doesn't really belong with the OPP series.

Hello Kevin/Nishant

My suggestion is introduce two new APIs in drivers/twl-core.c. Then once voltage
layer support is added call into an API provided by voltage layer to register 
two APIs.
If both Nishant and you are ok with this I will post this change as par of my 
voltage
and smartreflex series.

Regards
Thara

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code

2010-09-17 Thread Nishanth Menon

Gopinath, Thara had written, on 09/17/2010 09:57 AM, the following:
[..]

From: Paul Walmsley 

The OPP layer code should be independent of the PMIC,
introduce the TWL/TPS-specific code out to its own file.


I have been using this code for a while now. I really do not think wee need a 
separate
file for implementing the vsel to voltage in (uV) and vice versa formulas. 
Today only voltage

This split introduces a PMIC level abstraction already. Do you have a
suggestion which file it should go to? It is definitely not part of
opp.c, not part of other existing twl files as well. the job of this
file was to introduce conversion routines which can be used by any layer
(voltage layer if need be - it used to be srf and smartreflex before)..
in fact one of your voltage layer patches introduces capability for 6030
as well
http://marc.info/?l=linux-omap&m=128213020927919&w=2

Yes one of my patches has introduces this coz I had no other way
to add OMAP4 support. But I still do not understand why cant these
APIs be implemented in twl-core.c or twl4030-power.c?

Why there? Twl power does regulator operations not conversion
operations. core is not the place either as it is function independent.


Why  do you say core is not the place. For me core is exactly
the place. It is the PMIC driver file.
See [1] - they are all generic without a specific domain implementation. 
if we are so touchy about the location we want these api implementation, 
I guess core might be a compromise enough.. personally even though I 
believe core should remain specific functionality independent, I dont 
think I have very strong opinions about adding helpers there.. i 
would'nt put registration there though.. That should be in board files..


[1] 
http://git.kernel.org/?p=linux/kernel/git/khilman/linux-omap-pm.git;a=blob;f=drivers/mfd/twl4030-core.c;h=769b34bd48e445880ac0920423d9b73eabaf4cb7;hb=HEAD


--
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code

2010-09-17 Thread Gopinath, Thara


>>-Original Message-
>>From: Menon, Nishanth
>>Sent: Thursday, September 16, 2010 7:37 PM
>>To: Gopinath, Thara
>>Cc: Kevin Hilman; linux-omap@vger.kernel.org; 
>>linux-arm-ker...@lists.infradead.org
>>Subject: Re: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code
>>
>>Gopinath, Thara had written, on 09/16/2010 08:51 AM, the following:
>>>
>>>>> -Original Message-
>>>>> From: Menon, Nishanth
>>>>> Sent: Thursday, September 16, 2010 5:45 PM
>>>>> To: Gopinath, Thara
>>>>> Cc: Kevin Hilman; linux-omap@vger.kernel.org; 
>>>>> linux-arm-ker...@lists.infradead.org
>>>>> Subject: Re: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific 
>>>>> code
>>>>>
>>>>> Gopinath, Thara had written, on 09/16/2010 05:40 AM, the following:
>>>>>>>> -Original Message-
>>>>>>>> From: linux-omap-ow...@vger.kernel.org 
>>>>>>>> [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of
>>>>> Kevin
>>>>>>>> Hilman
>>>>>>>> Sent: Thursday, September 16, 2010 3:27 AM
>>>>>>>> To: linux-omap@vger.kernel.org
>>>>>>>> Cc: linux-arm-ker...@lists.infradead.org
>>>>>>>> Subject: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific 
>>>>>>>> code
>>>>>>>>
>>>>>>>> From: Paul Walmsley 
>>>>>>>>
>>>>>>>> The OPP layer code should be independent of the PMIC,
>>>>>>>> introduce the TWL/TPS-specific code out to its own file.
>>>>>> Hello Kevin,
>>>>>>
>>>>>> I have been using this code for a while now. I really do not think wee 
>>>>>> need a separate
>>>>>> file for implementing the vsel to voltage in (uV) and vice versa 
>>>>>> formulas. Today only voltage
>>>>> This split introduces a PMIC level abstraction already. Do you have a
>>>>> suggestion which file it should go to? It is definitely not part of
>>>>> opp.c, not part of other existing twl files as well. the job of this
>>>>> file was to introduce conversion routines which can be used by any layer
>>>>> (voltage layer if need be - it used to be srf and smartreflex before)..
>>>>> in fact one of your voltage layer patches introduces capability for 6030
>>>>> as well
>>>>> http://marc.info/?l=linux-omap&m=128213020927919&w=2
>>>
>>> Yes one of my patches has introduces this coz I had no other way
>>> to add OMAP4 support. But I still do not understand why cant these
>>> APIs be implemented in twl-core.c or twl4030-power.c?
>>Why there? Twl power does regulator operations not conversion
>>operations. core is not the place either as it is function independent.

Hello Nishant,

Why  do you say core is not the place. For me core is exactly
the place. It is the PMIC driver file.

Regards
Thara

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code

2010-09-16 Thread Kevin Hilman
"Gopinath, Thara"  writes:

[...]

>>>From: Paul Walmsley 
>>>
>>>The OPP layer code should be independent of the PMIC,
>>>introduce the TWL/TPS-specific code out to its own file.
>
> Hello Kevin,
>
> I have been using this code for a while now. I really do not think wee
> need a separate file for implementing the vsel to voltage in (uV) and
> vice versa formulas. Today only voltage layer is interested in these
> conversions. Voltage layer has a structure that can be populated with
> the information required from the PMIC. We only need to add two more
> function pointers to this structure. This info can then be passed from
> the actual PMIC driver file. This will make it much more simpler for
> OMAP4 where we have different formulas between different revisions of
> PMIC. Also in the omap voltage code we will no longer have to hard
> code omap_twl_vsel_to_uv and omap_twl_uv_to_vsel. 

Feel free to post an RFC series for what you're proposing.  

IMHO, even the voltage layer should not care about these conversions.
The voltage layer should care about voltages, and the PMIC layer should
handle these conversions.  IOW, this stuff is best abstracted in the
PMIC code, or board- or SoC-specific hooks that can be registered with
the PMIC.

> So please consider dropping this patch from this series.

If you pick this up as part of your voltage series (or more likely as a
pre-requisite of your voltage series) we can surely drop it from this
series, at it doesn't really belong with the OPP series.

There are no upstream users of this yet, so dropping it is easy. :)

Kevin

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code

2010-09-16 Thread Nishanth Menon

Gopinath, Thara had written, on 09/16/2010 08:51 AM, the following:



-Original Message-
From: Menon, Nishanth
Sent: Thursday, September 16, 2010 5:45 PM
To: Gopinath, Thara
Cc: Kevin Hilman; linux-omap@vger.kernel.org; 
linux-arm-ker...@lists.infradead.org
Subject: Re: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code

Gopinath, Thara had written, on 09/16/2010 05:40 AM, the following:

-Original Message-
From: linux-omap-ow...@vger.kernel.org 
[mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of

Kevin

Hilman
Sent: Thursday, September 16, 2010 3:27 AM
To: linux-omap@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Subject: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code

From: Paul Walmsley 

The OPP layer code should be independent of the PMIC,
introduce the TWL/TPS-specific code out to its own file.

Hello Kevin,

I have been using this code for a while now. I really do not think wee need a 
separate
file for implementing the vsel to voltage in (uV) and vice versa formulas. 
Today only voltage

This split introduces a PMIC level abstraction already. Do you have a
suggestion which file it should go to? It is definitely not part of
opp.c, not part of other existing twl files as well. the job of this
file was to introduce conversion routines which can be used by any layer
(voltage layer if need be - it used to be srf and smartreflex before)..
in fact one of your voltage layer patches introduces capability for 6030
as well
http://marc.info/?l=linux-omap&m=128213020927919&w=2


Yes one of my patches has introduces this coz I had no other way
to add OMAP4 support. But I still do not understand why cant these
APIs be implemented in twl-core.c or twl4030-power.c? 
Why there? Twl power does regulator operations not conversion 
operations. core is not the place either as it is function independent.





layer is interested in these conversions. Voltage layer has a structure that 
can be populated with
the information required from the PMIC. We only need to add two more function 
pointers to this

structure.

This info can then be passed from the actual PMIC driver file. This

will make it much

more simpler for OMAP4 where we have different formulas between different 
revisions of PMIC. Also
in the omap voltage code we will no longer have to hard code 
omap_twl_vsel_to_uv and

omap_twl_uv_to_vsel.
I think the problem is with the voltage layer (which has not been posted
upstream) which is using hard coded function pointer. What the patchset
should have done is to introduce function pointers registration from
twl_tps.c to voltage layer and voltage layer should ideally been using
function pointers by itself.


So please consider dropping this patch from this series.

I think I disagree - rationale for having this separated as a pmic
specific file is still sound, only the implementation of the future
framework should have changed (it should be using function pointers
instead of hardcoded function names). in fact I can add additional
suggestion for the voltage layer: the pmic selection should be done from
a board file - This will allow voltage layer to handle numerous PMICs
and combination of PMICs controlling various domains as well.. the only
neat way to handle it is ofcourse using function pointers.


Exactly if voltage layer has to use a func ptr, why not let them be populated
by the PMIC driver files directly?
Again, we are going into the details of how voltage layer will be 
implemented.. What suggestion do you do when on board x vdd1 is driven 
by PMIC1, vdd2 by PMIC2? it will have to be somesort of different 
registration mechanism. but nothing prevents the framework from 
registering the pointers defined in twl_tps.c








PS: Suggestion
- please fix your mailer to round off for 70/80 char.


Will try.


- might be good to point folks to rfc patchset for voltage layer to give
context.


https://patchwork.kernel.org/patch/119429/


thanks..

--
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code

2010-09-16 Thread Gopinath, Thara


>>-Original Message-
>>From: Menon, Nishanth
>>Sent: Thursday, September 16, 2010 5:45 PM
>>To: Gopinath, Thara
>>Cc: Kevin Hilman; linux-omap@vger.kernel.org; 
>>linux-arm-ker...@lists.infradead.org
>>Subject: Re: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code
>>
>>Gopinath, Thara had written, on 09/16/2010 05:40 AM, the following:
>>>
>>>>> -Original Message-
>>>>> From: linux-omap-ow...@vger.kernel.org 
>>>>> [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of
>>Kevin
>>>>> Hilman
>>>>> Sent: Thursday, September 16, 2010 3:27 AM
>>>>> To: linux-omap@vger.kernel.org
>>>>> Cc: linux-arm-ker...@lists.infradead.org
>>>>> Subject: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code
>>>>>
>>>>> From: Paul Walmsley 
>>>>>
>>>>> The OPP layer code should be independent of the PMIC,
>>>>> introduce the TWL/TPS-specific code out to its own file.
>>>
>>> Hello Kevin,
>>>
>>> I have been using this code for a while now. I really do not think wee need 
>>> a separate
>>> file for implementing the vsel to voltage in (uV) and vice versa formulas. 
>>> Today only voltage
>>This split introduces a PMIC level abstraction already. Do you have a
>>suggestion which file it should go to? It is definitely not part of
>>opp.c, not part of other existing twl files as well. the job of this
>>file was to introduce conversion routines which can be used by any layer
>>(voltage layer if need be - it used to be srf and smartreflex before)..
>>in fact one of your voltage layer patches introduces capability for 6030
>>as well
>>http://marc.info/?l=linux-omap&m=128213020927919&w=2

Yes one of my patches has introduces this coz I had no other way
to add OMAP4 support. But I still do not understand why cant these
APIs be implemented in twl-core.c or twl4030-power.c? 

>>
>>> layer is interested in these conversions. Voltage layer has a structure 
>>> that can be populated with
>>> the information required from the PMIC. We only need to add two more 
>>> function pointers to this
>>structure.
>> > This info can then be passed from the actual PMIC driver file. This
>>will make it much
>>> more simpler for OMAP4 where we have different formulas between different 
>>> revisions of PMIC. Also
>>> in the omap voltage code we will no longer have to hard code 
>>> omap_twl_vsel_to_uv and
>>omap_twl_uv_to_vsel.
>>I think the problem is with the voltage layer (which has not been posted
>>upstream) which is using hard coded function pointer. What the patchset
>>should have done is to introduce function pointers registration from
>>twl_tps.c to voltage layer and voltage layer should ideally been using
>>function pointers by itself.
>>
>> > So please consider dropping this patch from this series.
>>I think I disagree - rationale for having this separated as a pmic
>>specific file is still sound, only the implementation of the future
>>framework should have changed (it should be using function pointers
>>instead of hardcoded function names). in fact I can add additional
>>suggestion for the voltage layer: the pmic selection should be done from
>>a board file - This will allow voltage layer to handle numerous PMICs
>>and combination of PMICs controlling various domains as well.. the only
>>neat way to handle it is ofcourse using function pointers.

Exactly if voltage layer has to use a func ptr, why not let them be populated
by the PMIC driver files directly?

>>
>>
>>PS: Suggestion
>>- please fix your mailer to round off for 70/80 char.

Will try.

>>- might be good to point folks to rfc patchset for voltage layer to give
>>context.

https://patchwork.kernel.org/patch/119429/

>>
>>--
>>Regards,
>>Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code

2010-09-16 Thread Nishanth Menon

Gopinath, Thara had written, on 09/16/2010 05:40 AM, the following:



-Original Message-
From: linux-omap-ow...@vger.kernel.org 
[mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Kevin
Hilman
Sent: Thursday, September 16, 2010 3:27 AM
To: linux-omap@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Subject: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code

From: Paul Walmsley 

The OPP layer code should be independent of the PMIC,
introduce the TWL/TPS-specific code out to its own file.


Hello Kevin,

I have been using this code for a while now. I really do not think wee need a 
separate
file for implementing the vsel to voltage in (uV) and vice versa formulas. 
Today only voltage
This split introduces a PMIC level abstraction already. Do you have a 
suggestion which file it should go to? It is definitely not part of 
opp.c, not part of other existing twl files as well. the job of this 
file was to introduce conversion routines which can be used by any layer 
(voltage layer if need be - it used to be srf and smartreflex before)..
in fact one of your voltage layer patches introduces capability for 6030 
as well

http://marc.info/?l=linux-omap&m=128213020927919&w=2


layer is interested in these conversions. Voltage layer has a structure that 
can be populated with
the information required from the PMIC. We only need to add two more function 
pointers to this structure.
> This info can then be passed from the actual PMIC driver file. This 
will make it much

more simpler for OMAP4 where we have different formulas between different 
revisions of PMIC. Also
in the omap voltage code we will no longer have to hard code 
omap_twl_vsel_to_uv and omap_twl_uv_to_vsel.
I think the problem is with the voltage layer (which has not been posted 
upstream) which is using hard coded function pointer. What the patchset 
should have done is to introduce function pointers registration from 
twl_tps.c to voltage layer and voltage layer should ideally been using 
function pointers by itself.


> So please consider dropping this patch from this series.
I think I disagree - rationale for having this separated as a pmic 
specific file is still sound, only the implementation of the future 
framework should have changed (it should be using function pointers 
instead of hardcoded function names). in fact I can add additional 
suggestion for the voltage layer: the pmic selection should be done from 
a board file - This will allow voltage layer to handle numerous PMICs 
and combination of PMICs controlling various domains as well.. the only 
neat way to handle it is ofcourse using function pointers.



PS: Suggestion
- please fix your mailer to round off for 70/80 chars..
- might be good to point folks to rfc patchset for voltage layer to give 
context.


--
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code

2010-09-16 Thread Gopinath, Thara


>>-Original Message-
>>From: linux-omap-ow...@vger.kernel.org 
>>[mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Kevin
>>Hilman
>>Sent: Thursday, September 16, 2010 3:27 AM
>>To: linux-omap@vger.kernel.org
>>Cc: linux-arm-ker...@lists.infradead.org
>>Subject: [PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code
>>
>>From: Paul Walmsley 
>>
>>The OPP layer code should be independent of the PMIC,
>>introduce the TWL/TPS-specific code out to its own file.

Hello Kevin,

I have been using this code for a while now. I really do not think wee need a 
separate
file for implementing the vsel to voltage in (uV) and vice versa formulas. 
Today only voltage
layer is interested in these conversions. Voltage layer has a structure that 
can be populated with
the information required from the PMIC. We only need to add two more function 
pointers to this structure. This info can then be passed from the actual PMIC 
driver file. This will make it much
more simpler for OMAP4 where we have different formulas between different 
revisions of PMIC. Also
in the omap voltage code we will no longer have to hard code 
omap_twl_vsel_to_uv and omap_twl_uv_to_vsel. So please consider dropping this 
patch from this series.

Regards
Thara

>>
>>Signed-off-by: Paul Walmsley 
>>Signed-off-by: Romit Dasgupta 
>>Signed-off-by: Phil Carmody 
>>Signed-off-by: Nishanth Menon 
>>Signed-off-by: Kevin Hilman 
>>---
>> arch/arm/plat-omap/Makefile   |1 +
>> arch/arm/plat-omap/include/plat/opp_twl_tps.h |   21 +
>> arch/arm/plat-omap/opp_twl_tps.c  |   41 
>> +
>> 3 files changed, 63 insertions(+), 0 deletions(-)
>> create mode 100644 arch/arm/plat-omap/include/plat/opp_twl_tps.h
>> create mode 100644 arch/arm/plat-omap/opp_twl_tps.c
>>
>>diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
>>index c718a0a..a88879c 100644
>>--- a/arch/arm/plat-omap/Makefile
>>+++ b/arch/arm/plat-omap/Makefile
>>@@ -15,6 +15,7 @@ obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
>> # OPP support in (OMAP3+ only at the moment)
>> ifdef CONFIG_PM
>> obj-$(CONFIG_ARCH_OMAP3) += opp.o
>>+obj-$(CONFIG_TWL4030_CORE) += opp_twl_tps.o
>> endif
>>
>> # omap_device support (OMAP2+ only at the moment)
>>diff --git a/arch/arm/plat-omap/include/plat/opp_twl_tps.h b/arch/arm/plat-
>>omap/include/plat/opp_twl_tps.h
>>new file mode 100644
>>index 000..8784e5f
>>--- /dev/null
>>+++ b/arch/arm/plat-omap/include/plat/opp_twl_tps.h
>>@@ -0,0 +1,21 @@
>>+/*
>>+ * opp_twl_tps.h - TWL/TPS-specific headers for the OPP code
>>+ *
>>+ * Copyright (C) 2009 Texas Instruments Incorporated.
>>+ *   Nishanth Menon
>>+ *
>>+ * This program is free software; you can redistribute it and/or modify
>>+ * it under the terms of the GNU General Public License version 2 as
>>+ * published by the Free Software Foundation.
>>+ *
>>+ * XXX This code belongs as part of some other TWL/TPS code.
>>+ */
>>+#ifndef _ARCH_ARM_PLAT_OMAP_OPP_TWL_TPS_H
>>+#define _ARCH_ARM_PLAT_OMAP_OPP_TWL_TPS_H
>>+
>>+#include 
>>+
>>+unsigned long omap_twl_vsel_to_uv(const u8 vsel);
>>+u8 omap_twl_uv_to_vsel(unsigned long uV);
>>+
>>+#endif
>>diff --git a/arch/arm/plat-omap/opp_twl_tps.c 
>>b/arch/arm/plat-omap/opp_twl_tps.c
>>new file mode 100644
>>index 000..112f106
>>--- /dev/null
>>+++ b/arch/arm/plat-omap/opp_twl_tps.c
>>@@ -0,0 +1,41 @@
>>+/*
>>+ * opp_twl_tps.c - TWL/TPS-specific functions for the OPP code
>>+ *
>>+ * Copyright (C) 2009 Texas Instruments Incorporated.
>>+ * Nishanth Menon
>>+ * Copyright (C) 2009 Nokia Corporation
>>+ * Paul Walmsley
>>+ *
>>+ * This program is free software; you can redistribute it and/or modify
>>+ * it under the terms of the GNU General Public License version 2 as
>>+ * published by the Free Software Foundation.
>>+ *
>>+ * XXX This code should be part of some other TWL/TPS code.
>>+ */
>>+
>>+#include 
>>+
>>+/**
>>+ * omap_twl_vsel_to_vdc - convert TWL/TPS VSEL value to microvolts DC
>>+ * @vsel: TWL/TPS VSEL value to convert
>>+ *
>>+ * Returns the microvolts DC that the TWL/TPS family of PMICs should
>>+ * generate when programmed with @vsel.
>>+ */
>>+unsigned long omap_twl_vsel_to_uv(const u8 vsel)
>>+{
>>+ return (((vsel * 125) + 6000)) * 100;
>>+}
>>+
>>+/**
>>+ * omap_twl_uv_to_vsel - convert microvolts DC to TWL/TPS VSEL value
>>+ * @uv

[PATCH 2/4] OMAP: OPP: twl/tps: Introduce TWL/TPS-specific code

2010-09-15 Thread Kevin Hilman
From: Paul Walmsley 

The OPP layer code should be independent of the PMIC,
introduce the TWL/TPS-specific code out to its own file.

Signed-off-by: Paul Walmsley 
Signed-off-by: Romit Dasgupta 
Signed-off-by: Phil Carmody 
Signed-off-by: Nishanth Menon 
Signed-off-by: Kevin Hilman 
---
 arch/arm/plat-omap/Makefile   |1 +
 arch/arm/plat-omap/include/plat/opp_twl_tps.h |   21 +
 arch/arm/plat-omap/opp_twl_tps.c  |   41 +
 3 files changed, 63 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/opp_twl_tps.h
 create mode 100644 arch/arm/plat-omap/opp_twl_tps.c

diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index c718a0a..a88879c 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
 # OPP support in (OMAP3+ only at the moment)
 ifdef CONFIG_PM
 obj-$(CONFIG_ARCH_OMAP3) += opp.o
+obj-$(CONFIG_TWL4030_CORE) += opp_twl_tps.o
 endif
 
 # omap_device support (OMAP2+ only at the moment)
diff --git a/arch/arm/plat-omap/include/plat/opp_twl_tps.h 
b/arch/arm/plat-omap/include/plat/opp_twl_tps.h
new file mode 100644
index 000..8784e5f
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/opp_twl_tps.h
@@ -0,0 +1,21 @@
+/*
+ * opp_twl_tps.h - TWL/TPS-specific headers for the OPP code
+ *
+ * Copyright (C) 2009 Texas Instruments Incorporated.
+ * Nishanth Menon
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * XXX This code belongs as part of some other TWL/TPS code.
+ */
+#ifndef _ARCH_ARM_PLAT_OMAP_OPP_TWL_TPS_H
+#define _ARCH_ARM_PLAT_OMAP_OPP_TWL_TPS_H
+
+#include 
+
+unsigned long omap_twl_vsel_to_uv(const u8 vsel);
+u8 omap_twl_uv_to_vsel(unsigned long uV);
+
+#endif
diff --git a/arch/arm/plat-omap/opp_twl_tps.c b/arch/arm/plat-omap/opp_twl_tps.c
new file mode 100644
index 000..112f106
--- /dev/null
+++ b/arch/arm/plat-omap/opp_twl_tps.c
@@ -0,0 +1,41 @@
+/*
+ * opp_twl_tps.c - TWL/TPS-specific functions for the OPP code
+ *
+ * Copyright (C) 2009 Texas Instruments Incorporated.
+ * Nishanth Menon
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * XXX This code should be part of some other TWL/TPS code.
+ */
+
+#include 
+
+/**
+ * omap_twl_vsel_to_vdc - convert TWL/TPS VSEL value to microvolts DC
+ * @vsel: TWL/TPS VSEL value to convert
+ *
+ * Returns the microvolts DC that the TWL/TPS family of PMICs should
+ * generate when programmed with @vsel.
+ */
+unsigned long omap_twl_vsel_to_uv(const u8 vsel)
+{
+   return (((vsel * 125) + 6000)) * 100;
+}
+
+/**
+ * omap_twl_uv_to_vsel - convert microvolts DC to TWL/TPS VSEL value
+ * @uv: microvolts DC to convert
+ *
+ * Returns the VSEL value necessary for the TWL/TPS family of PMICs to
+ * generate an output voltage equal to or greater than @uv microvolts DC.
+ */
+u8 omap_twl_uv_to_vsel(unsigned long uv)
+{
+   /* Round up to higher voltage */
+   return DIV_ROUND_UP(uv - 60, 12500);
+}
-- 
1.7.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] omap: opp: twl/tps: Introduce TWL/TPS-specific code

2010-08-10 Thread Kevin Hilman
From: Paul Walmsley 

The OPP layer code should be independent of the PMIC,
introduce the TWL/TPS-specific code out to its own file.

Signed-off-by: Paul Walmsley 
Signed-off-by: Romit Dasgupta 
Signed-off-by: Phil Carmody 
Signed-off-by: Nishanth Menon 
Signed-off-by: Kevin Hilman 
---
 arch/arm/plat-omap/Makefile   |1 +
 arch/arm/plat-omap/include/plat/opp_twl_tps.h |   21 +
 arch/arm/plat-omap/opp_twl_tps.c  |   41 +
 3 files changed, 63 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/opp_twl_tps.h
 create mode 100644 arch/arm/plat-omap/opp_twl_tps.c

diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index 70b012d..faf831d 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
 # OPP support in (OMAP3+ only at the moment)
 ifdef CONFIG_CPU_FREQ
 obj-$(CONFIG_ARCH_OMAP3) += opp.o
+obj-$(CONFIG_TWL4030_CORE) += opp_twl_tps.o
 endif
 
 # omap_device support (OMAP2+ only at the moment)
diff --git a/arch/arm/plat-omap/include/plat/opp_twl_tps.h 
b/arch/arm/plat-omap/include/plat/opp_twl_tps.h
new file mode 100644
index 000..8784e5f
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/opp_twl_tps.h
@@ -0,0 +1,21 @@
+/*
+ * opp_twl_tps.h - TWL/TPS-specific headers for the OPP code
+ *
+ * Copyright (C) 2009 Texas Instruments Incorporated.
+ * Nishanth Menon
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * XXX This code belongs as part of some other TWL/TPS code.
+ */
+#ifndef _ARCH_ARM_PLAT_OMAP_OPP_TWL_TPS_H
+#define _ARCH_ARM_PLAT_OMAP_OPP_TWL_TPS_H
+
+#include 
+
+unsigned long omap_twl_vsel_to_uv(const u8 vsel);
+u8 omap_twl_uv_to_vsel(unsigned long uV);
+
+#endif
diff --git a/arch/arm/plat-omap/opp_twl_tps.c b/arch/arm/plat-omap/opp_twl_tps.c
new file mode 100644
index 000..112f106
--- /dev/null
+++ b/arch/arm/plat-omap/opp_twl_tps.c
@@ -0,0 +1,41 @@
+/*
+ * opp_twl_tps.c - TWL/TPS-specific functions for the OPP code
+ *
+ * Copyright (C) 2009 Texas Instruments Incorporated.
+ * Nishanth Menon
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * XXX This code should be part of some other TWL/TPS code.
+ */
+
+#include 
+
+/**
+ * omap_twl_vsel_to_vdc - convert TWL/TPS VSEL value to microvolts DC
+ * @vsel: TWL/TPS VSEL value to convert
+ *
+ * Returns the microvolts DC that the TWL/TPS family of PMICs should
+ * generate when programmed with @vsel.
+ */
+unsigned long omap_twl_vsel_to_uv(const u8 vsel)
+{
+   return (((vsel * 125) + 6000)) * 100;
+}
+
+/**
+ * omap_twl_uv_to_vsel - convert microvolts DC to TWL/TPS VSEL value
+ * @uv: microvolts DC to convert
+ *
+ * Returns the VSEL value necessary for the TWL/TPS family of PMICs to
+ * generate an output voltage equal to or greater than @uv microvolts DC.
+ */
+u8 omap_twl_uv_to_vsel(unsigned long uv)
+{
+   /* Round up to higher voltage */
+   return DIV_ROUND_UP(uv - 60, 12500);
+}
-- 
1.7.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html