~ubuntu-branches/ubuntu/karmic/linux-fsl-imx51/karmic

« back to all changes in this revision

Viewing changes to ubuntu/lirc/lirc_ene0100/lirc_ene0100.h

  • Committer: Bazaar Package Importer
  • Author(s): Andy Whitcroft, Andy Whitcroft, Upstream Kernel Changes, Ubuntu: 2.6.31-14.46, Ubuntu: 2.6.31-13.45, Ubuntu: 2.6.31-13.44
  • Date: 2009-10-13 15:59:33 UTC
  • Revision ID: james.westby@ubuntu.com-20091013155933-hxzquigs9nqajd9x
Tags: 2.6.31-105.14
[ Andy Whitcroft ]

* rebase to Ubuntu-2.6.31-14.46
* [Config] update configs since rebase to Ubuntu-2.6.31-14.46
* lirc update dropped module lirc_mceusb2

[ Upstream Kernel Changes ]

* mxc spi: fix spi driver for 2.6.31
  - LP: #427289, #446140

[ Ubuntu: 2.6.31-14.46 ]

* reinstate armel.mk with no flavours
  - LP: #449637
* [Upstream] elevator: fix fastfail checks to allow merge of readahead
  requests
  - LP: #444915
* [Upstream] block: silently error unsupported empty barriers too
  - LP: #420423
* SAUCE: AppArmor: Fix mediation of "deleted" paths
  - LP: #415632
* [Config] CONFIG_X86_MCE
  https://lists.ubuntu.com/archives/kernel-team/2009-October/007584.html
* Revert "appletalk: Fix skb leak when ipddp interface is not loaded,
  CVE-2009-2903" - Use patch from 2.6.31.4 which is slightly different.
* x86: fix csum_ipv6_magic asm memory clobber
* tty: Avoid dropping ldisc_mutex over hangup tty re-initialization
* x86: Don't leak 64-bit kernel register values to 32-bit processes
* tracing: correct module boundaries for ftrace_release
* ftrace: check for failure for all conversions
* futex: fix requeue_pi key imbalance
* futex: Move exit_pi_state() call to release_mm()
* futex: Nullify robust lists after cleanup
* futex: Fix locking imbalance
* NOHZ: update idle state also when NOHZ is inactive
* ima: ecryptfs fix imbalance message
* libata: fix incorrect link online check during probe
* sound: via82xx: move DXS volume controls to PCM interface
* ASoC: WM8350 capture PGA mutes are inverted
* KVM: Prevent overflow in KVM_GET_SUPPORTED_CPUID
* KVM: VMX: flush TLB with INVEPT on cpu migration
* KVM: fix LAPIC timer period overflow
* KVM: SVM: Fix tsc offset adjustment when running nested
* KVM: SVM: Handle tsc in svm_get_msr/svm_set_msr correctly
* net: Fix wrong sizeof
* mm: add_to_swap_cache() must not sleep
* sis5513: fix PIO setup for ATAPI devices
* PIT fixes to unbreak suspend/resume (bug #14222)
* IMA: open new file for read
* ACPI: Clarify resource conflict message
* ACPI: fix Compaq Evo N800c (Pentium 4m) boot hang regression
* net: restore tx timestamping for accelerated vlans
* net: unix: fix sending fds in multiple buffers
* tun: Return -EINVAL if neither IFF_TUN nor IFF_TAP is set.
* tcp: fix CONFIG_TCP_MD5SIG + CONFIG_PREEMPT timer BUG()
* net: Fix sock_wfree() race
* smsc95xx: fix transmission where ZLP is expected
* sky2: Set SKY2_HW_RAM_BUFFER in sky2_init
* appletalk: Fix skb leak when ipddp interface is not loaded
* ax25: Fix possible oops in ax25_make_new
* ax25: Fix SIOCAX25GETINFO ioctl
* sit: fix off-by-one in ipip6_tunnel_get_prl
* Linux 2.6.31.4
* drm/i915: Fix FDI M/N setting according with correct color depth
  - LP: #416792

[ Ubuntu: 2.6.31-13.45 ]

* [Config] Add sd_mod to scsi-modules udeb for powerpc
* SAUCE: Update to LIRC 0.8.6
  - LP: #432678
* [Config] CONFIG_X86_PAT=y
  https://lists.ubuntu.com/archives/kernel-team/2009-October/007477.html
  https://lists.ubuntu.com/archives/kernel-team/2009-October/007534.html
* [Config] Add armel arch to linux-libc-dev arches.
  - LP: #449637
* e1000e: swap max hw supported frame size between 82574 and 82583
* drm/i915: Initialize HDMI outputs as HDMI connectors, not DVI.
  - LP: #392017
* ALSA: hda - Add quirks for some HP laptops
  - LP: #449742
* ALSA: hda - Add support for HP dv6
  - LP: #449742

[ Ubuntu: 2.6.31-13.44 ]

* sgi-gru: Fix kernel stack buffer overrun, CVE-2009-2584
* appletalk: Fix skb leak when ipddp interface is not loaded,
  CVE-2009-2903
  Note - This patch causes an ABI change in the symbol aarp_send_ddp
  which I'm ignoring.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * driver for ENE KB3926 B/C/D CIR (also known as ENE0100)
 
3
 *
 
4
 * Copyright (C) 2009 Maxim Levitsky <maximlevitsky@gmail.com>
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU General Public License as
 
8
 * published by the Free Software Foundation; either version 2 of the
 
9
 * License, or (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful, but
 
12
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
19
 * USA
 
20
 */
 
21
 
 
22
#include "../kcompat.h"
 
23
#include "../lirc.h"
 
24
#include "../lirc_dev/lirc_dev.h"
 
25
 
 
26
/* hardware address */
 
27
#define ENE_STATUS              0        /* hardware status - unused */
 
28
#define ENE_ADDR_HI             1        /* hi byte of register address */
 
29
#define ENE_ADDR_LO             2        /* low byte of register address */
 
30
#define ENE_IO                  3        /* read/write window */
 
31
#define ENE_MAX_IO              4
 
32
 
 
33
/* 8 bytes of samples, divided in 2 halfs*/
 
34
#define ENE_SAMPLE_BUFFER       0xF8F0   /* regular sample buffer */
 
35
#define ENE_SAMPLE_SPC_MASK     (1 << 7) /* sample is space */
 
36
#define ENE_SAMPLE_VALUE_MASK   0x7F
 
37
#define ENE_SAMPLE_OVERFLOW     0x7F
 
38
#define ENE_SAMPLES_SIZE        4
 
39
 
 
40
/* fan input sample buffer */
 
41
#define ENE_SAMPLE_BUFFER_FAN   0xF8FB   /* this buffer holds high byte of */
 
42
                                         /* each sample of normal buffer */
 
43
 
 
44
#define ENE_FAN_SMPL_PULS_MSK   0x8000   /* this bit of combined sample */
 
45
                                         /* if set, says that sample is pulse */
 
46
#define ENE_FAN_VALUE_MASK      0x0FFF   /* mask for valid bits of the value */
 
47
 
 
48
/* first firmware register */
 
49
#define ENE_FW1                 0xF8F8
 
50
#define ENE_FW1_ENABLE          (1 << 0) /* enable fw processing */
 
51
#define ENE_FW1_TXIRQ           (1 << 1) /* TX interrupt pending */
 
52
#define ENE_FW1_WAKE            (1 << 6) /* enable wake from S3 */
 
53
#define ENE_FW1_IRQ             (1 << 7) /* enable interrupt */
 
54
 
 
55
/* second firmware register */
 
56
#define ENE_FW2                 0xF8F9
 
57
#define ENE_FW2_BUF_HIGH        (1 << 0) /* which half of the buffer to read */
 
58
#define ENE_FW2_IRQ_CLR         (1 << 2) /* clear this on IRQ */
 
59
#define ENE_FW2_GP40_AS_LEARN   (1 << 4) /* normal input is used as */
 
60
                                         /* learning input */
 
61
#define ENE_FW2_FAN_AS_NRML_IN  (1 << 6) /* fan is used as normal input */
 
62
#define ENE_FW2_LEARNING        (1 << 7) /* hardware supports learning and TX */
 
63
 
 
64
/* fan as input settings - only if learning capable */
 
65
#define ENE_FAN_AS_IN1          0xFE30   /* fan init reg 1 */
 
66
#define ENE_FAN_AS_IN1_EN       0xCD
 
67
#define ENE_FAN_AS_IN2          0xFE31   /* fan init reg 2 */
 
68
#define ENE_FAN_AS_IN2_EN       0x03
 
69
#define ENE_SAMPLE_PERIOD_FAN   61       /* fan input has fixed sample period */
 
70
 
 
71
/* IRQ registers block (for revision B) */
 
72
#define ENEB_IRQ                0xFD09   /* IRQ number */
 
73
#define ENEB_IRQ_UNK1           0xFD17   /* unknown setting = 1 */
 
74
#define ENEB_IRQ_STATUS         0xFD80   /* irq status */
 
75
#define ENEB_IRQ_STATUS_IR      (1 << 5) /* IR irq */
 
76
 
 
77
/* IRQ registers block (for revision C,D) */
 
78
#define ENEC_IRQ                0xFE9B   /* new irq settings register */
 
79
#define ENEC_IRQ_MASK           0x0F     /* irq number mask */
 
80
#define ENEC_IRQ_UNK_EN         (1 << 4) /* always enabled */
 
81
#define ENEC_IRQ_STATUS         (1 << 5) /* irq status and ACK */
 
82
 
 
83
/* CIR block settings */
 
84
#define ENE_CIR_CONF1           0xFEC0
 
85
#define ENE_CIR_CONF1_ADC_ON    0x7      /* reciever on gpio40 enabled */
 
86
#define ENE_CIR_CONF1_LEARN1    (1 << 3) /* enabled on learning mode */
 
87
#define ENE_CIR_CONF1_TX_ON     0x30     /* enabled on transmit */
 
88
#define ENE_CIR_CONF1_TX_CARR   (1 << 7) /* send TX carrier or not */
 
89
 
 
90
#define ENE_CIR_CONF2           0xFEC1   /* unknown setting = 0 */
 
91
#define ENE_CIR_CONF2_LEARN2    (1 << 4) /* set on enable learning */
 
92
#define ENE_CIR_CONF2_GPIO40DIS (1 << 5) /* disable normal input via gpio40 */
 
93
 
 
94
#define ENE_CIR_SAMPLE_PERIOD   0xFEC8   /* sample period in us */
 
95
#define ENE_CIR_SAMPLE_OVERFLOW (1 << 7) /* interrupt on overflows if set */
 
96
 
 
97
 
 
98
/* transmitter - not implemented yet */
 
99
/* KB3926C and higher */
 
100
/* transmission is very similiar to recieving, a byte is written to */
 
101
/* ENE_TX_INPUT, in same manner as it is read from sample buffer */
 
102
/* sample period is fixed*/
 
103
 
 
104
 
 
105
/* transmitter ports */
 
106
#define ENE_TX_PORT1            0xFC01   /* this enables one or both */
 
107
#define ENE_TX_PORT1_EN         (1 << 5) /* TX ports */
 
108
#define ENE_TX_PORT2            0xFC08
 
109
#define ENE_TX_PORT2_EN         (1 << 1)
 
110
 
 
111
#define ENE_TX_INPUT            0xFEC9   /* next byte to transmit */
 
112
#define ENE_TX_SPC_MASK         (1 << 7) /* Transmitted sample is space */
 
113
#define ENE_TX_UNK1             0xFECB   /* set to 0x63 */
 
114
#define ENE_TX_SMPL_PERIOD      50       /* transmit sample period */
 
115
 
 
116
 
 
117
#define ENE_TX_CARRIER          0xFECE   /* TX carrier * 2 (khz) */
 
118
#define ENE_TX_CARRIER_UNKBIT   0x80     /* This bit set on transmit */
 
119
#define ENE_TX_CARRIER_LOW      0xFECF   /* TX carrier / 2 */
 
120
 
 
121
/* Hardware versions */
 
122
#define ENE_HW_VERSION          0xFF00   /* hardware revision */
 
123
#define ENE_HW_UNK              0xFF1D
 
124
#define ENE_HW_UNK_CLR          (1 << 2)
 
125
#define ENE_HW_VER_MAJOR        0xFF1E   /* chip version */
 
126
#define ENE_HW_VER_MINOR        0xFF1F
 
127
#define ENE_HW_VER_OLD          0xFD00
 
128
 
 
129
#define same_sign(a, b) ((((a) > 0) && (b) > 0) || ((a) < 0 && (b) < 0))
 
130
 
 
131
#define ENE_DRIVER_NAME         "enecir"
 
132
#define ENE_MAXGAP              250000   /* this is amount of time we wait
 
133
                                         before turning the sampler, chosen
 
134
                                         arbitry */
 
135
 
 
136
#define space(len)             (-(len))  /* add a space */
 
137
 
 
138
/* software defines */
 
139
#define ENE_IRQ_RX              1
 
140
#define ENE_IRQ_TX              2
 
141
 
 
142
#define  ENE_HW_B               1       /* 3926B */
 
143
#define  ENE_HW_C               2       /* 3926C */
 
144
#define  ENE_HW_D               3       /* 3926D */
 
145
 
 
146
#define ene_printk(level, text, ...) \
 
147
        printk(level ENE_DRIVER_NAME ": " text, ## __VA_ARGS__)
 
148
 
 
149
struct ene_device {
 
150
        struct pnp_dev *pnp_dev;
 
151
        struct lirc_driver *lirc_driver;
 
152
 
 
153
        /* hw settings */
 
154
        unsigned long hw_io;
 
155
        int irq;
 
156
 
 
157
        int hw_revision;                        /* hardware revision */
 
158
        int hw_learning_and_tx_capable;         /* learning capable */
 
159
        int hw_gpio40_learning;                 /* gpio40 is learning */
 
160
        int hw_fan_as_normal_input;     /* fan input is used as regular input */
 
161
 
 
162
        /* device data */
 
163
        int idle;
 
164
        int fan_input_inuse;
 
165
 
 
166
        int sample;
 
167
        int in_use;
 
168
 
 
169
        struct timeval gap_start;
 
170
};