diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2012-05-16 07:11:57 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-05-20 11:27:12 -0400 |
commit | 1f01d60e4c0cae3416071680635f227df0020dd8 (patch) | |
tree | cb1e9884f2d71b402ed447c4164453e4d6b989c2 /drivers/mfd | |
parent | 6712419d697851c4472cdfd2111c844d777472e8 (diff) |
mfd: Register the twl6040 child for the ASoC codec unconditionally
The main function of the twl6040 is to provide audio on OMAP4+ platforms.
Since the ASoC codec driver can work without the pdata we can register the
child to load the codec driver whenever the twl6040 MFD driver is loaded.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/twl6040-core.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c index c50fba7be778..9765dc2b0ca3 100644 --- a/drivers/mfd/twl6040-core.c +++ b/drivers/mfd/twl6040-core.c | |||
@@ -507,7 +507,7 @@ static int __devinit twl6040_probe(struct i2c_client *client, | |||
507 | struct twl6040_platform_data *pdata = client->dev.platform_data; | 507 | struct twl6040_platform_data *pdata = client->dev.platform_data; |
508 | struct twl6040 *twl6040; | 508 | struct twl6040 *twl6040; |
509 | struct mfd_cell *cell = NULL; | 509 | struct mfd_cell *cell = NULL; |
510 | int ret, children = 0; | 510 | int irq, ret, children = 0; |
511 | 511 | ||
512 | if (!pdata) { | 512 | if (!pdata) { |
513 | dev_err(&client->dev, "Platform data is missing\n"); | 513 | dev_err(&client->dev, "Platform data is missing\n"); |
@@ -589,22 +589,27 @@ static int __devinit twl6040_probe(struct i2c_client *client, | |||
589 | /* dual-access registers controlled by I2C only */ | 589 | /* dual-access registers controlled by I2C only */ |
590 | twl6040_set_bits(twl6040, TWL6040_REG_ACCCTL, TWL6040_I2CSEL); | 590 | twl6040_set_bits(twl6040, TWL6040_REG_ACCCTL, TWL6040_I2CSEL); |
591 | 591 | ||
592 | /* | ||
593 | * The main functionality of twl6040 to provide audio on OMAP4+ systems. | ||
594 | * We can add the ASoC codec child whenever this driver has been loaded. | ||
595 | * The ASoC codec can work without pdata, pass the platform_data only if | ||
596 | * it has been provided. | ||
597 | */ | ||
598 | irq = twl6040->irq_base + TWL6040_IRQ_PLUG; | ||
599 | cell = &twl6040->cells[children]; | ||
600 | cell->name = "twl6040-codec"; | ||
601 | twl6040_codec_rsrc[0].start = irq; | ||
602 | twl6040_codec_rsrc[0].end = irq; | ||
603 | cell->resources = twl6040_codec_rsrc; | ||
604 | cell->num_resources = ARRAY_SIZE(twl6040_codec_rsrc); | ||
592 | if (pdata->codec) { | 605 | if (pdata->codec) { |
593 | int irq = twl6040->irq_base + TWL6040_IRQ_PLUG; | ||
594 | |||
595 | cell = &twl6040->cells[children]; | ||
596 | cell->name = "twl6040-codec"; | ||
597 | twl6040_codec_rsrc[0].start = irq; | ||
598 | twl6040_codec_rsrc[0].end = irq; | ||
599 | cell->resources = twl6040_codec_rsrc; | ||
600 | cell->num_resources = ARRAY_SIZE(twl6040_codec_rsrc); | ||
601 | cell->platform_data = pdata->codec; | 606 | cell->platform_data = pdata->codec; |
602 | cell->pdata_size = sizeof(*pdata->codec); | 607 | cell->pdata_size = sizeof(*pdata->codec); |
603 | children++; | ||
604 | } | 608 | } |
609 | children++; | ||
605 | 610 | ||
606 | if (pdata->vibra) { | 611 | if (pdata->vibra) { |
607 | int irq = twl6040->irq_base + TWL6040_IRQ_VIB; | 612 | irq = twl6040->irq_base + TWL6040_IRQ_VIB; |
608 | 613 | ||
609 | cell = &twl6040->cells[children]; | 614 | cell = &twl6040->cells[children]; |
610 | cell->name = "twl6040-vibra"; | 615 | cell->name = "twl6040-vibra"; |
@@ -618,16 +623,10 @@ static int __devinit twl6040_probe(struct i2c_client *client, | |||
618 | children++; | 623 | children++; |
619 | } | 624 | } |
620 | 625 | ||
621 | if (children) { | 626 | ret = mfd_add_devices(&client->dev, -1, twl6040->cells, children, |
622 | ret = mfd_add_devices(&client->dev, -1, twl6040->cells, | 627 | NULL, 0); |
623 | children, NULL, 0); | 628 | if (ret) |
624 | if (ret) | ||
625 | goto mfd_err; | ||
626 | } else { | ||
627 | dev_err(&client->dev, "No platform data found for children\n"); | ||
628 | ret = -ENODEV; | ||
629 | goto mfd_err; | 629 | goto mfd_err; |
630 | } | ||
631 | 630 | ||
632 | return 0; | 631 | return 0; |
633 | 632 | ||