﻿//=================================================================================================
// KBC Version: 	00.06.18
// Date:		2025/06/27
// Base:		v000617
//=================================================================================================
1. Modify PD port stop power-sharing when PD adapter only.

//=================================================================================================
// KBC Version: 	00.06.17
// Date:		2025/01/09
// Base:		v000616
//=================================================================================================
1. Added Thunderbolt Charging function.
   In battery mode, the Thunderbolt port will not charge the device when the system is in S4/ S5.

//=================================================================================================
// KBC Version: 	00.06.16
// Date:		2024/12/04
// Base:		v000615
//=================================================================================================
1. Fix the power OFF issue after flashing EC.

//=================================================================================================
// KBC Version: 	00.06.15
// Date:		2024/09/06
// Base:		v000614
//=================================================================================================
1. Modify SYS_ON low to be 20 seconds after entering shutdown.
2. Added H2RAM COMMAND 0x71:
     data 0x00: Disable PD Port.
     data 0x01: Enable Pd Port.
3. Added windows flash function.

//=================================================================================================
// KBC Version: 	00.06.14
// Date:		2024/05/06
// Base:		v000613
//=================================================================================================
1. Fix power button delay problem caused by Dock out.

//=================================================================================================
// KBC Version: 	00.06.13
// Date:		2023/10/13
// Base:		v000612
//=================================================================================================
1. Fix USB Power Share issue when BAT power only(GPJ6).

//=================================================================================================
// KBC Version: 	00.06.12
// Date:		2023/05/16
// Base:		v00061104
//=================================================================================================
1. Modify ACC_1(0x3F) 0x0BB8H(57W).
2. Modify ACL_2(0x3B) 0x0D5CH(64.980W)
3. Modify ADP_PROHOT(0x47) 0x0D80(65.664W)
4. Modify PDWatt_ACL1(-10W)/PDWatt_ACL2(-2W)/PDWatt_ACP(-1W).
5. Modify INIT_CHRG_CTRL_2(0x3D) 0x7000 -> 0x7100. PROCHOT# Duration set 1ms.

//=================================================================================================
// KBC Version: 	00.06.11
// Date:		2023/05/10
// Base:		v000610
//=================================================================================================
1. Modify Charge IC Control3 to  0x0320(Disable input current limit loop), only adapter exist and no battery exist, other 0x0300.
2. Modify ACL_2/ADP_PROHOT, PDWatt_ACL2/PDWatt_ACP.
3. Modify INIT_CHRG_CTRL_2(0x3D) 0x7200 -> 0x7000.

//=================================================================================================
// KBC Version: 	00.06.10
// Date:		2022/12/26
// Base:		v000609
//=================================================================================================
1. Fix PreCharge issue.

//=================================================================================================
// KBC Version: 	00.06.09
// Date:		2022/12/06
// Base:		v000608
//=================================================================================================
1. Delete AttDeviceBcTrigAssert function：send Mute Scan code.
2. Add SCI_BCTRIG_PRESS_CMD Event 0xDE.
       SCI_BCTRIG_RELEAS_CMD Event 0xDF.
3. Add H2RAM COMMAND 0x65.
   date 0x01 = SetBcTrigOutPinLow
   date 0x00 = SetBcTrigOutPinHigh
4. Modify SYS_ON low to be 10 seconds after entering shutdown.

//=================================================================================================
// KBC Version: 	00.06.08
// Date:		2022/11/08
// Base:		v000607
//=================================================================================================
1. Fix Battery Charging issue.
2. Fix BAT OUT Whwn EC sleep ssue.
3. Fix DOCK_PWRBTN# wake up issue.

//=================================================================================================
// KBC Version: 	00.06.07
// Date:		2022/10/11
// Base:		v000606
//=================================================================================================
1. Fix DOCK_PWRBTN# issue.
2. Modify H2RAM COMMAND 0xF0 OEM_INTERNAL_TEST_REV Byte(4).

//=================================================================================================
// KBC Version: 	00.06.06
// Date:		2022/09/07
// Base:		v000605
//=================================================================================================
1. Fix Moderstandby Power_LED issue.
2. Fix BAT LED.
3. Fix retimer function.

//=================================================================================================
// KBC Version: 	00.06.05
// Date:		2022/08/10
// Base:		v00060402
//=================================================================================================
1. Add Battery protection function：
   1-1. Standard Mode：Battery FC =1 stop charge.
   1-2. Advanced Mode：Battery percentage >= 80 stop charge.
   1-3. Temperature Mode：Battery FC =1 stop charge + Dynamic charge current for battery Temperature.
   1-4. Advanced Temperature Mode：Battery percentage >= 80 stop charge + Dynamic charge current for battery Temperature.
2. Add battery polymer support：
   2-1. Support set 1 = Battery is Polymer.
   2-2. Support set 0 = Battery is Cylinder.
3. Fix pressed power button 4-sec issue.

//=================================================================================================
// KBC Version: 	00.06.01
// Date:		2022/07/19
// Base:		v000600
//=================================================================================================
1. Modify bridge battery function : Suppoer Moder_Standby/S3/S4.

//=================================================================================================
// KBC Version: 	00.06.00
// Date:		2022/07/18
// Base:		v00050604
//=================================================================================================
1. Modify combkey function (D_key + Power_button)：Default disable function.
2. Modify Battery Led Control function：Battery_Only + S5 = Battery_LED off.

//=================================================================================================
// KBC Version: 	00.05.06.04
// Date:		2022/07/14
// Base:		v00050601
//=================================================================================================
1. Modify ChargerIC Control2 value => 0x7200.
2. Disable ChargerIC Control1 Bit_6(BGATE Force Off) write.
3. Modify D_Key Debounce time：60mS -> 30mS.

//=================================================================================================
// KBC Version: 	00.05.06.01
// Date:		2022/07/07
// Base:		v000506
//=================================================================================================
1. Disable combkey function (D_key + Power_button).

//=================================================================================================
// KBC Version: 	00.05.06
// Date:		2022/07/07
// Base:		v000505
//=================================================================================================
1. Modify Stealth Mode function.
2. Add Brightness auto repeat function.
3. Modify volume up/down auto repeat function：count 100mS -> 40mS
4. Modify P_Key & Bc_Key Debounce time：60mS -> 30mS
5. Modify Battery Led Control function.

//=================================================================================================
// KBC Version: 	00.05.05
// Date:		2022/06/30
// Base:		v000504
//=================================================================================================
1. Modyfi Battery Temperature Protect Function：
   1-1. Modifu Charge Current = 0 issue for error flag clear.
2. Modufy ChargerIC dynamic adjustment function.
3. Implement combkey function (D_key + Power_button).
4. Implement intel retimer function for PD FW update.
5. EC judges physical GPIO pin when user pressed 4-sec to do force shutdown.Otherwise, EC use eSPI VW bit.

//=================================================================================================
// KBC Version: 	00.05.04
// Date:		2022/06/28
// Base:		v000503
//=================================================================================================
1. Modify H2RAM Command 0x60 Battert Learn Mode function.
   1-1. Battert Learn Mode Enable：DAC3(FAN_ADJ) set OUTPUT_PIN + High.
   1-2. Battert Learn Mode Disable：DAC3(FAN_ADJ) set ALT_FUN_PIN.
2. Disable 62/66 Command 0x60 Battert Learn Mode function.
3. Modify ThermalPollingData function：Add OEM_Temperature5 buffer.
4. Modyfi Battery Temperature Protect Function：
   4-1. Modifu Battery Temperature < 45°C clear error flag.

//=================================================================================================
// KBC Version: 	00.05.03
// Date:		2022/06/23
// Base:		v000502
//=================================================================================================
1. Enable ChargerIC dynamic adjustment function.
2. Fix wrong power state after using stress tool when system resumes from S4/S5 (Tool name: sleeper2.3).
3. Modify PD FW udate FIFO write structure from 8 bytes to 32 bytes.
4. Change bytecount of address from 0328h to 031Bh.
5. Update PD FW update API due to FIFO limitation：
   5-1. SmbFIFOWrite changes to SmbWriteBlock.
   5-2. SmbFIFORead changes to SmbReadBlockLimit.
6. Modify FAN table.

//=================================================================================================
// KBC Version: 	00.05.02
// Date:		2022/06/21
// Base:		v000501
//=================================================================================================
1. Disable Can't full charged over 8hr set Battery LED Orange Blinking function.
2. Modyfi Battery Temperature Protect Function：
   2-1. Modifu Battery Temperature < 48°C clear error flag.
   2-2. Modifu Charge Current = 0 issue for error flag clear.
   2-3. GPE6(SYS_AC# = High) or Battery discharging：Disable Battery Temperature Protect Function.

//=================================================================================================
// KBC Version: 	00.05.01
// Date:		2022/06/20
// Base:		v000500
//=================================================================================================
1. Modify Battery Temperature Protect Function：
   1-1. Disable 0°C > Battery Temperature error flag.
   1-2. Modifu Battery Temperature >= 45°C to >= 50°C set error flag.
2. PWRSW/GPE4 (PWRBTN_SW#)：
   2-1. Support the EC reset for 8-sec.
   2-2. Support force shutdown for 4-sec.
3. Support When thermal is keeping in high, EC will action to do force shutdown，EC will pull down GPE0 to force shutdown.
4. Clear error flags of the battery after adapter out.
5. Fix write wrong CC value after adapter in.
6. Add ACPI 060D_BIT4 (AC_ADP_IN) for AC Adaptor in.
7. Modify Power on function：PD_ONLY & PD Watt < 60W & Battery percentage < 10% not Power on.
8. Add GPH7 (PM_SLP_S0#) function： GPA6(EC_SLP_S0#) set Low for GPH7(PM_SLP_S0#) continuous 500ms is Low.
9. Modify ChargerIC dynamic adjustment function.

//=================================================================================================
// KBC Version: 	00.05.00
// Date:		2022/06/07
// Base:		v000401
//=================================================================================================
1. Add read Battery Design Capacity (command 0x18) for AP test tool.
2. Add Definable_Key_Sel：BIT0 = 1： Windows_Key , 0: Definable_Key.
3. Add Button Function (WinKeyFunctionMode)：
   3-1. WinKeyFunctionMode：0x00 = Disable.
   3-2. WinKeyFunctionMode：0x01 = Windows key.
4. Modify Button Definable_key ACPI location.
5. Modify Button Programmable_key ACPI location.

//=================================================================================================
// KBC Version: 	00.04.01
// Date:		2022/05/27
// Base:		v000400
//=================================================================================================
1. Modify AttDeviceBcTrigAssert function：Add Delay 25ms.
2. Fix CC value should be clear after back from battery learn mode.
3. Fix the volume down only trigger once when user press continuously.
4. Create a new buffer that to avoid write 0 in charger voltage.
5. Create a new buffer that to avoid write Battery Charging Current in ChargerIC Charger Current.
6. Modify PD_Watt memory location to ACPI.
7. Modify External Button Key_Sel function：
   7-1. External Button Key_Sel = 0x00 = Disable.
   7-2. External Button Key_Sel = 0x01 = Windows Key.

//=================================================================================================
// KBC Version: 	00.04.00
// Date:		2022/05/24
// Base:		v000301
//=================================================================================================
1. Add External Button Key_Sel function： H = Windows Key , L = D Key.
2. Add GPA6 (EC_SLP_S0#)：
   2-1. GPA6 (EC_SLP_S0#) initial set OUTPUT+LOW+PULL_DW.
   2-2. S5 to S0 GPA6 (EC_SLP_S0#) set High.
   2-3. Modern standby Enabled GPA6 (EC_SLP_S0#) set Low.
   2-4. Modern standby Disable GPA6 (EC_SLP_S0#) set High

//=================================================================================================
// KBC Version: 	00.03.01
// Date:		2022/05/18
// Base:		v000300
//=================================================================================================
1. Modify AttDeviceBcTrigAssert function：Add send Scan code.

//=================================================================================================
// KBC Version: 	00.03.00
// Date:		2022/05/17
// Base:		v000209
//=================================================================================================
1. Add read CPU temp by OOB of eSPI interface function.
2. Modify AttDeviceLTEControl & AttDeviceGPSControl function.
   2-1. LTE_PWR_ON -> Delay 100ms -> LTE_EN
   2-2. LTE_PWR_ON -> Delay 100ms -> GPS_EN
3. Modify LTE_PWR initial set OUTPUT+LOW+PULL_DW
4. Modify LTE_EN initial set OUTPUT+LOW+PULL_DW
5. Modify GPS_EN initial set OUTPUT+LOW+PULL_DW
6. Add PWRSTATE = S3 ：LTE_PWR + LTE_ON + GPS_ON set OUTPUT+LOW

//=================================================================================================
// KBC Version: 	00.02.09
// Date:		2022/05/09
// Base:		v00020805
//=================================================================================================
1. Modify P_Sensor function.
2. Modify Brightness Up/Down not send Q_Event for Modern standby is Enabled.
3. Modify Modern standby function:
   3-1. Disable battery LED when enter Modern standby to Enabled battery LED when enter Modern standby.
4. Modify ChargerIC (Max System Voltage 0x15)：12.6V.
5. Add Hi-cap battery function：
   5-1. Normal_battery_IN：Set ChargerIC (ChargeCurrentLimit 0x14)：1800mA.
   5-2. Hi-cap_battery_IN：Set ChargerIC (ChargeCurrentLimit 0x14)：2800mA.

//=================================================================================================
// KBC Version: 	00.02.08.05
// Date:		2022/04/27
// Base:		v00020804
//=================================================================================================
1. Modify P_Sensor function.

//=================================================================================================
// KBC Version: 	00.02.08.04
// Date:		2022/04/22
// Base:		v00020802
//=================================================================================================
1. Add USB Power Share function.
2. Modify P_Sensor function：
   2-1. Modify P_Sensor function initial from SX9324 to SX9500.
   2-2. Add LTE_Disable set P_SENSOR Disable pins & LTE_Enabled set P_SENSOR Enabled pins.
   2-3. Add P_SENSOR is Far set PROXIMITY_DPR#(GPE3) is High & P_SENSOR is Near set PROXIMITY_DPR#(GPE3) is Low.
3. Add Pressed Power button send Q_Event on S0：Q_Event number 0x6a.
4. Modify S3toS0Variable and S0toS3Variable function.
5. Modify Modern standby function:
   5-1. Add Modern standby is Enabled run S0toS3VariableFun.
   5-2. Add Modern standby is Disable run S3toS0VariableFun.
6. Modify CheckDockReady function for Modern standby.
7. Modify BriBatOnPinCtrlPolling function for Modern standby.

//=================================================================================================
// KBC Version: 	00.02.08.02
// Date:		2022/04/20
// Base:		v000208
//=================================================================================================
1. Modify Modern standby function：Change PECI status from ALT to OutputLow when enter Modern standby.
2. Modify ChargerIC (Control_0 0x39)：Bit9-8 (Dither Enabled = Dither3x)
3. Modify ChargerIC (Control_1 0x3C)：Bit9-7 (Switching Frequency = 724kHz)
4. Modify battery learn mode function：
   4-1. Turn off battery led when enabled battery learn mode
   4-2. Can't full charged over 8hr no Count when enabled battery learn mode
   4-3. Add S0 to S4/S5 Learning Mode Disable

//=================================================================================================
// KBC Version: 	00.02.08
// Date:		2022/04/19
// Base:		v000207
//=================================================================================================
1. Add PD_CONNECTOR_MAX token in TPS65994.c
2. Add Modern standby function.
	2-1. Disable battery LED when enter Modern standby.
	2-2. Change PECI status from ALT to Input when enter Modern standby.
3. Modify Battery Learn Mode：Learn Mode Enabled => BAT_LED_OFF

//=================================================================================================
// KBC Version: 	00.02.07
// Date:		2022/04/12
// Base:		v000206
//=================================================================================================
1. Modify BAT_LED function for PD_INT(USB) BAT_LED error (ADAPT_DET# or PD_Adaptor_in for BAT_LED ON).
2. Disable Thermal Sensor Temperature for FAN function.
3. Disable CPU Power Control function.
4. Disable LCD Brightness Control function.
5. Disable Battery Charging Control function.
6. Change check SYS_ACIN# status form SYS_ACIN# to ADAPT_DET#.

//=================================================================================================
// KBC Version: 	00.02.06
// Date:		2022/04/04
// Base:		v000205
//=================================================================================================
1. Add EC Sleep mode.
2. Add P_Sensor INT(GPD0) interrupt function.
3. Modify AttDeviceControl function.
4. Add DOCK_READY#(GPI6) & DOCK_PWRBTN#(GPJ0)function.
5. Modify TMR SET (TMR_DCR_A0 = 0x0C)
6. Modify RF_LED for Windows airplane mode.
7. Modify BAT_LED function for PD_INT(USB) BAT_LED error.
8. Modify FAN table.
9. Add Button function：Definable_D (Launch Windows Start menu)

//=================================================================================================
// KBC Version: 	00.02.05
// Date:		2022/03/30
// Base:		v000204
//=================================================================================================
1. Delete Device all open for EE test.
2. Modify ChargerIC (Control_2 0x3D)：Bit12 (Two-Level Adapter Current Limit = Enabled)
3. Modify FAN_TEST for AP test：S0 to S3/S4/S5 FAN_TEST EC_RAM clear.

//=================================================================================================
// KBC Version: 	00.02.04
// Date:		2022/03/25
// Base:		v000203
//=================================================================================================
1. Add FAN function.
2. Add FAN_TEST for AP test

//=================================================================================================
// KBC Version: 	00.02.03
// Date:		2022/03/21
// Base:		v000201
//=================================================================================================
1. Add GPIO RF_LED function
2. Add Button function：Barcode/Camera Capture (Camera function)

//=================================================================================================
// KBC Version: 	00.02.01
// Date:		2022/03/20
// Base:		v000200
//=================================================================================================
1. Modify bridge battery function：If Bridge Battery No Detect , BRI_BAT_ON set Low
2. Add Button function：Definable_D & Programmable P & Barcode/Camera Capture
3. Modify ChargerIC (Control_1 0x3C)：Bit3 (PSYS = Enabled)

//=================================================================================================
// KBC Version: 	00.02.00
// Date:		2022/03/16
// Base:		v000103
//=================================================================================================
1. Add Device all open for EE test

//=================================================================================================
// KBC Version: 	00.01.03
// Date:		2022/03/16
// Base:		v000102
//=================================================================================================
1. Add read ChargerIC all registers to memory.h
2. Modify ChargerIC (ChargeCurrentLimit 0x14)：AC_IN+BAT_IN = 0708h
					       AC_IN+BAT_IN -> AC_IN+BAT_OUT = 00h
3. Modify ChargerIC (MaxSystemVoltage 0x15)：AC_IN+BAT_IN = 3180h
					     AC_IN+BAT_IN -> AC_IN+BAT_OUT = 3180h

//=================================================================================================
// KBC Version: 	00.01.02
// Date:		2022/03/11
// Base:		v000101
//=================================================================================================
1. Modify ChargerIC initial setting based (CCL & ADP_Min & ACOK)

//=================================================================================================
// KBC Version: 	00.01.01
// Date:		2022/03/10
// Base:		v000100
//=================================================================================================
1. Modify FAN_ADJ：DAC4_CH4 -> DAC_CH3

//=================================================================================================
// KBC Version: 	00.01.00
// Date:		2022/03/08
// Base:		v000500
//=================================================================================================
1. Modify GPIO Initial configuration beased.
2. Modify ChargerIC initial setting based.
3. Modify FAN_ADJ：DAC4_CH4 -> DAC_CH3 & FAN_ADJ S5 to S0 Set OUTPUT+HI


// R8AA1 //
//=================================================================================================
// KBC Version: 	00.05.00
// Date:		2022/02/25
// Base:		v000413
//=================================================================================================
1. Add TMR initial function
2. Add auto turn on when AC plug-in (under S5 and BIOS notify)
3. Modify Volume Up/Down multiple function of Volume Up/Down button
   3-1. In APM mode
   3-2. Typematic key
4. Add Stealth mode and programmable function of P1 button
5. Move subfunction” AttDeviceControlPolling” from 100mS to CMD 0x81of ACPI
6. Add S0 to S3 and S3 to S0 of power sequence

//=================================================================================================
// KBC Version: 	00.01.00
// Date:		2021/11/12
//=================================================================================================
1. Based on AMI ITE5571 code base and "R8 Internal Spec_V01_20210805.pdf".
2. GPIO Initial configuration beased on "202111012-AMI_EC_GPIO_S0-S5 - Twinhead(NEW).xlsx".
3. Power sequence based on "TURN_ON_POWER.TXT", "TURN_OFF_POWER.TXT" and "Load GPIO Config.TXT".
4. ChargerIC initial setting based on "ChargerIC Initial.TXT" and "isl95521a_ds-2016-05-09.pdf".

