Skip to content

Create a config file

Stefan Hirschmann edited this page Jun 11, 2017 · 3 revisions

For the beginning, it is usually a good idea to create a summary of everything relevant to control the fan. This could look like that:

  • ReadWriteWords: must be set to false, because the EC uses only one 8 bit (= 1 byte) wide register to store the fan speed instead of 2 8 bit wide (= 2 byte = 1 word) registers
  • ReadRegister: FRDC is at 0x2E = 46 (decimal)
  • WriteRegister: FTGC is at 0x2E + 1 byte = 47 (decimal)
  • MinSpeedValue: 0x58 = 88 (decimal)
  • MaxSpeedValue: 0x30 = 48 (decimal)
  • FanSpeedResetValue: 0xFF = 255 (decimal)
  • CRZN is at 0x22 = 34 (decimal) and allows us to select the current thermal zone
  • TEMP is at 0x22 + 4 byte = 38 (decimal) and allows us to get (or set) the temperature of the currently selected thermal zone
  • TEMP must be overridden, otherwise the EC doesn't allow the fan to be stopped

Then you can go on and translate this knowledge into a NBFC config file:

<?xml version="1.0"?>
<FanControlConfigV2 xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <NotebookModel>HP ProBook 6465b</NotebookModel>
  <ReadWriteWords>false</ReadWriteWords>
  <FanConfigurations>
    <FanConfiguration>
      <ReadRegister>46</ReadRegister>
      <WriteRegister>47</WriteRegister>
      <MinSpeedValue>88</MinSpeedValue>
      <MaxSpeedValue>48</MaxSpeedValue>
      <ResetRequired>true</ResetRequired>
      <FanSpeedResetValue>255</FanSpeedResetValue>
      <FanDisplayName>CPU fan</FanDisplayName>
    </FanConfiguration>
  </FanConfigurations>
</FanControlConfigV2>

This is a working config, but sometimes you must jump through some extra hoops (like enabling the EC's manual control mode) to make it perfect. This can be achieved via RegisterWriteConfigurations.

In this example, the temperature of thermal zone 1 (in this case: CPUZ, the CPU zone) needs to be set to 28°C. This is a little hack which is required because the ProBook 6465b's EC doesn't allow the fan to be turned off if the CPU temperature is over a certain threshold.

The extended config looks like that:

<?xml version="1.0"?>
<FanControlConfigV2 xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <NotebookModel>HP ProBook 6465b</NotebookModel>
  <ReadWriteWords>false</ReadWriteWords>
  <FanConfigurations>
    <FanConfiguration>
      <ReadRegister>46</ReadRegister>
      <WriteRegister>47</WriteRegister>
    </FanConfiguration>
  </FanConfigurations>

  <RegisterWriteConfigurations>
    <RegisterWriteConfiguration>
      <WriteOccasion>OnInitialization</WriteOccasion>
      <Register>34</Register>
      <Value>1</Value>
      <ResetRequired>true</ResetRequired>
      <ResetValue>1</ResetValue>
      <Description>Select thermal zone</Description>
    </RegisterWriteConfiguration>
    <RegisterWriteConfiguration>
      <WriteOccasion>OnInitialization</WriteOccasion>
      <Register>38</Register>
      <Value>28</Value>
      <ResetRequired>true</ResetRequired>
      <ResetValue>0</ResetValue>
      <Description>Fake thermal zone temperature</Description>
    </RegisterWriteConfiguration>
  </RegisterWriteConfigurations>

</FanControlConfigV2>

As icing on the cake you can add your own temperature thresholds to make the fan behave exactly like you want.

Congratulations! You have successfully created a NBFC config file. Please don't forget to share it with others :)