Skip to content

Commit

Permalink
cpu/atxmega: Fix PM states on peripherals
Browse files Browse the repository at this point in the history
Fix the required PM state on i2c and spi peripherals.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
  • Loading branch information
nandojve committed Jul 6, 2023
1 parent 211ac40 commit 60e83a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cpu/atxmega/periph/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,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 @@ -121,7 +121,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

0 comments on commit 60e83a3

Please sign in to comment.