Lines Matching +full:num +full:- +full:addresses
1 // SPDX-License-Identifier: GPL-2.0-only
33 struct IR_i2c_init_data *init_data = &dev->ir_i2c_init_data; in hdpvr_register_ir_i2c()
38 /* Our default information for ir-kbd-i2c.c to use */ in hdpvr_register_ir_i2c()
39 init_data->ir_codes = RC_MAP_HAUPPAUGE; in hdpvr_register_ir_i2c()
40 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; in hdpvr_register_ir_i2c()
41 init_data->type = RC_PROTO_BIT_RC5 | RC_PROTO_BIT_RC6_MCE | in hdpvr_register_ir_i2c()
43 init_data->name = "HD-PVR"; in hdpvr_register_ir_i2c()
44 init_data->polling_interval = 405; /* ms, duplicated from Windows */ in hdpvr_register_ir_i2c()
47 return i2c_new_client_device(&dev->i2c_adapter, &info); in hdpvr_register_ir_i2c()
56 if ((len > sizeof(dev->i2c_buf)) || (wlen > sizeof(dev->i2c_buf))) in hdpvr_i2c_read()
57 return -EINVAL; in hdpvr_i2c_read()
60 memcpy(dev->i2c_buf, wdata, wlen); in hdpvr_i2c_read()
61 ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), in hdpvr_i2c_read()
63 (bus << 8) | addr, 0, dev->i2c_buf, in hdpvr_i2c_read()
69 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), in hdpvr_i2c_read()
71 (bus << 8) | addr, 0, dev->i2c_buf, len, 1000); in hdpvr_i2c_read()
74 memcpy(data, dev->i2c_buf, len); in hdpvr_i2c_read()
77 ret = -EIO; in hdpvr_i2c_read()
87 if (len > sizeof(dev->i2c_buf)) in hdpvr_i2c_write()
88 return -EINVAL; in hdpvr_i2c_write()
90 memcpy(dev->i2c_buf, data, len); in hdpvr_i2c_write()
91 ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), in hdpvr_i2c_write()
93 (bus << 8) | addr, 0, dev->i2c_buf, len, 1000); in hdpvr_i2c_write()
98 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), in hdpvr_i2c_write()
100 0, 0, dev->i2c_buf, 2, 1000); in hdpvr_i2c_write()
102 if ((ret == 2) && (dev->i2c_buf[1] == (len - 1))) in hdpvr_i2c_write()
105 ret = -EIO; in hdpvr_i2c_write()
111 int num) in hdpvr_transfer() argument
116 mutex_lock(&dev->i2c_mutex); in hdpvr_transfer()
120 if (num == 1) { in hdpvr_transfer()
127 } else if (num == 2) { in hdpvr_transfer()
129 v4l2_warn(&dev->v4l2_dev, "refusing 2-phase i2c xfer with conflicting target addresses\n"); in hdpvr_transfer()
130 retval = -EINVAL; in hdpvr_transfer()
135 v4l2_warn(&dev->v4l2_dev, "refusing complex xfer with r0=%d, r1=%d\n", in hdpvr_transfer()
138 retval = -EINVAL; in hdpvr_transfer()
149 v4l2_warn(&dev->v4l2_dev, "refusing %d-phase i2c xfer\n", num); in hdpvr_transfer()
153 mutex_unlock(&dev->i2c_mutex); in hdpvr_transfer()
155 return retval ? retval : num; in hdpvr_transfer()
178 mutex_lock(&dev->i2c_mutex); in hdpvr_activate_ir()
189 mutex_unlock(&dev->i2c_mutex); in hdpvr_activate_ir()
198 dev->i2c_adapter = hdpvr_i2c_adapter_template; in hdpvr_register_i2c_adapter()
199 dev->i2c_adapter.dev.parent = &dev->udev->dev; in hdpvr_register_i2c_adapter()
201 i2c_set_adapdata(&dev->i2c_adapter, dev); in hdpvr_register_i2c_adapter()
203 return i2c_add_adapter(&dev->i2c_adapter); in hdpvr_register_i2c_adapter()