https://bugzilla.kernel.org/show_bug.cgi?id=76321
--- Comment #9 from Alex Deucher alexdeucher@gmail.com --- (In reply to Pali Rohár from comment #8)
Created attachment 146011 [details] patch for get/set dpm state
It is implemented in attached patch. I tested it and it working fine on my system. My scripts automacitally change dpm state to battery when power adapter is unplugged. And when radeon card is powered on it initialize in battery state (even if last state was performance before turning card off).
Patch looks fine wth respect to the power state change. You can drop the changes to radeon_[get|set]_dpm_forced_performance_level() however. That won't work without changes to the current force_performance_level interfaces. If you can clean up the patch as requested and generate a proper git patch, I'll apply it.