// SPDX-License-Identifier: GPL-2.0 // ir-sanyo-decoder.c - handle SANYO IR Pulse/Space protocol // // Copyright (C) 2011 by Mauro Carvalho Chehab // // This protocol uses the NEC protocol timings. However, data is formatted as: // 13 bits Custom Code // 13 bits NOT(Custom Code) // 8 bits Key data // 8 bits NOT(Key data) // // According with LIRC, this protocol is used on Sanyo, Aiwa and Chinon // Information for this protocol is available at the Sanyo LC7461 datasheet. #include <linux/module.h> #include <linux/bitrev.h> #include "rc-core-priv.h" #define SANYO_NBITS … #define SANYO_UNIT … #define SANYO_HEADER_PULSE … #define SANYO_HEADER_SPACE … #define SANYO_BIT_PULSE … #define SANYO_BIT_0_SPACE … #define SANYO_BIT_1_SPACE … #define SANYO_REPEAT_SPACE … #define SANYO_TRAILER_PULSE … #define SANYO_TRAILER_SPACE … enum sanyo_state { … }; /** * ir_sanyo_decode() - Decode one SANYO 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_sanyo_decode(struct rc_dev *dev, struct ir_raw_event ev) { … } static const struct ir_raw_timings_pd ir_sanyo_timings = …; /** * ir_sanyo_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_sanyo_encode(enum rc_proto protocol, u32 scancode, struct ir_raw_event *events, unsigned int max) { … } static struct ir_raw_handler sanyo_handler = …; static int __init ir_sanyo_decode_init(void) { … } static void __exit ir_sanyo_decode_exit(void) { … } module_init(…) …; module_exit(ir_sanyo_decode_exit); MODULE_LICENSE(…) …; MODULE_AUTHOR(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …;