Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Backlight control code for Sharp Zaurus SL-5500
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright 2005 John Lenz <lenz@cs.wisc.edu>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Maintainer: Pavel Machek <pavel@ucw.cz> (unless John wants to :-)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * This driver assumes single CPU. That's okay, because collie is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * slightly old hardware, and no one is going to retrofit second CPU to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * old PDA.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) /* LCD power functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/fb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/backlight.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <asm/hardware/locomo.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <asm/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <asm/mach/sharpsl_param.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include "../../../arch/arm/mach-sa1100/generic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) static struct backlight_device *locomolcd_bl_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) static struct locomo_dev *locomolcd_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) static unsigned long locomolcd_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define LOCOMOLCD_SUSPENDED     0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) static void locomolcd_on(int comadj)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	locomo_gpio_set_dir(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VSHA_ON, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VSHA_ON, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	mdelay(2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	locomo_gpio_set_dir(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VSHD_ON, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VSHD_ON, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	mdelay(2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	locomo_m62332_senddata(locomolcd_dev, comadj, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	mdelay(5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	locomo_gpio_set_dir(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VEE_ON, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VEE_ON, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	mdelay(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	/* TFTCRST | CPSOUT=0 | CPSEN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	locomo_writel(0x01, locomolcd_dev->mapbase + LOCOMO_TC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	/* Set CPSD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	locomo_writel(6, locomolcd_dev->mapbase + LOCOMO_CPSD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	/* TFTCRST | CPSOUT=0 | CPSEN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	locomo_writel((0x04 | 0x01), locomolcd_dev->mapbase + LOCOMO_TC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	mdelay(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	locomo_gpio_set_dir(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_MOD, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_MOD, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) static void locomolcd_off(int comadj)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	/* TFTCRST=1 | CPSOUT=1 | CPSEN = 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	locomo_writel(0x06, locomolcd_dev->mapbase + LOCOMO_TC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	mdelay(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VSHA_ON, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	mdelay(110);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VEE_ON, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	mdelay(700);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	/* TFTCRST=0 | CPSOUT=0 | CPSEN = 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	locomo_writel(0, locomolcd_dev->mapbase + LOCOMO_TC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_MOD, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VSHD_ON, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) void locomolcd_power(int on)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	int comadj = sharpsl_param.comadj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	if (!locomolcd_dev) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	/* read comadj */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	if (comadj == -1 && machine_is_collie())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		comadj = 128;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	if (comadj == -1 && machine_is_poodle())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		comadj = 118;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	if (on)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		locomolcd_on(comadj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		locomolcd_off(comadj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) EXPORT_SYMBOL(locomolcd_power);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) static int current_intensity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) static int locomolcd_set_intensity(struct backlight_device *bd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	int intensity = backlight_get_brightness(bd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	if (locomolcd_flags & LOCOMOLCD_SUSPENDED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		intensity = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	switch (intensity) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	 * AC and non-AC are handled differently,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	 * but produce same results in sharp code?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	case 0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		locomo_frontlight_set(locomolcd_dev, 0, 0, 161);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	case 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 		locomo_frontlight_set(locomolcd_dev, 117, 0, 161);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	case 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		locomo_frontlight_set(locomolcd_dev, 163, 0, 148);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	case 3:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		locomo_frontlight_set(locomolcd_dev, 194, 0, 161);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	case 4:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		locomo_frontlight_set(locomolcd_dev, 194, 1, 161);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	current_intensity = intensity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) static int locomolcd_get_intensity(struct backlight_device *bd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	return current_intensity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) static const struct backlight_ops locomobl_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	.get_brightness = locomolcd_get_intensity,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	.update_status  = locomolcd_set_intensity,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) #ifdef CONFIG_PM_SLEEP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) static int locomolcd_suspend(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	locomolcd_flags |= LOCOMOLCD_SUSPENDED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	locomolcd_set_intensity(locomolcd_bl_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) static int locomolcd_resume(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	locomolcd_flags &= ~LOCOMOLCD_SUSPENDED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	locomolcd_set_intensity(locomolcd_bl_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) static SIMPLE_DEV_PM_OPS(locomolcd_pm_ops, locomolcd_suspend, locomolcd_resume);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) static int locomolcd_probe(struct locomo_dev *ldev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	struct backlight_properties props;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	locomolcd_dev = ldev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	locomo_gpio_set_dir(ldev->dev.parent, LOCOMO_GPIO_FL_VR, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	 * the poodle_lcd_power function is called for the first time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	 * from fs_initcall, which is before locomo is activated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	 * We need to recall poodle_lcd_power here
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	if (machine_is_poodle())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 		locomolcd_power(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	memset(&props, 0, sizeof(struct backlight_properties));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	props.type = BACKLIGHT_RAW;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	props.max_brightness = 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	locomolcd_bl_device = backlight_device_register("locomo-bl",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 							&ldev->dev, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 							&locomobl_data, &props);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	if (IS_ERR(locomolcd_bl_device))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		return PTR_ERR(locomolcd_bl_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	/* Set up frontlight so that screen is readable */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	locomolcd_bl_device->props.brightness = 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	locomolcd_set_intensity(locomolcd_bl_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) static int locomolcd_remove(struct locomo_dev *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	locomolcd_bl_device->props.brightness = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	locomolcd_bl_device->props.power = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	locomolcd_set_intensity(locomolcd_bl_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	backlight_device_unregister(locomolcd_bl_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	locomolcd_dev = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) static struct locomo_driver poodle_lcd_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	.drv = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 		.name	= "locomo-backlight",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 		.pm	= &locomolcd_pm_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	.devid	= LOCOMO_DEVID_BACKLIGHT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	.probe	= locomolcd_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	.remove	= locomolcd_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) static int __init locomolcd_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	return locomo_driver_register(&poodle_lcd_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) static void __exit locomolcd_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	locomo_driver_unregister(&poodle_lcd_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) module_init(locomolcd_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) module_exit(locomolcd_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) MODULE_AUTHOR("John Lenz <lenz@cs.wisc.edu>, Pavel Machek <pavel@ucw.cz>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) MODULE_DESCRIPTION("Collie LCD driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) MODULE_LICENSE("GPL");