Skip to content

Mainline patch How‐to

Inochi Amaoto edited this page Sep 10, 2024 · 6 revisions

TL;DR

It is not permitted to submit vendor code directly.

In addition to keeping the rule of the upstream project (Linux, SBI, U-boot and others), it is necessary to keep the code and design generic.

If you want to abandon your patch (only related to Sophgo), please email inochi. I will take care of the rest.

Introduction

This howto mainly focus on how to avoid some problem when first submitting a contribution to the open source community. I will take the mainline Linux as an example to show how to design the driver and others.

Binding and DTS

The most important thing of driver design is the binding, which is why you will receive lots of suggestions on your binding.

Compatible

Before writing your binding, you should identify what your driver is specific for. It is common to use widest ip compatible to represent the whole series, let us take the USB phy ip as compatiable. The whole CV1800 series use the same USB phy ip, so it is better to use the sophgo,cv1800b-usb as generic solution since the cv1800b is minimum one.

Other Properties

It will be good to keep a clean and generic design. There is a guide from kernel for you to check your bindings: https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html

Drivers

Before you cook your driver, you should check other driver in the same subsystem to know the standard of the code.

After knowing the standard, you can do your work. There are no explicit restrictions for your to implement the driver, but there are two thing you may take care: 1. keep your driver generic 2. don’t be shy to use userspace interface (sysfs, debugfs, module parameter)

At last, it is necessary for you to test your code on all the affected platform. And it is also important to tell the maintainers that the result of your patch if you have (For example, sensor values, reference setup guide, test log).

Miscellaneous

Document

If possible, please attach a document link when you submit your patches.

Maintenance

Please keep maintaining your patch until it is accepted (or dropped). If you do not have time (only patch related to Sophgo), you could contact me. I will take care of the abandoned patch.