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 --- drivers/media/rc/ir-jvc-decoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/media/rc/ir-jvc-decoder.c') diff --git a/drivers/media/rc/ir-jvc-decoder.c b/drivers/media/rc/ir-jvc-decoder.c index 864d9e316c33..470f2e1fd507 100644 --- a/drivers/media/rc/ir-jvc-decoder.c +++ b/drivers/media/rc/ir-jvc-decoder.c @@ -9,7 +9,7 @@ #include "rc-core-priv.h" #define JVC_NBITS 16 /* dev(8) + func(8) */ -#define JVC_UNIT 525000 /* ns */ +#define JVC_UNIT 525 /* us */ #define JVC_HEADER_PULSE (16 * JVC_UNIT) /* lack of header -> repeat */ #define JVC_HEADER_SPACE (8 * JVC_UNIT) #define JVC_BIT_PULSE (1 * JVC_UNIT) @@ -49,7 +49,7 @@ static int ir_jvc_decode(struct rc_dev *dev, struct ir_raw_event ev) goto out; dev_dbg(&dev->dev, "JVC decode started at state %d (%uus %s)\n", - data->state, TO_US(ev.duration), TO_STR(ev.pulse)); + data->state, ev.duration, TO_STR(ev.pulse)); again: switch (data->state) { @@ -157,7 +157,7 @@ again: out: dev_dbg(&dev->dev, "JVC decode failed at state %d (%uus %s)\n", - data->state, TO_US(ev.duration), TO_STR(ev.pulse)); + data->state, ev.duration, TO_STR(ev.pulse)); data->state = STATE_INACTIVE; return -EINVAL; } -- cgit v1.2.3