aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/ii_pci20kc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/comedi/drivers/ii_pci20kc.c')
-rw-r--r--drivers/staging/comedi/drivers/ii_pci20kc.c83
1 files changed, 43 insertions, 40 deletions
diff --git a/drivers/staging/comedi/drivers/ii_pci20kc.c b/drivers/staging/comedi/drivers/ii_pci20kc.c
index 24df2453e683..e26c1b88ebeb 100644
--- a/drivers/staging/comedi/drivers/ii_pci20kc.c
+++ b/drivers/staging/comedi/drivers/ii_pci20kc.c
@@ -23,7 +23,8 @@
* no extern trigger implemented
*
* NOT WORKING (but soon) only 4 on-board differential channels supported
- * NOT WORKING (but soon) only ONE di-port and ONE do-port supported instead of 4 digital ports
+ * NOT WORKING (but soon) only ONE di-port and ONE do-port supported
+ * instead of 4 digital ports
* di-port == Port 0
* do-port == Port 1
*
@@ -63,17 +64,17 @@ Options:
options for PCI-20006M:
first: Analog output channel 0 range configuration
- 0 bipolar 10 (-10V -- +10V)
- 1 unipolar 10 (0V -- +10V)
- 2 bipolar 5 (-5V -- 5V)
+ 0 bipolar 10 (-10V -- +10V)
+ 1 unipolar 10 (0V -- +10V)
+ 2 bipolar 5 (-5V -- 5V)
second: Analog output channel 1 range configuration
options for PCI-20341M:
first: Analog input gain configuration
- 0 1
- 1 10
- 2 100
- 3 200
+ 0 1
+ 1 10
+ 2 100
+ 3 200
*/
/* XXX needs to use ioremap() for compatibility with 2.4 kernels. Should also
@@ -95,12 +96,12 @@ options for PCI-20341M:
#define PCI20000_DIO_3 0xc1
#define PCI20000_DIO_CONTROL_01 0x83 /* port 0, 1 control */
#define PCI20000_DIO_CONTROL_23 0xc3 /* port 2, 3 control */
-#define PCI20000_DIO_BUFFER 0x82 /* buffer direction and enable */
+#define PCI20000_DIO_BUFFER 0x82 /* buffer direction & enable */
#define PCI20000_DIO_EOC 0xef /* even port, control output */
#define PCI20000_DIO_OOC 0xfd /* odd port, control output */
#define PCI20000_DIO_EIC 0x90 /* even port, control input */
#define PCI20000_DIO_OIC 0x82 /* odd port, control input */
-#define DIO_CAND 0x12 /* and bit 1, bit 4 of control */
+#define DIO_CAND 0x12 /* and bit 1 & 4 of control */
#define DIO_BE 0x01 /* buffer: port enable */
#define DIO_BO 0x04 /* buffer: output */
#define DIO_BI 0x05 /* buffer: input */
@@ -137,7 +138,8 @@ union pci20xxx_subdev_private {
void *iobase;
struct {
void *iobase;
- const struct comedi_lrange *ao_range_list[2]; /* range of channels of ao module */
+ const struct comedi_lrange *ao_range_list[2];
+ /* range of channels of ao module */
unsigned int last_data[2];
} pci20006;
struct {
@@ -224,14 +226,13 @@ static int pci20xxx_attach(struct comedi_device *dev,
/* Check PCI-20001 C-2A Carrier Board ID */
if ((readb(devpriv->ioaddr) & PCI20000_ID) != PCI20000_ID) {
- printk("comedi%d: ii_pci20kc", dev->minor);
- printk
- (" PCI-20001 C-2A Carrier Board at base=0x%p not found !\n",
- devpriv->ioaddr);
+ printk(KERN_WARNING "comedi%d: ii_pci20kc PCI-20001"
+ " C-2A Carrier Board at base=0x%p not found !\n",
+ dev->minor, devpriv->ioaddr);
return -EINVAL;
}
- printk("comedi%d:\n", dev->minor);
- printk("ii_pci20kc: PCI-20001 C-2A at base=0x%p\n", devpriv->ioaddr);
+ printk(KERN_INFO "comedi%d: ii_pci20kc: PCI-20001 C-2A at base=0x%p\n",
+ dev->minor, devpriv->ioaddr);
for (i = 0; i < PCI20000_MODULES; i++) {
s = dev->subdevices + i;
@@ -244,21 +245,23 @@ static int pci20xxx_attach(struct comedi_device *dev,
devpriv->ioaddr + (i + 1) * PCI20000_OFFSET;
pci20006_init(dev, s, it->options[2 * i + 2],
it->options[2 * i + 3]);
- printk("comedi%d: ii_pci20kc", dev->minor);
- printk(" PCI-20006 module in slot %d \n", i + 1);
+ printk(KERN_INFO "comedi%d: "
+ "ii_pci20kc PCI-20006 module in slot %d \n",
+ dev->minor, i + 1);
break;
case PCI20341_ID:
sdp->pci20341.iobase =
devpriv->ioaddr + (i + 1) * PCI20000_OFFSET;
pci20341_init(dev, s, it->options[2 * i + 2],
it->options[2 * i + 3]);
- printk("comedi%d: ii_pci20kc", dev->minor);
- printk(" PCI-20341 module in slot %d \n", i + 1);
+ printk(KERN_INFO "comedi%d: "
+ "ii_pci20kc PCI-20341 module in slot %d \n",
+ dev->minor, i + 1);
break;
default:
- printk
- ("ii_pci20kc: unknown module code 0x%02x in slot %d: module disabled\n",
- id, i);
+ printk(KERN_WARNING "ii_pci20kc: unknown module "
+ "code 0x%02x in slot %d: module disabled\n",
+ id, i); /* XXX this looks like a bug! i + 1 ?? */
/* fall through */
case PCI20xxx_EMPTY_ID:
s->type = COMEDI_SUBD_UNUSED;
@@ -274,7 +277,7 @@ static int pci20xxx_attach(struct comedi_device *dev,
static int pci20xxx_detach(struct comedi_device *dev)
{
- printk("comedi%d: pci20xxx: remove\n", dev->minor);
+ printk(KERN_INFO "comedi%d: pci20xxx: remove\n", dev->minor);
return 0;
}
@@ -339,7 +342,8 @@ static int pci20006_insn_write(struct comedi_device *dev,
unsigned int boarddata;
sdp->pci20006.last_data[CR_CHAN(insn->chanspec)] = data[0];
- boarddata = (((unsigned int)data[0] + 0x8000) & 0xffff); /* comedi-data -> board-data */
+ boarddata = (((unsigned int)data[0] + 0x8000) & 0xffff);
+ /* comedi-data -> board-data */
lo = (boarddata & 0xff);
hi = ((boarddata >> 8) & 0xff);
@@ -355,7 +359,8 @@ static int pci20006_insn_write(struct comedi_device *dev,
writeb(0x00, sdp->iobase + PCI20006_STROBE1);
break;
default:
- printk(" comedi%d: pci20xxx: ao channel Error!\n", dev->minor);
+ printk(KERN_WARNING
+ " comedi%d: pci20xxx: ao channel Error!\n", dev->minor);
return -EINVAL;
}
@@ -373,8 +378,7 @@ static const int pci20341_settling_time[] = { 0x58, 0x58, 0x93, 0x99 };
static const struct comedi_lrange range_bipolar0_5 = { 1, {BIP_RANGE(0.5)} };
static const struct comedi_lrange range_bipolar0_05 = { 1, {BIP_RANGE(0.05)} };
-static const struct comedi_lrange range_bipolar0_025 =
- { 1, {BIP_RANGE(0.025)} };
+static const struct comedi_lrange range_bipolar0_025 = { 1, {BIP_RANGE(0.025)} };
static const struct comedi_lrange *const pci20341_ranges[] = {
&range_bipolar5,
@@ -447,9 +451,10 @@ static int pci20341_insn_read(struct comedi_device *dev,
eoc = readb(sdp->iobase + PCI20341_STATUS_REG);
}
if (j >= 100) {
- printk
- ("comedi%d: pci20xxx: AI interrupt channel %i polling exit !\n",
- dev->minor, i);
+ printk(KERN_WARNING
+ "comedi%d: pci20xxx: "
+ "AI interrupt channel %i polling exit !\n",
+ dev->minor, i);
return -EINVAL;
}
lo = readb(sdp->iobase + PCI20341_LDATA);
@@ -502,20 +507,18 @@ static int pci20xxx_dio_insn_config(struct comedi_device *dev,
int mask, bits;
mask = 1 << CR_CHAN(insn->chanspec);
- if (mask & 0x000000ff) {
+ if (mask & 0x000000ff)
bits = 0x000000ff;
- } else if (mask & 0x0000ff00) {
+ else if (mask & 0x0000ff00)
bits = 0x0000ff00;
- } else if (mask & 0x00ff0000) {
+ else if (mask & 0x00ff0000)
bits = 0x00ff0000;
- } else {
+ else
bits = 0xff000000;
- }
- if (data[0]) {
+ if (data[0])
s->io_bits |= bits;
- } else {
+ else
s->io_bits &= ~bits;
- }
pci20xxx_dio_config(dev, s);
return 1;