Lines Matching refs:dln2
53 static int dln2_i2c_enable(struct dln2_i2c *dln2, bool enable) in dln2_i2c_enable() argument
60 tx.port = dln2->port; in dln2_i2c_enable()
67 return dln2_transfer_tx(dln2->pdev, cmd, &tx, sizeof(tx)); in dln2_i2c_enable()
70 static int dln2_i2c_write(struct dln2_i2c *dln2, u8 addr, in dln2_i2c_write() argument
81 } __packed *tx = dln2->buf; in dln2_i2c_write()
86 tx->port = dln2->port; in dln2_i2c_write()
94 ret = dln2_transfer_tx(dln2->pdev, DLN2_I2C_WRITE, tx, len); in dln2_i2c_write()
101 static int dln2_i2c_read(struct dln2_i2c *dln2, u16 addr, u8 *data, in dln2_i2c_read() argument
115 } __packed *rx = dln2->buf; in dln2_i2c_read()
120 tx.port = dln2->port; in dln2_i2c_read()
126 ret = dln2_transfer(dln2->pdev, DLN2_I2C_READ, &tx, sizeof(tx), in dln2_i2c_read()
143 struct dln2_i2c *dln2 = i2c_get_adapdata(adapter); in dln2_i2c_xfer() local
153 ret = dln2_i2c_read(dln2, pmsg->addr, pmsg->buf, in dln2_i2c_xfer()
160 ret = dln2_i2c_write(dln2, pmsg->addr, pmsg->buf, in dln2_i2c_xfer()
190 struct dln2_i2c *dln2; in dln2_i2c_probe() local
194 dln2 = devm_kzalloc(dev, sizeof(*dln2), GFP_KERNEL); in dln2_i2c_probe()
195 if (!dln2) in dln2_i2c_probe()
198 dln2->buf = devm_kmalloc(dev, DLN2_I2C_BUF_SIZE, GFP_KERNEL); in dln2_i2c_probe()
199 if (!dln2->buf) in dln2_i2c_probe()
202 dln2->pdev = pdev; in dln2_i2c_probe()
203 dln2->port = pdata->port; in dln2_i2c_probe()
206 dln2->adapter.owner = THIS_MODULE; in dln2_i2c_probe()
207 dln2->adapter.class = I2C_CLASS_HWMON; in dln2_i2c_probe()
208 dln2->adapter.algo = &dln2_i2c_usb_algorithm; in dln2_i2c_probe()
209 dln2->adapter.quirks = &dln2_i2c_quirks; in dln2_i2c_probe()
210 dln2->adapter.dev.parent = dev; in dln2_i2c_probe()
211 ACPI_COMPANION_SET(&dln2->adapter.dev, ACPI_COMPANION(&pdev->dev)); in dln2_i2c_probe()
212 dln2->adapter.dev.of_node = dev->of_node; in dln2_i2c_probe()
213 i2c_set_adapdata(&dln2->adapter, dln2); in dln2_i2c_probe()
214 snprintf(dln2->adapter.name, sizeof(dln2->adapter.name), "%s-%s-%d", in dln2_i2c_probe()
215 "dln2-i2c", dev_name(pdev->dev.parent), dln2->port); in dln2_i2c_probe()
217 platform_set_drvdata(pdev, dln2); in dln2_i2c_probe()
220 ret = dln2_i2c_enable(dln2, true); in dln2_i2c_probe()
227 ret = i2c_add_adapter(&dln2->adapter); in dln2_i2c_probe()
234 dln2_i2c_enable(dln2, false); in dln2_i2c_probe()
241 struct dln2_i2c *dln2 = platform_get_drvdata(pdev); in dln2_i2c_remove() local
243 i2c_del_adapter(&dln2->adapter); in dln2_i2c_remove()
244 dln2_i2c_enable(dln2, false); in dln2_i2c_remove()