[Xperia Z5 Android Development] CTCaer:
This was working before?

For me (Z5C), I had to change gain paths for it to work (original had wrong gain paths and also only left channel gain):

--- /media/sf_z5c_dev/android_kernel_sony_msm8994_kitakami_r2-Sun-Kernel_Eclipse_32.2.A.0.305_corona_III.1_9_12_6_ctl_X/sound/soc/codecs/sound_control_3_gpl.c	2016-12-14 20:29:06.000000000
+++ /home/ctcaer/Desktop/z5c/kernel-z5c-ctcaer/sound/soc/codecs/sound_control_3_gpl.c	2016-12-10 21:58:26.000000000
@@ -30,13 +29,13 @@
#define SOUND_CONTROL_MINOR_VERSION	6

extern struct snd_soc_codec *fauxsound_codec_ptr;
extern int wcd9xxx_hw_revision;

static int snd_ctrl_locked = 1;
-static int snd_rec_ctrl_locked = 0;
+static int snd_rec_ctrl_locked = 1;

unsigned int tomtom_read(struct snd_soc_codec *codec, unsigned int reg);
int tomtom_write(struct snd_soc_codec *codec, unsigned int reg,
unsigned int value);

#define REG_SZ	25
@@ -205,13 +204,13 @@

static ssize_t cam_mic_gain_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%u",
tomtom_read(fauxsound_codec_ptr,
-	TOMTOM_A_CDC_TX7_VOL_CTL_GAIN));
+	[B][COLOR="Red"]TOMTOM_A_CDC_TX9_VOL_CTL_GAIN[/COLOR][/B]));

}

static ssize_t cam_mic_gain_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{
@@ -251,30 +250,30 @@

static ssize_t speaker_gain_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%u %u",
tomtom_read(fauxsound_codec_ptr,
-	TOMTOM_A_CDC_RX5_VOL_CTL_B2_CTL),
+	[B][COLOR="red"]TOMTOM_A_CDC_RX7_VOL_CTL_B2_CTL[/COLOR][/B]),
tomtom_read(fauxsound_codec_ptr,
-	TOMTOM_A_CDC_RX5_VOL_CTL_B2_CTL));
+	[B][COLOR="red"]TOMTOM_A_CDC_RX8_VOL_CTL_B2_CTL[/COLOR][/B]));

}

static ssize_t speaker_gain_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{
unsigned int lval, rval, chksum;

sscanf(buf, "%u %u %u", &lval, &rval, &chksum);

if (calc_checksum(lval, rval, chksum)) {
tomtom_write(fauxsound_codec_ptr,
-	TOMTOM_A_CDC_RX5_VOL_CTL_B2_CTL, lval);
+	[B][COLOR="red"]TOMTOM_A_CDC_RX7_VOL_CTL_B2_CT[/COLOR]L[/B], lval);
tomtom_write(fauxsound_codec_ptr,
-	TOMTOM_A_CDC_RX5_VOL_CTL_B2_CTL, rval);
+	[B][COLOR="red"]TOMTOM_A_CDC_RX8_VOL_CTL_B2_CTL[/COLOR][/B], rval);
}
return count;
}

static ssize_t headphone_gain_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
@@ -299,48 +298,12 @@
tomtom_write(fauxsound_codec_ptr,
TOMTOM_A_CDC_RX2_VOL_CTL_B2_CTL, rval);
}
return count;
}

-static ssize_t headphone_pa_gain_show(struct kobject *kobj,
-	struct kobj_attribute *attr, char *buf)
-{
-	return sprintf(buf, "%u %u",
-	tomtom_read(fauxsound_codec_ptr, TOMTOM_A_RX_HPH_L_GAIN),
-	tomtom_read(fauxsound_codec_ptr, TOMTOM_A_RX_HPH_R_GAIN));
-}

-static ssize_t headphone_pa_gain_store(struct kobject *kobj,
-	struct kobj_attribute *attr, const char *buf, size_t count)
-{
-	unsigned int lval, rval, chksum;
-	unsigned int gain, status;
-	unsigned int out;

-	sscanf(buf, "%u %u %u", &lval, &rval, &chksum);

-	if (calc_checksum(lval, rval, chksum)) {
-	gain = tomtom_read(fauxsound_codec_ptr, TOMTOM_A_RX_HPH_L_GAIN);
-	out = (gain & 0xf0) | lval;
-	tomtom_write(fauxsound_codec_ptr, TOMTOM_A_RX_HPH_L_GAIN, out);

-	status = tomtom_read(fauxsound_codec_ptr, TOMTOM_A_RX_HPH_L_STATUS);
-	out = (status & 0x0f) | (lval << 4);
-	tomtom_write(fauxsound_codec_ptr, TOMTOM_A_RX_HPH_L_STATUS, out);

-	gain = tomtom_read(fauxsound_codec_ptr, TOMTOM_A_RX_HPH_R_GAIN);
-	out = (gain & 0xf0) | rval;
-	tomtom_write(fauxsound_codec_ptr, TOMTOM_A_RX_HPH_R_GAIN, out);

-	status = tomtom_read(fauxsound_codec_ptr, TOMTOM_A_RX_HPH_R_STATUS);
-	out = (status & 0x0f) | (rval << 4);
-	tomtom_write(fauxsound_codec_ptr, TOMTOM_A_RX_HPH_R_STATUS, out);
-	}
-	return count;
-}

static unsigned int selected_reg = 0xdeadbeef;

static ssize_t sound_reg_select_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{
@@ -461,17 +424,11 @@
static struct kobj_attribute headphone_gain_attribute =
__ATTR(gpl_headphone_gain,
0666,
headphone_gain_show,
headphone_gain_store);

-static struct kobj_attribute headphone_pa_gain_attribute =
-	__ATTR(gpl_headphone_pa_gain,
-	0666,
-	headphone_pa_gain_show,
-	headphone_pa_gain_store);

static struct kobj_attribute sound_control_locked_attribute =
__ATTR(gpl_sound_control_locked,
0666,
sound_control_locked_show,
sound_control_locked_store);
@@ -495,13 +452,12 @@
static struct attribute *sound_control_attrs[] =
{
&cam_mic_gain_attribute.attr,
&mic_gain_attribute.attr,
&speaker_gain_attribute.attr,
&headphone_gain_attribute.attr,
-	&headphone_pa_gain_attribute.attr,
&sound_control_locked_attribute.attr,
&sound_control_rec_locked_attribute.attr,
&sound_reg_sel_attribute.attr,
&sound_reg_read_attribute.attr,
&sound_reg_write_attribute.attr,
&sound_hw_revision_attribute.attr,

I don't know if it broke more for you with 12.7, but if you can send me the /system/etc/mixer_paths.xml from Z5 and they are different, I can make you a patch for helping (without removal of headphone amp gain), with ifdef else on compile time that chooses the correct paths for each device.

FAST EDIT: It was easy to find Z5 mixer path. It has the same gain paths. Just try my patch and see if it works (you can keep the headphone gain if you want).

You are welcome.

Actually what helped me with the stuck on bootanimation or starting apps (not a bootloop) was a special ramdisk I made.

I added

persist.logd.logpersistd=logcatd

ro.logd.kernel=true

inside default.prop.

This produces logs on boot time and you can get them from /data/misc/logd directory.

After combining them in inverse order, I found out all external modules (compiled against module_layout) that failed to load (a_module_filename: disagrees about version of symbol module_layout)

On big changes you can also compare the Module.symvers with a working one you kept. If you see extreme changes and especially the symbol version of module_layout then all rom/stock external modules are broken.

Lastly, about UKSM, I left it after many hours of trying to not change core modules so much, because I realized that KSM (has same result as UKSM but it's slower) only saves around 20-30MB. Which for our devices is nothing. In the other hand, the battery drain is neglectable and is good having it if you don't reboot often.

You can have better info on ksm pages with this patch:

--- /media/sf_z5c_dev/android_kernel_sony_msm8994_kitakami_r2-Sun-Kernel_Eclipse_32.2.A.0.305_corona_III.1_9_12_6_ctl_X/mm/ksm.c	2016-12-14 20:29:06.000000000
+++ /home/ctcaer/Desktop/z5c/kernel-z5c-ctcaer/mm/ksm.c	2016-11-12 10:24:07.000000000
@@ -2435,20 +2435,20 @@
KSM_ATTR(merge_across_nodes);
#endif

static ssize_t pages_shared_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
-	return sprintf(buf, "%lu\n", ksm_pages_shared);
+	return sprintf(buf, "Shared memory: %luKB (%lu Pages)\n", ksm_pages_shared*4, ksm_pages_shared);
}
KSM_ATTR_RO(pages_shared);

static ssize_t pages_sharing_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
-	return sprintf(buf, "%lu\n", ksm_pages_sharing);
+	return sprintf(buf, "Saved memory: %luKB (%lu Pages)\n", ksm_pages_sharing*4, ksm_pages_sharing);
}
KSM_ATTR_RO(pages_sharing);

static ssize_t pages_unshared_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{

Some more food for thoughts:

ZRAM does the job for me (Z5C 2GB), even though it produces some lag under some conditions.

It's faster without ZRAM, but after camera usage with 23MP, I don't want Chrome to reload pages again.

Also without ZRAM, I saw strange big loads from kswapd and stuttering when having big data traffic (mobile or wifi). Didn't check but I think that some changes I did for a big datagrams fragmentation cpu load and memory leak bug fixed it. Also the new drivers from 5.11 vendor sources for BT and wifi are also way better and stable.

I would recommend disabling it by default in ramdisk for only Z5 though. 3GB is a LOT of RAM for Android (lowmemorykiller does all the work). You will see a big difference.

Check it and also check if you have this strange kswapd load (not the one from swapping normal cache pages though).