summaryrefslogtreecommitdiff
path: root/linux/opensimpad-2.4.25-vrs2-pxa1-jpm1/simpad-backlight-if.diff
diff options
context:
space:
mode:
Diffstat (limited to 'linux/opensimpad-2.4.25-vrs2-pxa1-jpm1/simpad-backlight-if.diff')
-rw-r--r--linux/opensimpad-2.4.25-vrs2-pxa1-jpm1/simpad-backlight-if.diff97
1 files changed, 97 insertions, 0 deletions
diff --git a/linux/opensimpad-2.4.25-vrs2-pxa1-jpm1/simpad-backlight-if.diff b/linux/opensimpad-2.4.25-vrs2-pxa1-jpm1/simpad-backlight-if.diff
index e69de29bb2..50a4ff7628 100644
--- a/linux/opensimpad-2.4.25-vrs2-pxa1-jpm1/simpad-backlight-if.diff
+++ b/linux/opensimpad-2.4.25-vrs2-pxa1-jpm1/simpad-backlight-if.diff
@@ -0,0 +1,97 @@
+--- /mnt/bdisk/openembedded/oetmp/base/opensimpad-2.4.25-vrs2-pxa1-jpm1-r5/linux-2.4.25/drivers/video/mq200fb.c 2004-07-01 21:10:30.000000000 +0200
++++ drivers/video/mq200fb.c 2004-07-03 20:58:59.000000000 +0200
+@@ -82,6 +82,20 @@
+ write: proc_write_reg
+ };
+
++#ifdef CONFIG_SA1100_SIMPAD
++
++static ssize_t proc_read_light(struct file * file, char * buf,
++ size_t nbytes, loff_t *ppos);
++static ssize_t proc_write_light(struct file * file, const char * buffer,
++ size_t count, loff_t *ppos);
++
++static struct file_operations proc_light_operations = {
++ read: proc_read_light,
++ write: proc_write_light
++};
++#endif
++
++
+ typedef struct sa1110_reg_entry {
+ u32 phyaddr;
+ char* name;
+@@ -622,6 +636,20 @@
+ }
+ }
+
++#ifdef CONFIG_SA1100_SIMPAD
++ entry = create_proc_entry("backlight",
++ S_IRWXU | S_IRWXG | S_IRWXO,
++ mq200dir);
++ if(entry) {
++ entry->proc_fops = &proc_light_operations;
++ }
++ else {
++ printk( KERN_ERR
++ "mq200fb: can't create /proc/" MQ200_DIRNAME
++ "/backlight\n");
++ return(-ENOMEM);
++ }
++ #endif
+
+ #ifdef MQ_SA1110
+
+@@ -1879,7 +1907,7 @@
+ static void writeBrightness(void *pMQMMIO, int brightness)
+ {
+ unsigned long dutyCycle, pwmcontrol;
+- int MAX_BRIGHT_REG = 0x000000fc; /* int 254 */
++ int MAX_BRIGHT_REG = 0x000000fe; /* int 254 */
+
+ if(brightness > MAX_BRIGHT_REG)
+ return;
+@@ -1961,3 +1989,43 @@
+ return (count+endp-buffer);
+ }
+
++#ifdef CONFIG_SA1100_SIMPAD
++
++#define SIMPAD_BACKLIGHT_MASK 0x00a10044
++
++static int proc_read_light(struct file * file, char * buf,
++ size_t nbytes, loff_t *ppos)
++{
++ char outputbuf[15];
++ int count;
++ u32 pwmctl;
++ if (*ppos>0) /* Assume reading completed in previous read*/
++ return 0;
++
++ pwmctl = *((volatile *) mq200_p2v(0x4be0e03c));
++ pwmctl &= ~SIMPAD_BACKLIGHT_MASK;
++ pwmctl = pwmctl >> 8;
++ pwmctl = 254 - pwmctl;
++
++ count = sprintf(outputbuf, "%d\n",pwmctl);
++ *ppos+=count;
++ if (count>nbytes) /* Assume output can be read at one time */
++ return -EINVAL;
++ if (copy_to_user(buf, outputbuf, count))
++ return -EFAULT;
++ return count;
++}
++
++static ssize_t proc_write_light(struct file * file, const char * buffer,
++ size_t count, loff_t *ppos)
++{
++ void * pMQMMIO = (void *) mqMmioAddr;
++ char *endp;
++ unsigned long newvalue = simple_strtoul(buffer,&endp,0);
++ if (newvalue > 254)
++ newvalue = 254;
++ writeBrightness(pMQMMIO,newvalue);
++ mq200_backlight(pMQMMIO,(int)newvalue);
++ return (count+endp-buffer);
++}
++#endif