aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorMisael Lopez Cruz <misael.lopez@ti.com>2011-12-19 12:40:28 -0600
committerZiyann <jaraidaniel@gmail.com>2014-10-01 12:55:48 +0200
commit159128bc2e8f4add7c55430a6248c9cfdc394165 (patch)
treedbbcea8958330443137f1f8346ec10fac5106a49 /drivers/mfd
parent456a3b47229c36ea4356f6b7c7cdf76f63eb58fa (diff)
downloadkernel_samsung_tuna-159128bc2e8f4add7c55430a6248c9cfdc394165.zip
kernel_samsung_tuna-159128bc2e8f4add7c55430a6248c9cfdc394165.tar.gz
kernel_samsung_tuna-159128bc2e8f4add7c55430a6248c9cfdc394165.tar.bz2
MFD: twl6040-codec: Add platform init/exit
Add init/exit to TWL6040 MFD platform data in order to provide a mechanism to allow platform level initializations (e.g. pin muxing). Change-Id: Ifea3af2ba94196e4b7d1ccd14ebcc541443cfe73 Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/twl6040-codec.c15
1 files changed, 15 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);