suzuke / LG-Gram-13z980-Opencore

Hackintosh(MacOS) Opencore EFI for LG Gram 13z980 **蘋果地帶論壇,不可使用**
https://github.com/suzuke/LG-Gram-13z980-Opencore
45 stars 14 forks source link

电池充电限制到80%不起作用 #3

Closed BrunoGM closed 4 years ago

BrunoGM commented 4 years ago

当我在BIOS中将电池充电限制设置为80%时,macOS仍将其充电为100%。关于如何解决的任何想法?(When I set the battery charge limit to 80% in the bios, macOS charges it to 100% anyways. Any idea on how to solve it?)

suzuke commented 4 years ago

我認為我們應該不需要擔心充電限制,因為系統會自動在充電時將電力來源轉換成由電源轉接器供電。 (I think we have no need to worry about charging threshold because the system will automatically change the power source to be powered by the power adapter when charging.)

截圖 2020-06-07 09 53 54
BrunoGM commented 4 years ago

Yeah, that's nice. But it would be better to have the charging threshold to reduce battery wear.

suzuke commented 4 years ago

I agree that it would be better to have the charging threshold. There is very little information about how to deal with the charging threshold on hackintosh. I have no idea about it now but I would dig into it when I have free time.

Any information is appreciated.

BrunoGM commented 4 years ago

Indeed, it would be nice having the new Catalina battery health management but I haven't seem anyone talking about making it work in forums. No idea if its possible. By the way, how did you get your package power as low as 1.5w? I m using your EFI but I can only go as down as ~2.2w.

suzuke commented 4 years ago

Are you using the newest EFI? I changed the SMBIOS from MacbookAir8,2 to MacBookPro15,2 and updated the CPUFriendDataProvider.kext yesterday. (see this commit)

BrunoGM commented 4 years ago

Yes, I tried the newest one and even other EFIs(like clover from shiningXu), or creating my own cpudataprovider.kext, but no way in hell it drops bellow 2.2w. Maybe some bios configuration?

suzuke commented 4 years ago

Do you unlock the CFG lock in BIOS? Press F2 to enter BIOS and then Ctrl+Alt+F7 that will show you the hidden menu. Follow the below steps: BIOS->Advanced->Intel Advanced Menu->Power&Performance->CPU Power Management Control: CFG Lock [Disabled]

BrunoGM commented 4 years ago

Yes, CFG Lock is disabled, I followed all the bios configs from your guide :/

suzuke commented 4 years ago

There is a related information of battery charging threshold.
battery-charge-thresholds-and-related-controls

I think it may take a long time to find out the correspond fields of battery :\

BrunoGM commented 4 years ago

I found 2 guides that could accomplish it, not sure how applicable it is to our hackintosh tho. I m gonna try them out later. https://www.reddit.com/r/thinkpad/comments/8tuw78/macos_guide_setup_battery_threshold_on_all/?utm_source=amp&utm_medium=&utm_content=post_body https://www.tonymacx86.com/threads/guide-lenovo-ideapad-battery-threshold-hotkeys-battery-conservation-mode.273562/

suzuke commented 4 years ago

I found that there is a acpi function (WMAB) that can control the battery charging threshold. _SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x02, 0x50) 0x61 : battery charging threshold 0x02 : set_value (0x01 get_value) 0x50: threshold value (80), 0x64 = 100, We can get current battery charging threshold with _SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x01, 0)

Hope this can help.

PS. this threshold will reset to 100(0x64) after reboot.

suzuke commented 4 years ago

The battery charging threshold is set to 0x50(which shows a maximum 84%) when the laptop is power on and it will set to 0x64 (100%) when the laptop is power off.

截圖 2020-07-05 23 30 15
BrunoGM commented 4 years ago

Thats quite an achievement, congrats! I m gonna test it ASAP, thanks for adding this feature.

BrunoGM commented 4 years ago

Worked like a charm, thanks again @suzuke .

ju0594 commented 3 years ago

I found that there is a acpi function (WMAB) that can control the battery charging threshold. _SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x02, 0x50) 0x61 : battery charging threshold 0x02 : set_value (0x01 get_value) 0x50: threshold value (80), 0x64 = 100, We can get current battery charging threshold with _SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x01, 0)

Hope this can help.

PS. this threshold will reset to 100(0x64) after reboot.

作者你好,我是z990系列的,我查了下在这个系列上,限制充电阈值的代码可能是 _SB.PCI0.LPCB.H_EC.MAP1.WMBB(0x010c, 0x02, 0x50) 这是我在Linux上的代码发现的,我依照你FNkey里的代码尝试写了一个方法绑定快捷键然后调用,结果啥也没发生。

想请问下作者在z980上是怎么实现的?除了调用WMAB方法外,还要做什么操作吗?

suzuke commented 3 years ago

I found that there is a acpi function (WMAB) that can control the battery charging threshold. _SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x02, 0x50) 0x61 : battery charging threshold 0x02 : set_value (0x01 get_value) 0x50: threshold value (80), 0x64 = 100, We can get current battery charging threshold with _SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x01, 0) Hope this can help. PS. this threshold will reset to 100(0x64) after reboot.

作者你好,我是z990系列的,我查了下在这个系列上,限制充电阈值的代码可能是 _SB.PCI0.LPCB.H_EC.MAP1.WMBB(0x010c, 0x02, 0x50) 这是我在Linux上的代码发现的,我依照你FNkey里的代码尝试写了一个方法绑定快捷键然后调用,结果啥也没发生。

想请问下作者在z980上是怎么实现的?除了调用WMAB方法外,还要做什么操作吗?

我也是參考同一份linux souce,我不確定你是怎麼推測出 _SB.PCI0.LPCB.H_EC.MAP1.WMBB(0x010c, 0x02, 0x50) 這個。 從你提供的原始碼裡雖然有定義了

#define WMBB_BATT_LIMIT 0x10C

但其實在linux source中都沒有被使用到,我自己實測也只有

_SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x01, 0)

對z980是有用的,z990我就無法協助測試了

ju0594 commented 3 years ago

I found that there is a acpi function (WMAB) that can control the battery charging threshold. _SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x02, 0x50) 0x61 : battery charging threshold 0x02 : set_value (0x01 get_value) 0x50: threshold value (80), 0x64 = 100, We can get current battery charging threshold with _SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x01, 0) Hope this can help. PS. this threshold will reset to 100(0x64) after reboot.

作者你好,我是z990系列的,我查了下在这个系列上,限制充电阈值的代码可能是 _SB.PCI0.LPCB.H_EC.MAP1.WMBB(0x010c, 0x02, 0x50) 这是我在Linux上的代码发现的,我依照你FNkey里的代码尝试写了一个方法绑定快捷键然后调用,结果啥也没发生。 想请问下作者在z980上是怎么实现的?除了调用WMAB方法外,还要做什么操作吗?

我也是參考同一份linux souce,我不確定你是怎麼推測出 _SB.PCI0.LPCB.H_EC.MAP1.WMBB(0x010c, 0x02, 0x50) 這個。 從你提供的原始碼裡雖然有定義了

#define WMBB_BATT_LIMIT 0x10C

但其實在linux source中都沒有被使用到,我自己實測也只有

_SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x01, 0)

對z980是有用的,z990我就無法協助測試了

你好作者,你这么一说,我也想起了当初在Linux上z990直接用linux仓库自带的内核驱动确实有问题,后来用了这一份修复过的就可以,我以为Github上更新了,刚才对比了下,确实两份文件有差异,修复过的针对机型做了判定,我对C语言不了解,我的理解是z980使用wmab,z990使用wmbb,作者你看看我的理解对吗?

在线查看

suzuke commented 3 years ago

I found that there is a acpi function (WMAB) that can control the battery charging threshold. _SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x02, 0x50) 0x61 : battery charging threshold 0x02 : set_value (0x01 get_value) 0x50: threshold value (80), 0x64 = 100, We can get current battery charging threshold with _SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x01, 0) Hope this can help. PS. this threshold will reset to 100(0x64) after reboot.

作者你好,我是z990系列的,我查了下在这个系列上,限制充电阈值的代码可能是 _SB.PCI0.LPCB.H_EC.MAP1.WMBB(0x010c, 0x02, 0x50) 这是我在Linux上的代码发现的,我依照你FNkey里的代码尝试写了一个方法绑定快捷键然后调用,结果啥也没发生。 想请问下作者在z980上是怎么实现的?除了调用WMAB方法外,还要做什么操作吗?

我也是參考同一份linux souce,我不確定你是怎麼推測出 _SB.PCI0.LPCB.H_EC.MAP1.WMBB(0x010c, 0x02, 0x50) 這個。 從你提供的原始碼裡雖然有定義了

#define WMBB_BATT_LIMIT 0x10C

但其實在linux source中都沒有被使用到,我自己實測也只有

_SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x01, 0)

對z980是有用的,z990我就無法協助測試了

你好作者,你这么一说,我也想起了当初在Linux上z990直接用linux仓库自带的内核驱动确实有问题,后来用了这一份修复过的就可以,我以为Github上更新了,刚才对比了下,确实两份文件有差异,修复过的针对机型做了判定,我对C语言不了解,我的理解是z980使用wmab,z990使用wmbb,作者你看看我的理解对吗?

在线查看

我稍微看了一下後面這份適合z990的linux driver source,的確2019年後的機型(z990)是需要使用

_SB.PCI0.LPCB.H_EC.MAP1.WMBB(0x010c, 0x02, 0x50)

這樣的方式去做設定,唯一有可能影響到的就是目前我看網上分享z990的EFI似乎都有把H_EC更名成EC,如果你也是的話,則應上面應該改成類似這樣:

_SB.PCI0.LPCB.EC.MAP1.WMBB(0x010c, 0x02, 0x50)

我這邊的z980 EFI是只有新增EC這個device但沒有把原有H_EC更名。

ju0594 commented 3 years ago

I found that there is a acpi function (WMAB) that can control the battery charging threshold. _SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x02, 0x50) 0x61 : battery charging threshold 0x02 : set_value (0x01 get_value) 0x50: threshold value (80), 0x64 = 100, We can get current battery charging threshold with _SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x01, 0) Hope this can help. PS. this threshold will reset to 100(0x64) after reboot.

作者你好,我是z990系列的,我查了下在这个系列上,限制充电阈值的代码可能是 _SB.PCI0.LPCB.H_EC.MAP1.WMBB(0x010c, 0x02, 0x50) 这是我在Linux上的代码发现的,我依照你FNkey里的代码尝试写了一个方法绑定快捷键然后调用,结果啥也没发生。 想请问下作者在z980上是怎么实现的?除了调用WMAB方法外,还要做什么操作吗?

我也是參考同一份linux souce,我不確定你是怎麼推測出 _SB.PCI0.LPCB.H_EC.MAP1.WMBB(0x010c, 0x02, 0x50) 這個。 從你提供的原始碼裡雖然有定義了

#define WMBB_BATT_LIMIT 0x10C

但其實在linux source中都沒有被使用到,我自己實測也只有

_SB.PCI0.LPCB.H_EC.MAP1.WMAB(0x61, 0x01, 0)

對z980是有用的,z990我就無法協助測試了

你好作者,你这么一说,我也想起了当初在Linux上z990直接用linux仓库自带的内核驱动确实有问题,后来用了这一份修复过的就可以,我以为Github上更新了,刚才对比了下,确实两份文件有差异,修复过的针对机型做了判定,我对C语言不了解,我的理解是z980使用wmab,z990使用wmbb,作者你看看我的理解对吗? 在线查看

我稍微看了一下後面這份適合z990的linux driver source,的確2019年後的機型(z990)是需要使用

_SB.PCI0.LPCB.H_EC.MAP1.WMBB(0x010c, 0x02, 0x50)

這樣的方式去做設定,唯一有可能影響到的就是目前我看網上分享z990的EFI似乎都有把H_EC更名成EC,如果你也是的話,則應上面應該改成類似這樣:

_SB.PCI0.LPCB.EC.MAP1.WMBB(0x010c, 0x02, 0x50)

我這邊的z980 EFI是只有新增EC這個device但沒有把原有H_EC更名。

我也是新增一个EC,我在想是不是我的ssdt文件没有编写好,我把_Q72重命名为了XQ72,然后使用下面这个ssdt,按下fn+f9后,充电方面仍然没有任何改变,不知道问题出在哪里...

DefinitionBlock ("", "SSDT", 2, "OCLT", "FNKey", 0x00000000)
{
    External (_SB_.PCI0.LPCB.H_EC, DeviceObj)
    External (_SB_.PCI0.LPCB.H_EC.MAP1.WMBB, MethodObj)
    External (_SB_.PCI0.LPCB.PS2K, DeviceObj)

    Scope (_SB.PCI0.LPCB.H_EC)
    {
        Method (_Q72, 0, NotSerialized)  // FN+F9
        {
            \_SB.PCI0.LPCB.H_EC.MAP1.WMBB (0x010C, 0x02, 0x50)
        }
    }
}