Skip to content

Commit

Permalink
hw-mgmt: config: Add fix for N5xxx with new power converter
Browse files Browse the repository at this point in the history
Add fix for N5xxx with new power converter

Signed-off-by: Oleksandr Shamray <[email protected]>
  • Loading branch information
sholeksandr committed Nov 15, 2024
1 parent b62da5e commit eb8ab46
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
42 changes: 30 additions & 12 deletions usr/usr/bin/hw-management-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,11 @@ smart_switch_dpu_events=("pg_1v8" "pg_dvdd" "pg_vdd pg_vddio" "thermal_trip" \
"vdd_cpu_alert" "vddq_alert")
l1_power_events=("power_button graceful_pwr_off")
ui_tree_sku=`cat $sku_file`
ui_tree_archive="/etc/hw-management-sensors/ui_tree_$ui_tree_sku.tar.gz"
ui_tree_archive=
udev_event_log="/var/log/udev_events.log"
vm_sku=`cat $sku_file`
vm_vpd_path="/etc/hw-management-virtual/$vm_sku"

# Validate label archive file.
[ -f "$pn_file" ] && pn=$(< $pn_file) || pn="Unknown"
case $pn in
N5200_LD|N5101_LD|N5300_LD|N5210_LD)
ui_tree_archive="/etc/hw-management-sensors/ui_tree_"$ui_tree_sku"_1.tar.gz"
;;
*)
;;
esac

declare -A psu_fandir_vs_pn=(["00KX1W"]=R ["00MP582"]=F ["00MP592"]=R ["00WT061"]=F \
["00WT062"]=R ["00WT199"]=F ["01FT674"]=F ["01FT691"]=F ["01LL976"]=F \
["01PG798"]=F ["01PG800"]=R ["02YF120"]=R ["02YF121"]=F ["03GX980"]=F \
Expand Down Expand Up @@ -239,6 +229,7 @@ unlock_service_state_change()

check_labels_enabled()
{
ui_tree_archive_file="$(get_ui_tree_archive_file)"
if ([ "$ui_tree_sku" = "HI130" ] ||
[ "$ui_tree_sku" = "HI151" ] ||
[ "$ui_tree_sku" = "HI157" ] ||
Expand All @@ -248,7 +239,7 @@ check_labels_enabled()
[ "$ui_tree_sku" = "HI167" ] ||
[ "$ui_tree_sku" = "HI169" ] ||
[ "$ui_tree_sku" = "HI170" ]) &&
([ ! -e "$ui_tree_archive" ]); then
([ ! -e "$ui_tree_archive_file" ]); then
return 0
else
return 1
Expand Down Expand Up @@ -776,3 +767,30 @@ load_dpu_sensors()
fi
fi
}

get_ui_tree_archive_file()
{
if [ ! -z $ui_tree_archive ]; then
echo $ui_tree_archive
fi

ui_tree_archive="/etc/hw-management-sensors/ui_tree_"$ui_tree_sku".tar.gz"

# Validate label archive file.
case $board_type in
VMOD0021)
# Check if raa228000 converter present on expected i2c addr 12-0060
# if 'yes' - we should use special ui file
pdb_pwr_conv1_folder=$(< /sys/bus/i2c/devices/i2c-12/12-0060)
if [ -d $pdb_pwr_conv1_folder ]; then
pdb_pwr_conv1_name=$(< "$pdb_pwr_conv1_folder/name")
if [[ $pdb_pwr_conv1_name == "raa228000" ]]; then
ui_tree_archive="/etc/hw-management-sensors/ui_tree_"$ui_tree_sku"_1.tar.gz"
fi
fi
;;
*)
;;
esac
echo $ui_tree_archive
}
5 changes: 3 additions & 2 deletions usr/usr/bin/hw-management-start-post.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ fi
case $sku in
HI130|HI151|HI157|HI158|HI162|HI166|HI167|HI169|HI170)
# Only for MQM9700
if [ -e "$ui_tree_archive" ]; then
ui_tree_archive_file="$(get_ui_tree_archive_file)"
if [ -e "$ui_tree_archive_file" ]; then
# Extract the ui_tree archive to /var/run/hw-management
tar xfz "$ui_tree_archive" -C "$hw_management_path"
tar xfz "$ui_tree_archive_file" -C "$hw_management_path"
echo 1 > "$config_path"/labels_ready
log_info "Labels data base is ready"
else
Expand Down

0 comments on commit eb8ab46

Please sign in to comment.