Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 77b2555b52a894a2e39a42e43d993df875c46a6a 122 lines 2.8 kB view raw
1/* 2 * IR port driver for the Cirrus Logic EP7211 processor. 3 * 4 * Copyright 2001, Blue Mug Inc. All rights reserved. 5 */ 6 7#include <linux/module.h> 8#include <linux/delay.h> 9#include <linux/tty.h> 10#include <linux/init.h> 11 12#include <net/irda/irda.h> 13#include <net/irda/irda_device.h> 14 15#include <asm/io.h> 16#include <asm/hardware.h> 17 18#define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */ 19#define MAX_DELAY 10000 /* 1 ms */ 20 21static void ep7211_ir_open(dongle_t *self, struct qos_info *qos); 22static void ep7211_ir_close(dongle_t *self); 23static int ep7211_ir_change_speed(struct irda_task *task); 24static int ep7211_ir_reset(struct irda_task *task); 25 26static struct dongle_reg dongle = { 27 .type = IRDA_EP7211_IR, 28 .open = ep7211_ir_open, 29 .close = ep7211_ir_close, 30 .reset = ep7211_ir_reset, 31 .change_speed = ep7211_ir_change_speed, 32 .owner = THIS_MODULE, 33}; 34 35static void ep7211_ir_open(dongle_t *self, struct qos_info *qos) 36{ 37 unsigned int syscon1, flags; 38 39 save_flags(flags); cli(); 40 41 /* Turn on the SIR encoder. */ 42 syscon1 = clps_readl(SYSCON1); 43 syscon1 |= SYSCON1_SIREN; 44 clps_writel(syscon1, SYSCON1); 45 46 /* XXX: We should disable modem status interrupts on the first 47 UART (interrupt #14). */ 48 49 restore_flags(flags); 50} 51 52static void ep7211_ir_close(dongle_t *self) 53{ 54 unsigned int syscon1, flags; 55 56 save_flags(flags); cli(); 57 58 /* Turn off the SIR encoder. */ 59 syscon1 = clps_readl(SYSCON1); 60 syscon1 &= ~SYSCON1_SIREN; 61 clps_writel(syscon1, SYSCON1); 62 63 /* XXX: If we've disabled the modem status interrupts, we should 64 reset them back to their original state. */ 65 66 restore_flags(flags); 67} 68 69/* 70 * Function ep7211_ir_change_speed (task) 71 * 72 * Change speed of the EP7211 I/R port. We don't really have to do anything 73 * for the EP7211 as long as the rate is being changed at the serial port 74 * level. 75 */ 76static int ep7211_ir_change_speed(struct irda_task *task) 77{ 78 irda_task_next_state(task, IRDA_TASK_DONE); 79 return 0; 80} 81 82/* 83 * Function ep7211_ir_reset (task) 84 * 85 * Reset the EP7211 I/R. We don't really have to do anything. 86 * 87 */ 88static int ep7211_ir_reset(struct irda_task *task) 89{ 90 irda_task_next_state(task, IRDA_TASK_DONE); 91 return 0; 92} 93 94/* 95 * Function ep7211_ir_init(void) 96 * 97 * Initialize EP7211 I/R module 98 * 99 */ 100static int __init ep7211_ir_init(void) 101{ 102 return irda_device_register_dongle(&dongle); 103} 104 105/* 106 * Function ep7211_ir_cleanup(void) 107 * 108 * Cleanup EP7211 I/R module 109 * 110 */ 111static void __exit ep7211_ir_cleanup(void) 112{ 113 irda_device_unregister_dongle(&dongle); 114} 115 116MODULE_AUTHOR("Jon McClintock <jonm@bluemug.com>"); 117MODULE_DESCRIPTION("EP7211 I/R driver"); 118MODULE_LICENSE("GPL"); 119MODULE_ALIAS("irda-dongle-8"); /* IRDA_EP7211_IR */ 120 121module_init(ep7211_ir_init); 122module_exit(ep7211_ir_cleanup);