Skip to content

Commit 1b450f2

Browse files
seanyoungmchehab
authored andcommitted
media: Revert "[media] staging: lirc_imon: port remaining usb ids to imon and remove"
This code was ported without the necessary hardware to test. There are multiple problems which are more easily solved by writing a separate driver. This reverts commit f41003a. Signed-off-by: Sean Young <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent d60f6e3 commit 1b450f2

File tree

1 file changed

+7
-128
lines changed

1 file changed

+7
-128
lines changed

drivers/media/rc/imon.c

Lines changed: 7 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ struct imon_usb_dev_descr {
9292
__u16 flags;
9393
#define IMON_NO_FLAGS 0
9494
#define IMON_NEED_20MS_PKT_DELAY 1
95-
#define IMON_IR_RAW 2
9695
struct imon_panel_key_table key_table[];
9796
};
9897

@@ -123,12 +122,6 @@ struct imon_context {
123122
unsigned char usb_tx_buf[8];
124123
unsigned int send_packet_delay;
125124

126-
struct rx_data {
127-
int count; /* length of 0 or 1 sequence */
128-
int prev_bit; /* logic level of sequence */
129-
int initial_space; /* initial space flag */
130-
} rx;
131-
132125
struct tx_t {
133126
unsigned char data_buf[35]; /* user data buffer */
134127
struct completion finished; /* wait for write to finish */
@@ -331,10 +324,6 @@ static const struct imon_usb_dev_descr imon_DH102 = {
331324
}
332325
};
333326

334-
static const struct imon_usb_dev_descr imon_ir_raw = {
335-
.flags = IMON_IR_RAW,
336-
};
337-
338327
/*
339328
* USB Device ID for iMON USB Control Boards
340329
*
@@ -418,18 +407,6 @@ static const struct usb_device_id imon_usb_id_table[] = {
418407
/* device specifics unknown */
419408
{ USB_DEVICE(0x15c2, 0x0046),
420409
.driver_info = (unsigned long)&imon_default_table},
421-
/* TriGem iMON (IR only) -- TG_iMON.inf */
422-
{ USB_DEVICE(0x0aa8, 0x8001),
423-
.driver_info = (unsigned long)&imon_ir_raw},
424-
/* SoundGraph iMON (IR only) -- sg_imon.inf */
425-
{ USB_DEVICE(0x04e8, 0xff30),
426-
.driver_info = (unsigned long)&imon_ir_raw},
427-
/* SoundGraph iMON VFD (IR & VFD) -- iMON_VFD.inf */
428-
{ USB_DEVICE(0x0aa8, 0xffda),
429-
.driver_info = (unsigned long)&imon_ir_raw},
430-
/* SoundGraph iMON SS (IR & VFD) -- iMON_SS.inf */
431-
{ USB_DEVICE(0x15c2, 0xffda),
432-
.driver_info = (unsigned long)&imon_ir_raw},
433410
{}
434411
};
435412

@@ -1572,91 +1549,8 @@ static int imon_parse_press_type(struct imon_context *ictx,
15721549
/*
15731550
* Process the incoming packet
15741551
*/
1575-
/*
1576-
* Convert bit count to time duration (in us) and submit
1577-
* the value to lirc_dev.
1578-
*/
1579-
static void submit_data(struct imon_context *context)
1580-
{
1581-
DEFINE_IR_RAW_EVENT(ev);
1582-
1583-
ev.pulse = context->rx.prev_bit;
1584-
ev.duration = US_TO_NS(context->rx.count * BIT_DURATION);
1585-
ir_raw_event_store_with_filter(context->rdev, &ev);
1586-
}
1587-
1588-
/*
1589-
* Process the incoming packet
1590-
*/
1591-
static void imon_incoming_ir_raw(struct imon_context *context,
1552+
static void imon_incoming_packet(struct imon_context *ictx,
15921553
struct urb *urb, int intf)
1593-
{
1594-
int len = urb->actual_length;
1595-
unsigned char *buf = urb->transfer_buffer;
1596-
struct device *dev = context->dev;
1597-
int octet, bit;
1598-
unsigned char mask;
1599-
1600-
if (len != 8) {
1601-
dev_warn(dev, "imon %s: invalid incoming packet size (len = %d, intf%d)\n",
1602-
__func__, len, intf);
1603-
return;
1604-
}
1605-
1606-
if (debug)
1607-
dev_info(dev, "raw packet: %*ph\n", len, buf);
1608-
/*
1609-
* Translate received data to pulse and space lengths.
1610-
* Received data is active low, i.e. pulses are 0 and
1611-
* spaces are 1.
1612-
*
1613-
* My original algorithm was essentially similar to
1614-
* Changwoo Ryu's with the exception that he switched
1615-
* the incoming bits to active high and also fed an
1616-
* initial space to LIRC at the start of a new sequence
1617-
* if the previous bit was a pulse.
1618-
*
1619-
* I've decided to adopt his algorithm.
1620-
*/
1621-
1622-
if (buf[7] == 1 && context->rx.initial_space) {
1623-
/* LIRC requires a leading space */
1624-
context->rx.prev_bit = 0;
1625-
context->rx.count = 4;
1626-
submit_data(context);
1627-
context->rx.count = 0;
1628-
}
1629-
1630-
for (octet = 0; octet < 5; ++octet) {
1631-
mask = 0x80;
1632-
for (bit = 0; bit < 8; ++bit) {
1633-
int curr_bit = !(buf[octet] & mask);
1634-
1635-
if (curr_bit != context->rx.prev_bit) {
1636-
if (context->rx.count) {
1637-
submit_data(context);
1638-
context->rx.count = 0;
1639-
}
1640-
context->rx.prev_bit = curr_bit;
1641-
}
1642-
++context->rx.count;
1643-
mask >>= 1;
1644-
}
1645-
}
1646-
1647-
if (buf[7] == 10) {
1648-
if (context->rx.count) {
1649-
submit_data(context);
1650-
context->rx.count = 0;
1651-
}
1652-
context->rx.initial_space = context->rx.prev_bit;
1653-
}
1654-
1655-
ir_raw_event_handle(context->rdev);
1656-
}
1657-
1658-
static void imon_incoming_scancode(struct imon_context *ictx,
1659-
struct urb *urb, int intf)
16601554
{
16611555
int len = urb->actual_length;
16621556
unsigned char *buf = urb->transfer_buffer;
@@ -1839,10 +1733,7 @@ static void usb_rx_callback_intf0(struct urb *urb)
18391733
break;
18401734

18411735
case 0:
1842-
if (ictx->rdev->driver_type == RC_DRIVER_IR_RAW)
1843-
imon_incoming_ir_raw(ictx, urb, intfnum);
1844-
else
1845-
imon_incoming_scancode(ictx, urb, intfnum);
1736+
imon_incoming_packet(ictx, urb, intfnum);
18461737
break;
18471738

18481739
default:
@@ -1883,10 +1774,7 @@ static void usb_rx_callback_intf1(struct urb *urb)
18831774
break;
18841775

18851776
case 0:
1886-
if (ictx->rdev->driver_type == RC_DRIVER_IR_RAW)
1887-
imon_incoming_ir_raw(ictx, urb, intfnum);
1888-
else
1889-
imon_incoming_scancode(ictx, urb, intfnum);
1777+
imon_incoming_packet(ictx, urb, intfnum);
18901778
break;
18911779

18921780
default:
@@ -2000,14 +1888,11 @@ static void imon_set_display_type(struct imon_context *ictx)
20001888
case 0x0041:
20011889
case 0x0042:
20021890
case 0x0043:
2003-
case 0x8001:
2004-
case 0xff30:
20051891
configured_display_type = IMON_DISPLAY_TYPE_NONE;
20061892
ictx->display_supported = false;
20071893
break;
20081894
case 0x0036:
20091895
case 0x0044:
2010-
case 0xffda:
20111896
default:
20121897
configured_display_type = IMON_DISPLAY_TYPE_VFD;
20131898
break;
@@ -2032,8 +1917,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
20321917
static const unsigned char fp_packet[] = {
20331918
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88 };
20341919

2035-
rdev = rc_allocate_device(ictx->dev_descr->flags & IMON_IR_RAW ?
2036-
RC_DRIVER_IR_RAW : RC_DRIVER_SCANCODE);
1920+
rdev = rc_allocate_device(RC_DRIVER_SCANCODE);
20371921
if (!rdev) {
20381922
dev_err(ictx->dev, "remote control dev allocation failed\n");
20391923
goto out;
@@ -2051,12 +1935,8 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
20511935
rdev->dev.parent = ictx->dev;
20521936

20531937
rdev->priv = ictx;
2054-
if (ictx->dev_descr->flags & IMON_IR_RAW)
2055-
rdev->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
2056-
else
2057-
/* iMON PAD or MCE */
2058-
rdev->allowed_protocols = RC_PROTO_BIT_OTHER |
2059-
RC_PROTO_BIT_RC6_MCE;
1938+
/* iMON PAD or MCE */
1939+
rdev->allowed_protocols = RC_PROTO_BIT_OTHER | RC_PROTO_BIT_RC6_MCE;
20601940
rdev->change_protocol = imon_ir_change_protocol;
20611941
rdev->driver_name = MOD_NAME;
20621942

@@ -2074,8 +1954,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
20741954

20751955
imon_set_display_type(ictx);
20761956

2077-
if (ictx->rc_proto == RC_PROTO_BIT_RC6_MCE ||
2078-
ictx->dev_descr->flags & IMON_IR_RAW)
1957+
if (ictx->rc_proto == RC_PROTO_BIT_RC6_MCE)
20791958
rdev->map_name = RC_MAP_IMON_MCE;
20801959
else
20811960
rdev->map_name = RC_MAP_IMON_PAD;

0 commit comments

Comments
 (0)