linux/drivers/w1/slaves/w1_ds28e04.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *	w1_ds28e04.c - w1 family 1C (DS28E04) driver
 *
 * Copyright (c) 2012 Markus Franke <[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/crc16.h>
#include <linux/uaccess.h>

#define CRC16_INIT
#define CRC16_VALID

#include <linux/w1.h>

#define W1_FAMILY_DS28E04

/* Allow the strong pullup to be disabled, but default to enabled.
 * If it was disabled a parasite powered device might not get the required
 * current to copy the data from the scratchpad to EEPROM.  If it is enabled
 * parasite powered devices have a better chance of getting the current
 * required.
 */
static int w1_strong_pullup =;
module_param_named(strong_pullup, w1_strong_pullup, int, 0);

/* enable/disable CRC checking on DS28E04-100 memory accesses */
static bool w1_enable_crccheck =;

#define W1_EEPROM_SIZE
#define W1_PAGE_COUNT
#define W1_PAGE_SIZE
#define W1_PAGE_BITS
#define W1_PAGE_MASK

#define W1_F1C_READ_EEPROM
#define W1_F1C_WRITE_SCRATCH
#define W1_F1C_READ_SCRATCH
#define W1_F1C_COPY_SCRATCH
#define W1_F1C_ACCESS_WRITE

#define W1_1C_REG_LOGIC_STATE

struct w1_f1C_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_f1C_fix_count(loff_t off, size_t count, size_t size)
{}

static int w1_f1C_refresh_block(struct w1_slave *sl, struct w1_f1C_data *data,
				int block)
{}

static int w1_f1C_read(struct w1_slave *sl, int addr, int len, char *data)
{}

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_f1C_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_f1C_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_EEPROM_SIZE);

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

{}

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

{}

static BIN_ATTR_RW(pio, 1);

static ssize_t crccheck_show(struct device *dev, struct device_attribute *attr,
			     char *buf)
{}

static ssize_t crccheck_store(struct device *dev, struct device_attribute *attr,
			      const char *buf, size_t count)
{}

static DEVICE_ATTR_RW(crccheck);

static struct attribute *w1_f1C_attrs[] =;

static struct bin_attribute *w1_f1C_bin_attrs[] =;

static const struct attribute_group w1_f1C_group =;

static const struct attribute_group *w1_f1C_groups[] =;

static int w1_f1C_add_slave(struct w1_slave *sl)
{}

static void w1_f1C_remove_slave(struct w1_slave *sl)
{}

static const struct w1_family_ops w1_f1C_fops =;

static struct w1_family w1_family_1C =;
module_w1_family();

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