Skip to content

Set necessary clocks automatically in pwm-bcm2835.c #1175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gohai opened this issue Oct 25, 2015 · 12 comments
Closed

Set necessary clocks automatically in pwm-bcm2835.c #1175

gohai opened this issue Oct 25, 2015 · 12 comments

Comments

@gohai
Copy link
Contributor

gohai commented Oct 25, 2015

Right now (Raspbian Jessie) it is necessary to make use of the audio output, e.g. by running omxplayer example.mp3, before the PMW functionality can be used. With clocks-audio queued for 4.4, and RPi Upstreaming, would it be possible to remove this requirement and setup the clocks directly from the driver?

(#1100 added the DT overlays for PWM)

@popcornmix
Copy link
Collaborator

No support in current kernel, but it may be possible in later kernels.

@gohai
Copy link
Contributor Author

gohai commented Nov 5, 2015

Seems this is being worked on (yay): http://lists.infradead.org/pipermail/linux-rpi-kernel/2015-November/002499.html

@Ruffio
Copy link

Ruffio commented Aug 17, 2016

@gohai has your issue been resolved? If so, please close this issue. Thanks.

@gohai
Copy link
Contributor Author

gohai commented Aug 18, 2016

@Ruffio No, this is still an issue on latest released Raspbian.

Try this: set dtoverlay=pwm in /boot/config.txt and reboot. Then:

$ echo "0" > /sys/class/pwm/pwmchip0/export
$ echo "1000000" > /sys/class/pwm/pwmchip0/pwm0/period
$ echo "500000" > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
$ echo "1" > /sys/class/pwm/pwmchip0/pwm0/enable

Expecting a 1 kHz period with a 50% duty cycle on GPIO18, but no:

screen shot 2016-08-18 at 1 35 13 pm

CC @repk

@repk
Copy link
Contributor

repk commented Jan 2, 2017

Hi @gohai ,

Sorry to dig an old issue.

Have you solved this issue now ? It appears that this repository does not have an appropriate overlay for my PWM clock patches to work.

You can find a proper overlay in #1533 (it uses GPIO19 but you can modify fragment@0 to set the appropriate function on GPIO18).

@gohai
Copy link
Contributor Author

gohai commented Jan 2, 2017

@repk Thanks for your reply!

This is still unresolved for me, but I will re-test shortly. Is the pwm-overlay.dts from the raspberrypi kernel not sufficient? (Based on the time this was last modified I presume that I was testing this version).

@repk
Copy link
Contributor

repk commented Jan 2, 2017

No the current bcm2708 devicetree creates a fixed clock named "pwm" which prevent the "proper" pwm clock to be initialized. To workaround this, you can create a overlay that renames this fixed clock such as the one in #1533 , the pwm-overlay.dts does not do that.

@gohai
Copy link
Contributor Author

gohai commented Jan 3, 2017

@repk I just finished building the latest downstream 4.4 kernel with the overlay you mentioned attached. But before I tried booting into it, I gave the stock kernel (and overlay) a try: and it worked.

My previous test was on an earlier Raspbian distribution, this now is the September release with kernel 4.4.21-v7+. Perhaps Raspbian's new window manager initializes the audio subsystem?

I am inclined to close this bug - @repk, this is not an issue with upstream kernels anyway, I presume?

@repk
Copy link
Contributor

repk commented Jan 3, 2017

Ok nice to know that, and yes this should not be an issue with upstream kernels that use different device tree.

@gohai
Copy link
Contributor Author

gohai commented Jan 4, 2017

@repk I'll double check this in the coming days with the latest vanilla Raspbian and a logic analyzer, and will close the issue then. Great that upstream is unaffected in any way!

@gohai
Copy link
Contributor Author

gohai commented Jan 8, 2017

@repk This is confirmed fixed (tested with vanilla Raspbian, which has 4.4.34-v7+ kernel, and no other overlays besides pwm).

@gohai gohai closed this as completed Jan 8, 2017
@ghost
Copy link

ghost commented Jul 17, 2017

May I ask what is the default duty_cycle? Is there any way to change default value for boot?

anholt pushed a commit to anholt/linux that referenced this issue Mar 3, 2018
…right screen edge

As described in the WA on GLK and CNL planes on the right edge of the
screen that have less than 4 pixels visible from the beginning of the
plane to the edge of the screen can cause FIFO underflow and display
corruption.

On GLK/CNL I could trigger the problem only if the plane was at the same
time also aligned to the top edge of the screen (after clipping) and
there were exactly 2 pixels visible from the start of the plane to the
right edge of the screen (so couldn't trigger it with 1 or 3 pixels
visible). Nevertheless, to be sure, I also applied the WA for these cases.

I also couldn't see any problem with the cursor plane and later Art
confirmed that it's not affected, so the WA is applied only for the
other plane types.

v2:
- Use -ERANGE instead of -EINVAL. (Chris)

Signed-off-by: Imre Deak <[email protected]>
Reviewed-by: Ville Syrjälä <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
anholt pushed a commit to anholt/linux that referenced this issue Mar 3, 2018
While running the kms_plane clipping test I noticed a similar problem to
the one described in Display WA raspberrypi#1175. In this case, similarly for
planes other than the cursor, with 1 or 3 pixels visible from the left
edge of the screen to the end of the plane and an odd plane X offset
used for clipping causes the same kind of underflow and display
corruption as described for WA raspberrypi#1175. Fix this in a similar way as that
WA rejecting planes ending <4 pixels from the left screen edge.

v2:
- Rebase on v2 of patch 1/1.

Testcase: igt/kms_plane/plane-clipping-pipe-*-planes
Signed-off-by: Imre Deak <[email protected]>
Reviewed-by: Ville Syrjälä <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants