mfd: tps65090: Fix ifdefs for suspend mode
PATCH 1/7 mfd: tps65090: Fix ifdefs for suspend mode
CONFIG_PM also covers runtime only PM.
--- drivers/mfd/tps65090.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/tps65090.c +2 -2
@@ -323,7 +323,7 @@ static int __devexit tps65090_i2c_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int tps65090_i2c_suspend (struct i2c_client *client,pm_message_t state) {if (client->irq)
@@ -352,7 +352,7 @@ static struct i2c_driver tps65090_driver = { }, .probe = tps65090_i2c_probe, .remove =__devexit_p (tps65090_i2c_remove), -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP .suspend = tps65090_i2c_suspend, .resume = tps65090_i2c_resume, #endif
Signature · 1 line
1.7.10
PATCH 2/7 mfd: tps65090: Don't use I2C-specific suspend and resume operations
The legacy suspend operations have been deprecated and printing warnings on boot for over a year now.
--- drivers/mfd/tps65090.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/mfd/tps65090.c +9 -6
@@ -324,21 +324,27 @@ static int __devexit tps65090_i2c_remove(struct i2c_client *client) }#ifdef CONFIG_PM_SLEEP -static int tps65090_i2c_suspend (struct i2c_client *client,pm_message_t state) +static int tps65090_suspend (struct device *dev) { +struct i2c_client *client =to_i2c_client (dev);if (client->irq)disable_irq (client->irq);return 0 ; } -static int tps65090_i2c_resume (struct i2c_client *client) +static int tps65090_resume (struct device *dev) { +struct i2c_client *client =to_i2c_client (dev);if (client->irq)enable_irq (client->irq);return 0 ; }#endif +static const struct dev_pm_ops tps65090_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (tps65090_suspend, tps65090_resume) +}; +static const struct i2c_device_id tps65090_id_table[] = { {"tps65090" ,0 }, { },
@@ -349,13 +355,10 @@ static struct i2c_driver tps65090_driver = { .driver = { .name = "tps65090", .owner = THIS_MODULE, + .pm = &tps65090_pm_ops, }, .probe = tps65090_i2c_probe, .remove = __devexit_p(tps65090_i2c_remove), -#ifdef CONFIG_PM_SLEEP - .suspend = tps65090_i2c_suspend, - .resume = tps65090_i2c_resume, -#endif .id_table = tps65090_id_table, };
Signature · 1 line
1.7.10
PATCH 3/7 mfd: tps65910: Fix section annotations
In reply to Mark BrownA warning was being generated by the reference from tps65910_i2c_probe() to tps65910_sleepinit() since the latter was annotated as __init but the former was unannotated. Since these functions can only be called during device init make them both __devinit, and while we're at it also annotate tps65910_i2c_remove() __devexit for symmetry.
--- drivers/mfd/tps65910.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/mfd/tps65910.c +5 -5
@@ -90,7 +90,7 @@ static const struct regmap_config tps65910_regmap_config = { .cache_type = REGCACHE_RBTREE, }; -static int __init tps65910_sleepinit (struct tps65910 *tps65910, +static int __devinit tps65910_sleepinit (struct tps65910 *tps65910,struct tps65910_board *pmic_pdata) {struct device *dev =NULL ;
@@ -150,8 +150,8 @@ err_sleep_init: } -static int tps65910_i2c_probe (struct i2c_client *i2c, -const struct i2c_device_id *id) +static __devinit int tps65910_i2c_probe (struct i2c_client *i2c, +const struct i2c_device_id *id) {struct tps65910 *tps65910;struct tps65910_board *pmic_plat_data;
@@ -213,7 +213,7 @@ regmap_err:return ret; } -static int tps65910_i2c_remove (struct i2c_client *i2c) +static __devexit int tps65910_i2c_remove(struct i2c_client *i2c) {struct tps65910 *tps65910 =i2c_get_clientdata (i2c);
@@ -239,7 +239,7 @@ static struct i2c_driver tps65910_i2c_driver = { .owner = THIS_MODULE, }, .probe = tps65910_i2c_probe, - .remove = tps65910_i2c_remove, + .remove = __devexit_p(tps65910_i2c_remove), .id_table = tps65910_i2c_id, };
Signature · 1 line
1.7.10
PATCH 4/7 mfd: wm831x: Fix register range passing for recent ARM updates
In reply to Mark BrownThe removal of mach/io.h from most ARM platforms also set the range of valid IO ports to be empty for most platforms when previously any 32 bit integer had been valid. This makes it impossible to add IO resources as the added range is smaller than that of the root resource for IO ports.
Since we're not really using IO memory at all fix this by defining our own root resource outside the normal tree and make that the parent of all IO resources. This also ensures we won't conflict with read IO ports if we ever run on a platform which happens to use them.
--- drivers/mfd/wm831x-core.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/mfd/wm831x-core.c +26 -0
@@ -614,8 +614,15 @@ int wm831x_set_bits(struct wm831x *wm831x, unsigned short reg, }EXPORT_SYMBOL_GPL (wm831x_set_bits); +static struct resource wm831x_io_parent = { + .start =0 , + .end =0xffffffff , + .flags =IORESOURCE_IO , +}; +static struct resource wm831x_dcdc1_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_DC1_CONTROL_1 , .end =WM831X_DC1_DVS_CONTROL , .flags =IORESOURCE_IO ,
@@ -637,6 +644,7 @@ static struct resource wm831x_dcdc1_resources[] = {static struct resource wm831x_dcdc2_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_DC2_CONTROL_1 , .end =WM831X_DC2_DVS_CONTROL , .flags =IORESOURCE_IO ,
@@ -657,6 +665,7 @@ static struct resource wm831x_dcdc2_resources[] = {static struct resource wm831x_dcdc3_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_DC3_CONTROL_1 , .end =WM831X_DC3_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -671,6 +680,7 @@ static struct resource wm831x_dcdc3_resources[] = {static struct resource wm831x_dcdc4_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_DC4_CONTROL , .end =WM831X_DC4_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -685,6 +695,7 @@ static struct resource wm831x_dcdc4_resources[] = {static struct resource wm8320_dcdc4_buck_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_DC4_CONTROL , .end =WM832X_DC4_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -707,6 +718,7 @@ static struct resource wm831x_gpio_resources[] = {static struct resource wm831x_isink1_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_CURRENT_SINK_1 , .end =WM831X_CURRENT_SINK_1 , .flags =IORESOURCE_IO ,
@@ -720,6 +732,7 @@ static struct resource wm831x_isink1_resources[] = {static struct resource wm831x_isink2_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_CURRENT_SINK_2 , .end =WM831X_CURRENT_SINK_2 , .flags =IORESOURCE_IO ,
@@ -733,6 +746,7 @@ static struct resource wm831x_isink2_resources[] = {static struct resource wm831x_ldo1_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_LDO1_CONTROL , .end =WM831X_LDO1_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -747,6 +761,7 @@ static struct resource wm831x_ldo1_resources[] = {static struct resource wm831x_ldo2_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_LDO2_CONTROL , .end =WM831X_LDO2_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -761,6 +776,7 @@ static struct resource wm831x_ldo2_resources[] = {static struct resource wm831x_ldo3_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_LDO3_CONTROL , .end =WM831X_LDO3_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -775,6 +791,7 @@ static struct resource wm831x_ldo3_resources[] = {static struct resource wm831x_ldo4_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_LDO4_CONTROL , .end =WM831X_LDO4_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -789,6 +806,7 @@ static struct resource wm831x_ldo4_resources[] = {static struct resource wm831x_ldo5_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_LDO5_CONTROL , .end =WM831X_LDO5_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -803,6 +821,7 @@ static struct resource wm831x_ldo5_resources[] = {static struct resource wm831x_ldo6_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_LDO6_CONTROL , .end =WM831X_LDO6_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -817,6 +836,7 @@ static struct resource wm831x_ldo6_resources[] = {static struct resource wm831x_ldo7_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_LDO7_CONTROL , .end =WM831X_LDO7_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -831,6 +851,7 @@ static struct resource wm831x_ldo7_resources[] = {static struct resource wm831x_ldo8_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_LDO8_CONTROL , .end =WM831X_LDO8_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -845,6 +866,7 @@ static struct resource wm831x_ldo8_resources[] = {static struct resource wm831x_ldo9_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_LDO9_CONTROL , .end =WM831X_LDO9_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -859,6 +881,7 @@ static struct resource wm831x_ldo9_resources[] = {static struct resource wm831x_ldo10_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_LDO10_CONTROL , .end =WM831X_LDO10_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -873,6 +896,7 @@ static struct resource wm831x_ldo10_resources[] = {static struct resource wm831x_ldo11_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_LDO11_ON_CONTROL , .end =WM831X_LDO11_SLEEP_CONTROL , .flags =IORESOURCE_IO ,
@@ -974,6 +998,7 @@ static struct resource wm831x_rtc_resources[] = {static struct resource wm831x_status1_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_STATUS_LED_1 , .end =WM831X_STATUS_LED_1 , .flags =IORESOURCE_IO ,
@@ -982,6 +1007,7 @@ static struct resource wm831x_status1_resources[] = {static struct resource wm831x_status2_resources[] = { { + .parent = &wm831x_io_parent, .start =WM831X_STATUS_LED_2 , .end =WM831X_STATUS_LED_2 , .flags =IORESOURCE_IO ,
Signature · 1 line
1.7.10
PATCH 5/7 mfd: wm8350: Convert physical I/O to regmap API
In reply to Mark BrownThe driver still uses a custom cache implementation but the underlying physical I/O is now done using the regmap API, saving some code and avoiding allocating enormous scratch arrays on the stack.
--- drivers/mfd/wm8350-core.c | 31 ++++++++--------------- drivers/mfd/wm8350-i2c.c | 53 +++++++++++---------------------------- include/linux/mfd/wm8350/core.h | 9 ++----- 3 files changed, 27 insertions(+), 66 deletions(-)
drivers/mfd/wm8350-core.c +10 -21
@@ -20,6 +20,7 @@#include <linux/device.h> #include <linux/delay.h> #include <linux/interrupt.h> +#include <linux/regmap.h> #include <linux/workqueue.h> #include <linux/mfd/wm8350/core.h>
@@ -74,7 +75,7 @@ static int wm8350_phys_read(struct wm8350 *wm8350, u8 reg, int num_regs,int bytes = num_regs *2 ;dev_dbg (wm8350->dev,"volatile read\n" ); - ret = wm8350->read_dev (wm8350, reg, bytes, (char *)dest); + ret =regmap_raw_read (wm8350->regmap, reg, dest, bytes);for (i = reg; i < reg + num_regs; i++) {/* Cache is CPU endian */
@@ -96,9 +97,6 @@ static int wm8350_read(struct wm8350 *wm8350, u8 reg, int num_regs, u16 *dest)int ret =0 ;int bytes = num_regs *2 ; -if (wm8350->read_dev ==NULL ) -return -ENODEV ; -if ((reg + num_regs -1 ) >WM8350_MAX_REGISTER ) {dev_err (wm8350->dev,"invalid reg %x\n" , reg + num_regs -1 );
@@ -149,9 +147,6 @@ static int wm8350_write(struct wm8350 *wm8350, u8 reg, int num_regs, u16 *src)int end = reg + num_regs;int bytes = num_regs *2 ; -if (wm8350->write_dev ==NULL ) -return -ENODEV ; -if ((reg + num_regs -1 ) >WM8350_MAX_REGISTER ) {dev_err (wm8350->dev,"invalid reg %x\n" , reg + num_regs -1 );
@@ -182,7 +177,7 @@ static int wm8350_write(struct wm8350 *wm8350, u8 reg, int num_regs, u16 *src) }/* Actually write it out */ -return wm8350->write_dev (wm8350, reg, bytes, (char *)src); +return regmap_raw_write (wm8350->regmap, reg, src, bytes); }/*
@@ -515,9 +510,8 @@ static int wm8350_create_cache(struct wm8350 *wm8350, int type, int mode)* a PMIC so the device many not be in a virgin state and we * can't rely on the silicon values. */ - ret = wm8350->read_dev (wm8350,0 , -sizeof (u16) * (WM8350_MAX_REGISTER +1 ), - wm8350->reg_cache); + ret =regmap_raw_read (wm8350->regmap,0 , wm8350->reg_cache, +sizeof (u16) * (WM8350_MAX_REGISTER +1 ));if (ret <0 ) {dev_err (wm8350->dev,"failed to read initial cache values\n" );
@@ -570,35 +564,30 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, struct wm8350_platform_data *pdata) {int ret; -u16 id1, id2, mask_rev; -u16 cust_id, mode, chip_rev; +unsigned int id1, id2, mask_rev; +unsigned int cust_id, mode, chip_rev;dev_set_drvdata (wm8350->dev, wm8350);/* get WM8350 revision and config mode */ - ret = wm8350->read_dev (wm8350,WM8350_RESET_ID ,sizeof (id1), &id1); + ret =regmap_read (wm8350->regmap,WM8350_RESET_ID , &id1);if (ret !=0 ) {dev_err (wm8350->dev,"Failed to read ID: %d\n" , ret); goto err; } - ret = wm8350->read_dev (wm8350,WM8350_ID ,sizeof (id2), &id2); + ret =regmap_read (wm8350->regmap,WM8350_ID , &id2);if (ret !=0 ) {dev_err (wm8350->dev,"Failed to read ID: %d\n" , ret); goto err; } - ret = wm8350->read_dev (wm8350,WM8350_REVISION ,sizeof (mask_rev), - &mask_rev); + ret =regmap_read (wm8350->regmap,WM8350_REVISION , &mask_rev);if (ret !=0 ) {dev_err (wm8350->dev,"Failed to read revision: %d\n" , ret); goto err; } - id1 =be16_to_cpu (id1); - id2 =be16_to_cpu (id2); - mask_rev =be16_to_cpu (mask_rev); -if (id1 !=0x6143 ) {dev_err (wm8350->dev,"Device with ID %x is not a WM8350\n" , id1);
drivers/mfd/wm8350-i2c.c +15 -38
79 lines not on this page · raw message
include/linux/mfd/wm8350/core.h +2 -7
@@ -602,6 +602,7 @@ extern const u16 wm8352_mode2_defaults[];extern const u16 wm8352_mode3_defaults[];struct wm8350 ; +struct regmap ;struct wm8350_hwmon {struct platform_device *pdev;
@@ -612,13 +613,7 @@ struct wm8350 {struct device *dev;/* device IO */ -union { -struct i2c_client *i2c_client; -struct spi_device *spi_device; - }; -int (*read_dev)(struct wm8350 *wm8350,char reg,int size,void *dest); -int (*write_dev)(struct wm8350 *wm8350,char reg,int size, -void *src); +struct regmap *regmap;u16 *reg_cache;struct mutex auxadc_mutex;
Signature · 1 line
1.7.10
PATCH 6/7 mfd: wm8994: Read CUST_ID from the device
In reply to Mark BrownRead CUST_ID from the device and log it for diagnostics.
--- drivers/mfd/wm8994-core.c | 7 ++++--- include/linux/mfd/wm8994/core.h | 1 + include/linux/mfd/wm8994/registers.h | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-)
drivers/mfd/wm8994-core.c +4 -3
@@ -500,7 +500,8 @@ static __devinit int wm8994_device_init(struct wm8994 *wm8994, int irq) ret); goto err_enable; } - wm8994->revision = ret; + wm8994->revision = ret &WM8994_CHIP_REV_MASK ; + wm8994->cust_id = (ret &WM8994_CUST_ID_MASK ) >>WM8994_CUST_ID_SHIFT ;switch (wm8994->type) {case WM8994 :
@@ -553,8 +554,8 @@ static __devinit int wm8994_device_init(struct wm8994 *wm8994, int irq)break ; } -dev_info (wm8994->dev,"%s revision %c\n" , devname, -'A' + wm8994->revision); +dev_info (wm8994->dev,"%s revision %c CUST_ID %02x\n" , devname, +'A' + wm8994->revision, wm8994->cust_id);switch (wm8994->type) {case WM1811 :
include/linux/mfd/wm8994/core.h +1 -0
@@ -57,6 +57,7 @@ struct wm8994 {enum wm8994_type type;int revision; +int cust_id;struct device *dev;struct regmap *regmap;
include/linux/mfd/wm8994/registers.h +3 -0
@@ -2212,6 +2212,9 @@/* * R256 (0x100) - Chip Revision */ +#define WM8994_CUST_ID_MASK 0xFF00/* CUST_ID - [15:8] */ +#define WM8994_CUST_ID_SHIFT 8/* CUST_ID - [15:8] */ +#define WM8994_CUST_ID_WIDTH 8/* CUST_ID - [15:8] */ #define WM8994_CHIP_REV_MASK 0x000F/* CHIP_REV - [3:0] */ #define WM8994_CHIP_REV_SHIFT 0/* CHIP_REV - [3:0] */ #define WM8994_CHIP_REV_WIDTH 4/* CHIP_REV - [3:0] */
Signature · 1 line
1.7.10
PATCH 7/7 mfd: wm8994: Convert to module_i2c_driver()
In reply to Mark Brown--- drivers/mfd/wm8994-core.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/mfd/wm8994-core.c +1 -17
@@ -733,23 +733,7 @@ static struct i2c_driver wm8994_i2c_driver = { .id_table = wm8994_i2c_id, }; -static int __init wm8994_i2c_init (void ) -{ -int ret; - - ret =i2c_add_driver (&wm8994_i2c_driver); -if (ret !=0 ) -pr_err ("Failed to register wm8994 I2C driver: %d\n" , ret); - -return ret; -} -module_init (wm8994_i2c_init); - -static void __exit wm8994_i2c_exit(void) -{ -i2c_del_driver (&wm8994_i2c_driver); -} -module_exit (wm8994_i2c_exit); +module_i2c_driver (wm8994_i2c_driver);MODULE_DESCRIPTION ("Core support for the WM8994 audio CODEC" );MODULE_LICENSE ("GPL" );
Signature · 1 line
1.7.10
Hi Mark,
Quoted 7 lines · Mark Brown
CONFIG_PMalso covers runtime only PM.Signed-off-by Mark Brown <[email protected]>Acked-by Venu Byravarasu <[email protected]>--- drivers/mfd/tps65090.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
This one and the 6 following patches applied to my for-next branch.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/