From 31e70cf182d5b834acf92ba7eabd780ce4bcc55d Mon Sep 17 00:00:00 2001 From: Benoit Goby Date: Wed, 4 Jan 2012 18:33:54 -0800 Subject: tuna: new kernel prebuilt e00d9bd mmc: Set suspend/resume bus operations if CONFIG_PM_RUNTIME is used d795e3c OMAP4: Clock: Put USB_DPLL in stop low power mode explicitly 1493e09 OMAP4: Clock: Correct OTG clock to use otg_60m_gfclk. Change-Id: Ib2e5b7bf14f8f297d6953ee9b79c0141ff7075dc --- kernel | Bin 3914160 -> 3914276 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index a043b24..37a3c45 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From 726553e5ce617056aff3796ef320b76db245ee67 Mon Sep 17 00:00:00 2001 From: Ken Sumrall Date: Wed, 4 Jan 2012 20:58:40 -0800 Subject: Tool to fix the fs_size in the crypto footer The GPT of HSPA Prime devices is incorrect when it comes from the factory. Flashing a new bootloader fixes the GPT, but if the user had already encrypted the device, the old size of the partition is recorded in the crypto footer. If the size if not updated, the device will not be able to boot after the OTA, so add a new command to fix the fs_size field in the crypto footer for Prime devices. Change-Id: Ied4b592973d3d5c36c478b7fb32d59ac9e9611b0 --- recovery/Android.mk | 2 +- recovery/recovery_updater.c | 65 +++++++++++++++++++++++++++++++++++++++++++++ releasetools.py | 8 ++++++ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/recovery/Android.mk b/recovery/Android.mk index 585db84..0034dc8 100644 --- a/recovery/Android.mk +++ b/recovery/Android.mk @@ -17,7 +17,7 @@ include $(CLEAR_VARS) # Edify extension functions for doing bootloader updates on Tuna devices. LOCAL_MODULE_TAGS := optional -LOCAL_C_INCLUDES += bootable/recovery +LOCAL_C_INCLUDES += bootable/recovery system/vold LOCAL_SRC_FILES := recovery_updater.c bootloader.c # should match TARGET_RECOVERY_UPDATER_LIBS set in BoardConfig.mk diff --git a/recovery/recovery_updater.c b/recovery/recovery_updater.c index 02963f5..0c49f9a 100644 --- a/recovery/recovery_updater.c +++ b/recovery/recovery_updater.c @@ -19,6 +19,11 @@ #include #include #include +#include +#include +#include +#include +#include #include "edify/expr.h" #include "bootloader.h" @@ -55,8 +60,68 @@ Value* WriteBootloaderFn(const char* name, State* state, int argc, Expr* argv[]) return StringValue(strdup(result == 0 ? "t" : "")); } +/* + * The size of the userdata partition for HSPA Galaxy Nexus devices is incorrect + * in the partition as it comes from the factory. Updating the bootloader fixes + * the partition table, and makes the size of the userdata partition 1 sector + * smaller. However, if the user had encrypted their device with the original + * incorrect size of the partition table, the crypto footer has saved that + * size, and tries to map that much data when decrypting. However, with the + * new partition table, that size is too big to be mapped, and the kernel + * throws an error, and the user can't decrypt and boot the device after the + * OTA is installed. Oops! + * + * The fix here is to recognize a crypto footer that has the wrong size, and + * update it to the new correct size. This program should be run as part of + * the recovery script for HSPA Galaxy Nexus devices. + */ + +#define BAD_SIZE 0x01b14fdfULL +#define GOOD_SIZE 0x01b14fdeULL + +#define HSPA_PRIME_KEY_PARTITION "/dev/block/platform/omap/omap_hsmmc.0/by-name/metadata" + +Value* FsSizeFixFn(const char* name, State* state, int argc, Expr* argv[]) +{ + struct crypt_mnt_ftr ftr; + int fd; + + if (argc != 0) { + return ErrorAbort(state, "%s() expects 0 args, got %d", name, argc); + } + + if ((fd = open(HSPA_PRIME_KEY_PARTITION, O_RDWR)) == -1) { + return ErrorAbort(state, "%s() Cannot open %s\n", name, HSPA_PRIME_KEY_PARTITION); + } + + if (read(fd, &ftr, sizeof(ftr)) != sizeof(ftr)) { + close(fd); + return ErrorAbort(state, "%s() Cannot read crypto footer %s\n", name, HSPA_PRIME_KEY_PARTITION); + } + + if ((ftr.magic == CRYPT_MNT_MAGIC) && (ftr.fs_size == BAD_SIZE)) { + ftr.fs_size = GOOD_SIZE; + if (lseek(fd, 0, SEEK_SET) == 0) { + if (write(fd, &ftr, sizeof(ftr)) == sizeof(ftr)) { + fsync(fd); /* Make sure it gets to the disk */ + fprintf(stderr, "Footer updated\n"); + close(fd); + return StringValue(strdup("t")); + } + } + close(fd); + return ErrorAbort(state, "%s() Cannot seek or write crypto footer %s\n", name, HSPA_PRIME_KEY_PARTITION); + } + + /* Nothing to do */ + fprintf(stderr, "Footer doesn't need updating\n"); + close(fd); + return StringValue(strdup("t")); +} + void Register_librecovery_updater_tuna() { fprintf(stderr, "installing samsung updater extensions\n"); RegisterFunction("samsung.write_bootloader", WriteBootloaderFn); + RegisterFunction("samsung.fs_size_fix", FsSizeFixFn); } diff --git a/releasetools.py b/releasetools.py index 23581d6..056c7dc 100644 --- a/releasetools.py +++ b/releasetools.py @@ -32,6 +32,8 @@ def FullOTA_InstallEnd(info): else: WriteRadio(info, radio_img) + FsSizeFix(info) + def IncrementalOTA_VerifyEnd(info): try: target_radio_img = info.target_zip.read("RADIO/radio.img") @@ -74,6 +76,12 @@ def IncrementalOTA_InstallEnd(info): except KeyError: print "no radio.img in target target_files; skipping install" + FsSizeFix(info) + +def FsSizeFix(info): + info.script.Print("Fixing fs_size in crypto footer...") + info.script.AppendExtra('''assert(samsung.fs_size_fix());''') + def WriteBootloader(info, bootloader_img): common.ZipWriteStr(info.output_zip, "bootloader.img", bootloader_img) fstab = info.info_dict["fstab"] -- cgit v1.1 From 0a467ce5fd7cc084d246243bffc3318da4b3bbaa Mon Sep 17 00:00:00 2001 From: Dima Zavin Date: Fri, 6 Jan 2012 10:44:51 -0800 Subject: tuna: update touch firmware to vers 0x65/0x45 0x65 is for rev3.2 touch panels, and 0x45 is for rev3.1 To resolve multi-touch issue, 1. Added debounce algorithm on switching mode at noisy environment. 2. Added hysteresis on rejecting events at noisy state, to prevent frequent drop of events and to improve usability. Change-Id: I62791274bb5e59ef2cf3300977da205c9914aaee --- mms144_ts_rev31.fw | Bin 31760 -> 31760 bytes mms144_ts_rev32.fw | Bin 31760 -> 31760 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/mms144_ts_rev31.fw b/mms144_ts_rev31.fw index 367709f..a5c7c78 100644 Binary files a/mms144_ts_rev31.fw and b/mms144_ts_rev31.fw differ diff --git a/mms144_ts_rev32.fw b/mms144_ts_rev32.fw index a4b5310..80acfd1 100644 Binary files a/mms144_ts_rev32.fw and b/mms144_ts_rev32.fw differ -- cgit v1.1 From f125adea76885148583d26f82c2991d9eedbff25 Mon Sep 17 00:00:00 2001 From: Jeff Davidson Date: Thu, 12 Jan 2012 19:09:54 -0800 Subject: Move toro spr files to torospr. This makes toro recovery visible to torospr. Change-Id: I1de6e0d14c8e1642d1a1105612db72eddbb70508 --- recovery/Android.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recovery/Android.mk b/recovery/Android.mk index 0034dc8..2fc8313 100644 --- a/recovery/Android.mk +++ b/recovery/Android.mk @@ -1,4 +1,4 @@ -ifneq (,$(findstring $(TARGET_DEVICE),tuna toro maguro)) +ifneq (,$(findstring $(TARGET_DEVICE),tuna toro torospr maguro)) LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -- cgit v1.1 From d007e23939cbb8484eea96234a4f356208842c63 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Fri, 13 Jan 2012 11:37:53 -0800 Subject: tuna: prebuilt kernel -- DO NOT MERGE 8ebb62b usb: musb: Add a BUG_ON if trying to suspend musb in B_IDLE state 098e128 omap: dispc: force L3_2 CD to NOSLEEP when dispc module is active 0e4741f net: wireless: bcmdhd: Fix proper scan command even if request is NULL 8e56dbd net: wireless: bcmdhd: Fix scan crash in ibss mode 5e53345 power: max17040: do a sanity check in the fuel alert handler Change-Id: Iaa5ec8b3cc4f8b57e9797a9f56ec2cd25192b832 Signed-off-by: Todd Poynor --- kernel | Bin 3914276 -> 3914488 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index 37a3c45..9561eb1 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From 7d8d74514dbf908018307852a50e80f671beeee6 Mon Sep 17 00:00:00 2001 From: "sujin119.kim" Date: Tue, 3 Jan 2012 17:05:02 +0900 Subject: Toro: USB: Add RNDIS+DM+MODEM Add RNDIS+DM+MODEM for CP logging 1. Add USB composite setting for RNDIS+DM+MODEM 2. Change the permission for ttyGS0 Change-Id: Ifec615a33b7bb2c3e64098525f968a9026ff14c4 Signed-off-by: sujin119.kim --- init.tuna.usb.rc | 11 ++++++++++- ueventd.tuna.rc | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/init.tuna.usb.rc b/init.tuna.usb.rc index 9d3d336..20bf090 100755 --- a/init.tuna.usb.rc +++ b/init.tuna.usb.rc @@ -64,7 +64,16 @@ on property:sys.usb.config=ptp,adb on property:sys.usb.config=rndis,dm write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6862 + write /sys/class/android_usb/android0/idProduct 6864 + write /sys/class/android_usb/android0/functions $sys.usb.config + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state $sys.usb.config + +on property:sys.usb.config=rndis,acm,dm + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/idVendor 04e8 + write /sys/class/android_usb/android0/idProduct 6864 write /sys/class/android_usb/android0/functions $sys.usb.config + write /sys/class/android_usb/android0/f_acm/instances 1 write /sys/class/android_usb/android0/enable 1 setprop sys.usb.state $sys.usb.config diff --git a/ueventd.tuna.rc b/ueventd.tuna.rc index 3fa9fe2..d1a8b47 100644 --- a/ueventd.tuna.rc +++ b/ueventd.tuna.rc @@ -38,7 +38,8 @@ /dev/cdma_rmnet5 0660 radio radio /dev/cdma_rmnet6 0660 radio radio /dev/lte_rmnet4 0660 radio radio -/dev/ttyGS1 0660 radio radio +/dev/ttyGS0 0660 radio radio +/dev/ttyGS1 0660 radio radio /dev/block/mmcblk0p4 0660 radio radio /dev/modem_br 0660 radio radio /dev/cdma_ramdump0 0660 radio radio -- cgit v1.1 From 7aeae7ab7dc78d476f8a7535f77c71a7c60ebbab Mon Sep 17 00:00:00 2001 From: Dima Zavin Date: Wed, 18 Jan 2012 12:42:24 -0800 Subject: tuna: add headset jack key layout files Change-Id: Ic47caa03b2927f405784b25cbd550739f2d2daa9 Signed-off-by: Dima Zavin --- device.mk | 4 +++- sec_jack.kcm | 15 +++++++++++++++ sec_jack.kl | 17 +++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 sec_jack.kcm create mode 100644 sec_jack.kl diff --git a/device.mk b/device.mk index e5da58c..962d7b5 100644 --- a/device.mk +++ b/device.mk @@ -99,7 +99,9 @@ PRODUCT_PACKAGES += \ # Key maps PRODUCT_COPY_FILES += \ device/samsung/tuna/tuna-gpio-keypad.kl:system/usr/keylayout/tuna-gpio-keypad.kl \ - device/samsung/tuna/tuna-gpio-keypad.kcm:system/usr/keychars/tuna-gpio-keypad.kcm + device/samsung/tuna/tuna-gpio-keypad.kcm:system/usr/keychars/tuna-gpio-keypad.kcm \ + device/samsung/tuna/sec_jack.kl:system/usr/keylayout/sec_jack.kl \ + device/samsung/tuna/sec_jack.kcm:system/usr/keychars/sec_jack.kcm # Input device calibration files PRODUCT_COPY_FILES += \ diff --git a/sec_jack.kcm b/sec_jack.kcm new file mode 100644 index 0000000..7ee6e5a --- /dev/null +++ b/sec_jack.kcm @@ -0,0 +1,15 @@ +# Copyright (C) 2010 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +type SPECIAL_FUNCTION diff --git a/sec_jack.kl b/sec_jack.kl new file mode 100644 index 0000000..1a421d6 --- /dev/null +++ b/sec_jack.kl @@ -0,0 +1,17 @@ +# Copyright (C) 2010 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +key 163 MEDIA_NEXT WAKE +key 165 MEDIA_PREVIOUS WAKE +key 226 HEADSETHOOK WAKE -- cgit v1.1 From e014fd40115848b826588efcb6175fd0809f8c45 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Wed, 18 Jan 2012 13:53:50 -0800 Subject: tuna: prebuilt kernel -- DO NOT MERGE 3ace783 Revert "mmc: Set suspend/resume bus operations if CONFIG_PM_RUNTIME is used" 8716f56 omap4: tuna: Drop soft lockup detector timeout to 10 secs 159f17c OMAP3+: PM: VC: vcbypass needs to wait for valid to clear 655fddd OMAP4: PM: TPS6236x: speed up voltage rampup rate 37d2aca OMAP4: PM: TPS6236x: ensure rampdown occurs fast on shutdown 058ca02 OMAP4460: TWL6030: Setup VDD_core OFF voltage to retention voltage 3d57d92 OMAP4: PM: work around for CPU1 onlining from OFF/OSWR state on older PPA 0108824 OMAP4: TWL: ensure PREQ1 results in all active VCOREs to be down 7180250 OMAP4: HWMOD: UART1: disable smart-idle. fdb7588 misc: fsa9480: don't enable FSA IRQ when VBUS IRQ is enabled ce033dd ASoC: DSP: Split runtime startup/shutdown updates a567f64 ASoC: dsp - BE disconnection after pending flag is clear 60f7431 misc: modem_if: link_mipi: Reset mipi phy when receive wrong packet fc3549e usb: musb: Change BUG_ON to BUG to catch the issue as soon as it happens Change-Id: Ic27e8bf5f08b6ac308a9aa26711da16d5e0cb6d6 Signed-off-by: Todd Poynor --- kernel | Bin 3914488 -> 3915204 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index 9561eb1..b60e8e0 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From bac9a4787055cce78df950755f48740597a0c574 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Wed, 18 Jan 2012 18:50:17 -0800 Subject: tuna: prebuilt kernel -- DO NOT MERGE c553b5b OMAP4: Clock: Force a DPLL clkdm/pwrdm ON before a relock Change-Id: I9631025af9090d374e641b7a4aebf36daac4e6a9 Signed-off-by: Todd Poynor --- kernel | Bin 3915204 -> 3915204 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index b60e8e0..306118e 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From 159a810daa779bfb93b50cd1d899c54a6453248d Mon Sep 17 00:00:00 2001 From: Dima Zavin Date: Thu, 19 Jan 2012 11:11:10 -0800 Subject: tuna: prebuilt kernel -- DO NOT MERGE 6224f02 Revert "proc: enable writing to /proc/pid/mem" Change-Id: Ia7000d5ca40ed4417e44d3470e0929763ce775a7 Signed-off-by: Dima Zavin --- kernel | Bin 3915204 -> 3914700 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index 306118e..4ed4721 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From 5348e6bc0a6e338f8747547bcd79adcc6aaa481d Mon Sep 17 00:00:00 2001 From: Simon Wilson Date: Tue, 24 Jan 2012 10:40:06 -0800 Subject: tuna: prebuilt kernel -- DO NOT MERGE e99370d ASoC: Tuna: Reduce S/PDIF power down time b2e44ef TWL6030: Add extra debugging around rtc and waking 159f916 Revert "usb: musb: Add a BUG_ON if trying to suspend musb in B_IDLE state" 34b0c02 usb: musb: Disable SESSREQ and VBUSERROR interrupts 3e367ee ARM: omap: sched_clock: Don't let sched_clock tick during suspend Change-Id: I5081b4c29e5f139a00f205540213a72e7c6afd2c --- kernel | Bin 3914700 -> 3915416 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index 4ed4721..ef95cbd 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From d48e3623c7b43da6be5c4980cee192264e8cb979 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Tue, 24 Jan 2012 16:15:49 -0800 Subject: tuna: prebuilt kernel -- DO NOT MERGE f2a12a5 Revert "Revert "mmc: Set suspend/resume bus operations if CONFIG_PM_RUNTIME is used"" a752602 serial: omap: disable serial port irq during suspend Change-Id: I9445220aee7f20ba2c5a773c45d413a73747c79c Signed-off-by: Todd Poynor --- kernel | Bin 3915416 -> 3915488 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index ef95cbd..36a71ac 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From 26f9aacc85305b20559e348109a3be3350704985 Mon Sep 17 00:00:00 2001 From: Ed Heyl Date: Tue, 24 Jan 2012 16:36:36 -0800 Subject: require bootloader LA03 Change-Id: I781dc9265a6e520d053abf663acfa9dc128f932e Conflicts: board-info.txt --- board-info.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board-info.txt b/board-info.txt index 73dad7f..e906c5e 100644 --- a/board-info.txt +++ b/board-info.txt @@ -1,3 +1,3 @@ require board=tuna -require version-bootloader=PRIMEKL01 +require version-bootloader=PRIMELA03 -- cgit v1.1 From 40c820fb04be8932baacd74c2003bd3ac3a41c14 Mon Sep 17 00:00:00 2001 From: Simon Wilson Date: Wed, 25 Jan 2012 10:29:55 -0800 Subject: audio: support multiple output PCMs Change-Id: I5179699b22224473bd158e90f864e4e73895b5dc --- audio/audio_hw.c | 165 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 117 insertions(+), 48 deletions(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 0ba9a41..bbd849a 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -227,6 +227,8 @@ struct pcm_config pcm_config_mm = { .period_size = LONG_PERIOD_SIZE, .period_count = PLAYBACK_LONG_PERIOD_COUNT, .format = PCM_FORMAT_S16_LE, + .start_threshold = SHORT_PERIOD_SIZE * 2, + .avail_min = LONG_PERIOD_SIZE, }; struct pcm_config pcm_config_mm_ul = { @@ -501,12 +503,19 @@ struct tuna_audio_device { struct ril_handle ril; }; +enum pcm_type { + PCM_NORMAL = 0, + PCM_SPDIF, + PCM_HDMI, + PCM_TOTAL, +}; + struct tuna_stream_out { struct audio_stream_out stream; pthread_mutex_t lock; /* see note below on mutex acquisition order */ - struct pcm_config config; - struct pcm *pcm; + struct pcm_config config[PCM_TOTAL]; + struct pcm *pcm[PCM_TOTAL]; struct resampler_itfe *resampler; char *buffer; int standby; @@ -1096,8 +1105,9 @@ static void select_input_device(struct tuna_audio_device *adev) static int start_output_stream(struct tuna_stream_out *out) { struct tuna_audio_device *adev = out->dev; - unsigned int card = CARD_TUNA_DEFAULT; - unsigned int port = PORT_MM; + unsigned int flags = PCM_OUT | PCM_MMAP | PCM_NOIRQ; + int i; + bool success = true; adev->active_output = out; @@ -1105,39 +1115,55 @@ static int start_output_stream(struct tuna_stream_out *out) /* FIXME: only works if only one output can be active at a time */ select_output_device(adev); } - /* S/PDIF takes priority over HDMI audio. In the case of multiple - * devices, this will cause use of S/PDIF or HDMI only */ - out->config.rate = MM_FULL_POWER_SAMPLING_RATE; - if (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) - port = PORT_SPDIF; - else if(adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) { - card = CARD_OMAP4_HDMI; - port = PORT_HDMI; - out->config.rate = MM_LOW_POWER_SAMPLING_RATE; - } + /* default to low power: will be corrected in out_write if necessary before first write to * tinyalsa. */ out->write_threshold = PLAYBACK_LONG_PERIOD_COUNT * LONG_PERIOD_SIZE; - out->config.start_threshold = SHORT_PERIOD_SIZE * 2; - out->config.avail_min = LONG_PERIOD_SIZE; out->low_power = 1; - out->pcm = pcm_open(card, port, PCM_OUT | PCM_MMAP | PCM_NOIRQ, &out->config); + if (adev->devices & (AUDIO_DEVICE_OUT_ALL & + ~(AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET | AUDIO_DEVICE_OUT_AUX_DIGITAL))) { + /* Something not a dock in use */ + out->config[PCM_NORMAL] = pcm_config_mm; + out->config[PCM_NORMAL].rate = MM_FULL_POWER_SAMPLING_RATE; + out->pcm[PCM_NORMAL] = pcm_open(CARD_TUNA_DEFAULT, PORT_MM, flags, &out->config[PCM_NORMAL]); + } - if (!pcm_is_ready(out->pcm)) { - LOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm)); - pcm_close(out->pcm); - adev->active_output = NULL; - return -ENOMEM; + if (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) { + /* SPDIF output in use */ + out->config[PCM_SPDIF] = pcm_config_mm; + out->config[PCM_SPDIF].rate = MM_FULL_POWER_SAMPLING_RATE; + out->pcm[PCM_SPDIF] = pcm_open(CARD_TUNA_DEFAULT, PORT_SPDIF, flags, &out->config[PCM_SPDIF]); + } + + if(adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) { + /* HDMI output in use */ + out->config[PCM_HDMI] = pcm_config_mm; + out->config[PCM_HDMI].rate = MM_LOW_POWER_SAMPLING_RATE; + out->pcm[PCM_HDMI] = pcm_open(CARD_OMAP4_HDMI, PORT_HDMI, flags, &out->config[PCM_HDMI]); } - if (adev->echo_reference != NULL) - out->echo_reference = adev->echo_reference; + /* Close any PCMs that could not be opened properly and return an error */ + for (i = 0; i < PCM_TOTAL; i++) { + if (out->pcm[i] && !pcm_is_ready(out->pcm[i])) { + LOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm[i])); + pcm_close(out->pcm[i]); + out->pcm[i] = NULL; + success = false; + } + } - out->resampler->reset(out->resampler); + if (success) { + if (adev->echo_reference != NULL) + out->echo_reference = adev->echo_reference; + out->resampler->reset(out->resampler); - return 0; + return 0; + } + + adev->active_output = NULL; + return -ENOMEM; } static int check_input_parameters(uint32_t sample_rate, int format, int channel_count) @@ -1244,8 +1270,13 @@ static int get_playback_delay(struct tuna_stream_out *out, { size_t kernel_frames; int status; + int primary_pcm = 0; - status = pcm_get_htimestamp(out->pcm, &kernel_frames, &buffer->time_stamp); + /* Find the first active PCM to act as primary */ + while ((primary_pcm < PCM_TOTAL) && !out->pcm[primary_pcm]) + primary_pcm++; + + status = pcm_get_htimestamp(out->pcm[primary_pcm], &kernel_frames, &buffer->time_stamp); if (status < 0) { buffer->time_stamp.tv_sec = 0; buffer->time_stamp.tv_nsec = 0; @@ -1255,7 +1286,7 @@ static int get_playback_delay(struct tuna_stream_out *out, return status; } - kernel_frames = pcm_get_buffer_size(out->pcm) - kernel_frames; + kernel_frames = pcm_get_buffer_size(out->pcm[primary_pcm]) - kernel_frames; /* adjust render time stamp with delay added by current driver buffer. * Add the duration of current frame as we want the render time of the last @@ -1282,8 +1313,9 @@ static size_t out_get_buffer_size(const struct audio_stream *stream) /* take resampling into account and return the closest majoring multiple of 16 frames, as audioflinger expects audio buffers to - be a multiple of 16 frames */ - size_t size = (SHORT_PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) / out->config.rate; + be a multiple of 16 frames. Note: we use the default rate here + from pcm_config_mm.rate. */ + size_t size = (SHORT_PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) / pcm_config_mm.rate; size = ((size + 15) / 16) * 16; return size * audio_stream_frame_size((struct audio_stream *)stream); } @@ -1307,10 +1339,15 @@ static int out_set_format(struct audio_stream *stream, int format) static int do_output_standby(struct tuna_stream_out *out) { struct tuna_audio_device *adev = out->dev; + int i; if (!out->standby) { - pcm_close(out->pcm); - out->pcm = NULL; + for (i = 0; i < PCM_TOTAL; i++) { + if (out->pcm[i]) { + pcm_close(out->pcm[i]); + out->pcm[i] = NULL; + } + } adev->active_output = 0; @@ -1376,11 +1413,14 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION) { force_input_standby = true; } - /* force standby if moving to/from HDMI */ + /* force standby if moving to/from HDMI/SPDIF or if the output + * device changes when in HDMI/SPDIF mode */ if (((val & AUDIO_DEVICE_OUT_AUX_DIGITAL) ^ (adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)) || ((val & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) ^ - (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET))) + (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) || + (adev->devices & (AUDIO_DEVICE_OUT_AUX_DIGITAL | + AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET))) do_output_standby(out); } adev->devices &= ~AUDIO_DEVICE_OUT_ALL; @@ -1410,7 +1450,8 @@ static uint32_t out_get_latency(const struct audio_stream_out *stream) { struct tuna_stream_out *out = (struct tuna_stream_out *)stream; - return (SHORT_PERIOD_SIZE * PLAYBACK_SHORT_PERIOD_COUNT * 1000) / out->config.rate; + /* Note: we use the default rate here from pcm_config_mm.rate */ + return (SHORT_PERIOD_SIZE * PLAYBACK_SHORT_PERIOD_COUNT * 1000) / pcm_config_mm.rate; } static int out_set_volume(struct audio_stream_out *stream, float left, @@ -1433,6 +1474,11 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, bool low_power; int kernel_frames; void *buf; + /* If we're in out_write, we will find at least one pcm active */ + int primary_pcm = -1; + int i; + bool use_resampler = false; + int period_size = 0; /* acquiring hw device mutex systematically is useful if a low priority thread is waiting * on the output stream mutex - e.g. executing select_mode() while holding the hw device @@ -1458,27 +1504,39 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, if (low_power != out->low_power) { if (low_power) { out->write_threshold = LONG_PERIOD_SIZE * PLAYBACK_LONG_PERIOD_COUNT; - out->config.avail_min = LONG_PERIOD_SIZE; + period_size = LONG_PERIOD_SIZE; } else { out->write_threshold = SHORT_PERIOD_SIZE * PLAYBACK_SHORT_PERIOD_COUNT; - out->config.avail_min = SHORT_PERIOD_SIZE; + period_size = SHORT_PERIOD_SIZE; + } - pcm_set_avail_min(out->pcm, out->config.avail_min); out->low_power = low_power; } + for (i = 0; i < PCM_TOTAL; i++) { + if (out->pcm[i]) { + /* Make the first active PCM act as primary */ + if (primary_pcm < 0) + primary_pcm = i; + + if (period_size) + pcm_set_avail_min(out->pcm[i], period_size); + + if (out->config[i].rate != DEFAULT_OUT_SAMPLING_RATE) + use_resampler = true; + } + } + /* only use resampler if required */ - if (out->config.rate != DEFAULT_OUT_SAMPLING_RATE) { + if (use_resampler) out->resampler->resample_from_input(out->resampler, (int16_t *)buffer, &in_frames, (int16_t *)out->buffer, &out_frames); - buf = out->buffer; - } else { + else out_frames = in_frames; - buf = (void *)buffer; - } + if (out->echo_reference != NULL) { struct echo_reference_buffer b; b.raw = (void *)buffer; @@ -1492,9 +1550,9 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, do { struct timespec time_stamp; - if (pcm_get_htimestamp(out->pcm, (unsigned int *)&kernel_frames, &time_stamp) < 0) + if (pcm_get_htimestamp(out->pcm[primary_pcm], (unsigned int *)&kernel_frames, &time_stamp) < 0) break; - kernel_frames = pcm_get_buffer_size(out->pcm) - kernel_frames; + kernel_frames = pcm_get_buffer_size(out->pcm[primary_pcm]) - kernel_frames; if (kernel_frames > out->write_threshold) { unsigned long time = (unsigned long) @@ -1506,7 +1564,20 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, } } while (kernel_frames > out->write_threshold); - ret = pcm_mmap_write(out->pcm, (void *)buf, out_frames * frame_size); + /* Write to all active PCMs */ + for (i = 0; i < PCM_TOTAL; i++) { + if (out->pcm[i]) { + if (out->config[i].rate == DEFAULT_OUT_SAMPLING_RATE) { + /* PCM uses native sample rate */ + ret = pcm_mmap_write(out->pcm[i], (void *)buffer, bytes); + } else { + /* PCM needs resampler */ + ret = pcm_mmap_write(out->pcm[i], (void *)out->buffer, out_frames * frame_size); + } + if (ret) + break; + } + } exit: pthread_mutex_unlock(&out->lock); @@ -2204,8 +2275,6 @@ static int adev_open_output_stream(struct audio_hw_device *dev, out->stream.write = out_write; out->stream.get_render_position = out_get_render_position; - out->config = pcm_config_mm; - out->dev = ladev; out->standby = 1; -- cgit v1.1 From 400a17182e7c28ef2ff7697889689bdbcb87af33 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Thu, 26 Jan 2012 13:52:30 -0800 Subject: tuna: prebuilt kernel -- DO NOT MERGE ec29a34 mmc: omap_hsmmc: Prevent calling mmc_host_lazy_disable() on suspend path Change-Id: I85bb2002f52012d8f11ab4da9c63a8aab158c146 Signed-off-by: Dmitry Shmidt --- kernel | Bin 3915488 -> 3915420 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index 36a71ac..1987e73 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From c55fbc67a5c8f02a4663f57844f5bd5bfd3b61bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= Date: Fri, 27 Jan 2012 17:55:19 -0800 Subject: Update kernel prebuilt -- DO NOT MERGE 21f62a0 ARM: omap4: tuna: Add panel configration for SM2A2 Line support. Change-Id: I7af3b742506e14c17218c42e04a0082673814f67 --- kernel | Bin 3915420 -> 3916860 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index 1987e73..540fa3a 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From 26c2ea0a893cf9e2e662ff0ea1aca972cb16f085 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Wed, 15 Feb 2012 20:04:00 -0800 Subject: tuna: prebuilt kernel -- DO NOT MERGE 35315c0 DEBUG: rtc: twl: add register dump if RTC did not fire on time Change-Id: I677478e4c82886f680bd154108b63d8abbe30663 Signed-off-by: Todd Poynor --- kernel | Bin 3916860 -> 3917552 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index 540fa3a..61945a2 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From bed53516982d3c5688d68aae29ea53680ad8fe81 Mon Sep 17 00:00:00 2001 From: Benoit Goby Date: Fri, 17 Feb 2012 14:55:34 -0800 Subject: tuna: update kernel prebuilt -- DO NOT MERGE 7b3a99d OMAP4+: HSI: fix for spurious CAWAKE event while processing RX/TX b18735e OMAP4: HSI: Add HW errata platform data 30624ea OMAP4: HSI: Fix for back to back CAWAKE interrupts Change-Id: I400f3217f3c941e543b79663347e0a2039b3f4c6 --- kernel | Bin 3917552 -> 3917928 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index 61945a2..296b22a 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From c63ec3168b6167e76385c9c5d9a96468e85f07c6 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Wed, 22 Feb 2012 16:12:20 -0800 Subject: tuna: prebuilt kernel -- DO NOT MERGE 5825a20 MFD: TWL 6030: clear IRQ status register only once Change-Id: I7738ba94c5441ef98446de1e2c5f052759f853a4 Signed-off-by: Todd Poynor --- kernel | Bin 3917928 -> 3917884 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index 296b22a..3318c36 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From 26f6ef77f90c2cb72026c01cefe8efcfae1a7567 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Mon, 27 Feb 2012 17:02:04 -0800 Subject: tuna: prebuilt kernel -- DO NOT MERGE f84aced net: wireless: bcmdhd: Add SET_RANDOM_MAC_SOFTAP option Change-Id: I8f9939300ba3fcb1f75aa2ac61482d3d1a3752a3 Signed-off-by: Dmitry Shmidt --- kernel | Bin 3917884 -> 3918024 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index 3318c36..ba734c3 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From a71cfea22241a46bf0c33c7357f2fa062ea6a74c Mon Sep 17 00:00:00 2001 From: Ken Sumrall Date: Thu, 1 Mar 2012 18:02:42 -0800 Subject: tuna: prebuilt kernel -- DO NOT MERGE cea631b [MMC] Patch the firmware of certain Samsung emmc parts to fix a bug e638e26 arch: arm: modems: remove pull_up setting for phone active input pin Change-Id: I8fcd868fef56c98884cc19d9999f84f62e968a95 Signed-off-by: Ken Sumrall --- kernel | Bin 3918024 -> 3918988 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index ba734c3..66e0ec2 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From babe3f69982a0993bb5c219fe34c29c9903f8ccb Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Fri, 9 Mar 2012 19:16:21 -0800 Subject: tuna: prebuilt kernel -- DO NOT MERGE 130ff2d ARM: 7296/1: proc-v7.S: remove HARVARD_CACHE preprocessor guards 650239f OMAP4: trim_quirks: Fix wrong implementation of erratum i684 Change-Id: Ic1742aef62a5d983e0a55b64c2e3eac05061e4ef Signed-off-by: Todd Poynor --- kernel | Bin 3918988 -> 3918824 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index 66e0ec2..9192b9a 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From 3b50cc6d1c148210fa7b39b1ba48f54f8c5e558d Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Tue, 13 Mar 2012 15:59:42 -0700 Subject: tuna: kernel prebuilt -- DO NOT MERGE 034fec9 net: wireless: bcmdhd: Fix mac setting from platform hook Change-Id: I45c7b3a193e652b278334b775b1d10684e1eea01 Signed-off-by: Dmitry Shmidt --- kernel | Bin 3918824 -> 3918788 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index 9192b9a..c10bd3f 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From 6c745c6f54e65d0bdc8d2fd23b4f3ca14b659de9 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Tue, 13 Mar 2012 15:59:42 -0700 Subject: tuna: kernel prebuilt -- DO NOT MERGE 034fec9 net: wireless: bcmdhd: Fix mac setting from platform hook Change-Id: I45c7b3a193e652b278334b775b1d10684e1eea01 Signed-off-by: Dmitry Shmidt --- kernel | Bin 3918824 -> 3918788 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel b/kernel index 9192b9a..c10bd3f 100644 Binary files a/kernel and b/kernel differ -- cgit v1.1 From 78a7609d251802da4db864dbbee37967be84514f Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Fri, 16 Mar 2012 18:59:28 -0700 Subject: audio: fix audio drop when speaker is selected When changing audio path to speaker while playback is active, several hundred ms of audio are dropped. This is mostly noticeable when a ringtone starts playing. This change is a workaround forcing the output in standby when speaker is selected. The root cause must still be indentified and fixed. Change-Id: Idef8dc1cdbf2da499a414d0b60244f91ef66e73b --- audio/audio_hw.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index bbd849a..850a1b1 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -1415,12 +1415,24 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) } /* force standby if moving to/from HDMI/SPDIF or if the output * device changes when in HDMI/SPDIF mode */ + + /* FIXME workaround for audio being dropped when switching path without forcing standby + * (several hundred ms of audio can be lost: e.g beginning of a ringtone. We must understand + * the root cause in audio HAL, driver or ABE. if (((val & AUDIO_DEVICE_OUT_AUX_DIGITAL) ^ (adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)) || ((val & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) ^ (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) || (adev->devices & (AUDIO_DEVICE_OUT_AUX_DIGITAL | AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET))) + */ + if (((val & AUDIO_DEVICE_OUT_AUX_DIGITAL) ^ + (adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)) || + ((val & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) ^ + (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) || + (adev->devices & (AUDIO_DEVICE_OUT_AUX_DIGITAL | + AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) || + (val == AUDIO_DEVICE_OUT_SPEAKER)) do_output_standby(out); } adev->devices &= ~AUDIO_DEVICE_OUT_ALL; -- cgit v1.1