Esempio n. 1
0
/* Bluetooth control */
static void h1940bt_enable(int on)
{
    if (on) {
#ifdef CONFIG_LEDS_H1940
        /* flashing Blue */
        led_trigger_event(bt_led_trigger, LED_HALF);
#endif

        /* Power on the chip */
        h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER);
        /* Reset the chip */
        mdelay(10);
        s3c2410_gpio_setpin(S3C2410_GPH1, 1);
        mdelay(10);
        s3c2410_gpio_setpin(S3C2410_GPH1, 0);

        state = 1;
    }
    else {
#ifdef CONFIG_LEDS_H1940
        led_trigger_event(bt_led_trigger, 0);
#endif

        s3c2410_gpio_setpin(S3C2410_GPH1, 1);
        mdelay(10);
        s3c2410_gpio_setpin(S3C2410_GPH1, 0);
        mdelay(10);
        h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0);

        state = 0;
    }
}
/*
 * Blue led.
 * (it can only be blue flashing led)
 */
static void h1940_blueled_set(struct led_classdev *led_dev,
			      enum led_brightness value)
{
	if (value) {
		/* flashing Blue */
		h1940_latch_control(0, H1940_LATCH_LED_FLASH);
		s3c2410_gpio_setpin(S3C2410_GPA3, 1);
	} else {
		h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
		s3c2410_gpio_setpin(S3C2410_GPA3, 0);
	}

}
Esempio n. 3
0
static void h1940_gpiolib_latch_set(struct gpio_chip *chip,
					unsigned offset, int value)
{
	int latch_bit = h1940_gpiolib_to_latch(offset);

	h1940_latch_control(value ? 0 : latch_bit,
		value ? latch_bit : 0);
}
Esempio n. 4
0
static void h1940_udc_pullup(enum s3c2410_udc_cmd_e cmd)
{
	printk(KERN_DEBUG "udc: pullup(%d)\n",cmd);

	switch (cmd)
	{
		case S3C2410_UDC_P_ENABLE :
			h1940_latch_control(0, H1940_LATCH_USB_DP);
			break;
		case S3C2410_UDC_P_DISABLE :
			h1940_latch_control(H1940_LATCH_USB_DP, 0);
			break;
		case S3C2410_UDC_P_RESET :
			break;
		default:
			break;
	}
}
/* Bluetooth control */
static void h1940bt_enable(int on)
{
	if (on) {
		/* Power on the chip */
		h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER);
		/* Reset the chip */
		mdelay(10);
		s3c2410_gpio_setpin(S3C2410_GPH(1), 1);
		mdelay(10);
		s3c2410_gpio_setpin(S3C2410_GPH(1), 0);
	}
	else {
		s3c2410_gpio_setpin(S3C2410_GPH(1), 1);
		mdelay(10);
		s3c2410_gpio_setpin(S3C2410_GPH(1), 0);
		mdelay(10);
		h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0);
	}
}
/*
 * Red led.
 */
static void h1940_redled_set(struct led_classdev *led_dev,
			     enum led_brightness value)
{
	switch (value) {
	case LED_HALF:
		h1940_latch_control(0, H1940_LATCH_LED_FLASH);
		s3c2410_gpio_setpin(S3C2410_GPA1, 1);
		break;
	case LED_FULL:
		h1940_latch_control(0, H1940_LATCH_LED_RED);
		s3c2410_gpio_setpin(S3C2410_GPA1, 1);
		break;
	default:
	case LED_OFF:
		h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
		h1940_latch_control(H1940_LATCH_LED_RED, 0);
		s3c2410_gpio_setpin(S3C2410_GPA1, 0);
		break;
	}
}
Esempio n. 7
0
static void __init h1940_map_io(void)
{
	s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
	s3c24xx_init_clocks(0);
	s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));

	/* setup PM */

#ifdef CONFIG_PM_H1940
	memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
#endif
	s3c_pm_init();

	/* Add latch gpio chip, set latch initial value */
	h1940_latch_control(0, 0);
	WARN_ON(gpiochip_add(&h1940_latch_gpiochip));
}