Skip to contentSkip to conversation

Help needed for unusual hack

DISCUSSION harrykipper 2 participants 5 messages Jul 31, 2015 – Aug 2, 2015

lore
Share & tools
lore
#0 lore raw

Hello, I have a Thinkpad X230 (IvyBridge, HD4000) with a very clever display mod (described to some extent by a guy here --> http://boweihe.me/?p=1442). Practically the low res native LVDS panel of the laptop was replaced with a FHD IPS eDP panel. The FHD eDP screen is attached to the dock DisplayPort connector on the laptop's mainboard, which has been rewired in some way, possibly with an interface board. The setup works fairly well, the screen is detected as DP-3 (the laptop has two other external digital ports) and treated as external. I could disable the non existent lvds screen using video=lvds1:d to prevent the gpu from duplicating the signal and wasting power, but that doesn't give me brightness controls because the lvds port is still initialized by the drm module and the intel_backlight/ directory is found in /sys/devices/pci0000\:00/0000\:00\:02.0/drm/card0/card0-LVDS-1/.

To try and solve this I went ahead and:
1 - added my laptop's vendor and model number to the intel_no_lvds_dmi_callback() function in intel_lvds.c 2 - changed the is_edp() function in intel_dp.c to always return 'true' :-D

This way the lvds port skips being initialized, so card0-LVDS-1 doesn't exist at all, the DP port is detected as eDP and intel_backlight sits correctly in /sys/devices/pci0000\:00/0000\:00\:02.0/drm/card0/card0-DP-1/. The screen works perfectly, I have full backlight control and xrandr shows all the modes supported by the panel. The backdrop is that the other two digital ports are lost, because the kernel disables them when it tries to initialize them as eDP, which obviously they are not. In dmesg I see

[drm] failed to retrieve link info, disabling eDP

repeated twice, suggesting that the third port is configured correctly, as in fact it is.

Now obviously this is a very ugly hack that I came up with as a non programmer, unfamiliar with the kernel, and additionally I have an error at boot (see below)

My question is (are): could anyone suggest a more clever way of forcing the third DP port to be detected as eDP and keeping the other two alive? Is the error below something that I should worry about?

Thanks very much and sorry if this is not the right place to ask.

WARNING: CPU: 0 PID: 6 at drivers/gpu/drm/i915/intel_display.c:1034 ironlake_crtc_disable+0x93/0x7f0()
[    3.220452] pipe_off wait timed out
[    3.220453] Modules linked in:
[    3.220456] CPU: 0 PID: 6 Comm: kworker/u16:0 Tainted: G     U       
  4.1.3-eDP #7
[    3.220458] Hardware name: LENOVO 2324B14/2324B14, BIOS G2ETA4WW (2.64 ) 04/09/2015
[    3.220463] Workqueue: events_unbound async_run_entry_fn
[    3.220466]  ffffffff8174a298 000000004c6f2a3f ffffffff8174a298 ffffffff815d398b
[    3.220468]  ffff8802149377f0 ffffffff81071907 ffff8802146e0000 ffff880214a92800
[    3.220470]  0000000000000000 ffff880214a92b38 ffff880214a92b40 ffffffff81071998
[    3.220471] Call Trace:
[    3.220478]  [<ffffffff815d398b>] ? dump_stack+0x47/0x67
[    3.220482]  [<ffffffff81071907>] ? warn_slowpath_common+0x77/0xb0
[    3.220484]  [<ffffffff81071998>] ? warn_slowpath_fmt+0x58/0x80
[    3.220488]  [<ffffffff813c7183>] ? ironlake_crtc_disable+0x93/0x7f0
[    3.220492]  [<ffffffff81358229>] ? drm_mode_copy+0x19/0x30
[    3.220496]  [<ffffffff81158c30>] ? __kmalloc_track_caller+0x20/0x1d0
[    3.220499]  [<ffffffff813c897c>] ? __intel_set_mode+0xb6c/0xc90
[    3.220503]  [<ffffffff813be913>] ? intel_dump_pipe_config.isra.52+0x33/0x3e0
[    3.220508]  [<ffffffff813b141c>] ? gen6_write32+0x2c/0x90
[    3.220510]  [<ffffffff813cfc9a>] ? intel_crtc_set_config+0xd3a/0x1060
[    3.220514]  [<ffffffff8136178a>] ? drm_atomic_state_clear+0x10a/0x180
[    3.220517]  [<ffffffff81351fcf>] ? drm_mode_set_config_internal+0x5f/0x100
[    3.220521]  [<ffffffff81340279>] ? restore_fbdev_mode+0xb9/0xe0
[    3.220524]  [<ffffffff8134218b>] ? drm_fb_helper_restore_fbdev_mode_unlocked+0x1b/0x60
[    3.220526]  [<ffffffff813421ed>] ? drm_fb_helper_set_par+0x1d/0x40
[    3.220530]  [<ffffffff813de4f1>] ? intel_fbdev_set_par+0x11/0x60
[    3.220533]  [<ffffffff812a50e0>] ? fbcon_init+0x580/0x610
[    3.220536]  [<ffffffff8130bb4c>] ? visual_init+0xac/0x110
[    3.220539]  [<ffffffff8130d694>] ? do_bind_con_driver+0x1e4/0x440
[    3.220542]  [<ffffffff8130dc30>] ? do_take_over_console+0x110/0x1a0
[    3.220545]  [<ffffffff812a51c3>] ? do_fbcon_takeover+0x53/0xc0
[    3.220550]  [<ffffffff8108d647>] ? notifier_call_chain+0x47/0x70
[    3.220552]  [<ffffffff8108d93c>] ? __blocking_notifier_call_chain+0x3c/0x60
[    3.220556]  [<ffffffff812ae0d0>] ? register_framebuffer+0x210/0x360
[    3.220559]  [<ffffffff81342492>] ? drm_fb_helper_initial_config+0x282/0x470
[    3.220561]  [<ffffffff8108ed7e>] ? async_run_entry_fn+0x3e/0x150
[    3.220564]  [<ffffffff81086d4e>] ? process_one_work+0x11e/0x3d0
[    3.220566]  [<ffffffff81087048>] ? worker_thread+0x48/0x4c0
[    3.220570]  [<ffffffff815d70ca>] ? preempt_schedule_common+0x1a/0x40
[    3.220572]  [<ffffffff81087000>] ? process_one_work+0x3d0/0x3d0
[    3.220576]  [<ffffffff8108ca38>] ? kthread+0xc8/0xe0
[    3.220579]  [<ffffffff8108c970>] ? kthread_worker_fn+0x180/0x180
[    3.220582]  [<ffffffff815da8d2>] ? ret_from_fork+0x42/0x70
[    3.220585]  [<ffffffff8108c970>] ? kthread_worker_fn+0x180/0x180
[    3.220587] ---[ end trace 5ff7400acd9836ea ]---
[    3.330758] [drm:ironlake_crtc_disable] *ERROR* failed to disable transcoder A
[    3.333347] [drm:intel_set_pch_fifo_underrun_reporting] *ERROR* uncleared pch fifo underrun on pch transcoder A
[    3.333350] [drm:cpt_irq_handler] *ERROR* PCH transcoder A FIFO underrun

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#1 lore raw

Hi,

Quoted 13 lines · harrykipper

Hello, I have a Thinkpad X230 (IvyBridge, HD4000) with a very clever display mod (described to some extent by a guy here --> http://boweihe.me/?p=1442).
Practically the low res native LVDS panel of the laptop was replaced with a FHD IPS eDP panel. The FHD eDP screen is attached to the dock DisplayPort connector on the laptop's mainboard, which has been rewired in some way, possibly with an interface board. The setup works fairly well, the screen is detected as DP-3 (the laptop has two other external digital ports) and treated as external. I could disable the non existent lvds screen using video=lvds1:d to prevent the gpu from duplicating the signal and wasting power, but that doesn't give me brightness controls because the lvds port is still initialized by the drm module and the intel_backlight/ directory is found in /sys/devices/pci0000\:00/0000\:00\:02.0/drm/card0/card0-LVDS-1/.

Quoted 4 lines

To try and solve this I went ahead and:
1 - added my laptop's vendor and model number to the intel_no_lvds_dmi_callback() function in intel_lvds.c
2 - changed the is_edp() function in intel_dp.c to always return 'true' :-D

Change is_edp() to something like:

- return intel_dig_port->base.type == INTEL_OUTPUT_EDP;
+ return intel_dig_port->base.type == INTEL_OUTPUT_EDP ||
+ strncmp(intel_dp->base.name, "DP-1", 4) == 0;

An alternative solution might be to modify intel_bios.c and change what has been read vom VBT, see parse_ddi_port().

Best regards,

Lukas

Quoted 77 lines

This way the lvds port skips being initialized, so card0-LVDS-1 doesn't exist at all, the DP port is detected as eDP and intel_backlight sits correctly in /sys/devices/pci0000\:00/0000\:00\:02.0/drm/card0/card0-DP-1/. The screen works perfectly, I have full backlight control and xrandr shows all the modes supported by the panel. The backdrop is that the other two digital ports are lost, because the kernel disables them when it tries to initialize them as eDP, which obviously they are not. In dmesg I see

[drm] failed to retrieve link info, disabling eDP

repeated twice, suggesting that the third port is configured correctly, as in fact it is.

Now obviously this is a very ugly hack that I came up with as a non programmer, unfamiliar with the kernel, and additionally I have an error at boot (see below)

My question is (are): could anyone suggest a more clever way of forcing the third DP port to be detected as eDP and keeping the other two alive? Is the error below something that I should worry about?

Thanks very much and sorry if this is not the right place to ask.

WARNING: CPU: 0 PID: 6 at drivers/gpu/drm/i915/intel_display.c:1034
ironlake_crtc_disable+0x93/0x7f0()
[    3.220452] pipe_off wait timed out
[    3.220453] Modules linked in:
[    3.220456] CPU: 0 PID: 6 Comm: kworker/u16:0 Tainted: G     U
4.1.3-eDP #7
[    3.220458] Hardware name: LENOVO 2324B14/2324B14, BIOS G2ETA4WW (2.64 )
04/09/2015
[    3.220463] Workqueue: events_unbound async_run_entry_fn
[    3.220466]  ffffffff8174a298 000000004c6f2a3f ffffffff8174a298
ffffffff815d398b
[    3.220468]  ffff8802149377f0 ffffffff81071907 ffff8802146e0000
ffff880214a92800
[    3.220470]  0000000000000000 ffff880214a92b38 ffff880214a92b40
ffffffff81071998
[    3.220471] Call Trace:
[    3.220478]  [<ffffffff815d398b>] ? dump_stack+0x47/0x67
[    3.220482]  [<ffffffff81071907>] ? warn_slowpath_common+0x77/0xb0
[    3.220484]  [<ffffffff81071998>] ? warn_slowpath_fmt+0x58/0x80
[    3.220488]  [<ffffffff813c7183>] ? ironlake_crtc_disable+0x93/0x7f0
[    3.220492]  [<ffffffff81358229>] ? drm_mode_copy+0x19/0x30
[    3.220496]  [<ffffffff81158c30>] ? __kmalloc_track_caller+0x20/0x1d0
[    3.220499]  [<ffffffff813c897c>] ? __intel_set_mode+0xb6c/0xc90
[    3.220503]  [<ffffffff813be913>] ?
intel_dump_pipe_config.isra.52+0x33/0x3e0
[    3.220508]  [<ffffffff813b141c>] ? gen6_write32+0x2c/0x90
[    3.220510]  [<ffffffff813cfc9a>] ? intel_crtc_set_config+0xd3a/0x1060
[    3.220514]  [<ffffffff8136178a>] ? drm_atomic_state_clear+0x10a/0x180
[    3.220517]  [<ffffffff81351fcf>] ?
drm_mode_set_config_internal+0x5f/0x100
[    3.220521]  [<ffffffff81340279>] ? restore_fbdev_mode+0xb9/0xe0
[    3.220524]  [<ffffffff8134218b>] ?
drm_fb_helper_restore_fbdev_mode_unlocked+0x1b/0x60
[    3.220526]  [<ffffffff813421ed>] ? drm_fb_helper_set_par+0x1d/0x40
[    3.220530]  [<ffffffff813de4f1>] ? intel_fbdev_set_par+0x11/0x60
[    3.220533]  [<ffffffff812a50e0>] ? fbcon_init+0x580/0x610
[    3.220536]  [<ffffffff8130bb4c>] ? visual_init+0xac/0x110
[    3.220539]  [<ffffffff8130d694>] ? do_bind_con_driver+0x1e4/0x440
[    3.220542]  [<ffffffff8130dc30>] ? do_take_over_console+0x110/0x1a0
[    3.220545]  [<ffffffff812a51c3>] ? do_fbcon_takeover+0x53/0xc0
[    3.220550]  [<ffffffff8108d647>] ? notifier_call_chain+0x47/0x70
[    3.220552]  [<ffffffff8108d93c>] ?
__blocking_notifier_call_chain+0x3c/0x60
[    3.220556]  [<ffffffff812ae0d0>] ? register_framebuffer+0x210/0x360
[    3.220559]  [<ffffffff81342492>] ?
drm_fb_helper_initial_config+0x282/0x470
[    3.220561]  [<ffffffff8108ed7e>] ? async_run_entry_fn+0x3e/0x150
[    3.220564]  [<ffffffff81086d4e>] ? process_one_work+0x11e/0x3d0
[    3.220566]  [<ffffffff81087048>] ? worker_thread+0x48/0x4c0
[    3.220570]  [<ffffffff815d70ca>] ? preempt_schedule_common+0x1a/0x40
[    3.220572]  [<ffffffff81087000>] ? process_one_work+0x3d0/0x3d0
[    3.220576]  [<ffffffff8108ca38>] ? kthread+0xc8/0xe0
[    3.220579]  [<ffffffff8108c970>] ? kthread_worker_fn+0x180/0x180
Quoted 8 lines
[    3.220582]  [<ffffffff815da8d2>] ? ret_from_fork+0x42/0x70
[    3.220585]  [<ffffffff8108c970>] ? kthread_worker_fn+0x180/0x180
[    3.220587] ---[ end trace 5ff7400acd9836ea ]---
[    3.330758] [drm:ironlake_crtc_disable] *ERROR* failed to disable
transcoder A
[    3.333347] [drm:intel_set_pch_fifo_underrun_reporting] *ERROR* uncleared
pch fifo underrun on pch transcoder A
[    3.333350] [drm:cpt_irq_handler] *ERROR* PCH transcoder A FIFO underrun

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 1 line · Lukas Wunner

Hi,

Thanks very much Lukas, I tried both

Review

Quoted 6 lines

Change is_edp() to something like:

(quoted diff) +2 -1
-	return intel_dig_port->base.type == INTEL_OUTPUT_EDP;
+	return intel_dig_port->base.type == INTEL_OUTPUT_EDP ||
+	       strncmp(intel_dp->base.name, "DP-1", 4) == 0;

This fails as ‘struct intel_dp’ has no member named ‘base’. Tried some variants, but I am clueless.. :-/

Quoted 4 lines

An alternative solution might be to modify intel_bios.c and change what has been read vom VBT, see parse_ddi_port().

This seems easier, parse_ddi_port() assigns an 'is_edp' variable with is_edp = is_dp && (child->common.device_type & DEVICE_TYPE_INTERNAL_CONNECTOR);

Assuming that setting it would suffice for my port to be detected as eDPI tried to change it to something like:
is_edp = is_dp && child->common.dvo_port == DVO_PORT_DPC;
or
is_edp = is_dp && (port == PORT_C);

is_edp = is_dp && port_name(port) == "DP-3"

since it's the third DP, but no success.

I must admit I am a bit clueless, but the solution seems within grasp....

Thanks very much

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Hi,

Quoted 8 lines · harrykipper

Review

Quoted 5 lines · Lukas Wunner

Change is_edp() to something like:

(quoted diff) +2 -1
-	return intel_dig_port->base.type == INTEL_OUTPUT_EDP;
+	return intel_dig_port->base.type == INTEL_OUTPUT_EDP ||
+	       strncmp(intel_dp->base.name, "DP-1", 4) == 0;

This fails as struct intel_dp has no member named base. Tried some variants, but I am clueless.. :-/

Sorry, intel_dp->attached_connector->base.name

You may also need to modify intel_dp_is_edp().

HTH,

Lukas
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 4 lines · Lukas Wunner

Sorry, intel_dp->attached_connector->base.name

You may also need to modify intel_dp_is_edp().

That made the trick!

I also changed

if (port == PORT_A)
return true;

into

if (port == PORT_D)
return true;

in intel_dp_is_edp() and now I have a card0-eDP-1 with intel_backlight and also card0-DP-1 card0-DP-2 card0-HDMI-A-1 card0-HDMI-A-2 card0-VGA-1.

Thanks very much Lukas. I hope this will be useful to the other twenty people on the planet with my same set up :-)

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx