Skip to content

Rpi 4.4.y dsi stub squash #1556

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

Merged
merged 16 commits into from
Aug 10, 2016

Conversation

anholt
Copy link
Contributor

@anholt anholt commented Jul 7, 2016

Here's the stripped down series I've come up with for adding DSI support, based on not having ignore_lcd in the config.txt. Since it's requiring that the firmware set up DSI, there's no power management and instead of turning off the DSI and PV during DPMS, we just set the HVS to scan out black.

There's no touch input support yet. I think that's the next step, even before fixing the DSI link management.

@@ -110,9 +111,10 @@
reg = <0x7e101000 0x2000>;

/* CPRMAN derives everything from the platform's
* oscillator.
* oscillator except for a few clocks that may
+ * derive from something else derived from CPRMAN..
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cut and paste??????

@anholt
Copy link
Contributor Author

anholt commented Jul 7, 2016

It looks like without disable_touchscreen set in config.txt, the rpi-ft5406 driver keeps working just fine.

@anholt anholt force-pushed the rpi-4.4.y-dsi-stub-squash branch from b988b5e to 6e70121 Compare July 8, 2016 18:02
@anholt
Copy link
Contributor Author

anholt commented Jul 8, 2016

(force push was to drop the stray "+" in the comment)

@chbae
Copy link

chbae commented Jul 27, 2016

@anholt When will you merge this change?

@anholt
Copy link
Contributor Author

anholt commented Jul 27, 2016

@chbae I'm the one requesting the merge, it's up to the foundation folks to pull it.

@clivem
Copy link

clivem commented Jul 27, 2016

@anholt Eric, is there no way of making this fly with CONFIG_DRM=m and CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=m. I haven't checked, but I'm thinking that having DRM compiled-in rather than module, is going to increase the size of the default kernel substantially, when very few people are actually using the functionality...... Just thinking out loud......

@popcornmix
Copy link
Collaborator

Looks like the =y option on CONFIG_DRM costs us 224K is available memory and 165K in size of kernel7.img.
@anholt - is that something that is essential?
It seems expensive for the users who don't use it.

pi@domnfs:~ $ ls -l /boot/kernel7.img 
-rwxr-xr-x 1 root root 4225384 Aug  8 18:01 /boot/kernel7.img
pi@domnfs:~ $ free -k
             total       used       free     shared    buffers     cached
Mem:        817828      91668     726160       5932         24      50740
-/+ buffers/cache:      40904     776924
Swap:       524284          0     524284
pi@domnfs:~ $ ls -l /boot/kernel7.img 
-rwxr-xr-x 1 root root 4390520 Aug  8 18:05 /boot/kernel7.img
pi@domnfs:~ $ free -k
             total       used       free     shared    buffers     cached
Mem:        817456      91544     725912       5932         24      50764
-/+ buffers/cache:      40756     776700
Swap:            0          0          0

@anholt
Copy link
Contributor Author

anholt commented Aug 8, 2016

I don't think counting on-disk size is appropriate, as you're just moving it from an initrd module to built-in. Memory size in non-vc4 mode is unfortunate, though if we can flip to vc4-by-defaut we should be able to get way more back by reducing gpu_mem.

For getting back to building as a module, hopefully with this series http://www.spinics.net/lists/dri-devel/msg114234.html it will be an option.

@anholt
Copy link
Contributor Author

anholt commented Aug 8, 2016

Note, if you're not up for merging the whole branch, it would still help a lot if you could pull up to before the defconfig change.

@popcornmix
Copy link
Collaborator

@pelwell any objections?

@pelwell
Copy link
Contributor

pelwell commented Aug 9, 2016

I'm skeptical about the need for CONFIG_DEBUG_GPIO, which appears to just enable some dmesg KERN_DEBUG output. AFAICT the /sys/kernel/debug/pinctrl/ entries are enabled by CONFIG_DEBUG_FS, which is already defined. I am, of course, open to correction.

anholt and others added 5 commits August 9, 2016 13:31
While the SDRAM is being driven by its dedicated PLL most of the time,
there is a little loop running in the firmware that periodically turns
on the CM SDRAM clock (using its pre-initialized parent) and switches
SDRAM to using the CM clock to do PVT recalibration.

This avoids system hangs if we choose SDRAM's parent for some other
clock, then disable that clock.

Signed-off-by: Eric Anholt <[email protected]>
Our core PLLs are intended to be configured once and left alone.  With
the flag set, asking to set the PLLD_DSI1 clock rate would change PLLD
just to get closer to the requested DSI clock, thus changing PLLD_PER,
the UART and ethernet PHY clock rates downstream of it, and breaking
ethernet.

Signed-off-by: Eric Anholt <[email protected]>
The drm_fbdev_cma_init function always calls the
drm_helper_disable_unused_functions. Since it's part of the usual probe
process, all the drivers using that helper will end up having their encoder
and CRTC disable functions called at probe if their device has not been
reported as enabled.

This could be fixed by reading out from the registers the current state of
the device if it is enabled, but even that will not handle the case where
the device is actually disabled.

Moreover, the drivers using the atomic modesetting expect that their enable
and disable callback to be called when the device is already enabled or
disabled (respectively).

We can however fix this issue by moving the call to
drm_helper_disable_unused_functions out of drm_fbdev_cma_init and make the
drivers needing it (all the drivers calling drm_fbdev_cma_init and not
using the atomic modesetting) explicitly call it.

Signed-off-by: Maxime Ripard <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/1452785109-6172-14-git-send-email-maxime.ripard@free-electrons.com
Acked-by: Laurent Pinchart <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
(cherry picked from commit 4314e19)
@anholt
Copy link
Contributor Author

anholt commented Aug 9, 2016

Yeah, I must have screwed something up to write that commit. I'll drop it and retest, or you can just drop it.

I'm working on a build against the current rpi-4.4.y right now, and if it works I'll re-push.

@@ -307,7 +307,7 @@ static inline void bcm2835_pinctrl_fsel_set(
u32 val = bcm2835_gpio_rd(pc, FSEL_REG(pin));
enum bcm2835_fsel cur = (val >> FSEL_SHIFT(pin)) & BCM2835_FSEL_MASK;

dev_dbg(pc->dev, "read %08x (%u => %s)\n", val, pin,
dev_info(pc->dev, "read %08x (%u => %s)\n", val, pin,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm - I don't think we want these.

@pelwell
Copy link
Contributor

pelwell commented Aug 9, 2016

Cool - it's nice to have my sanity confirmed occasionally,

Aside from that and the few inline comments, I have no issues with the patch., but note that I've concentrated on the interactions with other areas rather than reading all of your code.

@anholt anholt force-pushed the rpi-4.4.y-dsi-stub-squash branch from 6e70121 to 8720647 Compare August 9, 2016 21:22
@anholt
Copy link
Contributor Author

anholt commented Aug 9, 2016

Thanks for the cleanups @pelwell. Pushed with those two fixed and the gpio debug config dropped.

@anholt
Copy link
Contributor Author

anholt commented Aug 9, 2016

Also, anyone have any ideas why the panel built as a module wouldn't automatically load? That's the prereq for dropping CONFIG_DRM_MIPI_DSI to a module, and thus CONFIG_DRM back to module.

@pelwell
Copy link
Contributor

pelwell commented Aug 9, 2016

Off the top of my head (which is going to bed now), is it because the parent of the touchscreen node doesn't cause subnodes to be treated as potential platform devices, perhaps because it isn't a bus?

tiwai and others added 4 commits August 9, 2016 14:49
This is a preliminary patch for building drm-mipi-dsi as a module.
Add the module exit callback to unregister the bus properly.

Suggested-by: Thierry Reding <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Eric Anholt <[email protected]>
The drm-mipi-dsi driver has been only built-in although this isn't
strictly required to be so.  Since it's referred by lots of DRM
drivers nowadays, most of distro kernels include the driver as
built-in as a result, even though many systems don't need it at all.

This patch fixes Kconfig to allow drm-mipi-dsi driver built as a
module, so that we can save footprint on systems without such DRM
drivers.  The probe order is managed by the module dependency, and
postcore_initcall() works just fine as a module init call.

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Eric Anholt <[email protected]>
Empirically, DSI1 appears to be using HVS channel 0 on my Pi2.

Signed-off-by: Eric Anholt <[email protected]>
Every file was defining its own little struct and dumping for the
regs, when there's a helper in debugfs for doing just this.  However,
instead of printing:

PV_HORZA (0x000c): 0x00000000

we now print:

PV_HORZA = 0x00000000

Signed-off-by: Eric Anholt <[email protected]>
@anholt
Copy link
Contributor Author

anholt commented Aug 9, 2016

Yeah, they're not instantiated as platform devices, they're on their own bus. I may have a fix.

@anholt anholt force-pushed the rpi-4.4.y-dsi-stub-squash branch from 8720647 to 1a04975 Compare August 9, 2016 22:20
anholt added 6 commits August 9, 2016 15:23
The DSI0 and DSI1 blocks on the 2835 are different but very similar
hardware blocks.  Some registers move around, and the featureset is
slightly different, but they're clearly related.  This doesn't enable
DSI0, but some of the infrastructure is present.

Also, this driver doesn't initialize the DSI successfully from
poweron, so we currently require that the Raspberry Pi firmware enable
it at boot time.  From there, we just keep the same settings forever,
and when poweroff is requested we just scan out black instead.

Signed-off-by: Eric Anholt <[email protected]>
In order to make DSI panel modules able to load automatically, we need
to emit the OF modalias uevent so that their MODULE_DEVICE_TABLE(of,
...) can match against it.

Signed-off-by: Eric Anholt <[email protected]>
This gets the Raspberry Pi panel module to automatically load at boot
time.

Signed-off-by: Eric Anholt <[email protected]>
@anholt anholt force-pushed the rpi-4.4.y-dsi-stub-squash branch from 1a04975 to 8018f92 Compare August 9, 2016 22:28
@anholt
Copy link
Contributor Author

anholt commented Aug 9, 2016

And fixed a stray debug printf in vc4_dsi.c.

@popcornmix popcornmix merged commit 26550dc into raspberrypi:rpi-4.4.y Aug 10, 2016
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Aug 10, 2016
See: raspberrypi/linux#1581

kernel: enable gembird joypad support
See: raspberrypi/linux#1589

kernel: Added HiFiBerry Digi+ Pro driver
See: raspberrypi/linux#1583

kernel: overlays: Add assert_falling_edge to pps-gpio overlay
See: raspberrypi/linux#1590

kernel: Experimental graphics driver DSI support
See: raspberrypi/linux#1556

firmware: Add customisation project board type
firmware: platform: Enable Bluetooth on custom

firmware: gencmd: Add support for hdmi_cvt and hdmi_timings
See: #637

firmware: arm_display: Allow source aspect ratio to be configured
See: #638

firmware: mmal: Allow /dev/vchiq to be opened initialised prior to mmal_vc_init
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Aug 10, 2016
See: raspberrypi/linux#1581

kernel: enable gembird joypad support
See: raspberrypi/linux#1589

kernel: Added HiFiBerry Digi+ Pro driver
See: raspberrypi/linux#1583

kernel: overlays: Add assert_falling_edge to pps-gpio overlay
See: raspberrypi/linux#1590

kernel: Experimental graphics driver DSI support
See: raspberrypi/linux#1556

firmware: Add customisation project board type
firmware: platform: Enable Bluetooth on custom

firmware: gencmd: Add support for hdmi_cvt and hdmi_timings
See: raspberrypi/firmware#637

firmware: arm_display: Allow source aspect ratio to be configured
See: raspberrypi/firmware#638

firmware: mmal: Allow /dev/vchiq to be opened initialised prior to mmal_vc_init
mkreisl added a commit to xbianonpi/xbian-package-firmware that referenced this pull request Aug 12, 2016
- kernel: fix auto-sense in lirc_rpi driver

  See: raspberrypi/linux#1581

- kernel: enable gembird joypad support
  See: raspberrypi/linux#1589

- kernel: Added HiFiBerry Digi+ Pro driver
  See: raspberrypi/linux#1583

- kernel: overlays: Add assert_falling_edge to pps-gpio overlay
  See: raspberrypi/linux#1590

- kernel: Experimental graphics driver DSI support
  See: raspberrypi/linux#1556

- firmware: Add customisation project board type
- firmware: platform: Enable Bluetooth on custom

- firmware: gencmd: Add support for hdmi_cvt and hdmi_timings
  See: #637

- firmware: arm_display: Allow source aspect ratio to be configured
  See: #638

- firmware: mmal: Allow /dev/vchiq to be opened initialised prior to mmal_vc_init
@chbae
Copy link

chbae commented Aug 16, 2016

@anholt
Thanks for this work.
It works fine on GENIVI platform. (https://github.com/genivi/genivi-dev-platform).
I tested on my raspberrypi2 + Official 7'' touch screen. After adding rpi-ft5406-overlay, touch is also working fine.

@tom--pollard
Copy link

Can confirm this is working for me also, thanks for the great work @anholt !

@anholt anholt deleted the rpi-4.4.y-dsi-stub-squash branch September 29, 2016 00:48
neuschaefer pushed a commit to neuschaefer/raspi-binary-firmware that referenced this pull request Feb 27, 2017
See: raspberrypi/linux#1581

kernel: enable gembird joypad support
See: raspberrypi/linux#1589

kernel: Added HiFiBerry Digi+ Pro driver
See: raspberrypi/linux#1583

kernel: overlays: Add assert_falling_edge to pps-gpio overlay
See: raspberrypi/linux#1590

kernel: Experimental graphics driver DSI support
See: raspberrypi/linux#1556

firmware: Add customisation project board type
firmware: platform: Enable Bluetooth on custom

firmware: gencmd: Add support for hdmi_cvt and hdmi_timings
See: raspberrypi#637

firmware: arm_display: Allow source aspect ratio to be configured
See: raspberrypi#638

firmware: mmal: Allow /dev/vchiq to be opened initialised prior to mmal_vc_init
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

Successfully merging this pull request may close these issues.

8 participants