Giter VIP home page Giter VIP logo

linux-mdss-dsi-panel-driver-generator's Introduction

linux-mdss-dsi-panel-driver-generator (lmdpdg)

The downstream kernel for Qualcomm-based Android devices describes panel properties and initialization sequences in the device tree.
(See DSI Panel Driver Porting for details)

This tool uses the information provided in the device tree to automatically generate a simple DRM panel driver, for use in mainline together with Freedreno. As far as possible, it attempts to generate clean C code, so that only minimal changes are necessary for upstreaming the generated panel driver.

Example:

Preparation

Requirements

  • Python 3.7+
  • pylibfdt compiled for Python 3

Extracting device tree blob (DTB)

lmdpdg operates on the compiled device tree blob (dtb), not the original source file from the kernel source. This means that it can be easily used even when the kernel source is not available.

The device tree blob can be easily extracted from a stock boot image (boot.img):

$ tools/unpackbootimg.py boot.img
$ tools/unpackqcdt.py dt.img

This will produce multiple *.dtb files in the correct directory. You will need to try multiple (or all) of them to find the correct one.

Compiling from source .dtsi

If you have only the source .dtsi for the panel, or would like to make changes in it, you can still use it as input for this tool. You just need to pretend to have a full device tree blob by setting up the needed device nodes:

/dts-v1/;

/ {
	mdp {
		compatible = "qcom,mdss_mdp";

		/* Add your panels here */
		dsi_sim_vid: qcom,mdss_dsi_sim_video {
			qcom,mdss-dsi-panel-name = "Simulator video mode dsi panel";
			//qcom,mdss-dsi-panel-controller = <&mdss_dsi0>;
			qcom,mdss-dsi-panel-type = "dsi_video_mode";
			/* ... */
		};
	};
};

Comment out entries that refer to other devices (see above).

Compile it using dtc: dtc -O your.dtb your.dts. That's it! Yay!

Usage

Got the device tree blob? Then you are ready to go:

$ ./lmdpdg.py <dtbs...>

The generator has a couple of command line options that can be used to generate additional code (e.g. to enable a regulator to power on the panel). The script will gladly inform you about available options if you pass --help.

Making final edits

In most cases, the driver should work as-is, no changes required. If you would like to use it permanently, or even upstream it, here are a few things that you may want to update:

  • The compatible string in the device tree match table
  • MODULE_AUTHOR
  • MODULE_DESCRIPTION (eventually)
  • License header
  • If you have comments in your device tree source file (e.g. for the on/off command sequence), you may want to apply them to the driver to make the code a bit less magic.

Adding it to drivers/gpu/drm/panel, together with adding needed Kconfig and Makefile entries should be straightforward.

Warning

This tool is like a human: it can make mistakes. Nobody knows what will happen to your panel if you send it bad commands or turn it on incorrectly. In most cases it will just refuse to work.

However, this tool is mainly intended as a helping hand when porting new panels. You should verify that its output makes sense before using the generated driver.

Questions?

Feel free to open an issue! :)

linux-mdss-dsi-panel-driver-generator's People

Contributors

ichernev avatar konradybcio avatar mis012 avatar newbytee avatar stephan-gh avatar travmurav avatar z3ntu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.