diff options
author | Sean Young <sean@mess.org> | 2020-08-23 19:23:05 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-09-03 16:18:55 +0200 |
commit | 528222d853f9283110f0118dd71d9f0ad686d586 (patch) | |
tree | a1bca46afe71308a2832208ee2ea9c0c5b196338 /include/media | |
parent | 32c3db3d9873ef822a9544259d68d0cd31c7bc64 (diff) | |
download | linux-528222d853f9283110f0118dd71d9f0ad686d586.tar.bz2 |
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 'include/media')
-rw-r--r-- | include/media/rc-core.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/include/media/rc-core.h b/include/media/rc-core.h index d3f85df64bb2..a1019c4ab5e8 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -128,8 +128,8 @@ struct lirc_fh { * @timeout: optional time after which device stops sending data * @min_timeout: minimum timeout supported by device * @max_timeout: maximum timeout supported by device - * @rx_resolution : resolution (in ns) of input sampler - * @tx_resolution: resolution (in ns) of output sampler + * @rx_resolution : resolution (in us) of input sampler + * @tx_resolution: resolution (in us) of output sampler * @lirc_dev: lirc device * @lirc_cdev: lirc char cdev * @gap_start: time when gap starts @@ -157,7 +157,7 @@ struct lirc_fh { * @s_wakeup_filter: set the wakeup scancode filter. If the mask is zero * then wakeup should be disabled. wakeup_protocol will be set to * a valid protocol if mask is nonzero. - * @s_timeout: set hardware timeout in ns + * @s_timeout: set hardware timeout in us */ struct rc_dev { struct device dev; @@ -309,11 +309,10 @@ struct ir_raw_event { unsigned carrier_report:1; }; -#define IR_DEFAULT_TIMEOUT MS_TO_NS(125) -#define IR_MAX_DURATION 500000000 /* 500 ms */ #define US_TO_NS(usec) ((usec) * 1000) #define MS_TO_US(msec) ((msec) * 1000) -#define MS_TO_NS(msec) ((msec) * 1000 * 1000) +#define IR_MAX_DURATION MS_TO_US(500) +#define IR_DEFAULT_TIMEOUT MS_TO_US(125) void ir_raw_event_handle(struct rc_dev *dev); int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev); |