linux/drivers/hwmon/wm831x-hwmon.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * drivers/hwmon/wm831x-hwmon.c - Wolfson Microelectronics WM831x PMIC
 *                                hardware monitoring features.
 *
 * Copyright (C) 2009 Wolfson Microelectronics plc
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/slab.h>

#include <linux/mfd/wm831x/core.h>
#include <linux/mfd/wm831x/auxadc.h>

static const char * const input_names[] =;

static ssize_t show_voltage(struct device *dev,
			    struct device_attribute *attr, char *buf)
{}

static ssize_t show_chip_temp(struct device *dev,
			      struct device_attribute *attr, char *buf)
{}

static ssize_t show_label(struct device *dev,
			  struct device_attribute *attr, char *buf)
{}

#define WM831X_VOLTAGE(id, name)

#define WM831X_NAMED_VOLTAGE(id, name)

WM831X_VOLTAGE();
WM831X_VOLTAGE();
WM831X_VOLTAGE();
WM831X_VOLTAGE();

WM831X_NAMED_VOLTAGE(4, WM831X_AUX_SYSVDD);
WM831X_NAMED_VOLTAGE(5, WM831X_AUX_USB);
WM831X_NAMED_VOLTAGE(6, WM831X_AUX_BATT);
WM831X_NAMED_VOLTAGE(7, WM831X_AUX_WALL);
WM831X_NAMED_VOLTAGE(8, WM831X_AUX_BKUP_BATT);

static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_chip_temp, NULL,
			  WM831X_AUX_CHIP_TEMP);
static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL,
			  WM831X_AUX_CHIP_TEMP);
/*
 * Report as a voltage since conversion depends on external components
 * and that's what the ABI wants.
 */
static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_voltage, NULL,
			  WM831X_AUX_BATT_TEMP);
static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, show_label, NULL,
			  WM831X_AUX_BATT_TEMP);

static struct attribute *wm831x_attrs[] =;

ATTRIBUTE_GROUPS();

static int wm831x_hwmon_probe(struct platform_device *pdev)
{}

static struct platform_driver wm831x_hwmon_driver =;

module_platform_driver();

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