18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2004 Simtec Electronics
48c2ecf20Sopenharmony_ci *	http://armlinux.simtec.co.uk/
58c2ecf20Sopenharmony_ci *	Written by Ben Dooks, <ben@simtec.co.uk>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/* s3c_pm_init
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * called from board at initialisation time to setup the power
118c2ecf20Sopenharmony_ci * management
128c2ecf20Sopenharmony_ci*/
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include "pm-common.h"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistruct device;
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#ifdef CONFIG_SAMSUNG_PM
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciextern __init int s3c_pm_init(void);
218c2ecf20Sopenharmony_ciextern __init int s3c64xx_pm_init(void);
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#else
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistatic inline int s3c_pm_init(void)
268c2ecf20Sopenharmony_ci{
278c2ecf20Sopenharmony_ci	return 0;
288c2ecf20Sopenharmony_ci}
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistatic inline int s3c64xx_pm_init(void)
318c2ecf20Sopenharmony_ci{
328c2ecf20Sopenharmony_ci	return 0;
338c2ecf20Sopenharmony_ci}
348c2ecf20Sopenharmony_ci#endif
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* configuration for the IRQ mask over sleep */
378c2ecf20Sopenharmony_ciextern unsigned long s3c_irqwake_intmask;
388c2ecf20Sopenharmony_ciextern unsigned long s3c_irqwake_eintmask;
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* per-cpu sleep functions */
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciextern void (*pm_cpu_prep)(void);
438c2ecf20Sopenharmony_ciextern int (*pm_cpu_sleep)(unsigned long);
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* Flags for PM Control */
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciextern unsigned long s3c_pm_flags;
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* from sleep.S */
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ciextern int s3c2410_cpu_suspend(unsigned long);
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#ifdef CONFIG_PM_SLEEP
548c2ecf20Sopenharmony_ciextern int s3c_irq_wake(struct irq_data *data, unsigned int state);
558c2ecf20Sopenharmony_ciextern void s3c_cpu_resume(void);
568c2ecf20Sopenharmony_ci#else
578c2ecf20Sopenharmony_ci#define s3c_irq_wake NULL
588c2ecf20Sopenharmony_ci#define s3c_cpu_resume NULL
598c2ecf20Sopenharmony_ci#endif
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#ifdef CONFIG_SAMSUNG_PM
628c2ecf20Sopenharmony_ciextern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
638c2ecf20Sopenharmony_ci#else
648c2ecf20Sopenharmony_ci#define s3c_irqext_wake NULL
658c2ecf20Sopenharmony_ci#endif
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
688c2ecf20Sopenharmony_ci/**
698c2ecf20Sopenharmony_ci * s3c_pm_debug_smdkled() - Debug PM suspend/resume via SMDK Board LEDs
708c2ecf20Sopenharmony_ci * @set: set bits for the state of the LEDs
718c2ecf20Sopenharmony_ci * @clear: clear bits for the state of the LEDs.
728c2ecf20Sopenharmony_ci */
738c2ecf20Sopenharmony_ciextern void s3c_pm_debug_smdkled(u32 set, u32 clear);
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#else
768c2ecf20Sopenharmony_cistatic inline void s3c_pm_debug_smdkled(u32 set, u32 clear) { }
778c2ecf20Sopenharmony_ci#endif /* CONFIG_S3C_PM_DEBUG_LED_SMDK */
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/**
808c2ecf20Sopenharmony_ci * s3c_pm_configure_extint() - ensure pins are correctly set for IRQ
818c2ecf20Sopenharmony_ci *
828c2ecf20Sopenharmony_ci * Setup all the necessary GPIO pins for waking the system on external
838c2ecf20Sopenharmony_ci * interrupt.
848c2ecf20Sopenharmony_ci */
858c2ecf20Sopenharmony_ciextern void s3c_pm_configure_extint(void);
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#ifdef CONFIG_GPIO_SAMSUNG
888c2ecf20Sopenharmony_ci/**
898c2ecf20Sopenharmony_ci * samsung_pm_restore_gpios() - restore the state of the gpios after sleep.
908c2ecf20Sopenharmony_ci *
918c2ecf20Sopenharmony_ci * Restore the state of the GPIO pins after sleep, which may involve ensuring
928c2ecf20Sopenharmony_ci * that we do not glitch the state of the pins from that the bootloader's
938c2ecf20Sopenharmony_ci * resume code has done.
948c2ecf20Sopenharmony_ci*/
958c2ecf20Sopenharmony_ciextern void samsung_pm_restore_gpios(void);
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci/**
988c2ecf20Sopenharmony_ci * samsung_pm_save_gpios() - save the state of the GPIOs for restoring after sleep.
998c2ecf20Sopenharmony_ci *
1008c2ecf20Sopenharmony_ci * Save the GPIO states for resotration on resume. See samsung_pm_restore_gpios().
1018c2ecf20Sopenharmony_ci */
1028c2ecf20Sopenharmony_ciextern void samsung_pm_save_gpios(void);
1038c2ecf20Sopenharmony_ci#else
1048c2ecf20Sopenharmony_cistatic inline void samsung_pm_restore_gpios(void) {}
1058c2ecf20Sopenharmony_cistatic inline void samsung_pm_save_gpios(void) {}
1068c2ecf20Sopenharmony_ci#endif
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ciextern void s3c_pm_save_core(void);
1098c2ecf20Sopenharmony_ciextern void s3c_pm_restore_core(void);
110