Re: [PATCH 00/18] OMAP: DSS2: Intro
Hi, On Thu, 2009-09-03 at 00:11 +0200, ext Andrew Morton wrote: On Tue, 01 Sep 2009 10:10:19 +0300 Artem Bityutskiy dedeki...@gmail.com wrote: Andrew, could you please help with merging this piece of (well written) code? Could you give your blessing to include it into linux-next now, and merge this during the next merge window? I'll merge them (after I've looked through them, which I'll do now). Have you had time to take a look at this? Tomi But there are more rejects than I'm prepared to cope with. The various arch/arm files have undergone some changes in linux-next which yield more breakage than I'm prepared to try to fix. For example, arch/arm/mach-omap2/board-3430sdp.c:sdp3430_config[] ends up being an empty array! Then there's the matter of these patches, already in -mm: omapfb-add-support-for-the-apollon-lcd.patch omapfb-add-support-for-mipi-dcs-compatible-lcds.patch omapfb-add-support-for-the-amstrad-delta-lcd.patch omapfb-add-support-for-the-2430sdp-lcd.patch omapfb-add-support-for-the-omap2evm-lcd.patch omapfb-add-support-for-the-3430sdp-lcd.patch omapfb-add-support-for-the-omap3-evm-lcd.patch omapfb-add-support-for-the-omap3-beagle-dvi-output.patch omapfb-add-support-for-the-gumstix-overo-lcd.patch omapfb-add-support-for-the-zoom-mdk-lcd.patch omapfb-add-support-for-rotation-on-the-blizzard-lcd-ctrl.patch n770-enable-lcd-mipi-dcs-in-kconfig.patch omapfb-dispc-various-typo-fixes.patch omapfb-dispc-disable-iface-clocks-along-with-func-clocks.patch omapfb-dispc-enable-wake-up-capability.patch omapfb-dispc-allow-multiple-external-irq-handlers.patch omapfb-suspend-resume-only-if-fb-device-is-already-initialized.patch omapfb-fix-coding-style-remove-dead-line.patch omapfb-add-fb-manual-update-option-to-kconfig.patch omapfb-hwa742-fix-pointer-to-be-const.patch -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Issue with setting vdd2_opp level to 3 through OMAP3 SRF API's
Hello, When trying to make vdd2_opp resource to VDD2_OPP3 level using resource_request(arch\arm\plat-omap\resource.c), it is observed that vdd2_opp is always put to VDD2_OPP2 level. Code Snippet: For the above, set_opp() in arch\arm\mach-omap2\resource34xx.c is called with a target level of 3. The code flow is as given below: /*** Code Snippet Start/ else if (resp == vdd2_resp) { tput = target_level; /* Convert the tput in KiB/s to Bus frequency in MHz */ req_l3_freq = (tput * 1000)/4; for (ind = 2; ind = MAX_VDD2_OPP; ind++){ if ((l3_opps + ind)-rate = req_l3_freq) { target_level = ind; break; } } /* Set the highest OPP possible */ if (ind MAX_VDD2_OPP) target_level = ind-1; resource_set_opp_level(VDD2_OPP, target_level, 0); } /*** Code Snippet End/ Analysis: During execution, tout = 3; req_l3_freq = 750; when ind = 2, if ((l3_opps + ind)-rate = req_l3_freq) == (83M 750) which in turn makes target_level = 2. Hence while requesting for target_level of 3, vdd2_opp is made to target_level = 2, which is incorrect. Issues observed: The above code should have been made for mapping L3 freq 83MHz to VDD2_OPP2 and L3 freq 166MHz to VDD2_OPP3. But the above code would always make vdd2_opp to VDD2_OPP2 level. However, it is observed that, if we change the vdd2_opp to 3 using sysfs, it seems to be setting to level 3. I am wondering if there are any issues with sysfs entries since same is working with resource frame work API's. Please let me know if my understanding is wrong. Thanks Regards, V Charu Latha-- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
most up-to-date linux-omap 2.6.31 not booting on N810
Hi, I have just tried to boot a kernel image using n8x0_defconfig file, using the most up-to-date linux-omap tree (commit 52a962f09ab2306a2) This image is not booting on my N810 device Enabling 'kernel low-level debugging' option and disabling stack unwinding support I obtain this log: Uncompressing Linux... ... done, booting the kernel. 5Linux version 2.6.31-omap1-05923-g52a962f (r...@drivers-uwbtest) (gcc version 4.2.4 (Debian 4.2.4-6)) #10 Thu Sep 17 11:03:13 BST 2009 CPU: ARMv6-compatible processor [4107b362] revision 2 (ARMv6TEJ), cr=00c5387f CPU: VIPT aliasing data cache, VIPT aliasing instruction cache Machine: Nokia N810 4Ignoring unrecognised tag 0x414f4d50 Memory policy: ECC disabled, Data cache writeback 7On node 0 totalpages: 32768 7free_area_init_node: node 0, pgdat c025a4f8, node_mem_map c026d000 7 Normal zone: 256 pages used for memmap 7 Normal zone: 0 pages reserved 7 Normal zone: 32512 pages, LIFO batch:7 6OMAP24206 6SRAM: Mapped pa 0x4020 to va 0xe300 size: 0x10 Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512 5Kernel command line: root=1f03 rootfstype=jffs2 console=ttyS0,115200n8 PID hash table entries: 512 (order: 9, 2048 bytes) 6Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) 6Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) 6Memory: 64MB 64MB = 128MB total 5Memory: 127316KB available (2140K code, 188K data, 112K init, 0K highmem) 6SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 6Hierarchical RCU implementation. 6NR_IRQS:368 6Clocking rate (Crystal/DPLL/MPU): 19.2/658/329 MHz 1Unable to handle kernel NULL pointer dereference at virtual address 0004 1pgd = c0004000 1[0004] *pgd= Internal error: Oops: 5 [#1] dModules linked in: CPU: 0Not tainted (2.6.31-omap1-05923-g52a962f #10) PC is at _add_initiator_dep+0x28/0x38 LR is at _enable+0x54/0x1a4 pc : [c002f3c4]lr : [c002f6a8]psr: a1d3 sp : c023df10 ip : c023df20 fp : c023df1c r10: 80020a28 r9 : 4107b362 r8 : 80020a90 r7 : c024164c r6 : c002fb78 r5 : r4 : c02409cc r3 : r2 : r1 : c02409cc r0 : c02409cc Flags: NzCv IRQs off FIQs off Mode SVC_32 ISA ARM Segment kernel Control: 00c5387f Table: 80004000 DAC: 0017 Process swapper (pid: 0, stack limit = 0xc023c268) Stack: (0xc023df10 to 0xc023e000) df00: c023df3c c023df20 c002f6a8 c002f3a8 df20: 81d3 c0240974 c0240e44 c02409cc c023df5c c023df40 c002fbf8 c002f660 df40: c002fdfc c02409cc c002fb78 c023df7c c023df60 c002f0d4 c002fb84 df60: c0022e10 c0240338 c023df8c c023df80 c002fed4 c002f0ac df80: c023dfa4 c023df90 c000df60 c002fe80 c025ab10 c025ab04 c023dfb4 c023dfa8 dfa0: c000eae0 c000defc c023dfc4 c023dfb8 c000b738 c000ead4 c023dff4 c023dfc8 dfc0: c0008acc c000b70c c0008554 c0022e10 00c5387d dfe0: c025adc0 c0023214 c023dff8 80008034 c0008998 Backtrace: [c002f39c] (_add_initiator_dep+0x0/0x38) from [c002f6a8] (_enable+0x54/0x1a4) [c002f654] (_enable+0x0/0x1a4) from [c002fbf8] (_setup+0x80/0xb4) r4:c02409cc [c002fb78] (_setup+0x0/0xb4) from [c002f0d4] (omap_hwmod_for_each+0x34/0x78) r6:c002fb78 r5: r4:c02409cc [c002f0a0] (omap_hwmod_for_each+0x0/0x78) from [c002fed4] (omap_hwmod_late_init+0x60/0x8c) r7:c0240338 r6:c0022e10 r5: r4: [c002fe74] (omap_hwmod_late_init+0x0/0x8c) from [c000df60] (omap2_init_common_hw+0x70/0xa8) [c000def0] (omap2_init_common_hw+0x0/0xa8) from [c000eae0] (n8x0_init_irq+0x18/0x24) r5:c025ab04 r4:c025ab10 [c000eac8] (n8x0_init_irq+0x0/0x24) from [c000b738] (init_IRQ+0x38/0x44) [c000b700] (init_IRQ+0x0/0x44) from [c0008acc] (start_kernel+0x140/0x2c8) [c000898c] (start_kernel+0x0/0x2c8) from [80008034] (0x80008034) r6:c0023214 r5:c025adc0 r4:00c5387d Code: 089da800 e5913020 e592205c e593305c (e5920004) 4---[ end trace 1b75b31a2719ed1c ]--- 0Kernel panic - not syncing: Attempted to kill the idle task! Backtrace: [c0028e8c] (dump_backtrace+0x0/0x110) from [c0028fd0] (dump_stack+0x18/0x1c) r6:000b r5:c025b424 r4:c023c000 [c0028fb8] (dump_stack+0x0/0x1c) from [c004ad90] (panic+0x4c/0x124) [c004ad44] (panic+0x0/0x124) from [c004d9ac] (do_exit+0x64/0x578) r3: r2:c0246c74 r1:12f2 r0:c020ece4 [c004d948] (do_exit+0x0/0x578) from [c0029120] (die+0x12c/0x14c) [c0028ff4] (die+0x0/0x14c) from [c002b410] (__do_kernel_fault+0x6c/0x7c) [c002b3a4] (__do_kernel_fault+0x0/0x7c) from [c002b644] (do_page_fault+0x224/0x244) r7:c023dec8 r6:c023f6c8 r5:c02405e4 r4: [c002b420] (do_page_fault+0x0/0x244) from [c002b704] (do_translation_fault+0x1c/0x84) [c002b6e8] (do_translation_fault+0x0/0x84) from [c0024250] (do_DataAbort+0x3c/0xa0) r6:0005 r5:c02405e4 r4: [c0024214] (do_DataAbort+0x0/0xa0) from [c00249ec] (__dabt_svc+0x4c/0x60) Exception stack(0xc023dec8 to
linux-omap on N810
Hi guys, I need to boot a omap-kernel on N810 to try a ubuntu rootfs installed on the internal MMC card, Since the top of the tree is not booting, do you have any particular commit (end/or .config) which is Known to work and to boot correctly on N810? Do you have any how-to or any link you would recommend? I have been trying some previous commits but I could not get the internal MMC card to work... Any help would be much appreciated! Thanks, Stefano --- Stefano Panella, Software Engineer, Drivers Tel: +44(0)1223 692452 CSR, Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Issue with setting vdd2_opp level to 3 through OMAP3 SRF API's
Hello, The format of calling resource_rerquest for vdd2 opp setting is resource_request(vdd2_opp, dev, r); where r is the throughput. Example, in set_opp, if vdd1 opp is = 3, vdd2 opp is being set to 3. The above means resource_request expects targeted level for all types of OPP/Freq resources except for vdd2_opp. Only for vdd2_opp we need to give the throughput required and not the targeted level. Is that correct? API needs to be generic. If my above understanding is correct, why resource_request is expecting an unique kind of input parameter, only for vdd2_opp resource? Thanks, V Charu Latha ___ From: linux-omap-ow...@vger.kernel.org [linux-omap-ow...@vger.kernel.org] On Behalf Of Varadarajan, Charu Latha Sent: Thursday, September 17, 2009 2:55 PM To: linux-omap@vger.kernel.org Subject: Issue with setting vdd2_opp level to 3 through OMAP3 SRF API's Hello, When trying to make vdd2_opp resource to VDD2_OPP3 level using resource_request(arch\arm\plat-omap\resource.c), it is observed that vdd2_opp is always put to VDD2_OPP2 level. Code Snippet: For the above, set_opp() in arch\arm\mach-omap2\resource34xx.c is called with a target level of 3. The code flow is as given below: /*** Code Snippet Start/ else if (resp == vdd2_resp) { tput = target_level; /* Convert the tput in KiB/s to Bus frequency in MHz */ req_l3_freq = (tput * 1000)/4; for (ind = 2; ind = MAX_VDD2_OPP; ind++){ if ((l3_opps + ind)-rate = req_l3_freq) { target_level = ind; break; } } /* Set the highest OPP possible */ if (ind MAX_VDD2_OPP) target_level = ind-1; resource_set_opp_level(VDD2_OPP, target_level, 0); } /*** Code Snippet End/ Analysis: During execution, tout = 3; req_l3_freq = 750; when ind = 2, if ((l3_opps + ind)-rate = req_l3_freq) == (83M 750) which in turn makes target_level = 2. Hence while requesting for target_level of 3, vdd2_opp is made to target_level = 2, which is incorrect. Issues observed: The above code should have been made for mapping L3 freq 83MHz to VDD2_OPP2 and L3 freq 166MHz to VDD2_OPP3. But the above code would always make vdd2_opp to VDD2_OPP2 level. However, it is observed that, if we change the vdd2_opp to 3 using sysfs, it seems to be setting to level 3. I am wondering if there are any issues with sysfs entries since same is working with resource frame work API's. Please let me know if my understanding is wrong. Thanks Regards, V Charu Latha -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Bad block on N810
Hi folks, I'm having a curious problem with my N810: my device turn off (turn off, not restart) always a few seconds after just initialized. Well, after taking a look in dbug mode, I saw the the following problems: [ 36.921875] JFFS2 notice: (1200) check_node_data: wrong data CRC in data node at 0x0b651edc: read 0x25e088e1, calculated 0x76861b05. ... [ 40.578125] JFFS2 warning: (1293) jffs2_sum_write_sumnode: Not enough space for summary, padsize = -965 I already reflash the FIASCO image, but this error persists. So it looks that the fs has some problem (bad block) on internal memory card. mkfs could solve the problem, but, as I mentioned above, only a few seconds after starting, the device shutdown :( Any hints? BR, Carlos. -- Carlos Eduardo Aguiar Software Developer Mobile Linux Software Nokia Institute of Technology - INdT E-mail: carlos.agu...@indt.org.br -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC] DSPBRIDGE: Kill CAMelCaSiNg
Hi All, Ref [1] w.r.t some patchset seen on linux driver project having a similar condition of ton of camelcasing and [2], Can we consider running the following script for DSPBridge code? or if there are some more improvements folks can think of.. - #!/bin/bash # Silly little script to replace CaMELCaSInG to lower_casing # Half a zillion thoughts later, # why not use ctags which has c interpreter already to do # function identification for us? if [ ! -r 'tags' ]; then echo Sorry.. no tags file! exit 1 fi if [ ! -r $1 ]; then echo I need a directory or a file for replacing.. exit 2 fi DIR_FILE=`echo $1|sed -e s/\//\\\//g` # tags have the following notation in field 4 (tab seperated) # e - enum value # d - define # f - function # F - File itself # g - enum type # m - structure parameter # p - prototype # r - kconfig define(refered) # s - structure type # t - typedefined variable # v - variable # x - extern defined variable # we can choose to have different rules: # rename rule i am going to follow: # Any define - convert camelcase to lower_case_define-convert to caps # Any function, enum,struct param,prototype,struct type, typedef var,extern def - # camel_case to lower_case_define # All files will be made unix file only (no point in dos + unix mixtures..) #** #* @brief - changes camel casing to ones with smaller case #* camel_to_norm(){ echo $1|tr '\_' '+' |sed 's/\([A-Z]\)/_\l\1/g' | sed 's/^_\([a-z]\)/\1/g' |\ tr 'A-Z' 'a-z' | sed s/\([a-z][a-z]\+\)/-\1-/g|tr -d '_'|\ tr '-' '_'|sed -e s/_$//g|sed -e s/^_//g | tr '+' '_' |\ sed -e s/__*/_/g|sed -e s/_\([0-9][0-9]*\)/\1/g|\ sed -e s/^[a-z]\_\([a-z][a-z]\+\)/\1/g } #** #* @brief - all_to_upper - Moves all to upper case #* all_to_upper(){ camel_to_norm $1 | tr 'a-z' 'A-Z' } #** #* @brief generate_list - will generate list of symbols from tags matching #* generate_list() { cut -d' ' -f1,4 $TMPFILE|grep $1\$|cut -d' ' -f1|sort|uniq } #** #* @brief find_files - finds list of files from tag file matching usage #* find_files(){ cut -d' ' -f1,2 $TMPFILE|grep ^$1|cut -d' ' -f2|sort|uniq } TMPFILE=/tmp/cleaner.$$.tmp TMPFILE1=/tmp/cleaner.$$.1.tmp # grab the output for only the ones we want.. grep $DIR_FILE tags |grep -v ^\!|sed -e s/\/\^.*\/REPLACE_1/g$TMPFILE replace_pattern(){ echo =Search and replace for pattern $1 with $2 # Convert the functions back to smaller case and replace them in the files for token in `generate_list [$1]` do if [ $2 -eq 1 ]; then new=`camel_to_norm $token` else new=`all_to_upper $token` fi if [ $new != $token ]; then echo ==Replacing $token with $low for file in `find_files $low` do echo -replacing $token to $new in file $file cp $file $TMPFILE1 dos2unix $TMPFILE1 sed -e s/\(W*\)$token\(\W*\)/\1$new\2/g $TMPFILE1$file done else echo ==not replacing $token fi done } echo = Replacing Defines === replace_pattern d 2 echo = Replacing Functions === replace_pattern efgmpstvx 1 rm -f $TMPFILE $TMPFILE1 - -- Regards, Nishanth Menon Ref: [1] http://driverdev.linuxdriverproject.org/pipermail/devel/2009-September/002482.html [2] http://nishanthmenon.blogspot.com/2009/08/replace-camelcasing-with-lowercasing.html -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] DSPBRIDGE: OSAL: Get rid of KFILE
From: Andy Shevchenko ext-andriy.shevche...@nokia.com * Remove KFILE_Init(), KFILE_Exit() and tracing stuff * Simplify KFILE_Seek() * Simplify error checker in KFILE_Open after filp_open() call * Remove pid/tgid related code: it seems totally useless here * Get rid of KFILE_FileObj, use regular struct file instead * Remove kfile.c and kfile.h * Redefine necessary file operations in cod.c in a bit optimal way * Clean up errbase.h Signed-off-by: Andy Shevchenko ext-andriy.shevche...@nokia.com --- arch/arm/plat-omap/include/dspbridge/errbase.h | 27 -- arch/arm/plat-omap/include/dspbridge/kfile.h | 216 --- drivers/dsp/bridge/Kbuild |2 +- drivers/dsp/bridge/pmgr/cod.c | 108 +++- drivers/dsp/bridge/pmgr/dbl.c | 14 +- drivers/dsp/bridge/services/kfile.c| 337 drivers/dsp/bridge/services/services.c | 10 +- 7 files changed, 112 insertions(+), 602 deletions(-) delete mode 100644 arch/arm/plat-omap/include/dspbridge/kfile.h delete mode 100644 drivers/dsp/bridge/services/kfile.c diff --git a/arch/arm/plat-omap/include/dspbridge/errbase.h b/arch/arm/plat-omap/include/dspbridge/errbase.h index 47b9a0b..271315a 100644 --- a/arch/arm/plat-omap/include/dspbridge/errbase.h +++ b/arch/arm/plat-omap/include/dspbridge/errbase.h @@ -464,31 +464,4 @@ /* Insufficient space to hold data in registry value. */ #define REG_E_MOREDATA (REG_EBASE + 0x03) -/* FAILURE Codes : KFILE */ -#define KFILE_EBASE (DSP_COMP_EBASE + 0x900) - -/* Invalid file handle. */ -#define E_KFILE_INVALIDHANDLE (KFILE_EBASE + 0x01) - -/* Bad file name. */ -#define E_KFILE_BADFILENAME (KFILE_EBASE + 0x02) - -/* Invalid file mode. */ -#define E_KFILE_INVALIDMODE (KFILE_EBASE + 0x03) - -/* No resources available. */ -#define E_KFILE_NORESOURCES (KFILE_EBASE + 0x04) - -/* Invalid file buffer. */ -#define E_KFILE_INVALIDBUFFER (KFILE_EBASE + 0x05) - -/* Bad origin argument. */ -#define E_KFILE_BADORIGINFLAG (KFILE_EBASE + 0x06) - -/* Invalid file offset value. */ -#define E_KFILE_INVALIDOFFSET (KFILE_EBASE + 0x07) - -/* General KFILE error condition */ -#define E_KFILE_ERROR (KFILE_EBASE + 0x08) - #endif /* ERRBASE_ */ diff --git a/arch/arm/plat-omap/include/dspbridge/kfile.h b/arch/arm/plat-omap/include/dspbridge/kfile.h deleted file mode 100644 index 23c89b0..000 --- a/arch/arm/plat-omap/include/dspbridge/kfile.h +++ /dev/null @@ -1,216 +0,0 @@ -/* - * kfile.h - * - * DSP-BIOS Bridge driver support functions for TI OMAP processors. - * - * Copyright (C) 2005-2006 Texas Instruments, Inc. - * - * This package 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 PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - - -/* - * kfile.h - * Purpose: - * Provide file I/O management capabilities. - * - * Public Functions: - * KFILE_Close - * KFILE_Exit - * KFILE_Init - * KFILE_Open - * KFILE_Read - * KFILE_Seek - * KFILE_Tell - * KFILE_Write - * - * Notes: - * The KFILE module is not like most of the other DSP/BIOS Bridge modules - * in that it doesn't return WSX_STATUS type values. Rather, it's - * prototypes are meant to match the stdio file prototypes - * (ie, fopen, fclose, etc.). - * - *! Revision History - *! - *! 29-Oct-1999 kc: Clean up for code review. - *! 07-Jan-1998 cr: Clean up for code review. - *! 15-Aug-1997 cr: Added E_KFILE_ERROR for general error condition. - *! 04-Aug-1997 cr: Added explicit CDECL descriptions. - *! 11-Nov-1996 cr: Implemented changes based on code review. - *! 05-Nov-1996 cr: Cleaned up for code review. - *! 29-May-1996 gp: Added requirement that size != 0 in _Write() and _Read(). - *! 28-May-1996 mg: Changed return values for Read/Write. - *! 14-Dec-1995 cr: Created. - */ - -#ifndef KFILE_ -#define KFILE_ - -/* - * Constants for KFILE_Seek. Note that these MUST be the same definitions as - * those defined for fseek. - */ -#define KFILE_SEEK_SET 0x00 /* seek from beginning of file */ -#define KFILE_SEEK_CUR 0x01 /* seek from current position */ -#define KFILE_SEEK_END 0x02 /* seek from end of file */ - - struct KFILE_FileObj; - -/* - * KFILE_Close - * Purpose: - * This function closes a file's stream. - * Parameters: - * hFile: Handle of the file stream returned by KFILE_Open. - * Returns: - * E_KFILE_INVALIDHANDLE: bad handle. - * 0: success. - *
Re: [PATCH V2] OMAP: Fix race condition with autodeps
On Wed, 16 Sep 2009, Kalle Jokiniemi wrote: There is a possible race condition in clockdomain code handling hw supported idle transitions. When multiple autodeps dependencies are being added or removed, a transition of still remaining dependent powerdomain can result in false readings of the state counter. This is especially fatal for off mode state counter, as it could result in a driver not noticing a context loss. Fixed by disabling hw supported state transitions when autodeps are being changed. Signed-off-by: Kalle Jokiniemi kalle.jokini...@digia.com Looks great, Kalle, will send this upstream in a fixes series. - Paul --- arch/arm/mach-omap2/clockdomain.c | 74 ++--- 1 files changed, 44 insertions(+), 30 deletions(-) diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index 4ef7b4f..58aff84 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c @@ -137,6 +137,36 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm) } } +/* + * _omap2_clkdm_set_hwsup - set the hwsup idle transition bit + * @clkdm: struct clockdomain * + * @enable: int 0 to disable, 1 to enable + * + * Internal helper for actually switching the bit that controls hwsup + * idle transitions for clkdm. + */ +static void _omap2_clkdm_set_hwsup(struct clockdomain *clkdm, int enable) +{ + u32 v; + + if (cpu_is_omap24xx()) { + if (enable) + v = OMAP24XX_CLKSTCTRL_ENABLE_AUTO; + else + v = OMAP24XX_CLKSTCTRL_DISABLE_AUTO; + } else if (cpu_is_omap34xx()) { + if (enable) + v = OMAP34XX_CLKSTCTRL_ENABLE_AUTO; + else + v = OMAP34XX_CLKSTCTRL_DISABLE_AUTO; + } else { + BUG(); + } + + cm_rmw_mod_reg_bits(clkdm-clktrctrl_mask, + v __ffs(clkdm-clktrctrl_mask), + clkdm-pwrdm.ptr-prcm_offs, CM_CLKSTCTRL); +} static struct clockdomain *_clkdm_lookup(const char *name) { @@ -456,8 +486,6 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm) */ void omap2_clkdm_allow_idle(struct clockdomain *clkdm) { - u32 v; - if (!clkdm) return; @@ -473,18 +501,7 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm) if (atomic_read(clkdm-usecount) 0) _clkdm_add_autodeps(clkdm); - if (cpu_is_omap24xx()) - v = OMAP24XX_CLKSTCTRL_ENABLE_AUTO; - else if (cpu_is_omap34xx()) - v = OMAP34XX_CLKSTCTRL_ENABLE_AUTO; - else - BUG(); - - - cm_rmw_mod_reg_bits(clkdm-clktrctrl_mask, - v __ffs(clkdm-clktrctrl_mask), - clkdm-pwrdm.ptr-prcm_offs, - CM_CLKSTCTRL); + _omap2_clkdm_set_hwsup(clkdm, 1); pwrdm_clkdm_state_switch(clkdm); } @@ -500,8 +517,6 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm) */ void omap2_clkdm_deny_idle(struct clockdomain *clkdm) { - u32 v; - if (!clkdm) return; @@ -514,16 +529,7 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm) pr_debug(clockdomain: disabling automatic idle transitions for %s\n, clkdm-name); - if (cpu_is_omap24xx()) - v = OMAP24XX_CLKSTCTRL_DISABLE_AUTO; - else if (cpu_is_omap34xx()) - v = OMAP34XX_CLKSTCTRL_DISABLE_AUTO; - else - BUG(); - - cm_rmw_mod_reg_bits(clkdm-clktrctrl_mask, - v __ffs(clkdm-clktrctrl_mask), - clkdm-pwrdm.ptr-prcm_offs, CM_CLKSTCTRL); + _omap2_clkdm_set_hwsup(clkdm, 0); if (atomic_read(clkdm-usecount) 0) _clkdm_del_autodeps(clkdm); @@ -569,10 +575,14 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk) v = omap2_clkdm_clktrctrl_read(clkdm); if ((cpu_is_omap34xx() v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) || - (cpu_is_omap24xx() v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) + (cpu_is_omap24xx() v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) { + /* Disable HW transitions when we are changing deps */ + _omap2_clkdm_set_hwsup(clkdm, 0); _clkdm_add_autodeps(clkdm); - else + _omap2_clkdm_set_hwsup(clkdm, 1); + } else { omap2_clkdm_wakeup(clkdm); + } pwrdm_wait_transition(clkdm-pwrdm.ptr); pwrdm_clkdm_state_switch(clkdm); @@ -623,10 +633,14 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) v = omap2_clkdm_clktrctrl_read(clkdm); if ((cpu_is_omap34xx() v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) || - (cpu_is_omap24xx() v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) + (cpu_is_omap24xx() v ==
[PATCH 0/1] OMAP: I2C: Add mpu wake up latency constraint
Sending this patch that fixes a problem where I2C transfers get stalled because MPU can hit off mode while i2c is waiting for transfer completion. There are some changes on how clkrate is passed to i2c-omap bus driver, as I needed to pass also the constraint setting function. So review comments are most welcome. Applies on top of pm-branch. Just build tested for omap3_pm_defconfig. Could not get linux-omap to boot on my rx-51, so it's only tested with our internal tree. - Kalle -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/1] OMAP: I2C: Add mpu wake up latency constraint in i2c
While waiting for completion of the i2c transfer, the MPU could hit OFF mode and cause several msecs of delay that made i2c transfers fail more often. The extra delays and subsequent re-trys cause i2c clocks to be active more often. This has also an negative effect on power consumption. Added a constraint that allows MPU to wake up in few hundred usecs, which is roughly the average i2c wait period. The constraint function is passed as platform data from plat-omap/i2c.c and applied only on OMAP34XX devices. Signed-off-by: Kalle Jokiniemi kalle.jokini...@digia.com --- arch/arm/plat-omap/i2c.c | 49 +++-- drivers/i2c/busses/i2c-omap.c | 17 +++--- include/linux/i2c-omap.h |9 +++ 3 files changed, 59 insertions(+), 16 deletions(-) create mode 100644 include/linux/i2c-omap.h diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c index 8b84839..d43d0ad 100644 --- a/arch/arm/plat-omap/i2c.c +++ b/arch/arm/plat-omap/i2c.c @@ -26,8 +26,10 @@ #include linux/kernel.h #include linux/platform_device.h #include linux/i2c.h +#include linux/i2c-omap.h #include mach/irqs.h #include mach/mux.h +#include mach/omap-pm.h #define OMAP_I2C_SIZE 0x3f #define OMAP1_I2C_BASE 0xfffb3800 @@ -69,14 +71,14 @@ static struct resource i2c_resources[][2] = { }, \ } -static u32 i2c_rate[ARRAY_SIZE(i2c_resources)]; +static struct omap_i2c_bus_platform_data i2c_pdata[ARRAY_SIZE(i2c_resources)]; static struct platform_device omap_i2c_devices[] = { - I2C_DEV_BUILDER(1, i2c_resources[0], i2c_rate[0]), + I2C_DEV_BUILDER(1, i2c_resources[0], i2c_pdata[0]), #ifdefined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) - I2C_DEV_BUILDER(2, i2c_resources[1], i2c_rate[1]), + I2C_DEV_BUILDER(2, i2c_resources[1], i2c_pdata[1]), #endif #ifdefined(CONFIG_ARCH_OMAP34XX) - I2C_DEV_BUILDER(3, i2c_resources[2], i2c_rate[2]), + I2C_DEV_BUILDER(3, i2c_resources[2], i2c_pdata[2]), #endif }; @@ -100,6 +102,25 @@ static const int omap34xx_pins[][2] = {}; #define OMAP_I2C_CMDLINE_SETUP (BIT(31)) +/** + * omap_i2c_set_wfc_mpu_wkup_lat - sets mpu wake up constraint + * @dev: i2c bus device pointer + * @set: set or clear constraints + * + * When waiting for completion of a i2c transfer, we need to set a wake up + * latency constraint for the MPU. This is to ensure quick enough wakeup + * from idle, when transfer completes. + */ +#ifdef CONFIG_ARCH_OMAP34XX +static void omap_i2c_set_wfc_mpu_wkup_lat(struct device *dev, int set) +{ + omap_pm_set_max_mpu_wakeup_lat(dev, set ? 500 : -1); +} +#else +static inline void omap_i2c_set_wfc_mpu_wkup_lat(struct device *dev, int set) +{; } +#endif + static void __init omap_i2c_mux_pins(int bus) { int scl, sda; @@ -180,8 +201,8 @@ static int __init omap_i2c_bus_setup(char *str) get_options(str, 3, ints); if (ints[0] 2 || ints[1] 1 || ints[1] ports) return 0; - i2c_rate[ints[1] - 1] = ints[2]; - i2c_rate[ints[1] - 1] |= OMAP_I2C_CMDLINE_SETUP; + i2c_pdata[ints[1] - 1].clkrate = ints[2]; + i2c_pdata[ints[1] - 1].clkrate |= OMAP_I2C_CMDLINE_SETUP; return 1; } @@ -195,9 +216,11 @@ static int __init omap_register_i2c_bus_cmdline(void) { int i, err = 0; - for (i = 0; i ARRAY_SIZE(i2c_rate); i++) - if (i2c_rate[i] OMAP_I2C_CMDLINE_SETUP) { - i2c_rate[i] = ~OMAP_I2C_CMDLINE_SETUP; + for (i = 0; i ARRAY_SIZE(i2c_pdata); i++) + if (i2c_pdata[i].clkrate OMAP_I2C_CMDLINE_SETUP) { + i2c_pdata[i].clkrate = ~OMAP_I2C_CMDLINE_SETUP; + i2c_pdata[i].set_mpu_wkup_lat = + omap_i2c_set_wfc_mpu_wkup_lat; err = omap_i2c_add_bus(i + 1); if (err) goto out; @@ -231,9 +254,11 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate, return err; } - if (!i2c_rate[bus_id - 1]) - i2c_rate[bus_id - 1] = clkrate; - i2c_rate[bus_id - 1] = ~OMAP_I2C_CMDLINE_SETUP; + if (!i2c_pdata[bus_id - 1].clkrate) + i2c_pdata[bus_id - 1].clkrate = clkrate; + + i2c_pdata[bus_id - 1].set_mpu_wkup_lat = omap_i2c_set_wfc_mpu_wkup_lat; + i2c_pdata[bus_id - 1].clkrate = ~OMAP_I2C_CMDLINE_SETUP; return omap_i2c_add_bus(bus_id); } diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 75bf3ad..da6d276 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -37,6 +37,7 @@ #include linux/platform_device.h #include linux/clk.h #include linux/io.h +#include linux/i2c-omap.h /* I2C controller revisions */ #define OMAP_I2C_REV_2 0x20 @@ -165,6
RE: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup
Russell -Original Message- From: Russell King - ARM Linux [mailto:li...@arm.linux.org.uk] Sent: Wednesday, September 16, 2009 2:11 PM To: Kevin Hilman Cc: Pandita, Vikram; linux-omap@vger.kernel.org; linux-arm-ker...@lists.arm.linux.org.uk Subject: Re: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup On Thu, Aug 27, 2009 at 04:29:35PM +0300, Kevin Hilman wrote: The idea is to write to phys_io and io_pg_offset from kernel/head.S very early based on the uart address found in compressed/misc.c To make map_io writable, I will have to change the MACHINE_START to remove the const. It so happens that Russell has defined MACHINE_START to be a const. Not sure is removing const from MACHINE_START is acceptable? we'll find out after you post for RFC. The answer is no, it is not acceptable - it'll break XIP kernels because this is placed into the read-only part of the kernel image no matter what. The good news is that Version 2 of DEBUG_LL cleanup patch [1], does not change the const attribute of MACHINE_START. There are review comments by Kevin [2] still getting fixed, but a 'Russell-look' will surely help to the in-lined patch [3] . Regards, Vikram [1] git://dev.omapzoom.org/pub/scm/vikram/omap3.git runtime-debug-ll [2] http://patchwork.kernel.org/patch/46909/ [3] Patch inlined below --- diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 4515728..7fcc21a 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -277,6 +277,20 @@ not_relocated:mov r0, #0 blo 1b add sp, r1, #128@ relocate the stack + mov r9, r0 + + bl get_uart_base @ get uart phy address + adr r2, __dummy + str r0, [r2]@save uart phy adder in memory + ldm r2, {r13}^ @save phyadder in usermode reg + + bl get_uart_virt_base @ get uart virtual address + adr r2, __dummy + str r0, [r2]@save uart phy adder in memory + ldm r2, {r14}^ @save phyadder in usermode reg + + mov r0, r9 + bl cache_clean_flush add pc, r5, r0 @ call relocation code @@ -303,6 +317,9 @@ LC0: .word LC0 @ r1 LC1: .word reloc_end - reloc_start .size LC0, . - LC0 + .type __dummy, #object +__dummy: .word __dummy + #ifdef CONFIG_ARCH_RPC .globl params params:ldr r0, =params_phys diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index 17153b5..0758656 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -22,6 +22,15 @@ unsigned int __machine_arch_type; #include linux/types.h /* for size_t */ #include linux/stddef.h /* for NULL */ #include asm/string.h +#include asm/mach-types.h +/* TODO: + * Include of this header is not working. + * Gives Error: undefined reference to `omap_rev' + * This header is needed for constant: + * ZOOM2_EXT_QUART_VIRT = 0xFB00 + * ZOOM2_EXT_QUART_PHYS = 0x1000 + */ +/* #include mach/io.h */ #ifdef STANDALONE_DEBUG #define putstr printf @@ -316,6 +325,103 @@ static void error(char *x) #ifndef STANDALONE_DEBUG +u32 *omap_uart_debug_ll_phy_addr; + +static void find_debug_ll_uart_port(unsigned int arch_type) +{ + omap_uart_debug_ll_phy_addr = 0; + + /* Add logic here for new platforms, using __macine_arch_type */ + + /* TODO: REVISIT -- Check Completeness +* DEFINE PHY ADDRESS for EACH BOARD HERE: omap1/2/3/4 */ +#if defined(CONFIG_ARCH_OMAP1) + switch (arch_type) { + case MACH_TYPE_OMAP_PALMTT: + case MACH_TYPE_SX1: + /* UART2 */ + omap_uart_debug_ll_phy_addr = (u32 *)0xfffb0800; + break; + default: + /* UART1 */ + omap_uart_debug_ll_phy_addr = (u32 *)0xfffb; + break; + } +#endif + +#if defined(CONFIG_ARCH_OMAP2) + switch (arch_type) { + case MACH_TYPE_NOKIA_N800: + case MACH_TYPE_NOKIA_N810: + case MACH_TYPE_NOKIA_N810_WIMAX: + /* UART3 */ + omap_uart_debug_ll_phy_addr = (u32 *)0x4806e000; + break; + default: + /* UART1 */ + omap_uart_debug_ll_phy_addr = (u32 *)0x4806a000; + break; + } +#endif + +#if defined(CONFIG_ARCH_OMAP3) + switch (arch_type) { + case MACH_TYPE_OMAP_LDP: + case MACH_TYPE_OVERO: + case MACH_TYPE_OMAP3_PANDORA: + case MACH_TYPE_NOKIA_RX51: + case MACH_TYPE_OMAP3_BEAGLE: + /* UART3 */ + omap_uart_debug_ll_phy_addr = (u32 *)0x4902; + break; +
Re: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup
On Fri, Sep 18, 2009 at 12:30:25AM +0530, Pandita, Vikram wrote: There are review comments by Kevin [2] still getting fixed, but a 'Russell-look' will surely help to the in-lined patch [3] . Still not good. + mov r9, r0 + + bl get_uart_base @ get uart phy address + adr r2, __dummy + str r0, [r2]@save uart phy adder in memory + ldm r2, {r13}^ @save phyadder in usermode reg + + bl get_uart_virt_base @ get uart virtual address + adr r2, __dummy + str r0, [r2]@save uart phy adder in memory + ldm r2, {r14}^ @save phyadder in usermode reg + + mov r0, r9 + bl cache_clean_flush add pc, r5, r0 @ call relocation code @@ -303,6 +317,9 @@ LC0: .word LC0 @ r1 LC1: .word reloc_end - reloc_start .size LC0, . - LC0 + .type __dummy, #object +__dummy: .word __dummy This appears to be in the text segment, and is written to. That's not going to work if the text segment is stored in flash (and in fact might be dangerous in some cases.) + #ifdef CONFIG_ARCH_RPC .globl params params: ldr r0, =params_phys diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index 17153b5..0758656 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -22,6 +22,15 @@ unsigned int __machine_arch_type; #include linux/types.h /* for size_t */ #include linux/stddef.h/* for NULL */ #include asm/string.h +#include asm/mach-types.h +/* TODO: + * Include of this header is not working. + * Gives Error: undefined reference to `omap_rev' + * This header is needed for constant: + * ZOOM2_EXT_QUART_VIRT = 0xFB00 + * ZOOM2_EXT_QUART_PHYS = 0x1000 + */ +/* #include mach/io.h */ #ifdef STANDALONE_DEBUG #define putstr printf @@ -316,6 +325,103 @@ static void error(char *x) #ifndef STANDALONE_DEBUG +u32 *omap_uart_debug_ll_phy_addr; + +static void find_debug_ll_uart_port(unsigned int arch_type) +{ + omap_uart_debug_ll_phy_addr = 0; + + /* Add logic here for new platforms, using __macine_arch_type */ + + /* TODO: REVISIT -- Check Completeness + * DEFINE PHY ADDRESS for EACH BOARD HERE: omap1/2/3/4 */ +#if defined(CONFIG_ARCH_OMAP1) + switch (arch_type) { + case MACH_TYPE_OMAP_PALMTT: + case MACH_TYPE_SX1: + /* UART2 */ + omap_uart_debug_ll_phy_addr = (u32 *)0xfffb0800; + break; + default: + /* UART1 */ + omap_uart_debug_ll_phy_addr = (u32 *)0xfffb; + break; + } +#endif + +#if defined(CONFIG_ARCH_OMAP2) + switch (arch_type) { + case MACH_TYPE_NOKIA_N800: + case MACH_TYPE_NOKIA_N810: + case MACH_TYPE_NOKIA_N810_WIMAX: + /* UART3 */ + omap_uart_debug_ll_phy_addr = (u32 *)0x4806e000; + break; + default: + /* UART1 */ + omap_uart_debug_ll_phy_addr = (u32 *)0x4806a000; + break; + } +#endif + +#if defined(CONFIG_ARCH_OMAP3) + switch (arch_type) { + case MACH_TYPE_OMAP_LDP: + case MACH_TYPE_OVERO: + case MACH_TYPE_OMAP3_PANDORA: + case MACH_TYPE_NOKIA_RX51: + case MACH_TYPE_OMAP3_BEAGLE: + /* UART3 */ + omap_uart_debug_ll_phy_addr = (u32 *)0x4902; + break; + case MACH_TYPE_OMAP_ZOOM2: + /* EXTERNEL UART */ + omap_uart_debug_ll_phy_addr = (u32 *)0x1000; + break; + default: + /* UART1 */ + omap_uart_debug_ll_phy_addr = (u32 *)0x4806a000; + break; + } +#endif + +#ifdef CONFIG_ARCH_OMAP4 + switch (arch_type) { + /* OMAP3: UART1 */ + case MACH_TYPE_OMAP_4430SDP: + default: + omap_uart_debug_ll_phy_addr = (u32 *)0x4806a000; + putstr(This is an OMAP4 ...\n); + break; + } +#endif +} + +ulg +get_uart_base(void) +{ + return (ulg)omap_uart_debug_ll_phy_addr; +} + +ulg +get_uart_virt_base(void) +{ + ulg val = 0; + +#ifdef CONFIG_ARCH_OMAP1 + /* omap1 */ + val = 0xfef0; +#else + /* omap2/3/4... */ + if (MACH_TYPE_OMAP_ZOOM2 == __machine_arch_type) + val = 0xFB00; /* ZOOM2_EXT_QUART_VIRT */ + else + val = 0xd800; +#endif + + return (ulg)(((val) 18) 0xfffc); +} + Clearly, all this code should not be in here. There's a perfectly good header file to contain the platform specifics which it can live in, and there's a perfectly good hook for it to latch into (arch_decomp_setup). diff --git
Re: Exception while handling MEM Hole on OMAP3 / ARM Cortex A8
Pavel Machek wrote: On Mon 2009-09-07 15:22:10, Russell King - ARM Linux wrote: On Tue, Aug 18, 2009 at 08:31:49AM +0530, Rabin Vincent wrote: Here's a fixed version: And here's my revised version with these fixes in. I changed the while loop to a do..while loop instead (since we will always have at least one memory bank, it's pointless doing that test for the first iteration.) Acks and tested-bys would be useful please. +static int __init meminfo_cmp(const void *_a, const void *_b) +{ + const struct membank *a = _a, *b = _b; + long cmp = bank_pfn_start(a) - bank_pfn_start(b); + return cmp 0 ? -1 : cmp 0 ? 1 : 0; +} I believe you can just return cmp here. If this were generic code, the long value might overflow int. But this is ARM code, limited to 32 bits, so it could. It'd be asking for trouble if someone copied the code elsewhere, though. -- Jamie -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] omap: resource: Fix race in register_resource()
Checking if the resource is already registered and adding to the list must be atomic or bad things can happen. Signed-off-by: Mike Chan m...@android.com --- arch/arm/plat-omap/resource.c | 13 - 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/arm/plat-omap/resource.c b/arch/arm/plat-omap/resource.c index 111020a..4631912 100644 --- a/arch/arm/plat-omap/resource.c +++ b/arch/arm/plat-omap/resource.c @@ -255,6 +255,7 @@ int resource_refresh(void) */ int resource_register(struct shared_resource *resp) { + int ret = 0; if (!resp) return -EINVAL; @@ -262,12 +263,13 @@ int resource_register(struct shared_resource *resp) return -EINVAL; /* Verify that the resource is not already registered */ - if (resource_lookup(resp-name)) - return -EEXIST; + down(res_mutex); + if (_resource_lookup(resp-name)) + ret = -EEXIST; + goto out; INIT_LIST_HEAD(resp-users_list); - down(res_mutex); /* Add the resource to the resource list */ list_add(resp-node, res_list); @@ -275,10 +277,11 @@ int resource_register(struct shared_resource *resp) if (resp-ops-init) resp-ops-init(resp); - up(res_mutex); pr_debug(resource: registered %s\n, resp-name); - return 0; +out: + up(res_mutex); + return ret; } EXPORT_SYMBOL(resource_register); -- 1.5.4.5 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] video: omap2: dss: RET on idle, enable/disable dss clocks only when needed.
Signed-off-by: Mike Chan m...@android.com --- drivers/video/omap2/dss/dispc.c |6 - drivers/video/omap2/dss/dsi.c | 50 +++--- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index d061d75..4216466 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -484,13 +484,17 @@ static inline void enable_clocks(bool enable) bool dispc_go_busy(enum omap_channel channel) { int bit; + bool ret; if (channel == OMAP_DSS_CHANNEL_LCD) bit = 5; /* GOLCD */ else bit = 6; /* GODIGIT */ - return REG_GET(DISPC_CONTROL, bit, bit) == 1; + enable_clocks(1); + ret = REG_GET(DISPC_CONTROL, bit, bit) == 1; + enable_clocks(0); + return ret; } void dispc_go(enum omap_channel channel) diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 5e3d653..e9d8a5f 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -1186,6 +1186,9 @@ int dsi_pll_init(bool enable_hsclk, bool enable_hsdiv) if (r) goto err1; + enable_clocks(0); + dsi_enable_pll_clock(0); + DSSDBG(PLL init done\n); return 0; @@ -1199,11 +1202,9 @@ err0: void dsi_pll_uninit(void) { - enable_clocks(0); - dsi_enable_pll_clock(0); - dsi.pll_locked = 0; dsi_pll_power(DSI_PLL_POWER_OFF); + regulator_disable(dsi.vdds_dsi_reg); DSSDBG(PLL uninit done\n); } @@ -1848,6 +1849,9 @@ static int dsi_vc_send_bta_sync(int channel) INIT_COMPLETION(dsi.bta_completion); + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi_vc_enable_bta_irq(channel); r = dsi_vc_send_bta(channel); @@ -1870,6 +1874,9 @@ static int dsi_vc_send_bta_sync(int channel) err: dsi_vc_disable_bta_irq(channel); + enable_clocks(0); + dsi_enable_pll_clock(0); + return r; } @@ -1921,6 +1928,9 @@ static int dsi_vc_send_long(int channel, u8 data_type, u8 *data, u16 len, return -EINVAL; } + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi_vc_write_long_header(channel, data_type, len, ecc); /*dsi_vc_print_status(0); */ @@ -1964,6 +1974,9 @@ static int dsi_vc_send_long(int channel, u8 data_type, u8 *data, u16 len, dsi_vc_write_long_payload(channel, b1, b2, b3, 0); } + enable_clocks(0); + dsi_enable_pll_clock(0); + return r; } @@ -1979,6 +1992,9 @@ static int dsi_vc_send_short(int channel, u8 data_type, u16 data, u8 ecc) channel, data_type, data 0xff, (data 8) 0xff); + enable_clocks(1); + dsi_enable_pll_clock(1); + if (FLD_GET(dsi_read_reg(DSI_VC_CTRL(channel)), 16, 16)) { DSSERR(ERROR FIFO FULL, aborting transfer\n); return -EINVAL; @@ -1990,6 +2006,9 @@ static int dsi_vc_send_short(int channel, u8 data_type, u16 data, u8 ecc) dsi_write_reg(DSI_VC_SHORT_PACKET_HEADER(channel), r); + enable_clocks(0); + dsi_enable_pll_clock(0); + return 0; } @@ -2775,13 +2794,15 @@ static int dsi_update_thread(void *data) break; dsi_bus_lock(); - if (dsi.update_mode == OMAP_DSS_UPDATE_DISABLED || kthread_should_stop()) { dsi_bus_unlock(); break; } + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi_perf_mark_setup(); if (dsi.update_region.dirty) { @@ -2872,6 +2893,9 @@ static int dsi_update_thread(void *data) complete_all(dsi.update_completion); + enable_clocks(0); + dsi_enable_pll_clock(0); + dsi_bus_unlock(); /* XXX We need to give others chance to get the bus lock. Is @@ -3068,6 +3092,9 @@ static int dsi_display_enable(struct omap_dss_device *dssdev) if (dsi.update_mode == OMAP_DSS_UPDATE_AUTO) dsi_start_auto_update(dssdev); + enable_clocks(0); + dsi_enable_pll_clock(0); + dsi_bus_unlock(); mutex_unlock(dsi.lock); @@ -3101,6 +3128,9 @@ static void dsi_display_disable(struct omap_dss_device *dssdev) dsi.update_mode = OMAP_DSS_UPDATE_DISABLED; dssdev-state = OMAP_DSS_DISPLAY_DISABLED; + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi_display_uninit_dispc(dssdev); dsi_display_uninit_dsi(dssdev); @@ -3128,6 +3158,9 @@ static int dsi_display_suspend(struct omap_dss_device *dssdev) dsi.update_mode = OMAP_DSS_UPDATE_DISABLED; dssdev-state = OMAP_DSS_DISPLAY_SUSPENDED; +
Re: [PATCH] video: omap2: dss: RET on idle, enable/disable dss clocks only when needed.
On Thu, Sep 17, 2009 at 4:36 PM, Mike Chan m...@android.com wrote: Signed-off-by: Mike Chan m...@android.com --- drivers/video/omap2/dss/dispc.c | 6 - drivers/video/omap2/dss/dsi.c | 50 +++--- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index d061d75..4216466 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -484,13 +484,17 @@ static inline void enable_clocks(bool enable) bool dispc_go_busy(enum omap_channel channel) { int bit; + bool ret; if (channel == OMAP_DSS_CHANNEL_LCD) bit = 5; /* GOLCD */ else bit = 6; /* GODIGIT */ - return REG_GET(DISPC_CONTROL, bit, bit) == 1; + enable_clocks(1); + ret = REG_GET(DISPC_CONTROL, bit, bit) == 1; + enable_clocks(0); + return ret; } void dispc_go(enum omap_channel channel) diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 5e3d653..e9d8a5f 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -1186,6 +1186,9 @@ int dsi_pll_init(bool enable_hsclk, bool enable_hsdiv) if (r) goto err1; + enable_clocks(0); + dsi_enable_pll_clock(0); + DSSDBG(PLL init done\n); return 0; @@ -1199,11 +1202,9 @@ err0: void dsi_pll_uninit(void) { - enable_clocks(0); - dsi_enable_pll_clock(0); - dsi.pll_locked = 0; dsi_pll_power(DSI_PLL_POWER_OFF); + regulator_disable(dsi.vdds_dsi_reg); DSSDBG(PLL uninit done\n); } @@ -1848,6 +1849,9 @@ static int dsi_vc_send_bta_sync(int channel) INIT_COMPLETION(dsi.bta_completion); + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi_vc_enable_bta_irq(channel); r = dsi_vc_send_bta(channel); @@ -1870,6 +1874,9 @@ static int dsi_vc_send_bta_sync(int channel) err: dsi_vc_disable_bta_irq(channel); + enable_clocks(0); + dsi_enable_pll_clock(0); + return r; } @@ -1921,6 +1928,9 @@ static int dsi_vc_send_long(int channel, u8 data_type, u8 *data, u16 len, return -EINVAL; } + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi_vc_write_long_header(channel, data_type, len, ecc); /*dsi_vc_print_status(0); */ @@ -1964,6 +1974,9 @@ static int dsi_vc_send_long(int channel, u8 data_type, u8 *data, u16 len, dsi_vc_write_long_payload(channel, b1, b2, b3, 0); } + enable_clocks(0); + dsi_enable_pll_clock(0); + return r; } @@ -1979,6 +1992,9 @@ static int dsi_vc_send_short(int channel, u8 data_type, u16 data, u8 ecc) channel, data_type, data 0xff, (data 8) 0xff); + enable_clocks(1); + dsi_enable_pll_clock(1); + if (FLD_GET(dsi_read_reg(DSI_VC_CTRL(channel)), 16, 16)) { DSSERR(ERROR FIFO FULL, aborting transfer\n); return -EINVAL; @@ -1990,6 +2006,9 @@ static int dsi_vc_send_short(int channel, u8 data_type, u16 data, u8 ecc) dsi_write_reg(DSI_VC_SHORT_PACKET_HEADER(channel), r); + enable_clocks(0); + dsi_enable_pll_clock(0); + return 0; } @@ -2775,13 +2794,15 @@ static int dsi_update_thread(void *data) break; dsi_bus_lock(); - if (dsi.update_mode == OMAP_DSS_UPDATE_DISABLED || kthread_should_stop()) { dsi_bus_unlock(); break; } + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi_perf_mark_setup(); if (dsi.update_region.dirty) { @@ -2872,6 +2893,9 @@ static int dsi_update_thread(void *data) complete_all(dsi.update_completion); + enable_clocks(0); + dsi_enable_pll_clock(0); + dsi_bus_unlock(); /* XXX We need to give others chance to get the bus lock. Is @@ -3068,6 +3092,9 @@ static int dsi_display_enable(struct omap_dss_device *dssdev) if (dsi.update_mode == OMAP_DSS_UPDATE_AUTO) dsi_start_auto_update(dssdev); + enable_clocks(0); + dsi_enable_pll_clock(0); + dsi_bus_unlock(); mutex_unlock(dsi.lock); @@ -3101,6 +3128,9 @@ static void dsi_display_disable(struct omap_dss_device *dssdev) dsi.update_mode = OMAP_DSS_UPDATE_DISABLED; dssdev-state = OMAP_DSS_DISPLAY_DISABLED; + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi_display_uninit_dispc(dssdev); dsi_display_uninit_dsi(dssdev); @@ -3128,6 +3158,9 @@ static int dsi_display_suspend(struct omap_dss_device