Patchwork [2/2] PMH7: Add chip config

login
register
about
Submitter Sven Schnelle
Date 2011-04-10 15:45:49
Message ID <1302450349-22654-2-git-send-email-svens@stackframe.org>
Download mbox | patch
Permalink /patch/2862/
State Superseded
Headers show

Comments

Sven Schnelle - 2011-04-10 15:45:49
Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
 src/ec/lenovo/pmh7/chip.h              |    9 +++++++++
 src/ec/lenovo/pmh7/pmh7.c              |    4 ++++
 src/mainboard/lenovo/x60/devicetree.cb |    1 +
 src/mainboard/lenovo/x60/mainboard.c   |    2 --
 4 files changed, 14 insertions(+), 2 deletions(-)
 create mode 100644 src/ec/lenovo/pmh7/chip.h

Patch

diff --git a/src/ec/lenovo/pmh7/chip.h b/src/ec/lenovo/pmh7/chip.h
new file mode 100644
index 0000000..e11b772
--- /dev/null
+++ b/src/ec/lenovo/pmh7/chip.h
@@ -0,0 +1,9 @@ 
+#ifndef EC_LENOVO_PMH7_CHIP_H
+#define EC_LENOVO_PMH7_CHIP_H
+
+extern struct chip_operations ec_lenovo_pmh7_ops;
+
+struct ec_lenovo_pmh7_config {
+	int backlight_enable:1;
+};
+#endif
diff --git a/src/ec/lenovo/pmh7/pmh7.c b/src/ec/lenovo/pmh7/pmh7.c
index 47573a9..5d13b4e 100644
--- a/src/ec/lenovo/pmh7/pmh7.c
+++ b/src/ec/lenovo/pmh7/pmh7.c
@@ -23,6 +23,7 @@ 
 #include <device/pnp.h>
 #include <stdlib.h>
 #include "pmh7.h"
+#include "chip.h"
 
 void pmh7_register_set_bit(int reg, int bit)
 {
@@ -67,6 +68,7 @@  void pmh7_backlight_enable(int on)
 
 static void enable_dev(device_t dev)
 {
+	struct ec_lenovo_pmh7_config *conf = dev->chip_info;
 	struct resource *resource;
 
 	resource = new_resource(dev, EC_LENOVO_PMH7_INDEX);
@@ -75,6 +77,8 @@  static void enable_dev(device_t dev)
 	resource->size = 16;
 	resource->align = 5;
 	resource->gran = 5;
+
+	pmh7_backlight_enable(conf->backlight_enable);
 }
 
 struct chip_operations ec_lenovo_pmh7_ops = {
diff --git a/src/mainboard/lenovo/x60/devicetree.cb b/src/mainboard/lenovo/x60/devicetree.cb
index cdd1eae..947e213 100644
--- a/src/mainboard/lenovo/x60/devicetree.cb
+++ b/src/mainboard/lenovo/x60/devicetree.cb
@@ -85,6 +85,7 @@  chip northbridge/intel/i945
 				chip ec/lenovo/pmh7
 					device pnp ff.1 on # dummy
 					end
+					register "backlight_enable" = "0x01"
 				end
 				chip ec/lenovo/h8ec
 					device pnp ff.2 on # dummy
diff --git a/src/mainboard/lenovo/x60/mainboard.c b/src/mainboard/lenovo/x60/mainboard.c
index 616fdc5..4b46eb0 100644
--- a/src/mainboard/lenovo/x60/mainboard.c
+++ b/src/mainboard/lenovo/x60/mainboard.c
@@ -39,8 +39,6 @@  static void mainboard_enable(device_t dev)
 {
 	device_t dev0;
 
-	pmh7_backlight_enable(1);
-
 	/* enable Audio */
 	h8ec_set_audio_mute(0);