From: <mar...@us...> - 2007-07-22 20:41:02
|
Revision: 1200 http://svn.sourceforge.net/hackndev/?rev=1200&view=rev Author: marex_z71 Date: 2007-07-22 13:40:59 -0700 (Sun, 22 Jul 2007) Log Message: ----------- PalmLD: add display border handling driver Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h Added Paths: ----------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_border.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig 2007-07-22 13:53:01 UTC (rev 1199) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig 2007-07-22 20:40:59 UTC (rev 1200) @@ -37,4 +37,9 @@ default y if MACH_XSCALE_PALMLD help Enable support for suspend/resume the PalmOne LifeDrive PDA. - \ No newline at end of file + +config PALMLD_BORDER + tristate "Palm LifeDrive Display border switch" + depends on MACH_XSCALE_PALMLD + help + Enable support for turning LCD border on/off Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile 2007-07-22 13:53:01 UTC (rev 1199) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile 2007-07-22 20:40:59 UTC (rev 1200) @@ -8,4 +8,4 @@ obj-$(CONFIG_PALMLD_IDE) += palmld_ide.o obj-$(CONFIG_PALMLD_PM) += palmld_pm.o obj-$(CONFIG_PALMLD_BATTERY) += palmld_battery.o - +obj-$(CONFIG_PALMLD_BORDER) += palmld_border.o Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c 2007-07-22 13:53:01 UTC (rev 1199) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c 2007-07-22 20:40:59 UTC (rev 1200) @@ -44,9 +44,9 @@ #include "../generic.h" -/** +/********************************************************* * SD/MMC card controller - */ + *********************************************************/ static int palmld_mci_init(struct device *dev, irqreturn_t (*palmld_detect_int)(int, void *), void *data) { @@ -91,7 +91,9 @@ }; -/* Bluetooth */ +/********************************************************* + * Bluetooth + *********************************************************/ void bcm2035_bt_reset(int on) { @@ -139,9 +141,9 @@ }, }; -/** +/********************************************************* * AC97 audio controller - */ + *********************************************************/ static pxa2xx_audio_ops_t palmld_audio_ops = { /* @@ -158,9 +160,9 @@ .dev = { .platform_data = &palmld_audio_ops }, }; -/** +/********************************************************* * IRDA - */ + *********************************************************/ static void palmld_irda_transceiver_mode(struct device *dev, int mode) { @@ -195,19 +197,17 @@ .transceiver_mode = palmld_irda_transceiver_mode, }; -/* platform */ - -/* +/********************************************************* * LEDs - */ + *********************************************************/ static struct platform_device palmldled_device = { .name = "palmld-led", .id = -1, }; -/* +/********************************************************* * Cypress EZUSB SX2 USB2.0 Controller - */ + *********************************************************/ static struct sx2_udc_mach_info palmldusb2_platform_data = { .virt_base = PALMLD_USB_VIRT, @@ -229,9 +229,21 @@ }, }; -/** +/********************************************************* + * LCD Border + *********************************************************/ + +struct platform_device palmld_border = { + .name = "palmld-border", + .id = -1, + .dev = { + .platform_data = NULL, + }, +}; + +/********************************************************* * Backlight - */ + *********************************************************/ static void palmld_bl_power(int on) { @@ -316,9 +328,9 @@ }, }; -/******************************** +/********************************************************* * GPIO Key - Voice Memo Button * - ********************************/ + *********************************************************/ #ifdef CONFIG_KEYBOARD_GPIO static struct gpio_keys_button palmld_pxa_buttons[] = { {KEY_F8, GPIO_NR_PALMLD_POWER_SWITCH, 0, "Power switch" }, @@ -338,9 +350,9 @@ }; #endif -/******************** +/********************************************************* * Power Management * - ********************/ + *********************************************************/ struct platform_device palmld_pm = { .name = "palmld-pm", @@ -372,6 +384,7 @@ &palmldusb2_device, &palmld_pm, &bcm2035_bt, + &palmld_border, }; /********************************************************* @@ -388,9 +401,6 @@ .hsync_len = 4, .vsync_len = 1, - /* fixme: these are the margins PalmOS has set, - * they seem to work but could be better. - */ .left_margin = 32, .right_margin = 1, .upper_margin = 7, //5, Added: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_border.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_border.c (rev 0) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_border.c 2007-07-22 20:40:59 UTC (rev 1200) @@ -0,0 +1,100 @@ +/* + * Palm LifeDrive LCD Border switch + * + * Copyright (C) 2007 Marek Vasut <mar...@gm...> + * + * 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/platform_device.h> +#include <linux/delay.h> + +#include <asm/arch/hardware.h> +#include <asm/arch/palmld-gpio.h> + +static ssize_t palmld_border_write(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + signed long state = simple_strtol(buf, NULL, 10); + + if ( state >= 1 ) + SET_PALMLD_GPIO(BORDER_SELECT, 1); + else + SET_PALMLD_GPIO(BORDER_SELECT, 0); + + msleep(50); + SET_PALMLD_GPIO(BORDER_SWITCH, 1); + + if ((state == 1) || (state == 0)) /* default - switch border on/off */ + msleep(200); + else { /* hidden functionality - colored border */ + if (state >= 0) + msleep(state); + else + msleep(-state); + } + + SET_PALMLD_GPIO(BORDER_SWITCH, 0); + + return count; +} + +static ssize_t palmld_border_read(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + return strlcpy(buf, GET_PALMLD_GPIO(BORDER_SELECT) ? "1\n" : "0\n", 3); +} + +static DEVICE_ATTR(border_power, 0644, palmld_border_read, palmld_border_write); + +static struct attribute *palmld_border_attrs[] = { + &dev_attr_border_power.attr, + NULL +}; + +static struct attribute_group palmld_border_attr_group = { + .attrs = palmld_border_attrs, +}; + +static int __devinit palmld_border_probe(struct platform_device *pdev) +{ + return sysfs_create_group(&pdev->dev.kobj, &palmld_border_attr_group); +} + +static int palmld_border_remove(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, &palmld_border_attr_group); + return 0; +} + +static struct platform_driver palmld_border_driver = { + .probe = palmld_border_probe, + .remove = palmld_border_remove, + .suspend = NULL, + .resume = NULL, + .driver = { + .name = "palmld-border", + } +}; + +static int __init palmld_border_init(void) +{ + return platform_driver_register(&palmld_border_driver); +} + +static void palmld_border_exit(void) +{ + platform_driver_unregister(&palmld_border_driver); +} + +module_init(palmld_border_init); +module_exit(palmld_border_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Marek Vasut <mar...@gm...>"); +MODULE_DESCRIPTION("Palm LifeDrive Border switch"); Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h =================================================================== --- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h 2007-07-22 13:53:01 UTC (rev 1199) +++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h 2007-07-22 20:40:59 UTC (rev 1200) @@ -30,6 +30,9 @@ #define GPIO_NR_PALMLD_LOCK_SWITCH 15 /* keypad lock */ #define GPIO_NR_PALMLD_SCREEN 19 +#define GPIO_NR_PALMLD_BORDER_SWITCH 21 +#define GPIO_NR_PALMLD_BORDER_SELECT 22 + #define GPIO_NR_PALMLD_WM9712_IRQ 27 #define GPIO_NR_PALMLD_IR_DISABLE 40 /* IRDA */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |