summaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/meson-ir.c
Commit message (Collapse)AuthorAgeFilesLines
* media: rc: meson-ir: support rc driver type RC_DRIVER_SCANCODEZelong Dong2023-09-271-71/+451
| | | | | | | | | | Meson IR Controller supports hardware decoder in Meson-S4 and later SoC. So far, protocol NEC could be decoded by hardware decoder. Signed-off-by: Zelong Dong <zelong.dong@amlogic.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: Explicitly include correct DT includesRob Herring2023-07-191-1/+1
| | | | | | | | | | | | | | The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: rc: meson-ir: support MMIO regmaps to access registersZelong Dong2023-07-141-34/+38
| | | | | | | | Supports MMIO regmaps to access controller registers in Meson IR driver. Signed-off-by: Zelong Dong <zelong.dong@amlogic.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: rc: meson-ir: rename Meson IR Controller register macrosZelong Dong2023-07-141-37/+40
| | | | | | | | | There are more registers to come in the next Meson IR Controller. For defining clearly, rename register macros. Signed-off-by: Zelong Dong <zelong.dong@amlogic.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: rc: meson-ir: sort Meson IR Controller register macrosZelong Dong2023-07-141-19/+10
| | | | | | | | | | There are more registers to come in the next Meson IR Controller. For defining clearly, sort register macros and let address and bit macros as a set. Signed-off-by: Zelong Dong <zelong.dong@amlogic.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
* media: meson-ir: Convert to platform remove callback returning voidUwe Kleine-König2023-04-111-4/+2
| | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: rc: meson-ir: Make use of the helper function ↵Cai Huoqing2021-09-301-3/+1
| | | | | | | | | | | | | devm_platform_ioremap_resource() Use the devm_platform_ioremap_resource() helper instead of calling platform_get_resource() and devm_ioremap_resource() separately Signed-off-by: Cai Huoqing <caihuoqing@baidu.com> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
* media: rc: harmonize infrared durations to microsecondsSean Young2020-09-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* media: Remove dev_err() usage after platform_get_irq()Stephen Boyd2019-08-071-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: rc: remove redundant dev_err messageDing Xiang2019-06-271-3/+1
| | | | | | | | | devm_ioremap_resource already contains error message, so remove the redundant dev_err message Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: rc: meson-ir: update with SPDX Licence identifierNeil Armstrong2019-05-221-7/+1
| | | | | | | | Remove comment and replace with the appropriate SPDX identifier. Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: rc: Remove init_ir_raw_event and DEFINE_IR_RAW_EVENT macrosSean Young2018-10-041-1/+1
| | | | | | | | | | | | | | This can be done with c99 initializers, which makes the code cleaner and more transparent. It does require gcc 4.6, because of this bug in earlier versions: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676 Since commit cafa0010cd51 ("Raise the minimum required gcc version to 4.6"), this is the case. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* media: rc: meson-ir: lower timeout and make configurableSean Young2018-03-211-1/+3
| | | | | | | | | | | | | A timeout of 200ms is much longer than necessary, and delays the decoding decoding of a single scancode and the last scancode when a button is being held. This makes the remote seem sluggish. If the min_timeout and max_timeout values are set, the timeout is configurable via the LIRC_SET_REC_TIMEOUT ioctl. Tested-by: Matthias Reichl <hias@horus.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: rc: meson-ir: add timeout on idleSean Young2018-03-211-2/+1
| | | | | | | | | | | Meson doesn't seem to be able to generate timeout events in hardware. So install a software timer to generate the timeout events required by the decoders to prevent "ghost keypresses". Reported-by: Matthias Reichl <hias@horus.com> Tested-by: Matthias Reichl <hias@horus.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: rc: rename RC_TYPE_* to RC_PROTO_* and RC_BIT_* to RC_PROTO_BIT_*Sean Young2017-08-201-1/+1
| | | | | | | | | RC_TYPE is confusing and it's just the protocol. So rename it. Suggested-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Sean Young <sean@mess.org> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: rc-core: rename input_name to device_nameSean Young2017-08-201-1/+1
| | | | | | | | | | | | | | | | | | When an ir-spi is registered, you get this message. rc rc0: Unspecified device as /devices/platform/soc/3f215080.spi/spi_master/spi32766/spi32766.128/rc/rc0 "Unspecified device" refers to input_name, which makes no sense for IR TX only devices. So, rename to device_name. Also make driver_name const char* so that no casts are needed anywhere. Now ir-spi reports: rc rc0: IR SPI as /devices/platform/soc/3f215080.spi/spi_master/spi32766/spi32766.128/rc/rc0 Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] rc: meson-ir: switch config to NEC decoding on shutdownAlex Deryskyba2017-06-061-0/+27
| | | | | | | | | | | | | | | | | | | | | On the Amlogic SoCs, the bootloader firmware can handle the IR hardware in order to Wake up or Power back the system when in suspend on shutdown mode. This patch switches the hardware configuration in a state usable by the firmware to permit powering the system back. Some vendor bootloader firmware were modified to switch to this configuration but it may not be the case for all available products. This patch was originally posted at [1]. [1] https://github.com/LibreELEC/linux-amlogic/pull/27 Signed-off-by: Alex Deryskyba <alex@codesnake.com> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] rc: meson-ir: store raw event without processingJonas Karlman2017-06-061-1/+1
| | | | | | | | | | | | | | | This patch fixes meson-it driver by storing event without processing to avoid losing key pressed events when system is loaded and events are occurring too fast. This issue was reported at [1] [1] https://github.com/LibreELEC/linux-amlogic/pull/42 Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] rc: meson-ir: change irq name to to of node nameHeiner Kallweit2017-06-061-1/+1
| | | | | | | | | | Switch the interrupt description to the default which is the of node name. This is more in line with the interrupt descriptions in other meson drivers. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] rc: meson-ir: use readl_relaxed in the interrupt handlerHeiner Kallweit2017-06-061-3/+4
| | | | | | | | | | We don't need the memory barriers here and an interrupt handler should be as fast as possible. Therefore switch to readl_relaxed. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] rc: meson-ir: switch to managed rc device allocation / registrationHeiner Kallweit2017-06-061-14/+4
| | | | | | | | | | Switch to the managed versions of rc_allocate_device/rc_register_device, thus simplifying the code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] rc: meson-ir: make use of the bitfield macrosHeiner Kallweit2017-06-061-12/+12
| | | | | | | | | | | | | | | | | Make use of the bitfield macros thus partially hiding the complexity of dealing with bitfields. The patch also includes a minor fix to REG0_RATE_MASK, so far it was set to bit 0..10, but according to the spec it's bit 0..11. [mchehab@s-opensource.com: readd REG1_MODE_SHIFT and REG2_MODE_SHIFT that got removed on the original patch, as this will be used on another patch] Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] rc: meson-ir: remove irq from struct meson_irHeiner Kallweit2017-06-061-6/+5
| | | | | | | | | The irq number is used in the probe function only, therefore just use a local variable. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] rc-main: assign driver type during allocationAndi Shyti2017-01-301-2/+1
| | | | | | | | | | | | | | | | | | | The driver type can be assigned immediately when an RC device requests to the framework to allocate the device. This is an 'enum rc_driver_type' data type and specifies whether the device is a raw receiver or scancode receiver. The type will be given as parameter to the rc_allocate_device device. Change accordingly all the drivers calling rc_allocate_device() so that the device type is specified during the rc device allocation. Whenever the device type is not specified, it will be set as RC_DRIVER_SCANCODE which was the default '0' value. Suggested-by: Sean Young <sean@mess.org> Signed-off-by: Andi Shyti <andi.shyti@samsung.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] rc: raw IR drivers cannot handle cec, unknown or otherSean Young2017-01-301-1/+1
| | | | | | | | | | | | unknown and other are for IR protocols for which we have no decoder, so the raw IR drivers have no chance of generating them. cec is not an IR protocol. Signed-off-by: Sean Young <sean@mess.org> Cc: Jiri Kosina <jikos@kernel.org> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com> Cc: Bruno Prémont <bonbons@linux-vserver.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] rc: meson-ir: Fix module autoloadJavier Martinez Canillas2016-11-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If the driver is built as a module, autoload won't work because the module alias information is not filled. So user-space can't match the registered device with the corresponding module. Export the module alias information using the MODULE_DEVICE_TABLE() macro. Before this patch: $ modinfo drivers/media/rc/meson-ir.ko | grep alias $ After this patch: $ modinfo drivers/media/rc/meson-ir.ko | grep alias alias: of:N*T*Camlogic,meson-gxbb-irC* alias: of:N*T*Camlogic,meson-gxbb-ir alias: of:N*T*Camlogic,meson8b-irC* alias: of:N*T*Camlogic,meson8b-ir alias: of:N*T*Camlogic,meson6-irC* alias: of:N*T*Camlogic,meson6-ir Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Acked-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: rc: meson-ir: Add support for newer versions of the IR decoderNeil Armstrong2016-08-291-5/+24
| | | | | | | | | | | | | Newer SoCs (Meson 8b and GXBB) are using REG2 (offset 0x20) instead of REG1 to configure the decoder mode. This makes it necessary to introduce new bindings so the driver knows which register has to be used. Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Tested-by: Neil Armstrong <narmstrong@baylibre.com> Acked-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
* [media] media: rc: add driver for Amlogic Meson IR remote receiverBeniamino Galvani2014-11-261-0/+216
Amlogic Meson SoCs include a infrared remote control receiver that can operate in two modes: "NEC" mode in which the hardware decodes frames using the NEC IR protocol, and "general" mode in which the receiver simply reports the duration of pulses and spaces for software decoding. This is a driver for the IR receiver that implements software decoding of received frames. Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Acked-by: Carlo Caione <carlo@caione.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>