Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c Various cleanup, mostly reducing debugging spew.
details: https://anonhg.NetBSD.org/src/rev/c3b3aa0728b9
branches: trunk
changeset: 767985:c3b3aa0728b9
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Fri Aug 05 20:51:09 2011 +0000
description:
Various cleanup, mostly reducing debugging spew.
diffstat:
sys/dev/i2c/mt2131.c | 47 ++++++++++++++++++-----------------------------
1 files changed, 18 insertions(+), 29 deletions(-)
diffs (121 lines):
diff -r f79c7badf906 -r c3b3aa0728b9 sys/dev/i2c/mt2131.c
--- a/sys/dev/i2c/mt2131.c Fri Aug 05 20:33:17 2011 +0000
+++ b/sys/dev/i2c/mt2131.c Fri Aug 05 20:51:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mt2131.c,v 1.2 2011/08/04 22:24:29 jmcneill Exp $ */
+/* $NetBSD: mt2131.c,v 1.3 2011/08/05 20:51:09 jakllsch Exp $ */
/*
* Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mt2131.c,v 1.2 2011/08/04 22:24:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mt2131.c,v 1.3 2011/08/05 20:51:09 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -80,27 +80,25 @@
{
struct mt2131_softc *sc;
int ret;
+ uint8_t cmd, reg;
- uint8_t cmd, reg;
-
cmd = reg = 0;
- printf("%s\n", __func__);
-
/* get id reg */
iic_acquire_bus(t, I2C_F_POLL);
ret = iic_exec(t, I2C_OP_READ_WITH_STOP, a, &cmd, 1, ®, 1, I2C_F_POLL);
iic_release_bus(t, I2C_F_POLL);
if (ret) {
- printf("%s read fail\n", __func__);
+ device_printf(parent, "%s(): read fail\n", __func__);
return NULL;
}
- printf("%s %02x\n", __func__, reg);
-
- if ((reg & 0xfe) != 0x3e)
+ if ((reg & 0xfe) != 0x3e) {
+ device_printf(parent, "%s(): chip id %02x unknown\n",
+ __func__, reg);
return NULL;
+ }
sc = kmem_alloc(sizeof(*sc), KM_SLEEP);
if (sc == NULL)
@@ -124,7 +122,7 @@
int
mt2131_tune_dtv(struct mt2131_softc *sc, const struct dvb_frontend_parameters *p)
{
- int rv;
+ int rv, i;
uint64_t o1, o2;
uint64_t d1, d2;
uint32_t r1, r2;
@@ -151,9 +149,6 @@
r1 = d1/8192;
r2 = d2/8192;
- printf("mt2131 %lu %lu %lu %u\n", o1, d1, d1&0x1fff, r1);
- printf("mt2131 %lu %lu %lu %u\n", o2, d2, d2&0x1fff, r2);
-
b[1] = (d1 & 0x1fe0) >> 5;
b[2] = (d1 & 0x001f);
b[3] = r1;
@@ -170,31 +165,27 @@
if(regval > 0x13)
regval = 0x13;
- printf("mt2131 %u\n", regval);
-
rv = mt2131_write(sc, UPC_1, regval);
if (rv != 0)
- printf("%s\n", __func__);
+ device_printf(sc->parent, "%s write failed\n", __func__);
sc->frequency = (o1 - o2 - IF2) * 1000;
- printf("%s freq %d\n", __func__, sc->frequency);
+
+ for (i = 0; i < 100; i++) {
+ kpause("mt2131", true, 1, NULL);
- int i;
- b[0] = 0x08;
-
- for ( i = 0; i < 100; i++) {
rv = mt2131_read(sc, 0x08, ®val);
+ if (rv != 0)
+ device_printf(sc->parent, "%s read failed\n", __func__);
if (( regval & 0x88 ) == 0x88 ) {
- printf("mt2131 - locked\n");
- break;
- } else {
- printf("mt2131 - not locked - %02x\n", b[1]);
+ return 0;
}
- kpause("mt2131", true, 1, NULL);
}
+ device_printf(sc->parent, "mt2131 not locked, %02x\n", b[1]);
+
return rv;
}
@@ -203,8 +194,6 @@
{
int ret;
- printf("%s\n", __func__);
-
ret = iic_acquire_bus(sc->tag, I2C_F_POLL);
if (ret)
return -1;
Home |
Main Index |
Thread Index |
Old Index