浏览代码

intelfb: add preliminary i2c support

Adds code to unregister the I2C buses in the cleanup function.

Signed-off-by: Dennis Munsie <dmunsie@cecropia.com>
Dennis Munsie 19 年之前
父节点
当前提交
7627899b11
共有 3 个文件被更改,包括 22 次插入0 次删除
  1. 1 0
      drivers/video/intelfb/intelfb.h
  2. 16 0
      drivers/video/intelfb/intelfb_i2c.c
  3. 5 0
      drivers/video/intelfb/intelfbdrv.c

+ 1 - 0
drivers/video/intelfb/intelfb.h

@@ -367,6 +367,7 @@ extern int intelfb_var_to_depth(const struct fb_var_screeninfo *var);
 
 #ifdef CONFIG_FB_INTEL_I2C
 extern void intelfb_create_i2c_busses(struct intelfb_info *dinfo);
+extern void intelfb_delete_i2c_busses(struct intelfb_info *dinfo);
 #endif
 
 #endif /* _INTELFB_H */

+ 16 - 0
drivers/video/intelfb/intelfb_i2c.c

@@ -182,3 +182,19 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo)
 	}
 	dinfo->num_outputs = i;
 }
+
+void intelfb_delete_i2c_busses(struct intelfb_info *dinfo)
+{
+	int i;
+
+	for (i = 0; i < MAX_OUTPUTS; i++) {
+		if (dinfo->output[i].i2c_bus.dinfo) {
+			i2c_bit_del_bus(&dinfo->output[i].i2c_bus.adapter);
+			dinfo->output[i].i2c_bus.dinfo = NULL;
+		}
+		if (dinfo->output[i].ddc_bus.dinfo) {
+			i2c_bit_del_bus(&dinfo->output[i].ddc_bus.adapter);
+			dinfo->output[i].ddc_bus.dinfo = NULL;
+		}
+	}
+}

+ 5 - 0
drivers/video/intelfb/intelfbdrv.c

@@ -474,6 +474,11 @@ cleanup(struct intelfb_info *dinfo)
 		agp_free_memory(dinfo->gtt_ring_mem);
 	}
 
+#ifdef CONFIG_FB_INTEL_I2C
+	/* un-register I2C bus */
+	intelfb_delete_i2c_busses(dinfo);
+#endif
+
 	if (dinfo->mmio_base)
 		iounmap((void __iomem *)dinfo->mmio_base);
 	if (dinfo->aperture.virtual)