diff options
Diffstat (limited to 'drivers/media/rc/ir-xmp-decoder.c')
| -rw-r--r-- | drivers/media/rc/ir-xmp-decoder.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/drivers/media/rc/ir-xmp-decoder.c b/drivers/media/rc/ir-xmp-decoder.c index c965f51df1c1..dc36b68739cb 100644 --- a/drivers/media/rc/ir-xmp-decoder.c +++ b/drivers/media/rc/ir-xmp-decoder.c @@ -1,16 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only /* ir-xmp-decoder.c - handle XMP IR Pulse/Space protocol * * Copyright (C) 2014 by Marcel Mol * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * * - Based on info from http://www.hifi-remote.com * - Ignore Toggle=9 frames * - Ignore XMP-1 XMP-2 difference, always store 16 bit OBC @@ -20,11 +12,12 @@ #include <linux/module.h> #include "rc-core-priv.h" -#define XMP_UNIT 136000 /* ns */ -#define XMP_LEADER 210000 /* ns */ -#define XMP_NIBBLE_PREFIX 760000 /* ns */ -#define XMP_HALFFRAME_SPACE 13800000 /* ns */ -#define XMP_TRAILER_SPACE 20000000 /* should be 80ms but not all dureation supliers can go that high */ +#define XMP_UNIT 136 /* us */ +#define XMP_LEADER 210 /* us */ +#define XMP_NIBBLE_PREFIX 760 /* us */ +#define XMP_HALFFRAME_SPACE 13800 /* us */ +/* should be 80ms but not all duration supliers can go that high */ +#define XMP_TRAILER_SPACE 20000 enum xmp_state { STATE_INACTIVE, @@ -44,13 +37,13 @@ static int ir_xmp_decode(struct rc_dev *dev, struct ir_raw_event ev) struct xmp_dec *data = &dev->raw->xmp; if (!is_timing_event(ev)) { - if (ev.reset) + if (ev.overflow) data->state = STATE_INACTIVE; return 0; } dev_dbg(&dev->dev, "XMP decode started at state %d %d (%uus %s)\n", - data->state, data->count, TO_US(ev.duration), TO_STR(ev.pulse)); + data->state, data->count, ev.duration, TO_STR(ev.pulse)); switch (data->state) { @@ -94,7 +87,7 @@ static int ir_xmp_decode(struct rc_dev *dev, struct ir_raw_event ev) n = data->durations; /* * the 4th nibble should be 15 so base the divider on this - * to transform durations into nibbles. Substract 2000 from + * to transform durations into nibbles. Subtract 2000 from * the divider to compensate for fluctuations in the signal */ divider = (n[3] - XMP_NIBBLE_PREFIX) / 15 - 2000; @@ -174,7 +167,7 @@ static int ir_xmp_decode(struct rc_dev *dev, struct ir_raw_event ev) } else if (geq_margin(ev.duration, XMP_NIBBLE_PREFIX, XMP_UNIT)) { /* store nibble raw data, decode after trailer */ if (data->count == 16) { - dev_dbg(&dev->dev, "to many pulses (%d) ignoring: %u\n", + dev_dbg(&dev->dev, "too many pulses (%d) ignoring: %u\n", data->count, ev.duration); data->state = STATE_INACTIVE; return -EINVAL; @@ -191,7 +184,7 @@ static int ir_xmp_decode(struct rc_dev *dev, struct ir_raw_event ev) } dev_dbg(&dev->dev, "XMP decode failed at count %d state %d (%uus %s)\n", - data->count, data->state, TO_US(ev.duration), TO_STR(ev.pulse)); + data->count, data->state, ev.duration, TO_STR(ev.pulse)); data->state = STATE_INACTIVE; return -EINVAL; } |
