linux/drivers/hwmon/max127.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Hardware monitoring driver for MAX127.
 *
 * Copyright (c) 2020 Facebook Inc.
 */

#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/module.h>

/*
 * MAX127 Control Byte. Refer to MAX127 datasheet, Table 1 "Control-Byte
 * Format" for details.
 */
#define MAX127_CTRL_START
#define MAX127_CTRL_SEL_SHIFT
#define MAX127_CTRL_RNG
#define MAX127_CTRL_BIP
#define MAX127_CTRL_PD1
#define MAX127_CTRL_PD0

#define MAX127_NUM_CHANNELS
#define MAX127_SET_CHANNEL(ch)

/*
 * MAX127 channel input ranges. Refer to MAX127 datasheet, Table 3 "Range
 * and Polarity Selection" for details.
 */
#define MAX127_FULL_RANGE
#define MAX127_HALF_RANGE

/*
 * MAX127 returns 2 bytes at read:
 *   - the first byte contains data[11:4].
 *   - the second byte contains data[3:0] (MSB) and 4 dummy 0s (LSB).
 * Refer to MAX127 datasheet, "Read a Conversion (Read Cycle)" section
 * for details.
 */
#define MAX127_DATA_LEN
#define MAX127_DATA_SHIFT

#define MAX127_SIGN_BIT

struct max127_data {};

static int max127_select_channel(struct i2c_client *client, u8 ctrl_byte)
{}

static int max127_read_channel(struct i2c_client *client, long *val)
{}

static long max127_process_raw(u8 ctrl_byte, long raw)
{}

static int max127_read_input(struct max127_data *data, int channel, long *val)
{}

static int max127_read_min(struct max127_data *data, int channel, long *val)
{}

static int max127_read_max(struct max127_data *data, int channel, long *val)
{}

static int max127_write_min(struct max127_data *data, int channel, long val)
{}

static int max127_write_max(struct max127_data *data, int channel, long val)
{}

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

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

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

static const struct hwmon_ops max127_hwmon_ops =;

static const struct hwmon_channel_info * const max127_info[] =;

static const struct hwmon_chip_info max127_chip_info =;

static int max127_probe(struct i2c_client *client)
{}

static const struct i2c_device_id max127_id[] =;
MODULE_DEVICE_TABLE(i2c, max127_id);

static struct i2c_driver max127_driver =;

module_i2c_driver();

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