From nobody Wed Nov 27 10:28:57 2024 Received: from sonic308-18.consmr.mail.ir2.yahoo.com (sonic308-18.consmr.mail.ir2.yahoo.com [77.238.178.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 885581F8EF3 for ; Thu, 10 Oct 2024 18:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=77.238.178.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728585736; cv=none; b=bX1RbVtSStR9LO4STdtR2d8qlv4Fqvbcyewf1VIRPx1kR0zCpAkf/jKzh9SQioortROmO2BvHtIS0lL1+pvISEBvXQsKgC+MlshNWcusynluNKCapJ+5afhwuWjlOJj+aZ2OiElFE6EKHioUQ5mGP0PqgnlD5A8JUDy44s4RdTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728585736; c=relaxed/simple; bh=UnoeRwGbOEKXKDDyQckzF/imzIjtgx7OoVoFxPWxcOA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=SxfwSst8bDzxd3DTnX6WtHlcBfHjuqEvDSm8k8vddRnQHr6IG5wKKYS/EMAVfa6P3FkNf0QclYKfdpYkSP6/k2wRHFoYh74yMfOXpkmYHwujhmPNGDzoMmpisynjLt1SWzaLR05DVChNuuU5B+GlHrlIciEQ2qE1RkT+vqU3vHQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=rocketmail.com; spf=pass smtp.mailfrom=rocketmail.com; dkim=pass (2048-bit key) header.d=rocketmail.com header.i=@rocketmail.com header.b=KQ2vGE4A; arc=none smtp.client-ip=77.238.178.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=rocketmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rocketmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rocketmail.com header.i=@rocketmail.com header.b="KQ2vGE4A" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1728585732; bh=m9i6Z5AERl4/493Io6bNWVt9w79On7lBm53Y8vDCTs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=KQ2vGE4ADjJwr2YXlQ7gmZSpgHpUlhZba94V6Ap1lhCVlecmNwd6l92+M5t0XwUEC06j2enCirfBXn+G+Wn5CS/cdH+I3tE1Eqo4Qug2tCAyNyM80dcWjs/Lp9HYJRt106hsW33ky8N1siTiAYKgbjDcnFgHDPMTd0OWafnT1QGoerrvY+4uxF/gRibfKuofv/1xf0uOi7CBP0VR9tuV9/FnWXYYmjXust/ymS0J3FU/z2xZpoNPnbUoHTredP+fzS2sVpAR4JUdUIX+/v85+BatSGwjNVUZxU2J6IA4SqoFvxzK1fDFf9Q8KpxvmJXMfMCbZf1p61z4WrJ0qMFkJQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1728585732; bh=9dM/7ruFe0prmciomtX3QY2DYSbSgupC6IKacdSaGZb=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=QWV/sxvBzPG8JO5G5OpdJEbFWre8Ba6wnDTMpXwoUDZvIDLGHbSJhfB2PPYoB1Bw+D9lra0f+3Pmg7zS2SgsMFPjjb33zRD28SZdfwb8fXsyJIONCIYpA/v3wPzDyR4rLnfgdyfH9ojj3h83rY03NGBky3XUZvkLxte9QGjVLpGWaRH4CIzfm8DL8FlYoQPkRhhIMOEgFkbUoYWdH+xn05YajeHygGInOV/Y7faUly/sC6jWcHc00IW9T6vZQSdQJchfZm++LQYW5fbtJDhSS46Yc0f6q9IBEwgmncL+W35VPH3DAs75VOyhpJ6IncNrfNFmUw9OIblCQspJ+jH8rQ== X-YMail-OSG: d8kZyhcVM1m7.0Ywmlel8iyc9pSeRZX6XTYlv8b1yKw4cAIpWH01ZfGLT.O0kEs UjQpE2xi8Ga.F2m355nXblP_sK1GMV.kCaOJlub3oLdxKsb9jOu3gtRwXTzn71h9FFAdk7AEyvt5 ssrj5jxZHe02oOj5BxWPVk3MjVfY0qtXzMQ95sL3OUgrAcdUgKbH6dJ2W1HwGf6pIHKeXzZ4TJLf 1Ta6z5fiN8P2Eq7YkWWrpVlgXYw7Piw_Gq18wkgqa2CPy4mjF6nDv4gKyJgm.BJcDk7Ub3G6rDrD 4E8TY1fgAjo6mHlRwkMQ018tEygxZhdCa47S8k3PZMvcteCo5GEOtqN3j8a1DsLAwb9tUyzOmTnn VTBsF.oyB1XJ67.p9f8nti6hmzxVq0mBdAVpq4N3iQUbk959wfk6vpS5YecgOkpywltm9czjhGxh Kj3AD.ls8_aip2dU4VEzgkDo8ViAx.WnGQe6C8xVgVI.XoaUb4jUoRD0d1aNP7sKjvnzFIFKgbIg Xi.6__e._hgaLL7GHdYuMjxrMdpnXjoERcFLFP2gCaoH_ZLQWmsDGYL1CB0Tfs2dbWS4S18GeHu. Qt6NbBjUIdW.AggQrSldyDVQ2ykm.LwIQVLQZUkbflJE3EifwntgkOfm9QhIUNfj3bY33LLRjWGz JTHsiWcgNux6shRa7zDnIh4FTOENXsDqX_MvReXHfHcqPt8IboYrPGvc16YXb1Xa_DJ5NoFI3byN ZK7pfMj4GiITAIGuweh3E3eI6vysh0bisihFprJdU8X1AcJbwd1223A.WDl9Ud4hJki1CFtT_nya b3XJduge6gZ26FZ19uB.N4tk0zQVRxM7_kbZPvbWci1St3TmutaHuOGLRSntTfZgQToP1Xd8ODC7 L9u03V8GcY_eXHr7uTcnbS1JXhUoKuHZdBc9EVGPgx.n9HPfNwAvU5172tG5gfGZdyrF6eBZR.Fe mPWpEIVc4PA85JH1TuwwRSIcwOTq2QQyt8yMh1bIr4DCcnuweo58awmVqq_1cwDnrTEMarkl12Aa 90roLO3ngpy2OG9FB4NI9Ehls78hIi5_XfM.QRXNqCuzJP4H0QVZnjel0veV204SLsk7IA4syxtJ nJ1Wx8D.oCjp85TYo5XkUTxxE1b37gUEexLaaaOdu_WelH5j.WHAUG8yeY4.Zf25xCW5l4Xx_rgQ zButqAoHTXnaUgpzl52XaTpvlpdDwxyChi_MYYB_DaIkODAWAW2qCJOWoFWmtZ_xhlQZDBHELG87 YL_26aibUJWytAp.bRYM2Adhr.jUOsIPJfee0Gu9pyoEoG4l1_Dboy2IYZ.rIdjGrxr7GsvqA8Il P1920w.f8zY2njBk40pTbShi3.COrCQQW8OZqAqDO5CZADazA8uQRAA7rcs0iqsXAbEQqWhmjA6u JuoLJpL1_68pGhnMx.k2uzus.K.uWgvJI1wH0UPip0F0vxnaYiKGX8k3ng9lG_vzLg0vVNy6jPAE beHM8WEDZqvHj2XQrWm86I66q4fHb5zg2lu9lXtw9TiDqKRaxw.hoy4Wgh7r7yHrcR8pa.R9Ihlr AGN_3nXiqP.i4Td4ebl7GxT2lwzMOGiOvZvk3nYs3Sp0czBm.umqyRRHe.aZawYWhkT0Mh47Xmk_ Oh7y71Jh57bbKcnLtnlPLFCAMXnKHsy4QNwH7T5YZEEjRQyvT7raWVDLx1P6mnj8RtZ384Ofz2Q3 dtpi63fXYiBnoJJLEpey24Yuc05nOCj7UEgHxwN05cgRm66SHS4JTDgewJY4cV3JXJGHnS3oDOvO tQwOyDWLpyEGLP1vzUBQFmIvwmx.AUdO0FBk4ZxVtNlevIrwmAVfdNdRNm6lamWlq2696ptK1aYt jiM9Vi8duUlmLopsr5yq3TGGdAYU6NHOMeVSas8pvFclSJkFQPCNSQHtH.BZmYyS7itQo4cPNOTv S1JMZwonyfXm5b7Q7CGwndpkNEX.FfXLGwoEXhtDKDGaLSJChSs4HHAoPWHA57XQO9ANe7kr8KPO f9D0PSJoFBdeMTMDiFvZizvZ3_qy4R0gMVsuAtg3tLtSJ7g0X7yWPSu.KWc7Amtyx3cuZh1XDU3C wwGZAEH_bAJ8heJhhb.WXBOG70aAp2UHT6IIqY4DsBdGzFkmQswpwFrkvqZFhcyBpzKofvyYhgjC pmWzbRsFxs3cprBQ7n5HEPoF1LBdBbqmeaTHXCNyqTB4gV.zkEhv9kkS9Z3N6P5bP6ucJ_2FTBRN PTgq7v54EL96GObjpCuPWxnldVdhTYBGBCMXP4FgR5BUx5JHYi7xhxXdzCK77CnnCOzrmcVycHvU 5utSZi3S3pgSg0vuxCQr2Fu65ICF.8B6sDRvznAE.LRYHCV69GWKpW5Aw.g-- X-Sonic-MF: X-Sonic-ID: 97ba1a09-d70a-4ab3-af35-e9b764eefcb2 Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.ir2.yahoo.com with HTTP; Thu, 10 Oct 2024 18:42:12 +0000 Received: by hermes--production-ir2-6664f499fc-97g4x (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 7a7b462d09211a1a6528a42ebeb90f61; Thu, 10 Oct 2024 18:31:59 +0000 (UTC) From: Jakob Hauser To: Neil Armstrong , Jessica Zhang , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Jakob Hauser Subject: [PATCH 3/4] drm/panel: samsung-s6e88a0-ams427ap24: Add brightness control Date: Thu, 10 Oct 2024 20:31:50 +0200 Message-Id: X-Mailer: git-send-email 2.39.5 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The tables for brightness to candela, aid and elvss were taken from downstr= eam 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 downstr= eam 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 whi= le changing the brightness. [1] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/dri= vers/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/dri= vers/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/dri= vers/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/dri= vers/video/msm/mdss/samsung/S6E88A0_AMS427AP24/ss_dsi_smart_dimming_S6E88A0= _AMS427AP24.c [5] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/dri= vers/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/dri= vers/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/dri= vers/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/dri= vers/video/msm/mdss/samsung/ss_dsi_panel_common.c#L1389-L1517 [9] https://github.com/msm8916-mainline/linux-downstream/blob/GT-I9195I/dri= vers/video/msm/mdss/samsung/S6E88A0_AMS427AP24/ss_dsi_panel_S6E88A0_AMS427A= P24.c#L666-L678 Signed-off-by: Jakob Hauser --- drivers/gpu/drm/panel/Kconfig | 1 + .../panel/panel-samsung-s6e88a0-ams427ap24.c | 519 +++++++++++++++++- 2 files changed, 508 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index fa6a8c6cac5b..9b150eabc4e3 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -627,6 +627,7 @@ config DRM_PANEL_SAMSUNG_S6E88A0_AMS427AP24 tristate "Samsung AMS427AP24 panel with S6E88A0 controller" depends on GPIOLIB && OF && REGULATOR depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE help Say Y here if you want to enable support for Samsung AMS427AP24 panel with S6E88A0 controller (found in Samsung Galaxy S4 Mini Value Edition diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c b/dri= vers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c index 182ba8c347e2..657120d7dd33 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c @@ -4,6 +4,7 @@ * Copyright (c) 2024 Jakob Hauser */ =20 +#include #include #include #include @@ -17,8 +18,17 @@ #include #include =20 +#define NUM_STEPS_CANDELA 54 +#define NUM_STEPS_AID 39 +#define NUM_STEPS_ELVSS 17 + +#define SEQ_LENGTH_AID 5 +#define SEQ_LENGTH_ELVSS 2 +#define SEQ_LENGTH_GAMMA 33 + struct s6e88a0_ams427ap24 { struct drm_panel panel; + struct backlight_device *bl_dev; struct mipi_dsi_device *dsi; struct regulator_bulk_data *supplies; struct gpio_desc *reset_gpio; @@ -36,6 +46,464 @@ struct s6e88a0_ams427ap24 *to_s6e88a0_ams427ap24(struct= drm_panel *panel) return container_of(panel, struct s6e88a0_ams427ap24, panel); } =20 +enum candela { + CANDELA_10CD, /* 0 */ + CANDELA_11CD, + CANDELA_12CD, + CANDELA_13CD, + CANDELA_14CD, + CANDELA_15CD, + CANDELA_16CD, + CANDELA_17CD, + CANDELA_19CD, + CANDELA_20CD, + CANDELA_21CD, + CANDELA_22CD, + CANDELA_24CD, + CANDELA_25CD, + CANDELA_27CD, + CANDELA_29CD, + CANDELA_30CD, + CANDELA_32CD, + CANDELA_34CD, + CANDELA_37CD, + CANDELA_39CD, + CANDELA_41CD, + CANDELA_44CD, + CANDELA_47CD, + CANDELA_50CD, + CANDELA_53CD, + CANDELA_56CD, + CANDELA_60CD, + CANDELA_64CD, + CANDELA_68CD, + CANDELA_72CD, + CANDELA_77CD, + CANDELA_82CD, + CANDELA_87CD, + CANDELA_93CD, + CANDELA_98CD, + CANDELA_105CD, + CANDELA_111CD, + CANDELA_119CD, + CANDELA_126CD, + CANDELA_134CD, + CANDELA_143CD, + CANDELA_152CD, + CANDELA_162CD, + CANDELA_172CD, + CANDELA_183CD, + CANDELA_195CD, + CANDELA_207CD, + CANDELA_220CD, + CANDELA_234CD, + CANDELA_249CD, + CANDELA_265CD, + CANDELA_282CD, + CANDELA_300CD, /* 53 */ +}; + +static const int s6e88a0_ams427ap24_br_to_cd[NUM_STEPS_CANDELA] =3D { + /* brightness till, candela */ + 10, /* 10CD */ + 11, /* 11CD */ + 12, /* 12CD */ + 13, /* 13CD */ + 14, /* 14CD */ + 15, /* 15CD */ + 16, /* 16CD */ + 17, /* 17CD */ + 18, /* 19CD */ + 19, /* 20CD */ + 20, /* 21CD */ + 21, /* 22CD */ + 22, /* 24CD */ + 23, /* 25CD */ + 24, /* 27CD */ + 25, /* 29CD */ + 26, /* 30CD */ + 27, /* 32CD */ + 28, /* 34CD */ + 29, /* 37CD */ + 30, /* 39CD */ + 32, /* 41CD */ + 34, /* 44CD */ + 36, /* 47CD */ + 38, /* 50CD */ + 40, /* 53CD */ + 43, /* 56CD */ + 46, /* 60CD */ + 49, /* 64CD */ + 52, /* 68CD */ + 56, /* 72CD */ + 59, /* 77CD */ + 63, /* 82CD */ + 67, /* 87CD */ + 71, /* 93CD */ + 76, /* 98CD */ + 80, /* 105CD */ + 86, /* 111CD */ + 91, /* 119CD */ + 97, /* 126CD */ + 104, /* 134CD */ + 110, /* 143CD */ + 118, /* 152CD */ + 125, /* 162CD */ + 133, /* 172CD */ + 142, /* 183CD */ + 150, /* 195CD */ + 160, /* 207CD */ + 170, /* 220CD */ + 181, /* 234CD */ + 205, /* 249CD */ + 234, /* 265CD */ + 254, /* 282CD */ + 255, /* 300CD */ +}; + +static const u8 s6e88a0_ams427ap24_aid[NUM_STEPS_AID][SEQ_LENGTH_AID] =3D { + { 0x40, 0x08, 0x20, 0x03, 0x77 }, /* AOR 90.9%, 10CD */ + { 0x40, 0x08, 0x20, 0x03, 0x73 }, /* AOR 90.5%, 11CD */ + { 0x40, 0x08, 0x20, 0x03, 0x69 }, /* AOR 89.4%, 12CD */ + { 0x40, 0x08, 0x20, 0x03, 0x65 }, /* AOR 89.0%, 13CD */ + { 0x40, 0x08, 0x20, 0x03, 0x61 }, /* AOR 88.6%, 14CD */ + { 0x40, 0x08, 0x20, 0x03, 0x55 }, /* AOR 87.4%, 15CD */ + { 0x40, 0x08, 0x20, 0x03, 0x50 }, /* AOR 86.9%, 16CD */ + { 0x40, 0x08, 0x20, 0x03, 0x45 }, /* AOR 85.8%, 17CD */ + { 0x40, 0x08, 0x20, 0x03, 0x35 }, /* AOR 84.1%, 19CD */ + { 0x40, 0x08, 0x20, 0x03, 0x27 }, /* AOR 82.7%, 20CD */ + { 0x40, 0x08, 0x20, 0x03, 0x23 }, /* AOR 82.3%, 21CD */ + { 0x40, 0x08, 0x20, 0x03, 0x17 }, /* AOR 81.0%, 22CD */ + { 0x40, 0x08, 0x20, 0x03, 0x11 }, /* AOR 80.4%, 24CD */ + { 0x40, 0x08, 0x20, 0x03, 0x04 }, /* AOR 79.1%, 25CD */ + { 0x40, 0x08, 0x20, 0x02, 0xf4 }, /* AOR 77.5%, 27CD */ + { 0x40, 0x08, 0x20, 0x02, 0xe3 }, /* AOR 75.7%, 29CD */ + { 0x40, 0x08, 0x20, 0x02, 0xd7 }, /* AOR 74.5%, 30CD */ + { 0x40, 0x08, 0x20, 0x02, 0xc6 }, /* AOR 72.7%, 32CD */ + { 0x40, 0x08, 0x20, 0x02, 0xb7 }, /* AOR 71.2%, 34CD */ + { 0x40, 0x08, 0x20, 0x02, 0xa1 }, /* AOR 69.0%, 37CD */ + { 0x40, 0x08, 0x20, 0x02, 0x91 }, /* AOR 67.3%, 39CD */ + { 0x40, 0x08, 0x20, 0x02, 0x78 }, /* AOR 64.8%, 41CD */ + { 0x40, 0x08, 0x20, 0x02, 0x62 }, /* AOR 62.5%, 44CD */ + { 0x40, 0x08, 0x20, 0x02, 0x45 }, /* AOR 59.5%, 47CD */ + { 0x40, 0x08, 0x20, 0x02, 0x30 }, /* AOR 57.4%, 50CD */ + { 0x40, 0x08, 0x20, 0x02, 0x13 }, /* AOR 54.4%, 53CD */ + { 0x40, 0x08, 0x20, 0x01, 0xf5 }, /* AOR 51.3%, 56CD */ + { 0x40, 0x08, 0x20, 0x01, 0xd3 }, /* AOR 47.8%, 60CD */ + { 0x40, 0x08, 0x20, 0x01, 0xb1 }, /* AOR 44.4%, 64CD */ + { 0x40, 0x08, 0x20, 0x01, 0x87 }, /* AOR 40.1%, 68CD */ + { 0x40, 0x08, 0x20, 0x01, 0x63 }, /* AOR 36.6%, 72CD */ + { 0x40, 0x08, 0x20, 0x01, 0x35 }, /* AOR 31.7%, 77CD */ + { 0x40, 0x08, 0x20, 0x01, 0x05 }, /* AOR 26.9%, 82CD */ + { 0x40, 0x08, 0x20, 0x00, 0xd5 }, /* AOR 21.8%, 87CD */ + { 0x40, 0x08, 0x20, 0x00, 0xa1 }, /* AOR 16.5%, 93CD */ + { 0x40, 0x08, 0x20, 0x00, 0x6f }, /* AOR 11.4%, 98CD */ + { 0x40, 0x08, 0x20, 0x00, 0x31 }, /* AOR 5.0%, 105CD */ + { 0x40, 0x08, 0x20, 0x01, 0x86 }, /* AOR 40,00=C2=A0%, 111CD ~ 172CD */ + { 0x40, 0x08, 0x20, 0x00, 0x08 }, /* AOR 0.6%, 183CD ~ 300CD */ +}; + +static const u8 s6e88a0_ams427ap24_elvss[NUM_STEPS_ELVSS][SEQ_LENGTH_ELVSS= ] =3D { + { 0x28, 0x14 }, /* 10CD ~ 111CD */ + { 0x28, 0x13 }, /* 119CD */ + { 0x28, 0x12 }, /* 126CD */ + { 0x28, 0x12 }, /* 134CD */ + { 0x28, 0x11 }, /* 143CD */ + { 0x28, 0x10 }, /* 152CD */ + { 0x28, 0x0f }, /* 162CD */ + { 0x28, 0x0e }, /* 172CD */ + { 0x28, 0x11 }, /* 183CD */ + { 0x28, 0x11 }, /* 195CD */ + { 0x28, 0x10 }, /* 207CD */ + { 0x28, 0x0f }, /* 220CD */ + { 0x28, 0x0f }, /* 234CD */ + { 0x28, 0x0e }, /* 249CD */ + { 0x28, 0x0d }, /* 265CD */ + { 0x28, 0x0c }, /* 282CD */ + { 0x28, 0x0b }, /* 300CD */ +}; + +static const u8 s6e88a0_ams427ap24_gamma[NUM_STEPS_CANDELA][SEQ_LENGTH_GAM= MA] =3D { + /* 10CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x8a, 0x8c, 0x8b, + 0x8c, 0x87, 0x89, 0x89, 0x88, 0x87, 0x8c, 0x80, 0x82, 0x88, 0x7b, + 0x72, 0x8c, 0x60, 0x68, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + /* 11CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x8a, 0x8c, 0x8b, + 0x8c, 0x87, 0x89, 0x89, 0x88, 0x87, 0x8c, 0x80, 0x82, 0x88, 0x7b, + 0x72, 0x8c, 0x60, 0x68, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + /* 12CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x8a, 0x8b, 0x8b, + 0x8c, 0x88, 0x89, 0x8a, 0x88, 0x87, 0x8c, 0x81, 0x82, 0x87, 0x7a, + 0x72, 0x8b, 0x60, 0x68, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + /* 13CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x8a, 0x8b, 0x8b, + 0x8c, 0x88, 0x89, 0x8a, 0x88, 0x87, 0x8c, 0x81, 0x82, 0x87, 0x7a, + 0x72, 0x8b, 0x61, 0x69, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + /* 14CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8c, 0x8b, + 0x8c, 0x88, 0x89, 0x8a, 0x87, 0x86, 0x8a, 0x82, 0x82, 0x87, 0x79, + 0x71, 0x89, 0x63, 0x6c, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + /* 15CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x8a, 0x8c, 0x8c, + 0x8c, 0x86, 0x87, 0x88, 0x85, 0x85, 0x8a, 0x83, 0x83, 0x88, 0x78, + 0x72, 0x89, 0x64, 0x6c, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + /* 16CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8c, 0x8b, + 0x8c, 0x86, 0x88, 0x88, 0x86, 0x86, 0x8a, 0x84, 0x84, 0x88, 0x78, + 0x72, 0x89, 0x5d, 0x67, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + /* 17CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, + 0x8b, 0x87, 0x89, 0x89, 0x86, 0x86, 0x8a, 0x84, 0x83, 0x87, 0x78, + 0x73, 0x89, 0x64, 0x6e, 0x8e, 0x38, 0x32, 0x24, 0x00, 0x00, 0x00 }, + /* 19CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, + 0x8b, 0x87, 0x89, 0x89, 0x86, 0x86, 0x89, 0x84, 0x84, 0x87, 0x77, + 0x72, 0x88, 0x65, 0x6f, 0x8e, 0x38, 0x32, 0x24, 0x00, 0x00, 0x00 }, + /* 20CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, + 0x8b, 0x88, 0x89, 0x89, 0x85, 0x85, 0x88, 0x82, 0x83, 0x85, 0x79, + 0x73, 0x88, 0x65, 0x6f, 0x8e, 0x38, 0x32, 0x24, 0x00, 0x00, 0x00 }, + /* 21CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, + 0x8b, 0x88, 0x89, 0x89, 0x85, 0x85, 0x88, 0x82, 0x83, 0x85, 0x79, + 0x74, 0x88, 0x65, 0x6f, 0x8e, 0x38, 0x32, 0x24, 0x00, 0x00, 0x00 }, + /* 22CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8c, 0x8b, + 0x8c, 0x86, 0x88, 0x87, 0x86, 0x86, 0x89, 0x82, 0x83, 0x85, 0x7c, + 0x75, 0x87, 0x65, 0x6f, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + /* 24CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8c, 0x8b, + 0x8c, 0x86, 0x88, 0x87, 0x86, 0x86, 0x89, 0x82, 0x83, 0x85, 0x7c, + 0x76, 0x86, 0x66, 0x6f, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + /* 25CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, + 0x8b, 0x86, 0x89, 0x88, 0x87, 0x87, 0x89, 0x82, 0x82, 0x84, 0x7f, + 0x7a, 0x89, 0x6b, 0x73, 0x8f, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 27CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, + 0x8b, 0x86, 0x89, 0x88, 0x87, 0x87, 0x89, 0x82, 0x82, 0x84, 0x7f, + 0x7a, 0x89, 0x6b, 0x73, 0x8f, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 29CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, + 0x8b, 0x86, 0x89, 0x88, 0x85, 0x84, 0x87, 0x84, 0x85, 0x86, 0x80, + 0x7b, 0x88, 0x6a, 0x73, 0x8f, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 30CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, + 0x8b, 0x86, 0x89, 0x88, 0x85, 0x84, 0x87, 0x84, 0x85, 0x86, 0x80, + 0x7b, 0x88, 0x6a, 0x73, 0x8f, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 32CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, + 0x8b, 0x86, 0x89, 0x88, 0x85, 0x84, 0x87, 0x84, 0x85, 0x86, 0x80, + 0x7b, 0x88, 0x6a, 0x73, 0x8f, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 34CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8c, 0x8a, 0x89, 0x8b, 0x8b, + 0x8b, 0x86, 0x89, 0x88, 0x85, 0x84, 0x87, 0x83, 0x84, 0x84, 0x7f, + 0x79, 0x86, 0x6c, 0x76, 0x91, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 37CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, + 0x8b, 0x86, 0x88, 0x88, 0x87, 0x86, 0x87, 0x83, 0x84, 0x84, 0x7f, + 0x79, 0x86, 0x6c, 0x76, 0x90, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 39CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, + 0x8b, 0x86, 0x88, 0x87, 0x84, 0x84, 0x86, 0x83, 0x85, 0x85, 0x80, + 0x79, 0x85, 0x6c, 0x76, 0x90, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 41CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, + 0x8b, 0x86, 0x88, 0x87, 0x84, 0x84, 0x86, 0x81, 0x84, 0x83, 0x7f, + 0x79, 0x84, 0x6e, 0x79, 0x93, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 44CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, + 0x8b, 0x86, 0x88, 0x87, 0x84, 0x84, 0x86, 0x81, 0x84, 0x83, 0x7f, + 0x79, 0x84, 0x6e, 0x79, 0x92, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 47CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, + 0x8b, 0x86, 0x88, 0x87, 0x84, 0x85, 0x86, 0x81, 0x84, 0x83, 0x7f, + 0x79, 0x83, 0x6f, 0x79, 0x91, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 50CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, + 0x8b, 0x86, 0x88, 0x87, 0x84, 0x85, 0x86, 0x82, 0x84, 0x83, 0x7f, + 0x79, 0x83, 0x6f, 0x79, 0x90, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 53CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8b, + 0x8b, 0x86, 0x88, 0x87, 0x83, 0x83, 0x85, 0x84, 0x85, 0x85, 0x7f, + 0x79, 0x83, 0x70, 0x79, 0x8f, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 56CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8a, + 0x8a, 0x87, 0x89, 0x87, 0x83, 0x83, 0x85, 0x84, 0x85, 0x84, 0x7f, + 0x79, 0x82, 0x70, 0x7a, 0x8e, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 60CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8a, + 0x8a, 0x87, 0x89, 0x87, 0x83, 0x83, 0x85, 0x84, 0x85, 0x84, 0x7e, + 0x79, 0x82, 0x71, 0x7a, 0x8d, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 64CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8b, 0x89, 0x89, 0x8b, 0x8a, + 0x8a, 0x86, 0x88, 0x86, 0x84, 0x84, 0x86, 0x82, 0x83, 0x82, 0x80, + 0x7a, 0x84, 0x71, 0x7a, 0x8c, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 68CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8c, 0x8a, + 0x8a, 0x86, 0x88, 0x86, 0x84, 0x84, 0x86, 0x82, 0x84, 0x82, 0x81, + 0x7b, 0x83, 0x72, 0x7b, 0x8b, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 72CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8c, 0x8a, + 0x8a, 0x86, 0x88, 0x86, 0x85, 0x85, 0x86, 0x82, 0x84, 0x82, 0x81, + 0x7b, 0x83, 0x72, 0x7c, 0x8a, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 77CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8c, 0x8a, + 0x8a, 0x85, 0x87, 0x85, 0x85, 0x87, 0x87, 0x82, 0x84, 0x82, 0x81, + 0x7c, 0x82, 0x72, 0x7c, 0x89, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 82CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8c, 0x8a, + 0x8a, 0x85, 0x87, 0x85, 0x85, 0x87, 0x87, 0x82, 0x84, 0x82, 0x81, + 0x7c, 0x82, 0x73, 0x7c, 0x88, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 87CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8c, 0x8a, + 0x8a, 0x85, 0x87, 0x85, 0x84, 0x84, 0x86, 0x80, 0x84, 0x81, 0x80, + 0x7a, 0x82, 0x76, 0x7f, 0x89, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 93CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8b, 0x8a, + 0x8a, 0x86, 0x87, 0x85, 0x84, 0x85, 0x86, 0x80, 0x84, 0x80, 0x80, + 0x7a, 0x82, 0x76, 0x80, 0x88, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 98CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x8a, 0x89, 0x89, 0x8b, 0x8a, + 0x8a, 0x86, 0x87, 0x85, 0x85, 0x85, 0x86, 0x80, 0x84, 0x80, 0x80, + 0x7a, 0x82, 0x76, 0x80, 0x88, 0x33, 0x2f, 0x22, 0x00, 0x00, 0x00 }, + /* 105CD */ + { 0x00, 0xc8, 0x00, 0xc4, 0x00, 0xc5, 0x89, 0x88, 0x88, 0x8b, 0x8a, + 0x8a, 0x84, 0x87, 0x85, 0x85, 0x85, 0x85, 0x80, 0x84, 0x80, 0x7f, + 0x79, 0x81, 0x71, 0x7d, 0x87, 0x38, 0x32, 0x24, 0x00, 0x00, 0x00 }, + /* 111CD */ + { 0x00, 0xdf, 0x00, 0xde, 0x00, 0xde, 0x85, 0x85, 0x84, 0x87, 0x86, + 0x87, 0x85, 0x86, 0x85, 0x83, 0x83, 0x83, 0x81, 0x82, 0x82, 0x80, + 0x7d, 0x82, 0x75, 0x7f, 0x86, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 119CD */ + { 0x00, 0xe3, 0x00, 0xe1, 0x00, 0xe2, 0x85, 0x85, 0x84, 0x86, 0x85, + 0x85, 0x84, 0x85, 0x84, 0x83, 0x83, 0x83, 0x82, 0x82, 0x82, 0x7e, + 0x7b, 0x81, 0x75, 0x7f, 0x86, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 126CD */ + { 0x00, 0xe6, 0x00, 0xe5, 0x00, 0xe5, 0x85, 0x84, 0x84, 0x85, 0x85, + 0x85, 0x84, 0x84, 0x84, 0x82, 0x83, 0x83, 0x80, 0x81, 0x81, 0x80, + 0x7f, 0x83, 0x73, 0x7c, 0x84, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 134CD */ + { 0x00, 0xe9, 0x00, 0xe8, 0x00, 0xe8, 0x84, 0x84, 0x83, 0x85, 0x85, + 0x85, 0x84, 0x84, 0x83, 0x81, 0x82, 0x82, 0x81, 0x81, 0x81, 0x7f, + 0x7d, 0x81, 0x73, 0x7c, 0x83, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 143CD */ + { 0x00, 0xed, 0x00, 0xec, 0x00, 0xec, 0x84, 0x83, 0x83, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x83, 0x82, 0x83, 0x83, 0x81, 0x80, 0x81, 0x7f, + 0x7e, 0x81, 0x70, 0x79, 0x81, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 152CD */ + { 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x84, 0x84, 0x83, 0x81, 0x81, 0x81, 0x80, 0x80, 0x81, 0x80, + 0x80, 0x82, 0x6f, 0x78, 0x7f, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 162CD */ + { 0x00, 0xf4, 0x00, 0xf3, 0x00, 0xf4, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x82, 0x81, 0x81, 0x81, 0x81, 0x81, 0x80, 0x80, 0x81, 0x80, + 0x7f, 0x82, 0x6f, 0x78, 0x7f, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 172CD */ + { 0x00, 0xf8, 0x00, 0xf8, 0x00, 0xf8, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x81, 0x81, 0x80, 0x81, 0x80, 0x80, 0x80, 0x81, 0x81, + 0x80, 0x83, 0x6d, 0x76, 0x7d, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 183CD */ + { 0x00, 0xe0, 0x00, 0xdf, 0x00, 0xdf, 0x84, 0x84, 0x83, 0x86, 0x86, + 0x86, 0x83, 0x84, 0x83, 0x82, 0x82, 0x82, 0x81, 0x83, 0x81, 0x81, + 0x7e, 0x81, 0x80, 0x82, 0x84, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 195CD */ + { 0x00, 0xe4, 0x00, 0xe3, 0x00, 0xe3, 0x84, 0x83, 0x83, 0x85, 0x85, + 0x85, 0x83, 0x84, 0x83, 0x81, 0x82, 0x82, 0x82, 0x83, 0x81, 0x81, + 0x80, 0x82, 0x7d, 0x7f, 0x81, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 207CD */ + { 0x00, 0xe7, 0x00, 0xe6, 0x00, 0xe6, 0x83, 0x82, 0x82, 0x85, 0x85, + 0x85, 0x82, 0x83, 0x83, 0x82, 0x82, 0x82, 0x80, 0x81, 0x80, 0x81, + 0x80, 0x82, 0x7d, 0x7f, 0x81, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 220CD */ + { 0x00, 0xeb, 0x00, 0xea, 0x00, 0xea, 0x83, 0x83, 0x82, 0x84, 0x84, + 0x84, 0x82, 0x83, 0x82, 0x81, 0x81, 0x82, 0x81, 0x82, 0x81, 0x80, + 0x7e, 0x80, 0x7d, 0x7f, 0x81, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 234CD */ + { 0x00, 0xef, 0x00, 0xee, 0x00, 0xee, 0x83, 0x82, 0x82, 0x83, 0x83, + 0x83, 0x82, 0x82, 0x82, 0x81, 0x81, 0x81, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x81, 0x7b, 0x7c, 0x7f, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 249CD */ + { 0x00, 0xf3, 0x00, 0xf2, 0x00, 0xf2, 0x82, 0x81, 0x81, 0x83, 0x83, + 0x83, 0x82, 0x82, 0x82, 0x81, 0x81, 0x81, 0x80, 0x81, 0x80, 0x7f, + 0x7e, 0x7f, 0x7b, 0x7c, 0x7f, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 265CD */ + { 0x00, 0xf7, 0x00, 0xf7, 0x00, 0xf7, 0x81, 0x81, 0x80, 0x82, 0x82, + 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x81, 0x80, 0x7f, + 0x7e, 0x7f, 0x7b, 0x7c, 0x7f, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 282CD */ + { 0x00, 0xfb, 0x00, 0xfb, 0x00, 0xfb, 0x80, 0x80, 0x80, 0x81, 0x81, + 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x7f, 0x7f, 0x7f, 0x7f, + 0x7f, 0x7f, 0x78, 0x79, 0x7d, 0x85, 0x85, 0x82, 0x00, 0x00, 0x00 }, + /* 300CD */ + { 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00 }, +}; + +static int s6e88a0_ams427ap24_set_brightness(struct backlight_device *bd) +{ + struct s6e88a0_ams427ap24 *ctx =3D bl_get_data(bd); + struct mipi_dsi_device *dsi =3D ctx->dsi; + struct mipi_dsi_multi_context dsi_ctx =3D { .dsi =3D dsi }; + struct device *dev =3D &dsi->dev; + int brightness =3D bd->props.brightness; + int candela_enum; + u8 b2[SEQ_LENGTH_AID + 1]; + u8 b6[SEQ_LENGTH_ELVSS + 1]; + u8 ca[SEQ_LENGTH_GAMMA + 1]; + + /* get candela enum from brightness */ + for (candela_enum =3D 0; candela_enum < NUM_STEPS_CANDELA; candela_enum++) + if (brightness <=3D s6e88a0_ams427ap24_br_to_cd[candela_enum]) + break; + + /* get aid */ + b2[0] =3D 0xb2; + switch (candela_enum) { + case CANDELA_10CD ... CANDELA_105CD: + memcpy(&b2[1], s6e88a0_ams427ap24_aid[candela_enum], + SEQ_LENGTH_AID); + break; + case CANDELA_111CD ... CANDELA_172CD: + memcpy(&b2[1], s6e88a0_ams427ap24_aid[CANDELA_111CD], + SEQ_LENGTH_AID); + break; + case CANDELA_183CD ... CANDELA_300CD: + memcpy(&b2[1], s6e88a0_ams427ap24_aid[CANDELA_111CD + 1], + SEQ_LENGTH_AID); + break; + default: + dev_err(dev, "Failed to get aid data\n"); + return -EINVAL; + } + + /* get elvss */ + b6[0] =3D 0xb6; + if (candela_enum <=3D CANDELA_111CD) { + memcpy(&b6[1], s6e88a0_ams427ap24_elvss[0], SEQ_LENGTH_ELVSS); + } else { + memcpy(&b6[1], s6e88a0_ams427ap24_elvss[candela_enum - CANDELA_111CD], + SEQ_LENGTH_ELVSS); + } + + /* get gamma */ + ca[0] =3D 0xca; + memcpy(&ca[1], s6e88a0_ams427ap24_gamma[candela_enum], SEQ_LENGTH_GAMMA); + + /* write: key on, aid, acl off, elvss, gamma, gamma update, key off */ + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0x5a, 0x5a); + mipi_dsi_dcs_write_buffer_multi(&dsi_ctx, b2, ARRAY_SIZE(b2)); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x55, 0x00); + mipi_dsi_dcs_write_buffer_multi(&dsi_ctx, b6, ARRAY_SIZE(b6)); + mipi_dsi_dcs_write_buffer_multi(&dsi_ctx, ca, ARRAY_SIZE(ca)); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf7, 0x03); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0xa5, 0xa5); + + return dsi_ctx.accum_err; +} + static void s6e88a0_ams427ap24_reset(struct s6e88a0_ams427ap24 *ctx) { gpiod_set_value_cansleep(ctx->reset_gpio, 0); @@ -50,6 +518,8 @@ static int s6e88a0_ams427ap24_on(struct s6e88a0_ams427ap= 24 *ctx) { struct mipi_dsi_device *dsi =3D ctx->dsi; struct mipi_dsi_multi_context dsi_ctx =3D { .dsi =3D dsi }; + struct device *dev =3D &dsi->dev; + int ret; =20 dsi->mode_flags |=3D MIPI_DSI_MODE_LPM; =20 @@ -69,20 +539,15 @@ static int s6e88a0_ams427ap24_on(struct s6e88a0_ams427= ap24 *ctx) mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xcc, 0x4c); mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf2, 0x03, 0x0d); mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf1, 0xa5, 0xa5); - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xca, - 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x80, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, - 0x80, 0x80, 0x00, 0x00, 0x00); - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb2, - 0x40, 0x08, 0x20, 0x00, 0x08); - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb6, 0x28, 0x0b); - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf7, 0x03); - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x55, 0x00); mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0xa5, 0xa5); mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xfc, 0xa5, 0xa5); =20 + ret =3D s6e88a0_ams427ap24_set_brightness(ctx->bl_dev); + if (ret < 0) { + dev_err(dev, "Failed to set brightness: %d\n", ret); + return ret; + } + mipi_dsi_dcs_set_display_on_multi(&dsi_ctx); =20 return dsi_ctx.accum_err; @@ -182,6 +647,32 @@ static const struct drm_panel_funcs s6e88a0_ams427ap24= _panel_funcs =3D { .get_modes =3D s6e88a0_ams427ap24_get_modes, }; =20 +static const struct backlight_ops s6e88a0_ams427ap24_bl_ops =3D { + .update_status =3D s6e88a0_ams427ap24_set_brightness, +}; + +static int s6e88a0_ams427ap24_register_backlight(struct s6e88a0_ams427ap24= *ctx) +{ + struct backlight_properties props =3D { + .type =3D BACKLIGHT_RAW, + .brightness =3D 180, + .max_brightness =3D 255, + }; + struct mipi_dsi_device *dsi =3D ctx->dsi; + struct device *dev =3D &dsi->dev; + int ret =3D 0; + + ctx->bl_dev =3D devm_backlight_device_register(dev, dev_name(dev), dev, c= tx, + &s6e88a0_ams427ap24_bl_ops, + &props); + if (IS_ERR(ctx->bl_dev)) { + ret =3D PTR_ERR(ctx->bl_dev); + dev_err(dev, "error registering backlight device (%d)\n", ret); + } + + return ret; +} + static int s6e88a0_ams427ap24_probe(struct mipi_dsi_device *dsi) { struct device *dev =3D &dsi->dev; @@ -210,12 +701,16 @@ static int s6e88a0_ams427ap24_probe(struct mipi_dsi_d= evice *dsi) dsi->lanes =3D 2; dsi->format =3D MIPI_DSI_FMT_RGB888; dsi->mode_flags =3D MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | - MIPI_DSI_MODE_NO_EOT_PACKET; + MIPI_DSI_MODE_NO_EOT_PACKET | MIPI_DSI_MODE_VIDEO_NO_HFP; =20 drm_panel_init(&ctx->panel, dev, &s6e88a0_ams427ap24_panel_funcs, DRM_MODE_CONNECTOR_DSI); ctx->panel.prepare_prev_first =3D true; =20 + ret =3D s6e88a0_ams427ap24_register_backlight(ctx); + if (ret < 0) + return ret; + drm_panel_add(&ctx->panel); =20 ret =3D mipi_dsi_attach(dsi); --=20 2.39.5