#include <linux/acpi.h>
#include <linux/bitops.h>
#include <linux/capability.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/nvmem-provider.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#define AT24_FLAG_ADDR16 …
#define AT24_FLAG_READONLY …
#define AT24_FLAG_IRUGO …
#define AT24_FLAG_TAKE8ADDR …
#define AT24_FLAG_SERIAL …
#define AT24_FLAG_MAC …
#define AT24_FLAG_NO_RDROL …
struct at24_data { … };
static unsigned int at24_io_limit = …;
module_param_named(io_limit, at24_io_limit, uint, 0);
MODULE_PARM_DESC(…) …;
static unsigned int at24_write_timeout = …;
module_param_named(write_timeout, at24_write_timeout, uint, 0);
MODULE_PARM_DESC(…) …;
struct at24_chip_data { … };
#define AT24_CHIP_DATA(_name, _len, _flags) …
#define AT24_CHIP_DATA_CB(_name, _len, _flags, _read_post) …
#define AT24_CHIP_DATA_BS(_name, _len, _flags, _bank_addr_shift) …
static void at24_read_post_vaio(unsigned int off, char *buf, size_t count)
{ … }
AT24_CHIP_DATA(at24_data_24c00, 128 / 8, AT24_FLAG_TAKE8ADDR);
AT24_CHIP_DATA(at24_data_24c01, 1024 / 8, 0);
AT24_CHIP_DATA(at24_data_24cs01, 16,
AT24_FLAG_SERIAL | AT24_FLAG_READONLY);
AT24_CHIP_DATA(at24_data_24c02, 2048 / 8, 0);
AT24_CHIP_DATA(at24_data_24cs02, 16,
AT24_FLAG_SERIAL | AT24_FLAG_READONLY);
AT24_CHIP_DATA(at24_data_24mac402, 48 / 8,
AT24_FLAG_MAC | AT24_FLAG_READONLY);
AT24_CHIP_DATA(at24_data_24mac602, 64 / 8,
AT24_FLAG_MAC | AT24_FLAG_READONLY);
AT24_CHIP_DATA(at24_data_24aa025e48, 48 / 8,
AT24_FLAG_READONLY);
AT24_CHIP_DATA(at24_data_24aa025e64, 64 / 8,
AT24_FLAG_READONLY);
AT24_CHIP_DATA(at24_data_spd, 2048 / 8,
AT24_FLAG_READONLY | AT24_FLAG_IRUGO);
AT24_CHIP_DATA_CB(at24_data_24c02_vaio, 2048 / 8,
AT24_FLAG_READONLY | AT24_FLAG_IRUGO,
at24_read_post_vaio);
AT24_CHIP_DATA(at24_data_24c04, 4096 / 8, 0);
AT24_CHIP_DATA(at24_data_24cs04, 16,
AT24_FLAG_SERIAL | AT24_FLAG_READONLY);
AT24_CHIP_DATA(at24_data_24c08, 8192 / 8, 0);
AT24_CHIP_DATA(at24_data_24cs08, 16,
AT24_FLAG_SERIAL | AT24_FLAG_READONLY);
AT24_CHIP_DATA(at24_data_24c16, 16384 / 8, 0);
AT24_CHIP_DATA(at24_data_24cs16, 16,
AT24_FLAG_SERIAL | AT24_FLAG_READONLY);
AT24_CHIP_DATA(at24_data_24c32, 32768 / 8, AT24_FLAG_ADDR16);
AT24_CHIP_DATA(at24_data_24c32d_wlp, 32, AT24_FLAG_ADDR16);
AT24_CHIP_DATA(at24_data_24cs32, 16,
AT24_FLAG_ADDR16 | AT24_FLAG_SERIAL | AT24_FLAG_READONLY);
AT24_CHIP_DATA(at24_data_24c64, 65536 / 8, AT24_FLAG_ADDR16);
AT24_CHIP_DATA(at24_data_24c64d_wlp, 32, AT24_FLAG_ADDR16);
AT24_CHIP_DATA(at24_data_24cs64, 16,
AT24_FLAG_ADDR16 | AT24_FLAG_SERIAL | AT24_FLAG_READONLY);
AT24_CHIP_DATA(at24_data_24c128, 131072 / 8, AT24_FLAG_ADDR16);
AT24_CHIP_DATA(at24_data_24c256, 262144 / 8, AT24_FLAG_ADDR16);
AT24_CHIP_DATA(at24_data_24c512, 524288 / 8, AT24_FLAG_ADDR16);
AT24_CHIP_DATA(at24_data_24c1024, 1048576 / 8, AT24_FLAG_ADDR16);
AT24_CHIP_DATA_BS(at24_data_24c1025, 1048576 / 8, AT24_FLAG_ADDR16, 2);
AT24_CHIP_DATA(at24_data_24c2048, 2097152 / 8, AT24_FLAG_ADDR16);
AT24_CHIP_DATA(at24_data_INT3499, 8192 / 8, 0);
static const struct i2c_device_id at24_ids[] = …;
MODULE_DEVICE_TABLE(i2c, at24_ids);
static const struct of_device_id __maybe_unused at24_of_match[] = …;
MODULE_DEVICE_TABLE(of, at24_of_match);
static const struct acpi_device_id __maybe_unused at24_acpi_ids[] = …;
MODULE_DEVICE_TABLE(acpi, at24_acpi_ids);
static struct regmap *at24_translate_offset(struct at24_data *at24,
unsigned int *offset)
{ … }
static struct device *at24_base_client_dev(struct at24_data *at24)
{ … }
static size_t at24_adjust_read_count(struct at24_data *at24,
unsigned int offset, size_t count)
{ … }
static ssize_t at24_regmap_read(struct at24_data *at24, char *buf,
unsigned int offset, size_t count)
{ … }
static size_t at24_adjust_write_count(struct at24_data *at24,
unsigned int offset, size_t count)
{ … }
static ssize_t at24_regmap_write(struct at24_data *at24, const char *buf,
unsigned int offset, size_t count)
{ … }
static int at24_read(void *priv, unsigned int off, void *val, size_t count)
{ … }
static int at24_write(void *priv, unsigned int off, void *val, size_t count)
{ … }
static int at24_make_dummy_client(struct at24_data *at24, unsigned int index,
struct i2c_client *base_client,
struct regmap_config *regmap_config)
{ … }
static unsigned int at24_get_offset_adj(u8 flags, unsigned int byte_len)
{ … }
static void at24_probe_temp_sensor(struct i2c_client *client)
{ … }
static int at24_probe(struct i2c_client *client)
{ … }
static void at24_remove(struct i2c_client *client)
{ … }
static int __maybe_unused at24_suspend(struct device *dev)
{ … }
static int __maybe_unused at24_resume(struct device *dev)
{ … }
static const struct dev_pm_ops at24_pm_ops = …;
static struct i2c_driver at24_driver = …;
static int __init at24_init(void)
{ … }
module_init(…) …;
static void __exit at24_exit(void)
{ … }
module_exit(at24_exit);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;