Some more updates based on testing:
I noticed in the dmesg output that atmel-pwm-bl was being loaded before atmel_pwm. That prompted me to try restructuring the code to the following:
Code:
/*
* Atmel Backlight PWM
*/
#if defined(CONFIG_ATMEL_PWM) || defined(CONFIG_ATMEL_PWM_MODULE)
static void __init cs_add_device_pwm(void)
{
at91_add_device_pwm(1 << AT91_PWM0);
}
#else
static void __init cs_add_device_pwm(void)
#endif
#if defined(CONFIG_BACKLIGHT_ATMEL_PWM) || defined(CONFIG_BACKLIGHT_ATMEL_PWM_MODULE)
static struct atmel_pwm_bl_platform_data cs_bl_data = {
.pwm_channel = AT91_PWM0,
.pwm_frequency = 10000,
.pwm_compare_max = 100,
.pwm_duty_max = 100,
.pwm_duty_min = 50,
.pwm_active_low = 0,
.gpio_on = -1,
.on_active_low = 0,
};
/* Defined in at91sam9263_devices.c */
extern struct platform_device at91sam9263_pwm0_device;
static struct platform_device cs_bl_dev = {
.name = "atmel-pwm-bl",
.id = -1,
.dev = {
.parent = &at91sam9263_pwm0_device.dev,
.platform_data = &cs_bl_data,
},
};
static void __init cs_add_device_backlight_pwm(void)
{
platform_device_register(&cs_bl_dev);
}
#else
static void __init cs_add_device_backlight_pwm(void) {}
#endif
Especially note the parent dependency in the cs_bl_dev definition. My hope was that this would cause atmel_pwm to load before atmel-pwm-bl. Unfortunately, that hope was dashed.
I was able to get things working with the following:
[list=][*]CONFIG_ATMEL_PWM=y
[*]CONFIG_BACKLIGHT_ATMEL_PWM=m
[*]Load the kernel, atmel_pwm loads properly
[*]modprobe atmel-pwm-bl[/list]
Using this, I get the following dmesg output:
Code:
# dmesg | grep -i pwm
[ 0.220000] registering platform atmel_pwm device
[ 0.730000] atmel_pwm atmel_pwm: pwm registered, mask=0x00000001
[ 0.730000] atmel_pwm driver loaded
[ 277.450000] atmel-pwm-bl atmel-pwm-bl: atmel_pwm_bl_probe
[ 277.450000] atmel-pwm-bl atmel-pwm-bl: Atmel PWM backlight driver (7760 Hz)
[ 277.520000] backlight atmel-pwm-bl: backlight pwm registered
(I added these messages to the two drivers to help figure out the sequencing issue.)
So that leaves me with two questions:
[list=][*]Why is atmel-pwm-bl being loaded before atmel_pwm in the monolithic kernel, even with the parent dependency is setup?
[*]What can be done about it?[/list]
Chris