linux/drivers/w1/slaves/w1_ds2438.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * 1-Wire implementation for the ds2438 chip
 *
 * Copyright (c) 2017 Mariusz Bialonczyk <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/types.h>
#include <linux/delay.h>

#include <linux/w1.h>

#define W1_FAMILY_DS2438

#define W1_DS2438_RETRIES

/* Memory commands */
#define W1_DS2438_READ_SCRATCH
#define W1_DS2438_WRITE_SCRATCH
#define W1_DS2438_COPY_SCRATCH
#define W1_DS2438_RECALL_MEMORY
/* Register commands */
#define W1_DS2438_CONVERT_TEMP
#define W1_DS2438_CONVERT_VOLTAGE

#define DS2438_PAGE_SIZE
#define DS2438_ADC_INPUT_VAD
#define DS2438_ADC_INPUT_VDD
#define DS2438_MAX_CONVERSION_TIME

/* Page #0 definitions */
#define DS2438_STATUS_REG
#define DS2438_STATUS_IAD
#define DS2438_STATUS_CA
#define DS2438_STATUS_EE
#define DS2438_STATUS_AD
#define DS2438_STATUS_TB
#define DS2438_STATUS_NVB
#define DS2438_STATUS_ADB

#define DS2438_TEMP_LSB
#define DS2438_TEMP_MSB
#define DS2438_VOLTAGE_LSB
#define DS2438_VOLTAGE_MSB
#define DS2438_CURRENT_LSB
#define DS2438_CURRENT_MSB
#define DS2438_THRESHOLD

/* Page #1 definitions */
#define DS2438_ETM_0
#define DS2438_ETM_1
#define DS2438_ETM_2
#define DS2438_ETM_3
#define DS2438_ICA
#define DS2438_OFFSET_LSB
#define DS2438_OFFSET_MSB

static int w1_ds2438_get_page(struct w1_slave *sl, int pageno, u8 *buf)
{}

static int w1_ds2438_get_temperature(struct w1_slave *sl, int16_t *temperature)
{}

static int w1_ds2438_change_config_bit(struct w1_slave *sl, u8 mask, u8 value)
{}

static int w1_ds2438_change_offset_register(struct w1_slave *sl, u8 *value)
{}

static int w1_ds2438_get_voltage(struct w1_slave *sl,
				 int adc_input, uint16_t *voltage)
{}

static int w1_ds2438_get_current(struct w1_slave *sl, int16_t *voltage)
{}

static ssize_t iad_write(struct file *filp, struct kobject *kobj,
			 struct bin_attribute *bin_attr, char *buf,
			 loff_t off, size_t count)
{}

static ssize_t iad_read(struct file *filp, struct kobject *kobj,
			struct bin_attribute *bin_attr, char *buf,
			loff_t off, size_t count)
{}

static ssize_t page0_read(struct file *filp, struct kobject *kobj,
			  struct bin_attribute *bin_attr, char *buf,
			  loff_t off, size_t count)
{}

static ssize_t page1_read(struct file *filp, struct kobject *kobj,
			  struct bin_attribute *bin_attr, char *buf,
			  loff_t off, size_t count)
{}

static ssize_t offset_write(struct file *filp, struct kobject *kobj,
			    struct bin_attribute *bin_attr, char *buf,
			    loff_t off, size_t count)
{}

static ssize_t temperature_read(struct file *filp, struct kobject *kobj,
				struct bin_attribute *bin_attr, char *buf,
				loff_t off, size_t count)
{}

static ssize_t vad_read(struct file *filp, struct kobject *kobj,
			struct bin_attribute *bin_attr, char *buf,
			loff_t off, size_t count)
{}

static ssize_t vdd_read(struct file *filp, struct kobject *kobj,
			struct bin_attribute *bin_attr, char *buf,
			loff_t off, size_t count)
{}

static BIN_ATTR_RW(iad, 0);
static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE);
static BIN_ATTR_RO(page1, DS2438_PAGE_SIZE);
static BIN_ATTR_WO(offset, 2);
static BIN_ATTR_RO(temperature, 0/* real length varies */);
static BIN_ATTR_RO(vad, 0/* real length varies */);
static BIN_ATTR_RO(vdd, 0/* real length varies */);

static struct bin_attribute *w1_ds2438_bin_attrs[] =;

static const struct attribute_group w1_ds2438_group =;

static const struct attribute_group *w1_ds2438_groups[] =;

static const struct w1_family_ops w1_ds2438_fops =;

static struct w1_family w1_ds2438_family =;
module_w1_family();

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