1/* ASB2303 peripheral 7-segment LEDs x1 support 2 * 3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. 4 * Written by David Howells (dhowells@redhat.com) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public Licence 8 * as published by the Free Software Foundation; either version 9 * 2 of the Licence, or (at your option) any later version. 10 */ 11#include <linux/kernel.h> 12#include <linux/param.h> 13#include <linux/init.h> 14 15#include <asm/io.h> 16#include <asm/processor.h> 17#include <asm/intctl-regs.h> 18#include <asm/rtc-regs.h> 19#include <unit/leds.h> 20 21 22static const u8 asb2303_led_chase_tbl[6] = { 23 ~0x02, /* top - segA */ 24 ~0x04, /* right top - segB */ 25 ~0x08, /* right bottom - segC */ 26 ~0x10, /* bottom - segD */ 27 ~0x20, /* left bottom - segE */ 28 ~0x40, /* left top - segF */ 29}; 30 31static unsigned asb2303_led_chase; 32 33void peripheral_leds_display_exception(enum exception_code code) 34{ 35 ASB2303_GPIO0DEF = 0x5555; /* configure as an output port */ 36 ASB2303_7SEGLEDS = 0x6d; /* triple horizontal bar */ 37} 38 39void peripheral_leds_led_chase(void) 40{ 41 ASB2303_GPIO0DEF = 0x5555; /* configure as an output port */ 42 ASB2303_7SEGLEDS = asb2303_led_chase_tbl[asb2303_led_chase]; 43 asb2303_led_chase++; 44 if (asb2303_led_chase >= 6) 45 asb2303_led_chase = 0; 46} 47