#!/bin/bash
# Apply AMD GPU power management fix for Pop!_OS 22.04

echo "Creating AMD GPU configuration..."
sudo bash -c 'cat > /etc/modprobe.d/amdgpu.conf << EOFINNER
# Disable aggressive power management for AMD Phoenix GPU
# Temporary fix until Pop!_OS 24.04 stable (Dec 11, 2025)
options amdgpu ppfeaturemask=0x0
options amdgpu dpm=0
EOFINNER'

echo ""
echo "Verifying configuration was created..."
cat /etc/modprobe.d/amdgpu.conf

echo ""
echo "Rebuilding initramfs..."
sudo update-initramfs -u

echo ""
echo "✅ Fix applied! Please reboot now:"
echo "   sudo reboot"
