Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support several firmware versions. Flip or read bits instead of whole bytes for some parameters. Some new parameters. #13

Merged
merged 28 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8770d88
Created a struct to store different configurations for different fw v…
teackot Jan 4, 2023
3de62eb
Flip and check bits instead of writing and checking whole bytes for f…
teackot Jan 4, 2023
0fdcaf7
Store all configuration in structures rather than constants. Change s…
teackot Jan 5, 2023
b9fa426
Implemented three firmware configurations; configuration is determine…
teackot Jan 5, 2023
7e92bdc
Use standardized properties names
teackot Jan 5, 2023
a525add
Remove capacity and status as they are already supported
teackot Jan 7, 2023
efc7a3b
Human readable shift modes
teackot Jan 8, 2023
b7190b4
Attribute reporting all available shift modes
teackot Jan 8, 2023
ef7b127
Human readable fan modes
teackot Jan 8, 2023
edf57a3
Added a configuration for two new firmwares (#10)
teackot Jan 8, 2023
f76ae49
Corrected led config for E16 Flip
teackot Jan 8, 2023
b815cb5
Renamed a header in the dkms section of makefile
teackot Jan 14, 2023
a09165d
Store configurations in the init section
teackot Jan 17, 2023
ded2009
Don't store FW info addresses in configurations as they are universal
teackot Jan 17, 2023
ca2d620
Use a separate function to load config
teackot Jan 17, 2023
8ee8f02
Remove unsupported turbo mode from 14C1EMS1.101 configuration
teackot Feb 4, 2023
1b93b8b
Remove off shift mode, 0x80 now means 'unspecified'
teackot Feb 5, 2023
36de5ab
Added super battery function support
teackot Feb 5, 2023
414629a
Move allowed firmware arrays to init section
teackot Feb 6, 2023
2d40b8f
Implement webcam blocking
teackot Feb 7, 2023
f8fa23e
Remove unnecesary battery_mode configuration entry
teackot Feb 7, 2023
e0ee5e4
Add GS66 11UE (16V4EMS1.114) configuration (#9)
teackot Feb 11, 2023
185d230
Return an error if attribute is not supported (temporary until I impl…
teackot Feb 11, 2023
845fe78
Only create supported attributes
teackot Feb 11, 2023
2d14c1e
Simplify searching for a suitable conf by using match_string; I also …
teackot Feb 16, 2023
cb0fd5c
Allow to specify available fan modes in configs
teackot Feb 16, 2023
d6cc72f
Remove power_status attributes
teackot Feb 16, 2023
e714883
Omit commas after sentinel entries; use sentinel entries for modes ar…
teackot Feb 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ load:
unload:
-rmmod msi-ec

reload: unload load

install:
mkdir -p /lib/modules/$(shell uname -r)/extra
cp msi-ec.ko /lib/modules/$(shell uname -r)/extra
Expand All @@ -37,7 +39,7 @@ dkms-install:
cp $(CURDIR)/dkms.conf $(DKMS_ROOT_PATH)
cp $(CURDIR)/Makefile $(DKMS_ROOT_PATH)
cp $(CURDIR)/msi-ec.c $(DKMS_ROOT_PATH)
cp $(CURDIR)/constants.h $(DKMS_ROOT_PATH)
cp $(CURDIR)/registers_configuration.h $(DKMS_ROOT_PATH)

sed -e "s/@CFLGS@/${MCFLAGS}/" \
-e "s/@VERSION@/$(VERSION)/" \
Expand Down
45 changes: 36 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ Also, and until future enhancements, no DMI data is used to identify your laptop
This driver exports a few files in its own platform device, msi-ec, and is available to userspace under:

- `/sys/devices/platform/msi-ec/webcam`
- Description: This entry allows enabling the integrated webcam.
- Description: This entry allows enabling the integrated webcam (as if it was done by a keyboard button).
- Access: Read, Write
- Valid values:
- on: integrated webcam is enabled
- off: integrated webcam is disabled

- `/sys/devices/platform/msi-ec/webcam_block`
- Description: This entry allows blocking the integrated webcam. Being blocked by this entry, webcam can't be enabled by a keyboard button or by writing into the webcam file.
- Access: Read, Write
- Valid values:
- on: integrated webcam is blocked
- off: integrated webcam is not blocked

- `/sys/devices/platform/msi-ec/fn_key`
- Description: This entry allows switching the position between the function key and the windows key.
- Access: Read, Write
Expand Down Expand Up @@ -63,23 +70,43 @@ This driver exports a few files in its own platform device, msi-ec, and is avail
- on: cooler boost function is enabled
- off: cooler boost function is disabled

- `/sys/devices/platform/msi-ec/available_shift_modes`
- Description: This entry reports all supported shift modes.
- Access: Read
- Valid values: Newline separated list of strings.

- `/sys/devices/platform/msi-ec/shift_mode`
- Description: This entry allows switching the shift mode. It provides a set of profiles for gaining CPU & GPU overclock/underclock.
- Access: Read, Write
- Valid values:
- turbo: over-voltage and over-clock for the CPU & GPU, aka overcloking mode
- sport: full clock frequency for the CPU & GPU, aka default desktop mode
- comfort: dynamic clock frequency for the CPU & GPU, aka power balanced mode
- eco: low clock frequency for the CPU & GPU, aka power saving mode
- off: operating system decides
- unspecified (read-only)
- Values reported by `/sys/devices/platform/msi-ec/available_shift_modes`. Some of the possible values:
- eco: low clock frequency and voltage for the CPU & GPU, aka power saving mode
- comfort: dynamic clock frequency and voltage for the CPU & GPU, aka power balanced mode
- sport: full clock frequency and voltage for the CPU & GPU, aka default desktop mode
- turbo: over-voltage and over-clock for the CPU & GPU, aka overclocking mode

- `/sys/devices/platform/msi-ec/super_battery`
- Description: This entry allows switching the super battery function.
- Access: Read, Write
- Valid values:
- on: super battery function is enabled
- off: super battery function is disabled

- `/sys/devices/platform/msi-ec/available_fan_modes`
- Description: This entry reports all supported fan modes.
- Access: Read
- Valid values: Newline separated list of strings.

- `/sys/devices/platform/msi-ec/fan_mode`
- Description: This entry allows switching the fan mode. It provides a set of profiles for adjusting the fan speed under specific criteria.
- Access: Read, Write
- Valid values:
- auto: fan speed adjusts automatically
- basic: fixed 1-level fan speed for CPU/GPU (percent)
- advanced: fixed 6-levels fan speed for CPU/GPU (percent)
- Values reported by `/sys/devices/platform/msi-ec/available_fan_modes`. Some of the possible values:
- auto: fan speed adjusts automatically
- silent: fan is disabled
- basic: fixed 1-level fan speed for CPU/GPU (percent)
- advanced: fixed 6-levels fan speed for CPU/GPU (percent)

- `/sys/devices/platform/msi-ec/fw_version`
- Description: This entry reports the firmware version of the motherboard.
Expand Down
75 changes: 0 additions & 75 deletions constants.h

This file was deleted.

112 changes: 112 additions & 0 deletions ec_memory_configuration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#ifndef __MSI_EC_REGISTERS_CONFIG__
#define __MSI_EC_REGISTERS_CONFIG__

#include <linux/types.h>

#define MSI_EC_DRIVER_NAME "msi-ec"

#define MSI_EC_ADDR_UNKNOWN 0xff00 // unknown address

// Firmware info addresses are universal
#define MSI_EC_FW_VERSION_ADDRESS 0xa0
#define MSI_EC_FW_DATE_ADDRESS 0xac
#define MSI_EC_FW_TIME_ADDRESS 0xb4
#define MSI_EC_FW_VERSION_LENGTH 12
#define MSI_EC_FW_DATE_LENGTH 8
#define MSI_EC_FW_TIME_LENGTH 8

struct msi_ec_charge_control_conf {
int address;
int offset_start;
int offset_end;
int range_min;
int range_max;
};

struct msi_ec_webcam_conf {
int address;
int block_address;
int bit;
};

struct msi_ec_fn_win_swap_conf {
int address;
int bit;
};

struct msi_ec_cooler_boost_conf {
int address;
int bit;
};

#define MSI_EC_MODE_NULL { NULL, 0 }
struct msi_ec_mode {
const char *name;
int value;
};

#define MSI_EC_SHIFT_MODE_NAME_LIMIT 20
struct msi_ec_shift_mode_conf {
int address;
struct msi_ec_mode modes[5]; // fixed size for easier hard coding
};

struct msi_ec_super_battery_conf {
int address;
int mask;
};

struct msi_ec_fan_mode_conf {
int address;
struct msi_ec_mode modes[5]; // fixed size for easier hard coding
};

struct msi_ec_cpu_conf {
int rt_temp_address;
int rt_fan_speed_address; // realtime
int rt_fan_speed_base_min;
int rt_fan_speed_base_max;
int bs_fan_speed_address; // basic
int bs_fan_speed_base_min;
int bs_fan_speed_base_max;
};

struct msi_ec_gpu_conf {
int rt_temp_address;
int rt_fan_speed_address; // realtime
};

struct msi_ec_led_conf {
int micmute_led_address;
int mute_led_address;
int bit;
};

#define MSI_EC_KBD_BL_STATE_MASK 0x3
struct msi_ec_kbd_bl_conf {
int bl_mode_address;
int bl_modes[2];
int max_mode;

int bl_state_address;
int state_base_value;
int max_state;
};

struct msi_ec_conf {
const char **allowed_fw;

struct msi_ec_charge_control_conf charge_control;
struct msi_ec_webcam_conf webcam;
struct msi_ec_fn_win_swap_conf fn_win_swap;
struct msi_ec_cooler_boost_conf cooler_boost;
struct msi_ec_shift_mode_conf shift_mode;
struct msi_ec_super_battery_conf super_battery;
struct msi_ec_fan_mode_conf fan_mode;
struct msi_ec_cpu_conf cpu;
struct msi_ec_gpu_conf gpu;
struct msi_ec_led_conf leds;
struct msi_ec_kbd_bl_conf kbd_bl;
};

#endif // __MSI_EC_REGISTERS_CONFIG__
Loading