diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2008-10-29 00:04:15 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2008-10-29 00:04:15 +0000 |
commit | 9c3381a0bf60596ef5bd4767646a36954061bd19 (patch) | |
tree | 7f4af91c559620d3e97c2f872328543b3af58900 | |
parent | c376c43fdb627dc0cdeefa8559053821e3cda6b5 (diff) |
native default parameters for i2s devices instead of 8kHz
mulaw mono, which few can even do.
"Please just get this in." brad@
-rw-r--r-- | sys/arch/macppc/dev/aoa.c | 13 | ||||
-rw-r--r-- | sys/arch/macppc/dev/daca.c | 13 | ||||
-rw-r--r-- | sys/arch/macppc/dev/i2s.c | 17 | ||||
-rw-r--r-- | sys/arch/macppc/dev/i2svar.h | 5 | ||||
-rw-r--r-- | sys/arch/macppc/dev/onyx.c | 11 | ||||
-rw-r--r-- | sys/arch/macppc/dev/snapper.c | 11 | ||||
-rw-r--r-- | sys/arch/macppc/dev/tumbler.c | 11 |
7 files changed, 66 insertions, 15 deletions
diff --git a/sys/arch/macppc/dev/aoa.c b/sys/arch/macppc/dev/aoa.c index 88b3d13da33..97590123e09 100644 --- a/sys/arch/macppc/dev/aoa.c +++ b/sys/arch/macppc/dev/aoa.c @@ -1,5 +1,5 @@ -/* $OpenBSD: aoa.c,v 1.4 2008/04/21 00:32:42 jakemsr Exp $ */ -/* $Id: aoa.c,v 1.4 2008/04/21 00:32:42 jakemsr Exp $ */ +/* $OpenBSD: aoa.c,v 1.5 2008/10/29 00:04:14 jakemsr Exp $ */ +/* $Id: aoa.c,v 1.5 2008/10/29 00:04:14 jakemsr Exp $ */ /*- * Copyright (c) 2005 Tsubai Masanari. All rights reserved. @@ -57,6 +57,7 @@ int aoa_getdev(void *, struct audio_device *); int aoa_match(struct device *, void *, void *); void aoa_attach(struct device *, struct device *, void *); void aoa_set_volume(struct aoa_softc *, int, int); +void aoa_get_default_params(void *, int, struct audio_params *); struct cfattach aoa_ca = { sizeof(struct aoa_softc), aoa_match, aoa_attach @@ -93,7 +94,7 @@ struct audio_hw_if aoa_hw_if = { i2s_get_props, i2s_trigger_output, i2s_trigger_input, - NULL + aoa_get_default_params }; struct audio_device aoa_device = { @@ -150,3 +151,9 @@ aoa_set_volume(struct aoa_softc *sc, int left, int right) { printf("aoa_set_volume() not supported yet\n"); } + +void +aoa_get_default_params(void *addr, int mode, struct audio_params *params) +{ + i2s_get_default_params(params); +} diff --git a/sys/arch/macppc/dev/daca.c b/sys/arch/macppc/dev/daca.c index f7be5eb6c42..67485fddea2 100644 --- a/sys/arch/macppc/dev/daca.c +++ b/sys/arch/macppc/dev/daca.c @@ -1,5 +1,5 @@ -/* $OpenBSD: daca.c,v 1.5 2008/04/21 00:32:42 jakemsr Exp $ */ -/* $Id: daca.c,v 1.5 2008/04/21 00:32:42 jakemsr Exp $ */ +/* $OpenBSD: daca.c,v 1.6 2008/10/29 00:04:14 jakemsr Exp $ */ +/* $Id: daca.c,v 1.6 2008/10/29 00:04:14 jakemsr Exp $ */ /*- * Copyright (c) 2002,2003 Tsubai Masanari. All rights reserved. @@ -64,6 +64,7 @@ void daca_attach(struct device *, struct device *, void *); void daca_defer(struct device *); void daca_init(struct daca_softc *); void daca_set_volume(struct daca_softc *, int, int); +void daca_get_default_params(void *, int, struct audio_params *); struct cfattach daca_ca = { sizeof(struct daca_softc), daca_match, daca_attach @@ -100,7 +101,7 @@ struct audio_hw_if daca_hw_if = { i2s_get_props, i2s_trigger_output, i2s_trigger_input, - NULL + daca_get_default_params }; struct audio_device daca_device = { @@ -199,3 +200,9 @@ daca_set_volume(struct daca_softc *sc, int left, int right) data = left << 8 | right; kiic_write(sc->sc_i2c, DEQaddr, DEQ_AVOL, &data, 2); } + +void +daca_get_default_params(void *addr, int mode, struct audio_params *params) +{ + i2s_get_default_params(params); +} diff --git a/sys/arch/macppc/dev/i2s.c b/sys/arch/macppc/dev/i2s.c index e4ea99c65a0..f36b98036eb 100644 --- a/sys/arch/macppc/dev/i2s.c +++ b/sys/arch/macppc/dev/i2s.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i2s.c,v 1.12 2008/08/24 23:44:44 todd Exp $ */ +/* $OpenBSD: i2s.c,v 1.13 2008/10/29 00:04:14 jakemsr Exp $ */ /* $NetBSD: i2s.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */ /*- @@ -53,6 +53,15 @@ # define DPRINTF(x) #endif +struct i2s_audio_default { + 44100, /* sample_rate */ + AUDIO_ENCODING_SLINEAR_BE, /* encoding */ + 16, /* precision */ + 2, /* channels */ + NULL, /* sw_code */ + 1 /* factor */ +}; + struct i2s_mode *i2s_find_mode(u_int, u_int, u_int); static int gpio_read(char *); @@ -447,6 +456,12 @@ i2s_set_params(h, setmode, usemode, play, rec) return 0; } +void +i2s_get_default_params(struct audio_params *params) +{ + *params = i2s_audio_default; +} + int i2s_round_blocksize(h, size) void *h; diff --git a/sys/arch/macppc/dev/i2svar.h b/sys/arch/macppc/dev/i2svar.h index e6af63e1962..fd4939fd2d4 100644 --- a/sys/arch/macppc/dev/i2svar.h +++ b/sys/arch/macppc/dev/i2svar.h @@ -1,5 +1,5 @@ -/* $OpenBSD: i2svar.h,v 1.4 2008/08/24 23:44:44 todd Exp $ */ -/* $Id: i2svar.h,v 1.4 2008/08/24 23:44:44 todd Exp $ */ +/* $OpenBSD: i2svar.h,v 1.5 2008/10/29 00:04:14 jakemsr Exp $ */ +/* $Id: i2svar.h,v 1.5 2008/10/29 00:04:14 jakemsr Exp $ */ /*- * Copyright (c) 2001,2003 Tsubai Masanari. All rights reserved. @@ -88,6 +88,7 @@ int i2s_open(void *, int); void i2s_close(void *); int i2s_query_encoding(void *, struct audio_encoding *); int i2s_set_params(void *, int, int, struct audio_params *, struct audio_params *); +void i2s_get_default_params(struct audio_params *); int i2s_round_blocksize(void *, int); int i2s_halt_output(void *); int i2s_halt_input(void *); diff --git a/sys/arch/macppc/dev/onyx.c b/sys/arch/macppc/dev/onyx.c index afb883f77a3..7a05325778d 100644 --- a/sys/arch/macppc/dev/onyx.c +++ b/sys/arch/macppc/dev/onyx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: onyx.c,v 1.8 2008/04/21 00:32:42 jakemsr Exp $ */ +/* $OpenBSD: onyx.c,v 1.9 2008/10/29 00:04:14 jakemsr Exp $ */ /*- * Copyright (c) 2005 Tsubai Masanari. All rights reserved. @@ -72,6 +72,7 @@ int onyx_match(struct device *, void *, void *); void onyx_attach(struct device *, struct device *, void *); void onyx_defer(struct device *); void onyx_set_volume(struct onyx_softc *, int, int); +void onyx_get_default_params(void *, int, struct audio_params *); struct cfattach onyx_ca = { sizeof(struct onyx_softc), onyx_match, onyx_attach @@ -108,7 +109,7 @@ struct audio_hw_if onyx_hw_if = { i2s_get_props, i2s_trigger_output, i2s_trigger_input, - NULL + onyx_get_default_params }; struct audio_device onyx_device = { @@ -206,3 +207,9 @@ onyx_set_volume(struct onyx_softc *sc, int left, int right) kiic_write(sc->sc_i2c, PCM3052_I2C_ADDR, PCM3052_REG_RIGHT_VOLUME, &data, 1); } + +void +onyx_get_default_params(void *addr, int mode, struct audio_params *params) +{ + i2s_get_default_params(params); +} diff --git a/sys/arch/macppc/dev/snapper.c b/sys/arch/macppc/dev/snapper.c index 110070a7ab6..f29963fb689 100644 --- a/sys/arch/macppc/dev/snapper.c +++ b/sys/arch/macppc/dev/snapper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snapper.c,v 1.31 2008/08/25 03:16:22 todd Exp $ */ +/* $OpenBSD: snapper.c,v 1.32 2008/10/29 00:04:14 jakemsr Exp $ */ /* $NetBSD: snapper.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */ /*- @@ -67,6 +67,7 @@ void snapper_set_volume(struct snapper_softc *, int, int); void snapper_set_bass(struct snapper_softc *, int); void snapper_set_treble(struct snapper_softc *, int); void snapper_set_input(struct snapper_softc *, int); +void snapper_get_default_params(void *, int, struct audio_params *); int tas3004_write(struct snapper_softc *, u_int, const void *); int tas3004_init(struct snapper_softc *); @@ -105,7 +106,7 @@ struct audio_hw_if snapper_hw_if = { i2s_get_props, i2s_trigger_output, i2s_trigger_input, - NULL + snapper_get_default_params }; struct audio_device snapper_device = { @@ -731,3 +732,9 @@ snapper_getdev(void *h, struct audio_device *retp) *retp = snapper_device; return (0); } + +void +snapper_get_default_params(void *addr, int mode, struct audio_params *params) +{ + i2s_get_default_params(params); +} diff --git a/sys/arch/macppc/dev/tumbler.c b/sys/arch/macppc/dev/tumbler.c index e801e7d1a86..d6bc74b0ce6 100644 --- a/sys/arch/macppc/dev/tumbler.c +++ b/sys/arch/macppc/dev/tumbler.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tumbler.c,v 1.5 2008/04/21 00:32:42 jakemsr Exp $ */ +/* $OpenBSD: tumbler.c,v 1.6 2008/10/29 00:04:14 jakemsr Exp $ */ /*- * Copyright (c) 2001,2003 Tsubai Masanari. All rights reserved. @@ -65,6 +65,7 @@ void tumbler_defer(struct device *); void tumbler_set_volume(struct tumbler_softc *, int, int); void tumbler_set_bass(struct tumbler_softc *, int); void tumbler_set_treble(struct tumbler_softc *, int); +void tumbler_get_default_params(void *, int, struct audio_params *); int tas3001_write(struct tumbler_softc *, u_int, const void *); int tas3001_init(struct tumbler_softc *); @@ -103,7 +104,7 @@ struct audio_hw_if tumbler_hw_if = { i2s_get_props, i2s_trigger_output, i2s_trigger_input, - NULL + tumbler_get_default_params }; struct audio_device tumbler_device = { @@ -493,3 +494,9 @@ tumbler_getdev(void *h, struct audio_device *retp) *retp = tumbler_device; return (0); } + +void +tumbler_get_default_params(void *addr, int mode, struct audio_params *params) +{ + i2s_get_default_params(params); +} |