Find the answer to your Linux question:
Results 1 to 7 of 7
Hello, I am building a kernel dirver for a backlight control. The problem is that the backlight driver expects a PWM signal but it is connected only to a normal ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2012
    Posts
    9

    High precision timer in kernel module


    Hello,

    I am building a kernel dirver for a backlight control. The problem is that the backlight driver expects a PWM signal but it is connected only to a normal GPIO pin wich has no PWM capability. So I have to write a software PWM driver. Therefore I need a high precision timer with a high resolution and a high precision. The PWM must have a frequency of at least 100Hz and I'd like to have at least 10 steps, means that I need a timer with 1kHz resolution and also precision!
    I tryed with the hrtimer but the PWM is not stable, means I have a jitter in the signal which causes the display to flicker.
    Is there any possibility to get a timer with higher precision? Frequency must be higher than 1kHz but can go up to MHz.

    Fabian

  2. #2
    Linux Newbie hagfish52's Avatar
    Join Date
    Dec 2011
    Location
    Asheville, NC
    Posts
    225
    Maybe this will help: High Performance Time Measurement in Linux Software ahoy! This uses the HPET circuit in the southbridge chips found in most modern computers since 2005.

  3. #3
    Just Joined!
    Join Date
    Jul 2012
    Posts
    9
    With "modern computers" you mean X86 PCs? The problem is that I am on an ARM (OMAP 3 compatible).
    Edit: I found out that the GPIO I have to use also supports PWM. The problem is, it seems like there is no PWM (software) driver for OMAP3. So I will have to write my own driver... this may take a while.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Newbie hagfish52's Avatar
    Join Date
    Dec 2011
    Location
    Asheville, NC
    Posts
    225
    An overview of PWM on OMAP3 timers: BeagleBoardPWM - eLinux.org

    A PWM driver for OMAP3 produced at the 2010 Google Summer of Code: BeagleBoard/GSoC/2010 Projects/Pulse Width Modulation - eLinux.org

    You will have to set up an account with elinux.org before you can access these pages.

  6. #5
    Just Joined!
    Join Date
    Jul 2012
    Posts
    9
    Thanks I found these links already.
    The Beagleboard suff was helpfull according to the muxing but the OMAP3 PWM driver is crap as far as I can see. It is not a real PWM driver, it will provide some character devices in /dev/pwm0..3. It will not populate the PWM API to other kernel drivers. At the moment I have a workaround by implementing a backlight driver which will directly access the OMAP_DM timers. So I bypassed the PWM driver. It works fine but I don't think this is the way it should be and I will probably write it all again with the PWM driver.
    Thanks so far!

  7. #6
    Linux Newbie hagfish52's Avatar
    Join Date
    Dec 2011
    Location
    Asheville, NC
    Posts
    225
    Here is a more recent driver, but you may have the same problem with the PWM API. Also the author says there is a problem with using it with kernel 3.2.

    https://github.com/scottellis/omap3-pwm

  8. #7
    Just Joined!
    Join Date
    Jul 2012
    Posts
    9
    Seems to have the same problem. This driver also does not populate the PWM functions to other drivers.
    Or maybe I don't understand how it works, I am working on Linux drivers just since 3 days

    Edit: I think I am right. I need a driver for ARM/OMAP which exports the Kernel symbols pwm_config, pwm_enable, pwm_request, and so on....
    There is a header file which defines all these required symbols (structs and functions) in the kernel source include/linux/pwm.h.
    Both drivers you suggested don't export these functions. Maybe it is possible to adapt them to do that, I will check this later.
    Last edited by FabianS; 07-26-2012 at 03:46 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •