summaryrefslogtreecommitdiff
path: root/drivers/media/usb/dvb-usb/cxusb.c
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2016-11-20 12:45:52 +0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-01-30 16:50:32 +0300
commit517b500713fd321f1519996904a7c21a141ad3e9 (patch)
treec3dbe435e10e915fd44356719910ade9a5a90af9 /drivers/media/usb/dvb-usb/cxusb.c
parent74d47d75beb17babe5a999ae357b599caf1a1fcd (diff)
downloadlinux-517b500713fd321f1519996904a7c21a141ad3e9.tar.xz
[media] cxusb: port to rc-core
The d680_dmb keymap has some new new mappings. Tested-by: Vincent McIntyre <vincent.mcintyre@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/usb/dvb-usb/cxusb.c')
-rw-r--r--drivers/media/usb/dvb-usb/cxusb.c312
1 files changed, 80 insertions, 232 deletions
diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
index 9b8771eb31d4..5d7b4eaa6a3c 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -450,209 +450,46 @@ static int cxusb_d680_dmb_streaming_ctrl(
}
}
-static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
+static int cxusb_rc_query(struct dvb_usb_device *d)
{
- struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
u8 ircode[4];
- int i;
cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4);
- *event = 0;
- *state = REMOTE_NO_KEY_PRESSED;
-
- for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
- if (rc5_custom(&keymap[i]) == ircode[2] &&
- rc5_data(&keymap[i]) == ircode[3]) {
- *event = keymap[i].keycode;
- *state = REMOTE_KEY_PRESSED;
-
- return 0;
- }
- }
-
+ if (ircode[2] || ircode[3])
+ rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
+ RC_SCANCODE_RC5(ircode[2], ircode[3]), 0);
return 0;
}
-static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event,
- int *state)
+static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d)
{
- struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
u8 ircode[4];
- int i;
struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
.buf = ircode, .len = 4 };
- *event = 0;
- *state = REMOTE_NO_KEY_PRESSED;
-
if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1)
return 0;
- for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
- if (rc5_custom(&keymap[i]) == ircode[1] &&
- rc5_data(&keymap[i]) == ircode[2]) {
- *event = keymap[i].keycode;
- *state = REMOTE_KEY_PRESSED;
-
- return 0;
- }
- }
-
+ if (ircode[1] || ircode[2])
+ rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
+ RC_SCANCODE_RC5(ircode[1], ircode[2]), 0);
return 0;
}
-static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event,
- int *state)
+static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d)
{
- struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
u8 ircode[2];
- int i;
-
- *event = 0;
- *state = REMOTE_NO_KEY_PRESSED;
if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0)
return 0;
- for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
- if (rc5_custom(&keymap[i]) == ircode[0] &&
- rc5_data(&keymap[i]) == ircode[1]) {
- *event = keymap[i].keycode;
- *state = REMOTE_KEY_PRESSED;
-
- return 0;
- }
- }
-
+ if (ircode[0] || ircode[1])
+ rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
+ RC_SCANCODE_RC5(ircode[0], ircode[1]), 0);
return 0;
}
-static struct rc_map_table rc_map_dvico_mce_table[] = {
- { 0xfe02, KEY_TV },
- { 0xfe0e, KEY_MP3 },
- { 0xfe1a, KEY_DVD },
- { 0xfe1e, KEY_FAVORITES },
- { 0xfe16, KEY_SETUP },
- { 0xfe46, KEY_POWER2 },
- { 0xfe0a, KEY_EPG },
- { 0xfe49, KEY_BACK },
- { 0xfe4d, KEY_MENU },
- { 0xfe51, KEY_UP },
- { 0xfe5b, KEY_LEFT },
- { 0xfe5f, KEY_RIGHT },
- { 0xfe53, KEY_DOWN },
- { 0xfe5e, KEY_OK },
- { 0xfe59, KEY_INFO },
- { 0xfe55, KEY_TAB },
- { 0xfe0f, KEY_PREVIOUSSONG },/* Replay */
- { 0xfe12, KEY_NEXTSONG }, /* Skip */
- { 0xfe42, KEY_ENTER }, /* Windows/Start */
- { 0xfe15, KEY_VOLUMEUP },
- { 0xfe05, KEY_VOLUMEDOWN },
- { 0xfe11, KEY_CHANNELUP },
- { 0xfe09, KEY_CHANNELDOWN },
- { 0xfe52, KEY_CAMERA },
- { 0xfe5a, KEY_TUNER }, /* Live */
- { 0xfe19, KEY_OPEN },
- { 0xfe0b, KEY_1 },
- { 0xfe17, KEY_2 },
- { 0xfe1b, KEY_3 },
- { 0xfe07, KEY_4 },
- { 0xfe50, KEY_5 },
- { 0xfe54, KEY_6 },
- { 0xfe48, KEY_7 },
- { 0xfe4c, KEY_8 },
- { 0xfe58, KEY_9 },
- { 0xfe13, KEY_ANGLE }, /* Aspect */
- { 0xfe03, KEY_0 },
- { 0xfe1f, KEY_ZOOM },
- { 0xfe43, KEY_REWIND },
- { 0xfe47, KEY_PLAYPAUSE },
- { 0xfe4f, KEY_FASTFORWARD },
- { 0xfe57, KEY_MUTE },
- { 0xfe0d, KEY_STOP },
- { 0xfe01, KEY_RECORD },
- { 0xfe4e, KEY_POWER },
-};
-
-static struct rc_map_table rc_map_dvico_portable_table[] = {
- { 0xfc02, KEY_SETUP }, /* Profile */
- { 0xfc43, KEY_POWER2 },
- { 0xfc06, KEY_EPG },
- { 0xfc5a, KEY_BACK },
- { 0xfc05, KEY_MENU },
- { 0xfc47, KEY_INFO },
- { 0xfc01, KEY_TAB },
- { 0xfc42, KEY_PREVIOUSSONG },/* Replay */
- { 0xfc49, KEY_VOLUMEUP },
- { 0xfc09, KEY_VOLUMEDOWN },
- { 0xfc54, KEY_CHANNELUP },
- { 0xfc0b, KEY_CHANNELDOWN },
- { 0xfc16, KEY_CAMERA },
- { 0xfc40, KEY_TUNER }, /* ATV/DTV */
- { 0xfc45, KEY_OPEN },
- { 0xfc19, KEY_1 },
- { 0xfc18, KEY_2 },
- { 0xfc1b, KEY_3 },
- { 0xfc1a, KEY_4 },
- { 0xfc58, KEY_5 },
- { 0xfc59, KEY_6 },
- { 0xfc15, KEY_7 },
- { 0xfc14, KEY_8 },
- { 0xfc17, KEY_9 },
- { 0xfc44, KEY_ANGLE }, /* Aspect */
- { 0xfc55, KEY_0 },
- { 0xfc07, KEY_ZOOM },
- { 0xfc0a, KEY_REWIND },
- { 0xfc08, KEY_PLAYPAUSE },
- { 0xfc4b, KEY_FASTFORWARD },
- { 0xfc5b, KEY_MUTE },
- { 0xfc04, KEY_STOP },
- { 0xfc56, KEY_RECORD },
- { 0xfc57, KEY_POWER },
- { 0xfc41, KEY_UNKNOWN }, /* INPUT */
- { 0xfc00, KEY_UNKNOWN }, /* HD */
-};
-
-static struct rc_map_table rc_map_d680_dmb_table[] = {
- { 0x0038, KEY_UNKNOWN }, /* TV/AV */
- { 0x080c, KEY_ZOOM },
- { 0x0800, KEY_0 },
- { 0x0001, KEY_1 },
- { 0x0802, KEY_2 },
- { 0x0003, KEY_3 },
- { 0x0804, KEY_4 },
- { 0x0005, KEY_5 },
- { 0x0806, KEY_6 },
- { 0x0007, KEY_7 },
- { 0x0808, KEY_8 },
- { 0x0009, KEY_9 },
- { 0x000a, KEY_MUTE },
- { 0x0829, KEY_BACK },
- { 0x0012, KEY_CHANNELUP },
- { 0x0813, KEY_CHANNELDOWN },
- { 0x002b, KEY_VOLUMEUP },
- { 0x082c, KEY_VOLUMEDOWN },
- { 0x0020, KEY_UP },
- { 0x0821, KEY_DOWN },
- { 0x0011, KEY_LEFT },
- { 0x0810, KEY_RIGHT },
- { 0x000d, KEY_OK },
- { 0x081f, KEY_RECORD },
- { 0x0017, KEY_PLAYPAUSE },
- { 0x0816, KEY_PLAYPAUSE },
- { 0x000b, KEY_STOP },
- { 0x0827, KEY_FASTFORWARD },
- { 0x0026, KEY_REWIND },
- { 0x081e, KEY_UNKNOWN }, /* Time Shift */
- { 0x000e, KEY_UNKNOWN }, /* Snapshot */
- { 0x082d, KEY_UNKNOWN }, /* Mouse Cursor */
- { 0x000f, KEY_UNKNOWN }, /* Minimize/Maximize */
- { 0x0814, KEY_UNKNOWN }, /* Shuffle */
- { 0x0025, KEY_POWER },
-};
-
static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
{
static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 };
@@ -1000,7 +837,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
return -EIO;
/* try to determine if there is no IR decoder on the I2C bus */
- for (i = 0; adap->dev->props.rc.legacy.rc_map_table != NULL && i < 5; i++) {
+ for (i = 0; adap->dev->props.rc.core.rc_codes && i < 5; i++) {
msleep(20);
if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1)
goto no_IR;
@@ -1008,7 +845,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
continue;
if (ircode[2] + ircode[3] != 0xff) {
no_IR:
- adap->dev->props.rc.legacy.rc_map_table = NULL;
+ adap->dev->props.rc.core.rc_codes = NULL;
info("No IR receiver detected on this device.");
break;
}
@@ -1720,11 +1557,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
.i2c_algo = &cxusb_i2c_algo,
- .rc.legacy = {
- .rc_interval = 100,
- .rc_map_table = rc_map_dvico_portable_table,
- .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
- .rc_query = cxusb_rc_query,
+ .rc.core = {
+ .rc_interval = 100,
+ .rc_codes = RC_MAP_DVICO_PORTABLE,
+ .module_name = KBUILD_MODNAME,
+ .rc_query = cxusb_rc_query,
+ .allowed_protos = RC_BIT_UNKNOWN,
},
.generic_bulk_ctrl_endpoint = 0x01,
@@ -1776,11 +1614,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
.i2c_algo = &cxusb_i2c_algo,
- .rc.legacy = {
- .rc_interval = 150,
- .rc_map_table = rc_map_dvico_mce_table,
- .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table),
- .rc_query = cxusb_rc_query,
+ .rc.core = {
+ .rc_interval = 100,
+ .rc_codes = RC_MAP_DVICO_MCE,
+ .module_name = KBUILD_MODNAME,
+ .rc_query = cxusb_rc_query,
+ .allowed_protos = RC_BIT_UNKNOWN,
},
.generic_bulk_ctrl_endpoint = 0x01,
@@ -1840,11 +1679,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
.i2c_algo = &cxusb_i2c_algo,
- .rc.legacy = {
- .rc_interval = 100,
- .rc_map_table = rc_map_dvico_portable_table,
- .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
- .rc_query = cxusb_rc_query,
+ .rc.core = {
+ .rc_interval = 100,
+ .rc_codes = RC_MAP_DVICO_PORTABLE,
+ .module_name = KBUILD_MODNAME,
+ .rc_query = cxusb_rc_query,
+ .allowed_protos = RC_BIT_UNKNOWN,
},
.generic_bulk_ctrl_endpoint = 0x01,
@@ -1895,11 +1735,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
.i2c_algo = &cxusb_i2c_algo,
- .rc.legacy = {
- .rc_interval = 100,
- .rc_map_table = rc_map_dvico_portable_table,
- .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
- .rc_query = cxusb_rc_query,
+ .rc.core = {
+ .rc_interval = 100,
+ .rc_codes = RC_MAP_DVICO_PORTABLE,
+ .module_name = KBUILD_MODNAME,
+ .rc_query = cxusb_rc_query,
+ .allowed_protos = RC_BIT_UNKNOWN,
},
.generic_bulk_ctrl_endpoint = 0x01,
@@ -1949,11 +1790,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
.generic_bulk_ctrl_endpoint = 0x01,
- .rc.legacy = {
- .rc_interval = 100,
- .rc_map_table = rc_map_dvico_mce_table,
- .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table),
- .rc_query = cxusb_bluebird2_rc_query,
+ .rc.core = {
+ .rc_interval = 100,
+ .rc_codes = RC_MAP_DVICO_MCE,
+ .module_name = KBUILD_MODNAME,
+ .rc_query = cxusb_bluebird2_rc_query,
+ .allowed_protos = RC_BIT_UNKNOWN,
},
.num_device_descs = 1,
@@ -2002,11 +1844,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
.generic_bulk_ctrl_endpoint = 0x01,
- .rc.legacy = {
- .rc_interval = 100,
- .rc_map_table = rc_map_dvico_portable_table,
- .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
- .rc_query = cxusb_bluebird2_rc_query,
+ .rc.core = {
+ .rc_interval = 100,
+ .rc_codes = RC_MAP_DVICO_PORTABLE,
+ .module_name = KBUILD_MODNAME,
+ .rc_query = cxusb_bluebird2_rc_query,
+ .allowed_protos = RC_BIT_UNKNOWN,
},
.num_device_descs = 1,
@@ -2057,11 +1900,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope
.generic_bulk_ctrl_endpoint = 0x01,
- .rc.legacy = {
- .rc_interval = 100,
- .rc_map_table = rc_map_dvico_portable_table,
- .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
- .rc_query = cxusb_rc_query,
+ .rc.core = {
+ .rc_interval = 100,
+ .rc_codes = RC_MAP_DVICO_PORTABLE,
+ .module_name = KBUILD_MODNAME,
+ .rc_query = cxusb_rc_query,
+ .allowed_protos = RC_BIT_UNKNOWN,
},
.num_device_descs = 1,
@@ -2155,11 +1999,12 @@ struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = {
.generic_bulk_ctrl_endpoint = 0x01,
- .rc.legacy = {
- .rc_interval = 100,
- .rc_map_table = rc_map_dvico_mce_table,
- .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table),
- .rc_query = cxusb_rc_query,
+ .rc.core = {
+ .rc_interval = 100,
+ .rc_codes = RC_MAP_DVICO_MCE,
+ .module_name = KBUILD_MODNAME,
+ .rc_query = cxusb_rc_query,
+ .allowed_protos = RC_BIT_UNKNOWN,
},
.num_device_descs = 1,
@@ -2208,11 +2053,12 @@ static struct dvb_usb_device_properties cxusb_d680_dmb_properties = {
.generic_bulk_ctrl_endpoint = 0x01,
- .rc.legacy = {
- .rc_interval = 100,
- .rc_map_table = rc_map_d680_dmb_table,
- .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table),
- .rc_query = cxusb_d680_dmb_rc_query,
+ .rc.core = {
+ .rc_interval = 100,
+ .rc_codes = RC_MAP_D680_DMB,
+ .module_name = KBUILD_MODNAME,
+ .rc_query = cxusb_d680_dmb_rc_query,
+ .allowed_protos = RC_BIT_UNKNOWN,
},
.num_device_descs = 1,
@@ -2262,11 +2108,12 @@ static struct dvb_usb_device_properties cxusb_mygica_d689_properties = {
.generic_bulk_ctrl_endpoint = 0x01,
- .rc.legacy = {
- .rc_interval = 100,
- .rc_map_table = rc_map_d680_dmb_table,
- .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table),
- .rc_query = cxusb_d680_dmb_rc_query,
+ .rc.core = {
+ .rc_interval = 100,
+ .rc_codes = RC_MAP_D680_DMB,
+ .module_name = KBUILD_MODNAME,
+ .rc_query = cxusb_d680_dmb_rc_query,
+ .allowed_protos = RC_BIT_UNKNOWN,
},
.num_device_descs = 1,
@@ -2315,11 +2162,12 @@ static struct dvb_usb_device_properties cxusb_mygica_t230_properties = {
.generic_bulk_ctrl_endpoint = 0x01,
- .rc.legacy = {
- .rc_interval = 100,
- .rc_map_table = rc_map_d680_dmb_table,
- .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table),
- .rc_query = cxusb_d680_dmb_rc_query,
+ .rc.core = {
+ .rc_interval = 100,
+ .rc_codes = RC_MAP_D680_DMB,
+ .module_name = KBUILD_MODNAME,
+ .rc_query = cxusb_d680_dmb_rc_query,
+ .allowed_protos = RC_BIT_UNKNOWN,
},
.num_device_descs = 1,