Skip to content

Commit eec965d

Browse files
committed
lk2nd: device: Set panel name early if known at compile time
Since lk2nd_init() runs before display initialization nowadays, we need to set the panel name early for the lk1st case to make panel detection (for booting Linux later) work correctly. This is not a big problem, since lk1st does not support detecting panels dynamically currently, so we already know the panel name at compile time.
1 parent f62946b commit eec965d

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

lk2nd/device/device.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <libfdt.h>
1010
#include <lk2nd/device.h>
1111
#include <lk2nd/init.h>
12+
#include <lk2nd/panel.h>
1213
#include <lk2nd/util/lkfdt.h>
1314

1415
#include "device.h"
@@ -157,6 +158,9 @@ static void lk2nd_device_init(void)
157158
#ifdef LK2ND_COMPATIBLE
158159
lk2nd_dev.compatible = LK2ND_COMPATIBLE;
159160
#endif
161+
#ifdef LK2ND_DISPLAY
162+
lk2nd_dev.panel.name = lk2nd_oem_panel_name();
163+
#endif
160164

161165
dtb = lk2nd_device2nd_init();
162166
#ifdef LK2ND_BUNDLE_DTB

lk2nd/display/panel/oem_panel.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
#include <panel.h>
1010
#include <panel_display.h>
1111

12-
#include "generated/panels.h"
12+
#include <lk2nd/panel.h>
1313

14-
#include "../../device/device.h"
14+
#include "generated/panels.h"
1515

1616
#if TARGET_MSM8916
1717
uint32_t panel_regulator_settings[] = {
@@ -42,12 +42,20 @@ uint32_t oem_panel_max_auto_detect_panels()
4242
#define _panel_select(panel) panel_##panel##_select
4343
#define panel_select(panel) _panel_select(panel)
4444

45+
const char *lk2nd_oem_panel_name(void)
46+
{
47+
struct panel_struct panel;
48+
struct msm_panel_info pinfo;
49+
struct mdss_dsi_phy_ctrl phy_db;
50+
51+
panel_select(LK2ND_DISPLAY)(&panel, &pinfo, &phy_db);
52+
return panel.paneldata->panel_node_id;
53+
}
54+
4555
int oem_panel_select(const char *panel_name, struct panel_struct *panel,
4656
struct msm_panel_info *pinfo, struct mdss_dsi_phy_ctrl *phy_db)
4757
{
4858
panel_select(LK2ND_DISPLAY)(panel, pinfo, phy_db);
49-
lk2nd_dev.panel.name = panel->paneldata->panel_node_id;
50-
5159

5260
#if TARGET_MSM8916
5361
if (phy_db->regulator_mode == DSI_PHY_REGULATOR_LDO_MODE)

lk2nd/include/lk2nd/panel.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* SPDX-License-Identifier: BSD-3-Clause */
2+
#ifndef LK2ND_PANEL_H
3+
#define LK2ND_PANEL_H
4+
5+
const char *lk2nd_oem_panel_name(void);
6+
7+
#endif /* LK2ND_PANEL_H */

0 commit comments

Comments
 (0)