Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/isaki-audio2]: src/sys Adapt to audio2.
details: https://anonhg.NetBSD.org/src/rev/5ee3ae8e508d
branches: isaki-audio2
changeset: 455998:5ee3ae8e508d
user: isaki <isaki%NetBSD.org@localhost>
date: Sat Apr 27 10:17:59 2019 +0000
description:
Adapt to audio2.
- XXX Name conflicts. audio2 replaces set_params with set_format
and audio_dai already have had its own set_format.
I named newly introduced one audio_dai_mi_set_format for now.
diffstat:
sys/arch/arm/sunxi/sun8i_codec.c | 21 ++-------------------
sys/dev/audio_dai.h | 28 ++++++++++------------------
sys/dev/fdt/ausoc.c | 35 +++++++++++++----------------------
3 files changed, 25 insertions(+), 59 deletions(-)
diffs (190 lines):
diff -r aee8113345e2 -r 5ee3ae8e508d sys/arch/arm/sunxi/sun8i_codec.c
--- a/sys/arch/arm/sunxi/sun8i_codec.c Sat Apr 27 05:22:28 2019 +0000
+++ b/sys/arch/arm/sunxi/sun8i_codec.c Sat Apr 27 10:17:59 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_codec.c,v 1.5 2018/05/16 10:22:54 jmcneill Exp $ */
+/* $NetBSD: sun8i_codec.c,v 1.5.6.1 2019/04/27 10:17:59 isaki 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.5 2018/05/16 10:22:54 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sun8i_codec.c,v 1.5.6.1 2019/04/27 10:17:59 isaki Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -132,22 +132,6 @@
bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
static int
-sun8i_codec_set_params(void *priv, int setmode, int usemode,
- audio_params_t *play, audio_params_t *rec,
- stream_filter_list_t *pfil, stream_filter_list_t *rfil)
-{
- if (play && (setmode & AUMODE_PLAY))
- if (play->sample_rate != 48000)
- return EINVAL;
-
- if (rec && (setmode & AUMODE_RECORD))
- if (rec->sample_rate != 48000)
- return EINVAL;
-
- return 0;
-}
-
-static int
sun8i_codec_set_port(void *priv, mixer_ctrl_t *mc)
{
struct sun8i_codec_softc * const sc = priv;
@@ -181,7 +165,6 @@
}
static const struct audio_hw_if sun8i_codec_hw_if = {
- .set_params = sun8i_codec_set_params,
.set_port = sun8i_codec_set_port,
.get_port = sun8i_codec_get_port,
.query_devinfo = sun8i_codec_query_devinfo,
diff -r aee8113345e2 -r 5ee3ae8e508d sys/dev/audio_dai.h
--- a/sys/dev/audio_dai.h Sat Apr 27 05:22:28 2019 +0000
+++ b/sys/dev/audio_dai.h Sat Apr 27 10:17:59 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audio_dai.h,v 1.4 2018/11/19 10:14:40 maya Exp $ */
+/* $NetBSD: audio_dai.h,v 1.4.2.1 2019/04/27 10:17:59 isaki Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -146,22 +146,22 @@
}
static inline int
-audio_dai_query_encoding(audio_dai_tag_t dai, audio_encoding_t *ae)
+audio_dai_query_format(audio_dai_tag_t dai, audio_format_query_t *afp)
{
- if (!dai->dai_hw_if->query_encoding)
+ if (!dai->dai_hw_if->query_format)
return 0;
- return dai->dai_hw_if->query_encoding(dai->dai_priv, ae);
+ return dai->dai_hw_if->query_format(dai->dai_priv, afp);
}
static inline int
-audio_dai_set_params(audio_dai_tag_t dai, int setmode, int usemode,
- audio_params_t *play, audio_params_t *rec,
- stream_filter_list_t *pfil, stream_filter_list_t *rfil)
+audio_dai_mi_set_format(audio_dai_tag_t dai, int setmode,
+ const audio_params_t *play, const audio_params_t *rec,
+ audio_filter_reg_t *pfil, audio_filter_reg_t *rfil)
{
- if (!dai->dai_hw_if->set_params)
+ if (!dai->dai_hw_if->set_format)
return 0;
- return dai->dai_hw_if->set_params(dai->dai_priv, setmode,
- usemode, play, rec, pfil, rfil);
+ return dai->dai_hw_if->set_format(dai->dai_priv, setmode,
+ play, rec, pfil, rfil);
}
static inline int
@@ -244,14 +244,6 @@
return dai->dai_hw_if->round_buffersize(dai->dai_priv, dir, bufsize);
}
-static inline paddr_t
-audio_dai_mappage(audio_dai_tag_t dai, void *addr, off_t off, int prot)
-{
- if (!dai->dai_hw_if->mappage)
- return -1;
- return dai->dai_hw_if->mappage(dai->dai_priv, addr, off, prot);
-}
-
static inline int
audio_dai_get_props(audio_dai_tag_t dai)
{
diff -r aee8113345e2 -r 5ee3ae8e508d sys/dev/fdt/ausoc.c
--- a/sys/dev/fdt/ausoc.c Sat Apr 27 05:22:28 2019 +0000
+++ b/sys/dev/fdt/ausoc.c Sat Apr 27 10:17:59 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ausoc.c,v 1.3 2018/05/12 23:51:06 jmcneill Exp $ */
+/* $NetBSD: ausoc.c,v 1.3.8.1 2019/04/27 10:17:59 isaki Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ausoc.c,v 1.3 2018/05/12 23:51:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ausoc.c,v 1.3.8.1 2019/04/27 10:17:59 isaki Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -116,28 +116,28 @@
}
static int
-ausoc_query_encoding(void *priv, struct audio_encoding *ae)
+ausoc_query_format(void *priv, audio_format_query_t *afp)
{
struct ausoc_link * const link = priv;
- return audio_dai_query_encoding(link->link_cpu, ae);
+ return audio_dai_query_format(link->link_cpu, afp);
}
static int
-ausoc_set_params(void *priv, int setmode, int usemode,
- audio_params_t *play, audio_params_t *rec,
- stream_filter_list_t *pfil, stream_filter_list_t *rfil)
+ausoc_set_format(void *priv, int setmode,
+ const audio_params_t *play, const audio_params_t *rec,
+ audio_filter_reg_t *pfil, audio_filter_reg_t *rfil)
{
struct ausoc_link * const link = priv;
int error;
- error = audio_dai_set_params(link->link_cpu, setmode,
- usemode, play, rec, pfil, rfil);
+ error = audio_dai_mi_set_format(link->link_cpu, setmode,
+ play, rec, pfil, rfil);
if (error)
return error;
- return audio_dai_set_params(link->link_codec, setmode,
- usemode, play, rec, pfil, rfil);
+ return audio_dai_mi_set_format(link->link_codec, setmode,
+ play, rec, pfil, rfil);
}
static int
@@ -180,14 +180,6 @@
return audio_dai_freem(link->link_cpu, addr, size);
}
-static paddr_t
-ausoc_mappage(void *priv, void *addr, off_t off, int prot)
-{
- struct ausoc_link * const link = priv;
-
- return audio_dai_mappage(link->link_cpu, addr, off, prot);
-}
-
static int
ausoc_getdev(void *priv, struct audio_device *adev)
{
@@ -347,11 +339,10 @@
.open = ausoc_open,
.close = ausoc_close,
.drain = ausoc_drain,
- .query_encoding = ausoc_query_encoding,
- .set_params = ausoc_set_params,
+ .query_format = ausoc_query_format,
+ .set_format = ausoc_set_format,
.allocm = ausoc_allocm,
.freem = ausoc_freem,
- .mappage = ausoc_mappage,
.getdev = ausoc_getdev,
.set_port = ausoc_set_port,
.get_port = ausoc_get_port,
Home |
Main Index |
Thread Index |
Old Index