PTM services: Difference between revisions
Masagrator (talk | contribs) m Undo GetBatteryAgePercentage and GetRawBatteryChargePercentage changes |
|||
(19 intermediate revisions by 6 users not shown) | |||
Line 121: | Line 121: | ||
== GetRawBatteryChargePercentage == | == GetRawBatteryChargePercentage == | ||
No input, returns an output | No input, returns an output double. | ||
== IsEnoughPowerSupplied == | == IsEnoughPowerSupplied == | ||
No input, returns an output | No input, returns an output bool. | ||
== GetBatteryAgePercentage == | == GetBatteryAgePercentage == | ||
No input, returns an output | No input, returns an output double. | ||
== GetBatteryChargeInfoEvent == | == GetBatteryChargeInfoEvent == | ||
No input, returns an output | No input, returns an output Event handle. | ||
== GetBatteryChargeInfoFields == | == GetBatteryChargeInfoFields == | ||
No input, returns an output 0x40-byte struct. | No input, returns an output 0x40-byte struct: | ||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x00 || 0x4 || u32. Input (Sink) current limit in mA | |||
|- | |||
| 0x04 || 0x4 || u32. Output (Source/Vbus/OTG) current limit in mA | |||
|- | |||
| 0x08 || 0x4 || u32. Battery charging current limit in mA | |||
|- | |||
| 0x0C || 0x4 || u32. Battery charging voltage limit in mV | |||
|- | |||
| 0x10 || 0x4 || enum, same as power-role? Always 1 except when OTG where it becomes 2 | |||
|- | |||
| 0x14 || 0x4 || Possibly a bit field | |||
|- | |||
| 0x18 || 0x4 || u32. Charging limits state based on battery temperature | |||
|- | |||
| 0x1C || 0x4 || u32. Battery Temperature (milli C) | |||
|- | |||
| 0x20 || 0x4 || u32. Capacity now per cent-mille (i.e. 100% = 100000 pcm) | |||
|- | |||
| 0x24 || 0x4 || u32. Voltage avg in mV | |||
|- | |||
| 0x28 || 0x4 || u32. Battery age (capacity full / capacity design) per cent-mille (i.e. 100% = 100000 pcm) | |||
|- | |||
| 0x2C || 0x4 || enum. Power role (0: Unknown, 1: Sink, 2: Source) | |||
|- | |||
| 0x30 || 0x4 || enum. [[#Charger_Type]] | |||
|- | |||
| 0x34 || 0x4 || u32. Charger voltage limit in mV | |||
|- | |||
| 0x38 || 0x4 || u32. Charger current limit in mA | |||
|- | |||
| 0x3C || 0x4 || Bit field (bit0: potentially no hub, bit8: Joy-con charging, bit12: OTG) | |||
|- | |||
|} | |||
=== Charger Type === | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value || Name | |||
|- | |||
| 0 || Unknown | |||
|- | |||
| 1 || PD | |||
|- | |||
| 2 || Type-C 1.5A | |||
|- | |||
| 3 || Type-C 3.0A | |||
|- | |||
| 4 || DCP | |||
|- | |||
| 5 || CDP | |||
|- | |||
| 6 || SDP | |||
|- | |||
| 7 || Apple 500mA | |||
|- | |||
| 8 || Apple 1000mA | |||
|- | |||
| 9 || Apple 2000mA | |||
|} | |||
== IPsmSession == | == IPsmSession == | ||
Line 179: | Line 243: | ||
| 1 || GetThermalEvent | | 1 || GetThermalEvent | ||
|- | |- | ||
| 2 || | | 2 || IsActionAllowed | ||
|- | |- | ||
| 3 || | | 3 || EnableVirtualTemperature | ||
|- | |- | ||
| 4 || | | 4 || DisableVirtualTemperature | ||
|- | |- | ||
| 5 || | | 5 || SetVirtualTemperature | ||
|- | |- | ||
| 6 || | | 6 || EnableFanControl | ||
|- | |- | ||
| 7 || | | 7 || DisableFanControl | ||
|- | |- | ||
| 8 || | | 8 || IsFanControlEnabled | ||
|- | |- | ||
| 9 || [5.0.0+] | | 9 || [5.0.0+] GetSkinTemperatureMilliC | ||
|} | |} | ||
Line 203: | Line 267: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || | | 0 || [[#GetTemperatureRange]] | ||
|- | |- | ||
| 1 || | | 1 || [[#GetTemperature]] | ||
|- | |- | ||
| 2 || | | 2 || [[#SetMeasurementMode]] | ||
|- | |- | ||
| 3 || | | 3 || [[#GetTemperatureMilliC]] | ||
|- | |- | ||
| 4 || [8.0.0+] ? (Takes a total of 4-bytes of input, returns an [[#IUnknown0]]) | | 4 || [8.0.0+] ? (Takes a total of 4-bytes of input, returns an [[#IUnknown0]]) | ||
Line 228: | Line 292: | ||
|- | |- | ||
| 3 || | | 3 || | ||
|- | |||
| 4 || [10.0.0+] | |||
|} | |||
== GetTemperatureRange == | |||
Takes an u8 [[#Location]] and returns an s32 minimum temperature + s32 maximum temperature. | |||
The returned temperature values are in Celsius. | |||
== GetTemperature == | |||
Takes an u8 [[#Location]] and returns an output s32. | |||
The output is the temperature in Celsius. | |||
== SetMeasurementMode == | |||
Takes an u8 [[#Location]] and an u8 MeasurementMode, no output. | |||
== GetTemperatureMilliC == | |||
Takes an u8 [[#Location]] and returns an output s32. | |||
The output is the temperature in MilliC. | |||
== Location == | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value || Name | |||
|- | |||
| 0 || Internal | |||
|- | |||
| 1 || External | |||
|} | |} | ||
= pcm = | = pcm = | ||
This is "nn::pcm::IManager". | This is "nn::pcm::IManager". | ||
[4.0.0+] This service was moved to '''nvdbgsvc''' and is only available to SDEV units. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 240: | Line 336: | ||
|- | |- | ||
| 1 || ReadCurrentPower | | 1 || ReadCurrentPower | ||
|- | |||
| 2 || [4.0.0+] IsServiceEnabled | |||
|- | |||
| 3 || [4.0.0+] ReadCurrentVoltage | |||
|} | |} | ||
Line 301: | Line 401: | ||
| 0 || Disabled. | | 0 || Disabled. | ||
|- | |- | ||
| 1 || Use [[#PerformanceConfiguration|performance configurations]] 0x92220009 and 0x9222000A, or 0x9222000B and 0x9222000C. | | 1 || Boost CPU. Additionally, throttle GPU to minimum. | ||
Use [[#PerformanceConfiguration|performance configurations]] 0x92220009 and 0x9222000A, or 0x9222000B and 0x9222000C. | |||
|- | |- | ||
| 2 || Use [[#PerformanceConfiguration|performance configurations]] 0x9222000B and 0x9222000C. | | 2 || Conserve power. Only throttle GPU to minimum. | ||
Use [[#PerformanceConfiguration|performance configurations]] 0x9222000B and 0x9222000C. | |||
|} | |} | ||
Line 337: | Line 439: | ||
! Value || Name | ! Value || Name | ||
|- | |- | ||
| 0 || | | 0 || Normal | ||
|- | |- | ||
| 1 || | | 1 || Boost | ||
|} | |} | ||
Line 347: | Line 449: | ||
! Value || CPU clock || GPU clock || Memory clock | ! Value || CPU clock || GPU clock || Memory clock | ||
|- | |- | ||
| 0x00010000 || 1020 || 384 || 1600 | | 0x00010000 || 1020.0 || 384.0 || 1600.0 | ||
|- | |- | ||
| 0x00010001 || 1020 || 768 || 1600 | | 0x00010001 || 1020.0 || 768.0 || 1600.0 | ||
|- | |- | ||
| 0x00010002 || 1224 || 691.2 || 1600 | | 0x00010002 || 1224.0 || 691.2 || 1600.0 | ||
|- | |- | ||
| 0x00020000 || 1020 || 230.4 || 1600 | | 0x00020000 || 1020.0 || 230.4 || 1600.0 | ||
|- | |- | ||
| 0x00020001 || 1020 || 307.2 || 1600 | | 0x00020001 || 1020.0 || 307.2 || 1600.0 | ||
|- | |- | ||
| 0x00020002 || 1224 || 230.4 || 1600 | | 0x00020002 || 1224.0 || 230.4 || 1600.0 | ||
|- | |- | ||
| 0x00020003 || 1020 || 307 || 1331.2 | | 0x00020003 || 1020.0 || 307.2 || 1331.2 | ||
|- | |- | ||
| 0x00020004 || 1020 || 384 || 1331.2 | | 0x00020004 || 1020.0 || 384.0 || 1331.2 | ||
|- | |- | ||
| 0x00020005 || 1020 || 307.2 || 1065.6 | | 0x00020005 || 1020.0 || 307.2 || 1065.6 | ||
|- | |- | ||
| 0x00020006 || 1020 || 384 || 1065.6 | | 0x00020006 || 1020.0 || 384.0 || 1065.6 | ||
|- | |- | ||
| 0x92220007 || 1020 || 460.8 || 1600 | | 0x92220007 || 1020.0 || 460.8 || 1600.0 | ||
|- | |- | ||
| 0x92220008 || 1020 || 460.8 || 1331.2 | | 0x92220008 || 1020.0 || 460.8 || 1331.2 | ||
|- | |- | ||
| [7.0.0+] 0x92220009 || 1785 || | | [7.0.0+] 0x92220009 || 1785.0 || 76.8 || 1600.0 | ||
|- | |- | ||
| [7.0.0+] 0x9222000A || 1785 || | | [7.0.0+] 0x9222000A || 1785.0 || 76.8 || 1331.2 | ||
|- | |- | ||
| [7.0.0+] 0x9222000B || 1020 || | | [7.0.0+] 0x9222000B || 1020.0 || 76.8 || 1600.0 | ||
|- | |- | ||
| [7.0.0+] 0x9222000C || 1020 || | | [7.0.0+] 0x9222000C || 1020.0 || 76.8 || 1331.2 | ||
|} | |} | ||
Line 384: | Line 486: | ||
Configurations 0x10001 and 0x20000 are only available while docked. Configurations 0x10002 and 0x20002 are only available for SDEV units. | Configurations 0x10001 and 0x20000 are only available while docked. Configurations 0x10002 and 0x20002 are only available for SDEV units. | ||
= fgm, fgm:0, fgm:9 = | = fgm, fgm:0, fgm:1, fgm:2, fgm:3, fgm:4, fgm:5, fgm:6, fgm:7, fgm:9 = | ||
These are "nn::fgm::sf::ISession". | |||
Each service represents a different priority from 0 to 9. The "fgm" service represents priority 8 (default). | |||
[2.0.0+] Only "fgm", "fgm:0" and "fgm:9" are now valid. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 391: | Line 497: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || Initialize | | 0 || [[#Initialize]] | ||
|} | |} | ||
== Initialize == | |||
No input. Returns an [[#IRequest]]. | |||
== IRequest == | == IRequest == | ||
Line 401: | Line 510: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || Initialize | | 0 || [[#Initialize_2|Initialize]] | ||
|- | |- | ||
| 1 || Set | | 1 || [[#Set|Set]] | ||
|- | |- | ||
| 2 || Get | | 2 || [[#Get|Get]] | ||
|- | |- | ||
| 3 || Cancel | | 3 || [[#Cancel|Cancel]] | ||
|} | |} | ||
=== Initialize === | |||
Takes a PID-descriptor, a [[#Module]] and an u64. Returns an Event handle with EventClearMode 0. | |||
=== Set === | |||
Takes 2 u32s '''ClockMinRate''' and '''ClockMaxRate'''. No output. | |||
=== Get === | |||
No input. Returns an u32 '''ClockRate'''. | |||
=== Cancel === | |||
No input/output. | |||
= fgm:dbg = | = fgm:dbg = | ||
Line 422: | Line 543: | ||
|- | |- | ||
| 2 || Cancel | | 2 || Cancel | ||
|} | |||
= lbl = | |||
This is "nn::lbl::detail::ILblController". This was moved from [[Backlight_services|lbl]] with [10.0.0+]. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Cmd || Name | |||
|- | |||
| 0 || SaveCurrentSetting | |||
|- | |||
| 1 || LoadCurrentSetting | |||
|- | |||
| 2 || SetCurrentBrightnessSetting | |||
|- | |||
| 3 || GetCurrentBrightnessSetting | |||
|- | |||
| 4 || ApplyCurrentBrightnessSettingToBacklight | |||
|- | |||
| 5 || GetBrightnessSettingAppliedToBacklight | |||
|- | |||
| 6 || SwitchBacklightOn | |||
|- | |||
| 7 || SwitchBacklightOff | |||
|- | |||
| 8 || GetBacklightSwitchStatus | |||
|- | |||
| 9 || EnableDimming | |||
|- | |||
| 10 || DisableDimming | |||
|- | |||
| 11 || IsDimmingEnabled | |||
|- | |||
| 12 || EnableAutoBrightnessControl | |||
|- | |||
| 13 || DisableAutoBrightnessControl | |||
|- | |||
| 14 || IsAutoBrightnessControlEnabled | |||
|- | |||
| 15 || SetAmbientLightSensorValue | |||
|- | |||
| 16 || [[#GetAmbientLightSensorValue]] | |||
|- | |||
| 17 || SetBrightnessReflectionDelayLevel | |||
|- | |||
| 18 || GetBrightnessReflectionDelayLevel | |||
|- | |||
| 19 || SetCurrentBrightnessMapping | |||
|- | |||
| 20 || GetCurrentBrightnessMapping | |||
|- | |||
| 21 || SetCurrentAmbientLightSensorMapping | |||
|- | |||
| 22 || GetCurrentAmbientLightSensorMapping | |||
|- | |||
| 23 || [3.0.0+] IsAmbientLightSensorAvailable | |||
|- | |||
| 24 || [3.0.0+] SetCurrentBrightnessSettingForVrMode | |||
|- | |||
| 25 || [3.0.0+] GetCurrentBrightnessSettingForVrMode | |||
|- | |||
| 26 || [3.0.0+] [[#EnableVrMode]] | |||
|- | |||
| 27 || [3.0.0+] [[#DisableVrMode]] | |||
|- | |||
| 28 || [3.0.0+] [[#IsVrModeEnabled]] | |||
|- | |||
| 29 || [7.0.0+] IsAutoBrightnessControlSupported | |||
|} | |||
== Ambient Light Sensor Notes == | |||
The BH1730 outputs 2 values. Visible light and IR light. This is then calculated through an algorithm that checks for Gain, Measurement time, filter qualities and ouputs lux (max correct measurement of 100K lux). | |||
The default values are Gain 64x and ITIME of 38 (256 - 218). This allows for a max lux value of 17972 lux when visible light value is maximum and IR light is 0. When both of them are on their limit, the output is 1192 lux. | |||
The sensor is fully configurable. | |||
== GetAmbientLightSensorValue == | |||
No input. Before 5.x, outputs lux in float. (5.0.0+) Returns an output struct: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x4 || bOverLimit. (u32) Equals to 1 if visible or IR light data is over 65534. | |||
|- | |||
| 0x4 || 0x4 || fLux. (float) Value in lux from the ambient light sensor. | |||
|} | |||
Note: if bOverLimit=1 and the default ALS configuration is used, the measurement of fLux should not be considered and the actual max value depends on the type of light. Ranges from 12.5K - 17.5K. | |||
== GetCurrentBrightnessSetting == | |||
No input. Returns an output u32 int of the current backlight level. | |||
== GetBrightnessSettingAppliedToBacklight == | |||
No input. Returns an output u32 int of the backlight level computed from the ambient light sensor. | |||
== IsAutoBrightnessControlEnabled == | |||
No input. Returns an output u8 bool indicating whether auto brightness is enabled. | |||
== EnableVrMode == | |||
No input/output. Used by [[AM_services#SetVrModeEnabled]]. | |||
Sets a global state field to 0x1. | |||
== DisableVrMode == | |||
No input/output. Used by [[AM_services#SetVrModeEnabled]]. | |||
Sets the global state field used by [[#EnableVrMode]] to 0x0. | |||
== IsVrModeEnabled == | |||
No input. Returns an output u8 bool set by the above commands. | |||
= Module = | |||
This is "nn::fgm::Module". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Name || Block | |||
|- | |||
| 0 || CPU | |||
|- | |||
| 1 || GPU | |||
|- | |||
| 2 || EMC | |||
|- | |||
| 3 || SCLK | |||
|- | |||
| 4 || MSELECT | |||
|- | |||
| 5 || NVDEC | |||
|- | |||
| 6 || NVENC | |||
|- | |||
| 7 || NVJPG | |||
|} | |} | ||