Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVR-8: Implement Power Management #19784

Merged
merged 8 commits into from
Dec 1, 2023
Merged
Prev Previous commit
Next Next commit
cpu/atxmega: Fix PM states on peripherals
Fix the required PM state on i2c and spi peripherals.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
  • Loading branch information
nandojve authored and maribu committed Dec 1, 2023
commit 549e2b4de15d256aa4bff408cf6d5317bbd1a195
4 changes: 2 additions & 2 deletions cpu/atxmega/periph/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void i2c_acquire(i2c_t i2c)
{
assert((unsigned)i2c < I2C_NUMOF);
DEBUG("acquire\n");
pm_block(3);
pm_block(4); /* Require clkPer */
mutex_lock(&i2c_ctx[i2c].locks);
pm_periph_enable(i2c_config[i2c].pwr);

Expand All @@ -122,7 +122,7 @@ void i2c_release(i2c_t i2c)
dev(i2c)->MASTER.CTRLA = 0;
pm_periph_disable(i2c_config[i2c].pwr);
mutex_unlock(&i2c_ctx[i2c].locks);
pm_unblock(3);
pm_unblock(4);
DEBUG("release\n");
}

Expand Down
4 changes: 2 additions & 2 deletions cpu/atxmega/periph/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void spi_acquire(spi_t bus, spi_cs_t cs, spi_mode_t mode, spi_clk_t clk)

DEBUG("acquire\n");

pm_block(3);
pm_block(4); /* Require clkPer */
mutex_lock(&locks[bus]);
pm_periph_enable(spi_config[bus].pwr);

Expand All @@ -113,7 +113,7 @@ void spi_release(spi_t bus)
dev(bus)->CTRL &= ~SPI_ENABLE_bm;
pm_periph_disable(spi_config[bus].pwr);
mutex_unlock(&locks[bus]);
pm_unblock(3);
pm_unblock(4);

DEBUG("release\n");
}
Expand Down