linux/drivers/hwmon/asus_rog_ryujin.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * hwmon driver for Asus ROG Ryujin II 360 AIO cooler.
 *
 * Copyright 2024 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_ASUS_ROG
#define USB_PRODUCT_ID_RYUJIN_AIO

#define STATUS_VALIDITY
#define MAX_REPORT_LENGTH

/* Cooler status report offsets */
#define RYUJIN_TEMP_SENSOR_1
#define RYUJIN_TEMP_SENSOR_2
#define RYUJIN_PUMP_SPEED
#define RYUJIN_INTERNAL_FAN_SPEED

/* Cooler duty report offsets */
#define RYUJIN_PUMP_DUTY
#define RYUJIN_INTERNAL_FAN_DUTY

/* Controller status (speeds) report offsets */
#define RYUJIN_CONTROLLER_SPEED_1
#define RYUJIN_CONTROLLER_SPEED_2
#define RYUJIN_CONTROLLER_SPEED_3
#define RYUJIN_CONTROLLER_SPEED_4

/* Controller duty report offsets */
#define RYUJIN_CONTROLLER_DUTY

/* Control commands and their inner offsets */
#define RYUJIN_CMD_PREFIX

static const u8 get_cooler_status_cmd[] =;
static const u8 get_cooler_duty_cmd[] =;
static const u8 get_controller_speed_cmd[] =;
static const u8 get_controller_duty_cmd[] =;

#define RYUJIN_SET_COOLER_PUMP_DUTY_OFFSET
#define RYUJIN_SET_COOLER_FAN_DUTY_OFFSET
static const u8 set_cooler_duty_cmd[] =;

#define RYUJIN_SET_CONTROLLER_FAN_DUTY_OFFSET
static const u8 set_controller_duty_cmd[] =;

/* Command lengths */
#define GET_CMD_LENGTH
#define SET_CMD_LENGTH

/* Command response headers */
#define RYUJIN_GET_COOLER_STATUS_CMD_RESPONSE
#define RYUJIN_GET_COOLER_DUTY_CMD_RESPONSE
#define RYUJIN_GET_CONTROLLER_SPEED_CMD_RESPONSE
#define RYUJIN_GET_CONTROLLER_DUTY_CMD_RESPONSE

static const char *const rog_ryujin_temp_label[] =;

static const char *const rog_ryujin_speed_label[] =;

struct rog_ryujin_data {};

static int rog_ryujin_percent_to_pwm(u16 val)
{}

static int rog_ryujin_pwm_to_percent(long val)
{}

static umode_t rog_ryujin_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 rog_ryujin_write_expanded(struct rog_ryujin_data *priv, const u8 *cmd, int cmd_length)
{}

/* Assumes priv->status_report_request_mutex is locked */
static int rog_ryujin_execute_cmd(struct rog_ryujin_data *priv, const u8 *cmd, int cmd_length,
				  struct completion *status_completion)
{}

static int rog_ryujin_get_status(struct rog_ryujin_data *priv)
{}

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

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

static int rog_ryujin_write_fixed_duty(struct rog_ryujin_data *priv, int channel, int val)
{}

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

static const struct hwmon_ops rog_ryujin_hwmon_ops =;

static const struct hwmon_channel_info *rog_ryujin_info[] =;

static const struct hwmon_chip_info rog_ryujin_chip_info =;

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

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

static void rog_ryujin_remove(struct hid_device *hdev)
{}

static const struct hid_device_id rog_ryujin_table[] =;

MODULE_DEVICE_TABLE(hid, rog_ryujin_table);

static struct hid_driver rog_ryujin_driver =;

static int __init rog_ryujin_init(void)
{}

static void __exit rog_ryujin_exit(void)
{}

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

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