Release 4.14 drivers/video/backlight/omap1_bl.c
/*
* Backlight driver for OMAP based boards.
*
* Copyright (c) 2006 Andrzej Zaborowski <balrog@zabor.org>
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this package; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/fb.h>
#include <linux/backlight.h>
#include <linux/slab.h>
#include <linux/platform_data/omap1_bl.h>
#include <mach/hardware.h>
#include <mach/mux.h>
#define OMAPBL_MAX_INTENSITY 0xff
struct omap_backlight {
int powermode;
int current_intensity;
struct device *dev;
struct omap_backlight_config *pdata;
};
static inline void omapbl_send_intensity(int intensity)
{
omap_writeb(intensity, OMAP_PWL_ENABLE);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrzej Zaborowski | 16 | 94.12% | 1 | 50.00% |
Jingoo Han | 1 | 5.88% | 1 | 50.00% |
Total | 17 | 100.00% | 2 | 100.00% |
static inline void omapbl_send_enable(int enable)
{
omap_writeb(enable, OMAP_PWL_CLK_ENABLE);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrzej Zaborowski | 16 | 94.12% | 1 | 50.00% |
Jingoo Han | 1 | 5.88% | 1 | 50.00% |
Total | 17 | 100.00% | 2 | 100.00% |
static void omapbl_blank(struct omap_backlight *bl, int mode)
{
if (bl->pdata->set_power)
bl->pdata->set_power(bl->dev, mode);
switch (mode) {
case FB_BLANK_NORMAL:
case FB_BLANK_VSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
case FB_BLANK_POWERDOWN:
omapbl_send_intensity(0);
omapbl_send_enable(0);
break;
case FB_BLANK_UNBLANK:
omapbl_send_intensity(bl->current_intensity);
omapbl_send_enable(1);
break;
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrzej Zaborowski | 80 | 100.00% | 1 | 100.00% |
Total | 80 | 100.00% | 1 | 100.00% |
#ifdef CONFIG_PM_SLEEP
static int omapbl_suspend(struct device *dev)
{
struct backlight_device *bl_dev = dev_get_drvdata(dev);
struct omap_backlight *bl = bl_get_data(bl_dev);
omapbl_blank(bl, FB_BLANK_POWERDOWN);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrzej Zaborowski | 34 | 82.93% | 1 | 33.33% |
Jingoo Han | 7 | 17.07% | 2 | 66.67% |
Total | 41 | 100.00% | 3 | 100.00% |
static int omapbl_resume(struct device *dev)
{
struct backlight_device *bl_dev = dev_get_drvdata(dev);
struct omap_backlight *bl = bl_get_data(bl_dev);
omapbl_blank(bl, bl->powermode);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrzej Zaborowski | 36 | 83.72% | 1 | 33.33% |
Jingoo Han | 7 | 16.28% | 2 | 66.67% |
Total | 43 | 100.00% | 3 | 100.00% |
#endif
static int omapbl_set_power(struct backlight_device *dev, int state)
{
struct omap_backlight *bl = bl_get_data(dev);
omapbl_blank(bl, state);
bl->powermode = state;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrzej Zaborowski | 39 | 97.50% | 1 | 50.00% |
Jingoo Han | 1 | 2.50% | 1 | 50.00% |
Total | 40 | 100.00% | 2 | 100.00% |
static int omapbl_update_status(struct backlight_device *dev)
{
struct omap_backlight *bl = bl_get_data(dev);
if (bl->current_intensity != dev->props.brightness) {
if (bl->powermode == FB_BLANK_UNBLANK)
omapbl_send_intensity(dev->props.brightness);
bl->current_intensity = dev->props.brightness;
}
if (dev->props.fb_blank != bl->powermode)
omapbl_set_power(dev, dev->props.fb_blank);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrzej Zaborowski | 87 | 98.86% | 1 | 50.00% |
Jingoo Han | 1 | 1.14% | 1 | 50.00% |
Total | 88 | 100.00% | 2 | 100.00% |
static int omapbl_get_intensity(struct backlight_device *dev)
{
struct omap_backlight *bl = bl_get_data(dev);
return bl->current_intensity;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrzej Zaborowski | 25 | 96.15% | 1 | 50.00% |
Jingoo Han | 1 | 3.85% | 1 | 50.00% |
Total | 26 | 100.00% | 2 | 100.00% |
static const struct backlight_ops omapbl_ops = {
.get_brightness = omapbl_get_intensity,
.update_status = omapbl_update_status,
};
static int omapbl_probe(struct platform_device *pdev)
{
struct backlight_properties props;
struct backlight_device *dev;
struct omap_backlight *bl;
struct omap_backlight_config *pdata = dev_get_platdata(&pdev->dev);
if (!pdata)
return -ENXIO;
bl = devm_kzalloc(&pdev->dev, sizeof(struct omap_backlight),
GFP_KERNEL);
if (unlikely(!bl))
return -ENOMEM;
memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_RAW;
props.max_brightness = OMAPBL_MAX_INTENSITY;
dev = devm_backlight_device_register(&pdev->dev, "omap-bl", &pdev->dev,
bl, &omapbl_ops, &props);
if (IS_ERR(dev))
return PTR_ERR(dev);
bl->powermode = FB_BLANK_POWERDOWN;
bl->current_intensity = 0;
bl->pdata = pdata;
bl->dev = &pdev->dev;
platform_set_drvdata(pdev, dev);
omap_cfg_reg(PWL); /* Conflicts with UART3 */
dev->props.fb_blank = FB_BLANK_UNBLANK;
dev->props.brightness = pdata->default_intensity;
omapbl_update_status(dev);
dev_info(&pdev->dev, "OMAP LCD backlight initialised\n");
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrzej Zaborowski | 162 | 74.65% | 1 | 14.29% |
Matthew Garrett | 33 | 15.21% | 2 | 28.57% |
Jingoo Han | 16 | 7.37% | 3 | 42.86% |
Julia Lawall | 6 | 2.76% | 1 | 14.29% |
Total | 217 | 100.00% | 7 | 100.00% |
static SIMPLE_DEV_PM_OPS(omapbl_pm_ops, omapbl_suspend, omapbl_resume);
static struct platform_driver omapbl_driver = {
.probe = omapbl_probe,
.driver = {
.name = "omap-bl",
.pm = &omapbl_pm_ops,
},
};
module_platform_driver(omapbl_driver);
MODULE_AUTHOR("Andrzej Zaborowski <balrog@zabor.org>");
MODULE_DESCRIPTION("OMAP LCD Backlight driver");
MODULE_LICENSE("GPL");
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrzej Zaborowski | 606 | 85.84% | 1 | 6.67% |
Jingoo Han | 52 | 7.37% | 6 | 40.00% |
Matthew Garrett | 33 | 4.67% | 2 | 13.33% |
Julia Lawall | 6 | 0.85% | 1 | 6.67% |
Tejun Heo | 3 | 0.42% | 1 | 6.67% |
Axel Lin | 2 | 0.28% | 1 | 6.67% |
Igor Grinberg | 2 | 0.28% | 1 | 6.67% |
Emese Revfy | 1 | 0.14% | 1 | 6.67% |
Tony Lindgren | 1 | 0.14% | 1 | 6.67% |
Total | 706 | 100.00% | 15 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.