Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/i2c Avoid sleeping while the audio intr lock is held.



details:   https://anonhg.NetBSD.org/src/rev/c65f5c1c13a9
branches:  trunk
changeset: 1006157:c65f5c1c13a9
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Jan 03 01:00:08 2020 +0000

description:
Avoid sleeping while the audio intr lock is held.

diffstat:

 sys/dev/i2c/es8316ac.c |  49 +++++++++----------------------------------------
 1 files changed, 9 insertions(+), 40 deletions(-)

diffs (98 lines):

diff -r ff81ea0421af -r c65f5c1c13a9 sys/dev/i2c/es8316ac.c
--- a/sys/dev/i2c/es8316ac.c    Fri Jan 03 00:37:29 2020 +0000
+++ b/sys/dev/i2c/es8316ac.c    Fri Jan 03 01:00:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: es8316ac.c,v 1.1 2020/01/02 22:06:59 jmcneill Exp $ */
+/* $NetBSD: es8316ac.c,v 1.2 2020/01/03 01:00:08 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: es8316ac.c,v 1.1 2020/01/02 22:06:59 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: es8316ac.c,v 1.2 2020/01/03 01:00:08 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -137,7 +137,7 @@
 {
        uint8_t val;
 
-       if (iic_smbus_read_byte(sc->sc_i2c, sc->sc_addr, reg, &val, I2C_F_POLL) != 0)
+       if (iic_smbus_read_byte(sc->sc_i2c, sc->sc_addr, reg, &val, 0) != 0)
                val = 0xff;
 
        return val;
@@ -146,7 +146,7 @@
 static void
 escodec_write(struct escodec_softc *sc, uint8_t reg, uint8_t val)
 {
-       (void)iic_smbus_write_byte(sc->sc_i2c, sc->sc_addr, reg, val, I2C_F_POLL);
+       (void)iic_smbus_write_byte(sc->sc_i2c, sc->sc_addr, reg, val, 0);
 }
 
 enum escodec_mixer_ctrl {
@@ -322,40 +322,6 @@
 }
 
 static int
-escodec_trigger_output(void *priv, void *start, void *end, int blksize,
-    void (*intr)(void *), void *intarg, const audio_params_t *params)
-{
-       struct escodec_softc * const sc = priv;
-       uint8_t val;
-
-       escodec_lock(sc);
-
-       /* Enable HP output */
-       val = HPOUTEN_EN_HPL | HPOUTEN_EN_HPR |
-           HPOUTEN_HPL_OUTEN | HPOUTEN_HPR_OUTEN;
-       escodec_write(sc, ESCODEC_HPOUTEN_REG, val);
-
-       escodec_unlock(sc);
-
-       return 0;
-}
-
-static int
-escodec_halt_output(void *priv)
-{
-       struct escodec_softc * const sc = priv;
-
-       escodec_lock(sc);
-
-       /* Disable HP output */
-       escodec_write(sc, ESCODEC_HPOUTEN_REG, 0);
-
-       escodec_unlock(sc);
-
-       return 0;
-}
-
-static int
 escodec_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)
@@ -514,8 +480,6 @@
 }
 
 static const struct audio_hw_if escodec_hw_if = {
-       .trigger_output = escodec_trigger_output,
-       .halt_output = escodec_halt_output,
        .set_format = escodec_set_format,
        .set_port = escodec_set_port,
        .get_port = escodec_get_port,
@@ -699,6 +663,11 @@
        escodec_write(sc, ESCODEC_DACVOL_L_REG, 0);
        escodec_write(sc, ESCODEC_DACVOL_R_REG, 0);
 
+       /* Enable HP output */
+       val = HPOUTEN_EN_HPL | HPOUTEN_EN_HPR |
+           HPOUTEN_HPL_OUTEN | HPOUTEN_HPR_OUTEN;
+       escodec_write(sc, ESCODEC_HPOUTEN_REG, val);
+
        escodec_unlock(sc);
 }
 



Home | Main Index | Thread Index | Old Index