Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/macppc/dev don't invalidate sensors every time we f...
details: https://anonhg.NetBSD.org/src/rev/f676efe038ac
branches: trunk
changeset: 966936:f676efe038ac
user: macallan <macallan%NetBSD.org@localhost>
date: Sat Nov 23 05:13:11 2019 +0000
description:
don't invalidate sensors every time we fail to read fan speeds
diffstat:
sys/arch/macppc/dev/psoc.c | 38 ++++++++++++++++++--------------------
1 files changed, 18 insertions(+), 20 deletions(-)
diffs (72 lines):
diff -r 12460e6a4ae9 -r f676efe038ac sys/arch/macppc/dev/psoc.c
--- a/sys/arch/macppc/dev/psoc.c Sat Nov 23 03:59:39 2019 +0000
+++ b/sys/arch/macppc/dev/psoc.c Sat Nov 23 05:13:11 2019 +0000
@@ -1,7 +1,7 @@
- /* $NetBSD: psoc.c,v 1.2 2019/11/22 05:16:54 macallan Exp $ */
+ /* $NetBSD: psoc.c,v 1.3 2019/11/23 05:13:11 macallan Exp $ */
/*-
- * Copyright (c) 2018 Michael Lorenz
+ * Copyright (c) 2019 Michael Lorenz
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.2 2019/11/22 05:16:54 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.3 2019/11/23 05:13:11 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -159,7 +159,7 @@
{
struct psoc_softc *sc = sme->sme_cookie;
uint8_t cmd = 6;
- uint8_t buf[0x28], *bptr;
+ uint8_t buf[0x28];
int error = 1, data;
if ( edata->private < 0x20) {
@@ -183,26 +183,24 @@
psoc_dump(sc);
#endif
} else {
- cmd = 0x20;
+ cmd = edata->private;
iic_acquire_bus(sc->sc_i2c, 0);
error = iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP,
- sc->sc_addr, &cmd, 1, buf, 12, 0);
+ sc->sc_addr, &cmd, 1, buf, 3, 0);
iic_release_bus(sc->sc_i2c, 0);
if (error) return;
- if (edata->private >= 0x20) {
- bptr = &buf[edata->private - 0x20];
- switch (bptr[0] & 0xf0) {
- case 0x50:
- data = bptr[edata->private - 0x20];
- edata->value_cur = ((bptr[2] & 0x3f) << 6) | (bptr[1] & 0x3f);
- break;
- case 0x60:
- edata->value_cur = 0;
- break;
- default:
- error = -1;
- }
- }
+ switch (buf[0] & 0xf0) {
+ case 0x50:
+ data = buf[edata->private - 0x20];
+ edata->value_cur = ((buf[2] & 0x3f) << 6) |
+ (buf[1] & 0x3f);
+ break;
+ case 0x60:
+ edata->value_cur = 0;
+ break;
+ default:
+ error = 0;
+ }
}
if (error) {
edata->state = ENVSYS_SINVALID;
Home |
Main Index |
Thread Index |
Old Index