linux/drivers/hwmon/surface_temp.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Thermal sensor subsystem driver for Surface System Aggregator Module (SSAM).
 *
 * Copyright (C) 2022-2023 Maximilian Luz <[email protected]>
 */

#include <linux/bitops.h>
#include <linux/hwmon.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>

#include <linux/surface_aggregator/controller.h>
#include <linux/surface_aggregator/device.h>

/* -- SAM interface. -------------------------------------------------------- */

/*
 * Available sensors are indicated by a 16-bit bitfield, where a 1 marks the
 * presence of a sensor. So we have at most 16 possible sensors/channels.
 */
#define SSAM_TMP_SENSOR_MAX_COUNT

/*
 * All names observed so far are 6 characters long, but there's only
 * zeros after the name, so perhaps they can be longer. This number reflects
 * the maximum zero-padded space observed in the returned buffer.
 */
#define SSAM_TMP_SENSOR_NAME_LENGTH

struct ssam_tmp_get_name_rsp {} __packed;

static_assert();

SSAM_DEFINE_SYNC_REQUEST_CL_R(__ssam_tmp_get_available_sensors, __le16, {
	.target_category = SSAM_SSH_TC_TMP,
	.command_id      = 0x04,
});

SSAM_DEFINE_SYNC_REQUEST_MD_R(__ssam_tmp_get_temperature, __le16, {
	.target_category = SSAM_SSH_TC_TMP,
	.command_id      = 0x01,
});

SSAM_DEFINE_SYNC_REQUEST_MD_R(__ssam_tmp_get_name, struct ssam_tmp_get_name_rsp, {
	.target_category = SSAM_SSH_TC_TMP,
	.command_id      = 0x0e,
});

static int ssam_tmp_get_available_sensors(struct ssam_device *sdev, s16 *sensors)
{}

static int ssam_tmp_get_temperature(struct ssam_device *sdev, u8 iid, long *temperature)
{}

static int ssam_tmp_get_name(struct ssam_device *sdev, u8 iid, char *buf, size_t buf_len)
{}

/* -- Driver.---------------------------------------------------------------- */

struct ssam_temp {};

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

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

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

static const struct hwmon_channel_info * const ssam_temp_hwmon_info[] =;

static const struct hwmon_ops ssam_temp_hwmon_ops =;

static const struct hwmon_chip_info ssam_temp_hwmon_chip_info =;

static int ssam_temp_probe(struct ssam_device *sdev)
{}

static const struct ssam_device_id ssam_temp_match[] =;
MODULE_DEVICE_TABLE(ssam, ssam_temp_match);

static struct ssam_device_driver ssam_temp =;
module_ssam_device_driver();

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