@@ -2554,7 +2554,7 @@ static void __init fixup_device_tree_chrp(void)
#endif
#if defined(CONFIG_PPC64) && defined(CONFIG_PPC_PMAC)
-static void __init fixup_device_tree_pmac(void)
+static void __init fixup_device_tree_pmac_u3_i2c(void)
{
phandle u3, i2c, mpic;
u32 u3_rev;
@@ -2593,6 +2593,39 @@ static void __init fixup_device_tree_pmac(void)
prom_setprop(i2c, "/u3@0,f8000000/i2c@f8001000", "interrupt-parent",
&parent, sizeof(parent));
}
+
+static void __init fixup_device_tree_pmac_deq(void)
+{
+ phandle deq;
+ u32 i2c_address;
+
+ /*
+ * On older G5s the tas3004 is described by a deq node missing a
+ * compatible definition, instead of a codec node with a
+ * tas3004,code compatible property. Fix that up here.
+ */
+ deq = call_prom("finddevice", 1, 1, ADDR("/ht@0,f2000000/pci@1/mac-io@7/i2c@18000/deq@6a"));
+ if (!PHANDLE_VALID(deq))
+ return;
+ /* Check for proper i2c-address. */
+ if (prom_getprop(deq, "i2c-address", &i2c_address, sizeof(i2c_address)) == PROM_ERROR)
+ return;
+ i2c_address = (i2c_address >> 1) & 0x7f;
+ if (i2c_address != 0x34 && i2c_address != 0x35)
+ return;
+
+ prom_printf("fixing up missing compatible for deq node...\n");
+
+ prom_setprop (deq, "/ht@0,f2000000/pci@1/mac-io@7/i2c@18000/deq@6a",
+ "compatible", &RELOC("tas3004\0codec\0"),
+ sizeof("tas3004\0codec\0"));
+}
+
+static void __init fixup_device_tree_pmac(void)
+{
+ fixup_device_tree_pmac_u3_i2c();
+ fixup_device_tree_pmac_deq();
+}
#else
#define fixup_device_tree_pmac()
#endif