static int __init dev_init(void) { int ret; ret = misc_register(&misc); printk (DEVICE_NAME"\tinitialized\n"); s3c2410_gpio_cfgpin(S3C2410_GPG(4), S3C2410_GPIO_OUTPUT); set_bl(1); return ret; }
static ssize_t dev_write(struct file *file, const char *buffer, size_t count, loff_t * ppos) { unsigned char ch; int ret; if (count == 0) { return count; } ret = copy_from_user(&ch, buffer, sizeof ch) ? -EFAULT : 0; if (ret) { return ret; } ch &= 0x01; set_bl(ch); return count; }
static int __init bl_dev_init(void) { int ret; ret = gpio_request(GPIO_BL, "backlight"); if (ret) { printk("%s: request GPIO %d for backlight failed, ret = %d\n", DEVICE_NAME, GPIO_BL, ret); return ret; } s3c_gpio_cfgpin(GPIO_BL, S3C_GPIO_OUTPUT); set_bl(1); gpio_free(GPIO_BL); ret = misc_register(&misc); printk(DEVICE_NAME"\tinitialized\n"); return ret; }