linux/drivers/w1/slaves/w1_ds2433.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *	w1_ds2433.c - w1 family 23 (DS2433) & 43 (DS28EC20) eeprom driver
 *
 * Copyright (c) 2005 Ben Gardner <[email protected]>
 * Copyright (c) 2023 Marc Ferland <[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>
#ifdef CONFIG_W1_SLAVE_DS2433_CRC
#include <linux/crc16.h>

#define CRC16_INIT
#define CRC16_VALID

#endif

#include <linux/w1.h>

#define W1_EEPROM_DS2433
#define W1_EEPROM_DS28EC20

#define W1_EEPROM_DS2433_SIZE
#define W1_EEPROM_DS28EC20_SIZE

#define W1_PAGE_SIZE
#define W1_PAGE_BITS
#define W1_PAGE_MASK
#define W1_VALIDCRC_MAX

#define W1_F23_READ_EEPROM
#define W1_F23_WRITE_SCRATCH
#define W1_F23_READ_SCRATCH
#define W1_F23_COPY_SCRATCH

struct ds2433_config {};

static const struct ds2433_config config_f23 =;

static const struct ds2433_config config_f43 =;

struct w1_f23_data {};

/*
 * 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_f23_fix_count(loff_t off, size_t count, size_t size)
{}

#ifdef CONFIG_W1_SLAVE_DS2433_CRC
static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data,
				int block)
{}
#endif	/* CONFIG_W1_SLAVE_DS2433_CRC */

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

/**
 * w1_f23_write() - Writes to the scratchpad and reads it back for verification.
 * @sl:		The slave structure
 * @addr:	Address for the write
 * @len:	length must be <= (W1_PAGE_SIZE - (addr & W1_PAGE_MASK))
 * @data:	The data to write
 *
 * Then copies the scratchpad to EEPROM.
 * The data must be on one page.
 * The master must be locked.
 *
 * Return:	0=Success, -1=failure
 */
static int w1_f23_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 struct bin_attribute bin_attr_f23_eeprom =;

static struct bin_attribute bin_attr_f43_eeprom =;

static struct bin_attribute *w1_f23_bin_attributes[] =;

static const struct attribute_group w1_f23_group =;

static const struct attribute_group *w1_f23_groups[] =;

static struct bin_attribute *w1_f43_bin_attributes[] =;

static const struct attribute_group w1_f43_group =;

static const struct attribute_group *w1_f43_groups[] =;

static int w1_f23_add_slave(struct w1_slave *sl)
{}

static void w1_f23_remove_slave(struct w1_slave *sl)
{}

static const struct w1_family_ops w1_f23_fops =;

static const struct w1_family_ops w1_f43_fops =;

static struct w1_family w1_family_23 =;

static struct w1_family w1_family_43 =;

static int __init w1_ds2433_init(void)
{}

static void __exit w1_ds2433_exit(void)
{}

module_init();
module_exit(w1_ds2433_exit);

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