2020-07-12 11:48:49 +03:00
|
|
|
/* $NetBSD: dbcool_var.h,v 1.17 2020/07/12 08:48:49 kim Exp $ */
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Paul Goyette
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A driver for dbCool(tm) family of environmental controllers
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DBCOOLVAR_H
|
|
|
|
#define DBCOOLVAR_H
|
|
|
|
|
2011-03-11 20:12:43 +03:00
|
|
|
#ifdef DEBUG
|
2010-02-26 21:16:18 +03:00
|
|
|
#define DBCOOL_DEBUG
|
2011-03-11 20:12:43 +03:00
|
|
|
#endif
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
|
2020-04-17 02:29:52 +03:00
|
|
|
#include <sys/cdefs.h>
|
2020-07-12 11:48:49 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: dbcool_var.h,v 1.17 2020/07/12 08:48:49 kim Exp $");
|
2020-04-17 02:29:52 +03:00
|
|
|
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
#include <dev/i2c/i2cvar.h>
|
|
|
|
|
|
|
|
#include <dev/sysmon/sysmonvar.h>
|
|
|
|
|
|
|
|
#include <dev/i2c/dbcool_reg.h>
|
|
|
|
|
|
|
|
enum dbc_pwm_params {
|
|
|
|
DBC_PWM_BEHAVIOR = 0,
|
|
|
|
DBC_PWM_MIN_DUTY,
|
|
|
|
DBC_PWM_MAX_DUTY,
|
|
|
|
DBC_PWM_CUR_DUTY,
|
|
|
|
DBC_PWM_LAST_PARAM
|
|
|
|
};
|
|
|
|
|
|
|
|
enum dbc_sensor_type {
|
|
|
|
DBC_CTL = 0,
|
|
|
|
DBC_TEMP,
|
|
|
|
DBC_VOLT,
|
|
|
|
DBC_FAN,
|
2010-02-25 02:37:45 +03:00
|
|
|
DBC_VID,
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
DBC_EOF
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DBCFLAG_TEMPOFFSET 0x0001
|
|
|
|
#define DBCFLAG_HAS_MAXDUTY 0x0002
|
|
|
|
#define DBCFLAG_HAS_SHDN 0x0004
|
|
|
|
#define DBCFLAG_MULTI_VCC 0x0008
|
|
|
|
#define DBCFLAG_4BIT_VER 0x0010
|
2010-02-25 02:37:45 +03:00
|
|
|
#define DBCFLAG_OBSOLETE 0x0020 /* was DBCFLAG_HAS_VID */
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
#define DBCFLAG_HAS_VID_SEL 0x0040
|
2008-10-06 05:35:35 +04:00
|
|
|
#define DBCFLAG_HAS_PECI 0x0080
|
2010-02-25 02:37:45 +03:00
|
|
|
#define DBCFLAG_NO_READBYTE 0x1000
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
#define DBCFLAG_ADM1030 0x2000
|
|
|
|
#define DBCFLAG_ADT7466 0x4000
|
|
|
|
|
|
|
|
/* Maximum sensors for any dbCool device */
|
2010-02-25 02:37:45 +03:00
|
|
|
#define DBCOOL_MAXSENSORS 16
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
|
|
|
|
struct reg_list {
|
|
|
|
uint8_t val_reg;
|
|
|
|
uint8_t hi_lim_reg;
|
|
|
|
uint8_t lo_lim_reg;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct dbcool_sensor {
|
|
|
|
enum dbc_sensor_type type;
|
|
|
|
struct reg_list reg;
|
|
|
|
int name_index;
|
|
|
|
int sysctl_index;
|
2008-10-06 05:35:35 +04:00
|
|
|
int nom_volt_index;
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The members of dbcool_power_control need to stay in the same order
|
|
|
|
* as the enum dbc_pwm_params above
|
|
|
|
*/
|
|
|
|
struct dbcool_power_control {
|
2008-10-06 05:35:35 +04:00
|
|
|
uint8_t power_regs[DBC_PWM_LAST_PARAM];
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
const char *desc;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct chip_id;
|
|
|
|
|
2009-11-03 00:37:44 +03:00
|
|
|
struct dbcool_chipset {
|
|
|
|
i2c_tag_t dc_tag;
|
|
|
|
i2c_addr_t dc_addr;
|
|
|
|
void (*dc_writereg)(struct dbcool_chipset *, uint8_t, uint8_t);
|
|
|
|
uint8_t (*dc_readreg)(struct dbcool_chipset *, uint8_t);
|
|
|
|
struct chip_id *dc_chip;
|
|
|
|
};
|
|
|
|
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
struct dbcool_softc {
|
2009-05-12 18:16:35 +04:00
|
|
|
device_t sc_dev;
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
struct sysmon_envsys *sc_sme;
|
2009-11-03 00:37:44 +03:00
|
|
|
struct dbcool_chipset sc_dc;
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
envsys_data_t sc_sensor[DBCOOL_MAXSENSORS];
|
2010-04-10 23:02:39 +04:00
|
|
|
sysmon_envsys_lim_t sc_deflims[DBCOOL_MAXSENSORS];
|
|
|
|
uint32_t sc_defprops[DBCOOL_MAXSENSORS];
|
2010-03-01 06:14:49 +03:00
|
|
|
int sc_root_sysctl_num;
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
int sc_sysctl_num[DBCOOL_MAXSENSORS];
|
|
|
|
struct reg_list *sc_regs[DBCOOL_MAXSENSORS];
|
2008-10-06 05:35:35 +04:00
|
|
|
int sc_nom_volt[DBCOOL_MAXSENSORS];
|
|
|
|
int sc_temp_offset;
|
|
|
|
int64_t sc_supply_voltage;
|
|
|
|
bool sc_suspend;
|
2011-08-02 18:06:15 +04:00
|
|
|
struct sysctllog *sc_sysctl_log;
|
2020-07-12 11:48:49 +03:00
|
|
|
prop_dictionary_t sc_prop;
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
#ifdef DBCOOL_DEBUG
|
|
|
|
uint8_t sc_user_reg;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
struct chip_id {
|
|
|
|
uint8_t company;
|
|
|
|
uint8_t device;
|
|
|
|
uint8_t rev;
|
|
|
|
struct dbcool_sensor *table;
|
|
|
|
struct dbcool_power_control *power;
|
|
|
|
int flags;
|
|
|
|
int rpm_dividend;
|
|
|
|
const char *name;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Expose some routines for the macppc's ki2c match/attach routines
|
|
|
|
*/
|
2009-11-03 00:37:44 +03:00
|
|
|
uint8_t dbcool_readreg(struct dbcool_chipset *, uint8_t);
|
|
|
|
void dbcool_writereg(struct dbcool_chipset *, uint8_t, uint8_t);
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
void dbcool_setup(device_t);
|
2009-11-03 00:37:44 +03:00
|
|
|
int dbcool_chip_ident(struct dbcool_chipset *);
|
2010-02-25 01:37:54 +03:00
|
|
|
bool dbcool_pmf_suspend(device_t, const pmf_qual_t *);
|
|
|
|
bool dbcool_pmf_resume(device_t, const pmf_qual_t *);
|
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.
Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
2008-10-02 04:47:51 +04:00
|
|
|
|
|
|
|
#endif /* def DBCOOLVAR_H */
|