Lines Matching defs:slave
260 * @addr: 8-bit or 10-bit slave addr, including r/w bit
300 * @slave: list of slave devices registered on the I2C bus
301 * @slave_running: slave device currently used
303 * @slave_dir: transfer direction for the current slave device
305 * slave)
329 struct i2c_client *slave[STM32F7_I2C_MAX_SLAVE];
871 /* Set slave address */
956 /* Set slave address */
1223 static bool stm32f7_i2c_is_addr_match(struct i2c_client *slave, u32 addcode)
1227 if (!slave)
1230 if (slave->flags & I2C_CLIENT_TEN) {
1233 * X = Bit 9 of slave address
1234 * Y = Bit 8 of slave address
1236 addr = slave->addr >> 8;
1241 addr = slave->addr & 0x7f;
1251 struct i2c_client *slave = i2c_dev->slave_running;
1257 /* Notify i2c slave that new read transfer is starting */
1258 i2c_slave_event(slave, I2C_SLAVE_READ_REQUESTED, &value);
1261 * Disable slave TX config in case of I2C combined message
1278 /* Notify i2c slave that new write transfer is starting */
1279 i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
1308 if (stm32f7_i2c_is_addr_match(i2c_dev->slave[i], addcode)) {
1309 i2c_dev->slave_running = i2c_dev->slave[i];
1312 /* Start I2C slave processing */
1324 struct i2c_client *slave, int *id)
1329 if (i2c_dev->slave[i] == slave) {
1335 dev_err(i2c_dev->dev, "Slave 0x%x not registered\n", slave->addr);
1341 struct i2c_client *slave, int *id)
1347 * slave[STM32F7_SLAVE_HOSTNOTIFY] support only SMBus Host address (0x8)
1348 * slave[STM32F7_SLAVE_7_10_BITS_ADDR] supports 7-bit and 10-bit slave address
1349 * slave[STM32F7_SLAVE_7_BITS_ADDR] supports 7-bit slave address only
1351 if (i2c_dev->smbus_mode && (slave->addr == 0x08)) {
1352 if (i2c_dev->slave[STM32F7_SLAVE_HOSTNOTIFY])
1360 (slave->flags & I2C_CLIENT_TEN))
1362 if (!i2c_dev->slave[i]) {
1369 dev_err(dev, "Slave 0x%x could not be registered\n", slave->addr);
1379 if (i2c_dev->slave[i])
1392 if (i2c_dev->slave[i])
1461 /* Notify i2c slave that a STOP flag has been detected */
1483 /* Check if the interrupt if for a slave device */
1688 dev_dbg(i2c_dev->dev, "Access to slave 0x%x timed out\n",
1747 dev_dbg(dev, "Access to slave 0x%x timed out\n", f7_msg->addr);
1808 static int stm32f7_i2c_reg_slave(struct i2c_client *slave)
1810 struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(slave->adapter);
1816 if (slave->flags & I2C_CLIENT_PEC) {
1817 dev_err(dev, "SMBus PEC not supported in slave mode\n");
1822 dev_err(dev, "Too much slave registered\n");
1826 ret = stm32f7_i2c_get_free_slave_id(i2c_dev, slave, &id);
1840 i2c_dev->slave[id] = slave;
1847 if (slave->flags & I2C_CLIENT_TEN) {
1848 oar1 |= STM32F7_I2C_OAR1_OA1_10(slave->addr);
1851 oar1 |= STM32F7_I2C_OAR1_OA1_7(slave->addr);
1854 i2c_dev->slave[id] = slave;
1862 if (slave->flags & I2C_CLIENT_TEN) {
1867 oar2 |= STM32F7_I2C_OAR2_OA2_7(slave->addr);
1869 i2c_dev->slave[id] = slave;
1874 dev_err(dev, "I2C slave id not supported\n");
1898 static int stm32f7_i2c_unreg_slave(struct i2c_client *slave)
1900 struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(slave->adapter);
1905 ret = stm32f7_i2c_get_slave_id(i2c_dev, slave, &id);
1909 WARN_ON(!i2c_dev->slave[id]);
1923 i2c_dev->slave[id] = NULL;