This is from Yinghai's huge patch. I added missing license headers (Yinghai please complain if any of them is incorrect!), fixed some coding style issues and added a few comments.
The code is untested by me (didn't even test whether it builds)! Anybody wants to test this?
MSI ms9282 has w83627EHG. as I have tested ,yinghai's code is ok.