void
BuffaloGpio_AllLedOff(void)
{
	if (BIT_ALARM_LED >= 0) {
		BuffaloGpio_AlarmLedDisable();
		BuffaloGpio_AlarmLedBlinkDisable();
	}
	if (BIT_INFO_LED >= 0) {
		BuffaloGpio_InfoLedDisable();
		BuffaloGpio_InfoLedBlinkDisable();
	}
	if (BIT_PWR_LED >= 0) {
		BuffaloGpio_PowerLedDisable();
		BuffaloGpio_PowerLedBlinkDisable();
	}
//	if (BIT_LED_ETH >= 0) {
//		BuffaloGpio_EthLedOff();
//	}
	if (BIT_FUNC_LED >= 0) {
		BuffaloGpio_FuncLedDisable();
		BuffaloGpio_FuncLedBlinkDisable();
	}
}
예제 #2
0
//----------------------------------------------------------------------
int __init buffaloLedDriver_init (void)
{
    int i;
    char buf[1024];
    struct proc_dir_entry *pde;

    FUNCTRACE(printk("%s > Entered.\n",__FUNCTION__));

    BuffaloGpio_Init();
    pde = proc_mkdir("buffalo/gpio", 0);
    pde = proc_mkdir("buffalo/gpio/led", 0);
    pde = proc_mkdir("buffalo/gpio/switch", 0);
    pde = proc_mkdir("buffalo/gpio/fan", 0);
    pde = proc_mkdir("buffalo/gpio/power_control", 0);
    pde = create_proc_info_entry ("buffalo/power_sw", 0, 0, gpio_power_read_proc);

    pde = create_proc_entry("buffalo/gpio/led/all", 0, 0);
    pde->read_proc = BuffaloAllLedReadProc;
    pde->write_proc= BuffaloAllLedWriteProc;

    pde = create_proc_entry("buffalo/cpu_status", 0, 0);
    pde->read_proc = BuffaloCpuStatusReadProc;
    pde->write_proc = BuffaloCpuStatusWriteProc;


    if (BIT_LED_ALARM >= 0) {
        BuffaloGpio_AlarmLedDisable();

        pde = create_proc_entry("buffalo/gpio/led/alarm", 0, 0);
        pde->read_proc = BuffaloLedReadProc;
        pde->write_proc = BuffaloLedWriteProc;
        alarmLed.mppNumber = BIT_LED_ALARM;
        pde->data = &alarmLed;

        pde = create_proc_entry("buffalo/gpio/led/alarm_blink", 0, 0);
        pde->read_proc = BuffaloLedBlinkReadProc;
        pde->write_proc = BuffaloLedBlinkWriteProc;
        pde->data = &alarmLed;
    }

    if (BIT_LED_INFO >= 0) {
        BuffaloGpio_InfoLedDisable();

        pde = create_proc_entry("buffalo/gpio/led/info", 0, 0);
        pde->read_proc = BuffaloLedReadProc;
        pde->write_proc = BuffaloLedWriteProc;
        infoLed.mppNumber = BIT_LED_INFO;
        pde->data = &infoLed;

        pde = create_proc_entry("buffalo/gpio/led/info_blink", 0, 0);
        pde->read_proc = BuffaloLedBlinkReadProc;
        pde->write_proc = BuffaloLedBlinkWriteProc;
        pde->data = &infoLed;
    }

    if (BIT_LED_PWR >= 0) {
        BuffaloGpio_PowerLedEnable();

        pde = create_proc_entry("buffalo/gpio/led/power", 0, 0);
        pde->read_proc = BuffaloLedReadProc;
        pde->write_proc = BuffaloLedWriteProc;
        powerLed.mppNumber = BIT_LED_PWR;
        pde->data = &powerLed;

        pde = create_proc_entry("buffalo/gpio/led/power_blink", 0, 0);
        pde->read_proc = BuffaloLedBlinkReadProc;
        pde->write_proc = BuffaloLedBlinkWriteProc;
        pde->data = &powerLed;
    }

    if (BIT_LED_FUNC >= 0) {
        BuffaloGpio_FuncLedDisable();

        pde = create_proc_entry("buffalo/gpio/led/func", 0, 0);
        pde->read_proc = BuffaloLedReadProc;
        pde->write_proc = BuffaloLedWriteProc;
        funcLed.mppNumber = BIT_LED_FUNC;
        pde->data = &funcLed;

        pde = create_proc_entry("buffalo/gpio/led/func_blink", 0, 0);
        pde->read_proc = BuffaloLedBlinkReadProc;
        pde->write_proc = BuffaloLedBlinkWriteProc;
        pde->data = &funcLed;
    }

    if (BIT_LED_ETH >= 0) {
        pde = create_proc_entry("buffalo/gpio/led/eth", 0, 0);
        pde->read_proc = BuffaloEthLedReadProc;
        pde->write_proc = BuffaloEthLedWriteProc;
    }


    for (i=0; i<BUF_NV_SIZE_BIT_HDD_POWER; i++) {
        if (bitHddPower[i] < 0)
            continue;

        sprintf(buf, "buffalo/gpio/power_control/hdd%d", i);
        pde = create_proc_entry(buf, 0, 0);
        if (pde != NULL) {
            pde->read_proc = BuffaloHddReadProc;
            pde->write_proc= BuffaloHddWriteProc;
            pde->owner = THIS_MODULE;
            pde->data = (void *)i;
        }
    }

    for (i=0; i<BUF_NV_SIZE_BIT_USB_POWER; i++) {
        if (bitUsbPower[i] < 0)
            continue;

        sprintf(buf, "buffalo/gpio/power_control/usb%d", i);
        pde = create_proc_entry(buf, 0, NULL);
        if (pde != NULL) {
            pde->read_proc = BuffaloUsbReadProc;
            pde->write_proc = BuffaloUsbWriteProc;
            pde->owner = THIS_MODULE;
            pde->data = (void *)i;
        }
    }

    if (use_slide_power == 1) {
        pde = create_proc_entry("buffalo/gpio/switch/power", 0, 0);
        pde->read_proc = BuffaloPowerReadProc;
//		pde->write_proc = BuffaloPowerReadProc;

        pde = create_proc_info_entry("buffalo/gpio/switch/slide_switch", 0, 0, BuffaloSlideSwitchReadProc);
    }


    if (BIT_AUTO_POWER >= 0) {
        pde = create_proc_entry("buffalo/gpio/switch/auto_power", 0, 0);
        pde->read_proc = BuffaloAutoPowerReadProc;
//		pde->write_proc = BuffaloAutoPowerReadProc;
    }

    if (use_slide_power == 1 || BIT_AUTO_POWER >= 0) {
        pde = create_proc_entry("buffalo/gpio/switch/sw_control", 0, 0);
        pde->read_proc = BuffaloSwPollingReadProc;
        pde->write_proc = BuffaloSwPollingWriteProc;
    }

    if (BIT_FUNC >= 0) {
        pde = create_proc_entry("buffalo/gpio/switch/func", 0, 0);
        pde->read_proc = BuffaloFuncReadProc;
        //		pde->write_proc= BuffaloFuncReadProc;
    }

    if (BIT_FAN_LOW >= 0 && BIT_FAN_HIGH) {
        pde = create_proc_entry("buffalo/gpio/fan/control", 0, 0);
        pde->read_proc = BuffaloFanControlReadProc;
        pde->write_proc= BuffaloFanControlWriteProc;
    }

    if (BIT_FAN_LCK >= 0) {
        pde = create_proc_entry("buffalo/gpio/fan/lock", 0, 0);
        pde->read_proc = BuffaloFanStatusReadProc;
        pde->write_proc= BuffaloFanStatusWriteProc;
    }

    pde = create_proc_entry("buffalo/gpio/data_out_register", 0, 0);
    pde->read_proc = BuffaloGpioRegisterReadProc;
    pde->write_proc= BuffaloGpioRegisterWriteProc;
    pde->data = (void *)GPP_DATA_OUT_REG(0);

    pde = create_proc_entry("buffalo/gpio/data_out_enable_register", 0, 0);
    pde->read_proc = BuffaloGpioRegisterReadProc;
    pde->write_proc= BuffaloGpioRegisterWriteProc;
    pde->data = (void *)GPP_DATA_OUT_EN_REG(0);

    pde = create_proc_entry("buffalo/gpio/blink_enable_register", 0, 0);
    pde->read_proc = BuffaloGpioRegisterReadProc;
    pde->write_proc= BuffaloGpioRegisterWriteProc;
    pde->data = (void *)GPP_BLINK_EN_REG(0);

    pde = create_proc_entry("buffalo/gpio/data_in_polarity_register", 0, 0);
    pde->read_proc = BuffaloGpioRegisterReadProc;
    pde->write_proc= BuffaloGpioRegisterWriteProc;
    pde->data = (void *)GPP_DATA_IN_POL_REG(0);

    pde = create_proc_entry("buffalo/gpio/data_in_register", 0, 0);
    pde->read_proc = BuffaloGpioRegisterReadProc;
    pde->write_proc= BuffaloGpioRegisterWriteProc;
    pde->data = (void *)GPP_DATA_IN_REG(0);

    if (Buffalo_has_PM()) {
        for (i=0; i<4; i++) {
            sprintf(buf, "buffalo/gpio/power_control/hdd%d", i);
            pde = create_proc_entry(buf, 0, 0);
            if (pde != NULL) {
                pde->read_proc = BuffaloPMHddPowerReadProc;
                pde->write_proc= BuffaloPMHddPowerWriteProc;
                pde->owner = THIS_MODULE;
                pde->data = (void *)i;
            }

            sprintf(buf, "buffalo/gpio/led/pm_diag_led%d", i);
            pde = create_proc_entry(buf, 0, 0);
            if (pde != NULL) {
                pde->read_proc = BuffaloPMHddDiagLedReadProc;
                pde->write_proc= BuffaloPMHddDiagLedWriteProc;
                pde->owner = THIS_MODULE;
                pde->data = (void *)i;
            }
        }
    }

    printk("%s %s Ver.%s installed.\n", DRIVER_NAME, AUTHOR, BUFFALO_DRIVER_VER);
    return 0;
}