1 /*drivers/cir/bu92747guw_cir.h - driver for bu92747guw
3 * Copyright (C) 2010 ROCKCHIP, Inc.
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #ifndef _DRIVERS_CIR_BU92747GUW_CIR_H
16 #define _DRIVERS_CIR_BU92747GUW_CIR_H
18 #include <linux/ioctl.h>
20 /* irda registers addr */
21 #define REG_TXD_ADDR 0
22 #define REG_RXD_ADDR 0
23 #define REG_IER_ADDR 2
24 #define REG_EIR_ADDR 4
25 #define REG_MCR_ADDR 6
26 #define REG_PWR_FIT_ADDR 8
27 #define REG_TRCR_ADDR 10
28 #define REG_FTLV_ADDR 12
29 #define REG_FLV_ADDR 14
30 #define REG_FLVII_ADDR 16
31 #define REG_FLVIII_ADDR 18
32 #define REG_FLVIV_ADDR 20
33 #define REG_TRCRII_ADDR 22
34 #define REG_TXEC_ADDR 24
35 #define REG_WREC_ADDR 26
38 #define REG_SETTING0 0x00
39 #define REG_SETTING1 0x01
41 #define REG_BASE_CLOCK 0X02
53 #define REG_D0LO1 0x0b
54 #define REG_D0LO0 0x0c
55 #define REG_D0HI1 0x0d
56 #define REG_D0HI0 0x0e
58 #define REG_D1LO1 0x0f
59 #define REG_D1LO0 0x10
60 #define REG_D1HI1 0x11
61 #define REG_D1HI0 0x12
63 #define REG_ENDLEN1 0x13
64 #define REG_ENDLEN0 0x14
65 #define REG_BITLEN 0x15
66 #define REG_FRMLEN1 0x16
67 #define REG_REMLEN0 0x17
79 #define REG_OUT10 0x22
80 #define REG_OUT11 0x23
81 #define REG_OUT12 0x24
82 #define REG_OUT13 0x25
83 #define REG_OUT14 0x26
84 #define REG_OUT15 0x27
92 #define REG0_OPM (1<<5)
93 #define REG0_DIVS (1<<4)
94 #define REG0_IRQE (1<<3)
95 #define REG0_INV1 (1<<2)
96 #define REG0_INV0 (1<<1)
97 #define REG0_PWR (1<<0)
99 #define REG1_FRMB (1<<5)
100 #define REG1_FRME (1<<4)
101 #define REG1_RPT (1<<0)
103 #define ul64 unsigned long long
104 struct rk29_cir_struct_info {
105 u16 carry_high; // carry_high
106 u16 carry_low; // carry_low
108 u16 repeat; // ÊÇ·ñÊÇ Öظ´Ö¡
109 u8 inv; //00 01 10 11 Lsb->inv0
110 u8 frame_bit_len; // ÃüÁîÖ¡ÓÐЧλÊý
112 u16 stop_bit_interval; // period of end part NEC-560us
114 ul64 frame; // ÃüÁîÖ¡ LSB->MSB
115 u32 frame_interval; // frame interval NEC-108000s
117 u16 head_burst_time; //pan-3360us(USA) or 3680(Europe)¡¢ nec-9000¡¢ sharp-0¡¢ sony-600us
118 u16 head_space_time; //pan-6720us(USA) or 7360(Europe)¡¢ nec-450us¡¢sharp-0¡¢ sony-3000us
120 u16 logic_high_burst_time; //pan-840us(USA) or 508(Europe)¡¢ nec-560¡¢ sharp-320¡¢ sony-1200us // logic 1 burst time
121 u16 logic_high_space_time; //pan-3360us(USA) or 3680(Europe)¡¢ nec-1690¡¢ sharp-2000¡¢ sony-1800 // logic 1 time
123 u16 logic_low_burst_time; //pan-840us(USA) or 508(Europe)¡¢ nec-560¡¢ sharp-320¡¢ sony-600us // logic 0 burst time
124 u16 logic_low_space_time; //pan-1680us(USA) or 1816(Europe)¡¢ nec-560¡¢ sharp-1000¡¢ sony-1200 // logic 0 time
128 #define CIR_FRAME_SIZE sizeof(struct rk29_cir_struct_info)
130 #define BU92747IO 'B'
132 /* IOCTLs for BU92747*/
134 #define BU92747_IOCTL_STOP _IO(BU92747IO, 0x01)
135 #define BU92747_IOCTL_START _IO(BU92747IO, 0x02)
136 #define BU92747_IOCTL_SET_FORMAT _IOW(BU92747IO, 0x04, char[CIR_FRAME_SIZE])
137 #define BU92747_IOCTL_SEND_DATA _IOW(BU92747IO, 0x08, char[CIR_FRAME_SIZE])
140 #define BU92747_IOCTL_STOP _IO(BU92747IO, 0x01)
141 #define BU92747_IOCTL_START _IO(BU92747IO, 0x02)
142 #define BU92747_IOCTL_CARRIER _IOW(BU92747IO, 0x04, char[CIR_FRAME_SIZE])
143 #define BU92747_IOCTL_DATA _IOW(BU92747IO, 0x06, char[CIR_FRAME_SIZE])
144 #define BU92747_IOCTL_PULSE _IOW(BU92747IO, 0x08, char[CIR_FRAME_SIZE])
145 #define BU92747_IOCTL_REPEAT _IOW(BU92747IO, 0x0A, char[CIR_FRAME_SIZE])
146 #define BU92747_IOCTL_DURATION _IOW(BU92747IO, 0x0C, char[CIR_FRAME_SIZE])
147 #define BU92747_IOCTL_PARAMETER _IOW(BU92747IO, 0x0E, char[CIR_FRAME_SIZE])
148 #define BU92747_IOCTL_FORMATE _IOW(BU92747IO, 0x0F, char[CIR_FRAME_SIZE])
152 #define BU92747_STOP 4
153 #define BU92747_BUSY 3
154 #define BU92747_SUSPEND 2
155 #define BU92747_OPEN 1
156 #define BU92747_CLOSE 0
158 struct bu92747guw_platform_data {
160 int (*iomux_init)(void);
161 int (*iomux_deinit)(void);
162 int (*cir_pwr_ctl)(int en);
165 #endif /*_DRIVERS_CIR_BU92747GUW_CIR_H*/