PMH7: Add chip config
authorSven Schnelle <svens@stackframe.org>
Mon, 11 Apr 2011 19:43:50 +0000 (19:43 +0000)
committerSven Schnelle <svens@stackframe.org>
Mon, 11 Apr 2011 19:43:50 +0000 (19:43 +0000)
Signed-off-by: Sven Schnelle <svens@stackframe.org>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6486 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

src/ec/lenovo/pmh7/chip.h [new file with mode: 0644]
src/ec/lenovo/pmh7/pmh7.c
src/ec/lenovo/pmh7/pmh7.h
src/mainboard/lenovo/x60/devicetree.cb
src/mainboard/lenovo/x60/mainboard.c

diff --git a/src/ec/lenovo/pmh7/chip.h b/src/ec/lenovo/pmh7/chip.h
new file mode 100644 (file)
index 0000000..e11b772
--- /dev/null
@@ -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
index a46e179f81bff4d22612db2484b2c15a5a541a6d..ba378666a235a78a5c56ce9085d6e3870aaccb4d 100644 (file)
 #include <device/pnp.h>
 #include <stdlib.h>
 #include "pmh7.h"
+#include "chip.h"
+
+void pmh7_backlight_enable(int onoff)
+{
+       if (onoff)
+               pmh7_register_set_bit(0x50, 5);
+       else
+               pmh7_register_clear_bit(0x50, 5);
+}
 
 void pmh7_register_set_bit(int reg, int bit)
 {
@@ -58,6 +67,7 @@ void pmh7_register_write(int reg, int val)
 
 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);
@@ -66,6 +76,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 = {
index a4a61cc2a186b76d547791f5c6a4e71d060b212a..a85d710689d844a3932c9d82bf53c54a41030a99 100644 (file)
@@ -31,4 +31,5 @@ void pmh7_register_clear_bit(int reg, int bit);
 char pmh7_register_read(int reg);
 void pmh7_register_write(int reg, int val);
 
+void pmh7_backlight_enable(int onoff);
 #endif
index f47fdaeab6583668e866e9a402fc40927d21272a..d5ba7d979091ecd1ad02866a5d94aa832ea92c2c 100644 (file)
@@ -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/h8
                                        device pnp ff.2 on # dummy
index 15ed80861468f5044db9c2b64db474618023f391..b9416b5c20267cf5adb208c2c555cab8f41bfcf7 100644 (file)
 #include <ec/lenovo/h8/h8.h>
 #include <northbridge/intel/i945/i945.h>
 
-static void backlight_enable(void)
-{
-       pmh7_register_set_bit(0x50, 5);
-}
-
 static void mainboard_enable(device_t dev)
 {
        device_t dev0;
 
-       backlight_enable();
-
        /* enable Audio */
        h8_set_audio_mute(0);