linux/drivers/w1/slaves/w1_ds2408.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *	w1_ds2408.c - w1 family 29 (DS2408) driver
 *
 * Copyright (c) 2010 Jean-Francois Dagenais <[email protected]>
 */

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

#include <linux/w1.h>

#define W1_FAMILY_DS2408

#define W1_F29_RETRIES

#define W1_F29_REG_LOGIG_STATE
#define W1_F29_REG_OUTPUT_LATCH_STATE
#define W1_F29_REG_ACTIVITY_LATCH_STATE
#define W1_F29_REG_COND_SEARCH_SELECT_MASK
#define W1_F29_REG_COND_SEARCH_POL_SELECT
#define W1_F29_REG_CONTROL_AND_STATUS

#define W1_F29_FUNC_READ_PIO_REGS
#define W1_F29_FUNC_CHANN_ACCESS_READ
#define W1_F29_FUNC_CHANN_ACCESS_WRITE
/* also used to write the control/status reg (0x8D): */
#define W1_F29_FUNC_WRITE_COND_SEARCH_REG
#define W1_F29_FUNC_RESET_ACTIVITY_LATCHES

#define W1_F29_SUCCESS_CONFIRM_BYTE

static int _read_reg(struct w1_slave *sl, u8 address, unsigned char *buf)
{}

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

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

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

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

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

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

#ifdef CONFIG_W1_SLAVE_DS2408_READBACK
static bool optional_read_back_valid(struct w1_slave *sl, u8 expected)
{}
#else
static bool optional_read_back_valid(struct w1_slave *sl, u8 expected)
{
	return true;
}
#endif

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


/*
 * Writing to the activity file resets the activity latches.
 */
static ssize_t activity_write(struct file *filp, struct kobject *kobj,
			      struct bin_attribute *bin_attr, char *buf,
			      loff_t off, size_t count)
{}

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

/*
 * This is a special sequence we must do to ensure the P0 output is not stuck
 * in test mode. This is described in rev 2 of the ds2408's datasheet
 * (http://datasheets.maximintegrated.com/en/ds/DS2408.pdf) under
 * "APPLICATION INFORMATION/Power-up timing".
 */
static int w1_f29_disable_test_mode(struct w1_slave *sl)
{}

static BIN_ATTR_RO(state, 1);
static BIN_ATTR_RW(output, 1);
static BIN_ATTR_RW(activity, 1);
static BIN_ATTR_RO(cond_search_mask, 1);
static BIN_ATTR_RO(cond_search_polarity, 1);
static BIN_ATTR_RW(status_control, 1);

static struct bin_attribute *w1_f29_bin_attrs[] =;

static const struct attribute_group w1_f29_group =;

static const struct attribute_group *w1_f29_groups[] =;

static const struct w1_family_ops w1_f29_fops =;

static struct w1_family w1_family_29 =;
module_w1_family();

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