RE: Soft lockup when disconnecting musb isochronous device.
I've been trying to get the UVC camera driver working in linux-omap on the Beagleboard, which uses musb. With the latest linux-omap git, capture doesn't work. Applying Ajay Gupta's MUSB patches posted here on 9/8 allows capture to work until the device is closed. With or without Ajay's patches, when the device is closed, the following lockup occurs. Let me know if there is anything I can do to help debug this. Have you applied below patch posted on 25/08/2008? [PATCH v3] OMAP: MUSB: Corrects urb unlink function path This patch is accepted and is pending to be merged with latest OMAP GIT. Regards, Ajay BUG: soft lockup - CPU#0 stuck for 61s! [mjpg_streamer:1770] Modules linked in: ipv6 pegasus uvcvideo compat_ioctl32 videodev v4l1_compat Pid: 1770, comm:mjpg_streamer CPU: 0Not tainted (2.6.27-rc7-omap1 #4) PC is at __mutex_lock_slowpath+0x1ec/0x204 LR is at __mutex_lock_slowpath+0x1c4/0x204 pc : [c0320fa0]lr : [c0320f78]psr: 6013 sp : c7265ca0 ip : c7265ca0 fp : c7265cd4 r10: c79eb400 r9 : c7128218 r8 : c78a6a08 r7 : c78df9c0 r6 : 6013 r5 : c0437690 r4 : c7265ca4 r3 : r2 : r1 : c7264000 r0 : c0437690 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 00c5387f Table: 87348018 DAC: 0015 [c0034ca8] (show_regs+0x0/0x50) from [c007959c] (softlockup_tick+0x100/0x140) r5:00bc r4:007f [c007949c] (softlockup_tick+0x0/0x140) from [c005c08c] (run_local_timers+0x1c/0x20) [c005c070] (run_local_timers+0x0/0x20) from [c005c4e8] (update_process_times+0x30/0x5c) [c005c4b8] (update_process_times+0x0/0x5c) from [c006f138] (tick_sched_timer+0x8c/0xd8) r5:c7265c58 r4:c044d630 [c006f0ac] (tick_sched_timer+0x0/0xd8) from [c0069090] (__run_hrtimer+0x58/0x94) r7:c0425e60 r6:c044d630 r5:c0425e60 r4:c044d630 [c0069038] (__run_hrtimer+0x0/0x94) from [c0069c64] (hrtimer_interrupt+0x130/0x1a0) r5:00b9 r4:183847b0 [c0069b34] (hrtimer_interrupt+0x0/0x1a0) from [c003d248] (omap2_gp_timer_interrupt+0x28/0x34) [c003d220] (omap2_gp_timer_interrupt+0x0/0x34) from [c0079a58] (handle_IRQ_event+0x3c/0x74) [c0079a1c] (handle_IRQ_event+0x0/0x74) from [c007b2a4] (handle_level_irq+0xd4/0xf0) r7:c78df9c0 r6: r5:005f r4:c04279a8 [c007b1d0] (handle_level_irq+0x0/0xf0) from [c0033048] (__exception_text_start+0x48/0x64) r5:c04279a8 r4:005f [c0033000] (__exception_text_start+0x0/0x64) from [c0033830] (__irq_svc+0x30/0x80) Exception stack(0xc7265c58 to 0xc7265ca0) 5c40: c0437690 c7264000 5c60: c7265ca4 c0437690 6013 c78df9c0 c78a6a08 c7128218 5c80: c79eb400 c7265cd4 c7265ca0 c7265ca0 c0320f78 c0320fa0 6013 r7:c78df9c0 r6:6013 r5:d820 r4: [c0320db4] (__mutex_lock_slowpath+0x0/0x204) from [c0320fc8] (mutex_lock+0x10/0x14) r7:c7893000 r6:c7170c00 r5:c7170c00 r4:c791c738 [c0320fb8] (mutex_lock+0x0/0x14) from [c01ed760] (usb_kill_urb+0x38/0x104) [c01ed728] (usb_kill_urb+0x0/0x104) from [c01ece30] (usb_hcd_flush_endpoint+0xb0/0xcc) r6:c791c740 r5:c7170c00 r4:c791c738 [c01ecd80] (usb_hcd_flush_endpoint+0x0/0xcc) from [c01ee044] (usb_disable_endpoint+0x5c/0x6c) r7:c7893000 r6:c78a6a40 r5:c7893000 r4:c791c740 [c01edfe8] (usb_disable_endpoint+0x0/0x6c) from [c01ee180] (usb_disable_interface+0x34/0x4c) r5:0028 r4:0001 [c01ee14c] (usb_disable_interface+0x0/0x4c) from [c01ef4e0] (usb_set_interface+0xec/0x178) r7:0001 r6: r5:c7893000 r4:c78a6e00 [c01ef3f4] (usb_set_interface+0x0/0x178) from [bf014c48] (uvc_video_enable+0x3c/0x74 [uvcvideo]) r8:c721c050 r7:c7265e68 r6:c721c094 r5: r4:c721c050 [bf014c0c] (uvc_video_enable+0x0/0x74 [uvcvideo]) from [bf014308] (uvc_v4l2_do_ioctl+0xce4/0xf50 [uvcvideo]) r7:c7265e68 r6:c79f9e00 r5:c78d4760 r4:40045613 [bf013624] (uvc_v4l2_do_ioctl+0x0/0xf50 [uvcvideo]) from [bf008e20] (video_usercopy+0x1b8/0x2b8 [videodev]) [bf008c68] (video_usercopy+0x0/0x2b8 [videodev]) from [bf012fdc] (uvc_v4l2_ioctl+0x54/0x68 [uvcvideo]) [bf012f88] (uvc_v4l2_ioctl+0x0/0x68 [uvcvideo]) from [c00ace28] (vfs_ioctl+0x68/0x78) r7:c79eb400 r6:0003 r5:40c78ccc r4:40045613 [c00acdc0] (vfs_ioctl+0x0/0x78) from [c00ad0a8] (do_vfs_ioctl+0x270/0x280) r5:40c78ccc r4:c79eb400 [c00ace38] (do_vfs_ioctl+0x0/0x280) from [c00ad0f8] (sys_ioctl+0x40/0x64) r7:c79eb400 r6:40045613 r5:40c78ccc r4:0003 [c00ad0b8] (sys_ioctl+0x0/0x64) from [c0033c80] (ret_fast_syscall+0x0/0x2c) - Nathan -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/5] [RFC] ALSA ASOC Adds DSP DAI format support for platform driver
On Mon, Sep 29, 2008 at 4:45 PM, Jarkko Nikula [EMAIL PROTECTED] wrote: On Mon, 29 Sep 2008 15:20:12 +0530 ext Arun KS [EMAIL PROTECTED] wrote: Enables DSP DAI format for mcbsp in omap platform driver Signed-off-by: Arun KS [EMAIL PROTECTED] --- sound/soc/omap/omap-mcbsp.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 3a4cc4b..1c024aa 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c @@ -292,6 +292,12 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, regs-rcr2 |= RDATDLY(1); regs-xcr2 |= XDATDLY(1); break; + case SND_SOC_DAIFMT_DSP_A: + /* 0-bit data delay */ + regs-rcr2 |= RDATDLY(0); + regs-xcr2 |= XDATDLY(0); + break; + default: I think this is not enough. The word clock length equals to one BCLK cycle in DSP mode. Not n channel bit BCLK cycles like in I2S. In DSP Mode, Frame sync is followed by two data words. I tested this patch and its working. Am i missing something ? Jarkko -- To unsubscribe from this list: send the line unsubscribe alsa-devel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: does twl3040-pwrirq.c need to be a separate file?
Hi David, On Mon, Sep 29, 2008 at 02:17:12PM -0700, ext David Brownell wrote: Hi Peter, I see your patch 68d7477caca19c0b52b5d4e85700cd3e6115577f created pwrirq.c as a separate file and thread. I guess choose this solution because it was similar to the GPIO IRQs. Originally, this was 1 shared IRQ. But I wanted to change this to avoid every driver having to read PWR_ISR1 and clear his interrupt. This saves some i2c transactions. I'm wondering if there's any particular reason that bank of interrupts shouldn't be handled directly by twl4030-core, and even by the same IRQ handling thread. I don't think so. As it stands now the TWL core is not especially core-ish in this respect, and I'd like to see that be resolved (e.g. by a patch I'll probably write this afternoon) before this code goes to mainline ... Ok. Good. Cheers, Peter. -- goa is a state of mind -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 15/16] OMAP3: Dynamic enable/disable of OFF support
Rajendra Nayak [EMAIL PROTECTED] writes: I just managed to see that this patch seems to break suspend functionality. If after bootup I enable OFF mode the subsequent suspend tries to put a few power domains to OFF which are currently in RET, and since there is no code in place today to handle RET to OFF transitions, they don't transition to OFF and remain in RET. See commit a974addcfa23181667fe32e5032820917bf4a2b2 from Tero Kristo. This patch was meant to address these kinds of transitions, but it seems it's not working exactly right. I'm debugging now. Supporting run time enable/disable of OFF functionality is kind of becoming complicated. Do we really see a need to have a run-time option to enable/disable OFF mode or can we have a compile time option for this? Run-time option is required. Kevin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rajendra Nayak Sent: Friday, September 26, 2008 5:50 PM To: linux-omap@vger.kernel.org Cc: 'Kevin Hilman' Subject: [PATCH 15/16] OMAP3: Dynamic enable/disable of OFF support This patch adds a runtime sysfs knob (/sys/power/enable_off_mode) to enable/disbale CORE OFF support for OMAP3. Signed-off-by: Rajendra Nayak [EMAIL PROTECTED] --- arch/arm/mach-omap2/pm.c | 21 + arch/arm/mach-omap2/pm.h |2 ++ arch/arm/mach-omap2/pm34xx.c | 26 ++ 3 files changed, 45 insertions(+), 4 deletions(-) Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c === --- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c 2008-09-26 16:39:30.0 +0530 +++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c 2008-09-26 16:39:34.0 +0530 @@ -395,6 +395,32 @@ static int omap3_can_sleep(void) return 1; } +int set_next_pwrst(struct powerdomain *pwrdm) +{ +struct power_state *pwrst; +int ret = 0; +u32 state; + +if (!pwrdm-pwrsts) +return 0; + +if (enable_off_mode) +state = PWRDM_POWER_OFF; +else +state = PWRDM_POWER_RET; + +ret = pwrdm_set_next_pwrst(pwrdm, state); +if (ret) { +printk(KERN_ERR Unable to set state of powerdomain: %s\n, + pwrdm-name); +goto err; +} +list_for_each_entry(pwrst, pwrst_list, node) +pwrst-next_state = state; +err: +return ret; +} + /* This sets pwrdm state (other than mpu core. Currently only ON * RET are supported. Function is assuming that clkdm doesn't have * hw_sup mode enabled. */ Index: linux-omap-2.6/arch/arm/mach-omap2/pm.c === --- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.c 2008-09-26 16:39:30.0 +0530 +++ linux-omap-2.6/arch/arm/mach-omap2/pm.c 2008-09-26 16:39:34.0 +0530 @@ -35,6 +35,7 @@ unsigned short enable_dyn_sleep; unsigned short clocks_off_while_idle; +unsigned short enable_off_mode; atomic_t sleep_block = ATOMIC_INIT(0); static ssize_t idle_show(struct kobject *, struct kobj_attribute *, char *); @@ -47,6 +48,9 @@ static struct kobj_attribute sleep_while static struct kobj_attribute clocks_off_while_idle_attr = __ATTR(clocks_off_while_idle, 0644, idle_show, idle_store); +static struct kobj_attribute enable_off_mode_attr = +__ATTR(enable_off_mode, 0644, idle_show, idle_store); + static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -54,6 +58,8 @@ static ssize_t idle_show(struct kobject return sprintf(buf, %hu\n, enable_dyn_sleep); else if (attr == clocks_off_while_idle_attr) return sprintf(buf, %hu\n, clocks_off_while_idle); +else if (attr == enable_off_mode_attr) +return sprintf(buf, %hu\n, enable_off_mode); else return -EINVAL; } @@ -69,13 +75,16 @@ static ssize_t idle_store(struct kobject return -EINVAL; } -if (attr == sleep_while_idle_attr) +if (attr == sleep_while_idle_attr) { enable_dyn_sleep = value; -else if (attr == clocks_off_while_idle_attr) +} else if (attr == clocks_off_while_idle_attr) { clocks_off_while_idle = value; -else +} else if (attr == enable_off_mode_attr) { +enable_off_mode = value; +pwrdm_for_each(set_next_pwrst); +} else { return -EINVAL; - +} return n; } @@ -114,6 +123,10 @@ static int __init omap_pm_init(void) clocks_off_while_idle_attr.attr); if (error) printk(KERN_ERR sysfs_create_file failed: %d\n, error); +error = sysfs_create_file(power_kobj, + enable_off_mode_attr.attr); +if (error) +printk(KERN_ERR
Re: [PATCH 15/16] OMAP3: Dynamic enable/disable of OFF support
ext Kevin Hilman [EMAIL PROTECTED] writes: Rajendra Nayak [EMAIL PROTECTED] writes: I just managed to see that this patch seems to break suspend functionality. If after bootup I enable OFF mode the subsequent suspend tries to put a few power domains to OFF which are currently in RET, and since there is no code in place today to handle RET to OFF transitions, they don't transition to OFF and remain in RET. See commit a974addcfa23181667fe32e5032820917bf4a2b2 from Tero Kristo. This patch was meant to address these kinds of transitions, but it seems it's not working exactly right. I'm debugging now. Supporting run time enable/disable of OFF functionality is kind of becoming complicated. Do we really see a need to have a run-time option to enable/disable OFF mode or can we have a compile time option for this? Run-time option is required. Whole cpuidle + srf concept is about changing between OFF/RET/ON dynamically. So if implementing it through one sysfs entry is discarded because it's complicated, how do you think you could implement it in cpuidle and srf? Kevin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rajendra Nayak Sent: Friday, September 26, 2008 5:50 PM To: linux-omap@vger.kernel.org Cc: 'Kevin Hilman' Subject: [PATCH 15/16] OMAP3: Dynamic enable/disable of OFF support This patch adds a runtime sysfs knob (/sys/power/enable_off_mode) to enable/disbale CORE OFF support for OMAP3. Signed-off-by: Rajendra Nayak [EMAIL PROTECTED] --- arch/arm/mach-omap2/pm.c | 21 + arch/arm/mach-omap2/pm.h |2 ++ arch/arm/mach-omap2/pm34xx.c | 26 ++ 3 files changed, 45 insertions(+), 4 deletions(-) Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c === --- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c 2008-09-26 16:39:30.0 +0530 +++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c 2008-09-26 16:39:34.0 +0530 @@ -395,6 +395,32 @@ static int omap3_can_sleep(void) return 1; } +int set_next_pwrst(struct powerdomain *pwrdm) +{ + struct power_state *pwrst; + int ret = 0; + u32 state; + + if (!pwrdm-pwrsts) + return 0; + + if (enable_off_mode) + state = PWRDM_POWER_OFF; + else + state = PWRDM_POWER_RET; + + ret = pwrdm_set_next_pwrst(pwrdm, state); + if (ret) { + printk(KERN_ERR Unable to set state of powerdomain: %s\n, + pwrdm-name); + goto err; + } + list_for_each_entry(pwrst, pwrst_list, node) + pwrst-next_state = state; +err: + return ret; +} + /* This sets pwrdm state (other than mpu core. Currently only ON * RET are supported. Function is assuming that clkdm doesn't have * hw_sup mode enabled. */ Index: linux-omap-2.6/arch/arm/mach-omap2/pm.c === --- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.c 2008-09-26 16:39:30.0 +0530 +++ linux-omap-2.6/arch/arm/mach-omap2/pm.c 2008-09-26 16:39:34.0 +0530 @@ -35,6 +35,7 @@ unsigned short enable_dyn_sleep; unsigned short clocks_off_while_idle; +unsigned short enable_off_mode; atomic_t sleep_block = ATOMIC_INIT(0); static ssize_t idle_show(struct kobject *, struct kobj_attribute *, char *); @@ -47,6 +48,9 @@ static struct kobj_attribute sleep_while static struct kobj_attribute clocks_off_while_idle_attr = __ATTR(clocks_off_while_idle, 0644, idle_show, idle_store); +static struct kobj_attribute enable_off_mode_attr = + __ATTR(enable_off_mode, 0644, idle_show, idle_store); + static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -54,6 +58,8 @@ static ssize_t idle_show(struct kobject return sprintf(buf, %hu\n, enable_dyn_sleep); else if (attr == clocks_off_while_idle_attr) return sprintf(buf, %hu\n, clocks_off_while_idle); + else if (attr == enable_off_mode_attr) + return sprintf(buf, %hu\n, enable_off_mode); else return -EINVAL; } @@ -69,13 +75,16 @@ static ssize_t idle_store(struct kobject return -EINVAL; } - if (attr == sleep_while_idle_attr) + if (attr == sleep_while_idle_attr) { enable_dyn_sleep = value; - else if (attr == clocks_off_while_idle_attr) + } else if (attr == clocks_off_while_idle_attr) { clocks_off_while_idle = value; - else + } else if (attr == enable_off_mode_attr) { + enable_off_mode = value; + pwrdm_for_each(set_next_pwrst); + } else { return -EINVAL; - + } return n; } @@ -114,6 +123,10 @@ static int __init omap_pm_init(void) clocks_off_while_idle_attr.attr); if (error)
[PATCH 1/5 v1] ASoC Add TLV320AIC23 codec driver
ASoC codec driver for TLV320AIC23 device Signed-off-by: Arun KS [EMAIL PROTECTED] --- sound/soc/codecs/Kconfig |5 + sound/soc/codecs/Makefile |2 + sound/soc/codecs/tlv320aic23.c | 631 sound/soc/codecs/tlv320aic23.h | 125 4 files changed, 763 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/tlv320aic23.c create mode 100644 sound/soc/codecs/tlv320aic23.h diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 0507fcf..bdead2d 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -7,6 +7,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_AK4535 select SND_SOC_CS4270 select SND_SOC_SSM2602 + select SND_SOC_TLV320AIC23 select SND_SOC_TLV320AIC26 select SND_SOC_TLV320AIC3X select SND_SOC_UDA1380 @@ -62,6 +63,10 @@ config SND_SOC_CS4270_VD33_ERRATA config SND_SOC_SSM2602 tristate +config SND_SOC_TLV320AIC23 + tristate + depends on I2C + config SND_SOC_TLV320AIC26 tristate TI TLV320AIC26 Codec support depends on SND_SOC SPI diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 0731844..90f0a58 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -4,6 +4,7 @@ snd-soc-ad73311-objs := ad73311.o snd-soc-ak4535-objs := ak4535.o snd-soc-cs4270-objs := cs4270.o snd-soc-ssm2602-objs := ssm2602.o +snd-soc-tlv320aic23-objs := tlv320aic23.o snd-soc-tlv320aic26-objs := tlv320aic26.o snd-soc-tlv320aic3x-objs := tlv320aic3x.o snd-soc-uda1380-objs := uda1380.o @@ -25,6 +26,7 @@ obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o +obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o obj-$(CONFIG_SND_SOC_TLV320AIC26) += snd-soc-tlv320aic26.o obj-$(CONFIG_SND_SOC_TLV320AIC3X) += snd-soc-tlv320aic3x.o obj-$(CONFIG_SND_SOC_UDA1380) += snd-soc-uda1380.o diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c new file mode 100644 index 000..b602c87 --- /dev/null +++ b/sound/soc/codecs/tlv320aic23.c @@ -0,0 +1,631 @@ +/* + * ALSA SoC TLV320AIC23 codec driver + * + * Author: Arun KS, [EMAIL PROTECTED] + * Copyright: (C) 2008 Mistral Solutions Pvt Ltd., + * + * Based on sound/soc/codecs/tlv320aic3x.c by Vladimir Barinov + * + * 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. + * + * Notes: + * The AIC23 is a driver for a low power stereo audio + * codec tlv320aic23 + * + * The machine layer should disable unsupported inputs/outputs by + * snd_soc_dapm_disable_pin(codec, LHPOUT), etc. + */ + +#include linux/module.h +#include linux/moduleparam.h +#include linux/init.h +#include linux/delay.h +#include linux/pm.h +#include linux/i2c.h +#include linux/platform_device.h +#include sound/core.h +#include sound/pcm.h +#include sound/pcm_params.h +#include sound/soc.h +#include sound/soc-dapm.h +#include sound/initval.h + +#include tlv320aic23.h + +#define AUDIO_NAME tlv320aic23 +#define AIC23_VERSION 0.1 + +/* codec private data */ +struct tlv320aic23_priv { + unsigned int sysclk; + int master; +}; + +struct tlv320aic23_samplerate_reg_info { + u32 sample_rate; + u8 control; /* SR3, SR2, SR1, SR0 and BOSR */ + u8 divider; /* if 0 CLKIN = MCLK, if 1 CLKIN = MCLK/2 */ +}; + +/* + * AIC23 register cache + */ +static const u16 tlv320aic23_reg[] = { + 0x0097, 0x0097, 0x00F9, 0x00F9, /* 0 */ + 0x001A, 0x0004, 0x0007, 0x0001, /* 4 */ + 0x0020, 0x, 0x, 0x, /* 8 */ + 0x, 0x, 0x, 0x, /* 12 */ +}; + +/* + * read tlv320aic23 register cache + */ +static inline unsigned int tlv320aic23_read_reg_cache(struct snd_soc_codec + *codec, unsigned int reg) +{ + u16 *cache = codec-reg_cache; + if (reg = ARRAY_SIZE(tlv320aic23_reg)) + return -1; + return cache[reg]; +} + +/* + * write tlv320aic23 register cache + */ +static inline void tlv320aic23_write_reg_cache(struct snd_soc_codec *codec, + u8 reg, u16 value) +{ + u16 *cache = codec-reg_cache; + if (reg = ARRAY_SIZE(tlv320aic23_reg)) + return; + cache[reg] = value; +} + +/* + * write to the tlv320aic23 register space + */ +static int tlv320aic23_write(struct snd_soc_codec *codec, unsigned int reg, +unsigned int value) +{ + + u8 data; + + /* TLV320AIC23 has 7 bit address and 9 bits of data +* so we need to switch one data bit into reg and rest +* of data into val +*/ + + if
[PATCH 01/23] twl4030: fix potential null pointer dereference
The following patch fix a potential null pointer dereference in twl4030 keypad driver when parts of keypad platform_data aren't passed down to the driver. At that point kp-dbg_dev is not set yet. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/input/keyboard/omap-twl4030keypad.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/input/keyboard/omap-twl4030keypad.c b/drivers/input/keyboard/omap-twl4030keypad.c index 3893d63..48f29d3 100644 --- a/drivers/input/keyboard/omap-twl4030keypad.c +++ b/drivers/input/keyboard/omap-twl4030keypad.c @@ -238,7 +238,7 @@ static int __init omap_kp_probe(struct platform_device *pdev) return -ENOMEM; if (!pdata-rows || !pdata-cols || !pdata-keymap) { - dev_err(kp-dbg_dev, No rows, cols or keymap from pdata\n); + dev_err(pdev-dev, No rows, cols or keymap from pdata\n); kfree(kp); return -EINVAL; } -- 1.6.0.2.307.gc427 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/23] twl4030-gpio: Remove default pullup enable/disable of GPIO
From: Jagadeesh Bhaskar Pakaravoor [EMAIL PROTECTED] One twl4030_request_gpio() should not tamper with the pullup enabling/disabling of the rest of the GPIOs. So removing the default pullup values written to REG_GPIOPUPDCTR1. Acked-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Girish S G [EMAIL PROTECTED] Signed-off-by: Jagadeesh Bhaskar Pakaravoor [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-gpio.c |5 - 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/chips/twl4030-gpio.c b/drivers/i2c/chips/twl4030-gpio.c index 4d89abc..b51bed0 100644 --- a/drivers/i2c/chips/twl4030-gpio.c +++ b/drivers/i2c/chips/twl4030-gpio.c @@ -301,7 +301,6 @@ int twl4030_request_gpio(int gpio) if (gpio_usage_count (0x1 gpio)) ret = -EBUSY; else { - u8 clear_pull[6] = { 0, 0, 0, 0, 0, 0 }; /* First time usage? - switch on GPIO module */ if (!gpio_usage_count) { ret = @@ -311,10 +310,6 @@ int twl4030_request_gpio(int gpio) } if (!ret) gpio_usage_count |= (0x1 gpio); - - ret = - twl4030_i2c_write(TWL4030_MODULE_GPIO, clear_pull, - REG_GPIOPUPDCTR1, 5); } up(gpio_sem); return ret; -- 1.6.0.2.307.gc427 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/23] twl4030 gpio platform data
From: David Brownell [EMAIL PROTECTED] Define platform data for configuring TWL4030 GPIOs, and provide it for all boards using these chips. For now all boards use the same fixed assignments for GPIO and IRQ numbers. Eventually we should be able to shuffle them without changing platform headers. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/mach-omap2/board-2430sdp.c |7 +++ arch/arm/mach-omap2/board-3430sdp.c |7 +++ arch/arm/mach-omap2/board-ldp.c |7 +++ arch/arm/mach-omap2/board-omap2evm.c|7 +++ arch/arm/mach-omap2/board-omap3beagle.c | 12 arch/arm/mach-omap2/board-omap3evm.c|7 +++ arch/arm/mach-omap2/board-overo.c |6 ++ include/linux/i2c/twl4030.h | 24 +--- 8 files changed, 74 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 3073528..7842110 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -345,6 +345,12 @@ static struct omap_board_config_kernel sdp2430_config[] __initdata = { }; +static struct twl4030_gpio_platform_data sdp2430_gpio_data = { + .gpio_base = OMAP_MAX_GPIO_LINES, + .irq_base = TWL4030_GPIO_IRQ_BASE, + .irq_end= TWL4030_GPIO_IRQ_END, +}; + static struct twl4030_usb_data sdp2430_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; @@ -354,6 +360,7 @@ static struct twl4030_platform_data sdp2430_twldata = { .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ + .gpio = sdp2430_gpio_data, .keypad = sdp2430_kp_data, .usb= sdp2430_usb_data, }; diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index e0c39c2..66f0f98 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -300,6 +300,12 @@ static struct omap_board_config_kernel sdp3430_config[] __initdata = { { OMAP_TAG_LCD, sdp3430_lcd_config }, }; +static struct twl4030_gpio_platform_data sdp3430_gpio_data = { + .gpio_base = OMAP_MAX_GPIO_LINES, + .irq_base = TWL4030_GPIO_IRQ_BASE, + .irq_end= TWL4030_GPIO_IRQ_END, +}; + static struct twl4030_usb_data sdp3430_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; @@ -309,6 +315,7 @@ static struct twl4030_platform_data sdp3430_twldata = { .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ + .gpio = sdp3430_gpio_data, .keypad = sdp3430_kp_data, .usb= sdp3430_usb_data, }; diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index 219579b..48342f4 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c @@ -187,12 +187,19 @@ static struct twl4030_usb_data ldp_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; +static struct twl4030_gpio_platform_data ldp_gpio_data = { + .gpio_base = OMAP_MAX_GPIO_LINES, + .irq_base = TWL4030_GPIO_IRQ_BASE, + .irq_end= TWL4030_GPIO_IRQ_END, +}; + static struct twl4030_platform_data ldp_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .usb= ldp_usb_data, + .gpio = ldp_gpio_data, }; static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-omap2evm.c b/arch/arm/mach-omap2/board-omap2evm.c index be8348d..a921cf1 100644 --- a/arch/arm/mach-omap2/board-omap2evm.c +++ b/arch/arm/mach-omap2/board-omap2evm.c @@ -226,6 +226,12 @@ static struct omap_board_config_kernel omap2_evm_config[] __initdata = { { OMAP_TAG_LCD, omap2_evm_lcd_config }, }; +static struct twl4030_gpio_platform_data omap2evm_gpio_data = { + .gpio_base = OMAP_MAX_GPIO_LINES, + .irq_base = TWL4030_GPIO_IRQ_BASE, + .irq_end= TWL4030_GPIO_IRQ_END, +}; + static struct twl4030_usb_data omap2evm_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; @@ -237,6 +243,7 @@ static struct twl4030_platform_data omap2evm_twldata = { /* platform_data for children goes here */ .keypad = omap2evm_kp_data, .usb= omap2evm_usb_data, + .gpio = omap2evm_gpio_data, }; static struct i2c_board_info __initdata omap2evm_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index ae677b9..aa5e9a6 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -114,12 +114,24 @@ static struct twl4030_usb_data beagle_usb_data = {
[PATCH 21/23] twl4030-core: portability updates
From: David Brownell [EMAIL PROTECTED] Improve handling of the OMAP-specific setup in twl4030-core, and remove various warnings on non-OMAP builds. The main remaining portability problem for this core code (from a build perspective) is needing symbols like TWL4030_PWR_IRQ_BASE which are undesirable and platform-specific. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-core.c | 34 -- 1 files changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index 43424a8..efba776 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -75,6 +75,19 @@ #define twl_has_usb() false #endif +static inline void activate_irq(int irq) +{ +#ifdef CONFIG_ARM + /* ARM requires an extra step to clear IRQ_NOREQUEST, which it +* sets on behalf of every irq_chip. Also sets IRQ_NOPROBE. +*/ + set_irq_flags(irq, IRQF_VALID); +#else + /* same effect on other architectures */ + set_irq_noprobe(irq); +#endif +} + /* Primary Interrupt Handler on TWL4030 Registers */ /* Register Definitions */ @@ -584,7 +597,7 @@ static unsigned twl4030_irq_base; */ static int twl4030_irq_thread(void *data) { - int irq = (int)data; + long irq = (long)data; irq_desc_t *desc = irq_desc + irq; static unsigned i2c_errors; const static unsigned max_i2c_errors = 100; @@ -868,15 +881,15 @@ err: return status; } -static struct task_struct * __init start_twl4030_irq_thread(int irq) +static struct task_struct * __init start_twl4030_irq_thread(long irq) { struct task_struct *thread; init_completion(irq_event); thread = kthread_run(twl4030_irq_thread, (void *)irq, -twl4030 irq %d, irq); +twl4030 irq %ld, irq); if (!thread) - pr_err(%s: could not create twl4030 irq %d thread!\n, + pr_err(%s: could not create twl4030 irq %ld thread!\n, DRIVER_NAME, irq); return thread; @@ -909,16 +922,18 @@ static int __init unprotect_pm_master(void) static int __init power_companion_init(void) { int e = 0; - -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) struct clk *osc; u32 rate; u8 ctrl = HFCLK_FREQ_26_MHZ; +#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) if (cpu_is_omap2430()) osc = clk_get(NULL, osc_ck); else osc = clk_get(NULL, osc_sys_ck); +#else + osc = ERR_PTR(-EIO); +#endif if (IS_ERR(osc)) { printk(KERN_WARNING Skipping twl4030 internal clock init and using bootloader value (unknown osc rate)\n); @@ -945,7 +960,6 @@ static int __init power_companion_init(void) /* effect-MADC+USB ck en */ e |= twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, ctrl, R_CFG_BOOT); e |= protect_pm_master(); -#endif /* OMAP */ return e; } @@ -1051,9 +1065,9 @@ static void twl_init_irq(int irq_num, unsigned irq_base, unsigned irq_end) /* install an irq handler for each of the PIH modules */ for (i = irq_base; i irq_end; i++) { - set_irq_chip(i, twl4030_irq_chip); - set_irq_handler(i, do_twl4030_module_irq); - set_irq_flags(i, IRQF_VALID); + set_irq_chip_and_handler(i, twl4030_irq_chip, + do_twl4030_module_irq); + activate_irq(i); } /* install an irq handler to demultiplex the TWL4030 interrupt */ -- 1.6.0.2.307.gc427 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/23] i2c: move twl4030_keypad to new style registration
let twl4030-core.c take care of twl4030_keypad registration. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/mach-omap2/board-2430sdp.c | 14 ++ arch/arm/mach-omap2/board-3430sdp.c | 14 ++ arch/arm/mach-omap2/board-omap2evm.c| 16 ++ arch/arm/mach-omap2/board-omap3evm.c| 69 -- drivers/i2c/chips/twl4030-core.c| 27 ++ drivers/input/keyboard/omap-twl4030keypad.c |8 ++-- include/linux/i2c/twl4030.h | 10 7 files changed, 86 insertions(+), 72 deletions(-) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 3649a94..8c4c9dd 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -173,7 +173,7 @@ static int sdp2430_keymap[] = { 0 }; -static struct omap_kp_platform_data sdp2430_kp_data = { +static struct twl4030_keypad_data sdp2430_kp_data = { .rows = 5, .cols = 6, .keymap = sdp2430_keymap, @@ -182,14 +182,6 @@ static struct omap_kp_platform_data sdp2430_kp_data = { .irq= TWL4030_MODIRQ_KEYPAD, }; -static struct platform_device sdp2430_kp_device = { - .name = omap_twl4030keypad, - .id = -1, - .dev= { - .platform_data = sdp2430_kp_data, - }, -}; - static int __init msecure_init(void) { int ret = 0; @@ -216,7 +208,6 @@ out: static struct platform_device *sdp2430_devices[] __initdata = { sdp2430_smc91x_device, sdp2430_flash_device, - sdp2430_kp_device, sdp2430_lcd_device, }; @@ -356,6 +347,9 @@ static struct omap_board_config_kernel sdp2430_config[] __initdata = { static struct twl4030_platform_data sdp2430_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, + + /* platform_data for children goes here */ + .keypad = sdp2430_kp_data, }; static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 4c60d7b..fe1ba4e 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -110,7 +110,7 @@ static int sdp3430_keymap[] = { 0 }; -static struct omap_kp_platform_data sdp3430_kp_data = { +static struct twl4030_keypad_data sdp3430_kp_data = { .rows = 5, .cols = 6, .keymap = sdp3430_keymap, @@ -119,14 +119,6 @@ static struct omap_kp_platform_data sdp3430_kp_data = { .irq= TWL4030_MODIRQ_KEYPAD, }; -static struct platform_device sdp3430_kp_device = { - .name = omap_twl4030keypad, - .id = -1, - .dev= { - .platform_data = sdp3430_kp_data, - }, -}; - static int ts_gpio; static int __init msecure_init(void) @@ -252,7 +244,6 @@ static struct platform_device sdp3430_lcd_device = { static struct platform_device *sdp3430_devices[] __initdata = { sdp3430_smc91x_device, - sdp3430_kp_device, sdp3430_lcd_device, }; @@ -312,6 +303,9 @@ static struct omap_board_config_kernel sdp3430_config[] __initdata = { static struct twl4030_platform_data sdp3430_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, + + /* platform_data for children goes here */ + .keypad = sdp3430_kp_data, }; static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-omap2evm.c b/arch/arm/mach-omap2/board-omap2evm.c index 6ce7740..d2a3743 100644 --- a/arch/arm/mach-omap2/board-omap2evm.c +++ b/arch/arm/mach-omap2/board-omap2evm.c @@ -200,23 +200,15 @@ static int omap2evm_keymap[] = { KEY(3, 3, KEY_P) }; -static struct omap_kp_platform_data omap2evm_kp_data = { +static struct twl4030_keypad_data omap2evm_kp_data = { .rows = 4, .cols = 4, - .keymap = omap2evm_keymap, + .keymap = omap2evm_keymap, .keymapsize = ARRAY_SIZE(omap2evm_keymap), .rep= 1, .irq= TWL4030_MODIRQ_KEYPAD, }; -static struct platform_device omap2evm_kp_device = { - .name = omap_twl4030keypad, - .id = -1, - .dev= { - .platform_data = omap2evm_kp_data, - }, -}; - static void __init omap2_evm_init_irq(void) { omap2_init_common_hw(NULL); @@ -237,6 +229,9 @@ static struct omap_board_config_kernel omap2_evm_config[] __initdata = { static struct twl4030_platform_data omap2evm_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, + + /* platform_data for children goes here */ + .keypad
[PATCH 13/23] i2c: added a few missing gotos to add_children()
Previously we were failing platform_device_add_data() and returning from add_children but trying to keep going when platform_device_add() fails. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-core.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index 4ea6444..80cf231 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -675,6 +675,7 @@ static int add_children(struct twl4030_platform_data *pdata) if (!pdev) { pr_debug(%s: can't alloc gpio dev\n, DRIVER_NAME); status = -ENOMEM; + goto err; } /* more driver model init */ @@ -735,6 +736,7 @@ static int add_children(struct twl4030_platform_data *pdata) dev_dbg(twl-client-dev, can't create keypad dev, %d\n, status); + goto err; } } else { pr_debug(%s: can't alloc keypad dev\n, DRIVER_NAME); @@ -764,6 +766,7 @@ static int add_children(struct twl4030_platform_data *pdata) dev_dbg(twl-client-dev, can't create madc dev, %d\n, status); + goto err; } } else { pr_debug(%s: can't alloc madc dev\n, DRIVER_NAME); @@ -799,6 +802,7 @@ static int add_children(struct twl4030_platform_data *pdata) dev_dbg(twl-client-dev, can't create rtc dev, %d\n, status); + goto err; } } else { pr_debug(%s: can't alloc rtc dev\n, DRIVER_NAME); @@ -832,7 +836,6 @@ static int add_children(struct twl4030_platform_data *pdata) } else { pr_debug(%s: can't alloc usb dev\n, DRIVER_NAME); status = -ENOMEM; - goto err; } } -- 1.6.0.2.307.gc427 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/23] i2c: twl4030-usb: add 'vbus' sysfs file
vbus sysfs file will report the state of vbus irq coming from twl4030-usb. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-usb.c | 51 ++- 1 files changed, 50 insertions(+), 1 deletions(-) diff --git a/drivers/i2c/chips/twl4030-usb.c b/drivers/i2c/chips/twl4030-usb.c index 246aa9d..f530e71 100644 --- a/drivers/i2c/chips/twl4030-usb.c +++ b/drivers/i2c/chips/twl4030-usb.c @@ -29,6 +29,8 @@ #include linux/time.h #include linux/interrupt.h #include linux/platform_device.h +#include linux/spinlock.h +#include linux/workqueue.h #include linux/io.h #include linux/usb.h #include linux/usb/ch9.h @@ -259,11 +261,17 @@ struct twl4030_usb { + struct work_struct irq_work; struct otg_transceiver otg; struct device *dev; + /* for vbus reporting with irqs disabled */ + spinlock_t lock; + /* pin configuration */ enum twl4030_usb_mode usb_mode; + + unsignedvbus:1; int irq; u8 asleep; }; @@ -529,6 +537,29 @@ static void twl4030_usb_ldo_init(struct twl4030_usb *twl) twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, PROTECT_KEY); } +static ssize_t twl4030_usb_vbus_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct twl4030_usb *twl = dev_get_drvdata(dev); + unsigned long flags; + int ret = -EINVAL; + + spin_lock_irqsave(twl-lock, flags); + ret = sprintf(buf, %s\n, twl-vbus ? on : off); + spin_unlock_irqrestore(twl-lock, flags); + + return ret; +} +static DEVICE_ATTR(vbus, 0444, twl4030_usb_vbus_show, NULL); + +static void twl4030_usb_irq_work(struct work_struct *work) +{ + struct twl4030_usb *twl = container_of(work, + struct twl4030_usb, irq_work); + + sysfs_notify(twl-dev-kobj, NULL, vbus); +} + static irqreturn_t twl4030_usb_irq(int irq, void *_twl) { struct twl4030_usb *twl = _twl; @@ -541,10 +572,13 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) if (val USB_PRES_RISING) { twl4030_phy_resume(twl); twl4030charger_usb_en(1); + twl-vbus = 1; } else { twl4030charger_usb_en(0); + twl-vbus = 0; twl4030_phy_suspend(twl, 0); } + schedule_work(twl-irq_work); return IRQ_HANDLED; } @@ -634,6 +668,7 @@ static int __init twl4030_usb_probe(struct platform_device *pdev) struct twl4030_usb_data *pdata = pdev-dev.platform_data; struct twl4030_usb *twl; int status; + u8 vbus; twl = kzalloc(sizeof *twl, GFP_KERNEL); if (!twl) @@ -644,12 +679,23 @@ static int __init twl4030_usb_probe(struct platform_device *pdev) return -EINVAL; } + WARN_ON(twl4030_i2c_read_u8(TWL4030_MODULE_INT, + vbus, REG_PWR_EDR1) 0); + vbus = USB_PRES_RISING; + twl-dev= pdev-dev; twl-irq= TWL4030_PWRIRQ_USB_PRES; twl-otg.set_host = twl4030_set_host; twl-otg.set_peripheral = twl4030_set_peripheral; twl-otg.set_suspend= twl4030_set_suspend; twl-usb_mode = pdata-usb_mode; + twl-vbus = vbus ? 1 : 0; + + /* init spinlock for workqueue */ + spin_lock_init(twl-lock); + + /* init irq workqueue before request_irq */ + INIT_WORK(twl-irq_work, twl4030_usb_irq_work); usb_irq_disable(twl); status = request_irq(twl-irq, twl4030_usb_irq, 0, twl4030_usb, twl); @@ -660,7 +706,6 @@ static int __init twl4030_usb_probe(struct platform_device *pdev) return status; } - twl4030_usb_ldo_init(twl); twl4030_phy_power(twl, 1); twl4030_i2c_access(twl, 1); @@ -677,6 +722,9 @@ static int __init twl4030_usb_probe(struct platform_device *pdev) platform_set_drvdata(pdev, twl); dev_info(pdev-dev, Initialized TWL4030 USB module\n); + if (device_create_file(pdev-dev, dev_attr_vbus)) + dev_warn(pdev-dev, could not create sysfs file\n); + return 0; } @@ -687,6 +735,7 @@ static int __exit twl4030_usb_remove(struct platform_device *pdev) usb_irq_disable(twl); free_irq(twl-irq, twl); + device_remove_file(twl-dev, dev_attr_vbus); /* set transceiver mode to power on defaults */ twl4030_usb_set_mode(twl, -1); -- 1.6.0.2.307.gc427 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 18/23] twl4030-gpio irq_chip.set_type
From: David Brownell [EMAIL PROTECTED] Make twl4030 GPIO support set_type() request. Plus a bit of cleanup for the simple functions. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/gpio/twl4030-gpio.c | 84 +- 1 files changed, 74 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c index b65d476..e709fbb 100644 --- a/drivers/gpio/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c @@ -153,6 +153,9 @@ static unsigned int gpio_imr_shadow; /* bitmask of pending requests to unmask gpio interrupts */ static unsigned int gpio_pending_unmask; +/* bitmask of requests to set gpio irq trigger type */ +static unsigned int gpio_pending_trigger; + /* pointer to gpio unmask thread struct */ static struct task_struct *gpio_unmask_thread; @@ -241,10 +244,15 @@ static void twl4030_gpio_unmask(unsigned int irq) * controller to a kernel thread. We only need to support the unmask method. */ -static void twl4030_gpio_mask_and_ack_irqchip(unsigned int irq) {} -static void twl4030_gpio_mask_irqchip(unsigned int irq) {} +static void twl4030_gpio_irq_mask_and_ack(unsigned int irq) +{ +} + +static void twl4030_gpio_irq_mask(unsigned int irq) +{ +} -static void twl4030_gpio_unmask_irqchip(unsigned int irq) +static void twl4030_gpio_irq_unmask(unsigned int irq) { int gpio = irq - twl4030_gpio_irq_base; @@ -253,11 +261,36 @@ static void twl4030_gpio_unmask_irqchip(unsigned int irq) wake_up_process(gpio_unmask_thread); } +static int twl4030_gpio_irq_set_type(unsigned int irq, unsigned trigger) +{ + struct irq_desc *desc = irq_desc + irq; + int gpio = irq - twl4030_gpio_irq_base; + + trigger = IRQ_TYPE_SENSE_MASK; + if (trigger ~IRQ_TYPE_EDGE_BOTH) + return -EINVAL; + if ((desc-status IRQ_TYPE_SENSE_MASK) == trigger) + return 0; + + desc-status = ~IRQ_TYPE_SENSE_MASK; + desc-status |= trigger; + + /* REVISIT This makes the unmask thread do double duty, +* updating IRQ trigger modes too. Rename appropriately... +*/ + gpio_pending_trigger |= (1 gpio); + if (gpio_unmask_thread gpio_unmask_thread-state != TASK_RUNNING) + wake_up_process(gpio_unmask_thread); + + return 0; +} + static struct irq_chip twl4030_gpio_irq_chip = { - .name = twl4030, - .ack= twl4030_gpio_mask_and_ack_irqchip, - .mask = twl4030_gpio_mask_irqchip, - .unmask = twl4030_gpio_unmask_irqchip, + .name = twl4030, + .ack= twl4030_gpio_irq_mask_and_ack, + .mask = twl4030_gpio_irq_mask, + .unmask = twl4030_gpio_irq_unmask, + .set_type = twl4030_gpio_irq_set_type, }; /* @@ -478,8 +511,6 @@ int twl4030_set_gpio_pull(int gpio, int pull_dircn) /* * Configure Edge control for a GPIO pin on TWL4030 - * - * FIXME this should just be the irq_chip.set_type() method */ int twl4030_set_gpio_edge_ctrl(int gpio, int edge) { @@ -601,10 +632,14 @@ static int twl4030_gpio_unmask_thread(void *data) while (!kthread_should_stop()) { int irq; unsigned int gpio_unmask; + unsigned int gpio_trigger; local_irq_disable(); gpio_unmask = gpio_pending_unmask; gpio_pending_unmask = 0; + + gpio_trigger = gpio_pending_trigger; + gpio_pending_trigger = 0; local_irq_enable(); for (irq = twl4030_gpio_irq_base; 0 != gpio_unmask; @@ -613,8 +648,37 @@ static int twl4030_gpio_unmask_thread(void *data) twl4030_gpio_unmask(irq); } + for (irq = twl4030_gpio_irq_base; + gpio_trigger; + gpio_trigger = 1, irq++) { + struct irq_desc *desc; + unsigned type, edge; + + if (!(gpio_trigger 0x1)) + continue; + + desc = irq_desc + irq; + spin_lock_irq(desc-lock); + type = desc-status IRQ_TYPE_SENSE_MASK; + spin_unlock_irq(desc-lock); + + switch (type) { + case IRQ_TYPE_EDGE_RISING: + edge = TWL4030_GPIO_EDGE_RISING; + break; + case IRQ_TYPE_EDGE_FALLING: + edge = TWL4030_GPIO_EDGE_FALLING; + break; + default: + edge = TWL4030_GPIO_EDGE_RISING + | TWL4030_GPIO_EDGE_FALLING; + break; + } +
[PATCH 14/23] minor irq-related cleanups
From: David Brownell [EMAIL PROTECTED] Minor IRQ-related cleanups: comment out the no-longer-used GPIO irq symbol (more to come, eventually); create RTC IRQ resource; and use that RTC IRQ resource. And incidentally, make the RTC code free the correct IRQ; it was pretty goofed up... Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/gpio/twl4030-gpio.c |1 - drivers/i2c/chips/twl4030-core.c | 57 + drivers/rtc/rtc-twl4030.c| 11 +-- include/linux/i2c/twl4030.h |2 +- 4 files changed, 41 insertions(+), 30 deletions(-) diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c index 2949da1..b65d476 100644 --- a/drivers/gpio/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c @@ -49,7 +49,6 @@ /* REVISIT when these symbols vanish elsewhere, remove them here too */ /* #undef TWL4030_GPIO_IRQ_BASE */ /* #undef TWL4030_GPIO_IRQ_END */ -#undef TWL4030_MODIRQ_GPIO static struct gpio_chip twl_gpiochip; static int twl4030_gpio_irq_base; diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index 80cf231..e0a6ef4 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -776,37 +776,44 @@ static int add_children(struct twl4030_platform_data *pdata) } if (twl_has_rtc()) { + twl = twl4030_modules[TWL4030_SLAVENUM_NUM3]; + pdev = platform_device_alloc(twl4030_rtc, -1); - if (pdev) { - twl = twl4030_modules[TWL4030_SLAVENUM_NUM3]; + if (!pdev) { + pr_debug(%s: can't alloc rtc dev\n, DRIVER_NAME); + status = -ENOMEM; + } else { pdev-dev.parent = twl-client-dev; device_init_wakeup(pdev-dev, 1); + } - /* -* FIXME add the relevant IRQ resource, and make the -* rtc driver use it instead of hard-wiring ... -* -* REVISIT platform_data here currently only supports -* setting up the msecure line ... which actually -* violates the princple of least privilege, since -* it's effectively always in high trust mode. -* -* For now, expect equivalent treatment at board init: -* setting msecure high. Eventually, Linux might -* become more aware of those HW security concerns. -*/ + /* +* REVISIT platform_data here currently might use of +* msecure line ... but for now we just expect board +* setup to tell the chip we are secure at all times. +* Eventually, Linux might become more aware of such +* HW security concerns, and least privilege. +*/ + + /* RTC module IRQ */ + if (status == 0) { + struct resource r = { + /* REVISIT don't hard-wire this stuff */ + .start = TWL4030_PWRIRQ_RTC, + .flags = IORESOURCE_IRQ, + }; + + status = platform_device_add_resources(pdev, r, 1); + } + if (status == 0) status = platform_device_add(pdev); - if (status 0) { - platform_device_put(pdev); - dev_dbg(twl-client-dev, - can't create rtc dev, %d\n, - status); - goto err; - } - } else { - pr_debug(%s: can't alloc rtc dev\n, DRIVER_NAME); - status = -ENOMEM; + + if (status 0) { + platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't create rtc dev, %d\n, + status); goto err; } } diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c index 98aea07..b19151a 100644 --- a/drivers/rtc/rtc-twl4030.c +++ b/drivers/rtc/rtc-twl4030.c @@ -353,8 +353,12 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev) struct twl4030rtc_platform_data *pdata = pdev-dev.platform_data; struct rtc_device *rtc; int ret = 0; + int irq = platform_get_irq(pdev, 0); u8 rd_reg; + if (irq 0) + return irq; + if (pdata != NULL pdata-init != NULL) { ret
[PATCH 11/23] provide detailed diagnostics in add_children()
From: David Brownell [EMAIL PROTECTED] Provide detailed diagnostics in add_children() when DEBUG is defined ... and fix the non-DEBUG message to include minimal status, and not appear unless there was actually an error. Update the IRQ message; have it match what the GPIO subchip says, and as a precaution, make it only appear if the IRQs have been initialized. Signed-off-by: David Brownell [EMAIL PROTECTED] Added a few more diagnostics when platform_device_add() fails. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-core.c | 59 ++--- 1 files changed, 48 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index 22850a8..5dcc3b1 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -672,8 +672,10 @@ static int add_children(struct twl4030_platform_data *pdata) twl = twl4030_modules[TWL4030_SLAVENUM_NUM1]; pdev = platform_device_alloc(twl4030_gpio, -1); - if (!pdev) + if (!pdev) { + pr_debug(%s: can't alloc gpio dev\n, DRIVER_NAME); status = -ENOMEM; + } /* more driver model init */ if (status == 0) { @@ -682,6 +684,12 @@ static int add_children(struct twl4030_platform_data *pdata) status = platform_device_add_data(pdev, pdata-gpio, sizeof(*pdata-gpio)); + if (status 0) { + dev_dbg(twl-client-dev, + can't add gpio data, %d\n, + status); + goto err; + } } /* GPIO module IRQ */ @@ -715,13 +723,21 @@ static int add_children(struct twl4030_platform_data *pdata) status = platform_device_add_data(pdev, pdata-keypad, sizeof(*pdata-keypad)); if (status 0) { + dev_dbg(twl-client-dev, + can't add keypad data, %d\n, + status); platform_device_put(pdev); goto err; } status = platform_device_add(pdev); - if (status 0) + if (status 0) { platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't create keypad dev, %d\n, + status); + } } else { + pr_debug(%s: can't alloc keypad dev\n, DRIVER_NAME); status = -ENOMEM; goto err; } @@ -737,12 +753,20 @@ static int add_children(struct twl4030_platform_data *pdata) sizeof(*pdata-madc)); if (status 0) { platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't add madc data, %d\n, + status); goto err; } status = platform_device_add(pdev); - if (status 0) + if (status 0) { platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't create madc dev, %d\n, + status); + } } else { + pr_debug(%s: can't alloc madc dev\n, DRIVER_NAME); status = -ENOMEM; goto err; } @@ -770,9 +794,14 @@ static int add_children(struct twl4030_platform_data *pdata) */ status = platform_device_add(pdev); - if (status 0) + if (status 0) { platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't create rtc dev, %d\n, + status); + } } else { + pr_debug(%s: can't alloc rtc dev\n, DRIVER_NAME); status = -ENOMEM; goto err; } @@ -788,19 +817,28 @@ static int add_children(struct twl4030_platform_data *pdata)
[PATCH 5/5 v1] ASoC Adds DSP DAI format support for platform driver
Enables DSP DAI format for mcbsp in omap platform driver Signed-off-by: Arun KS [EMAIL PROTECTED] --- sound/soc/omap/omap-mcbsp.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 35310e1..fb920e1 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c @@ -245,6 +245,11 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, regs-rcr2 |= RDATDLY(1); regs-xcr2 |= XDATDLY(1); break; + case SND_SOC_DAIFMT_DSP_A: + /* 0-bit data delay */ + regs-rcr2 |= RDATDLY(0); + regs-xcr2 |= XDATDLY(0); + break; default: /* Unsupported data format */ return -EINVAL; -- 1.5.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 17/23] i2c: minor cleanups to twl4030-pwrbutton.c
Trivial brainless fixes, a few unused headers removed, changed one printk to pr_err() and removed one comment. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-pwrbutton.c | 10 +- 1 files changed, 1 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/chips/twl4030-pwrbutton.c b/drivers/i2c/chips/twl4030-pwrbutton.c index d86d489..9a361b3 100644 --- a/drivers/i2c/chips/twl4030-pwrbutton.c +++ b/drivers/i2c/chips/twl4030-pwrbutton.c @@ -26,9 +26,6 @@ #include linux/kernel.h #include linux/errno.h #include linux/input.h -#include linux/timer.h -#include linux/jiffies.h -#include linux/kthread.h #include linux/interrupt.h #include linux/i2c/twl4030.h @@ -47,11 +44,6 @@ static struct input_dev *powerbutton_dev; -/* - * Note : the following function runs in kernel thread context - * with IRQs enabled - */ - static irqreturn_t powerbutton_irq(int irq, void *dev_id) { int err; @@ -63,7 +55,7 @@ static irqreturn_t powerbutton_irq(int irq, void *dev_id) input_report_key(powerbutton_dev, KEY_POWER, value PWR_PWRON_IRQ); } else { - printk(KERN_WARNING I2C error %d while reading TWL4030 + pr_err(twl4030: i2c error %d while reading TWL4030 PM_MASTER STS_HW_CONDITIONS register\n, err); } -- 1.6.0.2.307.gc427 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/23] move twl4030-gpio to drivers/gpio
From: David Brownell [EMAIL PROTECTED] Move the twl4030 GPIO support from drivers/i2c/chips to drivers/gpio, which is a more appropriate home for this code. The Kconfig symbol name is changed to match the GPIO_* convention for such symbols, so config files must change in the obvious ways (Kconfig will prompt you). There's now some helptext. It can now be compiled as a module, should anyone really want to do that; that'll be mostly useful for test builds. Sanity check the IRQ range we're given. Initialization order needed a bit of work too: core add_children() called only after IRQs get set up, gpio uses subsys_initcall. This depends on a patch making i2c driver model init use postcore_initcall. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/plat-omap/include/mach/irqs.h |2 +- drivers/gpio/Kconfig |7 + drivers/gpio/Makefile |1 + drivers/{i2c/chips = gpio}/twl4030-gpio.c | 37 +++ drivers/i2c/chips/Kconfig |4 --- drivers/i2c/chips/Makefile |1 - drivers/i2c/chips/twl4030-core.c | 12 +++-- 7 files changed, 44 insertions(+), 20 deletions(-) rename drivers/{i2c/chips = gpio}/twl4030-gpio.c (96%) diff --git a/arch/arm/plat-omap/include/mach/irqs.h b/arch/arm/plat-omap/include/mach/irqs.h index 29c92c9..8a4473e 100644 --- a/arch/arm/plat-omap/include/mach/irqs.h +++ b/arch/arm/plat-omap/include/mach/irqs.h @@ -369,7 +369,7 @@ /* External TWL4030 gpio interrupts are optional */ #define TWL4030_GPIO_IRQ_BASE TWL4030_PWR_IRQ_END -#ifdef CONFIG_TWL4030_GPIO +#ifdef CONFIG_GPIO_TWL4030 #define TWL4030_GPIO_NR_IRQS 18 #else #defineTWL4030_GPIO_NR_IRQS0 diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index dbd42d6..293b4a7 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -127,6 +127,13 @@ config GPIO_PCF857X This driver provides an in-kernel interface to those GPIOs using platform-neutral GPIO calls. +config GPIO_TWL4030 + tristate TWL4030/TPS659x0 GPIO Driver + depends on TWL4030_CORE GPIOLIB + help + Say yes here to access the GPIO signals of various multi-function + power management chips from Texas Instruments. + comment PCI GPIO expanders: config GPIO_BT8XX diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 01b4bbd..6aafdeb 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -9,4 +9,5 @@ obj-$(CONFIG_GPIO_MAX732X) += max732x.o obj-$(CONFIG_GPIO_MCP23S08)+= mcp23s08.o obj-$(CONFIG_GPIO_PCA953X) += pca953x.o obj-$(CONFIG_GPIO_PCF857X) += pcf857x.o +obj-$(CONFIG_GPIO_TWL4030) += twl4030-gpio.o obj-$(CONFIG_GPIO_BT8XX) += bt8xxgpio.o diff --git a/drivers/i2c/chips/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c similarity index 96% rename from drivers/i2c/chips/twl4030-gpio.c rename to drivers/gpio/twl4030-gpio.c index 0d4dd28..2949da1 100644 --- a/drivers/i2c/chips/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c @@ -1,5 +1,5 @@ /* - * linux/drivers/i2c/chips/twl4030_gpio.c + * twl4030_gpio.c -- access to GPIOs on TWL4030/TPS659x0 chips * * Copyright (C) 2006-2007 Texas Instruments, Inc. * Copyright (C) 2006 MontaVista Software, Inc. @@ -23,7 +23,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * */ #include linux/module.h @@ -48,14 +47,19 @@ /* REVISIT when these symbols vanish elsewhere, remove them here too */ -#undef TWL4030_GPIO_IRQ_BASE -#undef TWL4030_GPIO_IRQ_END +/* #undef TWL4030_GPIO_IRQ_BASE */ +/* #undef TWL4030_GPIO_IRQ_END */ #undef TWL4030_MODIRQ_GPIO static struct gpio_chip twl_gpiochip; static int twl4030_gpio_irq_base; static int twl4030_gpio_irq_end; +#ifdef MODULE +#define is_module()true +#else +#define is_module()false +#endif /* BitField Definitions */ @@ -765,7 +769,24 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev) twl4030_gpio_irq_base = pdata-irq_base; twl4030_gpio_irq_end = pdata-irq_end; - /* REVISIT skip most of this if the irq range is empty... */ + if ((twl4030_gpio_irq_end - twl4030_gpio_irq_base) 0) { + if (is_module()) { + dev_err(pdev-dev, + can't dispatch IRQs from modules\n); + goto no_irqs; + } + if (twl4030_gpio_irq_end NR_IRQS) { + dev_err(pdev-dev, + last IRQ is too large: %d\n, + twl4030_gpio_irq_end); + return -EINVAL; + } + } else { + dev_notice(pdev-dev, + no
[PATCH 00/23] twl4030 patches (v4)
In this version there are irq fixes from David Brownell. David Brownell (11): twl4030 gpio platform data twl4030 uses gpiolib minor twl4030-core cleanups provide detailed diagnostics in add_children() move twl4030-gpio to drivers/gpio minor irq-related cleanups Move I2C driver model init earlier in the boot sequence twl4030-gpio irq_chip.set_type twl4030-gpio: remove legacy irq triggering calls and user twl4030-gpio: irq and other cleanup twl4030-core: portability updates Felipe Balbi (11): twl4030: fix potential null pointer dereference i2c: clean add_children a bit i2c: move twl4030_keypad to new style registration i2c: move twl4030-usb to platform_device i2c: twl4030-usb: add 'vbus' sysfs file i2c: move twl4030-madc to new registration style i2c: added a few missing gotos to add_children() i2c: switch twl4030-usb to use a resource for irq i2c: minor cleanups to twl4030-pwrbutton.c twl4030: minor cleanups to twl4030_bci_battery.c twl4030-bci: move to new style registration method Jagadeesh Bhaskar Pakaravoor (1): twl4030-gpio: Remove default pullup enable/disable of GPIO arch/arm/mach-omap2/Makefile|4 +- arch/arm/mach-omap2/bci.c | 57 arch/arm/mach-omap2/board-2430sdp.c | 32 ++- arch/arm/mach-omap2/board-3430sdp.c | 49 +++- arch/arm/mach-omap2/board-ldp.c | 37 +++- arch/arm/mach-omap2/board-omap2evm.c| 33 ++- arch/arm/mach-omap2/board-omap3beagle.c | 19 ++ arch/arm/mach-omap2/board-omap3evm.c| 85 +++--- arch/arm/mach-omap2/board-overo.c | 11 + arch/arm/mach-omap2/hsmmc.c |5 - arch/arm/plat-omap/include/mach/bci.h | 17 - arch/arm/plat-omap/include/mach/irqs.h |2 +- drivers/gpio/Kconfig|7 + drivers/gpio/Makefile |1 + drivers/{i2c/chips = gpio}/twl4030-gpio.c | 418 +++ drivers/i2c/chips/Kconfig | 20 -- drivers/i2c/chips/Makefile |1 - drivers/i2c/chips/twl4030-core.c| 344 +++--- drivers/i2c/chips/twl4030-madc.c| 243 ++-- drivers/i2c/chips/twl4030-pwrbutton.c | 10 +- drivers/i2c/chips/twl4030-usb.c | 373 drivers/i2c/i2c-core.c |2 +- drivers/input/keyboard/omap-twl4030keypad.c | 10 +- drivers/mmc/host/omap_hsmmc.c |4 +- drivers/power/twl4030_bci_battery.c | 184 ++-- drivers/rtc/rtc-twl4030.c | 11 +- include/linux/i2c/twl4030.h | 64 - 27 files changed, 1306 insertions(+), 737 deletions(-) delete mode 100644 arch/arm/mach-omap2/bci.c delete mode 100644 arch/arm/plat-omap/include/mach/bci.h rename drivers/{i2c/chips = gpio}/twl4030-gpio.c (67%) -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/23] i2c: clean add_children a bit
Clean up add_children a bit before adding more children to twl4030-core.c Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-core.c | 63 + 1 files changed, 36 insertions(+), 27 deletions(-) diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index 47f65f8..e55f49e 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -45,6 +45,11 @@ #define DRIVER_NAMEtwl4030 +#if defined(CONFIG_RTC_DRV_TWL4030) || defined(CONFIG_RTC_DRV_TWL4030_MODULE) +#define twl_has_rtc() true +#else +#define twl_has_rtc() false +#endif /* Primary Interrupt Handler on TWL4030 Registers */ @@ -639,34 +644,38 @@ static int add_children(struct twl4030_platform_data *pdata) struct twl4030_client *twl = NULL; int status = 0; -#ifdef CONFIG_RTC_DRV_TWL4030 - pdev = platform_device_alloc(twl4030_rtc, -1); - if (pdev) { - twl = twl4030_modules[TWL4030_SLAVENUM_NUM3]; - pdev-dev.parent = twl-client-dev; - device_init_wakeup(pdev-dev, 1); - - /* -* FIXME add the relevant IRQ resource, and make the -* rtc driver use it instead of hard-wiring ... -* -* REVISIT platform_data here currently only supports -* setting up the msecure line ... which actually -* violates the princple of least privilege, since -* it's effectively always in high trust mode. -* -* For now, expect equivalent treatment at board init: -* setting msecure high. Eventually, Linux might -* become more aware of those HW security concerns. -*/ - - status = platform_device_add(pdev); - if (status 0) - platform_device_put(pdev); - } else - status = -ENOMEM; -#endif + if (twl_has_rtc()) { + pdev = platform_device_alloc(twl4030_rtc, -1); + if (pdev) { + twl = twl4030_modules[TWL4030_SLAVENUM_NUM3]; + pdev-dev.parent = twl-client-dev; + device_init_wakeup(pdev-dev, 1); + + /* +* FIXME add the relevant IRQ resource, and make the +* rtc driver use it instead of hard-wiring ... +* +* REVISIT platform_data here currently only supports +* setting up the msecure line ... which actually +* violates the princple of least privilege, since +* it's effectively always in high trust mode. +* +* For now, expect equivalent treatment at board init: +* setting msecure high. Eventually, Linux might +* become more aware of those HW security concerns. +*/ + + status = platform_device_add(pdev); + if (status 0) + platform_device_put(pdev); + } else { + status = -ENOMEM; + goto err; + } + } +err: + pr_err(failed to add twl4030's children\n); return status; } -- 1.6.0.2.307.gc427 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 16/23] Move I2C driver model init earlier in the boot sequence
From: David Brownell [EMAIL PROTECTED] This avoids oopsing in statically linked systems when some subsystems register I2C drivers in subsys_initcall() code, but those subsystems are linked (and initialized) before I2C. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/i2c-core.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index b346a68..f520108 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -978,7 +978,7 @@ static void __exit i2c_exit(void) bus_unregister(i2c_bus_type); } -subsys_initcall(i2c_init); +postcore_initcall(i2c_init); module_exit(i2c_exit); /* -- 1.6.0.2.307.gc427 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 20/23] twl4030-gpio: irq and other cleanup
From: David Brownell [EMAIL PROTECTED] Remove some ARM and OMAP specific stuff from the twl4030 GPIO code, and some unused/undesirable CPP symbols. Add minor checkpatch fixes. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/gpio/twl4030-gpio.c | 36 +++- include/linux/i2c/twl4030.h |6 -- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c index 404cb34..04a58cb 100644 --- a/drivers/gpio/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c @@ -40,20 +40,25 @@ #include linux/i2c/twl4030.h #include linux/i2c/twl4030-gpio.h -#include mach/irqs.h -#include asm/mach/irq.h -#include mach/gpio.h -#include mach/mux.h - -/* REVISIT when these symbols vanish elsewhere, remove them here too */ -/* #undef TWL4030_GPIO_IRQ_BASE */ -/* #undef TWL4030_GPIO_IRQ_END */ +static inline void activate_irq(int irq) +{ +#ifdef CONFIG_ARM + /* ARM requires an extra step to clear IRQ_NOREQUEST, which it +* sets on behalf of every irq_chip. Also sets IRQ_NOPROBE. +*/ + set_irq_flags(irq, IRQF_VALID); +#else + /* same effect on other architectures */ + set_irq_noprobe(irq); +#endif +} static struct gpio_chip twl_gpiochip; static int twl4030_gpio_irq_base; static int twl4030_gpio_irq_end; +/* genirq interfaces are not available to modules */ #ifdef MODULE #define is_module()true #else @@ -530,7 +535,7 @@ static int twl4030_set_gpio_edge_ctrl(int gpio, int edge) if (ret = 0) { /* clear the previous rising/falling values */ reg = (u8) ret; - reg = ~( MASK_GPIO_EDR1_GPIOxFALLING(c_off) + reg = ~(MASK_GPIO_EDR1_GPIOxFALLING(c_off) | MASK_GPIO_EDR1_GPIOxRISING(c_off)); reg |= c_msk; ret = gpio_twl4030_write(base, reg); @@ -598,7 +603,7 @@ int twl4030_set_gpio_card_detect(int gpio, int enable) ret = gpio_twl4030_write(REG_GPIO_CTRL, reg); } mutex_unlock(gpio_lock); - return (ret); + return ret; } #endif @@ -847,9 +852,9 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev) /* install an irq handler for each of the gpio interrupts */ for (irq = twl4030_gpio_irq_base; irq twl4030_gpio_irq_end; irq++) { - set_irq_chip(irq, twl4030_gpio_irq_chip); - set_irq_handler(irq, do_twl4030_gpio_irq); - set_irq_flags(irq, IRQF_VALID); + set_irq_chip_and_handler(irq, twl4030_gpio_irq_chip, + do_twl4030_gpio_irq); + activate_irq(irq); } /* gpio module IRQ */ @@ -918,13 +923,10 @@ static int __devexit gpio_twl4030_remove(struct platform_device *pdev) /* uninstall the gpio demultiplexing interrupt handler */ irq = platform_get_irq(pdev, 0); set_irq_handler(irq, NULL); - set_irq_flags(irq, 0); /* uninstall the irq handler for each of the gpio interrupts */ - for (irq = twl4030_gpio_irq_base; irq twl4030_gpio_irq_end; irq++) { + for (irq = twl4030_gpio_irq_base; irq twl4030_gpio_irq_end; irq++) set_irq_handler(irq, NULL); - set_irq_flags(irq, 0); - } /* stop the gpio unmask kernel thread */ if (gpio_unmask_thread) { diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h index f26fda1..56a9415 100644 --- a/include/linux/i2c/twl4030.h +++ b/include/linux/i2c/twl4030.h @@ -138,17 +138,11 @@ struct twl4030_platform_data { /* TWL4030 GPIO interrupt definitions */ -#define TWL4030_GPIO_MIN 0 #define TWL4030_GPIO_MAX 18 -#define TWL4030_GPIO_MAX_CD2 #define TWL4030_GPIO_IRQ_NO(n) (TWL4030_GPIO_IRQ_BASE + (n)) -#define TWL4030_GPIO_IS_INPUT 1 -#define TWL4030_GPIO_IS_OUTPUT 0 #define TWL4030_GPIO_IS_ENABLE 1 -#define TWL4030_GPIO_IS_DISABLE0 #define TWL4030_GPIO_PULL_UP 0 #define TWL4030_GPIO_PULL_DOWN 1 -#define TWL4030_GPIO_PULL_NONE 2 /* Functions to read and write from TWL4030 */ -- 1.6.0.2.307.gc427 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 05/23] i2c: move twl4030-usb to platform_device
use new style twl4030-core to register a platform_device for twl4030-usb. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/mach-omap2/board-2430sdp.c |6 + arch/arm/mach-omap2/board-3430sdp.c |5 + arch/arm/mach-omap2/board-ldp.c |7 + arch/arm/mach-omap2/board-omap2evm.c|5 + arch/arm/mach-omap2/board-omap3beagle.c |7 + arch/arm/mach-omap2/board-omap3evm.c|6 +- arch/arm/mach-omap2/board-overo.c |5 + drivers/i2c/chips/Kconfig | 16 -- drivers/i2c/chips/twl4030-core.c| 27 +++ drivers/i2c/chips/twl4030-usb.c | 324 ++- include/linux/i2c/twl4030.h | 10 + 11 files changed, 219 insertions(+), 199 deletions(-) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 8c4c9dd..3073528 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -344,12 +344,18 @@ static struct omap_board_config_kernel sdp2430_config[] __initdata = { {OMAP_TAG_SERIAL_CONSOLE, sdp2430_serial_console_config}, }; + +static struct twl4030_usb_data sdp2430_usb_data = { + .usb_mode = T2_USB_MODE_ULPI, +}; + static struct twl4030_platform_data sdp2430_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .keypad = sdp2430_kp_data, + .usb= sdp2430_usb_data, }; static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index fe1ba4e..e0c39c2 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -300,12 +300,17 @@ static struct omap_board_config_kernel sdp3430_config[] __initdata = { { OMAP_TAG_LCD, sdp3430_lcd_config }, }; +static struct twl4030_usb_data sdp3430_usb_data = { + .usb_mode = T2_USB_MODE_ULPI, +}; + static struct twl4030_platform_data sdp3430_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .keypad = sdp3430_kp_data, + .usb= sdp3430_usb_data, }; static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index c07c712..219579b 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c @@ -183,9 +183,16 @@ static struct omap_board_config_kernel ldp_config[] __initdata = { { OMAP_TAG_UART,ldp_uart_config }, }; +static struct twl4030_usb_data ldp_usb_data = { + .usb_mode = T2_USB_MODE_ULPI, +}; + static struct twl4030_platform_data ldp_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, + + /* platform_data for children goes here */ + .usb= ldp_usb_data, }; static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-omap2evm.c b/arch/arm/mach-omap2/board-omap2evm.c index d2a3743..be8348d 100644 --- a/arch/arm/mach-omap2/board-omap2evm.c +++ b/arch/arm/mach-omap2/board-omap2evm.c @@ -226,12 +226,17 @@ static struct omap_board_config_kernel omap2_evm_config[] __initdata = { { OMAP_TAG_LCD, omap2_evm_lcd_config }, }; +static struct twl4030_usb_data omap2evm_usb_data = { + .usb_mode = T2_USB_MODE_ULPI, +}; + static struct twl4030_platform_data omap2evm_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .keypad = omap2evm_kp_data, + .usb= omap2evm_usb_data, }; static struct i2c_board_info __initdata omap2evm_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index fa8f5f6..ae677b9 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -110,9 +110,16 @@ static struct omap_uart_config omap3_beagle_uart_config __initdata = { .enabled_uarts = ((1 0) | (1 1) | (1 2)), }; +static struct twl4030_usb_data beagle_usb_data = { + .usb_mode = T2_USB_MODE_ULPI, +}; + static struct twl4030_platform_data beagle_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, + + /* platform_data for children goes here */ + .usb= beagle_usb_data, }; static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index c4a969d..158138c 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c @@ -90,6 +90,10 @@ static
[PATCH 15/23] i2c: switch twl4030-usb to use a resource for irq
use platform_get_irq() for getting irq number passed to twl4030-usb via twl4030-core.c:add_children() Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-core.c | 38 +++--- drivers/i2c/chips/twl4030-usb.c |2 +- include/linux/i2c/twl4030.h |2 +- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index e0a6ef4..43424a8 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -819,9 +819,16 @@ static int add_children(struct twl4030_platform_data *pdata) } if (twl_has_usb() pdata-usb) { + twl = twl4030_modules[TWL4030_SLAVENUM_NUM0]; + pdev = platform_device_alloc(twl4030_usb, -1); - if (pdev) { - twl = twl4030_modules[TWL4030_SLAVENUM_NUM0]; + if (!pdev) { + pr_debug(%s: can't alloc usb dev\n, DRIVER_NAME); + status = -ENOMEM; + goto err; + } + + if (status == 0) { pdev-dev.parent = twl-client-dev; device_init_wakeup(pdev-dev, 1); status = platform_device_add_data(pdev, pdata-usb, @@ -833,16 +840,25 @@ static int add_children(struct twl4030_platform_data *pdata) status); goto err; } + } + + if (status == 0) { + struct resource r = { + .start = TWL4030_PWRIRQ_USB_PRES, + .flags = IORESOURCE_IRQ, + }; + + status = platform_device_add_resources(pdev, r, 1); + } + + if (status == 0) status = platform_device_add(pdev); - if (status 0) { - platform_device_put(pdev); - dev_dbg(twl-client-dev, - can't create usb dev, %d\n, - status); - } - } else { - pr_debug(%s: can't alloc usb dev\n, DRIVER_NAME); - status = -ENOMEM; + + if (status 0) { + platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't create usb dev, %d\n, + status); } } diff --git a/drivers/i2c/chips/twl4030-usb.c b/drivers/i2c/chips/twl4030-usb.c index f530e71..133cc0f 100644 --- a/drivers/i2c/chips/twl4030-usb.c +++ b/drivers/i2c/chips/twl4030-usb.c @@ -684,7 +684,7 @@ static int __init twl4030_usb_probe(struct platform_device *pdev) vbus = USB_PRES_RISING; twl-dev= pdev-dev; - twl-irq= TWL4030_PWRIRQ_USB_PRES; + twl-irq= platform_get_irq(pdev, 0); twl-otg.set_host = twl4030_set_host; twl-otg.set_peripheral = twl4030_set_peripheral; twl-otg.set_suspend= twl4030_set_suspend; diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h index 5828485..1c79c89 100644 --- a/include/linux/i2c/twl4030.h +++ b/include/linux/i2c/twl4030.h @@ -112,7 +112,7 @@ struct twl4030_platform_data { #define TWL4030_MODIRQ_KEYPAD (TWL4030_IRQ_BASE + 1) #define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2) #define TWL4030_MODIRQ_MADC(TWL4030_IRQ_BASE + 3) -#define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) +/* #define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) */ #define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) #define TWL4030_PWRIRQ_PWRBTN (TWL4030_PWR_IRQ_BASE + 0) -- 1.6.0.2.307.gc427 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 19/23] twl4030-gpio: remove legacy irq triggering calls and user
From: David Brownell [EMAIL PROTECTED] Make the hsmmc code use genirq interfaces to make sure the card detect IRQ triggers on both edges. Remove the older TWL-specific infrastructure for making that happen. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/mach-omap2/hsmmc.c |5 - drivers/gpio/twl4030-gpio.c | 38 -- drivers/mmc/host/omap_hsmmc.c |4 +++- include/linux/i2c/twl4030.h |4 4 files changed, 11 insertions(+), 40 deletions(-) diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index 7334d86..2ba9986 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c @@ -65,11 +65,6 @@ static int hsmmc_late_init(struct device *dev) if (ret) goto err; - ret = twl4030_set_gpio_edge_ctrl(MMC1_CD_IRQ, - TWL4030_GPIO_EDGE_RISING | TWL4030_GPIO_EDGE_FALLING); - if (ret) - goto err; - ret = twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x02, TWL_GPIO_PUPDCTR1); if (ret) diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c index e709fbb..404cb34 100644 --- a/drivers/gpio/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c @@ -509,10 +509,7 @@ int twl4030_set_gpio_pull(int gpio, int pull_dircn) } #endif -/* - * Configure Edge control for a GPIO pin on TWL4030 - */ -int twl4030_set_gpio_edge_ctrl(int gpio, int edge) +static int twl4030_set_gpio_edge_ctrl(int gpio, int edge) { u8 c_bnk = GET_GPIO_CTL_BANK(gpio); u8 c_off = GET_GPIO_CTL_OFF(gpio); @@ -521,33 +518,26 @@ int twl4030_set_gpio_edge_ctrl(int gpio, int edge) u8 base = 0; int ret = 0; - if (unlikely((gpio = TWL4030_GPIO_MAX) - || !(gpio_usage_count (0x1 gpio - return -EPERM; - base = REG_GPIO_EDR1 + c_bnk; - if (edge TWL4030_GPIO_EDGE_RISING) + if (edge IRQ_TYPE_EDGE_RISING) c_msk |= MASK_GPIO_EDR1_GPIOxRISING(c_off); - - if (edge TWL4030_GPIO_EDGE_FALLING) + if (edge IRQ_TYPE_EDGE_FALLING) c_msk |= MASK_GPIO_EDR1_GPIOxFALLING(c_off); mutex_lock(gpio_lock); ret = gpio_twl4030_read(base); if (ret = 0) { /* clear the previous rising/falling values */ - reg = - (u8) (ret - ~(MASK_GPIO_EDR1_GPIOxFALLING(c_off) | - MASK_GPIO_EDR1_GPIOxRISING(c_off))); + reg = (u8) ret; + reg = ~( MASK_GPIO_EDR1_GPIOxFALLING(c_off) + | MASK_GPIO_EDR1_GPIOxRISING(c_off)); reg |= c_msk; ret = gpio_twl4030_write(base, reg); } mutex_unlock(gpio_lock); return ret; } -EXPORT_SYMBOL(twl4030_set_gpio_edge_ctrl); /* * Configure debounce timing value for a GPIO pin on TWL4030 @@ -652,7 +642,7 @@ static int twl4030_gpio_unmask_thread(void *data) gpio_trigger; gpio_trigger = 1, irq++) { struct irq_desc *desc; - unsigned type, edge; + unsigned type; if (!(gpio_trigger 0x1)) continue; @@ -662,19 +652,7 @@ static int twl4030_gpio_unmask_thread(void *data) type = desc-status IRQ_TYPE_SENSE_MASK; spin_unlock_irq(desc-lock); - switch (type) { - case IRQ_TYPE_EDGE_RISING: - edge = TWL4030_GPIO_EDGE_RISING; - break; - case IRQ_TYPE_EDGE_FALLING: - edge = TWL4030_GPIO_EDGE_FALLING; - break; - default: - edge = TWL4030_GPIO_EDGE_RISING - | TWL4030_GPIO_EDGE_FALLING; - break; - } - twl4030_set_gpio_edge_ctrl(irq, edge); + twl4030_set_gpio_edge_ctrl(irq, type); } local_irq_disable(); diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 7744669..4f5c0ab 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -918,7 +918,9 @@ static int __init omap_mmc_probe(struct platform_device *pdev) /* Request IRQ for card detect */ if ((mmc_slot(host).card_detect_irq) (mmc_slot(host).card_detect)) { ret = request_irq(mmc_slot(host).card_detect_irq, - omap_mmc_cd_handler, IRQF_DISABLED, + omap_mmc_cd_handler, +
[PATCH 22/23] twl4030: minor cleanups to twl4030_bci_battery.c
Brainless fixes, checkpatch.pl fixes, variable naming, etc. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/power/twl4030_bci_battery.c | 161 --- 1 files changed, 75 insertions(+), 86 deletions(-) diff --git a/drivers/power/twl4030_bci_battery.c b/drivers/power/twl4030_bci_battery.c index 6a55838..9ab6127 100644 --- a/drivers/power/twl4030_bci_battery.c +++ b/drivers/power/twl4030_bci_battery.c @@ -42,8 +42,8 @@ #define REG_PHY_CLK_CTRL_STS 0x0FF #define PHY_DPLL_CLK 0x01 -#define REG_BCICTL10x023 -#define REG_BCICTL20x024 +#define REG_BCICTL10x023 +#define REG_BCICTL20x024 #define CGAIN 0x020 #define ITHEN 0x010 #define ITHSENS0x007 @@ -70,7 +70,7 @@ #define REG_BCIMSTATEC 0x02 #define REG_BCIMFSTS4 0x010 #define REG_BCIMFSTS2 0x00E -#define REG_BCIMFSTS3 0x00F +#define REG_BCIMFSTS3 0x00F #define REG_BCIMFSTS1 0x001 #define USBFASTMCHG0x004 #define BATSTSPCHG 0x004 @@ -99,8 +99,8 @@ #define COR0x004 /* interrupt status registers */ -#define REG_BCIISR1A 0x0 -#define REG_BCIISR2A 0x01 +#define REG_BCIISR1A 0x0 +#define REG_BCIISR2A 0x01 /* Interrupt flags bits BCIISR1 */ #define BATSTS_ISR10x080 @@ -146,14 +146,6 @@ /* Ptr to thermistor table */ int *therm_tbl; -static int twl4030_bci_battery_probe(struct platform_device *dev); -static int twl4030_bci_battery_remove(struct platform_device *dev); -#ifdef CONFIG_PM -static int twl4030_bci_battery_suspend(struct platform_device *dev, - pm_message_t state); -static int twl4030_bci_battery_resume(struct platform_device *dev); -#endif - struct twl4030_bci_device_info { struct device *dev; @@ -171,18 +163,6 @@ struct twl4030_bci_device_info { struct delayed_work twl4030_bk_bci_monitor_work; }; -static struct platform_driver twl4030_bci_battery_driver = { - .probe =twl4030_bci_battery_probe, - .remove = twl4030_bci_battery_remove, -#ifdef CONFIG_PM - .suspend = twl4030_bci_battery_suspend, - .resume = twl4030_bci_battery_resume, -#endif - .driver = { - .name = twl4030-bci-battery, - }, -}; - static int usb_charger_flag; static int LVL_1, LVL_2, LVL_3, LVL_4; @@ -204,14 +184,11 @@ static inline int twl4030charger_presence_evt(void) if (ret) return IRQ_NONE; - /* If the AC charger have been connected */ - if (chg_sts STS_CHG) { + if (chg_sts STS_CHG) { /* If the AC charger have been connected */ /* configuring falling edge detection for CHG_PRES */ set = CHG_PRES_FALLING; clear = CHG_PRES_RISING; - } - /* If the AC charger have been disconnected */ - else { + } else { /* If the AC charger have been disconnected */ /* configuring rising edge detection for CHG_PRES */ set = CHG_PRES_RISING; clear = CHG_PRES_FALLING; @@ -230,9 +207,9 @@ static inline int twl4030charger_presence_evt(void) * USB_PRES (USB charger presence) CHG_PRES (AC charger presence) events * */ -static irqreturn_t twl4030charger_interrupt(int irq, void *dev_id) +static irqreturn_t twl4030charger_interrupt(int irq, void *_di) { - struct twl4030_bci_device_info *di = dev_id; + struct twl4030_bci_device_info *di = _di; twl4030charger_presence_evt(); power_supply_changed(di-bat); @@ -264,17 +241,14 @@ static int twl4030battery_presence_evt(void) * REVISIT: Physically inserting/removing the batt * does not seem to generate an int on 3430ES2 SDP. */ - - /* In case of the battery insertion event */ if ((batstspchg BATSTSPCHG) || (batstsmchg BATSTSMCHG)) { + /* In case of the battery insertion event */ ret = clear_n_set(TWL4030_MODULE_INTERRUPTS, BATSTS_EDRRISIN, BATSTS_EDRFALLING, REG_BCIEDR2); if (ret) return ret; - } - - /* In case of the battery removal event */ - else { + } else { + /* In case of the battery removal event */ ret = clear_n_set(TWL4030_MODULE_INTERRUPTS, BATSTS_EDRFALLING, BATSTS_EDRRISIN, REG_BCIEDR2); if (ret) @@ -298,18 +272,27 @@ static int twl4030battery_level_evt(void) if (ret) return ret; + /* REVISIT could use a bitmap */ if (mfst VBATOV4) { LVL_4 = 1; - LVL_3 = LVL_2 = LVL_1 = 0; + LVL_3 = 0; + LVL_2 = 0; + LVL_1 = 0; } else if (mfst VBATOV3) { +
[PATCH 08/23] twl4030 uses gpiolib
From: David Brownell [EMAIL PROTECTED] Make the twl4030 core create a platform device to which its GPIO code will bind, with platform_data used to configure board-specific behaviors and configuration. Update the twl4030 GPIO code: - Morph its gpio function code into a platform driver. - Move away from IRQ (and GPIO) numbers hard-wired in headers. - Hook up the twl4030 GPIO code to gpiolib. - Start phasing out the older TWL-specific calls ... currently those are used only by arch/arm/mach-omap2/hsmmc.c setup code. - Use a mutex for locking, not a binary semaphore. NOTE: more patches pending: (a) this doesn't use pdata-pullups to initialize (currently hsmmc code always sets GPIO-0 pullup even if the board has an external pullup); (b) there's a new gpio request/free hook forthcoming in 2.6.28, which this should use; (c) likewise there's a new gpio_to_irq() hook; (d) the irq_chip set_type() mechanism needs to be supported; (e) needs to move over to drivers/gpio; (f) upcoming threaded IRQ infrastructure should be used, when that merges. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/Kconfig|2 +- drivers/i2c/chips/twl4030-core.c | 44 ++ drivers/i2c/chips/twl4030-gpio.c | 273 +++--- 3 files changed, 238 insertions(+), 81 deletions(-) diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig index 121aec9..1a21388 100644 --- a/drivers/i2c/chips/Kconfig +++ b/drivers/i2c/chips/Kconfig @@ -159,7 +159,7 @@ config TWL4030_CORE config TWL4030_GPIO bool TWL4030 GPIO Driver - depends on TWL4030_CORE + depends on TWL4030_CORE GPIOLIB config TWL4030_MADC tristate TWL4030 MADC Driver diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index 02be771..c9460f7 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -63,6 +63,12 @@ #define twl_has_usb() false #endif +#ifdef CONFIG_TWL4030_GPIO +#define twl_has_gpio() true +#else +#define twl_has_gpio() false +#endif + /* Primary Interrupt Handler on TWL4030 Registers */ /* Register Definitions */ @@ -656,6 +662,44 @@ static int add_children(struct twl4030_platform_data *pdata) struct twl4030_client *twl = NULL; int status = 0; + if (twl_has_gpio() pdata-gpio) { + twl = twl4030_modules[TWL4030_SLAVENUM_NUM1]; + + pdev = platform_device_alloc(twl4030_gpio, -1); + if (!pdev) + status = -ENOMEM; + + /* more driver model init */ + if (status == 0) { + pdev-dev.parent = twl-client-dev; + /* device_init_wakeup(pdev-dev, 1); */ + + status = platform_device_add_data(pdev, pdata-gpio, + sizeof(*pdata-gpio)); + } + + /* GPIO module IRQ */ + if (status == 0) { + struct resource r = { + .start = pdata-irq_base + 0, + .flags = IORESOURCE_IRQ, + }; + + status = platform_device_add_resources(pdev, r, 1); + } + + if (status == 0) + status = platform_device_add(pdev); + + if (status 0) { + platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't create gpio dev, %d\n, + status); + goto err; + } + } + if (twl_has_rtc()) { pdev = platform_device_alloc(twl4030_rtc, -1); if (pdev) { diff --git a/drivers/i2c/chips/twl4030-gpio.c b/drivers/i2c/chips/twl4030-gpio.c index b51bed0..0d4dd28 100644 --- a/drivers/i2c/chips/twl4030-gpio.c +++ b/drivers/i2c/chips/twl4030-gpio.c @@ -31,22 +31,31 @@ #include linux/init.h #include linux/time.h #include linux/interrupt.h -#include linux/random.h -#include linux/syscalls.h +#include linux/device.h #include linux/kthread.h #include linux/irq.h +#include linux/gpio.h +#include linux/platform_device.h +#include linux/slab.h -#include linux/i2c.h #include linux/i2c/twl4030.h #include linux/i2c/twl4030-gpio.h -#include linux/slab.h #include mach/irqs.h #include asm/mach/irq.h #include mach/gpio.h #include mach/mux.h -#include linux/device.h + +/* REVISIT when these symbols vanish elsewhere, remove them here too */ +#undef TWL4030_GPIO_IRQ_BASE +#undef TWL4030_GPIO_IRQ_END +#undef TWL4030_MODIRQ_GPIO + +static struct gpio_chip twl_gpiochip; +static int twl4030_gpio_irq_base; +static int twl4030_gpio_irq_end; + /* BitField Definitions */ @@ -130,7 +139,7 @@ #define GPIO_32_MASK 0x0003 /* Data
[PATCH 09/23] i2c: move twl4030-madc to new registration style
Moving twl4030-madc to new style registration just like the other twl4030 children. Cc: Mikko Ylinen [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/mach-omap2/board-2430sdp.c |5 + arch/arm/mach-omap2/board-3430sdp.c |5 + arch/arm/mach-omap2/board-ldp.c |5 + arch/arm/mach-omap2/board-omap2evm.c |5 + arch/arm/mach-omap2/board-omap3evm.c |5 + drivers/i2c/chips/twl4030-core.c | 27 drivers/i2c/chips/twl4030-madc.c | 243 +- include/linux/i2c/twl4030.h |5 + 8 files changed, 209 insertions(+), 91 deletions(-) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 7842110..cea2540 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -355,12 +355,17 @@ static struct twl4030_usb_data sdp2430_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; +static struct twl4030_madc_platform_data sdp2430_madc_data = { + .irq_line = 1, +}; + static struct twl4030_platform_data sdp2430_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .gpio = sdp2430_gpio_data, + .madc = sdp2430_madc_data, .keypad = sdp2430_kp_data, .usb= sdp2430_usb_data, }; diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 66f0f98..661d5d0 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -310,12 +310,17 @@ static struct twl4030_usb_data sdp3430_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; +static struct twl4030_madc_platform_data sdp3430_madc_data = { + .irq_line = 1, +}; + static struct twl4030_platform_data sdp3430_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .gpio = sdp3430_gpio_data, + .madc = sdp3430_madc_data, .keypad = sdp3430_kp_data, .usb= sdp3430_usb_data, }; diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index 48342f4..a0e2c7a 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c @@ -193,11 +193,16 @@ static struct twl4030_gpio_platform_data ldp_gpio_data = { .irq_end= TWL4030_GPIO_IRQ_END, }; +static struct twl4030_madc_platform_data ldp_madc_data = { + .irq_line = 1, +}; + static struct twl4030_platform_data ldp_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ + .madc = ldp_madc_data, .usb= ldp_usb_data, .gpio = ldp_gpio_data, }; diff --git a/arch/arm/mach-omap2/board-omap2evm.c b/arch/arm/mach-omap2/board-omap2evm.c index a921cf1..9f19c34 100644 --- a/arch/arm/mach-omap2/board-omap2evm.c +++ b/arch/arm/mach-omap2/board-omap2evm.c @@ -236,12 +236,17 @@ static struct twl4030_usb_data omap2evm_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; +static struct twl4030_madc_platform_data omap2evm_madc_data = { + .irq_line = 1, +}; + static struct twl4030_platform_data omap2evm_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .keypad = omap2evm_kp_data, + .madc = omap2evm_madc_data, .usb= omap2evm_usb_data, .gpio = omap2evm_gpio_data, }; diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 2c1d76f..a9ff8d1 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c @@ -128,12 +128,17 @@ static struct twl4030_keypad_data omap3evm_kp_data = { .irq= TWL4030_MODIRQ_KEYPAD, }; +static struct twl4030_madc_platform_data omap3evm_madc_data = { + .irq_line = 1, +}; + static struct twl4030_platform_data omap3evm_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .keypad = omap3evm_kp_data, + .madc = omap3evm_madc_data, .usb= omap3evm_usb_data, .gpio = omap3evm_gpio_data, }; diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index c9460f7..79d4d82 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -69,6 +69,12 @@ #define twl_has_gpio() false #endif +#if defined(CONFIG_TWL4030_MADC) || defined(CONFIG_TWL4030_MADC_MODULE) +#define twl_has_madc() true +#else +#define twl_has_madc() false
[PATCH 23/23] twl4030-bci: move to new style registration method
twl4030_bci_battery.c is now moved to new style registration of twl4030 children. During the process a few bugfixes came but the main one is that twl4030-bci was releasing the wrong irq if battery registration had failed. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/mach-omap2/Makefile |4 +-- arch/arm/mach-omap2/bci.c | 57 - arch/arm/mach-omap2/board-3430sdp.c | 18 ++- arch/arm/mach-omap2/board-ldp.c | 18 ++- arch/arm/plat-omap/include/mach/bci.h | 17 -- drivers/i2c/chips/twl4030-core.c | 50 + drivers/power/twl4030_bci_battery.c | 25 +-- include/linux/i2c/twl4030.h |5 +++ 8 files changed, 105 insertions(+), 89 deletions(-) delete mode 100644 arch/arm/mach-omap2/bci.c delete mode 100644 arch/arm/plat-omap/include/mach/bci.h diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index e18da0c..33de217 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -54,8 +54,7 @@ obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o \ hsmmc.o \ usb-musb.o \ usb-ehci.o \ - board-3430sdp-flash.o \ - bci.o + board-3430sdp-flash.o obj-$(CONFIG_MACH_OMAP3EVM)+= board-omap3evm.o \ hsmmc.o \ usb-musb.o usb-ehci.o \ @@ -65,7 +64,6 @@ obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o \ hsmmc.o obj-$(CONFIG_MACH_OMAP_LDP)+= board-ldp.o \ hsmmc.o \ - bci.o \ usb-musb.o obj-$(CONFIG_MACH_OMAP_APOLLON)+= board-apollon.o \ board-apollon-mmc.o \ diff --git a/arch/arm/mach-omap2/bci.c b/arch/arm/mach-omap2/bci.c deleted file mode 100644 index 9b9f9d2..000 --- a/arch/arm/mach-omap2/bci.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * linux/arch/arm/mach-omap2/bci.c - * - * TWL4030 BCI platform device setup/initialization - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#include linux/module.h -#include linux/kernel.h -#include linux/init.h -#include linux/platform_device.h -#include mach/bci.h - -#if defined(CONFIG_TWL4030_BCI_BATTERY) || \ - defined(CONFIG_TWL4030_BCI_BATTERY_MODULE) -/* - * Thermistor Calibration for Current Source and MADC - * Tolerance (for THS05-3H103F) - */ -static int sdp3430_batt_table[] = { -/* 0 C*/ -30800, 29500, 28300, 27100, -26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900, -17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100, -11600, 11200, 10800, 10400, 1, 9630, 9280, 8950, 8620, 8310, -8020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830, -5640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170, -4040, 3910, 3790, 3670, 3550 -}; - -static struct twl4030_bci_platform_data sdp3430_bci_data = { - .battery_tmp_tbl = sdp3430_batt_table, - .tblsize = ARRAY_SIZE(sdp3430_batt_table), -}; - -static struct platform_device twl4030_bci_battery_device = { - .name = twl4030-bci-battery, - .id = -1, - .dev= { - .platform_data = sdp3430_bci_data, - }, - .num_resources = 0, -}; - -void __init twl4030_bci_battery_init(void) -{ - (void) platform_device_register(twl4030_bci_battery_device); -} -#else -void __init twl4030_bci_battery_init(void) -{ -} -#endif diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 661d5d0..4264b68 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -300,6 +300,22 @@ static struct omap_board_config_kernel sdp3430_config[] __initdata = { { OMAP_TAG_LCD, sdp3430_lcd_config }, }; +static int sdp3430_batt_table[] = { +/* 0 C*/ +30800, 29500, 28300, 27100, +26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900, +17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100, +11600, 11200, 10800, 10400, 1, 9630, 9280, 8950, 8620, 8310, +8020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830, +5640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170, +4040, 3910,
RE: [PATCH 15/16] OMAP3: Dynamic enable/disable of OFF support
-Original Message- From: Högander Jouni [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 3:19 PM To: ext Kevin Hilman Cc: Rajendra Nayak; linux-omap@vger.kernel.org Subject: Re: [PATCH 15/16] OMAP3: Dynamic enable/disable of OFF support ext Kevin Hilman [EMAIL PROTECTED] writes: Rajendra Nayak [EMAIL PROTECTED] writes: I just managed to see that this patch seems to break suspend functionality. If after bootup I enable OFF mode the subsequent suspend tries to put a few power domains to OFF which are currently in RET, and since there is no code in place today to handle RET to OFF transitions, they don't transition to OFF and remain in RET. See commit a974addcfa23181667fe32e5032820917bf4a2b2 from Tero Kristo. This patch was meant to address these kinds of transitions, but it seems it's not working exactly right. I'm debugging now. Supporting run time enable/disable of OFF functionality is kind of becoming complicated. Do we really see a need to have a run-time option to enable/disable OFF mode or can we have a compile time option for this? Run-time option is required. Whole cpuidle + srf concept is about changing between OFF/RET/ON dynamically. So if implementing it through one sysfs entry is discarded because it's complicated, how do you think you could implement it in cpuidle and srf? What I meant was that hacking around the *existing* code (which neither has cpuidle nor SRF) just to support runtime enable/disable of OFF mode is getting complicated. Kevin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rajendra Nayak Sent: Friday, September 26, 2008 5:50 PM To: linux-omap@vger.kernel.org Cc: 'Kevin Hilman' Subject: [PATCH 15/16] OMAP3: Dynamic enable/disable of OFF support This patch adds a runtime sysfs knob (/sys/power/enable_off_mode) to enable/disbale CORE OFF support for OMAP3. Signed-off-by: Rajendra Nayak [EMAIL PROTECTED] --- arch/arm/mach-omap2/pm.c | 21 + arch/arm/mach-omap2/pm.h |2 ++ arch/arm/mach-omap2/pm34xx.c | 26 ++ 3 files changed, 45 insertions(+), 4 deletions(-) Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c === --- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c 2008-09-26 16:39:30.0 +0530 +++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c 2008-09-26 16:39:34.0 +0530 @@ -395,6 +395,32 @@ static int omap3_can_sleep(void) return 1; } +int set_next_pwrst(struct powerdomain *pwrdm) +{ + struct power_state *pwrst; + int ret = 0; + u32 state; + + if (!pwrdm-pwrsts) + return 0; + + if (enable_off_mode) + state = PWRDM_POWER_OFF; + else + state = PWRDM_POWER_RET; + + ret = pwrdm_set_next_pwrst(pwrdm, state); + if (ret) { + printk(KERN_ERR Unable to set state of powerdomain: %s\n, +pwrdm-name); + goto err; + } + list_for_each_entry(pwrst, pwrst_list, node) + pwrst-next_state = state; +err: + return ret; +} + /* This sets pwrdm state (other than mpu core. Currently only ON * RET are supported. Function is assuming that clkdm doesn't have * hw_sup mode enabled. */ Index: linux-omap-2.6/arch/arm/mach-omap2/pm.c === --- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.c 2008-09-26 16:39:30.0 +0530 +++ linux-omap-2.6/arch/arm/mach-omap2/pm.c 2008-09-26 16:39:34.0 +0530 @@ -35,6 +35,7 @@ unsigned short enable_dyn_sleep; unsigned short clocks_off_while_idle; +unsigned short enable_off_mode; atomic_t sleep_block = ATOMIC_INIT(0); static ssize_t idle_show(struct kobject *, struct kobj_attribute *, char *); @@ -47,6 +48,9 @@ static struct kobj_attribute sleep_while static struct kobj_attribute clocks_off_while_idle_attr = __ATTR(clocks_off_while_idle, 0644, idle_show, idle_store); +static struct kobj_attribute enable_off_mode_attr = + __ATTR(enable_off_mode, 0644, idle_show, idle_store); + static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -54,6 +58,8 @@ static ssize_t idle_show(struct kobject return sprintf(buf, %hu\n, enable_dyn_sleep); else if (attr == clocks_off_while_idle_attr) return sprintf(buf, %hu\n, clocks_off_while_idle); + else if (attr == enable_off_mode_attr) + return sprintf(buf, %hu\n, enable_off_mode); else return -EINVAL; } @@ -69,13 +75,16 @@ static ssize_t idle_store(struct kobject return -EINVAL; } - if (attr == sleep_while_idle_attr) + if (attr == sleep_while_idle_attr) { enable_dyn_sleep
Re: [alsa-devel] [PATCH 1/5 v1] ASoC Add TLV320AIC23 codec driver
On Tue, Sep 30, 2008 at 03:29:32PM +0530, Arun KS wrote: Thanks! It looks like you've addressed pretty much all the comments from the first round of reviews but a few additional (fairly minor comments): +static const char *tlv320aic23_rec_src[] = { Line, Mic }; +static const char *tlv320aic23_sidetone_src[] = +{ -6db, -9db, -12db, -18db, 0db }; + +static const struct soc_enum tlv320aic23_enum[] = { + SOC_ENUM_SINGLE(TLV320AIC23_ANALOG_AUDIO_CONTROL, 2, 2, + tlv320aic23_rec_src), + SOC_ENUM_SINGLE(TLV320AIC23_ANALOG_AUDIO_CONTROL, 6, 5, + tlv320aic23_sidetone_src), +}; + sidetone_src really ought to be a SOC_SINGLE_TLV rather than an enum from the looks of it - it's not selecting between sources for the sidetone, it's determining the level of the signal so a gain control with TLV information would present better in UIs. +static const struct snd_kcontrol_new tlv320aic23_rec_src_mux_controls = +SOC_DAPM_ENUM(Route, tlv320aic23_enum[0]); +static const struct snd_kcontrol_new tlv320aic23_sidetone_src_controls = +SOC_DAPM_ENUM(Route, tlv320aic23_enum[1]); I know some of the older codec drivers do it but there's no need to have the enums be an array and it doesn't help clarity. Equally well, it's not a blocker for merge. +static const struct snd_kcontrol_new tlv320aic23_snd_controls[] = { + SOC_DOUBLE_R(PCM Playback Volume, TLV320AIC23_LEFT_CHANNEL_VOLUME, + TLV320AIC23_RIGHT_CHANNEL_VOLUME, 0, 0x7f, 0), TLV information might be nice here too (but it's not required). I suspect Digital Playback Volume would be a better name, but I'm not 100% sure on that one. + SOC_DOUBLE_R(Line Input Mute, TLV320AIC23_LEFT_LINE_VOLUME, + TLV320AIC23_RIGHT_LINE_VOLUME, 7, 0x01, 0), This should be Line Input Switch for user interfaces to pick it up properly. +static const struct snd_soc_dapm_route intercon[] = { + + {LHPOUT, NULL, DAC}, + {RHPOUT, NULL, DAC}, + + {LOUT, NULL, DAC}, + {ROUT, NULL, DAC}, + + {Capture Source, Line, LLINEIN}, + {Capture Source, Line, RLINEIN}, + + {Capture Source, Mic, MICIN}, + + {PGA Mixer, Line Switch, Capture Source}, + {PGA Mixer, Mic Switch, Capture Source}, + + {ADC, NULL, PGA Mixer}, +}; There are no routes here for your bypass path(s) - this will mean that DAPM won't power them on unless there's an active playback and record. At present that's fine for digital only bypass paths but if there are analogue ones they should be visible here. +static int tlv320aic23_mute(struct snd_soc_dai *dai, int mute) +{ + struct snd_soc_codec *codec = dai-codec; + u16 reg; + + reg = + tlv320aic23_read_reg_cache(codec, +TLV320AIC23_DIGITAL_AUDIO_CONTROL) + ~DACM_MUTE; Have you resolved the word wrapping issues with your mailer? I've not tried applying the patch but things like this make me think that it has been mangled. +static int tlv320aic23_set_dai_sysclk(struct snd_soc_dai *codec_dai, + int clk_id, unsigned int freq, int dir) +{ + struct snd_soc_codec *codec = codec_dai-codec; + struct tlv320aic23_priv *tlv320aic23 = codec-private_data; + + tlv320aic23-sysclk = freq; + return 0; +} You don't actually use sysclk for anything so you may as well drop this function and the local variable. + tlv320aic23-master = 1; + iface_reg |= MS_MASTER; + break; + case SND_SOC_DAIFMT_CBS_CFS: + tlv320aic23-master = 0; + break; You don't seem to use master anywhere either so it could also be dropped? + +/* Left (right) line input volume control register */ +#define LRS_ENABLED 0x0100 +#define LIM_MUTED0x0080 +#define LIV_DEFAULT 0x0017 +#define LIV_MAX 0x001f +#define LIV_MIN 0x All the definitions in the header should be namespaced - there's things like: +/* Power control down register */ +#define DEVICE_POWER_OFF 0x0080 +#define CLK_OFF 0x0040 +#define OSC_OFF 0x0020 +#define OUT_OFF 0x0010 +#define DAC_OFF 0x0008 +#define ADC_OFF 0x0004 +#define MIC_OFF 0x0002 +#define LINE_OFF 0x0001 which are very likely to collide with other chips. -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [alsa-devel] [PATCH 4/5 v1] ASoC adds destination and source port for dma
On Tue, Sep 30, 2008 at 03:35:16PM +0530, Arun KS wrote: @@ -147,12 +147,14 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream) Yup, these are definitely being word wrapped by your mailer so they won't apply without massaging. If you can't configure your normal MUA to send them through cleanly you might want to look into git send-email or the quilt equivalent both of which are specifically designed to handle patches. You can test this by mailing the patches to yourself and then trying to apply them. Anyway, the patch looks OK: Acked-by: Mark Brown [EMAIL PROTECTED] -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] gpmc: Remove compilation warning
From: Jagadeesh Bhaskar Pakaravoor [EMAIL PROTECTED] Return type of gpmc_init() function is void. Also, the error values returned by the function is not used by the caller. Hence it should not be returning any value. Signed-off-by: Anand Gadiyar [EMAIL PROTECTED] Signed-off-by: Jagadeesh Bhaskar Pakaravoor [EMAIL PROTECTED] --- Index: linux-omap-git/arch/arm/mach-omap2/gpmc.c === --- linux-omap-git.orig/arch/arm/mach-omap2/gpmc.c 2008-09-25 17:30:24.0 +0530 +++ linux-omap-git/arch/arm/mach-omap2/gpmc.c 2008-09-30 16:24:52.448034656 +0530 @@ -427,19 +427,10 @@ void __init gpmc_init(void) } gpmc_l3_clk = clk_get(NULL, ck); - if (IS_ERR(gpmc_l3_clk)) { - printk(KERN_ERR Could not get GPMC clock %s\n, ck); - return -ENODEV; - } - - gpmc_base = ioremap(l, SZ_4K); - if (!gpmc_base) { - clk_put(gpmc_l3_clk); - printk(KERN_ERR Could not get GPMC register memory\n); - return -ENOMEM; - } - BUG_ON(IS_ERR(gpmc_l3_clk)); + + gpmc_base = ioremap(l, SZ_4K); + BUG_ON(!gpmc_base); l = gpmc_read_reg(GPMC_REVISION); printk(KERN_INFO GPMC revision %d.%d\n, (l 4) 0x0f, l 0x0f); -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [i2c] [PATCH 1/8] i2c-omap: Do not use interruptible wait call in omap_i2c_xfer_msg
On Mon, 29 Sep 2008 23:21:00 +0100 ext Ben Dooks [EMAIL PROTECTED] wrote: On Thu, Sep 25, 2008 at 10:53:47AM +0300, Tony Lindgren wrote: From: Jarkko Nikula [EMAIL PROTECTED] If there is a signal pending and wait_for_completion_interruptible_timeout terminates with -ERESTARTSYS, we return and disable the i2c clocks in omap_i2c_xfer. If we terminate before sending last i2c message with a stop condition, the bus remains busy and we are not able to send new messages into bus with successive omap_i2c_xfer calls. Therefore a pending signal is not caught here and we return only because of timeout or i2c error. I assume that this is preferable to aborting an transfer when the signal is caught (if possible) ? Most probably yes as long as the stop condition is generated successfully. IRCC bug behind this fix, OMAP I2C went into bus arbitration without code able to recover easily or something like that. Would it be ok to let this fix as now, probably adding FIXME line near wait_for_completion_timeout so that we don't break anything now but note that this is not optimal fix? Jarkko -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: MMC broken on beagleboard with current git
* Tony Lindgren [EMAIL PROTECTED] [080928 15:44]: * Tony Lindgren [EMAIL PROTECTED] [080926 14:11]: * Tony Lindgren [EMAIL PROTECTED] [080926 10:40]: * Steve Sakoman [EMAIL PROTECTED] [080925 18:24]: On Thu, Sep 25, 2008 at 3:39 AM, Tony Lindgren [EMAIL PROTECTED] wrote: Hmm, I don't understand how it could work on 3430sdp... Looks like board-omap3beagle.c calls hsmmc_init() just like board-3430sdp.c. Maybe timings have changed and you need a longer delay somewhere during the init? I can confirm that mmc is also broken on Overo. I'll spend some time today investigating. I'll double check on omap3430sdp. Hmm, MMC does not seem to work any longer on 3430sdp either. I guess I have broken it, sorry. I've also confirmed that undoing c434c15d28c82d92e55897bd265c423e9ab69362 makes it work again. I swear it was working when I last tested it.. I'll try to debug it further, but I may not get to it for real until on Monday. I still suspect some timing change caused by the init changes.. I've reverted c434c15d28c82d92e55897bd265c423e9ab69362 as I may not be able to debug it until Wednesday. OK, found the problem, here's a diff on top of the currently reverted patch. I've pushed the MMC changes with this fix merged in, can you guys try it out now? Regards, Tony From c5e72c31fe23a139aabab1ab6c63c2c3a3aad46f Mon Sep 17 00:00:00 2001 From: Tony Lindgren [EMAIL PROTECTED] Date: Tue, 30 Sep 2008 12:03:42 +0300 Subject: [PATCH] Fix new MMC init code for hsmmc, and for 2430 The reason the new MMC init code did not work on 34xx was the _DEVID defines in omap_hsmmc.c. Fix these for now and add a comment about doing that with platform_data and controller and slot specific functions. Fix device id's for omap1, and add a late init function for the tps interrupt. Looks like omap1 MMC still does not work though. Change omap2430 mmchs clock id's to start from 0, as the first MMC instance is now 0. Also add a comment to clarify the difference between a slot and a controller. Signed-off-by: Tony Lindgren [EMAIL PROTECTED] diff --git a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c index 4fbe367..4cc2d4f 100644 --- a/arch/arm/mach-omap1/board-h2-mmc.c +++ b/arch/arm/mach-omap1/board-h2-mmc.c @@ -33,6 +33,24 @@ static int mmc_set_power(struct device *dev, int slot, int power_on, return 0; } +static int mmc_late_init(struct device *dev) +{ + int ret; + + ret = gpio_request(H2_TPS_GPIO_MMC_PWR_EN, MMC power); + if (ret 0) + return ret; + + gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0); + + return ret; +} + +static void mmc_shutdown(struct device *dev) +{ + gpio_free(H2_TPS_GPIO_MMC_PWR_EN); +} + /* * H2 could use the following functions tested: * - mmc_get_cover_state that uses OMAP_MPUIO(1) @@ -40,6 +58,8 @@ static int mmc_set_power(struct device *dev, int slot, int power_on, */ static struct omap_mmc_platform_data mmc1_data = { .nr_slots = 1, + .init= mmc_late_init, + .shutdown = mmc_shutdown, .dma_mask = 0x, .slots[0] = { .set_power = mmc_set_power, @@ -53,13 +73,6 @@ static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC]; void __init h2_mmc_init(void) { - int ret; - - ret = gpio_request(H2_TPS_GPIO_MMC_PWR_EN, MMC power); - if (ret 0) - return; - gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0); - mmc_data[0] = mmc1_data; omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC); } diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h index 2900a4a..8bf70cf 100644 --- a/arch/arm/mach-omap2/clock24xx.h +++ b/arch/arm/mach-omap2/clock24xx.h @@ -2727,7 +2727,6 @@ static struct clk usbhs_ick = { static struct clk mmchs1_ick = { .name = mmchs_ick, - .id = 1, .parent = l4_ck, .prcm_mod = CORE_MOD, .flags = CLOCK_IN_OMAP243X | WAIT_READY, @@ -2740,7 +2739,6 @@ static struct clk mmchs1_ick = { static struct clk mmchs1_fck = { .name = mmchs_fck, - .id = 1, .parent = func_96m_ck, .prcm_mod = CORE_MOD, .flags = CLOCK_IN_OMAP243X, @@ -2752,7 +2750,7 @@ static struct clk mmchs1_fck = { static struct clk mmchs2_ick = { .name = mmchs_ick, - .id = 2, + .id = 1, .parent = l4_ck, .prcm_mod = CORE_MOD, .flags = CLOCK_IN_OMAP243X | WAIT_READY, @@ -2765,7 +2763,7 @@ static struct clk mmchs2_ick = { static struct clk mmchs2_fck = { .name = mmchs_fck, - .id = 2, + .id = 1, .parent = func_96m_ck, .prcm_mod = CORE_MOD, .flags = CLOCK_IN_OMAP243X, diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 086e6de..c6544d2 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c @@ -1015,7 +1015,7 @@ static int mmc_omap_get_dma_channel(struct mmc_omap_host *host, struct mmc_data } if (is_read) { - if (host-id == 1) { + if (host-id == 0) { sync_dev = OMAP_DMA_MMC_RX; dma_dev_name = MMC1 read; } else { @@ -1023,7 +1023,7 @@
Re: [alsa-devel] [PATCH 4/5 v1] ASoC adds destination and source port for dma
On Tue, 30 Sep 2008 11:23:38 +0100 ext Mark Brown [EMAIL PROTECTED] wrote: On Tue, Sep 30, 2008 at 03:35:16PM +0530, Arun KS wrote: @@ -147,12 +147,14 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream) Yup, these are definitely being word wrapped by your mailer so they won't apply without massaging. If you can't configure your normal MUA to send them through cleanly you might want to look into git send-email or the quilt equivalent both of which are specifically designed to handle patches. You can test this by mailing the patches to yourself and then trying to apply them. Anyway, the patch looks OK: Acked-by: Mark Brown [EMAIL PROTECTED] Probably commit can mention the fix done but ok from my side. Acked-by: Jarkko Nikula [EMAIL PROTECTED] -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/23] twl4030 patches (v4)
* Felipe Balbi [EMAIL PROTECTED] [080930 13:34]: In this version there are irq fixes from David Brownell. David Brownell (11): twl4030 gpio platform data twl4030 uses gpiolib minor twl4030-core cleanups provide detailed diagnostics in add_children() move twl4030-gpio to drivers/gpio minor irq-related cleanups Move I2C driver model init earlier in the boot sequence twl4030-gpio irq_chip.set_type twl4030-gpio: remove legacy irq triggering calls and user twl4030-gpio: irq and other cleanup twl4030-core: portability updates Felipe Balbi (11): twl4030: fix potential null pointer dereference i2c: clean add_children a bit i2c: move twl4030_keypad to new style registration i2c: move twl4030-usb to platform_device i2c: twl4030-usb: add 'vbus' sysfs file i2c: move twl4030-madc to new registration style i2c: added a few missing gotos to add_children() i2c: switch twl4030-usb to use a resource for irq i2c: minor cleanups to twl4030-pwrbutton.c twl4030: minor cleanups to twl4030_bci_battery.c twl4030-bci: move to new style registration method Jagadeesh Bhaskar Pakaravoor (1): twl4030-gpio: Remove default pullup enable/disable of GPIO Let's plan on applying these tomorrow unless there are more comments. Tony arch/arm/mach-omap2/Makefile|4 +- arch/arm/mach-omap2/bci.c | 57 arch/arm/mach-omap2/board-2430sdp.c | 32 ++- arch/arm/mach-omap2/board-3430sdp.c | 49 +++- arch/arm/mach-omap2/board-ldp.c | 37 +++- arch/arm/mach-omap2/board-omap2evm.c| 33 ++- arch/arm/mach-omap2/board-omap3beagle.c | 19 ++ arch/arm/mach-omap2/board-omap3evm.c| 85 +++--- arch/arm/mach-omap2/board-overo.c | 11 + arch/arm/mach-omap2/hsmmc.c |5 - arch/arm/plat-omap/include/mach/bci.h | 17 - arch/arm/plat-omap/include/mach/irqs.h |2 +- drivers/gpio/Kconfig|7 + drivers/gpio/Makefile |1 + drivers/{i2c/chips = gpio}/twl4030-gpio.c | 418 +++ drivers/i2c/chips/Kconfig | 20 -- drivers/i2c/chips/Makefile |1 - drivers/i2c/chips/twl4030-core.c| 344 +++--- drivers/i2c/chips/twl4030-madc.c| 243 ++-- drivers/i2c/chips/twl4030-pwrbutton.c | 10 +- drivers/i2c/chips/twl4030-usb.c | 373 drivers/i2c/i2c-core.c |2 +- drivers/input/keyboard/omap-twl4030keypad.c | 10 +- drivers/mmc/host/omap_hsmmc.c |4 +- drivers/power/twl4030_bci_battery.c | 184 ++-- drivers/rtc/rtc-twl4030.c | 11 +- include/linux/i2c/twl4030.h | 64 - 27 files changed, 1306 insertions(+), 737 deletions(-) delete mode 100644 arch/arm/mach-omap2/bci.c delete mode 100644 arch/arm/plat-omap/include/mach/bci.h rename drivers/{i2c/chips = gpio}/twl4030-gpio.c (67%) -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/5] [RFC] ALSA ASOC Adds DSP DAI format support for platform driver
On Tue, 30 Sep 2008 12:11:45 +0530 ext Arun KS [EMAIL PROTECTED] wrote: I think this is not enough. The word clock length equals to one BCLK cycle in DSP mode. Not n channel bit BCLK cycles like in I2S. In DSP Mode, Frame sync is followed by two data words. I tested this patch and its working. Am i missing something ? I meant length of FS/LRC[IN | OUT] signal itself. E.g. see figures 3-7 and 3-8 in AIC23 data manual: http://www.ti.com/lit/gpn/tlv320aic23 Now omap-mcbsp.c sets this FS length to 16 BCLK periods in omap_mcbsp_dai_hw_params. Currently code is pretty much tailored for 16-bit stereo I2S so probably some McBSP configuration bits are better set in another function than currently :-) Jarkko -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: MMC broken on beagleboard with current git
On Tue, Sep 30, 2008 at 03:58:39PM +0300, Tony Lindgren wrote: + * One controller can have multiple slots, like on some omap boards using + * omap.c controller driver. Luckily this is not currently done on any known + * omap_hsmmc.c device. this is only true for omap1 afaict. -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: MMC broken on beagleboard with current git
On Tue, Sep 30, 2008 at 3:58 PM, Tony Lindgren [EMAIL PROTECTED] wrote: * Tony Lindgren [EMAIL PROTECTED] [080928 15:44]: * Tony Lindgren [EMAIL PROTECTED] [080926 14:11]: * Tony Lindgren [EMAIL PROTECTED] [080926 10:40]: * Steve Sakoman [EMAIL PROTECTED] [080925 18:24]: On Thu, Sep 25, 2008 at 3:39 AM, Tony Lindgren [EMAIL PROTECTED] wrote: Hmm, I don't understand how it could work on 3430sdp... Looks like board-omap3beagle.c calls hsmmc_init() just like board-3430sdp.c. Maybe timings have changed and you need a longer delay somewhere during the init? I can confirm that mmc is also broken on Overo. I'll spend some time today investigating. I'll double check on omap3430sdp. Hmm, MMC does not seem to work any longer on 3430sdp either. I guess I have broken it, sorry. I've also confirmed that undoing c434c15d28c82d92e55897bd265c423e9ab69362 makes it work again. I swear it was working when I last tested it.. I'll try to debug it further, but I may not get to it for real until on Monday. I still suspect some timing change caused by the init changes.. I've reverted c434c15d28c82d92e55897bd265c423e9ab69362 as I may not be able to debug it until Wednesday. OK, found the problem, here's a diff on top of the currently reverted patch. I've pushed the MMC changes with this fix merged in, can you guys try it out now? Seems to work fine for me on the beagleboard. -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: MMC broken on beagleboard with current git
* Felipe Balbi [EMAIL PROTECTED] [080930 16:22]: On Tue, Sep 30, 2008 at 03:58:39PM +0300, Tony Lindgren wrote: + * One controller can have multiple slots, like on some omap boards using + * omap.c controller driver. Luckily this is not currently done on any known + * omap_hsmmc.c device. this is only true for omap1 afaict. Do you mean omap.c but not on omap_hsmmc.c? If for sure we'll never have multiple slots on omap_hsmmc.c, we could simplify the code and assume the slot is always 0. Tony -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: MMC broken on beagleboard with current git
On Tue, Sep 30, 2008 at 04:35:51PM +0300, Tony Lindgren wrote: * Felipe Balbi [EMAIL PROTECTED] [080930 16:22]: On Tue, Sep 30, 2008 at 03:58:39PM +0300, Tony Lindgren wrote: + * One controller can have multiple slots, like on some omap boards using + * omap.c controller driver. Luckily this is not currently done on any known + * omap_hsmmc.c device. this is only true for omap1 afaict. Do you mean omap.c but not on omap_hsmmc.c? If for sure we'll never have multiple slots on omap_hsmmc.c, we could simplify the code and assume the slot is always 0. Yeah, looks like multislot is only useful for 2420 (h4 and n8x0). -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/16] OMAP3: Context save/Restore + OFF mode support
Rajendra Nayak [EMAIL PROTECTED] writes: This patch set adds context save/restore routines for minimal kernel and OFF mode support in idle and suspend. This patch set applies on top of pm-1 branch. This has context save/restore support implemented for the following modules GPMC, UART, GPIO, I2C, PRCM, INTC, SCM, SRAM. A sysfs knob to dynamically control OFF mode is provided at /sys/power/enable_off_mode. This is set to 0 (disabled) by default. Hi Rajendra, This series is in much better shape, and allows me to hit retention or OFF in idle and suspend. Thanks! I will pull this series into pm-1 tomorrow. There are few minor things that I will cleanup upon merging. - common: - in several new functions, no space between local variable definition and start of code - copyright 2007 additions. Shouldn't these be 2008? - 6/16: INTC - remove the comment MIRs being saved with PRCM since this is no longer true - 11/16: PER/NEON - checkpatch warnings - 15/16: /sys/power/enable_off_mode - your method doesn't quite work, I have an alternative - 14/16: CORE off - checkpatch errors and warnings Thanks, Kevin -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 16/23] Move I2C driver model init earlier in the boot sequence
On Tuesday 30 September 2008, Felipe Balbi wrote: From: David Brownell [EMAIL PROTECTED] This avoids oopsing in statically linked systems when some subsystems register I2C drivers in subsys_initcall() code, but those subsystems are linked (and initialized) before I2C. Signed-off-by: David Brownell [EMAIL PROTECTED] And as of this morning: Signed-off-by: Jean Delvare [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/i2c-core.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index b346a68..f520108 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -978,7 +978,7 @@ static void __exit i2c_exit(void) bus_unregister(i2c_bus_type); } -subsys_initcall(i2c_init); +postcore_initcall(i2c_init); module_exit(i2c_exit); /* -- 1.6.0.2.307.gc427 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/23] twl4030 patches (v4)
On Tue, Sep 30, 2008 at 6:05 AM, Tony Lindgren [EMAIL PROTECTED] wrote: Let's plan on applying these tomorrow unless there are more comments. I'm seeing some issues on Overo when applying these patches. On a cold boot everything proceeds normally (including devices being enumerated on the musb channel) until the kernel attempts to mount the rootfs from mmc. At that point boot messages stop: mmc0: new high speed SD card at address 55ce mmcblk0: mmc0:55ce SD02G 1921024KiB mmcblk0:7mmc0: starting CMD18 arg flags 00b5 p1 p2 At first I thought mmc support was broken and the system was hung. But after a 10 - 20 second delay I noticed that approximately every 10 seconds I get the following message: musb_h_tx_flush_fifo 124: Could not flush host TX fifo: csr: 000a After a few cycles of this the boot continues and completes normally, but the musb port is now non-functional. If I do a reboot command or press the reset button, the overo reboots without the above delays or error messages, however the musb port is non-functional. It seems that something has gone awry in the twl4030 usb section, since I get a functional system without these patches. Any suggestions as to where I should begin looking to help debug this? Steve -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch twl series 1/2] twl4030-gpio: pullup/pulldown init
From: David Brownell [EMAIL PROTECTED] Finish moving initialization of pullups and pulldowns for twl4030 GPIOs into board specific init. Remove partial/incorrect init code for that from the hsmmc glue. Doing this right requires some attention from board init logic, based on how the TWL chip is wired. Letting digital inputs float will waste power. Everyone with board schematics should update their board init code so it matches their boards; meanwhile, this returns to current behavior (all pullups disabled) but finally offers a way to do it right. Note that the ULPI pins won't need this attention (muxed against gpio{3-5,9-12,14} pins), and neither will ones with external pullups or pulldowns (conventional for MMC/SD card detect). Signed-off-by: David Brownell [EMAIL PROTECTED] --- This partially reverses the effect of patch 0002 of the series Felipe has been refreshing, in the sense that all pullups (and pullups) are again disabled. HOWEVER it fills in that hole by providing a way boards can fix that -- example in patch #2. arch/arm/mach-omap2/hsmmc.c |6 --- drivers/gpio/twl4030-gpio.c | 78 +- include/linux/i2c/twl4030.h |7 +++ 3 files changed, 46 insertions(+), 45 deletions(-) --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c @@ -27,7 +27,6 @@ #define VMMC1_DEDICATED0x2A #define VSEL_3V0x02 #define VSEL_18V 0x00 -#define TWL_GPIO_PUPDCTR1 0x13 #define TWL_GPIO_IMR1A 0x1C #define TWL_GPIO_ISR1A 0x19 #define LDO_CLR0x00 @@ -65,11 +64,6 @@ static int hsmmc_late_init(struct device if (ret) goto err; - ret = twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x02, - TWL_GPIO_PUPDCTR1); - if (ret) - goto err; - ret = twl4030_set_gpio_debounce(MMC1_CD_IRQ, TWL4030_GPIO_IS_ENABLE); if (ret) goto err; --- a/drivers/gpio/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c @@ -476,44 +476,6 @@ int twl4030_get_gpio_datain(int gpio) } EXPORT_SYMBOL(twl4030_get_gpio_datain); -#if 0 -/* - * Configure PULL type for a GPIO pin on TWL4030 - */ -int twl4030_set_gpio_pull(int gpio, int pull_dircn) -{ - u8 c_bnk = GET_GPIO_CTL_BANK(gpio); - u8 c_off = GET_GPIO_CTL_OFF(gpio); - u8 c_msk = 0; - u8 reg = 0; - u8 base = 0; - int ret = 0; - - if (unlikely((gpio = TWL4030_GPIO_MAX) || - !(gpio_usage_count (0x1 gpio - return -EPERM; - - base = REG_GPIOPUPDCTR1 + c_bnk; - if (pull_dircn == TWL4030_GPIO_PULL_DOWN) - c_msk = MASK_GPIOPUPDCTR1_GPIOxPD(c_off); - else if (pull_dircn == TWL4030_GPIO_PULL_UP) - c_msk = MASK_GPIOPUPDCTR1_GPIOxPU(c_off); - - mutex_lock(gpio_lock); - ret = gpio_twl4030_read(base); - if (ret = 0) { - /* clear the previous up/down values */ - reg = (u8) (ret); - reg = ~(MASK_GPIOPUPDCTR1_GPIOxPU(c_off) | - MASK_GPIOPUPDCTR1_GPIOxPD(c_off)); - reg |= c_msk; - ret = gpio_twl4030_write(base, reg); - } - mutex_unlock(gpio_lock); - return ret; -} -#endif - static int twl4030_set_gpio_edge_ctrl(int gpio, int edge) { u8 c_bnk = GET_GPIO_CTL_BANK(gpio); @@ -578,6 +540,9 @@ EXPORT_SYMBOL(twl4030_set_gpio_debounce) #if 0 /* * Configure Card detect for GPIO pin on TWL4030 + * + * This means: VMMC1 or VMMC2 is enabled or disabled based + * on the status of GPIO-0 or GPIO-1 pins (respectively). */ int twl4030_set_gpio_card_detect(int gpio, int enable) { @@ -800,6 +765,31 @@ static struct gpio_chip twl_gpiochip = { /*--*/ +static int __devinit gpio_twl4030_pulls(u32 ups, u32 downs) +{ + u8 message[6]; + unsignedi, gpio_bit; + + /* For most pins, a pulldown was enabled by default. +* We should have data that's specific to this board. +*/ + for (gpio_bit = 1, i = 1; i 6; i++) { + u8 bit_mask; + unsignedj; + + for (bit_mask = 0, j = 0; j 8; j += 2, gpio_bit = 1) { + if (ups gpio_bit) + bit_mask |= 1 (j + 1); + else if (downs gpio_bit) + bit_mask |= 1 (j + 0); + } + message[i] = bit_mask; + } + + return twl4030_i2c_write(TWL4030_MODULE_GPIO, message, + REG_GPIOPUPDCTR1, 5); +} + static int gpio_twl4030_remove(struct platform_device *pdev); static int __devinit gpio_twl4030_probe(struct platform_device *pdev) @@ -875,6 +865,18 @@ static int __devinit gpio_twl4030_probe( no_irqs:
[patch twl series 2/2] twl4030-gpio: beagle pull up/down init
From: David Brownell [EMAIL PROTECTED] Better TWL init on Beagle: use the setup() callback to learn IRQ assignments; and configure pullups/pulldowns. Signed-off-by: David Brownell [EMAIL PROTECTED] --- Similar patches will be needed for other TWL based boards. arch/arm/mach-omap2/board-omap3beagle.c | 26 +- 1 file changed, 21 insertions(+), 5 deletions(-) --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -115,15 +115,31 @@ static struct twl4030_usb_data beagle_us .usb_mode = T2_USB_MODE_ULPI, }; +static int beagle_twl_gpio_setup(struct device *dev, + unsigned gpio, unsigned ngpio) +{ + /* request_gpio(gpio + 0, mmc0_cd); +* gpio_direction_input(gpio + 0); +*/ + + gpio_request(gpio + 1, EHCI_nOC); + gpio_direction_input(gpio + 1); + + /* gpio + 18 + 0 == ledA, nEN_USB_PWR (out) +* gpio + 18 + 1 == ledB, PMU_STAT (out, a LED) +*/ + + return 0; +} + static struct twl4030_gpio_platform_data beagle_gpio_data = { .gpio_base = OMAP_MAX_GPIO_LINES, .irq_base = TWL4030_GPIO_IRQ_BASE, .irq_end= TWL4030_GPIO_IRQ_END, - - /* REVISIT: setup() should use twl gpio index -* - 0 as MMC card detect, -* - 1 as EHCI port overcurrent (active low) -*/ + .pullups= BIT(1), + .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13) + | BIT(15) | BIT(16) | BIT(17), + .setup = beagle_twl_gpio_setup, }; static struct twl4030_platform_data beagle_twldata = { -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: does twl3040-pwrirq.c need to be a separate file?
Hi Peter, On Tuesday 30 September 2008, Peter 'p2' De Schrijver wrote: I see your patch 68d7477caca19c0b52b5d4e85700cd3e6115577f created pwrirq.c as a separate file and thread. I guess choose this solution because it was similar to the GPIO IRQs. Originally, this was 1 shared IRQ. But I wanted to change this to avoid every driver having to read PWR_ISR1 and clear his interrupt. This saves some i2c transactions. Right; modularization is appropriate. Although it doesn't seem to have hit all the TWL subchips yet ... :) I'm wondering if there's any particular reason that bank of interrupts shouldn't be handled directly by twl4030-core, and even by the same IRQ handling thread. I don't think so. As it stands now the TWL core is not especially core-ish in this respect, and I'd like to see that be resolved (e.g. by a patch I'll probably write this afternoon) before this code goes to mainline ... Ok. Good. Thanks for the sanity check. - Dave -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Soft lockup when disconnecting musb isochronous device.
Op 30 sep 2008, om 08:03 heeft Gupta, Ajay Kumar het volgende geschreven: I've been trying to get the UVC camera driver working in linux-omap on the Beagleboard, which uses musb. With the latest linux-omap git, capture doesn't work. Applying Ajay Gupta's MUSB patches posted here on 9/8 allows capture to work until the device is closed. With or without Ajay's patches, when the device is closed, the following lockup occurs. Let me know if there is anything I can do to help debug this. Have you applied below patch posted on 25/08/2008? [PATCH v3] OMAP: MUSB: Corrects urb unlink function path That patch isn't applied in the uImage Nathan is using, I'm adding it to the patchqueue and will build a new uImage[1] regards, Koen [1] When I can access my buildmachine again, *$(*$([EMAIL PROTECTED] rain This patch is accepted and is pending to be merged with latest OMAP GIT. Regards, Ajay BUG: soft lockup - CPU#0 stuck for 61s! [mjpg_streamer:1770] Modules linked in: ipv6 pegasus uvcvideo compat_ioctl32 videodev v4l1_compat Pid: 1770, comm:mjpg_streamer CPU: 0Not tainted (2.6.27-rc7-omap1 #4) PC is at __mutex_lock_slowpath+0x1ec/0x204 LR is at __mutex_lock_slowpath+0x1c4/0x204 pc : [c0320fa0]lr : [c0320f78]psr: 6013 sp : c7265ca0 ip : c7265ca0 fp : c7265cd4 r10: c79eb400 r9 : c7128218 r8 : c78a6a08 r7 : c78df9c0 r6 : 6013 r5 : c0437690 r4 : c7265ca4 r3 : r2 : r1 : c7264000 r0 : c0437690 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 00c5387f Table: 87348018 DAC: 0015 [c0034ca8] (show_regs+0x0/0x50) from [c007959c] (softlockup_tick+0x100/0x140) r5:00bc r4:007f [c007949c] (softlockup_tick+0x0/0x140) from [c005c08c] (run_local_timers+0x1c/0x20) [c005c070] (run_local_timers+0x0/0x20) from [c005c4e8] (update_process_times+0x30/0x5c) [c005c4b8] (update_process_times+0x0/0x5c) from [c006f138] (tick_sched_timer+0x8c/0xd8) r5:c7265c58 r4:c044d630 [c006f0ac] (tick_sched_timer+0x0/0xd8) from [c0069090] (__run_hrtimer+0x58/0x94) r7:c0425e60 r6:c044d630 r5:c0425e60 r4:c044d630 [c0069038] (__run_hrtimer+0x0/0x94) from [c0069c64] (hrtimer_interrupt+0x130/0x1a0) r5:00b9 r4:183847b0 [c0069b34] (hrtimer_interrupt+0x0/0x1a0) from [c003d248] (omap2_gp_timer_interrupt+0x28/0x34) [c003d220] (omap2_gp_timer_interrupt+0x0/0x34) from [c0079a58] (handle_IRQ_event+0x3c/0x74) [c0079a1c] (handle_IRQ_event+0x0/0x74) from [c007b2a4] (handle_level_irq+0xd4/0xf0) r7:c78df9c0 r6: r5:005f r4:c04279a8 [c007b1d0] (handle_level_irq+0x0/0xf0) from [c0033048] (__exception_text_start+0x48/0x64) r5:c04279a8 r4:005f [c0033000] (__exception_text_start+0x0/0x64) from [c0033830] (__irq_svc+0x30/0x80) Exception stack(0xc7265c58 to 0xc7265ca0) 5c40: c0437690 c7264000 5c60: c7265ca4 c0437690 6013 c78df9c0 c78a6a08 c7128218 5c80: c79eb400 c7265cd4 c7265ca0 c7265ca0 c0320f78 c0320fa0 6013 r7:c78df9c0 r6:6013 r5:d820 r4: [c0320db4] (__mutex_lock_slowpath+0x0/0x204) from [c0320fc8] (mutex_lock+0x10/0x14) r7:c7893000 r6:c7170c00 r5:c7170c00 r4:c791c738 [c0320fb8] (mutex_lock+0x0/0x14) from [c01ed760] (usb_kill_urb +0x38/0x104) [c01ed728] (usb_kill_urb+0x0/0x104) from [c01ece30] (usb_hcd_flush_endpoint+0xb0/0xcc) r6:c791c740 r5:c7170c00 r4:c791c738 [c01ecd80] (usb_hcd_flush_endpoint+0x0/0xcc) from [c01ee044] (usb_disable_endpoint+0x5c/0x6c) r7:c7893000 r6:c78a6a40 r5:c7893000 r4:c791c740 [c01edfe8] (usb_disable_endpoint+0x0/0x6c) from [c01ee180] (usb_disable_interface+0x34/0x4c) r5:0028 r4:0001 [c01ee14c] (usb_disable_interface+0x0/0x4c) from [c01ef4e0] (usb_set_interface+0xec/0x178) r7:0001 r6: r5:c7893000 r4:c78a6e00 [c01ef3f4] (usb_set_interface+0x0/0x178) from [bf014c48] (uvc_video_enable+0x3c/0x74 [uvcvideo]) r8:c721c050 r7:c7265e68 r6:c721c094 r5: r4:c721c050 [bf014c0c] (uvc_video_enable+0x0/0x74 [uvcvideo]) from [bf014308] (uvc_v4l2_do_ioctl+0xce4/0xf50 [uvcvideo]) r7:c7265e68 r6:c79f9e00 r5:c78d4760 r4:40045613 [bf013624] (uvc_v4l2_do_ioctl+0x0/0xf50 [uvcvideo]) from [bf008e20] (video_usercopy+0x1b8/0x2b8 [videodev]) [bf008c68] (video_usercopy+0x0/0x2b8 [videodev]) from [bf012fdc] (uvc_v4l2_ioctl+0x54/0x68 [uvcvideo]) [bf012f88] (uvc_v4l2_ioctl+0x0/0x68 [uvcvideo]) from [c00ace28] (vfs_ioctl+0x68/0x78) r7:c79eb400 r6:0003 r5:40c78ccc r4:40045613 [c00acdc0] (vfs_ioctl+0x0/0x78) from [c00ad0a8] (do_vfs_ioctl +0x270/0x280) r5:40c78ccc r4:c79eb400 [c00ace38] (do_vfs_ioctl+0x0/0x280) from [c00ad0f8] (sys_ioctl +0x40/0x64) r7:c79eb400 r6:40045613 r5:40c78ccc r4:0003 [c00ad0b8] (sys_ioctl+0x0/0x64) from [c0033c80] (ret_fast_syscall +0x0/0x2c) - Nathan -- To unsubscribe from this list: send the line unsubscribe linux- omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from
Re: [PATCH 00/23] twl4030 patches (v4)
On Tue, Sep 30, 2008 at 10:37 AM, Felipe Balbi [EMAIL PROTECTED] wrote: On Tue, Sep 30, 2008 at 09:26:09AM -0700, Steve Sakoman wrote: On Tue, Sep 30, 2008 at 6:05 AM, Tony Lindgren [EMAIL PROTECTED] wrote: Let's plan on applying these tomorrow unless there are more comments. I'm seeing some issues on Overo when applying these patches. On a cold boot everything proceeds normally (including devices being enumerated on the musb channel) until the kernel attempts to mount the rootfs from mmc. At that point boot messages stop: mmc0: new high speed SD card at address 55ce mmcblk0: mmc0:55ce SD02G 1921024KiB mmcblk0:7mmc0: starting CMD18 arg flags 00b5 p1 p2 At first I thought mmc support was broken and the system was hung. But after a 10 - 20 second delay I noticed that approximately every 10 seconds I get the following message: musb_h_tx_flush_fifo 124: Could not flush host TX fifo: csr: 000a After a few cycles of this the boot continues and completes normally, but the musb port is now non-functional. If I do a reboot command or press the reset button, the overo reboots without the above delays or error messages, however the musb port is non-functional. It seems that something has gone awry in the twl4030 usb section, since I get a functional system without these patches. Any suggestions as to where I should begin looking to help debug this? remove the devices you have attached to musb port for now. musb shouldn't prevent these patches from being applied. As I said before, musb otg-host mode is not quite ok for omap3. I'm pretty sure we're gonna have a lot to patch in order to get it in good shape. A few patches are already coming from mainline btw. I should have mentioned that these patches were applied to current top of tree *plus* the 7 musb patches you have queued up on linux-usb list. Steve -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 00/25] twl4030 patches (v5)
From: Felipe Balbi [EMAIL PROTECTED] Hopefully this is the final version: In this version a bugfix to the use of twl4030_set_gpio_edge_ctrl() and includes Dave's pullup/pulldown patches. David Brownell (13): twl4030 gpio platform data twl4030 uses gpiolib minor twl4030-core cleanups provide detailed diagnostics in add_children() move twl4030-gpio to drivers/gpio minor irq-related cleanups Move I2C driver model init earlier in the boot sequence twl4030-gpio irq_chip.set_type twl4030-gpio: remove legacy irq triggering calls and user twl4030-gpio: irq and other cleanup twl4030-core: portability updates twl4030-gpio: pullup/pulldown init twl4030-gpio: beagle pull up/down init Felipe Balbi (11): twl4030: fix potential null pointer dereference i2c: clean add_children a bit i2c: move twl4030_keypad to new style registration i2c: move twl4030-usb to platform_device i2c: twl4030-usb: add 'vbus' sysfs file i2c: move twl4030-madc to new registration style i2c: added a few missing gotos to add_children() i2c: switch twl4030-usb to use a resource for irq i2c: minor cleanups to twl4030-pwrbutton.c twl4030: minor cleanups to twl4030_bci_battery.c twl4030-bci: move to new style registration method Jagadeesh Bhaskar Pakaravoor (1): twl4030-gpio: Remove default pullup enable/disable of GPIO arch/arm/mach-omap2/Makefile|4 +- arch/arm/mach-omap2/bci.c | 57 --- arch/arm/mach-omap2/board-2430sdp.c | 32 ++- arch/arm/mach-omap2/board-3430sdp.c | 49 ++- arch/arm/mach-omap2/board-ldp.c | 37 ++- arch/arm/mach-omap2/board-omap2evm.c| 33 ++- arch/arm/mach-omap2/board-omap3beagle.c | 35 ++ arch/arm/mach-omap2/board-omap3evm.c| 85 +++-- arch/arm/mach-omap2/board-overo.c | 11 + arch/arm/mach-omap2/hsmmc.c | 11 - arch/arm/plat-omap/include/mach/bci.h | 17 - arch/arm/plat-omap/include/mach/irqs.h |2 +- drivers/gpio/Kconfig|7 + drivers/gpio/Makefile |1 + drivers/{i2c/chips = gpio}/twl4030-gpio.c | 489 ++- drivers/i2c/chips/Kconfig | 20 -- drivers/i2c/chips/Makefile |1 - drivers/i2c/chips/twl4030-core.c| 344 +--- drivers/i2c/chips/twl4030-madc.c| 243 +- drivers/i2c/chips/twl4030-pwrbutton.c | 10 +- drivers/i2c/chips/twl4030-usb.c | 373 +++-- drivers/i2c/i2c-core.c |2 +- drivers/input/keyboard/omap-twl4030keypad.c | 10 +- drivers/mmc/host/omap_hsmmc.c |4 +- drivers/power/twl4030_bci_battery.c | 184 +-- drivers/rtc/rtc-twl4030.c | 11 +- include/linux/i2c/twl4030.h | 69 +++- 27 files changed, 1364 insertions(+), 777 deletions(-) delete mode 100644 arch/arm/mach-omap2/bci.c delete mode 100644 arch/arm/plat-omap/include/mach/bci.h rename drivers/{i2c/chips = gpio}/twl4030-gpio.c (64%) -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/25] twl4030: fix potential null pointer dereference
From: Felipe Balbi [EMAIL PROTECTED] The following patch fix a potential null pointer dereference in twl4030 keypad driver when parts of keypad platform_data aren't passed down to the driver. At that point kp-dbg_dev is not set yet. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/input/keyboard/omap-twl4030keypad.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/input/keyboard/omap-twl4030keypad.c b/drivers/input/keyboard/omap-twl4030keypad.c index 3893d63..48f29d3 100644 --- a/drivers/input/keyboard/omap-twl4030keypad.c +++ b/drivers/input/keyboard/omap-twl4030keypad.c @@ -238,7 +238,7 @@ static int __init omap_kp_probe(struct platform_device *pdev) return -ENOMEM; if (!pdata-rows || !pdata-cols || !pdata-keymap) { - dev_err(kp-dbg_dev, No rows, cols or keymap from pdata\n); + dev_err(pdev-dev, No rows, cols or keymap from pdata\n); kfree(kp); return -EINVAL; } -- 1.6.0.1.196.g01914 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/25] twl4030-gpio: Remove default pullup enable/disable of GPIO
From: Jagadeesh Bhaskar Pakaravoor [EMAIL PROTECTED] One twl4030_request_gpio() should not tamper with the pullup enabling/disabling of the rest of the GPIOs. So removing the default pullup values written to REG_GPIOPUPDCTR1. Acked-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Girish S G [EMAIL PROTECTED] Signed-off-by: Jagadeesh Bhaskar Pakaravoor [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-gpio.c |5 - 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/chips/twl4030-gpio.c b/drivers/i2c/chips/twl4030-gpio.c index 4d89abc..b51bed0 100644 --- a/drivers/i2c/chips/twl4030-gpio.c +++ b/drivers/i2c/chips/twl4030-gpio.c @@ -301,7 +301,6 @@ int twl4030_request_gpio(int gpio) if (gpio_usage_count (0x1 gpio)) ret = -EBUSY; else { - u8 clear_pull[6] = { 0, 0, 0, 0, 0, 0 }; /* First time usage? - switch on GPIO module */ if (!gpio_usage_count) { ret = @@ -311,10 +310,6 @@ int twl4030_request_gpio(int gpio) } if (!ret) gpio_usage_count |= (0x1 gpio); - - ret = - twl4030_i2c_write(TWL4030_MODULE_GPIO, clear_pull, - REG_GPIOPUPDCTR1, 5); } up(gpio_sem); return ret; -- 1.6.0.1.196.g01914 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/25] i2c: clean add_children a bit
From: Felipe Balbi [EMAIL PROTECTED] Clean up add_children a bit before adding more children to twl4030-core.c Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-core.c | 63 + 1 files changed, 36 insertions(+), 27 deletions(-) diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index 47f65f8..e55f49e 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -45,6 +45,11 @@ #define DRIVER_NAMEtwl4030 +#if defined(CONFIG_RTC_DRV_TWL4030) || defined(CONFIG_RTC_DRV_TWL4030_MODULE) +#define twl_has_rtc() true +#else +#define twl_has_rtc() false +#endif /* Primary Interrupt Handler on TWL4030 Registers */ @@ -639,34 +644,38 @@ static int add_children(struct twl4030_platform_data *pdata) struct twl4030_client *twl = NULL; int status = 0; -#ifdef CONFIG_RTC_DRV_TWL4030 - pdev = platform_device_alloc(twl4030_rtc, -1); - if (pdev) { - twl = twl4030_modules[TWL4030_SLAVENUM_NUM3]; - pdev-dev.parent = twl-client-dev; - device_init_wakeup(pdev-dev, 1); - - /* -* FIXME add the relevant IRQ resource, and make the -* rtc driver use it instead of hard-wiring ... -* -* REVISIT platform_data here currently only supports -* setting up the msecure line ... which actually -* violates the princple of least privilege, since -* it's effectively always in high trust mode. -* -* For now, expect equivalent treatment at board init: -* setting msecure high. Eventually, Linux might -* become more aware of those HW security concerns. -*/ - - status = platform_device_add(pdev); - if (status 0) - platform_device_put(pdev); - } else - status = -ENOMEM; -#endif + if (twl_has_rtc()) { + pdev = platform_device_alloc(twl4030_rtc, -1); + if (pdev) { + twl = twl4030_modules[TWL4030_SLAVENUM_NUM3]; + pdev-dev.parent = twl-client-dev; + device_init_wakeup(pdev-dev, 1); + + /* +* FIXME add the relevant IRQ resource, and make the +* rtc driver use it instead of hard-wiring ... +* +* REVISIT platform_data here currently only supports +* setting up the msecure line ... which actually +* violates the princple of least privilege, since +* it's effectively always in high trust mode. +* +* For now, expect equivalent treatment at board init: +* setting msecure high. Eventually, Linux might +* become more aware of those HW security concerns. +*/ + + status = platform_device_add(pdev); + if (status 0) + platform_device_put(pdev); + } else { + status = -ENOMEM; + goto err; + } + } +err: + pr_err(failed to add twl4030's children\n); return status; } -- 1.6.0.1.196.g01914 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/25] i2c: move twl4030_keypad to new style registration
From: Felipe Balbi [EMAIL PROTECTED] let twl4030-core.c take care of twl4030_keypad registration. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/mach-omap2/board-2430sdp.c | 14 ++ arch/arm/mach-omap2/board-3430sdp.c | 14 ++ arch/arm/mach-omap2/board-omap2evm.c| 16 ++ arch/arm/mach-omap2/board-omap3evm.c| 69 -- drivers/i2c/chips/twl4030-core.c| 27 ++ drivers/input/keyboard/omap-twl4030keypad.c |8 ++-- include/linux/i2c/twl4030.h | 10 7 files changed, 86 insertions(+), 72 deletions(-) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 3649a94..8c4c9dd 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -173,7 +173,7 @@ static int sdp2430_keymap[] = { 0 }; -static struct omap_kp_platform_data sdp2430_kp_data = { +static struct twl4030_keypad_data sdp2430_kp_data = { .rows = 5, .cols = 6, .keymap = sdp2430_keymap, @@ -182,14 +182,6 @@ static struct omap_kp_platform_data sdp2430_kp_data = { .irq= TWL4030_MODIRQ_KEYPAD, }; -static struct platform_device sdp2430_kp_device = { - .name = omap_twl4030keypad, - .id = -1, - .dev= { - .platform_data = sdp2430_kp_data, - }, -}; - static int __init msecure_init(void) { int ret = 0; @@ -216,7 +208,6 @@ out: static struct platform_device *sdp2430_devices[] __initdata = { sdp2430_smc91x_device, sdp2430_flash_device, - sdp2430_kp_device, sdp2430_lcd_device, }; @@ -356,6 +347,9 @@ static struct omap_board_config_kernel sdp2430_config[] __initdata = { static struct twl4030_platform_data sdp2430_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, + + /* platform_data for children goes here */ + .keypad = sdp2430_kp_data, }; static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 4c60d7b..fe1ba4e 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -110,7 +110,7 @@ static int sdp3430_keymap[] = { 0 }; -static struct omap_kp_platform_data sdp3430_kp_data = { +static struct twl4030_keypad_data sdp3430_kp_data = { .rows = 5, .cols = 6, .keymap = sdp3430_keymap, @@ -119,14 +119,6 @@ static struct omap_kp_platform_data sdp3430_kp_data = { .irq= TWL4030_MODIRQ_KEYPAD, }; -static struct platform_device sdp3430_kp_device = { - .name = omap_twl4030keypad, - .id = -1, - .dev= { - .platform_data = sdp3430_kp_data, - }, -}; - static int ts_gpio; static int __init msecure_init(void) @@ -252,7 +244,6 @@ static struct platform_device sdp3430_lcd_device = { static struct platform_device *sdp3430_devices[] __initdata = { sdp3430_smc91x_device, - sdp3430_kp_device, sdp3430_lcd_device, }; @@ -312,6 +303,9 @@ static struct omap_board_config_kernel sdp3430_config[] __initdata = { static struct twl4030_platform_data sdp3430_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, + + /* platform_data for children goes here */ + .keypad = sdp3430_kp_data, }; static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-omap2evm.c b/arch/arm/mach-omap2/board-omap2evm.c index 6ce7740..d2a3743 100644 --- a/arch/arm/mach-omap2/board-omap2evm.c +++ b/arch/arm/mach-omap2/board-omap2evm.c @@ -200,23 +200,15 @@ static int omap2evm_keymap[] = { KEY(3, 3, KEY_P) }; -static struct omap_kp_platform_data omap2evm_kp_data = { +static struct twl4030_keypad_data omap2evm_kp_data = { .rows = 4, .cols = 4, - .keymap = omap2evm_keymap, + .keymap = omap2evm_keymap, .keymapsize = ARRAY_SIZE(omap2evm_keymap), .rep= 1, .irq= TWL4030_MODIRQ_KEYPAD, }; -static struct platform_device omap2evm_kp_device = { - .name = omap_twl4030keypad, - .id = -1, - .dev= { - .platform_data = omap2evm_kp_data, - }, -}; - static void __init omap2_evm_init_irq(void) { omap2_init_common_hw(NULL); @@ -237,6 +229,9 @@ static struct omap_board_config_kernel omap2_evm_config[] __initdata = { static struct twl4030_platform_data omap2evm_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, + + /* platform_data for
[PATCH 05/25] i2c: move twl4030-usb to platform_device
From: Felipe Balbi [EMAIL PROTECTED] use new style twl4030-core to register a platform_device for twl4030-usb. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/mach-omap2/board-2430sdp.c |6 + arch/arm/mach-omap2/board-3430sdp.c |5 + arch/arm/mach-omap2/board-ldp.c |7 + arch/arm/mach-omap2/board-omap2evm.c|5 + arch/arm/mach-omap2/board-omap3beagle.c |7 + arch/arm/mach-omap2/board-omap3evm.c|6 +- arch/arm/mach-omap2/board-overo.c |5 + drivers/i2c/chips/Kconfig | 16 -- drivers/i2c/chips/twl4030-core.c| 27 +++ drivers/i2c/chips/twl4030-usb.c | 324 ++- include/linux/i2c/twl4030.h | 10 + 11 files changed, 219 insertions(+), 199 deletions(-) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 8c4c9dd..3073528 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -344,12 +344,18 @@ static struct omap_board_config_kernel sdp2430_config[] __initdata = { {OMAP_TAG_SERIAL_CONSOLE, sdp2430_serial_console_config}, }; + +static struct twl4030_usb_data sdp2430_usb_data = { + .usb_mode = T2_USB_MODE_ULPI, +}; + static struct twl4030_platform_data sdp2430_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .keypad = sdp2430_kp_data, + .usb= sdp2430_usb_data, }; static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index fe1ba4e..e0c39c2 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -300,12 +300,17 @@ static struct omap_board_config_kernel sdp3430_config[] __initdata = { { OMAP_TAG_LCD, sdp3430_lcd_config }, }; +static struct twl4030_usb_data sdp3430_usb_data = { + .usb_mode = T2_USB_MODE_ULPI, +}; + static struct twl4030_platform_data sdp3430_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .keypad = sdp3430_kp_data, + .usb= sdp3430_usb_data, }; static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index c07c712..219579b 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c @@ -183,9 +183,16 @@ static struct omap_board_config_kernel ldp_config[] __initdata = { { OMAP_TAG_UART,ldp_uart_config }, }; +static struct twl4030_usb_data ldp_usb_data = { + .usb_mode = T2_USB_MODE_ULPI, +}; + static struct twl4030_platform_data ldp_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, + + /* platform_data for children goes here */ + .usb= ldp_usb_data, }; static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-omap2evm.c b/arch/arm/mach-omap2/board-omap2evm.c index d2a3743..be8348d 100644 --- a/arch/arm/mach-omap2/board-omap2evm.c +++ b/arch/arm/mach-omap2/board-omap2evm.c @@ -226,12 +226,17 @@ static struct omap_board_config_kernel omap2_evm_config[] __initdata = { { OMAP_TAG_LCD, omap2_evm_lcd_config }, }; +static struct twl4030_usb_data omap2evm_usb_data = { + .usb_mode = T2_USB_MODE_ULPI, +}; + static struct twl4030_platform_data omap2evm_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .keypad = omap2evm_kp_data, + .usb= omap2evm_usb_data, }; static struct i2c_board_info __initdata omap2evm_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index fa8f5f6..ae677b9 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -110,9 +110,16 @@ static struct omap_uart_config omap3_beagle_uart_config __initdata = { .enabled_uarts = ((1 0) | (1 1) | (1 2)), }; +static struct twl4030_usb_data beagle_usb_data = { + .usb_mode = T2_USB_MODE_ULPI, +}; + static struct twl4030_platform_data beagle_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, + + /* platform_data for children goes here */ + .usb= beagle_usb_data, }; static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index c4a969d..158138c 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++
[PATCH 07/25] twl4030 gpio platform data
From: David Brownell [EMAIL PROTECTED] Define platform data for configuring TWL4030 GPIOs, and provide it for all boards using these chips. For now all boards use the same fixed assignments for GPIO and IRQ numbers. Eventually we should be able to shuffle them without changing platform headers. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/mach-omap2/board-2430sdp.c |7 +++ arch/arm/mach-omap2/board-3430sdp.c |7 +++ arch/arm/mach-omap2/board-ldp.c |7 +++ arch/arm/mach-omap2/board-omap2evm.c|7 +++ arch/arm/mach-omap2/board-omap3beagle.c | 12 arch/arm/mach-omap2/board-omap3evm.c|7 +++ arch/arm/mach-omap2/board-overo.c |6 ++ include/linux/i2c/twl4030.h | 24 +--- 8 files changed, 74 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 3073528..7842110 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -345,6 +345,12 @@ static struct omap_board_config_kernel sdp2430_config[] __initdata = { }; +static struct twl4030_gpio_platform_data sdp2430_gpio_data = { + .gpio_base = OMAP_MAX_GPIO_LINES, + .irq_base = TWL4030_GPIO_IRQ_BASE, + .irq_end= TWL4030_GPIO_IRQ_END, +}; + static struct twl4030_usb_data sdp2430_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; @@ -354,6 +360,7 @@ static struct twl4030_platform_data sdp2430_twldata = { .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ + .gpio = sdp2430_gpio_data, .keypad = sdp2430_kp_data, .usb= sdp2430_usb_data, }; diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index e0c39c2..66f0f98 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -300,6 +300,12 @@ static struct omap_board_config_kernel sdp3430_config[] __initdata = { { OMAP_TAG_LCD, sdp3430_lcd_config }, }; +static struct twl4030_gpio_platform_data sdp3430_gpio_data = { + .gpio_base = OMAP_MAX_GPIO_LINES, + .irq_base = TWL4030_GPIO_IRQ_BASE, + .irq_end= TWL4030_GPIO_IRQ_END, +}; + static struct twl4030_usb_data sdp3430_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; @@ -309,6 +315,7 @@ static struct twl4030_platform_data sdp3430_twldata = { .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ + .gpio = sdp3430_gpio_data, .keypad = sdp3430_kp_data, .usb= sdp3430_usb_data, }; diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index 219579b..48342f4 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c @@ -187,12 +187,19 @@ static struct twl4030_usb_data ldp_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; +static struct twl4030_gpio_platform_data ldp_gpio_data = { + .gpio_base = OMAP_MAX_GPIO_LINES, + .irq_base = TWL4030_GPIO_IRQ_BASE, + .irq_end= TWL4030_GPIO_IRQ_END, +}; + static struct twl4030_platform_data ldp_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .usb= ldp_usb_data, + .gpio = ldp_gpio_data, }; static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-omap2evm.c b/arch/arm/mach-omap2/board-omap2evm.c index be8348d..a921cf1 100644 --- a/arch/arm/mach-omap2/board-omap2evm.c +++ b/arch/arm/mach-omap2/board-omap2evm.c @@ -226,6 +226,12 @@ static struct omap_board_config_kernel omap2_evm_config[] __initdata = { { OMAP_TAG_LCD, omap2_evm_lcd_config }, }; +static struct twl4030_gpio_platform_data omap2evm_gpio_data = { + .gpio_base = OMAP_MAX_GPIO_LINES, + .irq_base = TWL4030_GPIO_IRQ_BASE, + .irq_end= TWL4030_GPIO_IRQ_END, +}; + static struct twl4030_usb_data omap2evm_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; @@ -237,6 +243,7 @@ static struct twl4030_platform_data omap2evm_twldata = { /* platform_data for children goes here */ .keypad = omap2evm_kp_data, .usb= omap2evm_usb_data, + .gpio = omap2evm_gpio_data, }; static struct i2c_board_info __initdata omap2evm_i2c_boardinfo[] = { diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index ae677b9..aa5e9a6 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -114,12 +114,24 @@ static struct twl4030_usb_data beagle_usb_data = {
[PATCH 08/25] twl4030 uses gpiolib
From: David Brownell [EMAIL PROTECTED] Make the twl4030 core create a platform device to which its GPIO code will bind, with platform_data used to configure board-specific behaviors and configuration. Update the twl4030 GPIO code: - Morph its gpio function code into a platform driver. - Move away from IRQ (and GPIO) numbers hard-wired in headers. - Hook up the twl4030 GPIO code to gpiolib. - Start phasing out the older TWL-specific calls ... currently those are used only by arch/arm/mach-omap2/hsmmc.c setup code. - Use a mutex for locking, not a binary semaphore. NOTE: more patches pending: (a) this doesn't use pdata-pullups to initialize (currently hsmmc code always sets GPIO-0 pullup even if the board has an external pullup); (b) there's a new gpio request/free hook forthcoming in 2.6.28, which this should use; (c) likewise there's a new gpio_to_irq() hook; (d) the irq_chip set_type() mechanism needs to be supported; (e) needs to move over to drivers/gpio; (f) upcoming threaded IRQ infrastructure should be used, when that merges. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/Kconfig|2 +- drivers/i2c/chips/twl4030-core.c | 44 ++ drivers/i2c/chips/twl4030-gpio.c | 273 +++--- 3 files changed, 238 insertions(+), 81 deletions(-) diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig index 121aec9..1a21388 100644 --- a/drivers/i2c/chips/Kconfig +++ b/drivers/i2c/chips/Kconfig @@ -159,7 +159,7 @@ config TWL4030_CORE config TWL4030_GPIO bool TWL4030 GPIO Driver - depends on TWL4030_CORE + depends on TWL4030_CORE GPIOLIB config TWL4030_MADC tristate TWL4030 MADC Driver diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index 02be771..c9460f7 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -63,6 +63,12 @@ #define twl_has_usb() false #endif +#ifdef CONFIG_TWL4030_GPIO +#define twl_has_gpio() true +#else +#define twl_has_gpio() false +#endif + /* Primary Interrupt Handler on TWL4030 Registers */ /* Register Definitions */ @@ -656,6 +662,44 @@ static int add_children(struct twl4030_platform_data *pdata) struct twl4030_client *twl = NULL; int status = 0; + if (twl_has_gpio() pdata-gpio) { + twl = twl4030_modules[TWL4030_SLAVENUM_NUM1]; + + pdev = platform_device_alloc(twl4030_gpio, -1); + if (!pdev) + status = -ENOMEM; + + /* more driver model init */ + if (status == 0) { + pdev-dev.parent = twl-client-dev; + /* device_init_wakeup(pdev-dev, 1); */ + + status = platform_device_add_data(pdev, pdata-gpio, + sizeof(*pdata-gpio)); + } + + /* GPIO module IRQ */ + if (status == 0) { + struct resource r = { + .start = pdata-irq_base + 0, + .flags = IORESOURCE_IRQ, + }; + + status = platform_device_add_resources(pdev, r, 1); + } + + if (status == 0) + status = platform_device_add(pdev); + + if (status 0) { + platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't create gpio dev, %d\n, + status); + goto err; + } + } + if (twl_has_rtc()) { pdev = platform_device_alloc(twl4030_rtc, -1); if (pdev) { diff --git a/drivers/i2c/chips/twl4030-gpio.c b/drivers/i2c/chips/twl4030-gpio.c index b51bed0..0d4dd28 100644 --- a/drivers/i2c/chips/twl4030-gpio.c +++ b/drivers/i2c/chips/twl4030-gpio.c @@ -31,22 +31,31 @@ #include linux/init.h #include linux/time.h #include linux/interrupt.h -#include linux/random.h -#include linux/syscalls.h +#include linux/device.h #include linux/kthread.h #include linux/irq.h +#include linux/gpio.h +#include linux/platform_device.h +#include linux/slab.h -#include linux/i2c.h #include linux/i2c/twl4030.h #include linux/i2c/twl4030-gpio.h -#include linux/slab.h #include mach/irqs.h #include asm/mach/irq.h #include mach/gpio.h #include mach/mux.h -#include linux/device.h + +/* REVISIT when these symbols vanish elsewhere, remove them here too */ +#undef TWL4030_GPIO_IRQ_BASE +#undef TWL4030_GPIO_IRQ_END +#undef TWL4030_MODIRQ_GPIO + +static struct gpio_chip twl_gpiochip; +static int twl4030_gpio_irq_base; +static int twl4030_gpio_irq_end; + /* BitField Definitions */ @@ -130,7 +139,7 @@ #define GPIO_32_MASK 0x0003 /* Data
[PATCH 09/25] i2c: move twl4030-madc to new registration style
From: Felipe Balbi [EMAIL PROTECTED] Moving twl4030-madc to new style registration just like the other twl4030 children. Cc: Mikko Ylinen [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/mach-omap2/board-2430sdp.c |5 + arch/arm/mach-omap2/board-3430sdp.c |5 + arch/arm/mach-omap2/board-ldp.c |5 + arch/arm/mach-omap2/board-omap2evm.c |5 + arch/arm/mach-omap2/board-omap3evm.c |5 + drivers/i2c/chips/twl4030-core.c | 27 drivers/i2c/chips/twl4030-madc.c | 243 +- include/linux/i2c/twl4030.h |5 + 8 files changed, 209 insertions(+), 91 deletions(-) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 7842110..cea2540 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -355,12 +355,17 @@ static struct twl4030_usb_data sdp2430_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; +static struct twl4030_madc_platform_data sdp2430_madc_data = { + .irq_line = 1, +}; + static struct twl4030_platform_data sdp2430_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .gpio = sdp2430_gpio_data, + .madc = sdp2430_madc_data, .keypad = sdp2430_kp_data, .usb= sdp2430_usb_data, }; diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 66f0f98..661d5d0 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -310,12 +310,17 @@ static struct twl4030_usb_data sdp3430_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; +static struct twl4030_madc_platform_data sdp3430_madc_data = { + .irq_line = 1, +}; + static struct twl4030_platform_data sdp3430_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .gpio = sdp3430_gpio_data, + .madc = sdp3430_madc_data, .keypad = sdp3430_kp_data, .usb= sdp3430_usb_data, }; diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index 48342f4..a0e2c7a 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c @@ -193,11 +193,16 @@ static struct twl4030_gpio_platform_data ldp_gpio_data = { .irq_end= TWL4030_GPIO_IRQ_END, }; +static struct twl4030_madc_platform_data ldp_madc_data = { + .irq_line = 1, +}; + static struct twl4030_platform_data ldp_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ + .madc = ldp_madc_data, .usb= ldp_usb_data, .gpio = ldp_gpio_data, }; diff --git a/arch/arm/mach-omap2/board-omap2evm.c b/arch/arm/mach-omap2/board-omap2evm.c index a921cf1..9f19c34 100644 --- a/arch/arm/mach-omap2/board-omap2evm.c +++ b/arch/arm/mach-omap2/board-omap2evm.c @@ -236,12 +236,17 @@ static struct twl4030_usb_data omap2evm_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; +static struct twl4030_madc_platform_data omap2evm_madc_data = { + .irq_line = 1, +}; + static struct twl4030_platform_data omap2evm_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .keypad = omap2evm_kp_data, + .madc = omap2evm_madc_data, .usb= omap2evm_usb_data, .gpio = omap2evm_gpio_data, }; diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 2c1d76f..a9ff8d1 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c @@ -128,12 +128,17 @@ static struct twl4030_keypad_data omap3evm_kp_data = { .irq= TWL4030_MODIRQ_KEYPAD, }; +static struct twl4030_madc_platform_data omap3evm_madc_data = { + .irq_line = 1, +}; + static struct twl4030_platform_data omap3evm_twldata = { .irq_base = TWL4030_IRQ_BASE, .irq_end= TWL4030_IRQ_END, /* platform_data for children goes here */ .keypad = omap3evm_kp_data, + .madc = omap3evm_madc_data, .usb= omap3evm_usb_data, .gpio = omap3evm_gpio_data, }; diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index c9460f7..79d4d82 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -69,6 +69,12 @@ #define twl_has_gpio() false #endif +#if defined(CONFIG_TWL4030_MADC) || defined(CONFIG_TWL4030_MADC_MODULE) +#define twl_has_madc() true
[PATCH 22/25] twl4030: minor cleanups to twl4030_bci_battery.c
From: Felipe Balbi [EMAIL PROTECTED] Brainless fixes, checkpatch.pl fixes, variable naming, etc. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/power/twl4030_bci_battery.c | 161 --- 1 files changed, 75 insertions(+), 86 deletions(-) diff --git a/drivers/power/twl4030_bci_battery.c b/drivers/power/twl4030_bci_battery.c index 6a55838..9ab6127 100644 --- a/drivers/power/twl4030_bci_battery.c +++ b/drivers/power/twl4030_bci_battery.c @@ -42,8 +42,8 @@ #define REG_PHY_CLK_CTRL_STS 0x0FF #define PHY_DPLL_CLK 0x01 -#define REG_BCICTL10x023 -#define REG_BCICTL20x024 +#define REG_BCICTL10x023 +#define REG_BCICTL20x024 #define CGAIN 0x020 #define ITHEN 0x010 #define ITHSENS0x007 @@ -70,7 +70,7 @@ #define REG_BCIMSTATEC 0x02 #define REG_BCIMFSTS4 0x010 #define REG_BCIMFSTS2 0x00E -#define REG_BCIMFSTS3 0x00F +#define REG_BCIMFSTS3 0x00F #define REG_BCIMFSTS1 0x001 #define USBFASTMCHG0x004 #define BATSTSPCHG 0x004 @@ -99,8 +99,8 @@ #define COR0x004 /* interrupt status registers */ -#define REG_BCIISR1A 0x0 -#define REG_BCIISR2A 0x01 +#define REG_BCIISR1A 0x0 +#define REG_BCIISR2A 0x01 /* Interrupt flags bits BCIISR1 */ #define BATSTS_ISR10x080 @@ -146,14 +146,6 @@ /* Ptr to thermistor table */ int *therm_tbl; -static int twl4030_bci_battery_probe(struct platform_device *dev); -static int twl4030_bci_battery_remove(struct platform_device *dev); -#ifdef CONFIG_PM -static int twl4030_bci_battery_suspend(struct platform_device *dev, - pm_message_t state); -static int twl4030_bci_battery_resume(struct platform_device *dev); -#endif - struct twl4030_bci_device_info { struct device *dev; @@ -171,18 +163,6 @@ struct twl4030_bci_device_info { struct delayed_work twl4030_bk_bci_monitor_work; }; -static struct platform_driver twl4030_bci_battery_driver = { - .probe =twl4030_bci_battery_probe, - .remove = twl4030_bci_battery_remove, -#ifdef CONFIG_PM - .suspend = twl4030_bci_battery_suspend, - .resume = twl4030_bci_battery_resume, -#endif - .driver = { - .name = twl4030-bci-battery, - }, -}; - static int usb_charger_flag; static int LVL_1, LVL_2, LVL_3, LVL_4; @@ -204,14 +184,11 @@ static inline int twl4030charger_presence_evt(void) if (ret) return IRQ_NONE; - /* If the AC charger have been connected */ - if (chg_sts STS_CHG) { + if (chg_sts STS_CHG) { /* If the AC charger have been connected */ /* configuring falling edge detection for CHG_PRES */ set = CHG_PRES_FALLING; clear = CHG_PRES_RISING; - } - /* If the AC charger have been disconnected */ - else { + } else { /* If the AC charger have been disconnected */ /* configuring rising edge detection for CHG_PRES */ set = CHG_PRES_RISING; clear = CHG_PRES_FALLING; @@ -230,9 +207,9 @@ static inline int twl4030charger_presence_evt(void) * USB_PRES (USB charger presence) CHG_PRES (AC charger presence) events * */ -static irqreturn_t twl4030charger_interrupt(int irq, void *dev_id) +static irqreturn_t twl4030charger_interrupt(int irq, void *_di) { - struct twl4030_bci_device_info *di = dev_id; + struct twl4030_bci_device_info *di = _di; twl4030charger_presence_evt(); power_supply_changed(di-bat); @@ -264,17 +241,14 @@ static int twl4030battery_presence_evt(void) * REVISIT: Physically inserting/removing the batt * does not seem to generate an int on 3430ES2 SDP. */ - - /* In case of the battery insertion event */ if ((batstspchg BATSTSPCHG) || (batstsmchg BATSTSMCHG)) { + /* In case of the battery insertion event */ ret = clear_n_set(TWL4030_MODULE_INTERRUPTS, BATSTS_EDRRISIN, BATSTS_EDRFALLING, REG_BCIEDR2); if (ret) return ret; - } - - /* In case of the battery removal event */ - else { + } else { + /* In case of the battery removal event */ ret = clear_n_set(TWL4030_MODULE_INTERRUPTS, BATSTS_EDRFALLING, BATSTS_EDRRISIN, REG_BCIEDR2); if (ret) @@ -298,18 +272,27 @@ static int twl4030battery_level_evt(void) if (ret) return ret; + /* REVISIT could use a bitmap */ if (mfst VBATOV4) { LVL_4 = 1; - LVL_3 = LVL_2 = LVL_1 = 0; + LVL_3 = 0; + LVL_2 = 0; + LVL_1 = 0;
[PATCH 16/25] Move I2C driver model init earlier in the boot sequence
From: David Brownell [EMAIL PROTECTED] This avoids oopsing in statically linked systems when some subsystems register I2C drivers in subsys_initcall() code, but those subsystems are linked (and initialized) before I2C. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] Signed-off-by: Jean Delvare [EMAIL PROTECTED] --- drivers/i2c/i2c-core.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index b346a68..f520108 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -978,7 +978,7 @@ static void __exit i2c_exit(void) bus_unregister(i2c_bus_type); } -subsys_initcall(i2c_init); +postcore_initcall(i2c_init); module_exit(i2c_exit); /* -- 1.6.0.1.196.g01914 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] omap: get rid of a useless cast
That cast was annyoing for quite a while. Now omap_ctrl_base_get() returns void __iomem * and __raw_read/write friends uses void __iomem * so there's no need for casting. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/mach-omap2/board-3430sdp.c |7 --- arch/arm/mach-omap2/board-ldp.c |7 --- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 4264b68..530a4d4 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -129,7 +129,8 @@ static int __init msecure_init(void) /* 3430ES2.0 doesn't have msecure/gpio-22 line connected to T2 */ if (omap_type() == OMAP2_DEVICE_TYPE_GP system_rev OMAP3430_REV_ES2_0) { - u32 msecure_pad_config_reg = omap_ctrl_base_get() + 0xA3C; + void __iomem *msecure_pad_config_reg = omap_ctrl_base_get() + + 0xA3C; int mux_mask = 0x04; u16 tmp; @@ -144,10 +145,10 @@ static int __init msecure_init(void) * is low. Make msecure line high in order to change the * TWL4030 RTC time and calender registers. */ - tmp = omap_readw(msecure_pad_config_reg); + tmp = __raw_readw(msecure_pad_config_reg); tmp = 0xF8; /* To enable mux mode 03/04 = GPIO_RTC */ tmp |= mux_mask;/* To enable mux mode 03/04 = GPIO_RTC */ - omap_writew(tmp, msecure_pad_config_reg); + __raw_writew(tmp, msecure_pad_config_reg); gpio_direction_output(TWL4030_MSECURE_GPIO, 1); } diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index 35c03b7..96452ad 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c @@ -56,7 +56,8 @@ static int __init msecure_init(void) /* 3430ES2.0 doesn't have msecure/gpio-22 line connected to T2 */ if (omap_device_type() == OMAP2_DEVICE_TYPE_GP system_rev OMAP3430_REV_ES2_0) { - u32 msecure_pad_config_reg = omap_ctrl_base_get() + 0xA3C; + void __iomem *msecure_pad_config_reg = omap_ctrl_base_get() + + 0xA3C; int mux_mask = 0x04; u16 tmp; @@ -72,10 +73,10 @@ static int __init msecure_init(void) * TWL4030 RTC time and calender registers. */ - tmp = omap_readw(msecure_pad_config_reg); + tmp = __raw_readw(msecure_pad_config_reg); tmp = 0xF8;/* To enable mux mode 03/04 = GPIO_RTC */ tmp |= mux_mask;/* To enable mux mode 03/04 = GPIO_RTC */ - omap_writew(tmp, msecure_pad_config_reg); + __raw_writew(tmp, msecure_pad_config_reg); gpio_direction_output(TWL4030_MSECURE_GPIO, 1); } -- 1.6.0.1.196.g01914 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 20/25] twl4030-gpio: irq and other cleanup
From: David Brownell [EMAIL PROTECTED] Remove some ARM and OMAP specific stuff from the twl4030 GPIO code, and some unused/undesirable CPP symbols. Add minor checkpatch fixes. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/gpio/twl4030-gpio.c | 36 +++- include/linux/i2c/twl4030.h |6 -- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c index 1ba3404..40abcbd 100644 --- a/drivers/gpio/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c @@ -40,20 +40,25 @@ #include linux/i2c/twl4030.h #include linux/i2c/twl4030-gpio.h -#include mach/irqs.h -#include asm/mach/irq.h -#include mach/gpio.h -#include mach/mux.h - -/* REVISIT when these symbols vanish elsewhere, remove them here too */ -/* #undef TWL4030_GPIO_IRQ_BASE */ -/* #undef TWL4030_GPIO_IRQ_END */ +static inline void activate_irq(int irq) +{ +#ifdef CONFIG_ARM + /* ARM requires an extra step to clear IRQ_NOREQUEST, which it +* sets on behalf of every irq_chip. Also sets IRQ_NOPROBE. +*/ + set_irq_flags(irq, IRQF_VALID); +#else + /* same effect on other architectures */ + set_irq_noprobe(irq); +#endif +} static struct gpio_chip twl_gpiochip; static int twl4030_gpio_irq_base; static int twl4030_gpio_irq_end; +/* genirq interfaces are not available to modules */ #ifdef MODULE #define is_module()true #else @@ -530,7 +535,7 @@ static int twl4030_set_gpio_edge_ctrl(int gpio, int edge) if (ret = 0) { /* clear the previous rising/falling values */ reg = (u8) ret; - reg = ~( MASK_GPIO_EDR1_GPIOxFALLING(c_off) + reg = ~(MASK_GPIO_EDR1_GPIOxFALLING(c_off) | MASK_GPIO_EDR1_GPIOxRISING(c_off)); reg |= c_msk; ret = gpio_twl4030_write(base, reg); @@ -598,7 +603,7 @@ int twl4030_set_gpio_card_detect(int gpio, int enable) ret = gpio_twl4030_write(REG_GPIO_CTRL, reg); } mutex_unlock(gpio_lock); - return (ret); + return ret; } #endif @@ -848,9 +853,9 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev) /* install an irq handler for each of the gpio interrupts */ for (irq = twl4030_gpio_irq_base; irq twl4030_gpio_irq_end; irq++) { - set_irq_chip(irq, twl4030_gpio_irq_chip); - set_irq_handler(irq, do_twl4030_gpio_irq); - set_irq_flags(irq, IRQF_VALID); + set_irq_chip_and_handler(irq, twl4030_gpio_irq_chip, + do_twl4030_gpio_irq); + activate_irq(irq); } /* gpio module IRQ */ @@ -919,13 +924,10 @@ static int __devexit gpio_twl4030_remove(struct platform_device *pdev) /* uninstall the gpio demultiplexing interrupt handler */ irq = platform_get_irq(pdev, 0); set_irq_handler(irq, NULL); - set_irq_flags(irq, 0); /* uninstall the irq handler for each of the gpio interrupts */ - for (irq = twl4030_gpio_irq_base; irq twl4030_gpio_irq_end; irq++) { + for (irq = twl4030_gpio_irq_base; irq twl4030_gpio_irq_end; irq++) set_irq_handler(irq, NULL); - set_irq_flags(irq, 0); - } /* stop the gpio unmask kernel thread */ if (gpio_unmask_thread) { diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h index f26fda1..56a9415 100644 --- a/include/linux/i2c/twl4030.h +++ b/include/linux/i2c/twl4030.h @@ -138,17 +138,11 @@ struct twl4030_platform_data { /* TWL4030 GPIO interrupt definitions */ -#define TWL4030_GPIO_MIN 0 #define TWL4030_GPIO_MAX 18 -#define TWL4030_GPIO_MAX_CD2 #define TWL4030_GPIO_IRQ_NO(n) (TWL4030_GPIO_IRQ_BASE + (n)) -#define TWL4030_GPIO_IS_INPUT 1 -#define TWL4030_GPIO_IS_OUTPUT 0 #define TWL4030_GPIO_IS_ENABLE 1 -#define TWL4030_GPIO_IS_DISABLE0 #define TWL4030_GPIO_PULL_UP 0 #define TWL4030_GPIO_PULL_DOWN 1 -#define TWL4030_GPIO_PULL_NONE 2 /* Functions to read and write from TWL4030 */ -- 1.6.0.1.196.g01914 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 21/25] twl4030-core: portability updates
From: David Brownell [EMAIL PROTECTED] Improve handling of the OMAP-specific setup in twl4030-core, and remove various warnings on non-OMAP builds. The main remaining portability problem for this core code (from a build perspective) is needing symbols like TWL4030_PWR_IRQ_BASE which are undesirable and platform-specific. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-core.c | 34 -- 1 files changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index 43424a8..efba776 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -75,6 +75,19 @@ #define twl_has_usb() false #endif +static inline void activate_irq(int irq) +{ +#ifdef CONFIG_ARM + /* ARM requires an extra step to clear IRQ_NOREQUEST, which it +* sets on behalf of every irq_chip. Also sets IRQ_NOPROBE. +*/ + set_irq_flags(irq, IRQF_VALID); +#else + /* same effect on other architectures */ + set_irq_noprobe(irq); +#endif +} + /* Primary Interrupt Handler on TWL4030 Registers */ /* Register Definitions */ @@ -584,7 +597,7 @@ static unsigned twl4030_irq_base; */ static int twl4030_irq_thread(void *data) { - int irq = (int)data; + long irq = (long)data; irq_desc_t *desc = irq_desc + irq; static unsigned i2c_errors; const static unsigned max_i2c_errors = 100; @@ -868,15 +881,15 @@ err: return status; } -static struct task_struct * __init start_twl4030_irq_thread(int irq) +static struct task_struct * __init start_twl4030_irq_thread(long irq) { struct task_struct *thread; init_completion(irq_event); thread = kthread_run(twl4030_irq_thread, (void *)irq, -twl4030 irq %d, irq); +twl4030 irq %ld, irq); if (!thread) - pr_err(%s: could not create twl4030 irq %d thread!\n, + pr_err(%s: could not create twl4030 irq %ld thread!\n, DRIVER_NAME, irq); return thread; @@ -909,16 +922,18 @@ static int __init unprotect_pm_master(void) static int __init power_companion_init(void) { int e = 0; - -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) struct clk *osc; u32 rate; u8 ctrl = HFCLK_FREQ_26_MHZ; +#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) if (cpu_is_omap2430()) osc = clk_get(NULL, osc_ck); else osc = clk_get(NULL, osc_sys_ck); +#else + osc = ERR_PTR(-EIO); +#endif if (IS_ERR(osc)) { printk(KERN_WARNING Skipping twl4030 internal clock init and using bootloader value (unknown osc rate)\n); @@ -945,7 +960,6 @@ static int __init power_companion_init(void) /* effect-MADC+USB ck en */ e |= twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, ctrl, R_CFG_BOOT); e |= protect_pm_master(); -#endif /* OMAP */ return e; } @@ -1051,9 +1065,9 @@ static void twl_init_irq(int irq_num, unsigned irq_base, unsigned irq_end) /* install an irq handler for each of the PIH modules */ for (i = irq_base; i irq_end; i++) { - set_irq_chip(i, twl4030_irq_chip); - set_irq_handler(i, do_twl4030_module_irq); - set_irq_flags(i, IRQF_VALID); + set_irq_chip_and_handler(i, twl4030_irq_chip, + do_twl4030_module_irq); + activate_irq(i); } /* install an irq handler to demultiplex the TWL4030 interrupt */ -- 1.6.0.1.196.g01914 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 25/25] twl4030-gpio: beagle pull up/down init
From: David Brownell [EMAIL PROTECTED] Better TWL init on Beagle: use the setup() callback to learn IRQ assignments; and configure pullups/pulldowns. Signed-off-by: David Brownell [EMAIL PROTECTED] --- arch/arm/mach-omap2/board-omap3beagle.c | 26 +- 1 files changed, 21 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index aa5e9a6..98bdaf2 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -114,15 +114,31 @@ static struct twl4030_usb_data beagle_usb_data = { .usb_mode = T2_USB_MODE_ULPI, }; +static int beagle_twl_gpio_setup(struct device *dev, + unsigned gpio, unsigned ngpio) +{ + /* request_gpio(gpio + 0, mmc0_cd); +* gpio_direction_input(gpio + 0); +*/ + + gpio_request(gpio + 1, EHCI_nOC); + gpio_direction_input(gpio + 1); + + /* gpio + 18 + 0 == ledA, nEN_USB_PWR (out) +* gpio + 18 + 1 == ledB, PMU_STAT (out, a LED) +*/ + + return 0; +} + static struct twl4030_gpio_platform_data beagle_gpio_data = { .gpio_base = OMAP_MAX_GPIO_LINES, .irq_base = TWL4030_GPIO_IRQ_BASE, .irq_end= TWL4030_GPIO_IRQ_END, - - /* REVISIT: setup() should use twl gpio index -* - 0 as MMC card detect, -* - 1 as EHCI port overcurrent (active low) -*/ + .pullups= BIT(1), + .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13) + | BIT(15) | BIT(16) | BIT(17), + .setup = beagle_twl_gpio_setup, }; static struct twl4030_platform_data beagle_twldata = { -- 1.6.0.1.196.g01914 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 19/25] twl4030-gpio: remove legacy irq triggering calls and user
From: David Brownell [EMAIL PROTECTED] Make the hsmmc code use genirq interfaces to make sure the card detect IRQ triggers on both edges. Remove the older TWL-specific infrastructure for making that happen. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/mach-omap2/hsmmc.c |5 - drivers/gpio/twl4030-gpio.c | 39 +-- drivers/mmc/host/omap_hsmmc.c |4 +++- include/linux/i2c/twl4030.h |4 4 files changed, 12 insertions(+), 40 deletions(-) diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index 32b517b..cc67a1d 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c @@ -65,11 +65,6 @@ static int hsmmc_late_init(struct device *dev) if (ret) goto err; - ret = twl4030_set_gpio_edge_ctrl(MMC1_CD_IRQ, - TWL4030_GPIO_EDGE_RISING | TWL4030_GPIO_EDGE_FALLING); - if (ret) - goto err; - ret = twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x02, TWL_GPIO_PUPDCTR1); if (ret) diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c index e709fbb..1ba3404 100644 --- a/drivers/gpio/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c @@ -509,10 +509,7 @@ int twl4030_set_gpio_pull(int gpio, int pull_dircn) } #endif -/* - * Configure Edge control for a GPIO pin on TWL4030 - */ -int twl4030_set_gpio_edge_ctrl(int gpio, int edge) +static int twl4030_set_gpio_edge_ctrl(int gpio, int edge) { u8 c_bnk = GET_GPIO_CTL_BANK(gpio); u8 c_off = GET_GPIO_CTL_OFF(gpio); @@ -521,33 +518,26 @@ int twl4030_set_gpio_edge_ctrl(int gpio, int edge) u8 base = 0; int ret = 0; - if (unlikely((gpio = TWL4030_GPIO_MAX) - || !(gpio_usage_count (0x1 gpio - return -EPERM; - base = REG_GPIO_EDR1 + c_bnk; - if (edge TWL4030_GPIO_EDGE_RISING) + if (edge IRQ_TYPE_EDGE_RISING) c_msk |= MASK_GPIO_EDR1_GPIOxRISING(c_off); - - if (edge TWL4030_GPIO_EDGE_FALLING) + if (edge IRQ_TYPE_EDGE_FALLING) c_msk |= MASK_GPIO_EDR1_GPIOxFALLING(c_off); mutex_lock(gpio_lock); ret = gpio_twl4030_read(base); if (ret = 0) { /* clear the previous rising/falling values */ - reg = - (u8) (ret - ~(MASK_GPIO_EDR1_GPIOxFALLING(c_off) | - MASK_GPIO_EDR1_GPIOxRISING(c_off))); + reg = (u8) ret; + reg = ~( MASK_GPIO_EDR1_GPIOxFALLING(c_off) + | MASK_GPIO_EDR1_GPIOxRISING(c_off)); reg |= c_msk; ret = gpio_twl4030_write(base, reg); } mutex_unlock(gpio_lock); return ret; } -EXPORT_SYMBOL(twl4030_set_gpio_edge_ctrl); /* * Configure debounce timing value for a GPIO pin on TWL4030 @@ -652,7 +642,7 @@ static int twl4030_gpio_unmask_thread(void *data) gpio_trigger; gpio_trigger = 1, irq++) { struct irq_desc *desc; - unsigned type, edge; + unsigned type; if (!(gpio_trigger 0x1)) continue; @@ -662,19 +652,8 @@ static int twl4030_gpio_unmask_thread(void *data) type = desc-status IRQ_TYPE_SENSE_MASK; spin_unlock_irq(desc-lock); - switch (type) { - case IRQ_TYPE_EDGE_RISING: - edge = TWL4030_GPIO_EDGE_RISING; - break; - case IRQ_TYPE_EDGE_FALLING: - edge = TWL4030_GPIO_EDGE_FALLING; - break; - default: - edge = TWL4030_GPIO_EDGE_RISING - | TWL4030_GPIO_EDGE_FALLING; - break; - } - twl4030_set_gpio_edge_ctrl(irq, edge); + twl4030_set_gpio_edge_ctrl(irq - twl4030_gpio_irq_base, + type); } local_irq_disable(); diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 9a007ca..00b1b68 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -928,7 +928,9 @@ static int __init omap_mmc_probe(struct platform_device *pdev) /* Request IRQ for card detect */ if ((mmc_slot(host).card_detect_irq) (mmc_slot(host).card_detect)) { ret = request_irq(mmc_slot(host).card_detect_irq, - omap_mmc_cd_handler, IRQF_DISABLED, +
[PATCH 18/25] twl4030-gpio irq_chip.set_type
From: David Brownell [EMAIL PROTECTED] Make twl4030 GPIO support set_type() request. Plus a bit of cleanup for the simple functions. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/gpio/twl4030-gpio.c | 84 +- 1 files changed, 74 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c index b65d476..e709fbb 100644 --- a/drivers/gpio/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c @@ -153,6 +153,9 @@ static unsigned int gpio_imr_shadow; /* bitmask of pending requests to unmask gpio interrupts */ static unsigned int gpio_pending_unmask; +/* bitmask of requests to set gpio irq trigger type */ +static unsigned int gpio_pending_trigger; + /* pointer to gpio unmask thread struct */ static struct task_struct *gpio_unmask_thread; @@ -241,10 +244,15 @@ static void twl4030_gpio_unmask(unsigned int irq) * controller to a kernel thread. We only need to support the unmask method. */ -static void twl4030_gpio_mask_and_ack_irqchip(unsigned int irq) {} -static void twl4030_gpio_mask_irqchip(unsigned int irq) {} +static void twl4030_gpio_irq_mask_and_ack(unsigned int irq) +{ +} + +static void twl4030_gpio_irq_mask(unsigned int irq) +{ +} -static void twl4030_gpio_unmask_irqchip(unsigned int irq) +static void twl4030_gpio_irq_unmask(unsigned int irq) { int gpio = irq - twl4030_gpio_irq_base; @@ -253,11 +261,36 @@ static void twl4030_gpio_unmask_irqchip(unsigned int irq) wake_up_process(gpio_unmask_thread); } +static int twl4030_gpio_irq_set_type(unsigned int irq, unsigned trigger) +{ + struct irq_desc *desc = irq_desc + irq; + int gpio = irq - twl4030_gpio_irq_base; + + trigger = IRQ_TYPE_SENSE_MASK; + if (trigger ~IRQ_TYPE_EDGE_BOTH) + return -EINVAL; + if ((desc-status IRQ_TYPE_SENSE_MASK) == trigger) + return 0; + + desc-status = ~IRQ_TYPE_SENSE_MASK; + desc-status |= trigger; + + /* REVISIT This makes the unmask thread do double duty, +* updating IRQ trigger modes too. Rename appropriately... +*/ + gpio_pending_trigger |= (1 gpio); + if (gpio_unmask_thread gpio_unmask_thread-state != TASK_RUNNING) + wake_up_process(gpio_unmask_thread); + + return 0; +} + static struct irq_chip twl4030_gpio_irq_chip = { - .name = twl4030, - .ack= twl4030_gpio_mask_and_ack_irqchip, - .mask = twl4030_gpio_mask_irqchip, - .unmask = twl4030_gpio_unmask_irqchip, + .name = twl4030, + .ack= twl4030_gpio_irq_mask_and_ack, + .mask = twl4030_gpio_irq_mask, + .unmask = twl4030_gpio_irq_unmask, + .set_type = twl4030_gpio_irq_set_type, }; /* @@ -478,8 +511,6 @@ int twl4030_set_gpio_pull(int gpio, int pull_dircn) /* * Configure Edge control for a GPIO pin on TWL4030 - * - * FIXME this should just be the irq_chip.set_type() method */ int twl4030_set_gpio_edge_ctrl(int gpio, int edge) { @@ -601,10 +632,14 @@ static int twl4030_gpio_unmask_thread(void *data) while (!kthread_should_stop()) { int irq; unsigned int gpio_unmask; + unsigned int gpio_trigger; local_irq_disable(); gpio_unmask = gpio_pending_unmask; gpio_pending_unmask = 0; + + gpio_trigger = gpio_pending_trigger; + gpio_pending_trigger = 0; local_irq_enable(); for (irq = twl4030_gpio_irq_base; 0 != gpio_unmask; @@ -613,8 +648,37 @@ static int twl4030_gpio_unmask_thread(void *data) twl4030_gpio_unmask(irq); } + for (irq = twl4030_gpio_irq_base; + gpio_trigger; + gpio_trigger = 1, irq++) { + struct irq_desc *desc; + unsigned type, edge; + + if (!(gpio_trigger 0x1)) + continue; + + desc = irq_desc + irq; + spin_lock_irq(desc-lock); + type = desc-status IRQ_TYPE_SENSE_MASK; + spin_unlock_irq(desc-lock); + + switch (type) { + case IRQ_TYPE_EDGE_RISING: + edge = TWL4030_GPIO_EDGE_RISING; + break; + case IRQ_TYPE_EDGE_FALLING: + edge = TWL4030_GPIO_EDGE_FALLING; + break; + default: + edge = TWL4030_GPIO_EDGE_RISING + | TWL4030_GPIO_EDGE_FALLING; + break; + } +
[PATCH 10/25] minor twl4030-core cleanups
From: David Brownell [EMAIL PROTECTED] Minor twl4030-core cleanups: alphabetize the creation of the new sub-function nodes; wrap an #if around the OMAP-only part (to get more general build testing when this goes upstream); remove reference to undocumented twl3040 variant. Signed-off-by: David Brownell [EMAIL PROTECTED] Moved gpio before keypad driver due to alphabetic order. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-core.c | 103 +++-- 1 files changed, 53 insertions(+), 50 deletions(-) diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index 79d4d82..22850a8 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -45,24 +45,12 @@ #define DRIVER_NAMEtwl4030 -#if defined(CONFIG_RTC_DRV_TWL4030) || defined(CONFIG_RTC_DRV_TWL4030_MODULE) -#define twl_has_rtc() true -#else -#define twl_has_rtc() false -#endif - #if defined(CONFIG_KEYBOARD_TWL4030) || defined(CONFIG_KEYBOARD_TWL4030_MODULE) #define twl_has_keypad() true #else #define twl_has_keypad() false #endif -#if defined(CONFIG_TWL4030_USB) || defined(CONFIG_TWL4030_USB_MODULE) -#define twl_has_usb() true -#else -#define twl_has_usb() false -#endif - #ifdef CONFIG_TWL4030_GPIO #define twl_has_gpio() true #else @@ -75,6 +63,18 @@ #define twl_has_madc() false #endif +#if defined(CONFIG_RTC_DRV_TWL4030) || defined(CONFIG_RTC_DRV_TWL4030_MODULE) +#define twl_has_rtc() true +#else +#define twl_has_rtc() false +#endif + +#if defined(CONFIG_TWL4030_USB) || defined(CONFIG_TWL4030_USB_MODULE) +#define twl_has_usb() true +#else +#define twl_has_usb() false +#endif + /* Primary Interrupt Handler on TWL4030 Registers */ /* Register Definitions */ @@ -706,27 +706,18 @@ static int add_children(struct twl4030_platform_data *pdata) } } - if (twl_has_rtc()) { - pdev = platform_device_alloc(twl4030_rtc, -1); + if (twl_has_keypad() pdata-keypad) { + pdev = platform_device_alloc(twl4030_keypad, -1); if (pdev) { - twl = twl4030_modules[TWL4030_SLAVENUM_NUM3]; + twl = twl4030_modules[TWL4030_SLAVENUM_NUM2]; pdev-dev.parent = twl-client-dev; device_init_wakeup(pdev-dev, 1); - - /* -* FIXME add the relevant IRQ resource, and make the -* rtc driver use it instead of hard-wiring ... -* -* REVISIT platform_data here currently only supports -* setting up the msecure line ... which actually -* violates the princple of least privilege, since -* it's effectively always in high trust mode. -* -* For now, expect equivalent treatment at board init: -* setting msecure high. Eventually, Linux might -* become more aware of those HW security concerns. -*/ - + status = platform_device_add_data(pdev, pdata-keypad, + sizeof(*pdata-keypad)); + if (status 0) { + platform_device_put(pdev); + goto err; + } status = platform_device_add(pdev); if (status 0) platform_device_put(pdev); @@ -736,14 +727,14 @@ static int add_children(struct twl4030_platform_data *pdata) } } - if (twl_has_keypad() pdata-keypad) { - pdev = platform_device_alloc(twl4030_keypad, -1); + if (twl_has_madc() pdata-madc) { + pdev = platform_device_alloc(twl4030_madc, -1); if (pdev) { twl = twl4030_modules[TWL4030_SLAVENUM_NUM2]; pdev-dev.parent = twl-client-dev; device_init_wakeup(pdev-dev, 1); - status = platform_device_add_data(pdev, pdata-keypad, - sizeof(*pdata-keypad)); + status = platform_device_add_data(pdev, pdata-madc, + sizeof(*pdata-madc)); if (status 0) { platform_device_put(pdev); goto err; @@ -757,18 +748,27 @@ static int add_children(struct twl4030_platform_data *pdata) } } - if (twl_has_usb() pdata-usb) { - pdev = platform_device_alloc(twl4030_usb, -1); + if (twl_has_rtc()) { + pdev = platform_device_alloc(twl4030_rtc, -1); if (pdev) { -
[PATCH 14/25] minor irq-related cleanups
From: David Brownell [EMAIL PROTECTED] Minor IRQ-related cleanups: comment out the no-longer-used GPIO irq symbol (more to come, eventually); create RTC IRQ resource; and use that RTC IRQ resource. And incidentally, make the RTC code free the correct IRQ; it was pretty goofed up... Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/gpio/twl4030-gpio.c |1 - drivers/i2c/chips/twl4030-core.c | 57 + drivers/rtc/rtc-twl4030.c| 11 +-- include/linux/i2c/twl4030.h |2 +- 4 files changed, 41 insertions(+), 30 deletions(-) diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c index 2949da1..b65d476 100644 --- a/drivers/gpio/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c @@ -49,7 +49,6 @@ /* REVISIT when these symbols vanish elsewhere, remove them here too */ /* #undef TWL4030_GPIO_IRQ_BASE */ /* #undef TWL4030_GPIO_IRQ_END */ -#undef TWL4030_MODIRQ_GPIO static struct gpio_chip twl_gpiochip; static int twl4030_gpio_irq_base; diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index 80cf231..e0a6ef4 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -776,37 +776,44 @@ static int add_children(struct twl4030_platform_data *pdata) } if (twl_has_rtc()) { + twl = twl4030_modules[TWL4030_SLAVENUM_NUM3]; + pdev = platform_device_alloc(twl4030_rtc, -1); - if (pdev) { - twl = twl4030_modules[TWL4030_SLAVENUM_NUM3]; + if (!pdev) { + pr_debug(%s: can't alloc rtc dev\n, DRIVER_NAME); + status = -ENOMEM; + } else { pdev-dev.parent = twl-client-dev; device_init_wakeup(pdev-dev, 1); + } - /* -* FIXME add the relevant IRQ resource, and make the -* rtc driver use it instead of hard-wiring ... -* -* REVISIT platform_data here currently only supports -* setting up the msecure line ... which actually -* violates the princple of least privilege, since -* it's effectively always in high trust mode. -* -* For now, expect equivalent treatment at board init: -* setting msecure high. Eventually, Linux might -* become more aware of those HW security concerns. -*/ + /* +* REVISIT platform_data here currently might use of +* msecure line ... but for now we just expect board +* setup to tell the chip we are secure at all times. +* Eventually, Linux might become more aware of such +* HW security concerns, and least privilege. +*/ + + /* RTC module IRQ */ + if (status == 0) { + struct resource r = { + /* REVISIT don't hard-wire this stuff */ + .start = TWL4030_PWRIRQ_RTC, + .flags = IORESOURCE_IRQ, + }; + + status = platform_device_add_resources(pdev, r, 1); + } + if (status == 0) status = platform_device_add(pdev); - if (status 0) { - platform_device_put(pdev); - dev_dbg(twl-client-dev, - can't create rtc dev, %d\n, - status); - goto err; - } - } else { - pr_debug(%s: can't alloc rtc dev\n, DRIVER_NAME); - status = -ENOMEM; + + if (status 0) { + platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't create rtc dev, %d\n, + status); goto err; } } diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c index 98aea07..b19151a 100644 --- a/drivers/rtc/rtc-twl4030.c +++ b/drivers/rtc/rtc-twl4030.c @@ -353,8 +353,12 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev) struct twl4030rtc_platform_data *pdata = pdev-dev.platform_data; struct rtc_device *rtc; int ret = 0; + int irq = platform_get_irq(pdev, 0); u8 rd_reg; + if (irq 0) + return irq; + if (pdata != NULL pdata-init != NULL) { ret
[PATCH 24/25] twl4030-gpio: pullup/pulldown init
From: David Brownell [EMAIL PROTECTED] Finish moving initialization of pullups and pulldowns for twl4030 GPIOs into board specific init. Remove partial/incorrect init code for that from the hsmmc glue. Doing this right requires some attention from board init logic, based on how the TWL chip is wired. Letting digital inputs float will waste power. Everyone with board schematics should update their board init code so it matches their boards; meanwhile, this returns to current behavior (all pullups disabled) but finally offers a way to do it right. Note that the ULPI pins won't need this attention (muxed against gpio{3-5,9-12,14} pins), and neither will ones with external pullups or pulldowns (conventional for MMC/SD card detect). Signed-off-by: David Brownell [EMAIL PROTECTED] --- arch/arm/mach-omap2/hsmmc.c |6 --- drivers/gpio/twl4030-gpio.c | 78 ++- include/linux/i2c/twl4030.h |7 +++- 3 files changed, 46 insertions(+), 45 deletions(-) diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index cc67a1d..c6ff490 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c @@ -27,7 +27,6 @@ #define VMMC1_DEDICATED0x2A #define VSEL_3V0x02 #define VSEL_18V 0x00 -#define TWL_GPIO_PUPDCTR1 0x13 #define TWL_GPIO_IMR1A 0x1C #define TWL_GPIO_ISR1A 0x19 #define LDO_CLR0x00 @@ -65,11 +64,6 @@ static int hsmmc_late_init(struct device *dev) if (ret) goto err; - ret = twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x02, - TWL_GPIO_PUPDCTR1); - if (ret) - goto err; - ret = twl4030_set_gpio_debounce(MMC1_CD_IRQ, TWL4030_GPIO_IS_ENABLE); if (ret) goto err; diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c index 40abcbd..47dc6e2 100644 --- a/drivers/gpio/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c @@ -476,44 +476,6 @@ int twl4030_get_gpio_datain(int gpio) } EXPORT_SYMBOL(twl4030_get_gpio_datain); -#if 0 -/* - * Configure PULL type for a GPIO pin on TWL4030 - */ -int twl4030_set_gpio_pull(int gpio, int pull_dircn) -{ - u8 c_bnk = GET_GPIO_CTL_BANK(gpio); - u8 c_off = GET_GPIO_CTL_OFF(gpio); - u8 c_msk = 0; - u8 reg = 0; - u8 base = 0; - int ret = 0; - - if (unlikely((gpio = TWL4030_GPIO_MAX) || - !(gpio_usage_count (0x1 gpio - return -EPERM; - - base = REG_GPIOPUPDCTR1 + c_bnk; - if (pull_dircn == TWL4030_GPIO_PULL_DOWN) - c_msk = MASK_GPIOPUPDCTR1_GPIOxPD(c_off); - else if (pull_dircn == TWL4030_GPIO_PULL_UP) - c_msk = MASK_GPIOPUPDCTR1_GPIOxPU(c_off); - - mutex_lock(gpio_lock); - ret = gpio_twl4030_read(base); - if (ret = 0) { - /* clear the previous up/down values */ - reg = (u8) (ret); - reg = ~(MASK_GPIOPUPDCTR1_GPIOxPU(c_off) | - MASK_GPIOPUPDCTR1_GPIOxPD(c_off)); - reg |= c_msk; - ret = gpio_twl4030_write(base, reg); - } - mutex_unlock(gpio_lock); - return ret; -} -#endif - static int twl4030_set_gpio_edge_ctrl(int gpio, int edge) { u8 c_bnk = GET_GPIO_CTL_BANK(gpio); @@ -578,6 +540,9 @@ EXPORT_SYMBOL(twl4030_set_gpio_debounce); #if 0 /* * Configure Card detect for GPIO pin on TWL4030 + * + * This means: VMMC1 or VMMC2 is enabled or disabled based + * on the status of GPIO-0 or GPIO-1 pins (respectively). */ int twl4030_set_gpio_card_detect(int gpio, int enable) { @@ -800,6 +765,31 @@ static struct gpio_chip twl_gpiochip = { /*--*/ +static int __devinit gpio_twl4030_pulls(u32 ups, u32 downs) +{ + u8 message[6]; + unsignedi, gpio_bit; + + /* For most pins, a pulldown was enabled by default. +* We should have data that's specific to this board. +*/ + for (gpio_bit = 1, i = 1; i 6; i++) { + u8 bit_mask; + unsignedj; + + for (bit_mask = 0, j = 0; j 8; j += 2, gpio_bit = 1) { + if (ups gpio_bit) + bit_mask |= 1 (j + 1); + else if (downs gpio_bit) + bit_mask |= 1 (j + 0); + } + message[i] = bit_mask; + } + + return twl4030_i2c_write(TWL4030_MODULE_GPIO, message, + REG_GPIOPUPDCTR1, 5); +} + static int gpio_twl4030_remove(struct platform_device *pdev); static int __devinit gpio_twl4030_probe(struct platform_device *pdev) @@ -875,6 +865,18 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev) no_irqs: if (!ret)
[PATCH 11/25] provide detailed diagnostics in add_children()
From: David Brownell [EMAIL PROTECTED] Provide detailed diagnostics in add_children() when DEBUG is defined ... and fix the non-DEBUG message to include minimal status, and not appear unless there was actually an error. Update the IRQ message; have it match what the GPIO subchip says, and as a precaution, make it only appear if the IRQs have been initialized. Signed-off-by: David Brownell [EMAIL PROTECTED] Added a few more diagnostics when platform_device_add() fails. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-core.c | 59 ++--- 1 files changed, 48 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index 22850a8..5dcc3b1 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -672,8 +672,10 @@ static int add_children(struct twl4030_platform_data *pdata) twl = twl4030_modules[TWL4030_SLAVENUM_NUM1]; pdev = platform_device_alloc(twl4030_gpio, -1); - if (!pdev) + if (!pdev) { + pr_debug(%s: can't alloc gpio dev\n, DRIVER_NAME); status = -ENOMEM; + } /* more driver model init */ if (status == 0) { @@ -682,6 +684,12 @@ static int add_children(struct twl4030_platform_data *pdata) status = platform_device_add_data(pdev, pdata-gpio, sizeof(*pdata-gpio)); + if (status 0) { + dev_dbg(twl-client-dev, + can't add gpio data, %d\n, + status); + goto err; + } } /* GPIO module IRQ */ @@ -715,13 +723,21 @@ static int add_children(struct twl4030_platform_data *pdata) status = platform_device_add_data(pdev, pdata-keypad, sizeof(*pdata-keypad)); if (status 0) { + dev_dbg(twl-client-dev, + can't add keypad data, %d\n, + status); platform_device_put(pdev); goto err; } status = platform_device_add(pdev); - if (status 0) + if (status 0) { platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't create keypad dev, %d\n, + status); + } } else { + pr_debug(%s: can't alloc keypad dev\n, DRIVER_NAME); status = -ENOMEM; goto err; } @@ -737,12 +753,20 @@ static int add_children(struct twl4030_platform_data *pdata) sizeof(*pdata-madc)); if (status 0) { platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't add madc data, %d\n, + status); goto err; } status = platform_device_add(pdev); - if (status 0) + if (status 0) { platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't create madc dev, %d\n, + status); + } } else { + pr_debug(%s: can't alloc madc dev\n, DRIVER_NAME); status = -ENOMEM; goto err; } @@ -770,9 +794,14 @@ static int add_children(struct twl4030_platform_data *pdata) */ status = platform_device_add(pdev); - if (status 0) + if (status 0) { platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't create rtc dev, %d\n, + status); + } } else { + pr_debug(%s: can't alloc rtc dev\n, DRIVER_NAME); status = -ENOMEM; goto err; } @@ -788,19 +817,28 @@ static int add_children(struct twl4030_platform_data *pdata)
[PATCH 15/25] i2c: switch twl4030-usb to use a resource for irq
From: Felipe Balbi [EMAIL PROTECTED] use platform_get_irq() for getting irq number passed to twl4030-usb via twl4030-core.c:add_children() Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-core.c | 38 +++--- drivers/i2c/chips/twl4030-usb.c |2 +- include/linux/i2c/twl4030.h |2 +- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index e0a6ef4..43424a8 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -819,9 +819,16 @@ static int add_children(struct twl4030_platform_data *pdata) } if (twl_has_usb() pdata-usb) { + twl = twl4030_modules[TWL4030_SLAVENUM_NUM0]; + pdev = platform_device_alloc(twl4030_usb, -1); - if (pdev) { - twl = twl4030_modules[TWL4030_SLAVENUM_NUM0]; + if (!pdev) { + pr_debug(%s: can't alloc usb dev\n, DRIVER_NAME); + status = -ENOMEM; + goto err; + } + + if (status == 0) { pdev-dev.parent = twl-client-dev; device_init_wakeup(pdev-dev, 1); status = platform_device_add_data(pdev, pdata-usb, @@ -833,16 +840,25 @@ static int add_children(struct twl4030_platform_data *pdata) status); goto err; } + } + + if (status == 0) { + struct resource r = { + .start = TWL4030_PWRIRQ_USB_PRES, + .flags = IORESOURCE_IRQ, + }; + + status = platform_device_add_resources(pdev, r, 1); + } + + if (status == 0) status = platform_device_add(pdev); - if (status 0) { - platform_device_put(pdev); - dev_dbg(twl-client-dev, - can't create usb dev, %d\n, - status); - } - } else { - pr_debug(%s: can't alloc usb dev\n, DRIVER_NAME); - status = -ENOMEM; + + if (status 0) { + platform_device_put(pdev); + dev_dbg(twl-client-dev, + can't create usb dev, %d\n, + status); } } diff --git a/drivers/i2c/chips/twl4030-usb.c b/drivers/i2c/chips/twl4030-usb.c index f530e71..133cc0f 100644 --- a/drivers/i2c/chips/twl4030-usb.c +++ b/drivers/i2c/chips/twl4030-usb.c @@ -684,7 +684,7 @@ static int __init twl4030_usb_probe(struct platform_device *pdev) vbus = USB_PRES_RISING; twl-dev= pdev-dev; - twl-irq= TWL4030_PWRIRQ_USB_PRES; + twl-irq= platform_get_irq(pdev, 0); twl-otg.set_host = twl4030_set_host; twl-otg.set_peripheral = twl4030_set_peripheral; twl-otg.set_suspend= twl4030_set_suspend; diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h index 5828485..1c79c89 100644 --- a/include/linux/i2c/twl4030.h +++ b/include/linux/i2c/twl4030.h @@ -112,7 +112,7 @@ struct twl4030_platform_data { #define TWL4030_MODIRQ_KEYPAD (TWL4030_IRQ_BASE + 1) #define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2) #define TWL4030_MODIRQ_MADC(TWL4030_IRQ_BASE + 3) -#define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) +/* #define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) */ #define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) #define TWL4030_PWRIRQ_PWRBTN (TWL4030_PWR_IRQ_BASE + 0) -- 1.6.0.1.196.g01914 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 13/25] i2c: added a few missing gotos to add_children()
From: Felipe Balbi [EMAIL PROTECTED] Previously we were failing platform_device_add_data() and returning from add_children but trying to keep going when platform_device_add() fails. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-core.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c index 4ea6444..80cf231 100644 --- a/drivers/i2c/chips/twl4030-core.c +++ b/drivers/i2c/chips/twl4030-core.c @@ -675,6 +675,7 @@ static int add_children(struct twl4030_platform_data *pdata) if (!pdev) { pr_debug(%s: can't alloc gpio dev\n, DRIVER_NAME); status = -ENOMEM; + goto err; } /* more driver model init */ @@ -735,6 +736,7 @@ static int add_children(struct twl4030_platform_data *pdata) dev_dbg(twl-client-dev, can't create keypad dev, %d\n, status); + goto err; } } else { pr_debug(%s: can't alloc keypad dev\n, DRIVER_NAME); @@ -764,6 +766,7 @@ static int add_children(struct twl4030_platform_data *pdata) dev_dbg(twl-client-dev, can't create madc dev, %d\n, status); + goto err; } } else { pr_debug(%s: can't alloc madc dev\n, DRIVER_NAME); @@ -799,6 +802,7 @@ static int add_children(struct twl4030_platform_data *pdata) dev_dbg(twl-client-dev, can't create rtc dev, %d\n, status); + goto err; } } else { pr_debug(%s: can't alloc rtc dev\n, DRIVER_NAME); @@ -832,7 +836,6 @@ static int add_children(struct twl4030_platform_data *pdata) } else { pr_debug(%s: can't alloc usb dev\n, DRIVER_NAME); status = -ENOMEM; - goto err; } } -- 1.6.0.1.196.g01914 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/25] move twl4030-gpio to drivers/gpio
From: David Brownell [EMAIL PROTECTED] Move the twl4030 GPIO support from drivers/i2c/chips to drivers/gpio, which is a more appropriate home for this code. The Kconfig symbol name is changed to match the GPIO_* convention for such symbols, so config files must change in the obvious ways (Kconfig will prompt you). There's now some helptext. It can now be compiled as a module, should anyone really want to do that; that'll be mostly useful for test builds. Sanity check the IRQ range we're given. Initialization order needed a bit of work too: core add_children() called only after IRQs get set up, gpio uses subsys_initcall. This depends on a patch making i2c driver model init use postcore_initcall. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/plat-omap/include/mach/irqs.h |2 +- drivers/gpio/Kconfig |7 + drivers/gpio/Makefile |1 + drivers/{i2c/chips = gpio}/twl4030-gpio.c | 37 +++ drivers/i2c/chips/Kconfig |4 --- drivers/i2c/chips/Makefile |1 - drivers/i2c/chips/twl4030-core.c | 12 +++-- 7 files changed, 44 insertions(+), 20 deletions(-) rename drivers/{i2c/chips = gpio}/twl4030-gpio.c (96%) diff --git a/arch/arm/plat-omap/include/mach/irqs.h b/arch/arm/plat-omap/include/mach/irqs.h index 29c92c9..8a4473e 100644 --- a/arch/arm/plat-omap/include/mach/irqs.h +++ b/arch/arm/plat-omap/include/mach/irqs.h @@ -369,7 +369,7 @@ /* External TWL4030 gpio interrupts are optional */ #define TWL4030_GPIO_IRQ_BASE TWL4030_PWR_IRQ_END -#ifdef CONFIG_TWL4030_GPIO +#ifdef CONFIG_GPIO_TWL4030 #define TWL4030_GPIO_NR_IRQS 18 #else #defineTWL4030_GPIO_NR_IRQS0 diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index dbd42d6..293b4a7 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -127,6 +127,13 @@ config GPIO_PCF857X This driver provides an in-kernel interface to those GPIOs using platform-neutral GPIO calls. +config GPIO_TWL4030 + tristate TWL4030/TPS659x0 GPIO Driver + depends on TWL4030_CORE GPIOLIB + help + Say yes here to access the GPIO signals of various multi-function + power management chips from Texas Instruments. + comment PCI GPIO expanders: config GPIO_BT8XX diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 01b4bbd..6aafdeb 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -9,4 +9,5 @@ obj-$(CONFIG_GPIO_MAX732X) += max732x.o obj-$(CONFIG_GPIO_MCP23S08)+= mcp23s08.o obj-$(CONFIG_GPIO_PCA953X) += pca953x.o obj-$(CONFIG_GPIO_PCF857X) += pcf857x.o +obj-$(CONFIG_GPIO_TWL4030) += twl4030-gpio.o obj-$(CONFIG_GPIO_BT8XX) += bt8xxgpio.o diff --git a/drivers/i2c/chips/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c similarity index 96% rename from drivers/i2c/chips/twl4030-gpio.c rename to drivers/gpio/twl4030-gpio.c index 0d4dd28..2949da1 100644 --- a/drivers/i2c/chips/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c @@ -1,5 +1,5 @@ /* - * linux/drivers/i2c/chips/twl4030_gpio.c + * twl4030_gpio.c -- access to GPIOs on TWL4030/TPS659x0 chips * * Copyright (C) 2006-2007 Texas Instruments, Inc. * Copyright (C) 2006 MontaVista Software, Inc. @@ -23,7 +23,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * */ #include linux/module.h @@ -48,14 +47,19 @@ /* REVISIT when these symbols vanish elsewhere, remove them here too */ -#undef TWL4030_GPIO_IRQ_BASE -#undef TWL4030_GPIO_IRQ_END +/* #undef TWL4030_GPIO_IRQ_BASE */ +/* #undef TWL4030_GPIO_IRQ_END */ #undef TWL4030_MODIRQ_GPIO static struct gpio_chip twl_gpiochip; static int twl4030_gpio_irq_base; static int twl4030_gpio_irq_end; +#ifdef MODULE +#define is_module()true +#else +#define is_module()false +#endif /* BitField Definitions */ @@ -765,7 +769,24 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev) twl4030_gpio_irq_base = pdata-irq_base; twl4030_gpio_irq_end = pdata-irq_end; - /* REVISIT skip most of this if the irq range is empty... */ + if ((twl4030_gpio_irq_end - twl4030_gpio_irq_base) 0) { + if (is_module()) { + dev_err(pdev-dev, + can't dispatch IRQs from modules\n); + goto no_irqs; + } + if (twl4030_gpio_irq_end NR_IRQS) { + dev_err(pdev-dev, + last IRQ is too large: %d\n, + twl4030_gpio_irq_end); + return -EINVAL; + } + } else { + dev_notice(pdev-dev, + no
[PATCH 17/25] i2c: minor cleanups to twl4030-pwrbutton.c
From: Felipe Balbi [EMAIL PROTECTED] Trivial brainless fixes, a few unused headers removed, changed one printk to pr_err() and removed one comment. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- drivers/i2c/chips/twl4030-pwrbutton.c | 10 +- 1 files changed, 1 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/chips/twl4030-pwrbutton.c b/drivers/i2c/chips/twl4030-pwrbutton.c index d86d489..9a361b3 100644 --- a/drivers/i2c/chips/twl4030-pwrbutton.c +++ b/drivers/i2c/chips/twl4030-pwrbutton.c @@ -26,9 +26,6 @@ #include linux/kernel.h #include linux/errno.h #include linux/input.h -#include linux/timer.h -#include linux/jiffies.h -#include linux/kthread.h #include linux/interrupt.h #include linux/i2c/twl4030.h @@ -47,11 +44,6 @@ static struct input_dev *powerbutton_dev; -/* - * Note : the following function runs in kernel thread context - * with IRQs enabled - */ - static irqreturn_t powerbutton_irq(int irq, void *dev_id) { int err; @@ -63,7 +55,7 @@ static irqreturn_t powerbutton_irq(int irq, void *dev_id) input_report_key(powerbutton_dev, KEY_POWER, value PWR_PWRON_IRQ); } else { - printk(KERN_WARNING I2C error %d while reading TWL4030 + pr_err(twl4030: i2c error %d while reading TWL4030 PM_MASTER STS_HW_CONDITIONS register\n, err); } -- 1.6.0.1.196.g01914 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 23/25] twl4030-bci: move to new style registration method
From: Felipe Balbi [EMAIL PROTECTED] twl4030_bci_battery.c is now moved to new style registration of twl4030 children. During the process a few bugfixes came, the main one is that twl4030-bci was releasing the wrong irq if battery registration had failed. Signed-off-by: Felipe Balbi [EMAIL PROTECTED] --- arch/arm/mach-omap2/Makefile |4 +-- arch/arm/mach-omap2/bci.c | 57 - arch/arm/mach-omap2/board-3430sdp.c | 18 ++- arch/arm/mach-omap2/board-ldp.c | 18 ++- arch/arm/plat-omap/include/mach/bci.h | 17 -- drivers/i2c/chips/twl4030-core.c | 50 + drivers/power/twl4030_bci_battery.c | 25 +-- include/linux/i2c/twl4030.h |5 +++ 8 files changed, 105 insertions(+), 89 deletions(-) delete mode 100644 arch/arm/mach-omap2/bci.c delete mode 100644 arch/arm/plat-omap/include/mach/bci.h diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index e18da0c..33de217 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -54,8 +54,7 @@ obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o \ hsmmc.o \ usb-musb.o \ usb-ehci.o \ - board-3430sdp-flash.o \ - bci.o + board-3430sdp-flash.o obj-$(CONFIG_MACH_OMAP3EVM)+= board-omap3evm.o \ hsmmc.o \ usb-musb.o usb-ehci.o \ @@ -65,7 +64,6 @@ obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o \ hsmmc.o obj-$(CONFIG_MACH_OMAP_LDP)+= board-ldp.o \ hsmmc.o \ - bci.o \ usb-musb.o obj-$(CONFIG_MACH_OMAP_APOLLON)+= board-apollon.o \ board-apollon-mmc.o \ diff --git a/arch/arm/mach-omap2/bci.c b/arch/arm/mach-omap2/bci.c deleted file mode 100644 index 9b9f9d2..000 --- a/arch/arm/mach-omap2/bci.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * linux/arch/arm/mach-omap2/bci.c - * - * TWL4030 BCI platform device setup/initialization - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#include linux/module.h -#include linux/kernel.h -#include linux/init.h -#include linux/platform_device.h -#include mach/bci.h - -#if defined(CONFIG_TWL4030_BCI_BATTERY) || \ - defined(CONFIG_TWL4030_BCI_BATTERY_MODULE) -/* - * Thermistor Calibration for Current Source and MADC - * Tolerance (for THS05-3H103F) - */ -static int sdp3430_batt_table[] = { -/* 0 C*/ -30800, 29500, 28300, 27100, -26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900, -17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100, -11600, 11200, 10800, 10400, 1, 9630, 9280, 8950, 8620, 8310, -8020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830, -5640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170, -4040, 3910, 3790, 3670, 3550 -}; - -static struct twl4030_bci_platform_data sdp3430_bci_data = { - .battery_tmp_tbl = sdp3430_batt_table, - .tblsize = ARRAY_SIZE(sdp3430_batt_table), -}; - -static struct platform_device twl4030_bci_battery_device = { - .name = twl4030-bci-battery, - .id = -1, - .dev= { - .platform_data = sdp3430_bci_data, - }, - .num_resources = 0, -}; - -void __init twl4030_bci_battery_init(void) -{ - (void) platform_device_register(twl4030_bci_battery_device); -} -#else -void __init twl4030_bci_battery_init(void) -{ -} -#endif diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 661d5d0..4264b68 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -300,6 +300,22 @@ static struct omap_board_config_kernel sdp3430_config[] __initdata = { { OMAP_TAG_LCD, sdp3430_lcd_config }, }; +static int sdp3430_batt_table[] = { +/* 0 C*/ +30800, 29500, 28300, 27100, +26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900, +17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100, +11600, 11200, 10800, 10400, 1, 9630, 9280, 8950, 8620, 8310, +8020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830, +5640, 5450, 5260, 5090, 4920, 4760, 4600, 4450,
Re: Soft lockup when disconnecting musb isochronous device.
Ajay, that did the trick. Thanks so much for pointing that out. My Logitech Quickcam 9000 is now rock solid with high speed iso capture. - Nathan On Mon, Sep 29, 2008 at 11:03 PM, Gupta, Ajay Kumar [EMAIL PROTECTED] wrote: I've been trying to get the UVC camera driver working in linux-omap on the Beagleboard, which uses musb. With the latest linux-omap git, capture doesn't work. Applying Ajay Gupta's MUSB patches posted here on 9/8 allows capture to work until the device is closed. With or without Ajay's patches, when the device is closed, the following lockup occurs. Let me know if there is anything I can do to help debug this. Have you applied below patch posted on 25/08/2008? [PATCH v3] OMAP: MUSB: Corrects urb unlink function path This patch is accepted and is pending to be merged with latest OMAP GIT. Regards, Ajay BUG: soft lockup - CPU#0 stuck for 61s! [mjpg_streamer:1770] Modules linked in: ipv6 pegasus uvcvideo compat_ioctl32 videodev v4l1_compat Pid: 1770, comm:mjpg_streamer CPU: 0Not tainted (2.6.27-rc7-omap1 #4) PC is at __mutex_lock_slowpath+0x1ec/0x204 LR is at __mutex_lock_slowpath+0x1c4/0x204 pc : [c0320fa0]lr : [c0320f78]psr: 6013 sp : c7265ca0 ip : c7265ca0 fp : c7265cd4 r10: c79eb400 r9 : c7128218 r8 : c78a6a08 r7 : c78df9c0 r6 : 6013 r5 : c0437690 r4 : c7265ca4 r3 : r2 : r1 : c7264000 r0 : c0437690 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 00c5387f Table: 87348018 DAC: 0015 [c0034ca8] (show_regs+0x0/0x50) from [c007959c] (softlockup_tick+0x100/0x140) r5:00bc r4:007f [c007949c] (softlockup_tick+0x0/0x140) from [c005c08c] (run_local_timers+0x1c/0x20) [c005c070] (run_local_timers+0x0/0x20) from [c005c4e8] (update_process_times+0x30/0x5c) [c005c4b8] (update_process_times+0x0/0x5c) from [c006f138] (tick_sched_timer+0x8c/0xd8) r5:c7265c58 r4:c044d630 [c006f0ac] (tick_sched_timer+0x0/0xd8) from [c0069090] (__run_hrtimer+0x58/0x94) r7:c0425e60 r6:c044d630 r5:c0425e60 r4:c044d630 [c0069038] (__run_hrtimer+0x0/0x94) from [c0069c64] (hrtimer_interrupt+0x130/0x1a0) r5:00b9 r4:183847b0 [c0069b34] (hrtimer_interrupt+0x0/0x1a0) from [c003d248] (omap2_gp_timer_interrupt+0x28/0x34) [c003d220] (omap2_gp_timer_interrupt+0x0/0x34) from [c0079a58] (handle_IRQ_event+0x3c/0x74) [c0079a1c] (handle_IRQ_event+0x0/0x74) from [c007b2a4] (handle_level_irq+0xd4/0xf0) r7:c78df9c0 r6: r5:005f r4:c04279a8 [c007b1d0] (handle_level_irq+0x0/0xf0) from [c0033048] (__exception_text_start+0x48/0x64) r5:c04279a8 r4:005f [c0033000] (__exception_text_start+0x0/0x64) from [c0033830] (__irq_svc+0x30/0x80) Exception stack(0xc7265c58 to 0xc7265ca0) 5c40: c0437690 c7264000 5c60: c7265ca4 c0437690 6013 c78df9c0 c78a6a08 c7128218 5c80: c79eb400 c7265cd4 c7265ca0 c7265ca0 c0320f78 c0320fa0 6013 r7:c78df9c0 r6:6013 r5:d820 r4: [c0320db4] (__mutex_lock_slowpath+0x0/0x204) from [c0320fc8] (mutex_lock+0x10/0x14) r7:c7893000 r6:c7170c00 r5:c7170c00 r4:c791c738 [c0320fb8] (mutex_lock+0x0/0x14) from [c01ed760] (usb_kill_urb+0x38/0x104) [c01ed728] (usb_kill_urb+0x0/0x104) from [c01ece30] (usb_hcd_flush_endpoint+0xb0/0xcc) r6:c791c740 r5:c7170c00 r4:c791c738 [c01ecd80] (usb_hcd_flush_endpoint+0x0/0xcc) from [c01ee044] (usb_disable_endpoint+0x5c/0x6c) r7:c7893000 r6:c78a6a40 r5:c7893000 r4:c791c740 [c01edfe8] (usb_disable_endpoint+0x0/0x6c) from [c01ee180] (usb_disable_interface+0x34/0x4c) r5:0028 r4:0001 [c01ee14c] (usb_disable_interface+0x0/0x4c) from [c01ef4e0] (usb_set_interface+0xec/0x178) r7:0001 r6: r5:c7893000 r4:c78a6e00 [c01ef3f4] (usb_set_interface+0x0/0x178) from [bf014c48] (uvc_video_enable+0x3c/0x74 [uvcvideo]) r8:c721c050 r7:c7265e68 r6:c721c094 r5: r4:c721c050 [bf014c0c] (uvc_video_enable+0x0/0x74 [uvcvideo]) from [bf014308] (uvc_v4l2_do_ioctl+0xce4/0xf50 [uvcvideo]) r7:c7265e68 r6:c79f9e00 r5:c78d4760 r4:40045613 [bf013624] (uvc_v4l2_do_ioctl+0x0/0xf50 [uvcvideo]) from [bf008e20] (video_usercopy+0x1b8/0x2b8 [videodev]) [bf008c68] (video_usercopy+0x0/0x2b8 [videodev]) from [bf012fdc] (uvc_v4l2_ioctl+0x54/0x68 [uvcvideo]) [bf012f88] (uvc_v4l2_ioctl+0x0/0x68 [uvcvideo]) from [c00ace28] (vfs_ioctl+0x68/0x78) r7:c79eb400 r6:0003 r5:40c78ccc r4:40045613 [c00acdc0] (vfs_ioctl+0x0/0x78) from [c00ad0a8] (do_vfs_ioctl+0x270/0x280) r5:40c78ccc r4:c79eb400 [c00ace38] (do_vfs_ioctl+0x0/0x280) from [c00ad0f8] (sys_ioctl+0x40/0x64) r7:c79eb400 r6:40045613 r5:40c78ccc r4:0003 [c00ad0b8] (sys_ioctl+0x0/0x64) from [c0033c80] (ret_fast_syscall+0x0/0x2c) - Nathan -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this
Re: [PATCH 00/25] twl4030 patches (v5)
On Tuesday 30 September 2008, Felipe Balbi wrote: Hopefully this is the final version: For the core? This is IMO suitable for merging to linux-omap. In terms of no-bugs-Dave-knows-about, for stuff he's touched. There will however be other updates later... ... including the patch 26/25 I'm about to send -- shrinkage. ;) -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 26/25] twl4030 gpio cleanups
From: David Brownell [EMAIL PROTECTED] Clean up the twl4030-gpio code a bit ... mostly by shrinkage. Remove a bunch of macros that are just obfuscating what the TWL4030 GPIO code is doing. Some duplicated standard macros like BIT(); others hid trivial math (mask/shift); others were completely unused. Use BIT() in several places to highlight the bitmasking and make the code more compact. Remove pointless locking calls, sanity checks, and parenthesis. And needless irq_chip. Signed-off-by: David Brownell [EMAIL PROTECTED] --- I suggest just merging 'v5' plus this patch instead of issuing v6 series. ;) drivers/gpio/twl4030-gpio.c | 189 ++ 1 file changed, 47 insertions(+), 142 deletions(-) --- a/drivers/gpio/twl4030-gpio.c +++ b/drivers/gpio/twl4030-gpio.c @@ -41,6 +41,20 @@ #include linux/i2c/twl4030-gpio.h +/* + * The GPIO subchip supports 18 GPIOs which can be configured as + * inputs or outputs, with pullups or pulldowns on each pin. Each + * GPIO can trigger interrupts on either or both edges. + * + * GPIO interrupts can be fed to either of two IRQ lines; this is + * intended to support multiple hosts. + * + * There are also two LED pins used sometimes as output-only GPIOs. + * + * FIXME code currently only handles the first IRQ line. + */ + + static inline void activate_irq(int irq) { #ifdef CONFIG_ARM @@ -65,83 +79,15 @@ static int twl4030_gpio_irq_end; #define is_module()false #endif -/* BitField Definitions */ - -/* Data banks : 3 banks for 8 gpios each */ -#define DATA_BANK_MAX 8 -#define GET_GPIO_DATA_BANK(x) ((x)/DATA_BANK_MAX) -#define GET_GPIO_DATA_OFF(x) ((x)%DATA_BANK_MAX) - -/* GPIODATADIR Fields each block 0-7 */ -#define BIT_GPIODATADIR_GPIOxDIR(x)(x) -#define MASK_GPIODATADIR_GPIOxDIR(x) (0x01 (x)) - -/* GPIODATAIN Fields each block 0-7 */ -#define BIT_GPIODATAIN_GPIOxIN(x) (x) -#define MASK_GPIODATAIN_GPIOxIN(x) (0x01 (x)) - -/* GPIODATAOUT Fields each block 0-7 */ -#define BIT_GPIODATAOUT_GPIOxOUT(x)(x) -#define MASK_GPIODATAOUT_GPIOxOUT(x) (0x01 (x)) - -/* CLEARGPIODATAOUT Fields */ -#define BIT_CLEARGPIODATAOUT_GPIOxOUT(x) (x) -#define MASK_CLEARGPIODATAOUT_GPIOxOUT(x) (0x01 (x)) - -/* SETGPIODATAOUT Fields */ -#define BIT_SETGPIODATAOUT_GPIOxOUT(x) (x) -#define MASK_SETGPIODATAOUT_GPIOxOUT(x)(0x01 (x)) - -/* GPIO_DEBEN Fields */ -#define BIT_GPIO_DEBEN_GPIOxDEB(x) (x) -#define MASK_GPIO_DEBEN_GPIOxDEB(x)(0x01 (x)) - -/* GPIO_ISR1A Fields */ -#define BIT_GPIO_ISR_GPIOxISR(x) (x) -#define MASK_GPIO_ISR_GPIOxISR(x) (0x01 (x)) - -/* GPIO_IMR1A Fields */ -#define BIT_GPIO_IMR1A_GPIOxIMR(x) (x) -#define MASK_GPIO_IMR1A_GPIOxIMR(x)(0x01 (x)) - -/* GPIO_SIR1 Fields */ -#define BIT_GPIO_SIR1_GPIOxSIR(x) (x) -#define MASK_GPIO_SIR1_GPIO0SIR(0x01 (x)) - - -/* Control banks : 5 banks for 4 gpios each */ -#define DATA_CTL_MAX 4 -#define GET_GPIO_CTL_BANK(x) ((x)/DATA_CTL_MAX) -#define GET_GPIO_CTL_OFF(x)((x)%DATA_CTL_MAX) -#define GPIO_BANK_MAX GET_GPIO_CTL_BANK(TWL4030_GPIO_MAX) - -/* GPIOPUPDCTRx Fields 5 banks of 4 gpios each */ -#define BIT_GPIOPUPDCTR1_GPIOxPD(x)(2 * (x)) -#define MASK_GPIOPUPDCTR1_GPIOxPD(x) (0x01 (2 * (x))) -#define BIT_GPIOPUPDCTR1_GPIOxPU(x)((x) + 1) -#define MASK_GPIOPUPDCTR1_GPIOxPU(x) (0x01 (((2 * (x)) + 1))) - -/* GPIO_EDR1 Fields */ -#define BIT_GPIO_EDR1_GPIOxFALLING(x) (2 * (x)) -#define MASK_GPIO_EDR1_GPIOxFALLING(x) (0x01 (2 * (x))) -#define BIT_GPIO_EDR1_GPIOxRISING(x) ((x) + 1) -#define MASK_GPIO_EDR1_GPIOxRISING(x) (0x01 (((2 * (x)) + 1))) - /* GPIO_SIH_CTRL Fields */ -#define BIT_GPIO_SIH_CTRL_EXCLEN (0x000) -#define MASK_GPIO_SIH_CTRL_EXCLEN (0x0001) -#define BIT_GPIO_SIH_CTRL_PENDDIS (0x001) -#define MASK_GPIO_SIH_CTRL_PENDDIS (0x0002) -#define BIT_GPIO_SIH_CTRL_COR (0x002) -#define MASK_GPIO_SIH_CTRL_COR (0x0004) +#define MASK_GPIO_SIH_CTRL_EXCLEN BIT(0) +#define MASK_GPIO_SIH_CTRL_PENDDIS BIT(1) +#define MASK_GPIO_SIH_CTRL_COR BIT(2) /* GPIO_CTRL Fields */ -#define BIT_GPIO_CTRL_GPIO0CD1 (0x000) -#define MASK_GPIO_CTRL_GPIO0CD1(0x0001) -#define BIT_GPIO_CTRL_GPIO1CD2 (0x001) -#define MASK_GPIO_CTRL_GPIO1CD2(0x0002) -#define BIT_GPIO_CTRL_GPIO_ON (0x002) -#define MASK_GPIO_CTRL_GPIO_ON (0x0004) +#define MASK_GPIO_CTRL_GPIO0CD1BIT(0) +#define MASK_GPIO_CTRL_GPIO1CD2BIT(1) +#define MASK_GPIO_CTRL_GPIO_ON BIT(2) /* Mask for GPIO registers when aggregated into a 32-bit integer */ #define GPIO_32_MASK 0x0003 @@ -298,29 +244,13 @@
Re: [PATCH 26/25] twl4030 gpio cleanups
On Tue, Sep 30, 2008 at 12:49:06PM -0700, David Brownell wrote: From: David Brownell [EMAIL PROTECTED] Clean up the twl4030-gpio code a bit ... mostly by shrinkage. Remove a bunch of macros that are just obfuscating what the TWL4030 GPIO code is doing. Some duplicated standard macros like BIT(); others hid trivial math (mask/shift); others were completely unused. Use BIT() in several places to highlight the bitmasking and make the code more compact. Remove pointless locking calls, sanity checks, and parenthesis. And needless irq_chip. The code looks much better after you apply the patch. Great job Dave :-) -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] OMAP3: Fix 34xx/35xx revision check
The 35xx TRM lists incorrect values for the VERSION field of the CONTROL_IDCODE register. The correct values are those listed in the 34xx TRM. Correct message on boot verified on ES2.1 and ES3.0. Signed-off-by: Mans Rullgard [EMAIL PROTECTED] --- arch/arm/mach-omap2/id.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index ab7a6e9..9f72ae6 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c @@ -162,14 +162,15 @@ void __init omap34xx_check_revision(void) /* * Detection for 34xx ES2.0 and above can be done with just * hawkeye and rev. See TRM 1.5.2 Device Identification. -* Note that rev cannot be used directly as ES1.0 uses value 0. +* The 35xx TRM lists incorrect values for the revision number. +* Correct values are documented in the 34xx TRM. */ idcode = read_tap_reg(OMAP_TAP_IDCODE); hawkeye = (idcode 12) 0x; rev = (idcode 28) 0xff; if (hawkeye == 0xb7ae) - system_rev = 0x34300034 | ((1 + rev) 12); + system_rev = 0x34300034 | (rev 12); out: switch (system_rev) { -- 1.6.0.2 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] OMAP3: Fix 34xx/35xx revision check
Mans Rullgard [EMAIL PROTECTED] writes: The 35xx TRM lists incorrect values for the VERSION field of the CONTROL_IDCODE register. The correct values are those listed in the 34xx TRM. Correct message on boot verified on ES2.1 and ES3.0. Signed-off-by: Mans Rullgard [EMAIL PROTECTED] --- arch/arm/mach-omap2/id.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index ab7a6e9..9f72ae6 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c @@ -162,14 +162,15 @@ void __init omap34xx_check_revision(void) /* * Detection for 34xx ES2.0 and above can be done with just * hawkeye and rev. See TRM 1.5.2 Device Identification. - * Note that rev cannot be used directly as ES1.0 uses value 0. + * The 35xx TRM lists incorrect values for the revision number. + * Correct values are documented in the 34xx TRM. */ idcode = read_tap_reg(OMAP_TAP_IDCODE); hawkeye = (idcode 12) 0x; rev = (idcode 28) 0xff; if (hawkeye == 0xb7ae) - system_rev = 0x34300034 | ((1 + rev) 12); + system_rev = 0x34300034 | (rev 12); out: switch (system_rev) { Forget this. A fix was already in the tree, but not merged to my branch. -- Måns Rullgård [EMAIL PROTECTED] -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 04/25] i2c: move twl4030_keypad to new style registration
On Tuesday 30 September 2008, Felipe Balbi wrote: +struct twl4030_keypad_data { + int rows; + int cols; + int *keymap; + int irq; + unsigned int keymapsize; + unsigned int rep:1; +}; To fix later: irq should be a standard platform resource. Those references in board init code to TWL4030_MODIRQ_KEYPAD should vanish, and add_children() should just pass the right number the standard way. - Dave -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/25] i2c: move twl4030-madc to new registration style
On Tuesday 30 September 2008, Felipe Balbi wrote: ret = request_irq(TWL4030_MODIRQ_MADC, twl4030_madc_irq_handler, Likewise: pass the IRQ through a platform driver resource. These TWL4030_MODIRQ_* symbols should vanish. (To fix later. No reason to hold up this batch of patches any longer...) - IRQF_DISABLED, twl4030_madc, twl4030_madc); - if (ret) - printk(KERN_ERR TWL4030_MADC_PFX request_irq: %d\n, ret); + IRQF_DISABLED, twl4030_madc, madc); + if (ret) { + dev_dbg(pdev-dev, could not request irq\n); + goto err_irq; + } -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/25] i2c: move twl4030-madc to new registration style
On Tue, Sep 30, 2008 at 02:45:19PM -0700, David Brownell wrote: On Tuesday 30 September 2008, Felipe Balbi wrote: ret = request_irq(TWL4030_MODIRQ_MADC, twl4030_madc_irq_handler, Likewise: pass the IRQ through a platform driver resource. These TWL4030_MODIRQ_* symbols should vanish. (To fix later. No reason to hold up this batch of patches any longer...) True, i'll cook a patch for it tomorrow :-D -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 04/25] i2c: move twl4030_keypad to new style registration
On Tue, Sep 30, 2008 at 02:42:47PM -0700, David Brownell wrote: On Tuesday 30 September 2008, Felipe Balbi wrote: +struct twl4030_keypad_data { + int rows; + int cols; + int *keymap; + int irq; + unsigned int keymapsize; + unsigned int rep:1; +}; To fix later: irq should be a standard platform resource. Those references in board init code to TWL4030_MODIRQ_KEYPAD should vanish, and add_children() should just pass the right number the standard way. Cool, could you take a look at twl4030-bci changes ?? They request both irqs, which seems ok, but then we won't be able to get rid of TWL4030_MODIRQ_BCI. If you can come up with an idea to change that, i'd be glad. -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: Soft lockup when disconnecting musb isochronous device.
it happens when w_scan tries to tune into a specific frequency on a USB DVB-T stick. Any ideas about that one? I have applied these patches: [PATCH v3] OMAP:MUSB: Corrects urb unlink function path usb: musb: fix something MUSB high-bandwidth support patch MUSB ISO dma fix. What version are you working at? If it is not the latest version on OMAP GIT then try syncing with latest drivers/usb/storage/* I had some issue with a pendrive and it got fixed by taking latest (v2.6.27 rc3) usb/storage patches. Regards, Ajay -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
USB serial devices not working on linux-omap musb.
I'm trying to use a USB serial device on a Beagleboard/OMAP-3530 via the musb port. The device is correctly enumerated and can send data, but no data is received. Other types of USB devices seem to be working great. I've tested with two devices: A PL2303 USB to serial cable, and an Atmel SAM-BA device (basic CDC serial). Both devices work on the Ubuntu/Intrepid x86 2.6.27 kernel on my PC. Additionally, when unplugging the PL2303 I receive an Oops attached below. Let me know what I can do to help. I'm using the latest linux-omap git plus these four patches: Crash on detach: http://marc.info/?l=linux-usbm=122112415222422w=2 Iso/cam fix #1: http://marc.info/?l=linux-usbm=122085130310484w=2 Iso/cam fix #2: http://marc.info/?l=linux-usbm=122085145310628w=2 'Fix something': http://git.mansr.com/?p=linux-omap;a=commitdiff;h=1e5bc41773bb981b3a89bd762becf98c72be5e4c Here is the Oops: usb 1-1.3: usb_disable_device nuking all URBs Unable to handle kernel NULL pointer dereference at virtual address 0014 pgd = c0004000 [0014] *pgd= Internal error: Oops: 17 [#1] Modules linked in: pl2303 usbserial ipv6 uvcvideo compat_ioctl32 videodev v4l1_compat zd1211rw CPU: 0Not tainted (2.6.27-rc7-omap1-05004-g81d2c7d-dirty #8) PC is at musb_h_disable+0x70/0x118 LR is at usb_hcd_disable_endpoint+0x24/0x28 pc : [c0233618]lr : [c021395c]psr: 2093 sp : c78d1e48 ip : c78d1e70 fp : c78d1e6c r10: c7baa060 r9 : c7baa0ec r8 : a013 r7 : c78add80 r6 : c70c8e5c r5 : r4 : c70c8e50 r3 : r2 : 0083 r1 : c70c8e50 r0 : c7852120 Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 00c5387f Table: 87114018 DAC: 0017 Process khubd (pid: 104, stack limit = 0xc78d02e8) Stack: (0xc78d1e48 to 0xc78d2000) 1e40: c70c8e50 c7baa000 c7baa000 c7baa0ec c7baa060 1e60: c78d1e7c c78d1e70 c021395c c02335b4 c78d1e94 c78d1e80 c021665c c0213944 1e80: 0004 c7baa07c c78d1ec4 c78d1e98 c02166f0 c0216608 c0401fc0 c78d1ea8 1ea0: c03367a0 001f c7baa07c c7baa000 c78daa4c c7baa10c c78d1ef4 c78d1ec8 1ec0: c0211740 c021668c c78d1ee4 c7baa000 0064 c044344c c78d 0003 1ee0: c7be9000 0100 c78d1fd4 c78d1ef8 c0212bd4 c0211684 0064 0064 1f00: 0100 03e8 c0193b74 c004ed18 0003 c78daa4c c7852014 1f20: c7be9044 c7bdb6ac c7bdb620 c7bdb600 c78da800 c7be9048 c7be904c c78da90c 1f40: c7be9008 0100 c78da800 c7bdb6ac c7bdb620 1f60: c78da800 c7be909c 0001 0002 00e0 c7852000 c7817404 1f80: c7be9002 c78da808 c7822100 c0069dc4 c78d1f94 c78d1f94 0100 1fa0: 0101 c78d c78d1fd4 c78d c02124f8 c045657c 1fc0: c78d1ff4 c78d1fd8 c00698dc c0212504 1fe0: c78d1ff8 c00587e0 c0069890 007fef00 2376ef8a Backtrace: [c02335a8] (musb_h_disable+0x0/0x118) from [c021395c] (usb_hcd_disable_endpoint+0x24/0x28) r8:c7baa060 r7:c7baa0ec r6:c7baa000 r5:c7baa000 r4:c70c8e50 [c0213938] (usb_hcd_disable_endpoint+0x0/0x28) from [c021665c] (usb_disable_endpoint+0x60/0x84) [c02165fc] (usb_disable_endpoint+0x0/0x84) from [c02166f0] (usb_disable_device+0x70/0x198) r5:c7baa07c r4:0004 [c0216680] (usb_disable_device+0x0/0x198) from [c0211740] (usb_disconnect+0xc8/0x150) r8:c7baa10c r7:c78daa4c r6:c7baa000 r5:c7baa07c r4:001f [c0211678] (usb_disconnect+0x0/0x150) from [c0212bd4] (hub_thread+0x6dc/0x12b0) [c02124f8] (hub_thread+0x0/0x12b0) from [c00698dc] (kthread+0x58/0x8c) [c0069884] (kthread+0x0/0x8c) from [c00587e0] (do_exit+0x0/0x774) r7: r6: r5: r4: Code: 0a1d e3a05000 e1a03005 e284600c (e5b32014) ---[ end trace 32560ec91a581d5d ]--- - Nathan -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: USB serial devices not working on linux-omap musb.
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nathan Monson Sent: Wednesday, October 01, 2008 10:06 AM To: linux-omap@vger.kernel.org Subject: USB serial devices not working on linux-omap musb. I'm trying to use a USB serial device on a Beagleboard/OMAP-3530 via the musb port. The device is correctly enumerated and can send data, but no data is received. Other types of USB devices seem to be working great. I've tested with two devices: A PL2303 USB to serial cable, and an Atmel SAM-BA device (basic CDC serial). Both devices work on the Ubuntu/Intrepid x86 2.6.27 kernel on my PC. Additionally, when unplugging the PL2303 I receive an Oops attached below. Let me know what I can do to help. I'm using the latest linux-omap git plus these four patches: Crash on detach: http://marc.info/?l=linux-usbm=122112415222422w=2 Iso/cam fix #1: http://marc.info/?l=linux-usbm=122085130310484w=2 Iso/cam fix #2: http://marc.info/?l=linux-usbm=122085145310628w=2 'Fix something': http://git.mansr.com/?p=linux-omap;a=commitdiff;h=1e5bc41773bb981b3a89bd762becf98c72be5e4c Monson, This issue seems to be related to BULK multiplexing. I have a patch for this and will submit it soon. Regards, Ajay Here is the Oops: usb 1-1.3: usb_disable_device nuking all URBs Unable to handle kernel NULL pointer dereference at virtual address 0014 pgd = c0004000 [0014] *pgd= Internal error: Oops: 17 [#1] Modules linked in: pl2303 usbserial ipv6 uvcvideo compat_ioctl32 videodev v4l1_compat zd1211rw CPU: 0Not tainted (2.6.27-rc7-omap1-05004-g81d2c7d-dirty #8) PC is at musb_h_disable+0x70/0x118 LR is at usb_hcd_disable_endpoint+0x24/0x28 pc : [c0233618]lr : [c021395c]psr: 2093 sp : c78d1e48 ip : c78d1e70 fp : c78d1e6c r10: c7baa060 r9 : c7baa0ec r8 : a013 r7 : c78add80 r6 : c70c8e5c r5 : r4 : c70c8e50 r3 : r2 : 0083 r1 : c70c8e50 r0 : c7852120 Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 00c5387f Table: 87114018 DAC: 0017 Process khubd (pid: 104, stack limit = 0xc78d02e8) Stack: (0xc78d1e48 to 0xc78d2000) 1e40: c70c8e50 c7baa000 c7baa000 c7baa0ec c7baa060 1e60: c78d1e7c c78d1e70 c021395c c02335b4 c78d1e94 c78d1e80 c021665c c0213944 1e80: 0004 c7baa07c c78d1ec4 c78d1e98 c02166f0 c0216608 c0401fc0 c78d1ea8 1ea0: c03367a0 001f c7baa07c c7baa000 c78daa4c c7baa10c c78d1ef4 c78d1ec8 1ec0: c0211740 c021668c c78d1ee4 c7baa000 0064 c044344c c78d 0003 1ee0: c7be9000 0100 c78d1fd4 c78d1ef8 c0212bd4 c0211684 0064 0064 1f00: 0100 03e8 c0193b74 c004ed18 0003 c78daa4c c7852014 1f20: c7be9044 c7bdb6ac c7bdb620 c7bdb600 c78da800 c7be9048 c7be904c c78da90c 1f40: c7be9008 0100 c78da800 c7bdb6ac c7bdb620 1f60: c78da800 c7be909c 0001 0002 00e0 c7852000 c7817404 1f80: c7be9002 c78da808 c7822100 c0069dc4 c78d1f94 c78d1f94 0100 1fa0: 0101 c78d c78d1fd4 c78d c02124f8 c045657c 1fc0: c78d1ff4 c78d1fd8 c00698dc c0212504 1fe0: c78d1ff8 c00587e0 c0069890 007fef00 2376ef8a Backtrace: [c02335a8] (musb_h_disable+0x0/0x118) from [c021395c] (usb_hcd_disable_endpoint+0x24/0x28) r8:c7baa060 r7:c7baa0ec r6:c7baa000 r5:c7baa000 r4:c70c8e50 [c0213938] (usb_hcd_disable_endpoint+0x0/0x28) from [c021665c] (usb_disable_endpoint+0x60/0x84) [c02165fc] (usb_disable_endpoint+0x0/0x84) from [c02166f0] (usb_disable_device+0x70/0x198) r5:c7baa07c r4:0004 [c0216680] (usb_disable_device+0x0/0x198) from [c0211740] (usb_disconnect+0xc8/0x150) r8:c7baa10c r7:c78daa4c r6:c7baa000 r5:c7baa07c r4:001f [c0211678] (usb_disconnect+0x0/0x150) from [c0212bd4] (hub_thread+0x6dc/0x12b0) [c02124f8] (hub_thread+0x0/0x12b0) from [c00698dc] (kthread+0x58/0x8c) [c0069884] (kthread+0x0/0x8c) from [c00587e0] (do_exit+0x0/0x774) r7: r6: r5: r4: Code: 0a1d e3a05000 e1a03005 e284600c (e5b32014) ---[ end trace 32560ec91a581d5d ]--- - Nathan -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html