Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/fdt Set sysclk rate at set_format time, so the link ...
details: https://anonhg.NetBSD.org/src/rev/4b437c37ad7b
branches: trunk
changeset: 461107:4b437c37ad7b
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Nov 16 12:47:47 2019 +0000
description:
Set sysclk rate at set_format time, so the link set_format callback can read the new sysclk
diffstat:
sys/dev/fdt/ausoc.c | 46 ++++++++++++++++++----------------------------
1 files changed, 18 insertions(+), 28 deletions(-)
diffs (85 lines):
diff -r af0842055889 -r 4b437c37ad7b sys/dev/fdt/ausoc.c
--- a/sys/dev/fdt/ausoc.c Sat Nov 16 12:26:54 2019 +0000
+++ b/sys/dev/fdt/ausoc.c Sat Nov 16 12:47:47 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ausoc.c,v 1.4 2019/05/08 13:40:18 isaki Exp $ */
+/* $NetBSD: ausoc.c,v 1.5 2019/11/16 12:47:47 jmcneill 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.4 2019/05/08 13:40:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ausoc.c,v 1.5 2019/11/16 12:47:47 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -121,8 +121,22 @@
audio_filter_reg_t *pfil, audio_filter_reg_t *rfil)
{
struct ausoc_link * const link = priv;
+ const audio_params_t *params = (setmode & AUMODE_PLAY) != 0 ?
+ play : rec;
int error;
+ if (link->link_mclk_fs) {
+ const u_int rate = params->sample_rate * link->link_mclk_fs;
+ error = audio_dai_set_sysclk(link->link_codec, rate,
+ AUDIO_DAI_CLOCK_IN);
+ if (error)
+ return error;
+ error = audio_dai_set_sysclk(link->link_cpu, rate,
+ AUDIO_DAI_CLOCK_OUT);
+ if (error)
+ return error;
+ }
+
error = audio_dai_mi_set_format(link->link_cpu, setmode,
play, rec, pfil, rfil);
if (error)
@@ -246,20 +260,8 @@
void (*intr)(void *), void *intrarg, const audio_params_t *params)
{
struct ausoc_link * const link = priv;
- u_int n, rate;
int error;
-
- if (link->link_mclk_fs) {
- rate = params->sample_rate * link->link_mclk_fs;
- error = audio_dai_set_sysclk(link->link_codec, rate,
- AUDIO_DAI_CLOCK_IN);
- if (error)
- goto failed;
- error = audio_dai_set_sysclk(link->link_cpu, rate,
- AUDIO_DAI_CLOCK_OUT);
- if (error)
- goto failed;
- }
+ u_int n;
for (n = 0; n < link->link_naux; n++) {
error = audio_dai_trigger(link->link_aux[n], start, end,
@@ -285,20 +287,8 @@
void (*intr)(void *), void *intrarg, const audio_params_t *params)
{
struct ausoc_link * const link = priv;
- u_int n, rate;
int error;
-
- if (link->link_mclk_fs) {
- rate = params->sample_rate * link->link_mclk_fs;
- error = audio_dai_set_sysclk(link->link_codec, rate,
- AUDIO_DAI_CLOCK_IN);
- if (error)
- goto failed;
- error = audio_dai_set_sysclk(link->link_cpu, rate,
- AUDIO_DAI_CLOCK_OUT);
- if (error)
- goto failed;
- }
+ u_int n;
for (n = 0; n < link->link_naux; n++) {
error = audio_dai_trigger(link->link_aux[n], start, end,
Home |
Main Index |
Thread Index |
Old Index