Commit 385a9cb3 authored by Tim Sell's avatar Tim Sell Committed by Greg Kroah-Hartman

staging: unisys: visorinput: remove need for 'depends on FB'

Previously, we used a hack to determine the max x,y resolution of the
visor virtual mouse: we just looked at the resolution of the
first-registered framebuffer device, using the currently-valid assumption
that in a Unisys s-Par guest environment the video will be provided by an
efifb framebuffer device.

This hack has been removed, by instead determining the default mouse
resolution by looking at fields within the visor mouse channel memory,
mouse.x_res and mouse.y_res.  If these fields are 0, a default resolution
of 1024x768 is assumed.
Signed-off-by: default avatarTim Sell <Timothy.Sell@unisys.com>
Signed-off-by: default avatarDavid Kershner <david.kershner@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 17eb0b29
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
config UNISYS_VISORINPUT config UNISYS_VISORINPUT
tristate "Unisys visorinput driver" tristate "Unisys visorinput driver"
depends on UNISYSSPAR && UNISYS_VISORBUS && FB && INPUT depends on UNISYSSPAR && UNISYS_VISORBUS && INPUT
---help--- ---help---
The Unisys s-Par visorinput driver provides a virtualized system The Unisys s-Par visorinput driver provides a virtualized system
console (keyboard and mouse) that is accessible through the console (keyboard and mouse) that is accessible through the
......
...@@ -32,10 +32,24 @@ ...@@ -32,10 +32,24 @@
0x81, 0xc3, 0x61, 0xab, 0xcd, 0xbd, 0xbd, 0x87) 0x81, 0xc3, 0x61, 0xab, 0xcd, 0xbd, 0xbd, 0x87)
#define VISOR_MOUSE_CHANNEL_GUID_STR "addf07d4-94a9-46e2-81c3-61abcdbdbd87" #define VISOR_MOUSE_CHANNEL_GUID_STR "addf07d4-94a9-46e2-81c3-61abcdbdbd87"
#define PIXELS_ACROSS_DEFAULT 800 #define PIXELS_ACROSS_DEFAULT 1024
#define PIXELS_DOWN_DEFAULT 600 #define PIXELS_DOWN_DEFAULT 768
#define KEYCODE_TABLE_BYTES 256 #define KEYCODE_TABLE_BYTES 256
/* header of keyboard/mouse channels */
struct visor_input_channel_data {
u32 n_input_reports;
union {
struct {
u16 x_res;
u16 y_res;
} mouse;
struct {
u32 flags;
} keyboard;
};
} __packed;
enum visorinput_device_type { enum visorinput_device_type {
visorinput_keyboard, visorinput_keyboard,
visorinput_mouse, visorinput_mouse,
...@@ -306,10 +320,9 @@ static struct input_dev *setup_client_keyboard(void *devdata, ...@@ -306,10 +320,9 @@ static struct input_dev *setup_client_keyboard(void *devdata,
return visorinput_dev; return visorinput_dev;
} }
static struct input_dev *setup_client_mouse(void *devdata) static struct input_dev *setup_client_mouse(void *devdata, unsigned int xres,
unsigned int yres)
{ {
int xres, yres;
struct fb_info *fb0;
struct input_dev *visorinput_dev = input_allocate_device(); struct input_dev *visorinput_dev = input_allocate_device();
if (!visorinput_dev) if (!visorinput_dev)
...@@ -327,14 +340,10 @@ static struct input_dev *setup_client_mouse(void *devdata) ...@@ -327,14 +340,10 @@ static struct input_dev *setup_client_mouse(void *devdata)
set_bit(BTN_RIGHT, visorinput_dev->keybit); set_bit(BTN_RIGHT, visorinput_dev->keybit);
set_bit(BTN_MIDDLE, visorinput_dev->keybit); set_bit(BTN_MIDDLE, visorinput_dev->keybit);
if (registered_fb[0]) { if (xres == 0)
fb0 = registered_fb[0];
xres = fb0->var.xres_virtual;
yres = fb0->var.yres_virtual;
} else {
xres = PIXELS_ACROSS_DEFAULT; xres = PIXELS_ACROSS_DEFAULT;
if (yres == 0)
yres = PIXELS_DOWN_DEFAULT; yres = PIXELS_DOWN_DEFAULT;
}
input_set_abs_params(visorinput_dev, ABS_X, 0, xres, 0, 0); input_set_abs_params(visorinput_dev, ABS_X, 0, xres, 0, 0);
input_set_abs_params(visorinput_dev, ABS_Y, 0, yres, 0, 0); input_set_abs_params(visorinput_dev, ABS_Y, 0, yres, 0, 0);
...@@ -353,6 +362,8 @@ static struct visorinput_devdata *devdata_create( ...@@ -353,6 +362,8 @@ static struct visorinput_devdata *devdata_create(
{ {
struct visorinput_devdata *devdata = NULL; struct visorinput_devdata *devdata = NULL;
unsigned int extra_bytes = 0; unsigned int extra_bytes = 0;
unsigned int size, xres, yres, err;
struct visor_input_channel_data data;
if (devtype == visorinput_keyboard) if (devtype == visorinput_keyboard)
/* allocate room for devdata->keycode_table, filled in below */ /* allocate room for devdata->keycode_table, filled in below */
...@@ -390,7 +401,15 @@ static struct visorinput_devdata *devdata_create( ...@@ -390,7 +401,15 @@ static struct visorinput_devdata *devdata_create(
goto cleanups_register; goto cleanups_register;
break; break;
case visorinput_mouse: case visorinput_mouse:
devdata->visorinput_dev = setup_client_mouse(devdata); size = sizeof(struct visor_input_channel_data);
err = visorbus_read_channel(dev, sizeof(struct channel_header),
&data, size);
if (err)
goto cleanups_register;
xres = data.mouse.x_res;
yres = data.mouse.y_res;
devdata->visorinput_dev = setup_client_mouse(devdata, xres,
yres);
if (!devdata->visorinput_dev) if (!devdata->visorinput_dev)
goto cleanups_register; goto cleanups_register;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment