linux/drivers/w1/slaves/w1_ds2430.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * w1_ds2430.c - w1 family 14 (DS2430) driver
 **
 * Copyright (c) 2019 Angelo Dureghello <[email protected]>
 *
 * Cloned and modified from ds2431
 * Copyright (c) 2008 Bernhard Weirich <[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_DS2430

#define W1_F14_EEPROM_SIZE
#define W1_F14_PAGE_COUNT
#define W1_F14_PAGE_BITS
#define W1_F14_PAGE_SIZE
#define W1_F14_PAGE_MASK

#define W1_F14_SCRATCH_BITS
#define W1_F14_SCRATCH_SIZE
#define W1_F14_SCRATCH_MASK

#define W1_F14_READ_EEPROM
#define W1_F14_WRITE_SCRATCH
#define W1_F14_READ_SCRATCH
#define W1_F14_COPY_SCRATCH
#define W1_F14_VALIDATION_KEY

#define W1_F14_TPROG_MS
#define W1_F14_READ_RETRIES
#define W1_F14_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_f14_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_F14_READ_RETRIES times.
 *
 * count must not exceed W1_F14_READ_MAXLEN.
 */
static int w1_f14_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_F14_SCRATCH_SIZE bytes and
 * must be W1_F14_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_F14_PAGE_SIZE - (addr & W1_F14_PAGE_MASK))
 * @param data	The data to write
 * @return	0=Success -1=failure
 */
static int w1_f14_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_F14_EEPROM_SIZE);

static struct bin_attribute *w1_f14_bin_attrs[] =;

static const struct attribute_group w1_f14_group =;

static const struct attribute_group *w1_f14_groups[] =;

static const struct w1_family_ops w1_f14_fops =;

static struct w1_family w1_family_14 =;
module_w1_family();

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