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; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 ao_gpio_suspend(void *arg)
23 struct stm_gpio *port = arg;
24 if (port == &stm_gpioa)
25 stm_rcc.ahbenr &= ~(1 << STM_RCC_AHBENR_IOPAEN);
26 else if ((port) == &stm_gpiob)
27 stm_rcc.ahbenr &= ~(1 << STM_RCC_AHBENR_IOPBEN);
28 else if ((port) == &stm_gpioc)
29 stm_rcc.ahbenr &= ~(1 << STM_RCC_AHBENR_IOPCEN);
30 else if ((port) == &stm_gpiof)
31 stm_rcc.ahbenr &= ~(1 << STM_RCC_AHBENR_IOPFEN);
35 ao_gpio_resume(void *arg)
37 struct stm_gpio *port = arg;
38 if (port == &stm_gpioa)
39 stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_IOPAEN);
40 else if ((port) == &stm_gpiob)
41 stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_IOPBEN);
42 else if ((port) == &stm_gpioc)
43 stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_IOPCEN);
44 else if ((port) == &stm_gpiof)
45 stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_IOPFEN);
48 struct ao_power ao_power_gpioa = {
49 .suspend = ao_gpio_suspend,
50 .resume = ao_gpio_resume,
54 struct ao_power ao_power_gpiob = {
55 .suspend = ao_gpio_suspend,
56 .resume = ao_gpio_resume,
60 struct ao_power ao_power_gpioc = {
61 .suspend = ao_gpio_suspend,
62 .resume = ao_gpio_resume,
66 struct ao_power ao_power_gpiof = {
67 .suspend = ao_gpio_suspend,
68 .resume = ao_gpio_resume,