Commit Graph

51 Commits

Author SHA1 Message Date
Alexander Motin
6237a1cc2d acpi_support: Remove CTLFLAG_NEEDGIANT from sysctls.
MFC after:	2 weeks
2021-12-26 19:37:08 -05:00
Mark Johnston
ddf1843203 acpi_ibm(4): Rename disengaged mode to unthrottled mode.
This mode was added in r362496.  Rename it to make the meaning more
clear.

PR:		247306
Suggested by:	rpokala
Submitted by:	Ali Abdallah <ali.abdallah@suse.com>
MFC with:	r362496
2020-06-24 19:51:03 +00:00
Mark Johnston
9f763f0092 acpi_ibm(4): Add support for putting fans in disengaged mode.
PR:		247306
Submitted by:	Ali Abdallah <ali.abdallah@suse.com>
MFC after:	2 weeks
2020-06-22 12:36:05 +00:00
Pawel Biernacki
7029da5c36 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE.  All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by:	kib (mentor, blanket)
Commented by:	kib, gallatin, melifaro
Differential Revision:	https://reviews.freebsd.org/D23718
2020-02-26 14:26:36 +00:00
Ed Maste
2927ab0397 acpi_ibm: remove superfluous cast
Reported by:	kib
2020-02-02 20:56:18 +00:00
Ed Maste
66671c1428 acpi_ibm: whitespace and wrapping cleanup 2020-02-02 19:01:16 +00:00
Ed Maste
4382f0f7a9 acpi_ibm: whitespace fixup 2020-02-02 18:07:47 +00:00
Philip Paeps
02aeba8374 acpi_ibm: add support for ThinkPad PrivacyGuard
ThinkPad PrivacyGuard is a built-in toggleable privacy filter that
restricts viewing angles when on. It is an available on some new
ThinkPad models such as the X1 Carbon 7th gen (as an optional HW
upgrade).

The privacy filter can be enabled/disabled via an ACPI call. This commit
adds a sysctl under dev.acpi_ibm that allows for getting and setting the
PrivacyGuard state.

Submitted by:   Kamila Součková <kamila@ksp.sk>
Reviewed By:    cem, philip
MFC after:      3  days
Differential Revision: https://reviews.freebsd.org/D23370
2020-01-30 10:40:38 +00:00
Ed Maste
8c5cb4ce25 acpi_ibm: reference ThinkPad instead of IBM
These are now Lenovo ThinkPads, not IBM ThinkPads.

PR:		234403
Submitted by:	Kevin Zheng <kevinz5000@gmail.com> (original)
2020-01-15 19:43:45 +00:00
Oleksandr Tymoshenko
cc1ac7fcda [acpi_ibm] Add support for newer Thinkpad models
Add support for newer Thinkpad models with id LEN0268. Was tested on
Thinkpad T480 and ThinkPad X1 Yoga 2nd gen.

PR:		229120
Submitted by:	Ali Abdallah <aliovx@gmail.com>
MFC after:	1 week
2019-04-24 23:10:19 +00:00
Takanori Watanabe
5efca36fbd Distinguish _CID match and _HID match and make lower priority probe
when _CID match.

Reviewed by: jhb, imp
Differential Revision:https://reviews.freebsd.org/D16468
2018-10-26 00:05:46 +00:00
Eitan Adler
9cd818a3f4 acpi: Add support for Thinkpads Mic led
PR:		229074
Submitted by:	"Ali Abdallah" <aliovx@gmail.com>
2018-06-17 20:44:20 +00:00
Luiz Otavio O Souza
9d6672e13b Fix the deciKelvin to Celsius conversion in kernel.
After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C
reference and as result, the temperature read in sysctl(8) now exibits a
+0.1C difference.

This commit fix the kernel references to match the reference value used in
sysctl(8) after r285994.

Sponsored by:	Rubicon Communications (Netgate)
2016-05-22 13:58:32 +00:00
Pedro F. Giffuni
453130d9bf sys/dev: minor spelling fixes.
Most affect comments, very few have user-visible effects.
2016-05-03 03:41:25 +00:00
Enji Cooper
62692eb1b9 Fix previous commit (r284357)
I forgot to convert the && to a ||

Pointyhat to: ngie
X-MFC with: r283678, r284336, r284357
2015-06-13 22:29:43 +00:00
Enji Cooper
63605044cf Fix inverted check by skipping over the model-specific checks if the maker
or product is NULL, not if they are both not NULL

Reported by: araujo, kib
X-MFC with: r283678, r284336
Pointyhat to: allanjude
2015-06-13 22:27:59 +00:00
Allan Jude
890cfe7eed acpi_ibm.ko panics if SMBIOS information is not available
Add a check for NULL before strcmp on smbios information incase it is not populated

Differential Revision:	https://reviews.freebsd.org/D2750
Reviewed by:	ngie, jhb
Approved by:	rpaulo
Sponsored by:	ScaleEngine Inc.
2015-06-13 05:55:26 +00:00
Rui Paulo
78fd538146 acpi_ibm: add per-model default events mask.
Add support for the hotkeys on a Lenovo X1 3rd gen. This also enables
event reporting by default.
2015-05-29 05:28:24 +00:00
Ganbold Tsagaankhuu
3a9ac40382 This implements default-state support as described in:
https://www.kernel.org/doc/Documentation/devicetree/bindings/leds/leds-gpio.txt

Without this booting the VSATV102 causes the blue "working" led to turn
off when the kernel starts up. With this the led (which is turned on by
the firmware) stays on since that's the default state specified in the FDT.

Expanded the meaning of the led_create_state state parameter in order
to implement support for "keep". The original values were:

== 0             Off
!= 0             On

The new values are:

== -1            don't change / keep current setting
== 0             Off
!= -1 && != 0    On

This should have no effect on acpi_asus_attach which only calls
led_create_state with state set to 1. Updated acpi_ibm_attach
in order to avoid surprises.

Differential Revision:	https://reviews.freebsd.org/D2615
Submitted by:	John Wehle
Reviewed by:	gonzo, loos
2015-05-24 07:45:42 +00:00
Rui Paulo
fe3155baa8 acpi_ibm: whitespace. 2015-05-16 20:06:39 +00:00
Hans Petter Selasky
0e1152fcc2 The SYSCTL data pointers can come from userspace and must not be
directly accessed. Although this will work on some platforms, it can
throw an exception if the pointer is invalid and then panic the kernel.

Add a missing SYSCTL_IN() of "SCTP_BASE_STATS" structure.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
2014-10-28 12:00:39 +00:00
Hans Petter Selasky
f0188618f2 Fix multiple incorrect SYSCTL arguments in the kernel:
- Wrong integer type was specified.

- Wrong or missing "access" specifier. The "access" specifier
sometimes included the SYSCTL type, which it should not, except for
procedural SYSCTL nodes.

- Logical OR where binary OR was expected.

- Properly assert the "access" argument passed to all SYSCTL macros,
using the CTASSERT macro. This applies to both static- and dynamically
created SYSCTLs.

- Properly assert the the data type for both static and dynamic
SYSCTLs. In the case of static SYSCTLs we only assert that the data
pointed to by the SYSCTL data pointer has the correct size, hence
there is no easy way to assert types in the C language outside a
C-function.

- Rewrote some code which doesn't pass a constant "access" specifier
when creating dynamic SYSCTL nodes, which is now a requirement.

- Updated "EXAMPLES" section in SYSCTL manual page.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
2014-10-21 07:31:21 +00:00
Sofian Brabez
61bfd86762 Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays
Reviewed by:	cognet
Approved by:	cognet
2013-01-30 18:01:20 +00:00
Baptiste Daroussin
2ef2a08637 add support for newer Lenovo ThinkPads to acpi_ibm
PR:		kern/164538
Submitted by:	Pierre Imai <pierre@imai.at>
MFC after:	2 weeks
2012-10-29 10:22:00 +00:00
Mitsuru IWASAKI
ae2f080bc4 Add in-driver event handler.
MFC after:	3 days
2012-06-23 18:43:54 +00:00
Matthew D Fleming
f4f04709ac Fix a few more SYSCTL_PROC() that were missing a CTLFLAG type specifier. 2011-01-19 00:57:58 +00:00
Matthew D Fleming
6dc7dc9a3e sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.
Commit the rest of the devices.
2011-01-12 19:53:56 +00:00
Jung-uk Kim
30363a9a9e Remove unused assignment.
Found by:	clang static analyzer
Found by:	Coverity Prevent[tm] (CID 4537, 4538, 4539)
2010-06-11 19:53:42 +00:00
Jung-uk Kim
9a179dd8be Merge ACPICA 20100121. 2010-01-21 21:14:28 +00:00
Mitsuru IWASAKI
a50f74cc3a Update acpi_ibm syctl nodes on resume.
This should fix some Thinkpad specific problems such as
connecting to a headphone jack is not functional on X41.

Reviewed by:	takawata
MFC after:	1 week
2010-01-05 20:29:30 +00:00
John Baldwin
08bfbfaa08 Remove unnecessary locking from attach(). This fixes a LOR between the
acpi_ibm lock and the sysctl lock.

MFC after:	3 days
2009-09-24 16:51:56 +00:00
John Baldwin
5c84347532 Re-remove the IBM0057 ID used for PS/2 mouse controllers. The asl for the
61p includes the hotkey device as IBM0068 and the mouse as IBM0057 similar
to other systems.

Submitted by:	marius
MFC after:	3 days
2009-09-20 13:28:19 +00:00
Jung-uk Kim
129d3046ef Import ACPICA 20090521. 2009-06-05 18:44:36 +00:00
Christian Brueffer
e831cd36d0 Remove unused variables.
Found with:	Coverity Prevent(tm)
CID:		544, 545
2009-05-12 23:22:58 +00:00
Pawel Jakub Dawidek
661812c066 Add ID for T61p, which is not IBM really, but well. 2008-05-20 12:26:45 +00:00
Poul-Henning Kamp
36bff1ebfb Convert amd64 and i386 to share the atrtc device driver. 2008-04-14 08:00:00 +00:00
John Baldwin
cc75dfe70b Don't attach to the "IBM0057" ID. This ID is used by IBM machines for
the PS/2 mouse controller.  Thus, when acpi_ibm(4) claimed the mouse
device, the mouse would stop working.  The one ACPI dump of an R40 that
I've looked at includes an HKEY device with the proper "IBM0068" ID, so
I'm not sure how the "IBM0057" ID could have helped at all.

MFC after:	1 week
Approved by:	njl
2007-10-25 17:30:18 +00:00
Markus Brueffer
9cf7411649 Utilize led_create_state in order to preserve the status of the ThinkLight
on driver attach.

PR:		kern/112044
Submitted by:	Henrik Brix Andersen <henrik@brixandersen.dk>
Approved by:	emax (mentor) (earlier version)
2007-04-24 23:09:37 +00:00
Jung-uk Kim
2be4e4713a Catch up with ACPI-CA 20070320 import. 2007-03-22 18:16:43 +00:00
Takanori Watanabe
b98a0eca16 Improve exception string format.
PR:100671
MFC after: 3 days
2006-08-14 18:38:56 +00:00
Takanori Watanabe
924ede2031 Remove debug messages on notify handler.
PR:100671
2006-08-14 18:24:22 +00:00
Markus Brueffer
f93120994e - Add support for setting the fan control mode to manual or automatic
- Add support for adjusting the fan speed if the fan control mode is manual

Documentation for the relevant embedded controller register was obtained from
http://www.thinkwiki.org/wiki/Patch_for_controlling_fan_speed

Tested on:	R51  by Fabian Keil
		T41p by markus
Requested by:	many
Approved by:	philip
MFC after:	1 week
2006-01-14 00:39:10 +00:00
David E. O'Brien
2a191126de Canonize the include of acpi.h. 2005-09-11 18:39:03 +00:00
Markus Brueffer
0873506fc0 Don't lock when holding led_mtx, instead use AcpiOsQueueForExecution to defer
the locking.

Idea taken from: acpi_asus(4)

Approved by:	philip
Reported by:	avatar
		Gordon Bergling <gbergling@0xfce3.net>
MFC after:	1 week
2005-08-04 22:48:36 +00:00
Martin Cracauer
c1204267ca Add the ID of my Thinkpad R40. Makes the module detect and with the
exception of fans everything seems to work fine.  No ill effects
observed.
Reviewed by:	Nate Lawson (on acpi list)
Approved by:	re (Ken Smith)
2005-06-17 17:10:16 +00:00
Markus Brueffer
4aea1563d6 - Only create the led(4) interface, if setting the thinklight is possible
- Initialize val_ec with the content of the volume EC register
  for ACPI_IBM_METHOD_VOLUME and ACPI_IBM_METHOD_MUTE in acpi_ibm_sysctl_set()
  if there is no CMOS handle present. This fixes setting volume and mute on
  such models.

Submitted by:	ru
Approved by:	philip
2005-06-10 11:56:18 +00:00
Markus Brueffer
a4bfd6388f Import a mostly rewritten and extended version of acpi_ibm:
- Restructured for easier extensibility and maintainability
- To be more uniform with the other ACPI extras drivers and to better reflect
  their actual meaning, some sysctls were moved:
    o brightness -> lcd_brightness
    o keylight   -> thinklight
    o enable     -> events
    o misckey    -> hotkey
    o avail_mask -> availmask
    o key_mask   -> eventmask
- New "initialmask" sysctl, which holds the initial eventmask
- The "wlan" sysctl is now read-only, since writing to it didn't have
  any effect
- The "version" sysctl was removed, since it seems to be the same (0x100)
  on all models I have seen
- Support for more hotkeys by the "hotkey" sysctl
- Improved support of ACPI events. Disabled by default, since it unexpectedly
  changes the behaviour of some keys. (on my T41p there are now 24 different
  keypress events that get reported)
- write support for: volume, mute, lcd_brightness and thinklight
- led(4) interface for the thinklight [1]
- New sysctls "fan" and "fan_speed" to support reading of fan status and speed
- New sysctl "thermal" to support reading of up to 8 thermal sensors

Reviewed by:	philip
Approved by:	philip
Submitted by:	simon [1]
Inspired by:	The Linux ibm_acpi driver by Borislav Deianov
		  http://ibm-acpi.sourceforge.net/
		The ThinkPad Button program (tpb) by Markus Braun
		  http://www.nongnu.org/tpb/
Thanks to:	brueffer, dvl, njl, philip, simon, takawata and the many
		testers from freebsd-acpi@ and freebsd-mobile@
2005-06-09 20:17:32 +00:00
David E. O'Brien
dad97fee58 Fix SCM ID's. 2005-03-02 09:22:34 +00:00
Nate Lawson
276cd9216d Unify ACPI_DEBUG support for all OEM drivers under ACPI_OEM. Since more than
one will never be supported on the same platform, this does not hurt
debugging.

MFC after:	3 days
2004-12-13 23:31:46 +00:00
Scott Long
82d4da0f73 Allow the acpi_ibm module to be built with ACPI_DEBUG. 2004-12-13 03:22:11 +00:00