summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-laptop')
-rw-r--r--app-laptop/tp_smapi/files/linux-4.15-timer_setup-fix.patch43
-rw-r--r--app-laptop/tp_smapi/tp_smapi-0.42-r2.ebuild76
2 files changed, 119 insertions, 0 deletions
diff --git a/app-laptop/tp_smapi/files/linux-4.15-timer_setup-fix.patch b/app-laptop/tp_smapi/files/linux-4.15-timer_setup-fix.patch
new file mode 100644
index 000000000000..88c5580db181
--- /dev/null
+++ b/app-laptop/tp_smapi/files/linux-4.15-timer_setup-fix.patch
@@ -0,0 +1,43 @@
+From 76c5120f7be4880cf2c6801f872327e4e70c449f Mon Sep 17 00:00:00 2001
+From: Jan Nordholz <jnordholz@sec.t-labs.tu-berlin.de>
+Date: Mon, 4 Dec 2017 03:27:11 +0100
+Subject: [PATCH] Adapt HDAPS driver to use the new timer_setup() interface.
+
+Linux 4.15 removed the ancient init_timer() API and changed the signature
+of the timer handler function.
+
+Signed-off-by: Jan Nordholz <jnordholz@sec.t-labs.tu-berlin.de>
+Closes: #31
+---
+ hdaps.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/hdaps.c b/hdaps.c
+index 0763c3a..76930a3 100644
+--- a/hdaps.c
++++ b/hdaps.c
+@@ -469,7 +469,11 @@ static void hdaps_calibrate(void)
+ /* Timer handler for updating the input device. Runs in softirq context,
+ * so avoid lenghty or blocking operations.
+ */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
+ static void hdaps_mousedev_poll(unsigned long unused)
++#else
++static void hdaps_mousedev_poll(struct timer_list *unused)
++#endif
+ {
+ int ret;
+
+@@ -779,8 +783,12 @@ static int __init hdaps_init(void)
+ hdaps_invert = 0; /* default */
+
+ /* Init timer before platform_driver_register, in case of suspend */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
+ init_timer(&hdaps_timer);
+ hdaps_timer.function = hdaps_mousedev_poll;
++#else
++ timer_setup(&hdaps_timer, hdaps_mousedev_poll, 0);
++#endif
+ ret = platform_driver_register(&hdaps_driver);
+ if (ret)
+ goto out;
diff --git a/app-laptop/tp_smapi/tp_smapi-0.42-r2.ebuild b/app-laptop/tp_smapi/tp_smapi-0.42-r2.ebuild
new file mode 100644
index 000000000000..e09bd1f674de
--- /dev/null
+++ b/app-laptop/tp_smapi/tp_smapi-0.42-r2.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit flag-o-matic linux-mod
+
+DESCRIPTION="IBM ThinkPad SMAPI BIOS driver"
+HOMEPAGE="https://github.com/evgeni/${PN}"
+SRC_URI="${HOMEPAGE}/releases/download/tp-smapi/${PV}/${P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="hdaps"
+
+# We need dmideode if the kernel does not support
+# DMI_DEV_TYPE_OEM_STRING in dmi.h.
+DEPEND="sys-apps/dmidecode"
+RDEPEND="${DEPEND}"
+
+PATCHES=( "${FILESDIR}/linux-4.15-timer_setup-fix.patch" )
+
+# This code is factored out of both pkg_pretend() and pkg_setup()
+# because the PMS states that ebuilds may not call phase functions
+# directly (see the "List of functions" section). This was bug #596616
+# and #596622.
+tp_smapi_pkg_pretend() {
+ linux-mod_pkg_setup
+
+ MODULE_NAMES="thinkpad_ec(extra:) tp_smapi(extra:)"
+ BUILD_PARAMS="KSRC=${KV_DIR} KBUILD=${KV_OUT_DIR}"
+ BUILD_TARGETS="default"
+
+ if use hdaps; then
+ CONFIG_CHECK="~INPUT_UINPUT"
+ WARNING_INPUT_UINPUT="Your kernel needs uinput for the hdaps module to perform better"
+ # Why call this twice?
+ linux-info_pkg_setup
+
+ MODULE_NAMES="${MODULE_NAMES} hdaps(extra:)"
+ BUILD_PARAMS="${BUILD_PARAMS} HDAPS=1"
+
+ CONFIG_CHECK="~!SENSORS_HDAPS"
+ ERROR_SENSORS_HDAPS="${P} with USE=hdaps conflicts with in-kernel HDAPS (CONFIG_SENSORS_HDAPS)"
+ linux-info_pkg_setup
+ fi
+}
+
+pkg_pretend() {
+ tp_smapi_pkg_pretend
+}
+
+pkg_setup() {
+ # run again as pkg_pretend is not var safe
+ tp_smapi_pkg_pretend
+}
+
+src_compile() {
+ # Kernel Makefiles may pull in -mpreferred-stack-boundary=3
+ # which requires that SSE disabled or compilation will fail.
+ # So we need to ensure that appended user CLAGS do not re-enable SSE
+ # https://bugs.gentoo.org/show_bug.cgi?id=492964
+ replace-flags '-msse*' ''
+ replace-flags '-mssse3' ''
+
+ linux-mod_src_compile
+}
+
+src_install() {
+ linux-mod_src_install
+ einstalldocs
+ newinitd "${FILESDIR}/${PN}-0.40-initd" smapi
+ newconfd "${FILESDIR}/${PN}-0.40-confd" smapi
+}