From 159128bc2e8f4add7c55430a6248c9cfdc394165 Mon Sep 17 00:00:00 2001 From: Misael Lopez Cruz Date: Mon, 19 Dec 2011 12:40:28 -0600 Subject: 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 --- drivers/mfd/twl6040-codec.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drivers/mfd') 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); -- cgit v1.1