Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /* ir-sony-decoder.c - handle Sony IR Pulse/Space protocol
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (C) 2010 by David Härdeman <david@hardeman.nu>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <linux/bitrev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include "rc-core-priv.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #define SONY_UNIT		600 /* us */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #define SONY_HEADER_PULSE	(4 * SONY_UNIT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #define	SONY_HEADER_SPACE	(1 * SONY_UNIT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define SONY_BIT_0_PULSE	(1 * SONY_UNIT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #define SONY_BIT_1_PULSE	(2 * SONY_UNIT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #define SONY_BIT_SPACE		(1 * SONY_UNIT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define SONY_TRAILER_SPACE	(10 * SONY_UNIT) /* minimum */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) enum sony_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	STATE_INACTIVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	STATE_HEADER_SPACE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	STATE_BIT_PULSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	STATE_BIT_SPACE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	STATE_FINISHED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * ir_sony_decode() - Decode one Sony pulse or space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * @dev:	the struct rc_dev descriptor of the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * @ev:         the struct ir_raw_event descriptor of the pulse/space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * This function returns -EINVAL if the pulse violates the state machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	struct sony_dec *data = &dev->raw->sony;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	enum rc_proto protocol;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	u32 scancode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	u8 device, subdevice, function;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	if (!is_timing_event(ev)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 		if (ev.reset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 			data->state = STATE_INACTIVE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	if (!geq_margin(ev.duration, SONY_UNIT, SONY_UNIT / 2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	dev_dbg(&dev->dev, "Sony decode started at state %d (%uus %s)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		data->state, ev.duration, TO_STR(ev.pulse));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	switch (data->state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	case STATE_INACTIVE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		if (!ev.pulse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		if (!eq_margin(ev.duration, SONY_HEADER_PULSE, SONY_UNIT / 2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		data->count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		data->state = STATE_HEADER_SPACE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	case STATE_HEADER_SPACE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		if (ev.pulse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		if (!eq_margin(ev.duration, SONY_HEADER_SPACE, SONY_UNIT / 2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		data->state = STATE_BIT_PULSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	case STATE_BIT_PULSE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		if (!ev.pulse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		data->bits <<= 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		if (eq_margin(ev.duration, SONY_BIT_1_PULSE, SONY_UNIT / 2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 			data->bits |= 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		else if (!eq_margin(ev.duration, SONY_BIT_0_PULSE, SONY_UNIT / 2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		data->count++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		data->state = STATE_BIT_SPACE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	case STATE_BIT_SPACE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		if (ev.pulse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		if (!geq_margin(ev.duration, SONY_BIT_SPACE, SONY_UNIT / 2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		decrease_duration(&ev, SONY_BIT_SPACE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		if (!geq_margin(ev.duration, SONY_UNIT, SONY_UNIT / 2)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 			data->state = STATE_BIT_PULSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 			return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		data->state = STATE_FINISHED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		fallthrough;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	case STATE_FINISHED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		if (ev.pulse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		if (!geq_margin(ev.duration, SONY_TRAILER_SPACE, SONY_UNIT / 2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		switch (data->count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 		case 12:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 			if (!(dev->enabled_protocols & RC_PROTO_BIT_SONY12))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 				goto finish_state_machine;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 			device    = bitrev8((data->bits <<  3) & 0xF8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 			subdevice = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 			function  = bitrev8((data->bits >>  4) & 0xFE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 			protocol = RC_PROTO_SONY12;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		case 15:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			if (!(dev->enabled_protocols & RC_PROTO_BIT_SONY15))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 				goto finish_state_machine;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 			device    = bitrev8((data->bits >>  0) & 0xFF);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 			subdevice = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 			function  = bitrev8((data->bits >>  7) & 0xFE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 			protocol = RC_PROTO_SONY15;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		case 20:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 			if (!(dev->enabled_protocols & RC_PROTO_BIT_SONY20))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 				goto finish_state_machine;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 			device    = bitrev8((data->bits >>  5) & 0xF8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 			subdevice = bitrev8((data->bits >>  0) & 0xFF);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 			function  = bitrev8((data->bits >> 12) & 0xFE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 			protocol = RC_PROTO_SONY20;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 			dev_dbg(&dev->dev, "Sony invalid bitcount %u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 				data->count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 		scancode = device << 16 | subdevice << 8 | function;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		dev_dbg(&dev->dev, "Sony(%u) scancode 0x%05x\n", data->count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 			scancode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		rc_keydown(dev, protocol, scancode, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 		goto finish_state_machine;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	dev_dbg(&dev->dev, "Sony decode failed at state %d (%uus %s)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 		data->state, ev.duration, TO_STR(ev.pulse));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	data->state = STATE_INACTIVE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) finish_state_machine:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	data->state = STATE_INACTIVE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) static const struct ir_raw_timings_pl ir_sony_timings = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	.header_pulse  = SONY_HEADER_PULSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	.bit_space     = SONY_BIT_SPACE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	.bit_pulse[0]  = SONY_BIT_0_PULSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	.bit_pulse[1]  = SONY_BIT_1_PULSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	.trailer_space = SONY_TRAILER_SPACE + SONY_BIT_SPACE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	.msb_first     = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)  * ir_sony_encode() - Encode a scancode as a stream of raw events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)  * @protocol:	protocol to encode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)  * @scancode:	scancode to encode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)  * @events:	array of raw ir events to write into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)  * @max:	maximum size of @events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)  * Returns:	The number of events written.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  *		-ENOBUFS if there isn't enough space in the array to fit the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)  *		encoding. In this case all @max events will have been written.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) static int ir_sony_encode(enum rc_proto protocol, u32 scancode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 			  struct ir_raw_event *events, unsigned int max)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	struct ir_raw_event *e = events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	u32 raw, len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	if (protocol == RC_PROTO_SONY12) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		raw = (scancode & 0x7f) | ((scancode & 0x1f0000) >> 9);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 		len = 12;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	} else if (protocol == RC_PROTO_SONY15) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		raw = (scancode & 0x7f) | ((scancode & 0xff0000) >> 9);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 		len = 15;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 		raw = (scancode & 0x7f) | ((scancode & 0x1f0000) >> 9) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		       ((scancode & 0xff00) << 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		len = 20;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	ret = ir_raw_gen_pl(&e, max, &ir_sony_timings, len, raw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	return e - events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) static struct ir_raw_handler sony_handler = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	.protocols	= RC_PROTO_BIT_SONY12 | RC_PROTO_BIT_SONY15 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 							RC_PROTO_BIT_SONY20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	.decode		= ir_sony_decode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	.encode		= ir_sony_encode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	.carrier	= 40000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	.min_timeout	= SONY_TRAILER_SPACE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) static int __init ir_sony_decode_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	ir_raw_handler_register(&sony_handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	printk(KERN_INFO "IR Sony protocol handler initialized\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) static void __exit ir_sony_decode_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	ir_raw_handler_unregister(&sony_handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) module_init(ir_sony_decode_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) module_exit(ir_sony_decode_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) MODULE_AUTHOR("David Härdeman <david@hardeman.nu>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) MODULE_DESCRIPTION("Sony IR protocol decoder");