static ssize_t h1940bt_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int new_state; char *endp; new_state = simple_strtoul(buf, &endp, 0); if (*endp && !isspace(*endp)) return -EINVAL; h1940bt_enable(new_state); return count; }
static int h1940bt_remove(struct platform_device *pdev) { struct rfkill *rfk = platform_get_drvdata(pdev); platform_set_drvdata(pdev, NULL); if (rfk) { rfkill_unregister(rfk); rfkill_destroy(rfk); } rfk = NULL; h1940bt_enable(0); return 0; }
static int __init h1940bt_probe(struct platform_device *pdev) { /* Configures BT serial port GPIOs */ s3c2410_gpio_cfgpin(S3C2410_GPH0, S3C2410_GPH0_nCTS0); s3c2410_gpio_pullup(S3C2410_GPH0, 1); s3c2410_gpio_cfgpin(S3C2410_GPH1, S3C2410_GPH1_OUTP); s3c2410_gpio_pullup(S3C2410_GPH1, 1); s3c2410_gpio_cfgpin(S3C2410_GPH2, S3C2410_GPH2_TXD0); s3c2410_gpio_pullup(S3C2410_GPH2, 1); s3c2410_gpio_cfgpin(S3C2410_GPH3, S3C2410_GPH3_RXD0); s3c2410_gpio_pullup(S3C2410_GPH3, 1); #ifdef CONFIG_LEDS_H1940 led_trigger_register_simple("h1940-bluetooth", &bt_led_trigger); #endif /* disable BT by default */ h1940bt_enable(0); return device_create_file(&pdev->dev, &dev_attr_enable); }
static int h1940bt_set_block(void *data, bool blocked) { h1940bt_enable(!blocked); return 0; }