Tuesday, December 28, 2010

Android kernel additions

Here is a good link which talks about the difference between android kernel and mainline kernel.

How to participate in linux Community

Here is a good document written by Jonathan corbet in linux foundation. The document explains pretty well how the community works. Its a must read for those who are interested in sending patches upstream.

Monday, December 27, 2010

OLED Organic Light Emiting Diodes


Organic in OLED means Organic material. Carbon is the basis of all organic material.
Advantages:
Fast response time.
Wide view angle due to the thin layers used.
Low power consumption.
Outstanding contrast levels.

For more info, OLED diplay.net
How stuff works

Friday, December 24, 2010

Regulator frame work in linux


Version : 2.6.35

You can read a presentation from Liam at free electrons.

Good documentation is there in Linux kernel DOCUMENTATION folder also. (Documentation/power/regulator/)

Problem:
Before enabling the regulator driver in linux kernel, I m able to get the sendend interrupts. But after enabling the regulator driver, not getting the interrupts.

Reason:
There is a call in my board file like,
regulator_has_full_constraints();

Here is the explanation given in drivers/regulators/core.c

/**
* regulator_has_full_constraints - the system has fully specified constraints
*
* Calling this function will cause the regulator API to disable all
* regulators which have a zero use count and don't have an always_on
* constraint in a late_initcall.
*
* The intention is that this will become the default behaviour in a
* future kernel release so users are encouraged to use this facility
* now.
*/

So this was switching off one LDO down which is used by a comparator to detect the send end interrupts. So commented out that function from the board file till power management becomes important. :-)

Monday, December 13, 2010

Trace 32

Trace 32 is an amazing tool for run time intrusive debugging. It has a good support for Linux also. To see the register dumps, where 0xFA50_0000 is the physical register address.
d.dump 0xFA500000

The above access is through processor. For that you need to stop the processor. If you want to access the registers while processor running, you have to access through DAP(Debug Acces Port). Here is the command,
d.dump EDAP:0xFA500000

To save contents to a file,
For eg save data in RAM from 0x96000000 to 0x96004000,
data.save.binary c:\D_drive\file.bin 0x96000000--0x96004000

or to save 1MB from 0x96900000,
data.save.binary c:\D_drive\ptms\notwrapped.bin 0x96900000++0x100000

similarly, to save using EDAP,
data.save.binary c:\D_drive\ptms\notwrapped.bin EDAP:0x96900000++0x100000

You must be thinking now why am I reading through EDAP. what's the difference. Consider the following scenario.
1. memset RAM address from 0x96000000(This will create cache entries for this region)
2. Now this memory is over written by a hardware eg:dma
3. Now if you try to access the RAM through processor, there is a high probabilty that you will see the old value in RAM(the one which you write with memset) and not the updated value written by hardware(eg dma). This is because of cache. When JTAG access through processor if there is a cache hit, it give the value in the cache.

So in these scenarios we have to access through DAP.

To draw the image at frame buffer ram address 0x4f80_0000 with RGB888 format
d.IMAGE a:0x4f800000 480. 992. /RGBX888

Type sys, you will get the window for attach option. Saving page layout, Windows->Store windows to. This will store the windows open as .cmm file. Next time when you want this windows, run the saved cmm file. To add the source, View-> Symbols->Source search path->Add dir To get online help, Type the command on the command line, leave a space blank and press F1. To take Register Dumps us the following scripts,
=======================
printer.filetype ascii
printer.open dump.txt
wp.d a:0xe0100000--a:0xe010700c /WIDTH 4
printer.close
=========================

For loading vmlinux:
data.load.elf Z:\projects\mobcom_andrwks_ext8\users\arunks\common-android\kernel\hawaii\3.4.5\vmlinux /nocode /noclear

    NoClear: Existing symbols are not deleted. This option is necessary if more programs
must be loaded (Tasks, Overlays, Banking).
    NoCODE: Suppress the code download. Only loads symbolic information.

More info

For loading a binary,
data.load.binary filename A:RamStart--A:RamEnd /noclear

For typcasting any memory:
For eg task_struct,
var.view (struct task_struct*)0xc094d8f0

To view stack frame:
var.frame /core 0

To disassemble a location,
data.list

STRIPPART
===========
Sometimes T32 might complain saying cannot find the path to file, when you try to map to source code.
Lets say for example,
"Z:\projects\mobcom\users\arunks\eos\br-eos-4.4-2b\android\kernel\init\main.c cannot find"

Our source is at location Y:\br-eos-4.4-2b\android\kernel\init\main.c

So our source path is different till br-eos-4.4-2b, so we need to strip till there,
ie 6 elements. so the command is
d.load.elf Y:\br-eos-4.4-2b\vmlinux /nocode /StripPART 6 /PATH Y:\br-eos-4.4-2b

Use command  "symbol.list.source" to easily find out how many patch to strip. Before this command you have to load elf without any /Strippart argument.

Sometimes vmlinux might get compiled in different folder, another way of doing it is copy the vmlinux to the kernel source folder. Then load from there and strip using /strippart


Data.LOAD.elf Z:\autotrees\LA.HB.1.1.5_RB1.07.00.00.310.033\kernel\msm-4.4\vmlinux /stripPart "/local/mnt/workspace/autotrees/LA.HB.1.1.5_RB1.07.00.00.310.033/kernel/msm-4.4" /nocode /gnu

CO-Processor registers
=================
http://www2.lauterbach.com/pdf/debugger_arm.pdf
page 32

For all Lauterbach T32 Manual, vist here.

Thursday, December 9, 2010

MIPI display pannel

When I was introduced to the project the display was not at all working. We were doing the porting of Froyo kernel(2.6.32) for garnett phone.

Let me first describe how a MIPI pannel driver works. Mobile Industry Processor Interface(MIPI) alliance is about setting up a standard for interfacing the processor with different peripherals. Our concern in this context is about Display Interface. The Display Serial Interface defines protocol between processor and peripheral device using a D-PHY physical interface. It is build by adopting pixel format and command set specified in DPI-2(Display Parallel Interface) and DCS standards. DSI serializes all pixel data, command and events. The legacy interfaces convey the data and control to and from from the peripheral on a parallel bus. The unavoidable consequence of this transformation is the increased latency. But the D-PHY solution brings out the very low power consumption.

The practical data rate per lane is <1Gb/s.
Min no of pins per direction 4.

So that's it about the DSI interface.

Now on the Garnet phone, which uses the Sam-sung Humming bird processor(C110) has 3-D accelerator. There is a separate driver for this hardware accelerator. In our display driver we will allocate the memory for the frame buffer and pass it to the hardware accelerator driver. It will decode the frames and place it in the frame buffer memory. From Frame buffer memory, the DSIM(Display serial interface Module) implements the DSI protocol for sending data to the lcd panel. The lcd panel used was an AMOLED.

The LCD panel interrupts the processor whenever it is ready to receive a new frame. So initially this gpio pin was not configured properly. After fixing this display started working after booting up. But boot animation was not showing.

The code base for Garnett is taken from the galaxy S phone. Later we found out from some status register that the DSIM controller is going in to ULPS(Ultra Low Power State). On Samsung galaxy, usb OTG uses a LDO3 for USB_V1.1 voltage supply. But on Garnett, this LDO is shared between USV_V1.1 and MIPI_PowerEN. Unluckily usb code was disabling the LDO3 during boot-up.

But still display didn't leave me. The problem becomes like this now. Some times boot animation is not coming. Hmm... What to do... Have to continue hunting... I dumped all the registers of the C110 processor(clock, DSIM, video controllor registers) using JTAG. Everything seems fine. Then checked the gpio mux settings. No issues there also. Cannot find direction to move ahead. At the end, problem was due to frame buffer probe is called before the regulator framework is initialized. During the regulator initialization he reset the chip and enables all the voltage again. So sometimes the LCD panel is going into invalid state.

So good lesson learned. Even if the boot loader initialize the regulators or not, we have to bring regulator up and stabilize all the voltages before initializing any of the peripherals. Dammn it!!!!. Thought of doing this first but didn't contemplate on this much.

Wednesday, December 8, 2010

Some Common Questions?

1) What is unaligned memory access?

Definition:
Unaligned memory accesses occur when you try to read N bytes of
data starting from an address that is not evenly divisible by N
(i.e. addr % N != 0). For example, reading 4 bytes of data
from address 0x10004 is fine, but reading 4 bytes of data from
address 0x10005 would be an unaligned memory access.

Fortunately things are not too complex, as in most cases, the
compiler ensures that things will work for you.

For more reading,
http://lwn.net/Articles/260456/

Thursday, December 2, 2010

A moment of pride

This is really a moment of pride for me. My driver is going upstream mainline Linux kernel.

Here it goes, the mail from Takashi Iwai to Linus Torvalds requesting to pull the driver,


One of my dreams comes true... Aha.....
I love Linux kernel. The way it works... During initial days of my career I used to ask many questions in the mailing list. I was amazed with the support and patience they posses. So I decided one day I will give something back to the community.

Contributions

Arun