From a65bbcaa1699a50004d862aa92b22862eb6ae986 Mon Sep 17 00:00:00 2001 From: Denis Bychkov Date: Sun, 18 Dec 2016 15:52:23 -0500 Subject: [PATCH 1/2] A better way to automatically load n5550 leds modules --- conf/99-n5550.rules | 1 - conf/modprobe_n5550.conf | 7 +++++-- conf/n5550.modules | 1 - dracut/install | 3 --- modules/n5550_ahci_leds.c | 1 + modules/n5550_board.c | 5 ++++- 6 files changed, 10 insertions(+), 8 deletions(-) delete mode 100644 conf/99-n5550.rules delete mode 100755 dracut/install diff --git a/conf/99-n5550.rules b/conf/99-n5550.rules deleted file mode 100644 index 6538953..0000000 --- a/conf/99-n5550.rules +++ /dev/null @@ -1 +0,0 @@ -ACTION=="add", DEVPATH=="/devices/pci0000:00/0000:00:1f.0/gpio_ich.1.auto/gpio/gpiochip195", RUN+="/usr/sbin/modprobe n5550_board" diff --git a/conf/modprobe_n5550.conf b/conf/modprobe_n5550.conf index cf9f08a..a0adf06 100644 --- a/conf/modprobe_n5550.conf +++ b/conf/modprobe_n5550.conf @@ -1,4 +1,7 @@ -install n5550_board /sbin/modprobe i2c_i801; /sbin/modprobe --ignore-install n5550_board -install libahci /sbin/modprobe --ignore-install libahci; /sbin/modprobe n5550_ahci_leds +softdep libahci post: n5550_ahci_leds +# without the second dependency, it is a race condition +# where n5550_ahci_leds sometimes loses out +softdep ahci pre: n5550_ahci_leds + install it87 /sbin/modprobe --ignore-install it87 fix_pwm_polarity=1; echo 1 > /sys/devices/platform/it87.656/pwm3_enable; echo 255 > /sys/devices/platform/it87.656/pwm3 remove it87 echo 0 > /sys/devices/platform/it87.656/pwm3_enable; /sbin/modprobe -r --ignore-remove it87 diff --git a/conf/n5550.modules b/conf/n5550.modules index 112422a..e65e620 100755 --- a/conf/n5550.modules +++ b/conf/n5550.modules @@ -2,7 +2,6 @@ modprobe -b coretemp >/dev/null 2>&1 modprobe -b it87 >/dev/null 2>&1 -modprobe -b n5550_board >/dev/null 2>&1 #modprobe -b ledtrig_timer >/dev/null 2>&1 exit 0 diff --git a/dracut/install b/dracut/install deleted file mode 100755 index 08dbfcb..0000000 --- a/dracut/install +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -inst /usr/lib/udev/rules.d/99-n5550.rules diff --git a/modules/n5550_ahci_leds.c b/modules/n5550_ahci_leds.c index 84be1f8..9d3bec1 100644 --- a/modules/n5550_ahci_leds.c +++ b/modules/n5550_ahci_leds.c @@ -271,6 +271,7 @@ static int __init n5550_ahci_leds_init(void) for (i = 0; i < 5; ++i) { led_trigger_register(&n5550_ahci_led_triggers[i]); } + pr_info("leds_n5550_ahci: Successfully installed LED hook\n"); done: mutex_unlock(&module_mutex); diff --git a/modules/n5550_board.c b/modules/n5550_board.c index 52a776d..430a667 100644 --- a/modules/n5550_board.c +++ b/modules/n5550_board.c @@ -22,7 +22,7 @@ #include #include -#define N5550_ICH_GPIO_BASE_DEFAULT 195 +#define N5550_ICH_GPIO_BASE_DEFAULT 451 #define N5550_PCA9532_1_GPIO_BASE 16 #define N5550_BOARD_ID 2 @@ -449,6 +449,9 @@ static void __exit n5550_board_exit(void) module_init(n5550_board_init); module_exit(n5550_board_exit); +MODULE_SOFTDEP("pre: i2c_i801"); +MODULE_ALIAS("dmi:bvnPhoenixTechnologiesLtd*:bvrCDV_T??X64:*:pnMilsteadPlatform:*:rnGraniteWell:rvrFABA:*:ct9:*"); + MODULE_AUTHOR("Ian Pilcher "); MODULE_DESCRIPTION("Thecus N5550 GPIO and LED support"); MODULE_LICENSE("GPL v2"); From 768ead55c2c0966762d93912c7b7e3d71e7ef9c0 Mon Sep 17 00:00:00 2001 From: Denis Bychkov Date: Tue, 20 Dec 2016 02:16:55 -0500 Subject: [PATCH 2/2] * Changed GPIO default base back to 195 to support older RH 7 kernels; * Addded options to modprobe.conf to override this parameter for the newer kernels together with the explanation about how to come up with the correct value --- conf/modprobe_n5550.conf | 13 +++++++++++-- modules/n5550_board.c | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/conf/modprobe_n5550.conf b/conf/modprobe_n5550.conf index a0adf06..409d90b 100644 --- a/conf/modprobe_n5550.conf +++ b/conf/modprobe_n5550.conf @@ -2,6 +2,15 @@ softdep libahci post: n5550_ahci_leds # without the second dependency, it is a race condition # where n5550_ahci_leds sometimes loses out softdep ahci pre: n5550_ahci_leds +# +options n5550_board ich_gpio_base=195 +# For the newer kernels ^^^^^^^^^^^^^^---- this parameter +# should be changed to 451; +# to find out: +# # dmesg | grep gpio_ich +# [ 17.017262] gpio_ich: GPIO from 451 to 511 on gpio_ich +# first integer is the GPIO base ---^^^^^ you are looking for -install it87 /sbin/modprobe --ignore-install it87 fix_pwm_polarity=1; echo 1 > /sys/devices/platform/it87.656/pwm3_enable; echo 255 > /sys/devices/platform/it87.656/pwm3 -remove it87 echo 0 > /sys/devices/platform/it87.656/pwm3_enable; /sbin/modprobe -r --ignore-remove it87 +install it87 /sbin/modprobe --ignore-install it87 fix_pwm_polarity=1; echo 1 > \ + /sys/devices/platform/it87.656/pwm3_enable; echo 255 > /sys/devices/platform/it87.656/pwm3 +remove it87 echo 0 > /sys/devices/platform/it87.656/pwm3_enable; /sbin/modprobe -r --ignore-remove it87 diff --git a/modules/n5550_board.c b/modules/n5550_board.c index 430a667..a964258 100644 --- a/modules/n5550_board.c +++ b/modules/n5550_board.c @@ -22,7 +22,7 @@ #include #include -#define N5550_ICH_GPIO_BASE_DEFAULT 451 +#define N5550_ICH_GPIO_BASE_DEFAULT 195 #define N5550_PCA9532_1_GPIO_BASE 16 #define N5550_BOARD_ID 2