[Armadeus-commitlog] SF.net SVN: armadeus: [597] trunk
Brought to you by:
sszy
|
From: <ar...@us...> - 2007-05-11 17:11:57
|
Revision: 597
http://armadeus.svn.sourceforge.net/armadeus/?rev=597&view=rev
Author: artemys
Date: 2007-05-11 10:11:58 -0700 (Fri, 11 May 2007)
Log Message:
-----------
[LINUX] First step in i.MXL backlight driver integration
Modified Paths:
--------------
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/050-linux-2.6.18-armadeus-kconfig.diff
trunk/target/linux/modules/Makefile
Added Paths:
-----------
trunk/target/linux/modules/backlight/
trunk/target/linux/modules/backlight/Makefile
trunk/target/linux/modules/backlight/imx_bl.c
Modified: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/050-linux-2.6.18-armadeus-kconfig.diff
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/050-linux-2.6.18-armadeus-kconfig.diff 2007-05-11 16:40:58 UTC (rev 596)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/050-linux-2.6.18-armadeus-kconfig.diff 2007-05-11 17:11:58 UTC (rev 597)
@@ -11,7 +11,7 @@
--- linux-2.6.18.1/drivers/Makefile.org 2007-05-09 10:48:51.000000000 +0200
+++ linux-2.6.18.1/drivers/Makefile 2007-05-09 10:57:09.000000000 +0200
@@ -76,3 +76,4 @@
- obj-$(CONFIG_SUPERH) += sh/
- obj-$(CONFIG_GENERIC_TIME) += clocksource/
- obj-$(CONFIG_DMA_ENGINE) += dma/
-+obj-y += armadeus/
+ obj-$(CONFIG_SUPERH) += sh/
+ obj-$(CONFIG_GENERIC_TIME) += clocksource/
+ obj-$(CONFIG_DMA_ENGINE) += dma/
++obj-$(CONFIG_ARMADEUS_DRIVERS) += armadeus/
Modified: trunk/target/linux/modules/Makefile
===================================================================
--- trunk/target/linux/modules/Makefile 2007-05-11 16:40:58 UTC (rev 596)
+++ trunk/target/linux/modules/Makefile 2007-05-11 17:11:58 UTC (rev 597)
@@ -7,7 +7,7 @@
# Part executed when called from kernel build system:
ifneq ($(KERNELRELEASE),)
-obj-m += gpio/ ps2keyboard/ fpga_devtools/ pwm/
+obj-$(CONFIG_ARMADEUS_DRIVERS) += gpio/ ps2keyboard/ fpga_devtools/ pwm/ backlight/
# Part execute when called from standard make in this directory:
else
Added: trunk/target/linux/modules/backlight/Makefile
===================================================================
--- trunk/target/linux/modules/backlight/Makefile (rev 0)
+++ trunk/target/linux/modules/backlight/Makefile 2007-05-11 17:11:58 UTC (rev 597)
@@ -0,0 +1,31 @@
+#
+# Makefile for the i.MXL backlight driver
+#
+
+# Part executed when called from kernel build system:
+ifneq ($(KERNELRELEASE),)
+
+obj-m += imx_bl.o
+
+#watchdog-objs := imx_watchdog.o
+
+# Part executed when called from standard make in this directory:
+# (preferably use Makefile in parent directory)
+else
+
+BASE_DIR="../../../../buildroot/"
+REL=`grep "BR2_PACKAGE_LINUX_VERSION=" $(BASE_DIR).config | \
+ sed "s/BR2_PACKAGE_LINUX_VERSION=\\"//" | sed "s/\\"//"`
+ARMADEUS_KERNEL_DIR=$(BASE_DIR)build_arm_nofpu/linux-$(REL)
+KDIR := $(ARMADEUS_KERNEL_DIR)
+PWD := $(shell pwd)
+
+default:
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
+
+clean:
+ rm -f *.*o \
+ rm -f Module.symvers
+
+endif
+
Added: trunk/target/linux/modules/backlight/imx_bl.c
===================================================================
--- trunk/target/linux/modules/backlight/imx_bl.c (rev 0)
+++ trunk/target/linux/modules/backlight/imx_bl.c 2007-05-11 17:11:58 UTC (rev 597)
@@ -0,0 +1,171 @@
+/*
+ * Backlight Driver for i.MXL based platform
+ *
+ * Copyright (c) 2007 Armadeus Project
+ *
+ * Based on Sharp's 2.4 Backlight Driver
+ *
+ * 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.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mutex.h>
+#include <linux/fb.h>
+#include <linux/backlight.h>
+#include <asm/arch/sharpsl.h> --> do the same in asm-arm/arch-imx !!
+#include <asm/arch/imx-regs.h>
+// #include <asm/hardware/sharpsl_pm.h>
+
+static int imxbl_intensity;
+static DEFINE_MUTEX(bl_mutex);
+static struct backlight_properties imxbl_data;
+static struct backlight_device *imx_backlight_device;
+static struct imxbl_machinfo *bl_machinfo;
+
+static unsigned long imxbl_flags;
+#define IMXBL_SUSPENDED 0x01
+#define IMXBL_BATTLOW 0x02
+
+static int imxbl_send_intensity(struct backlight_device *bd)
+{
+ void (*imx_kick_batt)(void);
+ 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 (imxbl_flags & IMXBL_SUSPENDED)
+ intensity = 0;
+ if (imxbl_flags & IMXBL_BATTLOW)
+ intensity &= bl_machinfo->limit_mask;
+
+ mutex_lock(&bl_mutex);
+ //bl_machinfo->set_bl_intensity(intensity);
+ //LCDC_PWMR = ....;
+ mutex_unlock(&bl_mutex);
+
+ imxbl_intensity = intensity;
+
+/* imx_kick_batt = symbol_get(sharpsl_battery_kick);
+ if (imx_kick_batt) {
+ imx_kick_batt();
+ symbol_put(sharpsl_battery_kick);
+ }
+*/
+ return 0;
+}
+
+#ifdef CONFIG_PM
+static int imxbl_suspend(struct platform_device *dev, pm_message_t state)
+{
+ imxbl_flags |= IMXBL_SUSPENDED;
+ imxbl_send_intensity(imx_backlight_device);
+ return 0;
+}
+
+static int imxbl_resume(struct platform_device *dev)
+{
+ imxbl_flags &= ~IMXBL_SUSPENDED;
+ imxbl_send_intensity(imx_backlight_device);
+ return 0;
+}
+#else
+#define imxbl_suspend NULL
+#define imxbl_resume NULL
+#endif
+
+static int imxbl_get_intensity(struct backlight_device *bd)
+{
+ return imxbl_intensity;
+}
+
+static int imxbl_set_intensity(struct backlight_device *bd)
+{
+ imxbl_send_intensity(imx_backlight_device);
+ return 0;
+}
+
+/*
+ * Called when the battery is low to limit the backlight intensity.
+ * If limit==0 clear any limit, otherwise limit the intensity
+ */
+void imxbl_limit_intensity(int limit)
+{
+ if (limit)
+ imxbl_flags |= IMXBL_BATTLOW;
+ else
+ imxbl_flags &= ~IMXBL_BATTLOW;
+ imxbl_send_intensity(imx_backlight_device);
+}
+EXPORT_SYMBOL(imxbl_limit_intensity);
+
+
+static struct backlight_properties imxbl_data = {
+ .owner = THIS_MODULE,
+ .get_brightness = imxbl_get_intensity,
+ .update_status = imxbl_set_intensity,
+};
+
+static int __init imxbl_probe(struct platform_device *pdev)
+{
+ struct imxbl_machinfo *machinfo = pdev->dev.platform_data;
+
+ bl_machinfo = machinfo;
+ imxbl_data.max_brightness = machinfo->max_intensity;
+ if (!machinfo->limit_mask)
+ machinfo->limit_mask = -1;
+
+ imx_backlight_device = backlight_device_register ("imxl-bl",
+ NULL, &imxbl_data);
+ if (IS_ERR (imx_backlight_device))
+ return PTR_ERR (imx_backlight_device);
+
+ imxbl_data.power = FB_BLANK_UNBLANK;
+ imxbl_data.brightness = machinfo->default_intensity;
+ imxbl_send_intensity(imx_backlight_device);
+
+ printk("i.MXL Backlight Driver Initialized.\n");
+ return 0;
+}
+
+static int imxbl_remove(struct platform_device *dev)
+{
+ backlight_device_unregister(imx_backlight_device);
+
+ printk("i.MXL Backlight Driver Unloaded\n");
+ return 0;
+}
+
+static struct platform_driver imxbl_driver = {
+ .probe = imxbl_probe,
+ .remove = imxbl_remove,
+ .suspend = imxbl_suspend,
+ .resume = imxbl_resume,
+ .driver = {
+ .name = "imxl-bl",
+ },
+};
+
+static int __init imxbl_init(void)
+{
+ return platform_driver_register(&imxbl_driver);
+}
+
+static void __exit imxbl_exit(void)
+{
+ platform_driver_unregister(&imxbl_driver);
+}
+
+module_init(imxbl_init);
+module_exit(imxbl_exit);
+
+MODULE_AUTHOR("Julien Boibessot <jul...@ar...>");
+MODULE_DESCRIPTION("i.MXL Backlight Driver");
+MODULE_LICENSE("GPLv2");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|