* [PATCH 0/2 v5] twl4030-madc driver
@ 2011-03-01 13:42 Keerthy
2011-03-02 10:15 ` Samuel Ortiz
0 siblings, 1 reply; 7+ messages in thread
From: Keerthy @ 2011-03-01 13:42 UTC (permalink / raw)
To: lm-sensors, guenter.roeck, sameo
Cc: mikko.k.ylinen, amit.kucheria, j-keerthy, linux-omap
MADC(Monitoring ADC) driver enables monitoring analog signals using
analog-to-digital conversion (ADC) on the input source.
The previous discussion concluded in keeping the generic ADC
functionality and the hwmon separate. The discussion can be found here:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg41805.html
Keerthy (2):
mfd: twl4030: Driver for twl4030 madc module
hwmon: twl4030: Hwmon Driver for TWL4030 MADC
Documentation/hwmon/twl4030-madc-hwmon | 45 ++
drivers/hwmon/Kconfig | 10 +
drivers/hwmon/Makefile | 1 +
drivers/hwmon/twl4030-madc-hwmon.c | 157 +++++++
drivers/mfd/Kconfig | 10 +
drivers/mfd/Makefile | 1 +
drivers/mfd/twl4030-madc.c | 802 ++++++++++++++++++++++++++++++++
include/linux/i2c/twl4030-madc.h | 141 ++++++
8 files changed, 1167 insertions(+), 0 deletions(-)
create mode 100644 Documentation/hwmon/twl4030-madc-hwmon
create mode 100644 drivers/hwmon/twl4030-madc-hwmon.c
create mode 100644 drivers/mfd/twl4030-madc.c
create mode 100644 include/linux/i2c/twl4030-madc.h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2 v5] twl4030-madc driver
2011-03-01 13:42 [PATCH 0/2 v5] twl4030-madc driver Keerthy
@ 2011-03-02 10:15 ` Samuel Ortiz
2011-05-03 15:14 ` Steve Sakoman
0 siblings, 1 reply; 7+ messages in thread
From: Samuel Ortiz @ 2011-03-02 10:15 UTC (permalink / raw)
To: Keerthy
Cc: lm-sensors, guenter.roeck, mikko.k.ylinen, amit.kucheria, linux-omap
Hi Keerthy,
On Tue, Mar 01, 2011 at 07:12:06PM +0530, Keerthy wrote:
> MADC(Monitoring ADC) driver enables monitoring analog signals using
> analog-to-digital conversion (ADC) on the input source.
> The previous discussion concluded in keeping the generic ADC
> functionality and the hwmon separate. The discussion can be found here:
>
> http://www.mail-archive.com/linux-omap@vger.kernel.org/msg41805.html
Thanks a lot, I applied those 2 patches.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2 v5] twl4030-madc driver
2011-03-02 10:15 ` Samuel Ortiz
@ 2011-05-03 15:14 ` Steve Sakoman
2011-05-03 19:49 ` J, KEERTHY
0 siblings, 1 reply; 7+ messages in thread
From: Steve Sakoman @ 2011-05-03 15:14 UTC (permalink / raw)
To: Keerthy
Cc: lm-sensors, guenter.roeck, mikko.k.ylinen, amit.kucheria,
linux-omap, Samuel Ortiz
On Wed, Mar 2, 2011 at 2:15 AM, Samuel Ortiz <sameo@linux.intel.com> wrote:
> Hi Keerthy,
>
> On Tue, Mar 01, 2011 at 07:12:06PM +0530, Keerthy wrote:
>> MADC(Monitoring ADC) driver enables monitoring analog signals using
>> analog-to-digital conversion (ADC) on the input source.
>> The previous discussion concluded in keeping the generic ADC
>> functionality and the hwmon separate. The discussion can be found here:
>>
>> http://www.mail-archive.com/linux-omap@vger.kernel.org/msg41805.html
> Thanks a lot, I applied those 2 patches.
I'm attempting to use this drive on the Overo platform with 2.6.39-rc5.
Other than enabling the module with CONFIG_SENSORS_TWL4030_MADC=m are
there any board file modifications required other than the below?
I have setup the platform data for the twl4030 madc driver:
diff --git a/arch/arm/mach-omap2/board-overo.c
b/arch/arm/mach-omap2/board-overo.c
index 112dfc9..05dd3eb 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -637,10 +637,15 @@ static struct twl4030_codec_data overo_codec_data = {
.audio = &overo_audio_data,
};
+static struct twl4030_madc_platform_data overo_madc_data = {
+ .irq_line = 1,
+};
+
static struct twl4030_platform_data overo_twldata = {
.irq_base = TWL4030_IRQ_BASE,
.irq_end = TWL4030_IRQ_END,
.gpio = &overo_gpio_data,
+ .madc = &overo_madc_data,
.usb = &overo_usb_data,
.codec = &overo_codec_data,
.vmmc1 = &overo_vmmc1,
However, I am not seeing the sysfs entry created:
# modprobe twl4030-madc-hwmon
twl4030_madc_hwmon_init entry
# lsmod
Module Size Used by
twl4030_madc_hwmon 2594 0
ipv6 224256 16
libertas_sdio 14867 0
libertas 92429 1 libertas_sdio
cfg80211 144256 1 libertas
lib80211 5027 1 libertas
firmware_class 5859 2 libertas_sdio,libertas
# ls /sys/class/hwmon/
#
I added a couple of printk's to the driver at the entry points of init
and probe, and as you can see above the init message is printed, but
not the probe.
Am I missing something really obvious here?
Steve
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2 v5] twl4030-madc driver
2011-05-03 15:14 ` Steve Sakoman
@ 2011-05-03 19:49 ` J, KEERTHY
2011-05-04 4:11 ` Steve Sakoman
0 siblings, 1 reply; 7+ messages in thread
From: J, KEERTHY @ 2011-05-03 19:49 UTC (permalink / raw)
To: Steve Sakoman
Cc: lm-sensors, guenter.roeck, mikko.k.ylinen, amit.kucheria,
linux-omap, Samuel Ortiz
[-- Attachment #1: Type: text/plain, Size: 2565 bytes --]
Hello Steve,
Can you try adding this patch?
Regards,
Keerthy
On Tue, May 3, 2011 at 8:44 PM, Steve Sakoman <sakoman@gmail.com> wrote:
> On Wed, Mar 2, 2011 at 2:15 AM, Samuel Ortiz <sameo@linux.intel.com> wrote:
>> Hi Keerthy,
>>
>> On Tue, Mar 01, 2011 at 07:12:06PM +0530, Keerthy wrote:
>>> MADC(Monitoring ADC) driver enables monitoring analog signals using
>>> analog-to-digital conversion (ADC) on the input source.
>>> The previous discussion concluded in keeping the generic ADC
>>> functionality and the hwmon separate. The discussion can be found here:
>>>
>>> http://www.mail-archive.com/linux-omap@vger.kernel.org/msg41805.html
>> Thanks a lot, I applied those 2 patches.
>
> I'm attempting to use this drive on the Overo platform with 2.6.39-rc5.
>
> Other than enabling the module with CONFIG_SENSORS_TWL4030_MADC=m are
> there any board file modifications required other than the below?
>
> I have setup the platform data for the twl4030 madc driver:
>
> diff --git a/arch/arm/mach-omap2/board-overo.c
> b/arch/arm/mach-omap2/board-overo.c
> index 112dfc9..05dd3eb 100644
> --- a/arch/arm/mach-omap2/board-overo.c
> +++ b/arch/arm/mach-omap2/board-overo.c
> @@ -637,10 +637,15 @@ static struct twl4030_codec_data overo_codec_data = {
> .audio = &overo_audio_data,
> };
>
> +static struct twl4030_madc_platform_data overo_madc_data = {
> + .irq_line = 1,
> +};
> +
> static struct twl4030_platform_data overo_twldata = {
> .irq_base = TWL4030_IRQ_BASE,
> .irq_end = TWL4030_IRQ_END,
> .gpio = &overo_gpio_data,
> + .madc = &overo_madc_data,
> .usb = &overo_usb_data,
> .codec = &overo_codec_data,
> .vmmc1 = &overo_vmmc1,
>
> However, I am not seeing the sysfs entry created:
>
> # modprobe twl4030-madc-hwmon
> twl4030_madc_hwmon_init entry
>
> # lsmod
> Module Size Used by
> twl4030_madc_hwmon 2594 0
> ipv6 224256 16
> libertas_sdio 14867 0
> libertas 92429 1 libertas_sdio
> cfg80211 144256 1 libertas
> lib80211 5027 1 libertas
> firmware_class 5859 2 libertas_sdio,libertas
>
> # ls /sys/class/hwmon/
> #
>
> I added a couple of printk's to the driver at the entry points of init
> and probe, and as you can see above the init message is printed, but
> not the probe.
>
> Am I missing something really obvious here?
>
> Steve
>
[-- Attachment #2: 0001-Enabling-Hwmon-driver-for-twl4030-madc.patch --]
[-- Type: text/x-patch, Size: 1233 bytes --]
From a05c6cbb4494173e03ea5957666216caedb22d84 Mon Sep 17 00:00:00 2001
From: Keerthy <j-keerthy@ti.com>
Date: Wed, 4 May 2011 01:14:50 +0530
Subject: [PATCH] Enabling Hwmon driver for twl4030-madc
Signed-off-by: Keerthy <j-keerthy@ti.com>
---
drivers/mfd/twl-core.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 960b5be..e6e99db 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -83,6 +83,13 @@
#define twl_has_madc() false
#endif
+#if defined(CONFIG_SENSORS_TWL4030_MADC) ||\
+ defined(CONFIG_SENSORS_TWL4030_MADC_MODULE)
+#define twl_has_madc_hwmon() true
+#else
+#define twl_has_madc_hwmon() false
+#endif
+
#ifdef CONFIG_TWL4030_POWER
#define twl_has_power() true
#else
@@ -609,6 +616,14 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
return PTR_ERR(child);
}
+if (twl_has_madc_hwmon()) {
+ child = add_child(2, "twl4030_madc_hwmon",
+ NULL, 0,
+ true, pdata->irq_base + MADC_INTR_OFFSET, 0);
+ if (IS_ERR(child))
+ return PTR_ERR(child);
+ }
+
if (twl_has_rtc()) {
/*
* REVISIT platform_data here currently might expose the
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2 v5] twl4030-madc driver
2011-05-03 19:49 ` J, KEERTHY
@ 2011-05-04 4:11 ` Steve Sakoman
2011-05-04 4:23 ` J, KEERTHY
0 siblings, 1 reply; 7+ messages in thread
From: Steve Sakoman @ 2011-05-04 4:11 UTC (permalink / raw)
To: J, KEERTHY
Cc: lm-sensors, guenter.roeck, mikko.k.ylinen, amit.kucheria,
linux-omap, Samuel Ortiz
On Tue, May 3, 2011 at 12:49 PM, J, KEERTHY <j-keerthy@ti.com> wrote:
> Hello Steve,
>
> Can you try adding this patch?
Thanks!
I tried the patch and it did indeed fix the issue. We should try to
get this in mainline since the hwmon driver won't work without it.
Steve
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2 v5] twl4030-madc driver
2011-05-04 4:11 ` Steve Sakoman
@ 2011-05-04 4:23 ` J, KEERTHY
2011-05-04 14:31 ` Steve Sakoman
0 siblings, 1 reply; 7+ messages in thread
From: J, KEERTHY @ 2011-05-04 4:23 UTC (permalink / raw)
To: Steve Sakoman
Cc: lm-sensors, guenter.roeck, mikko.k.ylinen, amit.kucheria,
linux-omap, Samuel Ortiz
On Wed, May 4, 2011 at 9:41 AM, Steve Sakoman <sakoman@gmail.com> wrote:
> On Tue, May 3, 2011 at 12:49 PM, J, KEERTHY <j-keerthy@ti.com> wrote:
>> Hello Steve,
>>
>> Can you try adding this patch?
>
> Thanks!
>
> I tried the patch and it did indeed fix the issue. We should try to
> get this in mainline since the hwmon driver won't work without it.
>
Yes Steve. I am posting a patch today.
> Steve
>
--
Regards and Thanks,
Keerthy
--
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2 v5] twl4030-madc driver
2011-05-04 4:23 ` J, KEERTHY
@ 2011-05-04 14:31 ` Steve Sakoman
0 siblings, 0 replies; 7+ messages in thread
From: Steve Sakoman @ 2011-05-04 14:31 UTC (permalink / raw)
To: J, KEERTHY
Cc: lm-sensors, guenter.roeck, mikko.k.ylinen, amit.kucheria,
linux-omap, Samuel Ortiz
On Tue, May 3, 2011 at 9:23 PM, J, KEERTHY <j-keerthy@ti.com> wrote:
> On Wed, May 4, 2011 at 9:41 AM, Steve Sakoman <sakoman@gmail.com> wrote:
>> On Tue, May 3, 2011 at 12:49 PM, J, KEERTHY <j-keerthy@ti.com> wrote:
>>> Hello Steve,
>>>
>>> Can you try adding this patch?
>>
>> Thanks!
>>
>> I tried the patch and it did indeed fix the issue. We should try to
>> get this in mainline since the hwmon driver won't work without it.
>>
>
> Yes Steve. I am posting a patch today.
I've also found that the madc clock needs to be enabled:
From: Steve Sakoman <steve@sakoman.com>
Date: Sat, 23 Jan 2010 14:26:54 +0000 (-0800)
Subject: mfd: twl-core: enable madc clock
X-Git-Url: http://www.sakoman.com/cgi-bin/gitweb.cgi?p=linux-omap-2.6.git;a=commitdiff_plain;h=a1f1a1a6420f15e8351a0c5d63a81aa2444874f4
mfd: twl-core: enable madc clock
Now that the madc driver has been merged it is also necessary to
enable the clock to the madc block
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index d9435e4..9096d7d 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -222,6 +222,11 @@
/* Few power values */
#define R_CFG_BOOT 0x05
+#define R_GPBR1 0x0C
+
+/* MADC clock values for R_GPBR1 */
+#define MADC_HFCLK_EN 0x80
+#define DEFAULT_MADC_CLK_EN 0x10
/* some fields in R_CFG_BOOT */
#define HFCLK_FREQ_19p2_MHZ (1 << 0)
@@ -992,6 +997,9 @@ static void clocks_init(struct device *dev,
e |= unprotect_pm_master();
/* effect->MADC+USB ck en */
+ if (twl_has_madc())
+ e |= twl_i2c_write_u8(TWL_MODULE_INTBR,
+ MADC_HFCLK_EN | DEFAULT_MADC_CLK_EN, R_GPBR1);
e |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER, ctrl, R_CFG_BOOT);
e |= protect_pm_master();
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 0c0d1ae..cbbf3b3 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -74,6 +74,7 @@
#define TWL_MODULE_USB TWL4030_MODULE_USB
#define TWL_MODULE_AUDIO_VOICE TWL4030_MODULE_AUDIO_VOICE
+#define TWL_MODULE_INTBR TWL4030_MODULE_INTBR
#define TWL_MODULE_PIH TWL4030_MODULE_PIH
#define TWL_MODULE_MADC TWL4030_MODULE_MADC
#define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE
I'll submit this patch separately.
Steve
--
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-05-04 14:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-01 13:42 [PATCH 0/2 v5] twl4030-madc driver Keerthy
2011-03-02 10:15 ` Samuel Ortiz
2011-05-03 15:14 ` Steve Sakoman
2011-05-03 19:49 ` J, KEERTHY
2011-05-04 4:11 ` Steve Sakoman
2011-05-04 4:23 ` J, KEERTHY
2011-05-04 14:31 ` Steve Sakoman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).