transcoder: Don't try to disable disabled DDI func

Tiger Lake makes some trouble on the `All_Off' path in case a trans-
coder is already disabled.  It somehow seems to be able to seriously
lock things up inside the processor,  causing Linux to hang,  report
stalled CPUs,  and the reset button not to work anymore.  This might
be related to disabled power wells,  that we do not keep track of on
the `All_Off' path.

As there shouldn't be no harm in skipping the register write for an
already disabled transcoder, just do that.

Tested with Kontron COMe bTL6.

Change-Id: Ia505422570d967b192fe2eb8cab10f305aff3dd7
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/83598
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: Nico Huber <nico.h@gmx.de>
diff --git a/common/hw-gfx-gma-transcoder.adb b/common/hw-gfx-gma-transcoder.adb
index 9e85b75..6eea451 100644
--- a/common/hw-gfx-gma-transcoder.adb
+++ b/common/hw-gfx-gma-transcoder.adb
@@ -373,7 +373,10 @@
       end if;
 
       if Config.Has_Pipe_DDI_Func then
-         Registers.Write (Trans.DDI_FUNC_CTL, 0);
+         Registers.Is_Set_Mask (Trans.DDI_FUNC_CTL, DDI_FUNC_CTL_ENABLE, Enabled);
+         if Enabled then
+            Registers.Write (Trans.DDI_FUNC_CTL, 0);
+         end if;
       end if;
    end Trans_Off;