From: stsp Date: Fri, 12 Jun 2015 09:30:05 +0000 (+0000) Subject: Fix rtwn(4) wifi LED support. Tested with rtwn(4) device in Thinkpad X220. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=48ebb32aea2731d35bcb3aff7b7f9b6f3d060540;p=openbsd Fix rtwn(4) wifi LED support. Tested with rtwn(4) device in Thinkpad X220. --- diff --git a/sys/dev/pci/if_rtwn.c b/sys/dev/pci/if_rtwn.c index 19ce5f84bc0..6cea7c3d4db 100644 --- a/sys/dev/pci/if_rtwn.c +++ b/sys/dev/pci/if_rtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rtwn.c,v 1.2 2015/06/10 15:34:17 mpi Exp $ */ +/* $OpenBSD: if_rtwn.c,v 1.3 2015/06/12 09:30:05 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini @@ -1091,10 +1091,12 @@ rtwn_set_led(struct rtwn_softc *sc, int led, int on) uint8_t reg; if (led == RTWN_LED_LINK) { - reg = rtwn_read_1(sc, R92C_LEDCFG0) & 0x70; + reg = rtwn_read_1(sc, R92C_LEDCFG2) & 0xf0; if (!on) - reg |= R92C_LEDCFG0_DIS; - rtwn_write_1(sc, R92C_LEDCFG0, reg); + reg |= R92C_LEDCFG2_DIS; + else + reg |= R92C_LEDCFG2_EN; + rtwn_write_1(sc, R92C_LEDCFG2, reg); sc->ledlink = on; /* Save LED state. */ } } diff --git a/sys/dev/pci/if_rtwnreg.h b/sys/dev/pci/if_rtwnreg.h index 62be0d8a912..adeb9093f5b 100644 --- a/sys/dev/pci/if_rtwnreg.h +++ b/sys/dev/pci/if_rtwnreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rtwnreg.h,v 1.1 2015/06/04 21:08:40 stsp Exp $ */ +/* $OpenBSD: if_rtwnreg.h,v 1.2 2015/06/12 09:30:05 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini @@ -337,6 +337,10 @@ /* Bits for R92C_LEDCFG0. */ #define R92C_LEDCFG0_DIS 0x08 +/* Bits for R92C_LEDCFG2. */ +#define R92C_LEDCFG2_EN 0x60 +#define R92C_LEDCFG2_DIS 0x68 + /* Bits for R92C_MCUFWDL. */ #define R92C_MCUFWDL_EN 0x00000001 #define R92C_MCUFWDL_RDY 0x00000002