mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 15:51:30 -05:00
i2c: mt7621: Use i2c_10bit_addr_*_from_msg() helpers
Use i2c_10bit_addr_*_from_msg() helpers instead of local copy. No functional change intended. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20250213141045.2716943-8-andriy.shevchenko@linux.intel.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
This commit is contained in:
committed by
Andi Shyti
parent
ed7f48d3ef
commit
6cdc8fe0ba
@@ -164,22 +164,18 @@ static int mtk_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
|
||||
/* write address */
|
||||
if (pmsg->flags & I2C_M_TEN) {
|
||||
/* 10 bits address */
|
||||
addr = 0xf0 | ((pmsg->addr >> 7) & 0x06);
|
||||
addr |= (pmsg->addr & 0xff) << 8;
|
||||
if (pmsg->flags & I2C_M_RD)
|
||||
addr |= 1;
|
||||
iowrite32(addr, i2c->base + REG_SM0D0_REG);
|
||||
ret = mtk_i2c_cmd(i2c, SM0CTL1_WRITE, 2);
|
||||
if (ret)
|
||||
goto err_timeout;
|
||||
addr = i2c_10bit_addr_hi_from_msg(pmsg);
|
||||
addr |= i2c_10bit_addr_lo_from_msg(pmsg) << 8;
|
||||
len = 2;
|
||||
} else {
|
||||
/* 7 bits address */
|
||||
addr = i2c_8bit_addr_from_msg(pmsg);
|
||||
iowrite32(addr, i2c->base + REG_SM0D0_REG);
|
||||
ret = mtk_i2c_cmd(i2c, SM0CTL1_WRITE, 1);
|
||||
if (ret)
|
||||
goto err_timeout;
|
||||
len = 1;
|
||||
}
|
||||
iowrite32(addr, i2c->base + REG_SM0D0_REG);
|
||||
ret = mtk_i2c_cmd(i2c, SM0CTL1_WRITE, len);
|
||||
if (ret)
|
||||
goto err_timeout;
|
||||
|
||||
/* check address ACK */
|
||||
if (!(pmsg->flags & I2C_M_IGNORE_NAK)) {
|
||||
|
||||
Reference in New Issue
Block a user