Skip to content

main_v2 - fby3.5: cl: Support TMP431 sensor reading#231

Closed
DelphineChiu wants to merge 4 commits into
facebook:main_v2from
Wiwynn:Ren/main_v2/Support-TMP431
Closed

main_v2 - fby3.5: cl: Support TMP431 sensor reading#231
DelphineChiu wants to merge 4 commits into
facebook:main_v2from
Wiwynn:Ren/main_v2/Support-TMP431

Conversation

@DelphineChiu

@DelphineChiu DelphineChiu commented Apr 15, 2022

Copy link
Copy Markdown

fby3.5: cl: Support TMP431 sensor reading
Summary:

  • Support TMP431 sensor device
    For EVT3 ADI system, the "HSC Temp" and "MB Outlet Temp" should be read from TMP431 chip.
    For EVT3 MPS system, the "HSC Temp" sensor value is read from MP5990 and "MB Outlet Temp" is read from TMP75.

    Dependency: main_v2 - fby3.5: cl: Fixing warning messages #230

Test Plan:

  1. Build code: pass
  2. [EVT3 MPS] Check "HSC Temp" and "MB Outlet Temp" sensor reading: pass
  3. [EVT3 ADI] Check "HSC Temp" and "MB Outlet Temp" sensor reading: pass
  4. [POC] Check "HSC Temp" and "MB Outlet Temp" sensor reading: pass

Log:

  1. Class type: class-1, 1ou present status: false, 2ou present status: true, board revision: EVT3(ADI)
    root@bmc-oob:~# sensor-util slot1|grep "HSC|MB Outlet Temp"
    MB Outlet Temp (0x2) : 25.44 C | (ok)
    HSC Temp (0xE) : 23.81 C | (ok)
    HSC Input Vol (0x29) : 12.00 Volts | (ok)
    HSC Output Cur (0x30) : 0.28 Amps | (ok)
    HSC Input Pwr (0x39) : 3.53 Watts | (ok)

  2. Class type: class-1, 1ou present status: false, 2ou present status: false, board revision: EVT3(MPS)
    root@bmc-oob:~# sensor-util slot1|grep "HSC|MB Outlet Temp"
    MB Outlet Temp (0x2) : 24.00 C | (ok)
    HSC Temp (0xE) : 25.00 C | (ok)
    HSC Input Vol (0x29) : 12.22 Volts | (ok)
    HSC Output Cur (0x30) : 0.25 Amps | (ok)
    HSC Input Pwr (0x39) : 6.00 Watts | (ok)

  3. Class type: class-1, 1ou present status: false, 2ou present status:false, board revision: POC
    root@bmc-oob:~# sensor-util slot3|grep "HSC|MB Outlet Temp"
    MB Outlet Temp (0x2) : 33.00 C | (ok)
    HSC Temp (0xE) : 29.52 C | (ok)
    HSC Input Vol (0x29) : 12.00 Volts | (ok)
    HSC Output Cur (0x30) : 8.82 Amps | (ok)
    HSC Input Pwr (0x39) : 108.70 Watts | (ok)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 15, 2022
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@GoldenBug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Comment thread common/dev/tmp431.c

static uint8_t temperature_range = 0xFF;

uint8_t tmp431_read(uint8_t sensor_num, int *reading)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check to see if sensor_num is in a valid range?

0 <= sensor_num < MAX_NUM_SENSORS ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have fixed this and do the forced update.
The sensor_num is unsigned type so only judge if it's less than MAX_NUM_SENSORS.
Please review it. Thanks.

Comment thread common/dev/tmp431.c
return SENSOR_READ_SUCCESS;
}

uint8_t tmp431_init(uint8_t sensor_num)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, check if sensor_num is in valid range?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have fixed this and do the forced update.
The sensor_num is unsigned type so only judge if it's less than MAX_NUM_SENSORS.
Please review it. Thanks.

Comment on lines +286 to +282
while (sensor_count != 0) {
add_sensor_config(
evt3_class1_adi_temperature_sensor_table[--sensor_count]);
if (sensor_count == 0) {
break;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it might be better as a for loop?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have fixed this and do the forced update.
Please review it. Thanks.

RenChen-wiwynn and others added 3 commits April 18, 2022 16:05
Summary:
- Support MP5990 sensor device

Test Plan:
1. Build code: pass
2. [MPS] Check GPIOA7 and the MP5990 configure register(38h and 46h)
3. [MPS] Get MP5990 sensor reading: pass
4. [ADI] Get ADM1278 sensor reading: pass

Log:
1. Class type: class-1, 1ou present status: false, 2ou present status: true, board revision: EVT3(EFUSE)
root@bmc-oob:/root# bic-util slot1 --get_gpio|grep "HSC_SET_EN_R"
7 HSC_SET_EN_R: 1
root@bmc-oob:/root# bic-util slot1 0x18 0x52 0x5 0x16 0x2 0x38
BF 01
root@bmc-oob:/root# bic-util slot1 0x18 0x52 0x5 0x16 0x2 0x46
46 00
root@bmc-oob:/root# sensor-util slot1|grep HSC
HSC Temp                     (0xE) :   25.00 C     | (ok)
HSC Input Vol                (0x29) :   12.31 Volts | (ok)
HSC Output Cur               (0x30) :    0.25 Amps  | (ok)
HSC Input Pwr                (0x39) :    0.00 Watts | (ok)

2. Class type: class-1, 1ou present status: false, 2ou present status: false, board revision: EVT3(EFUSE)
root@bmc-oob:/root# bic-util slot1 --get_gpio|grep "HSC_SET_EN_R"
7 HSC_SET_EN_R: 0
root@bmc-oob:/root# bic-util slot1 0x18 0x52 0x5 0x16 0x2 0x46
28 00
root@bmc-oob:/root# bic-util slot1 0x18 0x52 0x5 0x16 0x2 0x38
04 01
root@bmc-oob:/root# sensor-util slot1|grep HSC
HSC Temp                     (0xE) :   25.00 C     | (ok)
HSC Input Vol                (0x29) :   12.44 Volts | (ok)
HSC Output Cur               (0x30) :    0.25 Amps  | (ok)
HSC Input Pwr                (0x39) :    0.00 Watts | (ok)

3. Class type: class-1, 1ou present status: false, 2ou present status:false, board revision: POC
root@bmc-oob:/root# sensor-util slot3|grep HSC
HSC Temp                     (0xE) :   27.62 C     | (ok)
HSC Input Vol                (0x29) :   12.00 Volts | (ok)
HSC Output Cur               (0x30) :   10.52 Amps  | (ok)
HSC Input Pwr                (0x39) :  129.35 Watts | (ok)
Summary:
- K_WORK_DELAYABLE_DEFINE needs a callback function with the function parameter type of "struct k_work *".
- util_spi.c had a missing header that needed to be included as well as an improperly formatted print statement.
- Mark card_type_1ou that is currently unused in Yv3.5 CL as unused to silence compiler warnings.
- Initialized status in fall through case.

Test Plan:
- Build code: Pass
@RenChen-wiwynn RenChen-wiwynn force-pushed the Ren/main_v2/Support-TMP431 branch from 2a31d22 to 106d184 Compare April 18, 2022 09:03
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@DelphineChiu has updated the pull request. You must reimport the pull request before landing.

Summary:
- Support TMP431 sensor device
  For EVT3 ADI system, the "HSC Temp" and "MB Outlet Temp" should be read from TMP431 chip.
  For EVT3 MPS system, the "HSC Temp" sensor value is read from MP5990 and "MB Outlet Temp" is read from TMP75.

Test Plan:
1. Build code: pass
2. [EVT3 MPS] Check "HSC Temp" and "MB Outlet Temp" sensor reading: pass
3. [EVT3 ADI] Check "HSC Temp" and "MB Outlet Temp" sensor reading: pass
4. [POC] Check "HSC Temp" and "MB Outlet Temp" sensor reading: pass

Log:
1. Class type: class-1, 1ou present status: false, 2ou present status: true, board revision: EVT3(ADI)
root@bmc-oob:~# sensor-util slot1|grep "HSC\|MB Outlet Temp"
MB Outlet Temp               (0x2) :   25.44 C     | (ok)
HSC Temp                     (0xE) :   23.81 C     | (ok)
HSC Input Vol                (0x29) :   12.00 Volts | (ok)
HSC Output Cur               (0x30) :    0.28 Amps  | (ok)
HSC Input Pwr                (0x39) :    3.53 Watts | (ok)

2. Class type: class-1, 1ou present status: false, 2ou present status: false, board revision: EVT3(MPS)
root@bmc-oob:~# sensor-util slot1|grep "HSC\|MB Outlet Temp"
MB Outlet Temp               (0x2) :   24.00 C     | (ok)
HSC Temp                     (0xE) :   25.00 C     | (ok)
HSC Input Vol                (0x29) :   12.22 Volts | (ok)
HSC Output Cur               (0x30) :    0.25 Amps  | (ok)
HSC Input Pwr                (0x39) :    6.00 Watts | (ok)

3. Class type: class-1, 1ou present status: false, 2ou present status:false, board revision: POC
root@bmc-oob:~# sensor-util slot3|grep "HSC\|MB Outlet Temp"
MB Outlet Temp               (0x2) :   33.00 C     | (ok)
HSC Temp                     (0xE) :   29.52 C     | (ok)
HSC Input Vol                (0x29) :   12.00 Volts | (ok)
HSC Output Cur               (0x30) :    8.82 Amps  | (ok)
HSC Input Pwr                (0x39) :  108.70 Watts | (ok)
@RenChen-wiwynn RenChen-wiwynn force-pushed the Ren/main_v2/Support-TMP431 branch from 106d184 to 9517f23 Compare April 18, 2022 09:08
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@DelphineChiu has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@GoldenBug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot pushed a commit that referenced this pull request Apr 19, 2022
Summary:
fby3.5: cl: Support TMP431 sensor reading

- Support TMP431 sensor device
  For EVT3 ADI system, the "HSC Temp" and "MB Outlet Temp" should be read from TMP431 chip.
  For EVT3 MPS system, the "HSC Temp" sensor value is read from MP5990 and "MB Outlet Temp" is read from TMP75.

  Dependency: #230

Pull Request resolved: #231

Test Plan:
1. Build code: pass
2. [EVT3 MPS] Check "HSC Temp" and "MB Outlet Temp" sensor reading: pass
3. [EVT3 ADI] Check "HSC Temp" and "MB Outlet Temp" sensor reading: pass
4. [POC] Check "HSC Temp" and "MB Outlet Temp" sensor reading: pass

Log:
1. Class type: class-1, 1ou present status: false, 2ou present status: true, board revision: EVT3(ADI)
root@bmc-oob:~# sensor-util slot1|grep "HSC\|MB Outlet Temp"
MB Outlet Temp               (0x2) :   25.44 C     | (ok)
HSC Temp                     (0xE) :   23.81 C     | (ok)
HSC Input Vol                (0x29) :   12.00 Volts | (ok)
HSC Output Cur               (0x30) :    0.28 Amps  | (ok)
HSC Input Pwr                (0x39) :    3.53 Watts | (ok)

2. Class type: class-1, 1ou present status: false, 2ou present status: false, board revision: EVT3(MPS)
root@bmc-oob:~# sensor-util slot1|grep "HSC\|MB Outlet Temp"
MB Outlet Temp               (0x2) :   24.00 C     | (ok)
HSC Temp                     (0xE) :   25.00 C     | (ok)
HSC Input Vol                (0x29) :   12.22 Volts | (ok)
HSC Output Cur               (0x30) :    0.25 Amps  | (ok)
HSC Input Pwr                (0x39) :    6.00 Watts | (ok)

3. Class type: class-1, 1ou present status: false, 2ou present status:false, board revision: POC
root@bmc-oob:~# sensor-util slot3|grep "HSC\|MB Outlet Temp"
MB Outlet Temp               (0x2) :   33.00 C     | (ok)
HSC Temp                     (0xE) :   29.52 C     | (ok)
HSC Input Vol                (0x29) :   12.00 Volts | (ok)
HSC Output Cur               (0x30) :    8.82 Amps  | (ok)
HSC Input Pwr                (0x39) :  108.70 Watts | (ok)

Reviewed By: zhdaniel12

Differential Revision: D35679335

Pulled By: GoldenBug

fbshipit-source-id: b84692aaec201e3b3271b948c6cbba3df951bd5a
facebook-github-bot pushed a commit that referenced this pull request Apr 19, 2022
Summary:
Add Zephyr Kernel patches

- Add Zephyr Kernel patches
1. drivers: ipmb: Extend the ipmb buffer
2. drivers: i2c: Correct the timeout time as 35ms
3. peci: aspeed: Avoid race condition of accessing peci device.

Dependency: PR #231

Pull Request resolved: #232

Test Plan: 1. Build code: pass

Reviewed By: zhdaniel12

Differential Revision: D35679336

Pulled By: GoldenBug

fbshipit-source-id: 4167f89796b0151692da1b3fb645db86baf8dcab
@DelphineChiu

Copy link
Copy Markdown
Author

close the PR since the codes have been merged

facebook-github-bot pushed a commit that referenced this pull request Apr 26, 2022
Summary:
fby3.5: cl: Support TMP431 sensor reading

- Support TMP431 sensor device
  For EVT3 ADI system, the "HSC Temp" and "MB Outlet Temp" should be read from TMP431 chip.
  For EVT3 MPS system, the "HSC Temp" sensor value is read from MP5990 and "MB Outlet Temp" is read from TMP75.

  Dependency: #230

Pull Request resolved: #231

Test Plan:
1. Build code: pass
2. [EVT3 MPS] Check "HSC Temp" and "MB Outlet Temp" sensor reading: pass
3. [EVT3 ADI] Check "HSC Temp" and "MB Outlet Temp" sensor reading: pass
4. [POC] Check "HSC Temp" and "MB Outlet Temp" sensor reading: pass

Log:
1. Class type: class-1, 1ou present status: false, 2ou present status: true, board revision: EVT3(ADI)
root@bmc-oob:~# sensor-util slot1|grep "HSC\|MB Outlet Temp"
MB Outlet Temp               (0x2) :   25.44 C     | (ok)
HSC Temp                     (0xE) :   23.81 C     | (ok)
HSC Input Vol                (0x29) :   12.00 Volts | (ok)
HSC Output Cur               (0x30) :    0.28 Amps  | (ok)
HSC Input Pwr                (0x39) :    3.53 Watts | (ok)

2. Class type: class-1, 1ou present status: false, 2ou present status: false, board revision: EVT3(MPS)
root@bmc-oob:~# sensor-util slot1|grep "HSC\|MB Outlet Temp"
MB Outlet Temp               (0x2) :   24.00 C     | (ok)
HSC Temp                     (0xE) :   25.00 C     | (ok)
HSC Input Vol                (0x29) :   12.22 Volts | (ok)
HSC Output Cur               (0x30) :    0.25 Amps  | (ok)
HSC Input Pwr                (0x39) :    6.00 Watts | (ok)

3. Class type: class-1, 1ou present status: false, 2ou present status:false, board revision: POC
root@bmc-oob:~# sensor-util slot3|grep "HSC\|MB Outlet Temp"
MB Outlet Temp               (0x2) :   33.00 C     | (ok)
HSC Temp                     (0xE) :   29.52 C     | (ok)
HSC Input Vol                (0x29) :   12.00 Volts | (ok)
HSC Output Cur               (0x30) :    8.82 Amps  | (ok)
HSC Input Pwr                (0x39) :  108.70 Watts | (ok)

Reviewed By: garnermic

Differential Revision: D35941595

Pulled By: GoldenBug

fbshipit-source-id: 0914d4531c7d8c105518ea5c62391e9b8e17b608
facebook-github-bot pushed a commit that referenced this pull request Apr 26, 2022
Summary:
Add Zephyr Kernel patches

- Add Zephyr Kernel patches
1. drivers: ipmb: Extend the ipmb buffer
2. drivers: i2c: Correct the timeout time as 35ms
3. peci: aspeed: Avoid race condition of accessing peci device.

Dependency: PR #231

Pull Request resolved: #232

Test Plan: 1. Build code: pass

Reviewed By: garnermic

Differential Revision: D35941592

Pulled By: GoldenBug

fbshipit-source-id: b92f44bfa44451e8a9aa6dafd5fdf12fc12292a0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

5 participants