- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.3k
 
Add support for reTerminal, a Raspberry Pi 4 CM carrier board #4622
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
base: rpi-5.10.y
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are several problems with this PR:
- It contains several drivers (and changes to existing drivers) that aren't Pi-specific and should be upstreamed - we won't take on the support burden.
 - The overlay and README have a few stylistic issues - see the inline comments.
 - The defconfig patches can be squashed into a single one - we will do that eventually, so they might as well start out that way.
 
| 
           @AIWintermuteAI FWIW CM4 and CM4 IO support will land in Linux 5.16. The DTS approach differs a little bit from this tree, because of missing full overlay support in upstream.  | 
    
| 
           @pelwell Thanks for detailed review! 
  | 
    
| 
           @lategoodbye Thanks for the heads-up! Do you mean that the overlay in my PR needs to be modified because of that?  | 
    
| 
           @AIWintermuteAI There is no need to modify the overlay in this PR.  | 
    
| 
           I don't see why the touchpanel driver should be treated any differently - it's also generic code that could be useful for other platforms, so it should go upstream.  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like a bit of a mismash with multiple functions crammed into one driver.
ILI9881D would appear to be a standalone panel, although it does need GPIO control for reset control and/or regulators.
https://github.com/raspberrypi/linux/blob/rpi-5.10.y/arch/arm/boot/dts/overlays/vc4-kms-dsi-7inch-overlay.dts has been updated to use the newer drivers which split this functionality for the Pi panel into independent modules and stayed within the normal frameworks.
We also seem to have some new custom device tree properties which have no documentation.
        
          
                drivers/i2c/muxes/i2c-mux-pca953xx.c
              
                Outdated
          
        
      | @@ -0,0 +1,1413 @@ | |||
| // SPDX-License-Identifier: GPL-2.0-only | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've added this to drivers/i2c/muxes, but it's an I2C GPIO expander. It also appears to be a copy of /driver/gpio/gpio-pca953x, including duplicating a large number of the compatible strings.
| .vdisplay = 1280, | ||
| .vsync_start= 1280 + 10, | ||
| .vsync_end = 1280 + 10 + 20, | ||
| .vtotal = 1280 + 10 + 20 + 30, | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This timing looks identical to lhr050h41_default_mode in drivers/gpu/drm/panel/panel-ilitek-9881c.c
Are they actually any different?
| #include "panel-reTerminal.h" | ||
| 
               | 
          ||
| 
               | 
          ||
| static struct mipi_dsi_device *ili9881d_dsi = NULL; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One static variable, so how would I add 2 of these to a device?
| #define IILI9881_COMMAND(_cmd,_data...) DSI_DCS_WRITE(dsi,_cmd,_data) | ||
| static int ili9881d_prepare(struct drm_panel *panel) | ||
| { | ||
| struct mipi_dsi_device *dsi = ili9881d_dsi; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct i2c_mipi_dsi *md = panel_to_md(panel);
struct mipi_dsi_device *dsi = md->dsi;
Gets rid of ili9881d_dsi
| 
           Looking at it, your commit text says of the touchscreen If it is the vanilla Goodix touch-controller, it'd seem highly plausible to write a very simple wrapper that looked like an I2C controller to take requests from the existing driver and encapsulate them for the MCU. It largely looks like you're splitting the write and read into two transactions with a delay, so that should be pretty trivial to implement.  | 
    
5524210    to
    2d34f9a      
    Compare
  
    2d34f9a    to
    542eb1b      
    Compare
  
    | 
           @pelwell I dropped all the commits relating to the modules that you said need to go to upstream. What's left now is overlay and enabling building LIS331DLH driver as a module.  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If merging this now is useful to you then fix the hard TAB, squash down to two commits - overlay and config - and update the PR one more time.
          
 https://github.com/raspberrypi/linux/blob/rpi-5.10.y/arch/arm/boot/dts/overlays/vc4-kms-dsi-7inch-overlay.dts is the closest as it uses an Atmel as backlight, regulator, and GPIO controller. Remove the TC358762 bridge and panel_disp1, moving to a single ILI9881 panel under &dsi1 instead. ILI9881C already has a driver at https://github.com/raspberrypi/linux/blob/rpi-5.10.y/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c The I2C wrapper for the MCU should be relatively simple in taking a parent I2C device and creating a new one. The transfer function then takes in the request and issues multiple transfers to the parent, with delays between each.  | 
    
| 
           DRM requires all components to be available before it binds them all. I suspect with dsi1 enabled but no panel driver in the build, adding this overlay will lead to all displays going blank as DRM can never bind. Is that actually useful?  | 
    
542eb1b    to
    1403669      
    Compare
  
    | 
           Apart from @6by9's question ("Is [all display's blank] actually useful?") I'm ready to merge. I'm also happy to park this until progress has been made on getting the necessary drivers into the kernel.  | 
    
| 
           By coincidence a patch has just been submitted to dri-devel that claims to add an ILI9881D panel to the ILI9881C driver. That implies that they are close enough to reuse the same driver (or it's a typo!)  | 
    
This allows using reTerminal carrier board built-in sensors and LCD display/touch screen. Seeed Studio reTerminal is a Human-Machine Interface (HMI) carrier board for Raspberry Pi 4 CM with 5-inch LCD screen, accelerometer, light sensor, GPIO buttons and user LEDs. reTerminal can easily and efficiently work with IoT and cloud systems to unlock endless scenarios at the edge. Signed-off-by: Maslov Dmitry <[email protected]>
4a669d1    to
    d6afe37      
    Compare
  
    Enabled building LIS331DLH drivers as module, used in Seeed Studio reTerminal carrier board for Raspberry Pi CM 4. Signed-off-by: Maslov Dmitry <[email protected]>
This PR adds a seeed-reterminal-core overlay and enables building necessary drivers as modules to support reTerminal, a Raspberry Pi 4 CM carrier board.
Seeed Studio reTerminal is a Human-Machine Interface (HMI) carrier board
for Raspberry Pi 4 CM with 5-inch LCD screen, accelerometer,
light sensor, GPIO buttons and user LEDs. reTerminal can easily and
efficiently work with IoT and cloud systems to unlock endless scenarios
at the edge.
Signed-off-by: Maslov Dmitry [email protected]