Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d00ba726 authored by Richard Purdie's avatar Richard Purdie
Browse files

backlight: Rename the corgi backlight driver to generic



The corgi backlight driver is really generic code. This rename makes
this a lot clearer and completes the partial rename made a while ago.

Signed-off-by: default avatarRichard Purdie <rpurdie@linux.intel.com>
parent f4f6bda0
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -123,17 +123,14 @@ config BACKLIGHT_ATMEL_PWM
	  To compile this driver as a module, choose M here: the module will be
	  called atmel-pwm-bl.

config BACKLIGHT_CORGI
	tristate "Generic (aka Sharp Corgi) Backlight Driver (DEPRECATED)"
config BACKLIGHT_GENERIC
	tristate "Generic (aka Sharp Corgi) Backlight Driver"
	depends on BACKLIGHT_CLASS_DEVICE
	default n
	default y
	help
	  Say y to enable the generic platform backlight driver previously
	  known as the Corgi backlight driver. If you have a Sharp Zaurus
	  SL-C7xx, SL-Cxx00 or SL-6000x say y. Most users can say n.

	  Note: this driver is marked as deprecated, try enable SPI and
	  use the new corgi_lcd driver with integrated backlight control
	  SL-C7xx, SL-Cxx00 or SL-6000x say y.

config BACKLIGHT_LOCOMO
	tristate "Sharp LOCOMO LCD/Backlight Driver"
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o

obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o
obj-$(CONFIG_BACKLIGHT_ATMEL_PWM)    += atmel-pwm-bl.o
obj-$(CONFIG_BACKLIGHT_CORGI)	+= corgi_bl.o
obj-$(CONFIG_BACKLIGHT_GENERIC)	+= generic_bl.o
obj-$(CONFIG_BACKLIGHT_HP680)	+= hp680_bl.o
obj-$(CONFIG_BACKLIGHT_LOCOMO)	+= locomolcd.o
obj-$(CONFIG_BACKLIGHT_OMAP1)	+= omap1_bl.o
+147 −0
Original line number Diff line number Diff line
/*
 *  Backlight Driver for Sharp Zaurus Handhelds (various models)
 *  Generic Backlight Driver
 *
 *  Copyright (c) 2004-2006 Richard Purdie
 *
 *  Based on Sharp's 2.4 Backlight Driver
 *  Copyright (c) 2004-2008 Richard Purdie
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
@@ -19,15 +17,14 @@
#include <linux/fb.h>
#include <linux/backlight.h>

static int corgibl_intensity;
static struct backlight_properties corgibl_data;
static struct backlight_device *corgi_backlight_device;
static int genericbl_intensity;
static struct backlight_device *generic_backlight_device;
static struct generic_bl_info *bl_machinfo;

/* Flag to signal when the battery is low */
#define CORGIBL_BATTLOW       BL_CORE_DRIVER1
#define GENERICBL_BATTLOW       BL_CORE_DRIVER1

static int corgibl_send_intensity(struct backlight_device *bd)
static int genericbl_send_intensity(struct backlight_device *bd)
{
	int intensity = bd->props.brightness;

@@ -37,12 +34,12 @@ static int corgibl_send_intensity(struct backlight_device *bd)
		intensity = 0;
	if (bd->props.state & BL_CORE_SUSPENDED)
		intensity = 0;
	if (bd->props.state & CORGIBL_BATTLOW)
	if (bd->props.state & GENERICBL_BATTLOW)
		intensity &= bl_machinfo->limit_mask;

	bl_machinfo->set_bl_intensity(intensity);

	corgibl_intensity = intensity;
	genericbl_intensity = intensity;

	if (bl_machinfo->kick_battery)
		bl_machinfo->kick_battery();
@@ -50,9 +47,9 @@ static int corgibl_send_intensity(struct backlight_device *bd)
	return 0;
}

static int corgibl_get_intensity(struct backlight_device *bd)
static int genericbl_get_intensity(struct backlight_device *bd)
{
	return corgibl_intensity;
	return genericbl_intensity;
}

/*
@@ -61,29 +58,29 @@ static int corgibl_get_intensity(struct backlight_device *bd)
 */
void corgibl_limit_intensity(int limit)
{
	struct backlight_device *bd = corgi_backlight_device;
	struct backlight_device *bd = generic_backlight_device;

	mutex_lock(&bd->ops_lock);
	if (limit)
		bd->props.state |= CORGIBL_BATTLOW;
		bd->props.state |= GENERICBL_BATTLOW;
	else
		bd->props.state &= ~CORGIBL_BATTLOW;
	backlight_update_status(corgi_backlight_device);
		bd->props.state &= ~GENERICBL_BATTLOW;
	backlight_update_status(generic_backlight_device);
	mutex_unlock(&bd->ops_lock);
}
EXPORT_SYMBOL(corgibl_limit_intensity);


static struct backlight_ops corgibl_ops = {
static struct backlight_ops genericbl_ops = {
	.options = BL_CORE_SUSPENDRESUME,
	.get_brightness = corgibl_get_intensity,
	.update_status  = corgibl_send_intensity,
	.get_brightness = genericbl_get_intensity,
	.update_status  = genericbl_send_intensity,
};

static int corgibl_probe(struct platform_device *pdev)
static int genericbl_probe(struct platform_device *pdev)
{
	struct generic_bl_info *machinfo = pdev->dev.platform_data;
	const char *name = "generic-bl";
	struct backlight_device *bd;

	bl_machinfo = machinfo;
	if (!machinfo->limit_mask)
@@ -92,57 +89,59 @@ static int corgibl_probe(struct platform_device *pdev)
	if (machinfo->name)
		name = machinfo->name;

	corgi_backlight_device = backlight_device_register (name,
		&pdev->dev, NULL, &corgibl_ops);
	if (IS_ERR (corgi_backlight_device))
		return PTR_ERR (corgi_backlight_device);
	bd = backlight_device_register (name,
		&pdev->dev, NULL, &genericbl_ops);
	if (IS_ERR (bd))
		return PTR_ERR (bd);

	platform_set_drvdata(pdev, corgi_backlight_device);
	platform_set_drvdata(pdev, bd);

	bd->props.max_brightness = machinfo->max_intensity;
	bd->props.power = FB_BLANK_UNBLANK;
	bd->props.brightness = machinfo->default_intensity;
	backlight_update_status(bd);

	corgi_backlight_device->props.max_brightness = machinfo->max_intensity;
	corgi_backlight_device->props.power = FB_BLANK_UNBLANK;
	corgi_backlight_device->props.brightness = machinfo->default_intensity;
	backlight_update_status(corgi_backlight_device);
	generic_backlight_device = bd;

	printk("Corgi Backlight Driver Initialized.\n");
	printk("Generic Backlight Driver Initialized.\n");
	return 0;
}

static int corgibl_remove(struct platform_device *pdev)
static int genericbl_remove(struct platform_device *pdev)
{
	struct backlight_device *bd = platform_get_drvdata(pdev);

	corgibl_data.power = 0;
	corgibl_data.brightness = 0;
	bd->props.power = 0;
	bd->props.brightness = 0;
	backlight_update_status(bd);

	backlight_device_unregister(bd);

	printk("Corgi Backlight Driver Unloaded\n");
	printk("Generic Backlight Driver Unloaded\n");
	return 0;
}

static struct platform_driver corgibl_driver = {
	.probe		= corgibl_probe,
	.remove		= corgibl_remove,
static struct platform_driver genericbl_driver = {
	.probe		= genericbl_probe,
	.remove		= genericbl_remove,
	.driver		= {
		.name	= "generic-bl",
	},
};

static int __init corgibl_init(void)
static int __init genericbl_init(void)
{
	return platform_driver_register(&corgibl_driver);
	return platform_driver_register(&genericbl_driver);
}

static void __exit corgibl_exit(void)
static void __exit genericbl_exit(void)
{
	platform_driver_unregister(&corgibl_driver);
	platform_driver_unregister(&genericbl_driver);
}

module_init(corgibl_init);
module_exit(corgibl_exit);
module_init(genericbl_init);
module_exit(genericbl_exit);

MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
MODULE_DESCRIPTION("Corgi Backlight Driver");
MODULE_DESCRIPTION("Generic Backlight Driver");
MODULE_LICENSE("GPL");