1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * comedi/drivers/amplc_pc236.c 4 * Driver for Amplicon PC36AT DIO boards. 5 * 6 * Copyright (C) 2002 MEV Ltd. <https://www.mev.co.uk/> 7 * 8 * COMEDI - Linux Control and Measurement Device Interface 9 * Copyright (C) 2000 David A. Schleef <ds@schleef.org> 10 */ 11 /* 12 * Driver: amplc_pc236 13 * Description: Amplicon PC36AT 14 * Author: Ian Abbott <abbotti@mev.co.uk> 15 * Devices: [Amplicon] PC36AT (pc36at) 16 * Updated: Fri, 25 Jul 2014 15:32:40 +0000 17 * Status: works 18 * 19 * Configuration options - PC36AT: 20 * [0] - I/O port base address 21 * [1] - IRQ (optional) 22 * 23 * The PC36AT board has a single 8255 appearing as subdevice 0. 24 * 25 * Subdevice 1 pretends to be a digital input device, but it always returns 26 * 0 when read. However, if you run a command with scan_begin_src=TRIG_EXT, 27 * a rising edge on port C bit 3 acts as an external trigger, which can be 28 * used to wake up tasks. This is like the comedi_parport device, but the 29 * only way to physically disable the interrupt on the PC36AT is to remove 30 * the IRQ jumper. If no interrupt is connected, then subdevice 1 is 31 * unused. 32 */ 33 34 #include <linux/module.h> 35 #include <linux/comedi/comedidev.h> 36 37 #include "amplc_pc236.h" 38 39 static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) 40 { 41 struct pc236_private *devpriv; 42 int ret; 43 44 devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); 45 if (!devpriv) 46 return -ENOMEM; 47 48 ret = comedi_request_region(dev, it->options[0], 0x4); 49 if (ret) 50 return ret; 51 52 return amplc_pc236_common_attach(dev, dev->iobase, it->options[1], 0); 53 } 54 55 static const struct pc236_board pc236_boards[] = { 56 { 57 .name = "pc36at", 58 }, 59 }; 60 61 static struct comedi_driver amplc_pc236_driver = { 62 .driver_name = "amplc_pc236", 63 .module = THIS_MODULE, 64 .attach = pc236_attach, 65 .detach = comedi_legacy_detach, 66 .board_name = &pc236_boards[0].name, 67 .offset = sizeof(struct pc236_board), 68 .num_names = ARRAY_SIZE(pc236_boards), 69 }; 70 71 module_comedi_driver(amplc_pc236_driver); 72 73 MODULE_AUTHOR("Comedi https://www.comedi.org"); 74 MODULE_DESCRIPTION("Comedi driver for Amplicon PC36AT DIO boards"); 75 MODULE_LICENSE("GPL"); 76