[media] lirc_zilog: Remove use of deprecated struct i2c_adapter.id field
Remove use of deprecated struct i2c_adapter.id field. In the process, perform different detection of the HD PVR's Z8 IR microcontroller versus the other Hauppauge cards with the Z8 IR microcontroller. Also added a comment about probe() function behavior that needs to be fixed. Signed-off-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
a9cd591e29
commit
d7c7235695
@ -66,6 +66,7 @@ struct IR {
|
|||||||
/* Device info */
|
/* Device info */
|
||||||
struct mutex ir_lock;
|
struct mutex ir_lock;
|
||||||
int open;
|
int open;
|
||||||
|
bool is_hdpvr;
|
||||||
|
|
||||||
/* RX device */
|
/* RX device */
|
||||||
struct i2c_client c_rx;
|
struct i2c_client c_rx;
|
||||||
@ -206,16 +207,12 @@ static int add_to_buf(struct IR *ir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* key pressed ? */
|
/* key pressed ? */
|
||||||
#ifdef I2C_HW_B_HDPVR
|
if (ir->is_hdpvr) {
|
||||||
if (ir->c_rx.adapter->id == I2C_HW_B_HDPVR) {
|
|
||||||
if (got_data && (keybuf[0] == 0x80))
|
if (got_data && (keybuf[0] == 0x80))
|
||||||
return 0;
|
return 0;
|
||||||
else if (got_data && (keybuf[0] == 0x00))
|
else if (got_data && (keybuf[0] == 0x00))
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
} else if ((ir->b[0] & 0x80) == 0)
|
} else if ((ir->b[0] & 0x80) == 0)
|
||||||
#else
|
|
||||||
if ((ir->b[0] & 0x80) == 0)
|
|
||||||
#endif
|
|
||||||
return got_data ? 0 : -ENODATA;
|
return got_data ? 0 : -ENODATA;
|
||||||
|
|
||||||
/* look what we have */
|
/* look what we have */
|
||||||
@ -841,15 +838,15 @@ static int send_code(struct IR *ir, unsigned int code, unsigned int key)
|
|||||||
return ret < 0 ? ret : -EFAULT;
|
return ret < 0 ? ret : -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef I2C_HW_B_HDPVR
|
|
||||||
/*
|
/*
|
||||||
* The sleep bits aren't necessary on the HD PVR, and in fact, the
|
* The sleep bits aren't necessary on the HD PVR, and in fact, the
|
||||||
* last i2c_master_recv always fails with a -5, so for now, we're
|
* last i2c_master_recv always fails with a -5, so for now, we're
|
||||||
* going to skip this whole mess and say we're done on the HD PVR
|
* going to skip this whole mess and say we're done on the HD PVR
|
||||||
*/
|
*/
|
||||||
if (ir->c_rx.adapter->id == I2C_HW_B_HDPVR)
|
if (ir->is_hdpvr) {
|
||||||
goto done;
|
dprintk("sent code %u, key %u\n", code, key);
|
||||||
#endif
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This bit NAKs until the device is ready, so we retry it
|
* This bit NAKs until the device is ready, so we retry it
|
||||||
@ -1111,12 +1108,14 @@ static int ir_remove(struct i2c_client *client);
|
|||||||
static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id);
|
static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id);
|
||||||
static int ir_command(struct i2c_client *client, unsigned int cmd, void *arg);
|
static int ir_command(struct i2c_client *client, unsigned int cmd, void *arg);
|
||||||
|
|
||||||
|
#define ID_FLAG_TX 0x01
|
||||||
|
#define ID_FLAG_HDPVR 0x02
|
||||||
|
|
||||||
static const struct i2c_device_id ir_transceiver_id[] = {
|
static const struct i2c_device_id ir_transceiver_id[] = {
|
||||||
/* Generic entry for any IR transceiver */
|
{ "ir_tx_z8f0811_haup", ID_FLAG_TX },
|
||||||
{ "ir_video", 0 },
|
{ "ir_rx_z8f0811_haup", 0 },
|
||||||
/* IR device specific entries should be added here */
|
{ "ir_tx_z8f0811_hdpvr", ID_FLAG_HDPVR | ID_FLAG_TX },
|
||||||
{ "ir_tx_z8f0811_haup", 0 },
|
{ "ir_rx_z8f0811_hdpvr", ID_FLAG_HDPVR },
|
||||||
{ "ir_rx_z8f0811_haup", 0 },
|
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1196,9 +1195,24 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
|||||||
int ret;
|
int ret;
|
||||||
int have_rx = 0, have_tx = 0;
|
int have_rx = 0, have_tx = 0;
|
||||||
|
|
||||||
dprintk("%s: adapter id=0x%x, client addr=0x%02x\n",
|
dprintk("%s: adapter name (%s) nr %d, i2c_device_id name (%s), "
|
||||||
__func__, adap->id, client->addr);
|
"client addr=0x%02x\n",
|
||||||
|
__func__, adap->name, adap->nr, id->name, client->addr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FIXME - This probe function probes both the Tx and Rx
|
||||||
|
* addresses of the IR microcontroller.
|
||||||
|
*
|
||||||
|
* However, the I2C subsystem is passing along one I2C client at a
|
||||||
|
* time, based on matches to the ir_transceiver_id[] table above.
|
||||||
|
* The expectation is that each i2c_client address will be probed
|
||||||
|
* individually by drivers so the I2C subsystem can mark all client
|
||||||
|
* addresses as claimed or not.
|
||||||
|
*
|
||||||
|
* This probe routine causes only one of the client addresses, TX or RX,
|
||||||
|
* to be claimed. This will cause a problem if the I2C subsystem is
|
||||||
|
* subsequently triggered to probe unclaimed clients again.
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
* The external IR receiver is at i2c address 0x71.
|
* The external IR receiver is at i2c address 0x71.
|
||||||
* The IR transmitter is at 0x70.
|
* The IR transmitter is at 0x70.
|
||||||
@ -1241,6 +1255,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
|||||||
mutex_init(&ir->ir_lock);
|
mutex_init(&ir->ir_lock);
|
||||||
mutex_init(&ir->buf_lock);
|
mutex_init(&ir->buf_lock);
|
||||||
ir->need_boot = 1;
|
ir->need_boot = 1;
|
||||||
|
ir->is_hdpvr = (id->driver_data & ID_FLAG_HDPVR) ? true : false;
|
||||||
|
|
||||||
memcpy(&ir->l, &lirc_template, sizeof(struct lirc_driver));
|
memcpy(&ir->l, &lirc_template, sizeof(struct lirc_driver));
|
||||||
ir->l.minor = -1;
|
ir->l.minor = -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user