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

Commit 321709c5 authored by Richard Purdie's avatar Richard Purdie
Browse files

backlight: Clean up pmac_backlight handling



Move the setting/unsetting of pmac_backlight into the
backlight core instead of doing it in each driver.

Signed-off-by: default avatarRichard Purdie <rpurdie@rpsys.net>
parent e0e34ef7
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -170,11 +170,6 @@ void __init pmu_backlight_init()
	bd->props->power = FB_BLANK_UNBLANK;
	backlight_update_status(bd);

	mutex_lock(&pmac_backlight_mutex);
	if (!pmac_backlight)
		pmac_backlight = bd;
	mutex_unlock(&pmac_backlight_mutex);

	printk("pmubl: Backlight initialized (%s)\n", name);

	return;
+9 −6
Original line number Diff line number Diff line
@@ -384,7 +384,7 @@ static void sony_snc_pf_remove(void)
static int sony_backlight_update_status(struct backlight_device *bd)
{
	return acpi_callsetfunc(sony_acpi_handle, "SBRT",
				bd->props->brightness + 1, NULL);
				bd->props.brightness + 1, NULL);
}

static int sony_backlight_get_brightness(struct backlight_device *bd)
@@ -398,10 +398,9 @@ static int sony_backlight_get_brightness(struct backlight_device *bd)
}

static struct backlight_device *sony_backlight_device;
static struct backlight_properties sony_backlight_properties = {
static struct backlight_ops sony_backlight_ops = {
	.update_status = sony_backlight_update_status,
	.get_brightness = sony_backlight_get_brightness,
	.max_brightness = SONY_MAX_BRIGHTNESS - 1,
};

/*
@@ -483,15 +482,19 @@ static int sony_acpi_add(struct acpi_device *device)
	if (ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle, "GBRT", &handle))) {
		sony_backlight_device = backlight_device_register("sony", NULL,
								  NULL,
								  &sony_backlight_properties);
								  &sony_backlight_ops);

		if (IS_ERR(sony_backlight_device)) {
			printk(LOG_PFX "unable to register backlight device\n");
			sony_backlight_device = NULL;
		} else
			sony_backlight_properties.brightness =
		} else {
			sony_backlight_device->props.brightness =
			    sony_backlight_get_brightness
			    (sony_backlight_device);
			sony_backlight_device->props.max_brightness = 
			    SONY_MAX_BRIGHTNESS - 1;
		}

	}

	if (sony_snc_pf_add())
+2 −18
Original line number Diff line number Diff line
@@ -1829,13 +1829,6 @@ static void aty128_bl_init(struct aty128fb_par *par)
	bd->props->power = FB_BLANK_UNBLANK;
	backlight_update_status(bd);

#ifdef CONFIG_PMAC_BACKLIGHT
	mutex_lock(&pmac_backlight_mutex);
	if (!pmac_backlight)
		pmac_backlight = bd;
	mutex_unlock(&pmac_backlight_mutex);
#endif

	printk("aty128: Backlight initialized (%s)\n", name);

	return;
@@ -1846,18 +1839,9 @@ static void aty128_bl_init(struct aty128fb_par *par)

static void aty128_bl_exit(struct backlight_device *bd)
{
	if (bd) {
#ifdef CONFIG_PMAC_BACKLIGHT
		mutex_lock(&pmac_backlight_mutex);
		if (pmac_backlight == bd)
			pmac_backlight = NULL;
		mutex_unlock(&pmac_backlight_mutex);
#endif
	backlight_device_unregister(bd);

	printk("aty128: Backlight unloaded\n");
}
}
#endif /* CONFIG_FB_ATY128_BACKLIGHT */

/*
+2 −18
Original line number Diff line number Diff line
@@ -2198,13 +2198,6 @@ static void aty_bl_init(struct atyfb_par *par)
	bd->props->power = FB_BLANK_UNBLANK;
	backlight_update_status(bd);

#ifdef CONFIG_PMAC_BACKLIGHT
	mutex_lock(&pmac_backlight_mutex);
	if (!pmac_backlight)
		pmac_backlight = bd;
	mutex_unlock(&pmac_backlight_mutex);
#endif

	printk("aty: Backlight initialized (%s)\n", name);

	return;
@@ -2215,18 +2208,9 @@ static void aty_bl_init(struct atyfb_par *par)

static void aty_bl_exit(struct backlight_device *bd)
{
	if (bd) {
#ifdef CONFIG_PMAC_BACKLIGHT
		mutex_lock(&pmac_backlight_mutex);
		if (pmac_backlight == bd)
			pmac_backlight = NULL;
		mutex_unlock(&pmac_backlight_mutex);
#endif
	backlight_device_unregister(bd);

	printk("aty: Backlight unloaded\n");
}
}

#endif /* CONFIG_FB_ATY_BACKLIGHT */

+0 −13
Original line number Diff line number Diff line
@@ -192,13 +192,6 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
	bd->props->power = FB_BLANK_UNBLANK;
	backlight_update_status(bd);

#ifdef CONFIG_PMAC_BACKLIGHT
	mutex_lock(&pmac_backlight_mutex);
	if (!pmac_backlight)
		pmac_backlight = bd;
	mutex_unlock(&pmac_backlight_mutex);
#endif

	printk("radeonfb: Backlight initialized (%s)\n", name);

	return;
@@ -215,12 +208,6 @@ void radeonfb_bl_exit(struct radeonfb_info *rinfo)
	if (bd) {
		struct radeon_bl_privdata *pdata;

#ifdef CONFIG_PMAC_BACKLIGHT
		mutex_lock(&pmac_backlight_mutex);
		if (pmac_backlight == bd)
			pmac_backlight = NULL;
		mutex_unlock(&pmac_backlight_mutex);
#endif
		pdata = class_get_devdata(&bd->class_dev);
		backlight_device_unregister(bd);
		kfree(pdata);
Loading