From a3c18d29a0edf312e929858c32f441dccef88c08 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Wed, 19 Nov 2008 17:11:09 +0000 Subject: add-pwm-child-attach-callback.patch Things can depend on PWM being up, allow device tree to show that Signed-off-by: Andy Green --- arch/arm/mach-s3c2410/include/mach/pwm.h | 6 ++++++ arch/arm/mach-s3c2410/pwm.c | 10 ++++++++++ 2 files changed, 16 insertions(+) (limited to 'arch/arm/mach-s3c2410') diff --git a/arch/arm/mach-s3c2410/include/mach/pwm.h b/arch/arm/mach-s3c2410/include/mach/pwm.h index 4e3a298f407..18c1bac8851 100644 --- a/arch/arm/mach-s3c2410/include/mach/pwm.h +++ b/arch/arm/mach-s3c2410/include/mach/pwm.h @@ -29,6 +29,12 @@ struct s3c2410_pwm { unsigned long comparer; }; +struct s3c24xx_pwm_platform_data{ + /* callback to attach platform children (to enforce suspend / resume + * ordering */ + void (*attach_child_devices)(struct device *parent_device); +}; + int s3c2410_pwm_init(struct s3c2410_pwm *s3c2410_pwm); int s3c2410_pwm_enable(struct s3c2410_pwm *s3c2410_pwm); int s3c2410_pwm_disable(struct s3c2410_pwm *s3c2410_pwm); diff --git a/arch/arm/mach-s3c2410/pwm.c b/arch/arm/mach-s3c2410/pwm.c index 9528d7aab63..a171d3ceff7 100644 --- a/arch/arm/mach-s3c2410/pwm.c +++ b/arch/arm/mach-s3c2410/pwm.c @@ -223,8 +223,18 @@ EXPORT_SYMBOL_GPL(s3c2410_pwm_dumpregs); static int __init s3c24xx_pwm_probe(struct platform_device *pdev) { + struct s3c24xx_pwm_platform_data *pdata = pdev->dev.platform_data; + dev_info(&pdev->dev, "s3c24xx_pwm is registered \n"); + /* if platform was interested, give him a chance to register + * platform devices that switch power with us as the parent + * at registration time -- ensures suspend / resume ordering + */ + if (pdata) + if (pdata->attach_child_devices) + (pdata->attach_child_devices)(&pdev->dev); + return 0; } -- cgit v1.2.3