*/
        for (i = 0; i < spec->port_num; i++) {
                if (pin_nid == spec->port_map[i])
-                       return i + 1;
+                       return i;
        }
 
        /* return -1 if pin number exceeds our expectation */
                return port + intel_base_nid(codec) - 1;
        }
 
-       if (port < 1 || port > spec->port_num)
+       if (port < 0 || port >= spec->port_num)
                return 0;
-       return spec->port_map[port - 1];
+       return spec->port_map[port];
 }
 
 static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe)
 {
        /*
         * pin to port mapping table where the value indicate the pin number and
-        * the index indicate the port number with 1 base.
+        * the index indicate the port number.
         */
-       static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb};
+       static const int map[] = {0x0, 0x4, 0x6, 0x8, 0xa, 0xb};
 
        return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map));
 }
 {
        /*
         * pin to port mapping table where the value indicate the pin number and
-        * the index indicate the port number with 1 base.
+        * the index indicate the port number.
         */
        static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};