.. | .. |
---|
1 | | -/* ALSA Soc Audio Layer - I2S core for newer Samsung SoCs. |
---|
2 | | - * |
---|
3 | | - * Copyright (c) 2006 Wolfson Microelectronics PLC. |
---|
4 | | - * Graeme Gregory graeme.gregory@wolfsonmicro.com |
---|
5 | | - * linux@wolfsonmicro.com |
---|
6 | | - * |
---|
7 | | - * Copyright (c) 2008, 2007, 2004-2005 Simtec Electronics |
---|
8 | | - * http://armlinux.simtec.co.uk/ |
---|
9 | | - * Ben Dooks <ben@simtec.co.uk> |
---|
10 | | - * |
---|
11 | | - * This program is free software; you can redistribute it and/or modify it |
---|
12 | | - * under the terms of the GNU General Public License as published by the |
---|
13 | | - * Free Software Foundation; either version 2 of the License, or (at your |
---|
14 | | - * option) any later version. |
---|
15 | | - */ |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
---|
| 2 | +// |
---|
| 3 | +// ALSA Soc Audio Layer - I2S core for newer Samsung SoCs. |
---|
| 4 | +// |
---|
| 5 | +// Copyright (c) 2006 Wolfson Microelectronics PLC. |
---|
| 6 | +// Graeme Gregory graeme.gregory@wolfsonmicro.com |
---|
| 7 | +// linux@wolfsonmicro.com |
---|
| 8 | +// |
---|
| 9 | +// Copyright (c) 2008, 2007, 2004-2005 Simtec Electronics |
---|
| 10 | +// http://armlinux.simtec.co.uk/ |
---|
| 11 | +// Ben Dooks <ben@simtec.co.uk> |
---|
16 | 12 | |
---|
17 | 13 | #include <linux/module.h> |
---|
18 | 14 | #include <linux/delay.h> |
---|
.. | .. |
---|
383 | 379 | static int s3c2412_i2s_trigger(struct snd_pcm_substream *substream, int cmd, |
---|
384 | 380 | struct snd_soc_dai *dai) |
---|
385 | 381 | { |
---|
386 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
---|
387 | | - struct s3c_i2sv2_info *i2s = to_info(rtd->cpu_dai); |
---|
| 382 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
---|
| 383 | + struct s3c_i2sv2_info *i2s = to_info(asoc_rtd_to_cpu(rtd, 0)); |
---|
388 | 384 | int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); |
---|
389 | 385 | unsigned long irqs; |
---|
390 | 386 | int ret = 0; |
---|
.. | .. |
---|
620 | 616 | EXPORT_SYMBOL_GPL(s3c_i2sv2_iis_calc_rate); |
---|
621 | 617 | |
---|
622 | 618 | int s3c_i2sv2_probe(struct snd_soc_dai *dai, |
---|
623 | | - struct s3c_i2sv2_info *i2s, |
---|
624 | | - unsigned long base) |
---|
| 619 | + struct s3c_i2sv2_info *i2s) |
---|
625 | 620 | { |
---|
626 | 621 | struct device *dev = dai->dev; |
---|
627 | 622 | unsigned int iismod; |
---|
.. | .. |
---|
660 | 655 | } |
---|
661 | 656 | EXPORT_SYMBOL_GPL(s3c_i2sv2_cleanup); |
---|
662 | 657 | |
---|
663 | | -#ifdef CONFIG_PM |
---|
664 | | -static int s3c2412_i2s_suspend(struct snd_soc_dai *dai) |
---|
665 | | -{ |
---|
666 | | - struct s3c_i2sv2_info *i2s = to_info(dai); |
---|
667 | | - u32 iismod; |
---|
668 | | - |
---|
669 | | - if (dai->active) { |
---|
670 | | - i2s->suspend_iismod = readl(i2s->regs + S3C2412_IISMOD); |
---|
671 | | - i2s->suspend_iiscon = readl(i2s->regs + S3C2412_IISCON); |
---|
672 | | - i2s->suspend_iispsr = readl(i2s->regs + S3C2412_IISPSR); |
---|
673 | | - |
---|
674 | | - /* some basic suspend checks */ |
---|
675 | | - |
---|
676 | | - iismod = readl(i2s->regs + S3C2412_IISMOD); |
---|
677 | | - |
---|
678 | | - if (iismod & S3C2412_IISCON_RXDMA_ACTIVE) |
---|
679 | | - pr_warning("%s: RXDMA active?\n", __func__); |
---|
680 | | - |
---|
681 | | - if (iismod & S3C2412_IISCON_TXDMA_ACTIVE) |
---|
682 | | - pr_warning("%s: TXDMA active?\n", __func__); |
---|
683 | | - |
---|
684 | | - if (iismod & S3C2412_IISCON_IIS_ACTIVE) |
---|
685 | | - pr_warning("%s: IIS active\n", __func__); |
---|
686 | | - } |
---|
687 | | - |
---|
688 | | - return 0; |
---|
689 | | -} |
---|
690 | | - |
---|
691 | | -static int s3c2412_i2s_resume(struct snd_soc_dai *dai) |
---|
692 | | -{ |
---|
693 | | - struct s3c_i2sv2_info *i2s = to_info(dai); |
---|
694 | | - |
---|
695 | | - pr_info("dai_active %d, IISMOD %08x, IISCON %08x\n", |
---|
696 | | - dai->active, i2s->suspend_iismod, i2s->suspend_iiscon); |
---|
697 | | - |
---|
698 | | - if (dai->active) { |
---|
699 | | - writel(i2s->suspend_iiscon, i2s->regs + S3C2412_IISCON); |
---|
700 | | - writel(i2s->suspend_iismod, i2s->regs + S3C2412_IISMOD); |
---|
701 | | - writel(i2s->suspend_iispsr, i2s->regs + S3C2412_IISPSR); |
---|
702 | | - |
---|
703 | | - writel(S3C2412_IISFIC_RXFLUSH | S3C2412_IISFIC_TXFLUSH, |
---|
704 | | - i2s->regs + S3C2412_IISFIC); |
---|
705 | | - |
---|
706 | | - ndelay(250); |
---|
707 | | - writel(0x0, i2s->regs + S3C2412_IISFIC); |
---|
708 | | - } |
---|
709 | | - |
---|
710 | | - return 0; |
---|
711 | | -} |
---|
712 | | -#else |
---|
713 | | -#define s3c2412_i2s_suspend NULL |
---|
714 | | -#define s3c2412_i2s_resume NULL |
---|
715 | | -#endif |
---|
716 | | - |
---|
717 | 658 | int s3c_i2sv2_register_component(struct device *dev, int id, |
---|
718 | 659 | const struct snd_soc_component_driver *cmp_drv, |
---|
719 | 660 | struct snd_soc_dai_driver *dai_drv) |
---|
.. | .. |
---|
730 | 671 | /* Allow overriding by (for example) IISv4 */ |
---|
731 | 672 | if (!ops->delay) |
---|
732 | 673 | ops->delay = s3c2412_i2s_delay; |
---|
733 | | - |
---|
734 | | - dai_drv->suspend = s3c2412_i2s_suspend; |
---|
735 | | - dai_drv->resume = s3c2412_i2s_resume; |
---|
736 | 674 | |
---|
737 | 675 | return devm_snd_soc_register_component(dev, cmp_drv, dai_drv, 1); |
---|
738 | 676 | } |
---|