Introduction:
A short introduction about me:
Hey! I'm Anushka. I'm a UG college student, majoring in Information Technology, from India. I absolutely love learning about how systems work under the hood, and becoming a kernel developer is a dream of mine.
This year, I am applying to GSoC, specifically the Project under Device Tree Bindings, which involves converting Device Tree Bindings to DT Schema.
Note: This is not a tutorial, just my own devjournal documenting my learning process.
For the a patch for the task of converting a DT binding to a DT Schema, I looked through many drivers, and first, I had chosen Multi-Inno MI0283QT display panel
However, I found out that this device relied on a lot of complex properties that will probably depend on other files...
So, I decided to temporarily put it aside, and work on a simple file to get the hang of what should be done, and then come back to the bigger file, and work on it.
After looking through all the DT binding files, I decided to settle with this simple DT Bindings file
OLPC XO-1 RTC
OLPC XO-1 RTC
~~~~~~~~~~~~~
Required properties:
- compatible : "olpc,xo1-rtc"
Understanding the Hardware:
RTC - Real Time Clock
A RTC is an electronic device that measures and tracks time, often in hours, minutes, and seconds. Unlike regular clocks, an RTC is specifically designed to operate within computing systems, even when the device is turned off or disconnected from power. Its primary function is to provide accurate time and date, which is crucial for various applications such as event logging, timestamping, and time-sensitive operations in computing and embedded systems. 1
OLPC = One Laptop Per Child
The OLPC XO (colloquially known as $100 Laptop,Children's Machineis a low cost laptop computer intended to be distributed to children in developing countries around the world,to provide them with access to knowledge, and opportunities to "explore, experiment and express themselves" (constructionist learning).2
So, OLPC XO-1 RTC is basically an RTC that was developed specially for OLPC XO laptops.
Making a patch
I had already analyzed a patch while understanding Device Trees.
I also referred to the example-schema.yaml found in Documentation/devicetree/bindings
And I started working on my DT Schema patch, it was quite simple and didn't require much time
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: [http://devicetree.org/schemas/rtc/olpc-xo1-rtc.yaml](http://devicetree.org/schemas/rtc/olpc-xo1-rtc.yaml)#
$schema: [http://devicetree.org/meta-schemas/core.yaml](http://devicetree.org/meta-schemas/core.yaml)#
title: OLPC XO-1 RTC
maintainers:
- Alexandre Belloni <alexandre.belloni@bootlin.com>
properties:
compatible:
enum:
- olpc,xo1-rtc
required:
- compatible
additionalProperties: false
examples:
- |
rtc {
compatible = "olpc,xo1-rtc";
};
link: https://lore.kernel.org/linux-devicetree/20260325084708.40629-1-anushkabadhe@gmail.com/
I checked if this works and it does!
anu@laptop:~/kernel-dev/source/linux$ make clean && make -j8 \
dt_binding_check \
DT_SCHEMA_FILES=Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.yaml
CLEAN Documentation/devicetree/bindings
HOSTCC scripts/basic/fixdep
HOSTCC scripts/dtc/dtc.o
HOSTCC scripts/dtc/flattree.o
HOSTCC scripts/dtc/fstree.o
HOSTCC scripts/dtc/data.o
HOSTCC scripts/dtc/livetree.o
HOSTCC scripts/dtc/treesource.o
HOSTCC scripts/dtc/srcpos.o
HOSTCC scripts/dtc/checks.o
HOSTCC scripts/dtc/util.o
SCHEMA Documentation/devicetree/bindings/processed-schema.json
LEX scripts/dtc/dtc-lexer.lex.c
YACC scripts/dtc/dtc-parser.tab.[ch]
HOSTCC scripts/dtc/dtc-lexer.lex.o
HOSTCC scripts/dtc/dtc-parser.tab.o
HOSTLD scripts/dtc/dtc
CHKDT ./Documentation/devicetree/bindings
LINT ./Documentation/devicetree/bindings
DTEX Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.example.dts
DTC [C] Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.example.dtb
I validated DTB against my schema
Reply
I got a reply from the maintainer, Alexandre Belloni!
He told me that this should be moved in trivial-rtc
What is trivial-rtc?
trivial-rtc.yaml is a file where minimal or generic RTC devices' schema are written. These devices are very simple and have generic properties, so instead of creating a separate DT Schema file, they are added to a common file called trivial-rtc.yaml
Thus, I added my device to the file,
index a2891ceb6344..000000000000
--- a/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-OLPC XO-1 RTC
-~~~~~~~~~~~~~
-
-Required properties:
- - compatible : "olpc,xo1-rtc"
[diff](https://lore.kernel.org/linux-devicetree/20260325093003.44051-1-anushkabadhe@gmail.com/#iZ31Documentation:devicetree:bindings:rtc:trivial-rtc.yaml) --git a/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml b/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
index b47822370d6f..722176c831aa 100644
--- a/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
+++ b/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
@@ -65,6 +65,8 @@ properties:
- microcrystal,rv3029
# Real Time Clock
- microcrystal,rv8523
+ # OLPC XO-1 RTC
+ - olpc,xo1-rtc
# I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
- ricoh,r2025sd
# I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
--
I checked if the schema is valid and it is!
anu@laptop:~/kernel-dev/source/linux$ make -j4 dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
SCHEMA Documentation/devicetree/bindings/processed-schema.json
CHKDT ./Documentation/devicetree/bindings
LINT ./Documentation/devicetree/bindings
I went ahead submitted my patch
https://lore.kernel.org/linux-devicetree/20260325093003.44051-1-anushkabadhe@gmail.com/
[25-03-26 23:19:39] HOLY SHIT!!!!!!!!
MY PATCH GOT ACKED!!!!!!!!!!!!!!!
OMGGGGGG!!!!
I AM LITERALLY SCREAMING IN THE MIDDLE OF THE NIGHT!!
I HAVE NEVER FELT SO HAPPY!!!
I AM SO EXCITED THAT I AM JUMPING!
YAY!
I also got a piece of advice by the maintainer who accepted my patch, Conor Dooley:
I had been sending patches of the next version in response to the original patches, inside the same thread,
and that isn't how it's done
I should create a different thread in order to send new patches.
Thank you so much Conor! I'll definitely remember that for my future patches.
Right now, as I write, I am still so excited, my fingers are trembling, lol
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
;lkdsjgsoegnhgkesjrgnhbseikgujhiu sfkjslfkjaf
End note:
This was my first patch, and making it was a truly enjoyable process, I can't wait to start working on another patch again!
Although I am a currently beginner, I am learning through my mistakes, that I document on these post series. Someday, I won't be a beginner and a seasoned contributer. I really look forward to it.
I will definitely continue contributing to the kernel and open source!
References
Top comments (0)