kirkwood-i2s.c (033d777f548645c3a906b73eef5d665aeee55092) kirkwood-i2s.c (4734dc96ea50109ae08603af10804f989ff35437)
1/*
2 * kirkwood-i2s.c
3 *
4 * (c) 2010 Arnaud Patard <apatard@mandriva.com>
5 * (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the

--- 484 unchanged lines hidden (view full) ---

493 dev_err(&pdev->dev, "no clock\n");
494 return PTR_ERR(priv->clk);
495 }
496
497 err = clk_prepare_enable(priv->clk);
498 if (err < 0)
499 return err;
500
1/*
2 * kirkwood-i2s.c
3 *
4 * (c) 2010 Arnaud Patard <apatard@mandriva.com>
5 * (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the

--- 484 unchanged lines hidden (view full) ---

493 dev_err(&pdev->dev, "no clock\n");
494 return PTR_ERR(priv->clk);
495 }
496
497 err = clk_prepare_enable(priv->clk);
498 if (err < 0)
499 return err;
500
501 priv->extclk = clk_get(&pdev->dev, "extclk");
501 priv->extclk = devm_clk_get(&pdev->dev, "extclk");
502 if (!IS_ERR(priv->extclk)) {
503 if (priv->extclk == priv->clk) {
502 if (!IS_ERR(priv->extclk)) {
503 if (priv->extclk == priv->clk) {
504 clk_put(priv->extclk);
505 priv->extclk = ERR_PTR(-EINVAL);
506 } else {
507 dev_info(&pdev->dev, "found external clock\n");
508 clk_prepare_enable(priv->extclk);
509 soc_dai = &kirkwood_i2s_dai_extclk;
510 }
511 }
512

--- 11 unchanged lines hidden (view full) ---

524 }
525
526 err = snd_soc_register_component(&pdev->dev, &kirkwood_i2s_component,
527 soc_dai, 1);
528 if (!err)
529 return 0;
530 dev_err(&pdev->dev, "snd_soc_register_component failed\n");
531
504 priv->extclk = ERR_PTR(-EINVAL);
505 } else {
506 dev_info(&pdev->dev, "found external clock\n");
507 clk_prepare_enable(priv->extclk);
508 soc_dai = &kirkwood_i2s_dai_extclk;
509 }
510 }
511

--- 11 unchanged lines hidden (view full) ---

523 }
524
525 err = snd_soc_register_component(&pdev->dev, &kirkwood_i2s_component,
526 soc_dai, 1);
527 if (!err)
528 return 0;
529 dev_err(&pdev->dev, "snd_soc_register_component failed\n");
530
532 if (!IS_ERR(priv->extclk)) {
531 if (!IS_ERR(priv->extclk))
533 clk_disable_unprepare(priv->extclk);
532 clk_disable_unprepare(priv->extclk);
534 clk_put(priv->extclk);
535 }
536 clk_disable_unprepare(priv->clk);
537
538 return err;
539}
540
541static int kirkwood_i2s_dev_remove(struct platform_device *pdev)
542{
543 struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev);
544
545 snd_soc_unregister_component(&pdev->dev);
546
533 clk_disable_unprepare(priv->clk);
534
535 return err;
536}
537
538static int kirkwood_i2s_dev_remove(struct platform_device *pdev)
539{
540 struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev);
541
542 snd_soc_unregister_component(&pdev->dev);
543
547 if (!IS_ERR(priv->extclk)) {
544 if (!IS_ERR(priv->extclk))
548 clk_disable_unprepare(priv->extclk);
545 clk_disable_unprepare(priv->extclk);
549 clk_put(priv->extclk);
550 }
551 clk_disable_unprepare(priv->clk);
552
553 return 0;
554}
555
556static struct platform_driver kirkwood_i2s_driver = {
557 .probe = kirkwood_i2s_dev_probe,
558 .remove = kirkwood_i2s_dev_remove,

--- 13 unchanged lines hidden ---
546 clk_disable_unprepare(priv->clk);
547
548 return 0;
549}
550
551static struct platform_driver kirkwood_i2s_driver = {
552 .probe = kirkwood_i2s_dev_probe,
553 .remove = kirkwood_i2s_dev_remove,

--- 13 unchanged lines hidden ---