platform/x86: oxpec: Fix turbo register for G1 AMD
Subsystems (2)
Antheas Kapenekakis
maintainerPATCH 1/2 platform/x86: oxpec: Fix turbo register for G1 AMD
Turns out that the AMD variant of the G1 uses different turbo registers than the Intel variant. Differentiate them and apply the correct ones to the AMD variant.
--- drivers/platform/x86/oxpec.c | 37 +++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-)
drivers/platform/x86/oxpec.c +24 -13
@@ -58,7 +58,8 @@ enum oxp_board { oxp_mini_amd_a07, oxp_mini_amd_pro, oxp_x1, - oxp_g1, + oxp_g1_i, + oxp_g1_a, };static enum oxp_board board;
@@ -247,14 +248,14 @@ static const struct dmi_system_id dmi_table[] = {DMI_MATCH (DMI_BOARD_VENDOR ,"ONE-NETBOOK" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER G1 A"), }, - .driver_data = (void *)oxp_g1, + .driver_data = (void *)oxp_g1_a, }, { .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"ONE-NETBOOK" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER G1 i"), }, - .driver_data = (void *)oxp_g1, + .driver_data = (void *)oxp_g1_i, }, { .matches = {
@@ -352,7 +353,8 @@ static umode_t tt_toggle_is_visible(struct kobject *kobj,case oxp_mini_amd_a07:case oxp_mini_amd_pro:case oxp_x1: -case oxp_g1: +case oxp_g1_i: +case oxp_g1_a:return attr->mode;default :break ;
@@ -381,12 +383,13 @@ static ssize_t tt_toggle_store(struct device *dev,case aok_zoe_a1:case oxp_fly:case oxp_mini_amd_pro: +case oxp_g1_a: reg =OXP_TURBO_SWITCH_REG ; mask =OXP_TURBO_TAKE_VAL ;break ;case oxp_2:case oxp_x1: -case oxp_g1: +case oxp_g1_i: reg =OXP_2_TURBO_SWITCH_REG ; mask =OXP_TURBO_TAKE_VAL ;break ;
@@ -426,12 +429,13 @@ static ssize_t tt_toggle_show(struct device *dev,case aok_zoe_a1:case oxp_fly:case oxp_mini_amd_pro: +case oxp_g1_a: reg =OXP_TURBO_SWITCH_REG ; mask =OXP_TURBO_TAKE_VAL ;break ;case oxp_2:case oxp_x1: -case oxp_g1: +case oxp_g1_i: reg =OXP_2_TURBO_SWITCH_REG ; mask =OXP_TURBO_TAKE_VAL ;break ;
@@ -520,7 +524,8 @@ static bool oxp_psy_ext_supported(void) {switch (board) {case oxp_x1: -case oxp_g1: +case oxp_g1_i: +case oxp_g1_a:case oxp_fly:return true;default :
@@ -659,7 +664,8 @@ static int oxp_pwm_enable(void)case oxp_mini_amd_a07:case oxp_mini_amd_pro:case oxp_x1: -case oxp_g1: +case oxp_g1_i: +case oxp_g1_a:return write_to_ec (OXP_SENSOR_PWM_ENABLE_REG ,PWM_MODE_MANUAL );default :return -EINVAL ;
@@ -686,7 +692,8 @@ static int oxp_pwm_disable(void)case oxp_mini_amd_a07:case oxp_mini_amd_pro:case oxp_x1: -case oxp_g1: +case oxp_g1_i: +case oxp_g1_a:return write_to_ec (OXP_SENSOR_PWM_ENABLE_REG ,PWM_MODE_AUTO );default :return -EINVAL ;
@@ -713,7 +720,8 @@ static int oxp_pwm_read(long *val)case oxp_mini_amd_a07:case oxp_mini_amd_pro:case oxp_x1: -case oxp_g1: +case oxp_g1_i: +case oxp_g1_a:return read_from_ec (OXP_SENSOR_PWM_ENABLE_REG ,1 , val);default :return -EOPNOTSUPP ;
@@ -742,7 +750,7 @@ static int oxp_pwm_fan_speed(long *val)return read_from_ec (ORANGEPI_SENSOR_FAN_REG ,2 , val);case oxp_2:case oxp_x1: -case oxp_g1: +case oxp_g1_i:return read_from_ec (OXP_2_SENSOR_FAN_REG ,2 , val);case aok_zoe_a1:case aya_neo_2:
@@ -757,6 +765,7 @@ static int oxp_pwm_fan_speed(long *val)case oxp_mini_amd:case oxp_mini_amd_a07:case oxp_mini_amd_pro: +case oxp_g1_a:return read_from_ec (OXP_SENSOR_FAN_REG ,2 , val);default :return -EOPNOTSUPP ;
@@ -776,7 +785,7 @@ static int oxp_pwm_input_write(long val)return write_to_ec (ORANGEPI_SENSOR_PWM_REG , val);case oxp_2:case oxp_x1: -case oxp_g1: +case oxp_g1_i:/* scale to range [0-184] */ val = (val *184 ) /255 ;return write_to_ec (OXP_SENSOR_PWM_REG , val);
@@ -796,6 +805,7 @@ static int oxp_pwm_input_write(long val)case aok_zoe_a1:case oxp_fly:case oxp_mini_amd_pro: +case oxp_g1_a:return write_to_ec (OXP_SENSOR_PWM_REG , val);default :return -EOPNOTSUPP ;
@@ -816,7 +826,7 @@ static int oxp_pwm_input_read(long *val)break ;case oxp_2:case oxp_x1: -case oxp_g1: +case oxp_g1_i: ret =read_from_ec (OXP_SENSOR_PWM_REG ,1 , val);if (ret)return ret;
@@ -842,6 +852,7 @@ static int oxp_pwm_input_read(long *val)case aok_zoe_a1:case oxp_fly:case oxp_mini_amd_pro: +case oxp_g1_a:default : ret =read_from_ec (OXP_SENSOR_PWM_REG ,1 , val);if (ret)
Signature · 1 line
2.50.1
Antheas Kapenekakis
maintainerPATCH 2/2 platform/x86: oxpec: Add support for OneXPlayer X1 Mini Pro (Strix Point)
The OneXPlayer X1 Mini Pro (which is the Strix Point variant of the Mini) uses the same registers as the X1 Mini, so re-use the quirk.
--- drivers/platform/x86/oxpec.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/oxpec.c +7 -0
@@ -292,6 +292,13 @@ static const struct dmi_system_id dmi_table[] = { }, .driver_data = (void *)oxp_x1, }, + { + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"ONE-NETBOOK" ), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER X1Mini Pro"), + }, + .driver_data = (void *)oxp_x1, + }, { .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
Signature · 1 line
2.50.1
Ilpo Järvinen
maintainerQuoted 63 lines · Antheas Kapenekakis
Turns out that the AMD variant of the G1 uses different turbo registers than the Intel variant. Differentiate them and apply the correct ones to the AMD variant.
Fixes b369395c895b ("platform/x86: oxpec: Add support for the OneXPlayer G1")Signed-off-by Antheas Kapenekakis <[email protected]>--- drivers/platform/x86/oxpec.c | 37 +++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-)drivers/platform/x86/oxpec.c +9
-6@@ -58,7 +58,8 @@ enum oxp_board { oxp_mini_amd_a07, oxp_mini_amd_pro, oxp_x1, - oxp_g1, + oxp_g1_i, + oxp_g1_a, };static enum oxp_board board;@@ -247,14 +248,14 @@ static const struct dmi_system_id dmi_table[] = { DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER G1 A"), }, - .driver_data = (void *)oxp_g1, + .driver_data = (void *)oxp_g1_a, }, { .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER G1 i"), }, - .driver_data = (void *)oxp_g1, + .driver_data = (void *)oxp_g1_i, }, { .matches = { - case oxp_g1: + case oxp_g1_i:return read_from_ec (OXP_2_SENSOR_FAN_REG ,2 , val);@@ -757,6 +765,7 @@ static int oxp_pwm_fan_speed(long *val) +case oxp_g1_a:return read_from_ec (OXP_SENSOR_FAN_REG ,2 , val); -case oxp_g1: +case oxp_g1_i:/* scale to range [0-184] */ val = (val *184 ) /255 ;return write_to_ec (OXP_SENSOR_PWM_REG , val);@@ -796,6 +805,7 @@ static int oxp_pwm_input_write(long val) +case oxp_g1_a:return write_to_ec (OXP_SENSOR_PWM_REG , val);@@ -816,7 +826,7 @@ static int oxp_pwm_input_read(long *val) -case oxp_g1: +case oxp_g1_i: ret =read_from_ec (OXP_SENSOR_PWM_REG ,1 , val);
drivers/platform/x86/oxpec.c static int oxp_pwm_input_read(long *val) · line 854
Quoted 3 lines
drivers/platform/x86/oxpec.c +1
-0@@ -842,6 +852,7 @@ static int oxp_pwm_input_read(long *val) +case oxp_g1_a:default : ret =read_from_ec (OXP_SENSOR_PWM_REG ,1 , val);
Do these FAN and PWM registers fall under what is described in the changelog as "turbo registers"? Or did you extend the scope of this patch and forgot to update the changelog?
Signature · 1 line
i.
Antheas Kapenekakis
maintainerQuoted 65 lines · Ilpo Järvinen
Quoted 62 lines · Antheas Kapenekakis
Turns out that the AMD variant of the G1 uses different turbo registers than the Intel variant. Differentiate them and apply the correct ones to the AMD variant.
Fixes b369395c895b ("platform/x86: oxpec: Add support for the OneXPlayer G1")Signed-off-by Antheas Kapenekakis <[email protected]>--- drivers/platform/x86/oxpec.c | 37 +++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-)drivers/platform/x86/oxpec.c +9
-6@@ -58,7 +58,8 @@ enum oxp_board { oxp_mini_amd_a07, oxp_mini_amd_pro, oxp_x1, - oxp_g1, + oxp_g1_i, + oxp_g1_a, };static enum oxp_board board;@@ -247,14 +248,14 @@ static const struct dmi_system_id dmi_table[] = { DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER G1 A"), }, - .driver_data = (void *)oxp_g1, + .driver_data = (void *)oxp_g1_a, }, { .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER G1 i"), }, - .driver_data = (void *)oxp_g1, + .driver_data = (void *)oxp_g1_i, }, { .matches = { - case oxp_g1: + case oxp_g1_i:return read_from_ec (OXP_2_SENSOR_FAN_REG ,2 , val);@@ -757,6 +765,7 @@ static int oxp_pwm_fan_speed(long *val) +case oxp_g1_a:return read_from_ec (OXP_SENSOR_FAN_REG ,2 , val); -case oxp_g1: +case oxp_g1_i:/* scale to range [0-184] */ val = (val *184 ) /255 ;return write_to_ec (OXP_SENSOR_PWM_REG , val);@@ -796,6 +805,7 @@ static int oxp_pwm_input_write(long val) +case oxp_g1_a:return write_to_ec (OXP_SENSOR_PWM_REG , val);@@ -816,7 +826,7 @@ static int oxp_pwm_input_read(long *val) -case oxp_g1: +case oxp_g1_i: ret =read_from_ec (OXP_SENSOR_PWM_REG ,1 , val);
Quoted 8 lines
drivers/platform/x86/oxpec.c static int oxp_pwm_input_read(long *val) · line 854
Quoted 4 lines
drivers/platform/x86/oxpec.c +1
-0@@ -842,6 +852,7 @@ static int oxp_pwm_input_read(long *val) +case oxp_g1_a:default : ret =read_from_ec (OXP_SENSOR_PWM_REG ,1 , val);Do these FAN and PWM registers fall under what is described in the changelog as "turbo registers"? Or did you extend the scope of this patch and forgot to update the changelog?
Yes. Perhaps its not the best wording and it should have said EC registers.
Antheas
Quoted 5 lines
--
i.
Ilpo Järvinen
maintainerQuoted 76 lines · Antheas Kapenekakis
Quoted 65 lines · Ilpo Järvinen
Quoted 62 lines · Antheas Kapenekakis
Turns out that the AMD variant of the G1 uses different turbo registers than the Intel variant. Differentiate them and apply the correct ones to the AMD variant.
Fixes b369395c895b ("platform/x86: oxpec: Add support for the OneXPlayer G1")Signed-off-by Antheas Kapenekakis <[email protected]>--- drivers/platform/x86/oxpec.c | 37 +++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-)drivers/platform/x86/oxpec.c +9
-6@@ -58,7 +58,8 @@ enum oxp_board { oxp_mini_amd_a07, oxp_mini_amd_pro, oxp_x1, - oxp_g1, + oxp_g1_i, + oxp_g1_a, };static enum oxp_board board;@@ -247,14 +248,14 @@ static const struct dmi_system_id dmi_table[] = { DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER G1 A"), }, - .driver_data = (void *)oxp_g1, + .driver_data = (void *)oxp_g1_a, }, { .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER G1 i"), }, - .driver_data = (void *)oxp_g1, + .driver_data = (void *)oxp_g1_i, }, { .matches = { - case oxp_g1: + case oxp_g1_i:return read_from_ec (OXP_2_SENSOR_FAN_REG ,2 , val);@@ -757,6 +765,7 @@ static int oxp_pwm_fan_speed(long *val) +case oxp_g1_a:return read_from_ec (OXP_SENSOR_FAN_REG ,2 , val); -case oxp_g1: +case oxp_g1_i:/* scale to range [0-184] */ val = (val *184 ) /255 ;return write_to_ec (OXP_SENSOR_PWM_REG , val);@@ -796,6 +805,7 @@ static int oxp_pwm_input_write(long val) +case oxp_g1_a:return write_to_ec (OXP_SENSOR_PWM_REG , val);@@ -816,7 +826,7 @@ static int oxp_pwm_input_read(long *val) -case oxp_g1: +case oxp_g1_i: ret =read_from_ec (OXP_SENSOR_PWM_REG ,1 , val);Quoted 8 lines
drivers/platform/x86/oxpec.c static int oxp_pwm_input_read(long *val) · line 854
Quoted 4 lines
drivers/platform/x86/oxpec.c +1
-0@@ -842,6 +852,7 @@ static int oxp_pwm_input_read(long *val) +case oxp_g1_a:default : ret =read_from_ec (OXP_SENSOR_PWM_REG ,1 , val);Do these FAN and PWM registers fall under what is described in the changelog as "turbo registers"? Or did you extend the scope of this patch and forgot to update the changelog?
Quoted 1 line
Yes. Perhaps its not the best wording and it should have said EC registers.
Indeed, it is not the best wording as there is a register which has "TURBO" in its name so it's a bit confusing. I'll reword the changelog while applying.
Signature · 1 line
i.
Ilpo Järvinen
maintainerQuoted 5 lines · Antheas Kapenekakis
Turns out that the AMD variant of the G1 uses different turbo registers than the Intel variant. Differentiate them and apply the correct ones to the AMD variant.
Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.
The list of commits applied:
[1/2] platform/x86: oxpec: Fix turbo register for G1 AMD
commit: 232b41d3c2ce8cf4641a174416676458bf0de5b2
[2/2] platform/x86: oxpec: Add support for OneXPlayer X1 Mini Pro (Strix Point)
commit: 1798561befd8be1e52feb54f850efcab5a595f43--
i.