<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.dissonant.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Knuxify</id>
	<title>dissonant.dev wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.dissonant.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Knuxify"/>
	<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/wiki/Special:Contributions/Knuxify"/>
	<updated>2026-04-15T01:42:20Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar/Category:Sidebar_test&amp;diff=155</id>
		<title>MediaWiki:Sidebar/Category:Sidebar test</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar/Category:Sidebar_test&amp;diff=155"/>
		<updated>2026-03-10T15:27:00Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;** https://dissonant.dev | Test&lt;br /&gt;
*** https://wiki.dissonant.dev | Test 2&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar/Category:Sidebar_test&amp;diff=154</id>
		<title>MediaWiki:Sidebar/Category:Sidebar test</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar/Category:Sidebar_test&amp;diff=154"/>
		<updated>2026-03-10T15:22:45Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;** https://dissonant.dev | Test&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar/Category:Sidebar_test&amp;diff=153</id>
		<title>MediaWiki:Sidebar/Category:Sidebar test</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar/Category:Sidebar_test&amp;diff=153"/>
		<updated>2026-03-10T14:52:39Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* https://dissonant.dev | Test&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Category:Sidebar_test&amp;diff=152</id>
		<title>Category:Sidebar test</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Category:Sidebar_test&amp;diff=152"/>
		<updated>2026-03-10T14:48:20Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot;(test page)&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;(test page)&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Meta:Infrastructure&amp;diff=151</id>
		<title>Meta:Infrastructure</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Meta:Infrastructure&amp;diff=151"/>
		<updated>2026-03-10T14:44:36Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page acts as an overview of dissonant.dev&#039;s infrastructure.&lt;br /&gt;
&lt;br /&gt;
== Servers ==&lt;br /&gt;
&lt;br /&gt;
dissonant.dev currently operates on two servers:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;&amp;lt;code&amp;gt;franky&amp;lt;/code&amp;gt;&#039;&#039;&#039; - the main VPS, a [https://www.hetzner.com/ Hetzner] CX22 node. (2x2.1GHz, 4GB RAM, 40GB storage)&lt;br /&gt;
* &#039;&#039;&#039;&amp;lt;code&amp;gt;pandemonica&amp;lt;/code&amp;gt;&#039;&#039;&#039; (a.k.a &#039;&#039;pandy&#039;&#039;) - tiny VPS hosting fxtumblr/tpmblr.com; kindly provided by [https://sdomi.pl/ sdomi]. (1x4.2GHz, 2GB RAM, 10GB storage)&lt;br /&gt;
&lt;br /&gt;
Decomissioned servers:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;&amp;lt;code&amp;gt;arisu&amp;lt;/code&amp;gt;&#039;&#039;&#039; - the previous main VPS, a [https://homecloud.pl/ homecloud.pl] Cloud VPS M node. They stopped offering Cloud VPS nodes, and moved them to their main offering at a marked-up price, which forced me to reconsider my hosting options. (2x2GHz, 4GB RAM, 80GB storage)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;&amp;lt;code&amp;gt;franky&amp;lt;/code&amp;gt; is named after Franky from &#039;&#039;Flying Saucer Video&#039;&#039;. &amp;lt;code&amp;gt;pandemonica&amp;lt;/code&amp;gt; is named after Pandemonica from &#039;&#039;Helltaker&#039;&#039; (I don&#039;t even know what that game&#039;s about I just thought she was neat). &amp;lt;code&amp;gt;arisu&amp;lt;/code&amp;gt; was a Lain reference. I am cringe but I am free.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Expansion possibilities ==&lt;br /&gt;
&lt;br /&gt;
I would like to look into self-hosting some services from home; the main issue is getting a static IPv4 address, but my ISP provides public IPv6 addresses so that would leave us with having to find a proxy of some sort.&lt;br /&gt;
&lt;br /&gt;
[[Category:Sidebar test]]&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar&amp;diff=150</id>
		<title>MediaWiki:Sidebar</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar&amp;diff=150"/>
		<updated>2026-03-10T14:44:01Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* navigation&lt;br /&gt;
** mainpage|mainpage-description&lt;br /&gt;
** recentchanges-url|recentchanges&lt;br /&gt;
** randompage-url|randompage&lt;br /&gt;
** helppage|help-mediawiki&lt;br /&gt;
* Links&lt;br /&gt;
** Meta:Infrastructure|Infrastructure&lt;br /&gt;
* CATEGORY-SIDEBAR&lt;br /&gt;
* SEARCH&lt;br /&gt;
* TOOLBOX&lt;br /&gt;
* LANGUAGES&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=User:Knuxify/sidebartest&amp;diff=149</id>
		<title>User:Knuxify/sidebartest</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=User:Knuxify/sidebartest&amp;diff=149"/>
		<updated>2026-03-10T14:42:43Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot;This is an example page Category:Sidebar test&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is an example page&lt;br /&gt;
[[Category:Sidebar test]]&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar/Category:Sidebar_test&amp;diff=148</id>
		<title>MediaWiki:Sidebar/Category:Sidebar test</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar/Category:Sidebar_test&amp;diff=148"/>
		<updated>2026-03-10T14:42:11Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot; * navigation ** mainpage|mainpage-description ** recentchanges-url|recentchanges ** randompage-url|randompage ** helppage|help-mediawiki * https://dissonant.dev|Test * SEARCH * TOOLBOX * LANGUAGES&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* navigation&lt;br /&gt;
** mainpage|mainpage-description&lt;br /&gt;
** recentchanges-url|recentchanges&lt;br /&gt;
** randompage-url|randompage&lt;br /&gt;
** helppage|help-mediawiki&lt;br /&gt;
* https://dissonant.dev|Test&lt;br /&gt;
* SEARCH&lt;br /&gt;
* TOOLBOX&lt;br /&gt;
* LANGUAGES&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=MediaWiki:Editnotice-notext&amp;diff=147</id>
		<title>MediaWiki:Editnotice-notext</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=MediaWiki:Editnotice-notext&amp;diff=147"/>
		<updated>2025-10-04T05:48:38Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;test&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=MediaWiki:Edittools&amp;diff=146</id>
		<title>MediaWiki:Edittools</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=MediaWiki:Edittools&amp;diff=146"/>
		<updated>2025-10-04T05:48:13Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- Text here will be shown below edit and upload forms. --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=MediaWiki:Edittools&amp;diff=145</id>
		<title>MediaWiki:Edittools</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=MediaWiki:Edittools&amp;diff=145"/>
		<updated>2025-10-04T05:48:05Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- Text here will be shown below edit and upload forms. --&amp;gt;&lt;br /&gt;
a&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx&amp;diff=144</id>
		<title>Mainline:Broadcom Kona/BCM590xx</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx&amp;diff=144"/>
		<updated>2025-09-15T19:46:32Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This &#039;&#039;&#039;root page&#039;&#039;&#039; connects all pages related to the BCM590xx series of PMICs, in particular the BCM59054 and BCM59056.&lt;br /&gt;
&lt;br /&gt;
The BCM590xx PMICs comprise of the following parts:&lt;br /&gt;
&lt;br /&gt;
* Internal interrupt controller ([[/Interrupts]])&lt;br /&gt;
* Regulators ([[/Regulators]])&lt;br /&gt;
* Power-on key controller/PONKEY ([[/PONKEY]])&lt;br /&gt;
* RTC ([[/RTC]])&lt;br /&gt;
* Charger [[/Charger]])&lt;br /&gt;
* Fuel gauge ([[/Fuel gauge]])&lt;br /&gt;
* USB OTG control ([[/USB]])&lt;br /&gt;
* Audio amplifier (?)&lt;br /&gt;
* PWM LED controller&lt;br /&gt;
* ADC used e.g. for thermal monitoring ([[/ADC]])&lt;br /&gt;
&lt;br /&gt;
== Subpages ==&lt;br /&gt;
&lt;br /&gt;
{{Subpages|stripprefix=true}}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/Regulators&amp;diff=143</id>
		<title>Mainline:Broadcom Kona/BCM590xx/Regulators</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/Regulators&amp;diff=143"/>
		<updated>2025-09-15T19:46:20Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot;{{hatnote|Relevant downstream drivers: {{downstream|baffinlite|drivers/regulator/bcmpmu59xxx-regulator.c}}; {{downstream|baffinlite|bcmpmu-regulator.c}}; {{downstream|baffinlite|drivers/regulator/bcm590xx-regulator.c}} and {{downstream|baffinlite|drivers/regulator/bcm59055_regulator.c}} for BCM59055.}}  The BCM590xx PMUs have configurable voltage regulators.  == Regulator types ==  There are two types of regulators: &amp;#039;&amp;#039;&amp;#039;LDO&amp;#039;&amp;#039;&amp;#039; (low dropout) and &amp;#039;&amp;#039;&amp;#039;SR&amp;#039;&amp;#039;&amp;#039; (switcher). Regula...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Relevant downstream drivers: {{downstream|baffinlite|drivers/regulator/bcmpmu59xxx-regulator.c}}; {{downstream|baffinlite|bcmpmu-regulator.c}}; {{downstream|baffinlite|drivers/regulator/bcm590xx-regulator.c}} and {{downstream|baffinlite|drivers/regulator/bcm59055_regulator.c}} for BCM59055.}}&lt;br /&gt;
&lt;br /&gt;
The BCM590xx PMUs have configurable voltage regulators.&lt;br /&gt;
&lt;br /&gt;
== Regulator types ==&lt;br /&gt;
&lt;br /&gt;
There are two types of regulators: &#039;&#039;&#039;LDO&#039;&#039;&#039; (low dropout) and &#039;&#039;&#039;SR&#039;&#039;&#039; (switcher). Regulator names are suffixed with these shortcuts to indicate their type (e.g. &#039;&#039;LVLDO1&#039;&#039; is an LDO, &#039;&#039;CSR&#039;&#039; is an SR).&lt;br /&gt;
&lt;br /&gt;
== Operating modes ==&lt;br /&gt;
&lt;br /&gt;
The operating modes for each regulator are stored in &amp;lt;code&amp;gt;PMMODE&amp;lt;/code&amp;gt; registers. These registers are used to store operating modes for various &#039;&#039;&#039;PC&#039;&#039;&#039; (pin control) configurations. The mode that ends up being used is determined based on the state of PC1 and PC2 pins (and  optionally the GPIO1 pin, if it&#039;s configured to the PC3 function in GPIOCTRL).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;LDOs&#039;&#039;&#039; have &#039;&#039;&#039;2-bit modes&#039;&#039;&#039;. The available modes are &amp;lt;code&amp;gt;ON&amp;lt;/code&amp;gt; (0), &amp;lt;code&amp;gt;LPM&amp;lt;/code&amp;gt; (low power mode; 1) and &amp;lt;code&amp;gt;OFF&amp;lt;/code&amp;gt; (2). {{speculation|Mode 3 is presumably invalid, but hasn&#039;t been tested.}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;SRs&#039;&#039;&#039; have &#039;&#039;&#039;3-bit modes&#039;&#039;&#039;. The exact function of each mode is unknown; the vendor kernel does not bother with the distinction and applies the LDO modes described above.&lt;br /&gt;
&lt;br /&gt;
LDOs get 2 PMMODE registers each; SRs get 4 PMMODE registers. This is to accomodate the different mode sizes.&lt;br /&gt;
&lt;br /&gt;
There is no known way to query the state of PC pins from the BCM590xx itself; instead, the SoC&#039;s pinmux interface could be used.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[User:Knuxify/Old BCM590xx regulator notes|Old BCM590xx regulator notes]], very messy.&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=User:Knuxify/Old_BCM590xx_regulator_notes&amp;diff=142</id>
		<title>User:Knuxify/Old BCM590xx regulator notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=User:Knuxify/Old_BCM590xx_regulator_notes&amp;diff=142"/>
		<updated>2025-09-15T19:18:25Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Knuxify moved page Mainline:Broadcom Kona/BCM590xx/Regulators to User:Knuxify/Old BCM590xx regulator notes without leaving a redirect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;(note: this article has not been cleaned up &#039;&#039;at all&#039;&#039;, it is imported from my local notes as-is.)&lt;br /&gt;
&lt;br /&gt;
== Revisions ==&lt;br /&gt;
&lt;br /&gt;
BCMPMU_59054_ID is ID for 59054&lt;br /&gt;
&lt;br /&gt;
BCMPMU_59054A1_ANA_REV refers to A1 which has ACLD, A0 does not&lt;br /&gt;
&lt;br /&gt;
== Downstream driver notes ==&lt;br /&gt;
&lt;br /&gt;
* The downstream driver used is BCM59xxx, which despite the name is only for the BCM59054&lt;br /&gt;
** In the tree there are also drivers for BCM59056, a handful of other PMUs including BCM59055, and BCM590xx (which confusingly is &#039;&#039;&#039;not&#039;&#039;&#039; the same as BCM59xxx).&lt;br /&gt;
* The whole driver is fragmented as it&#039;s an MFD device, but the most important files are:&lt;br /&gt;
** &amp;lt;code&amp;gt;arch/arm/mach-{codename}/board-bcm59xxx_{device}.c&amp;lt;/code&amp;gt; - contains PMU setup data, including voltages, regulator modes, battery values, etc.&lt;br /&gt;
** various files in &amp;lt;code&amp;gt;drivers/mfd/&amp;lt;/code&amp;gt; starting from &amp;lt;code&amp;gt;bcmpmu59xxx-&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;drivers/regulator/bcmpmu-rgltr-bcm59xxx.c&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;drivers/regulator/bcmpmu59xxx-regulator.c&amp;lt;/code&amp;gt;&lt;br /&gt;
** there&#039;s some OTG related driver in &amp;lt;code&amp;gt;drivers/usb/otg/&amp;lt;/code&amp;gt;? investigate&lt;br /&gt;
** &amp;lt;code&amp;gt;drivers/misc/bcmpmu59xxx_audio.c&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;include/linux/mfd/bcmpmu59xxx_reg.h&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;include/linux/mfd/bcmpmu59054_reg.h&amp;lt;/code&amp;gt;&lt;br /&gt;
** and others not mentioned here. todo&lt;br /&gt;
&lt;br /&gt;
== Regulators ==&lt;br /&gt;
&lt;br /&gt;
SR apparently means &amp;quot;switcher&amp;quot; (drivers/regulator/bcmpmu-regulator-56.c line 249). Rest is LDOs.&lt;br /&gt;
&lt;br /&gt;
== Modes ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;(see &amp;lt;code&amp;gt;drivers/regulator/bcmpmu59xxx-regulator.c&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;include/linux/mfd/bcmpmu59xxx.h&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There are two mode settings: 3bit (GPLDOs only) and 2bit (everything else, including all regs in bcm59056).&lt;br /&gt;
&lt;br /&gt;
A standard regulator can have 3 modes: * ON (&amp;lt;code&amp;gt;REGULATOR_MODE_FAST&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;REGULATOR_MODE_NORMAL&amp;lt;/code&amp;gt;) (0) * LPM (&amp;lt;code&amp;gt;REGULATOR_MODE_IDLE&amp;lt;/code&amp;gt;) (1) * OFF (&amp;lt;code&amp;gt;REGULATOR_MODE_STANDBY&amp;lt;/code&amp;gt;) (2)&lt;br /&gt;
&lt;br /&gt;
* 2-bit mode regulators have 4 PM values in the PMMODE registers, at offsets 0, 2, 4 and 6 respectively (PM0, PM1, PM2, PM3), and &#039;&#039;&#039;2 PMMODE registers&#039;&#039;&#039;. (PMCTRL1 and PMCTRL2)&lt;br /&gt;
* 3-bit mode regulators have 2 PM values in the PMMODE registers, at offsets 0 and 3 respectively, and &#039;&#039;&#039;4 PMMODE registers&#039;&#039;&#039;. (PMCTRL1-&amp;gt;4)&lt;br /&gt;
&lt;br /&gt;
Each PM value corresponds to a different mode.&lt;br /&gt;
&lt;br /&gt;
== BCM59056 and modes ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;(see &amp;lt;code&amp;gt;drivers/regulator/bcmpmu-regulator-56.c&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strike&amp;gt;Unlike BCM59054, there&#039;s only one PMMODE register&amp;lt;/strike&amp;gt; (this is completely wrong! BCM59056 also has multiple PMMODE regs), and it has values PM0 to PM3. DSM (deep sleep) is pins PM0 and PM2. Regular value is written to PM1 and PM3.&lt;br /&gt;
&lt;br /&gt;
I have a sneaking suspicion, based on the mainline driver, and the fact that the function described in the &amp;quot;Enabling the regulator&amp;quot; part will gleefuly ignore PM0 mostly, that PM0 may be some sort of &amp;quot;perma-override&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*State of enabled regualtor in deep sleep     &lt;br /&gt;
Used to program PC2PC1 = 0b10 &amp;amp; 0b00 case     &lt;br /&gt;
when the regulator is enabled*/     &lt;br /&gt;
enum {     &lt;br /&gt;
        BCMPMU_REGL_ON_IN_DSM = 1,     &lt;br /&gt;
        BCMPMU_REGL_LPM_IN_DSM,     &lt;br /&gt;
        BCMPMU_REGL_OFF_IN_DSM     &lt;br /&gt;
};   &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...a PC reference? You&#039;ll see these in the next section.&lt;br /&gt;
&lt;br /&gt;
=== BCM59054 and modes ===&lt;br /&gt;
&lt;br /&gt;
Here, the situation is a bit more complicated because there are multiple PMMODE regs. (Actually BCM59056 seems to have these as well? weird.)&lt;br /&gt;
&lt;br /&gt;
=== Enabling a regulator ===&lt;br /&gt;
&lt;br /&gt;
In theory, enabling a regulator can be done by setting all of its modes to &amp;lt;code&amp;gt;PMMODE_ON&amp;lt;/code&amp;gt;. In practice, however, each regulator has specific &amp;quot;pins&amp;quot; which, when enabled, will enable the regulator. The pins used are stored in &amp;lt;code&amp;gt;arch/arm/mach-java/board-bcm59xxx_*&amp;lt;/code&amp;gt;, under &amp;lt;code&amp;gt;pc_pins_map&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This has a value created with the &amp;quot;PCPIN_MAP_ENC&amp;quot; macro, which effectively packs two &amp;quot;sets&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Set 1&#039;&#039;&#039;, which is the first parameter - if this is set, then &#039;&#039;&#039;all pins in this set must be enabled&#039;&#039;&#039; to enable this regulator.&lt;br /&gt;
* &#039;&#039;&#039;Set 0&#039;&#039;&#039;, which is the second parameter - if this is set, then &#039;&#039;&#039;one of the pins in this set must be enabled&#039;&#039;&#039; to enable this regulator.&lt;br /&gt;
&lt;br /&gt;
The functions &amp;lt;code&amp;gt;__is_2bit_pmmode_regl_enabled&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;__is_3bit_pmmode_regl_enabled&amp;lt;/code&amp;gt; check if a regulator is enabled based on those pin maps, and the &amp;lt;code&amp;gt;pmmode&amp;lt;/code&amp;gt; value as read out from the PMMODE registers.&lt;br /&gt;
&lt;br /&gt;
For every &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt; from 0 to 7 (&amp;lt;code&amp;gt;REGL_PMMODE_VAL_MAX&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* get the PM reg shift by &amp;lt;code&amp;gt;PMMODE_2BIT_PMx_MASK &amp;amp; i&amp;lt;/code&amp;gt; (PMMODE_2BIT_PMx_MASK == 3)&lt;br /&gt;
* if this &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt; gives a value through &amp;lt;code&amp;gt;setval &amp;amp; i&amp;lt;/code&amp;gt; in set0 or set1, then the value of whether the regulator is enabled is calculated using &amp;lt;code&amp;gt;PMMODE_2BIT_PMx_MASK &amp;amp; (pmmode[inx] &amp;gt;&amp;gt; shift)&amp;lt;/code&amp;gt;, where &amp;lt;code&amp;gt;inx&amp;lt;/code&amp;gt; is increased for every value where &amp;lt;code&amp;gt;PMMODE_2BIT_PMx_MASK &amp;amp; i&amp;lt;/code&amp;gt; == 3.&lt;br /&gt;
&lt;br /&gt;
In normal words: if the mode corresponding to the pin in &#039;&#039;any&#039;&#039; of the PMMODE registers is ON, then the regulator is on.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a table of what that looks like:&lt;br /&gt;
&lt;br /&gt;
(i - i iterator, s - pm offset, x - pmmode register no., set0 - matches against joined set0; pc1, pc2, pc3 - the result of the check for each of the possible pins in set0)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;i s x set0   pc1   pc2   pc3&lt;br /&gt;
0 0 0 False [False, False, False]&lt;br /&gt;
1 2 0 True [True, False, False]&lt;br /&gt;
2 4 0 True [False, True, False]&lt;br /&gt;
3 6 0 True [True, True, False]&lt;br /&gt;
4 0 1 True [False, False, True]&lt;br /&gt;
5 2 1 True [True, False, True]&lt;br /&gt;
6 4 1 True [False, True, True]&lt;br /&gt;
7 6 1 True [True, True, True]&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
One thing of note - PC1 matches exactly the same configuration as the non-deep-sleep pins from the BCM59056 driver mentioned earlier. PC2 matches offsets 4 and 6, and PC3 matches everything in the second register, but not the first one.&lt;br /&gt;
&lt;br /&gt;
So, how can the BCM59056 driver ignore that second register? Maybe I just didn&#039;t read something right? (probably...) (update: I think it&#039;s just BCM59054 that pokes multiple regs?)&lt;br /&gt;
&lt;br /&gt;
Update: I found this a little later, in the bcm59&#039;&#039;&#039;0xx&#039;&#039;&#039; driver (actually for the BCM59055).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;#define PC2_IS_0_PC1_IS_0                       0    &lt;br /&gt;
#define PC2_IS_0_PC1_IS_1                       2    &lt;br /&gt;
#define PC2_IS_1_PC1_IS_0                       4    &lt;br /&gt;
#define PC2_IS_1_PC1_IS_1                       6    &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
I suppose this should match the table above?&lt;br /&gt;
&lt;br /&gt;
In any case - what I think is happening here is that which registers are read from to determine the notes are controlled by some kind of pins. Each PMMODE offset represents a different combination of pins to set.&lt;br /&gt;
&lt;br /&gt;
=== The actual function called to prepare the enable value ===&lt;br /&gt;
&lt;br /&gt;
Now that we know how these pins work, we can analyze the second function, &amp;lt;code&amp;gt;__2bit_pmmode_frm_map&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This one&#039;s similar to the previous function:&lt;br /&gt;
&lt;br /&gt;
For every &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt; from 0 to 7 (&amp;lt;code&amp;gt;REGL_PMMODE_VAL_MAX&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* If the value is in set0 or set1, set the value to &amp;lt;code&amp;gt;PMMODE_ON&amp;lt;/code&amp;gt;; otherwise, use &#039;&#039;&#039;&amp;lt;code&amp;gt;dsm_pmmode&amp;lt;/code&amp;gt;&#039;&#039;&#039; (a variable passed at init time). Oooh, DSM again!&lt;br /&gt;
* Figure out the shift and register like before.&lt;br /&gt;
* Add the value to a temp variable by ORing &amp;lt;code&amp;gt;val &amp;lt;&amp;lt; shift&amp;lt;/code&amp;gt; to it.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s the thing: &amp;lt;code&amp;gt;dsm_pmmode&amp;lt;/code&amp;gt;... is the mode value provided in &amp;lt;code&amp;gt;__bcmpmuldo_set_mode&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The mode is set in a few places in the code, and next to one of them, I found this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;                        /* We need to set mode here as regulator framework     &lt;br /&gt;
                        (set_machine_constraints) set the mode first and     &lt;br /&gt;
                        then call enable. We have updated enable function     &lt;br /&gt;
                        to set ON for all states based on customer request     &lt;br /&gt;
                        set_mode function sets PMMODE as needed*/     &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== TL;DR, summary ====&lt;br /&gt;
&lt;br /&gt;
Regulators can be enabled by setting specific offsets at the PMMODE registers to PMMODE_ON. A combination of PC pins can be used to select which offsets and PMMODE registers actually apply - by default, only offsets in PMCTRL1 is used, but the others can be used as well if PC3 is present - see below.&lt;br /&gt;
&lt;br /&gt;
As a gross oversimplification, you can simply set &#039;&#039;every&#039;&#039; register to PMMODE_ON and it should work.&lt;br /&gt;
&lt;br /&gt;
PM0 and PM2 (offsets 0 and 4) may or may not be related to deep sleep mode.&lt;br /&gt;
&lt;br /&gt;
== A note about PC pins ==&lt;br /&gt;
&lt;br /&gt;
According to schematics, on the Grand Neo, PC1 and PC2 are connected to the accordingly named PC1 and PC2 pinctrl pins. PC3 is an alternative function of LCDCS0 - and it&#039;s connected, as PMU_PC3, to the GPIO1 pin on the PMIC.&lt;br /&gt;
&lt;br /&gt;
Turns out, the function of the GPIO pins can be programmed by writing to the GPIOCTRL registers. Here&#039;s the relevant downstream code:&lt;br /&gt;
&lt;br /&gt;
(arch/arm/mach-java/board-bcm59xxx_ss_baffinlite.c)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt; 121         /*  enable PC3 function */&lt;br /&gt;
 122         {.addr = PMU_REG_GPIOCTRL2, .val = 0x0E, .mask = 0xFF},&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Sadly, these regs are completely undocumented, so we can&#039;t know for sure which exact bit enables this function. We also don&#039;t know what happens if it&#039;s &#039;&#039;not&#039;&#039; enabled.&lt;br /&gt;
&lt;br /&gt;
== What about the regulator modes? ==&lt;br /&gt;
&lt;br /&gt;
Somehow, &amp;lt;code&amp;gt;__2bit_pmmode_frm_map&amp;lt;/code&amp;gt; &#039;&#039;doesn&#039;t&#039;&#039; set all of the PMMODE offsets! For the offsets matching the PC pin map, it actually &#039;&#039;leaves them on&#039;&#039;, and only sets the requested mode for the remaining ones! Given that the variable name for the provided mode is &amp;lt;code&amp;gt;dsm_pmmode&amp;lt;/code&amp;gt;, I suspect that Broadcom might&#039;ve abused the mode system to provide the &#039;&#039;deep sleep regulator mode&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
Still, this doesn&#039;t explain how the PC pins are controlled. I can&#039;t find any place in the downstream code that would do it. I suspect I should look at the suspend code...&lt;br /&gt;
&lt;br /&gt;
Note to self: CHIPREG seems interesting. Has a whole bunch of stuff.&lt;br /&gt;
&lt;br /&gt;
Another unrelated note: looks like i2c sets up slew rate for its pins in the driver, investigate&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Template:Todo/style.css&amp;diff=141</id>
		<title>Template:Todo/style.css</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Template:Todo/style.css&amp;diff=141"/>
		<updated>2025-09-15T18:56:31Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot;html.skin-theme-clientpref-night .box-todo { 	color: #fff !important; 	background-color: #5c1e1e !important; 	border-color: #c64242 !important; }  @media (prefers-color-scheme: dark) { 	html.skin-theme-clientpref-os .box-todo { 		color: #fff !important; 		background-color: #5c1e1e !important; 		border-color: #c64242 !important; 	} }&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;html.skin-theme-clientpref-night .box-todo {&lt;br /&gt;
	color: #fff !important;&lt;br /&gt;
	background-color: #5c1e1e !important;&lt;br /&gt;
	border-color: #c64242 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (prefers-color-scheme: dark) {&lt;br /&gt;
	html.skin-theme-clientpref-os .box-todo {&lt;br /&gt;
		color: #fff !important;&lt;br /&gt;
		background-color: #5c1e1e !important;&lt;br /&gt;
		border-color: #c64242 !important;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Template:Note/style.css&amp;diff=140</id>
		<title>Template:Note/style.css</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Template:Note/style.css&amp;diff=140"/>
		<updated>2025-09-15T18:56:03Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot;html.skin-theme-clientpref-night .box-note { 	color: #fff !important; 	background-color: #261c09 !important; 	border-color: #6a481c !important; }  @media (prefers-color-scheme: dark) { 	html.skin-theme-clientpref-os .box-note { 		color: #fff !important; 		background-color: #261c09 !important; 		border-color: #6a481c !important; 	} }&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;html.skin-theme-clientpref-night .box-note {&lt;br /&gt;
	color: #fff !important;&lt;br /&gt;
	background-color: #261c09 !important;&lt;br /&gt;
	border-color: #6a481c !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (prefers-color-scheme: dark) {&lt;br /&gt;
	html.skin-theme-clientpref-os .box-note {&lt;br /&gt;
		color: #fff !important;&lt;br /&gt;
		background-color: #261c09 !important;&lt;br /&gt;
		border-color: #6a481c !important;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Template:Note&amp;diff=139</id>
		<title>Template:Note</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Template:Note&amp;diff=139"/>
		<updated>2025-09-15T18:45:42Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot;&amp;lt;!-- Dark-mode colors are defined in the template style --&amp;gt;&amp;lt;templatestyles src=&amp;quot;Note/style.css&amp;quot;/&amp;gt;&amp;lt;!-- --&amp;gt;&amp;lt;includeonly&amp;gt;{{Icon box | box-icons = Note | box-text = {{{1}}} | border-color = #ac6600 | border-width = 1px | background = #f6efe5 | class = box-note }}&amp;lt;/includeonly&amp;gt;&amp;lt;!--  --&amp;gt;&amp;lt;noinclude&amp;gt; &amp;lt;templatedata&amp;gt; { 	&amp;quot;params&amp;quot;: { 		&amp;quot;1&amp;quot;: { 			&amp;quot;label&amp;quot;: &amp;quot;Text&amp;quot;, 			&amp;quot;description&amp;quot;: &amp;quot;Text to place in the box&amp;quot;, 			&amp;quot;type&amp;quot;: &amp;quot;unbalanced-wikitext&amp;quot;,...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- Dark-mode colors are defined in the template style --&amp;gt;&amp;lt;templatestyles src=&amp;quot;Note/style.css&amp;quot;/&amp;gt;&amp;lt;!--&lt;br /&gt;
--&amp;gt;&amp;lt;includeonly&amp;gt;{{Icon box&lt;br /&gt;
| box-icons = [[File:Reference icon.svg|20px|link=|Note]]&lt;br /&gt;
| box-text = {{{1}}}&lt;br /&gt;
| border-color = #ac6600&lt;br /&gt;
| border-width = 1px&lt;br /&gt;
| background = #f6efe5&lt;br /&gt;
| class = box-note&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&amp;lt;templatedata&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
	&amp;quot;params&amp;quot;: {&lt;br /&gt;
		&amp;quot;1&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Text&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Text to place in the box&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;unbalanced-wikitext&amp;quot;,&lt;br /&gt;
			&amp;quot;required&amp;quot;: true&lt;br /&gt;
		}&lt;br /&gt;
	},&lt;br /&gt;
	&amp;quot;description&amp;quot;: &amp;quot;Note box containing a note.&amp;quot;,&lt;br /&gt;
	&amp;quot;format&amp;quot;: &amp;quot;inline&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/templatedata&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{note|This is quite &#039;&#039;&#039;note-worthy&#039;&#039;&#039;.}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note|This is quite &#039;&#039;&#039;note-worthy&#039;&#039;&#039;.}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/ADC&amp;diff=138</id>
		<title>Mainline:Broadcom Kona/BCM590xx/ADC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/ADC&amp;diff=138"/>
		<updated>2025-08-31T15:37:26Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: /* RTM (Real-Time Measurment) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/hwmon/bcmpmu59xxx-hwmon.c}}, {{downstream|baffinlite|drivers/misc/bcm59055-adc.c}} (for BCM59055 but very well commented, and seems to be about the same as other models).}}&lt;br /&gt;
&lt;br /&gt;
The BCM590xx PMUs provide a 10-bit SAR (Successive Approximation) ADC.&lt;br /&gt;
&lt;br /&gt;
== Reading the ADC data ==&lt;br /&gt;
&lt;br /&gt;
Each ADC channel has two registers which immediately succeed each other. These registers follow the layout outlined below.&lt;br /&gt;
&lt;br /&gt;
To read the ADC data, one needs to combine the DATA_MSB bits (upper 2 bits, first two bits of the first register) with the DATA_LSB (lower 8 bits, entire value of the second register). An additional value at bit 2 is available to check the validity of the read data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
data = ((reg1 &amp;amp; 0x3) &amp;lt;&amp;lt; 8) | reg2;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRLx ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:3&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;READ_INVALID&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
| If 1, the read is invalid; 0 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATA_MSB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1:0&lt;br /&gt;
| Upper (most significant) 2 bits of the ADC data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRLx+1 ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATA_LSB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower (least significant) 8 bits of the ADC data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== RTM (Real-Time Measurment) ==&lt;br /&gt;
&lt;br /&gt;
The last ADC channel, RTM, is reserved for RTM (Real-Time Measurment) mode.&lt;br /&gt;
&lt;br /&gt;
The process for performing an RTM read is as follows:&lt;br /&gt;
&lt;br /&gt;
* In &amp;lt;code&amp;gt;ADCCTRL1&amp;lt;/code&amp;gt;: (these can all be performed in one write)&lt;br /&gt;
** Set the the &amp;lt;code&amp;gt;RTM_CONVERSION&amp;lt;/code&amp;gt; bit to enable RTM mode&lt;br /&gt;
** Write the channel number to read to the &amp;lt;code&amp;gt;RTM_CHANN&amp;lt;/code&amp;gt; offset&lt;br /&gt;
** Write the &amp;lt;code&amp;gt;RTM_START&amp;lt;/code&amp;gt; bit to start the RTM read&lt;br /&gt;
* Wait for the &amp;lt;code&amp;gt;ADC_RTM_DATA_READY&amp;lt;/code&amp;gt; interrupt.&lt;br /&gt;
* Perform a standard data read from the RTM ADC channel registers (see [[#Reading the ADC data]]).&lt;br /&gt;
* Clear the &amp;lt;code&amp;gt;RTM_CONVERSION&amp;lt;/code&amp;gt; bit to disable RTM mode.&lt;br /&gt;
&lt;br /&gt;
== Register layout ==&lt;br /&gt;
&lt;br /&gt;
Values given here are for the BCM59054. These registers are located on map 1.&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRL1 (0x20) ===&lt;br /&gt;
&lt;br /&gt;
Contains settings for RTM mode.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RTM_CHANN&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7:4&lt;br /&gt;
| Channel to read in RTM mode.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RTM_CONVERSION&amp;lt;/code&amp;gt;&lt;br /&gt;
| 3&lt;br /&gt;
| Enable (0) or disable (1) RTM mode. Prerequisite for performing an RTM read.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RTM_START&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
| When set to 1, starts the RTM reading.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RTM_MAX_RST_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1:0&lt;br /&gt;
| Max reset count for RTM mode. Valid values are:&lt;br /&gt;
* 0 (0b00) - 1&lt;br /&gt;
* 1 (0b01) - 3&lt;br /&gt;
* 2 (0b10) - 5&lt;br /&gt;
* 3 (0b11) - 7&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRL2 (0x21) ===&lt;br /&gt;
&lt;br /&gt;
{{note|These are taken from the BCM59055 driver, and haven&#039;t been tested on the BCM59054 yet. {{Speculation|Still, given that the ADCCTRL1 layout is the same, I suspect this one should be the same as well...}}}}&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:6&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;GSM_DEBOUNCE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 5&lt;br /&gt;
| If set to 1, enables ADC burst mode (todo, how does it work?).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RTM_DLY&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4:0&lt;br /&gt;
| RTM read delay. Valid values:&lt;br /&gt;
* 0  (0b00000) - 0ns&lt;br /&gt;
* 1  (0b00001) - 31.25ns&lt;br /&gt;
* 2  (0b00010) - 62.50ns&lt;br /&gt;
* 3  (0b00011) - 93.75ns&lt;br /&gt;
* 4  (0b00100) - 125ns&lt;br /&gt;
* 5  (0b00101) - 156.25ns&lt;br /&gt;
* 6  (0b00110) - 187.50ns&lt;br /&gt;
* 7  (0b00111) - 218.75ns&lt;br /&gt;
* 8  (0b01000) - 250ns&lt;br /&gt;
* 9  (0b01001) - 281.25ns&lt;br /&gt;
* 10 (0b01010) - 312.50ns&lt;br /&gt;
* 11 (0b01011) - 343.75ns&lt;br /&gt;
* 12 (0b01100) - 375ns&lt;br /&gt;
* 13 (0b01101) - 406.25ns&lt;br /&gt;
* 14 (0b01110) - 437.50ns&lt;br /&gt;
* 15 (0b01111) - 468.75ns&lt;br /&gt;
* 16 (0b10000) - 500ns&lt;br /&gt;
* 17 (0b10001) - 531.25ns&lt;br /&gt;
* 18 (0b10010) - 562.50ns&lt;br /&gt;
* 19 (0b10011) - 593.75ns&lt;br /&gt;
* 20 (0b10100) - 625ns&lt;br /&gt;
* 21 (0b10101) - 656.25ns&lt;br /&gt;
* 22 (0b10110) - 687.50ns&lt;br /&gt;
* 23 (0b10111) - 718.75ns&lt;br /&gt;
* 24 (0b11000) - 750ns&lt;br /&gt;
* 25 (0b11001) - 781.25ns&lt;br /&gt;
* 26 (0b11010) - 812.50ns&lt;br /&gt;
* 27 (0b11011) - 843.75ns&lt;br /&gt;
* 28 (0b11100) - 875ns&lt;br /&gt;
* 29 (0b11101) - 906.25ns&lt;br /&gt;
* 30 (0b11110) - 937.50ns&lt;br /&gt;
* 31 (0b11111) - 968.75ns&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRL3 - ADCCTRL28 ===&lt;br /&gt;
&lt;br /&gt;
ADC channel registers; see layout above.&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRL29 and ADCCTRL30 ===&lt;br /&gt;
&lt;br /&gt;
Unknown.&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/ADC&amp;diff=137</id>
		<title>Mainline:Broadcom Kona/BCM590xx/ADC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/ADC&amp;diff=137"/>
		<updated>2025-08-31T15:34:27Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/hwmon/bcmpmu59xxx-hwmon.c}}, {{downstream|baffinlite|drivers/misc/bcm59055-adc.c}} (for BCM59055 but very well commented, and seems to be about the same as other models).}}&lt;br /&gt;
&lt;br /&gt;
The BCM590xx PMUs provide a 10-bit SAR (Successive Approximation) ADC.&lt;br /&gt;
&lt;br /&gt;
== Reading the ADC data ==&lt;br /&gt;
&lt;br /&gt;
Each ADC channel has two registers which immediately succeed each other. These registers follow the layout outlined below.&lt;br /&gt;
&lt;br /&gt;
To read the ADC data, one needs to combine the DATA_MSB bits (upper 2 bits, first two bits of the first register) with the DATA_LSB (lower 8 bits, entire value of the second register). An additional value at bit 2 is available to check the validity of the read data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
data = ((reg1 &amp;amp; 0x3) &amp;lt;&amp;lt; 8) | reg2;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRLx ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:3&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;READ_INVALID&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
| If 1, the read is invalid; 0 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATA_MSB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1:0&lt;br /&gt;
| Upper (most significant) 2 bits of the ADC data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRLx+1 ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATA_LSB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower (least significant) 8 bits of the ADC data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== RTM (Real-Time Measurment) ==&lt;br /&gt;
&lt;br /&gt;
The last ADC channel, RTM, is reserved for RTM (Real-Time Measurment) mode.&lt;br /&gt;
&lt;br /&gt;
The process for performing an RTM read is as follows:&lt;br /&gt;
&lt;br /&gt;
* In &amp;lt;code&amp;gt;ADCCTRL1&amp;lt;/code&amp;gt;: (these can all be performed in one write)&lt;br /&gt;
** Set the the &amp;lt;code&amp;gt;RTM_CONVERSION&amp;lt;/code&amp;gt; bit to enable RTM mode&lt;br /&gt;
** Write the channel number to read to the &amp;lt;code&amp;gt;RTM_CHAN&amp;lt;/code&amp;gt; offset&lt;br /&gt;
** Write the &amp;lt;code&amp;gt;RTM_START&amp;lt;/code&amp;gt; bit to start the RTM read&lt;br /&gt;
* Wait for the &amp;lt;code&amp;gt;ADC_RTM_DATA_READY&amp;lt;/code&amp;gt; interrupt.&lt;br /&gt;
* Perform a standard data read from the RTM ADC channel registers (see [[#Reading the data]]).&lt;br /&gt;
* Clear the &amp;lt;code&amp;gt;RTM_CONVERSION&amp;lt;/code&amp;gt; bit to disable RTM mode.&lt;br /&gt;
&lt;br /&gt;
== Register layout ==&lt;br /&gt;
&lt;br /&gt;
Values given here are for the BCM59054. These registers are located on map 1.&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRL1 (0x20) ===&lt;br /&gt;
&lt;br /&gt;
Contains settings for RTM mode.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RTM_CHANN&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7:4&lt;br /&gt;
| Channel to read in RTM mode.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RTM_CONVERSION&amp;lt;/code&amp;gt;&lt;br /&gt;
| 3&lt;br /&gt;
| Enable (0) or disable (1) RTM mode. Prerequisite for performing an RTM read.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RTM_START&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
| When set to 1, starts the RTM reading.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RTM_MAX_RST_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1:0&lt;br /&gt;
| Max reset count for RTM mode. Valid values are:&lt;br /&gt;
* 0 (0b00) - 1&lt;br /&gt;
* 1 (0b01) - 3&lt;br /&gt;
* 2 (0b10) - 5&lt;br /&gt;
* 3 (0b11) - 7&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRL2 (0x21) ===&lt;br /&gt;
&lt;br /&gt;
{{note|These are taken from the BCM59055 driver, and haven&#039;t been tested on the BCM59054 yet. {{Speculation|Still, given that the ADCCTRL1 layout is the same, I suspect this one should be the same as well...}}}}&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:6&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;GSM_DEBOUNCE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 5&lt;br /&gt;
| If set to 1, enables ADC burst mode (todo, how does it work?).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RTM_DLY&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4:0&lt;br /&gt;
| RTM read delay. Valid values:&lt;br /&gt;
* 0  (0b00000) - 0ns&lt;br /&gt;
* 1  (0b00001) - 31.25ns&lt;br /&gt;
* 2  (0b00010) - 62.50ns&lt;br /&gt;
* 3  (0b00011) - 93.75ns&lt;br /&gt;
* 4  (0b00100) - 125ns&lt;br /&gt;
* 5  (0b00101) - 156.25ns&lt;br /&gt;
* 6  (0b00110) - 187.50ns&lt;br /&gt;
* 7  (0b00111) - 218.75ns&lt;br /&gt;
* 8  (0b01000) - 250ns&lt;br /&gt;
* 9  (0b01001) - 281.25ns&lt;br /&gt;
* 10 (0b01010) - 312.50ns&lt;br /&gt;
* 11 (0b01011) - 343.75ns&lt;br /&gt;
* 12 (0b01100) - 375ns&lt;br /&gt;
* 13 (0b01101) - 406.25ns&lt;br /&gt;
* 14 (0b01110) - 437.50ns&lt;br /&gt;
* 15 (0b01111) - 468.75ns&lt;br /&gt;
* 16 (0b10000) - 500ns&lt;br /&gt;
* 17 (0b10001) - 531.25ns&lt;br /&gt;
* 18 (0b10010) - 562.50ns&lt;br /&gt;
* 19 (0b10011) - 593.75ns&lt;br /&gt;
* 20 (0b10100) - 625ns&lt;br /&gt;
* 21 (0b10101) - 656.25ns&lt;br /&gt;
* 22 (0b10110) - 687.50ns&lt;br /&gt;
* 23 (0b10111) - 718.75ns&lt;br /&gt;
* 24 (0b11000) - 750ns&lt;br /&gt;
* 25 (0b11001) - 781.25ns&lt;br /&gt;
* 26 (0b11010) - 812.50ns&lt;br /&gt;
* 27 (0b11011) - 843.75ns&lt;br /&gt;
* 28 (0b11100) - 875ns&lt;br /&gt;
* 29 (0b11101) - 906.25ns&lt;br /&gt;
* 30 (0b11110) - 937.50ns&lt;br /&gt;
* 31 (0b11111) - 968.75ns&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRL3 - ADCCTRL28 ===&lt;br /&gt;
&lt;br /&gt;
ADC channel registers; see layout above.&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRL29 and ADCCTRL30 ===&lt;br /&gt;
&lt;br /&gt;
Unknown.&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/ADC&amp;diff=136</id>
		<title>Mainline:Broadcom Kona/BCM590xx/ADC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/ADC&amp;diff=136"/>
		<updated>2025-08-31T15:26:40Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: /* RTM (Real-Time Measurment) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/hwmon/bcmpmu59xxx-hwmon.c}}, {{downstream|baffinlite|drivers/misc/bcm59055-adc.c}} (for BCM59055 but very well commented, and seems to be about the same as other models).}}&lt;br /&gt;
&lt;br /&gt;
The BCM590xx PMUs provide a 10-bit SAR (Successive Approximation) ADC.&lt;br /&gt;
&lt;br /&gt;
== Reading the ADC data ==&lt;br /&gt;
&lt;br /&gt;
Each ADC channel has two registers which immediately succeed each other. These registers follow the layout outlined below.&lt;br /&gt;
&lt;br /&gt;
To read the ADC data, one needs to combine the DATA_MSB bits (upper 2 bits, first two bits of the first register) with the DATA_LSB (lower 8 bits, entire value of the second register). An additional value at bit 2 is available to check the validity of the read data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
data = ((reg1 &amp;amp; 0x3) &amp;lt;&amp;lt; 8) | reg2;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRLx ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:3&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;READ_INVALID&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
| If 1, the read is invalid; 0 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATA_MSB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1:0&lt;br /&gt;
| Upper (most significant) 2 bits of the ADC data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRLx+1 ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATA_LSB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower (least significant) 8 bits of the ADC data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== RTM (Real-Time Measurment) ==&lt;br /&gt;
&lt;br /&gt;
The last ADC channel, RTM, is reserved for RTM (Real-Time Measurment) mode.&lt;br /&gt;
&lt;br /&gt;
The process for performing an RTM read is as follows:&lt;br /&gt;
&lt;br /&gt;
* In &amp;lt;code&amp;gt;ADCCTRL1&amp;lt;/code&amp;gt;: (these can all be performed in one write)&lt;br /&gt;
** Set the the &amp;lt;code&amp;gt;RTM_CONVERSION&amp;lt;/code&amp;gt; bit to enable RTM mode&lt;br /&gt;
** Write the channel number to read to the &amp;lt;code&amp;gt;RTM_CHAN&amp;lt;/code&amp;gt; offset&lt;br /&gt;
** Write the &amp;lt;code&amp;gt;RTM_START&amp;lt;/code&amp;gt; bit to start the RTM read&lt;br /&gt;
* Wait for the &amp;lt;code&amp;gt;ADC_RTM_DATA_READY&amp;lt;/code&amp;gt; interrupt.&lt;br /&gt;
* Perform a standard data read from the RTM ADC channel registers (see [[#Reading the data]]).&lt;br /&gt;
* Clear the &amp;lt;code&amp;gt;RTM_CONVERSION&amp;lt;/code&amp;gt; bit to disable RTM mode.&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/ADC&amp;diff=135</id>
		<title>Mainline:Broadcom Kona/BCM590xx/ADC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/ADC&amp;diff=135"/>
		<updated>2025-08-31T14:58:15Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/hwmon/bcmpmu59xxx-hwmon.c}}, {{downstream|baffinlite|drivers/misc/bcm59055-adc.c}} (for BCM59055 but very well commented, and seems to be about the same as other models).}}&lt;br /&gt;
&lt;br /&gt;
The BCM590xx PMUs provide a 10-bit SAR (Successive Approximation) ADC.&lt;br /&gt;
&lt;br /&gt;
== Reading the ADC data ==&lt;br /&gt;
&lt;br /&gt;
Each ADC channel has two registers which immediately succeed each other. These registers follow the layout outlined below.&lt;br /&gt;
&lt;br /&gt;
To read the ADC data, one needs to combine the DATA_MSB bits (upper 2 bits, first two bits of the first register) with the DATA_LSB (lower 8 bits, entire value of the second register). An additional value at bit 2 is available to check the validity of the read data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
data = ((reg1 &amp;amp; 0x3) &amp;lt;&amp;lt; 8) | reg2;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRLx ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:3&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;READ_INVALID&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
| If 1, the read is invalid; 0 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATA_MSB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1:0&lt;br /&gt;
| Upper (most significant) 2 bits of the ADC data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRLx+1 ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATA_LSB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower (least significant) 8 bits of the ADC data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== RTM (Real-Time Measurment) ==&lt;br /&gt;
&lt;br /&gt;
The last ADC channel, RTM, is reserved for RTM (Real-Time Measurment) mode.&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/ADC&amp;diff=134</id>
		<title>Mainline:Broadcom Kona/BCM590xx/ADC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/ADC&amp;diff=134"/>
		<updated>2025-08-31T14:56:28Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/hwmon/bcmpmu59xxx-hwmon.c}}, {{downstream|baffinlite|drivers/misc/bcm59055-adc.}} (for BCM59055 but very well commented, and seems to be about the same as other models).}}  The BCM590xx PMUs provide a 10-bit SAR (Successive Approximation) ADC.  == Reading the ADC data ==  Each ADC channel has two registers which immediately succeed each other. These registers follow the layout outlined below.  To read the ADC d...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/hwmon/bcmpmu59xxx-hwmon.c}}, {{downstream|baffinlite|drivers/misc/bcm59055-adc.}} (for BCM59055 but very well commented, and seems to be about the same as other models).}}&lt;br /&gt;
&lt;br /&gt;
The BCM590xx PMUs provide a 10-bit SAR (Successive Approximation) ADC.&lt;br /&gt;
&lt;br /&gt;
== Reading the ADC data ==&lt;br /&gt;
&lt;br /&gt;
Each ADC channel has two registers which immediately succeed each other. These registers follow the layout outlined below.&lt;br /&gt;
&lt;br /&gt;
To read the ADC data, one needs to combine the DATA_MSB bits (upper 2 bits, first two bits of the first register) with the DATA_LSB (lower 8 bits, entire value of the second register). An additional value at bit 2 is available to check the validity of the read data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
data = ((reg1 &amp;amp; 0x3) &amp;lt;&amp;lt; 8) | reg2;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRLx ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:3&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;READ_INVALID&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
| If 1, the read is invalid; 0 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATA_MSB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1:0&lt;br /&gt;
| Upper (most significant) 2 bits of the ADC data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ADCCTRLx+1 ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATA_LSB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower (least significant) 8 bits of the ADC data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== RTM (Real-Time Measurment) ==&lt;br /&gt;
&lt;br /&gt;
The last ADC channel, RTM, is reserved for RTM (Real-Time Measurment) mode.&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx&amp;diff=133</id>
		<title>Mainline:Broadcom Kona/BCM590xx</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx&amp;diff=133"/>
		<updated>2025-08-31T14:45:25Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This &#039;&#039;&#039;root page&#039;&#039;&#039; connects all pages related to the BCM590xx series of PMICs, in particular the BCM59054 and BCM59056.&lt;br /&gt;
&lt;br /&gt;
The BCM590xx PMICs comprise of the following parts:&lt;br /&gt;
&lt;br /&gt;
* Internal interrupt controller ([[/Interrupts]])&lt;br /&gt;
* Regulators ([[/Regulators]] - WIP article, needs updates)&lt;br /&gt;
* Power-on key controller/PONKEY ([[/PONKEY]])&lt;br /&gt;
* RTC ([[/RTC]])&lt;br /&gt;
* Charger [[/Charger]])&lt;br /&gt;
* Fuel gauge ([[/Fuel gauge]])&lt;br /&gt;
* USB OTG control ([[/USB]])&lt;br /&gt;
* Audio amplifier (?)&lt;br /&gt;
* PWM LED controller&lt;br /&gt;
* ADC used e.g. for thermal monitoring ([[/ADC]])&lt;br /&gt;
&lt;br /&gt;
== Subpages ==&lt;br /&gt;
&lt;br /&gt;
{{Subpages|stripprefix=true}}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/USB&amp;diff=132</id>
		<title>Mainline:Broadcom Kona/BCM590xx/USB</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/USB&amp;diff=132"/>
		<updated>2025-08-27T13:11:27Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hatnote|Downstream drivers: {{downstream|baffinlite|drivers/mfd/bcmpmu59xxx-accy-core.c}}, {{downstream|baffinlite|bcmpmu59xxx-accy-detect.c}}, {{downstream|baffinlite|drivers/mfd/bcmpmu59xxx-accy.c}} which is unused?, {{downstream|baffinlite|drivers/mfd/bcm590xx-usb.c}} for the BCM59055; {{downstream|baffinlite|drivers/usb/otg/bcm_otg_adp.c}}, {{downstream|baffinlite|drivers/usb/otg/bcmpmu59xxx_otg_xceiv.c}}, and to some extent external MUIC drivers which hook into the BCM59xxx drivers:}}&lt;br /&gt;
&lt;br /&gt;
The BCM590xx PMUs are capable of USB port management and cable detection.&lt;br /&gt;
&lt;br /&gt;
== Glossary ==&lt;br /&gt;
&lt;br /&gt;
Some terms get mentioned repeatedly in USB OTG code. These are common terms related to either the USB 2.0 spec or the USB OTG spec, and appear often in other drivers as well.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;VBUS&#039;&#039;&#039; - the 5V power rail in an USB cable. When the device is charging or plugged in as a peripheral (e.g. to a computer), the voltage is provided by the charger; when an USB OTG dongle is plugged in (the device operates in host mode), it needs to provide its own voltage. Most PMUs, the BCM590xx included, provide a &amp;quot;VBUS boost&amp;quot; (&#039;&#039;VBUSB&#039;&#039;) mode to enable VBUS from the device for host mode and disable it for peripheral mode/charging.&lt;br /&gt;
* &#039;&#039;&#039;ID&#039;&#039;&#039; - The ID pin on the microUSB connector. A floating (not connected to ground) ID pin indicates that the device is to be connected as a peripheral; a grounded ID pin indicates the device should act as the host, and different resistance values between GND and ID can be used to switch between different device types (per the USB Carkit standard).&lt;br /&gt;
* &#039;&#039;&#039;ADP&#039;&#039;&#039; - From USB OTG docs: &amp;quot;The Attach Detection Protocol (ADP) allows an SRP-capable Targeted Host or peripheral-only B-device to detect when a remote device has been attached or detached when VBUS is not present.&amp;quot;&amp;lt;ref&amp;gt;https://ia601605.us.archive.org/7/items/usb_20_202303/USB_OTG_and_EH_2-0-version%201_1a.pdf section 5.4.&amp;lt;/ref&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;SRP&#039;&#039;&#039; - Stands for &#039;&#039;Session Request Protocol&#039;&#039;. An SRP request can be sent by an USB peripheral to the host device to enable VBUS.&lt;br /&gt;
* &#039;&#039;&#039;BC1.2&#039;&#039;&#039; - the [https://www.usb.org/document-library/battery-charging-v12-spec-and-adopters-agreement USB Battery Charging 1.2 specification]. (Code might use &amp;quot;BC&amp;quot; or &amp;quot;BC12&amp;quot; to refer to it.)&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/USB&amp;diff=131</id>
		<title>Mainline:Broadcom Kona/BCM590xx/USB</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/USB&amp;diff=131"/>
		<updated>2025-08-27T13:01:33Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hatnote|Downstream drivers: {{downstream|baffinlite|drivers/mfd/bcmpmu59xxx-accy-core.c}}, {{downstream|baffinlite|bcmpmu59xxx-accy-detect.c}}, {{downstream|baffinlite|drivers/mfd/bcmpmu59xxx-accy.c}} which is unused?, {{downstream|baffinlite|drivers/mfd/bcm590xx-usb.c}} for the BCM59055; {{downstream|baffinlite|drivers/usb/otg/bcm_otg_adp.c}}, {{downstream|baffinlite|drivers/usb/otg/bcmpmu59xxx_otg_xceiv.c}}, and to some extent external MUIC drivers which hook into the BCM59xxx drivers:}}&lt;br /&gt;
&lt;br /&gt;
The BCM590xx PMUs are capable of USB port management and cable detection.&lt;br /&gt;
&lt;br /&gt;
== Glossary ==&lt;br /&gt;
&lt;br /&gt;
Some terms get mentioned repeatedly in USB OTG code. These are common terms related to either the USB 2.0 spec or the USB OTG spec, and appear often in other drivers as well.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;VBUS&#039;&#039;&#039; - the 5V power rail in an USB cable. When the device is charging or plugged in as a peripheral (e.g. to a computer), the voltage is provided by the charger; when an USB OTG dongle is plugged in (the device operates in host mode), it needs to provide its own voltage. Most PMUs, the BCM590xx included, provide a &amp;quot;VBUS boost&amp;quot; (&#039;&#039;VBUSB&#039;&#039;) mode to enable VBUS from the device for host mode and disable it for peripheral mode/charging.&lt;br /&gt;
* &#039;&#039;&#039;ID&#039;&#039;&#039; - The ID pin on the microUSB connector. A floating (not connected to ground) ID pin indicates that the device is to be connected as a peripheral; a grounded ID pin indicates the device should act as the host, and different resistance values between GND and ID can be used to switch between different device types (per the USB Carkit standard).&lt;br /&gt;
* &#039;&#039;&#039;ADP&#039;&#039;&#039; - From USB OTG docs: &amp;quot;The Attach Detection Protocol (ADP) allows an SRP-capable Targeted Host or peripheral-only B-device to detect when a remote device has been attached or detached when VBUS is not present.&amp;quot;&amp;lt;ref&amp;gt;https://ia601605.us.archive.org/7/items/usb_20_202303/USB_OTG_and_EH_2-0-version%201_1a.pdf section 5.4.&amp;lt;/ref&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;SRP&#039;&#039;&#039; - Stands for &#039;&#039;Session Request Protocol&#039;&#039;. An SRP request can be sent by an USB peripheral to the host device to enable VBUS.&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/USB&amp;diff=130</id>
		<title>Mainline:Broadcom Kona/BCM590xx/USB</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/USB&amp;diff=130"/>
		<updated>2025-08-27T08:07:28Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: /* Glossary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hatnote|Downstream drivers: {{downstream|baffinlite|drivers/mfd/bcmpmu59xxx-accy-core.c}}, {{downstream|baffinlite|bcmpmu59xxx-accy-detect.c}}, {{downstream|baffinlite|drivers/mfd/bcmpmu59xxx-accy.c}} which is unused?, {{downstream|baffinlite|drivers/mfd/bcm590xx-usb.c}} for the BCM59055.}}&lt;br /&gt;
&lt;br /&gt;
The BCM590xx PMUs are capable of USB port management and cable detection.&lt;br /&gt;
&lt;br /&gt;
== Glossary ==&lt;br /&gt;
&lt;br /&gt;
Some terms get mentioned repeatedly in USB OTG code. These are common terms related to either the USB 2.0 spec or the USB OTG spec, and appear often in other drivers as well.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;VBUS&#039;&#039;&#039; - the 5V power rail in an USB cable. When the device is charging or plugged in as a peripheral (e.g. to a computer), the voltage is provided by the charger; when an USB OTG dongle is plugged in (the device operates in host mode), it needs to provide its own voltage. Most PMUs, the BCM590xx included, provide a &amp;quot;VBUS boost&amp;quot; (&#039;&#039;VBUSB&#039;&#039;) mode to enable VBUS from the device for host mode and disable it for peripheral mode/charging.&lt;br /&gt;
* &#039;&#039;&#039;ID&#039;&#039;&#039; - The ID pin on the microUSB connector. A floating (not connected to ground) ID pin indicates that the device is to be connected as a peripheral; a grounded ID pin indicates the device should act as the host, and different resistance values between GND and ID can be used to switch between different device types (per the USB Carkit standard).&lt;br /&gt;
* &#039;&#039;&#039;ADP&#039;&#039;&#039; - From USB OTG docs: &amp;quot;The Attach Detection Protocol (ADP) allows an SRP-capable Targeted Host or peripheral-only B-device to detect when a remote device has been attached or detached when VBUS is not present.&amp;quot;&amp;lt;ref&amp;gt;https://ia601605.us.archive.org/7/items/usb_20_202303/USB_OTG_and_EH_2-0-version%201_1a.pdf section 5.4.&amp;lt;/ref&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;SRP&#039;&#039;&#039; - Stands for &#039;&#039;Session Request Protocol&#039;&#039;. An SRP request can be sent by an USB peripheral to the host device to enable VBUS.&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/USB&amp;diff=129</id>
		<title>Mainline:Broadcom Kona/BCM590xx/USB</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/USB&amp;diff=129"/>
		<updated>2025-08-27T06:22:11Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot;{{Hatnote|Downstream drivers: {{downstream|baffinlite|drivers/mfd/bcmpmu59xxx-accy-core.c}}, {{downstream|baffinlite|bcmpmu59xxx-accy-detect.c}}, {{downstream|baffinlite|drivers/mfd/bcmpmu59xxx-accy.c}} which is unused?, {{downstream|baffinlite|drivers/mfd/bcm590xx-usb.c}} for the BCM59055.}}  The BCM590xx PMUs are capable of USB port management and cable detection.  == Glossary ==  Some terms get mentioned repeatedly in USB OTG code. These are common terms related to ei...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hatnote|Downstream drivers: {{downstream|baffinlite|drivers/mfd/bcmpmu59xxx-accy-core.c}}, {{downstream|baffinlite|bcmpmu59xxx-accy-detect.c}}, {{downstream|baffinlite|drivers/mfd/bcmpmu59xxx-accy.c}} which is unused?, {{downstream|baffinlite|drivers/mfd/bcm590xx-usb.c}} for the BCM59055.}}&lt;br /&gt;
&lt;br /&gt;
The BCM590xx PMUs are capable of USB port management and cable detection.&lt;br /&gt;
&lt;br /&gt;
== Glossary ==&lt;br /&gt;
&lt;br /&gt;
Some terms get mentioned repeatedly in USB OTG code. These are common terms related to either the USB 2.0 spec or the USB OTG spec, and appear often in other drivers as well.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;VBUS&#039;&#039;&#039; - the 5V power rail in an USB cable. When the device is charging or plugged in as a peripheral (e.g. to a computer), the voltage is provided by the charger; when an USB OTG dongle is plugged in (the device operates in host mode), it needs to provide its own voltage. Most PMUs, the BCM590xx included, provide a &amp;quot;VBUS boost&amp;quot; (&#039;&#039;VBUSB&#039;&#039;) mode to enable VBUS from the device for host mode and disable it for peripheral mode/charging.&lt;br /&gt;
* &#039;&#039;&#039;ID&#039;&#039;&#039; - The ID pin on the microUSB connector. A floating (not connected to ground) ID pin indicates that the device is to be connected as a peripheral; a grounded ID pin indicates the device should act as the host, and different resistance values between GND and ID can be used to switch between different device types (per the USB Carkit standard).&lt;br /&gt;
* &#039;&#039;&#039;ADP&#039;&#039;&#039; - From USB OTG docs: &amp;quot;The Attach Detection Protocol (ADP) allows an SRP-capable Targeted Host or peripheral-only B-device to detect when a remote device has been attached or detached when VBUS is not present.&amp;quot;&amp;lt;ref&amp;gt;https://ia601605.us.archive.org/7/items/usb_20_202303/USB_OTG_and_EH_2-0-version%201_1a.pdf section 5.4.&amp;lt;/ref&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;SRP&#039;&#039;&#039; - Stands for &#039;&#039;Session Request Protocol&#039;&#039;.&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/PONKEY&amp;diff=128</id>
		<title>Mainline:Broadcom Kona/BCM590xx/PONKEY</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/PONKEY&amp;diff=128"/>
		<updated>2025-08-17T09:56:37Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/input/misc/bcmpmu59xxx_ponkey.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMU can handle a power-on key (the responsible section is nicknamed PONKEY).&lt;br /&gt;
&lt;br /&gt;
== Key press detection ==&lt;br /&gt;
&lt;br /&gt;
When a key is pressed, the internal IRQ for a key press (BCM59054_IRQ_POK_PRESSED/BCM59056_IRQ_PONKEYB_F) is raised; when it is released, the internal IRQ for a key release (BCM59054_IRQ_POK_RELEASED/BCM59056_IRQ_PONKEYB_R) is raised. A driver can interpret these IRQs to toggle a key on/off (in downstream, it&#039;s wired up to &amp;lt;code&amp;gt;KEY_POWER&amp;lt;/code&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Debounce interval ===&lt;br /&gt;
&lt;br /&gt;
A debounce interval can be configured independently for button press and release. The debounce values are 3 bits wide and stored in &amp;lt;code&amp;gt;PONKEYCTRL1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For the BCM59054/BCM59056, the allowed values are 330ns, 1.2ms, 10ms, 50ms, 100ms, 500ms, 1000ms and 2000ms. For the BCM59039/BCM59042/BCM59055, the allowed values are undocumented, but different from BCM59054/56 - &amp;lt;code&amp;gt;3&amp;lt;/code&amp;gt; is equal to 100ms (whereas it&#039;s 50ms on 54/56).&lt;br /&gt;
&lt;br /&gt;
== Timer ==&lt;br /&gt;
&lt;br /&gt;
TODO. Seems like it might be possible to control long-press function using a timer (one of &amp;quot;poweroff&amp;quot;, &amp;quot;restart&amp;quot; or &amp;quot;smart reset&amp;quot;). [https://github.com/knuxdroid/android_kernel_samsung_baffinlite/blob/cm-12.1/drivers/input/misc/bcmpmu59xxx_ponkey.c#L204-L277 Relevant kernel sources], notably commented out.&lt;br /&gt;
&lt;br /&gt;
== Registers (BCM59054) ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|See {{downstream|baffinlite|include/linux/mfd/bcmpmu59054_reg.h}}.}}&lt;br /&gt;
&lt;br /&gt;
All of them are on MAP0.&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL1 (0x08) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RELEASE_DEB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 5:3&lt;br /&gt;
| Represents the release debounce. &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PRESS_DEB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2:0&lt;br /&gt;
| Represents the press debounce.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL2 (0x09) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TX1_ACTION&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7:6&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TX1_DLY&amp;lt;/code&amp;gt;&lt;br /&gt;
| 5:3&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TX1_DEB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2:0&lt;br /&gt;
| TODO&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL3 (0x0A) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TX2_ACTION&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7:6&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TX2_DLY&amp;lt;/code&amp;gt;&lt;br /&gt;
| 5:3&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TX2_DEB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2:0&lt;br /&gt;
| TODO&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL4 (0x0B) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;KEY_PAD_LOCK_MODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;KEY_PAD_LOCK&amp;lt;/code&amp;gt;&lt;br /&gt;
| 5&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;POK_RESTART_EN&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 3&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;POK_WAKUP_DEB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2:0&lt;br /&gt;
| TODO&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL5 (0x0C) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:0&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL6 (0x0D) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:5&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SMART_RST_DLY&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4:3&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SMART_RST_STATUS&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SMART_RST_PWR_EN&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SMART_RST_EN&amp;lt;/code&amp;gt;&lt;br /&gt;
| 0&lt;br /&gt;
| TODO&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL7 (0x0E) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:0&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL8 (0x0F) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TX3_ACTION&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7:6&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TX3_DLY&amp;lt;/code&amp;gt;&lt;br /&gt;
| 5:3&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TX3_DEB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2:0&lt;br /&gt;
| TODO&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Template:Todo&amp;diff=127</id>
		<title>Template:Todo</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Template:Todo&amp;diff=127"/>
		<updated>2025-08-17T09:39:41Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot;&amp;lt;!-- Dark-mode colors are defined in the template style --&amp;gt;&amp;lt;templatestyles src=&amp;quot;Todo/style.css&amp;quot;/&amp;gt;&amp;lt;!-- --&amp;gt;&amp;lt;includeonly&amp;gt;{{Icon box | box-icons = TODO | box-text = &amp;lt;b&amp;gt;TODO:&amp;lt;/b&amp;gt; {{{1}}} | border-color = #b60000 | border-width = 1px | background = #fdd1d1 | class = box-todo }}&amp;lt;!-- Category: --&amp;gt;{{#if: {{{nocategory|}}}||Category:To-do items}}&amp;lt;/includeonly&amp;gt;&amp;lt;!--  --&amp;gt;&amp;lt;noinclude&amp;gt; &amp;lt;templatedata&amp;gt; { 	&amp;quot;params&amp;quot;: { 		&amp;quot;1&amp;quot;: { 			&amp;quot;label&amp;quot;: &amp;quot;Text&amp;quot;...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- Dark-mode colors are defined in the template style --&amp;gt;&amp;lt;templatestyles src=&amp;quot;Todo/style.css&amp;quot;/&amp;gt;&amp;lt;!--&lt;br /&gt;
--&amp;gt;&amp;lt;includeonly&amp;gt;{{Icon box&lt;br /&gt;
| box-icons = [[File:Red warning icon.svg|20px|link=|TODO]]&lt;br /&gt;
| box-text = &amp;lt;b&amp;gt;TODO:&amp;lt;/b&amp;gt; {{{1}}}&lt;br /&gt;
| border-color = #b60000&lt;br /&gt;
| border-width = 1px&lt;br /&gt;
| background = #fdd1d1&lt;br /&gt;
| class = box-todo&lt;br /&gt;
}}&amp;lt;!--&lt;br /&gt;
Category:&lt;br /&gt;
--&amp;gt;{{#if: {{{nocategory|}}}||[[Category:To-do items]]}}&amp;lt;/includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&amp;lt;templatedata&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
	&amp;quot;params&amp;quot;: {&lt;br /&gt;
		&amp;quot;1&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Text&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Text to place in the box&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;unbalanced-wikitext&amp;quot;,&lt;br /&gt;
			&amp;quot;required&amp;quot;: true&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;nocategory&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;No category&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;If true/yes, do not add this page to the \&amp;quot;To-do items\&amp;quot; category.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;boolean&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
	},&lt;br /&gt;
	&amp;quot;description&amp;quot;: &amp;quot;TODO box containing a to-do item. Also adds the page to the \&amp;quot;To-do items\&amp;quot; category; this behavior can be disabled with the \&amp;quot;nocategory\&amp;quot; parameter.&amp;quot;,&lt;br /&gt;
	&amp;quot;format&amp;quot;: &amp;quot;inline&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/templatedata&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{todo|This is &#039;&#039;&#039;yet to be done&#039;&#039;&#039;.}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{todo|This is &#039;&#039;&#039;yet to be done&#039;&#039;&#039;.|nocategory=yes}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=126</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=126"/>
		<updated>2025-08-15T17:41:04Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/rtc/rtc-bcmpmu59xxx.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMUs provide a real-time clock.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Mask&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second (&amp;lt;code&amp;gt;SC&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute (&amp;lt;code&amp;gt;MN&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour (&amp;lt;code&amp;gt;HR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Weekday (&amp;lt;code&amp;gt;WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x07&lt;br /&gt;
|Day of week, from 0 to 6. Appears to roll over whenever the day changes; {{speculation|the hardware does not enforce a specific start.}} Sets itself to 0 on reset. &#039;&#039;&#039;Not used in downstream.&#039;&#039;&#039;&amp;lt;br&amp;gt;{{speculation|The day of month sets itself to 0 on reset, which should be an invalid value, but would suggest that the range is 0 -&amp;gt; Sunday, 6 -&amp;gt; Monday, but there is no downstream code to confirm this.}}&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Day of month (&amp;lt;code&amp;gt;DT&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Day of month, starting from 1. Sets itself to 0 on reset.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Month (&amp;lt;code&amp;gt;MT_WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x0F&lt;br /&gt;
|Number of the month. 1 to 12 represent January-December.&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Year (&amp;lt;code&amp;gt;YR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0xFF&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This exact format is used for both the time and alarm registers. The masks are enforced by hardware - any bit written outside of the mask gets ignored.&lt;br /&gt;
&lt;br /&gt;
== Getting the time ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, time registers start at 0xE0 and follow the format outlined above.&lt;br /&gt;
&lt;br /&gt;
There are interrupts for updates of each of the time values.&lt;br /&gt;
&lt;br /&gt;
The default reset value is &amp;lt;code&amp;gt;0 0 0 0 0 1 7&amp;lt;/code&amp;gt; (2007-01-00 00:00:00, weekday 0). Notably, the day of month is invalid (0).&lt;br /&gt;
&lt;br /&gt;
If the date overflows (1 second after 2255-12-31 23:59:59), the clock returns to 2255-12-01 00:00:00.&lt;br /&gt;
&lt;br /&gt;
=== Adjustment IRQ ===&lt;br /&gt;
&lt;br /&gt;
There is an RTCADJ IRQ that is supposed to fire when the RTC value is invalid (at least according to the comments of the downstream driver, and the downstream BCM59055 RTC driver). However, I haven&#039;t been able to get it to fire in my testing.&lt;br /&gt;
&lt;br /&gt;
== Alarm ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, the alarm registers start at 0xE7.&lt;br /&gt;
&lt;br /&gt;
There is an interrupt that is triggered when the alarm is triggered.&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/PONKEY&amp;diff=125</id>
		<title>Mainline:Broadcom Kona/BCM590xx/PONKEY</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/PONKEY&amp;diff=125"/>
		<updated>2025-08-15T17:32:35Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/input/misc/bcmpmu59xxx_ponkey.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMU can handle a power-on key (the responsible section is nicknamed PONKEY).&lt;br /&gt;
&lt;br /&gt;
== Key press detection ==&lt;br /&gt;
&lt;br /&gt;
When a key is pressed, the internal IRQ for a key press (BCM59054_IRQ_POK_PRESSED/BCM59056_IRQ_PONKEYB_F) is raised; when it is released, the internal IRQ for a key release (BCM59054_IRQ_POK_RELEASED/BCM59056_IRQ_PONKEYB_R) is raised. A driver can interpret these IRQs to toggle a key on/off (in downstream, it&#039;s wired up to &amp;lt;code&amp;gt;KEY_POWER&amp;lt;/code&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Debounce interval ===&lt;br /&gt;
&lt;br /&gt;
A debounce interval can be configured independently for button press and release. The debounce values are 3 bits wide and stored in &amp;lt;code&amp;gt;PONKEYCTRL1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For the BCM59054/BCM59056, the allowed values are 330ns, 1.2ms, 10ms, 50ms, 100ms, 500ms, 1000ms and 2000ms. For the BCM59039/BCM59042/BCM59055, the allowed values are undocumented, but different from BCM59054/56 - &amp;lt;code&amp;gt;3&amp;lt;/code&amp;gt; is equal to 100ms (whereas it&#039;s 50ms on 54/56).&lt;br /&gt;
&lt;br /&gt;
== Timer ==&lt;br /&gt;
&lt;br /&gt;
TODO. Seems like it might be possible to control long-press function using a timer (one of &amp;quot;poweroff&amp;quot;, &amp;quot;restart&amp;quot; or &amp;quot;smart reset&amp;quot;). [https://github.com/knuxdroid/android_kernel_samsung_baffinlite/blob/cm-12.1/drivers/input/misc/bcmpmu59xxx_ponkey.c#L204-L277 Relevant kernel sources], notably commented out.&lt;br /&gt;
&lt;br /&gt;
== Registers (BCM59054) ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|See {{downstream|baffinlite|include/linux/mfd/bcmpmu59054_reg.h}}.}}&lt;br /&gt;
&lt;br /&gt;
All of them are on MAP0.&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL1 (0x08) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RELEASE_DEB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 5:3&lt;br /&gt;
| Represents the release debounce. &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PRESS_DEB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2:0&lt;br /&gt;
| Represents the press debounce.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL2 (0x09) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TX_ACTION&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7:6&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TX_DLY&amp;lt;/code&amp;gt;&lt;br /&gt;
| 5:3&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TX_DEB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2:0&lt;br /&gt;
| TODO&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL3 (0x0A) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:0&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL4 (0x0B) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;KEY_PAD_LOCK_MODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;KEY_PAD_LOCK&amp;lt;/code&amp;gt;&lt;br /&gt;
| 5&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;POK_RESTART_EN&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 3&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;POK_WAKUP_DEB&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2:0&lt;br /&gt;
| TODO&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL5 (0x0C) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:0&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL6 (0x0D) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:5&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SMART_RST_DLY&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4:3&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SMART_RST_STATUS&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SMART_RST_PWR_EN&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1&lt;br /&gt;
| TODO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SMART_RST_EN&amp;lt;/code&amp;gt;&lt;br /&gt;
| 0&lt;br /&gt;
| TODO&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL7 (0x0E) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:0&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PONKEYCTRL8 (0x0F) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
| 7:0&lt;br /&gt;
| Reserved/unknown&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/PONKEY&amp;diff=124</id>
		<title>Mainline:Broadcom Kona/BCM590xx/PONKEY</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/PONKEY&amp;diff=124"/>
		<updated>2025-08-15T17:16:30Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The BCM590XX PMU can handle a power-on key (the responsible section is nicknamed PONKEY).&lt;br /&gt;
&lt;br /&gt;
== Key press detection ==&lt;br /&gt;
&lt;br /&gt;
When a key is pressed, the internal IRQ for a key press (BCM59054_IRQ_POK_PRESSED/BCM59056_IRQ_PONKEYB_F) is raised; when it is released, the internal IRQ for a key release (BCM59054_IRQ_POK_RELEASED/BCM59056_IRQ_PONKEYB_R) is raised. A driver can interpret these IRQs to toggle a key on/off (in downstream, it&#039;s wired up to &amp;lt;code&amp;gt;KEY_POWER&amp;lt;/code&amp;gt; by default.&lt;br /&gt;
&lt;br /&gt;
=== Debounce interval ===&lt;br /&gt;
&lt;br /&gt;
A debounce interval can be configured independently for button press and release. The debounce values are 3 bits wide and stored in &amp;lt;code&amp;gt;PONKEYCTRL1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For the BCM59054/BCM59056, the allowed values are 330ns, 1.2ms, 10ms, 50ms, 100ms, 500ms, 1000ms and 2000ms. For the BCM59039/BCM59042/BCM59055, the allowed values are undocumented, but different from BCM59054/56 - &amp;lt;code&amp;gt;3&amp;lt;/code&amp;gt; is equal to 100ms (whereas it&#039;s 50ms on 54/56).&lt;br /&gt;
&lt;br /&gt;
== Timer ==&lt;br /&gt;
&lt;br /&gt;
TODO. Seems like it might be possible to control long-press function using a timer (one of &amp;quot;poweroff&amp;quot;, &amp;quot;restart&amp;quot; or &amp;quot;smart reset&amp;quot;). [https://github.com/knuxdroid/android_kernel_samsung_baffinlite/blob/cm-12.1/drivers/input/misc/bcmpmu59xxx_ponkey.c#L204-L277 Relevant kernel sources], notably commented out.&lt;br /&gt;
&lt;br /&gt;
{{Subpages}}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=123</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=123"/>
		<updated>2025-08-15T12:57:56Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/rtc/rtc-bcmpmu59xxx.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMUs provide a real-time clock.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Mask&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second (&amp;lt;code&amp;gt;SC&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute (&amp;lt;code&amp;gt;MN&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour (&amp;lt;code&amp;gt;HR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Weekday (&amp;lt;code&amp;gt;WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x07&lt;br /&gt;
|Day of week, from 0 to 6. Appears to roll over whenever the day changes; {{speculation|the hardware does not enforce a specific start.}} Sets itself to 0 on reset. &#039;&#039;&#039;Not used in downstream.&#039;&#039;&#039;&amp;lt;br&amp;gt;{{speculation|The day of month sets itself to 0 on reset, which should be an invalid value, but would suggest that the range is 0 -&amp;gt; Sunday, 6 -&amp;gt; Monday, but there is no downstream code to confirm this.}}&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Day of month (&amp;lt;code&amp;gt;DT&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Day of month, starting from 1. Sets itself to 0 on reset.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Month (&amp;lt;code&amp;gt;MT_WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x0F&lt;br /&gt;
|Number of the month. 1 to 12 represent January-December.&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Year (&amp;lt;code&amp;gt;YR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0xFF&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This exact format is used for both the time and alarm registers. The masks are enforced by hardware - any bit written outside of the mask gets ignored.&lt;br /&gt;
&lt;br /&gt;
== Getting the time ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, time registers start at 0xE0 and follow the format outlined above.&lt;br /&gt;
&lt;br /&gt;
There are interrupts for updates of each of the time values.&lt;br /&gt;
&lt;br /&gt;
The default reset value is &amp;lt;code&amp;gt;0 0 0 0 0 1 7&amp;lt;/code&amp;gt; (2007-01-00 00:00:00, weekday 0). Notably, the day of month is invalid (0). In this state, the RTCADJ interrupt will be raised.&lt;br /&gt;
&lt;br /&gt;
If the date overflows (1 second after 2255-12-31 23:59:59), the clock returns to 2255-12-01 00:00:00.&lt;br /&gt;
&lt;br /&gt;
=== Adjustment IRQ ===&lt;br /&gt;
&lt;br /&gt;
There is an RTCADJ IRQ that is supposed to fire when the RTC value is invalid (at least according to the comments of the downstream driver, and the downstream BCM59055 RTC driver). However, I haven&#039;t been able to get it to fire in my testing.&lt;br /&gt;
&lt;br /&gt;
== Alarm ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, the alarm registers start at 0xE7.&lt;br /&gt;
&lt;br /&gt;
There is an interrupt that is triggered when the alarm is triggered.&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=122</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=122"/>
		<updated>2025-08-15T12:47:29Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/rtc/rtc-bcmpmu59xxx.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMUs provide a real-time clock.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Mask&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second (&amp;lt;code&amp;gt;SC&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute (&amp;lt;code&amp;gt;MN&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour (&amp;lt;code&amp;gt;HR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Weekday (&amp;lt;code&amp;gt;WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x07&lt;br /&gt;
|Day of week, from 0 to 6. Appears to roll over whenever the day changes; {{speculation|the hardware does not enforce a specific start.}} Sets itself to 0 on reset. &#039;&#039;&#039;Not used in downstream.&#039;&#039;&#039;&amp;lt;br&amp;gt;{{speculation|The day of month sets itself to 0 on reset, which should be an invalid value, but would suggest that the range is 0 -&amp;gt; Sunday, 6 -&amp;gt; Monday, but there is no downstream code to confirm this.}}&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Day of month (&amp;lt;code&amp;gt;DT&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Day of month, starting from 1. Sets itself to 0 on reset.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Month (&amp;lt;code&amp;gt;MT_WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x0F&lt;br /&gt;
|Number of the month. 1 to 12 represent January-December.&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Year (&amp;lt;code&amp;gt;YR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0xFF&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This exact format is used for both the time and alarm registers. In the time registers, the masks are enforced by hardware - any bit written outside of the mask gets ignored.&lt;br /&gt;
&lt;br /&gt;
== Getting the time ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, time registers start at 0xE0 and follow the format outlined above.&lt;br /&gt;
&lt;br /&gt;
There are interrupts for updates of each of the time values.&lt;br /&gt;
&lt;br /&gt;
The default reset value is &amp;lt;code&amp;gt;0 0 0 0 0 1 7&amp;lt;/code&amp;gt; (2007-01-00 00:00:00, weekday 0). Notably, the day of month is invalid (0). In this state, the RTCADJ interrupt will be raised.&lt;br /&gt;
&lt;br /&gt;
If the date overflows (1 second after 2255-12-31 23:59:59), the clock returns to 2255-12-01 00:00:00.&lt;br /&gt;
&lt;br /&gt;
=== Adjustment IRQ ===&lt;br /&gt;
&lt;br /&gt;
There is an RTCADJ IRQ that is supposed to fire when the RTC value is invalid (at least according to the comments of the downstream driver, and the downstream BCM59055 RTC driver). However, I haven&#039;t been able to get it to fire in my testing.&lt;br /&gt;
&lt;br /&gt;
== Alarm ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, the alarm registers start at 0xE7.&lt;br /&gt;
&lt;br /&gt;
There is an interrupt that is triggered when the alarm is triggered.&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=121</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=121"/>
		<updated>2025-08-15T12:45:20Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: /* Getting the time */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/rtc/rtc-bcmpmu59xxx.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMUs provide a real-time clock.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Mask&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second (&amp;lt;code&amp;gt;SC&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute (&amp;lt;code&amp;gt;MN&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour (&amp;lt;code&amp;gt;HR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Weekday (&amp;lt;code&amp;gt;WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x07&lt;br /&gt;
|Day of week, from 0 to 6. Appears to roll over whenever the day changes; {{speculation|the hardware does not enforce a specific start.}} Sets itself to 0 on reset. &#039;&#039;&#039;Not used in downstream.&#039;&#039;&#039;&amp;lt;br&amp;gt;{{speculation|The day of month sets itself to 0 on reset, which should be an invalid value, but would suggest that the range is 0 -&amp;gt; Sunday, 6 -&amp;gt; Monday, but there is no downstream code to confirm this.}}&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Day of month (&amp;lt;code&amp;gt;DT&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Day of month, starting from 1. Sets itself to 0 on reset.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Month (&amp;lt;code&amp;gt;MT_WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x0F&lt;br /&gt;
|Number of the month. 1 to 12 represent January-December.&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Year (&amp;lt;code&amp;gt;YR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0xFF&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This exact format is used for both the time and alarm registers. In the time registers, the masks are enforced by hardware - any bit written outside of the mask gets ignored.&lt;br /&gt;
&lt;br /&gt;
== Getting the time ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, time registers start at 0xE0 and follow the format outlined above.&lt;br /&gt;
&lt;br /&gt;
There are interrupts for updates of each of the time values.&lt;br /&gt;
&lt;br /&gt;
The default reset value is &amp;lt;code&amp;gt;0 0 0 0 0 1 7&amp;lt;/code&amp;gt; (2007-01-00 00:00:00, weekday 0). Notably, the day of month is invalid (0). In this state, the RTCADJ interrupt will be raised.&lt;br /&gt;
&lt;br /&gt;
If the date overflows (1 second after 2255-12-31 23:59:59), the clock returns to 2255-12-01 00:00:00.&lt;br /&gt;
&lt;br /&gt;
== Alarm ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, the alarm registers start at 0xE7.&lt;br /&gt;
&lt;br /&gt;
There is an interrupt that is triggered when the alarm is triggered.&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=120</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=120"/>
		<updated>2025-08-15T12:44:06Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: /* Time data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/rtc/rtc-bcmpmu59xxx.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMUs provide a real-time clock.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Mask&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second (&amp;lt;code&amp;gt;SC&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute (&amp;lt;code&amp;gt;MN&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour (&amp;lt;code&amp;gt;HR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Weekday (&amp;lt;code&amp;gt;WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x07&lt;br /&gt;
|Day of week, from 0 to 6. Appears to roll over whenever the day changes; {{speculation|the hardware does not enforce a specific start.}} Sets itself to 0 on reset. &#039;&#039;&#039;Not used in downstream.&#039;&#039;&#039;&amp;lt;br&amp;gt;{{speculation|The day of month sets itself to 0 on reset, which should be an invalid value, but would suggest that the range is 0 -&amp;gt; Sunday, 6 -&amp;gt; Monday, but there is no downstream code to confirm this.}}&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Day of month (&amp;lt;code&amp;gt;DT&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Day of month, starting from 1. Sets itself to 0 on reset.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Month (&amp;lt;code&amp;gt;MT_WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x0F&lt;br /&gt;
|Number of the month. 1 to 12 represent January-December.&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Year (&amp;lt;code&amp;gt;YR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0xFF&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This exact format is used for both the time and alarm registers. In the time registers, the masks are enforced by hardware - any bit written outside of the mask gets ignored.&lt;br /&gt;
&lt;br /&gt;
== Getting the time ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, time registers start at 0xE0 and follow the format outlined above.&lt;br /&gt;
&lt;br /&gt;
There are interrupts for updates of each of the time values.&lt;br /&gt;
&lt;br /&gt;
The default reset value is &amp;lt;code&amp;gt;0 0 0 0 0 1 7&amp;lt;/code&amp;gt; (2007-01-00 00:00:00, weekday 0). Notably, the day of month is invalid (0). In this state, the RTCADJ interrupt will be raised.&lt;br /&gt;
&lt;br /&gt;
== Alarm ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, the alarm registers start at 0xE7.&lt;br /&gt;
&lt;br /&gt;
There is an interrupt that is triggered when the alarm is triggered.&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=119</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=119"/>
		<updated>2025-08-15T12:38:57Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: /* Time data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/rtc/rtc-bcmpmu59xxx.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMUs provide a real-time clock.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Mask&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second (&amp;lt;code&amp;gt;SC&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute (&amp;lt;code&amp;gt;MN&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour (&amp;lt;code&amp;gt;HR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Weekday (&amp;lt;code&amp;gt;WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x0F&lt;br /&gt;
|Day of week, from 0 to 6. Appears to roll over whenever the day changes; {{speculation|the hardware does not enforce a specific start.}} Sets itself to 0 on reset. &#039;&#039;&#039;Not used in downstream.&#039;&#039;&#039;&amp;lt;br&amp;gt;{{speculation|The day of month sets itself to 0 on reset, which should be an invalid value, but would suggest that the range is 0 -&amp;gt; Sunday, 6 -&amp;gt; Monday, but there is no downstream code to confirm this.}}&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Day of month (&amp;lt;code&amp;gt;DT&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Day of month, starting from 1. Sets itself to 0 on reset.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Month (&amp;lt;code&amp;gt;MT_WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x0F&lt;br /&gt;
|Number of the month. 1 to 12 represent January-December.&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Year (&amp;lt;code&amp;gt;YR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0xFF&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This exact format is used for both the time and alarm registers. In the time registers, the masks are enforced by hardware - any bit written outside of the mask gets ignored.&lt;br /&gt;
&lt;br /&gt;
TODO: What happens on year overflow? Is there a reason as to why the downstream driver limits the values it gets?&lt;br /&gt;
&lt;br /&gt;
== Getting the time ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, time registers start at 0xE0 and follow the format outlined above.&lt;br /&gt;
&lt;br /&gt;
There are interrupts for updates of each of the time values.&lt;br /&gt;
&lt;br /&gt;
The default reset value is &amp;lt;code&amp;gt;0 0 0 0 0 1 7&amp;lt;/code&amp;gt; (2007-01-00 00:00:00, weekday 0). Notably, the day of month is invalid (0). In this state, the RTCADJ interrupt will be raised.&lt;br /&gt;
&lt;br /&gt;
== Alarm ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, the alarm registers start at 0xE7.&lt;br /&gt;
&lt;br /&gt;
There is an interrupt that is triggered when the alarm is triggered.&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=118</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=118"/>
		<updated>2025-08-15T12:21:16Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/rtc/rtc-bcmpmu59xxx.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMUs provide a real-time clock.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Mask&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second (&amp;lt;code&amp;gt;SC&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute (&amp;lt;code&amp;gt;MN&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour (&amp;lt;code&amp;gt;HR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Weekday (&amp;lt;code&amp;gt;WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|{{speculation|0x0F}}&lt;br /&gt;
|Day of week, from 0 to 6. Appears to roll over whenever the day changes; {{speculation|the hardware does not enforce a specific start.}} Sets itself to 0 on reset. &#039;&#039;&#039;Not used in downstream.&#039;&#039;&#039;&amp;lt;br&amp;gt;{{speculation|The day of month sets itself to 0 on reset, which should be an invalid value, but would suggest that the range is 0 -&amp;gt; Sunday, 6 -&amp;gt; Monday, but there is no downstream code to confirm this.}}&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Day of month (&amp;lt;code&amp;gt;DT&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Day of month, starting from 1. Sets itself to 0 on reset.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Month (&amp;lt;code&amp;gt;MT_WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x0F&lt;br /&gt;
|Number of the month. 1 to 12 represent January-December.&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Year (&amp;lt;code&amp;gt;YR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0xFF&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This exact format is used for both the time and alarm registers.&lt;br /&gt;
&lt;br /&gt;
TODO: What happens on year overflow? Is there a reason as to why the downstream driver limits the values it gets?&lt;br /&gt;
&lt;br /&gt;
== Getting the time ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, time registers start at 0xE0 and follow the format outlined above.&lt;br /&gt;
&lt;br /&gt;
There are interrupts for updates of each of the time values.&lt;br /&gt;
&lt;br /&gt;
The default reset value is &amp;lt;code&amp;gt;0 0 0 0 0 1 7&amp;lt;/code&amp;gt; (2007-01-00 00:00:00, weekday 0). Notably, the day of month is invalid (0). In this state, the RTCADJ interrupt will be raised.&lt;br /&gt;
&lt;br /&gt;
== Alarm ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, the alarm registers start at 0xE7.&lt;br /&gt;
&lt;br /&gt;
There is an interrupt that is triggered when the alarm is triggered.&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=117</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=117"/>
		<updated>2025-08-15T10:53:41Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/rtc/rtc-bcmpmu59xxx.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMUs provide a real-time clock.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Mask&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second (&amp;lt;code&amp;gt;SC&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute (&amp;lt;code&amp;gt;MN&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x3F&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour (&amp;lt;code&amp;gt;HR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Weekday (&amp;lt;code&amp;gt;WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|{{speculation|0x0F}}&lt;br /&gt;
|Day of week, from 0 to 6. Appears to roll over whenever the day changes; {{speculation|the hardware does not enforce a specific start.}} Sets itself to 0 on reset. &#039;&#039;&#039;Not used in downstream.&#039;&#039;&#039;&amp;lt;br&amp;gt;{{speculation|The day of month sets itself to 0 on reset, which should be an invalid value, but would suggest that the range is 0 -&amp;gt; Sunday, 6 -&amp;gt; Monday, but there is no downstream code to confirm this.}}&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Day of month (&amp;lt;code&amp;gt;DT&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x1F&lt;br /&gt;
|Day of month, starting from 1. Sets itself to 0 on reset.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Month (&amp;lt;code&amp;gt;MT_WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0x0F&lt;br /&gt;
|Number of the month. 1 to 12 represent January-December.&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Year (&amp;lt;code&amp;gt;YR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|0xFF&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This exact format is used for both the time and alarm registers.&lt;br /&gt;
&lt;br /&gt;
TODO: What happens on year overflow? Is there a reason as to why the downstream driver limits the values it gets?&lt;br /&gt;
&lt;br /&gt;
== Getting the time ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, time registers start at 0xE0 and follow the format outlined above.&lt;br /&gt;
&lt;br /&gt;
There are interrupts for updates of each of the time values.&lt;br /&gt;
&lt;br /&gt;
The default reset value is &amp;lt;code&amp;gt;0 0 0 0 0 1 7&amp;lt;/code&amp;gt; (2007-01-00 00:00:00, weekday 0). Notably, the day of month is invalid (0).&lt;br /&gt;
&lt;br /&gt;
== Alarm ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, the alarm registers start at 0xE7.&lt;br /&gt;
&lt;br /&gt;
There is an interrupt that is triggered when the alarm is triggered.&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=116</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=116"/>
		<updated>2025-08-14T06:43:41Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: /* Getting the time */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/rtc/rtc-bcmpmu59xxx.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMUs provide a real-time clock.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second (&amp;lt;code&amp;gt;SC&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute (&amp;lt;code&amp;gt;MN&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour (&amp;lt;code&amp;gt;HR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Weekday (&amp;lt;code&amp;gt;WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Day of week, from 0 to 6. {{speculation|Appears to roll over whenever the day changes; the hardware does not enforce a specific start.}} Sets itself to 0 on reset. {{speculation|The day of month sets itself to 0 on reset, which should be an invalid value, but would suggest that the range is 0 -&amp;gt; Sunday, 6 -&amp;gt; Monday, but there is no downstream code to confirm this.}}&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Day of month (&amp;lt;code&amp;gt;DT&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Day of month, starting from 1. {{speculation|Sets itself to 0 on reset.}}&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Month (&amp;lt;code&amp;gt;MT_WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Number of the month. 1 to 12 represent January-December.&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Year (&amp;lt;code&amp;gt;YR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This exact format is used for both the time and alarm registers.&lt;br /&gt;
&lt;br /&gt;
TODO: What happens on year overflow? Is there a reason as to why the downstream driver limits the values it gets?&lt;br /&gt;
&lt;br /&gt;
== Getting the time ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, time registers start at 0xE0 and follow the format outlined above.&lt;br /&gt;
&lt;br /&gt;
There are interrupts for updates of each of the time values.&lt;br /&gt;
&lt;br /&gt;
The default reset value is &amp;lt;code&amp;gt;0 0 0 0 0 1 7&amp;lt;/code&amp;gt; (2007-01-00 00:00:00, weekday 0). Notably, the day of month is invalid (0).&lt;br /&gt;
&lt;br /&gt;
== Alarm ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, the alarm registers start at 0xE7.&lt;br /&gt;
&lt;br /&gt;
There is an interrupt that is triggered when the alarm is triggered.&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=115</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=115"/>
		<updated>2025-08-14T06:03:50Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/rtc/rtc-bcmpmu59xxx.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMUs provide a real-time clock.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second (&amp;lt;code&amp;gt;SC&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute (&amp;lt;code&amp;gt;MN&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour (&amp;lt;code&amp;gt;HR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Weekday (&amp;lt;code&amp;gt;WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Day of week, from 0 to 6. {{speculation|Appears to roll over whenever the day changes; the hardware does not enforce a specific start.}} Sets itself to 0 on reset. {{speculation|The day of month sets itself to 0 on reset, which should be an invalid value, but would suggest that the range is 0 -&amp;gt; Sunday, 6 -&amp;gt; Monday, but there is no downstream code to confirm this.}}&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Day of month (&amp;lt;code&amp;gt;DT&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Day of month, starting from 1. {{speculation|Sets itself to 0 on reset.}}&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Month (&amp;lt;code&amp;gt;MT_WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Number of the month. 1 to 12 represent January-December.&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Year (&amp;lt;code&amp;gt;YR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This exact format is used for both the time and alarm registers.&lt;br /&gt;
&lt;br /&gt;
TODO: What happens on year overflow? Is there a reason as to why the downstream driver limits the values it gets?&lt;br /&gt;
&lt;br /&gt;
== Getting the time ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, time registers start at 0xE0 and follow the format outlined above.&lt;br /&gt;
&lt;br /&gt;
There are interrupts for updates of each of the time values.&lt;br /&gt;
&lt;br /&gt;
The default reset value is 2007-01-01 at 00:00:00.&lt;br /&gt;
&lt;br /&gt;
== Alarm ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, the alarm registers start at 0xE7.&lt;br /&gt;
&lt;br /&gt;
There is an interrupt that is triggered when the alarm is triggered.&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=114</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=114"/>
		<updated>2025-08-14T05:41:09Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/rtc/rtc-bcmpmu59xxx.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMUs provide a real-time clock.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second (&amp;lt;code&amp;gt;SC&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute (&amp;lt;code&amp;gt;MN&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour (&amp;lt;code&amp;gt;HR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Weekday (&amp;lt;code&amp;gt;WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Day of week; 0 is Monday, 6 is Sunday. {{speculation|todo, verify}}&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Day of month (&amp;lt;code&amp;gt;DT&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Day of month, starting from 0.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Month (&amp;lt;code&amp;gt;MT_WD&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Number of the month. 1 to 12 represent January-December.&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Year (&amp;lt;code&amp;gt;YR&amp;lt;/code&amp;gt;)&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This exact format is used for both the time and alarm registers.&lt;br /&gt;
&lt;br /&gt;
TODO: What happens on year overflow? Is there a reason as to why the downstream driver limits the values it gets?&lt;br /&gt;
&lt;br /&gt;
== Getting the time ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, time registers start at 0xE0 and follow the format outlined above.&lt;br /&gt;
&lt;br /&gt;
There are interrupts for updates of each of the time values.&lt;br /&gt;
&lt;br /&gt;
The default reset value is 2007-01-01 at 00:00:00.&lt;br /&gt;
&lt;br /&gt;
== Alarm ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, the alarm registers start at 0xE7.&lt;br /&gt;
&lt;br /&gt;
There is an interrupt that is triggered when the alarm is triggered.&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=113</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=113"/>
		<updated>2025-08-13T18:06:11Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/rtc/rtc-bcmpmu59xxx.c}}}}&lt;br /&gt;
&lt;br /&gt;
The BCM590XX PMUs provide a real-time clock.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Day of month&lt;br /&gt;
|Day of month, starting from 0.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Month&lt;br /&gt;
|Number of the month. Sets itself to 0 on reset; 1 to 12 represent January-December. {{speculation|...or does it? The downstream driver would suggest so, but it seems weird. Investigate.}}&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Year&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This exact format is used for both the time and alarm registers.&lt;br /&gt;
&lt;br /&gt;
TODO: What happens on year overflow? Is there a reason as to why the downstream driver limits the values it gets?&lt;br /&gt;
&lt;br /&gt;
== Getting the time ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, time registers start at 0xE0 and follow the format outlined above.&lt;br /&gt;
&lt;br /&gt;
There are interrupts for updates of each of the time values.&lt;br /&gt;
&lt;br /&gt;
== Alarm ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, the alarm registers start at 0xE7.&lt;br /&gt;
&lt;br /&gt;
There is an interrupt that is triggered when the alarm is triggered.&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=112</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=112"/>
		<updated>2025-08-13T18:04:49Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The BCM590XX PMUs provide a real-time clock.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Day of month&lt;br /&gt;
|Day of month, starting from 0.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Month&lt;br /&gt;
|Number of the month. Sets itself to 0 on reset; 1 to 12 represent January-December. {{speculation|...or does it? The downstream driver would suggest so, but it seems weird. Investigate.}}&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Year&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This exact format is used for both the time and alarm registers.&lt;br /&gt;
&lt;br /&gt;
TODO: What happens on year overflow? Is there a reason as to why the downstream driver limits the values it gets?&lt;br /&gt;
&lt;br /&gt;
== Getting the time ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, time registers start at 0xE0 and follow the format outlined above.&lt;br /&gt;
&lt;br /&gt;
There are interrupts for updates of each of the time values.&lt;br /&gt;
&lt;br /&gt;
== Alarm ==&lt;br /&gt;
&lt;br /&gt;
On the BCM59054 and BCM59056, the alarm registers start at 0xE7.&lt;br /&gt;
&lt;br /&gt;
There is an interrupt that is triggered when the alarm is triggered.&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=111</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=111"/>
		<updated>2025-08-13T14:17:09Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: /* Time data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The RTC is located at register 0xe0 on the BCM59054/BCM59056.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Day of month&lt;br /&gt;
|Day of month, starting from 0.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Month&lt;br /&gt;
|Number of the month. Sets itself to 0 on reset; 1 to 12 represent January-December. {{speculation|...or does it? The downstream driver would suggest so, but it seems weird. Investigate.}}&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Year&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
TODO: What happens on year overflow? Is there a reason as to why the downstream driver limits the values it gets?&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=110</id>
		<title>Mainline:Broadcom Kona/BCM590xx/RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Mainline:Broadcom_Kona/BCM590xx/RTC&amp;diff=110"/>
		<updated>2025-08-13T14:13:06Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot;The RTC is located at register 0xe0 on the BCM59054/BCM59056.  == Time data ==  The RTC stores the time in the following format:  {|class=&amp;quot;wikitable bittable&amp;quot; !Offset !Purpose !Value |- |0 |Second |Current second, from 0 to 59. |- |1 |Minute |Current minute of the hour, from 0 to 59. |- |2 |Hour |Current hour of the day, from 0 to 23. |- |3 |Day of month |Day of month, starting from 0. |- |4 |Month |Number of the month. Sets itself to 0 on reset; 1 to 12 represent Januar...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The RTC is located at register 0xe0 on the BCM59054/BCM59056.&lt;br /&gt;
&lt;br /&gt;
== Time data ==&lt;br /&gt;
&lt;br /&gt;
The RTC stores the time in the following format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Purpose&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Second&lt;br /&gt;
|Current second, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Minute&lt;br /&gt;
|Current minute of the hour, from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Hour&lt;br /&gt;
|Current hour of the day, from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Day of month&lt;br /&gt;
|Day of month, starting from 0.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Month&lt;br /&gt;
|Number of the month. Sets itself to 0 on reset; 1 to 12 represent January-December. {{speculation|...or does it? The downstream driver would suggest so, but it seems weird. Investigate.}}&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Year&lt;br /&gt;
|Amount of years since 2000 (0 = 2000, 1 = 2001, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Calibration ==&lt;br /&gt;
&lt;br /&gt;
{{hatnote|Downstream driver: {{downstream|baffinlite|drivers/char/broadcom/rtc_cal/bcm_rtc_cal.c}}}}&lt;br /&gt;
&lt;br /&gt;
There are three calibration registers: CALIB1, CALIB2 and CALIB3.&lt;br /&gt;
&lt;br /&gt;
{{todo|Figure out how the calibration process works, this is just my initial idea}}&lt;br /&gt;
&lt;br /&gt;
{{speculation|Calibration appears to be triggered based on a CP (communications processor) event; it receives a message from the CP and uses a value from it as the &amp;quot;ratio&amp;quot;.}} The ratio value is then compared against &amp;lt;code&amp;gt;RTCCAL_Ratio&amp;lt;/code&amp;gt; (taken from &amp;lt;code&amp;gt;rtccal_data.nom_ratio&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;8666667&amp;lt;/code&amp;gt;); if &amp;lt;code&amp;gt;ratio &amp;gt; RTCCAL_Ratio&amp;lt;/code&amp;gt;, then direction is 1, otherwise it&#039;s 0.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; value is then calculated based on the difference between the new and old ratio (&amp;lt;code&amp;gt;diff = abs(ratio - RTCCAL_Ratio)&amp;lt;/code&amp;gt;): &amp;lt;code&amp;gt;clk_val = RTCCAL_Ratio / diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO - what is the ratio value?&lt;br /&gt;
&lt;br /&gt;
=== CALIB1 (0xF4) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (1)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Lower 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB2 (0xF5) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;clk_val&amp;lt;/code&amp;gt; (2)&lt;br /&gt;
| 7:0&lt;br /&gt;
| Upper 8 bits of the calibration offset.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== CALIB3 (0xF6) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable bittable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;???&amp;lt;/code&amp;gt;&lt;br /&gt;
| 7&lt;br /&gt;
| Set to 1 during calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;direction&amp;lt;/code&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| Unknown/reserved&lt;br /&gt;
| 5:0&lt;br /&gt;
| Unknown/reserved.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=Template:Hatnote&amp;diff=109</id>
		<title>Template:Hatnote</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=Template:Hatnote&amp;diff=109"/>
		<updated>2025-08-13T13:09:06Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot;&amp;lt;noinclude&amp;gt;&amp;lt;templatedata&amp;gt; { 	&amp;quot;params&amp;quot;: { 		&amp;quot;1&amp;quot;: { 			&amp;quot;label&amp;quot;: &amp;quot;Text&amp;quot;, 			&amp;quot;type&amp;quot;: &amp;quot;unbalanced-wikitext&amp;quot;, 			&amp;quot;required&amp;quot;: true 		} 	}, 	&amp;quot;description&amp;quot;: &amp;quot;Hatnote template, as seen on Wikipedia. Primarily used for \&amp;quot;See also\&amp;quot; text.&amp;quot;, 	&amp;quot;format&amp;quot;: &amp;quot;inline&amp;quot; } &amp;lt;/templatedata&amp;gt; == Examples ==   &amp;lt;nowiki&amp;gt;{{Hatnote|This page is about the foo. See also: &amp;#039;&amp;#039;bar&amp;#039;&amp;#039;, &amp;#039;&amp;#039;baz&amp;#039;&amp;#039;.}}&amp;lt;/nowiki&amp;gt;  {{Hatnote|This page is about the foo. See also: &amp;#039;&amp;#039;bar&amp;#039;&amp;#039;, &amp;#039;&amp;#039;baz&amp;#039;&amp;#039;.}} &amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;&amp;lt;div class=&amp;quot;...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;templatedata&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
	&amp;quot;params&amp;quot;: {&lt;br /&gt;
		&amp;quot;1&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Text&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;unbalanced-wikitext&amp;quot;,&lt;br /&gt;
			&amp;quot;required&amp;quot;: true&lt;br /&gt;
		}&lt;br /&gt;
	},&lt;br /&gt;
	&amp;quot;description&amp;quot;: &amp;quot;Hatnote template, as seen on Wikipedia. Primarily used for \&amp;quot;See also\&amp;quot; text.&amp;quot;,&lt;br /&gt;
	&amp;quot;format&amp;quot;: &amp;quot;inline&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/templatedata&amp;gt;&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{Hatnote|This page is about the foo. See also: &#039;&#039;bar&#039;&#039;, &#039;&#039;baz&#039;&#039;.}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Hatnote|This page is about the foo. See also: &#039;&#039;bar&#039;&#039;, &#039;&#039;baz&#039;&#039;.}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;&amp;lt;div class=&amp;quot;hatnote&amp;quot; role=&amp;quot;note&amp;quot; style=&amp;quot;padding-left: 1.5em; margin-bottom: 0.5em; font-style: italic;&amp;quot;&amp;gt;{{{1}}}&amp;lt;/div&amp;gt;&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar&amp;diff=108</id>
		<title>MediaWiki:Sidebar</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar&amp;diff=108"/>
		<updated>2025-06-17T12:00:53Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* navigation&lt;br /&gt;
** mainpage|mainpage-description&lt;br /&gt;
** recentchanges-url|recentchanges&lt;br /&gt;
** randompage-url|randompage&lt;br /&gt;
** helppage|help-mediawiki&lt;br /&gt;
* Links&lt;br /&gt;
** Meta:Infrastructure|Infrastructure&lt;br /&gt;
* SEARCH&lt;br /&gt;
* TOOLBOX&lt;br /&gt;
* LANGUAGES&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar&amp;diff=107</id>
		<title>MediaWiki:Sidebar</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=MediaWiki:Sidebar&amp;diff=107"/>
		<updated>2025-06-17T11:59:47Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot; * navigation ** mainpage|mainpage-description ** recentchanges-url|recentchanges ** randompage-url|randompage ** helppage|help-mediawiki * The usual wiki links ** meow * SEARCH * TOOLBOX * LANGUAGES&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* navigation&lt;br /&gt;
** mainpage|mainpage-description&lt;br /&gt;
** recentchanges-url|recentchanges&lt;br /&gt;
** randompage-url|randompage&lt;br /&gt;
** helppage|help-mediawiki&lt;br /&gt;
* The usual wiki links&lt;br /&gt;
** meow&lt;br /&gt;
* SEARCH&lt;br /&gt;
* TOOLBOX&lt;br /&gt;
* LANGUAGES&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
	<entry>
		<id>https://wiki.dissonant.dev/index.php?title=MediaWiki:Copyrightwarning&amp;diff=105</id>
		<title>MediaWiki:Copyrightwarning</title>
		<link rel="alternate" type="text/html" href="https://wiki.dissonant.dev/index.php?title=MediaWiki:Copyrightwarning&amp;diff=105"/>
		<updated>2025-05-19T16:13:21Z</updated>

		<summary type="html">&lt;p&gt;Knuxify: Created page with &amp;quot;{{hint|Read the Editor&amp;#039;s Guide for wiki rules, information about MediaWiki syntax and other useful hints.}}  Please note that all contributions to {{SITENAME}} are considered to be released under the $2 (see $1 for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.&amp;lt;br /&amp;gt; You are also promising us that you wrote this yourself, or copied it from a public domain or similar fr...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{hint|Read the [[Help:Wiki editor&#039;s guide|Editor&#039;s Guide]] for wiki rules, information about MediaWiki syntax and other useful hints.}}&lt;br /&gt;
&lt;br /&gt;
Please note that all contributions to {{SITENAME}} are considered to be released under the $2 (see $1 for details).&lt;br /&gt;
If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.&amp;lt;br /&amp;gt;&lt;br /&gt;
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.&lt;br /&gt;
&amp;lt;strong&amp;gt;Do not submit copyrighted work without permission!&amp;lt;/strong&amp;gt;&lt;/div&gt;</summary>
		<author><name>Knuxify</name></author>
	</entry>
</feed>