Lines Matching +full:eeprom +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0-only
3 * max6875.c - driver for MAX6874/MAX6875
7 * Based on eeprom.c
9 * The MAX6875 has a bank of registers and two banks of EEPROM.
11 * * 0x0000 - 0x0046 = configuration registers
12 * * 0x8000 - 0x8046 = configuration EEPROM
13 * * 0x8100 - 0x82FF = user EEPROM
15 * This driver makes the user EEPROM available for read.
17 * The registers & config EEPROM should be accessed via i2c-dev.
20 * two addresses - 0x50/0x51 and 0x52/0x53.
23 * address, so this driver is destructive if loaded for the wrong EEPROM chip.
36 /* USER EEPROM is at addresses 0x8100 - 0x82FF */
63 mutex_lock(&data->update_lock);
65 buf = &data->data[slice << SLICE_BITS];
67 if (!(data->valid & (1 << slice)) ||
68 time_after(jiffies, data->last_updated[slice])) {
70 dev_dbg(&client->dev, "Starting update of slice %u\n", slice);
72 data->valid &= ~(1 << slice);
76 /* select the eeprom address */
78 dev_err(&client->dev, "address set failed\n");
82 if (i2c_check_functionality(client->adapter,
99 data->last_updated[slice] = jiffies;
100 data->valid |= (1 << slice);
103 mutex_unlock(&data->update_lock);
115 max_slice = (off + count - 1) >> SLICE_BITS;
119 memcpy(buf, &data->data[off], count);
126 .name = "eeprom",
135 struct i2c_adapter *adapter = client->adapter;
141 return -ENODEV;
144 if (client->addr & 1)
145 return -ENODEV;
149 return -ENOMEM;
152 data->fake_client = i2c_new_dummy_device(client->adapter, client->addr + 1);
153 if (IS_ERR(data->fake_client)) {
154 err = PTR_ERR(data->fake_client);
160 mutex_init(&data->update_lock);
162 err = sysfs_create_bin_file(&client->dev.kobj, &user_eeprom_attr);
169 i2c_unregister_device(data->fake_client);
179 i2c_unregister_device(data->fake_client);
181 sysfs_remove_bin_file(&client->dev.kobj, &user_eeprom_attr);
193 .name = "max6875",