linux/drivers/hwmon/max6639.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * max6639.c - Support for Maxim MAX6639
 *
 * 2-Channel Temperature Monitor with Dual PWM Fan-Speed Controller
 *
 * Copyright (C) 2010, 2011 Roland Stigge <[email protected]>
 *
 * based on the initial MAX6639 support from semptian.net
 * by He Changqing <[email protected]>
 */

#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>
#include <linux/mutex.h>
#include <linux/platform_data/max6639.h>
#include <linux/regmap.h>
#include <linux/util_macros.h>

/* Addresses to scan */
static const unsigned short normal_i2c[] =;

/* The MAX6639 registers, valid channel numbers: 0, 1 */
#define MAX6639_REG_TEMP(ch)
#define MAX6639_REG_STATUS
#define MAX6639_REG_OUTPUT_MASK
#define MAX6639_REG_GCONFIG
#define MAX6639_REG_TEMP_EXT(ch)
#define MAX6639_REG_ALERT_LIMIT(ch)
#define MAX6639_REG_OT_LIMIT(ch)
#define MAX6639_REG_THERM_LIMIT(ch)
#define MAX6639_REG_FAN_CONFIG1(ch)
#define MAX6639_REG_FAN_CONFIG2a(ch)
#define MAX6639_REG_FAN_CONFIG2b(ch)
#define MAX6639_REG_FAN_CONFIG3(ch)
#define MAX6639_REG_FAN_CNT(ch)
#define MAX6639_REG_TARGET_CNT(ch)
#define MAX6639_REG_FAN_PPR(ch)
#define MAX6639_REG_TARGTDUTY(ch)
#define MAX6639_REG_FAN_START_TEMP(ch)
#define MAX6639_REG_DEVID
#define MAX6639_REG_MANUID
#define MAX6639_REG_DEVREV

/* Register bits */
#define MAX6639_GCONFIG_STANDBY
#define MAX6639_GCONFIG_POR
#define MAX6639_GCONFIG_DISABLE_TIMEOUT
#define MAX6639_GCONFIG_CH2_LOCAL
#define MAX6639_GCONFIG_PWM_FREQ_HI

#define MAX6639_FAN_CONFIG1_PWM
#define MAX6639_FAN_CONFIG3_FREQ_MASK
#define MAX6639_FAN_CONFIG3_THERM_FULL_SPEED

#define MAX6639_NUM_CHANNELS

static const int rpm_ranges[] =;

/* Supported PWM frequency */
static const unsigned int freq_table[] =;

#define FAN_FROM_REG(val, rpm_range)
#define TEMP_LIMIT_TO_REG(val)

/*
 * Client data (each client gets its own)
 */
struct max6639_data {};

static int max6639_temp_read_input(struct device *dev, int channel, long *temp)
{}

static int max6639_temp_read_fault(struct device *dev, int channel, long *fault)
{}

static int max6639_temp_read_max(struct device *dev, int channel, long *max)
{}

static int max6639_temp_read_crit(struct device *dev, int channel, long *crit)
{}

static int max6639_temp_read_emergency(struct device *dev, int channel, long *emerg)
{}

static int max6639_get_status(struct device *dev, unsigned int *status)
{}

static int max6639_temp_set_max(struct max6639_data *data, int channel, long val)
{}

static int max6639_temp_set_crit(struct max6639_data *data, int channel, long val)
{}

static int max6639_temp_set_emergency(struct max6639_data *data, int channel, long val)
{}

static int max6639_read_fan(struct device *dev, u32 attr, int channel,
			    long *fan_val)
{}

static int max6639_set_ppr(struct max6639_data *data, int channel, u8 ppr)
{}

static int max6639_write_fan(struct device *dev, u32 attr, int channel,
			     long val)
{}

static umode_t max6639_fan_is_visible(const void *_data, u32 attr, int channel)
{}

static int max6639_read_pwm(struct device *dev, u32 attr, int channel,
			    long *pwm_val)
{}

static int max6639_write_pwm(struct device *dev, u32 attr, int channel,
			     long val)
{}

static umode_t max6639_pwm_is_visible(const void *_data, u32 attr, int channel)
{}

static int max6639_read_temp(struct device *dev, u32 attr, int channel,
			     long *val)
{}

static int max6639_write_temp(struct device *dev, u32 attr, int channel,
			      long val)
{}

static umode_t max6639_temp_is_visible(const void *_data, u32 attr, int channel)
{}

static int max6639_read(struct device *dev, enum hwmon_sensor_types type,
			u32 attr, int channel, long *val)
{}

static int max6639_write(struct device *dev, enum hwmon_sensor_types type,
			 u32 attr, int channel, long val)
{}

static umode_t max6639_is_visible(const void *data,
				  enum hwmon_sensor_types type,
				  u32 attr, int channel)
{}

static const struct hwmon_channel_info * const max6639_info[] =;

static const struct hwmon_ops max6639_hwmon_ops =;

static const struct hwmon_chip_info max6639_chip_info =;

/*
 *  returns respective index in rpm_ranges table
 *  1 by default on invalid range
 */
static int rpm_range_to_reg(int range)
{}

static int max6639_init_client(struct i2c_client *client,
			       struct max6639_data *data)
{}

/* Return 0 if detection is successful, -ENODEV otherwise */
static int max6639_detect(struct i2c_client *client,
			  struct i2c_board_info *info)
{}

static void max6639_regulator_disable(void *data)
{}

static bool max6639_regmap_is_volatile(struct device *dev, unsigned int reg)
{}

static const struct regmap_config max6639_regmap_config =;

static int max6639_probe(struct i2c_client *client)
{}

static int max6639_suspend(struct device *dev)
{}

static int max6639_resume(struct device *dev)
{}

static const struct i2c_device_id max6639_id[] =;

MODULE_DEVICE_TABLE(i2c, max6639_id);

static DEFINE_SIMPLE_DEV_PM_OPS(max6639_pm_ops, max6639_suspend, max6639_resume);

static const struct of_device_id max6639_of_match[] =;

static struct i2c_driver max6639_driver =;

module_i2c_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();