Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

e510: Enable CM support

  • Loading branch information...
commit 3a6c55c123eb5356c83120ddb39970760e20d6d5 1 parent 8c1f6ad
@rmcc rmcc authored
Showing with 8,644 additions and 0 deletions.
  1. +3 −0  Android.mk
  2. +44 −0 BoardConfig.mk
  3. +193 −0 NOTICE.cm
  4. +9 −0 configs/AudioFilter.csv
  5. +2 −0  configs/egl.cfg
  6. +204 −0 configs/media_profiles.xml
  7. +65 −0 configs/nvram.txt
  8. +5 −0 configs/wpa_supplicant.conf
  9. +38 −0 e510.mk
  10. +114 −0 extract-files.sh
  11. +246 −0 include/camera/CameraHardwareInterface.h
  12. +56 −0 init.univa.rc
  13. BIN  kernel
  14. +50 −0 libaudio/Android.mk
  15. +2,198 −0 libaudio/AudioHardware.cpp
  16. +327 −0 libaudio/AudioHardware.h
  17. +211 −0 libaudio/AudioPolicyManager.cpp
  18. +47 −0 libaudio/AudioPolicyManager.h
  19. 0  libaudio/MODULE_LICENSE_APACHE2
  20. +190 −0 libaudio/NOTICE
  21. +319 −0 libaudio/msm_audio.h
  22. +71 −0 libaudio/msm_audio_voicememo.h
  23. +42 −0 libgralloc/Android.mk
  24. 0  libgralloc/MODULE_LICENSE_APACHE2
  25. +190 −0 libgralloc/NOTICE
  26. +165 −0 libgralloc/allocator.cpp
  27. +130 −0 libgralloc/allocator.h
  28. +608 −0 libgralloc/framebuffer.cpp
  29. +391 −0 libgralloc/gpu.cpp
  30. +78 −0 libgralloc/gpu.h
  31. +69 −0 libgralloc/gr.h
  32. +205 −0 libgralloc/gralloc.cpp
  33. +285 −0 libgralloc/gralloc_priv.h
  34. +488 −0 libgralloc/mapper.cpp
  35. +320 −0 libgralloc/pmemalloc.cpp
  36. +161 −0 libgralloc/pmemalloc.h
  37. +55 −0 libgralloc/tests/Android.mk
  38. +601 −0 libgralloc/tests/pmemalloc_test.cpp
  39. +11 −0 overlay/frameworks/base/core/res/res/values/config.xml
  40. +13 −0 overlay/packages/apps/Phone/res/values/config.xml
  41. +64 −0 prebuilt/init.qcom.bt.sh
  42. BIN  prebuilt/wireless.ko
  43. +193 −0 setup-makefiles.sh
  44. +20 −0 system.prop
  45. +163 −0 ueventd.univa.rc
View
3  Android.mk
@@ -0,0 +1,3 @@
+ifeq ($(TARGET_BOOTLOADER_BOARD_NAME),e510)
+include $(call first-makefiles-under,$(call my-dir))
+endif
View
44 BoardConfig.mk
@@ -3,11 +3,20 @@ USE_CAMERA_STUB := true
# inherit from the proprietary version
-include vendor/lge/e510/BoardConfigVendor.mk
+BOARD_USES_QCOM_HARDWARE := true
+BOARD_USES_QCOM_LIBS := true
+BOARD_USES_QCOM_LIBRPC := true
+
TARGET_NO_BOOTLOADER := true
TARGET_BOARD_PLATFORM := msm7k
TARGET_CPU_ABI := armeabi
+TARGET_ARCH_VARIANT := armv6-vfp
+TARGET_BOARD_PLATFORM := msm7k
+TARGET_CPU_ABI := armeabi
TARGET_BOOTLOADER_BOARD_NAME := e510
+TARGET_BOARD_PLATFORM_GPU := qcom-adreno200
+
BOARD_KERNEL_CMDLINE := mem=471M console=ttyMSM2,115200n8 androidboot.hardware=univa
BOARD_KERNEL_BASE := 0x12800000
BOARD_KERNEL_PAGESIZE := 2048
@@ -21,3 +30,38 @@ BOARD_FLASH_BLOCK_SIZE := 131072
TARGET_PREBUILT_KERNEL := device/lge/e510/kernel
BOARD_HAS_NO_SELECT_BUTTON := true
+
+TARGET_PROVIDES_LIBAUDIO := true
+TARGET_PROVIDES_LIBRIL := true
+
+BOARD_HAVE_BLUETOOTH := true
+BOARD_HAVE_BLUETOOTH_BCM := true
+
+# to enable the GPS HAL
+BOARD_USES_QCOM_GPS := true
+BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE := e510
+# AMSS version to use for GPS
+BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION := 50000
+
+BOARD_EGL_CFG := device/lge/e510/configs/egl.cfg
+
+TARGET_SPECIFIC_HEADER_PATH := device/lge/e510/include
+TARGET_LIBAGL_USE_GRALLOC_COPYBITS := true
+BOARD_CAMERA_USE_GETBUFFERINFO := true
+BOARD_USE_CAF_LIBCAMERA := true
+
+BOARD_WLAN_DEVICE := bcm4330
+WIFI_DRIVER_FW_STA_PATH := "/system/etc/wl/rtecdc.bin"
+WIFI_DRIVER_FW_AP_PATH := "/system/etc/wl/rtecdc-apsta.bin"
+WIFI_DRIVER_MODULE_NAME := "wireless"
+WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/wireless.ko"
+WIFI_DRIVER_MODULE_ARG := "firmware_path=/etc/wl/rtecdc.bin nvram_path=/etc/wl/nvram.txt config_path=/data/misc/wifi/config"
+WPA_SUPPLICANT_VERSION := VER_0_6_X
+WIFI_DRIVER_HAS_LGE_SOFTAP := true
+BOARD_WEXT_NO_COMBO_SCAN := true
+BOARD_WPA_SUPPLICANT_DRIVER := WEXT
+
+## This is failing hard on 4330. hcitool hangs
+#BOARD_FM_DEVICE := bcm4329
+#BOARD_HAVE_FM_RADIO := true
+#BOARD_GLOBAL_CFLAGS += -DHAVE_FM_RADIO
View
193 NOTICE.cm
@@ -0,0 +1,193 @@
+
+ The device setup and all necessary integration with Android for this
+ software to run on the LG Electronics E510 (Optimus Hub) are:
+
+ Copyright (c) 2011, The CyanogenMod Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+
+ 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.
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
View
9 configs/AudioFilter.csv
@@ -0,0 +1,9 @@
+A1,AUDFMT IIR,0000,4000,0000,8000,0000,4000,6A48,3DE3,2B71,8439,6A48,3DE3,6A48,3DE3,2B71,8439,6A48,3DE3,6A48,3DE3,2B71,8439,6A48,3DE3,23E7,8112,EE41,3F06,3072,82D4,88D1,3D44,4EDB,8424,2804,3BF4,4A43,84D7,0942,3B41,0002,0002,0002,0002,0,0,0,0,0,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+A2,AUDFMT IIR,0000,4000,0000,8000,0000,4000,6A48,3DE3,2B71,8439,6A48,3DE3,6A48,3DE3,2B71,8439,6A48,3DE3,6A48,3DE3,2B71,8439,6A48,3DE3,23E7,8112,EE41,3F06,3072,82D4,88D1,3D44,4EDB,8424,2804,3BF4,4A43,84D7,0942,3B41,0002,0002,0002,0002,0,0,0,0,0,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+A3,AUDFMT IIR,0000,4000,0000,8000,0000,4000,6A48,3DE3,2B71,8439,6A48,3DE3,6A48,3DE3,2B71,8439,6A48,3DE3,6A48,3DE3,2B71,8439,6A48,3DE3,23E7,8112,EE41,3F06,3072,82D4,88D1,3D44,4EDB,8424,2804,3BF4,4A43,84D7,0942,3B41,0002,0002,0002,0002,0,0,0,0,0,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+C1,AUDFMT EQ,0,0,003C,1,016A,0,00AA,1,016A,3,136,3,016A,4,258,3,016A,4,3.00E+08,3,016A,4,0BB8,3,016A,3,1770,2,016A,0,2EE0,2,016A,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+C2,AUDFMT EQ,0,6,003C,1,016A,4,00AA,3,016A,1,136,3,016A,0,258,3,016A,0,3.00E+08,3,016A,3,0BB8,6,016A,3,1770,6,016A,5,2EE0,5,016A,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+C3,AUDFMT EQ,0,6,003C,1,016A,1,136,3,016A,1,136,3,016A,0,258,3,016A,0,3.00E+08,3,016A,3,0BB8,6,016A,3,1770,6,016A,6,2EE0,5,016A,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+D1,AUDFMT MBADRC,0002,0008,0090,00C2,0,0,0,0001,0000,0176,1d27,f5c2,76f3,0209,7f88,1217,8565,0001,0000,05cc,23a7,f333,6a8f,0d69,7f88,1217,0a1e,0000,0000,0000,FFFF,FFFF,FFFF,0000,0002,0005,0009,000C,000A,0004,FFFA,FFEC,FFE0,FFDB,FFE1,FFF7,0017,003D,005B,0064,004E,0015,FFC4,FF6D,FF2C,FF20,FF5B,FFDE,0091,0148,01C7,01D5,014D,0031,FEB3,FD2E,FC1C,FBFA,FD26,FFC5,03AF,0871,0D5B,11A3,148D,1595,148D,11A3,0D5B,0871,03AF,FFC5,FD26,FBFA,FC1C,FD2E,FEB3,0031,014D,01D5,01C7,0148,0091,FFDE,FF5B,FF20,FF2C,FF6D,FFC4,0015,004E,0064,005B,003D,0017,FFF7,FFE1,FFDB,FFE0,FFEC,FFFA,0004,000A,000C,0009,0005,0002,0000,FFFF,FFFF,FFFF,0000,0000,0000,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+D2,AUDFMT MBADRC,0002,0008,0090,00C2,0,0,0,0001,0000,0176,1d27,f5c2,76f3,0209,7f88,1217,8565,0001,0000,05cc,23a7,f333,6a8f,0d69,7f88,1217,0a1e,0000,0000,0000,FFFF,FFFF,FFFF,0000,0002,0005,0009,000C,000A,0004,FFFA,FFEC,FFE0,FFDB,FFE1,FFF7,0017,003D,005B,0064,004E,0015,FFC4,FF6D,FF2C,FF20,FF5B,FFDE,0091,0148,01C7,01D5,014D,0031,FEB3,FD2E,FC1C,FBFA,FD26,FFC5,03AF,0871,0D5B,11A3,148D,1595,148D,11A3,0D5B,0871,03AF,FFC5,FD26,FBFA,FC1C,FD2E,FEB3,0031,014D,01D5,01C7,0148,0091,FFDE,FF5B,FF20,FF2C,FF6D,FFC4,0015,004E,0064,005B,003D,0017,FFF7,FFE1,FFDB,FFE0,FFEC,FFFA,0004,000A,000C,0009,0005,0002,0000,FFFF,FFFF,FFFF,0000,0000,0000,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+D3,AUDFMT MBADRC,0005,0008,0090,0188,0,0,0,0001,0000,0176,1d27,f5c2,76f3,0209,7f88,1217,fe2f,0001,0000,05cc,23a7,f333,6a8f,0d69,7f88,1217,4b03,0001,0000,12d3,2aa7,e666,58b5,8e16,7f88,1217,17ff,0001,0000,12d3,2aa7,e666,58b5,8e16,7f88,1217,093a,0001,0000,12d3,2aa7,e666,58b5,8e16,7f88,1217,05f5,0001,0001,0001,0002,0002,0004,0005,0007,0009,000D,0010,0015,001B,0022,002A,0034,003F,004C,005B,006B,007E,0092,00A9,00C2,00DD,00FA,0119,013A,015C,0181,01A6,01CC,01F3,021B,0242,0269,0290,02B5,02D8,02FA,031A,0336,0350,0366,0379,0387,0392,0398,039B,0398,0392,0387,0379,0366,0350,0336,031A,02FA,02D8,02B5,0290,0269,0242,021B,01F3,01CC,01A6,0181,015C,013A,0119,00FA,00DD,00C2,00A9,0092,007E,006B,005B,004C,003F,0034,002A,0022,001B,0015,0010,000D,0009,0007,0005,0004,0002,0002,0001,0001,0001, FFFF,FFFC,FFF8,FFF7,0000,0021,006A,00EF,01C1,02EA,0468,0625,07FE,09C1,0B37,0C2F,0C86,0C2F,0B37,09C1,07FE,0625,0468,02EA,01C1,00EF,006A,0021,0000,FFF7,FFF8,FFFC,FFFF,0002,0006,000B,0009,FFF4,FFB9,FF56,FEE4,FEA6,FF03,006A,0323,0717,0BC0,1036,1370,149E,1370,1036,0BC0,0717,0323,006A,FF03,FEA6,FEE4,FF56,FFB9,FFF4,0009,000B,0006,0002,0000,FFFE,000F,FFFA,FFCE,0057,0036,FEE1,00A7,01EA,FCB3,FF31,07B7,F9FC,F3DD,25BE,4E07,25BE,F3DD,F9FC,07B7,FF31,FCB3,01EA,00A7,FEE1,0036,0057,FFCE,FFFA,000F,FFFE,0000,0,
View
2  configs/egl.cfg
@@ -0,0 +1,2 @@
+0 0 android
+0 1 adreno200
View
204 configs/media_profiles.xml
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<!DOCTYPE MediaSettings [
+<!ELEMENT MediaSettings (CamcorderProfiles,
+ EncoderOutputFileFormat+,
+ VideoEncoderCap+,
+ AudioEncoderCap+,
+ VideoDecoderCap,
+ AudioDecoderCap)>
+<!ELEMENT CamcorderProfiles (EncoderProfile+, ImageEncoding+, ImageDecoding, Camera)>
+<!ELEMENT EncoderProfile (Video, Audio)>
+<!ATTLIST EncoderProfile quality (high|low) #REQUIRED>
+<!ATTLIST EncoderProfile fileFormat (mp4|3gp) #REQUIRED>
+<!ATTLIST EncoderProfile duration (30|60) #REQUIRED>
+<!ATTLIST EncoderProfile cameraId (0|1) #REQUIRED>
+<!ELEMENT Video EMPTY>
+<!ATTLIST Video codec (h264|h263|m4v) #REQUIRED>
+<!ATTLIST Video bitRate CDATA #REQUIRED>
+<!ATTLIST Video width CDATA #REQUIRED>
+<!ATTLIST Video height CDATA #REQUIRED>
+<!ATTLIST Video frameRate CDATA #REQUIRED>
+<!ELEMENT Audio EMPTY>
+<!ATTLIST Audio codec (amrnb|amrwb|aac) #REQUIRED>
+<!ATTLIST Audio bitRate CDATA #REQUIRED>
+<!ATTLIST Audio sampleRate CDATA #REQUIRED>
+<!ATTLIST Audio channels (1|2) #REQUIRED>
+<!ELEMENT ImageEncoding EMPTY>
+<!ATTLIST ImageEncoding quality (90|80|70|60|50|40) #REQUIRED>
+<!ELEMENT ImageDecoding EMPTY>
+<!ATTLIST ImageDecoding memCap CDATA #REQUIRED>
+<!ELEMENT Camera EMPTY>
+<!ELEMENT EncoderOutputFileFormat EMPTY>
+<!ATTLIST EncoderOutputFileFormat name (mp4|3gp) #REQUIRED>
+<!ELEMENT VideoEncoderCap EMPTY>
+<!ATTLIST VideoEncoderCap name (h264|h263|m4v|wmv) #REQUIRED>
+<!ATTLIST VideoEncoderCap enabled (true|false) #REQUIRED>
+<!ATTLIST VideoEncoderCap minBitRate CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap maxBitRate CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap minFrameWidth CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap maxFrameWidth CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap minFrameHeight CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap maxFrameHeight CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap minFrameRate CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap maxFrameRate CDATA #REQUIRED>
+<!ELEMENT AudioEncoderCap EMPTY>
+<!ATTLIST AudioEncoderCap name (amrnb|amrwb|aac|wma) #REQUIRED>
+<!ATTLIST AudioEncoderCap enabled (true|false) #REQUIRED>
+<!ATTLIST AudioEncoderCap minBitRate CDATA #REQUIRED>
+<!ATTLIST AudioEncoderCap maxBitRate CDATA #REQUIRED>
+<!ATTLIST AudioEncoderCap minSampleRate CDATA #REQUIRED>
+<!ATTLIST AudioEncoderCap maxSampleRate CDATA #REQUIRED>
+<!ATTLIST AudioEncoderCap minChannels (1|2) #REQUIRED>
+<!ATTLIST AudioEncoderCap maxChannels (1|2) #REQUIRED>
+<!ELEMENT VideoDecoderCap EMPTY>
+<!ATTLIST VideoDecoderCap name (wmv) #REQUIRED>
+<!ATTLIST VideoDecoderCap enabled (true|false) #REQUIRED>
+<!ELEMENT AudioDecoderCap EMPTY>
+<!ATTLIST AudioDecoderCap name (wma) #REQUIRED>
+<!ATTLIST AudioDecoderCap enabled (true|false) #REQUIRED>
+]>
+<!--
+ This file is used to declare the multimedia profiles and capabilities
+ on an android-powered device.
+-->
+<MediaSettings>
+ <!-- Each camcorder profile defines a set of predefined configuration parameters -->
+ <CamcorderProfiles cameraId="0">
+
+ <EncoderProfile quality="high" fileFormat="mp4" duration="60">
+ <Video codec="h264"
+ bitRate="2000000"
+ width="640"
+ height="480"
+ frameRate="24" />
+
+ <Audio codec="aac"
+ bitRate="96000"
+ sampleRate="16000"
+ channels="1" />
+
+ </EncoderProfile>
+
+ <EncoderProfile quality="low" fileFormat="3gp" duration="30">
+ <Video codec="m4v"
+ bitRate="256000"
+ width="176"
+ height="144"
+ frameRate="15" />
+
+ <Audio codec="amrnb"
+ bitRate="12200"
+ sampleRate="8000"
+ channels="1" />
+
+ </EncoderProfile>
+
+ <ImageEncoding quality="90" />
+ <ImageEncoding quality="80" />
+ <ImageEncoding quality="70" />
+ <ImageDecoding memCap="20000000" />
+
+ </CamcorderProfiles>
+
+ <CamcorderProfiles cameraId="1">
+
+ <EncoderProfile quality="high" fileFormat="mp4" duration="60">
+ <Video codec="m4v"
+ bitRate="1000000"
+ width="640"
+ height="480"
+ frameRate="24" />
+
+ <Audio codec="aac"
+ bitRate="96000"
+ sampleRate="16000"
+ channels="1" />
+ </EncoderProfile>
+
+ <EncoderProfile quality="low" fileFormat="3gp" duration="30">
+ <Video codec="m4v"
+ bitRate="256000"
+ width="176"
+ height="144"
+ frameRate="15" />
+
+ <Audio codec="amrnb"
+ bitRate="12200"
+ sampleRate="8000"
+ channels="1" />
+
+ </EncoderProfile>
+
+ <ImageEncoding quality="90" />
+ <ImageEncoding quality="80" />
+ <ImageEncoding quality="70" />
+ <ImageDecoding memCap="20000000" />
+
+ </CamcorderProfiles>
+
+
+ <EncoderOutputFileFormat name="3gp" />
+ <EncoderOutputFileFormat name="mp4" />
+
+ <!--
+ If a codec is not enabled, it is invisible to the applications
+ In other words, the applications won't be able to use the codec
+ or query the capabilities of the codec at all if it is disabled
+ -->
+ <VideoEncoderCap name="h264" enabled="true"
+ minBitRate="64000" maxBitRate="3000000"
+ minFrameWidth="176" maxFrameWidth="640"
+ minFrameHeight="144" maxFrameHeight="480"
+ minFrameRate="1" maxFrameRate="30" />
+
+ <VideoEncoderCap name="h263" enabled="true"
+ minBitRate="64000" maxBitRate="1000000"
+ minFrameWidth="176" maxFrameWidth="640"
+ minFrameHeight="144" maxFrameHeight="480"
+ minFrameRate="1" maxFrameRate="30" />
+
+ <VideoEncoderCap name="m4v" enabled="true"
+ minBitRate="64000" maxBitRate="2000000"
+ minFrameWidth="176" maxFrameWidth="640"
+ minFrameHeight="144" maxFrameHeight="480"
+ minFrameRate="1" maxFrameRate="30" />
+
+ <AudioEncoderCap name="aac" enabled="true"
+ minBitRate="8192" maxBitRate="96000"
+ minSampleRate="8000" maxSampleRate="16000"
+ minChannels="1" maxChannels="1" />
+
+ <AudioEncoderCap name="amrwb" enabled="true"
+ minBitRate="6600" maxBitRate="23050"
+ minSampleRate="16000" maxSampleRate="16000"
+ minChannels="1" maxChannels="1" />
+
+ <AudioEncoderCap name="amrnb" enabled="true"
+ minBitRate="5525" maxBitRate="12200"
+ minSampleRate="8000" maxSampleRate="8000"
+ minChannels="1" maxChannels="1" />
+
+ <!--
+ FIXME:
+ We do not check decoder capabilities at present
+ At present, we only check whether windows media is visible
+ for TEST applications. For other applications, we do
+ not perform any checks at all.
+ -->
+ <VideoDecoderCap name="wmv" enabled="false"/>
+ <AudioDecoderCap name="wma" enabled="false"/>
+</MediaSettings>
View
65 configs/nvram.txt
@@ -0,0 +1,65 @@
+# BCM4330 B1 FCBGA LG P698 Rev.B 5/25/2011
+manfid=0x2d0
+prodid=0x0532
+vendid=0x14e4
+devid=0x4360
+boardtype=0x0532
+boardrev=0x40
+#boardflags: use a SP3T sw share with BT, 2.4GHz eLNA and iPA
+boardflags=0x81201
+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
+ccode=ALL
+# 2.4GHz PA parameters
+pa0b0=0x14C9
+pa0b1=0xFD94
+pa0b2=0xFF63
+cckPwrOffset=4
+# rssi params for 2.4GHz
+rssismf2g=0xa
+rssismc2g=0x3
+rssisav2g=0x7
+sromrev=3
+# 2.4G Tx Power 11b/g/n 17/14/13
+maxp2ga0=76
+ofdm2gpo=0x77777777
+mcs2gpo0=0x9999
+mcs2gpo1=0x9999
+# cckdigfilttype ranges from 20 to 27, default is 21.
+#cckdigfilttype=21
+# ofdmdigfilttype ranges from 0 to 4;
+#ofdmdigfilttype=2
+#il0macaddr=00:90:4c:c5:12:38
+#wl0id=0x431b
+#extpagain2g=2
+pacalidx2g=65
+dacrate2g=160
+xtalmode=0x20,0x4,0
+#noise_cal_ref_2g=56
+#noise_cal_po_bias_2g=-4
+pa0itssit=0x20
+
+rfreg033=0x19
+rfreg033_cck=0x1f
+#rfreg033=0x1f
+
+txalpfbyp2g=1
+#txalpfbyp2g_cck=0
+bphyscale=17
+
+# 2G RFMD RF5501
+swctrlmap_2g=0x04040404,0x0a0a0202,0x0c0c0404,0x010a02,0x1ff
+
+tssitime=1
+
+#for BT-coexistence
+btc_params80=0
+btc_params6=10
+sd_oobonly=1
+sd_gpout=0
+sd_gpval=1
View
5 configs/wpa_supplicant.conf
@@ -0,0 +1,5 @@
+update_config=1
+ctrl_interface=wlan0
+eapol_version=1
+ap_scan=1
+fast_reauth=1
View
38 e510.mk
@@ -17,8 +17,46 @@ endif
PRODUCT_COPY_FILES += \
$(LOCAL_KERNEL):kernel
+# Board-specific init
+PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/init.univa.rc:root/init.univa.rc \
+ $(LOCAL_PATH)/ueventd.univa.rc:root/ueventd.univa.rc
+
+# BT startup
+PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/prebuilt/init.qcom.bt.sh:system/bin/init.qcom.bt.sh
+
+# configs
+PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/configs/AudioFilter.csv:system/etc/AudioFilter.csv \
+ $(LOCAL_PATH)/configs/media_profiles.xml:system/etc/media_profiles.xml
+
+# WiFi
+PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/configs/nvram.txt:system/etc/wl/nvram.txt \
+ $(LOCAL_PATH)/configs/wpa_supplicant.conf:system/etc/wifi/wpa_supplicant.conf \
+ $(LOCAL_PATH)/prebuilt/wireless.ko:system/lib/modules/wireless.ko
+
+# Permission files
+PRODUCT_COPY_FILES += \
+ frameworks/base/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \
+ frameworks/base/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml \
+ frameworks/base/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml \
+ frameworks/base/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \
+ frameworks/base/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \
+ frameworks/base/data/etc/android.hardware.sensor.compass.xml:system/etc/permissions/android.hardware.sensor.compass.xml \
+ frameworks/base/data/etc/android.hardware.sensor.accelerometer.xml:system/etc/permissions/android.hardware.sensor.accelerometer.xml \
+ frameworks/base/data/etc/android.hardware.sensor.proximity.xml:system/etc/permissions/android.hardware.sensor.proximity.xml \
+ frameworks/base/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml \
+ frameworks/base/data/etc/android.hardware.touchscreen.multitouch.distinct.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.distinct.xml
+
$(call inherit-product, build/target/product/full.mk)
+PRODUCT_PACKAGES += \
+ gralloc.e510 \
+ gps.e510 \
+ libOmxCore
+
PRODUCT_BUILD_PROP_OVERRIDES += BUILD_UTC_DATE=0
PRODUCT_NAME := e510
PRODUCT_DEVICE := e510
View
114 extract-files.sh
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+# Copyright (C) 2011 The CyanogenMod 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.
+
+VENDOR=lge
+DEVICE=e510
+
+rm -rf ../../../vendor/$VENDOR/$DEVICE
+mkdir -p ../../../vendor/$VENDOR/$DEVICE/proprietary/bin
+mkdir -p ../../../vendor/$VENDOR/$DEVICE/proprietary/etc/flex
+mkdir -p ../../../vendor/$VENDOR/$DEVICE/proprietary/etc/wl
+mkdir -p ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/egl
+mkdir -p ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/hw
+
+## RIL
+
+adb pull /system/lib/libgstk_exp.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libgstk_exp.so
+adb pull /system/lib/libqmi.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libqmi.so
+adb pull /system/lib/libpbmlib.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libpbmlib.so
+adb pull /system/lib/libmmgsdilib.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libmmgsdilib.so
+adb pull /system/lib/liblge_security.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/liblge_security.so
+adb pull /system/lib/libril-qcril-hook-oem.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libril-qcril-hook-oem.so
+adb pull /system/lib/libdsm.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libdsm.so
+adb pull /system/lib/liboncrpc.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/liboncrpc.so
+adb pull /system/lib/libril-qc-qmi-1.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libril-qc-qmi-1.so
+adb pull /system/lib/libnv.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libnv.so
+adb pull /system/lib/libauth.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libauth.so
+adb pull /system/lib/libwms.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libwms.so
+adb pull /system/lib/libgsl.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libgsl.so
+adb pull /system/lib/libdiag.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libdiag.so
+adb pull /system/lib/liboem_rapi.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/liboem_rapi.so
+adb pull /system/lib/libgsdi_exp.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libgsdi_exp.so
+adb pull /system/lib/libril-qc-1.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libril-qc-1.so
+adb pull /system/lib/liblgeat.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/liblgeat.so
+adb pull /system/lib/libcm.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libcm.so
+adb pull /system/lib/libqueue.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libqueue.so
+adb pull /system/lib/liblgerft.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/liblgerft.so
+adb pull /system/lib/libdss.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libdss.so
+adb pull /system/lib/libbcmwl.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libbcmwl.so
+adb pull /system/lib/libwmsts.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libwmsts.so
+adb pull /system/lib/libdsutils.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libdsutils.so
+adb pull /system/lib/libidl.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libidl.so
+adb pull /system/lib/liblgdrm.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/liblgdrm.so
+adb pull /system/lib/libril.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libril.so
+adb pull /system/bin/qmuxd ../../../vendor/$VENDOR/$DEVICE/proprietary/bin/qmuxd
+adb pull /system/etc/flex/flex.xml ../../../vendor/$VENDOR/$DEVICE/proprietary/etc/flex/flex.xml
+adb pull /system/bin/atd ../../../vendor/$VENDOR/$DEVICE/proprietary/bin/atd
+
+## Audio
+
+adb pull /system/lib/libaudioeq.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/libaudioeq.so
+
+## HAL
+adb pull /system/lib/hw/copybit.msm7k.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/hw/copybit.msm7k.so
+adb pull /system/lib/hw/lights.msm7k.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/hw/lights.msm7k.so
+adb pull /system/lib/hw/sensors.msm7k.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/hw/sensors.msm7k.so
+
+## EGL
+adb pull /system/lib/egl/libGLESv2_adreno200.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/egl/libGLESv2_adreno200.so
+adb pull /system/lib/egl/libGLESv1_CM_adreno200.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/egl/libGLESv1_CM_adreno200.so
+adb pull /system/lib/egl/libq3dtools_adreno200.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/egl/libq3dtools_adreno200.so
+adb pull /system/lib/egl/libEGL_adreno200.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/egl/libEGL_adreno200.so
+adb pull /system/etc/firmware/yamato_pfp.fw ../../../vendor/$VENDOR/$DEVICE/proprietary/etc/firmware/yamato_pfp.fw
+adb pull /system/etc/firmware/yamato_pm4.fw ../../../vendor/$VENDOR/$DEVICE/proprietary/etc/firmware/yamato_pm4.fw
+adb pull /system/bin/ami304d ../../../vendor/$VENDOR/$DEVICE/proprietary/bin/ami304d
+
+## Camera
+adb pull /system/lib/libcamera.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/liboemcamera.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libmmjpeg.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libmmipl.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+
+## OMX
+adb pull /system/lib/libOmxAacDec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxAacEnc.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxAdpcmDec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxAmrDec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxAmrEnc.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxAmrRtpDec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxAmrwbDec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxEvrcDec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxEvrcEnc.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxEvrcHwDec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxH264Dec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxMp3Dec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxMpeg4Dec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxOn2Dec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxQcelp13Dec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxQcelp13Enc.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxQcelpHwDec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxVidEnc.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxWmaDec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libOmxWmvDec.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libmm-adspsvc.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+adb pull /system/lib/libdivxdrmdecrypt.so ../../../vendor/$VENDOR/$DEVICE/proprietary/lib/
+
+## BT
+adb pull /system/etc/firmware/BCM4330B1_002.001.003.0337.0338.hcd ../../../vendor/$VENDOR/$DEVICE/proprietary/etc/firmware/
+
+## Wifi
+adb pull /system/etc/wl/rtecdc-apsta.bin ../../../vendor/$VENDOR/$DEVICE/proprietary/etc/firmware/
+adb pull /system/etc/wl/rtecdc.bin ../../../vendor/$VENDOR/$DEVICE/proprietary/etc/firmware/
@jstotero
jstotero added a note

lines 113 and 144, should be pulled to ../../../vendor/$VENDOR/$DEVICE/proprietary/etc/wl/, shouldn't they?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
View
246 include/camera/CameraHardwareInterface.h
@@ -0,0 +1,246 @@
+/*
+ * Copyright (C) 2008 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 ANDROID_HARDWARE_CAMERA_HARDWARE_INTERFACE_H
+#define ANDROID_HARDWARE_CAMERA_HARDWARE_INTERFACE_H
+
+#include <binder/IMemory.h>
+#include <utils/RefBase.h>
+#include <surfaceflinger/ISurface.h>
+#include <camera/Camera.h>
+#include <camera/CameraParameters.h>
+
+namespace android {
+
+class Overlay;
+
+/**
+ * The size of image for display.
+ */
+typedef struct image_rect_struct
+{
+ uint32_t width; /* Image width */
+ uint32_t height; /* Image height */
+} image_rect_type;
+
+
+typedef void (*notify_callback)(int32_t msgType,
+ int32_t ext1,
+ int32_t ext2,
+ void* user);
+
+typedef void (*data_callback)(int32_t msgType,
+ const sp<IMemory>& dataPtr,
+ void* user);
+
+typedef void (*data_callback_timestamp)(nsecs_t timestamp,
+ int32_t msgType,
+ const sp<IMemory>& dataPtr,
+ void* user);
+
+/**
+ * CameraHardwareInterface.h defines the interface to the
+ * camera hardware abstraction layer, used for setting and getting
+ * parameters, live previewing, and taking pictures.
+ *
+ * It is a referenced counted interface with RefBase as its base class.
+ * CameraService calls openCameraHardware() to retrieve a strong pointer to the
+ * instance of this interface and may be called multiple times. The
+ * following steps describe a typical sequence:
+ *
+ * -# After CameraService calls openCameraHardware(), getParameters() and
+ * setParameters() are used to initialize the camera instance.
+ * CameraService calls getPreviewHeap() to establish access to the
+ * preview heap so it can be registered with SurfaceFlinger for
+ * efficient display updating while in preview mode.
+ * -# startPreview() is called. The camera instance then periodically
+ * sends the message CAMERA_MSG_PREVIEW_FRAME (if enabled) each time
+ * a new preview frame is available. If data callback code needs to use
+ * this memory after returning, it must copy the data.
+ *
+ * Prior to taking a picture, CameraService calls autofocus(). When auto
+ * focusing has completed, the camera instance sends a CAMERA_MSG_FOCUS notification,
+ * which informs the application whether focusing was successful. The camera instance
+ * only sends this message once and it is up to the application to call autoFocus()
+ * again if refocusing is desired.
+ *
+ * CameraService calls takePicture() to request the camera instance take a
+ * picture. At this point, if a shutter, postview, raw, and/or compressed callback
+ * is desired, the corresponding message must be enabled. As with CAMERA_MSG_PREVIEW_FRAME,
+ * any memory provided in a data callback must be copied if it's needed after returning.
+ */
+class CameraHardwareInterface : public virtual RefBase {
+public:
+ virtual ~CameraHardwareInterface() { }
+
+ /** Return the IMemoryHeap for the preview image heap */
+ virtual sp<IMemoryHeap> getPreviewHeap() const = 0;
+
+ /** Return the IMemoryHeap for the raw image heap */
+ virtual sp<IMemoryHeap> getRawHeap() const = 0;
+
+ /** Filler to match the blob's ABI */
+ virtual status_t getShutterSound(int) = 0;
+
+ /** Set the notification and data callbacks */
+ virtual void setCallbacks(notify_callback notify_cb,
+ data_callback data_cb,
+ data_callback_timestamp data_cb_timestamp,
+ void* user) = 0;
+
+ /**
+ * The following three functions all take a msgtype,
+ * which is a bitmask of the messages defined in
+ * include/ui/Camera.h
+ */
+
+ /**
+ * Enable a message, or set of messages.
+ */
+ virtual void enableMsgType(int32_t msgType) = 0; // 24
+
+ /**
+ * Disable a message, or a set of messages.
+ */
+ virtual void disableMsgType(int32_t msgType) = 0; // 28
+
+ /**
+ * Query whether a message, or a set of messages, is enabled.
+ * Note that this is operates as an AND, if any of the messages
+ * queried are off, this will return false.
+ */
+ virtual bool msgTypeEnabled(int32_t msgType) = 0;
+
+ /**
+ * Start preview mode.
+ */
+ virtual status_t startPreview() = 0;
+
+ /**
+ * Query the recording buffer information from HAL.
+ * This is needed because the opencore expects the buffer
+ * information before starting the recording.
+ */
+ virtual status_t getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize) = 0;
+
+ /**
+ * Encode the YUV data.
+ */
+ virtual void encodeData() = 0;
+
+ /**
+ * Only used if overlays are used for camera preview.
+ */
+ virtual bool useOverlay() {return false;}
+ virtual status_t setOverlay(const sp<Overlay> &overlay) {return BAD_VALUE;}
+
+ /**
+ * Stop a previously started preview.
+ */
+ virtual void stopPreview() = 0;
+
+ /**
+ * Returns true if preview is enabled.
+ */
+ virtual bool previewEnabled() = 0;
+
+ /**
+ * Start record mode. When a record image is available a CAMERA_MSG_VIDEO_FRAME
+ * message is sent with the corresponding frame. Every record frame must be released
+ * by calling releaseRecordingFrame().
+ */
+ virtual status_t startRecording() = 0;
+
+ /**
+ * Stop a previously started recording.
+ */
+ virtual void stopRecording() = 0;
+
+ /**
+ * Returns true if recording is enabled.
+ */
+ virtual bool recordingEnabled() = 0;
+
+ /**
+ * Release a record frame previously returned by CAMERA_MSG_VIDEO_FRAME.
+ */
+ virtual void releaseRecordingFrame(const sp<IMemory>& mem) = 0;
+
+ /**
+ * Start auto focus, the notification callback routine is called
+ * with CAMERA_MSG_FOCUS once when focusing is complete. autoFocus()
+ * will be called again if another auto focus is needed.
+ */
+ virtual status_t autoFocus() = 0;
+
+ /**
+ * Cancels auto-focus function. If the auto-focus is still in progress,
+ * this function will cancel it. Whether the auto-focus is in progress
+ * or not, this function will return the focus position to the default.
+ * If the camera does not support auto-focus, this is a no-op.
+ */
+ virtual status_t cancelAutoFocus() = 0;
+
+ /**
+ * Take a picture.
+ */
+ virtual status_t takePicture() = 0;
+
+ /**
+ * Cancel a picture that was started with takePicture. Calling this
+ * method when no picture is being taken is a no-op.
+ */
+ virtual status_t cancelPicture() = 0;
+
+ /**
+ * Set the camera parameters. This returns BAD_VALUE if any parameter is
+ * invalid or not supported. */
+ virtual status_t setParameters(const CameraParameters& params) = 0; //96
+
+ /** Return the camera parameters. */
+ virtual CameraParameters getParameters() const = 0;
+
+ /**
+ * Send command to camera driver.
+ */
+ virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;
+
+ /**
+ * Release the hardware resources owned by this object. Note that this is
+ * *not* done in the destructor.
+ */
+ virtual void release() = 0;
+
+ /**
+ * Dump state of the camera hardware
+ */
+ virtual status_t dump(int fd, const Vector<String16>& args) const = 0;
+};
+
+/**
+ * The functions need to be provided by the camera HAL.
+ *
+ * If getNumberOfCameras() returns N, the valid cameraId for getCameraInfo()
+ * and openCameraHardware() is 0 to N-1.
+ */
+extern "C" int HAL_getNumberOfCameras();
+extern "C" void HAL_getCameraInfo(int cameraId, struct CameraInfo* cameraInfo);
+/* HAL should return NULL if it fails to open camera hardware. */
+extern "C" sp<CameraHardwareInterface> HAL_openCameraHardware(int cameraId);
+
+}; // namespace android
+
+#endif
View
56 init.univa.rc
@@ -0,0 +1,56 @@
+on boot
+
+ mkdir /data/radio 0770 radio radio
+
+ mkdir /data/amit 0777 ami304d ami304d
+ chmod 0666 /data/amit/AMI306_Config.ini
+ chmod 0666 /data/amit/AMI306_Config2.ini
+
+ chown compass system /sys/bus/i2c/drivers/proximity_gp2ap/4-0044/enable
+ chmod 0660 /sys/bus/i2c/drivers/proximity_gp2ap/4-0044/enable
+## LGE's bluetooth stuff
+# bluetooth permissions
+ chmod 0660 /dev/ttyHS0
+ chown bluetooth bluetooth /dev/ttyHS0
+ chown bluetooth bluetooth /proc/bluetooth/sleep/proto
+ chmod 0660 /sys/class/rfkill/rfkill0/state
+ chmod 0660 /sys/class/rfkill/rfkill0/type
+
+ chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
+ chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
+ write /sys/class/rfkill/rfkill0/state 0
+### End of LGE bluetooth
+# WIFI
+ mkdir /data/misc/wifi/sockets 0770 wifi wifi
+ setprop wifi.supplicant_scan_interval 20
+ setprop wifi.interface wlan0
+ mkdir /data/misc/dhcp 0777 system system
+
+service qmuxd /system/bin/qmuxd
+ user radio
+ group radio
+service ami304d /system/bin/ami304d
+ user compass
+ group system
+
+service hciattach /system/bin/sh /system/bin/init.qcom.bt.sh
+ user bluetooth
+ group bluetooth net_bt_admin
+ disabled
+
+service dhcpcd_wlan0 /system/bin/dhcpcd -BKA wlan0
+ disabled
+ oneshot
+
+service iprenew_wlan0 /system/bin/dhcpcd -n wlan0
+ disabled
+ oneshot
+
+on property:init.svc.wpa_supplicant=stopped
+ stop dhcpcd_wlan0
+
+service wpa_supplicant /system/bin/wpa_supplicant -Dwext -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf
+ socket wpa_wlan0 dgram 660 wifi wifi
+ group system wifi inet
+ disabled
+ oneshot
View
BIN  kernel
Binary file not shown
View
50 libaudio/Android.mk
@@ -0,0 +1,50 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= \
+ AudioPolicyManager.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libutils \
+ libmedia
+
+LOCAL_STATIC_LIBRARIES := libaudiopolicybase
+
+LOCAL_MODULE:= libaudiopolicy
+
+ifeq ($(BOARD_HAVE_BLUETOOTH),true)
+ LOCAL_CFLAGS += -DWITH_A2DP
+endif
+
+include $(BUILD_SHARED_LIBRARY)
+
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libaudio
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libutils \
+ libmedia \
+ libhardware_legacy
+
+ifeq ($TARGET_OS)-$(TARGET_SIMULATOR),linux-true)
+LOCAL_LDLIBS += -ldl
+endif
+
+ifneq ($(TARGET_SIMULATOR),true)
+LOCAL_SHARED_LIBRARIES += libdl
+endif
+
+LOCAL_SRC_FILES += AudioHardware.cpp
+
+LOCAL_CFLAGS += -fno-short-enums
+
+LOCAL_STATIC_LIBRARIES += libaudiointerface
+ifeq ($(BOARD_HAVE_BLUETOOTH),true)
+ LOCAL_SHARED_LIBRARIES += liba2dp libbinder
+endif
+
+include $(BUILD_SHARED_LIBRARY)
View
2,198 libaudio/AudioHardware.cpp
@@ -0,0 +1,2198 @@
+/*
+** Copyright 2008, The Android Open-Source Project
+** Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+**
+** 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 <math.h>
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "AudioHardwareMSM72XX"
+#include <utils/Log.h>
+#include <utils/String8.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dlfcn.h>
+#include <fcntl.h>
+
+// hardware specific functions
+
+#include "AudioHardware.h"
+#include <media/AudioRecord.h>
+
+#define LOG_SND_RPC 0 // Set to 1 to log sound RPC's
+
+#define COMBO_DEVICE_SUPPORTED 0 // Headset speaker combo device not supported on this target
+#define DUALMIC_KEY "dualmic_enabled"
+#define TTY_MODE_KEY "tty_mode"
+
+namespace android {
+static int audpre_index, tx_iir_index;
+static void * acoustic;
+const uint32_t AudioHardware::inputSamplingRates[] = {
+ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000
+};
+
+static int get_audpp_filter(void);
+static int msm72xx_enable_postproc(bool state);
+
+// Post processing paramters
+static struct rx_iir_filter iir_cfg[3];
+static struct adrc_filter adrc_cfg[3];
+static struct mbadrc_filter mbadrc_cfg[3];
+eqalizer eqalizer[3];
+static uint16_t adrc_flag[3];
+static uint16_t mbadrc_flag[3];
+static uint16_t eq_flag[3];
+static uint16_t rx_iir_flag[3];
+static uint16_t agc_flag[3];
+static uint16_t ns_flag[3];
+static uint16_t txiir_flag[3];
+static bool audpp_filter_inited = false;
+static bool adrc_filter_exists[3];
+static bool mbadrc_filter_exists[3];
+static int post_proc_feature_mask = 0;
+static bool playback_in_progress = false;
+
+//Pre processing parameters
+static struct tx_iir tx_iir_cfg[9];
+static struct ns ns_cfg[9];
+static struct tx_agc tx_agc_cfg[9];
+static int enable_preproc_mask;
+
+static int snd_device = -1;
+
+#define PCM_OUT_DEVICE "/dev/msm_pcm_out"
+#define PCM_IN_DEVICE "/dev/msm_pcm_in"
+#define PCM_CTL_DEVICE "/dev/msm_pcm_ctl"
+#define PREPROC_CTL_DEVICE "/dev/msm_preproc_ctl"
+#define VOICE_MEMO_DEVICE "/dev/msm_voicememo"
+
+static uint32_t SND_DEVICE_CURRENT=-1;
+static uint32_t SND_DEVICE_HANDSET=-1;
+static uint32_t SND_DEVICE_SPEAKER=-1;
+static uint32_t SND_DEVICE_BT=-1;
+static uint32_t SND_DEVICE_BT_EC_OFF=-1;
+static uint32_t SND_DEVICE_HEADSET=-1;
+static uint32_t SND_DEVICE_HEADSET_AND_SPEAKER=-1;
+static uint32_t SND_DEVICE_IN_S_SADC_OUT_HANDSET=-1;
+static uint32_t SND_DEVICE_IN_S_SADC_OUT_SPEAKER_PHONE=-1;
+static uint32_t SND_DEVICE_TTY_HEADSET=-1;
+static uint32_t SND_DEVICE_TTY_HCO=-1;
+static uint32_t SND_DEVICE_TTY_VCO=-1;
+static uint32_t SND_DEVICE_CARKIT=-1;
+static uint32_t SND_DEVICE_FM_SPEAKER=-1;
+static uint32_t SND_DEVICE_FM_HEADSET=-1;
+static uint32_t SND_DEVICE_NO_MIC_HEADSET=-1;
+// ----------------------------------------------------------------------------
+
+AudioHardware::AudioHardware() :
+ mInit(false), mMicMute(true), mBluetoothNrec(true), mBluetoothId(0),
+ mOutput(0), mSndEndpoints(NULL), mCurSndDevice(-1), mDualMicEnabled(false), mBuiltinMicSelected(false),
+ mFmRadioEnabled(false),mFmPrev(false),mFmVolume(0),fmfd(-1)
+{
+ if (get_audpp_filter() == 0) {
+ audpp_filter_inited = true;
+ }
+
+ m7xsnddriverfd = open("/dev/msm_snd", O_RDWR);
+ if (m7xsnddriverfd >= 0) {
+ int rc = ioctl(m7xsnddriverfd, SND_GET_NUM_ENDPOINTS, &mNumSndEndpoints);
+ if (rc >= 0) {
+ mSndEndpoints = new msm_snd_endpoint[mNumSndEndpoints];
+ mInit = true;
+ LOGV("constructed (%d SND endpoints)", rc);
+ struct msm_snd_endpoint *ept = mSndEndpoints;
+ for (int cnt = 0; cnt < mNumSndEndpoints; cnt++, ept++) {
+ ept->id = cnt;
+ ioctl(m7xsnddriverfd, SND_GET_ENDPOINT, ept);
+ LOGV("cnt = %d ept->name = %s ept->id = %d\n", cnt, ept->name, ept->id);
+#define CHECK_FOR(desc) if (!strcmp(ept->name, #desc)) SND_DEVICE_##desc = ept->id;
+ CHECK_FOR(CURRENT);
+ CHECK_FOR(HANDSET);
+ CHECK_FOR(SPEAKER);
+ CHECK_FOR(BT);
+ CHECK_FOR(BT_EC_OFF);
+ CHECK_FOR(HEADSET);
+ CHECK_FOR(HEADSET_AND_SPEAKER);
+ CHECK_FOR(IN_S_SADC_OUT_HANDSET);
+ CHECK_FOR(IN_S_SADC_OUT_SPEAKER_PHONE);
+ CHECK_FOR(TTY_HEADSET);
+ CHECK_FOR(TTY_HCO);
+ CHECK_FOR(TTY_VCO);
+ CHECK_FOR(FM_SPEAKER);
+ CHECK_FOR(FM_HEADSET);
+#undef CHECK_FOR
+ }
+ }
+ else LOGE("Could not retrieve number of MSM SND endpoints.");
+
+ int AUTO_VOLUME_ENABLED = 1; // setting enabled as default
+
+ static const char *const path = "/system/etc/AutoVolumeControl.txt";
+ int txtfd;
+ struct stat st;
+ char *read_buf;
+
+ txtfd = open(path, O_RDONLY);
+ if (txtfd < 0) {
+ LOGE("failed to open AUTO_VOLUME_CONTROL %s: %s (%d)",
+ path, strerror(errno), errno);
+ }
+ else {
+ if (fstat(txtfd, &st) < 0) {
+ LOGE("failed to stat %s: %s (%d)",
+ path, strerror(errno), errno);
+ close(txtfd);
+ }
+
+ read_buf = (char *) mmap(0, st.st_size,
+ PROT_READ | PROT_WRITE,
+ MAP_PRIVATE,
+ txtfd, 0);
+
+ if (read_buf == MAP_FAILED) {
+ LOGE("failed to mmap parameters file: %s (%d)",
+ strerror(errno), errno);
+ close(txtfd);
+ }
+
+ if(read_buf[0] =='0')
+ AUTO_VOLUME_ENABLED = 0;
+
+ munmap(read_buf, st.st_size);
+ close(txtfd);
+ }
+
+ ioctl(m7xsnddriverfd, SND_AVC_CTL, &AUTO_VOLUME_ENABLED);
+ ioctl(m7xsnddriverfd, SND_AGC_CTL, &AUTO_VOLUME_ENABLED);
+ }
+ else LOGE("Could not open MSM SND driver.");
+}
+
+AudioHardware::~AudioHardware()
+{
+ for (size_t index = 0; index < mInputs.size(); index++) {
+ closeInputStream((AudioStreamIn*)mInputs[index]);
+ }
+ mInputs.clear();
+ closeOutputStream((AudioStreamOut*)mOutput);
+ delete [] mSndEndpoints;
+ if (acoustic) {
+ ::dlclose(acoustic);
+ acoustic = 0;
+ }
+ if (m7xsnddriverfd > 0)
+ {
+ close(m7xsnddriverfd);
+ m7xsnddriverfd = -1;
+ }
+ enable_preproc_mask = 0;
+ mInit = false;
+}
+
+status_t AudioHardware::initCheck()
+{
+ return mInit ? NO_ERROR : NO_INIT;
+}
+
+AudioStreamOut* AudioHardware::openOutputStream(
+ uint32_t devices, int *format, uint32_t *channels, uint32_t *sampleRate, status_t *status)
+{
+ { // scope for the lock
+ Mutex::Autolock lock(mLock);
+
+ // only one output stream allowed
+ if (mOutput) {
+ if (status) {
+ *status = INVALID_OPERATION;
+ }
+ return 0;
+ }
+
+ // create new output stream
+ AudioStreamOutMSM72xx* out = new AudioStreamOutMSM72xx();
+ status_t lStatus = out->set(this, devices, format, channels, sampleRate);
+ if (status) {
+ *status = lStatus;
+ }
+ if (lStatus == NO_ERROR) {
+ mOutput = out;
+ } else {
+ delete out;
+ }
+ }
+ return mOutput;
+}
+
+void AudioHardware::closeOutputStream(AudioStreamOut* out) {
+ Mutex::Autolock lock(mLock);
+ if (mOutput == 0 || mOutput != out) {
+ LOGW("Attempt to close invalid output stream");
+ }
+ else {
+ delete mOutput;
+ mOutput = 0;
+ }
+}
+
+AudioStreamIn* AudioHardware::openInputStream(
+ uint32_t devices, int *format, uint32_t *channels, uint32_t *sampleRate, status_t *status,
+ AudioSystem::audio_in_acoustics acoustic_flags)
+{
+ // check for valid input source
+ if (!AudioSystem::isInputDevice((AudioSystem::audio_devices)devices)) {
+ return 0;
+ }
+
+ mLock.lock();
+
+ AudioStreamInMSM72xx* in = new AudioStreamInMSM72xx();
+ status_t lStatus = in->set(this, devices, format, channels, sampleRate, acoustic_flags);
+ if (status) {
+ *status = lStatus;
+ }
+ if (lStatus != NO_ERROR) {
+ mLock.unlock();
+ delete in;
+ return 0;
+ }
+
+ mInputs.add(in);
+ mLock.unlock();
+
+ return in;
+}
+
+void AudioHardware::closeInputStream(AudioStreamIn* in) {
+ Mutex::Autolock lock(mLock);
+
+ ssize_t index = mInputs.indexOf((AudioStreamInMSM72xx *)in);
+ if (index < 0) {
+ LOGW("Attempt to close invalid input stream");
+ } else {
+ mLock.unlock();
+ delete mInputs[index];
+ mLock.lock();
+ mInputs.removeAt(index);
+ }
+}
+
+status_t AudioHardware::setMode(int mode)
+{
+ status_t status = AudioHardwareBase::setMode(mode);
+ if (status == NO_ERROR) {
+ // make sure that doAudioRouteOrMute() is called by doRouting()
+ // even if the new device selected is the same as current one.
+ clearCurDevice();
+ }
+ return status;
+}
+
+bool AudioHardware::checkOutputStandby()
+{
+ if (mOutput)
+ if (!mOutput->checkStandby())
+ return false;
+
+ return true;
+}
+
+status_t AudioHardware::setMicMute(bool state)
+{
+ Mutex::Autolock lock(mLock);
+ return setMicMute_nosync(state);
+}
+
+// always call with mutex held
+status_t AudioHardware::setMicMute_nosync(bool state)
+{
+ if (mMicMute != state) {
+ mMicMute = state;
+ return doAudioRouteOrMute(SND_DEVICE_CURRENT);
+ }
+ return NO_ERROR;
+}
+
+status_t AudioHardware::getMicMute(bool* state)
+{
+ *state = mMicMute;
+ return NO_ERROR;
+}
+
+status_t AudioHardware::setParameters(const String8& keyValuePairs)
+{
+ AudioParameter param = AudioParameter(keyValuePairs);
+ String8 value;
+ String8 key;
+ const char BT_NREC_KEY[] = "bt_headset_nrec";
+ const char BT_NAME_KEY[] = "bt_headset_name";
+ const char BT_NREC_VALUE_ON[] = "on";
+
+
+ LOGV("setParameters() %s", keyValuePairs.string());
+
+ if (keyValuePairs.length() == 0) return BAD_VALUE;
+
+ key = String8(BT_NREC_KEY);
+ if (param.get(key, value) == NO_ERROR) {
+ if (value == BT_NREC_VALUE_ON) {
+ mBluetoothNrec = true;
+ } else {
+ mBluetoothNrec = false;
+ LOGI("Turning noise reduction and echo cancellation off for BT "
+ "headset");
+ }
+ }
+ key = String8(BT_NAME_KEY);
+ if (param.get(key, value) == NO_ERROR) {
+ mBluetoothId = 0;
+ for (int i = 0; i < mNumSndEndpoints; i++) {
+ if (!strcasecmp(value.string(), mSndEndpoints[i].name)) {
+ mBluetoothId = mSndEndpoints[i].id;
+ LOGI("Using custom acoustic parameters for %s", value.string());
+ break;
+ }
+ }
+ if (mBluetoothId == 0) {
+ LOGI("Using default acoustic parameters "
+ "(%s not in acoustic database)", value.string());
+ doRouting(NULL);
+ }
+ }
+
+ key = String8(DUALMIC_KEY);
+ if (param.get(key, value) == NO_ERROR) {
+ if (value == "true") {
+ mDualMicEnabled = true;
+ LOGI("DualMike feature Enabled");
+ } else {
+ mDualMicEnabled = false;
+ LOGI("DualMike feature Disabled");
+ }
+ doRouting(NULL);
+ }
+
+ key = String8(TTY_MODE_KEY);
+ if (param.get(key, value) == NO_ERROR) {
+ if (value == "full") {
+ mTtyMode = TTY_FULL;
+ } else if (value == "hco") {
+ mTtyMode = TTY_HCO;
+ } else if (value == "vco") {
+ mTtyMode = TTY_VCO;
+ } else {
+ mTtyMode = TTY_OFF;
+ }
+ } else {
+ mTtyMode = TTY_OFF;
+ }
+
+#ifdef HAVE_FM_RADIO
+ key = String8(AudioParameter::keyFmOn);
+ int devices;
+ if (param.getInt(key, devices) == NO_ERROR) {
+ setFmOnOff(true);
+ }
+ key = String8(AudioParameter::keyFmOff);
+ if (param.getInt(key, devices) == NO_ERROR) {
+ setFmOnOff(false);
+ }
+#endif
+
+ doRouting(NULL);
+
+ return NO_ERROR;
+}
+
+String8 AudioHardware::getParameters(const String8& keys)
+{
+ AudioParameter param = AudioParameter(keys);
+ String8 value;
+
+ String8 key = String8(DUALMIC_KEY);
+
+ if (param.get(key, value) == NO_ERROR) {
+ value = String8(mDualMicEnabled ? "true" : "false");
+ param.add(key, value);
+ }
+
+ LOGV("AudioHardware::getParameters() %s", param.toString().string());
+ return param.toString();
+}
+
+int check_and_set_audpp_parameters(char *buf, int size)
+{
+ char *p, *ps;
+ static const char *const seps = ",";
+ int table_num;
+ int i, j;
+ int device_id = 0;
+ int samp_index = 0;
+ eq_filter_type eq[12];
+ int fd;
+ void *audioeq;
+ void *(*eq_cal)(int32_t, int32_t, int32_t, uint16_t, int32_t, int32_t *, int32_t *, uint16_t *);
+ uint16_t numerator[6];
+ uint16_t denominator[4];
+ uint16_t shift[2];
+
+ if ((buf[0] == 'A') && ((buf[1] == '1') || (buf[1] == '2') || (buf[1] == '3'))) {
+ /* IIR filter */
+ if(buf[1] == '1') device_id=0;
+ if(buf[1] == '2') device_id=1;
+ if(buf[1] == '3') device_id=2;
+ if (!(p = strtok(buf, ",")))
+ goto token_err;
+
+ /* Table header */
+ table_num = strtol(p + 1, &ps, 10);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ /* Table description */
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ for (i = 0; i < 48; i++) {
+ iir_cfg[device_id].iir_params[i] = (uint16_t)strtol(p, &ps, 16);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ }
+ rx_iir_flag[device_id] = (uint16_t)strtol(p, &ps, 16);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ iir_cfg[device_id].num_bands = (uint16_t)strtol(p, &ps, 16);
+
+ } else if ((buf[0] == 'B') && ((buf[1] == '1') || (buf[1] == '2') || (buf[1] == '3'))) {
+ /* This is the ADRC record we are looking for. Tokenize it */
+ if(buf[1] == '1') device_id=0;
+ if(buf[1] == '2') device_id=1;
+ if(buf[1] == '3') device_id=2;
+ adrc_filter_exists[device_id] = true;
+ if (!(p = strtok(buf, ",")))
+ goto token_err;
+
+ /* Table header */
+ table_num = strtol(p + 1, &ps, 10);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ /* Table description */
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ adrc_flag[device_id] = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ adrc_cfg[device_id].adrc_params[0] = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ adrc_cfg[device_id].adrc_params[1] = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ adrc_cfg[device_id].adrc_params[2] = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ adrc_cfg[device_id].adrc_params[3] = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ adrc_cfg[device_id].adrc_params[4] = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ adrc_cfg[device_id].adrc_params[5] = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ adrc_cfg[device_id].adrc_params[6] = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ adrc_cfg[device_id].adrc_params[7] = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ } else if (buf[0] == 'C' && ((buf[1] == '1') || (buf[1] == '2') || (buf[1] == '3'))) {
+ /* This is the EQ record we are looking for. Tokenize it */
+ if(buf[1] == '1') device_id=0;
+ if(buf[1] == '2') device_id=1;
+ if(buf[1] == '3') device_id=2;
+ if (!(p = strtok(buf, ",")))
+ goto token_err;
+
+ /* Table header */
+ table_num = strtol(p + 1, &ps, 10);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ /* Table description */
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ eq_flag[device_id] = (uint16_t)strtol(p, &ps, 16);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ LOGI("EQ flag = %02x.", eq_flag[device_id]);
+
+ audioeq = ::dlopen("/system/lib/libaudioeq.so", RTLD_NOW);
+ if (audioeq == NULL) {
+ LOGE("audioeq library open failure");
+ return -1;
+ }
+ eq_cal = (void *(*) (int32_t, int32_t, int32_t, uint16_t, int32_t, int32_t *, int32_t *, uint16_t *))::dlsym(audioeq, "audioeq_calccoefs");
+ memset(&eqalizer[device_id], 0, sizeof(eqalizer));
+ /* Temp add the bands here */
+ eqalizer[device_id].bands = 8;
+ for (i = 0; i < eqalizer[device_id].bands; i++) {
+
+ eq[i].gain = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ eq[i].freq = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ eq[i].type = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ eq[i].qf = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ eq_cal(eq[i].gain, eq[i].freq, 48000, eq[i].type, eq[i].qf, (int32_t*)numerator, (int32_t *)denominator, shift);
+ for (j = 0; j < 6; j++) {
+ eqalizer[device_id].params[ ( i * 6) + j] = numerator[j];
+ }
+ for (j = 0; j < 4; j++) {
+ eqalizer[device_id].params[(eqalizer[device_id].bands * 6) + (i * 4) + j] = denominator[j];
+ }
+ eqalizer[device_id].params[(eqalizer[device_id].bands * 10) + i] = shift[0];
+ }
+ ::dlclose(audioeq);
+
+ } else if ((buf[0] == 'D') && ((buf[1] == '1') || (buf[1] == '2') || (buf[1] == '3'))) {
+ /* This is the MB_ADRC record we are looking for. Tokenize it */
+ if(buf[1] == '1') device_id=0;
+ if(buf[1] == '2') device_id=1;
+ if(buf[1] == '3') device_id=2;
+ mbadrc_filter_exists[device_id] = true;
+ if (!(p = strtok(buf, ",")))
+ goto token_err;
+ /* Table header */
+ table_num = strtol(p + 1, &ps, 10);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ /* Table description */
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ mbadrc_cfg[device_id].num_bands = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ mbadrc_cfg[device_id].down_samp_level = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ mbadrc_cfg[device_id].adrc_delay = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ mbadrc_cfg[device_id].ext_buf_size = (uint16_t)strtol(p, &ps, 16);
+ int ext_buf_count = mbadrc_cfg[device_id].ext_buf_size / 2;
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ mbadrc_cfg[device_id].ext_partition = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ mbadrc_cfg[device_id].ext_buf_msw = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ mbadrc_cfg[device_id].ext_buf_lsw = (uint16_t)strtol(p, &ps, 16);
+
+ for(i = 0;i < mbadrc_cfg[device_id].num_bands; i++) {
+ for(j = 0; j < 10; j++) {
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ mbadrc_cfg[device_id].adrc_band[i].adrc_band_params[j] = (uint16_t)strtol(p, &ps, 16);
+ }
+ }
+
+ for(i = 0;i < mbadrc_cfg[device_id].ext_buf_size/2; i++) {
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ mbadrc_cfg[device_id].ext_buf.buff[i] = (uint16_t)strtol(p, &ps, 16);
+ }
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ mbadrc_flag[device_id] = (uint16_t)strtol(p, &ps, 16);
+ LOGV("MBADRC flag = %02x.", mbadrc_flag[device_id]);
+ }else if ((buf[0] == 'E') || (buf[0] == 'F') || (buf[0] == 'G')){
+ //Pre-Processing Features TX_IIR,NS,AGC
+ switch (buf[1]) {
+ case '1':
+ samp_index = 0;
+ break;
+ case '2':
+ samp_index = 1;
+ break;
+ case '3':
+ samp_index = 2;
+ break;
+ case '4':
+ samp_index = 3;
+ break;
+ case '5':
+ samp_index = 4;
+ break;
+ case '6':
+ samp_index = 5;
+ break;
+ case '7':
+ samp_index = 6;
+ break;
+ case '8':
+ samp_index = 7;
+ break;
+ case '9':
+ samp_index = 8;
+ break;
+ default:
+ return -EINVAL;
+ break;
+ }
+
+ if (buf[0] == 'E') {
+ /* TX_IIR filter */
+ if (!(p = strtok(buf, ","))){
+ goto token_err;}
+
+ /* Table header */
+ table_num = strtol(p + 1, &ps, 10);
+ if (!(p = strtok(NULL, seps))){
+ goto token_err;}
+ /* Table description */
+ if (!(p = strtok(NULL, seps))){
+ goto token_err;}
+
+ for (i = 0; i < 48; i++) {
+ j = (i >= 40)? i : ((i % 2)? (i - 1) : (i + 1));
+ tx_iir_cfg[samp_index].iir_params[j] = (uint16_t)strtol(p, &ps, 16);
+ if (!(p = strtok(NULL, seps))){
+ goto token_err;}
+ }
+
+ tx_iir_cfg[samp_index].active_flag = (uint16_t)strtol(p, &ps, 16);
+ if (!(p = strtok(NULL, seps))){
+ goto token_err;}
+
+ txiir_flag[device_id] = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ tx_iir_cfg[samp_index].num_bands = (uint16_t)strtol(p, &ps, 16);
+
+ tx_iir_cfg[samp_index].cmd_id = 0;
+
+ LOGV("TX IIR flag = %02x.", txiir_flag[device_id]);
+ if (txiir_flag[device_id] != 0)
+ enable_preproc_mask |= TX_IIR_ENABLE;
+ } else if(buf[0] == 'F') {
+ /* AGC filter */
+ if (!(p = strtok(buf, ",")))
+ goto token_err;
+
+ /* Table header */
+ table_num = strtol(p + 1, &ps, 10);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ /* Table description */
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ tx_agc_cfg[samp_index].cmd_id = (uint16_t)strtol(p, &ps, 16);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ tx_agc_cfg[samp_index].tx_agc_param_mask = (uint16_t)strtol(p, &ps, 16);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ tx_agc_cfg[samp_index].tx_agc_enable_flag = (uint16_t)strtol(p, &ps, 16);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ tx_agc_cfg[samp_index].static_gain = (uint16_t)strtol(p, &ps, 16);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ tx_agc_cfg[samp_index].adaptive_gain_flag = (uint16_t)strtol(p, &ps, 16);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ for (i = 0; i < 19; i++) {
+ tx_agc_cfg[samp_index].agc_params[i] = (uint16_t)strtol(p, &ps, 16);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ }
+
+ agc_flag[device_id] = (uint16_t)strtol(p, &ps, 16);
+ LOGV("AGC flag = %02x.", agc_flag[device_id]);
+ if (agc_flag[device_id != 0])
+ enable_preproc_mask |= AGC_ENABLE;
+ } else if ((buf[0] == 'G')) {
+ /* This is the NS record we are looking for. Tokenize it */
+ if (!(p = strtok(buf, ",")))
+ goto token_err;
+
+ /* Table header */
+ table_num = strtol(p + 1, &ps, 10);
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+
+ /* Table description */
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ ns_cfg[samp_index].cmd_id = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ ns_cfg[samp_index].ec_mode_new = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ ns_cfg[samp_index].dens_gamma_n = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ ns_cfg[samp_index].dens_nfe_block_size = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ ns_cfg[samp_index].dens_limit_ns = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ ns_cfg[samp_index].dens_limit_ns_d = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ ns_cfg[samp_index].wb_gamma_e = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ ns_cfg[samp_index].wb_gamma_n = (uint16_t)strtol(p, &ps, 16);
+
+ if (!(p = strtok(NULL, seps)))
+ goto token_err;
+ ns_flag[device_id] = (uint16_t)strtol(p, &ps, 16);
+
+ LOGV("NS flag = %02x.", ns_flag[device_id]);
+ if (ns_flag[device_id] != 0)
+ enable_preproc_mask |= NS_ENABLE;
+ }
+ }
+ return 0;
+
+token_err:
+ LOGE("malformatted pcm control buffer");
+ return -EINVAL;
+}
+
+static int get_audpp_filter(void)
+{
+ struct stat st;
+ char *read_buf;
+ char *next_str, *current_str;
+ int csvfd;
+
+ LOGI("get_audpp_filter");
+ static const char *const path =
+ "/system/etc/AudioFilter.csv";
+ csvfd = open(path, O_RDONLY);
+ if (csvfd < 0) {
+ /* failed to open normal acoustic file ... */
+ LOGE("failed to open AUDIO_NORMAL_FILTER %s: %s (%d).",
+ path, strerror(errno), errno);
+ return -1;
+ } else LOGI("open %s success.", path);
+
+ if (fstat(csvfd, &st) < 0) {
+ LOGE("failed to stat %s: %s (%d).",
+ path, strerror(errno), errno);
+ close(csvfd);
+ return -1;
+ }
+
+ read_buf = (char *) mmap(0, st.st_size,
+ PROT_READ | PROT_WRITE,
+ MAP_PRIVATE,
+ csvfd, 0);
+
+ if (read_buf == MAP_FAILED) {
+ LOGE("failed to mmap parameters file: %s (%d)",
+ strerror(errno), errno);
+ close(csvfd);
+ return -1;
+ }
+
+ current_str = read_buf;
+
+ while (1) {
+ int len;
+ next_str = strchr(current_str, '\n');
+ if (!next_str)
+ break;
+ len = next_str - current_str;
+ *next_str++ = '\0';
+ if (check_and_set_audpp_parameters(current_str, len)) {
+ LOGI("failed to set audpp parameters, exiting.");
+ munmap(read_buf, st.st_size);
+ close(csvfd);
+ return -1;
+ }
+ current_str = next_str;
+ }
+
+ munmap(read_buf, st.st_size);
+ close(csvfd);
+ return 0;
+}
+
+static int msm72xx_enable_postproc(bool state)
+{
+ int fd;
+ int device_id=0;
+
+ if (!audpp_filter_inited)
+ {
+ LOGE("Parsing error in AudioFilter.csv.");
+ return -EINVAL;
+ }
+ if(snd_device < 0) {
+ LOGE("Enabling/Disabling post proc features for device: %d", snd_device);
+ return -EINVAL;
+ }
+
+ if(snd_device == SND_DEVICE_SPEAKER)
+ {
+ device_id = 0;
+ LOGI("set device to SND_DEVICE_SPEAKER device_id=0");
+ }
+ if(snd_device == SND_DEVICE_HANDSET)
+ {
+ device_id = 1;
+ LOGI("set device to SND_DEVICE_HANDSET device_id=1");
+ }
+ if(snd_device == SND_DEVICE_HEADSET)
+ {
+ device_id = 2;
+ LOGI("set device to SND_DEVICE_HEADSET device_id=2");
+ }
+
+ fd = open(PCM_CTL_DEVICE, O_RDWR);
+ if (fd < 0) {
+ LOGE("Cannot open PCM Ctl device");
+ return -EPERM;
+ }
+
+ if(mbadrc_filter_exists[device_id] && state)
+ {
+ LOGV("MBADRC Enabled");
+ post_proc_feature_mask &= ADRC_DISABLE;
+ if ((mbadrc_flag[device_id] == 0) && (post_proc_feature_mask & MBADRC_ENABLE))
+ {
+ LOGV("MBADRC Disable");
+ post_proc_feature_mask &= MBADRC_DISABLE;
+ }
+ else if(post_proc_feature_mask & MBADRC_ENABLE)
+ {
+ LOGV("MBADRC Enabled %d", post_proc_feature_mask);
+
+ if (ioctl(fd, AUDIO_SET_MBADRC, &mbadrc_cfg[device_id]) < 0)
+ {
+ LOGE("set mbadrc filter error");
+ }
+ }
+ }
+ else if (adrc_filter_exists[device_id] && state)
+ {
+ post_proc_feature_mask &= MBADRC_DISABLE;
+ LOGV("ADRC Enabled %d", post_proc_feature_mask);
+
+ if (adrc_flag[device_id] == 0 && (post_proc_feature_mask & ADRC_ENABLE))
+ post_proc_feature_mask &= ADRC_DISABLE;
+ else if(post_proc_feature_mask & ADRC_ENABLE)
+ {
+ LOGI("ADRC Filter ADRC FLAG = %02x.", adrc_flag[device_id]);
+ LOGI("ADRC Filter COMP THRESHOLD = %02x.", adrc_cfg[device_id].adrc_params[0]);
+ LOGI("ADRC Filter COMP SLOPE = %02x.", adrc_cfg[device_id].adrc_params[1]);
+ LOGI("ADRC Filter COMP RMS TIME = %02x.", adrc_cfg[device_id].adrc_params[2]);
+ LOGI("ADRC Filter COMP ATTACK[0] = %02x.", adrc_cfg[device_id].adrc_params[3]);
+ LOGI("ADRC Filter COMP ATTACK[1] = %02x.", adrc_cfg[device_id].adrc_params[4]);
+ LOGI("ADRC Filter COMP RELEASE[0] = %02x.", adrc_cfg[device_id].adrc_params[5]);
+ LOGI("ADRC Filter COMP RELEASE[1] = %02x.", adrc_cfg[device_id].adrc_params[6]);
+ LOGI("ADRC Filter COMP DELAY = %02x.", adrc_cfg[device_id].adrc_params[7]);
+ if (ioctl(fd, AUDIO_SET_ADRC, &adrc_cfg[device_id]) < 0)
+ {
+ LOGE("set adrc filter error.");
+ }
+ }
+ }
+ else
+ {
+ LOGV("MBADRC and ADRC Disabled");
+ post_proc_feature_mask &= (MBADRC_DISABLE | ADRC_DISABLE);
+ }
+
+ if (eq_flag[device_id] == 0 && (post_proc_feature_mask & EQ_ENABLE))
+ post_proc_feature_mask &= EQ_DISABLE;
+ else if ((post_proc_feature_mask & EQ_ENABLE) && state)
+ {
+ LOGI("Setting EQ Filter");
+ if (ioctl(fd, AUDIO_SET_EQ, &eqalizer[device_id]) < 0) {
+ LOGE("set Equalizer error.");
+ }
+ }
+
+ if (rx_iir_flag[device_id] == 0 && (post_proc_feature_mask & RX_IIR_ENABLE))
+ post_proc_feature_mask &= RX_IIR_DISABLE;
+ else if ((post_proc_feature_mask & RX_IIR_ENABLE)&& state)
+ {
+ LOGI("IIR Filter FLAG = %02x.", rx_iir_flag[device_id]);
+ LOGI("IIR NUMBER OF BANDS = %02x.", iir_cfg[device_id].num_bands);
+ LOGI("IIR Filter N1 = %02x.", iir_cfg[device_id].iir_params[0]);
+ LOGI("IIR Filter N2 = %02x.", iir_cfg[device_id].iir_params[1]);
+ LOGI("IIR Filter N3 = %02x.", iir_cfg[device_id].iir_params[2]);
+ LOGI("IIR Filter N4 = %02x.", iir_cfg[device_id].iir_params[3]);
+ LOGI("IIR FILTER M1 = %02x.", iir_cfg[device_id].iir_params[24]);
+ LOGI("IIR FILTER M2 = %02x.", iir_cfg[device_id].iir_params[25]);
+ LOGI("IIR FILTER M3 = %02x.", iir_cfg[device_id].iir_params[26]);
+ LOGI("IIR FILTER M4 = %02x.", iir_cfg[device_id].iir_params[27]);
+ LOGI("IIR FILTER M16 = %02x.", iir_cfg[device_id].iir_params[39]);
+ LOGI("IIR FILTER SF1 = %02x.", iir_cfg[device_id].iir_params[40]);
+ if (ioctl(fd, AUDIO_SET_RX_IIR, &iir_cfg[device_id]) < 0)
+ {
+ LOGE("set rx iir filter error.");
+ }
+ }
+
+ if(state){
+ LOGI("Enabling post proc features with mask 0x%04x", post_proc_feature_mask);
+ if (ioctl(fd, AUDIO_ENABLE_AUDPP, &post_proc_feature_mask) < 0) {
+ LOGE("enable audpp error");
+ close(fd);
+ return -EPERM;
+ }
+ } else{
+ int disable_mask = 0;
+
+ if(post_proc_feature_mask & MBADRC_ENABLE) disable_mask |= MBADRC_DISABLE;
+ if(post_proc_feature_mask & ADRC_ENABLE) disable_mask |= ADRC_DISABLE;
+ if(post_proc_feature_mask & EQ_ENABLE) disable_mask |= EQ_DISABLE;
+ if(post_proc_feature_mask & RX_IIR_ENABLE) disable_mask |= RX_IIR_DISABLE;
+
+ LOGI("disabling post proc features with mask 0x%04x", post_proc_feature_mask);
+ if (ioctl(fd, AUDIO_ENABLE_AUDPP, &disable_mask) < 0) {
+ LOGE("enable audpp error");
+ close(fd);
+ return -EPERM;
+ }
+ }
+
+ close(fd);
+ return 0;
+}
+
+static unsigned calculate_audpre_table_index(unsigned index)
+{
+ switch (index) {
+ case 48000: return SAMP_RATE_INDX_48000;
+ case 44100: return SAMP_RATE_INDX_44100;
+ case 32000: return SAMP_RATE_INDX_32000;
+ case 24000: return SAMP_RATE_INDX_24000;
+ case 22050: return SAMP_RATE_INDX_22050;
+ case 16000: return SAMP_RATE_INDX_16000;
+ case 12000: return SAMP_RATE_INDX_12000;
+ case 11025: return SAMP_RATE_INDX_11025;
+ case 8000: return SAMP_RATE_INDX_8000;
+ default: return -1;
+ }
+}
+size_t AudioHardware::getInputBufferSize(uint32_t sampleRate, int format, int channelCount)
+{
+ if ( (format != AudioSystem::PCM_16_BIT) &&
+ (format != AudioSystem::AMR_NB) &&
+ (format != AudioSystem::AAC)){
+ LOGW("getInputBufferSize bad format: 0x%x", format);
+ return 0;
+ }
+ if (channelCount < 1 || channelCount > 2) {
+ LOGW("getInputBufferSize bad channel count: %d", channelCount);
+ return 0;
+ }
+
+ if(format == AudioSystem::AMR_NB)
+ return 320*channelCount;
+ else if (format == AudioSystem::AAC)
+ return 2048;
+ else
+ return 2048*channelCount;
+}
+
+static status_t set_volume_rpc(uint32_t device,
+ uint32_t method,
+ uint32_t volume,
+ int m7xsnddriverfd)
+{
+#if LOG_SND_RPC
+ LOGD("rpc_snd_set_volume(%d, %d, %d)\n", device, method, volume);
+#endif
+
+ if (device == -1UL) return NO_ERROR;
+
+ if (m7xsnddriverfd < 0) {
+ LOGE("Can not open snd device");
+ return -EPERM;
+ }
+ /* rpc_snd_set_volume(
+ * device, # Any hardware device enum, including
+ * # SND_DEVICE_CURRENT
+ * method, # must be SND_METHOD_VOICE to do anything useful
+ * volume, # integer volume level, in range [0,5].
+ * # note that 0 is audible (not quite muted)
+ * )
+ * rpc_snd_set_volume only works for in-call sound volume.
+ */
+ struct msm_snd_volume_config args;
+ args.device = device;
+ args.method = method;
+ args.volume = volume;
+
+ if (ioctl(m7xsnddriverfd, SND_SET_VOLUME, &args) < 0) {
+ LOGE("snd_set_volume error.");
+ return -EIO;
+ }
+ return NO_ERROR;
+}
+
+status_t AudioHardware::setVoiceVolume(float v)
+{
+ if (v < 0.0) {
+ LOGW("setVoiceVolume(%f) under 0.0, assuming 0.0\n", v);
+ v = 0.0;
+ } else if (v > 1.0) {
+ LOGW("setVoiceVolume(%f) over 1.0, assuming 1.0\n", v);
+ v = 1.0;
+ }
+
+ int vol = lrint(v * 7.0);
+ LOGD("setVoiceVolume(%f)\n", v);
+ LOGI("Setting in-call volume to %d (available range is 0 to 7)\n", vol);
+
+ if ((mCurSndDevice != -1) && ((mCurSndDevice == SND_DEVICE_TTY_HEADSET) || (mCurSndDevice == SND_DEVICE_TTY_VCO)))
+ {
+ vol = 1;
+ LOGI("For TTY device in FULL or VCO mode, the volume level is set to: %d \n", vol);
+ }
+
+ Mutex::Autolock lock(mLock);
+ set_volume_rpc(SND_DEVICE_CURRENT, SND_METHOD_VOICE, vol, m7xsnddriverfd);
+ return NO_ERROR;
+}
+
+status_t AudioHardware::setMasterVolume(float v)
+{
+ Mutex::Autolock lock(mLock);
+ int vol = ceil(v * 7.0);
+ LOGI("Set master volume to %d.\n", vol);
+ set_volume_rpc(SND_DEVICE_HANDSET, SND_METHOD_VOICE, vol, m7xsnddriverfd);
+ set_volume_rpc(SND_DEVICE_SPEAKER, SND_METHOD_VOICE, vol, m7xsnddriverfd);
+ set_volume_rpc(SND_DEVICE_BT, SND_METHOD_VOICE, vol, m7xsnddriverfd);
+ set_volume_rpc(SND_DEVICE_HEADSET, SND_METHOD_VOICE, vol, m7xsnddriverfd);
+ set_volume_rpc(SND_DEVICE_IN_S_SADC_OUT_HANDSET, SND_METHOD_VOICE, vol, m7xsnddriverfd);
+ set_volume_rpc(SND_DEVICE_IN_S_SADC_OUT_SPEAKER_PHONE, SND_METHOD_VOICE, vol, m7xsnddriverfd);
+ // We return an error code here to let the audioflinger do in-software
+ // volume on top of the maximum volume that we set through the SND API.
+ // return error - software mixer will handle it
+ return -1;
+}
+
+#ifdef HAVE_FM_RADIO
+status_t AudioHardware::setFmOnOff(bool onoff)
+{
+ int ret;
+
+ if (onoff) {
+ mFmRadioEnabled = true;
+ } else {
+ mFmRadioEnabled = false;
+ }
+
+ return NO_ERROR;
+}
+#endif
+
+static status_t do_route_audio_rpc(uint32_t device,
+ bool ear_mute, bool mic_mute, int m7xsnddriverfd)
+{
+ if (device == -1UL)
+ return NO_ERROR;
+
+#if LOG_SND_RPC
+ LOGD("rpc_snd_set_device(%d, %d, %d)\n", device, ear_mute, mic_mute);
+#endif
+
+ if (m7xsnddriverfd < 0) {
+ LOGE("Can not open snd device");
+ return -EPERM;
+ }
+ // RPC call to switch audio path
+ /* rpc_snd_set_device(
+ * device, # Hardware device enum to use
+ * ear_mute, # Set mute for outgoing voice audio
+ * # this should only be unmuted when in-call
+ * mic_mute, # Set mute for incoming voice audio
+ * # this should only be unmuted when in-call or
+ * # recording.
+ * )
+ */
+ struct msm_snd_device_config args;
+ args.device = device;
+ args.ear_mute = ear_mute ? SND_MUTE_MUTED : SND_MUTE_UNMUTED;
+ if((device != SND_DEVICE_CURRENT) && (!mic_mute)) {
+ //Explicitly mute the mic to release DSP resources
+ args.mic_mute = SND_MUTE_MUTED;
+ if (ioctl(m7xsnddriverfd, SND_SET_DEVICE, &args) < 0) {
+ LOGE("snd_set_device error.");
+ return -EIO;
+ }
+ }
+ args.mic_mute = mic_mute ? SND_MUTE_MUTED : SND_MUTE_UNMUTED;
+
+ if (ioctl(m7xsnddriverfd, SND_SET_DEVICE, &args) < 0) {
+ LOGE("snd_set_device error.");
+ return -EIO;
+ }
+
+ return NO_ERROR;
+}
+
+// always call with mutex held
+status_t AudioHardware::doAudioRouteOrMute(uint32_t device)
+{
+#if 0
+ if (device == (uint32_t)SND_DEVICE_BT || device == (uint32_t)SND_DEVICE_CARKIT) {
+ if (mBluetoothId) {
+ device = mBluetoothId;
+ } else if (!mBluetoothNrec) {
+ device = SND_DEVICE_BT_EC_OFF;
+ }
+ }
+#endif
+ /* QCOM caveat: Audio will be routed to speaker if device=handset and mute=true */
+ /* Also, the audio circuit causes battery drain unless mute=true */
+ /* Android < 2.0 uses MODE_IN_CALL for routing audio to earpiece */
+ /* Android >= 2.0 advises to use STREAM_VOICE_CALL streams and setSpeakerphoneOn() */
+ /* Android >= 2.3 uses MODE_IN_COMMUNICATION for SIP calls */
+ bool mute = !isInCall();
+ if(mute && (device == SND_DEVICE_HANDSET)) {
+ /* workaround to emulate Android >= 2.0 behaviour */
+ /* enable routing to earpiece (unmute) if mic is selected as input */
+ mute = !mBuiltinMicSelected;
+ }
+
+ mFmPrev=mFmRadioEnabled;
+#ifdef HAVE_FM_RADIO
+ if(mFmRadioEnabled) {
+ mute = 0;
+ LOGI("unmute for radio");
+ }
+#endif
+ LOGD("doAudioRouteOrMute() device %x, mMode %d, mMicMute %d, mBuiltinMicSelected %d, %s",
+ device, mMode, mMicMute, mBuiltinMicSelected, mute ? "muted" : "audio circuit active");
+ return do_route_audio_rpc(device, mute, mMicMute, m7xsnddriverfd);
+
+}
+
+status_t AudioHardware::doRouting(AudioStreamInMSM72xx *input)
+{
+ /* currently this code doesn't work without the htc libacoustic */
+
+ Mutex::Autolock lock(mLock);
+ uint32_t outputDevices = mOutput->devices();
+ status_t ret = NO_ERROR;
+ int new_snd_device = -1;
+ int new_post_proc_feature_mask = 0;
+
+ //int (*msm72xx_enable_audpp)(int);
+ //msm72xx_enable_audpp = (int (*)(int))::dlsym(acoustic, "msm72xx_enable_audpp");
+
+ if (input != NULL) {
+ uint32_t inputDevice = input->devices();
+ LOGI("do input routing device %x\n", inputDevice);
+ mBuiltinMicSelected = (inputDevice == AudioSystem::DEVICE_IN_BUILTIN_MIC);
+ // ignore routing device information when we start a recording in voice
+ // call
+ // Recording will happen through currently active tx device
+ if(inputDevice == AudioSystem::DEVICE_IN_VOICE_CALL)
+ return NO_ERROR;
+ if (inputDevice != 0) {
+ if (inputDevice & AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET) {
+ LOGI("Routing audio to Bluetooth PCM\n");
+ new_snd_device = SND_DEVICE_BT;
+ } else if (inputDevice & AudioSystem::DEVICE_IN_WIRED_HEADSET) {
+ LOGI("Routing audio to Wired Headset\n");
+ new_snd_device = SND_DEVICE_HEADSET;
+ } else {
+ if (outputDevices & AudioSystem::DEVICE_OUT_SPEAKER) {
+ LOGI("Routing audio to Speakerphone\n");
+ new_snd_device = SND_DEVICE_SPEAKER;
+ new_post_proc_feature_mask = (ADRC_ENABLE | EQ_ENABLE | RX_IIR_ENABLE | MBADRC_ENABLE);
+ } else {
+ LOGI("Routing audio to Handset\n");
+ new_snd_device = SND_DEVICE_HANDSET;
+ }
+ }