From owner-dev-commits-src-main@freebsd.org Thu Jul 22 12:55:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1483065A5AC; Thu, 22 Jul 2021 12:55:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GVsr807b6z4k4h; Thu, 22 Jul 2021 12:55:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF381121C1; Thu, 22 Jul 2021 12:55:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16MCtZNc042073; Thu, 22 Jul 2021 12:55:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16MCtZes042072; Thu, 22 Jul 2021 12:55:35 GMT (envelope-from git) Date: Thu, 22 Jul 2021 12:55:35 GMT Message-Id: <202107221255.16MCtZes042072@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: bce17068ac5b - main - arm: allwinner: cir: Reduce verbosity MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bce17068ac5b00799c221b4d114f7a3ff7086727 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jul 2021 12:55:36 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=bce17068ac5b00799c221b4d114f7a3ff7086727 commit bce17068ac5b00799c221b4d114f7a3ff7086727 Author: Emmanuel Vadot AuthorDate: 2021-07-01 08:24:26 +0000 Commit: Emmanuel Vadot CommitDate: 2021-07-22 12:55:03 +0000 arm: allwinner: cir: Reduce verbosity IR can be noisy in dmesg if it "receive" some unwanted data. Add a tunable hw.aw_cir.debug to enable those message that are only useful if one wants to debug the driver. Sponsored by: Diablotin Systems Differential Revision: https://reviews.freebsd.org/D30972 Reviewed by: ganbold MFC after: 1 month --- sys/arm/allwinner/aw_cir.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/sys/arm/allwinner/aw_cir.c b/sys/arm/allwinner/aw_cir.c index eabab4cba8f2..855769a7456e 100644 --- a/sys/arm/allwinner/aw_cir.c +++ b/sys/arm/allwinner/aw_cir.c @@ -144,6 +144,13 @@ enum { #define AW_IR_RAW_BUF_SIZE 128 +SYSCTL_NODE(_hw, OID_AUTO, aw_cir, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "aw_cir driver"); + +static int aw_cir_debug = 0; +SYSCTL_INT(_hw_aw_cir, OID_AUTO, debug, CTLFLAG_RWTUN, &aw_cir_debug, 0, + "Debug 1=on 0=off"); + struct aw_ir_softc { device_t dev; struct resource *res[2]; @@ -207,14 +214,14 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) unsigned char val, last; int i, bitcount; - if (bootverbose) + if (bootverbose && __predict_false(aw_cir_debug) != 0) device_printf(sc->dev, "sc->dcnt = %d\n", sc->dcnt); /* Find Lead 1 (bit separator) */ active_delay = AW_IR_ACTIVE_T_VAL * (AW_IR_ACTIVE_T_C_VAL != 0 ? 128 : 1); len = active_delay; - if (bootverbose) + if (bootverbose && __predict_false(aw_cir_debug) != 0) device_printf(sc->dev, "Initial len: %d\n", len); for (i = 0; i < sc->dcnt; i++) { val = sc->buf[i]; @@ -226,10 +233,10 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) len = 0; } } - if (bootverbose) + if (bootverbose && __predict_false(aw_cir_debug) != 0) device_printf(sc->dev, "len = %d\n", len); if ((val & VAL_MASK) || (len <= AW_IR_L1_MIN)) { - if (bootverbose) + if (bootverbose && __predict_false(aw_cir_debug) != 0) device_printf(sc->dev, "Bit separator error\n"); goto error_code; } @@ -246,7 +253,7 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) len += (val & PERIOD_MASK) + 1; } if ((!(val & VAL_MASK)) || (len <= AW_IR_L0_MIN)) { - if (bootverbose) + if (bootverbose && __predict_false(aw_cir_debug) != 0) device_printf(sc->dev, "Bit length error\n"); goto error_code; } @@ -330,7 +337,7 @@ aw_ir_intr(void *arg) /* Read RX interrupt status */ val = READ(sc, AW_IR_RXSTA); - if (bootverbose) + if (bootverbose && __predict_false(aw_cir_debug) != 0) device_printf(sc->dev, "RX interrupt status: %x\n", val); /* Clean all pending interrupt statuses */ @@ -338,7 +345,7 @@ aw_ir_intr(void *arg) /* When Rx FIFO Data available or Packet end */ if (val & (AW_IR_RXINT_RAI_EN | AW_IR_RXINT_RPEI_EN)) { - if (bootverbose) + if (bootverbose && __predict_false(aw_cir_debug) != 0) device_printf(sc->dev, "RX FIFO Data available or Packet end\n"); /* Get available message count in RX FIFO */ @@ -357,7 +364,7 @@ aw_ir_intr(void *arg) if (val & AW_IR_RXINT_RPEI_EN) { /* RX Packet end */ - if (bootverbose) + if (bootverbose && __predict_false(aw_cir_debug) != 0) device_printf(sc->dev, "RX Packet end\n"); ir_code = aw_ir_decode_packets(sc); stat = aw_ir_validate_code(ir_code); @@ -366,7 +373,7 @@ aw_ir_intr(void *arg) EV_MSC, MSC_SCAN, ir_code); evdev_sync(sc->sc_evdev); } - if (bootverbose) { + if (bootverbose && __predict_false(aw_cir_debug) != 0) { device_printf(sc->dev, "Final IR code: %lx\n", ir_code); device_printf(sc->dev, "IR code status: %d\n",