sm7125-common: Add NFC support for RU/EU variants

Signed-off-by: SagarMakhar <sagarmakhar@gmail.com>
This commit is contained in:
SagarMakhar
2021-08-02 16:29:20 +00:00
parent 791c1f3ea5
commit f901d6f762
13 changed files with 198 additions and 1 deletions

View File

@@ -86,6 +86,9 @@ TARGET_SURFACEFLINGER_FOD_LIB := //$(COMMON_PATH):libfod_extension.realme_sm7125
DEVICE_MANIFEST_FILE := $(COMMON_PATH)/manifest.xml
DEVICE_MATRIX_FILE := $(COMMON_PATH)/compatibility_matrix.xml
ODM_MANIFEST_SKUS += nfc
ODM_MANIFEST_NFC_FILES := $(COMMON_PATH)/manifest_nfc.xml
# Init
TARGET_INIT_VENDOR_LIB := //$(COMMON_PATH):libinit_realme_sm7125
TARGET_RECOVERY_DEVICE_MODULES := libinit_realme_sm7125
@@ -149,6 +152,7 @@ BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_ODMIMAGE_FILE_SYSTEM_TYPE := ext4
ifneq ($(WITH_GAPPS),true)

View File

@@ -238,6 +238,19 @@ PRODUCT_PACKAGES += \
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.ipsec_tunnels.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.ipsec_tunnels.xml
# NFC
PRODUCT_PACKAGES += \
android.hardware.nfc@1.2-service \
com.android.nfc_extras \
NfcNci \
android.hardware.secure_element@1.0-service-disabled \
SecureElement \
Tag
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/nfc/libese-nxp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libese-nxp.conf \
$(LOCAL_PATH)/configs/nfc/nfc_features.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc/nfc_features.xml
# Overlays
DEVICE_PACKAGE_OVERLAYS += \
$(LOCAL_PATH)/overlay \

38
configs/nfc/libese-nxp.conf Executable file
View File

@@ -0,0 +1,38 @@
##This file needs to be pushed into /vendor/etc/libese-nxp.conf
###############################################################################
# Application options
SE_DEBUG_ENABLED=1
#Timeout in secs
NXP_SWP_RD_TAG_OP_TIMEOUT=0xFF
#WTX Count in secs
NXP_WTX_COUNT_VALUE=9000
# PN67T_PWR_SCHEME 0x01
# PN80T_LEGACY_PWR_SCHEME 0x02
# PN80T_EXT_PMU_SCHEME 0x03
NXP_POWER_SCHEME=0x02
# For SOF = 0x5A 0x01
# For SOF = 0x00 0x02
NXP_SOF_WRITE=0x01
#SPI Thorughput measurement log enabled(1)/disabled(0) in kernel
NXP_TP_MEASUREMENT=0x00
#Enable/Disable interface reset as part of SPI open
NXP_SPI_INTF_RST_ENABLE=0x01
###############################################################################
# SPI WRITE TIMEOUT for RF event synchronization
NXP_SPI_WRITE_TIMEOUT=0x14
###############################################################################
# SPI Device Node name
NXP_ESE_DEV_NODE="/dev/nq-nci"
#MAX NO OF R_NACK RETRY ALLOWED IN CASE OF CRC FAILURE
NXP_MAX_RNACK_RETRY=0x0A

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<!-- Devices that support MIFARE need to declare NXP's feature constant -->
<feature name="com.nxp.mifare" />
<!-- This feature indicates that the device supports host-based
NFC card emulation -->
<feature name="android.hardware.nfc.hce" />
<!-- This feature indicates that the device supports host-based
NFC-F card emulation -->
<feature name="android.hardware.nfc.hcef" />
<!-- This is the standard feature indicating that the device can communicate
using Near-Field Communications (NFC). -->
<feature name="android.hardware.nfc" />
<feature name="android.hardware.nfc.any" />
<feature name="android.sofware.nfc.beam" />
<feature name="android.hardware.nfc.uicc" />
<feature name="android.hardware.nfc.ese" />
<feature name="android.hardware.se.omapi.uicc" />
<feature name="android.hardware.se.omapi.ese" />
<library name="com.nxp.nfc"
file="/system/framework/com.nxp.nfc.jar" />
<library name="com.android.nfc_extras"
file="/system/framework/com.android.nfc_extras.jar" />
</permissions>

View File

@@ -42,6 +42,8 @@
#include "vendor_init.h"
#include "property_service.h"
#define PROC_NFC_CHIPSET "/proc/oppo_nfc/chipset"
using android::base::GetProperty;
using std::string;
@@ -55,6 +57,21 @@ void property_override(string prop, string value)
__system_property_add(prop.c_str(), prop.size(), value.c_str(), value.size());
}
void check_nfc_support()
{
std::ifstream procfile(PROC_NFC_CHIPSET);
std::string chipset;
getline(procfile, chipset);
LOG(INFO) << "oppo_nfc : chipset " << chipset;
if (chipset != "NULL") {
property_override("ro.boot.product.hardware.sku", "nfc");
}
}
void vendor_load_properties()
{
check_nfc_support();
}

34
manifest_nfc.xml Normal file
View File

@@ -0,0 +1,34 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>android.hardware.nfc</name>
<transport>hwbinder</transport>
<version>1.2</version>
<interface>
<name>INfc</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.secure_element</name>
<transport>hwbinder</transport>
<fqname>@1.0::ISecureElement/eSE1</fqname>
</hal>
<hal format="hidl">
<name>vendor.nxp.nxpnfc</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>INxpNfc</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>vendor.nxp.nxpese</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>INxpEse</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

View File

@@ -813,6 +813,46 @@ vendor/lib64/unnhal-acc-common.so
vendor/lib64/unnhal-acc-hta.so
vendor/lib64/unnhal-acc-hvx.so
# NFC
odm/bin/opnscr
odm/etc/init/init.SN100x.nfc.rc
vendor/etc/libnfc-nci.conf
odm/etc/libnfc-nxp-pnscr.conf
odm/etc/libnfc-nxp-pnscr.conf:odm/etc/libnfc-nxp.conf
odm/etc/libnfc-nxp-pnscr.conf:vendor/etc/libnfc-nxp.conf
odm/etc/nfc/cxd225x_firmware.bin_cxd225x
odm/etc/nfc/libnfc-mtp-SN100.conf_206B3
odm/etc/nfc/libnfc-nci.conf_206B3
odm/etc/nfc/nfc_chipset_ref
odm/etc/nfc/nfc_conf_ref
odm/etc/nfc/nfc_fw_ref
odm/etc/nfc/sn100u.bin_sn100t_fw_01_10_53
odm/etc/nfc/sn100u.bin_sn100t_fw_01_10_57
odm/etc/nfc/st21nfc_fw.bin_st21h
odm/etc/nfc/st21nfc_fw7.bin_st21h
odm/etc/sn100u_bootup.pnscr
odm/etc/sn100u_ese_disableIso.pnscr
odm/etc/sn100u_ese_disableIsoRead.pnscr
odm/etc/sn100u_nfcon.pnscr
odm/etc/sn100u_pnx_chr.pnscr
odm/etc/sn100u_pnx_cui.pnscr
odm/etc/sn100u_pnx_ese_3.pnscr
odm/etc/sn100u_pnx_ese_aclog.pnscr
odm/etc/sn100u_pnx_ese_cplc.pnscr
odm/etc/sn100u_pnx_ese_fabkey.pnscr
odm/etc/sn100u_pnx_ese_free.pnscr
odm/etc/sn100u_pnx_ese_keyset.pnscr
odm/etc/sn100u_pnx_ese_sn.pnscr
odm/etc/sn100u_pnx_ndi.pnscr
odm/etc/sn100u_pnx_pcv.pnscr
odm/etc/sn100u_pnx_spc.pnscr
odm/etc/sn100u_pnx_sst.pnscr
odm/lib/libpn553_fw.so
odm/lib/libpn557_fw.so
odm/lib/libpnscr2.so
odm/lib/libsn100u_fw.so
odm/lib64/libpnscr2.so
# Oppo Init rc
odm/etc/init/init.network.rc
odm/etc/init/init.oppo.reserve.rc

View File

@@ -13,3 +13,14 @@ on boot
# OTG
chown system system /sys/class/power_supply/usb/otg_switch
chmod 0644 /sys/class/power_supply/usb/otg_switch
on property:ro.boot.product.hardware.sku=nfc
start secure_element_hal_service
start vendor.nfc_hal_service
service vendor.nfc_hal_service /vendor/bin/hw/android.hardware.nfc@1.2-service
override
disabled
class hal
user nfc
group nfc

View File

@@ -51,3 +51,6 @@
/sys/devices/platform/soc/aae0000.qcom,venus/subsys[0-9]/restart_level u:object_r:vendor_sysfs_ssr_toggle:s0
/sys/devices/platform/soc/soc:qcom,ipa_fws/subsys[0-9]/restart_level u:object_r:vendor_sysfs_ssr_toggle:s0
/sys/devices/platform/soc/soc:qcom,kgsl-hyp/subsys[0-9]/restart_level u:object_r:vendor_sysfs_ssr_toggle:s0
# SecureElement
/(vendor|odm)/bin/hw/android\.hardware\.secure_element@1\.0-service-disabled u:object_r:hal_secure_element_default_exec:s0

2
sepolicy/vendor/hal_nfc_default.te vendored Normal file
View File

@@ -0,0 +1,2 @@
allow hal_nfc_default nfc_hwservice:hwservice_manager { find add };
binder_call(hal_nfc_default, hal_secure_element_default)

View File

@@ -1 +1,2 @@
add_hwservice(hal_secure_element_default, nfc_hwservice);
allow hal_secure_element_default nfc_hwservice:hwservice_manager { find add };
binder_call(hal_secure_element_default, nfc_hwservice)

View File

@@ -91,6 +91,10 @@ vendor.mm.enable.qcom_parser=131071983
# Netflix
ro.netflix.bsp_rev=Q6250-19132-1
# NFC
persist.nfc.smartcard.recorder.enable=true
ro.nfc.port=I2C
# Perf
ro.vendor.qti.sys.fw.bservice_enable=true

View File

@@ -142,6 +142,12 @@ debug.stagefright.ccodec=1
debug.stagefright.omx_default_rank=0
drm.service.enabled=true
# NFC
persist.sys.nfc.disPowerSave=1
ro.camera.notify_nfc=1
persist.sys.nfc.aid_overflow=true
ro.hardware.nfc_nci=nqx.default
# PASR
vendor.power.pasr.enabled=true