Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
winbond-cir.c File Reference
#include <linux/module.h>
#include <linux/pnp.h>
#include <linux/interrupt.h>
#include <linux/timer.h>
#include <linux/leds.h>
#include <linux/spinlock.h>
#include <linux/pci_ids.h>
#include <linux/io.h>
#include <linux/bitrev.h>
#include <linux/slab.h>
#include <linux/wait.h>
#include <linux/sched.h>
#include <media/rc-core.h>

Go to the source code of this file.

Data Structures

struct  wbcir_data
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define DRVNAME   "winbond-cir"
 
#define WBCIR_REG_WCEIR_CTL   0x03 /* CEIR Receiver Control */
 
#define WBCIR_REG_WCEIR_STS   0x04 /* CEIR Receiver Status */
 
#define WBCIR_REG_WCEIR_EV_EN   0x05 /* CEIR Receiver Event Enable */
 
#define WBCIR_REG_WCEIR_CNTL   0x06 /* CEIR Receiver Counter Low */
 
#define WBCIR_REG_WCEIR_CNTH   0x07 /* CEIR Receiver Counter High */
 
#define WBCIR_REG_WCEIR_INDEX   0x08 /* CEIR Receiver Index */
 
#define WBCIR_REG_WCEIR_DATA   0x09 /* CEIR Receiver Data */
 
#define WBCIR_REG_WCEIR_CSL   0x0A /* CEIR Re. Compare Strlen */
 
#define WBCIR_REG_WCEIR_CFG1   0x0B /* CEIR Re. Configuration 1 */
 
#define WBCIR_REG_WCEIR_CFG2   0x0C /* CEIR Re. Configuration 2 */
 
#define WBCIR_REG_ECEIR_CTS   0x00 /* Enhanced IR Control Status */
 
#define WBCIR_REG_ECEIR_CCTL   0x01 /* Infrared Counter Control */
 
#define WBCIR_REG_ECEIR_CNT_LO   0x02 /* Infrared Counter LSB */
 
#define WBCIR_REG_ECEIR_CNT_HI   0x03 /* Infrared Counter MSB */
 
#define WBCIR_REG_ECEIR_IREM   0x04 /* Infrared Emitter Status */
 
#define WBCIR_REG_SP3_BSR   0x03 /* Bank Select, all banks */
 
#define WBCIR_REG_SP3_RXDATA   0x00 /* FIFO RX data (r) */
 
#define WBCIR_REG_SP3_TXDATA   0x00 /* FIFO TX data (w) */
 
#define WBCIR_REG_SP3_IER   0x01 /* Interrupt Enable */
 
#define WBCIR_REG_SP3_EIR   0x02 /* Event Identification (r) */
 
#define WBCIR_REG_SP3_FCR   0x02 /* FIFO Control (w) */
 
#define WBCIR_REG_SP3_MCR   0x04 /* Mode Control */
 
#define WBCIR_REG_SP3_LSR   0x05 /* Link Status */
 
#define WBCIR_REG_SP3_MSR   0x06 /* Modem Status */
 
#define WBCIR_REG_SP3_ASCR   0x07 /* Aux Status and Control */
 
#define WBCIR_REG_SP3_BGDL   0x00 /* Baud Divisor LSB */
 
#define WBCIR_REG_SP3_BGDH   0x01 /* Baud Divisor MSB */
 
#define WBCIR_REG_SP3_EXCR1   0x02 /* Extended Control 1 */
 
#define WBCIR_REG_SP3_EXCR2   0x04 /* Extended Control 2 */
 
#define WBCIR_REG_SP3_TXFLV   0x06 /* TX FIFO Level */
 
#define WBCIR_REG_SP3_RXFLV   0x07 /* RX FIFO Level */
 
#define WBCIR_REG_SP3_MRID   0x00 /* Module Identification */
 
#define WBCIR_REG_SP3_SH_LCR   0x01 /* LCR Shadow */
 
#define WBCIR_REG_SP3_SH_FCR   0x02 /* FCR Shadow */
 
#define WBCIR_REG_SP3_IRCR1   0x02 /* Infrared Control 1 */
 
#define WBCIR_REG_SP3_IRCR2   0x04 /* Infrared Control 2 */
 
#define WBCIR_REG_SP3_IRCR3   0x00 /* Infrared Control 3 */
 
#define WBCIR_REG_SP3_SIR_PW   0x02 /* SIR Pulse Width */
 
#define WBCIR_REG_SP3_IRRXDC   0x00 /* IR RX Demod Control */
 
#define WBCIR_REG_SP3_IRTXMC   0x01 /* IR TX Mod Control */
 
#define WBCIR_REG_SP3_RCCFG   0x02 /* CEIR Config */
 
#define WBCIR_REG_SP3_IRCFG1   0x04 /* Infrared Config 1 */
 
#define WBCIR_REG_SP3_IRCFG4   0x07 /* Infrared Config 4 */
 
#define WBCIR_IRQ_NONE   0x00
 
#define WBCIR_IRQ_RX   0x01
 
#define WBCIR_IRQ_TX_LOW   0x02
 
#define WBCIR_IRQ_ERR   0x04
 
#define WBCIR_IRQ_TX_EMPTY   0x20
 
#define WBCIR_LED_ENABLE   0x80
 
#define WBCIR_RX_AVAIL   0x01
 
#define WBCIR_RX_OVERRUN   0x02
 
#define WBCIR_TX_EOT   0x04
 
#define WBCIR_RX_DISABLE   0x20
 
#define WBCIR_TX_UNDERRUN   0x40
 
#define WBCIR_EXT_ENABLE   0x01
 
#define WBCIR_REGSEL_COMPARE   0x10
 
#define WBCIR_REGSEL_MASK   0x20
 
#define WBCIR_REG_ADDR0   0x00
 
#define WBCIR_NAME   "winbond-cir"
 
#define WBCIR_ID_FAMILY   0xF1 /* Family ID for the WPCD376I */
 
#define WBCIR_ID_CHIP   0x04 /* Chip ID for the WPCD376I */
 
#define INVALID_SCANCODE   0x7FFFFFFF /* Invalid with all protos */
 
#define WAKEUP_IOMEM_LEN   0x10 /* Wake-Up I/O Reg Len */
 
#define EHFUNC_IOMEM_LEN   0x10 /* Enhanced Func I/O Reg Len */
 
#define SP_IOMEM_LEN   0x08 /* Serial Port 3 (IR) Reg Len */
 

Enumerations

enum  wbcir_bank {
  WBCIR_BANK_0 = 0x00, WBCIR_BANK_1 = 0x80, WBCIR_BANK_2 = 0xE0, WBCIR_BANK_3 = 0xE4,
  WBCIR_BANK_4 = 0xE8, WBCIR_BANK_5 = 0xEC, WBCIR_BANK_6 = 0xF0, WBCIR_BANK_7 = 0xF4
}
 
enum  wbcir_protocol { IR_PROTOCOL_RC5 = 0x0, IR_PROTOCOL_NEC = 0x1, IR_PROTOCOL_RC6 = 0x2 }
 
enum  wbcir_rxstate { WBCIR_RXSTATE_INACTIVE = 0, WBCIR_RXSTATE_ACTIVE, WBCIR_RXSTATE_ERROR }
 
enum  wbcir_txstate { WBCIR_TXSTATE_INACTIVE = 0, WBCIR_TXSTATE_ACTIVE, WBCIR_TXSTATE_ERROR }
 

Functions

 module_param (protocol, uint, 0444)
 
 MODULE_PARM_DESC (protocol,"IR protocol to use for the power-on command ""(0 = RC5, 1 = NEC, 2 = RC6A, default)")
 
 module_param (invert, bool, 0444)
 
 MODULE_PARM_DESC (invert,"Invert the signal from the IR receiver")
 
 module_param (txandrx, bool, 0444)
 
 MODULE_PARM_DESC (txandrx,"Allow simultaneous TX and RX")
 
 module_param (wake_sc, uint, 0644)
 
 MODULE_PARM_DESC (wake_sc,"Scancode of the power-on IR command")
 
 module_param (wake_rc6mode, uint, 0644)
 
 MODULE_PARM_DESC (wake_rc6mode,"RC6 mode for the power-on command ""(0 = 0, 6 = 6A, default)")
 
 MODULE_DEVICE_TABLE (pnp, wbcir_ids)
 
 module_init (wbcir_init)
 
 module_exit (wbcir_exit)
 
 MODULE_AUTHOR ("David Härdeman <[email protected]>")
 
 MODULE_DESCRIPTION ("Winbond SuperI/O Consumer IR Driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define DRVNAME   "winbond-cir"

Definition at line 60 of file winbond-cir.c.

#define EHFUNC_IOMEM_LEN   0x10 /* Enhanced Func I/O Reg Len */

Definition at line 192 of file winbond-cir.c.

#define INVALID_SCANCODE   0x7FFFFFFF /* Invalid with all protos */

Definition at line 190 of file winbond-cir.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 44 of file winbond-cir.c.

#define SP_IOMEM_LEN   0x08 /* Serial Port 3 (IR) Reg Len */

Definition at line 193 of file winbond-cir.c.

#define WAKEUP_IOMEM_LEN   0x10 /* Wake-Up I/O Reg Len */

Definition at line 191 of file winbond-cir.c.

#define WBCIR_EXT_ENABLE   0x01

Definition at line 145 of file winbond-cir.c.

#define WBCIR_ID_CHIP   0x04 /* Chip ID for the WPCD376I */

Definition at line 189 of file winbond-cir.c.

#define WBCIR_ID_FAMILY   0xF1 /* Family ID for the WPCD376I */

Definition at line 188 of file winbond-cir.c.

#define WBCIR_IRQ_ERR   0x04

Definition at line 129 of file winbond-cir.c.

#define WBCIR_IRQ_NONE   0x00

Definition at line 123 of file winbond-cir.c.

#define WBCIR_IRQ_RX   0x01

Definition at line 125 of file winbond-cir.c.

#define WBCIR_IRQ_TX_EMPTY   0x20

Definition at line 131 of file winbond-cir.c.

#define WBCIR_IRQ_TX_LOW   0x02

Definition at line 127 of file winbond-cir.c.

#define WBCIR_LED_ENABLE   0x80

Definition at line 133 of file winbond-cir.c.

#define WBCIR_NAME   "winbond-cir"

Definition at line 187 of file winbond-cir.c.

#define WBCIR_REG_ADDR0   0x00

Definition at line 151 of file winbond-cir.c.

#define WBCIR_REG_ECEIR_CCTL   0x01 /* Infrared Counter Control */

Definition at line 76 of file winbond-cir.c.

#define WBCIR_REG_ECEIR_CNT_HI   0x03 /* Infrared Counter MSB */

Definition at line 78 of file winbond-cir.c.

#define WBCIR_REG_ECEIR_CNT_LO   0x02 /* Infrared Counter LSB */

Definition at line 77 of file winbond-cir.c.

#define WBCIR_REG_ECEIR_CTS   0x00 /* Enhanced IR Control Status */

Definition at line 75 of file winbond-cir.c.

#define WBCIR_REG_ECEIR_IREM   0x04 /* Infrared Emitter Status */

Definition at line 79 of file winbond-cir.c.

#define WBCIR_REG_SP3_ASCR   0x07 /* Aux Status and Control */

Definition at line 92 of file winbond-cir.c.

#define WBCIR_REG_SP3_BGDH   0x01 /* Baud Divisor MSB */

Definition at line 95 of file winbond-cir.c.

#define WBCIR_REG_SP3_BGDL   0x00 /* Baud Divisor LSB */

Definition at line 94 of file winbond-cir.c.

#define WBCIR_REG_SP3_BSR   0x03 /* Bank Select, all banks */

Definition at line 82 of file winbond-cir.c.

#define WBCIR_REG_SP3_EIR   0x02 /* Event Identification (r) */

Definition at line 87 of file winbond-cir.c.

#define WBCIR_REG_SP3_EXCR1   0x02 /* Extended Control 1 */

Definition at line 96 of file winbond-cir.c.

#define WBCIR_REG_SP3_EXCR2   0x04 /* Extended Control 2 */

Definition at line 97 of file winbond-cir.c.

#define WBCIR_REG_SP3_FCR   0x02 /* FIFO Control (w) */

Definition at line 88 of file winbond-cir.c.

#define WBCIR_REG_SP3_IER   0x01 /* Interrupt Enable */

Definition at line 86 of file winbond-cir.c.

#define WBCIR_REG_SP3_IRCFG1   0x04 /* Infrared Config 1 */

Definition at line 115 of file winbond-cir.c.

#define WBCIR_REG_SP3_IRCFG4   0x07 /* Infrared Config 4 */

Definition at line 116 of file winbond-cir.c.

#define WBCIR_REG_SP3_IRCR1   0x02 /* Infrared Control 1 */

Definition at line 105 of file winbond-cir.c.

#define WBCIR_REG_SP3_IRCR2   0x04 /* Infrared Control 2 */

Definition at line 107 of file winbond-cir.c.

#define WBCIR_REG_SP3_IRCR3   0x00 /* Infrared Control 3 */

Definition at line 109 of file winbond-cir.c.

#define WBCIR_REG_SP3_IRRXDC   0x00 /* IR RX Demod Control */

Definition at line 112 of file winbond-cir.c.

#define WBCIR_REG_SP3_IRTXMC   0x01 /* IR TX Mod Control */

Definition at line 113 of file winbond-cir.c.

#define WBCIR_REG_SP3_LSR   0x05 /* Link Status */

Definition at line 90 of file winbond-cir.c.

#define WBCIR_REG_SP3_MCR   0x04 /* Mode Control */

Definition at line 89 of file winbond-cir.c.

#define WBCIR_REG_SP3_MRID   0x00 /* Module Identification */

Definition at line 101 of file winbond-cir.c.

#define WBCIR_REG_SP3_MSR   0x06 /* Modem Status */

Definition at line 91 of file winbond-cir.c.

#define WBCIR_REG_SP3_RCCFG   0x02 /* CEIR Config */

Definition at line 114 of file winbond-cir.c.

#define WBCIR_REG_SP3_RXDATA   0x00 /* FIFO RX data (r) */

Definition at line 84 of file winbond-cir.c.

#define WBCIR_REG_SP3_RXFLV   0x07 /* RX FIFO Level */

Definition at line 99 of file winbond-cir.c.

#define WBCIR_REG_SP3_SH_FCR   0x02 /* FCR Shadow */

Definition at line 103 of file winbond-cir.c.

#define WBCIR_REG_SP3_SH_LCR   0x01 /* LCR Shadow */

Definition at line 102 of file winbond-cir.c.

#define WBCIR_REG_SP3_SIR_PW   0x02 /* SIR Pulse Width */

Definition at line 110 of file winbond-cir.c.

#define WBCIR_REG_SP3_TXDATA   0x00 /* FIFO TX data (w) */

Definition at line 85 of file winbond-cir.c.

#define WBCIR_REG_SP3_TXFLV   0x06 /* TX FIFO Level */

Definition at line 98 of file winbond-cir.c.

#define WBCIR_REG_WCEIR_CFG1   0x0B /* CEIR Re. Configuration 1 */

Definition at line 71 of file winbond-cir.c.

#define WBCIR_REG_WCEIR_CFG2   0x0C /* CEIR Re. Configuration 2 */

Definition at line 72 of file winbond-cir.c.

#define WBCIR_REG_WCEIR_CNTH   0x07 /* CEIR Receiver Counter High */

Definition at line 67 of file winbond-cir.c.

#define WBCIR_REG_WCEIR_CNTL   0x06 /* CEIR Receiver Counter Low */

Definition at line 66 of file winbond-cir.c.

#define WBCIR_REG_WCEIR_CSL   0x0A /* CEIR Re. Compare Strlen */

Definition at line 70 of file winbond-cir.c.

#define WBCIR_REG_WCEIR_CTL   0x03 /* CEIR Receiver Control */

Definition at line 63 of file winbond-cir.c.

#define WBCIR_REG_WCEIR_DATA   0x09 /* CEIR Receiver Data */

Definition at line 69 of file winbond-cir.c.

#define WBCIR_REG_WCEIR_EV_EN   0x05 /* CEIR Receiver Event Enable */

Definition at line 65 of file winbond-cir.c.

#define WBCIR_REG_WCEIR_INDEX   0x08 /* CEIR Receiver Index */

Definition at line 68 of file winbond-cir.c.

#define WBCIR_REG_WCEIR_STS   0x04 /* CEIR Receiver Status */

Definition at line 64 of file winbond-cir.c.

#define WBCIR_REGSEL_COMPARE   0x10

Definition at line 147 of file winbond-cir.c.

#define WBCIR_REGSEL_MASK   0x20

Definition at line 149 of file winbond-cir.c.

#define WBCIR_RX_AVAIL   0x01

Definition at line 135 of file winbond-cir.c.

#define WBCIR_RX_DISABLE   0x20

Definition at line 141 of file winbond-cir.c.

#define WBCIR_RX_OVERRUN   0x02

Definition at line 137 of file winbond-cir.c.

#define WBCIR_TX_EOT   0x04

Definition at line 139 of file winbond-cir.c.

#define WBCIR_TX_UNDERRUN   0x40

Definition at line 143 of file winbond-cir.c.

Enumeration Type Documentation

enum wbcir_bank
Enumerator:
WBCIR_BANK_0 
WBCIR_BANK_1 
WBCIR_BANK_2 
WBCIR_BANK_3 
WBCIR_BANK_4 
WBCIR_BANK_5 
WBCIR_BANK_6 
WBCIR_BANK_7 

Definition at line 154 of file winbond-cir.c.

Enumerator:
IR_PROTOCOL_RC5 
IR_PROTOCOL_NEC 
IR_PROTOCOL_RC6 

Definition at line 166 of file winbond-cir.c.

Enumerator:
WBCIR_RXSTATE_INACTIVE 
WBCIR_RXSTATE_ACTIVE 
WBCIR_RXSTATE_ERROR 

Definition at line 173 of file winbond-cir.c.

Enumerator:
WBCIR_TXSTATE_INACTIVE 
WBCIR_TXSTATE_ACTIVE 
WBCIR_TXSTATE_ERROR 

Definition at line 180 of file winbond-cir.c.

Function Documentation

MODULE_AUTHOR ( "David Härdeman <[email protected]>"  )
MODULE_DESCRIPTION ( "Winbond SuperI/O Consumer IR Driver"  )
MODULE_DEVICE_TABLE ( pnp  ,
wbcir_ids   
)
module_exit ( wbcir_exit  )
module_init ( wbcir_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( protocol  ,
uint  ,
0444   
)
module_param ( invert  ,
bool  ,
0444   
)
module_param ( txandrx  ,
bool  ,
0444   
)
module_param ( wake_sc  ,
uint  ,
0644   
)
module_param ( wake_rc6mode  ,
uint  ,
0644   
)
MODULE_PARM_DESC ( protocol  ,
"IR protocol to use for the power-on command ""(0 = RC5, 1 = NEC, 2 = RC6A, default)"   
)
MODULE_PARM_DESC ( invert  ,
"Invert the signal from the IR receiver  
)
MODULE_PARM_DESC ( txandrx  ,
"Allow simultaneous TX and RX  
)
MODULE_PARM_DESC ( wake_sc  ,
"Scancode of the power-on IR command  
)
MODULE_PARM_DESC ( wake_rc6mode  ,
"RC6 mode for the power-on command ""(0 = 0, 6 = 6A, default)"   
)