I thought I'd post the solution here to save anyone else in the same situation having to google as much as me!

I have a Samsung R510. Plugging in headphones does not mute the sound from the internal speakers, and no sound emits from the headphones. Some details:
Code:
 $ cat /proc/asound/card0/codec* | grep Codec
Codec: Realtek ALC262
Codec: Intel G45 DEVCTG
Anyway it seems to be fixed by loading the module thus
Code:
modprobe snd_hda_intel model=ultra
Adding the following line to /etc/modprobe.d/alsa-base.conf should solve the problem for good:
Code:
options snd-hda-intel model=ultra