Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/panel: samsung-s6e88a0-ams427ap24: Add brightness control

The tables for brightness to candela, aid and elvss were taken from downstream
kernel file "dsi_panel_S6E88A0_AMS427AP24_qhd_octa_video.dtsi" [1][2][3].

The gamma table gets generated in "ss_dsi_smart_dimming_S6E88A0_AMS427AP24.c" [4]
with hard-coded starting values. The function smart_dimming_init() [5] goes
through the v{*}_adjustments, generate_gray_scale and gamma_init procedure.
Instead of calculating it manually, it's easier to compile a custom downstream
kernel with SMART_DIMMING_DEBUG enabled and read out dmesg early at boot.

Selection of the values for aid and elvss are again according to downstream
file "dsi_panel_S6E88A0_AMS427AP24_qhd_octa_video.dtsi" [6][7].

The set of write commands is guided by downstream file "ss_dsi_panel_common.c" [8]
followed by "ss_dsi_panel_S6E88A0_AMS427AP24.c" [9].

The dsi mode flag MIPI_DSI_MODE_VIDEO_NO_HFP prevents screen flickering while
changing the brightness.

[1] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/drivers/video/msm/mdss/samsung/S6E88A0_AMS427AP24/dsi_panel_S6E88A0_AMS427AP24_qhd_octa_video.dtsi#L341-L397
[2] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/drivers/video/msm/mdss/samsung/S6E88A0_AMS427AP24/dsi_panel_S6E88A0_AMS427AP24_qhd_octa_video.dtsi#L214-L254
[3] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/drivers/video/msm/mdss/samsung/S6E88A0_AMS427AP24/dsi_panel_S6E88A0_AMS427AP24_qhd_octa_video.dtsi#L301-L320
[4] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/drivers/video/msm/mdss/samsung/S6E88A0_AMS427AP24/ss_dsi_smart_dimming_S6E88A0_AMS427AP24.c
[5] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/drivers/video/msm/mdss/samsung/S6E88A0_AMS427AP24/ss_dsi_smart_dimming_S6E88A0_AMS427AP24.c#L1816-L1900
[6] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/drivers/video/msm/mdss/samsung/S6E88A0_AMS427AP24/dsi_panel_S6E88A0_AMS427AP24_qhd_octa_video.dtsi#L256-L268
[7] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/drivers/video/msm/mdss/samsung/S6E88A0_AMS427AP24/dsi_panel_S6E88A0_AMS427AP24_qhd_octa_video.dtsi#L322-L334
[8] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/drivers/video/msm/mdss/samsung/ss_dsi_panel_common.c#L1389-L1517
[9] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/drivers/video/msm/mdss/samsung/S6E88A0_AMS427AP24/ss_dsi_panel_S6E88A0_AMS427AP24.c#L666-L678

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/30c154954a4e0f75d90f6ef6f393a5ba8b3ffea9.1730070570.git.jahau@rocketmail.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/30c154954a4e0f75d90f6ef6f393a5ba8b3ffea9.1730070570.git.jahau@rocketmail.com

authored by

Jakob Hauser and committed by
Neil Armstrong
5b67fdf1 d5658db2

+521 -12
+1
drivers/gpu/drm/panel/Kconfig
··· 636 636 tristate "Samsung AMS427AP24 panel with S6E88A0 controller" 637 637 depends on GPIOLIB && OF && REGULATOR 638 638 depends on DRM_MIPI_DSI 639 + depends on BACKLIGHT_CLASS_DEVICE 639 640 help 640 641 Say Y here if you want to enable support for Samsung AMS427AP24 panel 641 642 with S6E88A0 controller (found in Samsung Galaxy S4 Mini Value Edition
+520 -12
drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c
··· 4 4 * Copyright (c) 2024 Jakob Hauser <jahau@rocketmail.com> 5 5 */ 6 6 7 + #include <linux/backlight.h> 7 8 #include <linux/delay.h> 8 9 #include <linux/gpio/consumer.h> 9 10 #include <linux/module.h> ··· 17 16 #include <drm/drm_panel.h> 18 17 #include <drm/drm_probe_helper.h> 19 18 19 + #define NUM_STEPS_CANDELA 54 20 + #define NUM_STEPS_AID 39 21 + #define NUM_STEPS_ELVSS 17 22 + 23 + /* length of the payload data, thereof fixed and variable */ 24 + #define FIX_LEN_AID 4 25 + #define FIX_LEN_ELVSS 2 26 + #define FIX_LEN_GAMMA 1 27 + #define VAR_LEN_AID 2 28 + #define VAR_LEN_ELVSS 1 29 + #define VAR_LEN_GAMMA 33 30 + #define LEN_AID (FIX_LEN_AID + VAR_LEN_AID) 31 + #define LEN_ELVSS (FIX_LEN_ELVSS + VAR_LEN_ELVSS) 32 + #define LEN_GAMMA (FIX_LEN_GAMMA + VAR_LEN_GAMMA) 33 + 20 34 struct s6e88a0_ams427ap24 { 21 35 struct drm_panel panel; 36 + struct backlight_device *bl_dev; 22 37 struct mipi_dsi_device *dsi; 23 38 struct regulator_bulk_data *supplies; 24 39 struct gpio_desc *reset_gpio; ··· 51 34 return container_of(panel, struct s6e88a0_ams427ap24, panel); 52 35 } 53 36 37 + enum candela { 38 + CANDELA_10CD, /* 0 */ 39 + CANDELA_11CD, 40 + CANDELA_12CD, 41 + CANDELA_13CD, 42 + CANDELA_14CD, 43 + CANDELA_15CD, 44 + CANDELA_16CD, 45 + CANDELA_17CD, 46 + CANDELA_19CD, 47 + CANDELA_20CD, 48 + CANDELA_21CD, 49 + CANDELA_22CD, 50 + CANDELA_24CD, 51 + CANDELA_25CD, 52 + CANDELA_27CD, 53 + CANDELA_29CD, 54 + CANDELA_30CD, 55 + CANDELA_32CD, 56 + CANDELA_34CD, 57 + CANDELA_37CD, 58 + CANDELA_39CD, 59 + CANDELA_41CD, 60 + CANDELA_44CD, 61 + CANDELA_47CD, 62 + CANDELA_50CD, 63 + CANDELA_53CD, 64 + CANDELA_56CD, 65 + CANDELA_60CD, 66 + CANDELA_64CD, 67 + CANDELA_68CD, 68 + CANDELA_72CD, 69 + CANDELA_77CD, 70 + CANDELA_82CD, 71 + CANDELA_87CD, 72 + CANDELA_93CD, 73 + CANDELA_98CD, 74 + CANDELA_105CD, 75 + CANDELA_111CD, 76 + CANDELA_119CD, 77 + CANDELA_126CD, 78 + CANDELA_134CD, 79 + CANDELA_143CD, 80 + CANDELA_152CD, 81 + CANDELA_162CD, 82 + CANDELA_172CD, 83 + CANDELA_183CD, 84 + CANDELA_195CD, 85 + CANDELA_207CD, 86 + CANDELA_220CD, 87 + CANDELA_234CD, 88 + CANDELA_249CD, 89 + CANDELA_265CD, 90 + CANDELA_282CD, 91 + CANDELA_300CD, /* 53 */ 92 + }; 93 + 94 + static const int s6e88a0_ams427ap24_br_to_cd[NUM_STEPS_CANDELA] = { 95 + /* columns: brightness from, brightness till, candela */ 96 + /* 0 */ 10, /* 10CD */ 97 + /* 11 */ 11, /* 11CD */ 98 + /* 12 */ 12, /* 12CD */ 99 + /* 13 */ 13, /* 13CD */ 100 + /* 14 */ 14, /* 14CD */ 101 + /* 15 */ 15, /* 15CD */ 102 + /* 16 */ 16, /* 16CD */ 103 + /* 17 */ 17, /* 17CD */ 104 + /* 18 */ 18, /* 19CD */ 105 + /* 19 */ 19, /* 20CD */ 106 + /* 20 */ 20, /* 21CD */ 107 + /* 21 */ 21, /* 22CD */ 108 + /* 22 */ 22, /* 24CD */ 109 + /* 23 */ 23, /* 25CD */ 110 + /* 24 */ 24, /* 27CD */ 111 + /* 25 */ 25, /* 29CD */ 112 + /* 26 */ 26, /* 30CD */ 113 + /* 27 */ 27, /* 32CD */ 114 + /* 28 */ 28, /* 34CD */ 115 + /* 29 */ 29, /* 37CD */ 116 + /* 30 */ 30, /* 39CD */ 117 + /* 31 */ 32, /* 41CD */ 118 + /* 33 */ 34, /* 44CD */ 119 + /* 35 */ 36, /* 47CD */ 120 + /* 37 */ 38, /* 50CD */ 121 + /* 39 */ 40, /* 53CD */ 122 + /* 41 */ 43, /* 56CD */ 123 + /* 44 */ 46, /* 60CD */ 124 + /* 47 */ 49, /* 64CD */ 125 + /* 50 */ 52, /* 68CD */ 126 + /* 53 */ 56, /* 72CD */ 127 + /* 57 */ 59, /* 77CD */ 128 + /* 60 */ 63, /* 82CD */ 129 + /* 64 */ 67, /* 87CD */ 130 + /* 68 */ 71, /* 93CD */ 131 + /* 72 */ 76, /* 98CD */ 132 + /* 77 */ 80, /* 105CD */ 133 + /* 81 */ 86, /* 111CD */ 134 + /* 87 */ 91, /* 119CD */ 135 + /* 92 */ 97, /* 126CD */ 136 + /* 98 */ 104, /* 134CD */ 137 + /* 105 */ 110, /* 143CD */ 138 + /* 111 */ 118, /* 152CD */ 139 + /* 119 */ 125, /* 162CD */ 140 + /* 126 */ 133, /* 172CD */ 141 + /* 134 */ 142, /* 183CD */ 142 + /* 143 */ 150, /* 195CD */ 143 + /* 151 */ 160, /* 207CD */ 144 + /* 161 */ 170, /* 220CD */ 145 + /* 171 */ 181, /* 234CD */ 146 + /* 182 */ 205, /* 249CD */ 147 + /* 206 */ 234, /* 265CD */ 148 + /* 235 */ 254, /* 282CD */ 149 + /* 255 */ 255, /* 300CD */ 150 + }; 151 + 152 + static const u8 s6e88a0_ams427ap24_aid[NUM_STEPS_AID][VAR_LEN_AID] = { 153 + { 0x03, 0x77 }, /* AOR 90.9%, 10CD */ 154 + { 0x03, 0x73 }, /* AOR 90.5%, 11CD */ 155 + { 0x03, 0x69 }, /* AOR 89.4%, 12CD */ 156 + { 0x03, 0x65 }, /* AOR 89.0%, 13CD */ 157 + { 0x03, 0x61 }, /* AOR 88.6%, 14CD */ 158 + { 0x03, 0x55 }, /* AOR 87.4%, 15CD */ 159 + { 0x03, 0x50 }, /* AOR 86.9%, 16CD */ 160 + { 0x03, 0x45 }, /* AOR 85.8%, 17CD */ 161 + { 0x03, 0x35 }, /* AOR 84.1%, 19CD */ 162 + { 0x03, 0x27 }, /* AOR 82.7%, 20CD */ 163 + { 0x03, 0x23 }, /* AOR 82.3%, 21CD */ 164 + { 0x03, 0x17 }, /* AOR 81.0%, 22CD */ 165 + { 0x03, 0x11 }, /* AOR 80.4%, 24CD */ 166 + { 0x03, 0x04 }, /* AOR 79.1%, 25CD */ 167 + { 0x02, 0xf4 }, /* AOR 77.5%, 27CD */ 168 + { 0x02, 0xe3 }, /* AOR 75.7%, 29CD */ 169 + { 0x02, 0xd7 }, /* AOR 74.5%, 30CD */ 170 + { 0x02, 0xc6 }, /* AOR 72.7%, 32CD */ 171 + { 0x02, 0xb7 }, /* AOR 71.2%, 34CD */ 172 + { 0x02, 0xa1 }, /* AOR 69.0%, 37CD */ 173 + { 0x02, 0x91 }, /* AOR 67.3%, 39CD */ 174 + { 0x02, 0x78 }, /* AOR 64.8%, 41CD */ 175 + { 0x02, 0x62 }, /* AOR 62.5%, 44CD */ 176 + { 0x02, 0x45 }, /* AOR 59.5%, 47CD */ 177 + { 0x02, 0x30 }, /* AOR 57.4%, 50CD */ 178 + { 0x02, 0x13 }, /* AOR 54.4%, 53CD */ 179 + { 0x01, 0xf5 }, /* AOR 51.3%, 56CD */ 180 + { 0x01, 0xd3 }, /* AOR 47.8%, 60CD */ 181 + { 0x01, 0xb1 }, /* AOR 44.4%, 64CD */ 182 + { 0x01, 0x87 }, /* AOR 40.1%, 68CD */ 183 + { 0x01, 0x63 }, /* AOR 36.6%, 72CD */ 184 + { 0x01, 0x35 }, /* AOR 31.7%, 77CD */ 185 + { 0x01, 0x05 }, /* AOR 26.9%, 82CD */ 186 + { 0x00, 0xd5 }, /* AOR 21.8%, 87CD */ 187 + { 0x00, 0xa1 }, /* AOR 16.5%, 93CD */ 188 + { 0x00, 0x6f }, /* AOR 11.4%, 98CD */ 189 + { 0x00, 0x31 }, /* AOR 5.0%, 105CD */ 190 + { 0x01, 0x86 }, /* AOR 40.0%, 111CD ~ 172CD */ 191 + { 0x00, 0x08 }, /* AOR 0.6%, 183CD ~ 300CD */ 192 + }; 193 + 194 + static const u8 s6e88a0_ams427ap24_elvss[NUM_STEPS_ELVSS][VAR_LEN_ELVSS] = { 195 + { 0x14 }, /* 10CD ~ 111CD */ 196 + { 0x13 }, /* 119CD */ 197 + { 0x12 }, /* 126CD */ 198 + { 0x12 }, /* 134CD */ 199 + { 0x11 }, /* 143CD */ 200 + { 0x10 }, /* 152CD */ 201 + { 0x0f }, /* 162CD */ 202 + { 0x0e }, /* 172CD */ 203 + { 0x11 }, /* 183CD */ 204 + { 0x11 }, /* 195CD */ 205 + { 0x10 }, /* 207CD */ 206 + { 0x0f }, /* 220CD */ 207 + { 0x0f }, /* 234CD */ 208 + { 0x0e }, /* 249CD */ 209 + { 0x0d }, /* 265CD */ 210 + { 0x0c }, /* 282CD */ 211 + { 0x0b }, /* 300CD */ 212 + }; 213 + 214 + static const u8 s6e88a0_ams427ap24_gamma[NUM_STEPS_CANDELA][VAR_LEN_GAMMA] = { 215 + /* 10CD */ 216 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x8a, 0x8c, 0x8b, 217 + 0x8c, 0x87, 0x89, 0x89, 0x88, 0x87, 0x8c, 0x80, 0x82, 0x88, 0x7b, 218 + 0x72, 0x8c, 0x60, 0x68, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 219 + /* 11CD */ 220 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x8a, 0x8c, 0x8b, 221 + 0x8c, 0x87, 0x89, 0x89, 0x88, 0x87, 0x8c, 0x80, 0x82, 0x88, 0x7b, 222 + 0x72, 0x8c, 0x60, 0x68, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 223 + /* 12CD */ 224 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x8a, 0x8b, 0x8b, 225 + 0x8c, 0x88, 0x89, 0x8a, 0x88, 0x87, 0x8c, 0x81, 0x82, 0x87, 0x7a, 226 + 0x72, 0x8b, 0x60, 0x68, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 227 + /* 13CD */ 228 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x8a, 0x8b, 0x8b, 229 + 0x8c, 0x88, 0x89, 0x8a, 0x88, 0x87, 0x8c, 0x81, 0x82, 0x87, 0x7a, 230 + 0x72, 0x8b, 0x61, 0x69, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 231 + /* 14CD */ 232 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8c, 0x8b, 233 + 0x8c, 0x88, 0x89, 0x8a, 0x87, 0x86, 0x8a, 0x82, 0x82, 0x87, 0x79, 234 + 0x71, 0x89, 0x63, 0x6c, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 235 + /* 15CD */ 236 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x8a, 0x8c, 0x8c, 237 + 0x8c, 0x86, 0x87, 0x88, 0x85, 0x85, 0x8a, 0x83, 0x83, 0x88, 0x78, 238 + 0x72, 0x89, 0x64, 0x6c, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 239 + /* 16CD */ 240 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8c, 0x8b, 241 + 0x8c, 0x86, 0x88, 0x88, 0x86, 0x86, 0x8a, 0x84, 0x84, 0x88, 0x78, 242 + 0x72, 0x89, 0x5d, 0x67, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 243 + /* 17CD */ 244 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, 245 + 0x8b, 0x87, 0x89, 0x89, 0x86, 0x86, 0x8a, 0x84, 0x83, 0x87, 0x78, 246 + 0x73, 0x89, 0x64, 0x6e, 0x8e, 0x38, 0x32, 0x24, 0x00, 0x00, 0x00 }, 247 + /* 19CD */ 248 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, 249 + 0x8b, 0x87, 0x89, 0x89, 0x86, 0x86, 0x89, 0x84, 0x84, 0x87, 0x77, 250 + 0x72, 0x88, 0x65, 0x6f, 0x8e, 0x38, 0x32, 0x24, 0x00, 0x00, 0x00 }, 251 + /* 20CD */ 252 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, 253 + 0x8b, 0x88, 0x89, 0x89, 0x85, 0x85, 0x88, 0x82, 0x83, 0x85, 0x79, 254 + 0x73, 0x88, 0x65, 0x6f, 0x8e, 0x38, 0x32, 0x24, 0x00, 0x00, 0x00 }, 255 + /* 21CD */ 256 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, 257 + 0x8b, 0x88, 0x89, 0x89, 0x85, 0x85, 0x88, 0x82, 0x83, 0x85, 0x79, 258 + 0x74, 0x88, 0x65, 0x6f, 0x8e, 0x38, 0x32, 0x24, 0x00, 0x00, 0x00 }, 259 + /* 22CD */ 260 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8c, 0x8b, 261 + 0x8c, 0x86, 0x88, 0x87, 0x86, 0x86, 0x89, 0x82, 0x83, 0x85, 0x7c, 262 + 0x75, 0x87, 0x65, 0x6f, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 263 + /* 24CD */ 264 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8c, 0x8b, 265 + 0x8c, 0x86, 0x88, 0x87, 0x86, 0x86, 0x89, 0x82, 0x83, 0x85, 0x7c, 266 + 0x76, 0x86, 0x66, 0x6f, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 267 + /* 25CD */ 268 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, 269 + 0x8b, 0x86, 0x89, 0x88, 0x87, 0x87, 0x89, 0x82, 0x82, 0x84, 0x7f, 270 + 0x7a, 0x89, 0x6b, 0x73, 0x8f, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 271 + /* 27CD */ 272 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, 273 + 0x8b, 0x86, 0x89, 0x88, 0x87, 0x87, 0x89, 0x82, 0x82, 0x84, 0x7f, 274 + 0x7a, 0x89, 0x6b, 0x73, 0x8f, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 275 + /* 29CD */ 276 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, 277 + 0x8b, 0x86, 0x89, 0x88, 0x85, 0x84, 0x87, 0x84, 0x85, 0x86, 0x80, 278 + 0x7b, 0x88, 0x6a, 0x73, 0x8f, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 279 + /* 30CD */ 280 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, 281 + 0x8b, 0x86, 0x89, 0x88, 0x85, 0x84, 0x87, 0x84, 0x85, 0x86, 0x80, 282 + 0x7b, 0x88, 0x6a, 0x73, 0x8f, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 283 + /* 32CD */ 284 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, 285 + 0x8b, 0x86, 0x89, 0x88, 0x85, 0x84, 0x87, 0x84, 0x85, 0x86, 0x80, 286 + 0x7b, 0x88, 0x6a, 0x73, 0x8f, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 287 + /* 34CD */ 288 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, 289 + 0x8b, 0x86, 0x89, 0x88, 0x85, 0x84, 0x87, 0x83, 0x84, 0x84, 0x7f, 290 + 0x79, 0x86, 0x6c, 0x76, 0x91, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 291 + /* 37CD */ 292 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, 293 + 0x8b, 0x86, 0x88, 0x88, 0x87, 0x86, 0x87, 0x83, 0x84, 0x84, 0x7f, 294 + 0x79, 0x86, 0x6c, 0x76, 0x90, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 295 + /* 39CD */ 296 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, 297 + 0x8b, 0x86, 0x88, 0x87, 0x84, 0x84, 0x86, 0x83, 0x85, 0x85, 0x80, 298 + 0x79, 0x85, 0x6c, 0x76, 0x90, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 299 + /* 41CD */ 300 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, 301 + 0x8b, 0x86, 0x88, 0x87, 0x84, 0x84, 0x86, 0x81, 0x84, 0x83, 0x7f, 302 + 0x79, 0x84, 0x6e, 0x79, 0x93, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 303 + /* 44CD */ 304 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, 305 + 0x8b, 0x86, 0x88, 0x87, 0x84, 0x84, 0x86, 0x81, 0x84, 0x83, 0x7f, 306 + 0x79, 0x84, 0x6e, 0x79, 0x92, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 307 + /* 47CD */ 308 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, 309 + 0x8b, 0x86, 0x88, 0x87, 0x84, 0x85, 0x86, 0x81, 0x84, 0x83, 0x7f, 310 + 0x79, 0x83, 0x6f, 0x79, 0x91, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 311 + /* 50CD */ 312 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, 313 + 0x8b, 0x86, 0x88, 0x87, 0x84, 0x85, 0x86, 0x82, 0x84, 0x83, 0x7f, 314 + 0x79, 0x83, 0x6f, 0x79, 0x90, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 315 + /* 53CD */ 316 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, 317 + 0x8b, 0x86, 0x88, 0x87, 0x83, 0x83, 0x85, 0x84, 0x85, 0x85, 0x7f, 318 + 0x79, 0x83, 0x70, 0x79, 0x8f, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 319 + /* 56CD */ 320 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8a, 321 + 0x8a, 0x87, 0x89, 0x87, 0x83, 0x83, 0x85, 0x84, 0x85, 0x84, 0x7f, 322 + 0x79, 0x82, 0x70, 0x7a, 0x8e, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 323 + /* 60CD */ 324 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8a, 325 + 0x8a, 0x87, 0x89, 0x87, 0x83, 0x83, 0x85, 0x84, 0x85, 0x84, 0x7e, 326 + 0x79, 0x82, 0x71, 0x7a, 0x8d, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 327 + /* 64CD */ 328 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8a, 329 + 0x8a, 0x86, 0x88, 0x86, 0x84, 0x84, 0x86, 0x82, 0x83, 0x82, 0x80, 330 + 0x7a, 0x84, 0x71, 0x7a, 0x8c, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 331 + /* 68CD */ 332 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8c, 0x8a, 333 + 0x8a, 0x86, 0x88, 0x86, 0x84, 0x84, 0x86, 0x82, 0x84, 0x82, 0x81, 334 + 0x7b, 0x83, 0x72, 0x7b, 0x8b, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 335 + /* 72CD */ 336 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8c, 0x8a, 337 + 0x8a, 0x86, 0x88, 0x86, 0x85, 0x85, 0x86, 0x82, 0x84, 0x82, 0x81, 338 + 0x7b, 0x83, 0x72, 0x7c, 0x8a, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 339 + /* 77CD */ 340 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8c, 0x8a, 341 + 0x8a, 0x85, 0x87, 0x85, 0x85, 0x87, 0x87, 0x82, 0x84, 0x82, 0x81, 342 + 0x7c, 0x82, 0x72, 0x7c, 0x89, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 343 + /* 82CD */ 344 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8c, 0x8a, 345 + 0x8a, 0x85, 0x87, 0x85, 0x85, 0x87, 0x87, 0x82, 0x84, 0x82, 0x81, 346 + 0x7c, 0x82, 0x73, 0x7c, 0x88, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 347 + /* 87CD */ 348 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8c, 0x8a, 349 + 0x8a, 0x85, 0x87, 0x85, 0x84, 0x84, 0x86, 0x80, 0x84, 0x81, 0x80, 350 + 0x7a, 0x82, 0x76, 0x7f, 0x89, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 351 + /* 93CD */ 352 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8b, 0x8a, 353 + 0x8a, 0x86, 0x87, 0x85, 0x84, 0x85, 0x86, 0x80, 0x84, 0x80, 0x80, 354 + 0x7a, 0x82, 0x76, 0x80, 0x88, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 355 + /* 98CD */ 356 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8b, 0x8a, 357 + 0x8a, 0x86, 0x87, 0x85, 0x85, 0x85, 0x86, 0x80, 0x84, 0x80, 0x80, 358 + 0x7a, 0x82, 0x76, 0x80, 0x88, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, 359 + /* 105CD */ 360 + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x89, 0x88, 0x88, 0x8b, 0x8a, 361 + 0x8a, 0x84, 0x87, 0x85, 0x85, 0x85, 0x85, 0x80, 0x84, 0x80, 0x7f, 362 + 0x79, 0x81, 0x71, 0x7d, 0x87, 0x38, 0x32, 0x24, 0x00, 0x00, 0x00 }, 363 + /* 111CD */ 364 + { 0x00, 0xdf, 0x00, 0xde, 0x00, 0xde, 0x85, 0x85, 0x84, 0x87, 0x86, 365 + 0x87, 0x85, 0x86, 0x85, 0x83, 0x83, 0x83, 0x81, 0x82, 0x82, 0x80, 366 + 0x7d, 0x82, 0x75, 0x7f, 0x86, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 367 + /* 119CD */ 368 + { 0x00, 0xe3, 0x00, 0xe1, 0x00, 0xe2, 0x85, 0x85, 0x84, 0x86, 0x85, 369 + 0x85, 0x84, 0x85, 0x84, 0x83, 0x83, 0x83, 0x82, 0x82, 0x82, 0x7e, 370 + 0x7b, 0x81, 0x75, 0x7f, 0x86, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 371 + /* 126CD */ 372 + { 0x00, 0xe6, 0x00, 0xe5, 0x00, 0xe5, 0x85, 0x84, 0x84, 0x85, 0x85, 373 + 0x85, 0x84, 0x84, 0x84, 0x82, 0x83, 0x83, 0x80, 0x81, 0x81, 0x80, 374 + 0x7f, 0x83, 0x73, 0x7c, 0x84, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 375 + /* 134CD */ 376 + { 0x00, 0xe9, 0x00, 0xe8, 0x00, 0xe8, 0x84, 0x84, 0x83, 0x85, 0x85, 377 + 0x85, 0x84, 0x84, 0x83, 0x81, 0x82, 0x82, 0x81, 0x81, 0x81, 0x7f, 378 + 0x7d, 0x81, 0x73, 0x7c, 0x83, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 379 + /* 143CD */ 380 + { 0x00, 0xed, 0x00, 0xec, 0x00, 0xec, 0x84, 0x83, 0x83, 0x84, 0x84, 381 + 0x84, 0x84, 0x84, 0x83, 0x82, 0x83, 0x83, 0x81, 0x80, 0x81, 0x7f, 382 + 0x7e, 0x81, 0x70, 0x79, 0x81, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 383 + /* 152CD */ 384 + { 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x83, 0x83, 0x83, 0x83, 0x83, 385 + 0x83, 0x84, 0x84, 0x83, 0x81, 0x81, 0x81, 0x80, 0x80, 0x81, 0x80, 386 + 0x80, 0x82, 0x6f, 0x78, 0x7f, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 387 + /* 162CD */ 388 + { 0x00, 0xf4, 0x00, 0xf3, 0x00, 0xf4, 0x83, 0x83, 0x83, 0x83, 0x83, 389 + 0x83, 0x82, 0x81, 0x81, 0x81, 0x81, 0x81, 0x80, 0x80, 0x81, 0x80, 390 + 0x7f, 0x82, 0x6f, 0x78, 0x7f, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 391 + /* 172CD */ 392 + { 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x82, 0x82, 0x82, 0x82, 0x82, 393 + 0x82, 0x82, 0x81, 0x81, 0x80, 0x81, 0x80, 0x80, 0x80, 0x81, 0x81, 394 + 0x80, 0x83, 0x6d, 0x76, 0x7d, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 395 + /* 183CD */ 396 + { 0x00, 0xe0, 0x00, 0xdf, 0x00, 0xdf, 0x84, 0x84, 0x83, 0x86, 0x86, 397 + 0x86, 0x83, 0x84, 0x83, 0x82, 0x82, 0x82, 0x81, 0x83, 0x81, 0x81, 398 + 0x7e, 0x81, 0x80, 0x82, 0x84, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 399 + /* 195CD */ 400 + { 0x00, 0xe4, 0x00, 0xe3, 0x00, 0xe3, 0x84, 0x83, 0x83, 0x85, 0x85, 401 + 0x85, 0x83, 0x84, 0x83, 0x81, 0x82, 0x82, 0x82, 0x83, 0x81, 0x81, 402 + 0x80, 0x82, 0x7d, 0x7f, 0x81, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 403 + /* 207CD */ 404 + { 0x00, 0xe7, 0x00, 0xe6, 0x00, 0xe6, 0x83, 0x82, 0x82, 0x85, 0x85, 405 + 0x85, 0x82, 0x83, 0x83, 0x82, 0x82, 0x82, 0x80, 0x81, 0x80, 0x81, 406 + 0x80, 0x82, 0x7d, 0x7f, 0x81, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 407 + /* 220CD */ 408 + { 0x00, 0xeb, 0x00, 0xea, 0x00, 0xea, 0x83, 0x83, 0x82, 0x84, 0x84, 409 + 0x84, 0x82, 0x83, 0x82, 0x81, 0x81, 0x82, 0x81, 0x82, 0x81, 0x80, 410 + 0x7e, 0x80, 0x7d, 0x7f, 0x81, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 411 + /* 234CD */ 412 + { 0x00, 0xef, 0x00, 0xee, 0x00, 0xee, 0x83, 0x82, 0x82, 0x83, 0x83, 413 + 0x83, 0x82, 0x82, 0x82, 0x81, 0x81, 0x81, 0x80, 0x80, 0x80, 0x80, 414 + 0x80, 0x81, 0x7b, 0x7c, 0x7f, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 415 + /* 249CD */ 416 + { 0x00, 0xf3, 0x00, 0xf2, 0x00, 0xf2, 0x82, 0x81, 0x81, 0x83, 0x83, 417 + 0x83, 0x82, 0x82, 0x82, 0x81, 0x81, 0x81, 0x80, 0x81, 0x80, 0x7f, 418 + 0x7e, 0x7f, 0x7b, 0x7c, 0x7f, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 419 + /* 265CD */ 420 + { 0x00, 0xf7, 0x00, 0xf7, 0x00, 0xf7, 0x81, 0x81, 0x80, 0x82, 0x82, 421 + 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x81, 0x80, 0x7f, 422 + 0x7e, 0x7f, 0x7b, 0x7c, 0x7f, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 423 + /* 282CD */ 424 + { 0x00, 0xfb, 0x00, 0xfb, 0x00, 0xfb, 0x80, 0x80, 0x80, 0x81, 0x81, 425 + 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x7f, 0x7f, 0x7f, 0x7f, 426 + 0x7f, 0x7f, 0x78, 0x79, 0x7d, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, 427 + /* 300CD */ 428 + { 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 429 + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 430 + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00 }, 431 + }; 432 + 433 + static int s6e88a0_ams427ap24_set_brightness(struct backlight_device *bd) 434 + { 435 + struct s6e88a0_ams427ap24 *ctx = bl_get_data(bd); 436 + struct mipi_dsi_device *dsi = ctx->dsi; 437 + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; 438 + struct device *dev = &dsi->dev; 439 + int brightness = bd->props.brightness; 440 + int candela_enum; 441 + u8 b2[LEN_AID] = { 0xb2, 0x40, 0x08, 0x20, 0x00, 0x00 }; 442 + u8 b6[LEN_ELVSS] = { 0xb6, 0x28, 0x00 }; 443 + u8 ca[LEN_GAMMA]; 444 + 445 + /* get candela enum from brightness */ 446 + for (candela_enum = 0; candela_enum < NUM_STEPS_CANDELA; candela_enum++) 447 + if (brightness <= s6e88a0_ams427ap24_br_to_cd[candela_enum]) 448 + break; 449 + 450 + /* get aid */ 451 + switch (candela_enum) { 452 + case CANDELA_10CD ... CANDELA_105CD: 453 + memcpy(&b2[FIX_LEN_AID], 454 + s6e88a0_ams427ap24_aid[candela_enum], 455 + VAR_LEN_AID); 456 + break; 457 + case CANDELA_111CD ... CANDELA_172CD: 458 + memcpy(&b2[FIX_LEN_AID], 459 + s6e88a0_ams427ap24_aid[CANDELA_111CD], 460 + VAR_LEN_AID); 461 + break; 462 + case CANDELA_183CD ... CANDELA_300CD: 463 + memcpy(&b2[FIX_LEN_AID], 464 + s6e88a0_ams427ap24_aid[CANDELA_111CD + 1], 465 + VAR_LEN_AID); 466 + break; 467 + default: 468 + dev_err(dev, "Failed to get aid data\n"); 469 + return -EINVAL; 470 + } 471 + 472 + /* get elvss */ 473 + if (candela_enum <= CANDELA_111CD) { 474 + memcpy(&b6[FIX_LEN_ELVSS], 475 + s6e88a0_ams427ap24_elvss[0], 476 + VAR_LEN_ELVSS); 477 + } else { 478 + memcpy(&b6[FIX_LEN_ELVSS], 479 + s6e88a0_ams427ap24_elvss[candela_enum - CANDELA_111CD], 480 + VAR_LEN_ELVSS); 481 + } 482 + 483 + /* get gamma */ 484 + ca[0] = 0xca; 485 + memcpy(&ca[FIX_LEN_GAMMA], 486 + s6e88a0_ams427ap24_gamma[candela_enum], 487 + VAR_LEN_GAMMA); 488 + 489 + /* write data */ 490 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0x5a, 0x5a); // level 1 key on 491 + mipi_dsi_dcs_write_buffer_multi(&dsi_ctx, b2, ARRAY_SIZE(b2)); // set aid 492 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x55, 0x00); // acl off 493 + mipi_dsi_dcs_write_buffer_multi(&dsi_ctx, b6, ARRAY_SIZE(b6)); // set elvss 494 + mipi_dsi_dcs_write_buffer_multi(&dsi_ctx, ca, ARRAY_SIZE(ca)); // set gamma 495 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf7, 0x03); // gamma update 496 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0xa5, 0xa5); // level 1 key off 497 + 498 + return dsi_ctx.accum_err; 499 + } 500 + 54 501 static void s6e88a0_ams427ap24_reset(struct s6e88a0_ams427ap24 *ctx) 55 502 { 56 503 gpiod_set_value_cansleep(ctx->reset_gpio, 0); ··· 529 48 { 530 49 struct mipi_dsi_device *dsi = ctx->dsi; 531 50 struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; 51 + struct device *dev = &dsi->dev; 52 + int ret; 532 53 533 54 dsi->mode_flags |= MIPI_DSI_MODE_LPM; 534 55 ··· 550 67 mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xcc, 0x4c); // pixel clock divider pol. 551 68 mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf2, 0x03, 0x0d); // unknown 552 69 mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf1, 0xa5, 0xa5); // level 3 key off 553 - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xca, 554 - 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x80, 555 - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 556 - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 557 - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 558 - 0x80, 0x80, 0x00, 0x00, 0x00); // set gamma 559 - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb2, 560 - 0x40, 0x08, 0x20, 0x00, 0x08); // set aid 561 - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb6, 0x28, 0x0b); // set elvss 562 - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf7, 0x03); // gamma update 563 - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x55, 0x00); // acl off 564 70 mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0xa5, 0xa5); // level 1 key off 565 71 mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xfc, 0xa5, 0xa5); // level 2 key off 72 + 73 + ret = s6e88a0_ams427ap24_set_brightness(ctx->bl_dev); 74 + if (ret < 0) { 75 + dev_err(dev, "Failed to set brightness: %d\n", ret); 76 + return ret; 77 + } 566 78 567 79 mipi_dsi_dcs_set_display_on_multi(&dsi_ctx); 568 80 ··· 650 172 .get_modes = s6e88a0_ams427ap24_get_modes, 651 173 }; 652 174 175 + static const struct backlight_ops s6e88a0_ams427ap24_bl_ops = { 176 + .update_status = s6e88a0_ams427ap24_set_brightness, 177 + }; 178 + 179 + static int s6e88a0_ams427ap24_register_backlight(struct s6e88a0_ams427ap24 *ctx) 180 + { 181 + struct backlight_properties props = { 182 + .type = BACKLIGHT_RAW, 183 + .brightness = 180, 184 + .max_brightness = 255, 185 + }; 186 + struct mipi_dsi_device *dsi = ctx->dsi; 187 + struct device *dev = &dsi->dev; 188 + int ret = 0; 189 + 190 + ctx->bl_dev = devm_backlight_device_register(dev, dev_name(dev), dev, ctx, 191 + &s6e88a0_ams427ap24_bl_ops, 192 + &props); 193 + if (IS_ERR(ctx->bl_dev)) { 194 + ret = PTR_ERR(ctx->bl_dev); 195 + dev_err(dev, "error registering backlight device (%d)\n", ret); 196 + } 197 + 198 + return ret; 199 + } 200 + 653 201 static int s6e88a0_ams427ap24_probe(struct mipi_dsi_device *dsi) 654 202 { 655 203 struct device *dev = &dsi->dev; ··· 704 200 dsi->lanes = 2; 705 201 dsi->format = MIPI_DSI_FMT_RGB888; 706 202 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | 707 - MIPI_DSI_MODE_NO_EOT_PACKET; 203 + MIPI_DSI_MODE_NO_EOT_PACKET | MIPI_DSI_MODE_VIDEO_NO_HFP; 708 204 709 205 drm_panel_init(&ctx->panel, dev, &s6e88a0_ams427ap24_panel_funcs, 710 206 DRM_MODE_CONNECTOR_DSI); 711 207 ctx->panel.prepare_prev_first = true; 208 + 209 + ret = s6e88a0_ams427ap24_register_backlight(ctx); 210 + if (ret < 0) 211 + return ret; 712 212 713 213 drm_panel_add(&ctx->panel); 714 214