diff --git a/oriole/hdf_config/khdf/device_info/device_info.hcs b/oriole/hdf_config/khdf/device_info/device_info.hcs index 06315f6483778ae3184a9faad89b6de42eb63b98..24001f0ababc2d2996e5c4a2a07e47285798735d 100644 --- a/oriole/hdf_config/khdf/device_info/device_info.hcs +++ b/oriole/hdf_config/khdf/device_info/device_info.hcs @@ -470,6 +470,17 @@ deviceMatchAttr = "hdf_sensor_magnetic_lsm303_driver"; } } + device_sensor_mmc5603nj :: device { + device0 :: deviceNode { + policy = 1; + priority = 120; + preload = 0; + permission = 0664; + moduleName = "HDF_SENSOR_MAGNETIC_MMC5603NJ"; + serviceName = "hdf_magnetic_mmc5603nj"; + deviceMatchAttr = "hdf_sensor_magnetic_mmc5603nj_driver"; + } + } } usb_pnp_linux :: host { hostName = "usb_pnp_linux_host"; diff --git a/oriole/hdf_config/khdf/sensor/magnetic/magnetic_mmc5603nj_config.hcs b/oriole/hdf_config/khdf/sensor/magnetic/magnetic_mmc5603nj_config.hcs new file mode 100644 index 0000000000000000000000000000000000000000..d0b1bda452de5801d8800b1a47626bb9032f4c2a --- /dev/null +++ b/oriole/hdf_config/khdf/sensor/magnetic/magnetic_mmc5603nj_config.hcs @@ -0,0 +1,70 @@ +#include "../sensor_common.hcs" +root { + magnetic_mmc5603nj_chip_config : sensorConfig { + match_attr = "hdf_sensor_magnetic_mmc5603nj_driver"; + sensorInfo :: sensorDeviceInfo { + sensorName = "magnetometer"; + vendorName = "memsic_mmc5603nj"; // max string length is 16 bytes + sensorTypeId = 6; // enum SensorTypeTag + sensorId = 6; // user define sensor id + power = 110; + } + sensorBusConfig :: sensorBusInfo { + busType = 0; // 0:i2c 1:spi + busNum = 7; + busAddr = 0x30; + regWidth = 1; // 1byte + } + sensorIdAttr :: sensorIdInfo { + chipName = "mmc5603nj"; + chipIdRegister = 0x39; + chipIdValue = 0x10; + } + sensorDirection { + direction = 1; // chip direction range of value:0-7 + /* 1:negative 0:positive + 0:AXIS_X 1:AXIS_Y 2:AXIS_Z + */ + /* sign[AXIS_X], sign[AXIS_Y], sign[AXIS_Z], map[AXIS_X], map[AXIS_Y], map[AXIS_Z] */ + convert = [ + 0, 0, 0, 0, 1, 2, + 1, 0, 0, 1, 0, 2, + 0, 0, 1, 0, 1, 2, + 0, 1, 0, 1, 0, 2, + 1, 0, 1, 0, 1, 2, + 0, 0, 1, 1, 0, 2, + 0, 1, 1, 0, 1, 2, + 1, 1, 1, 1, 0, 2 + ]; + } + sensorRegConfig { + /* regAddr: register address + value: config register value + len: size of value + mask: mask of value + delay: config register delay time (ms) + opsType: enum SensorOpsType 0-none 1-read 2-write 3-read_check 4-update_bit + calType: enum SensorBitCalType 0-none 1-set 2-revert 3-xor 4-left shift 5-right shift + shiftNum: shift bits + debug: 0-no debug 1-debug + save: 0-no save 1-save + */ + /* regAddr, value, mask, len, delay, opsType, calType, shiftNum, debug, save */ + initSeqConfig = [ + 0x1E, 0x76, 0xff, 1, 5, 2, 0, 0, 0, 0, + 0x1F, 0x13, 0xff, 1, 5, 2, 0, 0, 0, 0, + 0x20, 0x3C, 0xff, 1, 5, 2, 0, 0, 0, 0 + + ]; + enableSeqConfig = [ + 0x1C, 0x01, 0xff, 1, 5, 2, 0, 0, 0, 0, + 0x1A, 0x78, 0xff, 1, 5, 2, 0, 0, 0, 0, + 0x1B, 0xA0, 0xff, 1, 5, 2, 0, 0, 0, 0, + 0x1D, 0x10, 0xff, 1, 5, 2, 0, 0, 0, 0 + ]; + disableSeqConfig = [ + 0x1D, 0x00, 0xff, 1, 5, 2, 0, 0, 0, 0 + ]; + } + } +} \ No newline at end of file diff --git a/oriole/hdf_config/khdf/sensor/sensor_config.hcs b/oriole/hdf_config/khdf/sensor/sensor_config.hcs index d27c7f7d71e78145ec1caf4662b6c6e966c9dd0e..8564e057d83ab27fc7329f74e6a0177ea075ac6b 100644 --- a/oriole/hdf_config/khdf/sensor/sensor_config.hcs +++ b/oriole/hdf_config/khdf/sensor/sensor_config.hcs @@ -4,3 +4,4 @@ #include "als/bh1745_config.hcs" #include "proximity/proximity_apds9960_config.hcs" #include "magnetic/magnetic_lsm303_config.hcs" +#include "magnetic/magnetic_mmc5603nj_config.hcs" diff --git a/oriole/patch.yml b/oriole/patch.yml index 9d00c0e23b9a53429214fcfc4448d68d57d90fb7..97e7f1c055fcf39557dfdaaa72a45d4c225e7d5c 100644 --- a/oriole/patch.yml +++ b/oriole/patch.yml @@ -9,6 +9,7 @@ drivers/hdf_core: - device/soc/spreadtrum/patches/drivers/hdf_core/0002-hdf_core.patch - device/soc/spreadtrum/patches/drivers/hdf_core/0003-del-DevHostServiceFreeInstance.patch - device/soc/spreadtrum/patches/drivers/hdf_core/0004-add-sensor-sc7a20e.patch + - device/soc/spreadtrum/patches/drivers/hdf_core/0005-add-mag-sensor.patch drivers/peripheral: # - device/soc/spreadtrum/patches/drivers/peripheral/0001-update-location-vintf.patch @@ -18,6 +19,7 @@ drivers/peripheral: - device/soc/spreadtrum/patches/drivers/peripheral/0005-update-base-codec-display.patch - device/soc/spreadtrum/patches/drivers/peripheral/0006-add-sensor-sc7a20e.patch - device/soc/spreadtrum/patches/drivers/peripheral/0007-add-custom-vibrator-driver-path.patch + - device/soc/spreadtrum/patches/drivers/peripheral/0008-add-mag-sensor.patch # base/security/code_signature: # - device/soc/spreadtrum/patches/base/security/code_signature/0001-code_signature.patch