Commit cad719d8 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight

* 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight:
  gta02: Use pcf50633 backlight driver instead of platform backlight driver.
  backlight: pcf50633: Register a pcf50633-backlight device in pcf50633 core driver.
  backlight: Add pcf50633 backlight driver
  backlight: 88pm860x_bl: fix error handling in pm860x_backlight_probe
  backlight: max8925_bl: Fix error handling path
  backlight: l4f00242t03: fix error handling in l4f00242t03_probe
  backlight: add S6E63M0 AMOLED LCD Panel driver
  backlight: adp8860: add support for ADP8861 & ADP8863
  backlight: mbp_nvidia_bl - Fix DMI_SYS_VENDOR for MacBook1,1
  backlight: Add Cirrus EP93xx backlight driver
  backlight: l4f00242t03: Fix regulators handling code in remove function
  backlight: fix adp8860_bl build errors
  backlight: new driver for the ADP8860 backlight parts
  backlight: 88pm860x_bl - potential memory leak
  backlight: mbp_nvidia_bl - add support for older MacBookPro and MacBook 6,1.
  backlight: Kconfig cleanup
  backlight: backlight_device_register() return ERR_PTR()
parents 3ddab478 67e67df8
......@@ -49,7 +49,6 @@
#include <linux/io.h>
#include <linux/i2c.h>
#include <linux/backlight.h>
#include <linux/regulator/machine.h>
#include <linux/mfd/pcf50633/core.h>
......@@ -57,6 +56,7 @@
#include <linux/mfd/pcf50633/adc.h>
#include <linux/mfd/pcf50633/gpio.h>
#include <linux/mfd/pcf50633/pmic.h>
#include <linux/mfd/pcf50633/backlight.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
......@@ -254,6 +254,12 @@ static char *gta02_batteries[] = {
"battery",
};
static struct pcf50633_bl_platform_data gta02_backlight_data = {
.default_brightness = 0x3f,
.default_brightness_limit = 0,
.ramp_time = 5,
};
struct pcf50633_platform_data gta02_pcf_pdata = {
.resumers = {
[0] = PCF50633_INT1_USBINS |
......@@ -271,6 +277,8 @@ struct pcf50633_platform_data gta02_pcf_pdata = {
.charger_reference_current_ma = 1000,
.backlight_data = &gta02_backlight_data,
.reg_init_data = {
[PCF50633_REGULATOR_AUTO] = {
.constraints = {
......@@ -478,71 +486,6 @@ static struct s3c2410_udc_mach_info gta02_udc_cfg = {
};
static void gta02_bl_set_intensity(int intensity)
{
struct pcf50633 *pcf = gta02_pcf;
int old_intensity = pcf50633_reg_read(pcf, PCF50633_REG_LEDOUT);
/* We map 8-bit intensity to 6-bit intensity in hardware. */
intensity >>= 2;
/*
* This can happen during, eg, print of panic on blanked console,
* but we can't service i2c without interrupts active, so abort.
*/
if (in_atomic()) {
printk(KERN_ERR "gta02_bl_set_intensity called while atomic\n");
return;
}
old_intensity = pcf50633_reg_read(pcf, PCF50633_REG_LEDOUT);
if (intensity == old_intensity)
return;
/* We can't do this anywhere else. */
pcf50633_reg_write(pcf, PCF50633_REG_LEDDIM, 5);
if (!(pcf50633_reg_read(pcf, PCF50633_REG_LEDENA) & 3))
old_intensity = 0;
/*
* The PCF50633 cannot handle LEDOUT = 0 (datasheet p60)
* if seen, you have to re-enable the LED unit.
*/
if (!intensity || !old_intensity)
pcf50633_reg_write(pcf, PCF50633_REG_LEDENA, 0);
/* Illegal to set LEDOUT to 0. */
if (!intensity)
pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_LEDOUT, 0x3f, 2);
else
pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_LEDOUT, 0x3f,
intensity);
if (intensity)
pcf50633_reg_write(pcf, PCF50633_REG_LEDENA, 2);
}
static struct generic_bl_info gta02_bl_info = {
.name = "gta02-bl",
.max_intensity = 0xff,
.default_intensity = 0xff,
.set_bl_intensity = gta02_bl_set_intensity,
};
static struct platform_device gta02_bl_dev = {
.name = "generic-bl",
.id = 1,
.dev = {
.platform_data = &gta02_bl_info,
},
};
/* USB */
static struct s3c2410_hcd_info gta02_usb_info __initdata = {
.port[0] = {
......@@ -579,7 +522,6 @@ static struct platform_device *gta02_devices[] __initdata = {
/* These guys DO need to be children of PMU. */
static struct platform_device *gta02_devices_pmu_children[] = {
&gta02_bl_dev,
};
......
......@@ -620,6 +620,9 @@ static int __devinit pcf50633_probe(struct i2c_client *client,
&pcf->mbc_pdev);
pcf50633_client_dev_register(pcf, "pcf50633-adc",
&pcf->adc_pdev);
pcf50633_client_dev_register(pcf, "pcf50633-backlight",
&pcf->bl_pdev);
for (i = 0; i < PCF50633_NUM_REGULATORS; i++) {
struct platform_device *pdev;
......
......@@ -222,6 +222,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
data->port = __check_device(pdata, name);
if (data->port < 0) {
dev_err(&pdev->dev, "wrong platform data is assigned");
kfree(data);
return -EINVAL;
}
......@@ -266,6 +267,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
backlight_update_status(bl);
return 0;
out:
backlight_device_unregister(bl);
kfree(data);
return ret;
}
......
This diff is collapsed.
......@@ -11,9 +11,11 @@ obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o
obj-$(CONFIG_LCD_VGG2432A4) += vgg2432a4.o
obj-$(CONFIG_LCD_TDO24M) += tdo24m.o
obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o
obj-$(CONFIG_LCD_S6E63M0) += s6e63m0.o
obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o
obj-$(CONFIG_BACKLIGHT_ATMEL_PWM) += atmel-pwm-bl.o
obj-$(CONFIG_BACKLIGHT_EP93XX) += ep93xx_bl.o
obj-$(CONFIG_BACKLIGHT_GENERIC) += generic_bl.o
obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o
obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o
......@@ -30,5 +32,7 @@ obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
obj-$(CONFIG_BACKLIGHT_ADX) += adx_bl.o
obj-$(CONFIG_BACKLIGHT_ADP5520) += adp5520_bl.o
obj-$(CONFIG_BACKLIGHT_ADP8860) += adp8860_bl.o
obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o
obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o
This diff is collapsed.
......@@ -107,8 +107,8 @@ static int __devinit adx_backlight_probe(struct platform_device *pdev)
props.max_brightness = 0xff;
bldev = backlight_device_register(dev_name(&pdev->dev), &pdev->dev,
bl, &adx_backlight_ops, &props);
if (!bldev) {
ret = -ENOMEM;
if (IS_ERR(bldev)) {
ret = PTR_ERR(bldev);
goto out;
}
......
/*
* Driver for the Cirrus EP93xx lcd backlight
*
* Copyright (c) 2010 H Hartley Sweeten <hsweeten@visionengravers.com>
*
* 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
* published by the Free Software Foundation.
*
* This driver controls the pulse width modulated brightness control output,
* BRIGHT, on the Cirrus EP9307, EP9312, and EP9315 processors.
*/
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/fb.h>
#include <linux/backlight.h>
#include <mach/hardware.h>
#define EP93XX_RASTER_REG(x) (EP93XX_RASTER_BASE + (x))
#define EP93XX_RASTER_BRIGHTNESS EP93XX_RASTER_REG(0x20)
#define EP93XX_MAX_COUNT 255
#define EP93XX_MAX_BRIGHT 255
#define EP93XX_DEF_BRIGHT 128
struct ep93xxbl {
void __iomem *mmio;
int brightness;
};
static int ep93xxbl_set(struct backlight_device *bl, int brightness)
{
struct ep93xxbl *ep93xxbl = bl_get_data(bl);
__raw_writel((brightness << 8) | EP93XX_MAX_COUNT, ep93xxbl->mmio);
ep93xxbl->brightness = brightness;
return 0;
}
static int ep93xxbl_update_status(struct backlight_device *bl)
{
int brightness = bl->props.brightness;
if (bl->props.power != FB_BLANK_UNBLANK ||
bl->props.fb_blank != FB_BLANK_UNBLANK)
brightness = 0;
return ep93xxbl_set(bl, brightness);
}
static int ep93xxbl_get_brightness(struct backlight_device *bl)
{
struct ep93xxbl *ep93xxbl = bl_get_data(bl);
return ep93xxbl->brightness;
}
static const struct backlight_ops ep93xxbl_ops = {
.update_status = ep93xxbl_update_status,
.get_brightness = ep93xxbl_get_brightness,
};
static int __init ep93xxbl_probe(struct platform_device *dev)
{
struct ep93xxbl *ep93xxbl;
struct backlight_device *bl;
struct backlight_properties props;
ep93xxbl = devm_kzalloc(&dev->dev, sizeof(*ep93xxbl), GFP_KERNEL);
if (!ep93xxbl)
return -ENOMEM;
/*
* This register is located in the range already ioremap'ed by
* the framebuffer driver. A MFD driver seems a bit of overkill
* to handle this so use the static I/O mapping; this address
* is already virtual.
*
* NOTE: No locking is required; the framebuffer does not touch
* this register.
*/
ep93xxbl->mmio = EP93XX_RASTER_BRIGHTNESS;
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = EP93XX_MAX_BRIGHT;
bl = backlight_device_register(dev->name, &dev->dev, ep93xxbl,
&ep93xxbl_ops, &props);
if (IS_ERR(bl))
return PTR_ERR(bl);
bl->props.brightness = EP93XX_DEF_BRIGHT;
platform_set_drvdata(dev, bl);
ep93xxbl_update_status(bl);
return 0;
}
static int ep93xxbl_remove(struct platform_device *dev)
{
struct backlight_device *bl = platform_get_drvdata(dev);
backlight_device_unregister(bl);
platform_set_drvdata(dev, NULL);
return 0;
}
#ifdef CONFIG_PM
static int ep93xxbl_suspend(struct platform_device *dev, pm_message_t state)
{
struct backlight_device *bl = platform_get_drvdata(dev);
return ep93xxbl_set(bl, 0);
}
static int ep93xxbl_resume(struct platform_device *dev)
{
struct backlight_device *bl = platform_get_drvdata(dev);
backlight_update_status(bl);
return 0;
}
#else
#define ep93xxbl_suspend NULL
#define ep93xxbl_resume NULL
#endif
static struct platform_driver ep93xxbl_driver = {
.driver = {
.name = "ep93xx-bl",
.owner = THIS_MODULE,
},
.probe = ep93xxbl_probe,
.remove = __devexit_p(ep93xxbl_remove),
.suspend = ep93xxbl_suspend,
.resume = ep93xxbl_resume,
};
static int __init ep93xxbl_init(void)
{
return platform_driver_register(&ep93xxbl_driver);
}
module_init(ep93xxbl_init);
static void __exit ep93xxbl_exit(void)
{
platform_driver_unregister(&ep93xxbl_driver);
}
module_exit(ep93xxbl_exit);
MODULE_DESCRIPTION("EP93xx Backlight Driver");
MODULE_AUTHOR("H Hartley Sweeten <hsweeten@visionengravers.com>");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:ep93xx-bl");
......@@ -125,8 +125,7 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
if (priv == NULL) {
dev_err(&spi->dev, "No memory for this device.\n");
ret = -ENOMEM;
goto err;
return -ENOMEM;
}
dev_set_drvdata(&spi->dev, priv);
......@@ -139,7 +138,7 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
if (ret) {
dev_err(&spi->dev,
"Unable to get the lcd l4f00242t03 reset gpio.\n");
return ret;
goto err;
}
ret = gpio_direction_output(pdata->reset_gpio, 1);
......@@ -151,7 +150,7 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
if (ret) {
dev_err(&spi->dev,
"Unable to get the lcd l4f00242t03 data en gpio.\n");
return ret;
goto err2;
}
ret = gpio_direction_output(pdata->data_enable_gpio, 0);
......@@ -222,9 +221,9 @@ static int __devexit l4f00242t03_remove(struct spi_device *spi)
gpio_free(pdata->reset_gpio);
if (priv->io_reg)
regulator_put(priv->core_reg);
if (priv->core_reg)
regulator_put(priv->io_reg);
if (priv->core_reg)
regulator_put(priv->core_reg);
kfree(priv);
......
......@@ -162,6 +162,7 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev)
backlight_update_status(bl);
return 0;
out:
backlight_device_unregister(bl);
kfree(data);
return ret;
}
......
......@@ -141,7 +141,7 @@ static const struct dmi_system_id __initdata mbp_device_table[] = {
.callback = mbp_dmi_match,
.ident = "MacBook 1,1",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBook1,1"),
},
.driver_data = (void *)&intel_chipset_data,
......@@ -182,6 +182,42 @@ static const struct dmi_system_id __initdata mbp_device_table[] = {
},
.driver_data = (void *)&intel_chipset_data,
},
{
.callback = mbp_dmi_match,
.ident = "MacBookPro 1,1",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro1,1"),
},
.driver_data = (void *)&intel_chipset_data,
},
{
.callback = mbp_dmi_match,
.ident = "MacBookPro 1,2",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro1,2"),
},
.driver_data = (void *)&intel_chipset_data,
},
{
.callback = mbp_dmi_match,
.ident = "MacBookPro 2,1",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro2,1"),
},
.driver_data = (void *)&intel_chipset_data,
},
{
.callback = mbp_dmi_match,
.ident = "MacBookPro 2,2",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro2,2"),
},
.driver_data = (void *)&intel_chipset_data,
},
{
.callback = mbp_dmi_match,
.ident = "MacBookPro 3,1",
......@@ -236,6 +272,15 @@ static const struct dmi_system_id __initdata mbp_device_table[] = {
},
.driver_data = (void *)&nvidia_chipset_data,
},
{
.callback = mbp_dmi_match,
.ident = "MacBook 6,1",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBook6,1"),
},
.driver_data = (void *)&nvidia_chipset_data,
},
{
.callback = mbp_dmi_match,
.ident = "MacBookAir 2,1",
......
/*
* Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
* PCF50633 backlight device driver
*
* This program 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.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <linux/backlight.h>
#include <linux/fb.h>
#include <linux/mfd/pcf50633/core.h>
#include <linux/mfd/pcf50633/backlight.h>
struct pcf50633_bl {
struct pcf50633 *pcf;
struct backlight_device *bl;
unsigned int brightness;
unsigned int brightness_limit;
};
/*
* pcf50633_bl_set_brightness_limit
*
* Update the brightness limit for the pc50633 backlight. The actual brightness
* will not go above the limit. This is useful to limit power drain for example
* on low battery.
*
* @dev: Pointer to a pcf50633 device
* @limit: The brightness limit. Valid values are 0-63
*/
int pcf50633_bl_set_brightness_limit(struct pcf50633 *pcf, unsigned int limit)
{
struct pcf50633_bl *pcf_bl = platform_get_drvdata(pcf->bl_pdev);
if (!pcf_bl)
return -ENODEV;
pcf_bl->brightness_limit = limit & 0x3f;
backlight_update_status(pcf_bl->bl);
return 0;
}
static int pcf50633_bl_update_status(struct backlight_device *bl)
{
struct pcf50633_bl *pcf_bl = bl_get_data(bl);
unsigned int new_brightness;
if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK) ||
bl->props.power != FB_BLANK_UNBLANK)
new_brightness = 0;
else if (bl->props.brightness < pcf_bl->brightness_limit)
new_brightness = bl->props.brightness;
else
new_brightness = pcf_bl->brightness_limit;
if (pcf_bl->brightness == new_brightness)
return 0;
if (new_brightness) {
pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDOUT,
new_brightness);
if (!pcf_bl->brightness)
pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDENA, 1);
} else {
pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDENA, 0);
}
pcf_bl->brightness = new_brightness;
return 0;
}
static int pcf50633_bl_get_brightness(struct backlight_device *bl)
{
struct pcf50633_bl *pcf_bl = bl_get_data(bl);
return pcf_bl->brightness;
}
static const struct backlight_ops pcf50633_bl_ops = {
.get_brightness = pcf50633_bl_get_brightness,
.update_status = pcf50633_bl_update_status,
.options = BL_CORE_SUSPENDRESUME,
};
static int __devinit pcf50633_bl_probe(struct platform_device *pdev)
{
int ret;
struct pcf50633_bl *pcf_bl;
struct device *parent = pdev->dev.parent;
struct pcf50633_platform_data *pcf50633_data = parent->platform_data;
struct pcf50633_bl_platform_data *pdata = pcf50633_data->backlight_data;
struct backlight_properties bl_props;
pcf_bl = kzalloc(sizeof(*pcf_bl), GFP_KERNEL);
if (!pcf_bl)
return -ENOMEM;
bl_props.max_brightness = 0x3f;
bl_props.power = FB_BLANK_UNBLANK;
if (pdata) {
bl_props.brightness = pdata->default_brightness;
pcf_bl->brightness_limit = pdata->default_brightness_limit;
} else {
bl_props.brightness = 0x3f;
pcf_bl->brightness_limit = 0x3f;
}
pcf_bl->pcf = dev_to_pcf50633(pdev->dev.parent);
pcf_bl->bl = backlight_device_register(pdev->name, &pdev->dev, pcf_bl,
&pcf50633_bl_ops, &bl_props);
if (IS_ERR(pcf_bl->bl)) {
ret = PTR_ERR(pcf_bl->bl);
goto err_free;
}
platform_set_drvdata(pdev, pcf_bl);
pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDDIM, pdata->ramp_time);
/* Should be different from bl_props.brightness, so we do not exit
* update_status early the first time it's called */
pcf_bl->brightness = pcf_bl->bl->props.brightness + 1;
backlight_update_status(pcf_bl->bl);
return 0;
err_free:
kfree(pcf_bl);
return ret;
}
static int __devexit pcf50633_bl_remove(struct platform_device *pdev)
{
struct pcf50633_bl *pcf_bl = platform_get_drvdata(pdev);
backlight_device_unregister(pcf_bl->bl);
platform_set_drvdata(pdev, NULL);
kfree(pcf_bl);
return 0;
}
static struct platform_driver pcf50633_bl_driver = {
.probe = pcf50633_bl_probe,
.remove = __devexit_p(pcf50633_bl_remove),
.driver = {
.name = "pcf50633-backlight",
},
};
static int __init pcf50633_bl_init(void)
{
return platform_driver_register(&pcf50633_bl_driver);
}
module_init(pcf50633_bl_init);
static void __exit pcf50633_bl_exit(void)
{
platform_driver_unregister(&pcf50633_bl_driver);
}
module_exit(pcf50633_bl_exit);
MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
MODULE_DESCRIPTION("PCF50633 backlight driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:pcf50633-backlight");
This diff is collapsed.
/* linux/drivers/video/samsung/s6e63m0_brightness.h
*
* Gamma level definitions.
*
* Copyright (c) 2009 Samsung Electronics
* InKi Dae <inki.dae@samsung.com>
*
* 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
* published by the Free Software Foundation.
*/
#ifndef _S6E63M0_BRIGHTNESS_H
#define _S6E63M0_BRIGHTNESS_H
#define MAX_GAMMA_LEVEL 11
#define GAMMA_TABLE_COUNT 21
/* gamma value: 2.2 */
static const unsigned int s6e63m0_22_300[] = {
0x18, 0x08, 0x24, 0x5f, 0x50, 0x2d, 0xB6,
0xB9, 0xA7, 0xAd, 0xB1, 0x9f, 0xbe, 0xC0,
0xB5, 0x00, 0xa0, 0x00, 0xa4, 0x00, 0xdb
};
static const unsigned int s6e63m0_22_280[] = {
0x18, 0x08, 0x24, 0x64, 0x56, 0x33, 0xB6,
0xBA, 0xA8, 0xAC, 0xB1, 0x9D, 0xC1, 0xC1,
0xB7, 0x00, 0x9C, 0x00, 0x9F, 0x00, 0xD6
};
static const unsigned int s6e63m0_22_260[] = {
0x18, 0x08, 0x24, 0x66, 0x58, 0x34, 0xB6,
0xBA, 0xA7, 0xAF, 0xB3, 0xA0, 0xC1, 0xC2,
0xB7, 0x00, 0x97, 0x00, 0x9A, 0x00, 0xD1
};
static const unsigned int s6e63m0_22_240[] = {
0x18, 0x08, 0x24, 0x62, 0x54, 0x30, 0xB9,
0xBB, 0xA9, 0xB0, 0xB3, 0xA1, 0xC1, 0xC3,
0xB7, 0x00, 0x91, 0x00, 0x95, 0x00, 0xDA
};
static const unsigned int s6e63m0_22_220[] = {
0x18, 0x08, 0x24, 0x63, 0x53, 0x31, 0xB8,
0xBC, 0xA9, 0xB0, 0xB5, 0xA2, 0xC4, 0xC4,
0xB8, 0x00, 0x8B, 0x00, 0x8E, 0x00, 0xC2
};
static const unsigned int s6e63m0_22_200[] = {
0x18, 0x08, 0x24, 0x66, 0x55, 0x34, 0xBA,
0xBD, 0xAB, 0xB1, 0xB5, 0xA3, 0xC5, 0xC6,
0xB9, 0x00, 0x85, 0x00, 0x88, 0x00, 0xBA
};
static const unsigned int s6e63m0_22_170[] = {
0x18, 0x08, 0x24, 0x69, 0x54, 0x37, 0xBB,
0xBE, 0xAC, 0xB4, 0xB7, 0xA6, 0xC7, 0xC8,
0xBC, 0x00, 0x7B, 0x00, 0x7E, 0x00, 0xAB
};
static const unsigned int s6e63m0_22_140[] = {
0x18, 0x08, 0x24, 0x6C, 0x54, 0x3A, 0xBC,
0xBF, 0xAC, 0xB7, 0xBB, 0xA9, 0xC9, 0xC9,
0xBE, 0x00, 0x71, 0x00, 0x73, 0x00, 0x9E
};
static const unsigned int s6e63m0_22_110[] = {
0x18, 0x08, 0x24, 0x70, 0x51, 0x3E, 0xBF,
0xC1, 0xAF, 0xB9, 0xBC, 0xAB, 0xCC, 0xCC,
0xC2, 0x00, 0x65, 0x00, 0x67, 0x00, 0x8D
};
static const unsigned int s6e63m0_22_90[] = {
0x18, 0x08, 0x24, 0x73, 0x4A, 0x3D, 0xC0,
0xC2, 0xB1, 0xBB, 0xBE, 0xAC, 0xCE, 0xCF,
0xC5, 0x00, 0x5D, 0x00, 0x5E, 0x00, 0x82
};
static const unsigned int s6e63m0_22_30[] = {
0x18, 0x08, 0x24, 0x78, 0xEC, 0x3D, 0xC8,
0xC2, 0xB6, 0xC4, 0xC7, 0xB6, 0xD5, 0xD7,
0xCC, 0x00, 0x39, 0x00, 0x36, 0x00, 0x51
};
/* gamma value: 1.9 */
static const unsigned int s6e63m0_19_300[] = {
0x18, 0x08, 0x24, 0x61, 0x5F, 0x39, 0xBA,
0xBD, 0xAD, 0xB1, 0xB6, 0xA5, 0xC4, 0xC5,
0xBC, 0x00, 0xA0, 0x00, 0xA4, 0x00, 0xDB
};
static const unsigned int s6e63m0_19_280[] = {
0x18, 0x08, 0x24, 0x61, 0x60, 0x39, 0xBB,
0xBE, 0xAD, 0xB2, 0xB6, 0xA6, 0xC5, 0xC7,
0xBD, 0x00, 0x9B, 0x00, 0x9E, 0x00, 0xD5
};
static const unsigned int s6e63m0_19_260[] = {
0x18, 0x08, 0x24, 0x63, 0x61, 0x3B, 0xBA,
0xBE, 0xAC, 0xB3, 0xB8, 0xA7, 0xC6, 0xC8,
0xBD, 0x00, 0x96, 0x00, 0x98, 0x00, 0xCF
};
static const unsigned int s6e63m0_19_240[] = {
0x18, 0x08, 0x24, 0x67, 0x64, 0x3F, 0xBB,
0xBE, 0xAD, 0xB3, 0xB9, 0xA7, 0xC8, 0xC9,
0xBE, 0x00, 0x90, 0x00, 0x92, 0x00, 0xC8
};
static const unsigned int s6e63m0_19_220[] = {
0x18, 0x08, 0x24, 0x68, 0x64, 0x40, 0xBC,
0xBF, 0xAF, 0xB4, 0xBA, 0xA9, 0xC8, 0xCA,
0xBE, 0x00, 0x8B, 0x00, 0x8C, 0x00, 0xC0
};
static const unsigned int s6e63m0_19_200[] = {
0x18, 0x08, 0x24, 0x68, 0x64, 0x3F, 0xBE,
0xC0, 0xB0, 0xB6, 0xBB, 0xAB, 0xC8, 0xCB,
0xBF, 0x00, 0x85, 0x00, 0x86, 0x00, 0xB8
};
static const unsigned int s6e63m0_19_170[] = {
0x18, 0x08, 0x24, 0x69, 0x64, 0x40, 0xBF,
0xC1, 0xB0, 0xB9, 0xBE, 0xAD, 0xCB, 0xCD,
0xC2, 0x00, 0x7A, 0x00, 0x7B, 0x00, 0xAA
};
static const unsigned int s6e63m0_19_140[] = {
0x18, 0x08, 0x24, 0x6E, 0x65, 0x45, 0xC0,
0xC3, 0xB2, 0xBA, 0xBE, 0xAE, 0xCD, 0xD0,
0xC4, 0x00, 0x70, 0x00, 0x70, 0x00, 0x9C
};
static const unsigned int s6e63m0_19_110[] = {
0x18, 0x08, 0x24, 0x6F, 0x65, 0x46, 0xC2,
0xC4, 0xB3, 0xBF, 0xC2, 0xB2, 0xCF, 0xD1,
0xC6, 0x00, 0x64, 0x00, 0x64, 0x00, 0x8D
};
static const unsigned int s6e63m0_19_90[] = {
0x18, 0x08, 0x24, 0x74, 0x60, 0x4A, 0xC3,
0xC6, 0xB5, 0xBF, 0xC3, 0xB2, 0xD2, 0xD3,
0xC8, 0x00, 0x5B, 0x00, 0x5B, 0x00, 0x81
};
static const unsigned int s6e63m0_19_30[] = {
0x18, 0x08, 0x24, 0x84, 0x45, 0x4F, 0xCA,
0xCB, 0xBC, 0xC9, 0xCB, 0xBC, 0xDA, 0xDA,
0xD0, 0x00, 0x35, 0x00, 0x34, 0x00, 0x4E
};
/* gamma value: 1.7 */
static const unsigned int s6e63m0_17_300[] = {
0x18, 0x08, 0x24, 0x70, 0x70, 0x4F, 0xBF,
0xC2, 0xB2, 0xB8, 0xBC, 0xAC, 0xCB, 0xCD,
0xC3, 0x00, 0xA0, 0x00, 0xA4, 0x00, 0xDB
};
static const unsigned int s6e63m0_17_280[] = {
0x18, 0x08, 0x24, 0x71, 0x71, 0x50, 0xBF,
0xC2, 0xB2, 0xBA, 0xBE, 0xAE, 0xCB, 0xCD,
0xC3, 0x00, 0x9C, 0x00, 0x9F, 0x00, 0xD6
};
static const unsigned int s6e63m0_17_260[] = {
0x18, 0x08, 0x24, 0x72, 0x72, 0x50, 0xC0,
0xC3, 0xB4, 0xB9, 0xBE, 0xAE, 0xCC, 0xCF,
0xC4, 0x00, 0x97, 0x00, 0x9A, 0x00, 0xD1
};
static const unsigned int s6e63m0_17_240[] = {
0x18, 0x08, 0x24, 0x71, 0x72, 0x4F, 0xC2,
0xC4, 0xB5, 0xBB, 0xBF, 0xB0, 0xCC, 0xCF,
0xC3, 0x00, 0x91, 0x00, 0x95, 0x00, 0xCA
};
static const unsigned int s6e63m0_17_220[] = {
0x18, 0x08, 0x24, 0x71, 0x73, 0x4F, 0xC2,
0xC5, 0xB5, 0xBD, 0xC0, 0xB2, 0xCD, 0xD1,
0xC5, 0x00, 0x8B, 0x00, 0x8E, 0x00, 0xC2
};
static const unsigned int s6e63m0_17_200[] = {
0x18, 0x08, 0x24, 0x72, 0x75, 0x51, 0xC2,
0xC6, 0xB5, 0xBF, 0xC1, 0xB3, 0xCE, 0xD1,
0xC6, 0x00, 0x85, 0x00, 0x88, 0x00, 0xBA
};
static const unsigned int s6e63m0_17_170[] = {
0x18, 0x08, 0x24, 0x75, 0x77, 0x54, 0xC3,
0xC7, 0xB7, 0xC0, 0xC3, 0xB4, 0xD1, 0xD3,
0xC9, 0x00, 0x7B, 0x00, 0x7E, 0x00, 0xAB
};
static const unsigned int s6e63m0_17_140[] = {
0x18, 0x08, 0x24, 0x7B, 0x77, 0x58, 0xC3,
0xC8, 0xB8, 0xC2, 0xC6, 0xB6, 0xD3, 0xD4,
0xCA, 0x00, 0x71, 0x00, 0x73, 0x00, 0x9E
};
static const unsigned int s6e63m0_17_110[] = {
0x18, 0x08, 0x24, 0x81, 0x7B, 0x5D, 0xC6,
0xCA, 0xBB, 0xC3, 0xC7, 0xB8, 0xD6, 0xD8,
0xCD, 0x00, 0x65, 0x00, 0x67, 0x00, 0x8D
};
static const unsigned int s6e63m0_17_90[] = {
0x18, 0x08, 0x24, 0x82, 0x7A, 0x5B, 0xC8,
0xCB, 0xBD, 0xC5, 0xCA, 0xBA, 0xD6, 0xD8,
0xCE, 0x00, 0x5D, 0x00, 0x5E, 0x00, 0x82
};
static const unsigned int s6e63m0_17_30[] = {
0x18, 0x08, 0x24, 0x8F, 0x73, 0x63, 0xD1,
0xD0, 0xC5, 0xCC, 0xD1, 0xC2, 0xDE, 0xE0,
0xD6, 0x00, 0x39, 0x00, 0x36, 0x00, 0x51
};
struct s6e63m0_gamma {
unsigned int *gamma_22_table[MAX_GAMMA_LEVEL];
unsigned int *gamma_19_table[MAX_GAMMA_LEVEL];
unsigned int *gamma_17_table[MAX_GAMMA_LEVEL];
};
static struct s6e63m0_gamma gamma_table = {
.gamma_22_table[0] = (unsigned int *)&s6e63m0_22_30,
.gamma_22_table[1] = (unsigned int *)&s6e63m0_22_90,
.gamma_22_table[2] = (unsigned int *)&s6e63m0_22_110,
.gamma_22_table[3] = (unsigned int *)&s6e63m0_22_140,
.gamma_22_table[4] = (unsigned int *)&s6e63m0_22_170,
.gamma_22_table[5] = (unsigned int *)&s6e63m0_22_200,
.gamma_22_table[6] = (unsigned int *)&s6e63m0_22_220,
.gamma_22_table[7] = (unsigned int *)&s6e63m0_22_240,
.gamma_22_table[8] = (unsigned int *)&s6e63m0_22_260,
.gamma_22_table[9] = (unsigned int *)&s6e63m0_22_280,
.gamma_22_table[10] = (unsigned int *)&s6e63m0_22_300,
.gamma_19_table[0] = (unsigned int *)&s6e63m0_19_30,
.gamma_19_table[1] = (unsigned int *)&s6e63m0_19_90,
.gamma_19_table[2] = (unsigned int *)&s6e63m0_19_110,
.gamma_19_table[3] = (unsigned int *)&s6e63m0_19_140,
.gamma_19_table[4] = (unsigned int *)&s6e63m0_19_170,
.gamma_19_table[5] = (unsigned int *)&s6e63m0_19_200,
.gamma_19_table[6] = (unsigned int *)&s6e63m0_19_220,
.gamma_19_table[7] = (unsigned int *)&s6e63m0_19_240,
.gamma_19_table[8] = (unsigned int *)&s6e63m0_19_260,
.gamma_19_table[9] = (unsigned int *)&s6e63m0_19_280,
.gamma_19_table[10] = (unsigned int *)&s6e63m0_19_300,
.gamma_17_table[0] = (unsigned int *)&s6e63m0_17_30,
.gamma_17_table[1] = (unsigned int *)&s6e63m0_17_90,
.gamma_17_table[2] = (unsigned int *)&s6e63m0_17_110,
.gamma_17_table[3] = (unsigned int *)&s6e63m0_17_140,
.gamma_17_table[4] = (unsigned int *)&s6e63m0_17_170,
.gamma_17_table[5] = (unsigned int *)&s6e63m0_17_200,
.gamma_17_table[6] = (unsigned int *)&s6e63m0_17_220,
.gamma_17_table[7] = (unsigned int *)&s6e63m0_17_240,
.gamma_17_table[8] = (unsigned int *)&s6e63m0_17_260,
.gamma_17_table[9] = (unsigned int *)&s6e63m0_17_280,
.gamma_17_table[10] = (unsigned int *)&s6e63m0_17_300,
};
#endif
/*
* Definitions and platform data for Analog Devices
* Backlight drivers ADP8860
*
* Copyright 2009-2010 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
#ifndef __LINUX_I2C_ADP8860_H
#define __LINUX_I2C_ADP8860_H
#include <linux/leds.h>
#include <linux/types.h>
#define ID_ADP8860 8860
#define ADP8860_MAX_BRIGHTNESS 0x7F
#define FLAG_OFFT_SHIFT 8
/*
* LEDs subdevice platform data
*/
#define ADP8860_LED_DIS_BLINK (0 << FLAG_OFFT_SHIFT)
#define ADP8860_LED_OFFT_600ms (1 << FLAG_OFFT_SHIFT)
#define ADP8860_LED_OFFT_1200ms (2 << FLAG_OFFT_SHIFT)
#define ADP8860_LED_OFFT_1800ms (3 << FLAG_OFFT_SHIFT)
#define ADP8860_LED_ONT_200ms 0
#define ADP8860_LED_ONT_600ms 1
#define ADP8860_LED_ONT_800ms 2
#define ADP8860_LED_ONT_1200ms 3
#define ADP8860_LED_D7 (7)
#define ADP8860_LED_D6 (6)
#define ADP8860_LED_D5 (5)
#define ADP8860_LED_D4 (4)
#define ADP8860_LED_D3 (3)
#define ADP8860_LED_D2 (2)
#define ADP8860_LED_D1 (1)
/*
* Backlight subdevice platform data
*/
#define ADP8860_BL_D7 (1 << 6)
#define ADP8860_BL_D6 (1 << 5)
#define ADP8860_BL_D5 (1 << 4)
#define ADP8860_BL_D4 (1 << 3)
#define ADP8860_BL_D3 (1 << 2)
#define ADP8860_BL_D2 (1 << 1)
#define ADP8860_BL_D1 (1 << 0)
#define ADP8860_FADE_T_DIS 0 /* Fade Timer Disabled */
#define ADP8860_FADE_T_300ms 1 /* 0.3 Sec */
#define ADP8860_FADE_T_600ms 2
#define ADP8860_FADE_T_900ms 3
#define ADP8860_FADE_T_1200ms 4
#define ADP8860_FADE_T_1500ms 5
#define ADP8860_FADE_T_1800ms 6
#define ADP8860_FADE_T_2100ms 7
#define ADP8860_FADE_T_2400ms 8
#define ADP8860_FADE_T_2700ms 9
#define ADP8860_FADE_T_3000ms 10
#define ADP8860_FADE_T_3500ms 11
#define ADP8860_FADE_T_4000ms 12
#define ADP8860_FADE_T_4500ms 13
#define ADP8860_FADE_T_5000ms 14
#define ADP8860_FADE_T_5500ms 15 /* 5.5 Sec */
#define ADP8860_FADE_LAW_LINEAR 0
#define ADP8860_FADE_LAW_SQUARE 1
#define ADP8860_FADE_LAW_CUBIC1 2
#define ADP8860_FADE_LAW_CUBIC2 3
#define ADP8860_BL_AMBL_FILT_80ms 0 /* Light sensor filter time */
#define ADP8860_BL_AMBL_FILT_160ms 1
#define ADP8860_BL_AMBL_FILT_320ms 2
#define ADP8860_BL_AMBL_FILT_640ms 3
#define ADP8860_BL_AMBL_FILT_1280ms 4
#define ADP8860_BL_AMBL_FILT_2560ms 5
#define ADP8860_BL_AMBL_FILT_5120ms 6
#define ADP8860_BL_AMBL_FILT_10240ms 7 /* 10.24 sec */
/*
* Blacklight current 0..30mA
*/
#define ADP8860_BL_CUR_mA(I) ((I * 127) / 30)
/*
* L2 comparator current 0..1106uA
*/
#define ADP8860_L2_COMP_CURR_uA(I) ((I * 255) / 1106)
/*
* L3 comparator current 0..138uA
*/
#define ADP8860_L3_COMP_CURR_uA(I) ((I * 255) / 138)
struct adp8860_backlight_platform_data {
u8 bl_led_assign; /* 1 = Backlight 0 = Individual LED */
u8 bl_fade_in; /* Backlight Fade-In Timer */
u8 bl_fade_out; /* Backlight Fade-Out Timer */
u8 bl_fade_law; /* fade-on/fade-off transfer characteristic */
u8 en_ambl_sens; /* 1 = enable ambient light sensor */
u8 abml_filt; /* Light sensor filter time */
u8 l1_daylight_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
u8 l1_daylight_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
u8 l2_office_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
u8 l2_office_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
u8 l3_dark_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
u8 l3_dark_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
u8 l2_trip; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
u8 l2_hyst; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
u8 l3_trip; /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
u8 l3_hyst; /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
/**
* Independent Current Sinks / LEDS
* Sinks not assigned to the Backlight can be exposed to
* user space using the LEDS CLASS interface
*/
int num_leds;
struct led_info *leds;
u8 led_fade_in; /* LED Fade-In Timer */
u8 led_fade_out; /* LED Fade-Out Timer */
u8 led_fade_law; /* fade-on/fade-off transfer characteristic */
u8 led_on_time;
/**
* Gain down disable. Setting this option does not allow the
* charge pump to switch to lower gains. NOT AVAILABLE on ADP8860
* 1 = the charge pump doesn't switch down in gain until all LEDs are 0.
* The charge pump switches up in gain as needed. This feature is
* useful if the ADP8863 charge pump is used to drive an external load.
* This feature must be used when utilizing small fly capacitors
* (0402 or smaller).
* 0 = the charge pump automatically switches up and down in gain.
* This provides optimal efficiency, but is not suitable for driving
* loads that are not connected through the ADP8863 diode drivers.
* Additionally, the charge pump fly capacitors should be low ESR
* and sized 0603 or greater.
*/
u8 gdwn_dis;
};
#endif /* __LINUX_I2C_ADP8860_H */
......@@ -69,6 +69,29 @@ struct lcd_device {
struct device dev;
};
struct lcd_platform_data {
/* reset lcd panel device. */
int (*reset)(struct lcd_device *ld);
/* on or off to lcd panel. if 'enable' is 0 then
lcd power off and 1, lcd power on. */
int (*power_on)(struct lcd_device *ld, int enable);
/* it indicates whether lcd panel was enabled
from bootloader or not. */
int lcd_enabled;
/* it means delay for stable time when it becomes low to high
or high to low that is dependent on whether reset gpio is
low active or high active. */
unsigned int reset_delay;
/* stable time needing to become lcd power on. */
unsigned int power_on_delay;
/* stable time needing to become lcd power off. */
unsigned int power_off_delay;
/* it could be used for any purpose. */
void *pdata;
};
static inline void lcd_set_power(struct lcd_device *ld, int power)
{
mutex_lock(&ld->update_lock);
......
/*
* Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
* PCF50633 backlight device driver
*
* This program 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.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __LINUX_MFD_PCF50633_BACKLIGHT
#define __LINUX_MFD_PCF50633_BACKLIGHT
/*
* @default_brightness: Backlight brightness is initialized to this value
*
* Brightness to be used after the driver has been probed.
* Valid range 0-63.
*
* @default_brightness_limit: The actual brightness is limited by this value
*
* Brightness limit to be used after the driver has been probed. This is useful
* when it is not known how much power is available for the backlight during
* probe.
* Valid range 0-63. Can be changed later with pcf50633_bl_set_brightness_limit.
*
* @ramp_time: Display ramp time when changing brightness
*
* When changing the backlights brightness the change is not instant, instead
* it fades smooth from one state to another. This value specifies how long
* the fade should take. The lower the value the higher the fade time.
* Valid range 0-255
*/
struct pcf50633_bl_platform_data {
unsigned int default_brightness;
unsigned int default_brightness_limit;
uint8_t ramp_time;
};
struct pcf50633;
int pcf50633_bl_set_brightness_limit(struct pcf50633 *pcf, unsigned int limit);
#endif
......@@ -18,6 +18,7 @@
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/power_supply.h>
#include <linux/mfd/pcf50633/backlight.h>
struct pcf50633;
......@@ -43,6 +44,8 @@ struct pcf50633_platform_data {
void (*force_shutdown)(struct pcf50633 *);
u8 resumers[5];
struct pcf50633_bl_platform_data *backlight_data;
};
struct pcf50633_irq {
......@@ -152,6 +155,7 @@ struct pcf50633 {
struct platform_device *mbc_pdev;
struct platform_device *adc_pdev;
struct platform_device *input_pdev;
struct platform_device *bl_pdev;
struct platform_device *regulator_pdev[PCF50633_NUM_REGULATORS];
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment