diff options
author | Madan Ankapura <mankapur@sta.samsung.com> | 2012-09-08 19:18:13 -0700 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2012-09-11 17:58:36 -0700 |
commit | 98773c8cfeef655fa63d95134c94b5a79d18eb35 (patch) | |
tree | 061dac4fe4dbaf2da3d0047d0b033ca3b72bdcd7 | |
parent | 5ff5ce799946b4105569bcda594514caddf1827b (diff) | |
download | toroplus-98773c8cfeef655fa63d95134c94b5a79d18eb35.tar.gz |
second set towards aosp toroplus
Bug: 6940653
Change-Id: I2750ea8cf70e73320710892b1feaef2bbef91a7b
Signed-off-by: Madan Ankapura <mankapur@sta.samsung.com>
-rw-r--r-- | BoardConfig.mk | 9 | ||||
-rw-r--r-- | bcmdhd.cal | 117 | ||||
-rw-r--r-- | device.mk | 9 | ||||
-rw-r--r-- | recovery/Android.mk | 18 | ||||
-rw-r--r-- | recovery/recovery_updater.c | 53 | ||||
-rw-r--r-- | recovery/update_cdma_modem.c | 109 | ||||
-rw-r--r-- | recovery/update_cdma_modem.h | 22 | ||||
-rw-r--r-- | releasetools.py | 144 | ||||
-rw-r--r-- | system.prop | 2 |
9 files changed, 479 insertions, 4 deletions
diff --git a/BoardConfig.mk b/BoardConfig.mk index 2eff643..d100af7 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -22,3 +22,12 @@ TARGET_BOARD_INFO_FILE ?= device/samsung/toroplus/board-info.txt # Use the part that is common between all tunas include device/samsung/tuna/BoardConfig.mk +BOARD_USERDATAIMAGE_PARTITION_SIZE := 30691799040 + +# Use/add toroplus-specific variants +TARGET_RECOVERY_UPDATER_LIBS += librecovery_updater_toroplus +TARGET_RELEASETOOLS_EXTENSIONS := device/samsung/toroplus + +# on toroplus boards we need to apply a special adaptive filter +# on the compass output because of noise generated by the pmic. +BOARD_INVENSENSE_APPLY_COMPASS_NOISE_FILTER := true diff --git a/bcmdhd.cal b/bcmdhd.cal new file mode 100644 index 0000000..2ff3f99 --- /dev/null +++ b/bcmdhd.cal @@ -0,0 +1,117 @@ +# BCM4330 B2 FCBGA SS Proxima VZW Rev1.1 12/08/2011 Calibrated verified with 125.84.4 // +manfid=0x2d0 +prodid=0x0532 +vendid=0x14e4 +devid=0x4360 +boardtype=0x0532 +boardrev=0x40 +#boardflags: has ext 5GHz lna, use a SP3T sw share with BT, 2.4GHz iLNA and iPA +boardflags=0x10081201 +nocrc=1 +xtalfreq=37400 +boardnum=21 +macaddr=00:90:4c:c5:12:38 +ag0=0 +# aa2g=1 means by default only one antenna, MAIN RF. +aa2g=1 +aa5g=1 +ccode=US +regrev=69 +# 2.4GHz PA parameters are preliminary +pa0b0=0x1491 +pa0b1=0xFD9D +pa0b2=0xFF64 +cckPwrOffset=4 +# rssi params for 2.4GHz +rssismf2g=0xa +rssismc2g=0x3 +rssisav2g=0x7 +# rssi params for 5GHz +rssismf5g=0xa +rssismc5g=0x7 +rssisav5g=0x1 +#PA parameters for lower a-band: CH.36 (5180M) - CH.64 (5320M) +pa1lob0=0x14B9 +pa1lob1=0xFD79 +pa1lob2=0xFF59 +#PA parameters for midband: CH.100 (5500M) - CH.140 (5700M) +pa1b0=0x14C5 +pa1b1=0xFD72 +pa1b2=0xFF54 +#PA parameters for high band: CH.149 (5745M) - CH.165 (5825M) +pa1hib0=0x148E +pa1hib1=0xFD6B +pa1hib2=0xFF49 +sromrev=3 +# 2.4G Tx Power: 17/14/13 +maxp2ga0=74 +ofdm2gpo=0x66666666 +mcs2gpo0=0x8888 +mcs2gpo1=0x8888 +# 5G Tx Power: 14/13 +maxp5ga0=74 +maxp5gla0=74 +maxp5gha0=74 +ofdm5gpo=0x66666666 +ofdm5glpo=0x66666666 +ofdm5ghpo=0x66666666 +mcs5gpo0=0x8888 +mcs5gpo1=0x8888 +mcs5glpo0=0x8888 +mcs5glpo1=0x8888 +mcs5ghpo0=0x8888 +mcs5ghpo1=0x8888 +#il0macaddr=00:90:4c:c5:12:38 +#wl0id=0x431b +# support A band ext PA +extpagain5g=2 + +#rfreg033=0x1f +rfreg033=0x19 +rfreg033_cck=0x1f +cckdigfilttype=22 + +txalpfbyp2g=1 +#txalpfbyp2g_cck=0 +bphyscale=17 + +pacalidx2g=65 +dacrate2g=160 + +# 2G Murata FEM +swctrlmap_2g=0x04040404,0x0a0a0202,0x0c0c0404,0x010a02,0x1ff +# 5G Murata MDFE2PFA-023 +swctrlmap_5g=0x90909090,0x60602020,0x50502020,0x010a02,0X2f8 + +#triso5g=9 +tridx5g=0 +noise_cal_po_2g=-3 +noise_cal_ref_2g=52 +pa0itssit=0x20 +# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG +# muxenab=0x2 +# tssitime=1 + +txiqlopapu5g=1 +txiqlopag5g=0x10 +iqlocalidx5g=32 + +sd_gpout=0 +# sd_oobonly=1 +muxenab=0x10 + +btc_params8=10000 +btc_params80=0 +btc_params6=10 + +# 5G +/-160MHz Spur +txgaintbl5g=1 + +# 5G 1.7G Spur +loidacmode5g=1 + +# 2.4G ACR +rxgaintbl100=1 + +# 5GHz Starting Tx Gain Index +initxidx5g=96 @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This file includes all definitions that apply only to maguro devices +# This file includes all definitions that apply only to toroplus device # # Anything that is generic to all tuna products should go in the tuna directory # @@ -20,9 +20,12 @@ DEVICE_PACKAGE_OVERLAYS := device/samsung/toroplus/overlay -# These are the hardware-specific features -PRODUCT_COPY_FILES := \ +PRODUCT_COPY_FILES += \ + device/samsung/toroplus/bcmdhd.cal:system/etc/wifi/bcmdhd.cal \ frameworks/native/data/etc/android.hardware.telephony.cdma.xml:system/etc/permissions/android.hardware.telephony.cdma.xml +PRODUCT_PROPERTY_OVERRIDES += \ + ro.config.vc_call_vol_steps=7 + $(call inherit-product, device/samsung/tuna/device.mk) $(call inherit-product-if-exists, vendor/samsung/toroplus/device-vendor.mk) diff --git a/recovery/Android.mk b/recovery/Android.mk new file mode 100644 index 0000000..8cbf2b3 --- /dev/null +++ b/recovery/Android.mk @@ -0,0 +1,18 @@ +LOCAL_PATH := $(call my-dir) + +ifneq (,$(findstring $(TARGET_DEVICE),toroplus)) + +# Edify extension functions for doing modem (radio) updates on toroplus devices. + +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional +LOCAL_C_INCLUDES += bootable/recovery +LOCAL_SRC_FILES := recovery_updater.c update_cdma_modem.c + +# should match TARGET_RECOVERY_UPDATER_LIBS set in BoardConfig.mk +LOCAL_MODULE := librecovery_updater_toroplus + +include $(BUILD_STATIC_LIBRARY) + +endif diff --git a/recovery/recovery_updater.c b/recovery/recovery_updater.c new file mode 100644 index 0000000..73499ff --- /dev/null +++ b/recovery/recovery_updater.c @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011 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. + */ + +#include <stdio.h> +#include <errno.h> +#include <stdarg.h> +#include <stdlib.h> +#include <string.h> + +#include "edify/expr.h" +#include "update_cdma_modem.h" + +Value* UpdateCdmaModemFn(const char* name, State* state, int argc, Expr* argv[]) +{ + int result = -1; + Value* img; + + if (argc != 1) { + return ErrorAbort(state, "%s() expects 1 arg, got %d", name, argc); + } + + if (ReadValueArgs(state, argv, 1, &img) < 0) { + return NULL; + } + + if(img->type != VAL_BLOB) { + FreeValue(img); + return ErrorAbort(state, "%s(): argument types are incorrect", name); + } + + result = update_cdma_modem(img->data, img->size); + FreeValue(img); + return StringValue(strdup(result == 0 ? "t" : "")); +} + +void Register_librecovery_updater_toroplus() { + fprintf(stderr, "installing samsung updater extensions for toroplus\n"); + + RegisterFunction("samsung.update_cdma_modem", UpdateCdmaModemFn); +} diff --git a/recovery/update_cdma_modem.c b/recovery/update_cdma_modem.c new file mode 100644 index 0000000..b309f89 --- /dev/null +++ b/recovery/update_cdma_modem.c @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2011 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. + */ + +#include <errno.h> +#include <fcntl.h> +#include <linux/usbdevice_fs.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/ioctl.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <time.h> +#include <unistd.h> +#include <termios.h> + +#include "update_cdma_modem.h" + + +#define MODEM_DEVNODE "/dev/cdma_boot0" + +#define IOCTL_MODEM_ON _IO('o', 0x19) +#define IOCTL_MODEM_OFF _IO('o', 0x20) +#define IOCTL_MODEM_RESET _IO('o', 0x21) +#define IOCTL_MODEM_BOOT_ON _IO('o', 0x22) +#define IOCTL_MODEM_BOOT_OFF _IO('o', 0x23) +#define IOCTL_MODEM_START _IO('o', 0x24) +#define IOCTL_MODEM_SEND _IO('o', 0x25) +#define IOCTL_MODEM_RECV _IO('o', 0x26) +#define IOCTL_MODEM_STATUS _IO('o', 0x27) +#define IOCTL_MODEM_GOTA_START _IO('o', 0x28) +#define IOCTL_MODEM_FW_UPDATE _IO('o', 0x29) + +/* buffer type for modem image */ +struct dpram_firmware { + char *firmware; + int size; + int is_delta; +}; + +static int modem_download_ioctl_fw(int sel, struct dpram_firmware* fw) +{ + int fd = open(MODEM_DEVNODE, O_RDWR); + if (fd < 0) { + fprintf(stderr, "Unable to open modem device (%s)\n", strerror(errno)); + return -1; + } + int ret = (fw != NULL) ? ioctl(fd, sel, fw) : ioctl(fd, sel); + close(fd); + + return ret; +} + +static int modem_download_ioctl(int sel) +{ + return modem_download_ioctl_fw(sel, NULL); +} + +int update_cdma_modem(const char* image_data, size_t image_size) { + int ret; + struct dpram_firmware fw; + + ret = modem_download_ioctl(IOCTL_MODEM_GOTA_START); + if (ret < 0) { + fprintf(stderr, "IOCTL_MODEM_GOTA_START failed: (%d)\n", ret); + return -1; + } + + ret = modem_download_ioctl(IOCTL_MODEM_BOOT_ON); + if (ret < 0) { + fprintf(stderr, "IOCTL_MODEM_BOOT_ON failed: (%d)\n", ret); + return -1; + } + + fw.firmware = image_data; + fw.size = image_size; + fw.is_delta = 0; + + ret = modem_download_ioctl_fw(IOCTL_MODEM_FW_UPDATE, &fw); + if (ret < 0) { + fprintf(stderr, "IOCTL_MODEM_FW_UPDATE failed: (%d)\n", ret); + return -1; + } + + ret = modem_download_ioctl(IOCTL_MODEM_BOOT_OFF); + if (ret < 0) { + fprintf(stderr, "IOCTL_MODEM_BOOT_OFF failed: (%d)\n", ret); + return -1; + } + + printf("Firmware update was successful\n"); + + return 0; +} diff --git a/recovery/update_cdma_modem.h b/recovery/update_cdma_modem.h new file mode 100644 index 0000000..9923402 --- /dev/null +++ b/recovery/update_cdma_modem.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2011 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. + */ + +#ifndef __UPDATE_CDMA_MODEM_H__ +#define __UPDATE_CDMA_MODEM_H__ + +int update_cdma_modem(const char* image_data, size_t image_size); + +#endif diff --git a/releasetools.py b/releasetools.py new file mode 100644 index 0000000..fbe9d22 --- /dev/null +++ b/releasetools.py @@ -0,0 +1,144 @@ +# Copyright (C) 2009 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. + +"""Emit commands needed for Toro during OTA installation +(installing the bootloader and radio images).""" + +import common + +def FullOTA_InstallEnd(info): + try: + bootloader_img = info.input_zip.read("RADIO/bootloader.img") + except KeyError: + print "no bootloader.img in target_files; skipping install" + else: + WriteBootloader(info, bootloader_img) + + # LTE Radio + try: + radio_img = info.input_zip.read("RADIO/radio.img") + except KeyError: + print "no radio.img in target_files; skipping install" + else: + WriteRadioLte(info, radio_img) + + # CDMA Radio + try: + radio_cdma_img = info.input_zip.read("RADIO/radio-cdma.img") + except KeyError: + print "no radio.img in target_files; skipping install" + else: + WriteRadioCdma(info, radio_cdma_img) + +def IncrementalOTA_VerifyEnd(info): + try: + target_radio_img = info.target_zip.read("RADIO/radio.img") + source_radio_img = info.source_zip.read("RADIO/radio.img") + except KeyError: + # No source or target radio. Nothing to verify + pass + else: + if source_radio_img != target_radio_img: + info.script.CacheFreeSpaceCheck(len(source_radio_img)) + radio_type, radio_device = common.GetTypeAndDevice("/radio", info.info_dict) + info.script.PatchCheck("%s:%s:%d:%s:%d:%s" % ( + radio_type, radio_device, + len(source_radio_img), common.sha1(source_radio_img).hexdigest(), + len(target_radio_img), common.sha1(target_radio_img).hexdigest())) + +def IncrementalOTA_InstallEnd(info): + try: + target_bootloader_img = info.target_zip.read("RADIO/bootloader.img") + try: + source_bootloader_img = info.source_zip.read("RADIO/bootloader.img") + except KeyError: + source_bootloader_img = None + + if source_bootloader_img == target_bootloader_img: + print "bootloader unchanged; skipping" + else: + WriteBootloader(info, target_bootloader_img) + except KeyError: + print "no bootloader.img in target target_files; skipping install" + + # LTE Radio + try: + target_radio_img = info.target_zip.read("RADIO/radio.img") + try: + source_radio_img = info.source_zip.read("RADIO/radio.img") + except KeyError: + source_radio_img = None + + WriteRadioLte(info, target_radio_img, source_radio_img) + except KeyError: + print "no radio.img in target target_files; skipping install" + + # CDMA Radio + try: + target_radio_cdma_img = info.target_zip.read("RADIO/radio-cdma.img") + try: + source_radio_cdma_img = info.source_zip.read("RADIO/radio-cdma.img") + except KeyError: + source_radio_cdma_img = None + + if source_radio_cdma_img == target_radio_cdma_img: + print "radio-cdma unchanged; skipping" + else: + WriteRadioCdma(info, target_radio_cdma_img) + except KeyError: + print "no radio-cdma.img in target target_files; skipping install" + +def WriteBootloader(info, bootloader_img): + common.ZipWriteStr(info.output_zip, "bootloader.img", bootloader_img) + fstab = info.info_dict["fstab"] + + info.script.Print("Writing bootloader...") + info.script.AppendExtra('''assert(samsung.write_bootloader( + package_extract_file("bootloader.img"), "%s", "%s"));''' % \ + (fstab["/xloader"].device, fstab["/sbl"].device)) + +def WriteRadioLte(info, target_radio_img, source_radio_img=None): + tf = common.File("radio.img", target_radio_img) + if source_radio_img is None: + tf.AddToZip(info.output_zip) + info.script.Print("Writing LTE radio...") + info.script.WriteRawImage("/radio", tf.name) + else: + sf = common.File("radio.img", source_radio_img); + if tf.sha1 == sf.sha1: + print "LTE radio image unchanged; skipping" + else: + diff = common.Difference(tf, sf) + common.ComputeDifferences([diff]) + _, _, d = diff.GetPatch() + if d is None or len(d) > tf.size * common.OPTIONS.patch_threshold: + # computing difference failed, or difference is nearly as + # big as the target: simply send the target. + tf.AddToZip(info.output_zip) + info.script.Print("Writing LTE radio...") + info.script.WriteRawImage("/radio", tf.name) + else: + common.ZipWriteStr(info.output_zip, "radio.img.p", d) + info.script.Print("Patching LTE radio...") + radio_type, radio_device = common.GetTypeAndDevice("/radio", info.info_dict) + info.script.ApplyPatch( + "%s:%s:%d:%s:%d:%s" % (radio_type, radio_device, + sf.size, sf.sha1, tf.size, tf.sha1), + "-", tf.size, tf.sha1, sf.sha1, "radio.img.p") + +def WriteRadioCdma(info, radio_cdma_img): + common.ZipWriteStr(info.output_zip, "radio-cdma.img", radio_cdma_img) + info.script.Print("Writing CDMA radio...") + info.script.AppendExtra('''assert(samsung.update_cdma_modem( + package_extract_file("radio-cdma.img")));''') diff --git a/system.prop b/system.prop index 128bb1b..e88a8ea 100644 --- a/system.prop +++ b/system.prop @@ -1,5 +1,5 @@ # -# system.prop for maguro +# system.prop for toroplus # rild.libpath=/vendor/lib/libsec-ril.so |