diff options
author | Sean Young <sean@mess.org> | 2020-08-23 20:23:05 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-09-03 17:18:55 +0300 |
commit | 528222d853f9283110f0118dd71d9f0ad686d586 (patch) | |
tree | a1bca46afe71308a2832208ee2ea9c0c5b196338 /drivers/media/rc/ir-rcmm-decoder.c | |
parent | 32c3db3d9873ef822a9544259d68d0cd31c7bc64 (diff) | |
download | linux-528222d853f9283110f0118dd71d9f0ad686d586.tar.xz |
media: rc: harmonize infrared durations to microseconds
rc-core kapi uses nanoseconds for infrared durations for receiving, and
microseconds for sending. The uapi already uses microseconds for both,
so this patch does not change the uapi.
Infrared durations do not need nanosecond resolution. IR protocols do not
have durations shorter than about 100 microseconds. Some IR hardware offers
250 microseconds resolution, which is sufficient for most protocols.
Better hardware has 50 microsecond resolution and is enough for every
protocol I am aware off.
Unify on microseconds everywhere. This simplifies the code since less
conversion between microseconds and nanoseconds needs to be done.
This affects:
- rx_resolution member of struct rc_dev
- timeout member of struct rc_dev
- duration member in struct ir_raw_event
Cc: "Bruno Prémont" <bonbons@linux-vserver.org>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: Patrick Lerda <patrick9876@free.fr>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: Sean Wang <sean.wang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: "David Härdeman" <david@hardeman.nu>
Cc: Benjamin Valentin <benpicco@googlemail.com>
Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/rc/ir-rcmm-decoder.c')
-rw-r--r-- | drivers/media/rc/ir-rcmm-decoder.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/media/rc/ir-rcmm-decoder.c b/drivers/media/rc/ir-rcmm-decoder.c index 028df5cb1828..fd9ec69a3718 100644 --- a/drivers/media/rc/ir-rcmm-decoder.c +++ b/drivers/media/rc/ir-rcmm-decoder.c @@ -6,12 +6,12 @@ #include "rc-core-priv.h" #include <linux/module.h> -#define RCMM_UNIT 166667 /* nanosecs */ -#define RCMM_PREFIX_PULSE 416666 /* 166666.666666666*2.5 */ -#define RCMM_PULSE_0 277777 /* 166666.666666666*(1+2/3) */ -#define RCMM_PULSE_1 444444 /* 166666.666666666*(2+2/3) */ -#define RCMM_PULSE_2 611111 /* 166666.666666666*(3+2/3) */ -#define RCMM_PULSE_3 777778 /* 166666.666666666*(4+2/3) */ +#define RCMM_UNIT 166 /* microseconds */ +#define RCMM_PREFIX_PULSE 417 /* 166.666666666666*2.5 */ +#define RCMM_PULSE_0 278 /* 166.666666666666*(1+2/3) */ +#define RCMM_PULSE_1 444 /* 166.666666666666*(2+2/3) */ +#define RCMM_PULSE_2 611 /* 166.666666666666*(3+2/3) */ +#define RCMM_PULSE_3 778 /* 166.666666666666*(4+2/3) */ enum rcmm_state { STATE_INACTIVE, @@ -64,8 +64,8 @@ static int ir_rcmm_decode(struct rc_dev *dev, struct ir_raw_event ev) int value; if (!(dev->enabled_protocols & (RC_PROTO_BIT_RCMM32 | - RC_PROTO_BIT_RCMM24 | - RC_PROTO_BIT_RCMM12))) + RC_PROTO_BIT_RCMM24 | + RC_PROTO_BIT_RCMM12))) return 0; if (!is_timing_event(ev)) { @@ -165,7 +165,7 @@ static int ir_rcmm_decode(struct rc_dev *dev, struct ir_raw_event ev) } dev_dbg(&dev->dev, "RC-MM 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; } |