Using a custom (portable) dtb file
Note: I know you mention instead of the "default-brightness-level",
but if a dtb file is made, then this can be used to save the
configuration that is saved outside of the kernel (i.e. could be
swapped out with a different file without rebuilding the kernel).
If you have access to the dtsi file that the Kernel was built with then you can modify the value under the appropriate section in there. This file should be in the arch/arm/boot/dts
directory for the kernel source.
At the same level as the compatible = "pwm-backlight"
, there is also a default-brightness-level
parameter. Change this value to a value of your liking (it corresponds to the index of the brightness-levels
array. For example:
backlight_lvds {
compatible = "pwm-backlight";
pwms = <&pwm4 0 500000>;
brightness-levels = <100 75 60 50 40 30 20 10 5 0>;
/* Default brightness level (index into the array defined by the "brightness-levels" property) */
default-brightness-level = <5>;
status = "okay";
};
You can then compile the dtsi into a dtb file that is included on your boot partition. Compile using the make dtbs
command. Something like:
cd ~/MyOS/kernel_imx
export CROSS_COMPILE=`pwd`/../prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
make myboard_defconfig
make dtbs
The output dtb file is then referenced in your bootloader script. As an example, for UBoot, it's:
setenv dtbname myCustom.dtb
myCustom.dtb
is the output of the make dtbs
command.
Couple things: 1) linux version 3.10.17 is the kernel version NOT the distro this will be used on --which makes a big difference for your question 2) you would have to either a) set the default-brightness-level to what you desired this 'on-boot' value to be OR b) create / define another level as a variable and use that as your compiled variable for the driver. – linuxdev2013 – 2016-07-06T22:17:44.607