Commit graph

49 commits

Author SHA1 Message Date
Jacopo Maroli
97ca55da44 fix channel ordering 2023-01-31 21:22:50 +00: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
5793cf6bf0 Revert "Operational change to correct for 5.5+ change in trigger order; REVISIT!"
This reverts commit e553d4f851.
2021-04-27 02:49:08 +01:00
Hin-Tak Leung
e553d4f851 Operational change to correct for 5.5+ change in trigger order; REVISIT!
Need to revisit, and do in a different way.

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-25 00:13:42 +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
af484de3af v4.17: replace codec to component
https://www.alsa-project.org/pipermail/alsa-devel/2018-January/thread.html#131069

https://www.alsa-project.org/pipermail/alsa-devel/2018-January/131070.html
[alsa-devel] [PATCH v2 00/39] ASoC: replace platform/codec component   Kuninori Morimoto

https://www.alsa-project.org/pipermail/alsa-devel/2018-January/131111.html
[alsa-devel] [PATCH v2 000/186] ASoC: replace codec component   Kuninori Morimoto
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
ebcf755c1a v5.9: .digital_mute merged into .mute_stream with adjustments
Reference:

commit e2978c45e5ed3bab7f69477b882ef588185b30cc
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Fri Jul 17 09:21:54 2020 +0900

    ASoC: soc-dai: remove .digital_mute

    All drivers are now using .mute_stream.
    Let's remove .digital_mute.

commit 22e9b54307987787efa0ee534aa9e31982ec1161
Merge: dc9584c5a3b8 a0234d0e6014
Author: Mark Brown <broonie@kernel.org>
Date:   Fri Jul 17 14:47:04 2020 +0100

    Merge series "ASoC: merge .digital_mute() into .mute_stream()" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

    These are v4 digital_mute() patch which adjusts
    to atmel which had conflict on v3.

    v3 -> v4
            - tidyup for atmel which had conflict

$ git diff dc9584c5a3b8...a0234d0e6014

commit bdd0c277d9846977ec3f175341d4e7475ed26ef7
Merge: d235b2823698 50891431aaad
Author: Mark Brown <broonie@kernel.org>
Date:   Thu Jul 16 23:51:51 2020 +0100

    Merge series "ASoC: merge .digital_mute() into .mute_stream()" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

    These are v3 patch-set.
    ALSA SoC has 2 mute callbacks (= .digital_mute(), .mute_stream()).
    But the difference between these 2 are very small.
            .digital_mute() is for Playback
            .mute_stream()  is for Playback/Capture

    This patch-set adds new .no_capture_mute flag and emulate
    .digital_mute() by .mute_stream().

    v2 -> v3
            - uses "xxx_mute_stream" for .mute_stream naming
              if it was better
            - removed verbose Cc email address

$ git diff d235b2823698...50891431aaad

commit 350d993510115e3d9e78f1b3359bff7b68e88418
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Thu Jul 9 10:55:41 2020 +0900

    ASoC: soc-dai.c: add .no_capture_mute support
2020-11-27 00:07:47 +00:00
Hin-Tak Leung
6aff6e0b33 Merge branch 'v5.5' into v5.7 2020-09-14 14:55:59 +01:00
Hin-Tak Leung
bb09e9d24b emit warning for calling ac108_set_sysclk() with unexpected arguments
Don't know why Seeed Studio staff did not put it in.

Conflicts:
	ac108.c
2020-09-14 14:49:22 +01:00
Hin-Tak Leung
df68ab22d6 Merge remote-tracking branch 'origin/v5.5' into v5.7 2020-08-23 20:43:08 +01:00
Hin-Tak Leung
d8775ccb93 Use pr_info() for regular information 2020-08-18 08:22:32 +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
Hin-Tak Leung
74d65bfcbd use the kernel's way of suppressing fallthrough
See include/linux/compiler_attributes.h:

/*
 * Add the pseudo keyword 'fallthrough' so case statement blocks
 * must end with any of these keywords:
 *   break;
 *   fallthrough;
 *   goto <label>;
 *   return [expression];
 *
 *  gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes
 */
-if __has_attribute(__fallthrough__)
- define fallthrough                    __attribute__((__fallthrough__))
-else
- define fallthrough                    do {} while (0)  /* fallthrough */
-endif
2020-04-27 01:07:51 +01:00
Hin-Tak Leung
82c8d1024a suppress another "this statement may fall through" warning
The whole warning is quite long but looks like this:

  CC [M]  seeed-voicecard/ac108.o
In file included from ./include/linux/printk.h:331,
                 from ./include/linux/kernel.h:15,
                 from ./include/linux/list.h:9,
                 from ./include/linux/module.h:12,
                 from seeed-voicecard/ac108.c:15:
seeed-voicecard/ac108.c: In function ‘ac108_set_fmt’:
./include/linux/dynamic_debug.h:122:52: warning: this statement may fall through [-Wimplicit-fallthrough=]
  122 | #define __dynamic_func_call(id, fmt, func, ...) do { \
      |                                                    ^
./include/linux/dynamic_debug.h:143:2: note: in expansion of macro ‘__dynamic_func_call’
  143 |  __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
      |  ^~~~~~~~~~~~~~~~~~~
./include/linux/dynamic_debug.h:157:2: note: in expansion of macro ‘_dynamic_func_call’
  157 |  _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
      |  ^~~~~~~~~~~~~~~~~~
./include/linux/device.h:1795:2: note: in expansion of macro ‘dynamic_dev_dbg’
 1795 |  dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
      |  ^~~~~~~~~~~~~~~
seeed-voicecard/ac108.c:866:4: note: in expansion of macro ‘dev_dbg’
  866 |    dev_dbg(dai->dev, "used as slave when AC101 is master\n");
      |    ^~~~~~~
seeed-voicecard/ac108.c:868:2: note: here
  868 |  case SND_SOC_DAIFMT_CBS_CFS:    /*AC108 Slave*/
      |  ^~~~
2020-04-26 23:39:25 +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
Peter.Yang
ccac09b842 Fix: reset ac101/ac108 chips after fill cache 2018-05-11 07:37:53 +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
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
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
cff392127f Fix: ac101 noise import by PLL frequncy deviation 2018-03-06 09:37:14 +00:00
Peter.Yang
b8f9bb38fd Move: register access from i2c_master_XXX to regmap_XXX 2018-02-27 09:05:55 +00:00
Peter.Yang
00d123836f Fix: channels widgets order for 6mic 2018-02-25 09:51:37 +00:00
peter.yang
18eec1abfa Merge: ac108 & ac101 as single codec module 2018-02-10 15:16:01 +08:00
peter.yang
fa4b566d9a Move: rename ac108 -> ac10x 2018-02-10 11:36:18 +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
add8afa699 Add: capturing & playing in Audacity is OK 2018-01-30 19:19:13 +08:00
peter.yang
10e0f12b16 Fix: master device same as codec device 2018-01-30 19:07:57 +08:00
peter.yang
d8b60f1116 Bugfix: crash due to device probing order 2018-01-29 19:14:28 +08:00
peter.yang
a62c615114 Add capturing volume controls 2017-11-29 09:17:52 +00:00
peter.yang
0cb24e58d2 Fix: pcm playback & capture stream can work together,
all with 8 channels.
2017-11-23 10:15:59 +00:00
peter.yang
07b67878dc Add 2 channels playback stream 2017-11-22 09:05:22 +00:00
peter.yang
878027066d Bugfix: miss channels order in cpu_dai 2017-11-20 01:22:28 +00:00
peter.yang
5028a91201 pcm format 8 channels, using two ac108 chips 2017-11-16 06:57:55 +00:00
peter.yang
7f4b5849a7 pcm format 4 channels: no need ac108_plugin 2017-11-10 09:00:23 +00:00
Baozhu Zuo
76a0140513 remove ac108 debug macro 2017-10-09 15:00:40 +08:00
Baozhu Zuo
125e5188e5 use two channel transfer 4 channels, rate should be double 2017-10-09 14:56:26 +08:00
Baozhu Zuo
3c4fc91f89 use the real rate value config clocking 2017-10-09 11:14:27 +08:00
Baozhu Zuo
6a0b216dbf enable High Pass Filter 2017-09-30 15:58:30 +08:00
Baozhu Zuo
0aae7a6ea6 miss 4 channels, set clock fixed 2017-09-26 15:11:21 +00:00
Baozhu Zuo
5b49bfb4ec add respeaker 4mic audio card driver 2017-09-14 08:29:26 +00:00