Commit 3b72e441 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-next' of git://git.o-hand.com/linux-mfd

* 'for-next' of git://git.o-hand.com/linux-mfd:
  mfd: further unbork the ucb1400 ac97_bus dependencies
  mfd: ucb1400 needs GPIO
  mfd: ucb1400 sound driver uses/depends on AC97_BUS:
  mfd: Don't use NO_IRQ in WM8350
  mfd: update TMIO drivers to use the clock API
  mfd: twl4030-core irq simplification
  mfd: add base support for Dialog DA9030/DA9034 PMICs
  mfd: TWL4030 core driver
  mfd: support tmiofb cell on tc6393xb
  mfd: add OHCI cell to tc6393xb
  mfd: Fix htc-egpio compile warning
  mfd: do tcb6393xb state restore on resume only if requested
  mfd: provide and use setup hook for tc6393xb
  mfd: update sm501 debugging/low information messages
  mfd: reduce stack usage in mfd-core.c
parents 396b122f 64c12e9b
...@@ -59,8 +59,6 @@ ...@@ -59,8 +59,6 @@
* TC6393XB GPIOs * TC6393XB GPIOs
*/ */
#define TOSA_TC6393XB_GPIO_BASE (NR_BUILTIN_GPIO + 2 * 12) #define TOSA_TC6393XB_GPIO_BASE (NR_BUILTIN_GPIO + 2 * 12)
#define TOSA_TC6393XB_GPIO(i) (TOSA_TC6393XB_GPIO_BASE + (i))
#define TOSA_TC6393XB_GPIO_BIT(gpio) (1 << (gpio - TOSA_TC6393XB_GPIO_BASE))
#define TOSA_GPIO_TG_ON (TOSA_TC6393XB_GPIO_BASE + 0) #define TOSA_GPIO_TG_ON (TOSA_TC6393XB_GPIO_BASE + 0)
#define TOSA_GPIO_L_MUTE (TOSA_TC6393XB_GPIO_BASE + 1) #define TOSA_GPIO_L_MUTE (TOSA_TC6393XB_GPIO_BASE + 1)
......
...@@ -706,16 +706,39 @@ static struct tmio_nand_data tosa_tc6393xb_nand_config = { ...@@ -706,16 +706,39 @@ static struct tmio_nand_data tosa_tc6393xb_nand_config = {
.badblock_pattern = &tosa_tc6393xb_nand_bbt, .badblock_pattern = &tosa_tc6393xb_nand_bbt,
}; };
static struct tc6393xb_platform_data tosa_tc6393xb_setup = { static int tosa_tc6393xb_setup(struct platform_device *dev)
{
int rc;
rc = gpio_request(TOSA_GPIO_CARD_VCC_ON, "CARD_VCC_ON");
if (rc)
goto err_req;
rc = gpio_direction_output(TOSA_GPIO_CARD_VCC_ON, 1);
if (rc)
goto err_dir;
return rc;
err_dir:
gpio_free(TOSA_GPIO_CARD_VCC_ON);
err_req:
return rc;
}
static void tosa_tc6393xb_teardown(struct platform_device *dev)
{
gpio_free(TOSA_GPIO_CARD_VCC_ON);
}
static struct tc6393xb_platform_data tosa_tc6393xb_data = {
.scr_pll2cr = 0x0cc1, .scr_pll2cr = 0x0cc1,
.scr_gper = 0x3300, .scr_gper = 0x3300,
.scr_gpo_dsr =
TOSA_TC6393XB_GPIO_BIT(TOSA_GPIO_CARD_VCC_ON),
.scr_gpo_doecr =
TOSA_TC6393XB_GPIO_BIT(TOSA_GPIO_CARD_VCC_ON),
.irq_base = IRQ_BOARD_START, .irq_base = IRQ_BOARD_START,
.gpio_base = TOSA_TC6393XB_GPIO_BASE, .gpio_base = TOSA_TC6393XB_GPIO_BASE,
.setup = tosa_tc6393xb_setup,
.teardown = tosa_tc6393xb_teardown,
.enable = tosa_tc6393xb_enable, .enable = tosa_tc6393xb_enable,
.disable = tosa_tc6393xb_disable, .disable = tosa_tc6393xb_disable,
...@@ -723,6 +746,8 @@ static struct tc6393xb_platform_data tosa_tc6393xb_setup = { ...@@ -723,6 +746,8 @@ static struct tc6393xb_platform_data tosa_tc6393xb_setup = {
.resume = tosa_tc6393xb_resume, .resume = tosa_tc6393xb_resume,
.nand_data = &tosa_tc6393xb_nand_config, .nand_data = &tosa_tc6393xb_nand_config,
.resume_restore = 1,
}; };
...@@ -730,7 +755,7 @@ static struct platform_device tc6393xb_device = { ...@@ -730,7 +755,7 @@ static struct platform_device tc6393xb_device = {
.name = "tc6393xb", .name = "tc6393xb",
.id = -1, .id = -1,
.dev = { .dev = {
.platform_data = &tosa_tc6393xb_setup, .platform_data = &tosa_tc6393xb_data,
}, },
.num_resources = ARRAY_SIZE(tc6393xb_resources), .num_resources = ARRAY_SIZE(tc6393xb_resources),
.resource = tc6393xb_resources, .resource = tc6393xb_resources,
......
...@@ -219,7 +219,7 @@ config TOUCHSCREEN_ATMEL_TSADCC ...@@ -219,7 +219,7 @@ config TOUCHSCREEN_ATMEL_TSADCC
config TOUCHSCREEN_UCB1400 config TOUCHSCREEN_UCB1400
tristate "Philips UCB1400 touchscreen" tristate "Philips UCB1400 touchscreen"
select AC97_BUS depends on AC97_BUS
depends on UCB1400_CORE depends on UCB1400_CORE
help help
This enables support for the Philips UCB1400 touchscreen interface. This enables support for the Philips UCB1400 touchscreen interface.
......
...@@ -52,6 +52,8 @@ config HTC_PASIC3 ...@@ -52,6 +52,8 @@ config HTC_PASIC3
config UCB1400_CORE config UCB1400_CORE
tristate "Philips UCB1400 Core driver" tristate "Philips UCB1400 Core driver"
depends on AC97_BUS
depends on GPIOLIB
help help
This enables support for the Philips UCB1400 core functions. This enables support for the Philips UCB1400 core functions.
The UCB1400 is an AC97 audio codec. The UCB1400 is an AC97 audio codec.
...@@ -59,6 +61,20 @@ config UCB1400_CORE ...@@ -59,6 +61,20 @@ config UCB1400_CORE
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called ucb1400_core. module will be called ucb1400_core.
config TWL4030_CORE
bool "Texas Instruments TWL4030/TPS659x0 Support"
depends on I2C=y && GENERIC_HARDIRQS && (ARCH_OMAP2 || ARCH_OMAP3)
help
Say yes here if you have TWL4030 family chip on your board.
This core driver provides register access and IRQ handling
facilities, and registers devices for the various functions
so that function-specific drivers can bind to them.
These multi-function chips are found on many OMAP2 and OMAP3
boards, providing power management, RTC, GPIO, keypad, a
high speed USB OTG transceiver, an audio codec (on most
versions) and many other features.
config MFD_TMIO config MFD_TMIO
bool bool
default n default n
......
...@@ -17,6 +17,8 @@ wm8350-objs := wm8350-core.o wm8350-regmap.o wm8350-gpio.o ...@@ -17,6 +17,8 @@ wm8350-objs := wm8350-core.o wm8350-regmap.o wm8350-gpio.o
obj-$(CONFIG_MFD_WM8350) += wm8350.o obj-$(CONFIG_MFD_WM8350) += wm8350.o
obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o
obj-$(CONFIG_TWL4030_CORE) += twl4030-core.o
obj-$(CONFIG_MFD_CORE) += mfd-core.o obj-$(CONFIG_MFD_CORE) += mfd-core.o
obj-$(CONFIG_MCP) += mcp-core.o obj-$(CONFIG_MCP) += mcp-core.o
......
This diff is collapsed.
...@@ -289,7 +289,7 @@ static int __init egpio_probe(struct platform_device *pdev) ...@@ -289,7 +289,7 @@ static int __init egpio_probe(struct platform_device *pdev)
ei->base_addr = ioremap_nocache(res->start, res->end - res->start); ei->base_addr = ioremap_nocache(res->start, res->end - res->start);
if (!ei->base_addr) if (!ei->base_addr)
goto fail; goto fail;
pr_debug("EGPIO phys=%08x virt=%p\n", res->start, ei->base_addr); pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr);
if ((pdata->bus_width != 16) && (pdata->bus_width != 32)) if ((pdata->bus_width != 16) && (pdata->bus_width != 32))
goto fail; goto fail;
......
...@@ -20,7 +20,7 @@ static int mfd_add_device(struct device *parent, int id, ...@@ -20,7 +20,7 @@ static int mfd_add_device(struct device *parent, int id,
struct resource *mem_base, struct resource *mem_base,
int irq_base) int irq_base)
{ {
struct resource res[cell->num_resources]; struct resource *res;
struct platform_device *pdev; struct platform_device *pdev;
int ret = -ENOMEM; int ret = -ENOMEM;
int r; int r;
...@@ -29,14 +29,17 @@ static int mfd_add_device(struct device *parent, int id, ...@@ -29,14 +29,17 @@ static int mfd_add_device(struct device *parent, int id,
if (!pdev) if (!pdev)
goto fail_alloc; goto fail_alloc;
res = kzalloc(sizeof(*res) * cell->num_resources, GFP_KERNEL);
if (!res)
goto fail_device;
pdev->dev.parent = parent; pdev->dev.parent = parent;
ret = platform_device_add_data(pdev, ret = platform_device_add_data(pdev,
cell->platform_data, cell->data_size); cell->platform_data, cell->data_size);
if (ret) if (ret)
goto fail_device; goto fail_res;
memset(res, 0, sizeof(res));
for (r = 0; r < cell->num_resources; r++) { for (r = 0; r < cell->num_resources; r++) {
res[r].name = cell->resources[r].name; res[r].name = cell->resources[r].name;
res[r].flags = cell->resources[r].flags; res[r].flags = cell->resources[r].flags;
...@@ -64,11 +67,15 @@ static int mfd_add_device(struct device *parent, int id, ...@@ -64,11 +67,15 @@ static int mfd_add_device(struct device *parent, int id,
ret = platform_device_add(pdev); ret = platform_device_add(pdev);
if (ret) if (ret)
goto fail_device; goto fail_res;
kfree(res);
return 0; return 0;
/* platform_device_del(pdev); */ /* platform_device_del(pdev); */
fail_res:
kfree(res);
fail_device: fail_device:
platform_device_put(pdev); platform_device_put(pdev);
fail_alloc: fail_alloc:
......
...@@ -623,7 +623,7 @@ unsigned long sm501_set_clock(struct device *dev, ...@@ -623,7 +623,7 @@ unsigned long sm501_set_clock(struct device *dev,
sm501_sync_regs(sm); sm501_sync_regs(sm);
dev_info(sm->dev, "gate %08lx, clock %08lx, mode %08lx\n", dev_dbg(sm->dev, "gate %08lx, clock %08lx, mode %08lx\n",
gate, clock, mode); gate, clock, mode);
sm501_mdelay(sm, 16); sm501_mdelay(sm, 16);
...@@ -742,7 +742,7 @@ static int sm501_register_device(struct sm501_devdata *sm, ...@@ -742,7 +742,7 @@ static int sm501_register_device(struct sm501_devdata *sm,
int ret; int ret;
for (ptr = 0; ptr < pdev->num_resources; ptr++) { for (ptr = 0; ptr < pdev->num_resources; ptr++) {
printk("%s[%d] flags %08lx: %08llx..%08llx\n", printk(KERN_DEBUG "%s[%d] flags %08lx: %08llx..%08llx\n",
pdev->name, ptr, pdev->name, ptr,
pdev->resource[ptr].flags, pdev->resource[ptr].flags,
(unsigned long long)pdev->resource[ptr].start, (unsigned long long)pdev->resource[ptr].start,
......
...@@ -24,8 +24,10 @@ ...@@ -24,8 +24,10 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/err.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/clk.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mfd/core.h> #include <linux/mfd/core.h>
#include <linux/mfd/tmio.h> #include <linux/mfd/tmio.h>
...@@ -56,6 +58,8 @@ struct t7l66xb { ...@@ -56,6 +58,8 @@ struct t7l66xb {
spinlock_t lock; spinlock_t lock;
struct resource rscr; struct resource rscr;
struct clk *clk48m;
struct clk *clk32k;
int irq; int irq;
int irq_base; int irq_base;
}; };
...@@ -65,13 +69,11 @@ struct t7l66xb { ...@@ -65,13 +69,11 @@ struct t7l66xb {
static int t7l66xb_mmc_enable(struct platform_device *mmc) static int t7l66xb_mmc_enable(struct platform_device *mmc)
{ {
struct platform_device *dev = to_platform_device(mmc->dev.parent); struct platform_device *dev = to_platform_device(mmc->dev.parent);
struct t7l66xb_platform_data *pdata = dev->dev.platform_data;
struct t7l66xb *t7l66xb = platform_get_drvdata(dev); struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
unsigned long flags; unsigned long flags;
u8 dev_ctl; u8 dev_ctl;
if (pdata->enable_clk32k) clk_enable(t7l66xb->clk32k);
pdata->enable_clk32k(dev);
spin_lock_irqsave(&t7l66xb->lock, flags); spin_lock_irqsave(&t7l66xb->lock, flags);
...@@ -87,7 +89,6 @@ static int t7l66xb_mmc_enable(struct platform_device *mmc) ...@@ -87,7 +89,6 @@ static int t7l66xb_mmc_enable(struct platform_device *mmc)
static int t7l66xb_mmc_disable(struct platform_device *mmc) static int t7l66xb_mmc_disable(struct platform_device *mmc)
{ {
struct platform_device *dev = to_platform_device(mmc->dev.parent); struct platform_device *dev = to_platform_device(mmc->dev.parent);
struct t7l66xb_platform_data *pdata = dev->dev.platform_data;
struct t7l66xb *t7l66xb = platform_get_drvdata(dev); struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
unsigned long flags; unsigned long flags;
u8 dev_ctl; u8 dev_ctl;
...@@ -100,8 +101,7 @@ static int t7l66xb_mmc_disable(struct platform_device *mmc) ...@@ -100,8 +101,7 @@ static int t7l66xb_mmc_disable(struct platform_device *mmc)
spin_unlock_irqrestore(&t7l66xb->lock, flags); spin_unlock_irqrestore(&t7l66xb->lock, flags);
if (pdata->disable_clk32k) clk_disable(t7l66xb->clk32k);
pdata->disable_clk32k(dev);
return 0; return 0;
} }
...@@ -258,18 +258,22 @@ static void t7l66xb_detach_irq(struct platform_device *dev) ...@@ -258,18 +258,22 @@ static void t7l66xb_detach_irq(struct platform_device *dev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int t7l66xb_suspend(struct platform_device *dev, pm_message_t state) static int t7l66xb_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
struct t7l66xb_platform_data *pdata = dev->dev.platform_data; struct t7l66xb_platform_data *pdata = dev->dev.platform_data;
if (pdata && pdata->suspend) if (pdata && pdata->suspend)
pdata->suspend(dev); pdata->suspend(dev);
clk_disable(t7l66xb->clk48m);
return 0; return 0;
} }
static int t7l66xb_resume(struct platform_device *dev) static int t7l66xb_resume(struct platform_device *dev)
{ {
struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
struct t7l66xb_platform_data *pdata = dev->dev.platform_data; struct t7l66xb_platform_data *pdata = dev->dev.platform_data;
clk_enable(t7l66xb->clk48m);
if (pdata && pdata->resume) if (pdata && pdata->resume)
pdata->resume(dev); pdata->resume(dev);
...@@ -309,6 +313,19 @@ static int t7l66xb_probe(struct platform_device *dev) ...@@ -309,6 +313,19 @@ static int t7l66xb_probe(struct platform_device *dev)
t7l66xb->irq_base = pdata->irq_base; t7l66xb->irq_base = pdata->irq_base;
t7l66xb->clk32k = clk_get(&dev->dev, "CLK_CK32K");
if (IS_ERR(t7l66xb->clk32k)) {
ret = PTR_ERR(t7l66xb->clk32k);
goto err_clk32k_get;
}
t7l66xb->clk48m = clk_get(&dev->dev, "CLK_CK48M");
if (IS_ERR(t7l66xb->clk48m)) {
ret = PTR_ERR(t7l66xb->clk48m);
clk_put(t7l66xb->clk32k);
goto err_clk48m_get;
}
rscr = &t7l66xb->rscr; rscr = &t7l66xb->rscr;
rscr->name = "t7l66xb-core"; rscr->name = "t7l66xb-core";
rscr->start = iomem->start; rscr->start = iomem->start;
...@@ -325,6 +342,8 @@ static int t7l66xb_probe(struct platform_device *dev) ...@@ -325,6 +342,8 @@ static int t7l66xb_probe(struct platform_device *dev)
goto err_ioremap; goto err_ioremap;
} }
clk_enable(t7l66xb->clk48m);
if (pdata && pdata->enable) if (pdata && pdata->enable)
pdata->enable(dev); pdata->enable(dev);
...@@ -359,9 +378,13 @@ static int t7l66xb_probe(struct platform_device *dev) ...@@ -359,9 +378,13 @@ static int t7l66xb_probe(struct platform_device *dev)
iounmap(t7l66xb->scr); iounmap(t7l66xb->scr);
err_ioremap: err_ioremap:
release_resource(&t7l66xb->rscr); release_resource(&t7l66xb->rscr);
err_noirq:
err_request_scr: err_request_scr:
kfree(t7l66xb); kfree(t7l66xb);
clk_put(t7l66xb->clk48m);
err_clk48m_get:
clk_put(t7l66xb->clk32k);
err_clk32k_get:
err_noirq:
return ret; return ret;
} }
...@@ -372,7 +395,8 @@ static int t7l66xb_remove(struct platform_device *dev) ...@@ -372,7 +395,8 @@ static int t7l66xb_remove(struct platform_device *dev)
int ret; int ret;
ret = pdata->disable(dev); ret = pdata->disable(dev);
clk_disable(t7l66xb->clk48m);
clk_put(t7l66xb->clk48m);
t7l66xb_detach_irq(dev); t7l66xb_detach_irq(dev);
iounmap(t7l66xb->scr); iounmap(t7l66xb->scr);
release_resource(&t7l66xb->rscr); release_resource(&t7l66xb->rscr);
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/mfd/core.h> #include <linux/mfd/core.h>
#include <linux/mfd/tmio.h> #include <linux/mfd/tmio.h>
...@@ -24,18 +25,22 @@ enum { ...@@ -24,18 +25,22 @@ enum {
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int tc6387xb_suspend(struct platform_device *dev, pm_message_t state) static int tc6387xb_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct tc6387xb_platform_data *pdata = platform_get_drvdata(dev); struct clk *clk32k = platform_get_drvdata(dev);
struct tc6387xb_platform_data *pdata = dev->dev.platform_data;
if (pdata && pdata->suspend) if (pdata && pdata->suspend)
pdata->suspend(dev); pdata->suspend(dev);
clk_disable(clk32k);
return 0; return 0;
} }
static int tc6387xb_resume(struct platform_device *dev) static int tc6387xb_resume(struct platform_device *dev)
{ {
struct tc6387xb_platform_data *pdata = platform_get_drvdata(dev); struct clk *clk32k = platform_get_drvdata(dev);
struct tc6387xb_platform_data *pdata = dev->dev.platform_data;
clk_enable(clk32k);
if (pdata && pdata->resume) if (pdata && pdata->resume)
pdata->resume(dev); pdata->resume(dev);
...@@ -51,10 +56,9 @@ static int tc6387xb_resume(struct platform_device *dev) ...@@ -51,10 +56,9 @@ static int tc6387xb_resume(struct platform_device *dev)
static int tc6387xb_mmc_enable(struct platform_device *mmc) static int tc6387xb_mmc_enable(struct platform_device *mmc)
{ {
struct platform_device *dev = to_platform_device(mmc->dev.parent); struct platform_device *dev = to_platform_device(mmc->dev.parent);
struct tc6387xb_platform_data *tc6387xb = dev->dev.platform_data; struct clk *clk32k = platform_get_drvdata(dev);
if (tc6387xb->enable_clk32k) clk_enable(clk32k);
tc6387xb->enable_clk32k(dev);
return 0; return 0;
} }
...@@ -62,10 +66,9 @@ static int tc6387xb_mmc_enable(struct platform_device *mmc) ...@@ -62,10 +66,9 @@ static int tc6387xb_mmc_enable(struct platform_device *mmc)
static int tc6387xb_mmc_disable(struct platform_device *mmc) static int tc6387xb_mmc_disable(struct platform_device *mmc)
{ {
struct platform_device *dev = to_platform_device(mmc->dev.parent); struct platform_device *dev = to_platform_device(mmc->dev.parent);
struct tc6387xb_platform_data *tc6387xb = dev->dev.platform_data; struct clk *clk32k = platform_get_drvdata(dev);
if (tc6387xb->disable_clk32k) clk_disable(clk32k);
tc6387xb->disable_clk32k(dev);
return 0; return 0;
} }
...@@ -102,14 +105,14 @@ static struct mfd_cell tc6387xb_cells[] = { ...@@ -102,14 +105,14 @@ static struct mfd_cell tc6387xb_cells[] = {
static int tc6387xb_probe(struct platform_device *dev) static int tc6387xb_probe(struct platform_device *dev)
{ {
struct tc6387xb_platform_data *data = platform_get_drvdata(dev); struct tc6387xb_platform_data *pdata = dev->dev.platform_data;
struct resource *iomem; struct resource *iomem;
struct clk *clk32k;
int irq, ret; int irq, ret;
iomem = platform_get_resource(dev, IORESOURCE_MEM, 0); iomem = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!iomem) { if (!iomem) {
ret = -EINVAL; return -EINVAL;
goto err_resource;
} }
ret = platform_get_irq(dev, 0); ret = platform_get_irq(dev, 0);
...@@ -118,8 +121,15 @@ static int tc6387xb_probe(struct platform_device *dev) ...@@ -118,8 +121,15 @@ static int tc6387xb_probe(struct platform_device *dev)
else else
goto err_resource; goto err_resource;
if (data && data->enable) clk32k = clk_get(&dev->dev, "CLK_CK32K");
data->enable(dev); if (IS_ERR(clk32k)) {
ret = PTR_ERR(clk32k);
goto err_resource;
}
platform_set_drvdata(dev, clk32k);
if (pdata && pdata->enable)
pdata->enable(dev);
printk(KERN_INFO "Toshiba tc6387xb initialised\n"); printk(KERN_INFO "Toshiba tc6387xb initialised\n");
...@@ -134,18 +144,19 @@ static int tc6387xb_probe(struct platform_device *dev) ...@@ -134,18 +144,19 @@ static int tc6387xb_probe(struct platform_device *dev)
if (!ret) if (!ret)
return 0; return 0;
clk_put(clk32k);
err_resource: err_resource:
return ret; return ret;
} }
static int tc6387xb_remove(struct platform_device *dev) static int tc6387xb_remove(struct platform_device *dev)
{ {
struct tc6387xb_platform_data *data = platform_get_drvdata(dev); struct clk *clk32k = platform_get_drvdata(dev);
if (data && data->disable)
data->disable(dev);
/* FIXME - free the resources! */ mfd_remove_devices(&dev->dev);
clk_disable(clk32k);
clk_put(clk32k);
platform_set_drvdata(dev, NULL);
return 0; return 0;
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -1217,7 +1217,7 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, ...@@ -1217,7 +1217,7 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
mutex_init(&wm8350->irq_mutex); mutex_init(&wm8350->irq_mutex);
INIT_WORK(&wm8350->irq_work, wm8350_irq_worker); INIT_WORK(&wm8350->irq_work, wm8350_irq_worker);
if (irq != NO_IRQ) { if (irq) {
ret = request_irq(irq, wm8350_irq, 0, ret = request_irq(irq, wm8350_irq, 0,
"wm8350", wm8350); "wm8350", wm8350);
if (ret != 0) { if (ret != 0) {
......
This diff is collapsed.
#ifndef __LINUX_PMIC_DA903X_H
#define __LINUX_PMIC_DA903X_H
/* Unified sub device IDs for DA9030/DA9034 */
enum {
DA9030_ID_LED_1,
DA9030_ID_LED_2,
DA9030_ID_LED_3,
DA9030_ID_LED_4,
DA9030_ID_LED_PC,
DA9030_ID_VIBRA,
DA9030_ID_WLED,
DA9030_ID_BUCK1,
DA9030_ID_BUCK2,
DA9030_ID_LDO1,
DA9030_ID_LDO2,
DA9030_ID_LDO3,
DA9030_ID_LDO4,
DA9030_ID_LDO5,
DA9030_ID_LDO6,
DA9030_ID_LDO7,
DA9030_ID_LDO8,
DA9030_ID_LDO9,
DA9030_ID_LDO10,
DA9030_ID_LDO11,
DA9030_ID_LDO12,
DA9030_ID_LDO13,
DA9030_ID_LDO14,
DA9030_ID_LDO15,
DA9030_ID_LDO16,
DA9030_ID_LDO17,
DA9030_ID_LDO18,
DA9030_ID_LDO19,
DA9030_ID_LDO_INT, /* LDO Internal */
DA9034_ID_LED_1,
DA9034_ID_LED_2,
DA9034_ID_VIBRA,
DA9034_ID_WLED,
DA9034_ID_TOUCH,
DA9034_ID_BUCK1,
DA9034_ID_BUCK2,
DA9034_ID_LDO1,
DA9034_ID_LDO2,
DA9034_ID_LDO3,
DA9034_ID_LDO4,
DA9034_ID_LDO5,
DA9034_ID_LDO6,
DA9034_ID_LDO7,
DA9034_ID_LDO8,
DA9034_ID_LDO9,
DA9034_ID_LDO10,
DA9034_ID_LDO11,
DA9034_ID_LDO12,
DA9034_ID_LDO13,
DA9034_ID_LDO14,
DA9034_ID_LDO15,
};
/*
* DA9030/DA9034 LEDs sub-devices uses generic "struct led_info"
* as the platform_data
*/
/* DA9030 flags for "struct led_info"
*/
#define DA9030_LED_RATE_ON (0 << 5)
#define DA9030_LED_RATE_052S (1 << 5)
#define DA9030_LED_DUTY_1_16 (0 << 3)
#define DA9030_LED_DUTY_1_8 (1 << 3)
#define DA9030_LED_DUTY_1_4 (2 << 3)
#define DA9030_LED_DUTY_1_2 (3 << 3)
#define DA9030_VIBRA_MODE_1P3V (0 << 1)
#define DA9030_VIBRA_MODE_2P7V (1 << 1)
#define DA9030_VIBRA_FREQ_1HZ (0 << 2)
#define DA9030_VIBRA_FREQ_2HZ (1 << 2)
#define DA9030_VIBRA_FREQ_4HZ (2 << 2)
#define DA9030_VIBRA_FREQ_8HZ (3 << 2)
#define DA9030_VIBRA_DUTY_ON (0 << 4)
#define DA9030_VIBRA_DUTY_75P (1 << 4)
#define DA9030_VIBRA_DUTY_50P (2 << 4)
#define DA9030_VIBRA_DUTY_25P (3 << 4)
/* DA9034 flags for "struct led_info" */
#define DA9034_LED_RAMP (1 << 7)
/* DA9034 touch screen platform data */
struct da9034_touch_pdata {
int interval_ms; /* sampling interval while pen down */
int x_inverted;
int y_inverted;
};
struct da903x_subdev_info {
int id;
const char *name;
void *platform_data;
};
struct da903x_platform_data {
int num_subdevs;
struct da903x_subdev_info *subdevs;
};
/* bit definitions for DA9030 events */
#define DA9030_EVENT_ONKEY (1 << 0)
#define DA9030_EVENT_PWREN (1 << 1)
#define DA9030_EVENT_EXTON (1 << 2)
#define DA9030_EVENT_CHDET (1 << 3)
#define DA9030_EVENT_TBAT (1 << 4)
#define DA9030_EVENT_VBATMON (1 << 5)
#define DA9030_EVENT_VBATMON_TXON (1 << 6)
#define DA9030_EVENT_CHIOVER (1 << 7)
#define DA9030_EVENT_TCTO (1 << 8)
#define DA9030_EVENT_CCTO (1 << 9)
#define DA9030_EVENT_ADC_READY (1 << 10)
#define DA9030_EVENT_VBUS_4P4 (1 << 11)
#define DA9030_EVENT_VBUS_4P0 (1 << 12)
#define DA9030_EVENT_SESS_VALID (1 << 13)
#define DA9030_EVENT_SRP_DETECT (1 << 14)
#define DA9030_EVENT_WATCHDOG (1 << 15)
#define DA9030_EVENT_LDO15 (1 << 16)
#define DA9030_EVENT_LDO16 (1 << 17)
#define DA9030_EVENT_LDO17 (1 << 18)
#define DA9030_EVENT_LDO18 (1 << 19)
#define DA9030_EVENT_LDO19 (1 << 20)
#define DA9030_EVENT_BUCK2 (1 << 21)
/* bit definitions for DA9034 events */
#define DA9034_EVENT_ONKEY (1 << 0)
#define DA9034_EVENT_EXTON (1 << 2)
#define DA9034_EVENT_CHDET (1 << 3)
#define DA9034_EVENT_TBAT (1 << 4)
#define DA9034_EVENT_VBATMON (1 << 5)
#define DA9034_EVENT_REV_IOVER (1 << 6)
#define DA9034_EVENT_CH_IOVER (1 << 7)
#define DA9034_EVENT_CH_TCTO (1 << 8)
#define DA9034_EVENT_CH_CCTO (1 << 9)
#define DA9034_EVENT_USB_DEV (1 << 10)
#define DA9034_EVENT_OTGCP_IOVER (1 << 11)
#define DA9034_EVENT_VBUS_4P55 (1 << 12)
#define DA9034_EVENT_VBUS_3P8 (1 << 13)
#define DA9034_EVENT_SESS_1P8 (1 << 14)
#define DA9034_EVENT_SRP_READY (1 << 15)
#define DA9034_EVENT_ADC_MAN (1 << 16)
#define DA9034_EVENT_ADC_AUTO4 (1 << 17)
#define DA9034_EVENT_ADC_AUTO5 (1 << 18)
#define DA9034_EVENT_ADC_AUTO6 (1 << 19)
#define DA9034_EVENT_PEN_DOWN (1 << 20)
#define DA9034_EVENT_TSI_READY (1 << 21)
#define DA9034_EVENT_UART_TX (1 << 22)
#define DA9034_EVENT_UART_RX (1 << 23)
#define DA9034_EVENT_HEADSET (1 << 25)
#define DA9034_EVENT_HOOKSWITCH (1 << 26)
#define DA9034_EVENT_WATCHDOG (1 << 27)
extern int da903x_register_notifier(struct device *dev,
struct notifier_block *nb, unsigned int events);
extern int da903x_unregister_notifier(struct device *dev,
struct notifier_block *nb, unsigned int events);
/* Status Query Interface */
#define DA9030_STATUS_ONKEY (1 << 0)
#define DA9030_STATUS_PWREN1 (1 << 1)
#define DA9030_STATUS_EXTON (1 << 2)
#define DA9030_STATUS_CHDET (1 << 3)
#define DA9030_STATUS_TBAT (1 << 4)
#define DA9030_STATUS_VBATMON (1 << 5)
#define DA9030_STATUS_VBATMON_TXON (1 << 6)
#define DA9030_STATUS_MCLKDET (1 << 7)
#define DA9034_STATUS_ONKEY (1 << 0)
#define DA9034_STATUS_EXTON (1 << 2)
#define DA9034_STATUS_CHDET (1 << 3)
#define DA9034_STATUS_TBAT (1 << 4)
#define DA9034_STATUS_VBATMON (1 << 5)
#define DA9034_STATUS_PEN_DOWN (1 << 6)
#define DA9034_STATUS_MCLKDET (1 << 7)
#define DA9034_STATUS_USB_DEV (1 << 8)
#define DA9034_STATUS_HEADSET (1 << 9)
#define DA9034_STATUS_HOOKSWITCH (1 << 10)
#define DA9034_STATUS_REMCON (1 << 11)
#define DA9034_STATUS_VBUS_VALID_4P55 (1 << 12)
#define DA9034_STATUS_VBUS_VALID_3P8 (1 << 13)
#define DA9034_STATUS_SESS_VALID_1P8 (1 << 14)
#define DA9034_STATUS_SRP_READY (1 << 15)
extern int da903x_query_status(struct device *dev, unsigned int status);
/* NOTE: the two functions below are not intended for use outside
* of the DA9034 sub-device drivers
*/
extern int da903x_write(struct device *dev, int reg, uint8_t val);
extern int da903x_read(struct device *dev, int reg, uint8_t *val);
extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask);
extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
#endif /* __LINUX_PMIC_DA903X_H */
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include <linux/mfd/tmio.h> #include <linux/mfd/tmio.h>
struct t7l66xb_platform_data { struct t7l66xb_platform_data {
int (*enable_clk32k)(struct platform_device *dev);
void (*disable_clk32k)(struct platform_device *dev);
int (*enable)(struct platform_device *dev); int (*enable)(struct platform_device *dev);
int (*disable)(struct platform_device *dev); int (*disable)(struct platform_device *dev);
int (*suspend)(struct platform_device *dev); int (*suspend)(struct platform_device *dev);
......
...@@ -11,9 +11,6 @@ ...@@ -11,9 +11,6 @@
#define MFD_TC6387XB_H #define MFD_TC6387XB_H
struct tc6387xb_platform_data { struct tc6387xb_platform_data {
int (*enable_clk32k)(struct platform_device *dev);
void (*disable_clk32k)(struct platform_device *dev);
int (*enable)(struct platform_device *dev); int (*enable)(struct platform_device *dev);
int (*disable)(struct platform_device *dev); int (*disable)(struct platform_device *dev);
int (*suspend)(struct platform_device *dev); int (*suspend)(struct platform_device *dev);
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
#ifndef MFD_TC6393XB_H #ifndef MFD_TC6393XB_H
#define MFD_TC6393XB_H #define MFD_TC6393XB_H
#include <linux/fb.h>
/* Also one should provide the CK3P6MI clock */ /* Also one should provide the CK3P6MI clock */
struct tc6393xb_platform_data { struct tc6393xb_platform_data {
u16 scr_pll2cr; /* PLL2 Control */ u16 scr_pll2cr; /* PLL2 Control */
u16 scr_gper; /* GP Enable */ u16 scr_gper; /* GP Enable */
u32 scr_gpo_doecr; /* GPO Data OE Control */
u32 scr_gpo_dsr; /* GPO Data Set */
int (*enable)(struct platform_device *dev); int (*enable)(struct platform_device *dev);
int (*disable)(struct platform_device *dev); int (*disable)(struct platform_device *dev);
...@@ -31,15 +31,28 @@ struct tc6393xb_platform_data { ...@@ -31,15 +31,28 @@ struct tc6393xb_platform_data {
int irq_base; /* base for subdevice irqs */ int irq_base; /* base for subdevice irqs */
int gpio_base; int gpio_base;
int (*setup)(struct platform_device *dev);
void (*teardown)(struct platform_device *dev);
struct tmio_nand_data *nand_data; struct tmio_nand_data *nand_data;
struct tmio_fb_data *fb_data;
unsigned resume_restore : 1; /* make special actions
to preserve the state
on suspend/resume */
}; };
extern int tc6393xb_lcd_mode(struct platform_device *fb,
const struct fb_videomode *mode);
extern int tc6393xb_lcd_set_power(struct platform_device *fb, bool on);
/* /*
* Relative to irq_base * Relative to irq_base
*/ */
#define IRQ_TC6393_NAND 0 #define IRQ_TC6393_NAND 0
#define IRQ_TC6393_MMC 1 #define IRQ_TC6393_MMC 1
#define IRQ_TC6393_OHCI 2
#define IRQ_TC6393_FB 4
#define TC6393XB_NR_IRQS 8 #define TC6393XB_NR_IRQS 8
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment