<p></p>
<p><b>@benpicco</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/14007#discussion_r419145580">cpu/sam0_common/periph/pwm.c</a>:</p>
<pre style='color:#555'>> +                      | GCLK_CLKCTRL_GEN(cfg->gclk_src)
+                      | GCLK_CLKCTRL_ID(cfg->tim.gclk_id);
+    PM->APBCMASK.reg |= cfg->tim.pm_mask;
+#endif
+}
+
+static void poweroff(pwm_t dev)
+{
+    const pwm_conf_t *cfg = &pwm_config[dev];
+
+#ifdef MCLK
+    GCLK->PCHCTRL[cfg->tim.gclk_id].reg = 0;
+    *cfg->tim.mclk &= ~cfg->tim.mclk_mask;
+#else
+    PM->APBCMASK.reg &= ~cfg->tim.pm_mask;
+    GCLK->CLKCTRL.reg = GCLK_CLKCTRL_GEN_GCLK7
</pre>
<p>I guess the idea was to connect it to an unused GCLK so the original one can be turned off if it runs ondemand.<br>
This was there already, I just kept that part - I can check if it makes any difference to power consumption (if something other than <code>SAM0_GCLK_MAIN</code> is used), I'd be happy to drop it.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/14007#discussion_r419145580">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYALNKM57CN2IIJ724TRPW6GNANCNFSM4MX5FGHQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABE7WYEWXYERJS7XXXC57L3RPW6GNA5CNFSM4MX5FGH2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGODAPHATQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/14007#discussion_r419145580",
"url": "https://github.com/RIOT-OS/RIOT/pull/14007#discussion_r419145580",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>