forked from Minki/linux
[media] it913x v1.25 support different for remotes
Support for different types of remote. ITE remotes share common device IDs with differently assigned keys. Two versions of remote maps have been created there are likely to be more. v1 for all other IDs v2 for USB_PID_ITETECH_IT9135_9005. This patch also separates the configuration parts from it913x_identify_state function. TODO remotes for HID interfaces. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
65dd3b699f
commit
3691a0dd3a
@ -429,24 +429,74 @@ static int ite_firmware_select(struct usb_device *udev,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void it913x_select_remote(struct usb_device *udev,
|
||||||
|
struct dvb_usb_device_properties *props)
|
||||||
|
{
|
||||||
|
switch (le16_to_cpu(udev->descriptor.idProduct)) {
|
||||||
|
case USB_PID_ITETECH_IT9135_9005:
|
||||||
|
props->rc.core.rc_codes = RC_MAP_IT913X_V2;
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
props->rc.core.rc_codes = RC_MAP_IT913X_V1;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#define TS_MPEG_PKT_SIZE 188
|
#define TS_MPEG_PKT_SIZE 188
|
||||||
#define EP_LOW 21
|
#define EP_LOW 21
|
||||||
#define TS_BUFFER_SIZE_PID (EP_LOW*TS_MPEG_PKT_SIZE)
|
#define TS_BUFFER_SIZE_PID (EP_LOW*TS_MPEG_PKT_SIZE)
|
||||||
#define EP_HIGH 348
|
#define EP_HIGH 348
|
||||||
#define TS_BUFFER_SIZE_MAX (EP_HIGH*TS_MPEG_PKT_SIZE)
|
#define TS_BUFFER_SIZE_MAX (EP_HIGH*TS_MPEG_PKT_SIZE)
|
||||||
|
|
||||||
static int it913x_identify_state(struct usb_device *udev,
|
static int it913x_select_config(struct usb_device *udev,
|
||||||
struct dvb_usb_device_properties *props,
|
struct dvb_usb_device_properties *props)
|
||||||
struct dvb_usb_device_description **desc,
|
|
||||||
int *cold)
|
|
||||||
{
|
{
|
||||||
int ret = 0, firm_no;
|
int ret = 0, reg;
|
||||||
u8 reg, remote;
|
bool proprietary_ir = false;
|
||||||
|
|
||||||
firm_no = it913x_return_status(udev);
|
if (it913x_config.chip_ver == 0x02
|
||||||
|
&& it913x_config.chip_type == 0x9135)
|
||||||
|
reg = it913x_read_reg(udev, 0x461d);
|
||||||
|
else
|
||||||
|
reg = it913x_read_reg(udev, 0x461b);
|
||||||
|
|
||||||
/* checnk for dual mode */
|
if (reg < 0)
|
||||||
it913x_config.dual_mode = it913x_read_reg(udev, 0x49c5);
|
return reg;
|
||||||
|
|
||||||
|
if (reg == 0) {
|
||||||
|
it913x_config.dual_mode = 0;
|
||||||
|
it913x_config.tuner_id_0 = IT9135_38;
|
||||||
|
proprietary_ir = true;
|
||||||
|
} else {
|
||||||
|
/* TS mode */
|
||||||
|
reg = it913x_read_reg(udev, 0x49c5);
|
||||||
|
if (reg < 0)
|
||||||
|
return reg;
|
||||||
|
it913x_config.dual_mode = reg;
|
||||||
|
|
||||||
|
/* IR mode type */
|
||||||
|
reg = it913x_read_reg(udev, 0x49ac);
|
||||||
|
if (reg < 0)
|
||||||
|
return reg;
|
||||||
|
if (reg == 5) {
|
||||||
|
info("Remote propriety (raw) mode");
|
||||||
|
proprietary_ir = true;
|
||||||
|
} else if (reg == 1) {
|
||||||
|
info("Remote HID mode NOT SUPPORTED");
|
||||||
|
proprietary_ir = false;
|
||||||
|
props->rc.core.rc_codes = NULL;
|
||||||
|
} else
|
||||||
|
props->rc.core.rc_codes = NULL;
|
||||||
|
|
||||||
|
/* Tuner_id */
|
||||||
|
reg = it913x_read_reg(udev, 0x49d0);
|
||||||
|
if (reg < 0)
|
||||||
|
return reg;
|
||||||
|
it913x_config.tuner_id_0 = reg;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (proprietary_ir)
|
||||||
|
it913x_select_remote(udev, props);
|
||||||
|
|
||||||
if (udev->speed != USB_SPEED_HIGH) {
|
if (udev->speed != USB_SPEED_HIGH) {
|
||||||
props->adapter[0].fe[0].pid_filter_count = 5;
|
props->adapter[0].fe[0].pid_filter_count = 5;
|
||||||
@ -461,17 +511,6 @@ static int it913x_identify_state(struct usb_device *udev,
|
|||||||
if(props->adapter[0].fe[0].pid_filter_count == 5)
|
if(props->adapter[0].fe[0].pid_filter_count == 5)
|
||||||
props->adapter[0].fe[0].pid_filter_count = 31;
|
props->adapter[0].fe[0].pid_filter_count = 31;
|
||||||
|
|
||||||
/* TODO different remotes */
|
|
||||||
remote = it913x_read_reg(udev, 0x49ac); /* Remote */
|
|
||||||
if (remote == 0)
|
|
||||||
props->rc.core.rc_codes = NULL;
|
|
||||||
|
|
||||||
/* TODO at the moment tuner_id is always assigned to 0x38 */
|
|
||||||
it913x_config.tuner_id_0 = it913x_read_reg(udev, 0x49d0);
|
|
||||||
|
|
||||||
info("Dual mode=%x Remote=%x Tuner Type=%x", it913x_config.dual_mode
|
|
||||||
, remote, it913x_config.tuner_id_0);
|
|
||||||
|
|
||||||
/* Select Stream Buffer Size and pid filter option*/
|
/* Select Stream Buffer Size and pid filter option*/
|
||||||
if (pid_filter) {
|
if (pid_filter) {
|
||||||
props->adapter[0].fe[0].stream.u.bulk.buffersize =
|
props->adapter[0].fe[0].stream.u.bulk.buffersize =
|
||||||
@ -492,8 +531,29 @@ static int it913x_identify_state(struct usb_device *udev,
|
|||||||
} else
|
} else
|
||||||
props->num_adapters = 1;
|
props->num_adapters = 1;
|
||||||
|
|
||||||
|
info("Dual mode=%x Tuner Type=%x", it913x_config.dual_mode,
|
||||||
|
it913x_config.tuner_id_0);
|
||||||
|
|
||||||
ret = ite_firmware_select(udev, props);
|
ret = ite_firmware_select(udev, props);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int it913x_identify_state(struct usb_device *udev,
|
||||||
|
struct dvb_usb_device_properties *props,
|
||||||
|
struct dvb_usb_device_description **desc,
|
||||||
|
int *cold)
|
||||||
|
{
|
||||||
|
int ret = 0, firm_no;
|
||||||
|
u8 reg;
|
||||||
|
|
||||||
|
firm_no = it913x_return_status(udev);
|
||||||
|
|
||||||
|
/* Read and select config */
|
||||||
|
ret = it913x_select_config(udev, props);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (firm_no > 0) {
|
if (firm_no > 0) {
|
||||||
*cold = 0;
|
*cold = 0;
|
||||||
return 0;
|
return 0;
|
||||||
@ -791,7 +851,7 @@ static struct dvb_usb_device_properties it913x_properties = {
|
|||||||
.rc_query = it913x_rc_query,
|
.rc_query = it913x_rc_query,
|
||||||
.rc_interval = IT913X_POLL,
|
.rc_interval = IT913X_POLL,
|
||||||
.allowed_protos = RC_TYPE_NEC,
|
.allowed_protos = RC_TYPE_NEC,
|
||||||
.rc_codes = RC_MAP_MSI_DIGIVOX_III,
|
.rc_codes = RC_MAP_IT913X_V1,
|
||||||
},
|
},
|
||||||
.i2c_algo = &it913x_i2c_algo,
|
.i2c_algo = &it913x_i2c_algo,
|
||||||
.num_device_descs = 5,
|
.num_device_descs = 5,
|
||||||
@ -825,5 +885,5 @@ module_usb_driver(it913x_driver);
|
|||||||
|
|
||||||
MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
|
MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
|
||||||
MODULE_DESCRIPTION("it913x USB 2 Driver");
|
MODULE_DESCRIPTION("it913x USB 2 Driver");
|
||||||
MODULE_VERSION("1.24");
|
MODULE_VERSION("1.25");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
Loading…
Reference in New Issue
Block a user