Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193561
b: refs/heads/master
c: c389874
h: refs/heads/master
i:
  193559: 5d08daf
v: v3
  • Loading branch information
Florian Tobias Schandinat authored and Jonathan Corbet committed May 7, 2010
1 parent 316e23d commit ef705fa
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7e0de022680f7899d33141f3ab5724a704f5669a
refs/heads/master: c389874805a6849e3e347fc0e13fa170d80840c1
22 changes: 0 additions & 22 deletions trunk/drivers/video/via/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,18 +537,6 @@ static void device_on(void);
static void enable_second_display_channel(void);
static void disable_second_display_channel(void);

void viafb_write_reg(u8 index, u16 io_port, u8 data)
{
outb(index, io_port);
outb(data, io_port + 1);
/*DEBUG_MSG(KERN_INFO "\nIndex=%2d Value=%2d", index, data); */
}
u8 viafb_read_reg(int io_port, u8 index)
{
outb(index, io_port);
return inb(io_port + 1);
}

void viafb_lock_crt(void)
{
viafb_write_reg_mask(CR11, VIACR, BIT7, BIT7);
Expand All @@ -560,16 +548,6 @@ void viafb_unlock_crt(void)
viafb_write_reg_mask(CR47, VIACR, 0, BIT0);
}

void viafb_write_reg_mask(u8 index, int io_port, u8 data, u8 mask)
{
u8 tmp;

outb(index, io_port);
tmp = inb(io_port + 1);
outb((data & mask) | (tmp & (~mask)), io_port + 1);
/*DEBUG_MSG(KERN_INFO "\nIndex=%2d Value=%2d", index, tmp); */
}

void write_dac_reg(u8 index, u8 r, u8 g, u8 b)
{
outb(index, LUT_INDEX_WRITE);
Expand Down
8 changes: 5 additions & 3 deletions trunk/drivers/video/via/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@

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

#define viafb_read_reg(p, i) via_read_reg(p, i)
#define viafb_write_reg(i, p, d) via_write_reg(p, i, d)
#define viafb_write_reg_mask(i, p, d, m) via_write_reg_mask(p, i, d, m)

/***************************************************
* Definition IGA1 Design Method of CRTC Registers *
Expand Down Expand Up @@ -870,7 +875,6 @@ extern int viafb_LCD_ON;
extern int viafb_DVI_ON;
extern int viafb_hotplug;

void viafb_write_reg_mask(u8 index, int io_port, u8 data, u8 mask);
void viafb_set_output_path(int device, int set_iga,
int output_interface);

Expand All @@ -885,8 +889,6 @@ void viafb_crt_disable(void);
void viafb_crt_enable(void);
void init_ad9389(void);
/* Access I/O Function */
void viafb_write_reg(u8 index, u16 io_port, u8 data);
u8 viafb_read_reg(int io_port, u8 index);
void viafb_lock_crt(void);
void viafb_unlock_crt(void);
void viafb_load_fetch_count_reg(int h_addr, int bpp_byte, int set_iga);
Expand Down
58 changes: 58 additions & 0 deletions trunk/drivers/video/via/via_io.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
* Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
* 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
* License as published by the Free Software Foundation;
* either version 2, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE.See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* basic io functions
*/

#ifndef __VIA_IO_H__
#define __VIA_IO_H__

#include <linux/types.h>
#include <linux/io.h>

/*
* Indexed port operations. Note that these are all multi-op
* functions; every invocation will be racy if you're not holding
* reg_lock.
*/
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);
}

#endif /* __VIA_IO_H__ */

0 comments on commit ef705fa

Please sign in to comment.