summaryrefslogtreecommitdiff
path: root/drivers/media/rc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/rc')
-rw-r--r--drivers/media/rc/ene_ir.c2
-rw-r--r--drivers/media/rc/igorplugusb.c2
-rw-r--r--drivers/media/rc/img-ir/img-ir-hw.c5
-rw-r--r--drivers/media/rc/img-ir/img-ir-raw.c2
-rw-r--r--drivers/media/rc/imon.c2
-rw-r--r--drivers/media/rc/ir-mce_kbd-decoder.c3
-rw-r--r--drivers/media/rc/ir-spi.c40
-rw-r--r--drivers/media/rc/keymaps/rc-hauppauge.c42
-rw-r--r--drivers/media/rc/rc-ir-raw.c3
-rw-r--r--drivers/media/rc/rc-main.c4
10 files changed, 81 insertions, 24 deletions
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c
index 9435cba3f4d9..d6c54a3bccc2 100644
--- a/drivers/media/rc/ene_ir.c
+++ b/drivers/media/rc/ene_ir.c
@@ -659,7 +659,7 @@ exit:
/* timer to simulate tx done interrupt */
static void ene_tx_irqsim(struct timer_list *t)
{
- struct ene_device *dev = from_timer(dev, t, tx_sim_timer);
+ struct ene_device *dev = timer_container_of(dev, t, tx_sim_timer);
unsigned long flags;
spin_lock_irqsave(&dev->hw_lock, flags);
diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c
index bfe86588c69b..e034c93d57cf 100644
--- a/drivers/media/rc/igorplugusb.c
+++ b/drivers/media/rc/igorplugusb.c
@@ -131,7 +131,7 @@ static void igorplugusb_cmd(struct igorplugusb *ir, int cmd)
static void igorplugusb_timer(struct timer_list *t)
{
- struct igorplugusb *ir = from_timer(ir, t, timer);
+ struct igorplugusb *ir = timer_container_of(ir, t, timer);
igorplugusb_cmd(ir, GET_INFRACODE);
}
diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c
index da89ddf771c3..63f6f5b36838 100644
--- a/drivers/media/rc/img-ir/img-ir-hw.c
+++ b/drivers/media/rc/img-ir/img-ir-hw.c
@@ -865,7 +865,7 @@ static void img_ir_handle_data(struct img_ir_priv *priv, u32 len, u64 raw)
/* timer function to end waiting for repeat. */
static void img_ir_end_timer(struct timer_list *t)
{
- struct img_ir_priv *priv = from_timer(priv, t, hw.end_timer);
+ struct img_ir_priv *priv = timer_container_of(priv, t, hw.end_timer);
spin_lock_irq(&priv->lock);
img_ir_end_repeat(priv);
@@ -879,7 +879,8 @@ static void img_ir_end_timer(struct timer_list *t)
*/
static void img_ir_suspend_timer(struct timer_list *t)
{
- struct img_ir_priv *priv = from_timer(priv, t, hw.suspend_timer);
+ struct img_ir_priv *priv = timer_container_of(priv, t,
+ hw.suspend_timer);
spin_lock_irq(&priv->lock);
/*
diff --git a/drivers/media/rc/img-ir/img-ir-raw.c b/drivers/media/rc/img-ir/img-ir-raw.c
index 669f3309e237..92fb7b555a0f 100644
--- a/drivers/media/rc/img-ir/img-ir-raw.c
+++ b/drivers/media/rc/img-ir/img-ir-raw.c
@@ -65,7 +65,7 @@ void img_ir_isr_raw(struct img_ir_priv *priv, u32 irq_status)
*/
static void img_ir_echo_timer(struct timer_list *t)
{
- struct img_ir_priv *priv = from_timer(priv, t, raw.timer);
+ struct img_ir_priv *priv = timer_container_of(priv, t, raw.timer);
spin_lock_irq(&priv->lock);
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index cb6f36ebe5c8..f5221b018808 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -1091,7 +1091,7 @@ static void usb_tx_callback(struct urb *urb)
*/
static void imon_touch_display_timeout(struct timer_list *t)
{
- struct imon_context *ictx = from_timer(ictx, t, ttimer);
+ struct imon_context *ictx = timer_container_of(ictx, t, ttimer);
if (ictx->display_type != IMON_DISPLAY_TYPE_VGA)
return;
diff --git a/drivers/media/rc/ir-mce_kbd-decoder.c b/drivers/media/rc/ir-mce_kbd-decoder.c
index 817030fb50c9..bb2d7c37c263 100644
--- a/drivers/media/rc/ir-mce_kbd-decoder.c
+++ b/drivers/media/rc/ir-mce_kbd-decoder.c
@@ -109,7 +109,8 @@ static unsigned char kbd_keycodes[256] = {
static void mce_kbd_rx_timeout(struct timer_list *t)
{
- struct ir_raw_event_ctrl *raw = from_timer(raw, t, mce_kbd.rx_timeout);
+ struct ir_raw_event_ctrl *raw = timer_container_of(raw, t,
+ mce_kbd.rx_timeout);
unsigned char maskcode;
unsigned long flags;
int i;
diff --git a/drivers/media/rc/ir-spi.c b/drivers/media/rc/ir-spi.c
index 8fc8e496e6aa..392441e0c116 100644
--- a/drivers/media/rc/ir-spi.c
+++ b/drivers/media/rc/ir-spi.c
@@ -21,13 +21,12 @@
#define IR_SPI_DRIVER_NAME "ir-spi"
#define IR_SPI_DEFAULT_FREQUENCY 38000
-#define IR_SPI_MAX_BUFSIZE 4096
+#define IR_SPI_BITS_PER_PULSE 16
struct ir_spi_data {
u32 freq;
bool negated;
- u16 tx_buf[IR_SPI_MAX_BUFSIZE];
u16 pulse;
u16 space;
@@ -43,17 +42,23 @@ static int ir_spi_tx(struct rc_dev *dev, unsigned int *buffer, unsigned int coun
unsigned int len = 0;
struct ir_spi_data *idata = dev->priv;
struct spi_transfer xfer;
+ u16 *tx_buf;
/* convert the pulse/space signal to raw binary signal */
for (i = 0; i < count; i++) {
- unsigned int periods;
- int j;
- u16 val;
+ buffer[i] = DIV_ROUND_CLOSEST_ULL((u64)buffer[i] * idata->freq,
+ 1000000);
+ len += buffer[i];
+ }
- periods = DIV_ROUND_CLOSEST(buffer[i] * idata->freq, 1000000);
+ tx_buf = kmalloc_array(len, sizeof(*tx_buf), GFP_KERNEL);
+ if (!tx_buf)
+ return -ENOMEM;
- if (len + periods >= IR_SPI_MAX_BUFSIZE)
- return -EINVAL;
+ len = 0;
+ for (i = 0; i < count; i++) {
+ int j;
+ u16 val;
/*
* The first value in buffer is a pulse, so that 0, 2, 4, ...
@@ -61,19 +66,19 @@ static int ir_spi_tx(struct rc_dev *dev, unsigned int *buffer, unsigned int coun
* contain a space duration.
*/
val = (i % 2) ? idata->space : idata->pulse;
- for (j = 0; j < periods; j++)
- idata->tx_buf[len++] = val;
+ for (j = 0; j < buffer[i]; j++)
+ tx_buf[len++] = val;
}
memset(&xfer, 0, sizeof(xfer));
- xfer.speed_hz = idata->freq * 16;
- xfer.len = len * sizeof(*idata->tx_buf);
- xfer.tx_buf = idata->tx_buf;
+ xfer.speed_hz = idata->freq * IR_SPI_BITS_PER_PULSE;
+ xfer.len = len * sizeof(*tx_buf);
+ xfer.tx_buf = tx_buf;
ret = regulator_enable(idata->regulator);
if (ret)
- return ret;
+ goto err_free_tx_buf;
ret = spi_sync_transfer(idata->spi, &xfer, 1);
if (ret)
@@ -81,6 +86,10 @@ static int ir_spi_tx(struct rc_dev *dev, unsigned int *buffer, unsigned int coun
regulator_disable(idata->regulator);
+err_free_tx_buf:
+
+ kfree(tx_buf);
+
return ret ? ret : count;
}
@@ -91,6 +100,9 @@ static int ir_spi_set_tx_carrier(struct rc_dev *dev, u32 carrier)
if (!carrier)
return -EINVAL;
+ if (carrier > idata->spi->max_speed_hz / IR_SPI_BITS_PER_PULSE)
+ return -EINVAL;
+
idata->freq = carrier;
return 0;
diff --git a/drivers/media/rc/keymaps/rc-hauppauge.c b/drivers/media/rc/keymaps/rc-hauppauge.c
index d7156774aa0e..9e64c0b2d18e 100644
--- a/drivers/media/rc/keymaps/rc-hauppauge.c
+++ b/drivers/media/rc/keymaps/rc-hauppauge.c
@@ -261,6 +261,48 @@ static struct rc_map_table rc5_hauppauge_new[] = {
{ 0x001e, KEY_RED }, /* Reserved */
{ 0x0000, KEY_NUMERIC_0 },
{ 0x0026, KEY_SLEEP }, /* Minimize */
+
+ /*
+ * Keycodes for the black Credit Card Remote Control shipped with, for
+ * example, the WinTV-dualHD tuner.
+ * Keycodes start with address = 0x19
+ */
+ { 0x190a, KEY_LAST }, /* <- */
+ { 0x192f, KEY_MENU }, /* List */
+ { 0x1910, KEY_CHANNELUP },
+ { 0x192e, KEY_CHANNELDOWN },
+ { 0x192c, KEY_OK },
+
+ { 0x1911, KEY_TV },
+ { 0x190c, KEY_POWER },
+
+ { 0x1900, KEY_NUMERIC_0 },
+ { 0x1938, KEY_NUMERIC_1 },
+ { 0x1920, KEY_NUMERIC_2 },
+ { 0x1901, KEY_NUMERIC_3 },
+ { 0x1902, KEY_NUMERIC_4 },
+ { 0x1904, KEY_NUMERIC_5 },
+ { 0x1905, KEY_NUMERIC_6 },
+ { 0x1907, KEY_NUMERIC_7 },
+ { 0x1908, KEY_NUMERIC_8 },
+ { 0x190f, KEY_NUMERIC_9 },
+
+ { 0x1921, KEY_VOLUMEUP },
+ { 0x1903, KEY_VOLUMEDOWN },
+ { 0x1906, KEY_MUTE },
+
+ { 0x1909, KEY_CAMERA }, /* Snap */
+ { 0x1922, KEY_SUBTITLE }, /* CC */
+ { 0x192b, KEY_INFO },
+
+ { 0x1929, KEY_END }, /* Skip to live TV */
+ { 0x190d, KEY_PLAYPAUSE },
+ { 0x1926, KEY_STOP },
+ { 0x192a, KEY_RECORD },
+ { 0x193a, KEY_PREVIOUS }, /* |< */
+ { 0x193b, KEY_REWIND }, /* << */
+ { 0x193c, KEY_FASTFORWARD }, /* >> */
+ { 0x193d, KEY_NEXT }, /* >| */
};
static struct rc_map_list rc5_hauppauge_new_map = {
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index aa4ac43c66fa..5dafe11f61c6 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -552,7 +552,8 @@ EXPORT_SYMBOL(ir_raw_encode_scancode);
*/
static void ir_raw_edge_handle(struct timer_list *t)
{
- struct ir_raw_event_ctrl *raw = from_timer(raw, t, edge_handle);
+ struct ir_raw_event_ctrl *raw = timer_container_of(raw, t,
+ edge_handle);
struct rc_dev *dev = raw->dev;
unsigned long flags;
ktime_t interval;
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index e46358fb8ac0..b9bf5cdcde4a 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -674,7 +674,7 @@ EXPORT_SYMBOL_GPL(rc_keyup);
*/
static void ir_timer_keyup(struct timer_list *t)
{
- struct rc_dev *dev = from_timer(dev, t, timer_keyup);
+ struct rc_dev *dev = timer_container_of(dev, t, timer_keyup);
unsigned long flags;
/*
@@ -703,7 +703,7 @@ static void ir_timer_keyup(struct timer_list *t)
*/
static void ir_timer_repeat(struct timer_list *t)
{
- struct rc_dev *dev = from_timer(dev, t, timer_repeat);
+ struct rc_dev *dev = timer_container_of(dev, t, timer_repeat);
struct input_dev *input = dev->input_dev;
unsigned long flags;