Compare commits

..

23 commits

Author SHA1 Message Date
Jacopo Maroli
c3f0119ae9 [PATCH] fix channel ordering 2024-11-22 17:05:21 +01:00
Hin-Tak Leung
c693d203d9 Merge remote-tracking branch 'origin/v6.1' into v6.5 2024-01-10 15:54:35 +00:00
HinTak
005fc23648
Merge pull request #23 from makermelissa/fix-install-config
Fix /boot/config.txt for bookworm installs
2024-01-10 15:53:37 +00:00
Melissa LeBlanc-Williams
58082f3fe8 Fix /boot/config.txt for bookworm installs 2024-01-05 10:46:23 -08:00
Hin-Tak Leung
cc37c8fb52 v6.5: ASoC: soc-core.c: add index on snd_soc_of_get_dai_name()
commit 3c8b5861850c734add65233e538d4a8c2dff95d9
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Tue Jun 20 02:14:11 2023 +0000

    ASoC: soc-core.c: add index on snd_soc_of_get_dai_name()

    Current snd_soc_of_get_dai_name() doesn't accept index
    for #sound-dai-cells. It is not useful for user.
    This patch adds it.

    Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Link: https://lore.kernel.org/r/87pm5qdgng.wl-kuninori.morimoto.gx@renesas.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-04 23:18:04 +01:00
Hin-Tak Leung
c3a2d96ba2 Changing install URL to point to mine. 2023-08-03 23:30:03 +01:00
Hin-Tak Leung
7aef82f3be Merge remote-tracking branch 'origin/v6.1' into v6.4 2023-08-02 02:10:52 +01:00
Hin-Tak Leung
4ab8158c18 Fine tuning the regex from discussion in the last pull 2023-08-02 02:08:55 +01:00
Hin-Tak Leung
8f377d1eaa Fine tuning the regex from discussion in the last pull 2023-08-02 02:07:04 +01:00
Hin-Tak Leung
aaa2090dbf Merge remote-tracking branch 'origin/v6.1' into v6.4 2023-08-02 02:01:48 +01:00
HinTak
f25e76508f
Merge pull request #7 from hellow554/v6.1
fix detection of kernel modules on 64-bit image
2023-08-02 01:59:17 +01:00
Hin-Tak Leung
a46c3f6324 Re-store support for v6.3 in the v6.4 branch 2023-07-27 02:08:40 +01:00
Hin-Tak Leung
2a40c7dbff v6.4: switch to use c2c_params instead of params
commit 99fddc1618ff64cc71bd51dbf83bd13e74778fe0
Merge: 72456c24c8357 1ea63f29c2771
Author: Mark Brown <broonie@kernel.org>
Date:   Wed Apr 5 16:35:09 2023 +0100

    ASoC: clarify Codec2Codec params

    Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

    ASoC is supporting Codec2Codec, but its parameter name is
    "params" and "num_params" which are very unclear naming.

    This patch-set clarifies it by replacing to c2c_params / num_c2c_params.

commit 1ea63f29c27712d6b9c45af67cd71299d849c5e3
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Sun Apr 2 23:00:17 2023 +0000

    ASoC: soc.h: remove unused params/num_params

    No drivers are using params/num_params any more.
    Let's remove these.

    Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Link: https://lore.kernel.org/r/87iledc2ke.wl-kuninori.morimoto.gx@renesas.com
    Signed-off-by: Mark Brown <broonie@kernel.org>

commit e7a73b05542d82e209af450dd90b730255f6e775
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Sun Apr 2 23:00:07 2023 +0000

    ASoC: samsung: switch to use c2c_params instead of params

    ASoC is now using c2c_params instead of params. This patch replace it.
    num_c2c_params (was num_params) was not mandatory before,
    but let's set it by this patch.

    Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Link: https://lore.kernel.org/r/87jzytc2kp.wl-kuninori.morimoto.gx@renesas.com
    Signed-off-by: Mark Brown <broonie@kernel.org>

commit 433f4a1697fae78c34377de1ef3abd26aec8214e
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Sun Apr 2 22:59:57 2023 +0000

    ASoC: meson: switch to use c2c_params instead of params

    ASoC is now using c2c_params instead of params. This patch replace it.
    num_c2c_params (was num_params) was not mandatory before,
    but let's set it by this patch.

    Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Link: https://lore.kernel.org/r/87lej9c2ky.wl-kuninori.morimoto.gx@renesas.com
    Signed-off-by: Mark Brown <broonie@kernel.org>

commit 7ddc7f91beb285246e926e3adf0b292b071aea33
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Sun Apr 2 22:59:35 2023 +0000

    ASoC: soc.h: clarify Codec2Codec params

    snd_soc_dai_link has params/num_params, but it is unclear that
    params for what. This patch clarify it is params for Codec2Codec.

    Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Link: https://lore.kernel.org/r/87o7o5c2lk.wl-kuninori.morimoto.gx@renesas.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-27 01:52:33 +01:00
Marcel Hellwig
f69370b841 fix detection of kernel modules on 64-bit image
The lib modules folder looks like `/lib/modules/6.1.21-v8+/build`, which
means that the previous regex doesn't capture anything after the `-` and
therefore it fails to detect the kernel version.
The regex now aligns with the other detection method and this works fine
on my machine™
2023-06-28 09:23:38 +02:00
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
0bb3ca6c98 v6.3: use simple i2c probe
commit a00f6d3723f5617222ab8df228228c3c2c84e3ec
Author: Stephen Kitt <steve@sk2.org>
Date:   Wed Oct 12 18:36:47 2022 +0200

    drivers/i2c: use simple i2c probe

    All these drivers have an i2c probe function which doesn't use the
    "struct i2c_device_id *id" parameter, so they can trivially be
    converted to the "probe_new" style of probe with a single argument.

    This is part of an ongoing transition to single-argument i2c probe
    functions. Old-style probe functions involve a call to i2c_match_id:
    in drivers/i2c/i2c-core-base.c,

             /*
              * When there are no more users of probe(),
              * rename probe_new to probe.
              */
             if (driver->probe_new)
                     status = driver->probe_new(client);
             else if (driver->probe)
                     status = driver->probe(client,
                                            i2c_match_id(driver->id_table, client));
             else
                     status = -EINVAL;

    Drivers which don't need the second parameter can be declared using
    probe_new instead, avoiding the call to i2c_match_id. Drivers which do
    can still be converted to probe_new-style, calling i2c_match_id
    themselves (as is done currently for of_match_id).

    This change was done using the following Coccinelle script, and fixed
    up for whitespace changes:

    @ rule1 @
    identifier fn;
    identifier client, id;
    @@

    - static int fn(struct i2c_client *client, const struct i2c_device_id *id)
    + static int fn(struct i2c_client *client)
    {
    ...when != id
    }

    @ rule2 depends on rule1 @
    identifier rule1.fn;
    identifier driver;
    @@

    struct i2c_driver driver = {
    -       .probe
    +       .probe_new
                    =
    (
                       fn
    |
    -                  &fn
    +                  fn
    )
                    ,
    };

    Signed-off-by: Stephen Kitt <steve@sk2.org>
    Signed-off-by: Wolfram Sang <wsa@kernel.org>
2023-06-16 23:36:50 +01:00
Hin-Tak Leung
18e297d2d8 64-bit-only kernel package does not have /boot/kernel.img ; use /boot/kernel8.img for version detection.
http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20230405-1_arm64.deb
9a716f09695f1e6c9f951a6bc9e4ff22
27025792 Apr  5 20:13

6.1.21-v8+
2023-04-16 19:19:19 +01:00
Hin-Tak Leung
280bb390a2 Remove garbage before "Linux version"
Kernel 6.1 onwards seems to have strings re-arranged so that a newline
no long happens right before the "Linux version" string.

Tested with:

4650945eaabe1297985759ef8e3d4153  archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20230306-1_armhf.deb
93830b458685feabf2262f474be4a0e0  archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20230317-1_armhf.deb
5449f3dd337c594491f3e73b6ee97cbf  archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20230405-1_armhf.deb

29384 5.15.84+
28712 6.1.19+ 6.1.21+
2023-04-16 19:11:24 +01:00
Hin-Tak Leung
19ca5aeb50 64-bit-only kernel package does not have /boot/kernel.img ; use /boot/kernel8.img for version detection.
http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20230405-1_arm64.deb
9a716f09695f1e6c9f951a6bc9e4ff22
27025792 Apr  5 20:13

6.1.21-v8+
2023-04-16 18:56:16 +01:00
Hin-Tak Leung
ebd1fa605c Raspbian has 64-bit kernel on 32-bit userspace 2023-04-14 00:09:12 +01:00
Hin-Tak Leung
a57389693c Remove garbage before "Linux version"
Kernel 6.1 onwards seems to have strings re-arranged so that a newline
no long happens right before the "Linux version" string.

Tested with:

4650945eaabe1297985759ef8e3d4153  archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20230306-1_armhf.deb
93830b458685feabf2262f474be4a0e0  archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20230317-1_armhf.deb
5449f3dd337c594491f3e73b6ee97cbf  archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20230405-1_armhf.deb

29384 5.15.84+
28712 6.1.19+ 6.1.21+
2023-04-10 20:36:18 +01:00
Hin-Tak Leung
977a7ff321 Attempt to fix mis-match to "5.15.84.x 2023-01-23 11:53:49 +00:00
Hin-Tak Leung
4d0e36d426 v6.1: i2c: Make remove callback return void
commit ed5c2f5fd10dda07263f79f338a512c0f49f76f5
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Mon Aug 15 10:02:30 2022 +0200

    i2c: Make remove callback return void

    The value returned by an i2c driver's remove function is mostly ignored.
    (Only an error message is printed if the value is non-zero that the
    error is ignored.)

    So change the prototype of the remove function to return no value. This
    way driver authors are not tempted to assume that passing an error to
    the upper layer is a good idea. All drivers are adapted accordingly.
    There is no intended change of behaviour, all callbacks were prepared to
    return 0 before.

    Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com>
    Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>
    Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
    Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
    Reviewed-by: Crt Mori <cmo@melexis.com>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia
    Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw
    Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power
    Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013
    Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/*
    Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s
    Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5
    Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg
    Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio
    Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860
    Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b
    Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes
    Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI
    Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
    Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power
    Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Signed-off-by: Wolfram Sang <wsa@kernel.org>
2023-01-18 00:14:00 +00:00
8 changed files with 56 additions and 46 deletions

View file

@ -5,7 +5,7 @@ The drivers for [ReSpeaker Mic Hat](https://www.seeedstudio.com/ReSpeaker-2-Mics
### Install seeed-voicecard ### Install seeed-voicecard
Get the seeed voice card source code and install all linux kernel drivers Get the seeed voice card source code and install all linux kernel drivers
```bash ```bash
git clone https://github.com/respeaker/seeed-voicecard git clone https://github.com/HinTak/seeed-voicecard
cd seeed-voicecard cd seeed-voicecard
sudo ./install.sh sudo ./install.sh
sudo reboot sudo reboot

View file

@ -955,7 +955,7 @@ void ac101_aif_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai
AC101_DBG("stream = %s, play: %d, capt: %d, active: %d\n", AC101_DBG("stream = %s, play: %d, capt: %d, active: %d\n",
snd_pcm_stream_str(substream), snd_pcm_stream_str(substream),
codec_dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK], codec_dai->stream_active[SNDRV_PCM_STREAM_CAPTURE], codec_dai->stream[SNDRV_PCM_STREAM_PLAYBACK].active, codec_dai->stream[SNDRV_PCM_STREAM_CAPTURE].active,
snd_soc_dai_active(codec_dai)); snd_soc_dai_active(codec_dai));
if (!snd_soc_dai_active(codec_dai)) { if (!snd_soc_dai_active(codec_dai)) {
@ -1080,7 +1080,7 @@ int ac101_hw_params(struct snd_pcm_substream *substream,
freq_out = _FREQ_24_576K; freq_out = _FREQ_24_576K;
for (i = 0; i < ARRAY_SIZE(codec_aif1_fs); i++) { for (i = 0; i < ARRAY_SIZE(codec_aif1_fs); i++) {
if (codec_aif1_fs[i].samp_rate == params_rate(params)) { if (codec_aif1_fs[i].samp_rate == params_rate(params)) {
if (codec_dai->stream_active[SNDRV_PCM_STREAM_CAPTURE] && dmic_used && codec_aif1_fs[i].samp_rate == 44100) { if (codec_dai->stream[SNDRV_PCM_STREAM_CAPTURE].active && dmic_used && codec_aif1_fs[i].samp_rate == 44100) {
ac101_update_bits(codec, AIF_SR_CTRL, (0xf<<AIF1_FS), (0x4<<AIF1_FS)); ac101_update_bits(codec, AIF_SR_CTRL, (0xf<<AIF1_FS), (0x4<<AIF1_FS));
} else { } else {
ac101_update_bits(codec, AIF_SR_CTRL, (0xf<<AIF1_FS), ((codec_aif1_fs[i].srbit)<<AIF1_FS)); ac101_update_bits(codec, AIF_SR_CTRL, (0xf<<AIF1_FS), ((codec_aif1_fs[i].srbit)<<AIF1_FS));
@ -1280,11 +1280,13 @@ int ac101_trigger(struct snd_pcm_substream *substream, int cmd,
ret = ret || ac101_update_bits(codec, MOD_RST_CTRL, (0x1<<MOD_RESET_AIF1), (0x1<<MOD_RESET_AIF1)); ret = ret || ac101_update_bits(codec, MOD_RST_CTRL, (0x1<<MOD_RESET_AIF1), (0x1<<MOD_RESET_AIF1));
} }
spin_unlock_irqrestore(&ac10x->lock, flags); spin_unlock_irqrestore(&ac10x->lock, flags);
ac101_set_clock(1, substream, cmd, dai);
#endif #endif
break; break;
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
ac101_set_clock(0, NULL, 0, NULL);
break; break;
default: default:
ret = -EINVAL; ret = -EINVAL;

40
ac108.c
View file

@ -653,7 +653,7 @@ static int ac108_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_h
dev_dbg(dai->dev, "%s() stream=%s play:%d capt:%d +++\n", __func__, dev_dbg(dai->dev, "%s() stream=%s play:%d capt:%d +++\n", __func__,
snd_pcm_stream_str(substream), snd_pcm_stream_str(substream),
dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK], dai->stream_active[SNDRV_PCM_STREAM_CAPTURE]); dai->stream[SNDRV_PCM_STREAM_PLAYBACK].active, dai->stream[SNDRV_PCM_STREAM_CAPTURE].active);
if (ac10x->i2c101) { if (ac10x->i2c101) {
ret = ac101_hw_params(substream, params, dai); ret = ac101_hw_params(substream, params, dai);
@ -664,8 +664,8 @@ static int ac108_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_h
} }
} }
if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE && dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK]) if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE && dai->stream[SNDRV_PCM_STREAM_PLAYBACK].active)
|| (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && dai->stream_active[SNDRV_PCM_STREAM_CAPTURE])) { || (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && dai->stream[SNDRV_PCM_STREAM_CAPTURE].active)) {
/* not configure hw_param twice */ /* not configure hw_param twice */
/* return 0; */ /* return 0; */
} }
@ -999,7 +999,7 @@ static int ac108_set_clock(int y_start_n_stop, struct snd_pcm_substream *substre
/* spin_lock move to machine trigger */ /* spin_lock move to machine trigger */
if (y_start_n_stop && ac10x->i2c101 && _MASTER_MULTI_CODEC == _MASTER_AC101) { if (ac10x->i2c101 && _MASTER_MULTI_CODEC == _MASTER_AC101) {
ac101_trigger(substream, cmd, dai); ac101_trigger(substream, cmd, dai);
} }
if (y_start_n_stop && ac10x->sysclk_en == 0) { if (y_start_n_stop && ac10x->sysclk_en == 0) {
@ -1073,15 +1073,12 @@ static int ac108_trigger(struct snd_pcm_substream *substream, int cmd,
ac108_multi_update_bits(I2S_CTRL, 0x1 << TXEN | 0x1 << GEN, 0x0 << TXEN | 0x0 << GEN, ac10x); ac108_multi_update_bits(I2S_CTRL, 0x1 << TXEN | 0x1 << GEN, 0x0 << TXEN | 0x0 << GEN, ac10x);
} }
spin_unlock_irqrestore(&ac10x->lock, flags); spin_unlock_irqrestore(&ac10x->lock, flags);
ac108_set_clock(1, substream, cmd, dai);
/* delayed clock starting, move to machine trigger() */
break; break;
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
if (ac10x->i2c101 && _MASTER_MULTI_CODEC == _MASTER_AC101) { ac108_set_clock(0, substream, cmd, dai);
ac101_trigger(substream, cmd, dai);
}
break; break;
default: default:
ret = -EINVAL; ret = -EINVAL;
@ -1410,7 +1407,15 @@ static const struct regmap_config ac108_regmap = {
.max_register = 0xDF, .max_register = 0xDF,
.cache_type = REGCACHE_FLAT, .cache_type = REGCACHE_FLAT,
}; };
static int ac108_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *i2c_id) { static const struct i2c_device_id ac108_i2c_id[] = {
{ "ac108_0", 0 },
{ "ac108_1", 1 },
{ "ac108_2", 2 },
{ "ac108_3", 3 },
{ "ac101", AC101_I2C_ID },
{ }
};
static int ac108_i2c_probe(struct i2c_client *i2c) {
struct device_node *np = i2c->dev.of_node; struct device_node *np = i2c->dev.of_node;
unsigned int val = 0; unsigned int val = 0;
int ret = 0, index; int ret = 0, index;
@ -1423,11 +1428,11 @@ static int ac108_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *i
} }
} }
index = (int)i2c_id->driver_data; index = (int)i2c_match_id(ac108_i2c_id, i2c)->driver_data;
if (index == AC101_I2C_ID) { if (index == AC101_I2C_ID) {
ac10x->i2c101 = i2c; ac10x->i2c101 = i2c;
i2c_set_clientdata(i2c, ac10x); i2c_set_clientdata(i2c, ac10x);
ret = ac101_probe(i2c, i2c_id); ret = ac101_probe(i2c, i2c_match_id(ac108_i2c_id, i2c));
if (ret) { if (ret) {
ac10x->i2c101 = NULL; ac10x->i2c101 = NULL;
return ret; return ret;
@ -1493,7 +1498,7 @@ __ret:
return ret; return ret;
} }
static int ac108_i2c_remove(struct i2c_client *i2c) { static void ac108_i2c_remove(struct i2c_client *i2c) {
if (ac10x->codec != NULL) { if (ac10x->codec != NULL) {
snd_soc_unregister_codec(&ac10x->i2c[_MASTER_INDEX]->dev); snd_soc_unregister_codec(&ac10x->i2c[_MASTER_INDEX]->dev);
ac10x->codec = NULL; ac10x->codec = NULL;
@ -1518,17 +1523,8 @@ __ret:
kfree(ac10x); kfree(ac10x);
ac10x = NULL; ac10x = NULL;
} }
return 0;
} }
static const struct i2c_device_id ac108_i2c_id[] = {
{ "ac108_0", 0 },
{ "ac108_1", 1 },
{ "ac108_2", 2 },
{ "ac108_3", 3 },
{ "ac101", AC101_I2C_ID },
{ }
};
MODULE_DEVICE_TABLE(i2c, ac108_i2c_id); MODULE_DEVICE_TABLE(i2c, ac108_i2c_id);
static const struct of_device_id ac108_of_match[] = { static const struct of_device_id ac108_of_match[] = {

View file

@ -26,7 +26,7 @@ fi
# #
# make sure that we are on something ARM/Raspberry related # make sure that we are on something ARM/Raspberry related
# either a bare metal Raspberry or a qemu session with # either a bare metal Raspberry or a qemu session with
# Raspberry stuff available # Raspberry stuff available
# - check for /boot/overlays # - check for /boot/overlays
# - dtparam and dtoverlay is available # - dtparam and dtoverlay is available
@ -67,8 +67,10 @@ function get_kernel_version() {
[ -z "$_VER_RUN" ] && { [ -z "$_VER_RUN" ] && {
ZIMAGE=/boot/kernel.img ZIMAGE=/boot/kernel.img
[ -f /boot/firmware/vmlinuz ] && ZIMAGE=/boot/firmware/vmlinuz [ -f /boot/firmware/vmlinuz ] && ZIMAGE=/boot/firmware/vmlinuz
# 64-bit-only kernel package
[ ! -f /boot/kernel.img ] && [ -f /boot/kernel8.img ] && ZIMAGE=/boot/kernel8.img
IMG_OFFSET=$(LC_ALL=C grep -abo $'\x1f\x8b\x08\x00' $ZIMAGE | head -n 1 | cut -d ':' -f 1) IMG_OFFSET=$(LC_ALL=C grep -abo $'\x1f\x8b\x08\x00' $ZIMAGE | head -n 1 | cut -d ':' -f 1)
_VER_RUN=$(dd if=$ZIMAGE obs=64K ibs=4 skip=$(( IMG_OFFSET / 4)) 2>/dev/null | zcat | grep -a -m1 "Linux version" | strings | awk '{ print $3; }') _VER_RUN=$(dd if=$ZIMAGE obs=64K ibs=4 skip=$(( IMG_OFFSET / 4)) 2>/dev/null | zcat | grep -a -m1 "Linux version" | LC_ALL=C sed -e 's/^.*Linux/Linux/' | strings | awk '{ print $3; }')
} }
echo "$_VER_RUN" echo "$_VER_RUN"
return 0 return 0
@ -76,11 +78,11 @@ function get_kernel_version() {
function check_kernel_headers() { function check_kernel_headers() {
VER_RUN=$(get_kernel_version) VER_RUN=$(get_kernel_version)
VER_HDR=$(dpkg -L raspberrypi-kernel-headers | egrep -m1 "/lib/modules/[^-]+/build" | awk -F'/' '{ print $4; }') VER_HDR=$(dpkg -L raspberrypi-kernel-headers | egrep -m1 "/lib/modules/[^\/]+/build" | awk -F'/' '{ print $4; }')
[ "X$VER_RUN" == "X$VER_HDR" ] && { [ "X$VER_RUN" == "X$VER_HDR" ] && {
return 0 return 0
} }
VER_HDR=$(dpkg -L linux-headers-$VER_RUN | egrep -m1 "/lib/modules/[[:print:]]+/build" | awk -F'/' '{ print $4; }') VER_HDR=$(dpkg -L linux-headers-$VER_RUN | egrep -m1 "/lib/modules/[^\/]+/build" | awk -F'/' '{ print $4; }')
[ "X$VER_RUN" == "X$VER_HDR" ] && { [ "X$VER_RUN" == "X$VER_HDR" ] && {
return 0 return 0
} }
@ -105,7 +107,9 @@ which apt &>/dev/null
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
apt update -y apt update -y
# Raspbian kernel packages # Raspbian kernel packages
apt-get -y install raspberrypi-kernel-headers raspberrypi-kernel apt-get -y install raspberrypi-kernel-headers raspberrypi-kernel
# Recent Raspbian has 64-bit kernel on 32-bit userspace
apt-get -y install gcc-aarch64-linux-gnu
# Ubuntu kernel packages # Ubuntu kernel packages
apt-get -y install linux-raspi linux-headers-raspi linux-image-raspi apt-get -y install linux-raspi linux-headers-raspi linux-image-raspi
apt-get -y install dkms git i2c-tools libasound2-plugins apt-get -y install dkms git i2c-tools libasound2-plugins
@ -173,10 +177,11 @@ grep -q "^snd-soc-seeed-voicecard$" /etc/modules || \
grep -q "^snd-soc-ac108$" /etc/modules || \ grep -q "^snd-soc-ac108$" /etc/modules || \
echo "snd-soc-ac108" >> /etc/modules echo "snd-soc-ac108" >> /etc/modules
grep -q "^snd-soc-wm8960$" /etc/modules || \ grep -q "^snd-soc-wm8960$" /etc/modules || \
echo "snd-soc-wm8960" >> /etc/modules echo "snd-soc-wm8960" >> /etc/modules
#set dtoverlays #set dtoverlays
CONFIG=/boot/config.txt CONFIG=/boot/config.txt
[ -f /boot/firmware/config.txt ] && CONFIG=/boot/firmware/config.txt
[ -f /boot/firmware/usercfg.txt ] && CONFIG=/boot/firmware/usercfg.txt [ -f /boot/firmware/usercfg.txt ] && CONFIG=/boot/firmware/usercfg.txt
sed -i -e 's:#dtparam=i2c_arm=on:dtparam=i2c_arm=on:g' $CONFIG || true sed -i -e 's:#dtparam=i2c_arm=on:dtparam=i2c_arm=on:g' $CONFIG || true
@ -209,7 +214,7 @@ git --git-dir=/etc/voicecard/.git --work-tree=/etc/voicecard/ commit -m "origin
cp seeed-voicecard /usr/bin/ cp seeed-voicecard /usr/bin/
cp seeed-voicecard.service /lib/systemd/system/ cp seeed-voicecard.service /lib/systemd/system/
systemctl enable seeed-voicecard.service systemctl enable seeed-voicecard.service
systemctl start seeed-voicecard systemctl start seeed-voicecard
echo "------------------------------------------------------" echo "------------------------------------------------------"

View file

@ -42,7 +42,9 @@ function get_kernel_version() {
[ -z "$_VER_RUN" ] && { [ -z "$_VER_RUN" ] && {
ZIMAGE=/boot/kernel.img ZIMAGE=/boot/kernel.img
IMG_OFFSET=$(LC_ALL=C grep -abo $'\x1f\x8b\x08\x00' $ZIMAGE | head -n 1 | cut -d ':' -f 1) IMG_OFFSET=$(LC_ALL=C grep -abo $'\x1f\x8b\x08\x00' $ZIMAGE | head -n 1 | cut -d ':' -f 1)
_VER_RUN=$(dd if=$ZIMAGE obs=64K ibs=4 skip=$(( IMG_OFFSET / 4)) | zcat | grep -a -m1 "Linux version" | strings | awk '{ print $3; }') # 64-bit-only kernel package
[ ! -f /boot/kernel.img ] && [ -f /boot/kernel8.img ] && ZIMAGE=/boot/kernel8.img
_VER_RUN=$(dd if=$ZIMAGE obs=64K ibs=4 skip=$(( IMG_OFFSET / 4)) 2>/dev/null | zcat | grep -a -m1 "Linux version" | LC_ALL=C sed -e 's/^.*Linux/Linux/' | strings | awk '{ print $3; }')
} }
echo "$_VER_RUN" echo "$_VER_RUN"
return 0 return 0

View file

@ -220,7 +220,7 @@ static int seeed_voice_card_trigger(struct snd_pcm_substream *substream, int cmd
dev_dbg(rtd->card->dev, "%s() stream=%s cmd=%d play:%d, capt:%d\n", dev_dbg(rtd->card->dev, "%s() stream=%s cmd=%d play:%d, capt:%d\n",
__FUNCTION__, snd_pcm_stream_str(substream), cmd, __FUNCTION__, snd_pcm_stream_str(substream), cmd,
dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK], dai->stream_active[SNDRV_PCM_STREAM_CAPTURE]); dai->stream[SNDRV_PCM_STREAM_PLAYBACK].active, dai->stream[SNDRV_PCM_STREAM_CAPTURE].active);
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
@ -231,8 +231,8 @@ static int seeed_voice_card_trigger(struct snd_pcm_substream *substream, int cmd
/* I know it will degrades performance, but I have no choice */ /* I know it will degrades performance, but I have no choice */
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
#endif #endif
if (_set_clock[SNDRV_PCM_STREAM_CAPTURE]) _set_clock[SNDRV_PCM_STREAM_CAPTURE](1, substream, cmd, dai); // if (_set_clock[SNDRV_PCM_STREAM_CAPTURE]) _set_clock[SNDRV_PCM_STREAM_CAPTURE](1, substream, cmd, dai);
if (_set_clock[SNDRV_PCM_STREAM_PLAYBACK]) _set_clock[SNDRV_PCM_STREAM_PLAYBACK](1, substream, cmd, dai); // if (_set_clock[SNDRV_PCM_STREAM_PLAYBACK]) _set_clock[SNDRV_PCM_STREAM_PLAYBACK](1, substream, cmd, dai);
#if CONFIG_AC10X_TRIG_LOCK #if CONFIG_AC10X_TRIG_LOCK
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
#endif #endif
@ -242,7 +242,7 @@ static int seeed_voice_card_trigger(struct snd_pcm_substream *substream, int cmd
case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
/* capture channel resync, if overrun */ /* capture channel resync, if overrun */
if (dai->stream_active[SNDRV_PCM_STREAM_CAPTURE] && substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (dai->stream[SNDRV_PCM_STREAM_CAPTURE].active && substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
break; break;
} }
@ -252,8 +252,8 @@ static int seeed_voice_card_trigger(struct snd_pcm_substream *substream, int cmd
if (0 != schedule_work(&priv->work_codec_clk)) { if (0 != schedule_work(&priv->work_codec_clk)) {
} }
} else { } else {
if (_set_clock[SNDRV_PCM_STREAM_CAPTURE]) _set_clock[SNDRV_PCM_STREAM_CAPTURE](0, NULL, 0, NULL); /* not using 2nd to 4th arg if 1st == 0 */ // if (_set_clock[SNDRV_PCM_STREAM_CAPTURE]) _set_clock[SNDRV_PCM_STREAM_CAPTURE](0, NULL, 0, NULL); /* not using 2nd to 4th arg if 1st == 0 */
if (_set_clock[SNDRV_PCM_STREAM_PLAYBACK]) _set_clock[SNDRV_PCM_STREAM_PLAYBACK](0, NULL, 0, NULL); /* not using 2nd to 4th arg if 1st == 0 */ // if (_set_clock[SNDRV_PCM_STREAM_PLAYBACK]) _set_clock[SNDRV_PCM_STREAM_PLAYBACK](0, NULL, 0, NULL); /* not using 2nd to 4th arg if 1st == 0 */
} }
break; break;
default: default:
@ -262,7 +262,7 @@ static int seeed_voice_card_trigger(struct snd_pcm_substream *substream, int cmd
dev_dbg(rtd->card->dev, "%s() stream=%s cmd=%d play:%d, capt:%d;finished %d\n", dev_dbg(rtd->card->dev, "%s() stream=%s cmd=%d play:%d, capt:%d;finished %d\n",
__FUNCTION__, snd_pcm_stream_str(substream), cmd, __FUNCTION__, snd_pcm_stream_str(substream), cmd,
dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK], dai->stream_active[SNDRV_PCM_STREAM_CAPTURE], ret); dai->stream[SNDRV_PCM_STREAM_PLAYBACK].active, dai->stream[SNDRV_PCM_STREAM_CAPTURE].active, ret);
return ret; return ret;
} }
@ -311,7 +311,7 @@ static int asoc_simple_parse_dai(struct device_node *node,
* 2) user need to rebind Sound Card everytime * 2) user need to rebind Sound Card everytime
* if he unbinded CPU or Codec. * if he unbinded CPU or Codec.
*/ */
ret = snd_soc_of_get_dai_name(node, &dlc->dai_name); ret = snd_soc_of_get_dai_name(node, &dlc->dai_name, 0);
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -396,8 +396,14 @@ static int asoc_simple_init_dai_link_params(struct snd_soc_pcm_runtime *rtd)
params->channels_min = hw.channels_min; params->channels_min = hw.channels_min;
params->channels_max = hw.channels_max; params->channels_max = hw.channels_max;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,0)
dai_link->c2c_params = params;
dai_link->num_c2c_params = 1;
#else
/* apparently this goes back to 5.6.x */
dai_link->params = params; dai_link->params = params;
dai_link->num_params = 1; dai_link->num_params = 1;
#endif
return 0; return 0;
} }

View file

@ -14,6 +14,7 @@ fi
uname_r=$(uname -r) uname_r=$(uname -r)
CONFIG=/boot/config.txt CONFIG=/boot/config.txt
[ -f /boot/firmware/config.txt ] && CONFIG=/boot/firmware/config.txt
[ -f /boot/firmware/usercfg.txt ] && CONFIG=/boot/firmware/usercfg.txt [ -f /boot/firmware/usercfg.txt ] && CONFIG=/boot/firmware/usercfg.txt
get_overlay() { get_overlay() {
@ -70,7 +71,7 @@ rm -rf /etc/voicecard/ || true
echo "disabled seeed-voicecard.service " echo "disabled seeed-voicecard.service "
systemctl stop seeed-voicecard.service systemctl stop seeed-voicecard.service
systemctl disable seeed-voicecard.service systemctl disable seeed-voicecard.service
echo "remove seeed-voicecard" echo "remove seeed-voicecard"
rm /usr/bin/seeed-voicecard || true rm /usr/bin/seeed-voicecard || true

View file

@ -1318,8 +1318,7 @@ static void wm8960_set_pdata_from_of(struct i2c_client *i2c,
pdata->shared_lrclk = true; pdata->shared_lrclk = true;
} }
static int wm8960_i2c_probe(struct i2c_client *i2c, static int wm8960_i2c_probe(struct i2c_client *i2c)
const struct i2c_device_id *id)
{ {
struct wm8960_data *pdata = dev_get_platdata(&i2c->dev); struct wm8960_data *pdata = dev_get_platdata(&i2c->dev);
struct wm8960_priv *wm8960; struct wm8960_priv *wm8960;
@ -1384,10 +1383,9 @@ static int wm8960_i2c_probe(struct i2c_client *i2c,
return ret; return ret;
} }
static int wm8960_i2c_remove(struct i2c_client *client) static void wm8960_i2c_remove(struct i2c_client *client)
{ {
snd_soc_unregister_codec(&client->dev); snd_soc_unregister_codec(&client->dev);
return 0;
} }
static const struct i2c_device_id wm8960_i2c_id[] = { static const struct i2c_device_id wm8960_i2c_id[] = {