[DEV-Only] 3.x Kernel for Xperia X10

Search This thread

Tof37

Senior Member
Oct 6, 2009
624
2,468
Tours
As some may know, I'm getting headaches since months (I'm not a professional dev ...) to port 3.0.8 kernel on x10.

I'm opening a new thread to talk about progress on 3.x kernel ported to the
ES209RA..

I'd like to share the work I've made since last year and involve as much people as it's possible.

I'll try to keep this thread updated with "what is working" and a "to do" or "to fix list" ...

You've been warned : this a development thread, and until kernel is "officialy" relased, flashing stuff or adding changes in kernel and flashing it on your device without knowing what you do may damage your phone.

Important notice :

This is not a thread to teach "how to port" or else ...

However when the time will come, testers will be needed, posts will be make to have report etc ...

Don't ask for ETA ...

Thanks a lot for understanding
 

Tof37

Senior Member
Oct 6, 2009
624
2,468
Tours
Kernel 3.0.8 porting

Ported on X10 from msm7x30-3.0.x-nAa

Thanks to :

nAa for his sources and his thread to get serial console,
Fxp, Doomlord, Androxyde for there answer to my annoying questions about serial console :),
Achotjan, Feravolt, Scritch and all other who helped me a lot since I started this project.

The link to my repo : Tof37-Github

For now this kernel is just made to be used as a base.

What is working :
  • Kernel is built with almost all ES209RA drivers (I think ar6000 are missing, nothing else)
  • it boots
  • Display is (finally) working
  • Rom (tested with an old CM9) is booting. Also booting on CM10.1 and 4.2.2 aosp (strange display problem with aosp)
  • ADB is working (dmesg and logcat can be done)
  • Battery chatging is working, data and led color are ok too
  • Got rom display. (Cm10.1 maybe others) ... for a stock configuration it's not so bad ...


Bug list :
  • QDSP6 has to be disabled, smsm modem is reseting
  • Recovery key access mismatch (it works only when it wants ...)
  • Added needed files and lines in defconfig to build ar6000.ko.
    Have to port some codes in msm_sdcc.c for plat_disable_wlan_slot and plat_enable_wlan_slot ... seems to be needed to turn wifi on and off ...
  • Added lines in defconfig to enable bluetooth ... still not working
  • maybe more I don't even know ...

To do:
  • Fix known bugs
  • Had necessary changes in ramdisk
 
Last edited:

Tof37

Senior Member
Oct 6, 2009
624
2,468
Tours
Log for qdsp crash

Here is the log I got with qdsp6 enabled :
PHP:
[   12.548407] ------------[ cut here ]------------                                                                       
[   12.548533] WARNING: at drivers/gpio/gpiolib.c:101 gpio_ensure_requested+0x4c/0xfc()                                   
[   12.548695] autorequest GPIO-149                                                                                       
[   12.548766] Modules linked in:                                                                                         
[   12.548864] [<c0047010>] (unwind_backtrace+0x0/0xf0) from [<c0089af4>] (warn_slowpath_common+0x4c/0x64)                
[   12.549893] [<c0089af4>] (warn_slowpath_common+0x4c/0x64) from [<c0089b8c>] (warn_slowpath_fmt+0x2c/0x3c)              
[   12.559441] [<c0089b8c>] (warn_slowpath_fmt+0x2c/0x3c) from [<c0270708>] (gpio_ensure_requested+0x4c/0xfc)             
[   12.569079] [<c0270708>] (gpio_ensure_requested+0x4c/0xfc) from [<c0270928>] (gpio_direction_output+0x74/0x158)        
[   12.579157] [<c0270928>] (gpio_direction_output+0x74/0x158) from [<c00728ec>] (analog_init+0x18/0x28)                  
[   12.588348] [<c00728ec>] (analog_init+0x18/0x28) from [<c0070e40>] (q6audio_init+0x214/0x2e4)                          
[   12.596855] [<c0070e40>] (q6audio_init+0x214/0x2e4) from [<c0072490>] (q6audio_open_pcm+0x20/0x200)                    
[   12.605883] [<c0072490>] (q6audio_open_pcm+0x20/0x200) from [<c0072b8c>] (pcm_ioctl+0x1d0/0x3f4)                       
[   12.614658] [<c0072b8c>] (pcm_ioctl+0x1d0/0x3f4) from [<c01153a8>] (do_vfs_ioctl+0x508/0x584)                          
[   12.623158] [<c01153a8>] (do_vfs_ioctl+0x508/0x584) from [<c0115458>] (sys_ioctl+0x34/0x54)       MODEM/AMSS has CRASHED                      
[   12.631502] [<c0115458>] (sys_ioctl+0x34/0x54) from [<c0042480>] (ret_fast_syscall+0x0/0x30)                           
[   12.639903] ---[ end trace 47a718f49542dde2 ]---                                                                       
[   12.690778]                                                                                                            
[   12.690789] SMSM: Modem SMSM state changed to SMSM_RESET.                                                              
[   12.691454] Notify: start reset                                                                                        
[   14.336724]                                                                                     
[   14.337405] smem: CRASH LOG                                                                                            
[   14.337410] 'ERR crash log report.  Version 2.

In analog_audio.c adding (like KTG .32 kernel)
PHP:
gpio_request(GPIO_HEADSET_AMP, NULL)

solved the warning ...but not the crash still having :

PHP:
[   17.020205] [pcm_out.c:pcm_open] open
<6>[   17.020852] [q6audio.c:q6audio_init] codecs
<6>[   17.021094] [q6audio.c:q6audio_init] attach ADSP
<6>[   17.128602] [dal.c:dal_attach] status = 0, name = 'DAL_AQ_AUD' dal_client d5c24000
<6>[   17.128795] [q6audio.c:q6audio_init] INIT
<6>[   17.130021] [q6audio.c:q6audio_init] OPEN control
<6>[   17.540540] [q6audio.c:q6audio_init] attach ACDB
<6>[   17.644275] [dal.c:dal_attach] status = 0, name = 'DAL_AM_AUD' dal_client d5eb5800
<6>[   17.644442] [q6audio.c:q6audio_init] attach ADIE
<6>[   17.644841] [dal.c:dal_attach] status = 0, name = 'DAL_AM_AUD' dal_client d5eb5400
<3>[   17.665947] 
<3>[   17.665958] SMSM: Modem SMSM state changed to SMSM_RESET.
<3>[   17.666632] Notify: start reset

nothing more for now
 
  • Like
Reactions: doodownunda

FeraVolt

Senior Member
Dec 30, 2011
2,110
16,574
www.facebook.com
Try this in config:
Code:
CONFIG_MSM_QDSP6=y
CONFIG_MSM_AUDIO_QDSP6=y //this one wants - SND_SOC_MSM_QDSP6_INTF
# CONFIG_MSM_QDSP6_APR is not set
# CONFIG_QSD_AUDIO is not set

p.s. can you send me your 51-android.rules file.. I messed up usb permissions and adb says:
error: insufficient permissions for device

I have this:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", MODE="0777"


EDIT>nvm.. fixed changing device permissions to 666
 
Last edited:

Tof37

Senior Member
Oct 6, 2009
624
2,468
Tours
Try this in config:
Code:
CONFIG_MSM_QDSP6=y
CONFIG_MSM_AUDIO_QDSP6=y //this one wants - SND_SOC_MSM_QDSP6_INTF
# CONFIG_MSM_QDSP6_APR is not set
# CONFIG_QSD_AUDIO is not set

p.s. can you send me your 51-android.rules file.. I messed up usb permissions and adb says:
error: insufficient permissions for device

I have this:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", MODE="0777"


EDIT>nvm.. fixed changing device permissions to 666

Will try ;)

BTW think where something is messing ... qdsp6 needs "ac" (qs6audio.c line 971)

PHP:
pr_info("[%s:%s] attach ADIE\n", __MM_FILE__, __func__);
adie = dal_attach(ADIE_DAL_DEVICE, ADIE_DAL_PORT, 0, 0, 0);
if (!adie) {
pr_err("[%s:%s] cannot attach to adie\n",
__MM_FILE__, __func__);
res = -ENODEV;
goto done;
}
if (analog_ops->init)
analog_ops->init();

res = 0;
ac_control = ac;

but ... if you look at the log on google drive (log 3.0.8 ... boot sur cm9, sans qdsp6)
you'll see that
PHP:
sysfs: cannot create duplicate filename '/class/power_supply/ac'

I think the problem is there ... if I revert this commit
it doesn't work either cause mx17040 doesn't probe as it should...

let's sleep now :)
 
Last edited:

FeraVolt

Senior Member
Dec 30, 2011
2,110
16,574
www.facebook.com
How about this <mach/msm_qdsp6_audio.h>:
Code:
/* arch/arm/mach-msm/include/mach/msm_qdsp6_audio.h
 *
 * Copyright (C) 2009 Google, Inc.
 * Author: Brian Swetland <swetland@google.com>
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef _MACH_MSM_QDSP6_Q6AUDIO_
#define _MACH_MSM_QDSP6_Q6AUDIO_

#define AUDIO_FLAG_READ		0
#define AUDIO_FLAG_WRITE	1
#define AUDIO_FLAG_INCALL_MIXED	2

#include <linux/wait.h>

struct audio_buffer {
	dma_addr_t phys;
	void *data;
	uint32_t size;
	uint32_t used;	/* 1 = CPU is waiting for DSP to consume this buf */
	uint32_t actual_size; /* actual number of bytes read by DSP */
};

struct audio_client {
	struct audio_buffer buf[2];
	int cpu_buf;	/* next buffer the CPU will touch */
	int dsp_buf;	/* next buffer the DSP will touch */
	int running;
	int session;

	wait_queue_head_t wait;
	struct dal_client *client;

	int cb_status;
	uint32_t flags;
};

/* Obtain a 16bit signed, interleaved audio channel of the specified
 * rate (Hz) and channels (1 or 2), with two buffers of bufsz bytes.
 */
struct audio_client *q6audio_open_pcm(uint32_t bufsz, uint32_t rate,
				      uint32_t channels, uint32_t flags,
				      uint32_t acdb_id);

struct audio_client *q6voice_open(uint32_t flags);

struct audio_client *q6audio_open_mp3(uint32_t bufsz, uint32_t rate,
				      uint32_t channels, uint32_t acdb_id);

struct audio_client *q6audio_open_dtmf(uint32_t rate, uint32_t channels,
							uint32_t acdb_id);
int q6audio_play_dtmf(struct audio_client *ac, uint16_t dtmf_hi,
			uint16_t dtmf_low, uint16_t duration, uint16_t rx_gain);

struct audio_client *q6audio_open_aac(uint32_t bufsz, uint32_t samplerate,
					uint32_t channels, uint32_t bitrate,
					uint32_t stream_format, uint32_t flags,
					uint32_t acdb_id);

struct audio_client *q6audio_open_qcp(uint32_t bufsz, uint32_t min_rate,
					uint32_t max_rate, uint32_t flags,
					uint32_t format, uint32_t acdb_id);

struct audio_client *q6audio_open_amrnb(uint32_t bufsz, uint32_t enc_mode,
					uint32_t dtx_enable, uint32_t flags,
					uint32_t acdb_id);

int q6audio_close(struct audio_client *ac);
int q6voice_close(struct audio_client *ac);
int q6audio_mp3_close(struct audio_client *ac);

int q6audio_read(struct audio_client *ac, struct audio_buffer *ab);
int q6audio_write(struct audio_client *ac, struct audio_buffer *ab);
int q6audio_async(struct audio_client *ac);

int q6audio_do_routing(uint32_t route, uint32_t acdb_id);
int q6audio_set_tx_mute(int mute);
int q6audio_reinit_acdb(char* filename);
int q6audio_update_acdb(uint32_t id_src, uint32_t id_dst);
int q6audio_set_rx_volume(int level);
int q6audio_set_stream_volume(struct audio_client *ac, int vol);
int q6audio_set_stream_eq_pcm(struct audio_client *ac, void *eq_config);

struct q6audio_analog_ops {
	void (*init)(void);
	void (*speaker_enable)(int en);
	void (*headset_enable)(int en);
	void (*receiver_enable)(int en);
	void (*bt_sco_enable)(int en);
	void (*int_mic_enable)(int en);
	void (*ext_mic_enable)(int en);
};

void q6audio_register_analog_ops(struct q6audio_analog_ops *ops);

/* signal non-recoverable DSP error so we can log and/or panic */
void q6audio_dsp_not_responding(void);

#endif
 

Tof37

Senior Member
Oct 6, 2009
624
2,468
Tours
Disable MSM_ION.. I just ported it and got similar thing.. No bootanimation.. All openGles2 apps crashes.. UI glitches.. I'd like to look at how Achotjan ported it.. Maybe its foolish me..

Spent nearly the whole day with qddp problem... still crashing...
About display I think memory allocation is not perfect... disabling triple buffer ended with no display but booting rom...
will see that tonight...

Sent from my XT890 using xda app-developers app
 

Tof37

Senior Member
Oct 6, 2009
624
2,468
Tours
Very nice :). Can we have latest dmesg & logcat? And.. maybe you can somehow capture how it's flickering.. To undrstand where the dog lies.. :good:

Here is a link to the ftf file with 3.0.8 kernel booting on cm9 rom : here (to flash at your own risk on unlocked bootloader only )

Got a log and dmesg in google drive (check your gmail :) )

EDIT : don't mind about ro.config.disable_hw_accel=false in build.prop ... just something I thought it should be useful ... but no ;)


This is awesome work Tof!

RE: this flickering issue.. I recall Scritch had similar issues when first porting CM10..

http://xdaforums.com/showpost.php?p=34720912&postcount=32

Not sure what Rom you're loading, but perhaps this needs implementing or reversing if you've already included it?

Also: http://xdaforums.com/showpost.php?p=34770510&postcount=37 for slightly more detail.

I have to check that ... I remember this patch ... but took the same msm diplay drivers ... will look :) Thanks
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 38
    As some may know, I'm getting headaches since months (I'm not a professional dev ...) to port 3.0.8 kernel on x10.

    I'm opening a new thread to talk about progress on 3.x kernel ported to the
    ES209RA..

    I'd like to share the work I've made since last year and involve as much people as it's possible.

    I'll try to keep this thread updated with "what is working" and a "to do" or "to fix list" ...

    You've been warned : this a development thread, and until kernel is "officialy" relased, flashing stuff or adding changes in kernel and flashing it on your device without knowing what you do may damage your phone.

    Important notice :

    This is not a thread to teach "how to port" or else ...

    However when the time will come, testers will be needed, posts will be make to have report etc ...

    Don't ask for ETA ...

    Thanks a lot for understanding
    36
    I got rid of working on the kernel.... :)

    Sent from my XT890 using xda app-developers app
    30
    Some more fresh news ...

    Ion version is booting with kgsl working.

    The price to pay is less memory available ...

    With cm10.1 it seems as "slow" as the no ion version ...


    I think I'll make a new thread for "official" release ... if ever someone is interrested in using and upgrading this kernel...
    29
    So ... read somewhere that kgsl needs fitting codes in drivers/video/msm ...

    I used video drivers from 3.0.8 kernel instead of the ones I put from .32 ... timestamp error diseapeared ;), no more error in rom logcat due to kgsl either.

    Have to solve few bugs to use those new drivers with our device and hopefully everything would be nice ;)

    BTW solved a small problem in board with smipool memory allocation needed by ion heaps (commited in ion-test branch)

    Will clean my repo when I'll get rid of display bugs.

    In the same time progressed a little bit in 3.4 build but nothing really new for now.
    29

    For now it's "only" with pmem ... seems the changes don't work with the ion kernel.

    The kernel doesn't boot on sde 4.1.2, got problem with the ion version of the kernel and problems with ramdisk.

    I uploaded a cm10.1 ftf with the 3.0.8 kernel ... don't wait to have a super fast rom ... the kernel is stock, no oveclock or else ... don't report me the things that are not working :) no wifi, no bluetooth, no camera .... it's just a early early alpha and the bug list still long ...


    Here is the link : Cm10.1-3-0-8kernel-alpha1