linux/drivers/w1/slaves/w1_ds2431.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * w1_ds2431.c - w1 family 2d (DS2431) driver
 *
 * Copyright (c) 2008 Bernhard Weirich <[email protected]>
 *
 * Heavily inspired by w1_DS2433 driver from Ben Gardner <[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/w1.h>

#define W1_EEPROM_DS2431

#define W1_F2D_EEPROM_SIZE
#define W1_F2D_PAGE_COUNT
#define W1_F2D_PAGE_BITS
#define W1_F2D_PAGE_SIZE
#define W1_F2D_PAGE_MASK

#define W1_F2D_SCRATCH_BITS
#define W1_F2D_SCRATCH_SIZE
#define W1_F2D_SCRATCH_MASK

#define W1_F2D_READ_EEPROM
#define W1_F2D_WRITE_SCRATCH
#define W1_F2D_READ_SCRATCH
#define W1_F2D_COPY_SCRATCH


#define W1_F2D_TPROG_MS

#define W1_F2D_READ_RETRIES
#define W1_F2D_READ_MAXLEN

/*
 * Check the file size bounds and adjusts count as needed.
 * This would not be needed if the file size didn't reset to 0 after a write.
 */
static inline size_t w1_f2d_fix_count(loff_t off, size_t count, size_t size)
{}

/*
 * Read a block from W1 ROM two times and compares the results.
 * If they are equal they are returned, otherwise the read
 * is repeated W1_F2D_READ_RETRIES times.
 *
 * count must not exceed W1_F2D_READ_MAXLEN.
 */
static int w1_f2d_readblock(struct w1_slave *sl, int off, int count, char *buf)
{}

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

/*
 * Writes to the scratchpad and reads it back for verification.
 * Then copies the scratchpad to EEPROM.
 * The data must be aligned at W1_F2D_SCRATCH_SIZE bytes and
 * must be W1_F2D_SCRATCH_SIZE bytes long.
 * The master must be locked.
 *
 * @param sl	The slave structure
 * @param addr	Address for the write
 * @param len   length must be <= (W1_F2D_PAGE_SIZE - (addr & W1_F2D_PAGE_MASK))
 * @param data	The data to write
 * @return	0=Success -1=failure
 */
static int w1_f2d_write(struct w1_slave *sl, int addr, int len, const u8 *data)
{}

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

static BIN_ATTR_RW(eeprom, W1_F2D_EEPROM_SIZE);

static struct bin_attribute *w1_f2d_bin_attrs[] =;

static const struct attribute_group w1_f2d_group =;

static const struct attribute_group *w1_f2d_groups[] =;

static const struct w1_family_ops w1_f2d_fops =;

static struct w1_family w1_family_2d =;
module_w1_family();

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