From 528222d853f9283110f0118dd71d9f0ad686d586 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Sun, 23 Aug 2020 19:23:05 +0200 Subject: media: rc: harmonize infrared durations to microseconds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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" Cc: Hans Verkuil Cc: Maxim Levitsky Cc: Patrick Lerda Cc: Kevin Hilman Cc: Neil Armstrong Cc: Jerome Brunet Cc: Martin Blumenstingl Cc: Sean Wang Cc: Matthias Brugger Cc: Patrice Chotard Cc: Maxime Ripard Cc: Chen-Yu Tsai Cc: "David Härdeman" Cc: Benjamin Valentin Cc: Antti Palosaari Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- include/media/rc-core.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'include/media') 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); -- cgit v1.2.3