Merge branch 'for-linus' of git://git.o-hand.com/linux-mfd
* 'for-linus' of git://git.o-hand.com/linux-mfd: mfd: Fix sm501_register_gpio section mismatch mfd: fix sm501 section mismatches mfd: terminate pcf50633 i2c_device_id list mfd: Ensure all WM8350 IRQs are masked at startup mfd: fix htc-egpio iomem resource handling using resource_size mfd: Fix TWL4030 build on some ARM variants mfd: wm8350 tries reaches -1 mfd: Mark WM835x USB_SLV_500MA bit as accessible mfd: Improve diagnostics for WM8350 ID register probe mfd: Initialise WM8350 interrupts earlier mfd: Fix egpio kzalloc return test
This commit is contained in:
commit
7f302fe317
@ -286,7 +286,7 @@ static int __init egpio_probe(struct platform_device *pdev)
|
|||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
if (!res)
|
if (!res)
|
||||||
goto fail;
|
goto fail;
|
||||||
ei->base_addr = ioremap_nocache(res->start, res->end - res->start);
|
ei->base_addr = ioremap_nocache(res->start, resource_size(res));
|
||||||
if (!ei->base_addr)
|
if (!ei->base_addr)
|
||||||
goto fail;
|
goto fail;
|
||||||
pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr);
|
pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr);
|
||||||
@ -307,7 +307,7 @@ static int __init egpio_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
ei->nchips = pdata->num_chips;
|
ei->nchips = pdata->num_chips;
|
||||||
ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL);
|
ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL);
|
||||||
if (!ei) {
|
if (!ei->chip) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -678,6 +678,7 @@ static int __devexit pcf50633_remove(struct i2c_client *client)
|
|||||||
|
|
||||||
static struct i2c_device_id pcf50633_id_table[] = {
|
static struct i2c_device_id pcf50633_id_table[] = {
|
||||||
{"pcf50633", 0x73},
|
{"pcf50633", 0x73},
|
||||||
|
{/* end of list */}
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct i2c_driver pcf50633_driver = {
|
static struct i2c_driver pcf50633_driver = {
|
||||||
|
@ -1050,7 +1050,7 @@ static int __devinit sm501_gpio_register_chip(struct sm501_devdata *sm,
|
|||||||
return gpiochip_add(gchip);
|
return gpiochip_add(gchip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sm501_register_gpio(struct sm501_devdata *sm)
|
static int __devinit sm501_register_gpio(struct sm501_devdata *sm)
|
||||||
{
|
{
|
||||||
struct sm501_gpio *gpio = &sm->gpio;
|
struct sm501_gpio *gpio = &sm->gpio;
|
||||||
resource_size_t iobase = sm->io_res->start + SM501_GPIO;
|
resource_size_t iobase = sm->io_res->start + SM501_GPIO;
|
||||||
@ -1321,7 +1321,7 @@ static unsigned int sm501_mem_local[] = {
|
|||||||
* Common init code for an SM501
|
* Common init code for an SM501
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int sm501_init_dev(struct sm501_devdata *sm)
|
static int __devinit sm501_init_dev(struct sm501_devdata *sm)
|
||||||
{
|
{
|
||||||
struct sm501_initdata *idata;
|
struct sm501_initdata *idata;
|
||||||
struct sm501_platdata *pdata;
|
struct sm501_platdata *pdata;
|
||||||
@ -1397,7 +1397,7 @@ static int sm501_init_dev(struct sm501_devdata *sm)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sm501_plat_probe(struct platform_device *dev)
|
static int __devinit sm501_plat_probe(struct platform_device *dev)
|
||||||
{
|
{
|
||||||
struct sm501_devdata *sm;
|
struct sm501_devdata *sm;
|
||||||
int ret;
|
int ret;
|
||||||
@ -1586,8 +1586,8 @@ static struct sm501_platdata sm501_pci_platdata = {
|
|||||||
.gpio_base = -1,
|
.gpio_base = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int sm501_pci_probe(struct pci_dev *dev,
|
static int __devinit sm501_pci_probe(struct pci_dev *dev,
|
||||||
const struct pci_device_id *id)
|
const struct pci_device_id *id)
|
||||||
{
|
{
|
||||||
struct sm501_devdata *sm;
|
struct sm501_devdata *sm;
|
||||||
int err;
|
int err;
|
||||||
@ -1693,7 +1693,7 @@ static void sm501_dev_remove(struct sm501_devdata *sm)
|
|||||||
sm501_gpio_remove(sm);
|
sm501_gpio_remove(sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sm501_pci_remove(struct pci_dev *dev)
|
static void __devexit sm501_pci_remove(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
struct sm501_devdata *sm = pci_get_drvdata(dev);
|
struct sm501_devdata *sm = pci_get_drvdata(dev);
|
||||||
|
|
||||||
@ -1727,16 +1727,16 @@ static struct pci_device_id sm501_pci_tbl[] = {
|
|||||||
|
|
||||||
MODULE_DEVICE_TABLE(pci, sm501_pci_tbl);
|
MODULE_DEVICE_TABLE(pci, sm501_pci_tbl);
|
||||||
|
|
||||||
static struct pci_driver sm501_pci_drv = {
|
static struct pci_driver sm501_pci_driver = {
|
||||||
.name = "sm501",
|
.name = "sm501",
|
||||||
.id_table = sm501_pci_tbl,
|
.id_table = sm501_pci_tbl,
|
||||||
.probe = sm501_pci_probe,
|
.probe = sm501_pci_probe,
|
||||||
.remove = sm501_pci_remove,
|
.remove = __devexit_p(sm501_pci_remove),
|
||||||
};
|
};
|
||||||
|
|
||||||
MODULE_ALIAS("platform:sm501");
|
MODULE_ALIAS("platform:sm501");
|
||||||
|
|
||||||
static struct platform_driver sm501_plat_drv = {
|
static struct platform_driver sm501_plat_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "sm501",
|
.name = "sm501",
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
@ -1749,14 +1749,14 @@ static struct platform_driver sm501_plat_drv = {
|
|||||||
|
|
||||||
static int __init sm501_base_init(void)
|
static int __init sm501_base_init(void)
|
||||||
{
|
{
|
||||||
platform_driver_register(&sm501_plat_drv);
|
platform_driver_register(&sm501_plat_driver);
|
||||||
return pci_register_driver(&sm501_pci_drv);
|
return pci_register_driver(&sm501_pci_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit sm501_base_exit(void)
|
static void __exit sm501_base_exit(void)
|
||||||
{
|
{
|
||||||
platform_driver_unregister(&sm501_plat_drv);
|
platform_driver_unregister(&sm501_plat_driver);
|
||||||
pci_unregister_driver(&sm501_pci_drv);
|
pci_unregister_driver(&sm501_pci_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(sm501_base_init);
|
module_init(sm501_base_init);
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/i2c/twl4030.h>
|
#include <linux/i2c/twl4030.h>
|
||||||
|
|
||||||
#ifdef CONFIG_ARM
|
#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
|
||||||
#include <mach/cpu.h>
|
#include <mach/cpu.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1111,7 +1111,7 @@ int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, int vref)
|
|||||||
do {
|
do {
|
||||||
schedule_timeout_interruptible(1);
|
schedule_timeout_interruptible(1);
|
||||||
reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1);
|
reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1);
|
||||||
} while (tries-- && (reg & WM8350_AUXADC_POLL));
|
} while (--tries && (reg & WM8350_AUXADC_POLL));
|
||||||
|
|
||||||
if (!tries)
|
if (!tries)
|
||||||
dev_err(wm8350->dev, "adc chn %d read timeout\n", channel);
|
dev_err(wm8350->dev, "adc chn %d read timeout\n", channel);
|
||||||
@ -1297,14 +1297,29 @@ static void wm8350_client_dev_register(struct wm8350 *wm8350,
|
|||||||
int wm8350_device_init(struct wm8350 *wm8350, int irq,
|
int wm8350_device_init(struct wm8350 *wm8350, int irq,
|
||||||
struct wm8350_platform_data *pdata)
|
struct wm8350_platform_data *pdata)
|
||||||
{
|
{
|
||||||
int ret = -EINVAL;
|
int ret;
|
||||||
u16 id1, id2, mask_rev;
|
u16 id1, id2, mask_rev;
|
||||||
u16 cust_id, mode, chip_rev;
|
u16 cust_id, mode, chip_rev;
|
||||||
|
|
||||||
/* get WM8350 revision and config mode */
|
/* get WM8350 revision and config mode */
|
||||||
wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1);
|
ret = wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1);
|
||||||
wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2);
|
if (ret != 0) {
|
||||||
wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), &mask_rev);
|
dev_err(wm8350->dev, "Failed to read ID: %d\n", ret);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &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);
|
||||||
|
if (ret != 0) {
|
||||||
|
dev_err(wm8350->dev, "Failed to read revision: %d\n", ret);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
id1 = be16_to_cpu(id1);
|
id1 = be16_to_cpu(id1);
|
||||||
id2 = be16_to_cpu(id2);
|
id2 = be16_to_cpu(id2);
|
||||||
@ -1404,14 +1419,12 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdata && pdata->init) {
|
wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0xFFFF);
|
||||||
ret = pdata->init(wm8350);
|
wm8350_reg_write(wm8350, WM8350_INT_STATUS_1_MASK, 0xFFFF);
|
||||||
if (ret != 0) {
|
wm8350_reg_write(wm8350, WM8350_INT_STATUS_2_MASK, 0xFFFF);
|
||||||
dev_err(wm8350->dev, "Platform init() failed: %d\n",
|
wm8350_reg_write(wm8350, WM8350_UNDER_VOLTAGE_INT_STATUS_MASK, 0xFFFF);
|
||||||
ret);
|
wm8350_reg_write(wm8350, WM8350_GPIO_INT_STATUS_MASK, 0xFFFF);
|
||||||
goto err;
|
wm8350_reg_write(wm8350, WM8350_COMPARATOR_INT_STATUS_MASK, 0xFFFF);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex_init(&wm8350->auxadc_mutex);
|
mutex_init(&wm8350->auxadc_mutex);
|
||||||
mutex_init(&wm8350->irq_mutex);
|
mutex_init(&wm8350->irq_mutex);
|
||||||
@ -1430,6 +1443,15 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
|
|||||||
}
|
}
|
||||||
wm8350->chip_irq = irq;
|
wm8350->chip_irq = irq;
|
||||||
|
|
||||||
|
if (pdata && pdata->init) {
|
||||||
|
ret = pdata->init(wm8350);
|
||||||
|
if (ret != 0) {
|
||||||
|
dev_err(wm8350->dev, "Platform init() failed: %d\n",
|
||||||
|
ret);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0);
|
wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0);
|
||||||
|
|
||||||
wm8350_client_dev_register(wm8350, "wm8350-codec",
|
wm8350_client_dev_register(wm8350, "wm8350-codec",
|
||||||
|
@ -3188,7 +3188,7 @@ const struct wm8350_reg_access wm8350_reg_io_map[] = {
|
|||||||
{ 0x7CFF, 0x0C00, 0x7FFF }, /* R1 - ID */
|
{ 0x7CFF, 0x0C00, 0x7FFF }, /* R1 - ID */
|
||||||
{ 0x0000, 0x0000, 0x0000 }, /* R2 */
|
{ 0x0000, 0x0000, 0x0000 }, /* R2 */
|
||||||
{ 0xBE3B, 0xBE3B, 0x8000 }, /* R3 - System Control 1 */
|
{ 0xBE3B, 0xBE3B, 0x8000 }, /* R3 - System Control 1 */
|
||||||
{ 0xFCF7, 0xFCF7, 0xF800 }, /* R4 - System Control 2 */
|
{ 0xFEF7, 0xFEF7, 0xF800 }, /* R4 - System Control 2 */
|
||||||
{ 0x80FF, 0x80FF, 0x8000 }, /* R5 - System Hibernate */
|
{ 0x80FF, 0x80FF, 0x8000 }, /* R5 - System Hibernate */
|
||||||
{ 0xFB0E, 0xFB0E, 0x0000 }, /* R6 - Interface Control */
|
{ 0xFB0E, 0xFB0E, 0x0000 }, /* R6 - Interface Control */
|
||||||
{ 0x0000, 0x0000, 0x0000 }, /* R7 */
|
{ 0x0000, 0x0000, 0x0000 }, /* R7 */
|
||||||
|
Loading…
Reference in New Issue
Block a user