Skip to content

Commit

Permalink
viafb: fold via_io.h into via-core.h
Browse files Browse the repository at this point in the history
Preparatory move toward the ultimate goal of moving pan-subdevice stuff
into include/linux.

Cc: ScottFang@viatech.com.cn
Cc: JosephChan@via.com.tw
Cc: Harald Welte <laforge@gnumonks.org>
Acked-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
  • Loading branch information
Jonathan Corbet committed May 11, 2010
1 parent 8bbf50f commit 64a6bd6
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 78 deletions.
1 change: 0 additions & 1 deletion drivers/video/via/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include "viamode.h"
#include "global.h"
#include "via_io.h"
#include "via_modesetting.h"

#define viafb_read_reg(p, i) via_read_reg(p, i)
Expand Down
11 changes: 3 additions & 8 deletions drivers/video/via/share.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,9 @@
/* Video Memory Size */
#define VIDEO_MEMORY_SIZE_16M 0x1000000

/* standard VGA IO port
*/
#define VIAStatus 0x3DA
#define VIACR 0x3D4
#define VIASR 0x3C4
#define VIAGR 0x3CE
#define VIAAR 0x3C0

/*
* Lengths of the VPIT structure arrays.
*/
#define StdCR 0x19
#define StdSR 0x04
#define StdGR 0x09
Expand Down
48 changes: 47 additions & 1 deletion drivers/video/via/via-core.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
* Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
* Copyright 2009 Jonathan Corbet <corbet@lwn.net>
* Copyright 2009-2010 Jonathan Corbet <corbet@lwn.net>
* Copyright 2010 Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
Expand All @@ -22,6 +23,8 @@

#ifndef __VIA_CORE_H__
#define __VIA_CORE_H__
#include <linux/types.h>
#include <linux/io.h>
#include <linux/spinlock.h>
#include <linux/pci.h>

Expand Down Expand Up @@ -170,4 +173,47 @@ int viafb_dma_copy_out_sg(unsigned int offset, struct scatterlist *sg, int nsg);
#define VGA_WIDTH 640
#define VGA_HEIGHT 480

/*
* Indexed port operations. Note that these are all multi-op
* functions; every invocation will be racy if you're not holding
* reg_lock.
*/

#define VIAStatus 0x3DA /* Non-indexed port */
#define VIACR 0x3D4
#define VIASR 0x3C4
#define VIAGR 0x3CE
#define VIAAR 0x3C0

static inline u8 via_read_reg(u16 port, u8 index)
{
outb(index, port);
return inb(port + 1);
}

static inline void via_write_reg(u16 port, u8 index, u8 data)
{
outb(index, port);
outb(data, port + 1);
}

static inline void via_write_reg_mask(u16 port, u8 index, u8 data, u8 mask)
{
u8 old;

outb(index, port);
old = inb(port + 1);
outb((data & mask) | (old & ~mask), port + 1);
}

#define VIA_MISC_REG_READ 0x03CC
#define VIA_MISC_REG_WRITE 0x03C2

static inline void via_write_misc_reg_mask(u8 data, u8 mask)
{
u8 old = inb(VIA_MISC_REG_READ);
outb((data & mask) | (old & ~mask), VIA_MISC_REG_WRITE);
}


#endif /* __VIA_CORE_H__ */
67 changes: 0 additions & 67 deletions drivers/video/via/via_io.h

This file was deleted.

2 changes: 1 addition & 1 deletion drivers/video/via/via_modesetting.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include <linux/kernel.h>
#include "via_modesetting.h"
#include "via_io.h"
#include "via-core.h"
#include "share.h"
#include "debug.h"

Expand Down
1 change: 1 addition & 0 deletions drivers/video/via/via_utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include "via-core.h"
#include "global.h"

void viafb_get_device_support_state(u32 *support_state)
Expand Down
1 change: 1 addition & 0 deletions drivers/video/via/viamode.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include "via-core.h"
#include "global.h"
struct res_map_refresh res_map_refresh_tbl[] = {
/*hres, vres, vclock, vmode_refresh*/
Expand Down

0 comments on commit 64a6bd6

Please sign in to comment.