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 Add mic preamp controls and unswap L/R DA...
details: https://anonhg.NetBSD.org/src/rev/d8744ba132ae
branches: trunk
changeset: 361876:d8744ba132ae
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Wed May 16 10:23:43 2018 +0000
description:
Add mic preamp controls and unswap L/R DAC channels to ADC mixer
diffstat:
sys/arch/arm/sunxi/sun50i_a64_acodec.c | 61 +++++++++++++++++++++++++++++++--
1 files changed, 57 insertions(+), 4 deletions(-)
diffs (115 lines):
diff -r ce4e37f9d3ab -r d8744ba132ae sys/arch/arm/sunxi/sun50i_a64_acodec.c
--- a/sys/arch/arm/sunxi/sun50i_a64_acodec.c Wed May 16 10:22:54 2018 +0000
+++ b/sys/arch/arm/sunxi/sun50i_a64_acodec.c Wed May 16 10:23:43 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i_a64_acodec.c,v 1.7 2018/05/16 00:12:57 jmcneill Exp $ */
+/* $NetBSD: sun50i_a64_acodec.c,v 1.8 2018/05/16 10:23:43 jmcneill Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sun50i_a64_acodec.c,v 1.7 2018/05/16 00:12:57 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sun50i_a64_acodec.c,v 1.8 2018/05/16 10:23:43 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -85,7 +85,7 @@
#define A64_ADCMIX_SRC_MIC1 __BIT(6)
#define A64_ADCMIX_SRC_MIC2 __BIT(5)
#define A64_ADCMIX_SRC_LINEIN __BIT(2)
-#define A64_ADCMIX_SRC_OMIXER __BIT(0)
+#define A64_ADCMIX_SRC_OMIXER __BIT(1)
#define A64_ADC_CTRL 0x0d
#define A64_ADCREN __BIT(7)
#define A64_ADCLEN __BIT(6)
@@ -117,7 +117,9 @@
A64_CODEC_INPUT_HP_VOLUME,
A64_CODEC_RECORD_LINE_VOLUME,
A64_CODEC_RECORD_MIC1_VOLUME,
+ A64_CODEC_RECORD_MIC1_PREAMP,
A64_CODEC_RECORD_MIC2_VOLUME,
+ A64_CODEC_RECORD_MIC2_PREAMP,
A64_CODEC_RECORD_AGC_VOLUME,
A64_CODEC_RECORD_SOURCE,
@@ -299,6 +301,26 @@
a64_acodec_pr_write(sc, mix->reg, val);
return 0;
+ case A64_CODEC_RECORD_MIC1_PREAMP:
+ if (mc->un.ord < 0 || mc->un.ord > 1)
+ return EINVAL;
+ if (mc->un.ord) {
+ a64_acodec_pr_set_clear(sc, A64_MIC1_CTRL, A64_MIC1AMPEN, 0);
+ } else {
+ a64_acodec_pr_set_clear(sc, A64_MIC1_CTRL, 0, A64_MIC1AMPEN);
+ }
+ return 0;
+
+ case A64_CODEC_RECORD_MIC2_PREAMP:
+ if (mc->un.ord < 0 || mc->un.ord > 1)
+ return EINVAL;
+ if (mc->un.ord) {
+ a64_acodec_pr_set_clear(sc, A64_MIC2_CTRL, A64_MIC2AMPEN, 0);
+ } else {
+ a64_acodec_pr_set_clear(sc, A64_MIC2_CTRL, 0, A64_MIC2AMPEN);
+ }
+ return 0;
+
case A64_CODEC_OUTPUT_MUTE:
if (mc->un.ord < 0 || mc->un.ord > 1)
return EINVAL;
@@ -367,6 +389,14 @@
mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = nvol;
return 0;
+ case A64_CODEC_RECORD_MIC1_PREAMP:
+ mc->un.ord = !!(a64_acodec_pr_read(sc, A64_MIC1_CTRL) & A64_MIC1AMPEN);
+ return 0;
+
+ case A64_CODEC_RECORD_MIC2_PREAMP:
+ mc->un.ord = !!(a64_acodec_pr_read(sc, A64_MIC2_CTRL) & A64_MIC2AMPEN);
+ return 0;
+
case A64_CODEC_OUTPUT_MUTE:
mc->un.ord = 1;
if (a64_acodec_pr_read(sc, A64_OL_MIX_CTRL) & A64_LMIXMUTE_LDAC)
@@ -445,11 +475,34 @@
di->un.v.delta =
256 / (__SHIFTOUT_MASK(mix->mask) + 1);
di->type = AUDIO_MIXER_VALUE;
- di->next = di->prev = AUDIO_MIXER_LAST;
+ di->prev = AUDIO_MIXER_LAST;
+ if (di->index == A64_CODEC_RECORD_MIC1_VOLUME)
+ di->next = A64_CODEC_RECORD_MIC1_PREAMP;
+ else if (di->index == A64_CODEC_RECORD_MIC2_VOLUME)
+ di->next = A64_CODEC_RECORD_MIC2_PREAMP;
+ else
+ di->next = AUDIO_MIXER_LAST;
di->un.v.num_channels = 2;
strcpy(di->un.v.units.name, AudioNvolume);
return 0;
+ case A64_CODEC_RECORD_MIC1_PREAMP:
+ case A64_CODEC_RECORD_MIC2_PREAMP:
+ di->mixer_class = A64_CODEC_RECORD_CLASS;
+ strcpy(di->label.name, AudioNpreamp);
+ di->type = AUDIO_MIXER_ENUM;
+ if (di->index == A64_CODEC_RECORD_MIC1_PREAMP)
+ di->prev = A64_CODEC_RECORD_MIC1_VOLUME;
+ else
+ di->prev = A64_CODEC_RECORD_MIC2_VOLUME;
+ di->next = AUDIO_MIXER_LAST;
+ di->un.e.num_mem = 2;
+ strcpy(di->un.e.member[0].label.name, AudioNoff);
+ di->un.e.member[0].ord = 0;
+ strcpy(di->un.e.member[1].label.name, AudioNon);
+ di->un.e.member[1].ord = 1;
+ return 0;
+
case A64_CODEC_OUTPUT_MUTE:
di->mixer_class = A64_CODEC_OUTPUT_CLASS;
strcpy(di->label.name, AudioNmute);
Home |
Main Index |
Thread Index |
Old Index