From: <mar...@us...> - 2007-08-27 15:42:23
|
Revision: 1276 http://hackndev.svn.sourceforge.net/hackndev/?rev=1276&view=rev Author: marex_z71 Date: 2007-08-25 21:55:37 -0700 (Sat, 25 Aug 2007) Log Message: ----------- PalmTX: polishing the code, replaced comments with C-style ones, used TABs, removed useless braces etc. Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx.c linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx_battery.c linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx_pm.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx.c 2007-08-26 04:40:15 UTC (rev 1275) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx.c 2007-08-26 04:55:37 UTC (rev 1276) @@ -156,10 +156,10 @@ **************/ struct platform_device palmtx_border = { - .name = "palmtx-border", - .id = -1, - .dev = { - .platform_data = NULL, + .name = "palmtx-border", + .id = -1, + .dev = { + .platform_data = NULL, }, }; @@ -169,23 +169,23 @@ static void palmtx_bl_power(int on) { - if(GET_PALMTX_GPIO(BL_POWER)!=on) { - SET_PALMTX_GPIO(LCD_POWER, on); - SET_PALMTX_GPIO(BL_POWER, on); - pxa_set_cken(CKEN0_PWM0, on); - pxa_set_cken(CKEN1_PWM1, on); - mdelay(50); - } + if(GET_PALMTX_GPIO(BL_POWER)!=on) { + SET_PALMTX_GPIO(LCD_POWER, on); + SET_PALMTX_GPIO(BL_POWER, on); + pxa_set_cken(CKEN0_PWM0, on); + pxa_set_cken(CKEN1_PWM1, on); + mdelay(50); + } } static void palmtx_set_bl_intensity(int intensity) { - palmtx_bl_power(intensity ? 1 : 0); - if(intensity) { - PWM_CTRL0 = 0x7; - PWM_PERVAL0 = PALMTX_PERIOD; - PWM_PWDUTY0 = intensity; - } + palmtx_bl_power(intensity ? 1 : 0); + if(intensity) { + PWM_CTRL0 = 0x7; + PWM_PERVAL0 = PALMTX_PERIOD; + PWM_PWDUTY0 = intensity; + } } static struct corgibl_machinfo palmtx_bl_machinfo = { @@ -333,7 +333,7 @@ .name = "pxa2xx-ac97", .id = -1, .dev = { - .platform_data = &palmtx_audio_ops + .platform_data = &palmtx_audio_ops }, }; @@ -342,9 +342,9 @@ ********************/ struct platform_device palmtx_pm = { - .name = "palmtx-pm", - .id = -1, - .dev = { + .name = "palmtx-pm", + .id = -1, + .dev = { .platform_data = NULL, }, }; @@ -377,18 +377,18 @@ static struct pxafb_mode_info palmtx_lcd_modes[] = { { .pixclock = 0, - .xres = 320, // PPL + 1 - .yres = 480, // LPP + 1 - .bpp = 16, // BPP + .xres = 320, /* PPL + 1 */ + .yres = 480, /* LPP + 1 */ + .bpp = 16, /* BPP */ - // linux palmos - .left_margin = 32, // BLW + 1 (BLW=31) - .right_margin = 1, // ELW + 1 (ELW=3) * - .upper_margin = 7, // BFW + 1 (BFW=7) * - .lower_margin = 1, // EFW + 1 (EFW=8) * + /* linux palmos */ + .left_margin = 32, /* BLW + 1 (BLW=31) */ + .right_margin = 1, /* ELW + 1 (ELW=3) */ + .upper_margin = 7, /* BFW + 1 (BFW=7) */ + .lower_margin = 1, /* EFW + 1 (EFW=8) */ - .hsync_len = 4, // HSW + 1 (HSW=3) - .vsync_len = 1, // VSW + 1 (VSW=0) + .hsync_len = 4, /* HSW + 1 (HSW=3) */ + .vsync_len = 1, /* VSW + 1 (VSW=0) */ }, }; @@ -422,11 +422,11 @@ static void __init palmtx_init(void) { - // disable primary codec interrupt to prevent WM9712 constantly interrupting the CPU - // and preventing the boot process to complete (Thanx Alex & Shadowmite!) + /* disable primary codec interrupt to prevent WM9712 constantly interrupting the CPU + and preventing the boot process to complete (Thanx Alex & Shadowmite!) */ GCR &= ~GCR_PRIRDY_IEN; - // configure AC97's GPIOs + /* configure AC97's GPIOs */ pxa_gpio_mode(GPIO28_BITCLK_AC97_MD); pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD); pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD); Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx_battery.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx_battery.c 2007-08-26 04:40:15 UTC (rev 1275) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx_battery.c 2007-08-26 04:55:37 UTC (rev 1276) @@ -73,13 +73,12 @@ int palmtx_battery_get_voltage(struct power_supply *b) { - if (bat.battery_registered){ + if (bat.battery_registered) { bat.previous_voltage = bat.current_voltage; bat.current_voltage = wm97xx_read_aux_adc(bat.wm, WM97XX_AUX_ID3); bat.last_battery_update = jiffies; return bat.current_voltage * 1889/1000 + 7678/10; - } - else{ + } else { printk("palmtx_battery: cannot get voltage -> battery driver unregistered\n"); return 0; } @@ -87,10 +86,9 @@ int palmtx_battery_get_capacity(struct power_supply *b) { - if (bat.battery_registered){ + if (bat.battery_registered) return (((palmtx_battery_get_voltage(b)-palmtx_battery_min_voltage(b)) /(palmtx_battery_max_voltage(b)-palmtx_battery_min_voltage(b)))*100); - } else{ printk("palmtx_battery: cannot get capacity -> battery driver unregistered\n"); return 0; @@ -196,14 +194,14 @@ static struct device_driver palmtx_wm97xx_driver = { - .name = "wm97xx-touchscreen", - .bus = &wm97xx_bus_type, - .owner = THIS_MODULE, - .probe = palmtx_wm97xx_probe, - .remove = palmtx_wm97xx_remove, - .suspend = palmtx_wm97xx_suspend, - .resume = palmtx_wm97xx_resume, - .shutdown = palmtx_wm97xx_shutdown + .name = "wm97xx-touchscreen", + .bus = &wm97xx_bus_type, + .owner = THIS_MODULE, + .probe = palmtx_wm97xx_probe, + .remove = palmtx_wm97xx_remove, + .suspend = palmtx_wm97xx_suspend, + .resume = palmtx_wm97xx_resume, + .shutdown = palmtx_wm97xx_shutdown }; static int palmtx_ac_is_connected (void){ @@ -232,9 +230,9 @@ info->ac_line_status = palmtx_ac_is_connected() ? APM_AC_ONLINE : APM_AC_OFFLINE; - if (info->ac_line_status) { + if (info->ac_line_status) info->battery_status = APM_BATTERY_STATUS_CHARGING; - } else { + else { if (percent > 50) info->battery_status = APM_BATTERY_STATUS_HIGH; else if (percent < 5) @@ -256,9 +254,8 @@ /* register battery to APM layer */ bat.battery_registered = 0; - if(power_supply_register(NULL, &palmtx_battery)) { + if(power_supply_register(NULL, &palmtx_battery)) printk(KERN_ERR "palmtx_ac97_probe: could not register battery class\n"); - } else { bat.battery_registered = 1; printk("Battery registered\n"); Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx_pm.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx_pm.c 2007-08-26 04:40:15 UTC (rev 1275) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx_pm.c 2007-08-26 04:55:37 UTC (rev 1276) @@ -91,8 +91,8 @@ } struct pxa_ll_pm_ops palmtx_ll_pm_ops = { - .suspend = palmtx_pxa_ll_pm_suspend, - .resume = palmtx_pxa_ll_pm_resume, + .suspend = palmtx_pxa_ll_pm_suspend, + .resume = palmtx_pxa_ll_pm_resume, }; static int palmtx_pm_probe(struct device *dev) @@ -102,11 +102,11 @@ } struct device_driver palmtx_pm_driver = { - .name = "palmtx-pm", - .bus = &platform_bus_type, - .probe = palmtx_pm_probe, - .suspend = palmtx_suspend, - .resume = palmtx_resume, + .name = "palmtx-pm", + .bus = &platform_bus_type, + .probe = palmtx_pm_probe, + .suspend = palmtx_suspend, + .resume = palmtx_resume, }; static int __init palmtx_pm_init(void) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |