Release 4.14 drivers/video/backlight/hp680_bl.c
/*
* Backlight Driver for HP Jornada 680
*
* Copyright (c) 2005 Andriy Skulysh
*
* Based on Sharp's Corgi Backlight Driver
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/spinlock.h>
#include <linux/fb.h>
#include <linux/backlight.h>
#include <cpu/dac.h>
#include <mach/hp6xx.h>
#include <asm/hd64461.h>
#define HP680_MAX_INTENSITY 255
#define HP680_DEFAULT_INTENSITY 10
static int hp680bl_suspended;
static int current_intensity;
static DEFINE_SPINLOCK(bl_lock);
static void hp680bl_send_intensity(struct backlight_device *bd)
{
unsigned long flags;
u16 v;
int intensity = bd->props.brightness;
if (bd->props.power != FB_BLANK_UNBLANK)
intensity = 0;
if (bd->props.fb_blank != FB_BLANK_UNBLANK)
intensity = 0;
if (hp680bl_suspended)
intensity = 0;
spin_lock_irqsave(&bl_lock, flags);
if (intensity && current_intensity == 0) {
sh_dac_enable(DAC_LCD_BRIGHTNESS);
v = inw(HD64461_GPBDR);
v &= ~HD64461_GPBDR_LCDOFF;
outw(v, HD64461_GPBDR);
sh_dac_output(255-(u8)intensity, DAC_LCD_BRIGHTNESS);
} else if (intensity == 0 && current_intensity != 0) {
sh_dac_output(255-(u8)intensity, DAC_LCD_BRIGHTNESS);
sh_dac_disable(DAC_LCD_BRIGHTNESS);
v = inw(HD64461_GPBDR);
v |= HD64461_GPBDR_LCDOFF;
outw(v, HD64461_GPBDR);
} else if (intensity) {
sh_dac_output(255-(u8)intensity, DAC_LCD_BRIGHTNESS);
}
spin_unlock_irqrestore(&bl_lock, flags);
current_intensity = intensity;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Richard Purdie | 109 | 55.61% | 2 | 66.67% |
Andriy Skulysh | 87 | 44.39% | 1 | 33.33% |
Total | 196 | 100.00% | 3 | 100.00% |
#ifdef CONFIG_PM_SLEEP
static int hp680bl_suspend(struct device *dev)
{
struct backlight_device *bd = dev_get_drvdata(dev);
hp680bl_suspended = 1;
hp680bl_send_intensity(bd);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andriy Skulysh | 15 | 45.45% | 1 | 25.00% |
Richard Purdie | 14 | 42.42% | 2 | 50.00% |
Jingoo Han | 4 | 12.12% | 1 | 25.00% |
Total | 33 | 100.00% | 4 | 100.00% |
static int hp680bl_resume(struct device *dev)
{
struct backlight_device *bd = dev_get_drvdata(dev);
hp680bl_suspended = 0;
hp680bl_send_intensity(bd);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andriy Skulysh | 15 | 45.45% | 1 | 25.00% |
Richard Purdie | 14 | 42.42% | 2 | 50.00% |
Jingoo Han | 4 | 12.12% | 1 | 25.00% |
Total | 33 | 100.00% | 4 | 100.00% |
#endif
static SIMPLE_DEV_PM_OPS(hp680bl_pm_ops, hp680bl_suspend, hp680bl_resume);
static int hp680bl_set_intensity(struct backlight_device *bd)
{
hp680bl_send_intensity(bd);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andriy Skulysh | 18 | 94.74% | 1 | 50.00% |
Richard Purdie | 1 | 5.26% | 1 | 50.00% |
Total | 19 | 100.00% | 2 | 100.00% |
static int hp680bl_get_intensity(struct backlight_device *bd)
{
return current_intensity;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andriy Skulysh | 14 | 100.00% | 1 | 100.00% |
Total | 14 | 100.00% | 1 | 100.00% |
static const struct backlight_ops hp680bl_ops = {
.get_brightness = hp680bl_get_intensity,
.update_status = hp680bl_set_intensity,
};
static int hp680bl_probe(struct platform_device *pdev)
{
struct backlight_properties props;
struct backlight_device *bd;
memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_RAW;
props.max_brightness = HP680_MAX_INTENSITY;
bd = devm_backlight_device_register(&pdev->dev, "hp680-bl", &pdev->dev,
NULL, &hp680bl_ops, &props);
if (IS_ERR(bd))
return PTR_ERR(bd);
platform_set_drvdata(pdev, bd);
bd->props.brightness = HP680_DEFAULT_INTENSITY;
hp680bl_send_intensity(bd);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andriy Skulysh | 35 | 32.71% | 1 | 12.50% |
Richard Purdie | 33 | 30.84% | 4 | 50.00% |
Matthew Garrett | 33 | 30.84% | 2 | 25.00% |
Jingoo Han | 6 | 5.61% | 1 | 12.50% |
Total | 107 | 100.00% | 8 | 100.00% |
static int hp680bl_remove(struct platform_device *pdev)
{
struct backlight_device *bd = platform_get_drvdata(pdev);
bd->props.brightness = 0;
bd->props.power = 0;
hp680bl_send_intensity(bd);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Henrique de Moraes Holschuh | 14 | 31.11% | 1 | 20.00% |
Richard Purdie | 13 | 28.89% | 2 | 40.00% |
Andriy Skulysh | 12 | 26.67% | 1 | 20.00% |
Kristoffer Ericson | 6 | 13.33% | 1 | 20.00% |
Total | 45 | 100.00% | 5 | 100.00% |
static struct platform_driver hp680bl_driver = {
.probe = hp680bl_probe,
.remove = hp680bl_remove,
.driver = {
.name = "hp680-bl",
.pm = &hp680bl_pm_ops,
},
};
static struct platform_device *hp680bl_device;
static int __init hp680bl_init(void)
{
int ret;
ret = platform_driver_register(&hp680bl_driver);
if (ret)
return ret;
hp680bl_device = platform_device_register_simple("hp680-bl", -1,
NULL, 0);
if (IS_ERR(hp680bl_device)) {
platform_driver_unregister(&hp680bl_driver);
return PTR_ERR(hp680bl_device);
}
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andriy Skulysh | 34 | 52.31% | 1 | 33.33% |
Akinobu Mita | 16 | 24.62% | 1 | 33.33% |
Richard Purdie | 15 | 23.08% | 1 | 33.33% |
Total | 65 | 100.00% | 3 | 100.00% |
static void __exit hp680bl_exit(void)
{
platform_device_unregister(hp680bl_device);
platform_driver_unregister(&hp680bl_driver);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andriy Skulysh | 19 | 95.00% | 1 | 50.00% |
Richard Purdie | 1 | 5.00% | 1 | 50.00% |
Total | 20 | 100.00% | 2 | 100.00% |
module_init(hp680bl_init);
module_exit(hp680bl_exit);
MODULE_AUTHOR("Andriy Skulysh <askulysh@gmail.com>");
MODULE_DESCRIPTION("HP Jornada 680 Backlight Driver");
MODULE_LICENSE("GPL");
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andriy Skulysh | 360 | 52.79% | 2 | 11.76% |
Richard Purdie | 215 | 31.52% | 4 | 23.53% |
Matthew Garrett | 33 | 4.84% | 2 | 11.76% |
Jingoo Han | 31 | 4.55% | 2 | 11.76% |
Akinobu Mita | 16 | 2.35% | 1 | 5.88% |
Henrique de Moraes Holschuh | 14 | 2.05% | 1 | 5.88% |
Kristoffer Ericson | 6 | 0.88% | 1 | 5.88% |
Ingo Molnar | 4 | 0.59% | 1 | 5.88% |
Paul Mundt | 2 | 0.29% | 2 | 11.76% |
Emese Revfy | 1 | 0.15% | 1 | 5.88% |
Total | 682 | 100.00% | 17 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.