亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? max6650.c

?? linux 內(nèi)核源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * max6650.c - Part of lm_sensors, Linux kernel modules for hardware *             monitoring. * * (C) 2007 by Hans J. Koch <hjk@linutronix.de> * * based on code written by John Morris <john.morris@spirentcom.com> * Copyright (c) 2003 Spirent Communications * and Claus Gindhart <claus.gindhart@kontron.com> * * This module has only been tested with the MAX6650 chip. It should * also work with the MAX6651. It does not distinguish max6650 and max6651 * chips. * * Tha datasheet was last seen at: * *        http://pdfserv.maxim-ic.com/en/ds/MAX6650-MAX6651.pdf * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */#include <linux/module.h>#include <linux/init.h>#include <linux/slab.h>#include <linux/jiffies.h>#include <linux/i2c.h>#include <linux/hwmon.h>#include <linux/hwmon-sysfs.h>#include <linux/err.h>/* * Addresses to scan. There are four disjoint possibilities, by pin config. */static unsigned short normal_i2c[] = {0x1b, 0x1f, 0x48, 0x4b, I2C_CLIENT_END};/* * Insmod parameters *//* fan_voltage: 5=5V fan, 12=12V fan, 0=don't change */static int fan_voltage;/* prescaler: Possible values are 1, 2, 4, 8, 16 or 0 for don't change */static int prescaler;/* clock: The clock frequency of the chip the driver should assume */static int clock = 254000;module_param(fan_voltage, int, S_IRUGO);module_param(prescaler, int, S_IRUGO);module_param(clock, int, S_IRUGO);I2C_CLIENT_INSMOD_1(max6650);/* * MAX 6650/6651 registers */#define MAX6650_REG_SPEED	0x00#define MAX6650_REG_CONFIG	0x02#define MAX6650_REG_GPIO_DEF	0x04#define MAX6650_REG_DAC		0x06#define MAX6650_REG_ALARM_EN	0x08#define MAX6650_REG_ALARM	0x0A#define MAX6650_REG_TACH0	0x0C#define MAX6650_REG_TACH1	0x0E#define MAX6650_REG_TACH2	0x10#define MAX6650_REG_TACH3	0x12#define MAX6650_REG_GPIO_STAT	0x14#define MAX6650_REG_COUNT	0x16/* * Config register bits */#define MAX6650_CFG_V12			0x08#define MAX6650_CFG_PRESCALER_MASK	0x07#define MAX6650_CFG_PRESCALER_2		0x01#define MAX6650_CFG_PRESCALER_4		0x02#define MAX6650_CFG_PRESCALER_8		0x03#define MAX6650_CFG_PRESCALER_16	0x04#define MAX6650_CFG_MODE_MASK		0x30#define MAX6650_CFG_MODE_ON		0x00#define MAX6650_CFG_MODE_OFF		0x10#define MAX6650_CFG_MODE_CLOSED_LOOP	0x20#define MAX6650_CFG_MODE_OPEN_LOOP	0x30#define MAX6650_COUNT_MASK		0x03/* Minimum and maximum values of the FAN-RPM */#define FAN_RPM_MIN 240#define FAN_RPM_MAX 30000#define DIV_FROM_REG(reg) (1 << (reg & 7))static int max6650_attach_adapter(struct i2c_adapter *adapter);static int max6650_detect(struct i2c_adapter *adapter, int address, int kind);static int max6650_init_client(struct i2c_client *client);static int max6650_detach_client(struct i2c_client *client);static struct max6650_data *max6650_update_device(struct device *dev);/* * Driver data (common to all clients) */static struct i2c_driver max6650_driver = {	.driver = {		.name	= "max6650",	},	.attach_adapter	= max6650_attach_adapter,	.detach_client	= max6650_detach_client,};/* * Client data (each client gets its own) */struct max6650_data{	struct i2c_client client;	struct device *hwmon_dev;	struct mutex update_lock;	char valid; /* zero until following fields are valid */	unsigned long last_updated; /* in jiffies */	/* register values */	u8 speed;	u8 config;	u8 tach[4];	u8 count;	u8 dac;};static ssize_t get_fan(struct device *dev, struct device_attribute *devattr,		       char *buf){	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);	struct max6650_data *data = max6650_update_device(dev);	int rpm;	/*	* Calculation details:	*	* Each tachometer counts over an interval given by the "count"	* register (0.25, 0.5, 1 or 2 seconds). This module assumes	* that the fans produce two pulses per revolution (this seems	* to be the most common).	*/	rpm = ((data->tach[attr->index] * 120) / DIV_FROM_REG(data->count));	return sprintf(buf, "%d\n", rpm);}/* * Set the fan speed to the specified RPM (or read back the RPM setting). * This works in closed loop mode only. Use pwm1 for open loop speed setting. * * The MAX6650/1 will automatically control fan speed when in closed loop * mode. * * Assumptions: * * 1) The MAX6650/1 internal 254kHz clock frequency is set correctly. Use *    the clock module parameter if you need to fine tune this. * * 2) The prescaler (low three bits of the config register) has already *    been set to an appropriate value. Use the prescaler module parameter *    if your BIOS doesn't initialize the chip properly. * * The relevant equations are given on pages 21 and 22 of the datasheet. * * From the datasheet, the relevant equation when in regulation is: * *    [fCLK / (128 x (KTACH + 1))] = 2 x FanSpeed / KSCALE * * where: * *    fCLK is the oscillator frequency (either the 254kHz internal *         oscillator or the externally applied clock) * *    KTACH is the value in the speed register * *    FanSpeed is the speed of the fan in rps * *    KSCALE is the prescaler value (1, 2, 4, 8, or 16) * * When reading, we need to solve for FanSpeed. When writing, we need to * solve for KTACH. * * Note: this tachometer is completely separate from the tachometers * used to measure the fan speeds. Only one fan's speed (fan1) is * controlled. */static ssize_t get_target(struct device *dev, struct device_attribute *devattr,			 char *buf){	struct max6650_data *data = max6650_update_device(dev);	int kscale, ktach, rpm;	/*	* Use the datasheet equation:	*	*    FanSpeed = KSCALE x fCLK / [256 x (KTACH + 1)]	*	* then multiply by 60 to give rpm.	*/	kscale = DIV_FROM_REG(data->config);	ktach = data->speed;	rpm = 60 * kscale * clock / (256 * (ktach + 1));	return sprintf(buf, "%d\n", rpm);}static ssize_t set_target(struct device *dev, struct device_attribute *devattr,			 const char *buf, size_t count){	struct i2c_client *client = to_i2c_client(dev);	struct max6650_data *data = i2c_get_clientdata(client);	int rpm = simple_strtoul(buf, NULL, 10);	int kscale, ktach;	rpm = SENSORS_LIMIT(rpm, FAN_RPM_MIN, FAN_RPM_MAX);	/*	* Divide the required speed by 60 to get from rpm to rps, then	* use the datasheet equation:	*	*     KTACH = [(fCLK x KSCALE) / (256 x FanSpeed)] - 1	*/	mutex_lock(&data->update_lock);	kscale = DIV_FROM_REG(data->config);	ktach = ((clock * kscale) / (256 * rpm / 60)) - 1;	if (ktach < 0)		ktach = 0;	if (ktach > 255)		ktach = 255;	data->speed = ktach;	i2c_smbus_write_byte_data(client, MAX6650_REG_SPEED, data->speed);	mutex_unlock(&data->update_lock);	return count;}/* * Get/set the fan speed in open loop mode using pwm1 sysfs file. * Speed is given as a relative value from 0 to 255, where 255 is maximum * speed. Note that this is done by writing directly to the chip's DAC, * it won't change the closed loop speed set by fan1_target. * Also note that due to rounding errors it is possible that you don't read * back exactly the value you have set. */static ssize_t get_pwm(struct device *dev, struct device_attribute *devattr,		       char *buf){	int pwm;	struct max6650_data *data = max6650_update_device(dev);	/* Useful range for dac is 0-180 for 12V fans and 0-76 for 5V fans.	   Lower DAC values mean higher speeds. */	if (data->config & MAX6650_CFG_V12)		pwm = 255 - (255 * (int)data->dac)/180;	else		pwm = 255 - (255 * (int)data->dac)/76;	if (pwm < 0)		pwm = 0;	return sprintf(buf, "%d\n", pwm);}static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr,			const char *buf, size_t count){	struct i2c_client *client = to_i2c_client(dev);	struct max6650_data *data = i2c_get_clientdata(client);	int pwm = simple_strtoul(buf, NULL, 10);	pwm = SENSORS_LIMIT(pwm, 0, 255);	mutex_lock(&data->update_lock);	if (data->config & MAX6650_CFG_V12)		data->dac = 180 - (180 * pwm)/255;	else		data->dac = 76 - (76 * pwm)/255;	i2c_smbus_write_byte_data(client, MAX6650_REG_DAC, data->dac);	mutex_unlock(&data->update_lock);	return count;}/* * Get/Set controller mode: * Possible values: * 0 = Fan always on * 1 = Open loop, Voltage is set according to speed, not regulated. * 2 = Closed loop, RPM for all fans regulated by fan1 tachometer */static ssize_t get_enable(struct device *dev, struct device_attribute *devattr,			  char *buf){	struct max6650_data *data = max6650_update_device(dev);	int mode = (data->config & MAX6650_CFG_MODE_MASK) >> 4;	int sysfs_modes[4] = {0, 1, 2, 1};	return sprintf(buf, "%d\n", sysfs_modes[mode]);}static ssize_t set_enable(struct device *dev, struct device_attribute *devattr,			  const char *buf, size_t count){	struct i2c_client *client = to_i2c_client(dev);	struct max6650_data *data = i2c_get_clientdata(client);	int mode = simple_strtoul(buf, NULL, 10);	int max6650_modes[3] = {0, 3, 2};	if ((mode < 0)||(mode > 2)) {		dev_err(&client->dev,			"illegal value for pwm1_enable (%d)\n", mode);		return -EINVAL;	}	mutex_lock(&data->update_lock);	data->config = i2c_smbus_read_byte_data(client, MAX6650_REG_CONFIG);	data->config = (data->config & ~MAX6650_CFG_MODE_MASK)		       | (max6650_modes[mode] << 4);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费人成精品欧美精品| 在线视频国内自拍亚洲视频| 欧美大片一区二区| 岛国一区二区在线观看| 一区二区三区 在线观看视频| 欧美日本韩国一区二区三区视频| 日本不卡一二三| 中文在线免费一区三区高中清不卡| 色先锋资源久久综合| 日本大胆欧美人术艺术动态| 久久精品亚洲乱码伦伦中文 | 免费在线观看一区二区三区| 精品sm在线观看| 在线播放一区二区三区| 国产资源精品在线观看| 日韩一区欧美二区| 亚洲精品视频在线| 亚洲欧美一区二区在线观看| 日韩欧美亚洲国产精品字幕久久久| 成人av小说网| 成人美女视频在线看| 看电视剧不卡顿的网站| 天堂成人国产精品一区| 樱桃国产成人精品视频| 日本一区二区三区四区| 日韩精品一区二区三区视频在线观看| 欧美亚洲愉拍一区二区| 91浏览器在线视频| 99久久综合狠狠综合久久| 成人v精品蜜桃久久一区| 国产精品77777| jlzzjlzz欧美大全| 91国产成人在线| 欧美一区二区观看视频| 欧美一级欧美三级| 欧美tickling网站挠脚心| 欧美日韩日日夜夜| 欧美日韩不卡在线| 欧美日韩精品福利| 欧美高清视频在线高清观看mv色露露十八| 处破女av一区二区| 老司机一区二区| 国产精品影音先锋| av在线不卡电影| 在线观看视频91| 欧美这里有精品| 91麻豆swag| 日韩色在线观看| 国产亚洲欧美日韩在线一区| 久久久不卡网国产精品二区| 国产精品久久久久久久久搜平片| 中文字幕成人av| 亚洲综合丝袜美腿| 精品在线一区二区| 精品一区二区在线观看| 成人性生交大片免费看视频在线 | 亚洲狠狠爱一区二区三区| 日韩高清不卡在线| 国产99久久久国产精品免费看| 岛国一区二区在线观看| 欧美日韩国产系列| 国产精品色哟哟| 婷婷综合在线观看| 成人午夜精品在线| 欧美日韩美女一区二区| 精品剧情在线观看| 亚洲午夜成aⅴ人片| eeuss影院一区二区三区| 91女神在线视频| 国产精品国产三级国产普通话99| 亚洲成人av在线电影| 91亚洲国产成人精品一区二区三 | 久久成人免费网| 欧美精品久久一区二区三区| 中文字幕亚洲区| 成人美女视频在线观看18| 国产日韩欧美激情| 91天堂素人约啪| 一区二区三区四区激情| 欧美剧情电影在线观看完整版免费励志电影| 国产亚洲成年网址在线观看| 国产一区三区三区| 国产精品三级视频| 色综合久久88色综合天天免费| 国产精品视频你懂的| 91免费看`日韩一区二区| 亚洲人成精品久久久久| 欧美亚洲动漫另类| 免费欧美日韩国产三级电影| 日韩欧美精品在线视频| 久久99蜜桃精品| 91麻豆精品国产91久久久| 亚洲成人综合视频| 欧美性猛交xxxxxxxx| 偷拍亚洲欧洲综合| 日本一区二区在线不卡| 91社区在线播放| 天堂一区二区在线免费观看| 中文文精品字幕一区二区| 国产一区二区三区四区五区入口| 中文字幕巨乱亚洲| 欧美影院午夜播放| 日韩电影在线一区二区三区| 久久一区二区三区四区| 欧美三级三级三级| 久久国产福利国产秒拍| 亚州成人在线电影| 中文字幕一区二区不卡| 精品少妇一区二区三区在线视频| 9色porny自拍视频一区二区| 亚洲成人一二三| 一区在线中文字幕| 91精品综合久久久久久| 成人丝袜18视频在线观看| 激情丁香综合五月| 麻豆极品一区二区三区| 国产精品久久夜| 久久久久久久综合日本| 欧美一区二区私人影院日本| 粗大黑人巨茎大战欧美成人| 国产精品1区2区3区| 国模大尺度一区二区三区| 免费看黄色91| 久久精品噜噜噜成人av农村| 日韩福利视频网| 美女脱光内衣内裤视频久久影院| 亚洲二区在线视频| 日韩电影在线免费| 国产麻豆视频一区| www.欧美色图| 在线国产电影不卡| 91精品国产黑色紧身裤美女| 欧美一区二区视频在线观看| 欧美日韩一级片在线观看| 欧美一a一片一级一片| 欧美一区二区成人6969| 精品久久久久久综合日本欧美| 2023国产精品视频| 中文字幕一区二区在线观看| 亚洲免费在线播放| 蜜臀久久99精品久久久久久9| 三级影片在线观看欧美日韩一区二区| 日本不卡一二三区黄网| yourporn久久国产精品| 99re8在线精品视频免费播放| 在线观看一区二区精品视频| 欧美不卡一区二区三区四区| 亚洲另类在线制服丝袜| 黄页视频在线91| 欧美日韩国产高清一区二区| 国产精品天美传媒沈樵| 午夜精品aaa| 日本精品视频一区二区| 一区二区高清在线| 久久99久久99精品免视看婷婷| 91视频观看视频| 国产精品久久久久久久久搜平片| 久久se精品一区精品二区| 波多野结衣欧美| 日本一区二区三区dvd视频在线 | 亚洲国产精品尤物yw在线观看| 国产综合久久久久影院| 日韩一二三四区| 蜜臀国产一区二区三区在线播放| jizzjizzjizz欧美| 亚洲欧美激情在线| 日本乱码高清不卡字幕| 国产精品久久久久久亚洲伦 | 国产不卡免费视频| 精品国产a毛片| 国v精品久久久网| 日韩理论片一区二区| 在线观看日韩高清av| 亚洲激情第一区| 欧美一区二区人人喊爽| 国产精品一级黄| 久久99热99| 国产精品久久三区| 亚洲国产精品一区二区久久恐怖片 | 99久久99精品久久久久久 | 91亚洲精品久久久蜜桃| 欧美一卡二卡三卡| 亚洲在线免费播放| 99精品视频中文字幕| 久久免费看少妇高潮| 久久精品国产秦先生| 欧美日韩不卡在线| 亚洲动漫第一页| 欧美综合久久久| 亚洲黄色免费电影| 色视频一区二区| 亚洲同性同志一二三专区| 成人一区二区三区在线观看| 久久久久久久电影| 国产激情偷乱视频一区二区三区| 日韩欧美www| 久久不见久久见免费视频1| 欧美一二三区精品| 美女网站一区二区| 精品少妇一区二区三区视频免付费 |