hal/link/unlink: revise semantics of hal_link()/hal_unlink():

old behavior: a pin's default value would be overwritten by a signal value
on link, effectively making the default pin value invisible outside the
component, and potentially causing a jump in the pin's value on link.

an unlink would re-apply the pin's hidden default value regardless of the
signal value, also causing a potential jump in the pin's value on unlink.

new behavior: the very first link of a signal to a pin will make the
signal inherit the pin's value. On unlink, the pin's default value will
be set from the current signal value.

The result is:
- no sudden jumps in pin values as a result of link/unlink
- it is now possible to access a pin's default value from other pins
- it is possible to have the changed default value retained on unlink

Change of behavior: Code relying on signal values defaulting to zero
post-linking should be revised to consider:

So far, a new signal value defaulted to 0/0.0/false regardless of
the pin's values linked to it.

Now, the signal will inherit the first linked pin's value.

ref: [Emc-developers] PID bidirectional pins. Mar 16 2014
hm2: Bring out A, B and INDEX inputs to hal pins.

This is important to muxed encoders as these pins are not available as GPIO.

Signed-off-by: Michael Geszkiewicz <micges@wp.pl>
hm2: fix typo in 5i24 connector numbers

Signed-off-by: Michael Geszkiewicz <micges@wp.pl>
Merge remote-tracking branch 'origin/v2.5_branch' into 2.6