I think I solved the problem for my XPS12. The answer is based on this question: Microphone is not working on Ubuntu 16.04
- I executed
hdajackretask (see image in the question mentioned above)
- I checked the "Show unconnected pins" check-box
- For every "pin" that had a "Headphones" option in its drop-down, I checked the "override" check-box and selected the "Headphones" option.
- I clicked the "Install boot override" button.
- I restarted, and the speakers worked fine.
Something important to note is that if you just play with other possibilities and press apply, for some reason, in my case, switching back and forward the same option, sometimes didn't work...
Another thing to note is that, after rebooting, I opened the
hdajackretask and the options didn't look exactly the same way I left them before reboot...
Bottom line: the headphones/speakers now work for me.