I have a toshiba l35-S2161 and had been through absolute hell trying to get sound working and I have finally done it! I have sound coming out of both speakers and my headphones.
Maybe someone can refine this process but it worked perfectly for me. I'm a complete linux noob but this isn't hard to do.(it was hard to figure out though.

) Going through this myself I know how hard it can be for complete newbies to follow the seemingly easiest instructions. So I will try to explain this as simply as possible.
Here it goes.
Step one is you need the newest version of the alsa sound drivers. To do that cut and paste each line of the below code box into the terminal one at a time. Wait untill one function is done before pasting in the next. The terminal is located in applications> accessories>terminal.
sudo apt-get install build-essential linux-headers-$(uname -r)
wget
ftp://ftp.alsa-project.org/pub/driver/a ... 14.tar.bz2
tar -xjf alsa-driver-1.0.14.tar.bz2
cd alsa-driver-1.0.14
./configure
sudo make
sudo make install
Once through all of the commands reboot your computer.
Once the computer is back up go back into the terminal and enter this:
sudo gedit /etc/modprobe.conf
You will be prompted for your user account password. When you type it will look like nothing is happening but thats just a security feature.
In the text file that pops up enter this and save it:
options snd-hda-intel model=6stack-digout
Once saved reboot your computer
Once your computer is back up go back into the terminal and enter
alsamixer
Use the arrow keys to move around on this screen. On anything you see double MM on press the M key and maximize the volume. Do this to anything with the double MM.
Once you do your headphones should be working! Go to the volume control panel and go to edit>preferences> and enable surround. From what I have seen that is the one that adjusts your headphones.