// SPDX-License-Identifier: GPL-2.0-only /* ir-sharp-decoder.c - handle Sharp IR Pulse/Space protocol * * Copyright (C) 2013-2014 Imagination Technologies Ltd. * * Based on NEC decoder: * Copyright (C) 2010 by Mauro Carvalho Chehab */ #include <linux/bitrev.h> #include <linux/module.h> #include "rc-core-priv.h" #define SHARP_NBITS … #define SHARP_UNIT … #define SHARP_BIT_PULSE … #define SHARP_BIT_0_PERIOD … #define SHARP_BIT_1_PERIOD … #define SHARP_BIT_0_SPACE … #define SHARP_BIT_1_SPACE … #define SHARP_ECHO_SPACE … #define SHARP_TRAILER_SPACE … enum sharp_state { … }; /** * ir_sharp_decode() - Decode one Sharp pulse or space * @dev: the struct rc_dev descriptor of the device * @ev: the struct ir_raw_event descriptor of the pulse/space * * This function returns -EINVAL if the pulse violates the state machine */ static int ir_sharp_decode(struct rc_dev *dev, struct ir_raw_event ev) { … } static const struct ir_raw_timings_pd ir_sharp_timings = …; /** * ir_sharp_encode() - Encode a scancode as a stream of raw events * * @protocol: protocol to encode * @scancode: scancode to encode * @events: array of raw ir events to write into * @max: maximum size of @events * * Returns: The number of events written. * -ENOBUFS if there isn't enough space in the array to fit the * encoding. In this case all @max events will have been written. */ static int ir_sharp_encode(enum rc_proto protocol, u32 scancode, struct ir_raw_event *events, unsigned int max) { … } static struct ir_raw_handler sharp_handler = …; static int __init ir_sharp_decode_init(void) { … } static void __exit ir_sharp_decode_exit(void) { … } module_init(…) …; module_exit(ir_sharp_decode_exit); MODULE_LICENSE(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …;