aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/twl6040-codec.c15
-rw-r--r--include/linux/i2c/twl.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/drivers/mfd/twl6040-codec.c b/drivers/mfd/twl6040-codec.c
index 0ad9184..989773d 100644
--- a/drivers/mfd/twl6040-codec.c
+++ b/drivers/mfd/twl6040-codec.c
@@ -669,6 +669,15 @@ static int __devinit twl6040_probe(struct platform_device *pdev)
mutex_init(&twl6040->mutex);
mutex_init(&twl6040->io_mutex);
+ if (pdata->init) {
+ ret = pdata->init();
+ if (ret) {
+ dev_err(twl6040->dev, "Platform init failed %d\n",
+ ret);
+ goto init_err;
+ }
+ }
+
twl6040->icrev = twl6040_reg_read(twl6040, TWL6040_REG_ASICREV);
if (twl6040->icrev < 0) {
ret = twl6040->icrev;
@@ -773,6 +782,9 @@ gpio2_err:
if (gpio_is_valid(audpwron))
gpio_free(audpwron);
gpio1_err:
+ if (pdata->exit)
+ pdata->exit();
+init_err:
platform_set_drvdata(pdev, NULL);
kfree(twl6040);
return ret;
@@ -800,6 +812,9 @@ static int __devexit twl6040_remove(struct platform_device *pdev)
if (pdata->put_ext_clk32k)
pdata->put_ext_clk32k();
+ if (pdata->exit)
+ pdata->exit();
+
platform_set_drvdata(pdev, NULL);
kfree(twl6040);
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 46cba075..0ce0057 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -748,6 +748,9 @@ struct twl4030_codec_data {
struct twl4030_codec_audio_data *audio;
struct twl4030_codec_vibra_data *vibra;
+ int (*init)(void);
+ void (*exit)(void);
+
/* twl6040 */
int audpwron_gpio; /* audio power-on gpio */
int naudint_irq; /* audio interrupt */