From 30816ac0495cb4f33fc8d748f64ac3cc880cb3c1 Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 20 Jan 2012 22:51:07 +0000 Subject: MFD: mcp-core: sanitize host creation/removal host_unregister() gives us no chance between removing the device and the mcp data structure being freed to access the data inbetween, which drivers may need to do if they need to iounmap() pointers in their private data structures. Therefore, re-jig the interfaces, which are now, on creation: mcp = mcp_host_alloc() if (mcp) { ret = mcp_host_add(mcp, data); if (!ret) mcp_host_free(mcp); } and on removal: mcp_host_del(mcp); ... access mcp ... mcp_host_free(mcp); The free does the final put_device() on the struct device as one would expect. Acked-by: Jochen Friedrich Signed-off-by: Russell King --- include/linux/mfd/mcp.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h index f88c1cc..79a6b13 100644 --- a/include/linux/mfd/mcp.h +++ b/include/linux/mfd/mcp.h @@ -47,8 +47,9 @@ void mcp_disable(struct mcp *); #define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) struct mcp *mcp_host_alloc(struct device *, size_t); -int mcp_host_register(struct mcp *); -void mcp_host_unregister(struct mcp *); +int mcp_host_add(struct mcp *); +void mcp_host_del(struct mcp *); +void mcp_host_free(struct mcp *); struct mcp_driver { struct device_driver drv; -- cgit v1.1 From 7658e7f9a8122b0678e4b4280308560aa5444bd5 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 12 Jan 2012 19:04:43 +0000 Subject: MFD: mcp-sa11x0: remove DMA initializers and variables The dma_device_t variables are only ever written to by mcp-sa11x0 and never read. As the old SA11x0 DMA support will be removed, remove these so that it no longer depends on the old SA11x0 DMA definitions. Acked-by: Jochen Friedrich Signed-off-by: Russell King --- include/linux/mfd/mcp.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'include') diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h index 79a6b13..dfe7e51 100644 --- a/include/linux/mfd/mcp.h +++ b/include/linux/mfd/mcp.h @@ -10,8 +10,6 @@ #ifndef MCP_H #define MCP_H -#include - struct mcp_ops; struct mcp { @@ -21,10 +19,6 @@ struct mcp { int use_count; unsigned int sclk_rate; unsigned int rw_timeout; - dma_device_t dma_audio_rd; - dma_device_t dma_audio_wr; - dma_device_t dma_telco_rd; - dma_device_t dma_telco_wr; struct device attached_device; int gpio_base; }; -- cgit v1.1 From abe06082d07fcb0673cb93338c1d6f037fdc375b Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 20 Jan 2012 22:13:52 +0000 Subject: MFD: mcp/ucb1x00: separate ucb1x00 driver data from the MCP data Patch taken from 5dd7bf59e0 (ARM: sa11x0: Implement autoloading of codec and codec pdata for mcp bus.) by Jochen Friedrich . This adds just the codec data part of the patch. Acked-by: Jochen Friedrich Signed-off-by: Russell King --- include/linux/mfd/mcp.h | 3 +-- include/linux/mfd/ucb1x00.h | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h index dfe7e51..bfcdf6d 100644 --- a/include/linux/mfd/mcp.h +++ b/include/linux/mfd/mcp.h @@ -20,7 +20,6 @@ struct mcp { unsigned int sclk_rate; unsigned int rw_timeout; struct device attached_device; - int gpio_base; }; struct mcp_ops { @@ -41,7 +40,7 @@ void mcp_disable(struct mcp *); #define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) struct mcp *mcp_host_alloc(struct device *, size_t); -int mcp_host_add(struct mcp *); +int mcp_host_add(struct mcp *, void *); void mcp_host_del(struct mcp *); void mcp_host_free(struct mcp *); diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h index 4321f04..731b23a 100644 --- a/include/linux/mfd/ucb1x00.h +++ b/include/linux/mfd/ucb1x00.h @@ -104,6 +104,9 @@ #define UCB_MODE_DYN_VFLAG_ENA (1 << 12) #define UCB_MODE_AUD_OFF_CAN (1 << 13) +struct ucb1x00_plat_data { + int gpio_base; +}; struct ucb1x00_irq { void *devid; -- cgit v1.1 From 2f7510c6070932371e0b842a5470ce7190dcf162 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 22 Jan 2012 19:02:25 +0000 Subject: MFD: ucb1x00-core: add handling for ucb1x00 reset Provide a way to handle the software controlled ucb1x00 reset signal from the ucb1x00-core driver without having to code platform specifics into these drivers. Acked-by: Jochen Friedrich Signed-off-by: Russell King --- include/linux/mfd/ucb1x00.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h index 731b23a..fd088cc 100644 --- a/include/linux/mfd/ucb1x00.h +++ b/include/linux/mfd/ucb1x00.h @@ -104,7 +104,14 @@ #define UCB_MODE_DYN_VFLAG_ENA (1 << 12) #define UCB_MODE_AUD_OFF_CAN (1 << 13) +enum ucb1x00_reset { + UCB_RST_PROBE, + UCB_RST_REMOVE, + UCB_RST_PROBE_FAIL, +}; + struct ucb1x00_plat_data { + void (*reset)(enum ucb1x00_reset); int gpio_base; }; -- cgit v1.1 From cae154767a96563d33924872aacfdc63d584f707 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 21 Jan 2012 09:33:38 +0000 Subject: MFD: ucb1x00-core: use mutexes instead of semaphores Convert the ucb1x00 driver to use mutexes rather than the depreciated semaphores for exclusive access to the ADC. Acked-by: Jochen Friedrich Signed-off-by: Russell King --- include/linux/mfd/ucb1x00.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h index fd088cc..a4b9543 100644 --- a/include/linux/mfd/ucb1x00.h +++ b/include/linux/mfd/ucb1x00.h @@ -12,7 +12,7 @@ #include #include -#include +#include #define UCB_IO_DATA 0x00 #define UCB_IO_DIR 0x01 @@ -124,7 +124,7 @@ struct ucb1x00 { spinlock_t lock; struct mcp *mcp; unsigned int irq; - struct semaphore adc_sem; + struct mutex adc_mutex; spinlock_t io_lock; u16 id; u16 io_dir; -- cgit v1.1 From 5a09b7120a965a7d7e8494d0ed509135bbce0118 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 21 Jan 2012 16:36:30 +0000 Subject: MFD: ucb1x00-core: convert to use dev_pm_ops Convert the ucb1x00-core driver to use dev_pm_ops rather than the legacy members in the mcp driver. Acked-by: Jochen Friedrich Signed-off-by: Russell King --- include/linux/mfd/ucb1x00.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h index a4b9543..253c12c 100644 --- a/include/linux/mfd/ucb1x00.h +++ b/include/linux/mfd/ucb1x00.h @@ -154,7 +154,7 @@ struct ucb1x00_driver { struct list_head devs; int (*add)(struct ucb1x00_dev *dev); void (*remove)(struct ucb1x00_dev *dev); - int (*suspend)(struct ucb1x00_dev *dev, pm_message_t state); + int (*suspend)(struct ucb1x00_dev *dev); int (*resume)(struct ucb1x00_dev *dev); }; -- cgit v1.1 From cf4abfcc0df2985ff6061f74e63b8353f2a1d0bc Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 21 Jan 2012 16:38:50 +0000 Subject: MFD: mcp-core: remove legacy driver suspend/resume methods The legacy driver suspend/resume methods are no longer used, so get rid of them. Acked-by: Jochen Friedrich Signed-off-by: Russell King --- include/linux/mfd/mcp.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h index bfcdf6d..a9e8bd1 100644 --- a/include/linux/mfd/mcp.h +++ b/include/linux/mfd/mcp.h @@ -48,8 +48,6 @@ struct mcp_driver { struct device_driver drv; int (*probe)(struct mcp *); void (*remove)(struct mcp *); - int (*suspend)(struct mcp *, pm_message_t); - int (*resume)(struct mcp *); }; int mcp_driver_register(struct mcp_driver *); -- cgit v1.1 From a3364409c4af8bae42d04def48dc11409787e503 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 21 Jan 2012 14:58:28 +0000 Subject: MFD: ucb1x00: convert to use genirq Convert the ucb1x00 driver to use genirq's interrupt services, rather than its own private implementation. This allows a wider range of drivers to use the GPIO interrupts (such as the gpio_keys driver) without being aware of the UCB1x00's private IRQ system. This prevents the UCB1x00 core driver from being built as a module, so adjust the configuration to add that restriction. Acked-by: Jochen Friedrich Signed-off-by: Russell King --- include/linux/mfd/ucb1x00.h | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'include') diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h index 253c12c..6fb9074 100644 --- a/include/linux/mfd/ucb1x00.h +++ b/include/linux/mfd/ucb1x00.h @@ -112,18 +112,15 @@ enum ucb1x00_reset { struct ucb1x00_plat_data { void (*reset)(enum ucb1x00_reset); + unsigned irq_base; int gpio_base; }; -struct ucb1x00_irq { - void *devid; - void (*fn)(int, void *); -}; - struct ucb1x00 { - spinlock_t lock; + raw_spinlock_t irq_lock; struct mcp *mcp; unsigned int irq; + int irq_base; struct mutex adc_mutex; spinlock_t io_lock; u16 id; @@ -132,7 +129,7 @@ struct ucb1x00 { u16 adc_cr; u16 irq_fal_enbl; u16 irq_ris_enbl; - struct ucb1x00_irq irq_handler[16]; + u16 irq_mask; struct device dev; struct list_head node; struct list_head devs; @@ -255,15 +252,4 @@ unsigned int ucb1x00_adc_read(struct ucb1x00 *ucb, int adc_channel, int sync); void ucb1x00_adc_enable(struct ucb1x00 *ucb); void ucb1x00_adc_disable(struct ucb1x00 *ucb); -/* - * Which edges of the IRQ do you want to control today? - */ -#define UCB_RISING (1 << 0) -#define UCB_FALLING (1 << 1) - -int ucb1x00_hook_irq(struct ucb1x00 *ucb, unsigned int idx, void (*fn)(int, void *), void *devid); -void ucb1x00_enable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges); -void ucb1x00_disable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges); -int ucb1x00_free_irq(struct ucb1x00 *ucb, unsigned int idx, void *devid); - #endif -- cgit v1.1 From 33237616771bfc29a97f17e74efe3799bb790343 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 22 Jan 2012 20:05:24 +0000 Subject: MFD: ucb1x00-core: add wakeup support Add genirq wakeup support for the ucb1x00 device. This allows an attached gpio_keys driver to wakeup the system. Touchscreen is also possible. When there are no wakeup sources, ask the platform to assert the reset signal to avoid any unexpected behaviour; this also puts the reset signal at the right level when power is removed from the device. Acked-by: Jochen Friedrich Signed-off-by: Russell King --- include/linux/mfd/ucb1x00.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h index 6fb9074..28af417 100644 --- a/include/linux/mfd/ucb1x00.h +++ b/include/linux/mfd/ucb1x00.h @@ -106,6 +106,8 @@ enum ucb1x00_reset { UCB_RST_PROBE, + UCB_RST_RESUME, + UCB_RST_SUSPEND, UCB_RST_REMOVE, UCB_RST_PROBE_FAIL, }; @@ -114,6 +116,7 @@ struct ucb1x00_plat_data { void (*reset)(enum ucb1x00_reset); unsigned irq_base; int gpio_base; + unsigned can_wakeup; }; struct ucb1x00 { @@ -130,6 +133,7 @@ struct ucb1x00 { u16 irq_fal_enbl; u16 irq_ris_enbl; u16 irq_mask; + u16 irq_wake; struct device dev; struct list_head node; struct list_head devs; -- cgit v1.1 From 9e6720fb0cfd6edda12b408a66f4ac88e8a82e32 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 14 Jan 2012 10:56:06 +0000 Subject: FB: sa1100: move machine inf structures to