Path: blob/master/arch/mn10300/unit-asb2303/leds.c
10817 views
/* ASB2303 peripheral 7-segment LEDs x1 support1*2* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public Licence7* as published by the Free Software Foundation; either version8* 2 of the Licence, or (at your option) any later version.9*/10#include <linux/kernel.h>11#include <linux/param.h>12#include <linux/init.h>1314#include <asm/io.h>15#include <asm/processor.h>16#include <asm/intctl-regs.h>17#include <asm/rtc-regs.h>18#include <unit/leds.h>1920#if 021static const u8 asb2303_led_hex_tbl[16] = {220x80, 0xf2, 0x48, 0x60, 0x32, 0x24, 0x04, 0xf0,230x00, 0x20, 0x10, 0x06, 0x8c, 0x42, 0x0c, 0x1c24};25#endif2627static const u8 asb2303_led_chase_tbl[6] = {28~0x02, /* top - segA */29~0x04, /* right top - segB */30~0x08, /* right bottom - segC */31~0x10, /* bottom - segD */32~0x20, /* left bottom - segE */33~0x40, /* left top - segF */34};3536static unsigned asb2303_led_chase;3738void peripheral_leds_display_exception(enum exception_code code)39{40ASB2303_GPIO0DEF = 0x5555; /* configure as an output port */41ASB2303_7SEGLEDS = 0x6d; /* triple horizontal bar */42}4344void peripheral_leds_led_chase(void)45{46ASB2303_GPIO0DEF = 0x5555; /* configure as an output port */47ASB2303_7SEGLEDS = asb2303_led_chase_tbl[asb2303_led_chase];48asb2303_led_chase++;49if (asb2303_led_chase >= 6)50asb2303_led_chase = 0;51}525354