2015-04-24 02:23:00 +03:00
|
|
|
/* $NetBSD: smsc.c,v 1.12 2015/04/23 23:23:00 pgoyette Exp $ */
|
2007-06-01 18:11:59 +04:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Brett Lymn.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is a driver for the Standard Microsystems Corp (SMSC)
|
|
|
|
* LPC47B397 "super i/o" chip. This driver only handles the environment
|
|
|
|
* monitoring capabilities of the chip, the other functions will be
|
|
|
|
* probed/matched as "normal" PC hardware devices (serial ports, fdc, so on).
|
|
|
|
* SMSC has not deigned to release a datasheet for this particular chip
|
|
|
|
* (though they do for others they make) so this driver was written from
|
|
|
|
* information contained in the comment block for the Linux driver.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
2015-04-24 02:23:00 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: smsc.c,v 1.12 2015/04/23 23:23:00 pgoyette Exp $");
|
2007-06-01 18:11:59 +04:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/device.h>
|
2011-07-31 20:18:54 +04:00
|
|
|
#include <sys/module.h>
|
2007-10-19 15:59:34 +04:00
|
|
|
#include <sys/bus.h>
|
2007-06-01 18:11:59 +04:00
|
|
|
|
|
|
|
#include <dev/isa/isareg.h>
|
|
|
|
#include <dev/isa/isavar.h>
|
|
|
|
|
|
|
|
#include <dev/sysmon/sysmonvar.h>
|
|
|
|
#include <dev/isa/smscvar.h>
|
|
|
|
|
|
|
|
#if defined(LMDEBUG)
|
|
|
|
#define DPRINTF(x) do { printf x; } while (0)
|
|
|
|
#else
|
|
|
|
#define DPRINTF(x)
|
|
|
|
#endif
|
|
|
|
|
2008-04-03 17:36:33 +04:00
|
|
|
static int smsc_match(device_t, cfdata_t, void *);
|
|
|
|
static void smsc_attach(device_t, device_t, void *);
|
|
|
|
static int smsc_detach(device_t, int);
|
|
|
|
|
|
|
|
static uint8_t smsc_readreg(bus_space_tag_t, bus_space_handle_t, int);
|
|
|
|
static void smsc_writereg(bus_space_tag_t, bus_space_handle_t, int, int);
|
2007-06-01 18:11:59 +04:00
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
static void smsc_refresh(struct sysmon_envsys *, envsys_data_t *);
|
2007-06-01 18:11:59 +04:00
|
|
|
|
2008-04-03 17:36:33 +04:00
|
|
|
CFATTACH_DECL_NEW(smsc, sizeof(struct smsc_softc),
|
2007-11-16 11:00:11 +03:00
|
|
|
smsc_match, smsc_attach, smsc_detach, NULL);
|
2007-06-01 18:11:59 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Probe for the SMSC Super I/O chip
|
|
|
|
*/
|
2007-11-16 11:00:11 +03:00
|
|
|
static int
|
2008-04-03 17:36:33 +04:00
|
|
|
smsc_match(device_t parent, cfdata_t match, void *aux)
|
2007-06-01 18:11:59 +04:00
|
|
|
{
|
|
|
|
bus_space_handle_t ioh;
|
|
|
|
struct isa_attach_args *ia = aux;
|
|
|
|
int rv;
|
|
|
|
uint8_t cr;
|
|
|
|
|
|
|
|
/* Must supply an address */
|
|
|
|
if (ia->ia_nio < 1)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (ISA_DIRECT_CONFIG(ia))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (ia->ia_io[0].ir_addr == ISA_UNKNOWN_PORT)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, 2, 0, &ioh))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* To get the device ID we must enter config mode... */
|
|
|
|
bus_space_write_1(ia->ia_iot, ioh, SMSC_ADDR, SMSC_CONFIG_START);
|
|
|
|
|
|
|
|
/* Then select the device id register */
|
2008-04-03 17:36:33 +04:00
|
|
|
cr = smsc_readreg(ia->ia_iot, ioh, SMSC_DEVICE_ID);
|
2007-06-01 18:11:59 +04:00
|
|
|
|
|
|
|
/* Exit config mode, apparently this is important to do */
|
|
|
|
bus_space_write_1(ia->ia_iot, ioh, SMSC_ADDR, SMSC_CONFIG_END);
|
|
|
|
|
2008-04-03 17:36:33 +04:00
|
|
|
switch (cr) {
|
|
|
|
case SMSC_ID_47B397:
|
|
|
|
case SMSC_ID_SCH5307NS:
|
|
|
|
case SMSC_ID_SCH5317:
|
2007-06-01 18:11:59 +04:00
|
|
|
rv = 1;
|
2008-04-03 17:36:33 +04:00
|
|
|
break;
|
|
|
|
default:
|
2007-06-01 18:11:59 +04:00
|
|
|
rv = 0;
|
2008-04-03 17:36:33 +04:00
|
|
|
break;
|
|
|
|
}
|
2007-06-01 18:11:59 +04:00
|
|
|
|
|
|
|
DPRINTF(("smsc: rv = %d, cr = %x\n", rv, cr));
|
|
|
|
|
|
|
|
bus_space_unmap(ia->ia_iot, ioh, 2);
|
|
|
|
|
|
|
|
if (rv) {
|
|
|
|
ia->ia_nio = 1;
|
|
|
|
ia->ia_io[0].ir_size = 2;
|
|
|
|
|
|
|
|
ia->ia_niomem = 0;
|
|
|
|
ia->ia_nirq = 0;
|
|
|
|
ia->ia_ndrq = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the base address for the monitoring registers and set up the
|
2008-04-03 17:36:33 +04:00
|
|
|
* sysmon_envsys(9) framework.
|
2007-06-01 18:11:59 +04:00
|
|
|
*/
|
2007-11-16 11:00:11 +03:00
|
|
|
static void
|
2008-04-03 17:36:33 +04:00
|
|
|
smsc_attach(device_t parent, device_t self, void *aux)
|
2007-06-01 18:11:59 +04:00
|
|
|
{
|
2007-11-16 11:00:11 +03:00
|
|
|
struct smsc_softc *sc = device_private(self);
|
2007-06-01 18:11:59 +04:00
|
|
|
struct isa_attach_args *ia = aux;
|
|
|
|
bus_space_handle_t ioh;
|
2008-04-03 17:36:33 +04:00
|
|
|
uint8_t rev, msb, lsb, chipid;
|
2007-06-01 18:11:59 +04:00
|
|
|
unsigned address;
|
2007-11-16 11:00:11 +03:00
|
|
|
int i;
|
2007-06-01 18:11:59 +04:00
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
sc->sc_iot = ia->ia_iot;
|
2007-06-01 18:11:59 +04:00
|
|
|
|
2008-04-03 17:36:33 +04:00
|
|
|
aprint_naive("\n");
|
|
|
|
|
|
|
|
/*
|
|
|
|
* To attach we need to find the actual Hardware Monitor
|
|
|
|
* I/O address space.
|
|
|
|
*/
|
2007-06-01 18:11:59 +04:00
|
|
|
if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, 2, 0,
|
|
|
|
&ioh)) {
|
|
|
|
aprint_error(": can't map base i/o space\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-04-03 17:36:33 +04:00
|
|
|
/* Enter config mode */
|
2007-06-01 18:11:59 +04:00
|
|
|
bus_space_write_1(ia->ia_iot, ioh, SMSC_ADDR, SMSC_CONFIG_START);
|
|
|
|
|
2008-04-03 17:36:33 +04:00
|
|
|
/*
|
|
|
|
* While we have the base registers mapped, grab the chip
|
|
|
|
* revision and device ID.
|
|
|
|
*/
|
|
|
|
rev = smsc_readreg(ia->ia_iot, ioh, SMSC_DEVICE_REVISION);
|
|
|
|
chipid = smsc_readreg(ia->ia_iot, ioh, SMSC_DEVICE_ID);
|
2007-06-01 18:11:59 +04:00
|
|
|
|
2008-04-03 17:36:33 +04:00
|
|
|
/* Select the Hardware Monitor LDN */
|
|
|
|
smsc_writereg(ia->ia_iot, ioh, SMSC_LOGICAL_DEV_SEL,
|
|
|
|
SMSC_LOGICAL_DEVICE);
|
2007-06-01 18:11:59 +04:00
|
|
|
|
|
|
|
/* Read the base address for the registers. */
|
2008-04-03 17:36:33 +04:00
|
|
|
msb = smsc_readreg(ia->ia_iot, ioh, SMSC_IO_BASE_MSB);
|
|
|
|
lsb = smsc_readreg(ia->ia_iot, ioh, SMSC_IO_BASE_LSB);
|
2007-06-01 18:11:59 +04:00
|
|
|
address = (msb << 8) | lsb;
|
|
|
|
|
|
|
|
/* Exit config mode */
|
|
|
|
bus_space_write_1(ia->ia_iot, ioh, SMSC_ADDR, SMSC_CONFIG_END);
|
|
|
|
bus_space_unmap(ia->ia_iot, ioh, 2);
|
|
|
|
|
2008-04-03 17:36:33 +04:00
|
|
|
/* Map the Hardware Monitor I/O space. */
|
2007-11-16 11:00:11 +03:00
|
|
|
if (bus_space_map(ia->ia_iot, address, 2, 0, &sc->sc_ioh)) {
|
2007-06-01 18:11:59 +04:00
|
|
|
aprint_error(": can't map register i/o space\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
sc->sc_sme = sysmon_envsys_create();
|
|
|
|
|
2008-04-03 17:36:33 +04:00
|
|
|
#define INITSENSOR(index, string, reg, type) \
|
|
|
|
do { \
|
|
|
|
strlcpy(sc->sc_sensor[index].desc, string, \
|
|
|
|
sizeof(sc->sc_sensor[index].desc)); \
|
|
|
|
sc->sc_sensor[index].units = type; \
|
|
|
|
sc->sc_regs[index] = reg; \
|
|
|
|
sc->sc_sensor[index].state = ENVSYS_SVALID; \
|
|
|
|
} while (/* CONSTCOND */ 0)
|
|
|
|
|
|
|
|
/* Temperature sensors */
|
|
|
|
INITSENSOR(0, "Temp0", SMSC_TEMP1, ENVSYS_STEMP);
|
|
|
|
INITSENSOR(1, "Temp1", SMSC_TEMP2, ENVSYS_STEMP);
|
|
|
|
INITSENSOR(2, "Temp2", SMSC_TEMP3, ENVSYS_STEMP);
|
|
|
|
INITSENSOR(3, "Temp3", SMSC_TEMP4, ENVSYS_STEMP);
|
|
|
|
|
|
|
|
/* Fan sensors */
|
|
|
|
INITSENSOR(4, "Fan0", SMSC_FAN1_LSB, ENVSYS_SFANRPM);
|
|
|
|
INITSENSOR(5, "Fan1", SMSC_FAN2_LSB, ENVSYS_SFANRPM);
|
|
|
|
INITSENSOR(6, "Fan2", SMSC_FAN3_LSB, ENVSYS_SFANRPM);
|
|
|
|
INITSENSOR(7, "Fan3", SMSC_FAN4_LSB, ENVSYS_SFANRPM);
|
|
|
|
|
|
|
|
for (i = 0; i < SMSC_MAX_SENSORS; i++) {
|
2011-06-20 22:12:54 +04:00
|
|
|
sc->sc_sensor[i].state = ENVSYS_SINVALID;
|
2007-11-16 11:00:11 +03:00
|
|
|
if (sysmon_envsys_sensor_attach(sc->sc_sme,
|
|
|
|
&sc->sc_sensor[i])) {
|
|
|
|
sysmon_envsys_destroy(sc->sc_sme);
|
2008-04-03 17:36:33 +04:00
|
|
|
bus_space_unmap(sc->sc_iot, sc->sc_ioh, 2);
|
2007-11-16 11:00:11 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-03 17:36:33 +04:00
|
|
|
sc->sc_sme->sme_name = device_xname(self);
|
2007-11-16 11:00:11 +03:00
|
|
|
sc->sc_sme->sme_cookie = sc;
|
|
|
|
sc->sc_sme->sme_refresh = smsc_refresh;
|
|
|
|
|
|
|
|
if ((i = sysmon_envsys_register(sc->sc_sme)) != 0) {
|
2008-04-03 17:36:33 +04:00
|
|
|
aprint_error(": unable to register with sysmon (%d)\n", i);
|
2007-11-16 11:00:11 +03:00
|
|
|
sysmon_envsys_destroy(sc->sc_sme);
|
2008-04-03 17:36:33 +04:00
|
|
|
bus_space_unmap(sc->sc_iot, sc->sc_ioh, 2);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (chipid) {
|
|
|
|
case SMSC_ID_47B397:
|
|
|
|
aprint_normal(": SMSC LPC47B397 Super I/O");
|
|
|
|
break;
|
|
|
|
case SMSC_ID_SCH5307NS:
|
|
|
|
aprint_normal(": SMSC SCH5307-NS Super I/O");
|
|
|
|
break;
|
|
|
|
case SMSC_ID_SCH5317:
|
|
|
|
aprint_normal(": SMSC SCH5317 Super I/O");
|
|
|
|
break;
|
2007-11-16 11:00:11 +03:00
|
|
|
}
|
|
|
|
|
2008-04-03 17:36:33 +04:00
|
|
|
aprint_normal(" (rev %u)\n", rev);
|
|
|
|
aprint_normal_dev(self, "Hardware Monitor registers at 0x%04x\n",
|
|
|
|
address);
|
2007-06-01 18:11:59 +04:00
|
|
|
}
|
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
static int
|
2009-05-12 13:10:15 +04:00
|
|
|
smsc_detach(device_t self, int flags)
|
2007-09-09 09:17:17 +04:00
|
|
|
{
|
|
|
|
struct smsc_softc *sc = device_private(self);
|
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
sysmon_envsys_unregister(sc->sc_sme);
|
|
|
|
bus_space_unmap(sc->sc_iot, sc->sc_ioh, 2);
|
2007-09-09 09:17:17 +04:00
|
|
|
return 0;
|
|
|
|
}
|
2007-06-01 18:11:59 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Read the value of the given register
|
|
|
|
*/
|
|
|
|
static uint8_t
|
2008-04-03 17:36:33 +04:00
|
|
|
smsc_readreg(bus_space_tag_t iot, bus_space_handle_t ioh, int reg)
|
2007-06-01 18:11:59 +04:00
|
|
|
{
|
2008-04-03 17:36:33 +04:00
|
|
|
bus_space_write_1(iot, ioh, SMSC_ADDR, reg);
|
|
|
|
return bus_space_read_1(iot, ioh, SMSC_DATA);
|
2007-06-01 18:11:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-04-03 17:36:33 +04:00
|
|
|
* Write the given value to the given register.
|
|
|
|
*/
|
2007-06-01 18:11:59 +04:00
|
|
|
static void
|
2008-04-03 17:36:33 +04:00
|
|
|
smsc_writereg(bus_space_tag_t iot, bus_space_handle_t ioh, int reg, int val)
|
2007-06-01 18:11:59 +04:00
|
|
|
{
|
2008-04-03 17:36:33 +04:00
|
|
|
bus_space_write_1(iot, ioh, SMSC_ADDR, reg);
|
|
|
|
bus_space_write_1(iot, ioh, SMSC_DATA, val);
|
2007-11-16 11:00:11 +03:00
|
|
|
}
|
2007-06-01 18:11:59 +04:00
|
|
|
|
|
|
|
/* convert temperature read from the chip to micro kelvin */
|
|
|
|
static inline int
|
|
|
|
smsc_temp2muk(uint8_t t)
|
|
|
|
{
|
|
|
|
int temp=t;
|
|
|
|
|
|
|
|
return temp * 1000000 + 273150000U;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* convert register value read from chip into rpm using:
|
|
|
|
*
|
|
|
|
* RPM = 60/(Count * 11.111us)
|
|
|
|
*
|
|
|
|
* 1/1.1111us = 90kHz
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static inline int
|
|
|
|
smsc_reg2rpm(unsigned int r)
|
|
|
|
{
|
|
|
|
unsigned long rpm;
|
|
|
|
|
|
|
|
if (r == 0x0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
rpm = (90000 * 60) / ((unsigned long) r);
|
|
|
|
return (int) rpm;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* min and max temperatures in uK */
|
|
|
|
#define SMSC_MIN_TEMP_UK ((-127 * 1000000) + 273150000)
|
|
|
|
#define SMSC_MAX_TEMP_UK ((127 * 1000000) + 273150000)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the data for the requested sensor, update the sysmon structure
|
|
|
|
* with the retrieved value.
|
|
|
|
*/
|
2007-11-16 11:00:11 +03:00
|
|
|
static void
|
|
|
|
smsc_refresh(struct sysmon_envsys *sme, envsys_data_t *edata)
|
2007-06-01 18:11:59 +04:00
|
|
|
{
|
|
|
|
struct smsc_softc *sc = sme->sme_cookie;
|
2007-11-16 11:00:11 +03:00
|
|
|
int reg;
|
2007-06-01 18:11:59 +04:00
|
|
|
unsigned int rpm;
|
|
|
|
uint8_t msb, lsb;
|
|
|
|
|
2007-11-16 11:00:11 +03:00
|
|
|
reg = sc->sc_regs[edata->sensor];
|
2007-06-01 18:11:59 +04:00
|
|
|
|
Imported envsys 2, a brief description of the new features:
(Part 2: drivers)
* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.
Tested by:
blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
2007-07-01 11:37:12 +04:00
|
|
|
switch (edata->units) {
|
2007-06-01 18:11:59 +04:00
|
|
|
case ENVSYS_STEMP:
|
2008-04-03 17:36:33 +04:00
|
|
|
edata->value_cur =
|
|
|
|
smsc_temp2muk(smsc_readreg(sc->sc_iot, sc->sc_ioh, reg));
|
2007-06-01 18:11:59 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ENVSYS_SFANRPM:
|
|
|
|
/* reading lsb first locks msb... */
|
2008-04-03 17:36:33 +04:00
|
|
|
lsb = smsc_readreg(sc->sc_iot, sc->sc_ioh, reg);
|
|
|
|
msb = smsc_readreg(sc->sc_iot, sc->sc_ioh, reg + 1);
|
2007-06-01 18:11:59 +04:00
|
|
|
rpm = (msb << 8) | lsb;
|
Imported envsys 2, a brief description of the new features:
(Part 2: drivers)
* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.
Tested by:
blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
2007-07-01 11:37:12 +04:00
|
|
|
edata->value_cur = smsc_reg2rpm(rpm);
|
2007-06-01 18:11:59 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-07-31 20:18:54 +04:00
|
|
|
|
2015-04-24 02:23:00 +03:00
|
|
|
MODULE(MODULE_CLASS_DRIVER, smsc, "sysmon_envsys");
|
2011-07-31 20:18:54 +04:00
|
|
|
|
|
|
|
#ifdef _MODULE
|
|
|
|
#include "ioconf.c"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static int
|
|
|
|
smsc_modcmd(modcmd_t cmd, void *opaque)
|
|
|
|
{
|
|
|
|
int error = 0;
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case MODULE_CMD_INIT:
|
|
|
|
#ifdef _MODULE
|
|
|
|
error = config_init_component(cfdriver_ioconf_smsc,
|
|
|
|
cfattach_ioconf_smsc, cfdata_ioconf_smsc);
|
|
|
|
#endif
|
|
|
|
return error;
|
|
|
|
case MODULE_CMD_FINI:
|
|
|
|
#ifdef _MODULE
|
|
|
|
error = config_fini_component(cfdriver_ioconf_smsc,
|
|
|
|
cfattach_ioconf_smsc, cfdata_ioconf_smsc);
|
|
|
|
#endif
|
|
|
|
return error;
|
|
|
|
default:
|
|
|
|
return ENOTTY;
|
|
|
|
}
|
|
|
|
}
|