diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2012-03-08 11:59:46 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-09 06:38:12 -0500 |
commit | 2b81ec69144de93f29fa258d3435557a5773ffb5 (patch) | |
tree | f5d563ede6fdbef43fec6249ad266a644aa5ba56 /sound/soc/fsl | |
parent | 5b596483936230b926898efe10f9cc258d5ed092 (diff) |
ASoC: fsl: check property 'compatible' for the machine name
Check /compatible rather than /model to determine the machine name.
The p1022ds older device trees get a different /model from the new
ones, while /compatible is consistent there, so checking /compatible
will save the bother of detecting older p1022ds device trees.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r-- | sound/soc/fsl/fsl_ssi.c | 6 | ||||
-rw-r--r-- | sound/soc/fsl/mpc8610_hpcd.c | 2 | ||||
-rw-r--r-- | sound/soc/fsl/p1022_ds.c | 32 |
3 files changed, 9 insertions, 31 deletions
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 3e066966d878..2eb407fa3b48 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -716,12 +716,12 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev) | |||
716 | } | 716 | } |
717 | 717 | ||
718 | /* Trigger the machine driver's probe function. The platform driver | 718 | /* Trigger the machine driver's probe function. The platform driver |
719 | * name of the machine driver is taken from the /model property of the | 719 | * name of the machine driver is taken from /compatible property of the |
720 | * device tree. We also pass the address of the CPU DAI driver | 720 | * device tree. We also pass the address of the CPU DAI driver |
721 | * structure. | 721 | * structure. |
722 | */ | 722 | */ |
723 | sprop = of_get_property(of_find_node_by_path("/"), "model", NULL); | 723 | sprop = of_get_property(of_find_node_by_path("/"), "compatible", NULL); |
724 | /* Sometimes the model name has a "fsl," prefix, so we strip that. */ | 724 | /* Sometimes the compatible name has a "fsl," prefix, so we strip it. */ |
725 | p = strrchr(sprop, ','); | 725 | p = strrchr(sprop, ','); |
726 | if (p) | 726 | if (p) |
727 | sprop = p + 1; | 727 | sprop = p + 1; |
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index fcf9302f59b4..afbabf427f27 100644 --- a/sound/soc/fsl/mpc8610_hpcd.c +++ b/sound/soc/fsl/mpc8610_hpcd.c | |||
@@ -546,7 +546,7 @@ static struct platform_driver mpc8610_hpcd_driver = { | |||
546 | .probe = mpc8610_hpcd_probe, | 546 | .probe = mpc8610_hpcd_probe, |
547 | .remove = __devexit_p(mpc8610_hpcd_remove), | 547 | .remove = __devexit_p(mpc8610_hpcd_remove), |
548 | .driver = { | 548 | .driver = { |
549 | /* The name must match the 'model' property in the device tree, | 549 | /* The name must match 'compatible' property in the device tree, |
550 | * in lowercase letters. | 550 | * in lowercase letters. |
551 | */ | 551 | */ |
552 | .name = "snd-soc-mpc8610hpcd", | 552 | .name = "snd-soc-mpc8610hpcd", |
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c index d32ec4646d25..b88987083475 100644 --- a/sound/soc/fsl/p1022_ds.c +++ b/sound/soc/fsl/p1022_ds.c | |||
@@ -543,6 +543,11 @@ static struct platform_driver p1022_ds_driver = { | |||
543 | .probe = p1022_ds_probe, | 543 | .probe = p1022_ds_probe, |
544 | .remove = __devexit_p(p1022_ds_remove), | 544 | .remove = __devexit_p(p1022_ds_remove), |
545 | .driver = { | 545 | .driver = { |
546 | /* | ||
547 | * The name must match 'compatible' property in the device tree, | ||
548 | * in lowercase letters. | ||
549 | */ | ||
550 | .name = "snd-soc-p1022ds", | ||
546 | .owner = THIS_MODULE, | 551 | .owner = THIS_MODULE, |
547 | }, | 552 | }, |
548 | }; | 553 | }; |
@@ -556,33 +561,6 @@ static int __init p1022_ds_init(void) | |||
556 | { | 561 | { |
557 | struct device_node *guts_np; | 562 | struct device_node *guts_np; |
558 | struct resource res; | 563 | struct resource res; |
559 | const char *sprop; | ||
560 | |||
561 | /* | ||
562 | * Check if we're actually running on a P1022DS. Older device trees | ||
563 | * have a model of "fsl,P1022" and newer ones use "fsl,P1022DS", so we | ||
564 | * need to support both. The SSI driver uses that property to link to | ||
565 | * the machine driver, so have to match it. | ||
566 | */ | ||
567 | sprop = of_get_property(of_find_node_by_path("/"), "model", NULL); | ||
568 | if (!sprop) { | ||
569 | pr_err("snd-soc-p1022ds: missing /model node"); | ||
570 | return -ENODEV; | ||
571 | } | ||
572 | |||
573 | pr_debug("snd-soc-p1022ds: board model name is %s\n", sprop); | ||
574 | |||
575 | /* | ||
576 | * The name of this board, taken from the device tree. Normally, this is a* | ||
577 | * fixed string, but some P1022DS device trees have a /model property of | ||
578 | * "fsl,P1022", and others have "fsl,P1022DS". | ||
579 | */ | ||
580 | if (strcasecmp(sprop, "fsl,p1022ds") == 0) | ||
581 | p1022_ds_driver.driver.name = "snd-soc-p1022ds"; | ||
582 | else if (strcasecmp(sprop, "fsl,p1022") == 0) | ||
583 | p1022_ds_driver.driver.name = "snd-soc-p1022"; | ||
584 | else | ||
585 | return -ENODEV; | ||
586 | 564 | ||
587 | /* Get the physical address of the global utilities registers */ | 565 | /* Get the physical address of the global utilities registers */ |
588 | guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts"); | 566 | guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts"); |