| .. | .. |
|---|
| 53 | 53 | #include "sisusb.h" |
|---|
| 54 | 54 | #include "sisusb_init.h" |
|---|
| 55 | 55 | |
|---|
| 56 | | -#ifdef INCL_SISUSB_CON |
|---|
| 56 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 57 | 57 | #include <linux/font.h> |
|---|
| 58 | 58 | #endif |
|---|
| 59 | 59 | |
|---|
| .. | .. |
|---|
| 61 | 61 | |
|---|
| 62 | 62 | /* Forward declarations / clean-up routines */ |
|---|
| 63 | 63 | |
|---|
| 64 | | -#ifdef INCL_SISUSB_CON |
|---|
| 64 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 65 | 65 | static int sisusb_first_vc; |
|---|
| 66 | 66 | static int sisusb_last_vc; |
|---|
| 67 | 67 | module_param_named(first, sisusb_first_vc, int, 0); |
|---|
| .. | .. |
|---|
| 1198 | 1198 | |
|---|
| 1199 | 1199 | /* High level: Gfx (indexed) register access */ |
|---|
| 1200 | 1200 | |
|---|
| 1201 | | -#ifdef INCL_SISUSB_CON |
|---|
| 1201 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 1202 | 1202 | int sisusb_setreg(struct sisusb_usb_data *sisusb, u32 port, u8 data) |
|---|
| 1203 | 1203 | { |
|---|
| 1204 | 1204 | return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); |
|---|
| .. | .. |
|---|
| 1272 | 1272 | |
|---|
| 1273 | 1273 | /* Write/read video ram */ |
|---|
| 1274 | 1274 | |
|---|
| 1275 | | -#ifdef INCL_SISUSB_CON |
|---|
| 1275 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 1276 | 1276 | int sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data) |
|---|
| 1277 | 1277 | { |
|---|
| 1278 | 1278 | return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data); |
|---|
| .. | .. |
|---|
| 1283 | 1283 | return sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data); |
|---|
| 1284 | 1284 | } |
|---|
| 1285 | 1285 | |
|---|
| 1286 | | -int sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src, |
|---|
| 1286 | +int sisusb_copy_memory(struct sisusb_usb_data *sisusb, u8 *src, |
|---|
| 1287 | 1287 | u32 dest, int length) |
|---|
| 1288 | 1288 | { |
|---|
| 1289 | 1289 | size_t dummy; |
|---|
| .. | .. |
|---|
| 1307 | 1307 | #ifdef SISUSBENDIANTEST |
|---|
| 1308 | 1308 | static void sisusb_testreadwrite(struct sisusb_usb_data *sisusb) |
|---|
| 1309 | 1309 | { |
|---|
| 1310 | | - static char srcbuffer[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }; |
|---|
| 1310 | + static u8 srcbuffer[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }; |
|---|
| 1311 | 1311 | char destbuffer[10]; |
|---|
| 1312 | 1312 | int i, j; |
|---|
| 1313 | 1313 | |
|---|
| .. | .. |
|---|
| 1747 | 1747 | return ret; |
|---|
| 1748 | 1748 | } |
|---|
| 1749 | 1749 | |
|---|
| 1750 | | -static int sisusb_set_default_mode(struct sisusb_usb_data *sisusb, |
|---|
| 1750 | +static void sisusb_set_default_mode(struct sisusb_usb_data *sisusb, |
|---|
| 1751 | 1751 | int touchengines) |
|---|
| 1752 | 1752 | { |
|---|
| 1753 | | - int ret = 0, i, j, modex, bpp, du; |
|---|
| 1753 | + int i, j, modex, bpp, du; |
|---|
| 1754 | 1754 | u8 sr31, cr63, tmp8; |
|---|
| 1755 | 1755 | static const char attrdata[] = { |
|---|
| 1756 | 1756 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
|---|
| .. | .. |
|---|
| 1873 | 1873 | } |
|---|
| 1874 | 1874 | |
|---|
| 1875 | 1875 | SETIREG(SISCR, 0x34, 0x44); /* we just set std mode #44 */ |
|---|
| 1876 | | - |
|---|
| 1877 | | - return ret; |
|---|
| 1878 | 1876 | } |
|---|
| 1879 | 1877 | |
|---|
| 1880 | 1878 | static int sisusb_init_gfxcore(struct sisusb_usb_data *sisusb) |
|---|
| .. | .. |
|---|
| 2019 | 2017 | |
|---|
| 2020 | 2018 | ret |= SETIREG(SISCR, 0x83, 0x00); |
|---|
| 2021 | 2019 | |
|---|
| 2022 | | - ret |= sisusb_set_default_mode(sisusb, 0); |
|---|
| 2020 | + sisusb_set_default_mode(sisusb, 0); |
|---|
| 2023 | 2021 | |
|---|
| 2024 | 2022 | ret |= SETIREGAND(SISSR, 0x21, 0xdf); |
|---|
| 2025 | 2023 | ret |= SETIREGOR(SISSR, 0x01, 0x20); |
|---|
| .. | .. |
|---|
| 2246 | 2244 | if (sisusb_init_gfxcore(sisusb) == 0) { |
|---|
| 2247 | 2245 | sisusb->gfxinit = 1; |
|---|
| 2248 | 2246 | sisusb_get_ramconfig(sisusb); |
|---|
| 2249 | | - ret |= sisusb_set_default_mode(sisusb, 1); |
|---|
| 2247 | + sisusb_set_default_mode(sisusb, 1); |
|---|
| 2250 | 2248 | ret |= sisusb_setup_screen(sisusb, 1, initscreen); |
|---|
| 2251 | 2249 | } |
|---|
| 2252 | 2250 | } |
|---|
| .. | .. |
|---|
| 2255 | 2253 | } |
|---|
| 2256 | 2254 | |
|---|
| 2257 | 2255 | |
|---|
| 2258 | | -#ifdef INCL_SISUSB_CON |
|---|
| 2256 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 2259 | 2257 | |
|---|
| 2260 | 2258 | /* Set up default text mode: |
|---|
| 2261 | 2259 | * - Set text mode (0x03) |
|---|
| .. | .. |
|---|
| 2342 | 2340 | } |
|---|
| 2343 | 2341 | |
|---|
| 2344 | 2342 | } else if (sisusb->scrbuf) { |
|---|
| 2345 | | - ret |= sisusb_copy_memory(sisusb, (char *)sisusb->scrbuf, |
|---|
| 2343 | + ret |= sisusb_copy_memory(sisusb, (u8 *)sisusb->scrbuf, |
|---|
| 2346 | 2344 | sisusb->vrambase, sisusb->scrbuf_size); |
|---|
| 2347 | 2345 | } |
|---|
| 2348 | 2346 | |
|---|
| .. | .. |
|---|
| 2448 | 2446 | sisusb->sisusb_dev = NULL; |
|---|
| 2449 | 2447 | sisusb_free_buffers(sisusb); |
|---|
| 2450 | 2448 | sisusb_free_urbs(sisusb); |
|---|
| 2451 | | -#ifdef INCL_SISUSB_CON |
|---|
| 2449 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 2452 | 2450 | kfree(sisusb->SiS_Pr); |
|---|
| 2453 | 2451 | #endif |
|---|
| 2454 | 2452 | kfree(sisusb); |
|---|
| .. | .. |
|---|
| 2844 | 2842 | |
|---|
| 2845 | 2843 | case SUCMD_HANDLETEXTMODE: |
|---|
| 2846 | 2844 | retval = 0; |
|---|
| 2847 | | -#ifdef INCL_SISUSB_CON |
|---|
| 2845 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 2848 | 2846 | /* Gfx core must be initialized, SiS_Pr must exist */ |
|---|
| 2849 | 2847 | if (!sisusb->gfxinit || !sisusb->SiS_Pr) |
|---|
| 2850 | 2848 | return -ENODEV; |
|---|
| .. | .. |
|---|
| 2860 | 2858 | #endif |
|---|
| 2861 | 2859 | break; |
|---|
| 2862 | 2860 | |
|---|
| 2863 | | -#ifdef INCL_SISUSB_CON |
|---|
| 2861 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 2864 | 2862 | case SUCMD_SETMODE: |
|---|
| 2865 | 2863 | /* Gfx core must be initialized, SiS_Pr must exist */ |
|---|
| 2866 | 2864 | if (!sisusb->gfxinit || !sisusb->SiS_Pr) |
|---|
| .. | .. |
|---|
| 2944 | 2942 | x.sisusb_vramsize = sisusb->vramsize; |
|---|
| 2945 | 2943 | x.sisusb_minor = sisusb->minor; |
|---|
| 2946 | 2944 | x.sisusb_fbdevactive = 0; |
|---|
| 2947 | | -#ifdef INCL_SISUSB_CON |
|---|
| 2945 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 2948 | 2946 | x.sisusb_conactive = sisusb->haveconsole ? 1 : 0; |
|---|
| 2949 | 2947 | #else |
|---|
| 2950 | 2948 | x.sisusb_conactive = 0; |
|---|
| .. | .. |
|---|
| 2975 | 2973 | return retval; |
|---|
| 2976 | 2974 | } |
|---|
| 2977 | 2975 | |
|---|
| 2978 | | -#ifdef SISUSB_NEW_CONFIG_COMPAT |
|---|
| 2976 | +#ifdef CONFIG_COMPAT |
|---|
| 2979 | 2977 | static long sisusb_compat_ioctl(struct file *f, unsigned int cmd, |
|---|
| 2980 | 2978 | unsigned long arg) |
|---|
| 2981 | 2979 | { |
|---|
| .. | .. |
|---|
| 2998 | 2996 | .read = sisusb_read, |
|---|
| 2999 | 2997 | .write = sisusb_write, |
|---|
| 3000 | 2998 | .llseek = sisusb_lseek, |
|---|
| 3001 | | -#ifdef SISUSB_NEW_CONFIG_COMPAT |
|---|
| 2999 | +#ifdef CONFIG_COMPAT |
|---|
| 3002 | 3000 | .compat_ioctl = sisusb_compat_ioctl, |
|---|
| 3003 | 3001 | #endif |
|---|
| 3004 | 3002 | .unlocked_ioctl = sisusb_ioctl |
|---|
| .. | .. |
|---|
| 3092 | 3090 | dev_info(&sisusb->sisusb_dev->dev, "Allocated %d output buffers\n", |
|---|
| 3093 | 3091 | sisusb->numobufs); |
|---|
| 3094 | 3092 | |
|---|
| 3095 | | -#ifdef INCL_SISUSB_CON |
|---|
| 3093 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 3096 | 3094 | /* Allocate our SiS_Pr */ |
|---|
| 3097 | 3095 | sisusb->SiS_Pr = kmalloc(sizeof(struct SiS_Private), GFP_KERNEL); |
|---|
| 3098 | 3096 | if (!sisusb->SiS_Pr) { |
|---|
| .. | .. |
|---|
| 3113 | 3111 | |
|---|
| 3114 | 3112 | if (dev->speed == USB_SPEED_HIGH || dev->speed >= USB_SPEED_SUPER) { |
|---|
| 3115 | 3113 | int initscreen = 1; |
|---|
| 3116 | | -#ifdef INCL_SISUSB_CON |
|---|
| 3114 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 3117 | 3115 | if (sisusb_first_vc > 0 && sisusb_last_vc > 0 && |
|---|
| 3118 | 3116 | sisusb_first_vc <= sisusb_last_vc && |
|---|
| 3119 | 3117 | sisusb_last_vc <= MAX_NR_CONSOLES) |
|---|
| .. | .. |
|---|
| 3135 | 3133 | dev_dbg(&sisusb->sisusb_dev->dev, "*** RWTEST END ***\n"); |
|---|
| 3136 | 3134 | #endif |
|---|
| 3137 | 3135 | |
|---|
| 3138 | | -#ifdef INCL_SISUSB_CON |
|---|
| 3136 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 3139 | 3137 | sisusb_console_init(sisusb, sisusb_first_vc, sisusb_last_vc); |
|---|
| 3140 | 3138 | #endif |
|---|
| 3141 | 3139 | |
|---|
| .. | .. |
|---|
| 3161 | 3159 | if (!sisusb) |
|---|
| 3162 | 3160 | return; |
|---|
| 3163 | 3161 | |
|---|
| 3164 | | -#ifdef INCL_SISUSB_CON |
|---|
| 3162 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 3165 | 3163 | sisusb_console_exit(sisusb); |
|---|
| 3166 | 3164 | #endif |
|---|
| 3167 | 3165 | |
|---|
| .. | .. |
|---|
| 3211 | 3209 | static int __init usb_sisusb_init(void) |
|---|
| 3212 | 3210 | { |
|---|
| 3213 | 3211 | |
|---|
| 3214 | | -#ifdef INCL_SISUSB_CON |
|---|
| 3212 | +#ifdef CONFIG_USB_SISUSBVGA_CON |
|---|
| 3215 | 3213 | sisusb_init_concode(); |
|---|
| 3216 | 3214 | #endif |
|---|
| 3217 | 3215 | |
|---|