Commit graph

47 commits

Author SHA1 Message Date
Hin-Tak Leung
a03624a0ce v6.3: cleanup Playback/Capture data for snd_soc_dai
commit 3653480c68120dc16ebfeb80e529200dbbd98f92
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Tue Jan 31 02:02:04 2023 +0000

    ASoC: soc-dai.h: cleanup Playback/Capture data for snd_soc_dai

    Current snd_soc_dai has data for Playback/Capture, but it is very
    random. Someone is array (A), someone is playback/capture (B),
    and someone is tx/rx (C);

            struct snd_soc_dai {
                    ...
    (A)             unsigned int stream_active[SNDRV_PCM_STREAM_LAST + 1];

    (B)             struct snd_soc_dapm_widget *playback_widget;
    (B)             struct snd_soc_dapm_widget *capture_widget;

    (B)             void *playback_dma_data;
    (B)             void *capture_dma_data;

                    ...

    (C)             unsigned int tx_mask;
    (C)             unsigned int rx_mask;
            };

    Because of it, the code was very complicated.
    This patch creates new data structure to merge these into one,
    and tidyup the code.

    Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
    Link: https://lore.kernel.org/r/87cz6vea1v.wl-kuninori.morimoto.gx@renesas.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
2023-06-16 23:49:29 +01:00
Hin-Tak Leung
19067f3333 Second/Alternative change to correct for 5.5+ change in trigger order
The idea is the same as the previous attempt: calls ac101_trigger() just
before set_clock(1).

https://github.com/respeaker/seeed-voicecard/issues/290
    6mics / linear 4 mics: fails to record against v5.10 kernel
https://github.com/raspberrypi/linux/issues/4279
    [regression] alsa system call blocks on record between 5.4.83 and 5.5.19

In v5.5,

commit 4378f1fbe924054a09ff0d4e39e1a581b9245252
Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
Date:   Fri Sep 27 10:16:46 2019 +0300

    ASoC: soc-pcm: Use different sequence for start/stop trigger

    On stream stop currently we stop the DMA first followed by the CPU DAI.
    This can cause underflow (playback) or overflow (capture) on the DAI side
    as the DMA is no longer feeding data while the DAI is still active.
    It can be observed easily if the DAI side does not have FIFO (or it is
    disabled) to survive the time while the DMA is stopped, but still can
    happen on relatively slow CPUs when relatively high sampling rate is used:
    the FIFO is drained between the time the DMA is stopped and the DAI is
    stopped.

    It can only fixed by using different sequence within trigger for 'stop' and
    'start':
    case SNDRV_PCM_TRIGGER_START:
    case SNDRV_PCM_TRIGGER_RESUME:
    case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
            Trigger order: dai_link, DMA, CPU DAI then the codec

    case SNDRV_PCM_TRIGGER_STOP:
    case SNDRV_PCM_TRIGGER_SUSPEND:
    case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
            Trigger order: codec, CPU DAI, DMA then dai_link

    Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20190927071646.22319-1-peter.ujfalusi@ti.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-27 02:49:25 +01:00
Hin-Tak Leung
1774a54301 Additional debug code to where the *_trigger()'s finish. 2021-04-25 00:13:42 +01:00
Hin-Tak Leung
43b6034266 Breaking the spinlock into two halves, and possible fix to spinlock issue 2021-04-25 00:13:42 +01:00
Hin-Tak Leung
8e1c59be7e fix silly mistake in "v5.8: struct snd_soc_dai->active replaced by snd_soc_dai_active(snd_soc_dai)" 2021-04-08 04:01:13 +01:00
Hin-Tak Leung
794d7a3527 Merge branch 'v5.7' into v5.8 2020-09-28 17:11:24 +01:00
Hin-Tak Leung
c206a43374 Merge branch 'v5.5' into v5.7 2020-09-28 17:11:03 +01:00
Hin-Tak Leung
921ac8fba5 Following Standard ALSA Control Names convention
See kernel documentation, e.g. v5.5:Documentation/sound/designs/control-names.rst

Fixes https://github.com/respeaker/seeed-voicecard/issues/247
2020-09-28 16:38:30 +01:00
Hin-Tak Leung
e2529f9eee Merge branch 'v5.7' into v5.8 2020-09-14 14:56:27 +01:00
Hin-Tak Leung
6aff6e0b33 Merge branch 'v5.5' into v5.7 2020-09-14 14:55:59 +01:00
Hin-Tak Leung
cf2a5fe807 Use pr_warn() for recoverable errors, not pr_info() 2020-09-13 18:24:25 +01:00
Hin-Tak Leung
471f88b337 Use pr_info() for just routine information, not pr_warn() 2020-09-13 18:18:30 +01:00
Hin-Tak Leung
c3adcde556 v5.8: struct snd_soc_dai->active replaced by snd_soc_dai_active(snd_soc_dai)
commit 0812a08ac8d054efc6cf2895d3b0e82c8731f8e9
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Fri May 15 09:48:02 2020 +0900

    ASoC: cleanup dai / component active code

    No one is using dai->active, snd_soc_component_is_active().
    Let's remove these.

commit efffd9b344adbf813e3ae6f6136df80000bf2833
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Fri May 15 09:46:37 2020 +0900

    ASoC: soc-dai: add snd_soc_dai_active()

    Current snd_soc_dai_action() is updating
    dai->stream_active for Playback/Capture (A),
    dai->active        for DAI (B)

            void snd_soc_dai_action(struct snd_soc_dai *dai,
                                    int stream, int action)
            {
    (A)             dai->stream_active[stream]      += action;
    (B)             dai->active                     += action;
                    dai->component->active          += action;
            }

    But, these are very verbose, because we can calculate
    DAI active from stream_active.

    This patch adds snd_soc_dai_active() which calculate
    DAI active from DAI stream_active.
2020-08-30 19:19:57 +01:00
Hin-Tak Leung
60d2a5129d Adjust for v5.7, "ASoC: soc-pcm: merge playback/cature_active into stream_active"
perl -pi -e 's(->capture_active)(->stream_active\[SNDRV_PCM_STREAM_CAPTURE\])g' *.c
perl -pi -e 's(->playback_active)(->stream_active\[SNDRV_PCM_STREAM_PLAYBACK\])g' *.c

commit 0f6011fd79a2fb92cb80177fd6bdc8aac3a3cd93
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Mon Feb 17 17:28:15 2020 +0900

    ASoC: soc-pcm: merge playback/cature_active into stream_active

    DAI has playback_active and capture_active to care usage count.
    OTOH, we have SNDRV_PCM_STREAM_PLAYBACK/CAPTURE.
    But because of this kind of implementation mismatch,
    ALSA SoC has many verbose code.

    To solve this issue, this patch merge playback_active/capture_active
    into stream_active[2];
2020-07-25 05:22:34 +01:00
respeaker
b98fce84e0 Add: compatible to linux-4.18 or higher 2019-03-14 03:13:25 +00:00
turmary
95f4fe0688 Fix: remove spin lock in machine trigger 2018-11-27 09:47:44 +00:00
turmary
3392bf394b Fix: try to stop aif clock in thread environment 2018-11-07 18:33:55 -10:00
turmary
0965139ead Optimize: simplify AC101 debug message 2018-11-07 15:29:06 -10:00
turmary
a8d0a23583 Fix: ac101 i2c accessing is too often. 2018-05-21 03:33:46 +00:00
Peter.Yang
ccac09b842 Fix: reset ac101/ac108 chips after fill cache 2018-05-11 07:37:53 +00:00
turmary
0548a6d0a3 Fix: close work_switch when codec removeing 2018-04-24 04:28:14 +00:00
Peter.Yang
d0d9107c91 Move: simple-audio-card -> seeed-voicecard, module removing & inserting again supported 2018-04-04 09:36:18 +00:00
Peter.Yang
d660a92d73 Add: headset detection for 6-Mics Circular Array Kit and 4-Mics Linear Array Kit 2018-04-02 08:43:20 +00:00
Peter.Yang
8211f4c000 Fix: 4MIC recording by portaudio & pyaudio 2018-04-02 07:59:17 +00:00
Peter.Yang
80e0478c91 Update: doc about limit for doing capture & playback the same time 2018-03-29 08:29:55 +00:00
Peter.Yang
860d38fc47 Fix: i2c access fail when AC108 as master, support make DEBUG=1 2018-03-27 03:13:53 +00:00
Peter.Yang
1901914b56 Fix: limit of capture starting first. 2018-03-24 12:22:02 +00:00
Peter.Yang
7e1f29af35 Fix: clear the "PuPu" noise again after ac101 as Master 2018-03-24 11:05:46 +00:00
Peter.Yang
d3d95d0296 Fix: i2c access fail & channels miss order 2018-03-24 10:01:33 +00:00
Peter.Yang
22f495491a Fix: ac101 as master, ac108 pll source from ac101 bclk 2018-03-23 03:25:52 +00:00
Peter.Yang
235485652b Optimize: names & disable sample rate 96K 2018-03-13 08:30:43 +00:00
Peter.Yang
9dce807fb7 Fix: clear the "PuPu" noise at the very beginning of playback 2018-03-13 03:40:16 +00:00
Peter.Yang
6b6552bf9c Move: ac101 pll clock source set to bclk if it's slave mode 2018-03-07 06:34:33 +00:00
Peter.Yang
cff392127f Fix: ac101 noise import by PLL frequncy deviation 2018-03-06 09:37:14 +00:00
Peter.Yang
2f31ac4ea4 Fix: ac101 stereo widgets get/put interface 2018-02-27 02:58:10 +00:00
peter.yang
18eec1abfa Merge: ac108 & ac101 as single codec module 2018-02-10 15:16:01 +08:00
peter.yang
560008e8fd Remove: not used code 2018-02-07 17:35:12 +08:00
peter.yang
cf52966d00 Add: multi codec support in simple-card 2018-02-07 14:02:45 +08:00
peter.yang
edb5a1da65 Merge: ac108 work for 4mic & 8mic 2018-02-05 10:45:55 +08:00
peter.yang
995c17c160 Add: export start-clock interface in ac101 to simple-card 2018-01-30 19:12:47 +08:00
peter.yang
780db6f6ab Add: speaker out is OK 2018-01-26 11:08:09 +08:00
peter.yang
b032c0664d Add: ac101 dsp_a mode, tdm enabled, 8 slot, 32bit OK 2018-01-24 20:18:58 +08:00
peter.yang
56da9a526c Bugfix: AC101 miss channels order in cpu_dai, channel map IN(0,1,2,3,4,5,6,7)->OUT(2,3,4,5,6,7,0,1) 2018-01-23 16:46:15 +08:00
peter.yang
c3367740d5 Remove: widgets and routes isnt for volume controlling 2018-01-23 16:19:00 +08:00
peter.yang
156697545a Remove: switch detecting 2018-01-22 16:08:32 +08:00
peter.yang
aec1941ae1 Add: ac101 dsp_a mode, playing 2 in 8 channels OK 2018-01-19 19:25:15 +08:00
peter.yang
7aae0e3353 add original ac101 reference driver 2018-01-12 16:37:28 +08:00