Lines Matching +full:bus +full:- +full:num

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright (c) 2010-2015 Steven Toth <stoth@kernellabs.com>
16 static int i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) in i2c_xfer() argument
18 struct saa7164_i2c *bus = i2c_adap->algo_data; in i2c_xfer() local
19 struct saa7164_dev *dev = bus->dev; in i2c_xfer()
22 dprintk(DBGLVL_I2C, "%s(num = %d)\n", __func__, num); in i2c_xfer()
24 for (i = 0 ; i < num; i++) { in i2c_xfer()
25 dprintk(DBGLVL_I2C, "%s(num = %d) addr = 0x%02x len = 0x%x\n", in i2c_xfer()
26 __func__, num, msgs[i].addr, msgs[i].len); in i2c_xfer()
28 retval = saa7164_api_i2c_read(bus, in i2c_xfer()
32 } else if (i + 1 < num && (msgs[i + 1].flags & I2C_M_RD) && in i2c_xfer()
36 retval = saa7164_api_i2c_read(bus, msgs[i].addr, in i2c_xfer()
47 retval = saa7164_api_i2c_write(bus, msgs[i].addr, in i2c_xfer()
53 return num; in i2c_xfer()
69 /* ----------------------------------------------------------------------- */
81 int saa7164_i2c_register(struct saa7164_i2c *bus) in saa7164_i2c_register() argument
83 struct saa7164_dev *dev = bus->dev; in saa7164_i2c_register()
85 dprintk(DBGLVL_I2C, "%s(bus = %d)\n", __func__, bus->nr); in saa7164_i2c_register()
87 bus->i2c_adap = saa7164_i2c_adap_template; in saa7164_i2c_register()
88 bus->i2c_client = saa7164_i2c_client_template; in saa7164_i2c_register()
90 bus->i2c_adap.dev.parent = &dev->pci->dev; in saa7164_i2c_register()
92 strscpy(bus->i2c_adap.name, bus->dev->name, in saa7164_i2c_register()
93 sizeof(bus->i2c_adap.name)); in saa7164_i2c_register()
95 bus->i2c_adap.algo_data = bus; in saa7164_i2c_register()
96 i2c_set_adapdata(&bus->i2c_adap, bus); in saa7164_i2c_register()
97 i2c_add_adapter(&bus->i2c_adap); in saa7164_i2c_register()
99 bus->i2c_client.adapter = &bus->i2c_adap; in saa7164_i2c_register()
101 if (0 != bus->i2c_rc) in saa7164_i2c_register()
102 printk(KERN_ERR "%s: i2c bus %d register FAILED\n", in saa7164_i2c_register()
103 dev->name, bus->nr); in saa7164_i2c_register()
105 return bus->i2c_rc; in saa7164_i2c_register()
108 int saa7164_i2c_unregister(struct saa7164_i2c *bus) in saa7164_i2c_unregister() argument
110 i2c_del_adapter(&bus->i2c_adap); in saa7164_i2c_unregister()