* The test passes when all the following voltages and temperatures
* are within allowed ranges:
*
- * Temperature -40 .. +85 C
- * +5V +4.75 .. +5.25 V
- * +5V standby +4.75 .. +5.25 V
+ * Temperature -40 .. +85 C
+ * +5V +4.75 .. +5.25 V
+ * +5V standby +4.75 .. +5.25 V
*
* LCD backlight is not enabled if temperature values are not within
* allowed ranges (-30 .. + 80). The brightness of backlite can be
#include <watchdog.h>
#include <i2c.h>
+#if defined(CONFIG_VIDEO)
+#include <mb862xx.h>
+#endif
+
#if CONFIG_POST & CFG_POST_SYSMON
DECLARE_GLOBAL_DATA_PTR;
-#define DEFAULT_BRIGHTNESS 50
-
/* from dspic.c */
-extern int dspic_read(ushort reg);
-/* from fpga.c */
-extern void fpga_backlight_enable(int v);
-
-static int sysmon_temp_invalid;
+extern int dspic_read(ushort reg, ushort *data);
#define RELOC(x) if (x != NULL) x = (void *) ((ulong) (x) + gd->reloc_off)
static void sysmon_dspic_init (sysmon_t * this);
static int sysmon_dspic_read (sysmon_t * this, uint addr);
+static int sysmon_dspic_read_sgn (sysmon_t * this, uint addr);
static void sysmon_backlight_disable (sysmon_table_t * this);
-static void sysmon_backlight_enable (sysmon_table_t * this);
struct sysmon_s
{
static sysmon_t sysmon_dspic =
{CFG_I2C_DSPIC_IO_ADDR, sysmon_dspic_init, sysmon_dspic_read};
+static sysmon_t sysmon_dspic_sgn =
+ {CFG_I2C_DSPIC_IO_ADDR, sysmon_dspic_init, sysmon_dspic_read_sgn};
+
static sysmon_t * sysmon_list[] =
{
&sysmon_dspic,
+ &sysmon_dspic_sgn,
NULL
};
static sysmon_table_t sysmon_table[] =
{
- {"Temperature", " C", &sysmon_dspic, NULL, sysmon_backlight_disable,
+ {"Temperature", " C", &sysmon_dspic_sgn, NULL, sysmon_backlight_disable,
1, 1, -32768, 32767, 0xFFFF, 0x8000-40, 0x8000+85, 0,
- 0x8000-30, 0x8000+80, 0, 0x12BC},
+ 0x8000-30, 0x8000+80, 0, 0x12BC},
{"+ 5 V", "V", &sysmon_dspic, NULL, NULL,
- 100, 1000, -0x8000, 0x7FFF, 0xFFFF, 0x8000+4750, 0x8000+5250, 0,
- 0x8000+4750, 0x8000+5250, 0, 0x12CA},
+ 100, 1000, 0, 0xFFFF, 0xFFFF, 4750, 5250, 0,
+ 4750, 5250, 0, 0x12CA},
- {"+ 5 V standby", "V", &sysmon_dspic, NULL, sysmon_backlight_enable,
- 100, 1000, -0x8000, 0x7FFF, 0xFFFF, 0x8000+4750, 0x8000+5250, 0,
- 0x8000+4750, 0x8000+5250, 0, 0x12C6},
+ {"+ 5 V standby", "V", &sysmon_dspic, NULL, NULL,
+ 100, 1000, 0, 0xFFFF, 0xFFFF, 4750, 5250, 0,
+ 4750, 5250, 0, 0x12C6},
};
static int sysmon_table_size = sizeof(sysmon_table) / sizeof(sysmon_table[0]);
static char buf[32];
char *p, sign;
int decimal, frac;
- int unit_val;
-
- unit_val =
+ int unit_val =
s->unit_min + (s->unit_max - s->unit_min) * val / s->val_mask;
if (val == -1)
static int sysmon_dspic_read (sysmon_t * this, uint addr)
{
- int res = dspic_read(addr);
+ ushort data;
- /* To fit into the table range we should add 0x8000 */
- return (res == -1) ? -1 : (res + 0x8000);
+ return (dspic_read(addr, &data)) ? -1 : data;
}
-static void sysmon_backlight_disable (sysmon_table_t * this)
+static int sysmon_dspic_read_sgn (sysmon_t * this, uint addr)
{
- if (!this->val_valid_alt)
- sysmon_temp_invalid = 1;
+ ushort data;
+
+ /* To fit into the table range we should add 0x8000 */
+ return (dspic_read(addr, &data)) ? -1 :
+ (signed short)data + 0x8000;
}
-static void sysmon_backlight_enable (sysmon_table_t * this)
+static void sysmon_backlight_disable (sysmon_table_t * this)
{
- char * param;
- int rc;
-
- if (!sysmon_temp_invalid) {
- param = getenv("brightness");
- rc = param ? simple_strtol(param, NULL, 10) : -1;
- if (rc >= 0)
- fpga_backlight_enable(rc);
- else
- fpga_backlight_enable(DEFAULT_BRIGHTNESS);
- }
+#if defined(CONFIG_VIDEO)
+ board_backlight_switch(this->val_valid_alt);
+#endif
}
int sysmon_post_test (int flags)