When jack detection works, it just works. It works out of the box on my laptop and shows up in dmesg as hdafg:...unsol (which is also referenced in the hdaudio code). So when I plug in my headphones it will play to them and not speakers. Some hardware is worse supported.