aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/img-ir/img-ir-hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/rc/img-ir/img-ir-hw.c')
-rw-r--r--drivers/media/rc/img-ir/img-ir-hw.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c
index 0127dd257a57..bfb282a714e8 100644
--- a/drivers/media/rc/img-ir/img-ir-hw.c
+++ b/drivers/media/rc/img-ir/img-ir-hw.c
@@ -3,6 +3,11 @@
3 * 3 *
4 * Copyright 2010-2014 Imagination Technologies Ltd. 4 * Copyright 2010-2014 Imagination Technologies Ltd.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
6 * This ties into the input subsystem using the RC-core. Protocol support is 11 * This ties into the input subsystem using the RC-core. Protocol support is
7 * provided in separate modules which provide the parameters and scancode 12 * provided in separate modules which provide the parameters and scancode
8 * translation functions to set up the hardware decoder and interpret the 13 * translation functions to set up the hardware decoder and interpret the
@@ -507,7 +512,7 @@ unlock:
507static int img_ir_set_normal_filter(struct rc_dev *dev, 512static int img_ir_set_normal_filter(struct rc_dev *dev,
508 struct rc_scancode_filter *sc_filter) 513 struct rc_scancode_filter *sc_filter)
509{ 514{
510 return img_ir_set_filter(dev, RC_FILTER_NORMAL, sc_filter); 515 return img_ir_set_filter(dev, RC_FILTER_NORMAL, sc_filter);
511} 516}
512 517
513static int img_ir_set_wakeup_filter(struct rc_dev *dev, 518static int img_ir_set_wakeup_filter(struct rc_dev *dev,
@@ -551,8 +556,8 @@ static void img_ir_set_decoder(struct img_ir_priv *priv,
551 hw->mode = IMG_IR_M_NORMAL; 556 hw->mode = IMG_IR_M_NORMAL;
552 557
553 /* clear the wakeup scancode filter */ 558 /* clear the wakeup scancode filter */
554 rdev->scancode_filters[RC_FILTER_WAKEUP].data = 0; 559 rdev->scancode_wakeup_filter.data = 0;
555 rdev->scancode_filters[RC_FILTER_WAKEUP].mask = 0; 560 rdev->scancode_wakeup_filter.mask = 0;
556 561
557 /* clear raw filters */ 562 /* clear raw filters */
558 _img_ir_set_filter(priv, NULL); 563 _img_ir_set_filter(priv, NULL);
@@ -656,8 +661,8 @@ success:
656 wakeup_protocols = *ir_type; 661 wakeup_protocols = *ir_type;
657 if (!hw->decoder || !hw->decoder->filter) 662 if (!hw->decoder || !hw->decoder->filter)
658 wakeup_protocols = 0; 663 wakeup_protocols = 0;
659 rc_set_allowed_wakeup_protocols(rdev, wakeup_protocols); 664 rdev->allowed_wakeup_protocols = wakeup_protocols;
660 rc_set_enabled_wakeup_protocols(rdev, wakeup_protocols); 665 rdev->enabled_wakeup_protocols = wakeup_protocols;
661 return 0; 666 return 0;
662} 667}
663 668
@@ -671,9 +676,9 @@ static void img_ir_set_protocol(struct img_ir_priv *priv, u64 proto)
671 spin_unlock_irq(&rdev->rc_map.lock); 676 spin_unlock_irq(&rdev->rc_map.lock);
672 677
673 mutex_lock(&rdev->lock); 678 mutex_lock(&rdev->lock);
674 rc_set_enabled_protocols(rdev, proto); 679 rdev->enabled_protocols = proto;
675 rc_set_allowed_wakeup_protocols(rdev, proto); 680 rdev->allowed_wakeup_protocols = proto;
676 rc_set_enabled_wakeup_protocols(rdev, proto); 681 rdev->enabled_wakeup_protocols = proto;
677 mutex_unlock(&rdev->lock); 682 mutex_unlock(&rdev->lock);
678} 683}
679 684
@@ -790,9 +795,11 @@ static void img_ir_handle_data(struct img_ir_priv *priv, u32 len, u64 raw)
790 struct img_ir_priv_hw *hw = &priv->hw; 795 struct img_ir_priv_hw *hw = &priv->hw;
791 const struct img_ir_decoder *dec = hw->decoder; 796 const struct img_ir_decoder *dec = hw->decoder;
792 int ret = IMG_IR_SCANCODE; 797 int ret = IMG_IR_SCANCODE;
793 int scancode; 798 u32 scancode;
799 enum rc_type protocol = RC_TYPE_UNKNOWN;
800
794 if (dec->scancode) 801 if (dec->scancode)
795 ret = dec->scancode(len, raw, &scancode, hw->enabled_protocols); 802 ret = dec->scancode(len, raw, &protocol, &scancode, hw->enabled_protocols);
796 else if (len >= 32) 803 else if (len >= 32)
797 scancode = (u32)raw; 804 scancode = (u32)raw;
798 else if (len < 32) 805 else if (len < 32)
@@ -801,7 +808,7 @@ static void img_ir_handle_data(struct img_ir_priv *priv, u32 len, u64 raw)
801 len, (unsigned long long)raw); 808 len, (unsigned long long)raw);
802 if (ret == IMG_IR_SCANCODE) { 809 if (ret == IMG_IR_SCANCODE) {
803 dev_dbg(priv->dev, "decoded scan code %#x\n", scancode); 810 dev_dbg(priv->dev, "decoded scan code %#x\n", scancode);
804 rc_keydown(hw->rdev, scancode, 0); 811 rc_keydown(hw->rdev, protocol, scancode, 0);
805 img_ir_end_repeat(priv); 812 img_ir_end_repeat(priv);
806 } else if (ret == IMG_IR_REPEATCODE) { 813 } else if (ret == IMG_IR_REPEATCODE) {
807 if (hw->mode == IMG_IR_M_REPEATING) { 814 if (hw->mode == IMG_IR_M_REPEATING) {
@@ -996,7 +1003,7 @@ int img_ir_probe_hw(struct img_ir_priv *priv)
996 } 1003 }
997 rdev->priv = priv; 1004 rdev->priv = priv;
998 rdev->map_name = RC_MAP_EMPTY; 1005 rdev->map_name = RC_MAP_EMPTY;
999 rc_set_allowed_protocols(rdev, img_ir_allowed_protos(priv)); 1006 rdev->allowed_protocols = img_ir_allowed_protos(priv);
1000 rdev->input_name = "IMG Infrared Decoder"; 1007 rdev->input_name = "IMG Infrared Decoder";
1001 rdev->s_filter = img_ir_set_normal_filter; 1008 rdev->s_filter = img_ir_set_normal_filter;
1002 rdev->s_wakeup_filter = img_ir_set_wakeup_filter; 1009 rdev->s_wakeup_filter = img_ir_set_wakeup_filter;