Module Name:    src
Committed By:   isaki
Date:           Mon Apr 29 09:32:07 UTC 2019

Modified Files:
        src/sys/dev/pci [isaki-audio2]: yds.c ydsvar.h

Log Message:
Adapt to audio2.


To generate a diff of this commit:
cvs rdiff -u -r1.61.2.1 -r1.61.2.2 src/sys/dev/pci/yds.c
cvs rdiff -u -r1.12 -r1.12.10.1 src/sys/dev/pci/ydsvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/yds.c
diff -u src/sys/dev/pci/yds.c:1.61.2.1 src/sys/dev/pci/yds.c:1.61.2.2
--- src/sys/dev/pci/yds.c:1.61.2.1	Sun Apr 21 05:11:22 2019
+++ src/sys/dev/pci/yds.c	Mon Apr 29 09:32:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: yds.c,v 1.61.2.1 2019/04/21 05:11:22 isaki Exp $	*/
+/*	$NetBSD: yds.c,v 1.61.2.2 2019/04/29 09:32:07 isaki Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.61.2.1 2019/04/21 05:11:22 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.61.2.2 2019/04/29 09:32:07 isaki Exp $");
 
 #include "mpu.h"
 
@@ -57,8 +57,6 @@ __KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.61
 
 #include <sys/audioio.h>
 #include <dev/audio_if.h>
-#include <dev/mulaw.h>
-#include <dev/auconv.h>
 #include <dev/ic/ac97reg.h>
 #include <dev/ic/ac97var.h>
 #include <dev/ic/mpuvar.h>
@@ -151,10 +149,10 @@ CFATTACH_DECL_NEW(yds, sizeof(struct yds
 
 static int	yds_open(void *, int);
 static void	yds_close(void *);
-static int	yds_query_encoding(void *, struct audio_encoding *);
-static int	yds_set_params(void *, int, int, audio_params_t *,
-			       audio_params_t *, stream_filter_list_t *,
-			       stream_filter_list_t *);
+static int	yds_query_format(void *, audio_format_query_t *);
+static int	yds_set_format(void *, int,
+			       const audio_params_t *, const audio_params_t *,
+			       audio_filter_reg_t *, audio_filter_reg_t *);
 static int	yds_round_blocksize(void *, int, int, const audio_params_t *);
 static int	yds_trigger_output(void *, void *, void *, int,
 				   void (*)(void *), void *,
@@ -170,7 +168,6 @@ static int	yds_mixer_get_port(void *, mi
 static void *	yds_malloc(void *, int, size_t);
 static void	yds_free(void *, void *, size_t);
 static size_t	yds_round_buffersize(void *, int, size_t);
-static paddr_t	yds_mappage(void *, void *, off_t, int);
 static int	yds_get_props(void *);
 static int	yds_query_devinfo(void *, mixer_devinfo_t *);
 static void	yds_get_locks(void *, kmutex_t **, kmutex_t **);
@@ -206,8 +203,8 @@ static const struct audio_hw_if yds_hw_i
 	.open		  = yds_open,
 	.close		  = yds_close,
 	.drain		  = NULL,
-	.query_encoding	  = yds_query_encoding,
-	.set_params	  = yds_set_params,
+	.query_format	  = yds_query_format,
+	.set_format	  = yds_set_format,
 	.round_blocksize  = yds_round_blocksize,
 	.commit_settings  = NULL,
 	.init_output	  = NULL,
@@ -225,7 +222,6 @@ static const struct audio_hw_if yds_hw_i
 	.allocm		  = yds_malloc,
 	.freem		  = yds_free,
 	.round_buffersize = yds_round_buffersize,
-	.mappage	  = yds_mappage,
 	.get_props	  = yds_get_props,
 	.trigger_output	  = yds_trigger_output,
 	.trigger_input	  = yds_trigger_input,
@@ -267,22 +263,18 @@ static const struct {
 #define YDS_CAP_BITS	"\020\005P44\004LEGFLEX\003LEGSEL\002MCODE1E\001MCODE1"
 #endif
 
-#define YDS_FORMAT(enc, prec, ch, chmask) \
-	{ \
-		.mode		= AUMODE_PLAY | AUMODE_RECORD, \
-		.encoding	= (enc), \
-		.validbits	= (prec), \
-		.precision	= (prec), \
-		.channels	= (ch), \
-		.channel_mask	= (chmask), \
-		.frequency_type	= 0, \
-		.frequency	= { 4000, 48000 }, \
-	}
 static const struct audio_format yds_formats[] = {
-	YDS_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 2, AUFMT_STEREO),
-	YDS_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 1, AUFMT_MONAURAL),
-	YDS_FORMAT(AUDIO_ENCODING_ULINEAR_LE,  8, 2, AUFMT_STEREO),
-	YDS_FORMAT(AUDIO_ENCODING_ULINEAR_LE,  8, 1, AUFMT_MONAURAL),
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_SLINEAR_LE,
+		.validbits	= 16,
+		.precision	= 16,
+		.channels	= 2,
+		.channel_mask	= AUFMT_STEREO,
+		.frequency_type	= 8,
+		.frequency	=
+		    { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000 },
+	},
 };
 #define	YDS_NFORMATS	(sizeof(yds_formats) / sizeof(struct audio_format))
 
@@ -937,13 +929,6 @@ detected:
 		}
 	}
 
-	if (0 != auconv_create_encodings(yds_formats, YDS_NFORMATS,
-	    &sc->sc_encodings)) {
-		mutex_destroy(&sc->sc_lock);
-		mutex_destroy(&sc->sc_intr_lock);
-		return;
-	}
-
 	audio_attach_mi(&yds_hw_if, sc, self);
 
 	sc->sc_legacy_iot = pa->pa_iot;
@@ -1253,29 +1238,17 @@ yds_close(void *addr)
 }
 
 static int
-yds_query_encoding(void *addr, struct audio_encoding *fp)
+yds_query_format(void *addr, audio_format_query_t *afp)
 {
-	struct yds_softc *sc;
 
-	sc = addr;
-	return auconv_query_encoding(sc->sc_encodings, fp);
+	return audio_query_format(yds_formats, YDS_NFORMATS, afp);
 }
 
 static int
-yds_set_params(void *addr, int setmode, int usemode,
-	       audio_params_t *play, audio_params_t* rec,
-	       stream_filter_list_t *pfil, stream_filter_list_t *rfil)
+yds_set_format(void *addr, int setmode,
+	const audio_params_t *play, const audio_params_t *rec,
+	audio_filter_reg_t *pfil, audio_filter_reg_t *rfil)
 {
-	if (setmode & AUMODE_RECORD) {
-		if (auconv_set_converter(yds_formats, YDS_NFORMATS,
-					 AUMODE_RECORD, rec, FALSE, rfil) < 0)
-			return EINVAL;
-	}
-	if (setmode & AUMODE_PLAY) {
-		if (auconv_set_converter(yds_formats, YDS_NFORMATS,
-					 AUMODE_PLAY, play, FALSE, pfil) < 0)
-			return EINVAL;
-	}
 	return 0;
 }
 
@@ -1735,22 +1708,6 @@ yds_round_buffersize(void *addr, int dir
 	return size;
 }
 
-static paddr_t
-yds_mappage(void *addr, void *mem, off_t off, int prot)
-{
-	struct yds_softc *sc;
-	struct yds_dma *p;
-
-	if (off < 0)
-		return -1;
-	sc = addr;
-	p = yds_find_dma(sc, mem);
-	if (p == NULL)
-		return -1;
-	return bus_dmamem_mmap(sc->sc_dmatag, p->segs, p->nsegs,
-	    off, prot, BUS_DMA_WAITOK);
-}
-
 static int
 yds_get_props(void *addr)
 {

Index: src/sys/dev/pci/ydsvar.h
diff -u src/sys/dev/pci/ydsvar.h:1.12 src/sys/dev/pci/ydsvar.h:1.12.10.1
--- src/sys/dev/pci/ydsvar.h:1.12	Sun Jun 25 16:07:48 2017
+++ src/sys/dev/pci/ydsvar.h	Mon Apr 29 09:32:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ydsvar.h,v 1.12 2017/06/25 16:07:48 christos Exp $	*/
+/*	$NetBSD: ydsvar.h,v 1.12.10.1 2019/04/29 09:32:07 isaki Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto.
@@ -112,8 +112,6 @@ struct yds_softc {
 	device_t 		sc_mpu;
 	bus_space_handle_t	sc_mpu_ioh;
 
-	struct audio_encoding_set *sc_encodings;
-
 	/*
 	 * Power management
 	 */

Reply via email to