2 * Copyright © 2016 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 ao_gpio_suspend(void *arg)
24 struct stm_gpio *port = arg;
25 if (port == &stm_gpioa)
26 stm_rcc.ahbenr &= ~(1UL << STM_RCC_AHBENR_IOPAEN);
27 else if ((port) == &stm_gpiob)
28 stm_rcc.ahbenr &= ~(1UL << STM_RCC_AHBENR_IOPBEN);
29 else if ((port) == &stm_gpioc)
30 stm_rcc.ahbenr &= ~(1UL << STM_RCC_AHBENR_IOPCEN);
31 else if ((port) == &stm_gpiof)
32 stm_rcc.ahbenr &= ~(1UL << STM_RCC_AHBENR_IOPFEN);
36 ao_gpio_resume(void *arg)
38 struct stm_gpio *port = arg;
39 if (port == &stm_gpioa)
40 stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_IOPAEN);
41 else if ((port) == &stm_gpiob)
42 stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_IOPBEN);
43 else if ((port) == &stm_gpioc)
44 stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_IOPCEN);
45 else if ((port) == &stm_gpiof)
46 stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_IOPFEN);
49 struct ao_power ao_power_gpioa = {
50 .suspend = ao_gpio_suspend,
51 .resume = ao_gpio_resume,
55 struct ao_power ao_power_gpiob = {
56 .suspend = ao_gpio_suspend,
57 .resume = ao_gpio_resume,
61 struct ao_power ao_power_gpioc = {
62 .suspend = ao_gpio_suspend,
63 .resume = ao_gpio_resume,
67 struct ao_power ao_power_gpiof = {
68 .suspend = ao_gpio_suspend,
69 .resume = ao_gpio_resume,