// SPDX-License-Identifier: GPL-2.0-only /* * max6875.c - driver for MAX6874/MAX6875 * * Copyright (C) 2005 Ben Gardner <bgardner@wabtec.com> * * Based on eeprom.c * * The MAX6875 has a bank of registers and two banks of EEPROM. * Address ranges are defined as follows: * * 0x0000 - 0x0046 = configuration registers * * 0x8000 - 0x8046 = configuration EEPROM * * 0x8100 - 0x82FF = user EEPROM * * This driver makes the user EEPROM available for read. * * The registers & config EEPROM should be accessed via i2c-dev. * * The MAX6875 ignores the lowest address bit, so each chip responds to * two addresses - 0x50/0x51 and 0x52/0x53. * * Note that the MAX6875 uses i2c_smbus_write_byte_data() to set the read * address, so this driver is destructive if loaded for the wrong EEPROM chip.
*/
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA
| I2C_FUNC_SMBUS_READ_BYTE)) return -ENODEV;
/* Only bind to even addresses */ if (client->addr & 1) return -ENODEV;
data = kzalloc(sizeof(struct max6875_data), GFP_KERNEL); if (!data) return -ENOMEM;
/* A fake client is created on the odd address */
data->fake_client = i2c_new_dummy_device(client->adapter, client->addr + 1); if (IS_ERR(data->fake_client)) {
err = PTR_ERR(data->fake_client); goto exit_kfree;
}
/* Init real i2c_client */
i2c_set_clientdata(client, data);
mutex_init(&data->update_lock);
err = sysfs_create_bin_file(&client->dev.kobj, &user_eeprom_attr); if (err) goto exit_remove_fake;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.