Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/sunxi sun8icodec: Update for binding spec changes.
details: https://anonhg.NetBSD.org/src/rev/0dbadb6d5ace
branches: trunk
changeset: 372185:0dbadb6d5ace
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Oct 29 19:07:39 2022 +0000
description:
sun8icodec: Update for binding spec changes.
The allwinner,sun8i-a33-codec binding spec has changed[1] to allow for
#sound-dai-cells to be either 0 or 1, to allow exporting multiple DAIs
from the codec.
This change updates the driver to allow #sound-dai-cells of either 0 or 1
while still only supporting AIF1 for the time being.
[1] https://github.com/torvalds/linux/commit/880e007f15a31f446b9e1713720c6ae5a539f3f4
diffstat:
sys/arch/arm/sunxi/sun8i_codec.c | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
diffs (53 lines):
diff -r 036c9aa7a88d -r 0dbadb6d5ace sys/arch/arm/sunxi/sun8i_codec.c
--- a/sys/arch/arm/sunxi/sun8i_codec.c Sat Oct 29 15:35:16 2022 +0000
+++ b/sys/arch/arm/sunxi/sun8i_codec.c Sat Oct 29 19:07:39 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_codec.c,v 1.9 2021/01/27 03:10:20 thorpej Exp $ */
+/* $NetBSD: sun8i_codec.c,v 1.10 2022/10/29 19:07:39 jmcneill Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sun8i_codec.c,v 1.9 2021/01/27 03:10:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sun8i_codec.c,v 1.10 2022/10/29 19:07:39 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -174,11 +174,31 @@
sun8i_codec_dai_get_tag(device_t dev, const void *data, size_t len)
{
struct sun8i_codec_softc * const sc = device_private(dev);
+ const u_int sound_dai_cells = len / 4;
- if (len != 4)
- return NULL;
+ KASSERT(sound_dai_cells > 0);
- return &sc->sc_dai;
+ /*
+ * This driver only supports AIF1 with CPU DAI at the moment.
+ * When #sound-dai-cells is 0, return this tag. When #sound-dai-cells
+ * is 1, return this tag only when the second cell contains the
+ * value 0.
+ *
+ * Update this when support for multiple interfaces is added to
+ * this driver.
+ */
+ if (sound_dai_cells == 1) {
+ return &sc->sc_dai;
+ }
+
+ if (sound_dai_cells == 2) {
+ const u_int iface = be32dec((const u_int *)data + 1);
+ if (iface == 0) {
+ return &sc->sc_dai;
+ }
+ }
+
+ return NULL;
}
static struct fdtbus_dai_controller_func sun8i_codec_dai_funcs = {
Home |
Main Index |
Thread Index |
Old Index