aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/twl6040.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2013-07-12 07:32:02 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-07-30 20:02:55 -0400
commitdf04b6242a584ab3dcfe89221775085f60ba83dd (patch)
treeed8ca3ad7bef3b74fdc41c02dcdc25a48d25a595 /drivers/mfd/twl6040.c
parent6b845ba934cc425e43615032a2f046709b95a76c (diff)
mfd: twl6040: Remove support for legacy (pdata) mode
TWL6040 is used only with OMAP4/5 SoCs and they can only boot in in DT mode. The support for pdata/legacy boot can be removed. Add TODO comment to the header file that all pdata struct can be removed in the next merge window (after the sub driver updates are in). Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/twl6040.c')
-rw-r--r--drivers/mfd/twl6040.c55
1 files changed, 13 insertions, 42 deletions
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index 492ee2cd3400..a4034ed66dc0 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -44,17 +44,12 @@
44#define VIBRACTRL_MEMBER(reg) ((reg == TWL6040_REG_VIBCTLL) ? 0 : 1) 44#define VIBRACTRL_MEMBER(reg) ((reg == TWL6040_REG_VIBCTLL) ? 0 : 1)
45#define TWL6040_NUM_SUPPLIES (2) 45#define TWL6040_NUM_SUPPLIES (2)
46 46
47static bool twl6040_has_vibra(struct twl6040_platform_data *pdata, 47static bool twl6040_has_vibra(struct device_node *node)
48 struct device_node *node)
49{ 48{
50 if (pdata && pdata->vibra)
51 return true;
52
53#ifdef CONFIG_OF 49#ifdef CONFIG_OF
54 if (of_find_node_by_name(node, "vibra")) 50 if (of_find_node_by_name(node, "vibra"))
55 return true; 51 return true;
56#endif 52#endif
57
58 return false; 53 return false;
59} 54}
60 55
@@ -520,14 +515,13 @@ static struct regmap_irq_chip twl6040_irq_chip = {
520static int twl6040_probe(struct i2c_client *client, 515static int twl6040_probe(struct i2c_client *client,
521 const struct i2c_device_id *id) 516 const struct i2c_device_id *id)
522{ 517{
523 struct twl6040_platform_data *pdata = client->dev.platform_data;
524 struct device_node *node = client->dev.of_node; 518 struct device_node *node = client->dev.of_node;
525 struct twl6040 *twl6040; 519 struct twl6040 *twl6040;
526 struct mfd_cell *cell = NULL; 520 struct mfd_cell *cell = NULL;
527 int irq, ret, children = 0; 521 int irq, ret, children = 0;
528 522
529 if (!pdata && !node) { 523 if (!node) {
530 dev_err(&client->dev, "Platform data is missing\n"); 524 dev_err(&client->dev, "of node is missing\n");
531 return -EINVAL; 525 return -EINVAL;
532 } 526 }
533 527
@@ -576,13 +570,10 @@ static int twl6040_probe(struct i2c_client *client,
576 twl6040->rev = twl6040_reg_read(twl6040, TWL6040_REG_ASICREV); 570 twl6040->rev = twl6040_reg_read(twl6040, TWL6040_REG_ASICREV);
577 571
578 /* ERRATA: Automatic power-up is not possible in ES1.0 */ 572 /* ERRATA: Automatic power-up is not possible in ES1.0 */
579 if (twl6040_get_revid(twl6040) > TWL6040_REV_ES1_0) { 573 if (twl6040_get_revid(twl6040) > TWL6040_REV_ES1_0)
580 if (pdata) 574 twl6040->audpwron = of_get_named_gpio(node,
581 twl6040->audpwron = pdata->audpwron_gpio; 575 "ti,audpwron-gpio", 0);
582 else 576 else
583 twl6040->audpwron = of_get_named_gpio(node,
584 "ti,audpwron-gpio", 0);
585 } else
586 twl6040->audpwron = -EINVAL; 577 twl6040->audpwron = -EINVAL;
587 578
588 if (gpio_is_valid(twl6040->audpwron)) { 579 if (gpio_is_valid(twl6040->audpwron)) {
@@ -625,8 +616,6 @@ static int twl6040_probe(struct i2c_client *client,
625 /* 616 /*
626 * The main functionality of twl6040 to provide audio on OMAP4+ systems. 617 * The main functionality of twl6040 to provide audio on OMAP4+ systems.
627 * We can add the ASoC codec child whenever this driver has been loaded. 618 * We can add the ASoC codec child whenever this driver has been loaded.
628 * The ASoC codec can work without pdata, pass the platform_data only if
629 * it has been provided.
630 */ 619 */
631 irq = regmap_irq_get_virq(twl6040->irq_data, TWL6040_IRQ_PLUG); 620 irq = regmap_irq_get_virq(twl6040->irq_data, TWL6040_IRQ_PLUG);
632 cell = &twl6040->cells[children]; 621 cell = &twl6040->cells[children];
@@ -635,13 +624,10 @@ static int twl6040_probe(struct i2c_client *client,
635 twl6040_codec_rsrc[0].end = irq; 624 twl6040_codec_rsrc[0].end = irq;
636 cell->resources = twl6040_codec_rsrc; 625 cell->resources = twl6040_codec_rsrc;
637 cell->num_resources = ARRAY_SIZE(twl6040_codec_rsrc); 626 cell->num_resources = ARRAY_SIZE(twl6040_codec_rsrc);
638 if (pdata && pdata->codec) {
639 cell->platform_data = pdata->codec;
640 cell->pdata_size = sizeof(*pdata->codec);
641 }
642 children++; 627 children++;
643 628
644 if (twl6040_has_vibra(pdata, node)) { 629 /* Vibra input driver support */
630 if (twl6040_has_vibra(node)) {
645 irq = regmap_irq_get_virq(twl6040->irq_data, TWL6040_IRQ_VIB); 631 irq = regmap_irq_get_virq(twl6040->irq_data, TWL6040_IRQ_VIB);
646 632
647 cell = &twl6040->cells[children]; 633 cell = &twl6040->cells[children];
@@ -650,28 +636,13 @@ static int twl6040_probe(struct i2c_client *client,
650 twl6040_vibra_rsrc[0].end = irq; 636 twl6040_vibra_rsrc[0].end = irq;
651 cell->resources = twl6040_vibra_rsrc; 637 cell->resources = twl6040_vibra_rsrc;
652 cell->num_resources = ARRAY_SIZE(twl6040_vibra_rsrc); 638 cell->num_resources = ARRAY_SIZE(twl6040_vibra_rsrc);
653
654 if (pdata && pdata->vibra) {
655 cell->platform_data = pdata->vibra;
656 cell->pdata_size = sizeof(*pdata->vibra);
657 }
658 children++; 639 children++;
659 } 640 }
660 641
661 /* 642 /* GPO support */
662 * Enable the GPO driver in the following cases: 643 cell = &twl6040->cells[children];
663 * DT booted kernel or legacy boot with valid gpo platform_data 644 cell->name = "twl6040-gpo";
664 */ 645 children++;
665 if (!pdata || (pdata && pdata->gpo)) {
666 cell = &twl6040->cells[children];
667 cell->name = "twl6040-gpo";
668
669 if (pdata) {
670 cell->platform_data = pdata->gpo;
671 cell->pdata_size = sizeof(*pdata->gpo);
672 }
673 children++;
674 }
675 646
676 ret = mfd_add_devices(&client->dev, -1, twl6040->cells, children, 647 ret = mfd_add_devices(&client->dev, -1, twl6040->cells, children,
677 NULL, 0, NULL); 648 NULL, 0, NULL);