linux/drivers/hwmon/gigabyte_waterforce.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * hwmon driver for Gigabyte AORUS Waterforce AIO CPU coolers: X240, X280 and X360.
 *
 * Copyright 2023 Aleksa Savic <[email protected]>
 */

#include <linux/debugfs.h>
#include <linux/hid.h>
#include <linux/hwmon.h>
#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <asm/unaligned.h>

#define DRIVER_NAME

#define USB_VENDOR_ID_GIGABYTE
#define USB_PRODUCT_ID_WATERFORCE

#define STATUS_VALIDITY
#define MAX_REPORT_LENGTH

#define WATERFORCE_TEMP_SENSOR
#define WATERFORCE_FAN_SPEED
#define WATERFORCE_PUMP_SPEED
#define WATERFORCE_FAN_DUTY
#define WATERFORCE_PUMP_DUTY

/* Control commands, inner offsets and lengths */
static const u8 get_status_cmd[] =;

#define FIRMWARE_VER_START_OFFSET_1
#define FIRMWARE_VER_START_OFFSET_2
static const u8 get_firmware_ver_cmd[] =;

/* Command lengths */
#define GET_STATUS_CMD_LENGTH
#define GET_FIRMWARE_VER_CMD_LENGTH

static const char *const waterforce_temp_label[] =;

static const char *const waterforce_speed_label[] =;

struct waterforce_data {};

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

/* Writes the command to the device with the rest of the report filled with zeroes */
static int waterforce_write_expanded(struct waterforce_data *priv, const u8 *cmd, int cmd_length)
{}

static int waterforce_get_status(struct waterforce_data *priv)
{}

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

static int waterforce_read_string(struct device *dev, enum hwmon_sensor_types type,
				  u32 attr, int channel, const char **str)
{}

static int waterforce_get_fw_ver(struct hid_device *hdev)
{}

static const struct hwmon_ops waterforce_hwmon_ops =;

static const struct hwmon_channel_info *waterforce_info[] =;

static const struct hwmon_chip_info waterforce_chip_info =;

static int waterforce_raw_event(struct hid_device *hdev, struct hid_report *report, u8 *data,
				int size)
{}

static int firmware_version_show(struct seq_file *seqf, void *unused)
{}
DEFINE_SHOW_ATTRIBUTE();

static void waterforce_debugfs_init(struct waterforce_data *priv)
{}

static int waterforce_probe(struct hid_device *hdev, const struct hid_device_id *id)
{}

static void waterforce_remove(struct hid_device *hdev)
{}

static const struct hid_device_id waterforce_table[] =;

MODULE_DEVICE_TABLE(hid, waterforce_table);

static struct hid_driver waterforce_driver =;

static int __init waterforce_init(void)
{}

static void __exit waterforce_exit(void)
{}

/* When compiled into the kernel, initialize after the HID bus */
late_initcall(waterforce_init);
module_exit(waterforce_exit);

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