Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Nov 2023 16:50:57 +0100
From:      Emmanuel Vadot <manu@bidouilliste.com>
To:        "Dr. Amr Osman" <dr3mro@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Brightness 100% when connect or disconnect charger
Message-ID:  <20231110165057.7e55ad6c62354294219fa980@bidouilliste.com>
In-Reply-To: <CAEYFr1BatCEkP8yoir4Q%2B5mXP1KzU2mBOHp7CwKX4Md1UhNVJQ@mail.gmail.com>
References:  <CAEYFr1DV%2BHpBpUX9gs4CCM887aJnJybJMozPct6X=kFgw8g_ZQ@mail.gmail.com> <20231109091931.983f45f8fad4305569faddcb@bidouilliste.com> <20231110121053.42e78f4b7f44eba5e91da898@bidouilliste.com> <CAEYFr1BatCEkP8yoir4Q%2B5mXP1KzU2mBOHp7CwKX4Md1UhNVJQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 10 Nov 2023 15:58:30 +0200
"Dr. Amr Osman" <dr3mro@gmail.com> wrote:

> It's working!
> I just added
>=20
>       return 0;
>=20
> below if_def_linux so it will always return 0 and when I plug and
> unplug my charger it never goes to 100
>=20
> Thank You
> Dr. Amr Osman
>=20
>=20
> Thank You
> Dr. Amr Osman
>=20

 The theory that I have now is that the value set back when an event
happen is the one that was set with the keyboard keys, for me it's 100%
as this is how it's set at boot and since my keys don't work it stays
that way. Can someone with functional keys for brightness can confirm ?

>=20
>=20
> On Fri, Nov 10, 2023 at 1:10?PM Emmanuel Vadot <manu@bidouilliste.com> wr=
ote:
> >
> > On Thu, 9 Nov 2023 09:19:31 +0100
> > Emmanuel Vadot <manu@bidouilliste.com> wrote:
> >
> > > On Wed, 8 Nov 2023 21:57:21 +0200
> > > "Dr. Amr Osman" <dr3mro@gmail.com> wrote:
> > >
> > > > Hello,
> > > > I have installed freeBSD 14rc4 on Lenovo Thinkpad x270 and xfce des=
ktop and
> > > > when I
> > > > 1) connect the charger
> > > > 2) disconnect the charger
> > > > 3) resume from suspend
> > > > The LCD brightness is 100% which is really disturbing specially whe=
n I am
> > > > in dark room
> > >
> > >  I don't have the issue on my Thinkpad X390 with suspend/resume but I
> > > do have it with the charger.
> > >  I'm pretty sure that it's a hardware thing and we can't do anything
> > > about it without having some framework for sensors that can handle
> > > power supply connection/disconnection and events.
> > >
> > > > hw.acpi.video.lcd0.economy: 20
> > > > hw.acpi.video.lcd0.fullpower: 30
> > > > I have loaded acpi_video and acpi_ibm
> > > > and if I tried to adjust brightness it goes suddenly from 100 to 20=
 if I
> > > > press fn +f5/f6
> > >
> > >  You shouldn't need to load acpi_video on modern laptop, backlight(9)
> > > and backlight(8) is enought (if you have drm loaded).
> > >
> > > > What can I do to fix this issue?
> >
> >  So I had a better look at I was only ~50% right :)
> >  There is some harware thing that happens, when some external events
> > happens (docking, plugging charger, suspend/resume etc ...) the
> > gpu firmware (or the IP not sure about which) generates some interrupts
> > and the i915 driver get some messages via some mailbox. We seem to get
> > a set backlight message for those events, it's happening
> > https://github.com/freebsd/drm-kmod/blob/dce1b3ba0d1ff8ccbbbec09d74480a=
3a0de346e4/drivers/gpu/drm/i915/display/intel_opregion.c#L420
> >  There is a few things that I still don't understand :
> >  - Why do we get a message to set the backlight at 100% for any of
> > those events ?
> > - Linux checks the backlight type and if it's "native" they discard
> > this call. Still unsure what "native" really means, looking at some
> > code it seems that if acpi_video is used it's not considered as a
> > native backlight unless there is a quirk for the computer or if in the
> > ACPI table it's says that it's a windows 8 laptop or some chromebook.
> > - Modifying the above function to always returns 0 (so faking that we
> > have a "native" backlight) obviously don't change the backlight value,
> > but I'm unsure if this is the correct hack or if there will be some
> > problems with it.
> >
> >  So it will be interesting for people who have this problem to know if
> > modifying the code to always do a return 0; at the beginning fixes
> > everything. I'd also like to know if the keyboard keys to modify the
> > backlight still works correctly after this (mine don't do a thing and
> > never did, one day I should have a look at how to use them).
> >
> >  Cheers,
> >
> > --
> > Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>
>=20


--=20
Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20231110165057.7e55ad6c62354294219fa980>