Lines Matching +full:tx +full:- +full:freq
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * winbond-cir.c - Driver for the Consumer IR functionality of Winbond
12 * Copyright (C) 2009 - 2011 David Härdeman <david@hardeman.nu>
26 * o Wake-On-CIR functionality
44 #include <media/rc-core.h>
46 #define DRVNAME "winbond-cir"
48 /* CEIR Wake-Up Registers, relative to data->wbase */
60 /* CEIR Enhanced Functionality Registers, relative to data->ebase */
67 /* SP3 Banked Registers, relative to data->sbase */
71 #define WBCIR_REG_SP3_TXDATA 0x00 /* FIFO TX data (w) */
84 #define WBCIR_REG_SP3_TXFLV 0x06 /* TX FIFO Level */
99 #define WBCIR_REG_SP3_IRTXMC 0x01 /* IR TX Mod Control */
112 /* TX data low bit for WBCIR_REG_SP3_IER and WBCIR_REG_SP3_EIR */
114 /* Over/Under-flow bit for WBCIR_REG_SP3_IER and WBCIR_REG_SP3_EIR */
116 /* TX data empty bit for WBCEIR_REG_SP3_IER and WBCIR_REG_SP3_EIR */
124 /* TX End-Of-Transmission bit for WBCIR_REG_SP3_ASCR */
128 /* TX data underrun error bit for WBCIR_REG_SP3_ASCR */
142 /* Invert TX */
159 /* Supported power-on IR Protocols */
184 #define WAKEUP_IOMEM_LEN 0x10 /* Wake-Up I/O Reg Len */
188 /* Per-device data */
194 unsigned long wbase; /* Wake-Up Baseaddr */
205 /* TX state */
220 MODULE_PARM_DESC(txandrx, "Allow simultaneous TX and RX");
244 outb(bank, data->sbase + WBCIR_REG_SP3_BSR); in wbcir_select_bank()
250 if (data->irqmask == irqmask) in wbcir_set_irqmask()
254 outb(irqmask, data->sbase + WBCIR_REG_SP3_IER); in wbcir_set_irqmask()
255 data->irqmask = irqmask; in wbcir_set_irqmask()
265 if (inb(data->ebase + WBCIR_REG_ECEIR_CTS) & WBCIR_LED_ENABLE) in wbcir_led_brightness_get()
279 wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CTS, in wbcir_led_brightness_set()
312 unsigned counter = inb(data->ebase + WBCIR_REG_ECEIR_CNT_LO) | in wbcir_carrier_report()
313 inb(data->ebase + WBCIR_REG_ECEIR_CNT_HI) << 8; in wbcir_carrier_report()
319 data->pulse_duration) in wbcir_carrier_report()
322 ir_raw_event_store(data->dev, &ev); in wbcir_carrier_report()
326 data->pulse_duration = 0; in wbcir_carrier_report()
327 wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL, WBCIR_CNTR_R, in wbcir_carrier_report()
329 wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL, WBCIR_CNTR_EN, in wbcir_carrier_report()
336 struct wbcir_data *data = dev->priv; in wbcir_idle_rx()
338 if (!idle && data->rxstate == WBCIR_RXSTATE_INACTIVE) in wbcir_idle_rx()
339 data->rxstate = WBCIR_RXSTATE_ACTIVE; in wbcir_idle_rx()
341 if (idle && data->rxstate != WBCIR_RXSTATE_INACTIVE) { in wbcir_idle_rx()
342 data->rxstate = WBCIR_RXSTATE_INACTIVE; in wbcir_idle_rx()
344 if (data->carrier_report_enabled) in wbcir_idle_rx()
348 outb(WBCIR_RX_DISABLE, data->sbase + WBCIR_REG_SP3_ASCR); in wbcir_idle_rx()
359 while (inb(data->sbase + WBCIR_REG_SP3_LSR) & WBCIR_RX_AVAIL) { in wbcir_irq_rx()
360 irdata = inb(data->sbase + WBCIR_REG_SP3_RXDATA); in wbcir_irq_rx()
361 if (data->rxstate == WBCIR_RXSTATE_ERROR) in wbcir_irq_rx()
365 (data->carrier_report_enabled ? 2 : 10); in wbcir_irq_rx()
369 data->pulse_duration += rawir.duration; in wbcir_irq_rx()
371 ir_raw_event_store_with_filter(data->dev, &rawir); in wbcir_irq_rx()
374 ir_raw_event_handle(data->dev); in wbcir_irq_rx()
385 if (!data->txbuf) in wbcir_irq_tx()
388 switch (data->txstate) { in wbcir_irq_tx()
390 /* TX FIFO empty */ in wbcir_irq_tx()
394 /* TX FIFO low (3 bytes or less) */ in wbcir_irq_tx()
405 * TX data is run-length coded in bytes: YXXXXXXX in wbcir_irq_tx()
409 for (used = 0; used < space && data->txoff != data->txlen; used++) { in wbcir_irq_tx()
410 if (data->txbuf[data->txoff] == 0) { in wbcir_irq_tx()
411 data->txoff++; in wbcir_irq_tx()
414 byte = min((u32)0x80, data->txbuf[data->txoff]); in wbcir_irq_tx()
415 data->txbuf[data->txoff] -= byte; in wbcir_irq_tx()
416 byte--; in wbcir_irq_tx()
417 byte |= (data->txoff % 2 ? 0x80 : 0x00); /* pulse/space */ in wbcir_irq_tx()
421 while (data->txoff != data->txlen && data->txbuf[data->txoff] == 0) in wbcir_irq_tx()
422 data->txoff++; in wbcir_irq_tx()
426 if (data->txstate == WBCIR_TXSTATE_ERROR) in wbcir_irq_tx()
427 /* Clear TX underrun bit */ in wbcir_irq_tx()
428 outb(WBCIR_TX_UNDERRUN, data->sbase + WBCIR_REG_SP3_ASCR); in wbcir_irq_tx()
430 kfree(data->txbuf); in wbcir_irq_tx()
431 data->txbuf = NULL; in wbcir_irq_tx()
432 data->txstate = WBCIR_TXSTATE_INACTIVE; in wbcir_irq_tx()
433 } else if (data->txoff == data->txlen) { in wbcir_irq_tx()
435 outsb(data->sbase + WBCIR_REG_SP3_TXDATA, bytes, used - 1); in wbcir_irq_tx()
436 outb(WBCIR_TX_EOT, data->sbase + WBCIR_REG_SP3_ASCR); in wbcir_irq_tx()
437 outb(bytes[used - 1], data->sbase + WBCIR_REG_SP3_TXDATA); in wbcir_irq_tx()
442 outsb(data->sbase + WBCIR_REG_SP3_RXDATA, bytes, used); in wbcir_irq_tx()
443 if (data->txstate == WBCIR_TXSTATE_INACTIVE) { in wbcir_irq_tx()
446 data->txstate = WBCIR_TXSTATE_ACTIVE; in wbcir_irq_tx()
459 spin_lock_irqsave(&data->spinlock, flags); in wbcir_irq_handler()
461 status = inb(data->sbase + WBCIR_REG_SP3_EIR); in wbcir_irq_handler()
462 status &= data->irqmask; in wbcir_irq_handler()
465 spin_unlock_irqrestore(&data->spinlock, flags); in wbcir_irq_handler()
471 if (inb(data->sbase + WBCIR_REG_SP3_LSR) & WBCIR_RX_OVERRUN) { in wbcir_irq_handler()
472 data->rxstate = WBCIR_RXSTATE_ERROR; in wbcir_irq_handler()
473 ir_raw_event_overflow(data->dev); in wbcir_irq_handler()
476 /* TX underflow? */ in wbcir_irq_handler()
477 if (inb(data->sbase + WBCIR_REG_SP3_ASCR) & WBCIR_TX_UNDERRUN) in wbcir_irq_handler()
478 data->txstate = WBCIR_TXSTATE_ERROR; in wbcir_irq_handler()
487 spin_unlock_irqrestore(&data->spinlock, flags); in wbcir_irq_handler()
493 * RC-CORE INTERFACE FUNCTIONS
500 struct wbcir_data *data = dev->priv; in wbcir_set_carrier_report()
503 spin_lock_irqsave(&data->spinlock, flags); in wbcir_set_carrier_report()
505 if (data->carrier_report_enabled == enable) { in wbcir_set_carrier_report()
506 spin_unlock_irqrestore(&data->spinlock, flags); in wbcir_set_carrier_report()
510 data->pulse_duration = 0; in wbcir_set_carrier_report()
511 wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL, WBCIR_CNTR_R, in wbcir_set_carrier_report()
514 if (enable && data->dev->idle) in wbcir_set_carrier_report()
515 wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL, in wbcir_set_carrier_report()
520 data->dev->rx_resolution = enable ? 2 : 10; in wbcir_set_carrier_report()
521 outb(enable ? 0x03 : 0x0f, data->sbase + WBCIR_REG_SP3_BGDL); in wbcir_set_carrier_report()
522 outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH); in wbcir_set_carrier_report()
526 wbcir_set_bits(data->sbase + WBCIR_REG_SP3_RCCFG, in wbcir_set_carrier_report()
529 data->carrier_report_enabled = enable; in wbcir_set_carrier_report()
530 spin_unlock_irqrestore(&data->spinlock, flags); in wbcir_set_carrier_report()
538 struct wbcir_data *data = dev->priv; in wbcir_txcarrier()
541 u32 freq; in wbcir_txcarrier() local
543 freq = DIV_ROUND_CLOSEST(carrier, 1000); in wbcir_txcarrier()
544 if (freq < 30 || freq > 60) in wbcir_txcarrier()
545 return -EINVAL; in wbcir_txcarrier()
547 switch (freq) { in wbcir_txcarrier()
551 val = freq - 58; in wbcir_txcarrier()
552 freq *= 1000; in wbcir_txcarrier()
555 val = freq - 27; in wbcir_txcarrier()
556 freq = 56900; in wbcir_txcarrier()
559 val = freq - 27; in wbcir_txcarrier()
560 freq *= 1000; in wbcir_txcarrier()
564 spin_lock_irqsave(&data->spinlock, flags); in wbcir_txcarrier()
565 if (data->txstate != WBCIR_TXSTATE_INACTIVE) { in wbcir_txcarrier()
566 spin_unlock_irqrestore(&data->spinlock, flags); in wbcir_txcarrier()
567 return -EBUSY; in wbcir_txcarrier()
570 if (data->txcarrier != freq) { in wbcir_txcarrier()
572 wbcir_set_bits(data->sbase + WBCIR_REG_SP3_IRTXMC, val, 0x1F); in wbcir_txcarrier()
573 data->txcarrier = freq; in wbcir_txcarrier()
576 spin_unlock_irqrestore(&data->spinlock, flags); in wbcir_txcarrier()
583 struct wbcir_data *data = dev->priv; in wbcir_txmask()
606 return -EINVAL; in wbcir_txmask()
609 spin_lock_irqsave(&data->spinlock, flags); in wbcir_txmask()
610 if (data->txstate != WBCIR_TXSTATE_INACTIVE) { in wbcir_txmask()
611 spin_unlock_irqrestore(&data->spinlock, flags); in wbcir_txmask()
612 return -EBUSY; in wbcir_txmask()
615 if (data->txmask != mask) { in wbcir_txmask()
616 wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CTS, val, 0x0c); in wbcir_txmask()
617 data->txmask = mask; in wbcir_txmask()
620 spin_unlock_irqrestore(&data->spinlock, flags); in wbcir_txmask()
627 struct wbcir_data *data = dev->priv; in wbcir_tx()
634 return -ENOMEM; in wbcir_tx()
641 spin_lock_irqsave(&data->spinlock, flags); in wbcir_tx()
642 if (data->txstate != WBCIR_TXSTATE_INACTIVE) { in wbcir_tx()
643 spin_unlock_irqrestore(&data->spinlock, flags); in wbcir_tx()
645 return -EBUSY; in wbcir_tx()
648 /* Fill the TX fifo once, the irq handler will do the rest */ in wbcir_tx()
649 data->txbuf = buf; in wbcir_tx()
650 data->txlen = count; in wbcir_tx()
651 data->txoff = 0; in wbcir_tx()
655 spin_unlock_irqrestore(&data->spinlock, flags); in wbcir_tx()
668 struct device *dev = &device->dev; in wbcir_shutdown()
670 struct rc_dev *rc = data->dev; in wbcir_shutdown()
676 u32 wake_sc = rc->scancode_wakeup_filter.data; in wbcir_shutdown()
677 u32 mask_sc = rc->scancode_wakeup_filter.mask; in wbcir_shutdown()
688 switch (rc->wakeup_protocol) { in wbcir_shutdown()
788 /* Customer bits 7 - 0 */ in wbcir_shutdown()
792 if (rc->wakeup_protocol == RC_PROTO_RC6_6A_20) { in wbcir_shutdown()
798 if (rc->wakeup_protocol == RC_PROTO_RC6_6A_24) { in wbcir_shutdown()
801 /* Customer range bit and bits 15 - 8 */ in wbcir_shutdown()
825 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_INDEX, in wbcir_shutdown()
828 outsb(data->wbase + WBCIR_REG_WCEIR_DATA, match, 11); in wbcir_shutdown()
829 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_INDEX, in wbcir_shutdown()
832 outsb(data->wbase + WBCIR_REG_WCEIR_DATA, mask, 11); in wbcir_shutdown()
835 outb(rc6_csl, data->wbase + WBCIR_REG_WCEIR_CSL); in wbcir_shutdown()
838 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_STS, 0x17, 0x17); in wbcir_shutdown()
841 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x01, 0x07); in wbcir_shutdown()
844 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, in wbcir_shutdown()
849 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07); in wbcir_shutdown()
852 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, 0x00, 0x01); in wbcir_shutdown()
862 disable_irq(data->irq); in wbcir_shutdown()
878 led_classdev_suspend(&data->led); in wbcir_suspend()
890 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, invert ? 8 : 0, 0x09); in wbcir_init_hw()
893 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_STS, 0x17, 0x17); in wbcir_init_hw()
896 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07); in wbcir_init_hw()
899 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CFG1, 0x4A, 0x7F); in wbcir_init_hw()
903 outb(WBCIR_IRTX_INV, data->ebase + WBCIR_REG_ECEIR_CCTL); in wbcir_init_hw()
905 outb(0x00, data->ebase + WBCIR_REG_ECEIR_CCTL); in wbcir_init_hw()
908 * Clear IR LED, set SP3 clock to 24Mhz, set TX mask to IRTX1, in wbcir_init_hw()
911 outb(0x10, data->ebase + WBCIR_REG_ECEIR_CTS); in wbcir_init_hw()
912 data->txmask = 0x1; in wbcir_init_hw()
916 outb(WBCIR_EXT_ENABLE, data->sbase + WBCIR_REG_SP3_EXCR1); in wbcir_init_hw()
923 * 24Mhz clock freq to 48Mhz. in wbcir_init_hw()
929 /* prescaler 1.0, tx/rx fifo lvl 16 */ in wbcir_init_hw()
930 outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2); in wbcir_init_hw()
933 outb(0x0f, data->sbase + WBCIR_REG_SP3_BGDL); in wbcir_init_hw()
934 outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH); in wbcir_init_hw()
938 outb(0xC0, data->sbase + WBCIR_REG_SP3_MCR); in wbcir_init_hw()
939 inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */ in wbcir_init_hw()
940 inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */ in wbcir_init_hw()
942 /* Disable RX demod, enable run-length enc/dec, set freq span */ in wbcir_init_hw()
944 outb(0x90, data->sbase + WBCIR_REG_SP3_RCCFG); in wbcir_init_hw()
948 outb(0x00, data->sbase + WBCIR_REG_SP3_IRCR1); in wbcir_init_hw()
950 /* Disable MSR interrupt, clear AUX_IRX, mask RX during TX? */ in wbcir_init_hw()
952 outb(txandrx ? 0x03 : 0x02, data->sbase + WBCIR_REG_SP3_IRCR2); in wbcir_init_hw()
956 outb(0x20, data->sbase + WBCIR_REG_SP3_IRCR3); in wbcir_init_hw()
958 /* Set RX demodulation freq, not really used */ in wbcir_init_hw()
960 outb(0xF2, data->sbase + WBCIR_REG_SP3_IRRXDC); in wbcir_init_hw()
962 /* Set TX modulation, 36kHz, 7us pulse width */ in wbcir_init_hw()
963 outb(0x69, data->sbase + WBCIR_REG_SP3_IRTXMC); in wbcir_init_hw()
964 data->txcarrier = 36000; in wbcir_init_hw()
968 outb(0x10, data->sbase + WBCIR_REG_SP3_IRCFG4); in wbcir_init_hw()
970 outb(0x00, data->sbase + WBCIR_REG_SP3_IRCFG4); in wbcir_init_hw()
972 /* Set FIFO thresholds (RX = 8, TX = 3), reset RX/TX */ in wbcir_init_hw()
974 outb(0x97, data->sbase + WBCIR_REG_SP3_FCR); in wbcir_init_hw()
977 outb(0xE0, data->sbase + WBCIR_REG_SP3_ASCR); in wbcir_init_hw()
980 data->rxstate = WBCIR_RXSTATE_INACTIVE; in wbcir_init_hw()
981 wbcir_idle_rx(data->dev, true); in wbcir_init_hw()
983 /* Clear TX state */ in wbcir_init_hw()
984 if (data->txstate == WBCIR_TXSTATE_ACTIVE) { in wbcir_init_hw()
985 kfree(data->txbuf); in wbcir_init_hw()
986 data->txbuf = NULL; in wbcir_init_hw()
987 data->txstate = WBCIR_TXSTATE_INACTIVE; in wbcir_init_hw()
1000 enable_irq(data->irq); in wbcir_resume()
1001 led_classdev_resume(&data->led); in wbcir_resume()
1009 struct device *dev = &device->dev; in wbcir_probe()
1017 return -ENODEV; in wbcir_probe()
1022 err = -ENOMEM; in wbcir_probe()
1028 spin_lock_init(&data->spinlock); in wbcir_probe()
1029 data->ebase = pnp_port_start(device, 0); in wbcir_probe()
1030 data->wbase = pnp_port_start(device, 1); in wbcir_probe()
1031 data->sbase = pnp_port_start(device, 2); in wbcir_probe()
1032 data->irq = pnp_irq(device, 0); in wbcir_probe()
1034 if (data->wbase == 0 || data->ebase == 0 || in wbcir_probe()
1035 data->sbase == 0 || data->irq == -1) { in wbcir_probe()
1036 err = -ENODEV; in wbcir_probe()
1041 dev_dbg(&device->dev, "Found device (w: 0x%lX, e: 0x%lX, s: 0x%lX, i: %u)\n", in wbcir_probe()
1042 data->wbase, data->ebase, data->sbase, data->irq); in wbcir_probe()
1044 data->led.name = "cir::activity"; in wbcir_probe()
1045 data->led.default_trigger = "rc-feedback"; in wbcir_probe()
1046 data->led.brightness_set = wbcir_led_brightness_set; in wbcir_probe()
1047 data->led.brightness_get = wbcir_led_brightness_get; in wbcir_probe()
1048 err = led_classdev_register(&device->dev, &data->led); in wbcir_probe()
1052 data->dev = rc_allocate_device(RC_DRIVER_IR_RAW); in wbcir_probe()
1053 if (!data->dev) { in wbcir_probe()
1054 err = -ENOMEM; in wbcir_probe()
1058 data->dev->driver_name = DRVNAME; in wbcir_probe()
1059 data->dev->device_name = WBCIR_NAME; in wbcir_probe()
1060 data->dev->input_phys = "wbcir/cir0"; in wbcir_probe()
1061 data->dev->input_id.bustype = BUS_HOST; in wbcir_probe()
1062 data->dev->input_id.vendor = PCI_VENDOR_ID_WINBOND; in wbcir_probe()
1063 data->dev->input_id.product = WBCIR_ID_FAMILY; in wbcir_probe()
1064 data->dev->input_id.version = WBCIR_ID_CHIP; in wbcir_probe()
1065 data->dev->map_name = RC_MAP_RC6_MCE; in wbcir_probe()
1066 data->dev->s_idle = wbcir_idle_rx; in wbcir_probe()
1067 data->dev->s_carrier_report = wbcir_set_carrier_report; in wbcir_probe()
1068 data->dev->s_tx_mask = wbcir_txmask; in wbcir_probe()
1069 data->dev->s_tx_carrier = wbcir_txcarrier; in wbcir_probe()
1070 data->dev->tx_ir = wbcir_tx; in wbcir_probe()
1071 data->dev->priv = data; in wbcir_probe()
1072 data->dev->dev.parent = &device->dev; in wbcir_probe()
1073 data->dev->min_timeout = 1; in wbcir_probe()
1074 data->dev->timeout = IR_DEFAULT_TIMEOUT; in wbcir_probe()
1075 data->dev->max_timeout = 10 * IR_DEFAULT_TIMEOUT; in wbcir_probe()
1076 data->dev->rx_resolution = 2; in wbcir_probe()
1077 data->dev->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER; in wbcir_probe()
1078 data->dev->allowed_wakeup_protocols = RC_PROTO_BIT_NEC | in wbcir_probe()
1083 data->dev->wakeup_protocol = RC_PROTO_RC6_MCE; in wbcir_probe()
1084 data->dev->scancode_wakeup_filter.data = 0x800f040c; in wbcir_probe()
1085 data->dev->scancode_wakeup_filter.mask = 0xffff7fff; in wbcir_probe()
1086 data->dev->s_wakeup_filter = wbcir_set_wakeup_filter; in wbcir_probe()
1088 err = rc_register_device(data->dev); in wbcir_probe()
1092 if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { in wbcir_probe()
1093 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", in wbcir_probe()
1094 data->wbase, data->wbase + WAKEUP_IOMEM_LEN - 1); in wbcir_probe()
1095 err = -EBUSY; in wbcir_probe()
1099 if (!request_region(data->ebase, EHFUNC_IOMEM_LEN, DRVNAME)) { in wbcir_probe()
1100 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", in wbcir_probe()
1101 data->ebase, data->ebase + EHFUNC_IOMEM_LEN - 1); in wbcir_probe()
1102 err = -EBUSY; in wbcir_probe()
1106 if (!request_region(data->sbase, SP_IOMEM_LEN, DRVNAME)) { in wbcir_probe()
1107 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", in wbcir_probe()
1108 data->sbase, data->sbase + SP_IOMEM_LEN - 1); in wbcir_probe()
1109 err = -EBUSY; in wbcir_probe()
1113 err = request_irq(data->irq, wbcir_irq_handler, in wbcir_probe()
1116 dev_err(dev, "Failed to claim IRQ %u\n", data->irq); in wbcir_probe()
1117 err = -EBUSY; in wbcir_probe()
1121 device_init_wakeup(&device->dev, 1); in wbcir_probe()
1128 release_region(data->sbase, SP_IOMEM_LEN); in wbcir_probe()
1130 release_region(data->ebase, EHFUNC_IOMEM_LEN); in wbcir_probe()
1132 release_region(data->wbase, WAKEUP_IOMEM_LEN); in wbcir_probe()
1134 rc_unregister_device(data->dev); in wbcir_probe()
1135 data->dev = NULL; in wbcir_probe()
1137 rc_free_device(data->dev); in wbcir_probe()
1139 led_classdev_unregister(&data->led); in wbcir_probe()
1154 free_irq(data->irq, device); in wbcir_remove()
1157 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_STS, 0x17, 0x17); in wbcir_remove()
1160 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, 0x00, 0x01); in wbcir_remove()
1163 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07); in wbcir_remove()
1165 rc_unregister_device(data->dev); in wbcir_remove()
1167 led_classdev_unregister(&data->led); in wbcir_remove()
1169 /* This is ok since &data->led isn't actually used */ in wbcir_remove()
1170 wbcir_led_brightness_set(&data->led, LED_OFF); in wbcir_remove()
1172 release_region(data->wbase, WAKEUP_IOMEM_LEN); in wbcir_remove()
1173 release_region(data->ebase, EHFUNC_IOMEM_LEN); in wbcir_remove()
1174 release_region(data->sbase, SP_IOMEM_LEN); in wbcir_remove()