| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright 2011 Freescale Semiconductor, Inc. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 6 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 7 | | - * (at your option) any later version. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | | - * GNU General Public License for more details. |
|---|
| 13 | | - * |
|---|
| 14 | | - * You should have received a copy of the GNU General Public License along |
|---|
| 15 | | - * with this program; if not, write to the Free Software Foundation, Inc., |
|---|
| 16 | | - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|---|
| 17 | 4 | */ |
|---|
| 18 | 5 | |
|---|
| 19 | 6 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 26 | 13 | #include <linux/clk.h> |
|---|
| 27 | 14 | #include <linux/clk-provider.h> |
|---|
| 28 | 15 | #include <linux/delay.h> |
|---|
| 16 | +#include <linux/io.h> |
|---|
| 29 | 17 | #include <linux/time.h> |
|---|
| 30 | 18 | #include <sound/core.h> |
|---|
| 31 | 19 | #include <sound/pcm.h> |
|---|
| .. | .. |
|---|
| 467 | 455 | * basic clock which should be fast enough for the internal |
|---|
| 468 | 456 | * logic. |
|---|
| 469 | 457 | */ |
|---|
| 470 | | - clk_enable(saif->clk); |
|---|
| 458 | + ret = clk_enable(saif->clk); |
|---|
| 459 | + if (ret) |
|---|
| 460 | + return ret; |
|---|
| 461 | + |
|---|
| 471 | 462 | ret = clk_set_rate(saif->clk, 24000000); |
|---|
| 472 | 463 | clk_disable(saif->clk); |
|---|
| 473 | 464 | if (ret) |
|---|
| .. | .. |
|---|
| 744 | 735 | static int mxs_saif_probe(struct platform_device *pdev) |
|---|
| 745 | 736 | { |
|---|
| 746 | 737 | struct device_node *np = pdev->dev.of_node; |
|---|
| 747 | | - struct resource *iores; |
|---|
| 748 | 738 | struct mxs_saif *saif; |
|---|
| 749 | | - int irq, ret = 0; |
|---|
| 739 | + int irq, ret; |
|---|
| 750 | 740 | struct device_node *master; |
|---|
| 751 | | - |
|---|
| 752 | | - if (!np) |
|---|
| 753 | | - return -EINVAL; |
|---|
| 754 | 741 | |
|---|
| 755 | 742 | saif = devm_kzalloc(&pdev->dev, sizeof(*saif), GFP_KERNEL); |
|---|
| 756 | 743 | if (!saif) |
|---|
| .. | .. |
|---|
| 777 | 764 | saif->master_id = saif->id; |
|---|
| 778 | 765 | } else { |
|---|
| 779 | 766 | ret = of_alias_get_id(master, "saif"); |
|---|
| 767 | + of_node_put(master); |
|---|
| 780 | 768 | if (ret < 0) |
|---|
| 781 | 769 | return ret; |
|---|
| 782 | 770 | else |
|---|
| .. | .. |
|---|
| 798 | 786 | return ret; |
|---|
| 799 | 787 | } |
|---|
| 800 | 788 | |
|---|
| 801 | | - iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 802 | | - |
|---|
| 803 | | - saif->base = devm_ioremap_resource(&pdev->dev, iores); |
|---|
| 789 | + saif->base = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 804 | 790 | if (IS_ERR(saif->base)) |
|---|
| 805 | 791 | return PTR_ERR(saif->base); |
|---|
| 806 | 792 | |
|---|
| 807 | 793 | irq = platform_get_irq(pdev, 0); |
|---|
| 808 | | - if (irq < 0) { |
|---|
| 809 | | - ret = irq; |
|---|
| 810 | | - dev_err(&pdev->dev, "failed to get irq resource: %d\n", |
|---|
| 811 | | - ret); |
|---|
| 812 | | - return ret; |
|---|
| 813 | | - } |
|---|
| 794 | + if (irq < 0) |
|---|
| 795 | + return irq; |
|---|
| 814 | 796 | |
|---|
| 815 | 797 | saif->dev = &pdev->dev; |
|---|
| 816 | 798 | ret = devm_request_irq(&pdev->dev, irq, mxs_saif_irq, 0, |
|---|