How do I detect wheter the audio cable is connected? Cables cannot be detected. Depending on the hardware, a device at the other end of the cable can be detected; in practice, this is only used for headphones detection. Show which HDA codec you have and how it is wired up to the jack.
ALSA/ASoC: How to correctly load devices/drivers? You should read the ASoC documentation, and then ask on the alsa-devel list (where you will be told that 2.6.39 is horribly outdated, and that the board vendor is responsible for support).