aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sre@kernel.org>2014-04-28 10:07:26 -0400
committerMark Brown <broonie@linaro.org>2014-05-01 13:57:34 -0400
commitd052a3d6a7955f917fe940b1fecdaf20fa61efae (patch)
tree3e8c6cec37c21606c6b49b090d9ec0dd53000e50
parentf29b542183df7dc74664799c356f9a041f67a10b (diff)
ASoC: omap: rx51: Add DT support
This patch adds device tree support to the Nokia N900 audio driver and adds documentation for the DT binding. Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--Documentation/devicetree/bindings/sound/nokia,rx51.txt27
-rw-r--r--sound/soc/omap/rx51.c53
2 files changed, 80 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/sound/nokia,rx51.txt b/Documentation/devicetree/bindings/sound/nokia,rx51.txt
new file mode 100644
index 000000000000..72f93d996273
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/nokia,rx51.txt
@@ -0,0 +1,27 @@
1* Nokia N900 audio setup
2
3Required properties:
4- compatible: Should contain "nokia,n900-audio"
5- nokia,cpu-dai: phandle for the McBSP node
6- nokia,audio-codec: phandles for the main TLV320AIC3X node and the
7 auxiliary TLV320AIC3X node (in this order)
8- nokia,headphone-amplifier: phandle for the TPA6130A2 node
9- tvout-selection-gpios: GPIO for tvout selection
10- jack-detection-gpios: GPIO for jack detection
11- eci-switch-gpios: GPIO for ECI (Enhancement Control Interface) switch
12- speaker-amplifier-gpios: GPIO for speaker amplifier
13
14Example:
15
16sound {
17 compatible = "nokia,n900-audio";
18
19 nokia,cpu-dai = <&mcbsp2>;
20 nokia,audio-codec = <&tlv320aic3x>, <&tlv320aic3x_aux>;
21 nokia,headphone-amplifier = <&tpa6130a2>;
22
23 tvout-selection-gpios = <&gpio2 8 GPIO_ACTIVE_HIGH>; /* 40 */
24 jack-detection-gpios = <&gpio6 17 GPIO_ACTIVE_HIGH>; /* 177 */
25 eci-switch-gpios = <&gpio6 22 GPIO_ACTIVE_HIGH>; /* 182 */
26 speaker-amplifier-gpios = <&twl_gpio 7 GPIO_ACTIVE_HIGH>;
27};
diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
index 110deca7fcbb..866578bcda55 100644
--- a/sound/soc/omap/rx51.c
+++ b/sound/soc/omap/rx51.c
@@ -386,6 +386,7 @@ static struct snd_soc_card rx51_sound_card = {
386static int rx51_soc_probe(struct platform_device *pdev) 386static int rx51_soc_probe(struct platform_device *pdev)
387{ 387{
388 struct rx51_audio_pdata *pdata; 388 struct rx51_audio_pdata *pdata;
389 struct device_node *np = pdev->dev.of_node;
389 struct snd_soc_card *card = &rx51_sound_card; 390 struct snd_soc_card *card = &rx51_sound_card;
390 int err; 391 int err;
391 392
@@ -394,6 +395,49 @@ static int rx51_soc_probe(struct platform_device *pdev)
394 395
395 card->dev = &pdev->dev; 396 card->dev = &pdev->dev;
396 397
398 if (np) {
399 struct device_node *dai_node;
400
401 dai_node = of_parse_phandle(np, "nokia,cpu-dai", 0);
402 if (!dai_node) {
403 dev_err(&pdev->dev, "McBSP node is not provided\n");
404 return -EINVAL;
405 }
406 rx51_dai[0].cpu_dai_name = NULL;
407 rx51_dai[0].platform_name = NULL;
408 rx51_dai[0].cpu_of_node = dai_node;
409 rx51_dai[0].platform_of_node = dai_node;
410
411 dai_node = of_parse_phandle(np, "nokia,audio-codec", 0);
412 if (!dai_node) {
413 dev_err(&pdev->dev, "Codec node is not provided\n");
414 return -EINVAL;
415 }
416 rx51_dai[0].codec_name = NULL;
417 rx51_dai[0].codec_of_node = dai_node;
418
419 dai_node = of_parse_phandle(np, "nokia,audio-codec", 1);
420 if (!dai_node) {
421 dev_err(&pdev->dev, "Auxiliary Codec node is not provided\n");
422 return -EINVAL;
423 }
424 rx51_aux_dev[0].codec_name = NULL;
425 rx51_aux_dev[0].codec_of_node = dai_node;
426 rx51_codec_conf[0].dev_name = NULL;
427 rx51_codec_conf[0].of_node = dai_node;
428
429 dai_node = of_parse_phandle(np, "nokia,headphone-amplifier", 0);
430 if (!dai_node) {
431 dev_err(&pdev->dev, "Headphone amplifier node is not provided\n");
432 return -EINVAL;
433 }
434
435 /* TODO: tpa6130a2a driver supports only a single instance, so
436 * this driver ignores the headphone-amplifier node for now.
437 * It's already mandatory in the DT binding to be future proof.
438 */
439 }
440
397 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 441 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
398 if (pdata == NULL) { 442 if (pdata == NULL) {
399 dev_err(card->dev, "failed to create private data\n"); 443 dev_err(card->dev, "failed to create private data\n");
@@ -463,10 +507,19 @@ static int rx51_soc_remove(struct platform_device *pdev)
463 return 0; 507 return 0;
464} 508}
465 509
510#if defined(CONFIG_OF)
511static const struct of_device_id rx51_audio_of_match[] = {
512 { .compatible = "nokia,n900-audio", },
513 {},
514};
515MODULE_DEVICE_TABLE(of, rx51_audio_of_match);
516#endif
517
466static struct platform_driver rx51_soc_driver = { 518static struct platform_driver rx51_soc_driver = {
467 .driver = { 519 .driver = {
468 .name = "rx51-audio", 520 .name = "rx51-audio",
469 .owner = THIS_MODULE, 521 .owner = THIS_MODULE,
522 .of_match_table = of_match_ptr(rx51_audio_of_match),
470 }, 523 },
471 .probe = rx51_soc_probe, 524 .probe = rx51_soc_probe,
472 .remove = rx51_soc_remove, 525 .remove = rx51_soc_remove,