I just wanted to say thanks for posting this info on the PWM driver. I need to run the PWMs at different frequencies and was able to easily accomplish it after finding this message.

 

Nick

 

There is a frequency parameter you can pass to the driver

when you load it, but it applies to all of the timers.

 

It's described in the README.

 

It's a trivial mod to do what you want, i.e. give each timer

their own frequency.

 

Here's what I'd do.

 

Add a new frequency variable to struct pwm_dev

 

struct pwm_dev {

    dev_t devt;

    struct cdev cdev;

    struct device *device;

    ...

+ int frequency;

};

 

Initialize it for each timer, maybe in pwm_init() but anywhere

as long as its before the pwm_set_frequency() call. Since you

know your frequencies, I'd just hard code them.

 

Then everywhere the current global frequency is used, use

your new pwm_dev.frequency instead. I think it's just

pwm_set_frequency() and pwm_set_servo_pulse() but I'd

check yourself.

 

FYI, the README is a little behind some recent changes to the

driver from Jemiah Aitch and Tobias Simon. Performance should

be improved using ioctl to change the timer settings at runtime.

The old file write() still works though.

 

Scott