diff options
author | Tim Sell <Timothy.Sell@unisys.com> | 2018-01-31 11:41:12 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-02-16 15:42:22 +0100 |
commit | 385a9cb3471c79289a1ee90dd2c381405d3615d9 (patch) | |
tree | c0932157a8d364109000fe9033b265a742574d65 /drivers/staging | |
parent | 17eb0b29c2604f09b346e8de695dc81b84afd1bd (diff) |
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: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/unisys/visorinput/Kconfig | 2 | ||||
-rw-r--r-- | drivers/staging/unisys/visorinput/visorinput.c | 43 |
2 files changed, 32 insertions, 13 deletions
diff --git a/drivers/staging/unisys/visorinput/Kconfig b/drivers/staging/unisys/visorinput/Kconfig index 655cd62433de..a3817e0f7e5c 100644 --- a/drivers/staging/unisys/visorinput/Kconfig +++ b/drivers/staging/unisys/visorinput/Kconfig @@ -4,7 +4,7 @@ config UNISYS_VISORINPUT tristate "Unisys visorinput driver" - depends on UNISYSSPAR && UNISYS_VISORBUS && FB && INPUT + depends on UNISYSSPAR && UNISYS_VISORBUS && INPUT ---help--- The Unisys s-Par visorinput driver provides a virtualized system console (keyboard and mouse) that is accessible through the diff --git a/drivers/staging/unisys/visorinput/visorinput.c b/drivers/staging/unisys/visorinput/visorinput.c index d8048e48658f..99730409bd7f 100644 --- a/drivers/staging/unisys/visorinput/visorinput.c +++ b/drivers/staging/unisys/visorinput/visorinput.c @@ -32,10 +32,24 @@ 0x81, 0xc3, 0x61, 0xab, 0xcd, 0xbd, 0xbd, 0x87) #define VISOR_MOUSE_CHANNEL_GUID_STR "addf07d4-94a9-46e2-81c3-61abcdbdbd87" -#define PIXELS_ACROSS_DEFAULT 800 -#define PIXELS_DOWN_DEFAULT 600 +#define PIXELS_ACROSS_DEFAULT 1024 +#define PIXELS_DOWN_DEFAULT 768 #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 { visorinput_keyboard, visorinput_mouse, @@ -306,10 +320,9 @@ static struct input_dev *setup_client_keyboard(void *devdata, 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(); if (!visorinput_dev) @@ -327,14 +340,10 @@ static struct input_dev *setup_client_mouse(void *devdata) set_bit(BTN_RIGHT, visorinput_dev->keybit); set_bit(BTN_MIDDLE, visorinput_dev->keybit); - if (registered_fb[0]) { - fb0 = registered_fb[0]; - xres = fb0->var.xres_virtual; - yres = fb0->var.yres_virtual; - } else { + if (xres == 0) xres = PIXELS_ACROSS_DEFAULT; + if (yres == 0) yres = PIXELS_DOWN_DEFAULT; - } input_set_abs_params(visorinput_dev, ABS_X, 0, xres, 0, 0); input_set_abs_params(visorinput_dev, ABS_Y, 0, yres, 0, 0); @@ -353,6 +362,8 @@ static struct visorinput_devdata *devdata_create( { struct visorinput_devdata *devdata = NULL; unsigned int extra_bytes = 0; + unsigned int size, xres, yres, err; + struct visor_input_channel_data data; if (devtype == visorinput_keyboard) /* allocate room for devdata->keycode_table, filled in below */ @@ -390,7 +401,15 @@ static struct visorinput_devdata *devdata_create( goto cleanups_register; break; 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) goto cleanups_register; break; |