diff options
Diffstat (limited to 'drivers')
219 files changed, 6870 insertions, 3121 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 1bcecc7dd2ca..766bd25d3376 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -1710,7 +1710,6 @@ static int acpi_thermal_resume(struct acpi_device *device) | |||
1710 | return AE_OK; | 1710 | return AE_OK; |
1711 | } | 1711 | } |
1712 | 1712 | ||
1713 | #ifdef CONFIG_DMI | ||
1714 | static int thermal_act(const struct dmi_system_id *d) { | 1713 | static int thermal_act(const struct dmi_system_id *d) { |
1715 | 1714 | ||
1716 | if (act == 0) { | 1715 | if (act == 0) { |
@@ -1785,7 +1784,6 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = { | |||
1785 | }, | 1784 | }, |
1786 | {} | 1785 | {} |
1787 | }; | 1786 | }; |
1788 | #endif /* CONFIG_DMI */ | ||
1789 | 1787 | ||
1790 | static int __init acpi_thermal_init(void) | 1788 | static int __init acpi_thermal_init(void) |
1791 | { | 1789 | { |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index fddd346b1d57..853559e32315 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -678,7 +678,7 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap) | |||
678 | return ata_dev_classify(&tf); | 678 | return ata_dev_classify(&tf); |
679 | } | 679 | } |
680 | 680 | ||
681 | static int sata_fsl_prereset(struct ata_linke *link, unsigned long deadline) | 681 | static int sata_fsl_prereset(struct ata_link *link, unsigned long deadline) |
682 | { | 682 | { |
683 | /* FIXME: Never skip softreset, sata_fsl_softreset() is | 683 | /* FIXME: Never skip softreset, sata_fsl_softreset() is |
684 | * combination of soft and hard resets. sata_fsl_softreset() | 684 | * combination of soft and hard resets. sata_fsl_softreset() |
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index 7bd76639544c..e8e38faeafd8 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c | |||
@@ -319,7 +319,7 @@ out: | |||
319 | 319 | ||
320 | #ifdef CONFIG_BLK_DEV_XIP | 320 | #ifdef CONFIG_BLK_DEV_XIP |
321 | static int brd_direct_access (struct block_device *bdev, sector_t sector, | 321 | static int brd_direct_access (struct block_device *bdev, sector_t sector, |
322 | unsigned long *data) | 322 | void **kaddr, unsigned long *pfn) |
323 | { | 323 | { |
324 | struct brd_device *brd = bdev->bd_disk->private_data; | 324 | struct brd_device *brd = bdev->bd_disk->private_data; |
325 | struct page *page; | 325 | struct page *page; |
@@ -333,7 +333,8 @@ static int brd_direct_access (struct block_device *bdev, sector_t sector, | |||
333 | page = brd_insert_page(brd, sector); | 333 | page = brd_insert_page(brd, sector); |
334 | if (!page) | 334 | if (!page) |
335 | return -ENOMEM; | 335 | return -ENOMEM; |
336 | *data = (unsigned long)page_address(page); | 336 | *kaddr = page_address(page); |
337 | *pfn = page_to_pfn(page); | ||
337 | 338 | ||
338 | return 0; | 339 | return 0; |
339 | } | 340 | } |
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 2906ee7bd298..929d4fa73fd9 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -732,9 +732,16 @@ config NVRAM | |||
732 | To compile this driver as a module, choose M here: the | 732 | To compile this driver as a module, choose M here: the |
733 | module will be called nvram. | 733 | module will be called nvram. |
734 | 734 | ||
735 | # | ||
736 | # These legacy RTC drivers just cause too many conflicts with the generic | ||
737 | # RTC framework ... let's not even try to coexist any more. | ||
738 | # | ||
739 | if RTC_LIB=n | ||
740 | |||
735 | config RTC | 741 | config RTC |
736 | tristate "Enhanced Real Time Clock Support" | 742 | tristate "Enhanced Real Time Clock Support" |
737 | depends on !PPC && !PARISC && !IA64 && !M68K && !SPARC && !FRV && !ARM && !SUPERH && !S390 && !AVR32 | 743 | depends on !PPC && !PARISC && !IA64 && !M68K && !SPARC && !FRV \ |
744 | && !ARM && !SUPERH && !S390 && !AVR32 | ||
738 | ---help--- | 745 | ---help--- |
739 | If you say Y here and create a character special file /dev/rtc with | 746 | If you say Y here and create a character special file /dev/rtc with |
740 | major number 10 and minor number 135 using mknod ("man mknod"), you | 747 | major number 10 and minor number 135 using mknod ("man mknod"), you |
@@ -840,6 +847,8 @@ config DS1302 | |||
840 | will get access to the real time clock (or hardware clock) built | 847 | will get access to the real time clock (or hardware clock) built |
841 | into your computer. | 848 | into your computer. |
842 | 849 | ||
850 | endif # RTC_LIB | ||
851 | |||
843 | config COBALT_LCD | 852 | config COBALT_LCD |
844 | bool "Support for Cobalt LCD" | 853 | bool "Support for Cobalt LCD" |
845 | depends on MIPS_COBALT | 854 | depends on MIPS_COBALT |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 4e84d233e5a2..583356426dfb 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -189,20 +189,20 @@ typedef struct _mgslpc_info { | |||
189 | 189 | ||
190 | u32 pending_bh; | 190 | u32 pending_bh; |
191 | 191 | ||
192 | int bh_running; | 192 | bool bh_running; |
193 | int bh_requested; | 193 | bool bh_requested; |
194 | 194 | ||
195 | int dcd_chkcount; /* check counts to prevent */ | 195 | int dcd_chkcount; /* check counts to prevent */ |
196 | int cts_chkcount; /* too many IRQs if a signal */ | 196 | int cts_chkcount; /* too many IRQs if a signal */ |
197 | int dsr_chkcount; /* is floating */ | 197 | int dsr_chkcount; /* is floating */ |
198 | int ri_chkcount; | 198 | int ri_chkcount; |
199 | 199 | ||
200 | int rx_enabled; | 200 | bool rx_enabled; |
201 | int rx_overflow; | 201 | bool rx_overflow; |
202 | 202 | ||
203 | int tx_enabled; | 203 | bool tx_enabled; |
204 | int tx_active; | 204 | bool tx_active; |
205 | int tx_aborting; | 205 | bool tx_aborting; |
206 | u32 idle_mode; | 206 | u32 idle_mode; |
207 | 207 | ||
208 | int if_mode; /* serial interface selection (RS-232, v.35 etc) */ | 208 | int if_mode; /* serial interface selection (RS-232, v.35 etc) */ |
@@ -216,12 +216,12 @@ typedef struct _mgslpc_info { | |||
216 | 216 | ||
217 | unsigned char serial_signals; /* current serial signal states */ | 217 | unsigned char serial_signals; /* current serial signal states */ |
218 | 218 | ||
219 | char irq_occurred; /* for diagnostics use */ | 219 | bool irq_occurred; /* for diagnostics use */ |
220 | char testing_irq; | 220 | char testing_irq; |
221 | unsigned int init_error; /* startup error (DIAGS) */ | 221 | unsigned int init_error; /* startup error (DIAGS) */ |
222 | 222 | ||
223 | char flag_buf[MAX_ASYNC_BUFFER_SIZE]; | 223 | char flag_buf[MAX_ASYNC_BUFFER_SIZE]; |
224 | BOOLEAN drop_rts_on_tx_done; | 224 | bool drop_rts_on_tx_done; |
225 | 225 | ||
226 | struct _input_signal_events input_signal_events; | 226 | struct _input_signal_events input_signal_events; |
227 | 227 | ||
@@ -402,8 +402,8 @@ static void hdlcdev_exit(MGSLPC_INFO *info); | |||
402 | 402 | ||
403 | static void trace_block(MGSLPC_INFO *info,const char* data, int count, int xmit); | 403 | static void trace_block(MGSLPC_INFO *info,const char* data, int count, int xmit); |
404 | 404 | ||
405 | static BOOLEAN register_test(MGSLPC_INFO *info); | 405 | static bool register_test(MGSLPC_INFO *info); |
406 | static BOOLEAN irq_test(MGSLPC_INFO *info); | 406 | static bool irq_test(MGSLPC_INFO *info); |
407 | static int adapter_test(MGSLPC_INFO *info); | 407 | static int adapter_test(MGSLPC_INFO *info); |
408 | 408 | ||
409 | static int claim_resources(MGSLPC_INFO *info); | 409 | static int claim_resources(MGSLPC_INFO *info); |
@@ -411,7 +411,7 @@ static void release_resources(MGSLPC_INFO *info); | |||
411 | static void mgslpc_add_device(MGSLPC_INFO *info); | 411 | static void mgslpc_add_device(MGSLPC_INFO *info); |
412 | static void mgslpc_remove_device(MGSLPC_INFO *info); | 412 | static void mgslpc_remove_device(MGSLPC_INFO *info); |
413 | 413 | ||
414 | static int rx_get_frame(MGSLPC_INFO *info); | 414 | static bool rx_get_frame(MGSLPC_INFO *info); |
415 | static void rx_reset_buffers(MGSLPC_INFO *info); | 415 | static void rx_reset_buffers(MGSLPC_INFO *info); |
416 | static int rx_alloc_buffers(MGSLPC_INFO *info); | 416 | static int rx_alloc_buffers(MGSLPC_INFO *info); |
417 | static void rx_free_buffers(MGSLPC_INFO *info); | 417 | static void rx_free_buffers(MGSLPC_INFO *info); |
@@ -719,7 +719,7 @@ static int mgslpc_resume(struct pcmcia_device *link) | |||
719 | } | 719 | } |
720 | 720 | ||
721 | 721 | ||
722 | static inline int mgslpc_paranoia_check(MGSLPC_INFO *info, | 722 | static inline bool mgslpc_paranoia_check(MGSLPC_INFO *info, |
723 | char *name, const char *routine) | 723 | char *name, const char *routine) |
724 | { | 724 | { |
725 | #ifdef MGSLPC_PARANOIA_CHECK | 725 | #ifdef MGSLPC_PARANOIA_CHECK |
@@ -730,17 +730,17 @@ static inline int mgslpc_paranoia_check(MGSLPC_INFO *info, | |||
730 | 730 | ||
731 | if (!info) { | 731 | if (!info) { |
732 | printk(badinfo, name, routine); | 732 | printk(badinfo, name, routine); |
733 | return 1; | 733 | return true; |
734 | } | 734 | } |
735 | if (info->magic != MGSLPC_MAGIC) { | 735 | if (info->magic != MGSLPC_MAGIC) { |
736 | printk(badmagic, name, routine); | 736 | printk(badmagic, name, routine); |
737 | return 1; | 737 | return true; |
738 | } | 738 | } |
739 | #else | 739 | #else |
740 | if (!info) | 740 | if (!info) |
741 | return 1; | 741 | return true; |
742 | #endif | 742 | #endif |
743 | return 0; | 743 | return false; |
744 | } | 744 | } |
745 | 745 | ||
746 | 746 | ||
@@ -752,16 +752,16 @@ static inline int mgslpc_paranoia_check(MGSLPC_INFO *info, | |||
752 | #define CMD_TXEOM BIT1 // transmit end message | 752 | #define CMD_TXEOM BIT1 // transmit end message |
753 | #define CMD_TXRESET BIT0 // transmit reset | 753 | #define CMD_TXRESET BIT0 // transmit reset |
754 | 754 | ||
755 | static BOOLEAN wait_command_complete(MGSLPC_INFO *info, unsigned char channel) | 755 | static bool wait_command_complete(MGSLPC_INFO *info, unsigned char channel) |
756 | { | 756 | { |
757 | int i = 0; | 757 | int i = 0; |
758 | /* wait for command completion */ | 758 | /* wait for command completion */ |
759 | while (read_reg(info, (unsigned char)(channel+STAR)) & BIT2) { | 759 | while (read_reg(info, (unsigned char)(channel+STAR)) & BIT2) { |
760 | udelay(1); | 760 | udelay(1); |
761 | if (i++ == 1000) | 761 | if (i++ == 1000) |
762 | return FALSE; | 762 | return false; |
763 | } | 763 | } |
764 | return TRUE; | 764 | return true; |
765 | } | 765 | } |
766 | 766 | ||
767 | static void issue_command(MGSLPC_INFO *info, unsigned char channel, unsigned char cmd) | 767 | static void issue_command(MGSLPC_INFO *info, unsigned char channel, unsigned char cmd) |
@@ -825,8 +825,8 @@ static int bh_action(MGSLPC_INFO *info) | |||
825 | 825 | ||
826 | if (!rc) { | 826 | if (!rc) { |
827 | /* Mark BH routine as complete */ | 827 | /* Mark BH routine as complete */ |
828 | info->bh_running = 0; | 828 | info->bh_running = false; |
829 | info->bh_requested = 0; | 829 | info->bh_requested = false; |
830 | } | 830 | } |
831 | 831 | ||
832 | spin_unlock_irqrestore(&info->lock,flags); | 832 | spin_unlock_irqrestore(&info->lock,flags); |
@@ -846,7 +846,7 @@ static void bh_handler(struct work_struct *work) | |||
846 | printk( "%s(%d):bh_handler(%s) entry\n", | 846 | printk( "%s(%d):bh_handler(%s) entry\n", |
847 | __FILE__,__LINE__,info->device_name); | 847 | __FILE__,__LINE__,info->device_name); |
848 | 848 | ||
849 | info->bh_running = 1; | 849 | info->bh_running = true; |
850 | 850 | ||
851 | while((action = bh_action(info)) != 0) { | 851 | while((action = bh_action(info)) != 0) { |
852 | 852 | ||
@@ -913,7 +913,7 @@ static void rx_ready_hdlc(MGSLPC_INFO *info, int eom) | |||
913 | /* no more free buffers */ | 913 | /* no more free buffers */ |
914 | issue_command(info, CHA, CMD_RXRESET); | 914 | issue_command(info, CHA, CMD_RXRESET); |
915 | info->pending_bh |= BH_RECEIVE; | 915 | info->pending_bh |= BH_RECEIVE; |
916 | info->rx_overflow = 1; | 916 | info->rx_overflow = true; |
917 | info->icount.buf_overrun++; | 917 | info->icount.buf_overrun++; |
918 | return; | 918 | return; |
919 | } | 919 | } |
@@ -1032,8 +1032,8 @@ static void tx_done(MGSLPC_INFO *info) | |||
1032 | if (!info->tx_active) | 1032 | if (!info->tx_active) |
1033 | return; | 1033 | return; |
1034 | 1034 | ||
1035 | info->tx_active = 0; | 1035 | info->tx_active = false; |
1036 | info->tx_aborting = 0; | 1036 | info->tx_aborting = false; |
1037 | 1037 | ||
1038 | if (info->params.mode == MGSL_MODE_ASYNC) | 1038 | if (info->params.mode == MGSL_MODE_ASYNC) |
1039 | return; | 1039 | return; |
@@ -1047,7 +1047,7 @@ static void tx_done(MGSLPC_INFO *info) | |||
1047 | info->serial_signals &= ~SerialSignal_RTS; | 1047 | info->serial_signals &= ~SerialSignal_RTS; |
1048 | set_signals(info); | 1048 | set_signals(info); |
1049 | } | 1049 | } |
1050 | info->drop_rts_on_tx_done = 0; | 1050 | info->drop_rts_on_tx_done = false; |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | #if SYNCLINK_GENERIC_HDLC | 1053 | #if SYNCLINK_GENERIC_HDLC |
@@ -1081,7 +1081,7 @@ static void tx_ready(MGSLPC_INFO *info) | |||
1081 | return; | 1081 | return; |
1082 | } | 1082 | } |
1083 | if (!info->tx_count) | 1083 | if (!info->tx_count) |
1084 | info->tx_active = 0; | 1084 | info->tx_active = false; |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | if (!info->tx_count) | 1087 | if (!info->tx_count) |
@@ -1261,7 +1261,7 @@ static irqreturn_t mgslpc_isr(int dummy, void *dev_id) | |||
1261 | { | 1261 | { |
1262 | isr = read_reg16(info, CHA + ISR); | 1262 | isr = read_reg16(info, CHA + ISR); |
1263 | if (isr & IRQ_TIMER) { | 1263 | if (isr & IRQ_TIMER) { |
1264 | info->irq_occurred = 1; | 1264 | info->irq_occurred = true; |
1265 | irq_disable(info, CHA, IRQ_TIMER); | 1265 | irq_disable(info, CHA, IRQ_TIMER); |
1266 | } | 1266 | } |
1267 | 1267 | ||
@@ -1318,7 +1318,7 @@ static irqreturn_t mgslpc_isr(int dummy, void *dev_id) | |||
1318 | printk("%s(%d):%s queueing bh task.\n", | 1318 | printk("%s(%d):%s queueing bh task.\n", |
1319 | __FILE__,__LINE__,info->device_name); | 1319 | __FILE__,__LINE__,info->device_name); |
1320 | schedule_work(&info->task); | 1320 | schedule_work(&info->task); |
1321 | info->bh_requested = 1; | 1321 | info->bh_requested = true; |
1322 | } | 1322 | } |
1323 | 1323 | ||
1324 | spin_unlock(&info->lock); | 1324 | spin_unlock(&info->lock); |
@@ -1990,7 +1990,7 @@ static int tx_abort(MGSLPC_INFO * info) | |||
1990 | * This results in underrun and abort transmission. | 1990 | * This results in underrun and abort transmission. |
1991 | */ | 1991 | */ |
1992 | info->tx_count = info->tx_put = info->tx_get = 0; | 1992 | info->tx_count = info->tx_put = info->tx_get = 0; |
1993 | info->tx_aborting = TRUE; | 1993 | info->tx_aborting = true; |
1994 | } | 1994 | } |
1995 | spin_unlock_irqrestore(&info->lock,flags); | 1995 | spin_unlock_irqrestore(&info->lock,flags); |
1996 | return 0; | 1996 | return 0; |
@@ -2589,7 +2589,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2589 | { | 2589 | { |
2590 | DECLARE_WAITQUEUE(wait, current); | 2590 | DECLARE_WAITQUEUE(wait, current); |
2591 | int retval; | 2591 | int retval; |
2592 | int do_clocal = 0, extra_count = 0; | 2592 | bool do_clocal = false; |
2593 | bool extra_count = false; | ||
2593 | unsigned long flags; | 2594 | unsigned long flags; |
2594 | 2595 | ||
2595 | if (debug_level >= DEBUG_LEVEL_INFO) | 2596 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -2604,7 +2605,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2604 | } | 2605 | } |
2605 | 2606 | ||
2606 | if (tty->termios->c_cflag & CLOCAL) | 2607 | if (tty->termios->c_cflag & CLOCAL) |
2607 | do_clocal = 1; | 2608 | do_clocal = true; |
2608 | 2609 | ||
2609 | /* Wait for carrier detect and the line to become | 2610 | /* Wait for carrier detect and the line to become |
2610 | * free (i.e., not in use by the callout). While we are in | 2611 | * free (i.e., not in use by the callout). While we are in |
@@ -2622,7 +2623,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2622 | 2623 | ||
2623 | spin_lock_irqsave(&info->lock, flags); | 2624 | spin_lock_irqsave(&info->lock, flags); |
2624 | if (!tty_hung_up_p(filp)) { | 2625 | if (!tty_hung_up_p(filp)) { |
2625 | extra_count = 1; | 2626 | extra_count = true; |
2626 | info->count--; | 2627 | info->count--; |
2627 | } | 2628 | } |
2628 | spin_unlock_irqrestore(&info->lock, flags); | 2629 | spin_unlock_irqrestore(&info->lock, flags); |
@@ -3493,8 +3494,8 @@ static void rx_stop(MGSLPC_INFO *info) | |||
3493 | /* MODE:03 RAC Receiver Active, 0=inactive */ | 3494 | /* MODE:03 RAC Receiver Active, 0=inactive */ |
3494 | clear_reg_bits(info, CHA + MODE, BIT3); | 3495 | clear_reg_bits(info, CHA + MODE, BIT3); |
3495 | 3496 | ||
3496 | info->rx_enabled = 0; | 3497 | info->rx_enabled = false; |
3497 | info->rx_overflow = 0; | 3498 | info->rx_overflow = false; |
3498 | } | 3499 | } |
3499 | 3500 | ||
3500 | static void rx_start(MGSLPC_INFO *info) | 3501 | static void rx_start(MGSLPC_INFO *info) |
@@ -3504,13 +3505,13 @@ static void rx_start(MGSLPC_INFO *info) | |||
3504 | __FILE__,__LINE__, info->device_name ); | 3505 | __FILE__,__LINE__, info->device_name ); |
3505 | 3506 | ||
3506 | rx_reset_buffers(info); | 3507 | rx_reset_buffers(info); |
3507 | info->rx_enabled = 0; | 3508 | info->rx_enabled = false; |
3508 | info->rx_overflow = 0; | 3509 | info->rx_overflow = false; |
3509 | 3510 | ||
3510 | /* MODE:03 RAC Receiver Active, 1=active */ | 3511 | /* MODE:03 RAC Receiver Active, 1=active */ |
3511 | set_reg_bits(info, CHA + MODE, BIT3); | 3512 | set_reg_bits(info, CHA + MODE, BIT3); |
3512 | 3513 | ||
3513 | info->rx_enabled = 1; | 3514 | info->rx_enabled = true; |
3514 | } | 3515 | } |
3515 | 3516 | ||
3516 | static void tx_start(MGSLPC_INFO *info) | 3517 | static void tx_start(MGSLPC_INFO *info) |
@@ -3523,24 +3524,24 @@ static void tx_start(MGSLPC_INFO *info) | |||
3523 | /* If auto RTS enabled and RTS is inactive, then assert */ | 3524 | /* If auto RTS enabled and RTS is inactive, then assert */ |
3524 | /* RTS and set a flag indicating that the driver should */ | 3525 | /* RTS and set a flag indicating that the driver should */ |
3525 | /* negate RTS when the transmission completes. */ | 3526 | /* negate RTS when the transmission completes. */ |
3526 | info->drop_rts_on_tx_done = 0; | 3527 | info->drop_rts_on_tx_done = false; |
3527 | 3528 | ||
3528 | if (info->params.flags & HDLC_FLAG_AUTO_RTS) { | 3529 | if (info->params.flags & HDLC_FLAG_AUTO_RTS) { |
3529 | get_signals(info); | 3530 | get_signals(info); |
3530 | if (!(info->serial_signals & SerialSignal_RTS)) { | 3531 | if (!(info->serial_signals & SerialSignal_RTS)) { |
3531 | info->serial_signals |= SerialSignal_RTS; | 3532 | info->serial_signals |= SerialSignal_RTS; |
3532 | set_signals(info); | 3533 | set_signals(info); |
3533 | info->drop_rts_on_tx_done = 1; | 3534 | info->drop_rts_on_tx_done = true; |
3534 | } | 3535 | } |
3535 | } | 3536 | } |
3536 | 3537 | ||
3537 | if (info->params.mode == MGSL_MODE_ASYNC) { | 3538 | if (info->params.mode == MGSL_MODE_ASYNC) { |
3538 | if (!info->tx_active) { | 3539 | if (!info->tx_active) { |
3539 | info->tx_active = 1; | 3540 | info->tx_active = true; |
3540 | tx_ready(info); | 3541 | tx_ready(info); |
3541 | } | 3542 | } |
3542 | } else { | 3543 | } else { |
3543 | info->tx_active = 1; | 3544 | info->tx_active = true; |
3544 | tx_ready(info); | 3545 | tx_ready(info); |
3545 | mod_timer(&info->tx_timer, jiffies + | 3546 | mod_timer(&info->tx_timer, jiffies + |
3546 | msecs_to_jiffies(5000)); | 3547 | msecs_to_jiffies(5000)); |
@@ -3548,7 +3549,7 @@ static void tx_start(MGSLPC_INFO *info) | |||
3548 | } | 3549 | } |
3549 | 3550 | ||
3550 | if (!info->tx_enabled) | 3551 | if (!info->tx_enabled) |
3551 | info->tx_enabled = 1; | 3552 | info->tx_enabled = true; |
3552 | } | 3553 | } |
3553 | 3554 | ||
3554 | static void tx_stop(MGSLPC_INFO *info) | 3555 | static void tx_stop(MGSLPC_INFO *info) |
@@ -3559,8 +3560,8 @@ static void tx_stop(MGSLPC_INFO *info) | |||
3559 | 3560 | ||
3560 | del_timer(&info->tx_timer); | 3561 | del_timer(&info->tx_timer); |
3561 | 3562 | ||
3562 | info->tx_enabled = 0; | 3563 | info->tx_enabled = false; |
3563 | info->tx_active = 0; | 3564 | info->tx_active = false; |
3564 | } | 3565 | } |
3565 | 3566 | ||
3566 | /* Reset the adapter to a known state and prepare it for further use. | 3567 | /* Reset the adapter to a known state and prepare it for further use. |
@@ -3860,19 +3861,19 @@ static void rx_reset_buffers(MGSLPC_INFO *info) | |||
3860 | /* Attempt to return a received HDLC frame | 3861 | /* Attempt to return a received HDLC frame |
3861 | * Only frames received without errors are returned. | 3862 | * Only frames received without errors are returned. |
3862 | * | 3863 | * |
3863 | * Returns 1 if frame returned, otherwise 0 | 3864 | * Returns true if frame returned, otherwise false |
3864 | */ | 3865 | */ |
3865 | static int rx_get_frame(MGSLPC_INFO *info) | 3866 | static bool rx_get_frame(MGSLPC_INFO *info) |
3866 | { | 3867 | { |
3867 | unsigned short status; | 3868 | unsigned short status; |
3868 | RXBUF *buf; | 3869 | RXBUF *buf; |
3869 | unsigned int framesize = 0; | 3870 | unsigned int framesize = 0; |
3870 | unsigned long flags; | 3871 | unsigned long flags; |
3871 | struct tty_struct *tty = info->tty; | 3872 | struct tty_struct *tty = info->tty; |
3872 | int return_frame = 0; | 3873 | bool return_frame = false; |
3873 | 3874 | ||
3874 | if (info->rx_frame_count == 0) | 3875 | if (info->rx_frame_count == 0) |
3875 | return 0; | 3876 | return false; |
3876 | 3877 | ||
3877 | buf = (RXBUF*)(info->rx_buf + (info->rx_get * info->rx_buf_size)); | 3878 | buf = (RXBUF*)(info->rx_buf + (info->rx_get * info->rx_buf_size)); |
3878 | 3879 | ||
@@ -3891,7 +3892,7 @@ static int rx_get_frame(MGSLPC_INFO *info) | |||
3891 | else if (!(status & BIT5)) { | 3892 | else if (!(status & BIT5)) { |
3892 | info->icount.rxcrc++; | 3893 | info->icount.rxcrc++; |
3893 | if (info->params.crc_type & HDLC_CRC_RETURN_EX) | 3894 | if (info->params.crc_type & HDLC_CRC_RETURN_EX) |
3894 | return_frame = 1; | 3895 | return_frame = true; |
3895 | } | 3896 | } |
3896 | framesize = 0; | 3897 | framesize = 0; |
3897 | #if SYNCLINK_GENERIC_HDLC | 3898 | #if SYNCLINK_GENERIC_HDLC |
@@ -3902,7 +3903,7 @@ static int rx_get_frame(MGSLPC_INFO *info) | |||
3902 | } | 3903 | } |
3903 | #endif | 3904 | #endif |
3904 | } else | 3905 | } else |
3905 | return_frame = 1; | 3906 | return_frame = true; |
3906 | 3907 | ||
3907 | if (return_frame) | 3908 | if (return_frame) |
3908 | framesize = buf->count; | 3909 | framesize = buf->count; |
@@ -3945,16 +3946,16 @@ static int rx_get_frame(MGSLPC_INFO *info) | |||
3945 | info->rx_get = 0; | 3946 | info->rx_get = 0; |
3946 | spin_unlock_irqrestore(&info->lock,flags); | 3947 | spin_unlock_irqrestore(&info->lock,flags); |
3947 | 3948 | ||
3948 | return 1; | 3949 | return true; |
3949 | } | 3950 | } |
3950 | 3951 | ||
3951 | static BOOLEAN register_test(MGSLPC_INFO *info) | 3952 | static bool register_test(MGSLPC_INFO *info) |
3952 | { | 3953 | { |
3953 | static unsigned char patterns[] = | 3954 | static unsigned char patterns[] = |
3954 | { 0x00, 0xff, 0xaa, 0x55, 0x69, 0x96, 0x0f }; | 3955 | { 0x00, 0xff, 0xaa, 0x55, 0x69, 0x96, 0x0f }; |
3955 | static unsigned int count = ARRAY_SIZE(patterns); | 3956 | static unsigned int count = ARRAY_SIZE(patterns); |
3956 | unsigned int i; | 3957 | unsigned int i; |
3957 | BOOLEAN rc = TRUE; | 3958 | bool rc = true; |
3958 | unsigned long flags; | 3959 | unsigned long flags; |
3959 | 3960 | ||
3960 | spin_lock_irqsave(&info->lock,flags); | 3961 | spin_lock_irqsave(&info->lock,flags); |
@@ -3965,7 +3966,7 @@ static BOOLEAN register_test(MGSLPC_INFO *info) | |||
3965 | write_reg(info, XAD2, patterns[(i + 1) % count]); | 3966 | write_reg(info, XAD2, patterns[(i + 1) % count]); |
3966 | if ((read_reg(info, XAD1) != patterns[i]) || | 3967 | if ((read_reg(info, XAD1) != patterns[i]) || |
3967 | (read_reg(info, XAD2) != patterns[(i + 1) % count])) { | 3968 | (read_reg(info, XAD2) != patterns[(i + 1) % count])) { |
3968 | rc = FALSE; | 3969 | rc = false; |
3969 | break; | 3970 | break; |
3970 | } | 3971 | } |
3971 | } | 3972 | } |
@@ -3974,7 +3975,7 @@ static BOOLEAN register_test(MGSLPC_INFO *info) | |||
3974 | return rc; | 3975 | return rc; |
3975 | } | 3976 | } |
3976 | 3977 | ||
3977 | static BOOLEAN irq_test(MGSLPC_INFO *info) | 3978 | static bool irq_test(MGSLPC_INFO *info) |
3978 | { | 3979 | { |
3979 | unsigned long end_time; | 3980 | unsigned long end_time; |
3980 | unsigned long flags; | 3981 | unsigned long flags; |
@@ -3982,10 +3983,10 @@ static BOOLEAN irq_test(MGSLPC_INFO *info) | |||
3982 | spin_lock_irqsave(&info->lock,flags); | 3983 | spin_lock_irqsave(&info->lock,flags); |
3983 | reset_device(info); | 3984 | reset_device(info); |
3984 | 3985 | ||
3985 | info->testing_irq = TRUE; | 3986 | info->testing_irq = true; |
3986 | hdlc_mode(info); | 3987 | hdlc_mode(info); |
3987 | 3988 | ||
3988 | info->irq_occurred = FALSE; | 3989 | info->irq_occurred = false; |
3989 | 3990 | ||
3990 | /* init hdlc mode */ | 3991 | /* init hdlc mode */ |
3991 | 3992 | ||
@@ -4000,13 +4001,13 @@ static BOOLEAN irq_test(MGSLPC_INFO *info) | |||
4000 | msleep_interruptible(10); | 4001 | msleep_interruptible(10); |
4001 | } | 4002 | } |
4002 | 4003 | ||
4003 | info->testing_irq = FALSE; | 4004 | info->testing_irq = false; |
4004 | 4005 | ||
4005 | spin_lock_irqsave(&info->lock,flags); | 4006 | spin_lock_irqsave(&info->lock,flags); |
4006 | reset_device(info); | 4007 | reset_device(info); |
4007 | spin_unlock_irqrestore(&info->lock,flags); | 4008 | spin_unlock_irqrestore(&info->lock,flags); |
4008 | 4009 | ||
4009 | return info->irq_occurred ? TRUE : FALSE; | 4010 | return info->irq_occurred; |
4010 | } | 4011 | } |
4011 | 4012 | ||
4012 | static int adapter_test(MGSLPC_INFO *info) | 4013 | static int adapter_test(MGSLPC_INFO *info) |
@@ -4079,7 +4080,7 @@ static void tx_timeout(unsigned long context) | |||
4079 | info->icount.txtimeout++; | 4080 | info->icount.txtimeout++; |
4080 | } | 4081 | } |
4081 | spin_lock_irqsave(&info->lock,flags); | 4082 | spin_lock_irqsave(&info->lock,flags); |
4082 | info->tx_active = 0; | 4083 | info->tx_active = false; |
4083 | info->tx_count = info->tx_put = info->tx_get = 0; | 4084 | info->tx_count = info->tx_put = info->tx_get = 0; |
4084 | 4085 | ||
4085 | spin_unlock_irqrestore(&info->lock,flags); | 4086 | spin_unlock_irqrestore(&info->lock,flags); |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 5c3142b6f1fc..e2ec2ee4cf79 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -88,6 +88,7 @@ | |||
88 | 88 | ||
89 | #ifdef CONFIG_SPARC32 | 89 | #ifdef CONFIG_SPARC32 |
90 | #include <linux/pci.h> | 90 | #include <linux/pci.h> |
91 | #include <linux/jiffies.h> | ||
91 | #include <asm/ebus.h> | 92 | #include <asm/ebus.h> |
92 | 93 | ||
93 | static unsigned long rtc_port; | 94 | static unsigned long rtc_port; |
@@ -1316,7 +1317,8 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) | |||
1316 | * Once the read clears, read the RTC time (again via ioctl). Easy. | 1317 | * Once the read clears, read the RTC time (again via ioctl). Easy. |
1317 | */ | 1318 | */ |
1318 | 1319 | ||
1319 | while (rtc_is_updating() != 0 && jiffies - uip_watchdog < 2*HZ/100) | 1320 | while (rtc_is_updating() != 0 && |
1321 | time_before(jiffies, uip_watchdog + 2*HZ/100)) | ||
1320 | cpu_relax(); | 1322 | cpu_relax(); |
1321 | 1323 | ||
1322 | /* | 1324 | /* |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index a3237d48a584..fadab1d9510f 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -218,9 +218,9 @@ struct mgsl_struct { | |||
218 | 218 | ||
219 | u32 pending_bh; | 219 | u32 pending_bh; |
220 | 220 | ||
221 | int bh_running; /* Protection from multiple */ | 221 | bool bh_running; /* Protection from multiple */ |
222 | int isr_overflow; | 222 | int isr_overflow; |
223 | int bh_requested; | 223 | bool bh_requested; |
224 | 224 | ||
225 | int dcd_chkcount; /* check counts to prevent */ | 225 | int dcd_chkcount; /* check counts to prevent */ |
226 | int cts_chkcount; /* too many IRQs if a signal */ | 226 | int cts_chkcount; /* too many IRQs if a signal */ |
@@ -250,12 +250,12 @@ struct mgsl_struct { | |||
250 | int tx_holding_count; /* number of tx holding buffers waiting */ | 250 | int tx_holding_count; /* number of tx holding buffers waiting */ |
251 | struct tx_holding_buffer tx_holding_buffers[MAX_TX_HOLDING_BUFFERS]; | 251 | struct tx_holding_buffer tx_holding_buffers[MAX_TX_HOLDING_BUFFERS]; |
252 | 252 | ||
253 | int rx_enabled; | 253 | bool rx_enabled; |
254 | int rx_overflow; | 254 | bool rx_overflow; |
255 | int rx_rcc_underrun; | 255 | bool rx_rcc_underrun; |
256 | 256 | ||
257 | int tx_enabled; | 257 | bool tx_enabled; |
258 | int tx_active; | 258 | bool tx_active; |
259 | u32 idle_mode; | 259 | u32 idle_mode; |
260 | 260 | ||
261 | u16 cmr_value; | 261 | u16 cmr_value; |
@@ -269,14 +269,14 @@ struct mgsl_struct { | |||
269 | 269 | ||
270 | unsigned int io_base; /* base I/O address of adapter */ | 270 | unsigned int io_base; /* base I/O address of adapter */ |
271 | unsigned int io_addr_size; /* size of the I/O address range */ | 271 | unsigned int io_addr_size; /* size of the I/O address range */ |
272 | int io_addr_requested; /* nonzero if I/O address requested */ | 272 | bool io_addr_requested; /* true if I/O address requested */ |
273 | 273 | ||
274 | unsigned int irq_level; /* interrupt level */ | 274 | unsigned int irq_level; /* interrupt level */ |
275 | unsigned long irq_flags; | 275 | unsigned long irq_flags; |
276 | int irq_requested; /* nonzero if IRQ requested */ | 276 | bool irq_requested; /* true if IRQ requested */ |
277 | 277 | ||
278 | unsigned int dma_level; /* DMA channel */ | 278 | unsigned int dma_level; /* DMA channel */ |
279 | int dma_requested; /* nonzero if dma channel requested */ | 279 | bool dma_requested; /* true if dma channel requested */ |
280 | 280 | ||
281 | u16 mbre_bit; | 281 | u16 mbre_bit; |
282 | u16 loopback_bits; | 282 | u16 loopback_bits; |
@@ -286,27 +286,27 @@ struct mgsl_struct { | |||
286 | 286 | ||
287 | unsigned char serial_signals; /* current serial signal states */ | 287 | unsigned char serial_signals; /* current serial signal states */ |
288 | 288 | ||
289 | int irq_occurred; /* for diagnostics use */ | 289 | bool irq_occurred; /* for diagnostics use */ |
290 | unsigned int init_error; /* Initialization startup error (DIAGS) */ | 290 | unsigned int init_error; /* Initialization startup error (DIAGS) */ |
291 | int fDiagnosticsmode; /* Driver in Diagnostic mode? (DIAGS) */ | 291 | int fDiagnosticsmode; /* Driver in Diagnostic mode? (DIAGS) */ |
292 | 292 | ||
293 | u32 last_mem_alloc; | 293 | u32 last_mem_alloc; |
294 | unsigned char* memory_base; /* shared memory address (PCI only) */ | 294 | unsigned char* memory_base; /* shared memory address (PCI only) */ |
295 | u32 phys_memory_base; | 295 | u32 phys_memory_base; |
296 | int shared_mem_requested; | 296 | bool shared_mem_requested; |
297 | 297 | ||
298 | unsigned char* lcr_base; /* local config registers (PCI only) */ | 298 | unsigned char* lcr_base; /* local config registers (PCI only) */ |
299 | u32 phys_lcr_base; | 299 | u32 phys_lcr_base; |
300 | u32 lcr_offset; | 300 | u32 lcr_offset; |
301 | int lcr_mem_requested; | 301 | bool lcr_mem_requested; |
302 | 302 | ||
303 | u32 misc_ctrl_value; | 303 | u32 misc_ctrl_value; |
304 | char flag_buf[MAX_ASYNC_BUFFER_SIZE]; | 304 | char flag_buf[MAX_ASYNC_BUFFER_SIZE]; |
305 | char char_buf[MAX_ASYNC_BUFFER_SIZE]; | 305 | char char_buf[MAX_ASYNC_BUFFER_SIZE]; |
306 | BOOLEAN drop_rts_on_tx_done; | 306 | bool drop_rts_on_tx_done; |
307 | 307 | ||
308 | BOOLEAN loopmode_insert_requested; | 308 | bool loopmode_insert_requested; |
309 | BOOLEAN loopmode_send_done_requested; | 309 | bool loopmode_send_done_requested; |
310 | 310 | ||
311 | struct _input_signal_events input_signal_events; | 311 | struct _input_signal_events input_signal_events; |
312 | 312 | ||
@@ -752,10 +752,10 @@ static void mgsl_trace_block(struct mgsl_struct *info,const char* data, int coun | |||
752 | /* | 752 | /* |
753 | * Adapter diagnostic routines | 753 | * Adapter diagnostic routines |
754 | */ | 754 | */ |
755 | static BOOLEAN mgsl_register_test( struct mgsl_struct *info ); | 755 | static bool mgsl_register_test( struct mgsl_struct *info ); |
756 | static BOOLEAN mgsl_irq_test( struct mgsl_struct *info ); | 756 | static bool mgsl_irq_test( struct mgsl_struct *info ); |
757 | static BOOLEAN mgsl_dma_test( struct mgsl_struct *info ); | 757 | static bool mgsl_dma_test( struct mgsl_struct *info ); |
758 | static BOOLEAN mgsl_memory_test( struct mgsl_struct *info ); | 758 | static bool mgsl_memory_test( struct mgsl_struct *info ); |
759 | static int mgsl_adapter_test( struct mgsl_struct *info ); | 759 | static int mgsl_adapter_test( struct mgsl_struct *info ); |
760 | 760 | ||
761 | /* | 761 | /* |
@@ -770,8 +770,8 @@ static struct mgsl_struct* mgsl_allocate_device(void); | |||
770 | * DMA buffer manupulation functions. | 770 | * DMA buffer manupulation functions. |
771 | */ | 771 | */ |
772 | static void mgsl_free_rx_frame_buffers( struct mgsl_struct *info, unsigned int StartIndex, unsigned int EndIndex ); | 772 | static void mgsl_free_rx_frame_buffers( struct mgsl_struct *info, unsigned int StartIndex, unsigned int EndIndex ); |
773 | static int mgsl_get_rx_frame( struct mgsl_struct *info ); | 773 | static bool mgsl_get_rx_frame( struct mgsl_struct *info ); |
774 | static int mgsl_get_raw_rx_frame( struct mgsl_struct *info ); | 774 | static bool mgsl_get_raw_rx_frame( struct mgsl_struct *info ); |
775 | static void mgsl_reset_rx_dma_buffers( struct mgsl_struct *info ); | 775 | static void mgsl_reset_rx_dma_buffers( struct mgsl_struct *info ); |
776 | static void mgsl_reset_tx_dma_buffers( struct mgsl_struct *info ); | 776 | static void mgsl_reset_tx_dma_buffers( struct mgsl_struct *info ); |
777 | static int num_free_tx_dma_buffers(struct mgsl_struct *info); | 777 | static int num_free_tx_dma_buffers(struct mgsl_struct *info); |
@@ -791,7 +791,7 @@ static int mgsl_alloc_intermediate_rxbuffer_memory(struct mgsl_struct *info); | |||
791 | static void mgsl_free_intermediate_rxbuffer_memory(struct mgsl_struct *info); | 791 | static void mgsl_free_intermediate_rxbuffer_memory(struct mgsl_struct *info); |
792 | static int mgsl_alloc_intermediate_txbuffer_memory(struct mgsl_struct *info); | 792 | static int mgsl_alloc_intermediate_txbuffer_memory(struct mgsl_struct *info); |
793 | static void mgsl_free_intermediate_txbuffer_memory(struct mgsl_struct *info); | 793 | static void mgsl_free_intermediate_txbuffer_memory(struct mgsl_struct *info); |
794 | static int load_next_tx_holding_buffer(struct mgsl_struct *info); | 794 | static bool load_next_tx_holding_buffer(struct mgsl_struct *info); |
795 | static int save_tx_buffer_request(struct mgsl_struct *info,const char *Buffer, unsigned int BufferSize); | 795 | static int save_tx_buffer_request(struct mgsl_struct *info,const char *Buffer, unsigned int BufferSize); |
796 | 796 | ||
797 | /* | 797 | /* |
@@ -847,7 +847,7 @@ static int mgsl_wait_event(struct mgsl_struct * info, int __user *mask); | |||
847 | static int mgsl_loopmode_send_done( struct mgsl_struct * info ); | 847 | static int mgsl_loopmode_send_done( struct mgsl_struct * info ); |
848 | 848 | ||
849 | /* set non-zero on successful registration with PCI subsystem */ | 849 | /* set non-zero on successful registration with PCI subsystem */ |
850 | static int pci_registered; | 850 | static bool pci_registered; |
851 | 851 | ||
852 | /* | 852 | /* |
853 | * Global linked list of SyncLink devices | 853 | * Global linked list of SyncLink devices |
@@ -1054,8 +1054,8 @@ static int mgsl_bh_action(struct mgsl_struct *info) | |||
1054 | 1054 | ||
1055 | if (!rc) { | 1055 | if (!rc) { |
1056 | /* Mark BH routine as complete */ | 1056 | /* Mark BH routine as complete */ |
1057 | info->bh_running = 0; | 1057 | info->bh_running = false; |
1058 | info->bh_requested = 0; | 1058 | info->bh_requested = false; |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | 1061 | spin_unlock_irqrestore(&info->irq_spinlock,flags); |
@@ -1079,7 +1079,7 @@ static void mgsl_bh_handler(struct work_struct *work) | |||
1079 | printk( "%s(%d):mgsl_bh_handler(%s) entry\n", | 1079 | printk( "%s(%d):mgsl_bh_handler(%s) entry\n", |
1080 | __FILE__,__LINE__,info->device_name); | 1080 | __FILE__,__LINE__,info->device_name); |
1081 | 1081 | ||
1082 | info->bh_running = 1; | 1082 | info->bh_running = true; |
1083 | 1083 | ||
1084 | while((action = mgsl_bh_action(info)) != 0) { | 1084 | while((action = mgsl_bh_action(info)) != 0) { |
1085 | 1085 | ||
@@ -1113,7 +1113,7 @@ static void mgsl_bh_handler(struct work_struct *work) | |||
1113 | 1113 | ||
1114 | static void mgsl_bh_receive(struct mgsl_struct *info) | 1114 | static void mgsl_bh_receive(struct mgsl_struct *info) |
1115 | { | 1115 | { |
1116 | int (*get_rx_frame)(struct mgsl_struct *info) = | 1116 | bool (*get_rx_frame)(struct mgsl_struct *info) = |
1117 | (info->params.mode == MGSL_MODE_HDLC ? mgsl_get_rx_frame : mgsl_get_raw_rx_frame); | 1117 | (info->params.mode == MGSL_MODE_HDLC ? mgsl_get_rx_frame : mgsl_get_raw_rx_frame); |
1118 | 1118 | ||
1119 | if ( debug_level >= DEBUG_LEVEL_BH ) | 1119 | if ( debug_level >= DEBUG_LEVEL_BH ) |
@@ -1187,7 +1187,7 @@ static void mgsl_isr_receive_status( struct mgsl_struct *info ) | |||
1187 | usc_loopmode_active(info) ) | 1187 | usc_loopmode_active(info) ) |
1188 | { | 1188 | { |
1189 | ++info->icount.rxabort; | 1189 | ++info->icount.rxabort; |
1190 | info->loopmode_insert_requested = FALSE; | 1190 | info->loopmode_insert_requested = false; |
1191 | 1191 | ||
1192 | /* clear CMR:13 to start echoing RxD to TxD */ | 1192 | /* clear CMR:13 to start echoing RxD to TxD */ |
1193 | info->cmr_value &= ~BIT13; | 1193 | info->cmr_value &= ~BIT13; |
@@ -1257,7 +1257,7 @@ static void mgsl_isr_transmit_status( struct mgsl_struct *info ) | |||
1257 | else | 1257 | else |
1258 | info->icount.txunder++; | 1258 | info->icount.txunder++; |
1259 | 1259 | ||
1260 | info->tx_active = 0; | 1260 | info->tx_active = false; |
1261 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | 1261 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; |
1262 | del_timer(&info->tx_timer); | 1262 | del_timer(&info->tx_timer); |
1263 | 1263 | ||
@@ -1267,7 +1267,7 @@ static void mgsl_isr_transmit_status( struct mgsl_struct *info ) | |||
1267 | info->serial_signals &= ~SerialSignal_RTS; | 1267 | info->serial_signals &= ~SerialSignal_RTS; |
1268 | usc_set_serial_signals( info ); | 1268 | usc_set_serial_signals( info ); |
1269 | } | 1269 | } |
1270 | info->drop_rts_on_tx_done = 0; | 1270 | info->drop_rts_on_tx_done = false; |
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | #if SYNCLINK_GENERIC_HDLC | 1273 | #if SYNCLINK_GENERIC_HDLC |
@@ -1403,7 +1403,7 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info ) | |||
1403 | usc_OutReg( info, SICR, | 1403 | usc_OutReg( info, SICR, |
1404 | (unsigned short)(usc_InReg(info,SICR) & ~(SICR_TXC_ACTIVE+SICR_TXC_INACTIVE)) ); | 1404 | (unsigned short)(usc_InReg(info,SICR) & ~(SICR_TXC_ACTIVE+SICR_TXC_INACTIVE)) ); |
1405 | usc_UnlatchIostatusBits( info, MISCSTATUS_TXC_LATCHED ); | 1405 | usc_UnlatchIostatusBits( info, MISCSTATUS_TXC_LATCHED ); |
1406 | info->irq_occurred = 1; | 1406 | info->irq_occurred = true; |
1407 | } | 1407 | } |
1408 | 1408 | ||
1409 | } /* end of mgsl_isr_io_pin() */ | 1409 | } /* end of mgsl_isr_io_pin() */ |
@@ -1431,7 +1431,7 @@ static void mgsl_isr_transmit_data( struct mgsl_struct *info ) | |||
1431 | if ( info->xmit_cnt ) | 1431 | if ( info->xmit_cnt ) |
1432 | usc_load_txfifo( info ); | 1432 | usc_load_txfifo( info ); |
1433 | else | 1433 | else |
1434 | info->tx_active = 0; | 1434 | info->tx_active = false; |
1435 | 1435 | ||
1436 | if (info->xmit_cnt < WAKEUP_CHARS) | 1436 | if (info->xmit_cnt < WAKEUP_CHARS) |
1437 | info->pending_bh |= BH_TRANSMIT; | 1437 | info->pending_bh |= BH_TRANSMIT; |
@@ -1568,7 +1568,7 @@ static void mgsl_isr_misc( struct mgsl_struct *info ) | |||
1568 | 1568 | ||
1569 | /* schedule BH handler to restart receiver */ | 1569 | /* schedule BH handler to restart receiver */ |
1570 | info->pending_bh |= BH_RECEIVE; | 1570 | info->pending_bh |= BH_RECEIVE; |
1571 | info->rx_rcc_underrun = 1; | 1571 | info->rx_rcc_underrun = true; |
1572 | } | 1572 | } |
1573 | 1573 | ||
1574 | usc_ClearIrqPendingBits( info, MISC ); | 1574 | usc_ClearIrqPendingBits( info, MISC ); |
@@ -1626,7 +1626,7 @@ static void mgsl_isr_receive_dma( struct mgsl_struct *info ) | |||
1626 | info->pending_bh |= BH_RECEIVE; | 1626 | info->pending_bh |= BH_RECEIVE; |
1627 | 1627 | ||
1628 | if ( status & BIT3 ) { | 1628 | if ( status & BIT3 ) { |
1629 | info->rx_overflow = 1; | 1629 | info->rx_overflow = true; |
1630 | info->icount.buf_overrun++; | 1630 | info->icount.buf_overrun++; |
1631 | } | 1631 | } |
1632 | 1632 | ||
@@ -1745,7 +1745,7 @@ static irqreturn_t mgsl_interrupt(int dummy, void *dev_id) | |||
1745 | printk("%s(%d):%s queueing bh task.\n", | 1745 | printk("%s(%d):%s queueing bh task.\n", |
1746 | __FILE__,__LINE__,info->device_name); | 1746 | __FILE__,__LINE__,info->device_name); |
1747 | schedule_work(&info->task); | 1747 | schedule_work(&info->task); |
1748 | info->bh_requested = 1; | 1748 | info->bh_requested = true; |
1749 | } | 1749 | } |
1750 | 1750 | ||
1751 | spin_unlock(&info->irq_spinlock); | 1751 | spin_unlock(&info->irq_spinlock); |
@@ -3303,7 +3303,8 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3303 | { | 3303 | { |
3304 | DECLARE_WAITQUEUE(wait, current); | 3304 | DECLARE_WAITQUEUE(wait, current); |
3305 | int retval; | 3305 | int retval; |
3306 | int do_clocal = 0, extra_count = 0; | 3306 | bool do_clocal = false; |
3307 | bool extra_count = false; | ||
3307 | unsigned long flags; | 3308 | unsigned long flags; |
3308 | 3309 | ||
3309 | if (debug_level >= DEBUG_LEVEL_INFO) | 3310 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -3317,7 +3318,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3317 | } | 3318 | } |
3318 | 3319 | ||
3319 | if (tty->termios->c_cflag & CLOCAL) | 3320 | if (tty->termios->c_cflag & CLOCAL) |
3320 | do_clocal = 1; | 3321 | do_clocal = true; |
3321 | 3322 | ||
3322 | /* Wait for carrier detect and the line to become | 3323 | /* Wait for carrier detect and the line to become |
3323 | * free (i.e., not in use by the callout). While we are in | 3324 | * free (i.e., not in use by the callout). While we are in |
@@ -3335,7 +3336,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3335 | 3336 | ||
3336 | spin_lock_irqsave(&info->irq_spinlock, flags); | 3337 | spin_lock_irqsave(&info->irq_spinlock, flags); |
3337 | if (!tty_hung_up_p(filp)) { | 3338 | if (!tty_hung_up_p(filp)) { |
3338 | extra_count = 1; | 3339 | extra_count = true; |
3339 | info->count--; | 3340 | info->count--; |
3340 | } | 3341 | } |
3341 | spin_unlock_irqrestore(&info->irq_spinlock, flags); | 3342 | spin_unlock_irqrestore(&info->irq_spinlock, flags); |
@@ -4043,13 +4044,13 @@ static void mgsl_free_intermediate_txbuffer_memory(struct mgsl_struct *info) | |||
4043 | * | 4044 | * |
4044 | * info pointer to device instance data | 4045 | * info pointer to device instance data |
4045 | * | 4046 | * |
4046 | * Return Value: 1 if next buffered tx request loaded | 4047 | * Return Value: true if next buffered tx request loaded |
4047 | * into adapter's tx dma buffer, | 4048 | * into adapter's tx dma buffer, |
4048 | * 0 otherwise | 4049 | * false otherwise |
4049 | */ | 4050 | */ |
4050 | static int load_next_tx_holding_buffer(struct mgsl_struct *info) | 4051 | static bool load_next_tx_holding_buffer(struct mgsl_struct *info) |
4051 | { | 4052 | { |
4052 | int ret = 0; | 4053 | bool ret = false; |
4053 | 4054 | ||
4054 | if ( info->tx_holding_count ) { | 4055 | if ( info->tx_holding_count ) { |
4055 | /* determine if we have enough tx dma buffers | 4056 | /* determine if we have enough tx dma buffers |
@@ -4073,7 +4074,7 @@ static int load_next_tx_holding_buffer(struct mgsl_struct *info) | |||
4073 | /* restart transmit timer */ | 4074 | /* restart transmit timer */ |
4074 | mod_timer(&info->tx_timer, jiffies + msecs_to_jiffies(5000)); | 4075 | mod_timer(&info->tx_timer, jiffies + msecs_to_jiffies(5000)); |
4075 | 4076 | ||
4076 | ret = 1; | 4077 | ret = true; |
4077 | } | 4078 | } |
4078 | } | 4079 | } |
4079 | 4080 | ||
@@ -4119,7 +4120,7 @@ static int mgsl_claim_resources(struct mgsl_struct *info) | |||
4119 | __FILE__,__LINE__,info->device_name, info->io_base); | 4120 | __FILE__,__LINE__,info->device_name, info->io_base); |
4120 | return -ENODEV; | 4121 | return -ENODEV; |
4121 | } | 4122 | } |
4122 | info->io_addr_requested = 1; | 4123 | info->io_addr_requested = true; |
4123 | 4124 | ||
4124 | if ( request_irq(info->irq_level,mgsl_interrupt,info->irq_flags, | 4125 | if ( request_irq(info->irq_level,mgsl_interrupt,info->irq_flags, |
4125 | info->device_name, info ) < 0 ) { | 4126 | info->device_name, info ) < 0 ) { |
@@ -4127,7 +4128,7 @@ static int mgsl_claim_resources(struct mgsl_struct *info) | |||
4127 | __FILE__,__LINE__,info->device_name, info->irq_level ); | 4128 | __FILE__,__LINE__,info->device_name, info->irq_level ); |
4128 | goto errout; | 4129 | goto errout; |
4129 | } | 4130 | } |
4130 | info->irq_requested = 1; | 4131 | info->irq_requested = true; |
4131 | 4132 | ||
4132 | if ( info->bus_type == MGSL_BUS_TYPE_PCI ) { | 4133 | if ( info->bus_type == MGSL_BUS_TYPE_PCI ) { |
4133 | if (request_mem_region(info->phys_memory_base,0x40000,"synclink") == NULL) { | 4134 | if (request_mem_region(info->phys_memory_base,0x40000,"synclink") == NULL) { |
@@ -4135,13 +4136,13 @@ static int mgsl_claim_resources(struct mgsl_struct *info) | |||
4135 | __FILE__,__LINE__,info->device_name, info->phys_memory_base); | 4136 | __FILE__,__LINE__,info->device_name, info->phys_memory_base); |
4136 | goto errout; | 4137 | goto errout; |
4137 | } | 4138 | } |
4138 | info->shared_mem_requested = 1; | 4139 | info->shared_mem_requested = true; |
4139 | if (request_mem_region(info->phys_lcr_base + info->lcr_offset,128,"synclink") == NULL) { | 4140 | if (request_mem_region(info->phys_lcr_base + info->lcr_offset,128,"synclink") == NULL) { |
4140 | printk( "%s(%d):lcr mem addr conflict device %s Addr=%08X\n", | 4141 | printk( "%s(%d):lcr mem addr conflict device %s Addr=%08X\n", |
4141 | __FILE__,__LINE__,info->device_name, info->phys_lcr_base + info->lcr_offset); | 4142 | __FILE__,__LINE__,info->device_name, info->phys_lcr_base + info->lcr_offset); |
4142 | goto errout; | 4143 | goto errout; |
4143 | } | 4144 | } |
4144 | info->lcr_mem_requested = 1; | 4145 | info->lcr_mem_requested = true; |
4145 | 4146 | ||
4146 | info->memory_base = ioremap(info->phys_memory_base,0x40000); | 4147 | info->memory_base = ioremap(info->phys_memory_base,0x40000); |
4147 | if (!info->memory_base) { | 4148 | if (!info->memory_base) { |
@@ -4172,7 +4173,7 @@ static int mgsl_claim_resources(struct mgsl_struct *info) | |||
4172 | mgsl_release_resources( info ); | 4173 | mgsl_release_resources( info ); |
4173 | return -ENODEV; | 4174 | return -ENODEV; |
4174 | } | 4175 | } |
4175 | info->dma_requested = 1; | 4176 | info->dma_requested = true; |
4176 | 4177 | ||
4177 | /* ISA adapter uses bus master DMA */ | 4178 | /* ISA adapter uses bus master DMA */ |
4178 | set_dma_mode(info->dma_level,DMA_MODE_CASCADE); | 4179 | set_dma_mode(info->dma_level,DMA_MODE_CASCADE); |
@@ -4200,12 +4201,12 @@ static void mgsl_release_resources(struct mgsl_struct *info) | |||
4200 | 4201 | ||
4201 | if ( info->irq_requested ) { | 4202 | if ( info->irq_requested ) { |
4202 | free_irq(info->irq_level, info); | 4203 | free_irq(info->irq_level, info); |
4203 | info->irq_requested = 0; | 4204 | info->irq_requested = false; |
4204 | } | 4205 | } |
4205 | if ( info->dma_requested ) { | 4206 | if ( info->dma_requested ) { |
4206 | disable_dma(info->dma_level); | 4207 | disable_dma(info->dma_level); |
4207 | free_dma(info->dma_level); | 4208 | free_dma(info->dma_level); |
4208 | info->dma_requested = 0; | 4209 | info->dma_requested = false; |
4209 | } | 4210 | } |
4210 | mgsl_free_dma_buffers(info); | 4211 | mgsl_free_dma_buffers(info); |
4211 | mgsl_free_intermediate_rxbuffer_memory(info); | 4212 | mgsl_free_intermediate_rxbuffer_memory(info); |
@@ -4213,15 +4214,15 @@ static void mgsl_release_resources(struct mgsl_struct *info) | |||
4213 | 4214 | ||
4214 | if ( info->io_addr_requested ) { | 4215 | if ( info->io_addr_requested ) { |
4215 | release_region(info->io_base,info->io_addr_size); | 4216 | release_region(info->io_base,info->io_addr_size); |
4216 | info->io_addr_requested = 0; | 4217 | info->io_addr_requested = false; |
4217 | } | 4218 | } |
4218 | if ( info->shared_mem_requested ) { | 4219 | if ( info->shared_mem_requested ) { |
4219 | release_mem_region(info->phys_memory_base,0x40000); | 4220 | release_mem_region(info->phys_memory_base,0x40000); |
4220 | info->shared_mem_requested = 0; | 4221 | info->shared_mem_requested = false; |
4221 | } | 4222 | } |
4222 | if ( info->lcr_mem_requested ) { | 4223 | if ( info->lcr_mem_requested ) { |
4223 | release_mem_region(info->phys_lcr_base + info->lcr_offset,128); | 4224 | release_mem_region(info->phys_lcr_base + info->lcr_offset,128); |
4224 | info->lcr_mem_requested = 0; | 4225 | info->lcr_mem_requested = false; |
4225 | } | 4226 | } |
4226 | if (info->memory_base){ | 4227 | if (info->memory_base){ |
4227 | iounmap(info->memory_base); | 4228 | iounmap(info->memory_base); |
@@ -4486,7 +4487,7 @@ static int __init synclink_init(void) | |||
4486 | if ((rc = pci_register_driver(&synclink_pci_driver)) < 0) | 4487 | if ((rc = pci_register_driver(&synclink_pci_driver)) < 0) |
4487 | printk("%s:failed to register PCI driver, error=%d\n",__FILE__,rc); | 4488 | printk("%s:failed to register PCI driver, error=%d\n",__FILE__,rc); |
4488 | else | 4489 | else |
4489 | pci_registered = 1; | 4490 | pci_registered = true; |
4490 | 4491 | ||
4491 | if ((rc = mgsl_init_tty()) < 0) | 4492 | if ((rc = mgsl_init_tty()) < 0) |
4492 | goto error; | 4493 | goto error; |
@@ -4679,7 +4680,7 @@ static u16 usc_InReg( struct mgsl_struct *info, u16 RegAddr ) | |||
4679 | static void usc_set_sdlc_mode( struct mgsl_struct *info ) | 4680 | static void usc_set_sdlc_mode( struct mgsl_struct *info ) |
4680 | { | 4681 | { |
4681 | u16 RegValue; | 4682 | u16 RegValue; |
4682 | int PreSL1660; | 4683 | bool PreSL1660; |
4683 | 4684 | ||
4684 | /* | 4685 | /* |
4685 | * determine if the IUSC on the adapter is pre-SL1660. If | 4686 | * determine if the IUSC on the adapter is pre-SL1660. If |
@@ -4692,11 +4693,7 @@ static void usc_set_sdlc_mode( struct mgsl_struct *info ) | |||
4692 | */ | 4693 | */ |
4693 | usc_OutReg(info,TMCR,0x1f); | 4694 | usc_OutReg(info,TMCR,0x1f); |
4694 | RegValue=usc_InReg(info,TMDR); | 4695 | RegValue=usc_InReg(info,TMDR); |
4695 | if ( RegValue == IUSC_PRE_SL1660 ) | 4696 | PreSL1660 = (RegValue == IUSC_PRE_SL1660); |
4696 | PreSL1660 = 1; | ||
4697 | else | ||
4698 | PreSL1660 = 0; | ||
4699 | |||
4700 | 4697 | ||
4701 | if ( info->params.flags & HDLC_FLAG_HDLC_LOOPMODE ) | 4698 | if ( info->params.flags & HDLC_FLAG_HDLC_LOOPMODE ) |
4702 | { | 4699 | { |
@@ -5382,9 +5379,9 @@ static void usc_process_rxoverrun_sync( struct mgsl_struct *info ) | |||
5382 | int start_index; | 5379 | int start_index; |
5383 | int end_index; | 5380 | int end_index; |
5384 | int frame_start_index; | 5381 | int frame_start_index; |
5385 | int start_of_frame_found = FALSE; | 5382 | bool start_of_frame_found = false; |
5386 | int end_of_frame_found = FALSE; | 5383 | bool end_of_frame_found = false; |
5387 | int reprogram_dma = FALSE; | 5384 | bool reprogram_dma = false; |
5388 | 5385 | ||
5389 | DMABUFFERENTRY *buffer_list = info->rx_buffer_list; | 5386 | DMABUFFERENTRY *buffer_list = info->rx_buffer_list; |
5390 | u32 phys_addr; | 5387 | u32 phys_addr; |
@@ -5410,9 +5407,9 @@ static void usc_process_rxoverrun_sync( struct mgsl_struct *info ) | |||
5410 | 5407 | ||
5411 | if ( !start_of_frame_found ) | 5408 | if ( !start_of_frame_found ) |
5412 | { | 5409 | { |
5413 | start_of_frame_found = TRUE; | 5410 | start_of_frame_found = true; |
5414 | frame_start_index = end_index; | 5411 | frame_start_index = end_index; |
5415 | end_of_frame_found = FALSE; | 5412 | end_of_frame_found = false; |
5416 | } | 5413 | } |
5417 | 5414 | ||
5418 | if ( buffer_list[end_index].status ) | 5415 | if ( buffer_list[end_index].status ) |
@@ -5423,8 +5420,8 @@ static void usc_process_rxoverrun_sync( struct mgsl_struct *info ) | |||
5423 | /* We want to leave the buffers for this frame intact. */ | 5420 | /* We want to leave the buffers for this frame intact. */ |
5424 | /* Move on to next possible frame. */ | 5421 | /* Move on to next possible frame. */ |
5425 | 5422 | ||
5426 | start_of_frame_found = FALSE; | 5423 | start_of_frame_found = false; |
5427 | end_of_frame_found = TRUE; | 5424 | end_of_frame_found = true; |
5428 | } | 5425 | } |
5429 | 5426 | ||
5430 | /* advance to next buffer entry in linked list */ | 5427 | /* advance to next buffer entry in linked list */ |
@@ -5439,8 +5436,8 @@ static void usc_process_rxoverrun_sync( struct mgsl_struct *info ) | |||
5439 | /* completely screwed, reset all receive buffers! */ | 5436 | /* completely screwed, reset all receive buffers! */ |
5440 | mgsl_reset_rx_dma_buffers( info ); | 5437 | mgsl_reset_rx_dma_buffers( info ); |
5441 | frame_start_index = 0; | 5438 | frame_start_index = 0; |
5442 | start_of_frame_found = FALSE; | 5439 | start_of_frame_found = false; |
5443 | reprogram_dma = TRUE; | 5440 | reprogram_dma = true; |
5444 | break; | 5441 | break; |
5445 | } | 5442 | } |
5446 | } | 5443 | } |
@@ -5466,7 +5463,7 @@ static void usc_process_rxoverrun_sync( struct mgsl_struct *info ) | |||
5466 | 5463 | ||
5467 | } while( start_index != end_index ); | 5464 | } while( start_index != end_index ); |
5468 | 5465 | ||
5469 | reprogram_dma = TRUE; | 5466 | reprogram_dma = true; |
5470 | } | 5467 | } |
5471 | 5468 | ||
5472 | if ( reprogram_dma ) | 5469 | if ( reprogram_dma ) |
@@ -5536,9 +5533,9 @@ static void usc_stop_receiver( struct mgsl_struct *info ) | |||
5536 | usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) ); | 5533 | usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) ); |
5537 | usc_RTCmd( info, RTCmd_PurgeRxFifo ); | 5534 | usc_RTCmd( info, RTCmd_PurgeRxFifo ); |
5538 | 5535 | ||
5539 | info->rx_enabled = 0; | 5536 | info->rx_enabled = false; |
5540 | info->rx_overflow = 0; | 5537 | info->rx_overflow = false; |
5541 | info->rx_rcc_underrun = 0; | 5538 | info->rx_rcc_underrun = false; |
5542 | 5539 | ||
5543 | } /* end of stop_receiver() */ | 5540 | } /* end of stop_receiver() */ |
5544 | 5541 | ||
@@ -5601,7 +5598,7 @@ static void usc_start_receiver( struct mgsl_struct *info ) | |||
5601 | 5598 | ||
5602 | usc_OutReg( info, CCSR, 0x1020 ); | 5599 | usc_OutReg( info, CCSR, 0x1020 ); |
5603 | 5600 | ||
5604 | info->rx_enabled = 1; | 5601 | info->rx_enabled = true; |
5605 | 5602 | ||
5606 | } /* end of usc_start_receiver() */ | 5603 | } /* end of usc_start_receiver() */ |
5607 | 5604 | ||
@@ -5628,14 +5625,14 @@ static void usc_start_transmitter( struct mgsl_struct *info ) | |||
5628 | /* RTS and set a flag indicating that the driver should */ | 5625 | /* RTS and set a flag indicating that the driver should */ |
5629 | /* negate RTS when the transmission completes. */ | 5626 | /* negate RTS when the transmission completes. */ |
5630 | 5627 | ||
5631 | info->drop_rts_on_tx_done = 0; | 5628 | info->drop_rts_on_tx_done = false; |
5632 | 5629 | ||
5633 | if ( info->params.flags & HDLC_FLAG_AUTO_RTS ) { | 5630 | if ( info->params.flags & HDLC_FLAG_AUTO_RTS ) { |
5634 | usc_get_serial_signals( info ); | 5631 | usc_get_serial_signals( info ); |
5635 | if ( !(info->serial_signals & SerialSignal_RTS) ) { | 5632 | if ( !(info->serial_signals & SerialSignal_RTS) ) { |
5636 | info->serial_signals |= SerialSignal_RTS; | 5633 | info->serial_signals |= SerialSignal_RTS; |
5637 | usc_set_serial_signals( info ); | 5634 | usc_set_serial_signals( info ); |
5638 | info->drop_rts_on_tx_done = 1; | 5635 | info->drop_rts_on_tx_done = true; |
5639 | } | 5636 | } |
5640 | } | 5637 | } |
5641 | 5638 | ||
@@ -5699,11 +5696,11 @@ static void usc_start_transmitter( struct mgsl_struct *info ) | |||
5699 | mod_timer(&info->tx_timer, jiffies + | 5696 | mod_timer(&info->tx_timer, jiffies + |
5700 | msecs_to_jiffies(5000)); | 5697 | msecs_to_jiffies(5000)); |
5701 | } | 5698 | } |
5702 | info->tx_active = 1; | 5699 | info->tx_active = true; |
5703 | } | 5700 | } |
5704 | 5701 | ||
5705 | if ( !info->tx_enabled ) { | 5702 | if ( !info->tx_enabled ) { |
5706 | info->tx_enabled = 1; | 5703 | info->tx_enabled = true; |
5707 | if ( info->params.flags & HDLC_FLAG_AUTO_CTS ) | 5704 | if ( info->params.flags & HDLC_FLAG_AUTO_CTS ) |
5708 | usc_EnableTransmitter(info,ENABLE_AUTO_CTS); | 5705 | usc_EnableTransmitter(info,ENABLE_AUTO_CTS); |
5709 | else | 5706 | else |
@@ -5735,8 +5732,8 @@ static void usc_stop_transmitter( struct mgsl_struct *info ) | |||
5735 | usc_DmaCmd( info, DmaCmd_ResetTxChannel ); | 5732 | usc_DmaCmd( info, DmaCmd_ResetTxChannel ); |
5736 | usc_RTCmd( info, RTCmd_PurgeTxFifo ); | 5733 | usc_RTCmd( info, RTCmd_PurgeTxFifo ); |
5737 | 5734 | ||
5738 | info->tx_enabled = 0; | 5735 | info->tx_enabled = false; |
5739 | info->tx_active = 0; | 5736 | info->tx_active = false; |
5740 | 5737 | ||
5741 | } /* end of usc_stop_transmitter() */ | 5738 | } /* end of usc_stop_transmitter() */ |
5742 | 5739 | ||
@@ -6520,7 +6517,7 @@ static void mgsl_reset_rx_dma_buffers( struct mgsl_struct *info ) | |||
6520 | */ | 6517 | */ |
6521 | static void mgsl_free_rx_frame_buffers( struct mgsl_struct *info, unsigned int StartIndex, unsigned int EndIndex ) | 6518 | static void mgsl_free_rx_frame_buffers( struct mgsl_struct *info, unsigned int StartIndex, unsigned int EndIndex ) |
6522 | { | 6519 | { |
6523 | int Done = 0; | 6520 | bool Done = false; |
6524 | DMABUFFERENTRY *pBufEntry; | 6521 | DMABUFFERENTRY *pBufEntry; |
6525 | unsigned int Index; | 6522 | unsigned int Index; |
6526 | 6523 | ||
@@ -6534,7 +6531,7 @@ static void mgsl_free_rx_frame_buffers( struct mgsl_struct *info, unsigned int S | |||
6534 | 6531 | ||
6535 | if ( Index == EndIndex ) { | 6532 | if ( Index == EndIndex ) { |
6536 | /* This is the last buffer of the frame! */ | 6533 | /* This is the last buffer of the frame! */ |
6537 | Done = 1; | 6534 | Done = true; |
6538 | } | 6535 | } |
6539 | 6536 | ||
6540 | /* reset current buffer for reuse */ | 6537 | /* reset current buffer for reuse */ |
@@ -6559,18 +6556,18 @@ static void mgsl_free_rx_frame_buffers( struct mgsl_struct *info, unsigned int S | |||
6559 | * receive DMA buffers. Only frames received without errors are returned. | 6556 | * receive DMA buffers. Only frames received without errors are returned. |
6560 | * | 6557 | * |
6561 | * Arguments: info pointer to device extension | 6558 | * Arguments: info pointer to device extension |
6562 | * Return Value: 1 if frame returned, otherwise 0 | 6559 | * Return Value: true if frame returned, otherwise false |
6563 | */ | 6560 | */ |
6564 | static int mgsl_get_rx_frame(struct mgsl_struct *info) | 6561 | static bool mgsl_get_rx_frame(struct mgsl_struct *info) |
6565 | { | 6562 | { |
6566 | unsigned int StartIndex, EndIndex; /* index of 1st and last buffers of Rx frame */ | 6563 | unsigned int StartIndex, EndIndex; /* index of 1st and last buffers of Rx frame */ |
6567 | unsigned short status; | 6564 | unsigned short status; |
6568 | DMABUFFERENTRY *pBufEntry; | 6565 | DMABUFFERENTRY *pBufEntry; |
6569 | unsigned int framesize = 0; | 6566 | unsigned int framesize = 0; |
6570 | int ReturnCode = 0; | 6567 | bool ReturnCode = false; |
6571 | unsigned long flags; | 6568 | unsigned long flags; |
6572 | struct tty_struct *tty = info->tty; | 6569 | struct tty_struct *tty = info->tty; |
6573 | int return_frame = 0; | 6570 | bool return_frame = false; |
6574 | 6571 | ||
6575 | /* | 6572 | /* |
6576 | * current_rx_buffer points to the 1st buffer of the next available | 6573 | * current_rx_buffer points to the 1st buffer of the next available |
@@ -6629,7 +6626,7 @@ static int mgsl_get_rx_frame(struct mgsl_struct *info) | |||
6629 | else { | 6626 | else { |
6630 | info->icount.rxcrc++; | 6627 | info->icount.rxcrc++; |
6631 | if ( info->params.crc_type & HDLC_CRC_RETURN_EX ) | 6628 | if ( info->params.crc_type & HDLC_CRC_RETURN_EX ) |
6632 | return_frame = 1; | 6629 | return_frame = true; |
6633 | } | 6630 | } |
6634 | framesize = 0; | 6631 | framesize = 0; |
6635 | #if SYNCLINK_GENERIC_HDLC | 6632 | #if SYNCLINK_GENERIC_HDLC |
@@ -6640,7 +6637,7 @@ static int mgsl_get_rx_frame(struct mgsl_struct *info) | |||
6640 | } | 6637 | } |
6641 | #endif | 6638 | #endif |
6642 | } else | 6639 | } else |
6643 | return_frame = 1; | 6640 | return_frame = true; |
6644 | 6641 | ||
6645 | if ( return_frame ) { | 6642 | if ( return_frame ) { |
6646 | /* receive frame has no errors, get frame size. | 6643 | /* receive frame has no errors, get frame size. |
@@ -6719,7 +6716,7 @@ static int mgsl_get_rx_frame(struct mgsl_struct *info) | |||
6719 | /* Free the buffers used by this frame. */ | 6716 | /* Free the buffers used by this frame. */ |
6720 | mgsl_free_rx_frame_buffers( info, StartIndex, EndIndex ); | 6717 | mgsl_free_rx_frame_buffers( info, StartIndex, EndIndex ); |
6721 | 6718 | ||
6722 | ReturnCode = 1; | 6719 | ReturnCode = true; |
6723 | 6720 | ||
6724 | Cleanup: | 6721 | Cleanup: |
6725 | 6722 | ||
@@ -6758,15 +6755,15 @@ Cleanup: | |||
6758 | * last Rx DMA buffer and return that last portion of the frame. | 6755 | * last Rx DMA buffer and return that last portion of the frame. |
6759 | * | 6756 | * |
6760 | * Arguments: info pointer to device extension | 6757 | * Arguments: info pointer to device extension |
6761 | * Return Value: 1 if frame returned, otherwise 0 | 6758 | * Return Value: true if frame returned, otherwise false |
6762 | */ | 6759 | */ |
6763 | static int mgsl_get_raw_rx_frame(struct mgsl_struct *info) | 6760 | static bool mgsl_get_raw_rx_frame(struct mgsl_struct *info) |
6764 | { | 6761 | { |
6765 | unsigned int CurrentIndex, NextIndex; | 6762 | unsigned int CurrentIndex, NextIndex; |
6766 | unsigned short status; | 6763 | unsigned short status; |
6767 | DMABUFFERENTRY *pBufEntry; | 6764 | DMABUFFERENTRY *pBufEntry; |
6768 | unsigned int framesize = 0; | 6765 | unsigned int framesize = 0; |
6769 | int ReturnCode = 0; | 6766 | bool ReturnCode = false; |
6770 | unsigned long flags; | 6767 | unsigned long flags; |
6771 | struct tty_struct *tty = info->tty; | 6768 | struct tty_struct *tty = info->tty; |
6772 | 6769 | ||
@@ -6891,7 +6888,7 @@ static int mgsl_get_raw_rx_frame(struct mgsl_struct *info) | |||
6891 | /* Free the buffers used by this frame. */ | 6888 | /* Free the buffers used by this frame. */ |
6892 | mgsl_free_rx_frame_buffers( info, CurrentIndex, CurrentIndex ); | 6889 | mgsl_free_rx_frame_buffers( info, CurrentIndex, CurrentIndex ); |
6893 | 6890 | ||
6894 | ReturnCode = 1; | 6891 | ReturnCode = true; |
6895 | } | 6892 | } |
6896 | 6893 | ||
6897 | 6894 | ||
@@ -7000,15 +6997,15 @@ static void mgsl_load_tx_dma_buffer(struct mgsl_struct *info, | |||
7000 | * Performs a register test of the 16C32. | 6997 | * Performs a register test of the 16C32. |
7001 | * | 6998 | * |
7002 | * Arguments: info pointer to device instance data | 6999 | * Arguments: info pointer to device instance data |
7003 | * Return Value: TRUE if test passed, otherwise FALSE | 7000 | * Return Value: true if test passed, otherwise false |
7004 | */ | 7001 | */ |
7005 | static BOOLEAN mgsl_register_test( struct mgsl_struct *info ) | 7002 | static bool mgsl_register_test( struct mgsl_struct *info ) |
7006 | { | 7003 | { |
7007 | static unsigned short BitPatterns[] = | 7004 | static unsigned short BitPatterns[] = |
7008 | { 0x0000, 0xffff, 0xaaaa, 0x5555, 0x1234, 0x6969, 0x9696, 0x0f0f }; | 7005 | { 0x0000, 0xffff, 0xaaaa, 0x5555, 0x1234, 0x6969, 0x9696, 0x0f0f }; |
7009 | static unsigned int Patterncount = ARRAY_SIZE(BitPatterns); | 7006 | static unsigned int Patterncount = ARRAY_SIZE(BitPatterns); |
7010 | unsigned int i; | 7007 | unsigned int i; |
7011 | BOOLEAN rc = TRUE; | 7008 | bool rc = true; |
7012 | unsigned long flags; | 7009 | unsigned long flags; |
7013 | 7010 | ||
7014 | spin_lock_irqsave(&info->irq_spinlock,flags); | 7011 | spin_lock_irqsave(&info->irq_spinlock,flags); |
@@ -7019,10 +7016,10 @@ static BOOLEAN mgsl_register_test( struct mgsl_struct *info ) | |||
7019 | if ( (usc_InReg( info, SICR ) != 0) || | 7016 | if ( (usc_InReg( info, SICR ) != 0) || |
7020 | (usc_InReg( info, IVR ) != 0) || | 7017 | (usc_InReg( info, IVR ) != 0) || |
7021 | (usc_InDmaReg( info, DIVR ) != 0) ){ | 7018 | (usc_InDmaReg( info, DIVR ) != 0) ){ |
7022 | rc = FALSE; | 7019 | rc = false; |
7023 | } | 7020 | } |
7024 | 7021 | ||
7025 | if ( rc == TRUE ){ | 7022 | if ( rc ){ |
7026 | /* Write bit patterns to various registers but do it out of */ | 7023 | /* Write bit patterns to various registers but do it out of */ |
7027 | /* sync, then read back and verify values. */ | 7024 | /* sync, then read back and verify values. */ |
7028 | 7025 | ||
@@ -7040,7 +7037,7 @@ static BOOLEAN mgsl_register_test( struct mgsl_struct *info ) | |||
7040 | (usc_InReg( info, RCLR ) != BitPatterns[(i+3)%Patterncount]) || | 7037 | (usc_InReg( info, RCLR ) != BitPatterns[(i+3)%Patterncount]) || |
7041 | (usc_InReg( info, RSR ) != BitPatterns[(i+4)%Patterncount]) || | 7038 | (usc_InReg( info, RSR ) != BitPatterns[(i+4)%Patterncount]) || |
7042 | (usc_InDmaReg( info, TBCR ) != BitPatterns[(i+5)%Patterncount]) ){ | 7039 | (usc_InDmaReg( info, TBCR ) != BitPatterns[(i+5)%Patterncount]) ){ |
7043 | rc = FALSE; | 7040 | rc = false; |
7044 | break; | 7041 | break; |
7045 | } | 7042 | } |
7046 | } | 7043 | } |
@@ -7056,9 +7053,9 @@ static BOOLEAN mgsl_register_test( struct mgsl_struct *info ) | |||
7056 | /* mgsl_irq_test() Perform interrupt test of the 16C32. | 7053 | /* mgsl_irq_test() Perform interrupt test of the 16C32. |
7057 | * | 7054 | * |
7058 | * Arguments: info pointer to device instance data | 7055 | * Arguments: info pointer to device instance data |
7059 | * Return Value: TRUE if test passed, otherwise FALSE | 7056 | * Return Value: true if test passed, otherwise false |
7060 | */ | 7057 | */ |
7061 | static BOOLEAN mgsl_irq_test( struct mgsl_struct *info ) | 7058 | static bool mgsl_irq_test( struct mgsl_struct *info ) |
7062 | { | 7059 | { |
7063 | unsigned long EndTime; | 7060 | unsigned long EndTime; |
7064 | unsigned long flags; | 7061 | unsigned long flags; |
@@ -7068,10 +7065,10 @@ static BOOLEAN mgsl_irq_test( struct mgsl_struct *info ) | |||
7068 | 7065 | ||
7069 | /* | 7066 | /* |
7070 | * Setup 16C32 to interrupt on TxC pin (14MHz clock) transition. | 7067 | * Setup 16C32 to interrupt on TxC pin (14MHz clock) transition. |
7071 | * The ISR sets irq_occurred to 1. | 7068 | * The ISR sets irq_occurred to true. |
7072 | */ | 7069 | */ |
7073 | 7070 | ||
7074 | info->irq_occurred = FALSE; | 7071 | info->irq_occurred = false; |
7075 | 7072 | ||
7076 | /* Enable INTEN gate for ISA adapter (Port 6, Bit12) */ | 7073 | /* Enable INTEN gate for ISA adapter (Port 6, Bit12) */ |
7077 | /* Enable INTEN (Port 6, Bit12) */ | 7074 | /* Enable INTEN (Port 6, Bit12) */ |
@@ -7097,10 +7094,7 @@ static BOOLEAN mgsl_irq_test( struct mgsl_struct *info ) | |||
7097 | usc_reset(info); | 7094 | usc_reset(info); |
7098 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | 7095 | spin_unlock_irqrestore(&info->irq_spinlock,flags); |
7099 | 7096 | ||
7100 | if ( !info->irq_occurred ) | 7097 | return info->irq_occurred; |
7101 | return FALSE; | ||
7102 | else | ||
7103 | return TRUE; | ||
7104 | 7098 | ||
7105 | } /* end of mgsl_irq_test() */ | 7099 | } /* end of mgsl_irq_test() */ |
7106 | 7100 | ||
@@ -7111,16 +7105,16 @@ static BOOLEAN mgsl_irq_test( struct mgsl_struct *info ) | |||
7111 | * using single buffer DMA mode. | 7105 | * using single buffer DMA mode. |
7112 | * | 7106 | * |
7113 | * Arguments: info pointer to device instance data | 7107 | * Arguments: info pointer to device instance data |
7114 | * Return Value: TRUE if test passed, otherwise FALSE | 7108 | * Return Value: true if test passed, otherwise false |
7115 | */ | 7109 | */ |
7116 | static BOOLEAN mgsl_dma_test( struct mgsl_struct *info ) | 7110 | static bool mgsl_dma_test( struct mgsl_struct *info ) |
7117 | { | 7111 | { |
7118 | unsigned short FifoLevel; | 7112 | unsigned short FifoLevel; |
7119 | unsigned long phys_addr; | 7113 | unsigned long phys_addr; |
7120 | unsigned int FrameSize; | 7114 | unsigned int FrameSize; |
7121 | unsigned int i; | 7115 | unsigned int i; |
7122 | char *TmpPtr; | 7116 | char *TmpPtr; |
7123 | BOOLEAN rc = TRUE; | 7117 | bool rc = true; |
7124 | unsigned short status=0; | 7118 | unsigned short status=0; |
7125 | unsigned long EndTime; | 7119 | unsigned long EndTime; |
7126 | unsigned long flags; | 7120 | unsigned long flags; |
@@ -7233,7 +7227,7 @@ static BOOLEAN mgsl_dma_test( struct mgsl_struct *info ) | |||
7233 | 7227 | ||
7234 | for(;;) { | 7228 | for(;;) { |
7235 | if (time_after(jiffies, EndTime)) { | 7229 | if (time_after(jiffies, EndTime)) { |
7236 | rc = FALSE; | 7230 | rc = false; |
7237 | break; | 7231 | break; |
7238 | } | 7232 | } |
7239 | 7233 | ||
@@ -7289,7 +7283,7 @@ static BOOLEAN mgsl_dma_test( struct mgsl_struct *info ) | |||
7289 | 7283 | ||
7290 | for(;;) { | 7284 | for(;;) { |
7291 | if (time_after(jiffies, EndTime)) { | 7285 | if (time_after(jiffies, EndTime)) { |
7292 | rc = FALSE; | 7286 | rc = false; |
7293 | break; | 7287 | break; |
7294 | } | 7288 | } |
7295 | 7289 | ||
@@ -7309,7 +7303,7 @@ static BOOLEAN mgsl_dma_test( struct mgsl_struct *info ) | |||
7309 | } | 7303 | } |
7310 | 7304 | ||
7311 | 7305 | ||
7312 | if ( rc == TRUE ) | 7306 | if ( rc ) |
7313 | { | 7307 | { |
7314 | /* Enable 16C32 transmitter. */ | 7308 | /* Enable 16C32 transmitter. */ |
7315 | 7309 | ||
@@ -7337,7 +7331,7 @@ static BOOLEAN mgsl_dma_test( struct mgsl_struct *info ) | |||
7337 | 7331 | ||
7338 | while ( !(status & (BIT6+BIT5+BIT4+BIT2+BIT1)) ) { | 7332 | while ( !(status & (BIT6+BIT5+BIT4+BIT2+BIT1)) ) { |
7339 | if (time_after(jiffies, EndTime)) { | 7333 | if (time_after(jiffies, EndTime)) { |
7340 | rc = FALSE; | 7334 | rc = false; |
7341 | break; | 7335 | break; |
7342 | } | 7336 | } |
7343 | 7337 | ||
@@ -7348,13 +7342,13 @@ static BOOLEAN mgsl_dma_test( struct mgsl_struct *info ) | |||
7348 | } | 7342 | } |
7349 | 7343 | ||
7350 | 7344 | ||
7351 | if ( rc == TRUE ){ | 7345 | if ( rc ){ |
7352 | /* CHECK FOR TRANSMIT ERRORS */ | 7346 | /* CHECK FOR TRANSMIT ERRORS */ |
7353 | if ( status & (BIT5 + BIT1) ) | 7347 | if ( status & (BIT5 + BIT1) ) |
7354 | rc = FALSE; | 7348 | rc = false; |
7355 | } | 7349 | } |
7356 | 7350 | ||
7357 | if ( rc == TRUE ) { | 7351 | if ( rc ) { |
7358 | /* WAIT FOR RECEIVE COMPLETE */ | 7352 | /* WAIT FOR RECEIVE COMPLETE */ |
7359 | 7353 | ||
7360 | /* Wait 100ms */ | 7354 | /* Wait 100ms */ |
@@ -7364,7 +7358,7 @@ static BOOLEAN mgsl_dma_test( struct mgsl_struct *info ) | |||
7364 | status=info->rx_buffer_list[0].status; | 7358 | status=info->rx_buffer_list[0].status; |
7365 | while ( status == 0 ) { | 7359 | while ( status == 0 ) { |
7366 | if (time_after(jiffies, EndTime)) { | 7360 | if (time_after(jiffies, EndTime)) { |
7367 | rc = FALSE; | 7361 | rc = false; |
7368 | break; | 7362 | break; |
7369 | } | 7363 | } |
7370 | status=info->rx_buffer_list[0].status; | 7364 | status=info->rx_buffer_list[0].status; |
@@ -7372,17 +7366,17 @@ static BOOLEAN mgsl_dma_test( struct mgsl_struct *info ) | |||
7372 | } | 7366 | } |
7373 | 7367 | ||
7374 | 7368 | ||
7375 | if ( rc == TRUE ) { | 7369 | if ( rc ) { |
7376 | /* CHECK FOR RECEIVE ERRORS */ | 7370 | /* CHECK FOR RECEIVE ERRORS */ |
7377 | status = info->rx_buffer_list[0].status; | 7371 | status = info->rx_buffer_list[0].status; |
7378 | 7372 | ||
7379 | if ( status & (BIT8 + BIT3 + BIT1) ) { | 7373 | if ( status & (BIT8 + BIT3 + BIT1) ) { |
7380 | /* receive error has occurred */ | 7374 | /* receive error has occurred */ |
7381 | rc = FALSE; | 7375 | rc = false; |
7382 | } else { | 7376 | } else { |
7383 | if ( memcmp( info->tx_buffer_list[0].virt_addr , | 7377 | if ( memcmp( info->tx_buffer_list[0].virt_addr , |
7384 | info->rx_buffer_list[0].virt_addr, FrameSize ) ){ | 7378 | info->rx_buffer_list[0].virt_addr, FrameSize ) ){ |
7385 | rc = FALSE; | 7379 | rc = false; |
7386 | } | 7380 | } |
7387 | } | 7381 | } |
7388 | } | 7382 | } |
@@ -7445,9 +7439,9 @@ static int mgsl_adapter_test( struct mgsl_struct *info ) | |||
7445 | * Test the shared memory on a PCI adapter. | 7439 | * Test the shared memory on a PCI adapter. |
7446 | * | 7440 | * |
7447 | * Arguments: info pointer to device instance data | 7441 | * Arguments: info pointer to device instance data |
7448 | * Return Value: TRUE if test passed, otherwise FALSE | 7442 | * Return Value: true if test passed, otherwise false |
7449 | */ | 7443 | */ |
7450 | static BOOLEAN mgsl_memory_test( struct mgsl_struct *info ) | 7444 | static bool mgsl_memory_test( struct mgsl_struct *info ) |
7451 | { | 7445 | { |
7452 | static unsigned long BitPatterns[] = | 7446 | static unsigned long BitPatterns[] = |
7453 | { 0x0, 0x55555555, 0xaaaaaaaa, 0x66666666, 0x99999999, 0xffffffff, 0x12345678 }; | 7447 | { 0x0, 0x55555555, 0xaaaaaaaa, 0x66666666, 0x99999999, 0xffffffff, 0x12345678 }; |
@@ -7457,7 +7451,7 @@ static BOOLEAN mgsl_memory_test( struct mgsl_struct *info ) | |||
7457 | unsigned long * TestAddr; | 7451 | unsigned long * TestAddr; |
7458 | 7452 | ||
7459 | if ( info->bus_type != MGSL_BUS_TYPE_PCI ) | 7453 | if ( info->bus_type != MGSL_BUS_TYPE_PCI ) |
7460 | return TRUE; | 7454 | return true; |
7461 | 7455 | ||
7462 | TestAddr = (unsigned long *)info->memory_base; | 7456 | TestAddr = (unsigned long *)info->memory_base; |
7463 | 7457 | ||
@@ -7466,7 +7460,7 @@ static BOOLEAN mgsl_memory_test( struct mgsl_struct *info ) | |||
7466 | for ( i = 0 ; i < Patterncount ; i++ ) { | 7460 | for ( i = 0 ; i < Patterncount ; i++ ) { |
7467 | *TestAddr = BitPatterns[i]; | 7461 | *TestAddr = BitPatterns[i]; |
7468 | if ( *TestAddr != BitPatterns[i] ) | 7462 | if ( *TestAddr != BitPatterns[i] ) |
7469 | return FALSE; | 7463 | return false; |
7470 | } | 7464 | } |
7471 | 7465 | ||
7472 | /* Test address lines with incrementing pattern over */ | 7466 | /* Test address lines with incrementing pattern over */ |
@@ -7481,13 +7475,13 @@ static BOOLEAN mgsl_memory_test( struct mgsl_struct *info ) | |||
7481 | 7475 | ||
7482 | for ( i = 0 ; i < TestLimit ; i++ ) { | 7476 | for ( i = 0 ; i < TestLimit ; i++ ) { |
7483 | if ( *TestAddr != i * 4 ) | 7477 | if ( *TestAddr != i * 4 ) |
7484 | return FALSE; | 7478 | return false; |
7485 | TestAddr++; | 7479 | TestAddr++; |
7486 | } | 7480 | } |
7487 | 7481 | ||
7488 | memset( info->memory_base, 0, SHARED_MEM_ADDRESS_SIZE ); | 7482 | memset( info->memory_base, 0, SHARED_MEM_ADDRESS_SIZE ); |
7489 | 7483 | ||
7490 | return TRUE; | 7484 | return true; |
7491 | 7485 | ||
7492 | } /* End Of mgsl_memory_test() */ | 7486 | } /* End Of mgsl_memory_test() */ |
7493 | 7487 | ||
@@ -7604,7 +7598,7 @@ static void mgsl_tx_timeout(unsigned long context) | |||
7604 | info->icount.txtimeout++; | 7598 | info->icount.txtimeout++; |
7605 | } | 7599 | } |
7606 | spin_lock_irqsave(&info->irq_spinlock,flags); | 7600 | spin_lock_irqsave(&info->irq_spinlock,flags); |
7607 | info->tx_active = 0; | 7601 | info->tx_active = false; |
7608 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | 7602 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; |
7609 | 7603 | ||
7610 | if ( info->params.flags & HDLC_FLAG_HDLC_LOOPMODE ) | 7604 | if ( info->params.flags & HDLC_FLAG_HDLC_LOOPMODE ) |
@@ -7632,7 +7626,7 @@ static int mgsl_loopmode_send_done( struct mgsl_struct * info ) | |||
7632 | spin_lock_irqsave(&info->irq_spinlock,flags); | 7626 | spin_lock_irqsave(&info->irq_spinlock,flags); |
7633 | if (info->params.flags & HDLC_FLAG_HDLC_LOOPMODE) { | 7627 | if (info->params.flags & HDLC_FLAG_HDLC_LOOPMODE) { |
7634 | if (info->tx_active) | 7628 | if (info->tx_active) |
7635 | info->loopmode_send_done_requested = TRUE; | 7629 | info->loopmode_send_done_requested = true; |
7636 | else | 7630 | else |
7637 | usc_loopmode_send_done(info); | 7631 | usc_loopmode_send_done(info); |
7638 | } | 7632 | } |
@@ -7646,7 +7640,7 @@ static int mgsl_loopmode_send_done( struct mgsl_struct * info ) | |||
7646 | */ | 7640 | */ |
7647 | static void usc_loopmode_send_done( struct mgsl_struct * info ) | 7641 | static void usc_loopmode_send_done( struct mgsl_struct * info ) |
7648 | { | 7642 | { |
7649 | info->loopmode_send_done_requested = FALSE; | 7643 | info->loopmode_send_done_requested = false; |
7650 | /* clear CMR:13 to 0 to start echoing RxData to TxData */ | 7644 | /* clear CMR:13 to 0 to start echoing RxData to TxData */ |
7651 | info->cmr_value &= ~BIT13; | 7645 | info->cmr_value &= ~BIT13; |
7652 | usc_OutReg(info, CMR, info->cmr_value); | 7646 | usc_OutReg(info, CMR, info->cmr_value); |
@@ -7668,7 +7662,7 @@ static void usc_loopmode_cancel_transmit( struct mgsl_struct * info ) | |||
7668 | */ | 7662 | */ |
7669 | static void usc_loopmode_insert_request( struct mgsl_struct * info ) | 7663 | static void usc_loopmode_insert_request( struct mgsl_struct * info ) |
7670 | { | 7664 | { |
7671 | info->loopmode_insert_requested = TRUE; | 7665 | info->loopmode_insert_requested = true; |
7672 | 7666 | ||
7673 | /* enable RxAbort irq. On next RxAbort, clear CMR:13 to | 7667 | /* enable RxAbort irq. On next RxAbort, clear CMR:13 to |
7674 | * begin repeating TxData on RxData (complete insertion) | 7668 | * begin repeating TxData on RxData (complete insertion) |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 3c89266c8255..f3d8d72e5ea4 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -117,7 +117,7 @@ static struct pci_driver pci_driver = { | |||
117 | .remove = __devexit_p(remove_one), | 117 | .remove = __devexit_p(remove_one), |
118 | }; | 118 | }; |
119 | 119 | ||
120 | static int pci_registered; | 120 | static bool pci_registered; |
121 | 121 | ||
122 | /* | 122 | /* |
123 | * module configuration and status | 123 | * module configuration and status |
@@ -289,12 +289,12 @@ struct slgt_info { | |||
289 | 289 | ||
290 | struct work_struct task; | 290 | struct work_struct task; |
291 | u32 pending_bh; | 291 | u32 pending_bh; |
292 | int bh_requested; | 292 | bool bh_requested; |
293 | int bh_running; | 293 | bool bh_running; |
294 | 294 | ||
295 | int isr_overflow; | 295 | int isr_overflow; |
296 | int irq_requested; /* nonzero if IRQ requested */ | 296 | bool irq_requested; /* true if IRQ requested */ |
297 | int irq_occurred; /* for diagnostics use */ | 297 | bool irq_occurred; /* for diagnostics use */ |
298 | 298 | ||
299 | /* device configuration */ | 299 | /* device configuration */ |
300 | 300 | ||
@@ -304,7 +304,7 @@ struct slgt_info { | |||
304 | 304 | ||
305 | unsigned char __iomem * reg_addr; /* memory mapped registers address */ | 305 | unsigned char __iomem * reg_addr; /* memory mapped registers address */ |
306 | u32 phys_reg_addr; | 306 | u32 phys_reg_addr; |
307 | int reg_addr_requested; | 307 | bool reg_addr_requested; |
308 | 308 | ||
309 | MGSL_PARAMS params; /* communications parameters */ | 309 | MGSL_PARAMS params; /* communications parameters */ |
310 | u32 idle_mode; | 310 | u32 idle_mode; |
@@ -315,11 +315,11 @@ struct slgt_info { | |||
315 | 315 | ||
316 | /* device status */ | 316 | /* device status */ |
317 | 317 | ||
318 | int rx_enabled; | 318 | bool rx_enabled; |
319 | int rx_restart; | 319 | bool rx_restart; |
320 | 320 | ||
321 | int tx_enabled; | 321 | bool tx_enabled; |
322 | int tx_active; | 322 | bool tx_active; |
323 | 323 | ||
324 | unsigned char signals; /* serial signal states */ | 324 | unsigned char signals; /* serial signal states */ |
325 | int init_error; /* initialization error */ | 325 | int init_error; /* initialization error */ |
@@ -329,7 +329,7 @@ struct slgt_info { | |||
329 | 329 | ||
330 | char flag_buf[MAX_ASYNC_BUFFER_SIZE]; | 330 | char flag_buf[MAX_ASYNC_BUFFER_SIZE]; |
331 | char char_buf[MAX_ASYNC_BUFFER_SIZE]; | 331 | char char_buf[MAX_ASYNC_BUFFER_SIZE]; |
332 | BOOLEAN drop_rts_on_tx_done; | 332 | bool drop_rts_on_tx_done; |
333 | struct _input_signal_events input_signal_events; | 333 | struct _input_signal_events input_signal_events; |
334 | 334 | ||
335 | int dcd_chkcount; /* check counts to prevent */ | 335 | int dcd_chkcount; /* check counts to prevent */ |
@@ -467,8 +467,8 @@ static void rx_start(struct slgt_info *info); | |||
467 | static void reset_rbufs(struct slgt_info *info); | 467 | static void reset_rbufs(struct slgt_info *info); |
468 | static void free_rbufs(struct slgt_info *info, unsigned int first, unsigned int last); | 468 | static void free_rbufs(struct slgt_info *info, unsigned int first, unsigned int last); |
469 | static void rdma_reset(struct slgt_info *info); | 469 | static void rdma_reset(struct slgt_info *info); |
470 | static int rx_get_frame(struct slgt_info *info); | 470 | static bool rx_get_frame(struct slgt_info *info); |
471 | static int rx_get_buf(struct slgt_info *info); | 471 | static bool rx_get_buf(struct slgt_info *info); |
472 | 472 | ||
473 | static void tx_start(struct slgt_info *info); | 473 | static void tx_start(struct slgt_info *info); |
474 | static void tx_stop(struct slgt_info *info); | 474 | static void tx_stop(struct slgt_info *info); |
@@ -1968,8 +1968,8 @@ static int bh_action(struct slgt_info *info) | |||
1968 | rc = BH_STATUS; | 1968 | rc = BH_STATUS; |
1969 | } else { | 1969 | } else { |
1970 | /* Mark BH routine as complete */ | 1970 | /* Mark BH routine as complete */ |
1971 | info->bh_running = 0; | 1971 | info->bh_running = false; |
1972 | info->bh_requested = 0; | 1972 | info->bh_requested = false; |
1973 | rc = 0; | 1973 | rc = 0; |
1974 | } | 1974 | } |
1975 | 1975 | ||
@@ -1988,7 +1988,7 @@ static void bh_handler(struct work_struct *work) | |||
1988 | 1988 | ||
1989 | if (!info) | 1989 | if (!info) |
1990 | return; | 1990 | return; |
1991 | info->bh_running = 1; | 1991 | info->bh_running = true; |
1992 | 1992 | ||
1993 | while((action = bh_action(info))) { | 1993 | while((action = bh_action(info))) { |
1994 | switch (action) { | 1994 | switch (action) { |
@@ -2158,7 +2158,7 @@ static void isr_serial(struct slgt_info *info) | |||
2158 | 2158 | ||
2159 | wr_reg16(info, SSR, status); /* clear pending */ | 2159 | wr_reg16(info, SSR, status); /* clear pending */ |
2160 | 2160 | ||
2161 | info->irq_occurred = 1; | 2161 | info->irq_occurred = true; |
2162 | 2162 | ||
2163 | if (info->params.mode == MGSL_MODE_ASYNC) { | 2163 | if (info->params.mode == MGSL_MODE_ASYNC) { |
2164 | if (status & IRQ_TXIDLE) { | 2164 | if (status & IRQ_TXIDLE) { |
@@ -2225,7 +2225,7 @@ static void isr_rdma(struct slgt_info *info) | |||
2225 | 2225 | ||
2226 | if (status & (BIT5 + BIT4)) { | 2226 | if (status & (BIT5 + BIT4)) { |
2227 | DBGISR(("%s isr_rdma rx_restart=1\n", info->device_name)); | 2227 | DBGISR(("%s isr_rdma rx_restart=1\n", info->device_name)); |
2228 | info->rx_restart = 1; | 2228 | info->rx_restart = true; |
2229 | } | 2229 | } |
2230 | info->pending_bh |= BH_RECEIVE; | 2230 | info->pending_bh |= BH_RECEIVE; |
2231 | } | 2231 | } |
@@ -2276,14 +2276,14 @@ static void isr_txeom(struct slgt_info *info, unsigned short status) | |||
2276 | info->icount.txok++; | 2276 | info->icount.txok++; |
2277 | } | 2277 | } |
2278 | 2278 | ||
2279 | info->tx_active = 0; | 2279 | info->tx_active = false; |
2280 | info->tx_count = 0; | 2280 | info->tx_count = 0; |
2281 | 2281 | ||
2282 | del_timer(&info->tx_timer); | 2282 | del_timer(&info->tx_timer); |
2283 | 2283 | ||
2284 | if (info->params.mode != MGSL_MODE_ASYNC && info->drop_rts_on_tx_done) { | 2284 | if (info->params.mode != MGSL_MODE_ASYNC && info->drop_rts_on_tx_done) { |
2285 | info->signals &= ~SerialSignal_RTS; | 2285 | info->signals &= ~SerialSignal_RTS; |
2286 | info->drop_rts_on_tx_done = 0; | 2286 | info->drop_rts_on_tx_done = false; |
2287 | set_signals(info); | 2287 | set_signals(info); |
2288 | } | 2288 | } |
2289 | 2289 | ||
@@ -2337,7 +2337,7 @@ static irqreturn_t slgt_interrupt(int dummy, void *dev_id) | |||
2337 | 2337 | ||
2338 | while((gsr = rd_reg32(info, GSR) & 0xffffff00)) { | 2338 | while((gsr = rd_reg32(info, GSR) & 0xffffff00)) { |
2339 | DBGISR(("%s gsr=%08x\n", info->device_name, gsr)); | 2339 | DBGISR(("%s gsr=%08x\n", info->device_name, gsr)); |
2340 | info->irq_occurred = 1; | 2340 | info->irq_occurred = true; |
2341 | for(i=0; i < info->port_count ; i++) { | 2341 | for(i=0; i < info->port_count ; i++) { |
2342 | if (info->port_array[i] == NULL) | 2342 | if (info->port_array[i] == NULL) |
2343 | continue; | 2343 | continue; |
@@ -2374,7 +2374,7 @@ static irqreturn_t slgt_interrupt(int dummy, void *dev_id) | |||
2374 | !port->bh_requested) { | 2374 | !port->bh_requested) { |
2375 | DBGISR(("%s bh queued\n", port->device_name)); | 2375 | DBGISR(("%s bh queued\n", port->device_name)); |
2376 | schedule_work(&port->task); | 2376 | schedule_work(&port->task); |
2377 | port->bh_requested = 1; | 2377 | port->bh_requested = true; |
2378 | } | 2378 | } |
2379 | } | 2379 | } |
2380 | 2380 | ||
@@ -3110,7 +3110,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3110 | { | 3110 | { |
3111 | DECLARE_WAITQUEUE(wait, current); | 3111 | DECLARE_WAITQUEUE(wait, current); |
3112 | int retval; | 3112 | int retval; |
3113 | int do_clocal = 0, extra_count = 0; | 3113 | bool do_clocal = false; |
3114 | bool extra_count = false; | ||
3114 | unsigned long flags; | 3115 | unsigned long flags; |
3115 | 3116 | ||
3116 | DBGINFO(("%s block_til_ready\n", tty->driver->name)); | 3117 | DBGINFO(("%s block_til_ready\n", tty->driver->name)); |
@@ -3122,7 +3123,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3122 | } | 3123 | } |
3123 | 3124 | ||
3124 | if (tty->termios->c_cflag & CLOCAL) | 3125 | if (tty->termios->c_cflag & CLOCAL) |
3125 | do_clocal = 1; | 3126 | do_clocal = true; |
3126 | 3127 | ||
3127 | /* Wait for carrier detect and the line to become | 3128 | /* Wait for carrier detect and the line to become |
3128 | * free (i.e., not in use by the callout). While we are in | 3129 | * free (i.e., not in use by the callout). While we are in |
@@ -3136,7 +3137,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3136 | 3137 | ||
3137 | spin_lock_irqsave(&info->lock, flags); | 3138 | spin_lock_irqsave(&info->lock, flags); |
3138 | if (!tty_hung_up_p(filp)) { | 3139 | if (!tty_hung_up_p(filp)) { |
3139 | extra_count = 1; | 3140 | extra_count = true; |
3140 | info->count--; | 3141 | info->count--; |
3141 | } | 3142 | } |
3142 | spin_unlock_irqrestore(&info->lock, flags); | 3143 | spin_unlock_irqrestore(&info->lock, flags); |
@@ -3321,7 +3322,7 @@ static int claim_resources(struct slgt_info *info) | |||
3321 | goto errout; | 3322 | goto errout; |
3322 | } | 3323 | } |
3323 | else | 3324 | else |
3324 | info->reg_addr_requested = 1; | 3325 | info->reg_addr_requested = true; |
3325 | 3326 | ||
3326 | info->reg_addr = ioremap(info->phys_reg_addr, SLGT_REG_SIZE); | 3327 | info->reg_addr = ioremap(info->phys_reg_addr, SLGT_REG_SIZE); |
3327 | if (!info->reg_addr) { | 3328 | if (!info->reg_addr) { |
@@ -3341,12 +3342,12 @@ static void release_resources(struct slgt_info *info) | |||
3341 | { | 3342 | { |
3342 | if (info->irq_requested) { | 3343 | if (info->irq_requested) { |
3343 | free_irq(info->irq_level, info); | 3344 | free_irq(info->irq_level, info); |
3344 | info->irq_requested = 0; | 3345 | info->irq_requested = false; |
3345 | } | 3346 | } |
3346 | 3347 | ||
3347 | if (info->reg_addr_requested) { | 3348 | if (info->reg_addr_requested) { |
3348 | release_mem_region(info->phys_reg_addr, SLGT_REG_SIZE); | 3349 | release_mem_region(info->phys_reg_addr, SLGT_REG_SIZE); |
3349 | info->reg_addr_requested = 0; | 3350 | info->reg_addr_requested = false; |
3350 | } | 3351 | } |
3351 | 3352 | ||
3352 | if (info->reg_addr) { | 3353 | if (info->reg_addr) { |
@@ -3511,7 +3512,7 @@ static void device_init(int adapter_num, struct pci_dev *pdev) | |||
3511 | port_array[0]->device_name, | 3512 | port_array[0]->device_name, |
3512 | port_array[0]->irq_level)); | 3513 | port_array[0]->irq_level)); |
3513 | } else { | 3514 | } else { |
3514 | port_array[0]->irq_requested = 1; | 3515 | port_array[0]->irq_requested = true; |
3515 | adapter_test(port_array[0]); | 3516 | adapter_test(port_array[0]); |
3516 | for (i=1 ; i < port_count ; i++) { | 3517 | for (i=1 ; i < port_count ; i++) { |
3517 | port_array[i]->init_error = port_array[0]->init_error; | 3518 | port_array[i]->init_error = port_array[0]->init_error; |
@@ -3654,7 +3655,7 @@ static int __init slgt_init(void) | |||
3654 | printk("%s pci_register_driver error=%d\n", driver_name, rc); | 3655 | printk("%s pci_register_driver error=%d\n", driver_name, rc); |
3655 | goto error; | 3656 | goto error; |
3656 | } | 3657 | } |
3657 | pci_registered = 1; | 3658 | pci_registered = true; |
3658 | 3659 | ||
3659 | if (!slgt_device_list) | 3660 | if (!slgt_device_list) |
3660 | printk("%s no devices found\n",driver_name); | 3661 | printk("%s no devices found\n",driver_name); |
@@ -3812,8 +3813,8 @@ static void rx_stop(struct slgt_info *info) | |||
3812 | 3813 | ||
3813 | rdma_reset(info); | 3814 | rdma_reset(info); |
3814 | 3815 | ||
3815 | info->rx_enabled = 0; | 3816 | info->rx_enabled = false; |
3816 | info->rx_restart = 0; | 3817 | info->rx_restart = false; |
3817 | } | 3818 | } |
3818 | 3819 | ||
3819 | static void rx_start(struct slgt_info *info) | 3820 | static void rx_start(struct slgt_info *info) |
@@ -3849,8 +3850,8 @@ static void rx_start(struct slgt_info *info) | |||
3849 | /* enable receiver */ | 3850 | /* enable receiver */ |
3850 | wr_reg16(info, RCR, (unsigned short)(rd_reg16(info, RCR) | BIT1)); | 3851 | wr_reg16(info, RCR, (unsigned short)(rd_reg16(info, RCR) | BIT1)); |
3851 | 3852 | ||
3852 | info->rx_restart = 0; | 3853 | info->rx_restart = false; |
3853 | info->rx_enabled = 1; | 3854 | info->rx_enabled = true; |
3854 | } | 3855 | } |
3855 | 3856 | ||
3856 | static void tx_start(struct slgt_info *info) | 3857 | static void tx_start(struct slgt_info *info) |
@@ -3858,11 +3859,11 @@ static void tx_start(struct slgt_info *info) | |||
3858 | if (!info->tx_enabled) { | 3859 | if (!info->tx_enabled) { |
3859 | wr_reg16(info, TCR, | 3860 | wr_reg16(info, TCR, |
3860 | (unsigned short)((rd_reg16(info, TCR) | BIT1) & ~BIT2)); | 3861 | (unsigned short)((rd_reg16(info, TCR) | BIT1) & ~BIT2)); |
3861 | info->tx_enabled = TRUE; | 3862 | info->tx_enabled = true; |
3862 | } | 3863 | } |
3863 | 3864 | ||
3864 | if (info->tx_count) { | 3865 | if (info->tx_count) { |
3865 | info->drop_rts_on_tx_done = 0; | 3866 | info->drop_rts_on_tx_done = false; |
3866 | 3867 | ||
3867 | if (info->params.mode != MGSL_MODE_ASYNC) { | 3868 | if (info->params.mode != MGSL_MODE_ASYNC) { |
3868 | if (info->params.flags & HDLC_FLAG_AUTO_RTS) { | 3869 | if (info->params.flags & HDLC_FLAG_AUTO_RTS) { |
@@ -3870,7 +3871,7 @@ static void tx_start(struct slgt_info *info) | |||
3870 | if (!(info->signals & SerialSignal_RTS)) { | 3871 | if (!(info->signals & SerialSignal_RTS)) { |
3871 | info->signals |= SerialSignal_RTS; | 3872 | info->signals |= SerialSignal_RTS; |
3872 | set_signals(info); | 3873 | set_signals(info); |
3873 | info->drop_rts_on_tx_done = 1; | 3874 | info->drop_rts_on_tx_done = true; |
3874 | } | 3875 | } |
3875 | } | 3876 | } |
3876 | 3877 | ||
@@ -3888,7 +3889,7 @@ static void tx_start(struct slgt_info *info) | |||
3888 | wr_reg16(info, SSR, IRQ_TXIDLE); | 3889 | wr_reg16(info, SSR, IRQ_TXIDLE); |
3889 | } | 3890 | } |
3890 | tdma_start(info); | 3891 | tdma_start(info); |
3891 | info->tx_active = 1; | 3892 | info->tx_active = true; |
3892 | } | 3893 | } |
3893 | } | 3894 | } |
3894 | 3895 | ||
@@ -3949,8 +3950,8 @@ static void tx_stop(struct slgt_info *info) | |||
3949 | 3950 | ||
3950 | reset_tbufs(info); | 3951 | reset_tbufs(info); |
3951 | 3952 | ||
3952 | info->tx_enabled = 0; | 3953 | info->tx_enabled = false; |
3953 | info->tx_active = 0; | 3954 | info->tx_active = false; |
3954 | } | 3955 | } |
3955 | 3956 | ||
3956 | static void reset_port(struct slgt_info *info) | 3957 | static void reset_port(struct slgt_info *info) |
@@ -4470,14 +4471,13 @@ static void reset_rbufs(struct slgt_info *info) | |||
4470 | /* | 4471 | /* |
4471 | * pass receive HDLC frame to upper layer | 4472 | * pass receive HDLC frame to upper layer |
4472 | * | 4473 | * |
4473 | * return 1 if frame available, otherwise 0 | 4474 | * return true if frame available, otherwise false |
4474 | */ | 4475 | */ |
4475 | static int rx_get_frame(struct slgt_info *info) | 4476 | static bool rx_get_frame(struct slgt_info *info) |
4476 | { | 4477 | { |
4477 | unsigned int start, end; | 4478 | unsigned int start, end; |
4478 | unsigned short status; | 4479 | unsigned short status; |
4479 | unsigned int framesize = 0; | 4480 | unsigned int framesize = 0; |
4480 | int rc = 0; | ||
4481 | unsigned long flags; | 4481 | unsigned long flags; |
4482 | struct tty_struct *tty = info->tty; | 4482 | struct tty_struct *tty = info->tty; |
4483 | unsigned char addr_field = 0xff; | 4483 | unsigned char addr_field = 0xff; |
@@ -4601,23 +4601,23 @@ check_again: | |||
4601 | } | 4601 | } |
4602 | } | 4602 | } |
4603 | free_rbufs(info, start, end); | 4603 | free_rbufs(info, start, end); |
4604 | rc = 1; | 4604 | return true; |
4605 | 4605 | ||
4606 | cleanup: | 4606 | cleanup: |
4607 | return rc; | 4607 | return false; |
4608 | } | 4608 | } |
4609 | 4609 | ||
4610 | /* | 4610 | /* |
4611 | * pass receive buffer (RAW synchronous mode) to tty layer | 4611 | * pass receive buffer (RAW synchronous mode) to tty layer |
4612 | * return 1 if buffer available, otherwise 0 | 4612 | * return true if buffer available, otherwise false |
4613 | */ | 4613 | */ |
4614 | static int rx_get_buf(struct slgt_info *info) | 4614 | static bool rx_get_buf(struct slgt_info *info) |
4615 | { | 4615 | { |
4616 | unsigned int i = info->rbuf_current; | 4616 | unsigned int i = info->rbuf_current; |
4617 | unsigned int count; | 4617 | unsigned int count; |
4618 | 4618 | ||
4619 | if (!desc_complete(info->rbufs[i])) | 4619 | if (!desc_complete(info->rbufs[i])) |
4620 | return 0; | 4620 | return false; |
4621 | count = desc_count(info->rbufs[i]); | 4621 | count = desc_count(info->rbufs[i]); |
4622 | switch(info->params.mode) { | 4622 | switch(info->params.mode) { |
4623 | case MGSL_MODE_MONOSYNC: | 4623 | case MGSL_MODE_MONOSYNC: |
@@ -4633,7 +4633,7 @@ static int rx_get_buf(struct slgt_info *info) | |||
4633 | ldisc_receive_buf(info->tty, info->rbufs[i].buf, | 4633 | ldisc_receive_buf(info->tty, info->rbufs[i].buf, |
4634 | info->flag_buf, count); | 4634 | info->flag_buf, count); |
4635 | free_rbufs(info, i, i); | 4635 | free_rbufs(info, i, i); |
4636 | return 1; | 4636 | return true; |
4637 | } | 4637 | } |
4638 | 4638 | ||
4639 | static void reset_tbufs(struct slgt_info *info) | 4639 | static void reset_tbufs(struct slgt_info *info) |
@@ -4758,7 +4758,7 @@ static int irq_test(struct slgt_info *info) | |||
4758 | 4758 | ||
4759 | /* assume failure */ | 4759 | /* assume failure */ |
4760 | info->init_error = DiagStatus_IrqFailure; | 4760 | info->init_error = DiagStatus_IrqFailure; |
4761 | info->irq_occurred = FALSE; | 4761 | info->irq_occurred = false; |
4762 | 4762 | ||
4763 | spin_unlock_irqrestore(&info->lock, flags); | 4763 | spin_unlock_irqrestore(&info->lock, flags); |
4764 | 4764 | ||
@@ -4891,7 +4891,7 @@ static void tx_timeout(unsigned long context) | |||
4891 | info->icount.txtimeout++; | 4891 | info->icount.txtimeout++; |
4892 | } | 4892 | } |
4893 | spin_lock_irqsave(&info->lock,flags); | 4893 | spin_lock_irqsave(&info->lock,flags); |
4894 | info->tx_active = 0; | 4894 | info->tx_active = false; |
4895 | info->tx_count = 0; | 4895 | info->tx_count = 0; |
4896 | spin_unlock_irqrestore(&info->lock,flags); | 4896 | spin_unlock_irqrestore(&info->lock,flags); |
4897 | 4897 | ||
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index c96062ea72b4..e98c3e6f8216 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -188,9 +188,9 @@ typedef struct _synclinkmp_info { | |||
188 | 188 | ||
189 | u32 pending_bh; | 189 | u32 pending_bh; |
190 | 190 | ||
191 | int bh_running; /* Protection from multiple */ | 191 | bool bh_running; /* Protection from multiple */ |
192 | int isr_overflow; | 192 | int isr_overflow; |
193 | int bh_requested; | 193 | bool bh_requested; |
194 | 194 | ||
195 | int dcd_chkcount; /* check counts to prevent */ | 195 | int dcd_chkcount; /* check counts to prevent */ |
196 | int cts_chkcount; /* too many IRQs if a signal */ | 196 | int cts_chkcount; /* too many IRQs if a signal */ |
@@ -213,11 +213,11 @@ typedef struct _synclinkmp_info { | |||
213 | unsigned char *tmp_rx_buf; | 213 | unsigned char *tmp_rx_buf; |
214 | unsigned int tmp_rx_buf_count; | 214 | unsigned int tmp_rx_buf_count; |
215 | 215 | ||
216 | int rx_enabled; | 216 | bool rx_enabled; |
217 | int rx_overflow; | 217 | bool rx_overflow; |
218 | 218 | ||
219 | int tx_enabled; | 219 | bool tx_enabled; |
220 | int tx_active; | 220 | bool tx_active; |
221 | u32 idle_mode; | 221 | u32 idle_mode; |
222 | 222 | ||
223 | unsigned char ie0_value; | 223 | unsigned char ie0_value; |
@@ -238,13 +238,13 @@ typedef struct _synclinkmp_info { | |||
238 | 238 | ||
239 | unsigned int irq_level; /* interrupt level */ | 239 | unsigned int irq_level; /* interrupt level */ |
240 | unsigned long irq_flags; | 240 | unsigned long irq_flags; |
241 | int irq_requested; /* nonzero if IRQ requested */ | 241 | bool irq_requested; /* true if IRQ requested */ |
242 | 242 | ||
243 | MGSL_PARAMS params; /* communications parameters */ | 243 | MGSL_PARAMS params; /* communications parameters */ |
244 | 244 | ||
245 | unsigned char serial_signals; /* current serial signal states */ | 245 | unsigned char serial_signals; /* current serial signal states */ |
246 | 246 | ||
247 | int irq_occurred; /* for diagnostics use */ | 247 | bool irq_occurred; /* for diagnostics use */ |
248 | unsigned int init_error; /* Initialization startup error */ | 248 | unsigned int init_error; /* Initialization startup error */ |
249 | 249 | ||
250 | u32 last_mem_alloc; | 250 | u32 last_mem_alloc; |
@@ -255,7 +255,7 @@ typedef struct _synclinkmp_info { | |||
255 | unsigned char* sca_base; /* HD64570 SCA Memory address */ | 255 | unsigned char* sca_base; /* HD64570 SCA Memory address */ |
256 | u32 phys_sca_base; | 256 | u32 phys_sca_base; |
257 | u32 sca_offset; | 257 | u32 sca_offset; |
258 | int sca_base_requested; | 258 | bool sca_base_requested; |
259 | 259 | ||
260 | unsigned char* lcr_base; /* local config registers (PCI only) */ | 260 | unsigned char* lcr_base; /* local config registers (PCI only) */ |
261 | u32 phys_lcr_base; | 261 | u32 phys_lcr_base; |
@@ -265,12 +265,12 @@ typedef struct _synclinkmp_info { | |||
265 | unsigned char* statctrl_base; /* status/control register memory */ | 265 | unsigned char* statctrl_base; /* status/control register memory */ |
266 | u32 phys_statctrl_base; | 266 | u32 phys_statctrl_base; |
267 | u32 statctrl_offset; | 267 | u32 statctrl_offset; |
268 | int sca_statctrl_requested; | 268 | bool sca_statctrl_requested; |
269 | 269 | ||
270 | u32 misc_ctrl_value; | 270 | u32 misc_ctrl_value; |
271 | char flag_buf[MAX_ASYNC_BUFFER_SIZE]; | 271 | char flag_buf[MAX_ASYNC_BUFFER_SIZE]; |
272 | char char_buf[MAX_ASYNC_BUFFER_SIZE]; | 272 | char char_buf[MAX_ASYNC_BUFFER_SIZE]; |
273 | BOOLEAN drop_rts_on_tx_done; | 273 | bool drop_rts_on_tx_done; |
274 | 274 | ||
275 | struct _input_signal_events input_signal_events; | 275 | struct _input_signal_events input_signal_events; |
276 | 276 | ||
@@ -571,12 +571,12 @@ static void shutdown(SLMP_INFO *info); | |||
571 | static void program_hw(SLMP_INFO *info); | 571 | static void program_hw(SLMP_INFO *info); |
572 | static void change_params(SLMP_INFO *info); | 572 | static void change_params(SLMP_INFO *info); |
573 | 573 | ||
574 | static int init_adapter(SLMP_INFO *info); | 574 | static bool init_adapter(SLMP_INFO *info); |
575 | static int register_test(SLMP_INFO *info); | 575 | static bool register_test(SLMP_INFO *info); |
576 | static int irq_test(SLMP_INFO *info); | 576 | static bool irq_test(SLMP_INFO *info); |
577 | static int loopback_test(SLMP_INFO *info); | 577 | static bool loopback_test(SLMP_INFO *info); |
578 | static int adapter_test(SLMP_INFO *info); | 578 | static int adapter_test(SLMP_INFO *info); |
579 | static int memory_test(SLMP_INFO *info); | 579 | static bool memory_test(SLMP_INFO *info); |
580 | 580 | ||
581 | static void reset_adapter(SLMP_INFO *info); | 581 | static void reset_adapter(SLMP_INFO *info); |
582 | static void reset_port(SLMP_INFO *info); | 582 | static void reset_port(SLMP_INFO *info); |
@@ -587,7 +587,7 @@ static void rx_stop(SLMP_INFO *info); | |||
587 | static void rx_start(SLMP_INFO *info); | 587 | static void rx_start(SLMP_INFO *info); |
588 | static void rx_reset_buffers(SLMP_INFO *info); | 588 | static void rx_reset_buffers(SLMP_INFO *info); |
589 | static void rx_free_frame_buffers(SLMP_INFO *info, unsigned int first, unsigned int last); | 589 | static void rx_free_frame_buffers(SLMP_INFO *info, unsigned int first, unsigned int last); |
590 | static int rx_get_frame(SLMP_INFO *info); | 590 | static bool rx_get_frame(SLMP_INFO *info); |
591 | 591 | ||
592 | static void tx_start(SLMP_INFO *info); | 592 | static void tx_start(SLMP_INFO *info); |
593 | static void tx_stop(SLMP_INFO *info); | 593 | static void tx_stop(SLMP_INFO *info); |
@@ -1473,7 +1473,7 @@ static inline int line_info(char *buf, SLMP_INFO *info) | |||
1473 | 1473 | ||
1474 | /* Called to print information about devices | 1474 | /* Called to print information about devices |
1475 | */ | 1475 | */ |
1476 | int read_proc(char *page, char **start, off_t off, int count, | 1476 | static int read_proc(char *page, char **start, off_t off, int count, |
1477 | int *eof, void *data) | 1477 | int *eof, void *data) |
1478 | { | 1478 | { |
1479 | int len = 0, l; | 1479 | int len = 0, l; |
@@ -2024,7 +2024,7 @@ static void hdlcdev_exit(SLMP_INFO *info) | |||
2024 | /* Return next bottom half action to perform. | 2024 | /* Return next bottom half action to perform. |
2025 | * Return Value: BH action code or 0 if nothing to do. | 2025 | * Return Value: BH action code or 0 if nothing to do. |
2026 | */ | 2026 | */ |
2027 | int bh_action(SLMP_INFO *info) | 2027 | static int bh_action(SLMP_INFO *info) |
2028 | { | 2028 | { |
2029 | unsigned long flags; | 2029 | unsigned long flags; |
2030 | int rc = 0; | 2030 | int rc = 0; |
@@ -2044,8 +2044,8 @@ int bh_action(SLMP_INFO *info) | |||
2044 | 2044 | ||
2045 | if (!rc) { | 2045 | if (!rc) { |
2046 | /* Mark BH routine as complete */ | 2046 | /* Mark BH routine as complete */ |
2047 | info->bh_running = 0; | 2047 | info->bh_running = false; |
2048 | info->bh_requested = 0; | 2048 | info->bh_requested = false; |
2049 | } | 2049 | } |
2050 | 2050 | ||
2051 | spin_unlock_irqrestore(&info->lock,flags); | 2051 | spin_unlock_irqrestore(&info->lock,flags); |
@@ -2055,7 +2055,7 @@ int bh_action(SLMP_INFO *info) | |||
2055 | 2055 | ||
2056 | /* Perform bottom half processing of work items queued by ISR. | 2056 | /* Perform bottom half processing of work items queued by ISR. |
2057 | */ | 2057 | */ |
2058 | void bh_handler(struct work_struct *work) | 2058 | static void bh_handler(struct work_struct *work) |
2059 | { | 2059 | { |
2060 | SLMP_INFO *info = container_of(work, SLMP_INFO, task); | 2060 | SLMP_INFO *info = container_of(work, SLMP_INFO, task); |
2061 | int action; | 2061 | int action; |
@@ -2067,7 +2067,7 @@ void bh_handler(struct work_struct *work) | |||
2067 | printk( "%s(%d):%s bh_handler() entry\n", | 2067 | printk( "%s(%d):%s bh_handler() entry\n", |
2068 | __FILE__,__LINE__,info->device_name); | 2068 | __FILE__,__LINE__,info->device_name); |
2069 | 2069 | ||
2070 | info->bh_running = 1; | 2070 | info->bh_running = true; |
2071 | 2071 | ||
2072 | while((action = bh_action(info)) != 0) { | 2072 | while((action = bh_action(info)) != 0) { |
2073 | 2073 | ||
@@ -2100,7 +2100,7 @@ void bh_handler(struct work_struct *work) | |||
2100 | __FILE__,__LINE__,info->device_name); | 2100 | __FILE__,__LINE__,info->device_name); |
2101 | } | 2101 | } |
2102 | 2102 | ||
2103 | void bh_receive(SLMP_INFO *info) | 2103 | static void bh_receive(SLMP_INFO *info) |
2104 | { | 2104 | { |
2105 | if ( debug_level >= DEBUG_LEVEL_BH ) | 2105 | if ( debug_level >= DEBUG_LEVEL_BH ) |
2106 | printk( "%s(%d):%s bh_receive()\n", | 2106 | printk( "%s(%d):%s bh_receive()\n", |
@@ -2109,7 +2109,7 @@ void bh_receive(SLMP_INFO *info) | |||
2109 | while( rx_get_frame(info) ); | 2109 | while( rx_get_frame(info) ); |
2110 | } | 2110 | } |
2111 | 2111 | ||
2112 | void bh_transmit(SLMP_INFO *info) | 2112 | static void bh_transmit(SLMP_INFO *info) |
2113 | { | 2113 | { |
2114 | struct tty_struct *tty = info->tty; | 2114 | struct tty_struct *tty = info->tty; |
2115 | 2115 | ||
@@ -2121,7 +2121,7 @@ void bh_transmit(SLMP_INFO *info) | |||
2121 | tty_wakeup(tty); | 2121 | tty_wakeup(tty); |
2122 | } | 2122 | } |
2123 | 2123 | ||
2124 | void bh_status(SLMP_INFO *info) | 2124 | static void bh_status(SLMP_INFO *info) |
2125 | { | 2125 | { |
2126 | if ( debug_level >= DEBUG_LEVEL_BH ) | 2126 | if ( debug_level >= DEBUG_LEVEL_BH ) |
2127 | printk( "%s(%d):%s bh_status() entry\n", | 2127 | printk( "%s(%d):%s bh_status() entry\n", |
@@ -2133,7 +2133,7 @@ void bh_status(SLMP_INFO *info) | |||
2133 | info->cts_chkcount = 0; | 2133 | info->cts_chkcount = 0; |
2134 | } | 2134 | } |
2135 | 2135 | ||
2136 | void isr_timer(SLMP_INFO * info) | 2136 | static void isr_timer(SLMP_INFO * info) |
2137 | { | 2137 | { |
2138 | unsigned char timer = (info->port_num & 1) ? TIMER2 : TIMER0; | 2138 | unsigned char timer = (info->port_num & 1) ? TIMER2 : TIMER0; |
2139 | 2139 | ||
@@ -2152,14 +2152,14 @@ void isr_timer(SLMP_INFO * info) | |||
2152 | */ | 2152 | */ |
2153 | write_reg(info, (unsigned char)(timer + TMCS), 0); | 2153 | write_reg(info, (unsigned char)(timer + TMCS), 0); |
2154 | 2154 | ||
2155 | info->irq_occurred = TRUE; | 2155 | info->irq_occurred = true; |
2156 | 2156 | ||
2157 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2157 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
2158 | printk("%s(%d):%s isr_timer()\n", | 2158 | printk("%s(%d):%s isr_timer()\n", |
2159 | __FILE__,__LINE__,info->device_name); | 2159 | __FILE__,__LINE__,info->device_name); |
2160 | } | 2160 | } |
2161 | 2161 | ||
2162 | void isr_rxint(SLMP_INFO * info) | 2162 | static void isr_rxint(SLMP_INFO * info) |
2163 | { | 2163 | { |
2164 | struct tty_struct *tty = info->tty; | 2164 | struct tty_struct *tty = info->tty; |
2165 | struct mgsl_icount *icount = &info->icount; | 2165 | struct mgsl_icount *icount = &info->icount; |
@@ -2218,7 +2218,7 @@ void isr_rxint(SLMP_INFO * info) | |||
2218 | /* | 2218 | /* |
2219 | * handle async rx data interrupts | 2219 | * handle async rx data interrupts |
2220 | */ | 2220 | */ |
2221 | void isr_rxrdy(SLMP_INFO * info) | 2221 | static void isr_rxrdy(SLMP_INFO * info) |
2222 | { | 2222 | { |
2223 | u16 status; | 2223 | u16 status; |
2224 | unsigned char DataByte; | 2224 | unsigned char DataByte; |
@@ -2232,7 +2232,7 @@ void isr_rxrdy(SLMP_INFO * info) | |||
2232 | while((status = read_reg(info,CST0)) & BIT0) | 2232 | while((status = read_reg(info,CST0)) & BIT0) |
2233 | { | 2233 | { |
2234 | int flag = 0; | 2234 | int flag = 0; |
2235 | int over = 0; | 2235 | bool over = false; |
2236 | DataByte = read_reg(info,TRB); | 2236 | DataByte = read_reg(info,TRB); |
2237 | 2237 | ||
2238 | icount->rx++; | 2238 | icount->rx++; |
@@ -2265,7 +2265,7 @@ void isr_rxrdy(SLMP_INFO * info) | |||
2265 | * reported immediately, and doesn't | 2265 | * reported immediately, and doesn't |
2266 | * affect the current character | 2266 | * affect the current character |
2267 | */ | 2267 | */ |
2268 | over = 1; | 2268 | over = true; |
2269 | } | 2269 | } |
2270 | } | 2270 | } |
2271 | } /* end of if (error) */ | 2271 | } /* end of if (error) */ |
@@ -2318,14 +2318,14 @@ static void isr_txeom(SLMP_INFO * info, unsigned char status) | |||
2318 | info->icount.txok++; | 2318 | info->icount.txok++; |
2319 | } | 2319 | } |
2320 | 2320 | ||
2321 | info->tx_active = 0; | 2321 | info->tx_active = false; |
2322 | info->tx_count = info->tx_put = info->tx_get = 0; | 2322 | info->tx_count = info->tx_put = info->tx_get = 0; |
2323 | 2323 | ||
2324 | del_timer(&info->tx_timer); | 2324 | del_timer(&info->tx_timer); |
2325 | 2325 | ||
2326 | if (info->params.mode != MGSL_MODE_ASYNC && info->drop_rts_on_tx_done ) { | 2326 | if (info->params.mode != MGSL_MODE_ASYNC && info->drop_rts_on_tx_done ) { |
2327 | info->serial_signals &= ~SerialSignal_RTS; | 2327 | info->serial_signals &= ~SerialSignal_RTS; |
2328 | info->drop_rts_on_tx_done = 0; | 2328 | info->drop_rts_on_tx_done = false; |
2329 | set_signals(info); | 2329 | set_signals(info); |
2330 | } | 2330 | } |
2331 | 2331 | ||
@@ -2348,7 +2348,7 @@ static void isr_txeom(SLMP_INFO * info, unsigned char status) | |||
2348 | /* | 2348 | /* |
2349 | * handle tx status interrupts | 2349 | * handle tx status interrupts |
2350 | */ | 2350 | */ |
2351 | void isr_txint(SLMP_INFO * info) | 2351 | static void isr_txint(SLMP_INFO * info) |
2352 | { | 2352 | { |
2353 | unsigned char status = read_reg(info, SR1) & info->ie1_value & (UDRN + IDLE + CCTS); | 2353 | unsigned char status = read_reg(info, SR1) & info->ie1_value & (UDRN + IDLE + CCTS); |
2354 | 2354 | ||
@@ -2376,7 +2376,7 @@ void isr_txint(SLMP_INFO * info) | |||
2376 | /* | 2376 | /* |
2377 | * handle async tx data interrupts | 2377 | * handle async tx data interrupts |
2378 | */ | 2378 | */ |
2379 | void isr_txrdy(SLMP_INFO * info) | 2379 | static void isr_txrdy(SLMP_INFO * info) |
2380 | { | 2380 | { |
2381 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2381 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
2382 | printk("%s(%d):%s isr_txrdy() tx_count=%d\n", | 2382 | printk("%s(%d):%s isr_txrdy() tx_count=%d\n", |
@@ -2398,7 +2398,7 @@ void isr_txrdy(SLMP_INFO * info) | |||
2398 | if ( info->tx_count ) | 2398 | if ( info->tx_count ) |
2399 | tx_load_fifo( info ); | 2399 | tx_load_fifo( info ); |
2400 | else { | 2400 | else { |
2401 | info->tx_active = 0; | 2401 | info->tx_active = false; |
2402 | info->ie0_value &= ~TXRDYE; | 2402 | info->ie0_value &= ~TXRDYE; |
2403 | write_reg(info, IE0, info->ie0_value); | 2403 | write_reg(info, IE0, info->ie0_value); |
2404 | } | 2404 | } |
@@ -2407,7 +2407,7 @@ void isr_txrdy(SLMP_INFO * info) | |||
2407 | info->pending_bh |= BH_TRANSMIT; | 2407 | info->pending_bh |= BH_TRANSMIT; |
2408 | } | 2408 | } |
2409 | 2409 | ||
2410 | void isr_rxdmaok(SLMP_INFO * info) | 2410 | static void isr_rxdmaok(SLMP_INFO * info) |
2411 | { | 2411 | { |
2412 | /* BIT7 = EOT (end of transfer) | 2412 | /* BIT7 = EOT (end of transfer) |
2413 | * BIT6 = EOM (end of message/frame) | 2413 | * BIT6 = EOM (end of message/frame) |
@@ -2424,7 +2424,7 @@ void isr_rxdmaok(SLMP_INFO * info) | |||
2424 | info->pending_bh |= BH_RECEIVE; | 2424 | info->pending_bh |= BH_RECEIVE; |
2425 | } | 2425 | } |
2426 | 2426 | ||
2427 | void isr_rxdmaerror(SLMP_INFO * info) | 2427 | static void isr_rxdmaerror(SLMP_INFO * info) |
2428 | { | 2428 | { |
2429 | /* BIT5 = BOF (buffer overflow) | 2429 | /* BIT5 = BOF (buffer overflow) |
2430 | * BIT4 = COF (counter overflow) | 2430 | * BIT4 = COF (counter overflow) |
@@ -2438,11 +2438,11 @@ void isr_rxdmaerror(SLMP_INFO * info) | |||
2438 | printk("%s(%d):%s isr_rxdmaerror(), status=%02x\n", | 2438 | printk("%s(%d):%s isr_rxdmaerror(), status=%02x\n", |
2439 | __FILE__,__LINE__,info->device_name,status); | 2439 | __FILE__,__LINE__,info->device_name,status); |
2440 | 2440 | ||
2441 | info->rx_overflow = TRUE; | 2441 | info->rx_overflow = true; |
2442 | info->pending_bh |= BH_RECEIVE; | 2442 | info->pending_bh |= BH_RECEIVE; |
2443 | } | 2443 | } |
2444 | 2444 | ||
2445 | void isr_txdmaok(SLMP_INFO * info) | 2445 | static void isr_txdmaok(SLMP_INFO * info) |
2446 | { | 2446 | { |
2447 | unsigned char status_reg1 = read_reg(info, SR1); | 2447 | unsigned char status_reg1 = read_reg(info, SR1); |
2448 | 2448 | ||
@@ -2460,7 +2460,7 @@ void isr_txdmaok(SLMP_INFO * info) | |||
2460 | write_reg(info, IE0, info->ie0_value); | 2460 | write_reg(info, IE0, info->ie0_value); |
2461 | } | 2461 | } |
2462 | 2462 | ||
2463 | void isr_txdmaerror(SLMP_INFO * info) | 2463 | static void isr_txdmaerror(SLMP_INFO * info) |
2464 | { | 2464 | { |
2465 | /* BIT5 = BOF (buffer overflow) | 2465 | /* BIT5 = BOF (buffer overflow) |
2466 | * BIT4 = COF (counter overflow) | 2466 | * BIT4 = COF (counter overflow) |
@@ -2477,7 +2477,7 @@ void isr_txdmaerror(SLMP_INFO * info) | |||
2477 | 2477 | ||
2478 | /* handle input serial signal changes | 2478 | /* handle input serial signal changes |
2479 | */ | 2479 | */ |
2480 | void isr_io_pin( SLMP_INFO *info, u16 status ) | 2480 | static void isr_io_pin( SLMP_INFO *info, u16 status ) |
2481 | { | 2481 | { |
2482 | struct mgsl_icount *icount; | 2482 | struct mgsl_icount *icount; |
2483 | 2483 | ||
@@ -2691,7 +2691,7 @@ static irqreturn_t synclinkmp_interrupt(int dummy, void *dev_id) | |||
2691 | printk("%s(%d):%s queueing bh task.\n", | 2691 | printk("%s(%d):%s queueing bh task.\n", |
2692 | __FILE__,__LINE__,port->device_name); | 2692 | __FILE__,__LINE__,port->device_name); |
2693 | schedule_work(&port->task); | 2693 | schedule_work(&port->task); |
2694 | port->bh_requested = 1; | 2694 | port->bh_requested = true; |
2695 | } | 2695 | } |
2696 | } | 2696 | } |
2697 | 2697 | ||
@@ -3320,7 +3320,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3320 | { | 3320 | { |
3321 | DECLARE_WAITQUEUE(wait, current); | 3321 | DECLARE_WAITQUEUE(wait, current); |
3322 | int retval; | 3322 | int retval; |
3323 | int do_clocal = 0, extra_count = 0; | 3323 | bool do_clocal = false; |
3324 | bool extra_count = false; | ||
3324 | unsigned long flags; | 3325 | unsigned long flags; |
3325 | 3326 | ||
3326 | if (debug_level >= DEBUG_LEVEL_INFO) | 3327 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -3335,7 +3336,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3335 | } | 3336 | } |
3336 | 3337 | ||
3337 | if (tty->termios->c_cflag & CLOCAL) | 3338 | if (tty->termios->c_cflag & CLOCAL) |
3338 | do_clocal = 1; | 3339 | do_clocal = true; |
3339 | 3340 | ||
3340 | /* Wait for carrier detect and the line to become | 3341 | /* Wait for carrier detect and the line to become |
3341 | * free (i.e., not in use by the callout). While we are in | 3342 | * free (i.e., not in use by the callout). While we are in |
@@ -3353,7 +3354,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3353 | 3354 | ||
3354 | spin_lock_irqsave(&info->lock, flags); | 3355 | spin_lock_irqsave(&info->lock, flags); |
3355 | if (!tty_hung_up_p(filp)) { | 3356 | if (!tty_hung_up_p(filp)) { |
3356 | extra_count = 1; | 3357 | extra_count = true; |
3357 | info->count--; | 3358 | info->count--; |
3358 | } | 3359 | } |
3359 | spin_unlock_irqrestore(&info->lock, flags); | 3360 | spin_unlock_irqrestore(&info->lock, flags); |
@@ -3413,7 +3414,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3413 | return retval; | 3414 | return retval; |
3414 | } | 3415 | } |
3415 | 3416 | ||
3416 | int alloc_dma_bufs(SLMP_INFO *info) | 3417 | static int alloc_dma_bufs(SLMP_INFO *info) |
3417 | { | 3418 | { |
3418 | unsigned short BuffersPerFrame; | 3419 | unsigned short BuffersPerFrame; |
3419 | unsigned short BufferCount; | 3420 | unsigned short BufferCount; |
@@ -3487,7 +3488,7 @@ int alloc_dma_bufs(SLMP_INFO *info) | |||
3487 | 3488 | ||
3488 | /* Allocate DMA buffers for the transmit and receive descriptor lists. | 3489 | /* Allocate DMA buffers for the transmit and receive descriptor lists. |
3489 | */ | 3490 | */ |
3490 | int alloc_buf_list(SLMP_INFO *info) | 3491 | static int alloc_buf_list(SLMP_INFO *info) |
3491 | { | 3492 | { |
3492 | unsigned int i; | 3493 | unsigned int i; |
3493 | 3494 | ||
@@ -3546,7 +3547,7 @@ int alloc_buf_list(SLMP_INFO *info) | |||
3546 | 3547 | ||
3547 | /* Allocate the frame DMA buffers used by the specified buffer list. | 3548 | /* Allocate the frame DMA buffers used by the specified buffer list. |
3548 | */ | 3549 | */ |
3549 | int alloc_frame_bufs(SLMP_INFO *info, SCADESC *buf_list,SCADESC_EX *buf_list_ex,int count) | 3550 | static int alloc_frame_bufs(SLMP_INFO *info, SCADESC *buf_list,SCADESC_EX *buf_list_ex,int count) |
3550 | { | 3551 | { |
3551 | int i; | 3552 | int i; |
3552 | unsigned long phys_addr; | 3553 | unsigned long phys_addr; |
@@ -3563,7 +3564,7 @@ int alloc_frame_bufs(SLMP_INFO *info, SCADESC *buf_list,SCADESC_EX *buf_list_ex, | |||
3563 | return 0; | 3564 | return 0; |
3564 | } | 3565 | } |
3565 | 3566 | ||
3566 | void free_dma_bufs(SLMP_INFO *info) | 3567 | static void free_dma_bufs(SLMP_INFO *info) |
3567 | { | 3568 | { |
3568 | info->buffer_list = NULL; | 3569 | info->buffer_list = NULL; |
3569 | info->rx_buf_list = NULL; | 3570 | info->rx_buf_list = NULL; |
@@ -3573,7 +3574,7 @@ void free_dma_bufs(SLMP_INFO *info) | |||
3573 | /* allocate buffer large enough to hold max_frame_size. | 3574 | /* allocate buffer large enough to hold max_frame_size. |
3574 | * This buffer is used to pass an assembled frame to the line discipline. | 3575 | * This buffer is used to pass an assembled frame to the line discipline. |
3575 | */ | 3576 | */ |
3576 | int alloc_tmp_rx_buf(SLMP_INFO *info) | 3577 | static int alloc_tmp_rx_buf(SLMP_INFO *info) |
3577 | { | 3578 | { |
3578 | info->tmp_rx_buf = kmalloc(info->max_frame_size, GFP_KERNEL); | 3579 | info->tmp_rx_buf = kmalloc(info->max_frame_size, GFP_KERNEL); |
3579 | if (info->tmp_rx_buf == NULL) | 3580 | if (info->tmp_rx_buf == NULL) |
@@ -3581,13 +3582,13 @@ int alloc_tmp_rx_buf(SLMP_INFO *info) | |||
3581 | return 0; | 3582 | return 0; |
3582 | } | 3583 | } |
3583 | 3584 | ||
3584 | void free_tmp_rx_buf(SLMP_INFO *info) | 3585 | static void free_tmp_rx_buf(SLMP_INFO *info) |
3585 | { | 3586 | { |
3586 | kfree(info->tmp_rx_buf); | 3587 | kfree(info->tmp_rx_buf); |
3587 | info->tmp_rx_buf = NULL; | 3588 | info->tmp_rx_buf = NULL; |
3588 | } | 3589 | } |
3589 | 3590 | ||
3590 | int claim_resources(SLMP_INFO *info) | 3591 | static int claim_resources(SLMP_INFO *info) |
3591 | { | 3592 | { |
3592 | if (request_mem_region(info->phys_memory_base,SCA_MEM_SIZE,"synclinkmp") == NULL) { | 3593 | if (request_mem_region(info->phys_memory_base,SCA_MEM_SIZE,"synclinkmp") == NULL) { |
3593 | printk( "%s(%d):%s mem addr conflict, Addr=%08X\n", | 3594 | printk( "%s(%d):%s mem addr conflict, Addr=%08X\n", |
@@ -3596,7 +3597,7 @@ int claim_resources(SLMP_INFO *info) | |||
3596 | goto errout; | 3597 | goto errout; |
3597 | } | 3598 | } |
3598 | else | 3599 | else |
3599 | info->shared_mem_requested = 1; | 3600 | info->shared_mem_requested = true; |
3600 | 3601 | ||
3601 | if (request_mem_region(info->phys_lcr_base + info->lcr_offset,128,"synclinkmp") == NULL) { | 3602 | if (request_mem_region(info->phys_lcr_base + info->lcr_offset,128,"synclinkmp") == NULL) { |
3602 | printk( "%s(%d):%s lcr mem addr conflict, Addr=%08X\n", | 3603 | printk( "%s(%d):%s lcr mem addr conflict, Addr=%08X\n", |
@@ -3605,7 +3606,7 @@ int claim_resources(SLMP_INFO *info) | |||
3605 | goto errout; | 3606 | goto errout; |
3606 | } | 3607 | } |
3607 | else | 3608 | else |
3608 | info->lcr_mem_requested = 1; | 3609 | info->lcr_mem_requested = true; |
3609 | 3610 | ||
3610 | if (request_mem_region(info->phys_sca_base + info->sca_offset,SCA_BASE_SIZE,"synclinkmp") == NULL) { | 3611 | if (request_mem_region(info->phys_sca_base + info->sca_offset,SCA_BASE_SIZE,"synclinkmp") == NULL) { |
3611 | printk( "%s(%d):%s sca mem addr conflict, Addr=%08X\n", | 3612 | printk( "%s(%d):%s sca mem addr conflict, Addr=%08X\n", |
@@ -3614,7 +3615,7 @@ int claim_resources(SLMP_INFO *info) | |||
3614 | goto errout; | 3615 | goto errout; |
3615 | } | 3616 | } |
3616 | else | 3617 | else |
3617 | info->sca_base_requested = 1; | 3618 | info->sca_base_requested = true; |
3618 | 3619 | ||
3619 | if (request_mem_region(info->phys_statctrl_base + info->statctrl_offset,SCA_REG_SIZE,"synclinkmp") == NULL) { | 3620 | if (request_mem_region(info->phys_statctrl_base + info->statctrl_offset,SCA_REG_SIZE,"synclinkmp") == NULL) { |
3620 | printk( "%s(%d):%s stat/ctrl mem addr conflict, Addr=%08X\n", | 3621 | printk( "%s(%d):%s stat/ctrl mem addr conflict, Addr=%08X\n", |
@@ -3623,7 +3624,7 @@ int claim_resources(SLMP_INFO *info) | |||
3623 | goto errout; | 3624 | goto errout; |
3624 | } | 3625 | } |
3625 | else | 3626 | else |
3626 | info->sca_statctrl_requested = 1; | 3627 | info->sca_statctrl_requested = true; |
3627 | 3628 | ||
3628 | info->memory_base = ioremap(info->phys_memory_base,SCA_MEM_SIZE); | 3629 | info->memory_base = ioremap(info->phys_memory_base,SCA_MEM_SIZE); |
3629 | if (!info->memory_base) { | 3630 | if (!info->memory_base) { |
@@ -3674,7 +3675,7 @@ errout: | |||
3674 | return -ENODEV; | 3675 | return -ENODEV; |
3675 | } | 3676 | } |
3676 | 3677 | ||
3677 | void release_resources(SLMP_INFO *info) | 3678 | static void release_resources(SLMP_INFO *info) |
3678 | { | 3679 | { |
3679 | if ( debug_level >= DEBUG_LEVEL_INFO ) | 3680 | if ( debug_level >= DEBUG_LEVEL_INFO ) |
3680 | printk( "%s(%d):%s release_resources() entry\n", | 3681 | printk( "%s(%d):%s release_resources() entry\n", |
@@ -3682,24 +3683,24 @@ void release_resources(SLMP_INFO *info) | |||
3682 | 3683 | ||
3683 | if ( info->irq_requested ) { | 3684 | if ( info->irq_requested ) { |
3684 | free_irq(info->irq_level, info); | 3685 | free_irq(info->irq_level, info); |
3685 | info->irq_requested = 0; | 3686 | info->irq_requested = false; |
3686 | } | 3687 | } |
3687 | 3688 | ||
3688 | if ( info->shared_mem_requested ) { | 3689 | if ( info->shared_mem_requested ) { |
3689 | release_mem_region(info->phys_memory_base,SCA_MEM_SIZE); | 3690 | release_mem_region(info->phys_memory_base,SCA_MEM_SIZE); |
3690 | info->shared_mem_requested = 0; | 3691 | info->shared_mem_requested = false; |
3691 | } | 3692 | } |
3692 | if ( info->lcr_mem_requested ) { | 3693 | if ( info->lcr_mem_requested ) { |
3693 | release_mem_region(info->phys_lcr_base + info->lcr_offset,128); | 3694 | release_mem_region(info->phys_lcr_base + info->lcr_offset,128); |
3694 | info->lcr_mem_requested = 0; | 3695 | info->lcr_mem_requested = false; |
3695 | } | 3696 | } |
3696 | if ( info->sca_base_requested ) { | 3697 | if ( info->sca_base_requested ) { |
3697 | release_mem_region(info->phys_sca_base + info->sca_offset,SCA_BASE_SIZE); | 3698 | release_mem_region(info->phys_sca_base + info->sca_offset,SCA_BASE_SIZE); |
3698 | info->sca_base_requested = 0; | 3699 | info->sca_base_requested = false; |
3699 | } | 3700 | } |
3700 | if ( info->sca_statctrl_requested ) { | 3701 | if ( info->sca_statctrl_requested ) { |
3701 | release_mem_region(info->phys_statctrl_base + info->statctrl_offset,SCA_REG_SIZE); | 3702 | release_mem_region(info->phys_statctrl_base + info->statctrl_offset,SCA_REG_SIZE); |
3702 | info->sca_statctrl_requested = 0; | 3703 | info->sca_statctrl_requested = false; |
3703 | } | 3704 | } |
3704 | 3705 | ||
3705 | if (info->memory_base){ | 3706 | if (info->memory_base){ |
@@ -3730,7 +3731,7 @@ void release_resources(SLMP_INFO *info) | |||
3730 | /* Add the specified device instance data structure to the | 3731 | /* Add the specified device instance data structure to the |
3731 | * global linked list of devices and increment the device count. | 3732 | * global linked list of devices and increment the device count. |
3732 | */ | 3733 | */ |
3733 | void add_device(SLMP_INFO *info) | 3734 | static void add_device(SLMP_INFO *info) |
3734 | { | 3735 | { |
3735 | info->next_device = NULL; | 3736 | info->next_device = NULL; |
3736 | info->line = synclinkmp_device_count; | 3737 | info->line = synclinkmp_device_count; |
@@ -3853,7 +3854,7 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev) | |||
3853 | return info; | 3854 | return info; |
3854 | } | 3855 | } |
3855 | 3856 | ||
3856 | void device_init(int adapter_num, struct pci_dev *pdev) | 3857 | static void device_init(int adapter_num, struct pci_dev *pdev) |
3857 | { | 3858 | { |
3858 | SLMP_INFO *port_array[SCA_MAX_PORTS]; | 3859 | SLMP_INFO *port_array[SCA_MAX_PORTS]; |
3859 | int port; | 3860 | int port; |
@@ -3902,7 +3903,7 @@ void device_init(int adapter_num, struct pci_dev *pdev) | |||
3902 | port_array[0]->irq_level ); | 3903 | port_array[0]->irq_level ); |
3903 | } | 3904 | } |
3904 | else { | 3905 | else { |
3905 | port_array[0]->irq_requested = 1; | 3906 | port_array[0]->irq_requested = true; |
3906 | adapter_test(port_array[0]); | 3907 | adapter_test(port_array[0]); |
3907 | } | 3908 | } |
3908 | } | 3909 | } |
@@ -4047,7 +4048,7 @@ module_exit(synclinkmp_exit); | |||
4047 | * The TxCLK and RxCLK signals are generated from the BRG and | 4048 | * The TxCLK and RxCLK signals are generated from the BRG and |
4048 | * the TxD is looped back to the RxD internally. | 4049 | * the TxD is looped back to the RxD internally. |
4049 | */ | 4050 | */ |
4050 | void enable_loopback(SLMP_INFO *info, int enable) | 4051 | static void enable_loopback(SLMP_INFO *info, int enable) |
4051 | { | 4052 | { |
4052 | if (enable) { | 4053 | if (enable) { |
4053 | /* MD2 (Mode Register 2) | 4054 | /* MD2 (Mode Register 2) |
@@ -4094,7 +4095,7 @@ void enable_loopback(SLMP_INFO *info, int enable) | |||
4094 | * data_rate data rate of clock in bits per second | 4095 | * data_rate data rate of clock in bits per second |
4095 | * A data rate of 0 disables the AUX clock. | 4096 | * A data rate of 0 disables the AUX clock. |
4096 | */ | 4097 | */ |
4097 | void set_rate( SLMP_INFO *info, u32 data_rate ) | 4098 | static void set_rate( SLMP_INFO *info, u32 data_rate ) |
4098 | { | 4099 | { |
4099 | u32 TMCValue; | 4100 | u32 TMCValue; |
4100 | unsigned char BRValue; | 4101 | unsigned char BRValue; |
@@ -4140,7 +4141,7 @@ void set_rate( SLMP_INFO *info, u32 data_rate ) | |||
4140 | 4141 | ||
4141 | /* Disable receiver | 4142 | /* Disable receiver |
4142 | */ | 4143 | */ |
4143 | void rx_stop(SLMP_INFO *info) | 4144 | static void rx_stop(SLMP_INFO *info) |
4144 | { | 4145 | { |
4145 | if (debug_level >= DEBUG_LEVEL_ISR) | 4146 | if (debug_level >= DEBUG_LEVEL_ISR) |
4146 | printk("%s(%d):%s rx_stop()\n", | 4147 | printk("%s(%d):%s rx_stop()\n", |
@@ -4155,13 +4156,13 @@ void rx_stop(SLMP_INFO *info) | |||
4155 | write_reg(info, RXDMA + DCMD, SWABORT); /* reset/init Rx DMA */ | 4156 | write_reg(info, RXDMA + DCMD, SWABORT); /* reset/init Rx DMA */ |
4156 | write_reg(info, RXDMA + DIR, 0); /* disable Rx DMA interrupts */ | 4157 | write_reg(info, RXDMA + DIR, 0); /* disable Rx DMA interrupts */ |
4157 | 4158 | ||
4158 | info->rx_enabled = 0; | 4159 | info->rx_enabled = false; |
4159 | info->rx_overflow = 0; | 4160 | info->rx_overflow = false; |
4160 | } | 4161 | } |
4161 | 4162 | ||
4162 | /* enable the receiver | 4163 | /* enable the receiver |
4163 | */ | 4164 | */ |
4164 | void rx_start(SLMP_INFO *info) | 4165 | static void rx_start(SLMP_INFO *info) |
4165 | { | 4166 | { |
4166 | int i; | 4167 | int i; |
4167 | 4168 | ||
@@ -4211,14 +4212,14 @@ void rx_start(SLMP_INFO *info) | |||
4211 | 4212 | ||
4212 | write_reg(info, CMD, RXENABLE); | 4213 | write_reg(info, CMD, RXENABLE); |
4213 | 4214 | ||
4214 | info->rx_overflow = FALSE; | 4215 | info->rx_overflow = false; |
4215 | info->rx_enabled = 1; | 4216 | info->rx_enabled = true; |
4216 | } | 4217 | } |
4217 | 4218 | ||
4218 | /* Enable the transmitter and send a transmit frame if | 4219 | /* Enable the transmitter and send a transmit frame if |
4219 | * one is loaded in the DMA buffers. | 4220 | * one is loaded in the DMA buffers. |
4220 | */ | 4221 | */ |
4221 | void tx_start(SLMP_INFO *info) | 4222 | static void tx_start(SLMP_INFO *info) |
4222 | { | 4223 | { |
4223 | if (debug_level >= DEBUG_LEVEL_ISR) | 4224 | if (debug_level >= DEBUG_LEVEL_ISR) |
4224 | printk("%s(%d):%s tx_start() tx_count=%d\n", | 4225 | printk("%s(%d):%s tx_start() tx_count=%d\n", |
@@ -4227,7 +4228,7 @@ void tx_start(SLMP_INFO *info) | |||
4227 | if (!info->tx_enabled ) { | 4228 | if (!info->tx_enabled ) { |
4228 | write_reg(info, CMD, TXRESET); | 4229 | write_reg(info, CMD, TXRESET); |
4229 | write_reg(info, CMD, TXENABLE); | 4230 | write_reg(info, CMD, TXENABLE); |
4230 | info->tx_enabled = TRUE; | 4231 | info->tx_enabled = true; |
4231 | } | 4232 | } |
4232 | 4233 | ||
4233 | if ( info->tx_count ) { | 4234 | if ( info->tx_count ) { |
@@ -4236,7 +4237,7 @@ void tx_start(SLMP_INFO *info) | |||
4236 | /* RTS and set a flag indicating that the driver should */ | 4237 | /* RTS and set a flag indicating that the driver should */ |
4237 | /* negate RTS when the transmission completes. */ | 4238 | /* negate RTS when the transmission completes. */ |
4238 | 4239 | ||
4239 | info->drop_rts_on_tx_done = 0; | 4240 | info->drop_rts_on_tx_done = false; |
4240 | 4241 | ||
4241 | if (info->params.mode != MGSL_MODE_ASYNC) { | 4242 | if (info->params.mode != MGSL_MODE_ASYNC) { |
4242 | 4243 | ||
@@ -4245,7 +4246,7 @@ void tx_start(SLMP_INFO *info) | |||
4245 | if ( !(info->serial_signals & SerialSignal_RTS) ) { | 4246 | if ( !(info->serial_signals & SerialSignal_RTS) ) { |
4246 | info->serial_signals |= SerialSignal_RTS; | 4247 | info->serial_signals |= SerialSignal_RTS; |
4247 | set_signals( info ); | 4248 | set_signals( info ); |
4248 | info->drop_rts_on_tx_done = 1; | 4249 | info->drop_rts_on_tx_done = true; |
4249 | } | 4250 | } |
4250 | } | 4251 | } |
4251 | 4252 | ||
@@ -4282,13 +4283,13 @@ void tx_start(SLMP_INFO *info) | |||
4282 | write_reg(info, IE0, info->ie0_value); | 4283 | write_reg(info, IE0, info->ie0_value); |
4283 | } | 4284 | } |
4284 | 4285 | ||
4285 | info->tx_active = 1; | 4286 | info->tx_active = true; |
4286 | } | 4287 | } |
4287 | } | 4288 | } |
4288 | 4289 | ||
4289 | /* stop the transmitter and DMA | 4290 | /* stop the transmitter and DMA |
4290 | */ | 4291 | */ |
4291 | void tx_stop( SLMP_INFO *info ) | 4292 | static void tx_stop( SLMP_INFO *info ) |
4292 | { | 4293 | { |
4293 | if (debug_level >= DEBUG_LEVEL_ISR) | 4294 | if (debug_level >= DEBUG_LEVEL_ISR) |
4294 | printk("%s(%d):%s tx_stop()\n", | 4295 | printk("%s(%d):%s tx_stop()\n", |
@@ -4308,14 +4309,14 @@ void tx_stop( SLMP_INFO *info ) | |||
4308 | info->ie0_value &= ~TXRDYE; | 4309 | info->ie0_value &= ~TXRDYE; |
4309 | write_reg(info, IE0, info->ie0_value); /* disable tx data interrupts */ | 4310 | write_reg(info, IE0, info->ie0_value); /* disable tx data interrupts */ |
4310 | 4311 | ||
4311 | info->tx_enabled = 0; | 4312 | info->tx_enabled = false; |
4312 | info->tx_active = 0; | 4313 | info->tx_active = false; |
4313 | } | 4314 | } |
4314 | 4315 | ||
4315 | /* Fill the transmit FIFO until the FIFO is full or | 4316 | /* Fill the transmit FIFO until the FIFO is full or |
4316 | * there is no more data to load. | 4317 | * there is no more data to load. |
4317 | */ | 4318 | */ |
4318 | void tx_load_fifo(SLMP_INFO *info) | 4319 | static void tx_load_fifo(SLMP_INFO *info) |
4319 | { | 4320 | { |
4320 | u8 TwoBytes[2]; | 4321 | u8 TwoBytes[2]; |
4321 | 4322 | ||
@@ -4364,7 +4365,7 @@ void tx_load_fifo(SLMP_INFO *info) | |||
4364 | 4365 | ||
4365 | /* Reset a port to a known state | 4366 | /* Reset a port to a known state |
4366 | */ | 4367 | */ |
4367 | void reset_port(SLMP_INFO *info) | 4368 | static void reset_port(SLMP_INFO *info) |
4368 | { | 4369 | { |
4369 | if (info->sca_base) { | 4370 | if (info->sca_base) { |
4370 | 4371 | ||
@@ -4388,7 +4389,7 @@ void reset_port(SLMP_INFO *info) | |||
4388 | 4389 | ||
4389 | /* Reset all the ports to a known state. | 4390 | /* Reset all the ports to a known state. |
4390 | */ | 4391 | */ |
4391 | void reset_adapter(SLMP_INFO *info) | 4392 | static void reset_adapter(SLMP_INFO *info) |
4392 | { | 4393 | { |
4393 | int i; | 4394 | int i; |
4394 | 4395 | ||
@@ -4400,7 +4401,7 @@ void reset_adapter(SLMP_INFO *info) | |||
4400 | 4401 | ||
4401 | /* Program port for asynchronous communications. | 4402 | /* Program port for asynchronous communications. |
4402 | */ | 4403 | */ |
4403 | void async_mode(SLMP_INFO *info) | 4404 | static void async_mode(SLMP_INFO *info) |
4404 | { | 4405 | { |
4405 | 4406 | ||
4406 | unsigned char RegValue; | 4407 | unsigned char RegValue; |
@@ -4539,7 +4540,7 @@ void async_mode(SLMP_INFO *info) | |||
4539 | 4540 | ||
4540 | /* Program the SCA for HDLC communications. | 4541 | /* Program the SCA for HDLC communications. |
4541 | */ | 4542 | */ |
4542 | void hdlc_mode(SLMP_INFO *info) | 4543 | static void hdlc_mode(SLMP_INFO *info) |
4543 | { | 4544 | { |
4544 | unsigned char RegValue; | 4545 | unsigned char RegValue; |
4545 | u32 DpllDivisor; | 4546 | u32 DpllDivisor; |
@@ -4741,7 +4742,7 @@ void hdlc_mode(SLMP_INFO *info) | |||
4741 | 4742 | ||
4742 | /* Set the transmit HDLC idle mode | 4743 | /* Set the transmit HDLC idle mode |
4743 | */ | 4744 | */ |
4744 | void tx_set_idle(SLMP_INFO *info) | 4745 | static void tx_set_idle(SLMP_INFO *info) |
4745 | { | 4746 | { |
4746 | unsigned char RegValue = 0xff; | 4747 | unsigned char RegValue = 0xff; |
4747 | 4748 | ||
@@ -4761,7 +4762,7 @@ void tx_set_idle(SLMP_INFO *info) | |||
4761 | 4762 | ||
4762 | /* Query the adapter for the state of the V24 status (input) signals. | 4763 | /* Query the adapter for the state of the V24 status (input) signals. |
4763 | */ | 4764 | */ |
4764 | void get_signals(SLMP_INFO *info) | 4765 | static void get_signals(SLMP_INFO *info) |
4765 | { | 4766 | { |
4766 | u16 status = read_reg(info, SR3); | 4767 | u16 status = read_reg(info, SR3); |
4767 | u16 gpstatus = read_status_reg(info); | 4768 | u16 gpstatus = read_status_reg(info); |
@@ -4790,7 +4791,7 @@ void get_signals(SLMP_INFO *info) | |||
4790 | /* Set the state of DTR and RTS based on contents of | 4791 | /* Set the state of DTR and RTS based on contents of |
4791 | * serial_signals member of device context. | 4792 | * serial_signals member of device context. |
4792 | */ | 4793 | */ |
4793 | void set_signals(SLMP_INFO *info) | 4794 | static void set_signals(SLMP_INFO *info) |
4794 | { | 4795 | { |
4795 | unsigned char RegValue; | 4796 | unsigned char RegValue; |
4796 | u16 EnableBit; | 4797 | u16 EnableBit; |
@@ -4819,7 +4820,7 @@ void set_signals(SLMP_INFO *info) | |||
4819 | * and set the current buffer to the first buffer. This effectively | 4820 | * and set the current buffer to the first buffer. This effectively |
4820 | * makes all buffers free and discards any data in buffers. | 4821 | * makes all buffers free and discards any data in buffers. |
4821 | */ | 4822 | */ |
4822 | void rx_reset_buffers(SLMP_INFO *info) | 4823 | static void rx_reset_buffers(SLMP_INFO *info) |
4823 | { | 4824 | { |
4824 | rx_free_frame_buffers(info, 0, info->rx_buf_count - 1); | 4825 | rx_free_frame_buffers(info, 0, info->rx_buf_count - 1); |
4825 | } | 4826 | } |
@@ -4830,16 +4831,16 @@ void rx_reset_buffers(SLMP_INFO *info) | |||
4830 | * first index of 1st receive buffer of frame | 4831 | * first index of 1st receive buffer of frame |
4831 | * last index of last receive buffer of frame | 4832 | * last index of last receive buffer of frame |
4832 | */ | 4833 | */ |
4833 | void rx_free_frame_buffers(SLMP_INFO *info, unsigned int first, unsigned int last) | 4834 | static void rx_free_frame_buffers(SLMP_INFO *info, unsigned int first, unsigned int last) |
4834 | { | 4835 | { |
4835 | int done = 0; | 4836 | bool done = false; |
4836 | 4837 | ||
4837 | while(!done) { | 4838 | while(!done) { |
4838 | /* reset current buffer for reuse */ | 4839 | /* reset current buffer for reuse */ |
4839 | info->rx_buf_list[first].status = 0xff; | 4840 | info->rx_buf_list[first].status = 0xff; |
4840 | 4841 | ||
4841 | if (first == last) { | 4842 | if (first == last) { |
4842 | done = 1; | 4843 | done = true; |
4843 | /* set new last rx descriptor address */ | 4844 | /* set new last rx descriptor address */ |
4844 | write_reg16(info, RXDMA + EDA, info->rx_buf_list_ex[first].phys_entry); | 4845 | write_reg16(info, RXDMA + EDA, info->rx_buf_list_ex[first].phys_entry); |
4845 | } | 4846 | } |
@@ -4856,14 +4857,14 @@ void rx_free_frame_buffers(SLMP_INFO *info, unsigned int first, unsigned int las | |||
4856 | /* Return a received frame from the receive DMA buffers. | 4857 | /* Return a received frame from the receive DMA buffers. |
4857 | * Only frames received without errors are returned. | 4858 | * Only frames received without errors are returned. |
4858 | * | 4859 | * |
4859 | * Return Value: 1 if frame returned, otherwise 0 | 4860 | * Return Value: true if frame returned, otherwise false |
4860 | */ | 4861 | */ |
4861 | int rx_get_frame(SLMP_INFO *info) | 4862 | static bool rx_get_frame(SLMP_INFO *info) |
4862 | { | 4863 | { |
4863 | unsigned int StartIndex, EndIndex; /* index of 1st and last buffers of Rx frame */ | 4864 | unsigned int StartIndex, EndIndex; /* index of 1st and last buffers of Rx frame */ |
4864 | unsigned short status; | 4865 | unsigned short status; |
4865 | unsigned int framesize = 0; | 4866 | unsigned int framesize = 0; |
4866 | int ReturnCode = 0; | 4867 | bool ReturnCode = false; |
4867 | unsigned long flags; | 4868 | unsigned long flags; |
4868 | struct tty_struct *tty = info->tty; | 4869 | struct tty_struct *tty = info->tty; |
4869 | unsigned char addr_field = 0xff; | 4870 | unsigned char addr_field = 0xff; |
@@ -5014,7 +5015,7 @@ CheckAgain: | |||
5014 | /* Free the buffers used by this frame. */ | 5015 | /* Free the buffers used by this frame. */ |
5015 | rx_free_frame_buffers( info, StartIndex, EndIndex ); | 5016 | rx_free_frame_buffers( info, StartIndex, EndIndex ); |
5016 | 5017 | ||
5017 | ReturnCode = 1; | 5018 | ReturnCode = true; |
5018 | 5019 | ||
5019 | Cleanup: | 5020 | Cleanup: |
5020 | if ( info->rx_enabled && info->rx_overflow ) { | 5021 | if ( info->rx_enabled && info->rx_overflow ) { |
@@ -5033,7 +5034,7 @@ Cleanup: | |||
5033 | 5034 | ||
5034 | /* load the transmit DMA buffer with data | 5035 | /* load the transmit DMA buffer with data |
5035 | */ | 5036 | */ |
5036 | void tx_load_dma_buffer(SLMP_INFO *info, const char *buf, unsigned int count) | 5037 | static void tx_load_dma_buffer(SLMP_INFO *info, const char *buf, unsigned int count) |
5037 | { | 5038 | { |
5038 | unsigned short copy_count; | 5039 | unsigned short copy_count; |
5039 | unsigned int i = 0; | 5040 | unsigned int i = 0; |
@@ -5073,12 +5074,12 @@ void tx_load_dma_buffer(SLMP_INFO *info, const char *buf, unsigned int count) | |||
5073 | info->last_tx_buf = ++i; | 5074 | info->last_tx_buf = ++i; |
5074 | } | 5075 | } |
5075 | 5076 | ||
5076 | int register_test(SLMP_INFO *info) | 5077 | static bool register_test(SLMP_INFO *info) |
5077 | { | 5078 | { |
5078 | static unsigned char testval[] = {0x00, 0xff, 0xaa, 0x55, 0x69, 0x96}; | 5079 | static unsigned char testval[] = {0x00, 0xff, 0xaa, 0x55, 0x69, 0x96}; |
5079 | static unsigned int count = ARRAY_SIZE(testval); | 5080 | static unsigned int count = ARRAY_SIZE(testval); |
5080 | unsigned int i; | 5081 | unsigned int i; |
5081 | int rc = TRUE; | 5082 | bool rc = true; |
5082 | unsigned long flags; | 5083 | unsigned long flags; |
5083 | 5084 | ||
5084 | spin_lock_irqsave(&info->lock,flags); | 5085 | spin_lock_irqsave(&info->lock,flags); |
@@ -5101,7 +5102,7 @@ int register_test(SLMP_INFO *info) | |||
5101 | (read_reg(info, SA0) != testval[(i+2)%count]) || | 5102 | (read_reg(info, SA0) != testval[(i+2)%count]) || |
5102 | (read_reg(info, SA1) != testval[(i+3)%count]) ) | 5103 | (read_reg(info, SA1) != testval[(i+3)%count]) ) |
5103 | { | 5104 | { |
5104 | rc = FALSE; | 5105 | rc = false; |
5105 | break; | 5106 | break; |
5106 | } | 5107 | } |
5107 | } | 5108 | } |
@@ -5112,7 +5113,7 @@ int register_test(SLMP_INFO *info) | |||
5112 | return rc; | 5113 | return rc; |
5113 | } | 5114 | } |
5114 | 5115 | ||
5115 | int irq_test(SLMP_INFO *info) | 5116 | static bool irq_test(SLMP_INFO *info) |
5116 | { | 5117 | { |
5117 | unsigned long timeout; | 5118 | unsigned long timeout; |
5118 | unsigned long flags; | 5119 | unsigned long flags; |
@@ -5124,7 +5125,7 @@ int irq_test(SLMP_INFO *info) | |||
5124 | 5125 | ||
5125 | /* assume failure */ | 5126 | /* assume failure */ |
5126 | info->init_error = DiagStatus_IrqFailure; | 5127 | info->init_error = DiagStatus_IrqFailure; |
5127 | info->irq_occurred = FALSE; | 5128 | info->irq_occurred = false; |
5128 | 5129 | ||
5129 | /* setup timer0 on SCA0 to interrupt */ | 5130 | /* setup timer0 on SCA0 to interrupt */ |
5130 | 5131 | ||
@@ -5163,7 +5164,7 @@ int irq_test(SLMP_INFO *info) | |||
5163 | 5164 | ||
5164 | /* initialize individual SCA device (2 ports) | 5165 | /* initialize individual SCA device (2 ports) |
5165 | */ | 5166 | */ |
5166 | static int sca_init(SLMP_INFO *info) | 5167 | static bool sca_init(SLMP_INFO *info) |
5167 | { | 5168 | { |
5168 | /* set wait controller to single mem partition (low), no wait states */ | 5169 | /* set wait controller to single mem partition (low), no wait states */ |
5169 | write_reg(info, PABR0, 0); /* wait controller addr boundary 0 */ | 5170 | write_reg(info, PABR0, 0); /* wait controller addr boundary 0 */ |
@@ -5199,12 +5200,12 @@ static int sca_init(SLMP_INFO *info) | |||
5199 | */ | 5200 | */ |
5200 | write_reg(info, ITCR, 0); | 5201 | write_reg(info, ITCR, 0); |
5201 | 5202 | ||
5202 | return TRUE; | 5203 | return true; |
5203 | } | 5204 | } |
5204 | 5205 | ||
5205 | /* initialize adapter hardware | 5206 | /* initialize adapter hardware |
5206 | */ | 5207 | */ |
5207 | int init_adapter(SLMP_INFO *info) | 5208 | static bool init_adapter(SLMP_INFO *info) |
5208 | { | 5209 | { |
5209 | int i; | 5210 | int i; |
5210 | 5211 | ||
@@ -5257,20 +5258,20 @@ int init_adapter(SLMP_INFO *info) | |||
5257 | sca_init(info->port_array[0]); | 5258 | sca_init(info->port_array[0]); |
5258 | sca_init(info->port_array[2]); | 5259 | sca_init(info->port_array[2]); |
5259 | 5260 | ||
5260 | return TRUE; | 5261 | return true; |
5261 | } | 5262 | } |
5262 | 5263 | ||
5263 | /* Loopback an HDLC frame to test the hardware | 5264 | /* Loopback an HDLC frame to test the hardware |
5264 | * interrupt and DMA functions. | 5265 | * interrupt and DMA functions. |
5265 | */ | 5266 | */ |
5266 | int loopback_test(SLMP_INFO *info) | 5267 | static bool loopback_test(SLMP_INFO *info) |
5267 | { | 5268 | { |
5268 | #define TESTFRAMESIZE 20 | 5269 | #define TESTFRAMESIZE 20 |
5269 | 5270 | ||
5270 | unsigned long timeout; | 5271 | unsigned long timeout; |
5271 | u16 count = TESTFRAMESIZE; | 5272 | u16 count = TESTFRAMESIZE; |
5272 | unsigned char buf[TESTFRAMESIZE]; | 5273 | unsigned char buf[TESTFRAMESIZE]; |
5273 | int rc = FALSE; | 5274 | bool rc = false; |
5274 | unsigned long flags; | 5275 | unsigned long flags; |
5275 | 5276 | ||
5276 | struct tty_struct *oldtty = info->tty; | 5277 | struct tty_struct *oldtty = info->tty; |
@@ -5304,16 +5305,16 @@ int loopback_test(SLMP_INFO *info) | |||
5304 | msleep_interruptible(10); | 5305 | msleep_interruptible(10); |
5305 | 5306 | ||
5306 | if (rx_get_frame(info)) { | 5307 | if (rx_get_frame(info)) { |
5307 | rc = TRUE; | 5308 | rc = true; |
5308 | break; | 5309 | break; |
5309 | } | 5310 | } |
5310 | } | 5311 | } |
5311 | 5312 | ||
5312 | /* verify received frame length and contents */ | 5313 | /* verify received frame length and contents */ |
5313 | if (rc == TRUE && | 5314 | if (rc && |
5314 | ( info->tmp_rx_buf_count != count || | 5315 | ( info->tmp_rx_buf_count != count || |
5315 | memcmp(buf, info->tmp_rx_buf,count))) { | 5316 | memcmp(buf, info->tmp_rx_buf,count))) { |
5316 | rc = FALSE; | 5317 | rc = false; |
5317 | } | 5318 | } |
5318 | 5319 | ||
5319 | spin_lock_irqsave(&info->lock,flags); | 5320 | spin_lock_irqsave(&info->lock,flags); |
@@ -5328,7 +5329,7 @@ int loopback_test(SLMP_INFO *info) | |||
5328 | 5329 | ||
5329 | /* Perform diagnostics on hardware | 5330 | /* Perform diagnostics on hardware |
5330 | */ | 5331 | */ |
5331 | int adapter_test( SLMP_INFO *info ) | 5332 | static int adapter_test( SLMP_INFO *info ) |
5332 | { | 5333 | { |
5333 | unsigned long flags; | 5334 | unsigned long flags; |
5334 | if ( debug_level >= DEBUG_LEVEL_INFO ) | 5335 | if ( debug_level >= DEBUG_LEVEL_INFO ) |
@@ -5390,7 +5391,7 @@ int adapter_test( SLMP_INFO *info ) | |||
5390 | 5391 | ||
5391 | /* Test the shared memory on a PCI adapter. | 5392 | /* Test the shared memory on a PCI adapter. |
5392 | */ | 5393 | */ |
5393 | int memory_test(SLMP_INFO *info) | 5394 | static bool memory_test(SLMP_INFO *info) |
5394 | { | 5395 | { |
5395 | static unsigned long testval[] = { 0x0, 0x55555555, 0xaaaaaaaa, | 5396 | static unsigned long testval[] = { 0x0, 0x55555555, 0xaaaaaaaa, |
5396 | 0x66666666, 0x99999999, 0xffffffff, 0x12345678 }; | 5397 | 0x66666666, 0x99999999, 0xffffffff, 0x12345678 }; |
@@ -5404,7 +5405,7 @@ int memory_test(SLMP_INFO *info) | |||
5404 | for ( i = 0 ; i < count ; i++ ) { | 5405 | for ( i = 0 ; i < count ; i++ ) { |
5405 | *addr = testval[i]; | 5406 | *addr = testval[i]; |
5406 | if ( *addr != testval[i] ) | 5407 | if ( *addr != testval[i] ) |
5407 | return FALSE; | 5408 | return false; |
5408 | } | 5409 | } |
5409 | 5410 | ||
5410 | /* Test address lines with incrementing pattern over */ | 5411 | /* Test address lines with incrementing pattern over */ |
@@ -5419,12 +5420,12 @@ int memory_test(SLMP_INFO *info) | |||
5419 | 5420 | ||
5420 | for ( i = 0 ; i < limit ; i++ ) { | 5421 | for ( i = 0 ; i < limit ; i++ ) { |
5421 | if ( *addr != i * 4 ) | 5422 | if ( *addr != i * 4 ) |
5422 | return FALSE; | 5423 | return false; |
5423 | addr++; | 5424 | addr++; |
5424 | } | 5425 | } |
5425 | 5426 | ||
5426 | memset( info->memory_base, 0, SCA_MEM_SIZE ); | 5427 | memset( info->memory_base, 0, SCA_MEM_SIZE ); |
5427 | return TRUE; | 5428 | return true; |
5428 | } | 5429 | } |
5429 | 5430 | ||
5430 | /* Load data into PCI adapter shared memory. | 5431 | /* Load data into PCI adapter shared memory. |
@@ -5442,7 +5443,7 @@ int memory_test(SLMP_INFO *info) | |||
5442 | * the write transation. This allows any pending DMA request to gain control | 5443 | * the write transation. This allows any pending DMA request to gain control |
5443 | * of the local bus in a timely fasion. | 5444 | * of the local bus in a timely fasion. |
5444 | */ | 5445 | */ |
5445 | void load_pci_memory(SLMP_INFO *info, char* dest, const char* src, unsigned short count) | 5446 | static void load_pci_memory(SLMP_INFO *info, char* dest, const char* src, unsigned short count) |
5446 | { | 5447 | { |
5447 | /* A load interval of 16 allows for 4 32-bit writes at */ | 5448 | /* A load interval of 16 allows for 4 32-bit writes at */ |
5448 | /* 136ns each for a maximum latency of 542ns on the local bus.*/ | 5449 | /* 136ns each for a maximum latency of 542ns on the local bus.*/ |
@@ -5461,7 +5462,7 @@ void load_pci_memory(SLMP_INFO *info, char* dest, const char* src, unsigned shor | |||
5461 | memcpy(dest, src, count % sca_pci_load_interval); | 5462 | memcpy(dest, src, count % sca_pci_load_interval); |
5462 | } | 5463 | } |
5463 | 5464 | ||
5464 | void trace_block(SLMP_INFO *info,const char* data, int count, int xmit) | 5465 | static void trace_block(SLMP_INFO *info,const char* data, int count, int xmit) |
5465 | { | 5466 | { |
5466 | int i; | 5467 | int i; |
5467 | int linecount; | 5468 | int linecount; |
@@ -5496,7 +5497,7 @@ void trace_block(SLMP_INFO *info,const char* data, int count, int xmit) | |||
5496 | /* called when HDLC frame times out | 5497 | /* called when HDLC frame times out |
5497 | * update stats and do tx completion processing | 5498 | * update stats and do tx completion processing |
5498 | */ | 5499 | */ |
5499 | void tx_timeout(unsigned long context) | 5500 | static void tx_timeout(unsigned long context) |
5500 | { | 5501 | { |
5501 | SLMP_INFO *info = (SLMP_INFO*)context; | 5502 | SLMP_INFO *info = (SLMP_INFO*)context; |
5502 | unsigned long flags; | 5503 | unsigned long flags; |
@@ -5508,7 +5509,7 @@ void tx_timeout(unsigned long context) | |||
5508 | info->icount.txtimeout++; | 5509 | info->icount.txtimeout++; |
5509 | } | 5510 | } |
5510 | spin_lock_irqsave(&info->lock,flags); | 5511 | spin_lock_irqsave(&info->lock,flags); |
5511 | info->tx_active = 0; | 5512 | info->tx_active = false; |
5512 | info->tx_count = info->tx_put = info->tx_get = 0; | 5513 | info->tx_count = info->tx_put = info->tx_get = 0; |
5513 | 5514 | ||
5514 | spin_unlock_irqrestore(&info->lock,flags); | 5515 | spin_unlock_irqrestore(&info->lock,flags); |
@@ -5523,7 +5524,7 @@ void tx_timeout(unsigned long context) | |||
5523 | 5524 | ||
5524 | /* called to periodically check the DSR/RI modem signal input status | 5525 | /* called to periodically check the DSR/RI modem signal input status |
5525 | */ | 5526 | */ |
5526 | void status_timeout(unsigned long context) | 5527 | static void status_timeout(unsigned long context) |
5527 | { | 5528 | { |
5528 | u16 status = 0; | 5529 | u16 status = 0; |
5529 | SLMP_INFO *info = (SLMP_INFO*)context; | 5530 | SLMP_INFO *info = (SLMP_INFO*)context; |
@@ -5574,36 +5575,36 @@ void status_timeout(unsigned long context) | |||
5574 | } | 5575 | } |
5575 | 5576 | ||
5576 | 5577 | ||
5577 | unsigned char read_reg(SLMP_INFO * info, unsigned char Addr) | 5578 | static unsigned char read_reg(SLMP_INFO * info, unsigned char Addr) |
5578 | { | 5579 | { |
5579 | CALC_REGADDR(); | 5580 | CALC_REGADDR(); |
5580 | return *RegAddr; | 5581 | return *RegAddr; |
5581 | } | 5582 | } |
5582 | void write_reg(SLMP_INFO * info, unsigned char Addr, unsigned char Value) | 5583 | static void write_reg(SLMP_INFO * info, unsigned char Addr, unsigned char Value) |
5583 | { | 5584 | { |
5584 | CALC_REGADDR(); | 5585 | CALC_REGADDR(); |
5585 | *RegAddr = Value; | 5586 | *RegAddr = Value; |
5586 | } | 5587 | } |
5587 | 5588 | ||
5588 | u16 read_reg16(SLMP_INFO * info, unsigned char Addr) | 5589 | static u16 read_reg16(SLMP_INFO * info, unsigned char Addr) |
5589 | { | 5590 | { |
5590 | CALC_REGADDR(); | 5591 | CALC_REGADDR(); |
5591 | return *((u16 *)RegAddr); | 5592 | return *((u16 *)RegAddr); |
5592 | } | 5593 | } |
5593 | 5594 | ||
5594 | void write_reg16(SLMP_INFO * info, unsigned char Addr, u16 Value) | 5595 | static void write_reg16(SLMP_INFO * info, unsigned char Addr, u16 Value) |
5595 | { | 5596 | { |
5596 | CALC_REGADDR(); | 5597 | CALC_REGADDR(); |
5597 | *((u16 *)RegAddr) = Value; | 5598 | *((u16 *)RegAddr) = Value; |
5598 | } | 5599 | } |
5599 | 5600 | ||
5600 | unsigned char read_status_reg(SLMP_INFO * info) | 5601 | static unsigned char read_status_reg(SLMP_INFO * info) |
5601 | { | 5602 | { |
5602 | unsigned char *RegAddr = (unsigned char *)info->statctrl_base; | 5603 | unsigned char *RegAddr = (unsigned char *)info->statctrl_base; |
5603 | return *RegAddr; | 5604 | return *RegAddr; |
5604 | } | 5605 | } |
5605 | 5606 | ||
5606 | void write_control_reg(SLMP_INFO * info) | 5607 | static void write_control_reg(SLMP_INFO * info) |
5607 | { | 5608 | { |
5608 | unsigned char *RegAddr = (unsigned char *)info->statctrl_base; | 5609 | unsigned char *RegAddr = (unsigned char *)info->statctrl_base; |
5609 | *RegAddr = info->port_array[0]->ctrlreg_value; | 5610 | *RegAddr = info->port_array[0]->ctrlreg_value; |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index de60e1ea4fb3..1ade193c9128 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -271,8 +271,7 @@ static struct sysrq_key_op sysrq_term_op = { | |||
271 | 271 | ||
272 | static void moom_callback(struct work_struct *ignored) | 272 | static void moom_callback(struct work_struct *ignored) |
273 | { | 273 | { |
274 | out_of_memory(&NODE_DATA(0)->node_zonelists[ZONE_NORMAL], | 274 | out_of_memory(node_zonelist(0, GFP_KERNEL), GFP_KERNEL, 0); |
275 | GFP_KERNEL, 0); | ||
276 | } | 275 | } |
277 | 276 | ||
278 | static DECLARE_WORK(moom_work, moom_callback); | 277 | static DECLARE_WORK(moom_work, moom_callback); |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 9b58b894f823..df4c3ead9e2b 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -2054,6 +2054,7 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co | |||
2054 | unsigned long draw_from = 0, draw_to = 0; | 2054 | unsigned long draw_from = 0, draw_to = 0; |
2055 | struct vc_data *vc; | 2055 | struct vc_data *vc; |
2056 | unsigned char vc_attr; | 2056 | unsigned char vc_attr; |
2057 | struct vt_notifier_param param; | ||
2057 | uint8_t rescan; | 2058 | uint8_t rescan; |
2058 | uint8_t inverse; | 2059 | uint8_t inverse; |
2059 | uint8_t width; | 2060 | uint8_t width; |
@@ -2113,6 +2114,8 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co | |||
2113 | if (IS_FG(vc)) | 2114 | if (IS_FG(vc)) |
2114 | hide_cursor(vc); | 2115 | hide_cursor(vc); |
2115 | 2116 | ||
2117 | param.vc = vc; | ||
2118 | |||
2116 | while (!tty->stopped && count) { | 2119 | while (!tty->stopped && count) { |
2117 | int orig = *buf; | 2120 | int orig = *buf; |
2118 | c = orig; | 2121 | c = orig; |
@@ -2201,6 +2204,11 @@ rescan_last_byte: | |||
2201 | tc = vc->vc_translate[vc->vc_toggle_meta ? (c | 0x80) : c]; | 2204 | tc = vc->vc_translate[vc->vc_toggle_meta ? (c | 0x80) : c]; |
2202 | } | 2205 | } |
2203 | 2206 | ||
2207 | param.c = tc; | ||
2208 | if (atomic_notifier_call_chain(&vt_notifier_list, VT_PREWRITE, | ||
2209 | ¶m) == NOTIFY_STOP) | ||
2210 | continue; | ||
2211 | |||
2204 | /* If the original code was a control character we | 2212 | /* If the original code was a control character we |
2205 | * only allow a glyph to be displayed if the code is | 2213 | * only allow a glyph to be displayed if the code is |
2206 | * not normally used (such as for cursor movement) or | 2214 | * not normally used (such as for cursor movement) or |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index d8db2f8ee411..24c62b848bf9 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -43,6 +43,7 @@ struct gpio_desc { | |||
43 | /* flag symbols are bit numbers */ | 43 | /* flag symbols are bit numbers */ |
44 | #define FLAG_REQUESTED 0 | 44 | #define FLAG_REQUESTED 0 |
45 | #define FLAG_IS_OUT 1 | 45 | #define FLAG_IS_OUT 1 |
46 | #define FLAG_RESERVED 2 | ||
46 | 47 | ||
47 | #ifdef CONFIG_DEBUG_FS | 48 | #ifdef CONFIG_DEBUG_FS |
48 | const char *label; | 49 | const char *label; |
@@ -68,6 +69,9 @@ static void gpio_ensure_requested(struct gpio_desc *desc) | |||
68 | if (test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0) { | 69 | if (test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0) { |
69 | pr_warning("GPIO-%d autorequested\n", (int)(desc - gpio_desc)); | 70 | pr_warning("GPIO-%d autorequested\n", (int)(desc - gpio_desc)); |
70 | desc_set_label(desc, "[auto]"); | 71 | desc_set_label(desc, "[auto]"); |
72 | if (!try_module_get(desc->chip->owner)) | ||
73 | pr_err("GPIO-%d: module can't be gotten \n", | ||
74 | (int)(desc - gpio_desc)); | ||
71 | } | 75 | } |
72 | } | 76 | } |
73 | 77 | ||
@@ -77,6 +81,76 @@ static inline struct gpio_chip *gpio_to_chip(unsigned gpio) | |||
77 | return gpio_desc[gpio].chip; | 81 | return gpio_desc[gpio].chip; |
78 | } | 82 | } |
79 | 83 | ||
84 | /* dynamic allocation of GPIOs, e.g. on a hotplugged device */ | ||
85 | static int gpiochip_find_base(int ngpio) | ||
86 | { | ||
87 | int i; | ||
88 | int spare = 0; | ||
89 | int base = -ENOSPC; | ||
90 | |||
91 | for (i = ARCH_NR_GPIOS - 1; i >= 0 ; i--) { | ||
92 | struct gpio_desc *desc = &gpio_desc[i]; | ||
93 | struct gpio_chip *chip = desc->chip; | ||
94 | |||
95 | if (!chip && !test_bit(FLAG_RESERVED, &desc->flags)) { | ||
96 | spare++; | ||
97 | if (spare == ngpio) { | ||
98 | base = i; | ||
99 | break; | ||
100 | } | ||
101 | } else { | ||
102 | spare = 0; | ||
103 | if (chip) | ||
104 | i -= chip->ngpio - 1; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | if (gpio_is_valid(base)) | ||
109 | pr_debug("%s: found new base at %d\n", __func__, base); | ||
110 | return base; | ||
111 | } | ||
112 | |||
113 | /** | ||
114 | * gpiochip_reserve() - reserve range of gpios to use with platform code only | ||
115 | * @start: starting gpio number | ||
116 | * @ngpio: number of gpios to reserve | ||
117 | * Context: platform init, potentially before irqs or kmalloc will work | ||
118 | * | ||
119 | * Returns a negative errno if any gpio within the range is already reserved | ||
120 | * or registered, else returns zero as a success code. Use this function | ||
121 | * to mark a range of gpios as unavailable for dynamic gpio number allocation, | ||
122 | * for example because its driver support is not yet loaded. | ||
123 | */ | ||
124 | int __init gpiochip_reserve(int start, int ngpio) | ||
125 | { | ||
126 | int ret = 0; | ||
127 | unsigned long flags; | ||
128 | int i; | ||
129 | |||
130 | if (!gpio_is_valid(start) || !gpio_is_valid(start + ngpio)) | ||
131 | return -EINVAL; | ||
132 | |||
133 | spin_lock_irqsave(&gpio_lock, flags); | ||
134 | |||
135 | for (i = start; i < start + ngpio; i++) { | ||
136 | struct gpio_desc *desc = &gpio_desc[i]; | ||
137 | |||
138 | if (desc->chip || test_bit(FLAG_RESERVED, &desc->flags)) { | ||
139 | ret = -EBUSY; | ||
140 | goto err; | ||
141 | } | ||
142 | |||
143 | set_bit(FLAG_RESERVED, &desc->flags); | ||
144 | } | ||
145 | |||
146 | pr_debug("%s: reserved gpios from %d to %d\n", | ||
147 | __func__, start, start + ngpio - 1); | ||
148 | err: | ||
149 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
150 | |||
151 | return ret; | ||
152 | } | ||
153 | |||
80 | /** | 154 | /** |
81 | * gpiochip_add() - register a gpio_chip | 155 | * gpiochip_add() - register a gpio_chip |
82 | * @chip: the chip to register, with chip->base initialized | 156 | * @chip: the chip to register, with chip->base initialized |
@@ -85,38 +159,49 @@ static inline struct gpio_chip *gpio_to_chip(unsigned gpio) | |||
85 | * Returns a negative errno if the chip can't be registered, such as | 159 | * Returns a negative errno if the chip can't be registered, such as |
86 | * because the chip->base is invalid or already associated with a | 160 | * because the chip->base is invalid or already associated with a |
87 | * different chip. Otherwise it returns zero as a success code. | 161 | * different chip. Otherwise it returns zero as a success code. |
162 | * | ||
163 | * If chip->base is negative, this requests dynamic assignment of | ||
164 | * a range of valid GPIOs. | ||
88 | */ | 165 | */ |
89 | int gpiochip_add(struct gpio_chip *chip) | 166 | int gpiochip_add(struct gpio_chip *chip) |
90 | { | 167 | { |
91 | unsigned long flags; | 168 | unsigned long flags; |
92 | int status = 0; | 169 | int status = 0; |
93 | unsigned id; | 170 | unsigned id; |
171 | int base = chip->base; | ||
94 | 172 | ||
95 | /* NOTE chip->base negative is reserved to mean a request for | 173 | if ((!gpio_is_valid(base) || !gpio_is_valid(base + chip->ngpio)) |
96 | * dynamic allocation. We don't currently support that. | 174 | && base >= 0) { |
97 | */ | ||
98 | |||
99 | if (chip->base < 0 || (chip->base + chip->ngpio) >= ARCH_NR_GPIOS) { | ||
100 | status = -EINVAL; | 175 | status = -EINVAL; |
101 | goto fail; | 176 | goto fail; |
102 | } | 177 | } |
103 | 178 | ||
104 | spin_lock_irqsave(&gpio_lock, flags); | 179 | spin_lock_irqsave(&gpio_lock, flags); |
105 | 180 | ||
181 | if (base < 0) { | ||
182 | base = gpiochip_find_base(chip->ngpio); | ||
183 | if (base < 0) { | ||
184 | status = base; | ||
185 | goto fail_unlock; | ||
186 | } | ||
187 | chip->base = base; | ||
188 | } | ||
189 | |||
106 | /* these GPIO numbers must not be managed by another gpio_chip */ | 190 | /* these GPIO numbers must not be managed by another gpio_chip */ |
107 | for (id = chip->base; id < chip->base + chip->ngpio; id++) { | 191 | for (id = base; id < base + chip->ngpio; id++) { |
108 | if (gpio_desc[id].chip != NULL) { | 192 | if (gpio_desc[id].chip != NULL) { |
109 | status = -EBUSY; | 193 | status = -EBUSY; |
110 | break; | 194 | break; |
111 | } | 195 | } |
112 | } | 196 | } |
113 | if (status == 0) { | 197 | if (status == 0) { |
114 | for (id = chip->base; id < chip->base + chip->ngpio; id++) { | 198 | for (id = base; id < base + chip->ngpio; id++) { |
115 | gpio_desc[id].chip = chip; | 199 | gpio_desc[id].chip = chip; |
116 | gpio_desc[id].flags = 0; | 200 | gpio_desc[id].flags = 0; |
117 | } | 201 | } |
118 | } | 202 | } |
119 | 203 | ||
204 | fail_unlock: | ||
120 | spin_unlock_irqrestore(&gpio_lock, flags); | 205 | spin_unlock_irqrestore(&gpio_lock, flags); |
121 | fail: | 206 | fail: |
122 | /* failures here can mean systems won't boot... */ | 207 | /* failures here can mean systems won't boot... */ |
@@ -171,12 +256,15 @@ int gpio_request(unsigned gpio, const char *label) | |||
171 | 256 | ||
172 | spin_lock_irqsave(&gpio_lock, flags); | 257 | spin_lock_irqsave(&gpio_lock, flags); |
173 | 258 | ||
174 | if (gpio >= ARCH_NR_GPIOS) | 259 | if (!gpio_is_valid(gpio)) |
175 | goto done; | 260 | goto done; |
176 | desc = &gpio_desc[gpio]; | 261 | desc = &gpio_desc[gpio]; |
177 | if (desc->chip == NULL) | 262 | if (desc->chip == NULL) |
178 | goto done; | 263 | goto done; |
179 | 264 | ||
265 | if (!try_module_get(desc->chip->owner)) | ||
266 | goto done; | ||
267 | |||
180 | /* NOTE: gpio_request() can be called in early boot, | 268 | /* NOTE: gpio_request() can be called in early boot, |
181 | * before IRQs are enabled. | 269 | * before IRQs are enabled. |
182 | */ | 270 | */ |
@@ -184,8 +272,10 @@ int gpio_request(unsigned gpio, const char *label) | |||
184 | if (test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0) { | 272 | if (test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0) { |
185 | desc_set_label(desc, label ? : "?"); | 273 | desc_set_label(desc, label ? : "?"); |
186 | status = 0; | 274 | status = 0; |
187 | } else | 275 | } else { |
188 | status = -EBUSY; | 276 | status = -EBUSY; |
277 | module_put(desc->chip->owner); | ||
278 | } | ||
189 | 279 | ||
190 | done: | 280 | done: |
191 | if (status) | 281 | if (status) |
@@ -201,7 +291,7 @@ void gpio_free(unsigned gpio) | |||
201 | unsigned long flags; | 291 | unsigned long flags; |
202 | struct gpio_desc *desc; | 292 | struct gpio_desc *desc; |
203 | 293 | ||
204 | if (gpio >= ARCH_NR_GPIOS) { | 294 | if (!gpio_is_valid(gpio)) { |
205 | WARN_ON(extra_checks); | 295 | WARN_ON(extra_checks); |
206 | return; | 296 | return; |
207 | } | 297 | } |
@@ -209,9 +299,10 @@ void gpio_free(unsigned gpio) | |||
209 | spin_lock_irqsave(&gpio_lock, flags); | 299 | spin_lock_irqsave(&gpio_lock, flags); |
210 | 300 | ||
211 | desc = &gpio_desc[gpio]; | 301 | desc = &gpio_desc[gpio]; |
212 | if (desc->chip && test_and_clear_bit(FLAG_REQUESTED, &desc->flags)) | 302 | if (desc->chip && test_and_clear_bit(FLAG_REQUESTED, &desc->flags)) { |
213 | desc_set_label(desc, NULL); | 303 | desc_set_label(desc, NULL); |
214 | else | 304 | module_put(desc->chip->owner); |
305 | } else | ||
215 | WARN_ON(extra_checks); | 306 | WARN_ON(extra_checks); |
216 | 307 | ||
217 | spin_unlock_irqrestore(&gpio_lock, flags); | 308 | spin_unlock_irqrestore(&gpio_lock, flags); |
@@ -236,7 +327,7 @@ const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned offset) | |||
236 | { | 327 | { |
237 | unsigned gpio = chip->base + offset; | 328 | unsigned gpio = chip->base + offset; |
238 | 329 | ||
239 | if (gpio >= ARCH_NR_GPIOS || gpio_desc[gpio].chip != chip) | 330 | if (!gpio_is_valid(gpio) || gpio_desc[gpio].chip != chip) |
240 | return NULL; | 331 | return NULL; |
241 | if (test_bit(FLAG_REQUESTED, &gpio_desc[gpio].flags) == 0) | 332 | if (test_bit(FLAG_REQUESTED, &gpio_desc[gpio].flags) == 0) |
242 | return NULL; | 333 | return NULL; |
@@ -267,7 +358,7 @@ int gpio_direction_input(unsigned gpio) | |||
267 | 358 | ||
268 | spin_lock_irqsave(&gpio_lock, flags); | 359 | spin_lock_irqsave(&gpio_lock, flags); |
269 | 360 | ||
270 | if (gpio >= ARCH_NR_GPIOS) | 361 | if (!gpio_is_valid(gpio)) |
271 | goto fail; | 362 | goto fail; |
272 | chip = desc->chip; | 363 | chip = desc->chip; |
273 | if (!chip || !chip->get || !chip->direction_input) | 364 | if (!chip || !chip->get || !chip->direction_input) |
@@ -305,7 +396,7 @@ int gpio_direction_output(unsigned gpio, int value) | |||
305 | 396 | ||
306 | spin_lock_irqsave(&gpio_lock, flags); | 397 | spin_lock_irqsave(&gpio_lock, flags); |
307 | 398 | ||
308 | if (gpio >= ARCH_NR_GPIOS) | 399 | if (!gpio_is_valid(gpio)) |
309 | goto fail; | 400 | goto fail; |
310 | chip = desc->chip; | 401 | chip = desc->chip; |
311 | if (!chip || !chip->set || !chip->direction_output) | 402 | if (!chip || !chip->set || !chip->direction_output) |
@@ -522,7 +613,7 @@ static int gpiolib_show(struct seq_file *s, void *unused) | |||
522 | 613 | ||
523 | /* REVISIT this isn't locked against gpio_chip removal ... */ | 614 | /* REVISIT this isn't locked against gpio_chip removal ... */ |
524 | 615 | ||
525 | for (gpio = 0; gpio < ARCH_NR_GPIOS; gpio++) { | 616 | for (gpio = 0; gpio_is_valid(gpio); gpio++) { |
526 | if (chip == gpio_desc[gpio].chip) | 617 | if (chip == gpio_desc[gpio].chip) |
527 | continue; | 618 | continue; |
528 | chip = gpio_desc[gpio].chip; | 619 | chip = gpio_desc[gpio].chip; |
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c index bb60e8c1a1f0..7fb5b9d009d4 100644 --- a/drivers/gpio/mcp23s08.c +++ b/drivers/gpio/mcp23s08.c | |||
@@ -239,6 +239,7 @@ static int mcp23s08_probe(struct spi_device *spi) | |||
239 | mcp->chip.base = pdata->base; | 239 | mcp->chip.base = pdata->base; |
240 | mcp->chip.ngpio = 8; | 240 | mcp->chip.ngpio = 8; |
241 | mcp->chip.can_sleep = 1; | 241 | mcp->chip.can_sleep = 1; |
242 | mcp->chip.owner = THIS_MODULE; | ||
242 | 243 | ||
243 | spi_set_drvdata(spi, mcp); | 244 | spi_set_drvdata(spi, mcp); |
244 | 245 | ||
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index 6e72fd31184d..e0e0af536108 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -189,6 +189,7 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios) | |||
189 | gc->base = chip->gpio_start; | 189 | gc->base = chip->gpio_start; |
190 | gc->ngpio = gpios; | 190 | gc->ngpio = gpios; |
191 | gc->label = chip->client->name; | 191 | gc->label = chip->client->name; |
192 | gc->owner = THIS_MODULE; | ||
192 | } | 193 | } |
193 | 194 | ||
194 | static int __devinit pca953x_probe(struct i2c_client *client) | 195 | static int __devinit pca953x_probe(struct i2c_client *client) |
diff --git a/drivers/gpio/pcf857x.c b/drivers/gpio/pcf857x.c index c6b3b5378384..1106aa15ac79 100644 --- a/drivers/gpio/pcf857x.c +++ b/drivers/gpio/pcf857x.c | |||
@@ -159,6 +159,7 @@ static int pcf857x_probe(struct i2c_client *client) | |||
159 | 159 | ||
160 | gpio->chip.base = pdata->gpio_base; | 160 | gpio->chip.base = pdata->gpio_base; |
161 | gpio->chip.can_sleep = 1; | 161 | gpio->chip.can_sleep = 1; |
162 | gpio->chip.owner = THIS_MODULE; | ||
162 | 163 | ||
163 | /* NOTE: the OnSemi jlc1562b is also largely compatible with | 164 | /* NOTE: the OnSemi jlc1562b is also largely compatible with |
164 | * these parts, notably for output. It has a low-resolution | 165 | * these parts, notably for output. It has a low-resolution |
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index e0d805f1b2bf..01427c51c7cc 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -654,7 +654,7 @@ static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t co | |||
654 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 654 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
655 | HID_REQ_SET_REPORT, | 655 | HID_REQ_SET_REPORT, |
656 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | 656 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, |
657 | cpu_to_le16(((HID_OUTPUT_REPORT + 1) << 8) | *buf), | 657 | ((HID_OUTPUT_REPORT + 1) << 8) | *buf, |
658 | interface->desc.bInterfaceNumber, buf + 1, count - 1, | 658 | interface->desc.bInterfaceNumber, buf + 1, count - 1, |
659 | USB_CTRL_SET_TIMEOUT); | 659 | USB_CTRL_SET_TIMEOUT); |
660 | 660 | ||
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 124445c20921..65038ca35e10 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -419,17 +419,19 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e | |||
419 | 419 | ||
420 | hwif = ide_find_port(); | 420 | hwif = ide_find_port(); |
421 | if (hwif) { | 421 | if (hwif) { |
422 | int i; | ||
423 | |||
424 | /* | 422 | /* |
425 | * Ensure we're using MMIO | 423 | * Ensure we're using MMIO |
426 | */ | 424 | */ |
427 | default_hwif_mmiops(hwif); | 425 | default_hwif_mmiops(hwif); |
428 | 426 | ||
429 | for (i = 0; i <= 7; i++) { | 427 | hwif->io_ports.data_addr = port; |
430 | hwif->io_ports_array[i] = port; | 428 | hwif->io_ports.error_addr = port + (1 << info->stepping); |
431 | port += 1 << info->stepping; | 429 | hwif->io_ports.nsect_addr = port + (2 << info->stepping); |
432 | } | 430 | hwif->io_ports.lbal_addr = port + (3 << info->stepping); |
431 | hwif->io_ports.lbam_addr = port + (4 << info->stepping); | ||
432 | hwif->io_ports.lbah_addr = port + (5 << info->stepping); | ||
433 | hwif->io_ports.device_addr = port + (6 << info->stepping); | ||
434 | hwif->io_ports.status_addr = port + (7 << info->stepping); | ||
433 | hwif->io_ports.ctl_addr = | 435 | hwif->io_ports.ctl_addr = |
434 | (unsigned long)base + info->ctrloffset; | 436 | (unsigned long)base + info->ctrloffset; |
435 | hwif->irq = ec->irq; | 437 | hwif->irq = ec->irq; |
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index a3573d40b4b7..f9210458aea0 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c | |||
@@ -36,23 +36,6 @@ static const unsigned long pcide_bases[Q40IDE_NUM_HWIFS] = { | |||
36 | PCIDE_BASE6 */ | 36 | PCIDE_BASE6 */ |
37 | }; | 37 | }; |
38 | 38 | ||
39 | |||
40 | /* | ||
41 | * Offsets from one of the above bases | ||
42 | */ | ||
43 | |||
44 | /* used to do addr translation here but it is easier to do in setup ports */ | ||
45 | /*#define IDE_OFF_B(x) ((unsigned long)Q40_ISA_IO_B((IDE_##x##_OFFSET)))*/ | ||
46 | |||
47 | #define IDE_OFF_B(x) ((unsigned long)((IDE_##x##_OFFSET))) | ||
48 | #define IDE_OFF_W(x) ((unsigned long)((IDE_##x##_OFFSET))) | ||
49 | |||
50 | static const int pcide_offsets[IDE_NR_PORTS] = { | ||
51 | IDE_OFF_W(DATA), IDE_OFF_B(ERROR), IDE_OFF_B(NSECTOR), IDE_OFF_B(SECTOR), | ||
52 | IDE_OFF_B(LCYL), IDE_OFF_B(HCYL), 6 /*IDE_OFF_B(CURRENT)*/, IDE_OFF_B(STATUS), | ||
53 | 518/*IDE_OFF(CMD)*/ | ||
54 | }; | ||
55 | |||
56 | static int q40ide_default_irq(unsigned long base) | 39 | static int q40ide_default_irq(unsigned long base) |
57 | { | 40 | { |
58 | switch (base) { | 41 | switch (base) { |
@@ -68,23 +51,22 @@ static int q40ide_default_irq(unsigned long base) | |||
68 | /* | 51 | /* |
69 | * Addresses are pretranslated for Q40 ISA access. | 52 | * Addresses are pretranslated for Q40 ISA access. |
70 | */ | 53 | */ |
71 | void q40_ide_setup_ports ( hw_regs_t *hw, | 54 | static void q40_ide_setup_ports(hw_regs_t *hw, unsigned long base, |
72 | unsigned long base, int *offsets, | ||
73 | unsigned long ctrl, unsigned long intr, | ||
74 | ide_ack_intr_t *ack_intr, | 55 | ide_ack_intr_t *ack_intr, |
75 | int irq) | 56 | int irq) |
76 | { | 57 | { |
77 | int i; | ||
78 | |||
79 | memset(hw, 0, sizeof(hw_regs_t)); | 58 | memset(hw, 0, sizeof(hw_regs_t)); |
80 | for (i = 0; i < IDE_NR_PORTS; i++) { | 59 | /* BIG FAT WARNING: |
81 | /* BIG FAT WARNING: | 60 | assumption: only DATA port is ever used in 16 bit mode */ |
82 | assumption: only DATA port is ever used in 16 bit mode */ | 61 | hw->io_ports.data_addr = Q40_ISA_IO_W(base); |
83 | if (i == 0) | 62 | hw->io_ports.error_addr = Q40_ISA_IO_B(base + 1); |
84 | hw->io_ports_array[i] = Q40_ISA_IO_W(base + offsets[i]); | 63 | hw->io_ports.nsect_addr = Q40_ISA_IO_B(base + 2); |
85 | else | 64 | hw->io_ports.lbal_addr = Q40_ISA_IO_B(base + 3); |
86 | hw->io_ports_array[i] = Q40_ISA_IO_B(base + offsets[i]); | 65 | hw->io_ports.lbam_addr = Q40_ISA_IO_B(base + 4); |
87 | } | 66 | hw->io_ports.lbah_addr = Q40_ISA_IO_B(base + 5); |
67 | hw->io_ports.device_addr = Q40_ISA_IO_B(base + 6); | ||
68 | hw->io_ports.status_addr = Q40_ISA_IO_B(base + 7); | ||
69 | hw->io_ports.ctl_addr = Q40_ISA_IO_B(base + 0x206); | ||
88 | 70 | ||
89 | hw->irq = irq; | 71 | hw->irq = irq; |
90 | hw->ack_intr = ack_intr; | 72 | hw->ack_intr = ack_intr; |
@@ -131,9 +113,8 @@ static int __init q40ide_init(void) | |||
131 | release_region(pcide_bases[i], 8); | 113 | release_region(pcide_bases[i], 8); |
132 | continue; | 114 | continue; |
133 | } | 115 | } |
134 | q40_ide_setup_ports(&hw,(unsigned long) pcide_bases[i], (int *)pcide_offsets, | 116 | q40_ide_setup_ports(&hw, pcide_bases[i], |
135 | pcide_bases[i]+0x206, | 117 | NULL, |
136 | 0, NULL, | ||
137 | // m68kide_iops, | 118 | // m68kide_iops, |
138 | q40ide_default_irq(pcide_bases[i])); | 119 | q40ide_default_irq(pcide_bases[i])); |
139 | 120 | ||
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index 1457b73850e7..7fb3cf81cfbf 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c | |||
@@ -159,7 +159,7 @@ static int iforce_usb_probe(struct usb_interface *intf, | |||
159 | 159 | ||
160 | iforce->cr.bRequestType = USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_INTERFACE; | 160 | iforce->cr.bRequestType = USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_INTERFACE; |
161 | iforce->cr.wIndex = 0; | 161 | iforce->cr.wIndex = 0; |
162 | iforce->cr.wLength = 16; | 162 | iforce->cr.wLength = cpu_to_le16(16); |
163 | 163 | ||
164 | usb_fill_int_urb(iforce->irq, dev, usb_rcvintpipe(dev, epirq->bEndpointAddress), | 164 | usb_fill_int_urb(iforce->irq, dev, usb_rcvintpipe(dev, epirq->bEndpointAddress), |
165 | iforce->data, 16, iforce_usb_irq, iforce, epirq->bInterval); | 165 | iforce->data, 16, iforce_usb_irq, iforce, epirq->bInterval); |
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c index fed3c375ccf3..d8765cc93d27 100644 --- a/drivers/input/misc/sparcspkr.c +++ b/drivers/input/misc/sparcspkr.c | |||
@@ -2,33 +2,69 @@ | |||
2 | * Driver for PC-speaker like devices found on various Sparc systems. | 2 | * Driver for PC-speaker like devices found on various Sparc systems. |
3 | * | 3 | * |
4 | * Copyright (c) 2002 Vojtech Pavlik | 4 | * Copyright (c) 2002 Vojtech Pavlik |
5 | * Copyright (c) 2002, 2006 David S. Miller (davem@davemloft.net) | 5 | * Copyright (c) 2002, 2006, 2008 David S. Miller (davem@davemloft.net) |
6 | */ | 6 | */ |
7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/input.h> | 10 | #include <linux/input.h> |
11 | #include <linux/platform_device.h> | 11 | #include <linux/of_device.h> |
12 | 12 | ||
13 | #include <asm/io.h> | 13 | #include <asm/io.h> |
14 | #include <asm/ebus.h> | ||
15 | #include <asm/isa.h> | ||
16 | 14 | ||
17 | MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); | 15 | MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); |
18 | MODULE_DESCRIPTION("Sparc Speaker beeper driver"); | 16 | MODULE_DESCRIPTION("Sparc Speaker beeper driver"); |
19 | MODULE_LICENSE("GPL"); | 17 | MODULE_LICENSE("GPL"); |
20 | 18 | ||
19 | struct grover_beep_info { | ||
20 | void __iomem *freq_regs; | ||
21 | void __iomem *enable_reg; | ||
22 | }; | ||
23 | |||
24 | struct bbc_beep_info { | ||
25 | u32 clock_freq; | ||
26 | void __iomem *regs; | ||
27 | }; | ||
28 | |||
21 | struct sparcspkr_state { | 29 | struct sparcspkr_state { |
22 | const char *name; | 30 | const char *name; |
23 | unsigned long iobase; | ||
24 | int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); | 31 | int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); |
25 | spinlock_t lock; | 32 | spinlock_t lock; |
26 | struct input_dev *input_dev; | 33 | struct input_dev *input_dev; |
34 | union { | ||
35 | struct grover_beep_info grover; | ||
36 | struct bbc_beep_info bbc; | ||
37 | } u; | ||
27 | }; | 38 | }; |
28 | 39 | ||
29 | static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 40 | static u32 bbc_count_to_reg(struct bbc_beep_info *info, unsigned int count) |
41 | { | ||
42 | u32 val, clock_freq = info->clock_freq; | ||
43 | int i; | ||
44 | |||
45 | if (!count) | ||
46 | return 0; | ||
47 | |||
48 | if (count <= clock_freq >> 20) | ||
49 | return 1 << 18; | ||
50 | |||
51 | if (count >= clock_freq >> 12) | ||
52 | return 1 << 10; | ||
53 | |||
54 | val = 1 << 18; | ||
55 | for (i = 19; i >= 11; i--) { | ||
56 | val >>= 1; | ||
57 | if (count <= clock_freq >> i) | ||
58 | break; | ||
59 | } | ||
60 | |||
61 | return val; | ||
62 | } | ||
63 | |||
64 | static int bbc_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | ||
30 | { | 65 | { |
31 | struct sparcspkr_state *state = dev_get_drvdata(dev->dev.parent); | 66 | struct sparcspkr_state *state = dev_get_drvdata(dev->dev.parent); |
67 | struct bbc_beep_info *info = &state->u.bbc; | ||
32 | unsigned int count = 0; | 68 | unsigned int count = 0; |
33 | unsigned long flags; | 69 | unsigned long flags; |
34 | 70 | ||
@@ -44,24 +80,29 @@ static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned in | |||
44 | if (value > 20 && value < 32767) | 80 | if (value > 20 && value < 32767) |
45 | count = 1193182 / value; | 81 | count = 1193182 / value; |
46 | 82 | ||
83 | count = bbc_count_to_reg(info, count); | ||
84 | |||
47 | spin_lock_irqsave(&state->lock, flags); | 85 | spin_lock_irqsave(&state->lock, flags); |
48 | 86 | ||
49 | /* EBUS speaker only has on/off state, the frequency does not | 87 | if (count) { |
50 | * appear to be programmable. | 88 | outb(0x01, info->regs + 0); |
51 | */ | 89 | outb(0x00, info->regs + 2); |
52 | if (state->iobase & 0x2UL) | 90 | outb((count >> 16) & 0xff, info->regs + 3); |
53 | outb(!!count, state->iobase); | 91 | outb((count >> 8) & 0xff, info->regs + 4); |
54 | else | 92 | outb(0x00, info->regs + 5); |
55 | outl(!!count, state->iobase); | 93 | } else { |
94 | outb(0x00, info->regs + 0); | ||
95 | } | ||
56 | 96 | ||
57 | spin_unlock_irqrestore(&state->lock, flags); | 97 | spin_unlock_irqrestore(&state->lock, flags); |
58 | 98 | ||
59 | return 0; | 99 | return 0; |
60 | } | 100 | } |
61 | 101 | ||
62 | static int isa_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 102 | static int grover_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
63 | { | 103 | { |
64 | struct sparcspkr_state *state = dev_get_drvdata(dev->dev.parent); | 104 | struct sparcspkr_state *state = dev_get_drvdata(dev->dev.parent); |
105 | struct grover_beep_info *info = &state->u.grover; | ||
65 | unsigned int count = 0; | 106 | unsigned int count = 0; |
66 | unsigned long flags; | 107 | unsigned long flags; |
67 | 108 | ||
@@ -81,15 +122,15 @@ static int isa_spkr_event(struct input_dev *dev, unsigned int type, unsigned int | |||
81 | 122 | ||
82 | if (count) { | 123 | if (count) { |
83 | /* enable counter 2 */ | 124 | /* enable counter 2 */ |
84 | outb(inb(state->iobase + 0x61) | 3, state->iobase + 0x61); | 125 | outb(inb(info->enable_reg) | 3, info->enable_reg); |
85 | /* set command for counter 2, 2 byte write */ | 126 | /* set command for counter 2, 2 byte write */ |
86 | outb(0xB6, state->iobase + 0x43); | 127 | outb(0xB6, info->freq_regs + 1); |
87 | /* select desired HZ */ | 128 | /* select desired HZ */ |
88 | outb(count & 0xff, state->iobase + 0x42); | 129 | outb(count & 0xff, info->freq_regs + 0); |
89 | outb((count >> 8) & 0xff, state->iobase + 0x42); | 130 | outb((count >> 8) & 0xff, info->freq_regs + 0); |
90 | } else { | 131 | } else { |
91 | /* disable counter 2 */ | 132 | /* disable counter 2 */ |
92 | outb(inb_p(state->iobase + 0x61) & 0xFC, state->iobase + 0x61); | 133 | outb(inb_p(info->enable_reg) & 0xFC, info->enable_reg); |
93 | } | 134 | } |
94 | 135 | ||
95 | spin_unlock_irqrestore(&state->lock, flags); | 136 | spin_unlock_irqrestore(&state->lock, flags); |
@@ -131,7 +172,7 @@ static int __devinit sparcspkr_probe(struct device *dev) | |||
131 | return 0; | 172 | return 0; |
132 | } | 173 | } |
133 | 174 | ||
134 | static int __devexit sparcspkr_remove(struct of_device *dev) | 175 | static int sparcspkr_shutdown(struct of_device *dev) |
135 | { | 176 | { |
136 | struct sparcspkr_state *state = dev_get_drvdata(&dev->dev); | 177 | struct sparcspkr_state *state = dev_get_drvdata(&dev->dev); |
137 | struct input_dev *input_dev = state->input_dev; | 178 | struct input_dev *input_dev = state->input_dev; |
@@ -139,115 +180,180 @@ static int __devexit sparcspkr_remove(struct of_device *dev) | |||
139 | /* turn off the speaker */ | 180 | /* turn off the speaker */ |
140 | state->event(input_dev, EV_SND, SND_BELL, 0); | 181 | state->event(input_dev, EV_SND, SND_BELL, 0); |
141 | 182 | ||
142 | input_unregister_device(input_dev); | ||
143 | |||
144 | dev_set_drvdata(&dev->dev, NULL); | ||
145 | kfree(state); | ||
146 | |||
147 | return 0; | 183 | return 0; |
148 | } | 184 | } |
149 | 185 | ||
150 | static int sparcspkr_shutdown(struct of_device *dev) | 186 | static int __devinit bbc_beep_probe(struct of_device *op, const struct of_device_id *match) |
151 | { | 187 | { |
152 | struct sparcspkr_state *state = dev_get_drvdata(&dev->dev); | 188 | struct sparcspkr_state *state; |
153 | struct input_dev *input_dev = state->input_dev; | 189 | struct bbc_beep_info *info; |
190 | struct device_node *dp; | ||
191 | int err = -ENOMEM; | ||
154 | 192 | ||
155 | /* turn off the speaker */ | 193 | state = kzalloc(sizeof(*state), GFP_KERNEL); |
156 | state->event(input_dev, EV_SND, SND_BELL, 0); | 194 | if (!state) |
195 | goto out_err; | ||
196 | |||
197 | state->name = "Sparc BBC Speaker"; | ||
198 | state->event = bbc_spkr_event; | ||
199 | spin_lock_init(&state->lock); | ||
200 | |||
201 | dp = of_find_node_by_path("/"); | ||
202 | err = -ENODEV; | ||
203 | if (!dp) | ||
204 | goto out_free; | ||
205 | |||
206 | info = &state->u.bbc; | ||
207 | info->clock_freq = of_getintprop_default(dp, "clock-frequency", 0); | ||
208 | if (!info->clock_freq) | ||
209 | goto out_free; | ||
210 | |||
211 | info->regs = of_ioremap(&op->resource[0], 0, 6, "bbc beep"); | ||
212 | if (!info->regs) | ||
213 | goto out_free; | ||
214 | |||
215 | dev_set_drvdata(&op->dev, state); | ||
216 | |||
217 | err = sparcspkr_probe(&op->dev); | ||
218 | if (err) | ||
219 | goto out_clear_drvdata; | ||
157 | 220 | ||
158 | return 0; | 221 | return 0; |
222 | |||
223 | out_clear_drvdata: | ||
224 | dev_set_drvdata(&op->dev, NULL); | ||
225 | of_iounmap(&op->resource[0], info->regs, 6); | ||
226 | |||
227 | out_free: | ||
228 | kfree(state); | ||
229 | out_err: | ||
230 | return err; | ||
159 | } | 231 | } |
160 | 232 | ||
161 | static int __devinit ebus_beep_probe(struct of_device *dev, const struct of_device_id *match) | 233 | static int bbc_remove(struct of_device *op) |
162 | { | 234 | { |
163 | struct linux_ebus_device *edev = to_ebus_device(&dev->dev); | 235 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); |
164 | struct sparcspkr_state *state; | 236 | struct input_dev *input_dev = state->input_dev; |
165 | int err; | 237 | struct bbc_beep_info *info = &state->u.bbc; |
166 | 238 | ||
167 | state = kzalloc(sizeof(*state), GFP_KERNEL); | 239 | /* turn off the speaker */ |
168 | if (!state) | 240 | state->event(input_dev, EV_SND, SND_BELL, 0); |
169 | return -ENOMEM; | ||
170 | 241 | ||
171 | state->name = "Sparc EBUS Speaker"; | 242 | input_unregister_device(input_dev); |
172 | state->iobase = edev->resource[0].start; | ||
173 | state->event = ebus_spkr_event; | ||
174 | spin_lock_init(&state->lock); | ||
175 | 243 | ||
176 | dev_set_drvdata(&dev->dev, state); | 244 | of_iounmap(&op->resource[0], info->regs, 6); |
177 | 245 | ||
178 | err = sparcspkr_probe(&dev->dev); | 246 | dev_set_drvdata(&op->dev, NULL); |
179 | if (err) { | 247 | kfree(state); |
180 | dev_set_drvdata(&dev->dev, NULL); | ||
181 | kfree(state); | ||
182 | } | ||
183 | 248 | ||
184 | return 0; | 249 | return 0; |
185 | } | 250 | } |
186 | 251 | ||
187 | static struct of_device_id ebus_beep_match[] = { | 252 | static struct of_device_id bbc_beep_match[] = { |
188 | { | 253 | { |
189 | .name = "beep", | 254 | .name = "beep", |
255 | .compatible = "SUNW,bbc-beep", | ||
190 | }, | 256 | }, |
191 | {}, | 257 | {}, |
192 | }; | 258 | }; |
193 | 259 | ||
194 | static struct of_platform_driver ebus_beep_driver = { | 260 | static struct of_platform_driver bbc_beep_driver = { |
195 | .name = "beep", | 261 | .name = "bbcbeep", |
196 | .match_table = ebus_beep_match, | 262 | .match_table = bbc_beep_match, |
197 | .probe = ebus_beep_probe, | 263 | .probe = bbc_beep_probe, |
198 | .remove = __devexit_p(sparcspkr_remove), | 264 | .remove = __devexit_p(bbc_remove), |
199 | .shutdown = sparcspkr_shutdown, | 265 | .shutdown = sparcspkr_shutdown, |
200 | }; | 266 | }; |
201 | 267 | ||
202 | static int __devinit isa_beep_probe(struct of_device *dev, const struct of_device_id *match) | 268 | static int __devinit grover_beep_probe(struct of_device *op, const struct of_device_id *match) |
203 | { | 269 | { |
204 | struct sparc_isa_device *idev = to_isa_device(&dev->dev); | ||
205 | struct sparcspkr_state *state; | 270 | struct sparcspkr_state *state; |
206 | int err; | 271 | struct grover_beep_info *info; |
272 | int err = -ENOMEM; | ||
207 | 273 | ||
208 | state = kzalloc(sizeof(*state), GFP_KERNEL); | 274 | state = kzalloc(sizeof(*state), GFP_KERNEL); |
209 | if (!state) | 275 | if (!state) |
210 | return -ENOMEM; | 276 | goto out_err; |
211 | 277 | ||
212 | state->name = "Sparc ISA Speaker"; | 278 | state->name = "Sparc Grover Speaker"; |
213 | state->iobase = idev->resource.start; | 279 | state->event = grover_spkr_event; |
214 | state->event = isa_spkr_event; | ||
215 | spin_lock_init(&state->lock); | 280 | spin_lock_init(&state->lock); |
216 | 281 | ||
217 | dev_set_drvdata(&dev->dev, state); | 282 | info = &state->u.grover; |
283 | info->freq_regs = of_ioremap(&op->resource[2], 0, 2, "grover beep freq"); | ||
284 | if (!info->freq_regs) | ||
285 | goto out_free; | ||
218 | 286 | ||
219 | err = sparcspkr_probe(&dev->dev); | 287 | info->enable_reg = of_ioremap(&op->resource[3], 0, 1, "grover beep enable"); |
220 | if (err) { | 288 | if (!info->enable_reg) |
221 | dev_set_drvdata(&dev->dev, NULL); | 289 | goto out_unmap_freq_regs; |
222 | kfree(state); | 290 | |
223 | } | 291 | dev_set_drvdata(&op->dev, state); |
292 | |||
293 | err = sparcspkr_probe(&op->dev); | ||
294 | if (err) | ||
295 | goto out_clear_drvdata; | ||
296 | |||
297 | return 0; | ||
298 | |||
299 | out_clear_drvdata: | ||
300 | dev_set_drvdata(&op->dev, NULL); | ||
301 | of_iounmap(&op->resource[3], info->enable_reg, 1); | ||
302 | |||
303 | out_unmap_freq_regs: | ||
304 | of_iounmap(&op->resource[2], info->freq_regs, 2); | ||
305 | out_free: | ||
306 | kfree(state); | ||
307 | out_err: | ||
308 | return err; | ||
309 | } | ||
310 | |||
311 | static int grover_remove(struct of_device *op) | ||
312 | { | ||
313 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); | ||
314 | struct grover_beep_info *info = &state->u.grover; | ||
315 | struct input_dev *input_dev = state->input_dev; | ||
316 | |||
317 | /* turn off the speaker */ | ||
318 | state->event(input_dev, EV_SND, SND_BELL, 0); | ||
319 | |||
320 | input_unregister_device(input_dev); | ||
321 | |||
322 | of_iounmap(&op->resource[3], info->enable_reg, 1); | ||
323 | of_iounmap(&op->resource[2], info->freq_regs, 2); | ||
324 | |||
325 | dev_set_drvdata(&op->dev, NULL); | ||
326 | kfree(state); | ||
224 | 327 | ||
225 | return 0; | 328 | return 0; |
226 | } | 329 | } |
227 | 330 | ||
228 | static struct of_device_id isa_beep_match[] = { | 331 | static struct of_device_id grover_beep_match[] = { |
229 | { | 332 | { |
230 | .name = "dma", | 333 | .name = "beep", |
334 | .compatible = "SUNW,smbus-beep", | ||
231 | }, | 335 | }, |
232 | {}, | 336 | {}, |
233 | }; | 337 | }; |
234 | 338 | ||
235 | static struct of_platform_driver isa_beep_driver = { | 339 | static struct of_platform_driver grover_beep_driver = { |
236 | .name = "beep", | 340 | .name = "groverbeep", |
237 | .match_table = isa_beep_match, | 341 | .match_table = grover_beep_match, |
238 | .probe = isa_beep_probe, | 342 | .probe = grover_beep_probe, |
239 | .remove = __devexit_p(sparcspkr_remove), | 343 | .remove = __devexit_p(grover_remove), |
240 | .shutdown = sparcspkr_shutdown, | 344 | .shutdown = sparcspkr_shutdown, |
241 | }; | 345 | }; |
242 | 346 | ||
243 | static int __init sparcspkr_init(void) | 347 | static int __init sparcspkr_init(void) |
244 | { | 348 | { |
245 | int err = of_register_driver(&ebus_beep_driver, &ebus_bus_type); | 349 | int err = of_register_driver(&bbc_beep_driver, |
350 | &of_platform_bus_type); | ||
246 | 351 | ||
247 | if (!err) { | 352 | if (!err) { |
248 | err = of_register_driver(&isa_beep_driver, &isa_bus_type); | 353 | err = of_register_driver(&grover_beep_driver, |
354 | &of_platform_bus_type); | ||
249 | if (err) | 355 | if (err) |
250 | of_unregister_driver(&ebus_beep_driver); | 356 | of_unregister_driver(&bbc_beep_driver); |
251 | } | 357 | } |
252 | 358 | ||
253 | return err; | 359 | return err; |
@@ -255,8 +361,8 @@ static int __init sparcspkr_init(void) | |||
255 | 361 | ||
256 | static void __exit sparcspkr_exit(void) | 362 | static void __exit sparcspkr_exit(void) |
257 | { | 363 | { |
258 | of_unregister_driver(&ebus_beep_driver); | 364 | of_unregister_driver(&bbc_beep_driver); |
259 | of_unregister_driver(&isa_beep_driver); | 365 | of_unregister_driver(&grover_beep_driver); |
260 | } | 366 | } |
261 | 367 | ||
262 | module_init(sparcspkr_init); | 368 | module_init(sparcspkr_init); |
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index d2c6da264722..f66ca215cdec 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c | |||
@@ -897,7 +897,7 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
897 | dbg("Extra descriptor success: type:%d len:%d", | 897 | dbg("Extra descriptor success: type:%d len:%d", |
898 | hid_desc->bDescriptorType, hid_desc->wDescriptorLength); | 898 | hid_desc->bDescriptorType, hid_desc->wDescriptorLength); |
899 | 899 | ||
900 | report = kzalloc(hid_desc->wDescriptorLength, GFP_KERNEL); | 900 | report = kzalloc(le16_to_cpu(hid_desc->wDescriptorLength), GFP_KERNEL); |
901 | if (!report) { | 901 | if (!report) { |
902 | err("No more memory for report"); | 902 | err("No more memory for report"); |
903 | error = -ENOMEM; | 903 | error = -ENOMEM; |
@@ -913,16 +913,16 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
913 | REPORT_DEVICE_TYPE << 8, | 913 | REPORT_DEVICE_TYPE << 8, |
914 | 0, /* interface */ | 914 | 0, /* interface */ |
915 | report, | 915 | report, |
916 | hid_desc->wDescriptorLength, | 916 | le16_to_cpu(hid_desc->wDescriptorLength), |
917 | 5000); /* 5 secs */ | 917 | 5000); /* 5 secs */ |
918 | 918 | ||
919 | if (result == hid_desc->wDescriptorLength) | 919 | if (result == le16_to_cpu(hid_desc->wDescriptorLength)) |
920 | break; | 920 | break; |
921 | } | 921 | } |
922 | 922 | ||
923 | /* If we didn't get the report, fail */ | 923 | /* If we didn't get the report, fail */ |
924 | dbg("usb_control_msg result: :%d", result); | 924 | dbg("usb_control_msg result: :%d", result); |
925 | if (result != hid_desc->wDescriptorLength) { | 925 | if (result != le16_to_cpu(hid_desc->wDescriptorLength)) { |
926 | err("Failed to get HID Report Descriptor of size: %d", | 926 | err("Failed to get HID Report Descriptor of size: %d", |
927 | hid_desc->wDescriptorLength); | 927 | hid_desc->wDescriptorLength); |
928 | error = -EIO; | 928 | error = -EIO; |
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 23ae66c76d47..24c6b7ca62be 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -350,7 +350,7 @@ static void capincci_free(struct capidev *cdev, u32 ncci) | |||
350 | if (ncci == 0xffffffff || np->ncci == ncci) { | 350 | if (ncci == 0xffffffff || np->ncci == ncci) { |
351 | *pp = (*pp)->next; | 351 | *pp = (*pp)->next; |
352 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE | 352 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE |
353 | if ((mp = np->minorp) != 0) { | 353 | if ((mp = np->minorp) != NULL) { |
354 | #if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE) | 354 | #if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE) |
355 | capifs_free_ncci(mp->minor); | 355 | capifs_free_ncci(mp->minor); |
356 | #endif | 356 | #endif |
@@ -366,7 +366,7 @@ static void capincci_free(struct capidev *cdev, u32 ncci) | |||
366 | } | 366 | } |
367 | #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ | 367 | #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ |
368 | kfree(np); | 368 | kfree(np); |
369 | if (*pp == 0) return; | 369 | if (*pp == NULL) return; |
370 | } else { | 370 | } else { |
371 | pp = &(*pp)->next; | 371 | pp = &(*pp)->next; |
372 | } | 372 | } |
@@ -483,7 +483,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb) | |||
483 | #endif | 483 | #endif |
484 | goto bad; | 484 | goto bad; |
485 | } | 485 | } |
486 | if ((nskb = gen_data_b3_resp_for(mp, skb)) == 0) { | 486 | if ((nskb = gen_data_b3_resp_for(mp, skb)) == NULL) { |
487 | printk(KERN_ERR "capi: gen_data_b3_resp failed\n"); | 487 | printk(KERN_ERR "capi: gen_data_b3_resp failed\n"); |
488 | goto bad; | 488 | goto bad; |
489 | } | 489 | } |
@@ -512,7 +512,7 @@ bad: | |||
512 | static void handle_minor_recv(struct capiminor *mp) | 512 | static void handle_minor_recv(struct capiminor *mp) |
513 | { | 513 | { |
514 | struct sk_buff *skb; | 514 | struct sk_buff *skb; |
515 | while ((skb = skb_dequeue(&mp->inqueue)) != 0) { | 515 | while ((skb = skb_dequeue(&mp->inqueue)) != NULL) { |
516 | unsigned int len = skb->len; | 516 | unsigned int len = skb->len; |
517 | mp->inbytes -= len; | 517 | mp->inbytes -= len; |
518 | if (handle_recv_skb(mp, skb) < 0) { | 518 | if (handle_recv_skb(mp, skb) < 0) { |
@@ -538,7 +538,7 @@ static int handle_minor_send(struct capiminor *mp) | |||
538 | return 0; | 538 | return 0; |
539 | } | 539 | } |
540 | 540 | ||
541 | while ((skb = skb_dequeue(&mp->outqueue)) != 0) { | 541 | while ((skb = skb_dequeue(&mp->outqueue)) != NULL) { |
542 | datahandle = mp->datahandle; | 542 | datahandle = mp->datahandle; |
543 | len = (u16)skb->len; | 543 | len = (u16)skb->len; |
544 | skb_push(skb, CAPI_DATA_B3_REQ_LEN); | 544 | skb_push(skb, CAPI_DATA_B3_REQ_LEN); |
@@ -689,19 +689,19 @@ capi_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
689 | if (!cdev->ap.applid) | 689 | if (!cdev->ap.applid) |
690 | return -ENODEV; | 690 | return -ENODEV; |
691 | 691 | ||
692 | if ((skb = skb_dequeue(&cdev->recvqueue)) == 0) { | 692 | if ((skb = skb_dequeue(&cdev->recvqueue)) == NULL) { |
693 | 693 | ||
694 | if (file->f_flags & O_NONBLOCK) | 694 | if (file->f_flags & O_NONBLOCK) |
695 | return -EAGAIN; | 695 | return -EAGAIN; |
696 | 696 | ||
697 | for (;;) { | 697 | for (;;) { |
698 | interruptible_sleep_on(&cdev->recvwait); | 698 | interruptible_sleep_on(&cdev->recvwait); |
699 | if ((skb = skb_dequeue(&cdev->recvqueue)) != 0) | 699 | if ((skb = skb_dequeue(&cdev->recvqueue)) != NULL) |
700 | break; | 700 | break; |
701 | if (signal_pending(current)) | 701 | if (signal_pending(current)) |
702 | break; | 702 | break; |
703 | } | 703 | } |
704 | if (skb == 0) | 704 | if (skb == NULL) |
705 | return -ERESTARTNOHAND; | 705 | return -ERESTARTNOHAND; |
706 | } | 706 | } |
707 | if (skb->len > count) { | 707 | if (skb->len > count) { |
@@ -940,12 +940,12 @@ capi_ioctl(struct inode *inode, struct file *file, | |||
940 | return -EFAULT; | 940 | return -EFAULT; |
941 | 941 | ||
942 | mutex_lock(&cdev->ncci_list_mtx); | 942 | mutex_lock(&cdev->ncci_list_mtx); |
943 | if ((nccip = capincci_find(cdev, (u32) ncci)) == 0) { | 943 | if ((nccip = capincci_find(cdev, (u32) ncci)) == NULL) { |
944 | mutex_unlock(&cdev->ncci_list_mtx); | 944 | mutex_unlock(&cdev->ncci_list_mtx); |
945 | return 0; | 945 | return 0; |
946 | } | 946 | } |
947 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE | 947 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE |
948 | if ((mp = nccip->minorp) != 0) { | 948 | if ((mp = nccip->minorp) != NULL) { |
949 | count += atomic_read(&mp->ttyopencount); | 949 | count += atomic_read(&mp->ttyopencount); |
950 | } | 950 | } |
951 | #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ | 951 | #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ |
@@ -966,7 +966,7 @@ capi_ioctl(struct inode *inode, struct file *file, | |||
966 | return -EFAULT; | 966 | return -EFAULT; |
967 | mutex_lock(&cdev->ncci_list_mtx); | 967 | mutex_lock(&cdev->ncci_list_mtx); |
968 | nccip = capincci_find(cdev, (u32) ncci); | 968 | nccip = capincci_find(cdev, (u32) ncci); |
969 | if (!nccip || (mp = nccip->minorp) == 0) { | 969 | if (!nccip || (mp = nccip->minorp) == NULL) { |
970 | mutex_unlock(&cdev->ncci_list_mtx); | 970 | mutex_unlock(&cdev->ncci_list_mtx); |
971 | return -ESRCH; | 971 | return -ESRCH; |
972 | } | 972 | } |
@@ -986,7 +986,7 @@ capi_open(struct inode *inode, struct file *file) | |||
986 | if (file->private_data) | 986 | if (file->private_data) |
987 | return -EEXIST; | 987 | return -EEXIST; |
988 | 988 | ||
989 | if ((file->private_data = capidev_alloc()) == 0) | 989 | if ((file->private_data = capidev_alloc()) == NULL) |
990 | return -ENOMEM; | 990 | return -ENOMEM; |
991 | 991 | ||
992 | return nonseekable_open(inode, file); | 992 | return nonseekable_open(inode, file); |
@@ -1023,9 +1023,9 @@ static int capinc_tty_open(struct tty_struct * tty, struct file * file) | |||
1023 | struct capiminor *mp; | 1023 | struct capiminor *mp; |
1024 | unsigned long flags; | 1024 | unsigned long flags; |
1025 | 1025 | ||
1026 | if ((mp = capiminor_find(iminor(file->f_path.dentry->d_inode))) == 0) | 1026 | if ((mp = capiminor_find(iminor(file->f_path.dentry->d_inode))) == NULL) |
1027 | return -ENXIO; | 1027 | return -ENXIO; |
1028 | if (mp->nccip == 0) | 1028 | if (mp->nccip == NULL) |
1029 | return -ENXIO; | 1029 | return -ENXIO; |
1030 | 1030 | ||
1031 | tty->driver_data = (void *)mp; | 1031 | tty->driver_data = (void *)mp; |
@@ -1058,7 +1058,7 @@ static void capinc_tty_close(struct tty_struct * tty, struct file * file) | |||
1058 | #ifdef _DEBUG_REFCOUNT | 1058 | #ifdef _DEBUG_REFCOUNT |
1059 | printk(KERN_DEBUG "capinc_tty_close ocount=%d\n", atomic_read(&mp->ttyopencount)); | 1059 | printk(KERN_DEBUG "capinc_tty_close ocount=%d\n", atomic_read(&mp->ttyopencount)); |
1060 | #endif | 1060 | #endif |
1061 | if (mp->nccip == 0) | 1061 | if (mp->nccip == NULL) |
1062 | capiminor_free(mp); | 1062 | capiminor_free(mp); |
1063 | } | 1063 | } |
1064 | 1064 | ||
@@ -1526,9 +1526,9 @@ static int __init capi_init(void) | |||
1526 | char *compileinfo; | 1526 | char *compileinfo; |
1527 | int major_ret; | 1527 | int major_ret; |
1528 | 1528 | ||
1529 | if ((p = strchr(revision, ':')) != 0 && p[1]) { | 1529 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
1530 | strlcpy(rev, p + 2, sizeof(rev)); | 1530 | strlcpy(rev, p + 2, sizeof(rev)); |
1531 | if ((p = strchr(rev, '$')) != 0 && p > rev) | 1531 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
1532 | *(p-1) = 0; | 1532 | *(p-1) = 0; |
1533 | } else | 1533 | } else |
1534 | strcpy(rev, "1.0"); | 1534 | strcpy(rev, "1.0"); |
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c index cb42b690b45e..d5b4cc357a3c 100644 --- a/drivers/isdn/capi/capidrv.c +++ b/drivers/isdn/capi/capidrv.c | |||
@@ -335,7 +335,7 @@ static capidrv_plci *new_plci(capidrv_contr * card, int chan) | |||
335 | 335 | ||
336 | plcip = kzalloc(sizeof(capidrv_plci), GFP_ATOMIC); | 336 | plcip = kzalloc(sizeof(capidrv_plci), GFP_ATOMIC); |
337 | 337 | ||
338 | if (plcip == 0) | 338 | if (plcip == NULL) |
339 | return NULL; | 339 | return NULL; |
340 | 340 | ||
341 | plcip->state = ST_PLCI_NONE; | 341 | plcip->state = ST_PLCI_NONE; |
@@ -404,7 +404,7 @@ static inline capidrv_ncci *new_ncci(capidrv_contr * card, | |||
404 | 404 | ||
405 | nccip = kzalloc(sizeof(capidrv_ncci), GFP_ATOMIC); | 405 | nccip = kzalloc(sizeof(capidrv_ncci), GFP_ATOMIC); |
406 | 406 | ||
407 | if (nccip == 0) | 407 | if (nccip == NULL) |
408 | return NULL; | 408 | return NULL; |
409 | 409 | ||
410 | nccip->ncci = ncci; | 410 | nccip->ncci = ncci; |
@@ -426,7 +426,7 @@ static inline capidrv_ncci *find_ncci(capidrv_contr * card, u32 ncci) | |||
426 | capidrv_plci *plcip; | 426 | capidrv_plci *plcip; |
427 | capidrv_ncci *p; | 427 | capidrv_ncci *p; |
428 | 428 | ||
429 | if ((plcip = find_plci_by_ncci(card, ncci)) == 0) | 429 | if ((plcip = find_plci_by_ncci(card, ncci)) == NULL) |
430 | return NULL; | 430 | return NULL; |
431 | 431 | ||
432 | for (p = plcip->ncci_list; p; p = p->next) | 432 | for (p = plcip->ncci_list; p; p = p->next) |
@@ -441,7 +441,7 @@ static inline capidrv_ncci *find_ncci_by_msgid(capidrv_contr * card, | |||
441 | capidrv_plci *plcip; | 441 | capidrv_plci *plcip; |
442 | capidrv_ncci *p; | 442 | capidrv_ncci *p; |
443 | 443 | ||
444 | if ((plcip = find_plci_by_ncci(card, ncci)) == 0) | 444 | if ((plcip = find_plci_by_ncci(card, ncci)) == NULL) |
445 | return NULL; | 445 | return NULL; |
446 | 446 | ||
447 | for (p = plcip->ncci_list; p; p = p->next) | 447 | for (p = plcip->ncci_list; p; p = p->next) |
@@ -755,7 +755,7 @@ static inline int new_bchan(capidrv_contr * card) | |||
755 | { | 755 | { |
756 | int i; | 756 | int i; |
757 | for (i = 0; i < card->nbchan; i++) { | 757 | for (i = 0; i < card->nbchan; i++) { |
758 | if (card->bchans[i].plcip == 0) { | 758 | if (card->bchans[i].plcip == NULL) { |
759 | card->bchans[i].disconnecting = 0; | 759 | card->bchans[i].disconnecting = 0; |
760 | return i; | 760 | return i; |
761 | } | 761 | } |
@@ -877,7 +877,7 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg) | |||
877 | return; | 877 | return; |
878 | } | 878 | } |
879 | bchan = &card->bchans[chan]; | 879 | bchan = &card->bchans[chan]; |
880 | if ((plcip = new_plci(card, chan)) == 0) { | 880 | if ((plcip = new_plci(card, chan)) == NULL) { |
881 | printk(KERN_ERR "capidrv-%d: incoming call: no memory, sorry.\n", card->contrnr); | 881 | printk(KERN_ERR "capidrv-%d: incoming call: no memory, sorry.\n", card->contrnr); |
882 | return; | 882 | return; |
883 | } | 883 | } |
@@ -1388,12 +1388,12 @@ static void capidrv_recv_message(struct capi20_appl *ap, struct sk_buff *skb) | |||
1388 | _cdebbuf *cdb = capi_cmsg2str(&s_cmsg); | 1388 | _cdebbuf *cdb = capi_cmsg2str(&s_cmsg); |
1389 | 1389 | ||
1390 | if (cdb) { | 1390 | if (cdb) { |
1391 | printk(KERN_DEBUG "%s: applid=%d %s\n", __FUNCTION__, | 1391 | printk(KERN_DEBUG "%s: applid=%d %s\n", __func__, |
1392 | ap->applid, cdb->buf); | 1392 | ap->applid, cdb->buf); |
1393 | cdebbuf_free(cdb); | 1393 | cdebbuf_free(cdb); |
1394 | } else | 1394 | } else |
1395 | printk(KERN_DEBUG "%s: applid=%d %s not traced\n", | 1395 | printk(KERN_DEBUG "%s: applid=%d %s not traced\n", |
1396 | __FUNCTION__, ap->applid, | 1396 | __func__, ap->applid, |
1397 | capi_cmd2str(s_cmsg.Command, s_cmsg.Subcommand)); | 1397 | capi_cmd2str(s_cmsg.Command, s_cmsg.Subcommand)); |
1398 | } | 1398 | } |
1399 | if (s_cmsg.Command == CAPI_DATA_B3 | 1399 | if (s_cmsg.Command == CAPI_DATA_B3 |
@@ -1661,7 +1661,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card) | |||
1661 | NULL, /* Useruserdata */ | 1661 | NULL, /* Useruserdata */ |
1662 | NULL /* Facilitydataarray */ | 1662 | NULL /* Facilitydataarray */ |
1663 | ); | 1663 | ); |
1664 | if ((plcip = new_plci(card, (c->arg % card->nbchan))) == 0) { | 1664 | if ((plcip = new_plci(card, (c->arg % card->nbchan))) == NULL) { |
1665 | cmd.command = ISDN_STAT_DHUP; | 1665 | cmd.command = ISDN_STAT_DHUP; |
1666 | cmd.driver = card->myid; | 1666 | cmd.driver = card->myid; |
1667 | cmd.arg = (c->arg % card->nbchan); | 1667 | cmd.arg = (c->arg % card->nbchan); |
@@ -1966,7 +1966,7 @@ static void enable_dchannel_trace(capidrv_contr *card) | |||
1966 | card->name, errcode); | 1966 | card->name, errcode); |
1967 | return; | 1967 | return; |
1968 | } | 1968 | } |
1969 | if (strstr(manufacturer, "AVM") == 0) { | 1969 | if (strstr(manufacturer, "AVM") == NULL) { |
1970 | printk(KERN_ERR "%s: not from AVM, no d-channel trace possible (%s)\n", | 1970 | printk(KERN_ERR "%s: not from AVM, no d-channel trace possible (%s)\n", |
1971 | card->name, manufacturer); | 1971 | card->name, manufacturer); |
1972 | return; | 1972 | return; |
@@ -2291,10 +2291,10 @@ static int __init capidrv_init(void) | |||
2291 | u32 ncontr, contr; | 2291 | u32 ncontr, contr; |
2292 | u16 errcode; | 2292 | u16 errcode; |
2293 | 2293 | ||
2294 | if ((p = strchr(revision, ':')) != 0 && p[1]) { | 2294 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
2295 | strncpy(rev, p + 2, sizeof(rev)); | 2295 | strncpy(rev, p + 2, sizeof(rev)); |
2296 | rev[sizeof(rev)-1] = 0; | 2296 | rev[sizeof(rev)-1] = 0; |
2297 | if ((p = strchr(rev, '$')) != 0 && p > rev) | 2297 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
2298 | *(p-1) = 0; | 2298 | *(p-1) = 0; |
2299 | } else | 2299 | } else |
2300 | strcpy(rev, "1.0"); | 2300 | strcpy(rev, "1.0"); |
@@ -2335,10 +2335,10 @@ static void __exit capidrv_exit(void) | |||
2335 | char rev[32]; | 2335 | char rev[32]; |
2336 | char *p; | 2336 | char *p; |
2337 | 2337 | ||
2338 | if ((p = strchr(revision, ':')) != 0) { | 2338 | if ((p = strchr(revision, ':')) != NULL) { |
2339 | strncpy(rev, p + 1, sizeof(rev)); | 2339 | strncpy(rev, p + 1, sizeof(rev)); |
2340 | rev[sizeof(rev)-1] = 0; | 2340 | rev[sizeof(rev)-1] = 0; |
2341 | if ((p = strchr(rev, '$')) != 0) | 2341 | if ((p = strchr(rev, '$')) != NULL) |
2342 | *p = 0; | 2342 | *p = 0; |
2343 | } else { | 2343 | } else { |
2344 | strcpy(rev, " ??? "); | 2344 | strcpy(rev, " ??? "); |
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c index 6d7c47ec0367..550e80f390a6 100644 --- a/drivers/isdn/capi/capifs.c +++ b/drivers/isdn/capi/capifs.c | |||
@@ -69,6 +69,7 @@ static int capifs_remount(struct super_block *s, int *flags, char *data) | |||
69 | } else if (sscanf(this_char, "mode=%o%c", &n, &dummy) == 1) | 69 | } else if (sscanf(this_char, "mode=%o%c", &n, &dummy) == 1) |
70 | mode = n & ~S_IFMT; | 70 | mode = n & ~S_IFMT; |
71 | else { | 71 | else { |
72 | kfree(new_opt); | ||
72 | printk("capifs: called with bogus options\n"); | 73 | printk("capifs: called with bogus options\n"); |
73 | return -EINVAL; | 74 | return -EINVAL; |
74 | } | 75 | } |
@@ -189,9 +190,9 @@ static int __init capifs_init(void) | |||
189 | char *p; | 190 | char *p; |
190 | int err; | 191 | int err; |
191 | 192 | ||
192 | if ((p = strchr(revision, ':')) != 0 && p[1]) { | 193 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
193 | strlcpy(rev, p + 2, sizeof(rev)); | 194 | strlcpy(rev, p + 2, sizeof(rev)); |
194 | if ((p = strchr(rev, '$')) != 0 && p > rev) | 195 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
195 | *(p-1) = 0; | 196 | *(p-1) = 0; |
196 | } else | 197 | } else |
197 | strcpy(rev, "1.0"); | 198 | strcpy(rev, "1.0"); |
diff --git a/drivers/isdn/capi/capilib.c b/drivers/isdn/capi/capilib.c index 68409d971e73..fcaa1241ee77 100644 --- a/drivers/isdn/capi/capilib.c +++ b/drivers/isdn/capi/capilib.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/isdn/capilli.h> | 4 | #include <linux/isdn/capilli.h> |
5 | 5 | ||
6 | #define DBG(format, arg...) do { \ | 6 | #define DBG(format, arg...) do { \ |
7 | printk(KERN_DEBUG "%s: " format "\n" , __FUNCTION__ , ## arg); \ | 7 | printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \ |
8 | } while (0) | 8 | } while (0) |
9 | 9 | ||
10 | struct capilib_msgidqueue { | 10 | struct capilib_msgidqueue { |
@@ -44,7 +44,7 @@ static inline void mq_init(struct capilib_ncci * np) | |||
44 | static inline int mq_enqueue(struct capilib_ncci * np, u16 msgid) | 44 | static inline int mq_enqueue(struct capilib_ncci * np, u16 msgid) |
45 | { | 45 | { |
46 | struct capilib_msgidqueue *mq; | 46 | struct capilib_msgidqueue *mq; |
47 | if ((mq = np->msgidfree) == 0) | 47 | if ((mq = np->msgidfree) == NULL) |
48 | return 0; | 48 | return 0; |
49 | np->msgidfree = mq->next; | 49 | np->msgidfree = mq->next; |
50 | mq->msgid = msgid; | 50 | mq->msgid = msgid; |
diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c index 22379b94e88f..ebef4ce1b00c 100644 --- a/drivers/isdn/capi/capiutil.c +++ b/drivers/isdn/capi/capiutil.c | |||
@@ -450,7 +450,7 @@ static void pars_2_message(_cmsg * cmsg) | |||
450 | cmsg->l += 4; | 450 | cmsg->l += 4; |
451 | break; | 451 | break; |
452 | case _CSTRUCT: | 452 | case _CSTRUCT: |
453 | if (*(u8 **) OFF == 0) { | 453 | if (*(u8 **) OFF == NULL) { |
454 | *(cmsg->m + cmsg->l) = '\0'; | 454 | *(cmsg->m + cmsg->l) = '\0'; |
455 | cmsg->l++; | 455 | cmsg->l++; |
456 | } else if (**(_cstruct *) OFF != 0xff) { | 456 | } else if (**(_cstruct *) OFF != 0xff) { |
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c index f55531869313..75726ea0fbbd 100644 --- a/drivers/isdn/capi/kcapi.c +++ b/drivers/isdn/capi/kcapi.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define CONFIG_AVMB1_COMPAT | 13 | #define AVMB1_COMPAT |
14 | 14 | ||
15 | #include "kcapi.h" | 15 | #include "kcapi.h" |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
@@ -29,7 +29,7 @@ | |||
29 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
30 | #include <linux/isdn/capicmd.h> | 30 | #include <linux/isdn/capicmd.h> |
31 | #include <linux/isdn/capiutil.h> | 31 | #include <linux/isdn/capiutil.h> |
32 | #ifdef CONFIG_AVMB1_COMPAT | 32 | #ifdef AVMB1_COMPAT |
33 | #include <linux/b1lli.h> | 33 | #include <linux/b1lli.h> |
34 | #endif | 34 | #endif |
35 | #include <linux/mutex.h> | 35 | #include <linux/mutex.h> |
@@ -154,7 +154,7 @@ static void register_appl(struct capi_ctr *card, u16 applid, capi_register_param | |||
154 | if (card) | 154 | if (card) |
155 | card->register_appl(card, applid, rparam); | 155 | card->register_appl(card, applid, rparam); |
156 | else | 156 | else |
157 | printk(KERN_WARNING "%s: cannot get card resources\n", __FUNCTION__); | 157 | printk(KERN_WARNING "%s: cannot get card resources\n", __func__); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
@@ -178,7 +178,7 @@ static void notify_up(u32 contr) | |||
178 | printk(KERN_DEBUG "kcapi: notify up contr %d\n", contr); | 178 | printk(KERN_DEBUG "kcapi: notify up contr %d\n", contr); |
179 | } | 179 | } |
180 | if (!card) { | 180 | if (!card) { |
181 | printk(KERN_WARNING "%s: invalid contr %d\n", __FUNCTION__, contr); | 181 | printk(KERN_WARNING "%s: invalid contr %d\n", __func__, contr); |
182 | return; | 182 | return; |
183 | } | 183 | } |
184 | for (applid = 1; applid <= CAPI_MAXAPPL; applid++) { | 184 | for (applid = 1; applid <= CAPI_MAXAPPL; applid++) { |
@@ -740,7 +740,7 @@ u16 capi20_get_profile(u32 contr, struct capi_profile *profp) | |||
740 | 740 | ||
741 | EXPORT_SYMBOL(capi20_get_profile); | 741 | EXPORT_SYMBOL(capi20_get_profile); |
742 | 742 | ||
743 | #ifdef CONFIG_AVMB1_COMPAT | 743 | #ifdef AVMB1_COMPAT |
744 | static int old_capi_manufacturer(unsigned int cmd, void __user *data) | 744 | static int old_capi_manufacturer(unsigned int cmd, void __user *data) |
745 | { | 745 | { |
746 | avmb1_loadandconfigdef ldef; | 746 | avmb1_loadandconfigdef ldef; |
@@ -826,7 +826,7 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data) | |||
826 | card = capi_ctr_get(card); | 826 | card = capi_ctr_get(card); |
827 | if (!card) | 827 | if (!card) |
828 | return -ESRCH; | 828 | return -ESRCH; |
829 | if (card->load_firmware == 0) { | 829 | if (card->load_firmware == NULL) { |
830 | printk(KERN_DEBUG "kcapi: load: no load function\n"); | 830 | printk(KERN_DEBUG "kcapi: load: no load function\n"); |
831 | return -ESRCH; | 831 | return -ESRCH; |
832 | } | 832 | } |
@@ -835,7 +835,7 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data) | |||
835 | printk(KERN_DEBUG "kcapi: load: invalid parameter: length of t4file is %d ?\n", ldef.t4file.len); | 835 | printk(KERN_DEBUG "kcapi: load: invalid parameter: length of t4file is %d ?\n", ldef.t4file.len); |
836 | return -EINVAL; | 836 | return -EINVAL; |
837 | } | 837 | } |
838 | if (ldef.t4file.data == 0) { | 838 | if (ldef.t4file.data == NULL) { |
839 | printk(KERN_DEBUG "kcapi: load: invalid parameter: dataptr is 0\n"); | 839 | printk(KERN_DEBUG "kcapi: load: invalid parameter: dataptr is 0\n"); |
840 | return -EINVAL; | 840 | return -EINVAL; |
841 | } | 841 | } |
@@ -904,7 +904,7 @@ int capi20_manufacturer(unsigned int cmd, void __user *data) | |||
904 | struct capi_ctr *card; | 904 | struct capi_ctr *card; |
905 | 905 | ||
906 | switch (cmd) { | 906 | switch (cmd) { |
907 | #ifdef CONFIG_AVMB1_COMPAT | 907 | #ifdef AVMB1_COMPAT |
908 | case AVMB1_LOAD: | 908 | case AVMB1_LOAD: |
909 | case AVMB1_LOAD_AND_CONFIG: | 909 | case AVMB1_LOAD_AND_CONFIG: |
910 | case AVMB1_RESETCARD: | 910 | case AVMB1_RESETCARD: |
@@ -951,7 +951,7 @@ int capi20_manufacturer(unsigned int cmd, void __user *data) | |||
951 | if (strcmp(driver->name, cdef.driver) == 0) | 951 | if (strcmp(driver->name, cdef.driver) == 0) |
952 | break; | 952 | break; |
953 | } | 953 | } |
954 | if (driver == 0) { | 954 | if (driver == NULL) { |
955 | printk(KERN_ERR "kcapi: driver \"%s\" not loaded.\n", | 955 | printk(KERN_ERR "kcapi: driver \"%s\" not loaded.\n", |
956 | cdef.driver); | 956 | cdef.driver); |
957 | return -ESRCH; | 957 | return -ESRCH; |
@@ -1004,9 +1004,9 @@ static int __init kcapi_init(void) | |||
1004 | return ret; | 1004 | return ret; |
1005 | kcapi_proc_init(); | 1005 | kcapi_proc_init(); |
1006 | 1006 | ||
1007 | if ((p = strchr(revision, ':')) != 0 && p[1]) { | 1007 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
1008 | strlcpy(rev, p + 2, sizeof(rev)); | 1008 | strlcpy(rev, p + 2, sizeof(rev)); |
1009 | if ((p = strchr(rev, '$')) != 0 && p > rev) | 1009 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
1010 | *(p-1) = 0; | 1010 | *(p-1) = 0; |
1011 | } else | 1011 | } else |
1012 | strcpy(rev, "1.0"); | 1012 | strcpy(rev, "1.0"); |
diff --git a/drivers/isdn/capi/kcapi.h b/drivers/isdn/capi/kcapi.h index 1cb2c40f9921..244711f7f838 100644 --- a/drivers/isdn/capi/kcapi.h +++ b/drivers/isdn/capi/kcapi.h | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | #ifdef KCAPI_DEBUG | 18 | #ifdef KCAPI_DEBUG |
19 | #define DBG(format, arg...) do { \ | 19 | #define DBG(format, arg...) do { \ |
20 | printk(KERN_DEBUG "%s: " format "\n" , __FUNCTION__ , ## arg); \ | 20 | printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \ |
21 | } while (0) | 21 | } while (0) |
22 | #else | 22 | #else |
23 | #define DBG(format, arg...) /* */ | 23 | #define DBG(format, arg...) /* */ |
diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c index 4484a6417235..abf05ec31760 100644 --- a/drivers/isdn/hardware/avm/b1.c +++ b/drivers/isdn/hardware/avm/b1.c | |||
@@ -661,11 +661,11 @@ int b1ctl_read_proc(char *page, char **start, off_t off, | |||
661 | len += sprintf(page+len, "%-16s %s\n", "type", s); | 661 | len += sprintf(page+len, "%-16s %s\n", "type", s); |
662 | if (card->cardtype == avm_t1isa) | 662 | if (card->cardtype == avm_t1isa) |
663 | len += sprintf(page+len, "%-16s %d\n", "cardnr", card->cardnr); | 663 | len += sprintf(page+len, "%-16s %d\n", "cardnr", card->cardnr); |
664 | if ((s = cinfo->version[VER_DRIVER]) != 0) | 664 | if ((s = cinfo->version[VER_DRIVER]) != NULL) |
665 | len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); | 665 | len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); |
666 | if ((s = cinfo->version[VER_CARDTYPE]) != 0) | 666 | if ((s = cinfo->version[VER_CARDTYPE]) != NULL) |
667 | len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); | 667 | len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); |
668 | if ((s = cinfo->version[VER_SERIAL]) != 0) | 668 | if ((s = cinfo->version[VER_SERIAL]) != NULL) |
669 | len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); | 669 | len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); |
670 | 670 | ||
671 | if (card->cardtype != avm_m1) { | 671 | if (card->cardtype != avm_m1) { |
@@ -788,9 +788,9 @@ static int __init b1_init(void) | |||
788 | char *p; | 788 | char *p; |
789 | char rev[32]; | 789 | char rev[32]; |
790 | 790 | ||
791 | if ((p = strchr(revision, ':')) != 0 && p[1]) { | 791 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
792 | strlcpy(rev, p + 2, 32); | 792 | strlcpy(rev, p + 2, 32); |
793 | if ((p = strchr(rev, '$')) != 0 && p > rev) | 793 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
794 | *(p-1) = 0; | 794 | *(p-1) = 0; |
795 | } else | 795 | } else |
796 | strcpy(rev, "1.0"); | 796 | strcpy(rev, "1.0"); |
diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c index 669f6f67449c..da34b98e3de7 100644 --- a/drivers/isdn/hardware/avm/b1dma.c +++ b/drivers/isdn/hardware/avm/b1dma.c | |||
@@ -883,11 +883,11 @@ int b1dmactl_read_proc(char *page, char **start, off_t off, | |||
883 | default: s = "???"; break; | 883 | default: s = "???"; break; |
884 | } | 884 | } |
885 | len += sprintf(page+len, "%-16s %s\n", "type", s); | 885 | len += sprintf(page+len, "%-16s %s\n", "type", s); |
886 | if ((s = cinfo->version[VER_DRIVER]) != 0) | 886 | if ((s = cinfo->version[VER_DRIVER]) != NULL) |
887 | len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); | 887 | len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); |
888 | if ((s = cinfo->version[VER_CARDTYPE]) != 0) | 888 | if ((s = cinfo->version[VER_CARDTYPE]) != NULL) |
889 | len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); | 889 | len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); |
890 | if ((s = cinfo->version[VER_SERIAL]) != 0) | 890 | if ((s = cinfo->version[VER_SERIAL]) != NULL) |
891 | len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); | 891 | len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); |
892 | 892 | ||
893 | if (card->cardtype != avm_m1) { | 893 | if (card->cardtype != avm_m1) { |
@@ -970,9 +970,9 @@ static int __init b1dma_init(void) | |||
970 | char *p; | 970 | char *p; |
971 | char rev[32]; | 971 | char rev[32]; |
972 | 972 | ||
973 | if ((p = strchr(revision, ':')) != 0 && p[1]) { | 973 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
974 | strlcpy(rev, p + 2, sizeof(rev)); | 974 | strlcpy(rev, p + 2, sizeof(rev)); |
975 | if ((p = strchr(rev, '$')) != 0 && p > rev) | 975 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
976 | *(p-1) = 0; | 976 | *(p-1) = 0; |
977 | } else | 977 | } else |
978 | strcpy(rev, "1.0"); | 978 | strcpy(rev, "1.0"); |
diff --git a/drivers/isdn/hardware/avm/b1isa.c b/drivers/isdn/hardware/avm/b1isa.c index 80fb488848b8..1e288eeb5e2a 100644 --- a/drivers/isdn/hardware/avm/b1isa.c +++ b/drivers/isdn/hardware/avm/b1isa.c | |||
@@ -203,9 +203,9 @@ static int __init b1isa_init(void) | |||
203 | char rev[32]; | 203 | char rev[32]; |
204 | int i; | 204 | int i; |
205 | 205 | ||
206 | if ((p = strchr(revision, ':')) != 0 && p[1]) { | 206 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
207 | strlcpy(rev, p + 2, 32); | 207 | strlcpy(rev, p + 2, 32); |
208 | if ((p = strchr(rev, '$')) != 0 && p > rev) | 208 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
209 | *(p-1) = 0; | 209 | *(p-1) = 0; |
210 | } else | 210 | } else |
211 | strcpy(rev, "1.0"); | 211 | strcpy(rev, "1.0"); |
diff --git a/drivers/isdn/hardware/avm/b1pci.c b/drivers/isdn/hardware/avm/b1pci.c index 90e2e6643d19..5b314a2c4049 100644 --- a/drivers/isdn/hardware/avm/b1pci.c +++ b/drivers/isdn/hardware/avm/b1pci.c | |||
@@ -382,9 +382,9 @@ static int __init b1pci_init(void) | |||
382 | char rev[32]; | 382 | char rev[32]; |
383 | int err; | 383 | int err; |
384 | 384 | ||
385 | if ((p = strchr(revision, ':')) != 0 && p[1]) { | 385 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
386 | strlcpy(rev, p + 2, 32); | 386 | strlcpy(rev, p + 2, 32); |
387 | if ((p = strchr(rev, '$')) != 0 && p > rev) | 387 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
388 | *(p-1) = 0; | 388 | *(p-1) = 0; |
389 | } else | 389 | } else |
390 | strcpy(rev, "1.0"); | 390 | strcpy(rev, "1.0"); |
diff --git a/drivers/isdn/hardware/avm/b1pcmcia.c b/drivers/isdn/hardware/avm/b1pcmcia.c index e479c0aef38d..7740403b40e1 100644 --- a/drivers/isdn/hardware/avm/b1pcmcia.c +++ b/drivers/isdn/hardware/avm/b1pcmcia.c | |||
@@ -201,9 +201,9 @@ static int __init b1pcmcia_init(void) | |||
201 | char *p; | 201 | char *p; |
202 | char rev[32]; | 202 | char rev[32]; |
203 | 203 | ||
204 | if ((p = strchr(revision, ':')) != 0 && p[1]) { | 204 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
205 | strlcpy(rev, p + 2, 32); | 205 | strlcpy(rev, p + 2, 32); |
206 | if ((p = strchr(rev, '$')) != 0 && p > rev) | 206 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
207 | *(p-1) = 0; | 207 | *(p-1) = 0; |
208 | } else | 208 | } else |
209 | strcpy(rev, "1.0"); | 209 | strcpy(rev, "1.0"); |
diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c index 4bbbbe688077..9df1d3f66c87 100644 --- a/drivers/isdn/hardware/avm/c4.c +++ b/drivers/isdn/hardware/avm/c4.c | |||
@@ -1088,11 +1088,11 @@ static int c4_read_proc(char *page, char **start, off_t off, | |||
1088 | default: s = "???"; break; | 1088 | default: s = "???"; break; |
1089 | } | 1089 | } |
1090 | len += sprintf(page+len, "%-16s %s\n", "type", s); | 1090 | len += sprintf(page+len, "%-16s %s\n", "type", s); |
1091 | if ((s = cinfo->version[VER_DRIVER]) != 0) | 1091 | if ((s = cinfo->version[VER_DRIVER]) != NULL) |
1092 | len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); | 1092 | len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); |
1093 | if ((s = cinfo->version[VER_CARDTYPE]) != 0) | 1093 | if ((s = cinfo->version[VER_CARDTYPE]) != NULL) |
1094 | len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); | 1094 | len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); |
1095 | if ((s = cinfo->version[VER_SERIAL]) != 0) | 1095 | if ((s = cinfo->version[VER_SERIAL]) != NULL) |
1096 | len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); | 1096 | len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); |
1097 | 1097 | ||
1098 | if (card->cardtype != avm_m1) { | 1098 | if (card->cardtype != avm_m1) { |
@@ -1167,7 +1167,7 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, | |||
1167 | } | 1167 | } |
1168 | 1168 | ||
1169 | card->mbase = ioremap(card->membase, 128); | 1169 | card->mbase = ioremap(card->membase, 128); |
1170 | if (card->mbase == 0) { | 1170 | if (card->mbase == NULL) { |
1171 | printk(KERN_NOTICE "c4: can't remap memory at 0x%lx\n", | 1171 | printk(KERN_NOTICE "c4: can't remap memory at 0x%lx\n", |
1172 | card->membase); | 1172 | card->membase); |
1173 | retval = -EIO; | 1173 | retval = -EIO; |
@@ -1291,9 +1291,9 @@ static int __init c4_init(void) | |||
1291 | char rev[32]; | 1291 | char rev[32]; |
1292 | int err; | 1292 | int err; |
1293 | 1293 | ||
1294 | if ((p = strchr(revision, ':')) != 0 && p[1]) { | 1294 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
1295 | strlcpy(rev, p + 2, 32); | 1295 | strlcpy(rev, p + 2, 32); |
1296 | if ((p = strchr(rev, '$')) != 0 && p > rev) | 1296 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
1297 | *(p-1) = 0; | 1297 | *(p-1) = 0; |
1298 | } else | 1298 | } else |
1299 | strcpy(rev, "1.0"); | 1299 | strcpy(rev, "1.0"); |
diff --git a/drivers/isdn/hardware/avm/t1isa.c b/drivers/isdn/hardware/avm/t1isa.c index 6130724e46e7..e7724493738c 100644 --- a/drivers/isdn/hardware/avm/t1isa.c +++ b/drivers/isdn/hardware/avm/t1isa.c | |||
@@ -551,9 +551,9 @@ static int __init t1isa_init(void) | |||
551 | char *p; | 551 | char *p; |
552 | int i; | 552 | int i; |
553 | 553 | ||
554 | if ((p = strchr(revision, ':')) != 0 && p[1]) { | 554 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
555 | strlcpy(rev, p + 2, 32); | 555 | strlcpy(rev, p + 2, 32); |
556 | if ((p = strchr(rev, '$')) != 0 && p > rev) | 556 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
557 | *(p-1) = 0; | 557 | *(p-1) = 0; |
558 | } else | 558 | } else |
559 | strcpy(rev, "1.0"); | 559 | strcpy(rev, "1.0"); |
diff --git a/drivers/isdn/hardware/avm/t1pci.c b/drivers/isdn/hardware/avm/t1pci.c index d1e253c94db4..e6d298d75146 100644 --- a/drivers/isdn/hardware/avm/t1pci.c +++ b/drivers/isdn/hardware/avm/t1pci.c | |||
@@ -233,9 +233,9 @@ static int __init t1pci_init(void) | |||
233 | char rev[32]; | 233 | char rev[32]; |
234 | int err; | 234 | int err; |
235 | 235 | ||
236 | if ((p = strchr(revision, ':')) != 0 && p[1]) { | 236 | if ((p = strchr(revision, ':')) != NULL && p[1]) { |
237 | strlcpy(rev, p + 2, 32); | 237 | strlcpy(rev, p + 2, 32); |
238 | if ((p = strchr(rev, '$')) != 0 && p > rev) | 238 | if ((p = strchr(rev, '$')) != NULL && p > rev) |
239 | *(p-1) = 0; | 239 | *(p-1) = 0; |
240 | } else | 240 | } else |
241 | strcpy(rev, "1.0"); | 241 | strcpy(rev, "1.0"); |
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c index 6d39f9360766..5fcbdccd7a53 100644 --- a/drivers/isdn/hardware/eicon/divasmain.c +++ b/drivers/isdn/hardware/eicon/divasmain.c | |||
@@ -393,7 +393,7 @@ void diva_free_dma_map(void *hdev, struct _diva_dma_map_entry *pmap) | |||
393 | dma_addr_t dma_handle; | 393 | dma_addr_t dma_handle; |
394 | void *addr_handle; | 394 | void *addr_handle; |
395 | 395 | ||
396 | for (i = 0; (pmap != 0); i++) { | 396 | for (i = 0; (pmap != NULL); i++) { |
397 | diva_get_dma_map_entry(pmap, i, &cpu_addr, &phys_addr); | 397 | diva_get_dma_map_entry(pmap, i, &cpu_addr, &phys_addr); |
398 | if (!cpu_addr) { | 398 | if (!cpu_addr) { |
399 | break; | 399 | break; |
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c index 1ff98e7eb794..599fed88222d 100644 --- a/drivers/isdn/hardware/eicon/message.c +++ b/drivers/isdn/hardware/eicon/message.c | |||
@@ -742,7 +742,7 @@ static void start_internal_command (dword Id, PLCI *plci, t_std_internal_comma | |||
742 | else | 742 | else |
743 | { | 743 | { |
744 | i = 1; | 744 | i = 1; |
745 | while (plci->internal_command_queue[i] != 0) | 745 | while (plci->internal_command_queue[i] != NULL) |
746 | i++; | 746 | i++; |
747 | plci->internal_command_queue[i] = command_function; | 747 | plci->internal_command_queue[i] = command_function; |
748 | } | 748 | } |
@@ -758,7 +758,7 @@ static void next_internal_command (dword Id, PLCI *plci) | |||
758 | 758 | ||
759 | plci->internal_command = 0; | 759 | plci->internal_command = 0; |
760 | plci->internal_command_queue[0] = NULL; | 760 | plci->internal_command_queue[0] = NULL; |
761 | while (plci->internal_command_queue[1] != 0) | 761 | while (plci->internal_command_queue[1] != NULL) |
762 | { | 762 | { |
763 | for (i = 0; i < MAX_INTERNAL_COMMAND_LEVELS - 1; i++) | 763 | for (i = 0; i < MAX_INTERNAL_COMMAND_LEVELS - 1; i++) |
764 | plci->internal_command_queue[i] = plci->internal_command_queue[i+1]; | 764 | plci->internal_command_queue[i] = plci->internal_command_queue[i+1]; |
@@ -9119,7 +9119,7 @@ word AdvCodecSupport(DIVA_CAPI_ADAPTER *a, PLCI *plci, APPL *appl, byte ho | |||
9119 | dbug(1,dprintf("AdvSigPlci=0x%x",a->AdvSignalPLCI)); | 9119 | dbug(1,dprintf("AdvSigPlci=0x%x",a->AdvSignalPLCI)); |
9120 | return 0x2001; /* codec in use by another application */ | 9120 | return 0x2001; /* codec in use by another application */ |
9121 | } | 9121 | } |
9122 | if(plci!=0) | 9122 | if(plci!=NULL) |
9123 | { | 9123 | { |
9124 | a->AdvSignalPLCI = plci; | 9124 | a->AdvSignalPLCI = plci; |
9125 | plci->tel=ADV_VOICE; | 9125 | plci->tel=ADV_VOICE; |
@@ -9144,7 +9144,7 @@ word AdvCodecSupport(DIVA_CAPI_ADAPTER *a, PLCI *plci, APPL *appl, byte ho | |||
9144 | } | 9144 | } |
9145 | /* indicate D-ch connect if */ | 9145 | /* indicate D-ch connect if */ |
9146 | } /* codec is connected OK */ | 9146 | } /* codec is connected OK */ |
9147 | if(plci!=0) | 9147 | if(plci!=NULL) |
9148 | { | 9148 | { |
9149 | a->AdvSignalPLCI = plci; | 9149 | a->AdvSignalPLCI = plci; |
9150 | plci->tel=ADV_VOICE; | 9150 | plci->tel=ADV_VOICE; |
@@ -9170,7 +9170,7 @@ word AdvCodecSupport(DIVA_CAPI_ADAPTER *a, PLCI *plci, APPL *appl, byte ho | |||
9170 | { | 9170 | { |
9171 | if(hook_listen) return 0x300B; /* Facility not supported */ | 9171 | if(hook_listen) return 0x300B; /* Facility not supported */ |
9172 | /* no hook with SCOM */ | 9172 | /* no hook with SCOM */ |
9173 | if(plci!=0) plci->tel = CODEC; | 9173 | if(plci!=NULL) plci->tel = CODEC; |
9174 | dbug(1,dprintf("S/SCOM codec")); | 9174 | dbug(1,dprintf("S/SCOM codec")); |
9175 | /* first time we use the scom-s codec we must shut down the internal */ | 9175 | /* first time we use the scom-s codec we must shut down the internal */ |
9176 | /* handset application of the card. This can be done by an assign with */ | 9176 | /* handset application of the card. This can be done by an assign with */ |
@@ -14604,7 +14604,7 @@ static void channel_xmit_extended_xon (PLCI * plci) { | |||
14604 | int max_ch = ARRAY_SIZE(a->ch_flow_control); | 14604 | int max_ch = ARRAY_SIZE(a->ch_flow_control); |
14605 | int i, one_requested = 0; | 14605 | int i, one_requested = 0; |
14606 | 14606 | ||
14607 | if ((!plci) || (!plci->Id) || ((a = plci->adapter) == 0)) { | 14607 | if ((!plci) || (!plci->Id) || ((a = plci->adapter) == NULL)) { |
14608 | return; | 14608 | return; |
14609 | } | 14609 | } |
14610 | 14610 | ||
diff --git a/drivers/isdn/hisax/asuscom.c b/drivers/isdn/hisax/asuscom.c index b96f3184c2e5..1f879b500d83 100644 --- a/drivers/isdn/hisax/asuscom.c +++ b/drivers/isdn/hisax/asuscom.c | |||
@@ -344,7 +344,7 @@ setup_asuscom(struct IsdnCard *card) | |||
344 | err = pnp_activate_dev(pnp_d); | 344 | err = pnp_activate_dev(pnp_d); |
345 | if (err<0) { | 345 | if (err<0) { |
346 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", | 346 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", |
347 | __FUNCTION__, err); | 347 | __func__, err); |
348 | return(0); | 348 | return(0); |
349 | } | 349 | } |
350 | card->para[1] = pnp_port_start(pnp_d, 0); | 350 | card->para[1] = pnp_port_start(pnp_d, 0); |
diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c index 0f1db1f669b2..7cabc5a19492 100644 --- a/drivers/isdn/hisax/avm_pci.c +++ b/drivers/isdn/hisax/avm_pci.c | |||
@@ -797,7 +797,7 @@ static int __devinit avm_pnp_setup(struct IsdnCardState *cs) | |||
797 | err = pnp_activate_dev(pnp_avm_d); | 797 | err = pnp_activate_dev(pnp_avm_d); |
798 | if (err<0) { | 798 | if (err<0) { |
799 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", | 799 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", |
800 | __FUNCTION__, err); | 800 | __func__, err); |
801 | return(0); | 801 | return(0); |
802 | } | 802 | } |
803 | cs->hw.avm.cfg_reg = | 803 | cs->hw.avm.cfg_reg = |
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c index 2d670856d141..018bd293e580 100644 --- a/drivers/isdn/hisax/diva.c +++ b/drivers/isdn/hisax/diva.c | |||
@@ -1088,7 +1088,7 @@ static int __devinit setup_diva_isapnp(struct IsdnCard *card) | |||
1088 | err = pnp_activate_dev(pnp_d); | 1088 | err = pnp_activate_dev(pnp_d); |
1089 | if (err<0) { | 1089 | if (err<0) { |
1090 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", | 1090 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", |
1091 | __FUNCTION__, err); | 1091 | __func__, err); |
1092 | return(0); | 1092 | return(0); |
1093 | } | 1093 | } |
1094 | card->para[1] = pnp_port_start(pnp_d, 0); | 1094 | card->para[1] = pnp_port_start(pnp_d, 0); |
diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c index 2c3691fda300..aa29d1cf16af 100644 --- a/drivers/isdn/hisax/elsa.c +++ b/drivers/isdn/hisax/elsa.c | |||
@@ -937,7 +937,7 @@ setup_elsa_isapnp(struct IsdnCard *card) | |||
937 | err = pnp_activate_dev(pnp_d); | 937 | err = pnp_activate_dev(pnp_d); |
938 | if (err<0) { | 938 | if (err<0) { |
939 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", | 939 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", |
940 | __FUNCTION__, err); | 940 | __func__, err); |
941 | return(0); | 941 | return(0); |
942 | } | 942 | } |
943 | card->para[1] = pnp_port_start(pnp_d, 0); | 943 | card->para[1] = pnp_port_start(pnp_d, 0); |
diff --git a/drivers/isdn/hisax/hfc_sx.c b/drivers/isdn/hisax/hfc_sx.c index f4a213877e35..d92e8d6c2ae2 100644 --- a/drivers/isdn/hisax/hfc_sx.c +++ b/drivers/isdn/hisax/hfc_sx.c | |||
@@ -1417,7 +1417,7 @@ setup_hfcsx(struct IsdnCard *card) | |||
1417 | err = pnp_activate_dev(pnp_d); | 1417 | err = pnp_activate_dev(pnp_d); |
1418 | if (err<0) { | 1418 | if (err<0) { |
1419 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", | 1419 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", |
1420 | __FUNCTION__, err); | 1420 | __func__, err); |
1421 | return(0); | 1421 | return(0); |
1422 | } | 1422 | } |
1423 | card->para[1] = pnp_port_start(pnp_d, 0); | 1423 | card->para[1] = pnp_port_start(pnp_d, 0); |
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c index 98b0149bca68..8df889b0c1a9 100644 --- a/drivers/isdn/hisax/hfc_usb.c +++ b/drivers/isdn/hisax/hfc_usb.c | |||
@@ -905,7 +905,7 @@ rx_int_complete(struct urb *urb) | |||
905 | if (status) { | 905 | if (status) { |
906 | printk(KERN_INFO | 906 | printk(KERN_INFO |
907 | "HFC-S USB: %s error resubmitting URB fifo(%d)\n", | 907 | "HFC-S USB: %s error resubmitting URB fifo(%d)\n", |
908 | __FUNCTION__, fifon); | 908 | __func__, fifon); |
909 | } | 909 | } |
910 | } | 910 | } |
911 | 911 | ||
@@ -1543,14 +1543,14 @@ hfc_usb_disconnect(struct usb_interface *intf) | |||
1543 | stop_isoc_chain(&context->fifos[i]); | 1543 | stop_isoc_chain(&context->fifos[i]); |
1544 | DBG(HFCUSB_DBG_INIT, | 1544 | DBG(HFCUSB_DBG_INIT, |
1545 | "HFC-S USB: %s stopping ISOC chain Fifo(%i)", | 1545 | "HFC-S USB: %s stopping ISOC chain Fifo(%i)", |
1546 | __FUNCTION__, i); | 1546 | __func__, i); |
1547 | } | 1547 | } |
1548 | } else { | 1548 | } else { |
1549 | if (context->fifos[i].active > 0) { | 1549 | if (context->fifos[i].active > 0) { |
1550 | context->fifos[i].active = 0; | 1550 | context->fifos[i].active = 0; |
1551 | DBG(HFCUSB_DBG_INIT, | 1551 | DBG(HFCUSB_DBG_INIT, |
1552 | "HFC-S USB: %s unlinking URB for Fifo(%i)", | 1552 | "HFC-S USB: %s unlinking URB for Fifo(%i)", |
1553 | __FUNCTION__, i); | 1553 | __func__, i); |
1554 | } | 1554 | } |
1555 | usb_kill_urb(context->fifos[i].urb); | 1555 | usb_kill_urb(context->fifos[i].urb); |
1556 | usb_free_urb(context->fifos[i].urb); | 1556 | usb_free_urb(context->fifos[i].urb); |
diff --git a/drivers/isdn/hisax/hfcscard.c b/drivers/isdn/hisax/hfcscard.c index 909d6709ec16..cf082665cc8b 100644 --- a/drivers/isdn/hisax/hfcscard.c +++ b/drivers/isdn/hisax/hfcscard.c | |||
@@ -193,7 +193,7 @@ setup_hfcs(struct IsdnCard *card) | |||
193 | err = pnp_activate_dev(pnp_d); | 193 | err = pnp_activate_dev(pnp_d); |
194 | if (err<0) { | 194 | if (err<0) { |
195 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", | 195 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", |
196 | __FUNCTION__, err); | 196 | __func__, err); |
197 | return(0); | 197 | return(0); |
198 | } | 198 | } |
199 | card->para[1] = pnp_port_start(pnp_d, 0); | 199 | card->para[1] = pnp_port_start(pnp_d, 0); |
diff --git a/drivers/isdn/hisax/hisax_debug.h b/drivers/isdn/hisax/hisax_debug.h index ceafecdb1037..5ed3b1c44184 100644 --- a/drivers/isdn/hisax/hisax_debug.h +++ b/drivers/isdn/hisax/hisax_debug.h | |||
@@ -27,14 +27,14 @@ | |||
27 | 27 | ||
28 | #define DBG(level, format, arg...) do { \ | 28 | #define DBG(level, format, arg...) do { \ |
29 | if (level & __debug_variable) \ | 29 | if (level & __debug_variable) \ |
30 | printk(KERN_DEBUG "%s: " format "\n" , __FUNCTION__ , ## arg); \ | 30 | printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \ |
31 | } while (0) | 31 | } while (0) |
32 | 32 | ||
33 | #define DBG_PACKET(level,data,count) \ | 33 | #define DBG_PACKET(level,data,count) \ |
34 | if (level & __debug_variable) dump_packet(__FUNCTION__,data,count) | 34 | if (level & __debug_variable) dump_packet(__func__,data,count) |
35 | 35 | ||
36 | #define DBG_SKB(level,skb) \ | 36 | #define DBG_SKB(level,skb) \ |
37 | if ((level & __debug_variable) && skb) dump_packet(__FUNCTION__,skb->data,skb->len) | 37 | if ((level & __debug_variable) && skb) dump_packet(__func__,skb->data,skb->len) |
38 | 38 | ||
39 | 39 | ||
40 | static void __attribute__((unused)) | 40 | static void __attribute__((unused)) |
diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c index 76043dedba5b..c0b4db2f8364 100644 --- a/drivers/isdn/hisax/hisax_fcpcipnp.c +++ b/drivers/isdn/hisax/hisax_fcpcipnp.c | |||
@@ -68,7 +68,7 @@ static struct pci_device_id fcpci_ids[] = { | |||
68 | 68 | ||
69 | MODULE_DEVICE_TABLE(pci, fcpci_ids); | 69 | MODULE_DEVICE_TABLE(pci, fcpci_ids); |
70 | 70 | ||
71 | #ifdef __ISAPNP__ | 71 | #ifdef CONFIG_PNP |
72 | static struct pnp_device_id fcpnp_ids[] __devinitdata = { | 72 | static struct pnp_device_id fcpnp_ids[] __devinitdata = { |
73 | { | 73 | { |
74 | .id = "AVM0900", | 74 | .id = "AVM0900", |
@@ -914,7 +914,7 @@ static int __devinit fcpci_probe(struct pci_dev *pdev, | |||
914 | return retval; | 914 | return retval; |
915 | } | 915 | } |
916 | 916 | ||
917 | #ifdef __ISAPNP__ | 917 | #ifdef CONFIG_PNP |
918 | static int __devinit fcpnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) | 918 | static int __devinit fcpnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) |
919 | { | 919 | { |
920 | struct fritz_adapter *adapter; | 920 | struct fritz_adapter *adapter; |
@@ -935,7 +935,7 @@ static int __devinit fcpnp_probe(struct pnp_dev *pdev, const struct pnp_device_i | |||
935 | pnp_disable_dev(pdev); | 935 | pnp_disable_dev(pdev); |
936 | retval = pnp_activate_dev(pdev); | 936 | retval = pnp_activate_dev(pdev); |
937 | if (retval < 0) { | 937 | if (retval < 0) { |
938 | printk(KERN_WARNING "%s: pnp_activate_dev(%s) ret(%d)\n", __FUNCTION__, | 938 | printk(KERN_WARNING "%s: pnp_activate_dev(%s) ret(%d)\n", __func__, |
939 | (char *)dev_id->driver_data, retval); | 939 | (char *)dev_id->driver_data, retval); |
940 | goto err_free; | 940 | goto err_free; |
941 | } | 941 | } |
@@ -974,6 +974,8 @@ static struct pnp_driver fcpnp_driver = { | |||
974 | .remove = __devexit_p(fcpnp_remove), | 974 | .remove = __devexit_p(fcpnp_remove), |
975 | .id_table = fcpnp_ids, | 975 | .id_table = fcpnp_ids, |
976 | }; | 976 | }; |
977 | #else | ||
978 | static struct pnp_driver fcpnp_driver; | ||
977 | #endif | 979 | #endif |
978 | 980 | ||
979 | static void __devexit fcpci_remove(struct pci_dev *pdev) | 981 | static void __devexit fcpci_remove(struct pci_dev *pdev) |
@@ -1001,7 +1003,7 @@ static int __init hisax_fcpcipnp_init(void) | |||
1001 | retval = pci_register_driver(&fcpci_driver); | 1003 | retval = pci_register_driver(&fcpci_driver); |
1002 | if (retval) | 1004 | if (retval) |
1003 | return retval; | 1005 | return retval; |
1004 | #ifdef __ISAPNP__ | 1006 | #ifdef CONFIG_PNP |
1005 | retval = pnp_register_driver(&fcpnp_driver); | 1007 | retval = pnp_register_driver(&fcpnp_driver); |
1006 | if (retval < 0) { | 1008 | if (retval < 0) { |
1007 | pci_unregister_driver(&fcpci_driver); | 1009 | pci_unregister_driver(&fcpci_driver); |
@@ -1013,7 +1015,7 @@ static int __init hisax_fcpcipnp_init(void) | |||
1013 | 1015 | ||
1014 | static void __exit hisax_fcpcipnp_exit(void) | 1016 | static void __exit hisax_fcpcipnp_exit(void) |
1015 | { | 1017 | { |
1016 | #ifdef __ISAPNP__ | 1018 | #ifdef CONFIG_PNP |
1017 | pnp_unregister_driver(&fcpnp_driver); | 1019 | pnp_unregister_driver(&fcpnp_driver); |
1018 | #endif | 1020 | #endif |
1019 | pci_unregister_driver(&fcpci_driver); | 1021 | pci_unregister_driver(&fcpci_driver); |
diff --git a/drivers/isdn/hisax/ix1_micro.c b/drivers/isdn/hisax/ix1_micro.c index 2d18d4f1e57e..a92bf0d2cab2 100644 --- a/drivers/isdn/hisax/ix1_micro.c +++ b/drivers/isdn/hisax/ix1_micro.c | |||
@@ -252,7 +252,7 @@ setup_ix1micro(struct IsdnCard *card) | |||
252 | err = pnp_activate_dev(pnp_d); | 252 | err = pnp_activate_dev(pnp_d); |
253 | if (err<0) { | 253 | if (err<0) { |
254 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", | 254 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", |
255 | __FUNCTION__, err); | 255 | __func__, err); |
256 | return(0); | 256 | return(0); |
257 | } | 257 | } |
258 | card->para[1] = pnp_port_start(pnp_d, 0); | 258 | card->para[1] = pnp_port_start(pnp_d, 0); |
diff --git a/drivers/isdn/hisax/niccy.c b/drivers/isdn/hisax/niccy.c index 421b8e6763d7..ef00633e1d2a 100644 --- a/drivers/isdn/hisax/niccy.c +++ b/drivers/isdn/hisax/niccy.c | |||
@@ -255,7 +255,7 @@ int __devinit setup_niccy(struct IsdnCard *card) | |||
255 | err = pnp_activate_dev(pnp_d); | 255 | err = pnp_activate_dev(pnp_d); |
256 | if (err < 0) { | 256 | if (err < 0) { |
257 | printk(KERN_WARNING "%s: pnp_activate_dev " | 257 | printk(KERN_WARNING "%s: pnp_activate_dev " |
258 | "ret(%d)\n", __FUNCTION__, err); | 258 | "ret(%d)\n", __func__, err); |
259 | return 0; | 259 | return 0; |
260 | } | 260 | } |
261 | card->para[1] = pnp_port_start(pnp_d, 0); | 261 | card->para[1] = pnp_port_start(pnp_d, 0); |
diff --git a/drivers/isdn/hisax/sedlbauer.c b/drivers/isdn/hisax/sedlbauer.c index 95425f3d2220..a10dfa82c734 100644 --- a/drivers/isdn/hisax/sedlbauer.c +++ b/drivers/isdn/hisax/sedlbauer.c | |||
@@ -555,7 +555,7 @@ setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt) | |||
555 | err = pnp_activate_dev(pnp_d); | 555 | err = pnp_activate_dev(pnp_d); |
556 | if (err<0) { | 556 | if (err<0) { |
557 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", | 557 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", |
558 | __FUNCTION__, err); | 558 | __func__, err); |
559 | return(0); | 559 | return(0); |
560 | } | 560 | } |
561 | card->para[1] = pnp_port_start(pnp_d, 0); | 561 | card->para[1] = pnp_port_start(pnp_d, 0); |
diff --git a/drivers/isdn/hisax/st5481.h b/drivers/isdn/hisax/st5481.h index 04416bad611d..2044e7173ab4 100644 --- a/drivers/isdn/hisax/st5481.h +++ b/drivers/isdn/hisax/st5481.h | |||
@@ -218,13 +218,13 @@ enum { | |||
218 | #define L1_EVENT_COUNT (EV_TIMER3 + 1) | 218 | #define L1_EVENT_COUNT (EV_TIMER3 + 1) |
219 | 219 | ||
220 | #define ERR(format, arg...) \ | 220 | #define ERR(format, arg...) \ |
221 | printk(KERN_ERR "%s:%s: " format "\n" , __FILE__, __FUNCTION__ , ## arg) | 221 | printk(KERN_ERR "%s:%s: " format "\n" , __FILE__, __func__ , ## arg) |
222 | 222 | ||
223 | #define WARN(format, arg...) \ | 223 | #define WARN(format, arg...) \ |
224 | printk(KERN_WARNING "%s:%s: " format "\n" , __FILE__, __FUNCTION__ , ## arg) | 224 | printk(KERN_WARNING "%s:%s: " format "\n" , __FILE__, __func__ , ## arg) |
225 | 225 | ||
226 | #define INFO(format, arg...) \ | 226 | #define INFO(format, arg...) \ |
227 | printk(KERN_INFO "%s:%s: " format "\n" , __FILE__, __FUNCTION__ , ## arg) | 227 | printk(KERN_INFO "%s:%s: " format "\n" , __FILE__, __func__ , ## arg) |
228 | 228 | ||
229 | #include "isdnhdlc.h" | 229 | #include "isdnhdlc.h" |
230 | #include "fsm.h" | 230 | #include "fsm.h" |
@@ -406,7 +406,7 @@ struct st5481_adapter { | |||
406 | 406 | ||
407 | /* | 407 | /* |
408 | * Submit an URB with error reporting. This is a macro so | 408 | * Submit an URB with error reporting. This is a macro so |
409 | * the __FUNCTION__ returns the caller function name. | 409 | * the __func__ returns the caller function name. |
410 | */ | 410 | */ |
411 | #define SUBMIT_URB(urb, mem_flags) \ | 411 | #define SUBMIT_URB(urb, mem_flags) \ |
412 | ({ \ | 412 | ({ \ |
@@ -470,7 +470,7 @@ extern int st5481_debug; | |||
470 | #ifdef CONFIG_HISAX_DEBUG | 470 | #ifdef CONFIG_HISAX_DEBUG |
471 | 471 | ||
472 | #define DBG_ISO_PACKET(level,urb) \ | 472 | #define DBG_ISO_PACKET(level,urb) \ |
473 | if (level & __debug_variable) dump_iso_packet(__FUNCTION__,urb) | 473 | if (level & __debug_variable) dump_iso_packet(__func__,urb) |
474 | 474 | ||
475 | static void __attribute__((unused)) | 475 | static void __attribute__((unused)) |
476 | dump_iso_packet(const char *name, struct urb *urb) | 476 | dump_iso_packet(const char *name, struct urb *urb) |
diff --git a/drivers/isdn/hisax/st5481_usb.c b/drivers/isdn/hisax/st5481_usb.c index 4ada66b8b679..427a8b0520f5 100644 --- a/drivers/isdn/hisax/st5481_usb.c +++ b/drivers/isdn/hisax/st5481_usb.c | |||
@@ -342,7 +342,7 @@ void st5481_release_usb(struct st5481_adapter *adapter) | |||
342 | usb_kill_urb(intr->urb); | 342 | usb_kill_urb(intr->urb); |
343 | kfree(intr->urb->transfer_buffer); | 343 | kfree(intr->urb->transfer_buffer); |
344 | usb_free_urb(intr->urb); | 344 | usb_free_urb(intr->urb); |
345 | ctrl->urb = NULL; | 345 | intr->urb = NULL; |
346 | } | 346 | } |
347 | 347 | ||
348 | /* | 348 | /* |
diff --git a/drivers/isdn/hisax/teles3.c b/drivers/isdn/hisax/teles3.c index 6a5e379e0774..5dc9f1a43629 100644 --- a/drivers/isdn/hisax/teles3.c +++ b/drivers/isdn/hisax/teles3.c | |||
@@ -301,7 +301,7 @@ setup_teles3(struct IsdnCard *card) | |||
301 | err = pnp_activate_dev(pnp_d); | 301 | err = pnp_activate_dev(pnp_d); |
302 | if (err<0) { | 302 | if (err<0) { |
303 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", | 303 | printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n", |
304 | __FUNCTION__, err); | 304 | __func__, err); |
305 | return(0); | 305 | return(0); |
306 | } | 306 | } |
307 | card->para[3] = pnp_port_start(pnp_d, 2); | 307 | card->para[3] = pnp_port_start(pnp_d, 2); |
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index d4ad6992f776..0f3c66de69bc 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c | |||
@@ -1924,7 +1924,7 @@ isdn_free_channel(int di, int ch, int usage) | |||
1924 | 1924 | ||
1925 | if ((di < 0) || (ch < 0)) { | 1925 | if ((di < 0) || (ch < 0)) { |
1926 | printk(KERN_WARNING "%s: called with invalid drv(%d) or channel(%d)\n", | 1926 | printk(KERN_WARNING "%s: called with invalid drv(%d) or channel(%d)\n", |
1927 | __FUNCTION__, di, ch); | 1927 | __func__, di, ch); |
1928 | return; | 1928 | return; |
1929 | } | 1929 | } |
1930 | for (i = 0; i < ISDN_MAX_CHANNELS; i++) | 1930 | for (i = 0; i < ISDN_MAX_CHANNELS; i++) |
diff --git a/drivers/isdn/i4l/isdn_net.h b/drivers/isdn/i4l/isdn_net.h index bc2f0dd962ea..be4949715d55 100644 --- a/drivers/isdn/i4l/isdn_net.h +++ b/drivers/isdn/i4l/isdn_net.h | |||
@@ -108,7 +108,7 @@ static __inline__ void isdn_net_add_to_bundle(isdn_net_dev *nd, isdn_net_local * | |||
108 | 108 | ||
109 | lp = nd->queue; | 109 | lp = nd->queue; |
110 | // printk(KERN_DEBUG "%s: lp:%s(%p) nlp:%s(%p) last(%p)\n", | 110 | // printk(KERN_DEBUG "%s: lp:%s(%p) nlp:%s(%p) last(%p)\n", |
111 | // __FUNCTION__, lp->name, lp, nlp->name, nlp, lp->last); | 111 | // __func__, lp->name, lp, nlp->name, nlp, lp->last); |
112 | nlp->last = lp->last; | 112 | nlp->last = lp->last; |
113 | lp->last->next = nlp; | 113 | lp->last->next = nlp; |
114 | lp->last = nlp; | 114 | lp->last = nlp; |
@@ -129,7 +129,7 @@ static __inline__ void isdn_net_rm_from_bundle(isdn_net_local *lp) | |||
129 | master_lp = (isdn_net_local *) lp->master->priv; | 129 | master_lp = (isdn_net_local *) lp->master->priv; |
130 | 130 | ||
131 | // printk(KERN_DEBUG "%s: lp:%s(%p) mlp:%s(%p) last(%p) next(%p) mndq(%p)\n", | 131 | // printk(KERN_DEBUG "%s: lp:%s(%p) mlp:%s(%p) last(%p) next(%p) mndq(%p)\n", |
132 | // __FUNCTION__, lp->name, lp, master_lp->name, master_lp, lp->last, lp->next, master_lp->netdev->queue); | 132 | // __func__, lp->name, lp, master_lp->name, master_lp, lp->last, lp->next, master_lp->netdev->queue); |
133 | spin_lock_irqsave(&master_lp->netdev->queue_lock, flags); | 133 | spin_lock_irqsave(&master_lp->netdev->queue_lock, flags); |
134 | lp->last->next = lp->next; | 134 | lp->last->next = lp->next; |
135 | lp->next->last = lp->last; | 135 | lp->next->last = lp->last; |
@@ -141,7 +141,7 @@ static __inline__ void isdn_net_rm_from_bundle(isdn_net_local *lp) | |||
141 | } | 141 | } |
142 | lp->next = lp->last = lp; /* (re)set own pointers */ | 142 | lp->next = lp->last = lp; /* (re)set own pointers */ |
143 | // printk(KERN_DEBUG "%s: mndq(%p)\n", | 143 | // printk(KERN_DEBUG "%s: mndq(%p)\n", |
144 | // __FUNCTION__, master_lp->netdev->queue); | 144 | // __func__, master_lp->netdev->queue); |
145 | spin_unlock_irqrestore(&master_lp->netdev->queue_lock, flags); | 145 | spin_unlock_irqrestore(&master_lp->netdev->queue_lock, flags); |
146 | } | 146 | } |
147 | 147 | ||
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 9f5fe372f83d..127cfdad68e7 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c | |||
@@ -110,7 +110,7 @@ isdn_ppp_free(isdn_net_local * lp) | |||
110 | 110 | ||
111 | if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { | 111 | if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { |
112 | printk(KERN_ERR "%s: ppp_slot(%d) out of range\n", | 112 | printk(KERN_ERR "%s: ppp_slot(%d) out of range\n", |
113 | __FUNCTION__, lp->ppp_slot); | 113 | __func__, lp->ppp_slot); |
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
116 | 116 | ||
@@ -127,7 +127,7 @@ isdn_ppp_free(isdn_net_local * lp) | |||
127 | #endif /* CONFIG_ISDN_MPP */ | 127 | #endif /* CONFIG_ISDN_MPP */ |
128 | if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { | 128 | if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { |
129 | printk(KERN_ERR "%s: ppp_slot(%d) now invalid\n", | 129 | printk(KERN_ERR "%s: ppp_slot(%d) now invalid\n", |
130 | __FUNCTION__, lp->ppp_slot); | 130 | __func__, lp->ppp_slot); |
131 | return 0; | 131 | return 0; |
132 | } | 132 | } |
133 | is = ippp_table[lp->ppp_slot]; | 133 | is = ippp_table[lp->ppp_slot]; |
@@ -226,7 +226,7 @@ isdn_ppp_wakeup_daemon(isdn_net_local * lp) | |||
226 | { | 226 | { |
227 | if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { | 227 | if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { |
228 | printk(KERN_ERR "%s: ppp_slot(%d) out of range\n", | 228 | printk(KERN_ERR "%s: ppp_slot(%d) out of range\n", |
229 | __FUNCTION__, lp->ppp_slot); | 229 | __func__, lp->ppp_slot); |
230 | return; | 230 | return; |
231 | } | 231 | } |
232 | ippp_table[lp->ppp_slot]->state = IPPP_OPEN | IPPP_CONNECT | IPPP_NOBLOCK; | 232 | ippp_table[lp->ppp_slot]->state = IPPP_OPEN | IPPP_CONNECT | IPPP_NOBLOCK; |
@@ -245,7 +245,7 @@ isdn_ppp_closewait(int slot) | |||
245 | 245 | ||
246 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { | 246 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { |
247 | printk(KERN_ERR "%s: slot(%d) out of range\n", | 247 | printk(KERN_ERR "%s: slot(%d) out of range\n", |
248 | __FUNCTION__, slot); | 248 | __func__, slot); |
249 | return 0; | 249 | return 0; |
250 | } | 250 | } |
251 | is = ippp_table[slot]; | 251 | is = ippp_table[slot]; |
@@ -343,7 +343,7 @@ isdn_ppp_release(int min, struct file *file) | |||
343 | is = file->private_data; | 343 | is = file->private_data; |
344 | 344 | ||
345 | if (!is) { | 345 | if (!is) { |
346 | printk(KERN_ERR "%s: no file->private_data\n", __FUNCTION__); | 346 | printk(KERN_ERR "%s: no file->private_data\n", __func__); |
347 | return; | 347 | return; |
348 | } | 348 | } |
349 | if (is->debug & 0x1) | 349 | if (is->debug & 0x1) |
@@ -353,7 +353,7 @@ isdn_ppp_release(int min, struct file *file) | |||
353 | isdn_net_dev *p = is->lp->netdev; | 353 | isdn_net_dev *p = is->lp->netdev; |
354 | 354 | ||
355 | if (!p) { | 355 | if (!p) { |
356 | printk(KERN_ERR "%s: no lp->netdev\n", __FUNCTION__); | 356 | printk(KERN_ERR "%s: no lp->netdev\n", __func__); |
357 | return; | 357 | return; |
358 | } | 358 | } |
359 | is->state &= ~IPPP_CONNECT; /* -> effect: no call of wakeup */ | 359 | is->state &= ~IPPP_CONNECT; /* -> effect: no call of wakeup */ |
@@ -1080,7 +1080,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff | |||
1080 | printk(KERN_DEBUG "isdn_ppp: VJC_UNCOMP\n"); | 1080 | printk(KERN_DEBUG "isdn_ppp: VJC_UNCOMP\n"); |
1081 | if (net_dev->local->ppp_slot < 0) { | 1081 | if (net_dev->local->ppp_slot < 0) { |
1082 | printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n", | 1082 | printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n", |
1083 | __FUNCTION__, net_dev->local->ppp_slot); | 1083 | __func__, net_dev->local->ppp_slot); |
1084 | goto drop_packet; | 1084 | goto drop_packet; |
1085 | } | 1085 | } |
1086 | if (slhc_remember(ippp_table[net_dev->local->ppp_slot]->slcomp, skb->data, skb->len) <= 0) { | 1086 | if (slhc_remember(ippp_table[net_dev->local->ppp_slot]->slcomp, skb->data, skb->len) <= 0) { |
@@ -1107,7 +1107,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff | |||
1107 | skb_old->len); | 1107 | skb_old->len); |
1108 | if (net_dev->local->ppp_slot < 0) { | 1108 | if (net_dev->local->ppp_slot < 0) { |
1109 | printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n", | 1109 | printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n", |
1110 | __FUNCTION__, net_dev->local->ppp_slot); | 1110 | __func__, net_dev->local->ppp_slot); |
1111 | goto drop_packet; | 1111 | goto drop_packet; |
1112 | } | 1112 | } |
1113 | pkt_len = slhc_uncompress(ippp_table[net_dev->local->ppp_slot]->slcomp, | 1113 | pkt_len = slhc_uncompress(ippp_table[net_dev->local->ppp_slot]->slcomp, |
@@ -1553,7 +1553,7 @@ static int isdn_ppp_mp_init( isdn_net_local * lp, ippp_bundle * add_to ) | |||
1553 | 1553 | ||
1554 | if (lp->ppp_slot < 0) { | 1554 | if (lp->ppp_slot < 0) { |
1555 | printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", | 1555 | printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", |
1556 | __FUNCTION__, lp->ppp_slot); | 1556 | __func__, lp->ppp_slot); |
1557 | return(-EINVAL); | 1557 | return(-EINVAL); |
1558 | } | 1558 | } |
1559 | 1559 | ||
@@ -1604,7 +1604,7 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, | |||
1604 | slot = lp->ppp_slot; | 1604 | slot = lp->ppp_slot; |
1605 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { | 1605 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { |
1606 | printk(KERN_ERR "%s: lp->ppp_slot(%d)\n", | 1606 | printk(KERN_ERR "%s: lp->ppp_slot(%d)\n", |
1607 | __FUNCTION__, lp->ppp_slot); | 1607 | __func__, lp->ppp_slot); |
1608 | stats->frame_drops++; | 1608 | stats->frame_drops++; |
1609 | dev_kfree_skb(skb); | 1609 | dev_kfree_skb(skb); |
1610 | spin_unlock_irqrestore(&mp->lock, flags); | 1610 | spin_unlock_irqrestore(&mp->lock, flags); |
@@ -1641,7 +1641,7 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, | |||
1641 | slot = lpq->ppp_slot; | 1641 | slot = lpq->ppp_slot; |
1642 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { | 1642 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { |
1643 | printk(KERN_ERR "%s: lpq->ppp_slot(%d)\n", | 1643 | printk(KERN_ERR "%s: lpq->ppp_slot(%d)\n", |
1644 | __FUNCTION__, lpq->ppp_slot); | 1644 | __func__, lpq->ppp_slot); |
1645 | } else { | 1645 | } else { |
1646 | u32 lls = ippp_table[slot]->last_link_seqno; | 1646 | u32 lls = ippp_table[slot]->last_link_seqno; |
1647 | if (MP_LT(lls, minseq)) | 1647 | if (MP_LT(lls, minseq)) |
@@ -1875,7 +1875,7 @@ void isdn_ppp_mp_reassembly( isdn_net_dev * net_dev, isdn_net_local * lp, | |||
1875 | 1875 | ||
1876 | if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { | 1876 | if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { |
1877 | printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", | 1877 | printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", |
1878 | __FUNCTION__, lp->ppp_slot); | 1878 | __func__, lp->ppp_slot); |
1879 | return; | 1879 | return; |
1880 | } | 1880 | } |
1881 | if( MP_FLAGS(from) == (MP_BEGIN_FRAG | MP_END_FRAG) ) { | 1881 | if( MP_FLAGS(from) == (MP_BEGIN_FRAG | MP_END_FRAG) ) { |
@@ -2655,7 +2655,7 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, | |||
2655 | lp->ppp_slot); | 2655 | lp->ppp_slot); |
2656 | if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { | 2656 | if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { |
2657 | printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", | 2657 | printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", |
2658 | __FUNCTION__, lp->ppp_slot); | 2658 | __func__, lp->ppp_slot); |
2659 | return; | 2659 | return; |
2660 | } | 2660 | } |
2661 | is = ippp_table[lp->ppp_slot]; | 2661 | is = ippp_table[lp->ppp_slot]; |
@@ -2665,7 +2665,7 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, | |||
2665 | int slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; | 2665 | int slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; |
2666 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { | 2666 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { |
2667 | printk(KERN_ERR "%s: slot(%d) out of range\n", | 2667 | printk(KERN_ERR "%s: slot(%d) out of range\n", |
2668 | __FUNCTION__, slot); | 2668 | __func__, slot); |
2669 | return; | 2669 | return; |
2670 | } | 2670 | } |
2671 | mis = ippp_table[slot]; | 2671 | mis = ippp_table[slot]; |
@@ -2829,7 +2829,7 @@ static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, struct | |||
2829 | return; | 2829 | return; |
2830 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { | 2830 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { |
2831 | printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", | 2831 | printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", |
2832 | __FUNCTION__, slot); | 2832 | __func__, slot); |
2833 | return; | 2833 | return; |
2834 | } | 2834 | } |
2835 | is = ippp_table[slot]; | 2835 | is = ippp_table[slot]; |
@@ -2852,7 +2852,7 @@ static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, struct | |||
2852 | slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; | 2852 | slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; |
2853 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { | 2853 | if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { |
2854 | printk(KERN_ERR "%s: slot(%d) out of range\n", | 2854 | printk(KERN_ERR "%s: slot(%d) out of range\n", |
2855 | __FUNCTION__, slot); | 2855 | __func__, slot); |
2856 | return; | 2856 | return; |
2857 | } | 2857 | } |
2858 | mis = ippp_table[slot]; | 2858 | mis = ippp_table[slot]; |
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index 133eb18e65cc..8af0df1d5b8c 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -1347,7 +1347,7 @@ isdn_tty_tiocmget(struct tty_struct *tty, struct file *file) | |||
1347 | modem_info *info = (modem_info *) tty->driver_data; | 1347 | modem_info *info = (modem_info *) tty->driver_data; |
1348 | u_char control, status; | 1348 | u_char control, status; |
1349 | 1349 | ||
1350 | if (isdn_tty_paranoia_check(info, tty->name, __FUNCTION__)) | 1350 | if (isdn_tty_paranoia_check(info, tty->name, __func__)) |
1351 | return -ENODEV; | 1351 | return -ENODEV; |
1352 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1352 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1353 | return -EIO; | 1353 | return -EIO; |
@@ -1372,7 +1372,7 @@ isdn_tty_tiocmset(struct tty_struct *tty, struct file *file, | |||
1372 | { | 1372 | { |
1373 | modem_info *info = (modem_info *) tty->driver_data; | 1373 | modem_info *info = (modem_info *) tty->driver_data; |
1374 | 1374 | ||
1375 | if (isdn_tty_paranoia_check(info, tty->name, __FUNCTION__)) | 1375 | if (isdn_tty_paranoia_check(info, tty->name, __func__)) |
1376 | return -ENODEV; | 1376 | return -ENODEV; |
1377 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1377 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1378 | return -EIO; | 1378 | return -EIO; |
@@ -1608,7 +1608,7 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp) | |||
1608 | if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_open")) | 1608 | if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_open")) |
1609 | return -ENODEV; | 1609 | return -ENODEV; |
1610 | if (!try_module_get(info->owner)) { | 1610 | if (!try_module_get(info->owner)) { |
1611 | printk(KERN_WARNING "%s: cannot reserve module\n", __FUNCTION__); | 1611 | printk(KERN_WARNING "%s: cannot reserve module\n", __func__); |
1612 | return -ENODEV; | 1612 | return -ENODEV; |
1613 | } | 1613 | } |
1614 | #ifdef ISDN_DEBUG_MODEM_OPEN | 1614 | #ifdef ISDN_DEBUG_MODEM_OPEN |
diff --git a/drivers/md/dm-uevent.c b/drivers/md/dm-uevent.c index 50377e5dc2a3..6f65883aef12 100644 --- a/drivers/md/dm-uevent.c +++ b/drivers/md/dm-uevent.c | |||
@@ -78,7 +78,7 @@ static struct dm_uevent *dm_build_path_uevent(struct mapped_device *md, | |||
78 | 78 | ||
79 | event = dm_uevent_alloc(md); | 79 | event = dm_uevent_alloc(md); |
80 | if (!event) { | 80 | if (!event) { |
81 | DMERR("%s: dm_uevent_alloc() failed", __FUNCTION__); | 81 | DMERR("%s: dm_uevent_alloc() failed", __func__); |
82 | goto err_nomem; | 82 | goto err_nomem; |
83 | } | 83 | } |
84 | 84 | ||
@@ -86,32 +86,32 @@ static struct dm_uevent *dm_build_path_uevent(struct mapped_device *md, | |||
86 | 86 | ||
87 | if (add_uevent_var(&event->ku_env, "DM_TARGET=%s", ti->type->name)) { | 87 | if (add_uevent_var(&event->ku_env, "DM_TARGET=%s", ti->type->name)) { |
88 | DMERR("%s: add_uevent_var() for DM_TARGET failed", | 88 | DMERR("%s: add_uevent_var() for DM_TARGET failed", |
89 | __FUNCTION__); | 89 | __func__); |
90 | goto err_add; | 90 | goto err_add; |
91 | } | 91 | } |
92 | 92 | ||
93 | if (add_uevent_var(&event->ku_env, "DM_ACTION=%s", dm_action)) { | 93 | if (add_uevent_var(&event->ku_env, "DM_ACTION=%s", dm_action)) { |
94 | DMERR("%s: add_uevent_var() for DM_ACTION failed", | 94 | DMERR("%s: add_uevent_var() for DM_ACTION failed", |
95 | __FUNCTION__); | 95 | __func__); |
96 | goto err_add; | 96 | goto err_add; |
97 | } | 97 | } |
98 | 98 | ||
99 | if (add_uevent_var(&event->ku_env, "DM_SEQNUM=%u", | 99 | if (add_uevent_var(&event->ku_env, "DM_SEQNUM=%u", |
100 | dm_next_uevent_seq(md))) { | 100 | dm_next_uevent_seq(md))) { |
101 | DMERR("%s: add_uevent_var() for DM_SEQNUM failed", | 101 | DMERR("%s: add_uevent_var() for DM_SEQNUM failed", |
102 | __FUNCTION__); | 102 | __func__); |
103 | goto err_add; | 103 | goto err_add; |
104 | } | 104 | } |
105 | 105 | ||
106 | if (add_uevent_var(&event->ku_env, "DM_PATH=%s", path)) { | 106 | if (add_uevent_var(&event->ku_env, "DM_PATH=%s", path)) { |
107 | DMERR("%s: add_uevent_var() for DM_PATH failed", __FUNCTION__); | 107 | DMERR("%s: add_uevent_var() for DM_PATH failed", __func__); |
108 | goto err_add; | 108 | goto err_add; |
109 | } | 109 | } |
110 | 110 | ||
111 | if (add_uevent_var(&event->ku_env, "DM_NR_VALID_PATHS=%d", | 111 | if (add_uevent_var(&event->ku_env, "DM_NR_VALID_PATHS=%d", |
112 | nr_valid_paths)) { | 112 | nr_valid_paths)) { |
113 | DMERR("%s: add_uevent_var() for DM_NR_VALID_PATHS failed", | 113 | DMERR("%s: add_uevent_var() for DM_NR_VALID_PATHS failed", |
114 | __FUNCTION__); | 114 | __func__); |
115 | goto err_add; | 115 | goto err_add; |
116 | } | 116 | } |
117 | 117 | ||
@@ -146,25 +146,25 @@ void dm_send_uevents(struct list_head *events, struct kobject *kobj) | |||
146 | if (dm_copy_name_and_uuid(event->md, event->name, | 146 | if (dm_copy_name_and_uuid(event->md, event->name, |
147 | event->uuid)) { | 147 | event->uuid)) { |
148 | DMERR("%s: dm_copy_name_and_uuid() failed", | 148 | DMERR("%s: dm_copy_name_and_uuid() failed", |
149 | __FUNCTION__); | 149 | __func__); |
150 | goto uevent_free; | 150 | goto uevent_free; |
151 | } | 151 | } |
152 | 152 | ||
153 | if (add_uevent_var(&event->ku_env, "DM_NAME=%s", event->name)) { | 153 | if (add_uevent_var(&event->ku_env, "DM_NAME=%s", event->name)) { |
154 | DMERR("%s: add_uevent_var() for DM_NAME failed", | 154 | DMERR("%s: add_uevent_var() for DM_NAME failed", |
155 | __FUNCTION__); | 155 | __func__); |
156 | goto uevent_free; | 156 | goto uevent_free; |
157 | } | 157 | } |
158 | 158 | ||
159 | if (add_uevent_var(&event->ku_env, "DM_UUID=%s", event->uuid)) { | 159 | if (add_uevent_var(&event->ku_env, "DM_UUID=%s", event->uuid)) { |
160 | DMERR("%s: add_uevent_var() for DM_UUID failed", | 160 | DMERR("%s: add_uevent_var() for DM_UUID failed", |
161 | __FUNCTION__); | 161 | __func__); |
162 | goto uevent_free; | 162 | goto uevent_free; |
163 | } | 163 | } |
164 | 164 | ||
165 | r = kobject_uevent_env(kobj, event->action, event->ku_env.envp); | 165 | r = kobject_uevent_env(kobj, event->action, event->ku_env.envp); |
166 | if (r) | 166 | if (r) |
167 | DMERR("%s: kobject_uevent_env failed", __FUNCTION__); | 167 | DMERR("%s: kobject_uevent_env failed", __func__); |
168 | uevent_free: | 168 | uevent_free: |
169 | dm_uevent_free(event); | 169 | dm_uevent_free(event); |
170 | } | 170 | } |
@@ -187,7 +187,7 @@ void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti, | |||
187 | struct dm_uevent *event; | 187 | struct dm_uevent *event; |
188 | 188 | ||
189 | if (event_type >= ARRAY_SIZE(_dm_uevent_type_names)) { | 189 | if (event_type >= ARRAY_SIZE(_dm_uevent_type_names)) { |
190 | DMERR("%s: Invalid event_type %d", __FUNCTION__, event_type); | 190 | DMERR("%s: Invalid event_type %d", __func__, event_type); |
191 | goto out; | 191 | goto out; |
192 | } | 192 | } |
193 | 193 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 5ebfb4d79901..87620b705bee 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -731,9 +731,9 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version | |||
731 | else | 731 | else |
732 | rdev->desc_nr = sb->this_disk.number; | 732 | rdev->desc_nr = sb->this_disk.number; |
733 | 733 | ||
734 | if (refdev == 0) | 734 | if (!refdev) { |
735 | ret = 1; | 735 | ret = 1; |
736 | else { | 736 | } else { |
737 | __u64 ev1, ev2; | 737 | __u64 ev1, ev2; |
738 | mdp_super_t *refsb = (mdp_super_t*)page_address(refdev->sb_page); | 738 | mdp_super_t *refsb = (mdp_super_t*)page_address(refdev->sb_page); |
739 | if (!uuid_equal(refsb, sb)) { | 739 | if (!uuid_equal(refsb, sb)) { |
@@ -1116,9 +1116,9 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version) | |||
1116 | else | 1116 | else |
1117 | rdev->desc_nr = le32_to_cpu(sb->dev_number); | 1117 | rdev->desc_nr = le32_to_cpu(sb->dev_number); |
1118 | 1118 | ||
1119 | if (refdev == 0) | 1119 | if (!refdev) { |
1120 | ret = 1; | 1120 | ret = 1; |
1121 | else { | 1121 | } else { |
1122 | __u64 ev1, ev2; | 1122 | __u64 ev1, ev2; |
1123 | struct mdp_superblock_1 *refsb = | 1123 | struct mdp_superblock_1 *refsb = |
1124 | (struct mdp_superblock_1*)page_address(refdev->sb_page); | 1124 | (struct mdp_superblock_1*)page_address(refdev->sb_page); |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 3f299d835a2b..42ee1a2dc144 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -244,7 +244,8 @@ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev) | |||
244 | conf->working_disks--; | 244 | conf->working_disks--; |
245 | mddev->degraded++; | 245 | mddev->degraded++; |
246 | printk(KERN_ALERT "multipath: IO failure on %s," | 246 | printk(KERN_ALERT "multipath: IO failure on %s," |
247 | " disabling IO path. \n Operation continuing" | 247 | " disabling IO path.\n" |
248 | "multipath: Operation continuing" | ||
248 | " on %d IO paths.\n", | 249 | " on %d IO paths.\n", |
249 | bdevname (rdev->bdev,b), | 250 | bdevname (rdev->bdev,b), |
250 | conf->working_disks); | 251 | conf->working_disks); |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index ff61b309129a..9fd473a6dbf5 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1008,8 +1008,8 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1008 | } else | 1008 | } else |
1009 | set_bit(Faulty, &rdev->flags); | 1009 | set_bit(Faulty, &rdev->flags); |
1010 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 1010 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
1011 | printk(KERN_ALERT "raid1: Disk failure on %s, disabling device. \n" | 1011 | printk(KERN_ALERT "raid1: Disk failure on %s, disabling device.\n" |
1012 | " Operation continuing on %d devices\n", | 1012 | "raid1: Operation continuing on %d devices.\n", |
1013 | bdevname(rdev->bdev,b), conf->raid_disks - mddev->degraded); | 1013 | bdevname(rdev->bdev,b), conf->raid_disks - mddev->degraded); |
1014 | } | 1014 | } |
1015 | 1015 | ||
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 32389d2f18fc..1e96aa3ff513 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1001,8 +1001,8 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1001 | } | 1001 | } |
1002 | set_bit(Faulty, &rdev->flags); | 1002 | set_bit(Faulty, &rdev->flags); |
1003 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 1003 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
1004 | printk(KERN_ALERT "raid10: Disk failure on %s, disabling device. \n" | 1004 | printk(KERN_ALERT "raid10: Disk failure on %s, disabling device.\n" |
1005 | " Operation continuing on %d devices\n", | 1005 | "raid10: Operation continuing on %d devices.\n", |
1006 | bdevname(rdev->bdev,b), conf->raid_disks - mddev->degraded); | 1006 | bdevname(rdev->bdev,b), conf->raid_disks - mddev->degraded); |
1007 | } | 1007 | } |
1008 | 1008 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index b162b839a662..968dacaced6d 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -63,6 +63,7 @@ | |||
63 | #define STRIPE_SHIFT (PAGE_SHIFT - 9) | 63 | #define STRIPE_SHIFT (PAGE_SHIFT - 9) |
64 | #define STRIPE_SECTORS (STRIPE_SIZE>>9) | 64 | #define STRIPE_SECTORS (STRIPE_SIZE>>9) |
65 | #define IO_THRESHOLD 1 | 65 | #define IO_THRESHOLD 1 |
66 | #define BYPASS_THRESHOLD 1 | ||
66 | #define NR_HASH (PAGE_SIZE / sizeof(struct hlist_head)) | 67 | #define NR_HASH (PAGE_SIZE / sizeof(struct hlist_head)) |
67 | #define HASH_MASK (NR_HASH - 1) | 68 | #define HASH_MASK (NR_HASH - 1) |
68 | 69 | ||
@@ -398,6 +399,7 @@ static void ops_run_io(struct stripe_head *sh) | |||
398 | 399 | ||
399 | might_sleep(); | 400 | might_sleep(); |
400 | 401 | ||
402 | set_bit(STRIPE_IO_STARTED, &sh->state); | ||
401 | for (i = disks; i--; ) { | 403 | for (i = disks; i--; ) { |
402 | int rw; | 404 | int rw; |
403 | struct bio *bi; | 405 | struct bio *bi; |
@@ -433,7 +435,7 @@ static void ops_run_io(struct stripe_head *sh) | |||
433 | 435 | ||
434 | bi->bi_bdev = rdev->bdev; | 436 | bi->bi_bdev = rdev->bdev; |
435 | pr_debug("%s: for %llu schedule op %ld on disc %d\n", | 437 | pr_debug("%s: for %llu schedule op %ld on disc %d\n", |
436 | __FUNCTION__, (unsigned long long)sh->sector, | 438 | __func__, (unsigned long long)sh->sector, |
437 | bi->bi_rw, i); | 439 | bi->bi_rw, i); |
438 | atomic_inc(&sh->count); | 440 | atomic_inc(&sh->count); |
439 | bi->bi_sector = sh->sector + rdev->data_offset; | 441 | bi->bi_sector = sh->sector + rdev->data_offset; |
@@ -520,7 +522,7 @@ static void ops_complete_biofill(void *stripe_head_ref) | |||
520 | raid5_conf_t *conf = sh->raid_conf; | 522 | raid5_conf_t *conf = sh->raid_conf; |
521 | int i; | 523 | int i; |
522 | 524 | ||
523 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 525 | pr_debug("%s: stripe %llu\n", __func__, |
524 | (unsigned long long)sh->sector); | 526 | (unsigned long long)sh->sector); |
525 | 527 | ||
526 | /* clear completed biofills */ | 528 | /* clear completed biofills */ |
@@ -569,7 +571,7 @@ static void ops_run_biofill(struct stripe_head *sh) | |||
569 | raid5_conf_t *conf = sh->raid_conf; | 571 | raid5_conf_t *conf = sh->raid_conf; |
570 | int i; | 572 | int i; |
571 | 573 | ||
572 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 574 | pr_debug("%s: stripe %llu\n", __func__, |
573 | (unsigned long long)sh->sector); | 575 | (unsigned long long)sh->sector); |
574 | 576 | ||
575 | for (i = sh->disks; i--; ) { | 577 | for (i = sh->disks; i--; ) { |
@@ -600,7 +602,7 @@ static void ops_complete_compute5(void *stripe_head_ref) | |||
600 | int target = sh->ops.target; | 602 | int target = sh->ops.target; |
601 | struct r5dev *tgt = &sh->dev[target]; | 603 | struct r5dev *tgt = &sh->dev[target]; |
602 | 604 | ||
603 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 605 | pr_debug("%s: stripe %llu\n", __func__, |
604 | (unsigned long long)sh->sector); | 606 | (unsigned long long)sh->sector); |
605 | 607 | ||
606 | set_bit(R5_UPTODATE, &tgt->flags); | 608 | set_bit(R5_UPTODATE, &tgt->flags); |
@@ -625,7 +627,7 @@ ops_run_compute5(struct stripe_head *sh, unsigned long pending) | |||
625 | int i; | 627 | int i; |
626 | 628 | ||
627 | pr_debug("%s: stripe %llu block: %d\n", | 629 | pr_debug("%s: stripe %llu block: %d\n", |
628 | __FUNCTION__, (unsigned long long)sh->sector, target); | 630 | __func__, (unsigned long long)sh->sector, target); |
629 | BUG_ON(!test_bit(R5_Wantcompute, &tgt->flags)); | 631 | BUG_ON(!test_bit(R5_Wantcompute, &tgt->flags)); |
630 | 632 | ||
631 | for (i = disks; i--; ) | 633 | for (i = disks; i--; ) |
@@ -653,7 +655,7 @@ static void ops_complete_prexor(void *stripe_head_ref) | |||
653 | { | 655 | { |
654 | struct stripe_head *sh = stripe_head_ref; | 656 | struct stripe_head *sh = stripe_head_ref; |
655 | 657 | ||
656 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 658 | pr_debug("%s: stripe %llu\n", __func__, |
657 | (unsigned long long)sh->sector); | 659 | (unsigned long long)sh->sector); |
658 | 660 | ||
659 | set_bit(STRIPE_OP_PREXOR, &sh->ops.complete); | 661 | set_bit(STRIPE_OP_PREXOR, &sh->ops.complete); |
@@ -670,7 +672,7 @@ ops_run_prexor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | |||
670 | /* existing parity data subtracted */ | 672 | /* existing parity data subtracted */ |
671 | struct page *xor_dest = xor_srcs[count++] = sh->dev[pd_idx].page; | 673 | struct page *xor_dest = xor_srcs[count++] = sh->dev[pd_idx].page; |
672 | 674 | ||
673 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 675 | pr_debug("%s: stripe %llu\n", __func__, |
674 | (unsigned long long)sh->sector); | 676 | (unsigned long long)sh->sector); |
675 | 677 | ||
676 | for (i = disks; i--; ) { | 678 | for (i = disks; i--; ) { |
@@ -699,7 +701,7 @@ ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx, | |||
699 | */ | 701 | */ |
700 | int prexor = test_bit(STRIPE_OP_PREXOR, &pending); | 702 | int prexor = test_bit(STRIPE_OP_PREXOR, &pending); |
701 | 703 | ||
702 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 704 | pr_debug("%s: stripe %llu\n", __func__, |
703 | (unsigned long long)sh->sector); | 705 | (unsigned long long)sh->sector); |
704 | 706 | ||
705 | for (i = disks; i--; ) { | 707 | for (i = disks; i--; ) { |
@@ -744,7 +746,7 @@ static void ops_complete_postxor(void *stripe_head_ref) | |||
744 | { | 746 | { |
745 | struct stripe_head *sh = stripe_head_ref; | 747 | struct stripe_head *sh = stripe_head_ref; |
746 | 748 | ||
747 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 749 | pr_debug("%s: stripe %llu\n", __func__, |
748 | (unsigned long long)sh->sector); | 750 | (unsigned long long)sh->sector); |
749 | 751 | ||
750 | set_bit(STRIPE_OP_POSTXOR, &sh->ops.complete); | 752 | set_bit(STRIPE_OP_POSTXOR, &sh->ops.complete); |
@@ -757,7 +759,7 @@ static void ops_complete_write(void *stripe_head_ref) | |||
757 | struct stripe_head *sh = stripe_head_ref; | 759 | struct stripe_head *sh = stripe_head_ref; |
758 | int disks = sh->disks, i, pd_idx = sh->pd_idx; | 760 | int disks = sh->disks, i, pd_idx = sh->pd_idx; |
759 | 761 | ||
760 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 762 | pr_debug("%s: stripe %llu\n", __func__, |
761 | (unsigned long long)sh->sector); | 763 | (unsigned long long)sh->sector); |
762 | 764 | ||
763 | for (i = disks; i--; ) { | 765 | for (i = disks; i--; ) { |
@@ -787,7 +789,7 @@ ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx, | |||
787 | unsigned long flags; | 789 | unsigned long flags; |
788 | dma_async_tx_callback callback; | 790 | dma_async_tx_callback callback; |
789 | 791 | ||
790 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 792 | pr_debug("%s: stripe %llu\n", __func__, |
791 | (unsigned long long)sh->sector); | 793 | (unsigned long long)sh->sector); |
792 | 794 | ||
793 | /* check if prexor is active which means only process blocks | 795 | /* check if prexor is active which means only process blocks |
@@ -837,7 +839,7 @@ static void ops_complete_check(void *stripe_head_ref) | |||
837 | struct stripe_head *sh = stripe_head_ref; | 839 | struct stripe_head *sh = stripe_head_ref; |
838 | int pd_idx = sh->pd_idx; | 840 | int pd_idx = sh->pd_idx; |
839 | 841 | ||
840 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 842 | pr_debug("%s: stripe %llu\n", __func__, |
841 | (unsigned long long)sh->sector); | 843 | (unsigned long long)sh->sector); |
842 | 844 | ||
843 | if (test_and_clear_bit(STRIPE_OP_MOD_DMA_CHECK, &sh->ops.pending) && | 845 | if (test_and_clear_bit(STRIPE_OP_MOD_DMA_CHECK, &sh->ops.pending) && |
@@ -859,7 +861,7 @@ static void ops_run_check(struct stripe_head *sh) | |||
859 | int count = 0, pd_idx = sh->pd_idx, i; | 861 | int count = 0, pd_idx = sh->pd_idx, i; |
860 | struct page *xor_dest = xor_srcs[count++] = sh->dev[pd_idx].page; | 862 | struct page *xor_dest = xor_srcs[count++] = sh->dev[pd_idx].page; |
861 | 863 | ||
862 | pr_debug("%s: stripe %llu\n", __FUNCTION__, | 864 | pr_debug("%s: stripe %llu\n", __func__, |
863 | (unsigned long long)sh->sector); | 865 | (unsigned long long)sh->sector); |
864 | 866 | ||
865 | for (i = disks; i--; ) { | 867 | for (i = disks; i--; ) { |
@@ -1260,8 +1262,8 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1260 | } | 1262 | } |
1261 | set_bit(Faulty, &rdev->flags); | 1263 | set_bit(Faulty, &rdev->flags); |
1262 | printk (KERN_ALERT | 1264 | printk (KERN_ALERT |
1263 | "raid5: Disk failure on %s, disabling device." | 1265 | "raid5: Disk failure on %s, disabling device.\n" |
1264 | " Operation continuing on %d devices\n", | 1266 | "raid5: Operation continuing on %d devices.\n", |
1265 | bdevname(rdev->bdev,b), conf->raid_disks - mddev->degraded); | 1267 | bdevname(rdev->bdev,b), conf->raid_disks - mddev->degraded); |
1266 | } | 1268 | } |
1267 | } | 1269 | } |
@@ -1720,6 +1722,9 @@ handle_write_operations5(struct stripe_head *sh, int rcw, int expand) | |||
1720 | locked++; | 1722 | locked++; |
1721 | } | 1723 | } |
1722 | } | 1724 | } |
1725 | if (locked + 1 == disks) | ||
1726 | if (!test_and_set_bit(STRIPE_FULL_WRITE, &sh->state)) | ||
1727 | atomic_inc(&sh->raid_conf->pending_full_writes); | ||
1723 | } else { | 1728 | } else { |
1724 | BUG_ON(!(test_bit(R5_UPTODATE, &sh->dev[pd_idx].flags) || | 1729 | BUG_ON(!(test_bit(R5_UPTODATE, &sh->dev[pd_idx].flags) || |
1725 | test_bit(R5_Wantcompute, &sh->dev[pd_idx].flags))); | 1730 | test_bit(R5_Wantcompute, &sh->dev[pd_idx].flags))); |
@@ -1759,7 +1764,7 @@ handle_write_operations5(struct stripe_head *sh, int rcw, int expand) | |||
1759 | locked++; | 1764 | locked++; |
1760 | 1765 | ||
1761 | pr_debug("%s: stripe %llu locked: %d pending: %lx\n", | 1766 | pr_debug("%s: stripe %llu locked: %d pending: %lx\n", |
1762 | __FUNCTION__, (unsigned long long)sh->sector, | 1767 | __func__, (unsigned long long)sh->sector, |
1763 | locked, sh->ops.pending); | 1768 | locked, sh->ops.pending); |
1764 | 1769 | ||
1765 | return locked; | 1770 | return locked; |
@@ -1947,6 +1952,9 @@ handle_requests_to_failed_array(raid5_conf_t *conf, struct stripe_head *sh, | |||
1947 | STRIPE_SECTORS, 0, 0); | 1952 | STRIPE_SECTORS, 0, 0); |
1948 | } | 1953 | } |
1949 | 1954 | ||
1955 | if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) | ||
1956 | if (atomic_dec_and_test(&conf->pending_full_writes)) | ||
1957 | md_wakeup_thread(conf->mddev->thread); | ||
1950 | } | 1958 | } |
1951 | 1959 | ||
1952 | /* __handle_issuing_new_read_requests5 - returns 0 if there are no more disks | 1960 | /* __handle_issuing_new_read_requests5 - returns 0 if there are no more disks |
@@ -2149,6 +2157,10 @@ static void handle_completed_write_requests(raid5_conf_t *conf, | |||
2149 | 0); | 2157 | 0); |
2150 | } | 2158 | } |
2151 | } | 2159 | } |
2160 | |||
2161 | if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) | ||
2162 | if (atomic_dec_and_test(&conf->pending_full_writes)) | ||
2163 | md_wakeup_thread(conf->mddev->thread); | ||
2152 | } | 2164 | } |
2153 | 2165 | ||
2154 | static void handle_issuing_new_write_requests5(raid5_conf_t *conf, | 2166 | static void handle_issuing_new_write_requests5(raid5_conf_t *conf, |
@@ -2333,6 +2345,9 @@ static void handle_issuing_new_write_requests6(raid5_conf_t *conf, | |||
2333 | s->locked++; | 2345 | s->locked++; |
2334 | set_bit(R5_Wantwrite, &sh->dev[i].flags); | 2346 | set_bit(R5_Wantwrite, &sh->dev[i].flags); |
2335 | } | 2347 | } |
2348 | if (s->locked == disks) | ||
2349 | if (!test_and_set_bit(STRIPE_FULL_WRITE, &sh->state)) | ||
2350 | atomic_inc(&conf->pending_full_writes); | ||
2336 | /* after a RECONSTRUCT_WRITE, the stripe MUST be in-sync */ | 2351 | /* after a RECONSTRUCT_WRITE, the stripe MUST be in-sync */ |
2337 | set_bit(STRIPE_INSYNC, &sh->state); | 2352 | set_bit(STRIPE_INSYNC, &sh->state); |
2338 | 2353 | ||
@@ -3094,6 +3109,8 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page) | |||
3094 | else | 3109 | else |
3095 | continue; | 3110 | continue; |
3096 | 3111 | ||
3112 | set_bit(STRIPE_IO_STARTED, &sh->state); | ||
3113 | |||
3097 | bi = &sh->dev[i].req; | 3114 | bi = &sh->dev[i].req; |
3098 | 3115 | ||
3099 | bi->bi_rw = rw; | 3116 | bi->bi_rw = rw; |
@@ -3164,7 +3181,7 @@ static void raid5_activate_delayed(raid5_conf_t *conf) | |||
3164 | clear_bit(STRIPE_DELAYED, &sh->state); | 3181 | clear_bit(STRIPE_DELAYED, &sh->state); |
3165 | if (!test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) | 3182 | if (!test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) |
3166 | atomic_inc(&conf->preread_active_stripes); | 3183 | atomic_inc(&conf->preread_active_stripes); |
3167 | list_add_tail(&sh->lru, &conf->handle_list); | 3184 | list_add_tail(&sh->lru, &conf->hold_list); |
3168 | } | 3185 | } |
3169 | } else | 3186 | } else |
3170 | blk_plug_device(conf->mddev->queue); | 3187 | blk_plug_device(conf->mddev->queue); |
@@ -3442,6 +3459,58 @@ static int chunk_aligned_read(struct request_queue *q, struct bio * raid_bio) | |||
3442 | } | 3459 | } |
3443 | } | 3460 | } |
3444 | 3461 | ||
3462 | /* __get_priority_stripe - get the next stripe to process | ||
3463 | * | ||
3464 | * Full stripe writes are allowed to pass preread active stripes up until | ||
3465 | * the bypass_threshold is exceeded. In general the bypass_count | ||
3466 | * increments when the handle_list is handled before the hold_list; however, it | ||
3467 | * will not be incremented when STRIPE_IO_STARTED is sampled set signifying a | ||
3468 | * stripe with in flight i/o. The bypass_count will be reset when the | ||
3469 | * head of the hold_list has changed, i.e. the head was promoted to the | ||
3470 | * handle_list. | ||
3471 | */ | ||
3472 | static struct stripe_head *__get_priority_stripe(raid5_conf_t *conf) | ||
3473 | { | ||
3474 | struct stripe_head *sh; | ||
3475 | |||
3476 | pr_debug("%s: handle: %s hold: %s full_writes: %d bypass_count: %d\n", | ||
3477 | __func__, | ||
3478 | list_empty(&conf->handle_list) ? "empty" : "busy", | ||
3479 | list_empty(&conf->hold_list) ? "empty" : "busy", | ||
3480 | atomic_read(&conf->pending_full_writes), conf->bypass_count); | ||
3481 | |||
3482 | if (!list_empty(&conf->handle_list)) { | ||
3483 | sh = list_entry(conf->handle_list.next, typeof(*sh), lru); | ||
3484 | |||
3485 | if (list_empty(&conf->hold_list)) | ||
3486 | conf->bypass_count = 0; | ||
3487 | else if (!test_bit(STRIPE_IO_STARTED, &sh->state)) { | ||
3488 | if (conf->hold_list.next == conf->last_hold) | ||
3489 | conf->bypass_count++; | ||
3490 | else { | ||
3491 | conf->last_hold = conf->hold_list.next; | ||
3492 | conf->bypass_count -= conf->bypass_threshold; | ||
3493 | if (conf->bypass_count < 0) | ||
3494 | conf->bypass_count = 0; | ||
3495 | } | ||
3496 | } | ||
3497 | } else if (!list_empty(&conf->hold_list) && | ||
3498 | ((conf->bypass_threshold && | ||
3499 | conf->bypass_count > conf->bypass_threshold) || | ||
3500 | atomic_read(&conf->pending_full_writes) == 0)) { | ||
3501 | sh = list_entry(conf->hold_list.next, | ||
3502 | typeof(*sh), lru); | ||
3503 | conf->bypass_count -= conf->bypass_threshold; | ||
3504 | if (conf->bypass_count < 0) | ||
3505 | conf->bypass_count = 0; | ||
3506 | } else | ||
3507 | return NULL; | ||
3508 | |||
3509 | list_del_init(&sh->lru); | ||
3510 | atomic_inc(&sh->count); | ||
3511 | BUG_ON(atomic_read(&sh->count) != 1); | ||
3512 | return sh; | ||
3513 | } | ||
3445 | 3514 | ||
3446 | static int make_request(struct request_queue *q, struct bio * bi) | 3515 | static int make_request(struct request_queue *q, struct bio * bi) |
3447 | { | 3516 | { |
@@ -3914,7 +3983,6 @@ static void raid5d(mddev_t *mddev) | |||
3914 | handled = 0; | 3983 | handled = 0; |
3915 | spin_lock_irq(&conf->device_lock); | 3984 | spin_lock_irq(&conf->device_lock); |
3916 | while (1) { | 3985 | while (1) { |
3917 | struct list_head *first; | ||
3918 | struct bio *bio; | 3986 | struct bio *bio; |
3919 | 3987 | ||
3920 | if (conf->seq_flush != conf->seq_write) { | 3988 | if (conf->seq_flush != conf->seq_write) { |
@@ -3936,17 +4004,12 @@ static void raid5d(mddev_t *mddev) | |||
3936 | handled++; | 4004 | handled++; |
3937 | } | 4005 | } |
3938 | 4006 | ||
3939 | if (list_empty(&conf->handle_list)) { | 4007 | sh = __get_priority_stripe(conf); |
4008 | |||
4009 | if (!sh) { | ||
3940 | async_tx_issue_pending_all(); | 4010 | async_tx_issue_pending_all(); |
3941 | break; | 4011 | break; |
3942 | } | 4012 | } |
3943 | |||
3944 | first = conf->handle_list.next; | ||
3945 | sh = list_entry(first, struct stripe_head, lru); | ||
3946 | |||
3947 | list_del_init(first); | ||
3948 | atomic_inc(&sh->count); | ||
3949 | BUG_ON(atomic_read(&sh->count)!= 1); | ||
3950 | spin_unlock_irq(&conf->device_lock); | 4013 | spin_unlock_irq(&conf->device_lock); |
3951 | 4014 | ||
3952 | handled++; | 4015 | handled++; |
@@ -3978,15 +4041,13 @@ static ssize_t | |||
3978 | raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len) | 4041 | raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len) |
3979 | { | 4042 | { |
3980 | raid5_conf_t *conf = mddev_to_conf(mddev); | 4043 | raid5_conf_t *conf = mddev_to_conf(mddev); |
3981 | char *end; | 4044 | unsigned long new; |
3982 | int new; | ||
3983 | if (len >= PAGE_SIZE) | 4045 | if (len >= PAGE_SIZE) |
3984 | return -EINVAL; | 4046 | return -EINVAL; |
3985 | if (!conf) | 4047 | if (!conf) |
3986 | return -ENODEV; | 4048 | return -ENODEV; |
3987 | 4049 | ||
3988 | new = simple_strtoul(page, &end, 10); | 4050 | if (strict_strtoul(page, 10, &new)) |
3989 | if (!*page || (*end && *end != '\n') ) | ||
3990 | return -EINVAL; | 4051 | return -EINVAL; |
3991 | if (new <= 16 || new > 32768) | 4052 | if (new <= 16 || new > 32768) |
3992 | return -EINVAL; | 4053 | return -EINVAL; |
@@ -4011,6 +4072,40 @@ raid5_stripecache_size = __ATTR(stripe_cache_size, S_IRUGO | S_IWUSR, | |||
4011 | raid5_store_stripe_cache_size); | 4072 | raid5_store_stripe_cache_size); |
4012 | 4073 | ||
4013 | static ssize_t | 4074 | static ssize_t |
4075 | raid5_show_preread_threshold(mddev_t *mddev, char *page) | ||
4076 | { | ||
4077 | raid5_conf_t *conf = mddev_to_conf(mddev); | ||
4078 | if (conf) | ||
4079 | return sprintf(page, "%d\n", conf->bypass_threshold); | ||
4080 | else | ||
4081 | return 0; | ||
4082 | } | ||
4083 | |||
4084 | static ssize_t | ||
4085 | raid5_store_preread_threshold(mddev_t *mddev, const char *page, size_t len) | ||
4086 | { | ||
4087 | raid5_conf_t *conf = mddev_to_conf(mddev); | ||
4088 | unsigned long new; | ||
4089 | if (len >= PAGE_SIZE) | ||
4090 | return -EINVAL; | ||
4091 | if (!conf) | ||
4092 | return -ENODEV; | ||
4093 | |||
4094 | if (strict_strtoul(page, 10, &new)) | ||
4095 | return -EINVAL; | ||
4096 | if (new > conf->max_nr_stripes) | ||
4097 | return -EINVAL; | ||
4098 | conf->bypass_threshold = new; | ||
4099 | return len; | ||
4100 | } | ||
4101 | |||
4102 | static struct md_sysfs_entry | ||
4103 | raid5_preread_bypass_threshold = __ATTR(preread_bypass_threshold, | ||
4104 | S_IRUGO | S_IWUSR, | ||
4105 | raid5_show_preread_threshold, | ||
4106 | raid5_store_preread_threshold); | ||
4107 | |||
4108 | static ssize_t | ||
4014 | stripe_cache_active_show(mddev_t *mddev, char *page) | 4109 | stripe_cache_active_show(mddev_t *mddev, char *page) |
4015 | { | 4110 | { |
4016 | raid5_conf_t *conf = mddev_to_conf(mddev); | 4111 | raid5_conf_t *conf = mddev_to_conf(mddev); |
@@ -4026,6 +4121,7 @@ raid5_stripecache_active = __ATTR_RO(stripe_cache_active); | |||
4026 | static struct attribute *raid5_attrs[] = { | 4121 | static struct attribute *raid5_attrs[] = { |
4027 | &raid5_stripecache_size.attr, | 4122 | &raid5_stripecache_size.attr, |
4028 | &raid5_stripecache_active.attr, | 4123 | &raid5_stripecache_active.attr, |
4124 | &raid5_preread_bypass_threshold.attr, | ||
4029 | NULL, | 4125 | NULL, |
4030 | }; | 4126 | }; |
4031 | static struct attribute_group raid5_attrs_group = { | 4127 | static struct attribute_group raid5_attrs_group = { |
@@ -4130,12 +4226,14 @@ static int run(mddev_t *mddev) | |||
4130 | init_waitqueue_head(&conf->wait_for_stripe); | 4226 | init_waitqueue_head(&conf->wait_for_stripe); |
4131 | init_waitqueue_head(&conf->wait_for_overlap); | 4227 | init_waitqueue_head(&conf->wait_for_overlap); |
4132 | INIT_LIST_HEAD(&conf->handle_list); | 4228 | INIT_LIST_HEAD(&conf->handle_list); |
4229 | INIT_LIST_HEAD(&conf->hold_list); | ||
4133 | INIT_LIST_HEAD(&conf->delayed_list); | 4230 | INIT_LIST_HEAD(&conf->delayed_list); |
4134 | INIT_LIST_HEAD(&conf->bitmap_list); | 4231 | INIT_LIST_HEAD(&conf->bitmap_list); |
4135 | INIT_LIST_HEAD(&conf->inactive_list); | 4232 | INIT_LIST_HEAD(&conf->inactive_list); |
4136 | atomic_set(&conf->active_stripes, 0); | 4233 | atomic_set(&conf->active_stripes, 0); |
4137 | atomic_set(&conf->preread_active_stripes, 0); | 4234 | atomic_set(&conf->preread_active_stripes, 0); |
4138 | atomic_set(&conf->active_aligned_reads, 0); | 4235 | atomic_set(&conf->active_aligned_reads, 0); |
4236 | conf->bypass_threshold = BYPASS_THRESHOLD; | ||
4139 | 4237 | ||
4140 | pr_debug("raid5: run(%s) called.\n", mdname(mddev)); | 4238 | pr_debug("raid5: run(%s) called.\n", mdname(mddev)); |
4141 | 4239 | ||
diff --git a/drivers/md/raid6algos.c b/drivers/md/raid6algos.c index 77a6e4bf503d..21987e3dbe6c 100644 --- a/drivers/md/raid6algos.c +++ b/drivers/md/raid6algos.c | |||
@@ -121,7 +121,8 @@ int __init raid6_select_algo(void) | |||
121 | j0 = jiffies; | 121 | j0 = jiffies; |
122 | while ( (j1 = jiffies) == j0 ) | 122 | while ( (j1 = jiffies) == j0 ) |
123 | cpu_relax(); | 123 | cpu_relax(); |
124 | while ( (jiffies-j1) < (1 << RAID6_TIME_JIFFIES_LG2) ) { | 124 | while (time_before(jiffies, |
125 | j1 + (1<<RAID6_TIME_JIFFIES_LG2))) { | ||
125 | (*algo)->gen_syndrome(disks, PAGE_SIZE, dptrs); | 126 | (*algo)->gen_syndrome(disks, PAGE_SIZE, dptrs); |
126 | perf++; | 127 | perf++; |
127 | } | 128 | } |
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index d545c98dd5e7..01ea99c9bc1a 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c | |||
@@ -13,7 +13,7 @@ | |||
13 | /* | 13 | /* |
14 | * TODO: | 14 | * TODO: |
15 | * - remove "mark pages reserved-hacks" from memory allocation code | 15 | * - remove "mark pages reserved-hacks" from memory allocation code |
16 | * and implement nopage() | 16 | * and implement fault() |
17 | * - check decimation, calculating and reporting image size when | 17 | * - check decimation, calculating and reporting image size when |
18 | * using decimation | 18 | * using decimation |
19 | * - implement read(), user mode buffers and overlay (?) | 19 | * - implement read(), user mode buffers and overlay (?) |
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 13bac53db69a..6e655b4c6682 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/sm501.h> | 23 | #include <linux/sm501.h> |
24 | #include <linux/sm501-regs.h> | 24 | #include <linux/sm501-regs.h> |
25 | #include <linux/serial_8250.h> | ||
25 | 26 | ||
26 | #include <asm/io.h> | 27 | #include <asm/io.h> |
27 | 28 | ||
@@ -723,13 +724,14 @@ static void sm501_device_release(struct device *dev) | |||
723 | */ | 724 | */ |
724 | 725 | ||
725 | static struct platform_device * | 726 | static struct platform_device * |
726 | sm501_create_subdev(struct sm501_devdata *sm, | 727 | sm501_create_subdev(struct sm501_devdata *sm, char *name, |
727 | char *name, unsigned int res_count) | 728 | unsigned int res_count, unsigned int platform_data_size) |
728 | { | 729 | { |
729 | struct sm501_device *smdev; | 730 | struct sm501_device *smdev; |
730 | 731 | ||
731 | smdev = kzalloc(sizeof(struct sm501_device) + | 732 | smdev = kzalloc(sizeof(struct sm501_device) + |
732 | sizeof(struct resource) * res_count, GFP_KERNEL); | 733 | (sizeof(struct resource) * res_count) + |
734 | platform_data_size, GFP_KERNEL); | ||
733 | if (!smdev) | 735 | if (!smdev) |
734 | return NULL; | 736 | return NULL; |
735 | 737 | ||
@@ -737,11 +739,15 @@ sm501_create_subdev(struct sm501_devdata *sm, | |||
737 | 739 | ||
738 | smdev->pdev.name = name; | 740 | smdev->pdev.name = name; |
739 | smdev->pdev.id = sm->pdev_id; | 741 | smdev->pdev.id = sm->pdev_id; |
740 | smdev->pdev.resource = (struct resource *)(smdev+1); | ||
741 | smdev->pdev.num_resources = res_count; | ||
742 | |||
743 | smdev->pdev.dev.parent = sm->dev; | 742 | smdev->pdev.dev.parent = sm->dev; |
744 | 743 | ||
744 | if (res_count) { | ||
745 | smdev->pdev.resource = (struct resource *)(smdev+1); | ||
746 | smdev->pdev.num_resources = res_count; | ||
747 | } | ||
748 | if (platform_data_size) | ||
749 | smdev->pdev.dev.platform_data = (void *)(smdev+1); | ||
750 | |||
745 | return &smdev->pdev; | 751 | return &smdev->pdev; |
746 | } | 752 | } |
747 | 753 | ||
@@ -829,7 +835,7 @@ static int sm501_register_usbhost(struct sm501_devdata *sm, | |||
829 | { | 835 | { |
830 | struct platform_device *pdev; | 836 | struct platform_device *pdev; |
831 | 837 | ||
832 | pdev = sm501_create_subdev(sm, "sm501-usb", 3); | 838 | pdev = sm501_create_subdev(sm, "sm501-usb", 3, 0); |
833 | if (!pdev) | 839 | if (!pdev) |
834 | return -ENOMEM; | 840 | return -ENOMEM; |
835 | 841 | ||
@@ -840,12 +846,55 @@ static int sm501_register_usbhost(struct sm501_devdata *sm, | |||
840 | return sm501_register_device(sm, pdev); | 846 | return sm501_register_device(sm, pdev); |
841 | } | 847 | } |
842 | 848 | ||
849 | static void sm501_setup_uart_data(struct sm501_devdata *sm, | ||
850 | struct plat_serial8250_port *uart_data, | ||
851 | unsigned int offset) | ||
852 | { | ||
853 | uart_data->membase = sm->regs + offset; | ||
854 | uart_data->mapbase = sm->io_res->start + offset; | ||
855 | uart_data->iotype = UPIO_MEM; | ||
856 | uart_data->irq = sm->irq; | ||
857 | uart_data->flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; | ||
858 | uart_data->regshift = 2; | ||
859 | uart_data->uartclk = (9600 * 16); | ||
860 | } | ||
861 | |||
862 | static int sm501_register_uart(struct sm501_devdata *sm, int devices) | ||
863 | { | ||
864 | struct platform_device *pdev; | ||
865 | struct plat_serial8250_port *uart_data; | ||
866 | |||
867 | pdev = sm501_create_subdev(sm, "serial8250", 0, | ||
868 | sizeof(struct plat_serial8250_port) * 3); | ||
869 | if (!pdev) | ||
870 | return -ENOMEM; | ||
871 | |||
872 | uart_data = pdev->dev.platform_data; | ||
873 | |||
874 | if (devices & SM501_USE_UART0) { | ||
875 | sm501_setup_uart_data(sm, uart_data++, 0x30000); | ||
876 | sm501_unit_power(sm->dev, SM501_GATE_UART0, 1); | ||
877 | sm501_modify_reg(sm->dev, SM501_IRQ_MASK, 1 << 12, 0); | ||
878 | sm501_modify_reg(sm->dev, SM501_GPIO63_32_CONTROL, 0x01e0, 0); | ||
879 | } | ||
880 | if (devices & SM501_USE_UART1) { | ||
881 | sm501_setup_uart_data(sm, uart_data++, 0x30020); | ||
882 | sm501_unit_power(sm->dev, SM501_GATE_UART1, 1); | ||
883 | sm501_modify_reg(sm->dev, SM501_IRQ_MASK, 1 << 13, 0); | ||
884 | sm501_modify_reg(sm->dev, SM501_GPIO63_32_CONTROL, 0x1e00, 0); | ||
885 | } | ||
886 | |||
887 | pdev->id = PLAT8250_DEV_SM501; | ||
888 | |||
889 | return sm501_register_device(sm, pdev); | ||
890 | } | ||
891 | |||
843 | static int sm501_register_display(struct sm501_devdata *sm, | 892 | static int sm501_register_display(struct sm501_devdata *sm, |
844 | resource_size_t *mem_avail) | 893 | resource_size_t *mem_avail) |
845 | { | 894 | { |
846 | struct platform_device *pdev; | 895 | struct platform_device *pdev; |
847 | 896 | ||
848 | pdev = sm501_create_subdev(sm, "sm501-fb", 4); | 897 | pdev = sm501_create_subdev(sm, "sm501-fb", 4, 0); |
849 | if (!pdev) | 898 | if (!pdev) |
850 | return -ENOMEM; | 899 | return -ENOMEM; |
851 | 900 | ||
@@ -963,6 +1012,7 @@ static unsigned int sm501_mem_local[] = { | |||
963 | 1012 | ||
964 | static int sm501_init_dev(struct sm501_devdata *sm) | 1013 | static int sm501_init_dev(struct sm501_devdata *sm) |
965 | { | 1014 | { |
1015 | struct sm501_initdata *idata; | ||
966 | resource_size_t mem_avail; | 1016 | resource_size_t mem_avail; |
967 | unsigned long dramctrl; | 1017 | unsigned long dramctrl; |
968 | unsigned long devid; | 1018 | unsigned long devid; |
@@ -980,6 +1030,9 @@ static int sm501_init_dev(struct sm501_devdata *sm) | |||
980 | return -EINVAL; | 1030 | return -EINVAL; |
981 | } | 1031 | } |
982 | 1032 | ||
1033 | /* disable irqs */ | ||
1034 | writel(0, sm->regs + SM501_IRQ_MASK); | ||
1035 | |||
983 | dramctrl = readl(sm->regs + SM501_DRAM_CONTROL); | 1036 | dramctrl = readl(sm->regs + SM501_DRAM_CONTROL); |
984 | mem_avail = sm501_mem_local[(dramctrl >> 13) & 0x7]; | 1037 | mem_avail = sm501_mem_local[(dramctrl >> 13) & 0x7]; |
985 | 1038 | ||
@@ -998,15 +1051,14 @@ static int sm501_init_dev(struct sm501_devdata *sm) | |||
998 | 1051 | ||
999 | /* check to see if we have some device initialisation */ | 1052 | /* check to see if we have some device initialisation */ |
1000 | 1053 | ||
1001 | if (sm->platdata) { | 1054 | idata = sm->platdata ? sm->platdata->init : NULL; |
1002 | struct sm501_platdata *pdata = sm->platdata; | 1055 | if (idata) { |
1056 | sm501_init_regs(sm, idata); | ||
1003 | 1057 | ||
1004 | if (pdata->init) { | 1058 | if (idata->devices & SM501_USE_USB_HOST) |
1005 | sm501_init_regs(sm, sm->platdata->init); | 1059 | sm501_register_usbhost(sm, &mem_avail); |
1006 | 1060 | if (idata->devices & (SM501_USE_UART0 | SM501_USE_UART1)) | |
1007 | if (pdata->init->devices & SM501_USE_USB_HOST) | 1061 | sm501_register_uart(sm, idata->devices); |
1008 | sm501_register_usbhost(sm, &mem_avail); | ||
1009 | } | ||
1010 | } | 1062 | } |
1011 | 1063 | ||
1012 | ret = sm501_check_clocks(sm); | 1064 | ret = sm501_check_clocks(sm); |
diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c index 5e859486eaf8..ad34e2d22524 100644 --- a/drivers/mfd/ucb1x00-ts.c +++ b/drivers/mfd/ucb1x00-ts.c | |||
@@ -204,8 +204,7 @@ static inline int ucb1x00_ts_pen_down(struct ucb1x00_ts *ts) | |||
204 | static int ucb1x00_thread(void *_ts) | 204 | static int ucb1x00_thread(void *_ts) |
205 | { | 205 | { |
206 | struct ucb1x00_ts *ts = _ts; | 206 | struct ucb1x00_ts *ts = _ts; |
207 | struct task_struct *tsk = current; | 207 | DECLARE_WAITQUEUE(wait, current); |
208 | DECLARE_WAITQUEUE(wait, tsk); | ||
209 | int valid = 0; | 208 | int valid = 0; |
210 | 209 | ||
211 | set_freezable(); | 210 | set_freezable(); |
@@ -234,7 +233,7 @@ static int ucb1x00_thread(void *_ts) | |||
234 | 233 | ||
235 | 234 | ||
236 | if (ucb1x00_ts_pen_down(ts)) { | 235 | if (ucb1x00_ts_pen_down(ts)) { |
237 | set_task_state(tsk, TASK_INTERRUPTIBLE); | 236 | set_current_state(TASK_INTERRUPTIBLE); |
238 | 237 | ||
239 | ucb1x00_enable_irq(ts->ucb, UCB_IRQ_TSPX, machine_is_collie() ? UCB_RISING : UCB_FALLING); | 238 | ucb1x00_enable_irq(ts->ucb, UCB_IRQ_TSPX, machine_is_collie() ? UCB_RISING : UCB_FALLING); |
240 | ucb1x00_disable(ts->ucb); | 239 | ucb1x00_disable(ts->ucb); |
@@ -262,7 +261,7 @@ static int ucb1x00_thread(void *_ts) | |||
262 | valid = 1; | 261 | valid = 1; |
263 | } | 262 | } |
264 | 263 | ||
265 | set_task_state(tsk, TASK_INTERRUPTIBLE); | 264 | set_current_state(TASK_INTERRUPTIBLE); |
266 | timeout = HZ / 100; | 265 | timeout = HZ / 100; |
267 | } | 266 | } |
268 | 267 | ||
diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile index c2642bc1d49b..2c343aae38d4 100644 --- a/drivers/net/wireless/Makefile +++ b/drivers/net/wireless/Makefile | |||
@@ -56,7 +56,7 @@ obj-$(CONFIG_RTL8187) += rtl8187.o | |||
56 | 56 | ||
57 | obj-$(CONFIG_ADM8211) += adm8211.o | 57 | obj-$(CONFIG_ADM8211) += adm8211.o |
58 | 58 | ||
59 | obj-$(CONFIG_IWLCORE) += iwlwifi/ | 59 | obj-$(CONFIG_IWLWIFI) += iwlwifi/ |
60 | obj-$(CONFIG_RT2X00) += rt2x00/ | 60 | obj-$(CONFIG_RT2X00) += rt2x00/ |
61 | 61 | ||
62 | obj-$(CONFIG_P54_COMMON) += p54/ | 62 | obj-$(CONFIG_P54_COMMON) += p54/ |
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig index c4e631d14bfe..9a25f550fd16 100644 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ b/drivers/net/wireless/iwlwifi/Kconfig | |||
@@ -1,6 +1,11 @@ | |||
1 | config IWLWIFI | ||
2 | bool | ||
3 | default n | ||
4 | |||
1 | config IWLCORE | 5 | config IWLCORE |
2 | tristate "Intel Wireless Wifi Core" | 6 | tristate "Intel Wireless Wifi Core" |
3 | depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL | 7 | depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL |
8 | select IWLWIFI | ||
4 | 9 | ||
5 | config IWLWIFI_LEDS | 10 | config IWLWIFI_LEDS |
6 | bool | 11 | bool |
@@ -106,6 +111,7 @@ config IWL3945 | |||
106 | tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" | 111 | tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" |
107 | depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL | 112 | depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL |
108 | select FW_LOADER | 113 | select FW_LOADER |
114 | select IWLWIFI | ||
109 | ---help--- | 115 | ---help--- |
110 | Select to build the driver supporting the: | 116 | Select to build the driver supporting the: |
111 | 117 | ||
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c index b07ba2a14119..9304c4555079 100644 --- a/drivers/oprofile/buffer_sync.c +++ b/drivers/oprofile/buffer_sync.c | |||
@@ -491,7 +491,7 @@ typedef enum { | |||
491 | */ | 491 | */ |
492 | void sync_buffer(int cpu) | 492 | void sync_buffer(int cpu) |
493 | { | 493 | { |
494 | struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[cpu]; | 494 | struct oprofile_cpu_buffer *cpu_buf = &per_cpu(cpu_buffer, cpu); |
495 | struct mm_struct *mm = NULL; | 495 | struct mm_struct *mm = NULL; |
496 | struct task_struct * new; | 496 | struct task_struct * new; |
497 | unsigned long cookie = 0; | 497 | unsigned long cookie = 0; |
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c index c93d3d2640ab..efcbf4b4579f 100644 --- a/drivers/oprofile/cpu_buffer.c +++ b/drivers/oprofile/cpu_buffer.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "buffer_sync.h" | 27 | #include "buffer_sync.h" |
28 | #include "oprof.h" | 28 | #include "oprof.h" |
29 | 29 | ||
30 | struct oprofile_cpu_buffer cpu_buffer[NR_CPUS] __cacheline_aligned; | 30 | DEFINE_PER_CPU_SHARED_ALIGNED(struct oprofile_cpu_buffer, cpu_buffer); |
31 | 31 | ||
32 | static void wq_sync_buffer(struct work_struct *work); | 32 | static void wq_sync_buffer(struct work_struct *work); |
33 | 33 | ||
@@ -39,7 +39,7 @@ void free_cpu_buffers(void) | |||
39 | int i; | 39 | int i; |
40 | 40 | ||
41 | for_each_online_cpu(i) | 41 | for_each_online_cpu(i) |
42 | vfree(cpu_buffer[i].buffer); | 42 | vfree(per_cpu(cpu_buffer, i).buffer); |
43 | } | 43 | } |
44 | 44 | ||
45 | int alloc_cpu_buffers(void) | 45 | int alloc_cpu_buffers(void) |
@@ -49,7 +49,7 @@ int alloc_cpu_buffers(void) | |||
49 | unsigned long buffer_size = fs_cpu_buffer_size; | 49 | unsigned long buffer_size = fs_cpu_buffer_size; |
50 | 50 | ||
51 | for_each_online_cpu(i) { | 51 | for_each_online_cpu(i) { |
52 | struct oprofile_cpu_buffer * b = &cpu_buffer[i]; | 52 | struct oprofile_cpu_buffer *b = &per_cpu(cpu_buffer, i); |
53 | 53 | ||
54 | b->buffer = vmalloc_node(sizeof(struct op_sample) * buffer_size, | 54 | b->buffer = vmalloc_node(sizeof(struct op_sample) * buffer_size, |
55 | cpu_to_node(i)); | 55 | cpu_to_node(i)); |
@@ -83,7 +83,7 @@ void start_cpu_work(void) | |||
83 | work_enabled = 1; | 83 | work_enabled = 1; |
84 | 84 | ||
85 | for_each_online_cpu(i) { | 85 | for_each_online_cpu(i) { |
86 | struct oprofile_cpu_buffer * b = &cpu_buffer[i]; | 86 | struct oprofile_cpu_buffer *b = &per_cpu(cpu_buffer, i); |
87 | 87 | ||
88 | /* | 88 | /* |
89 | * Spread the work by 1 jiffy per cpu so they dont all | 89 | * Spread the work by 1 jiffy per cpu so they dont all |
@@ -100,7 +100,7 @@ void end_cpu_work(void) | |||
100 | work_enabled = 0; | 100 | work_enabled = 0; |
101 | 101 | ||
102 | for_each_online_cpu(i) { | 102 | for_each_online_cpu(i) { |
103 | struct oprofile_cpu_buffer * b = &cpu_buffer[i]; | 103 | struct oprofile_cpu_buffer *b = &per_cpu(cpu_buffer, i); |
104 | 104 | ||
105 | cancel_delayed_work(&b->work); | 105 | cancel_delayed_work(&b->work); |
106 | } | 106 | } |
@@ -227,7 +227,7 @@ static void oprofile_end_trace(struct oprofile_cpu_buffer * cpu_buf) | |||
227 | void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs, | 227 | void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs, |
228 | unsigned long event, int is_kernel) | 228 | unsigned long event, int is_kernel) |
229 | { | 229 | { |
230 | struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()]; | 230 | struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(cpu_buffer); |
231 | 231 | ||
232 | if (!backtrace_depth) { | 232 | if (!backtrace_depth) { |
233 | log_sample(cpu_buf, pc, is_kernel, event); | 233 | log_sample(cpu_buf, pc, is_kernel, event); |
@@ -254,13 +254,13 @@ void oprofile_add_sample(struct pt_regs * const regs, unsigned long event) | |||
254 | 254 | ||
255 | void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event) | 255 | void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event) |
256 | { | 256 | { |
257 | struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()]; | 257 | struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(cpu_buffer); |
258 | log_sample(cpu_buf, pc, is_kernel, event); | 258 | log_sample(cpu_buf, pc, is_kernel, event); |
259 | } | 259 | } |
260 | 260 | ||
261 | void oprofile_add_trace(unsigned long pc) | 261 | void oprofile_add_trace(unsigned long pc) |
262 | { | 262 | { |
263 | struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()]; | 263 | struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(cpu_buffer); |
264 | 264 | ||
265 | if (!cpu_buf->tracing) | 265 | if (!cpu_buf->tracing) |
266 | return; | 266 | return; |
diff --git a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h index c66c025abe75..13588174311d 100644 --- a/drivers/oprofile/cpu_buffer.h +++ b/drivers/oprofile/cpu_buffer.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
15 | #include <linux/workqueue.h> | 15 | #include <linux/workqueue.h> |
16 | #include <linux/cache.h> | 16 | #include <linux/cache.h> |
17 | #include <linux/sched.h> | ||
17 | 18 | ||
18 | struct task_struct; | 19 | struct task_struct; |
19 | 20 | ||
@@ -47,7 +48,7 @@ struct oprofile_cpu_buffer { | |||
47 | struct delayed_work work; | 48 | struct delayed_work work; |
48 | } ____cacheline_aligned; | 49 | } ____cacheline_aligned; |
49 | 50 | ||
50 | extern struct oprofile_cpu_buffer cpu_buffer[]; | 51 | DECLARE_PER_CPU(struct oprofile_cpu_buffer, cpu_buffer); |
51 | 52 | ||
52 | void cpu_buffer_reset(struct oprofile_cpu_buffer * cpu_buf); | 53 | void cpu_buffer_reset(struct oprofile_cpu_buffer * cpu_buf); |
53 | 54 | ||
diff --git a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c index d1f6d776e9e4..f99b28e7b79a 100644 --- a/drivers/oprofile/oprofile_stats.c +++ b/drivers/oprofile/oprofile_stats.c | |||
@@ -23,7 +23,7 @@ void oprofile_reset_stats(void) | |||
23 | int i; | 23 | int i; |
24 | 24 | ||
25 | for_each_possible_cpu(i) { | 25 | for_each_possible_cpu(i) { |
26 | cpu_buf = &cpu_buffer[i]; | 26 | cpu_buf = &per_cpu(cpu_buffer, i); |
27 | cpu_buf->sample_received = 0; | 27 | cpu_buf->sample_received = 0; |
28 | cpu_buf->sample_lost_overflow = 0; | 28 | cpu_buf->sample_lost_overflow = 0; |
29 | cpu_buf->backtrace_aborted = 0; | 29 | cpu_buf->backtrace_aborted = 0; |
@@ -49,7 +49,7 @@ void oprofile_create_stats_files(struct super_block * sb, struct dentry * root) | |||
49 | return; | 49 | return; |
50 | 50 | ||
51 | for_each_possible_cpu(i) { | 51 | for_each_possible_cpu(i) { |
52 | cpu_buf = &cpu_buffer[i]; | 52 | cpu_buf = &per_cpu(cpu_buffer, i); |
53 | snprintf(buf, 10, "cpu%d", i); | 53 | snprintf(buf, 10, "cpu%d", i); |
54 | cpudir = oprofilefs_mkdir(sb, dir, buf); | 54 | cpudir = oprofilefs_mkdir(sb, dir, buf); |
55 | 55 | ||
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index 12a1645a2e43..e85cbf116db1 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c | |||
@@ -167,7 +167,7 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state) | |||
167 | return error; | 167 | return error; |
168 | } | 168 | } |
169 | 169 | ||
170 | if (pnp_dev->protocol && pnp_dev->protocol->suspend) | 170 | if (pnp_dev->protocol->suspend) |
171 | pnp_dev->protocol->suspend(pnp_dev, state); | 171 | pnp_dev->protocol->suspend(pnp_dev, state); |
172 | return 0; | 172 | return 0; |
173 | } | 173 | } |
@@ -181,7 +181,7 @@ static int pnp_bus_resume(struct device *dev) | |||
181 | if (!pnp_drv) | 181 | if (!pnp_drv) |
182 | return 0; | 182 | return 0; |
183 | 183 | ||
184 | if (pnp_dev->protocol && pnp_dev->protocol->resume) | 184 | if (pnp_dev->protocol->resume) |
185 | pnp_dev->protocol->resume(pnp_dev); | 185 | pnp_dev->protocol->resume(pnp_dev); |
186 | 186 | ||
187 | if (pnp_can_write(pnp_dev)) { | 187 | if (pnp_can_write(pnp_dev)) { |
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c index 37993206ae5d..e4daf4635c48 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c | |||
@@ -49,8 +49,11 @@ static void quirk_awe32_resources(struct pnp_dev *dev) | |||
49 | port2->max += 0x400; | 49 | port2->max += 0x400; |
50 | port3->min += 0x800; | 50 | port3->min += 0x800; |
51 | port3->max += 0x800; | 51 | port3->max += 0x800; |
52 | dev_info(&dev->dev, | ||
53 | "AWE32 quirk - added ioports 0x%lx and 0x%lx\n", | ||
54 | (unsigned long)port2->min, | ||
55 | (unsigned long)port3->min); | ||
52 | } | 56 | } |
53 | printk(KERN_INFO "pnp: AWE32 quirk - adding two ports\n"); | ||
54 | } | 57 | } |
55 | 58 | ||
56 | static void quirk_cmi8330_resources(struct pnp_dev *dev) | 59 | static void quirk_cmi8330_resources(struct pnp_dev *dev) |
@@ -73,7 +76,8 @@ static void quirk_cmi8330_resources(struct pnp_dev *dev) | |||
73 | IORESOURCE_DMA_8BIT) | 76 | IORESOURCE_DMA_8BIT) |
74 | dma->map = 0x000A; | 77 | dma->map = 0x000A; |
75 | } | 78 | } |
76 | printk(KERN_INFO "pnp: CMI8330 quirk - fixing interrupts and dma\n"); | 79 | dev_info(&dev->dev, "CMI8330 quirk - forced possible IRQs to 5, 7, 10 " |
80 | "and DMA channels to 1, 3\n"); | ||
77 | } | 81 | } |
78 | 82 | ||
79 | static void quirk_sb16audio_resources(struct pnp_dev *dev) | 83 | static void quirk_sb16audio_resources(struct pnp_dev *dev) |
@@ -104,8 +108,7 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev) | |||
104 | changed = 1; | 108 | changed = 1; |
105 | } | 109 | } |
106 | if (changed) | 110 | if (changed) |
107 | printk(KERN_INFO | 111 | dev_info(&dev->dev, "SB audio device quirk - increased port range\n"); |
108 | "pnp: SB audio device quirk - increasing port range\n"); | ||
109 | } | 112 | } |
110 | 113 | ||
111 | 114 | ||
@@ -214,8 +217,8 @@ void pnp_fixup_device(struct pnp_dev *dev) | |||
214 | quirk = pnp_fixups[i].quirk_function; | 217 | quirk = pnp_fixups[i].quirk_function; |
215 | 218 | ||
216 | #ifdef DEBUG | 219 | #ifdef DEBUG |
217 | dev_dbg(&dev->dev, "calling quirk 0x%p", quirk); | 220 | dev_dbg(&dev->dev, "calling "); |
218 | print_fn_descriptor_symbol(": %s()\n", | 221 | print_fn_descriptor_symbol("%s()\n", |
219 | (unsigned long) *quirk); | 222 | (unsigned long) *quirk); |
220 | #endif | 223 | #endif |
221 | (*quirk)(dev); | 224 | (*quirk)(dev); |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 02a4c8cf2b2d..6cc2c0330230 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -20,10 +20,6 @@ menuconfig RTC_CLASS | |||
20 | 20 | ||
21 | if RTC_CLASS | 21 | if RTC_CLASS |
22 | 22 | ||
23 | if GEN_RTC || RTC | ||
24 | comment "Conflicting RTC option has been selected, check GEN_RTC and RTC" | ||
25 | endif | ||
26 | |||
27 | config RTC_HCTOSYS | 23 | config RTC_HCTOSYS |
28 | bool "Set system time from RTC on startup and resume" | 24 | bool "Set system time from RTC on startup and resume" |
29 | depends on RTC_CLASS = y | 25 | depends on RTC_CLASS = y |
@@ -304,6 +300,7 @@ comment "Platform RTC drivers" | |||
304 | config RTC_DRV_CMOS | 300 | config RTC_DRV_CMOS |
305 | tristate "PC-style 'CMOS'" | 301 | tristate "PC-style 'CMOS'" |
306 | depends on X86 || ALPHA || ARM || M32R || ATARI || PPC || MIPS | 302 | depends on X86 || ALPHA || ARM || M32R || ATARI || PPC || MIPS |
303 | default y if X86 | ||
307 | help | 304 | help |
308 | Say "yes" here to get direct support for the real time clock | 305 | Say "yes" here to get direct support for the real time clock |
309 | found in every PC or ACPI-based system, and some other boards. | 306 | found in every PC or ACPI-based system, and some other boards. |
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index 52abffc86bcd..39e64ab1ecb7 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c | |||
@@ -83,7 +83,7 @@ static int at91_rtc_readtime(struct device *dev, struct rtc_time *tm) | |||
83 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); | 83 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); |
84 | tm->tm_year = tm->tm_year - 1900; | 84 | tm->tm_year = tm->tm_year - 1900; |
85 | 85 | ||
86 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __FUNCTION__, | 86 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, |
87 | 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, | 87 | 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, |
88 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 88 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
89 | 89 | ||
@@ -97,7 +97,7 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
97 | { | 97 | { |
98 | unsigned long cr; | 98 | unsigned long cr; |
99 | 99 | ||
100 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __FUNCTION__, | 100 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, |
101 | 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, | 101 | 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, |
102 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 102 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
103 | 103 | ||
@@ -142,7 +142,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
142 | alrm->enabled = (at91_sys_read(AT91_RTC_IMR) & AT91_RTC_ALARM) | 142 | alrm->enabled = (at91_sys_read(AT91_RTC_IMR) & AT91_RTC_ALARM) |
143 | ? 1 : 0; | 143 | ? 1 : 0; |
144 | 144 | ||
145 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __FUNCTION__, | 145 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, |
146 | 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, | 146 | 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, |
147 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 147 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
148 | 148 | ||
@@ -178,7 +178,7 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
178 | if (alrm->enabled) | 178 | if (alrm->enabled) |
179 | at91_sys_write(AT91_RTC_IER, AT91_RTC_ALARM); | 179 | at91_sys_write(AT91_RTC_IER, AT91_RTC_ALARM); |
180 | 180 | ||
181 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __FUNCTION__, | 181 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, |
182 | at91_alarm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, | 182 | at91_alarm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, |
183 | tm.tm_min, tm.tm_sec); | 183 | tm.tm_min, tm.tm_sec); |
184 | 184 | ||
@@ -193,7 +193,7 @@ static int at91_rtc_ioctl(struct device *dev, unsigned int cmd, | |||
193 | { | 193 | { |
194 | int ret = 0; | 194 | int ret = 0; |
195 | 195 | ||
196 | pr_debug("%s(): cmd=%08x, arg=%08lx.\n", __FUNCTION__, cmd, arg); | 196 | pr_debug("%s(): cmd=%08x, arg=%08lx.\n", __func__, cmd, arg); |
197 | 197 | ||
198 | switch (cmd) { | 198 | switch (cmd) { |
199 | case RTC_AIE_OFF: /* alarm off */ | 199 | case RTC_AIE_OFF: /* alarm off */ |
@@ -265,7 +265,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) | |||
265 | 265 | ||
266 | rtc_update_irq(rtc, 1, events); | 266 | rtc_update_irq(rtc, 1, events); |
267 | 267 | ||
268 | pr_debug("%s(): num=%ld, events=0x%02lx\n", __FUNCTION__, | 268 | pr_debug("%s(): num=%ld, events=0x%02lx\n", __func__, |
269 | events >> 8, events & 0x000000FF); | 269 | events >> 8, events & 0x000000FF); |
270 | 270 | ||
271 | return IRQ_HANDLED; | 271 | return IRQ_HANDLED; |
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 56728a2a3385..38d8742a4bdf 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -288,7 +288,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *_rtc) | |||
288 | 288 | ||
289 | rtc_update_irq(rtc->rtcdev, 1, events); | 289 | rtc_update_irq(rtc->rtcdev, 1, events); |
290 | 290 | ||
291 | pr_debug("%s: num=%ld, events=0x%02lx\n", __FUNCTION__, | 291 | pr_debug("%s: num=%ld, events=0x%02lx\n", __func__, |
292 | events >> 8, events & 0x000000FF); | 292 | events >> 8, events & 0x000000FF); |
293 | 293 | ||
294 | return IRQ_HANDLED; | 294 | return IRQ_HANDLED; |
diff --git a/drivers/rtc/rtc-ds1302.c b/drivers/rtc/rtc-ds1302.c index 7b002ceeaa7d..b9397818f73a 100644 --- a/drivers/rtc/rtc-ds1302.c +++ b/drivers/rtc/rtc-ds1302.c | |||
@@ -122,7 +122,7 @@ static int ds1302_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
122 | 122 | ||
123 | dev_dbg(dev, "%s: tm is secs=%d, mins=%d, hours=%d, " | 123 | dev_dbg(dev, "%s: tm is secs=%d, mins=%d, hours=%d, " |
124 | "mday=%d, mon=%d, year=%d, wday=%d\n", | 124 | "mday=%d, mon=%d, year=%d, wday=%d\n", |
125 | __FUNCTION__, | 125 | __func__, |
126 | tm->tm_sec, tm->tm_min, tm->tm_hour, | 126 | tm->tm_sec, tm->tm_min, tm->tm_hour, |
127 | tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday); | 127 | tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday); |
128 | 128 | ||
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c index d08912f18ddd..a83a40b3ebaa 100644 --- a/drivers/rtc/rtc-ds1511.c +++ b/drivers/rtc/rtc-ds1511.c | |||
@@ -181,8 +181,7 @@ ds1511_wdog_disable(void) | |||
181 | * stupidly, some callers call with year unmolested; | 181 | * stupidly, some callers call with year unmolested; |
182 | * and some call with year = year - 1900. thanks. | 182 | * and some call with year = year - 1900. thanks. |
183 | */ | 183 | */ |
184 | int | 184 | static int ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm) |
185 | ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm) | ||
186 | { | 185 | { |
187 | u8 mon, day, dow, hrs, min, sec, yrs, cen; | 186 | u8 mon, day, dow, hrs, min, sec, yrs, cen; |
188 | unsigned int flags; | 187 | unsigned int flags; |
@@ -245,8 +244,7 @@ ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm) | |||
245 | return 0; | 244 | return 0; |
246 | } | 245 | } |
247 | 246 | ||
248 | int | 247 | static int ds1511_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm) |
249 | ds1511_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm) | ||
250 | { | 248 | { |
251 | unsigned int century; | 249 | unsigned int century; |
252 | unsigned int flags; | 250 | unsigned int flags; |
diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c index e0900ca678ec..6fa4556f5f5c 100644 --- a/drivers/rtc/rtc-ds1672.c +++ b/drivers/rtc/rtc-ds1672.c | |||
@@ -50,13 +50,13 @@ static int ds1672_get_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
50 | 50 | ||
51 | /* read date registers */ | 51 | /* read date registers */ |
52 | if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) { | 52 | if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) { |
53 | dev_err(&client->dev, "%s: read error\n", __FUNCTION__); | 53 | dev_err(&client->dev, "%s: read error\n", __func__); |
54 | return -EIO; | 54 | return -EIO; |
55 | } | 55 | } |
56 | 56 | ||
57 | dev_dbg(&client->dev, | 57 | dev_dbg(&client->dev, |
58 | "%s: raw read data - counters=%02x,%02x,%02x,%02x\n", | 58 | "%s: raw read data - counters=%02x,%02x,%02x,%02x\n", |
59 | __FUNCTION__, buf[0], buf[1], buf[2], buf[3]); | 59 | __func__, buf[0], buf[1], buf[2], buf[3]); |
60 | 60 | ||
61 | time = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; | 61 | time = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; |
62 | 62 | ||
@@ -64,7 +64,7 @@ static int ds1672_get_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
64 | 64 | ||
65 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " | 65 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " |
66 | "mday=%d, mon=%d, year=%d, wday=%d\n", | 66 | "mday=%d, mon=%d, year=%d, wday=%d\n", |
67 | __FUNCTION__, tm->tm_sec, tm->tm_min, tm->tm_hour, | 67 | __func__, tm->tm_sec, tm->tm_min, tm->tm_hour, |
68 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); | 68 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); |
69 | 69 | ||
70 | return 0; | 70 | return 0; |
@@ -84,7 +84,7 @@ static int ds1672_set_mmss(struct i2c_client *client, unsigned long secs) | |||
84 | 84 | ||
85 | xfer = i2c_master_send(client, buf, 6); | 85 | xfer = i2c_master_send(client, buf, 6); |
86 | if (xfer != 6) { | 86 | if (xfer != 6) { |
87 | dev_err(&client->dev, "%s: send: %d\n", __FUNCTION__, xfer); | 87 | dev_err(&client->dev, "%s: send: %d\n", __func__, xfer); |
88 | return -EIO; | 88 | return -EIO; |
89 | } | 89 | } |
90 | 90 | ||
@@ -98,7 +98,7 @@ static int ds1672_set_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
98 | dev_dbg(&client->dev, | 98 | dev_dbg(&client->dev, |
99 | "%s: secs=%d, mins=%d, hours=%d, " | 99 | "%s: secs=%d, mins=%d, hours=%d, " |
100 | "mday=%d, mon=%d, year=%d, wday=%d\n", | 100 | "mday=%d, mon=%d, year=%d, wday=%d\n", |
101 | __FUNCTION__, | 101 | __func__, |
102 | tm->tm_sec, tm->tm_min, tm->tm_hour, | 102 | tm->tm_sec, tm->tm_min, tm->tm_hour, |
103 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); | 103 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); |
104 | 104 | ||
@@ -133,7 +133,7 @@ static int ds1672_get_control(struct i2c_client *client, u8 *status) | |||
133 | 133 | ||
134 | /* read control register */ | 134 | /* read control register */ |
135 | if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) { | 135 | if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) { |
136 | dev_err(&client->dev, "%s: read error\n", __FUNCTION__); | 136 | dev_err(&client->dev, "%s: read error\n", __func__); |
137 | return -EIO; | 137 | return -EIO; |
138 | } | 138 | } |
139 | 139 | ||
@@ -199,7 +199,7 @@ static int ds1672_probe(struct i2c_adapter *adapter, int address, int kind) | |||
199 | struct i2c_client *client; | 199 | struct i2c_client *client; |
200 | struct rtc_device *rtc; | 200 | struct rtc_device *rtc; |
201 | 201 | ||
202 | dev_dbg(&adapter->dev, "%s\n", __FUNCTION__); | 202 | dev_dbg(&adapter->dev, "%s\n", __func__); |
203 | 203 | ||
204 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { | 204 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { |
205 | err = -ENODEV; | 205 | err = -ENODEV; |
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index 725b0c73c333..fb15e3fb4ce2 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c | |||
@@ -15,16 +15,15 @@ | |||
15 | #include <linux/bcd.h> | 15 | #include <linux/bcd.h> |
16 | #include <linux/rtc.h> | 16 | #include <linux/rtc.h> |
17 | 17 | ||
18 | #define DRV_NAME "isl1208" | 18 | #define DRV_VERSION "0.3" |
19 | #define DRV_VERSION "0.2" | ||
20 | 19 | ||
21 | /* Register map */ | 20 | /* Register map */ |
22 | /* rtc section */ | 21 | /* rtc section */ |
23 | #define ISL1208_REG_SC 0x00 | 22 | #define ISL1208_REG_SC 0x00 |
24 | #define ISL1208_REG_MN 0x01 | 23 | #define ISL1208_REG_MN 0x01 |
25 | #define ISL1208_REG_HR 0x02 | 24 | #define ISL1208_REG_HR 0x02 |
26 | #define ISL1208_REG_HR_MIL (1<<7) /* 24h/12h mode */ | 25 | #define ISL1208_REG_HR_MIL (1<<7) /* 24h/12h mode */ |
27 | #define ISL1208_REG_HR_PM (1<<5) /* PM/AM bit in 12h mode */ | 26 | #define ISL1208_REG_HR_PM (1<<5) /* PM/AM bit in 12h mode */ |
28 | #define ISL1208_REG_DT 0x03 | 27 | #define ISL1208_REG_DT 0x03 |
29 | #define ISL1208_REG_MO 0x04 | 28 | #define ISL1208_REG_MO 0x04 |
30 | #define ISL1208_REG_YR 0x05 | 29 | #define ISL1208_REG_YR 0x05 |
@@ -33,14 +32,14 @@ | |||
33 | 32 | ||
34 | /* control/status section */ | 33 | /* control/status section */ |
35 | #define ISL1208_REG_SR 0x07 | 34 | #define ISL1208_REG_SR 0x07 |
36 | #define ISL1208_REG_SR_ARST (1<<7) /* auto reset */ | 35 | #define ISL1208_REG_SR_ARST (1<<7) /* auto reset */ |
37 | #define ISL1208_REG_SR_XTOSCB (1<<6) /* crystal oscillator */ | 36 | #define ISL1208_REG_SR_XTOSCB (1<<6) /* crystal oscillator */ |
38 | #define ISL1208_REG_SR_WRTC (1<<4) /* write rtc */ | 37 | #define ISL1208_REG_SR_WRTC (1<<4) /* write rtc */ |
39 | #define ISL1208_REG_SR_ALM (1<<2) /* alarm */ | 38 | #define ISL1208_REG_SR_ALM (1<<2) /* alarm */ |
40 | #define ISL1208_REG_SR_BAT (1<<1) /* battery */ | 39 | #define ISL1208_REG_SR_BAT (1<<1) /* battery */ |
41 | #define ISL1208_REG_SR_RTCF (1<<0) /* rtc fail */ | 40 | #define ISL1208_REG_SR_RTCF (1<<0) /* rtc fail */ |
42 | #define ISL1208_REG_INT 0x08 | 41 | #define ISL1208_REG_INT 0x08 |
43 | #define ISL1208_REG_09 0x09 /* reserved */ | 42 | #define ISL1208_REG_09 0x09 /* reserved */ |
44 | #define ISL1208_REG_ATR 0x0a | 43 | #define ISL1208_REG_ATR 0x0a |
45 | #define ISL1208_REG_DTR 0x0b | 44 | #define ISL1208_REG_DTR 0x0b |
46 | 45 | ||
@@ -58,39 +57,21 @@ | |||
58 | #define ISL1208_REG_USR2 0x13 | 57 | #define ISL1208_REG_USR2 0x13 |
59 | #define ISL1208_USR_SECTION_LEN 2 | 58 | #define ISL1208_USR_SECTION_LEN 2 |
60 | 59 | ||
61 | /* i2c configuration */ | 60 | static struct i2c_driver isl1208_driver; |
62 | #define ISL1208_I2C_ADDR 0xde | ||
63 | |||
64 | static const unsigned short normal_i2c[] = { | ||
65 | ISL1208_I2C_ADDR>>1, I2C_CLIENT_END | ||
66 | }; | ||
67 | I2C_CLIENT_INSMOD; /* defines addr_data */ | ||
68 | |||
69 | static int isl1208_attach_adapter(struct i2c_adapter *adapter); | ||
70 | static int isl1208_detach_client(struct i2c_client *client); | ||
71 | |||
72 | static struct i2c_driver isl1208_driver = { | ||
73 | .driver = { | ||
74 | .name = DRV_NAME, | ||
75 | }, | ||
76 | .id = I2C_DRIVERID_ISL1208, | ||
77 | .attach_adapter = &isl1208_attach_adapter, | ||
78 | .detach_client = &isl1208_detach_client, | ||
79 | }; | ||
80 | 61 | ||
81 | /* block read */ | 62 | /* block read */ |
82 | static int | 63 | static int |
83 | isl1208_i2c_read_regs(struct i2c_client *client, u8 reg, u8 buf[], | 64 | isl1208_i2c_read_regs(struct i2c_client *client, u8 reg, u8 buf[], |
84 | unsigned len) | 65 | unsigned len) |
85 | { | 66 | { |
86 | u8 reg_addr[1] = { reg }; | 67 | u8 reg_addr[1] = { reg }; |
87 | struct i2c_msg msgs[2] = { | 68 | struct i2c_msg msgs[2] = { |
88 | { client->addr, client->flags, sizeof(reg_addr), reg_addr }, | 69 | {client->addr, 0, sizeof(reg_addr), reg_addr} |
89 | { client->addr, client->flags | I2C_M_RD, len, buf } | 70 | , |
71 | {client->addr, I2C_M_RD, len, buf} | ||
90 | }; | 72 | }; |
91 | int ret; | 73 | int ret; |
92 | 74 | ||
93 | BUG_ON(len == 0); | ||
94 | BUG_ON(reg > ISL1208_REG_USR2); | 75 | BUG_ON(reg > ISL1208_REG_USR2); |
95 | BUG_ON(reg + len > ISL1208_REG_USR2 + 1); | 76 | BUG_ON(reg + len > ISL1208_REG_USR2 + 1); |
96 | 77 | ||
@@ -103,15 +84,14 @@ isl1208_i2c_read_regs(struct i2c_client *client, u8 reg, u8 buf[], | |||
103 | /* block write */ | 84 | /* block write */ |
104 | static int | 85 | static int |
105 | isl1208_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[], | 86 | isl1208_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[], |
106 | unsigned len) | 87 | unsigned len) |
107 | { | 88 | { |
108 | u8 i2c_buf[ISL1208_REG_USR2 + 2]; | 89 | u8 i2c_buf[ISL1208_REG_USR2 + 2]; |
109 | struct i2c_msg msgs[1] = { | 90 | struct i2c_msg msgs[1] = { |
110 | { client->addr, client->flags, len + 1, i2c_buf } | 91 | {client->addr, 0, len + 1, i2c_buf} |
111 | }; | 92 | }; |
112 | int ret; | 93 | int ret; |
113 | 94 | ||
114 | BUG_ON(len == 0); | ||
115 | BUG_ON(reg > ISL1208_REG_USR2); | 95 | BUG_ON(reg > ISL1208_REG_USR2); |
116 | BUG_ON(reg + len > ISL1208_REG_USR2 + 1); | 96 | BUG_ON(reg + len > ISL1208_REG_USR2 + 1); |
117 | 97 | ||
@@ -125,7 +105,8 @@ isl1208_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[], | |||
125 | } | 105 | } |
126 | 106 | ||
127 | /* simple check to see wether we have a isl1208 */ | 107 | /* simple check to see wether we have a isl1208 */ |
128 | static int isl1208_i2c_validate_client(struct i2c_client *client) | 108 | static int |
109 | isl1208_i2c_validate_client(struct i2c_client *client) | ||
129 | { | 110 | { |
130 | u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; | 111 | u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; |
131 | u8 zero_mask[ISL1208_RTC_SECTION_LEN] = { | 112 | u8 zero_mask[ISL1208_RTC_SECTION_LEN] = { |
@@ -139,24 +120,29 @@ static int isl1208_i2c_validate_client(struct i2c_client *client) | |||
139 | return ret; | 120 | return ret; |
140 | 121 | ||
141 | for (i = 0; i < ISL1208_RTC_SECTION_LEN; ++i) { | 122 | for (i = 0; i < ISL1208_RTC_SECTION_LEN; ++i) { |
142 | if (regs[i] & zero_mask[i]) /* check if bits are cleared */ | 123 | if (regs[i] & zero_mask[i]) /* check if bits are cleared */ |
143 | return -ENODEV; | 124 | return -ENODEV; |
144 | } | 125 | } |
145 | 126 | ||
146 | return 0; | 127 | return 0; |
147 | } | 128 | } |
148 | 129 | ||
149 | static int isl1208_i2c_get_sr(struct i2c_client *client) | 130 | static int |
131 | isl1208_i2c_get_sr(struct i2c_client *client) | ||
150 | { | 132 | { |
151 | return i2c_smbus_read_byte_data(client, ISL1208_REG_SR) == -1 ? -EIO:0; | 133 | int sr = i2c_smbus_read_byte_data(client, ISL1208_REG_SR); |
134 | if (sr < 0) | ||
135 | return -EIO; | ||
136 | |||
137 | return sr; | ||
152 | } | 138 | } |
153 | 139 | ||
154 | static int isl1208_i2c_get_atr(struct i2c_client *client) | 140 | static int |
141 | isl1208_i2c_get_atr(struct i2c_client *client) | ||
155 | { | 142 | { |
156 | int atr = i2c_smbus_read_byte_data(client, ISL1208_REG_ATR); | 143 | int atr = i2c_smbus_read_byte_data(client, ISL1208_REG_ATR); |
157 | |||
158 | if (atr < 0) | 144 | if (atr < 0) |
159 | return -EIO; | 145 | return atr; |
160 | 146 | ||
161 | /* The 6bit value in the ATR register controls the load | 147 | /* The 6bit value in the ATR register controls the load |
162 | * capacitance C_load * in steps of 0.25pF | 148 | * capacitance C_load * in steps of 0.25pF |
@@ -169,51 +155,54 @@ static int isl1208_i2c_get_atr(struct i2c_client *client) | |||
169 | * | 155 | * |
170 | */ | 156 | */ |
171 | 157 | ||
172 | atr &= 0x3f; /* mask out lsb */ | 158 | atr &= 0x3f; /* mask out lsb */ |
173 | atr ^= 1<<5; /* invert 6th bit */ | 159 | atr ^= 1 << 5; /* invert 6th bit */ |
174 | atr += 2*9; /* add offset of 4.5pF; unit[atr] = 0.25pF */ | 160 | atr += 2 * 9; /* add offset of 4.5pF; unit[atr] = 0.25pF */ |
175 | 161 | ||
176 | return atr; | 162 | return atr; |
177 | } | 163 | } |
178 | 164 | ||
179 | static int isl1208_i2c_get_dtr(struct i2c_client *client) | 165 | static int |
166 | isl1208_i2c_get_dtr(struct i2c_client *client) | ||
180 | { | 167 | { |
181 | int dtr = i2c_smbus_read_byte_data(client, ISL1208_REG_DTR); | 168 | int dtr = i2c_smbus_read_byte_data(client, ISL1208_REG_DTR); |
182 | |||
183 | if (dtr < 0) | 169 | if (dtr < 0) |
184 | return -EIO; | 170 | return -EIO; |
185 | 171 | ||
186 | /* dtr encodes adjustments of {-60,-40,-20,0,20,40,60} ppm */ | 172 | /* dtr encodes adjustments of {-60,-40,-20,0,20,40,60} ppm */ |
187 | dtr = ((dtr & 0x3) * 20) * (dtr & (1<<2) ? -1 : 1); | 173 | dtr = ((dtr & 0x3) * 20) * (dtr & (1 << 2) ? -1 : 1); |
188 | 174 | ||
189 | return dtr; | 175 | return dtr; |
190 | } | 176 | } |
191 | 177 | ||
192 | static int isl1208_i2c_get_usr(struct i2c_client *client) | 178 | static int |
179 | isl1208_i2c_get_usr(struct i2c_client *client) | ||
193 | { | 180 | { |
194 | u8 buf[ISL1208_USR_SECTION_LEN] = { 0, }; | 181 | u8 buf[ISL1208_USR_SECTION_LEN] = { 0, }; |
195 | int ret; | 182 | int ret; |
196 | 183 | ||
197 | ret = isl1208_i2c_read_regs (client, ISL1208_REG_USR1, buf, | 184 | ret = isl1208_i2c_read_regs(client, ISL1208_REG_USR1, buf, |
198 | ISL1208_USR_SECTION_LEN); | 185 | ISL1208_USR_SECTION_LEN); |
199 | if (ret < 0) | 186 | if (ret < 0) |
200 | return ret; | 187 | return ret; |
201 | 188 | ||
202 | return (buf[1] << 8) | buf[0]; | 189 | return (buf[1] << 8) | buf[0]; |
203 | } | 190 | } |
204 | 191 | ||
205 | static int isl1208_i2c_set_usr(struct i2c_client *client, u16 usr) | 192 | static int |
193 | isl1208_i2c_set_usr(struct i2c_client *client, u16 usr) | ||
206 | { | 194 | { |
207 | u8 buf[ISL1208_USR_SECTION_LEN]; | 195 | u8 buf[ISL1208_USR_SECTION_LEN]; |
208 | 196 | ||
209 | buf[0] = usr & 0xff; | 197 | buf[0] = usr & 0xff; |
210 | buf[1] = (usr >> 8) & 0xff; | 198 | buf[1] = (usr >> 8) & 0xff; |
211 | 199 | ||
212 | return isl1208_i2c_set_regs (client, ISL1208_REG_USR1, buf, | 200 | return isl1208_i2c_set_regs(client, ISL1208_REG_USR1, buf, |
213 | ISL1208_USR_SECTION_LEN); | 201 | ISL1208_USR_SECTION_LEN); |
214 | } | 202 | } |
215 | 203 | ||
216 | static int isl1208_rtc_proc(struct device *dev, struct seq_file *seq) | 204 | static int |
205 | isl1208_rtc_proc(struct device *dev, struct seq_file *seq) | ||
217 | { | 206 | { |
218 | struct i2c_client *const client = to_i2c_client(dev); | 207 | struct i2c_client *const client = to_i2c_client(dev); |
219 | int sr, dtr, atr, usr; | 208 | int sr, dtr, atr, usr; |
@@ -230,20 +219,19 @@ static int isl1208_rtc_proc(struct device *dev, struct seq_file *seq) | |||
230 | (sr & ISL1208_REG_SR_ALM) ? " ALM" : "", | 219 | (sr & ISL1208_REG_SR_ALM) ? " ALM" : "", |
231 | (sr & ISL1208_REG_SR_WRTC) ? " WRTC" : "", | 220 | (sr & ISL1208_REG_SR_WRTC) ? " WRTC" : "", |
232 | (sr & ISL1208_REG_SR_XTOSCB) ? " XTOSCB" : "", | 221 | (sr & ISL1208_REG_SR_XTOSCB) ? " XTOSCB" : "", |
233 | (sr & ISL1208_REG_SR_ARST) ? " ARST" : "", | 222 | (sr & ISL1208_REG_SR_ARST) ? " ARST" : "", sr); |
234 | sr); | ||
235 | 223 | ||
236 | seq_printf(seq, "batt_status\t: %s\n", | 224 | seq_printf(seq, "batt_status\t: %s\n", |
237 | (sr & ISL1208_REG_SR_RTCF) ? "bad" : "okay"); | 225 | (sr & ISL1208_REG_SR_RTCF) ? "bad" : "okay"); |
238 | 226 | ||
239 | dtr = isl1208_i2c_get_dtr(client); | 227 | dtr = isl1208_i2c_get_dtr(client); |
240 | if (dtr >= 0 -1) | 228 | if (dtr >= 0 - 1) |
241 | seq_printf(seq, "digital_trim\t: %d ppm\n", dtr); | 229 | seq_printf(seq, "digital_trim\t: %d ppm\n", dtr); |
242 | 230 | ||
243 | atr = isl1208_i2c_get_atr(client); | 231 | atr = isl1208_i2c_get_atr(client); |
244 | if (atr >= 0) | 232 | if (atr >= 0) |
245 | seq_printf(seq, "analog_trim\t: %d.%.2d pF\n", | 233 | seq_printf(seq, "analog_trim\t: %d.%.2d pF\n", |
246 | atr>>2, (atr&0x3)*25); | 234 | atr >> 2, (atr & 0x3) * 25); |
247 | 235 | ||
248 | usr = isl1208_i2c_get_usr(client); | 236 | usr = isl1208_i2c_get_usr(client); |
249 | if (usr >= 0) | 237 | if (usr >= 0) |
@@ -252,9 +240,8 @@ static int isl1208_rtc_proc(struct device *dev, struct seq_file *seq) | |||
252 | return 0; | 240 | return 0; |
253 | } | 241 | } |
254 | 242 | ||
255 | 243 | static int | |
256 | static int isl1208_i2c_read_time(struct i2c_client *client, | 244 | isl1208_i2c_read_time(struct i2c_client *client, struct rtc_time *tm) |
257 | struct rtc_time *tm) | ||
258 | { | 245 | { |
259 | int sr; | 246 | int sr; |
260 | u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; | 247 | u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; |
@@ -274,27 +261,30 @@ static int isl1208_i2c_read_time(struct i2c_client *client, | |||
274 | 261 | ||
275 | tm->tm_sec = BCD2BIN(regs[ISL1208_REG_SC]); | 262 | tm->tm_sec = BCD2BIN(regs[ISL1208_REG_SC]); |
276 | tm->tm_min = BCD2BIN(regs[ISL1208_REG_MN]); | 263 | tm->tm_min = BCD2BIN(regs[ISL1208_REG_MN]); |
277 | { /* HR field has a more complex interpretation */ | 264 | |
265 | /* HR field has a more complex interpretation */ | ||
266 | { | ||
278 | const u8 _hr = regs[ISL1208_REG_HR]; | 267 | const u8 _hr = regs[ISL1208_REG_HR]; |
279 | if (_hr & ISL1208_REG_HR_MIL) /* 24h format */ | 268 | if (_hr & ISL1208_REG_HR_MIL) /* 24h format */ |
280 | tm->tm_hour = BCD2BIN(_hr & 0x3f); | 269 | tm->tm_hour = BCD2BIN(_hr & 0x3f); |
281 | else { // 12h format | 270 | else { |
271 | /* 12h format */ | ||
282 | tm->tm_hour = BCD2BIN(_hr & 0x1f); | 272 | tm->tm_hour = BCD2BIN(_hr & 0x1f); |
283 | if (_hr & ISL1208_REG_HR_PM) /* PM flag set */ | 273 | if (_hr & ISL1208_REG_HR_PM) /* PM flag set */ |
284 | tm->tm_hour += 12; | 274 | tm->tm_hour += 12; |
285 | } | 275 | } |
286 | } | 276 | } |
287 | 277 | ||
288 | tm->tm_mday = BCD2BIN(regs[ISL1208_REG_DT]); | 278 | tm->tm_mday = BCD2BIN(regs[ISL1208_REG_DT]); |
289 | tm->tm_mon = BCD2BIN(regs[ISL1208_REG_MO]) - 1; /* rtc starts at 1 */ | 279 | tm->tm_mon = BCD2BIN(regs[ISL1208_REG_MO]) - 1; /* rtc starts at 1 */ |
290 | tm->tm_year = BCD2BIN(regs[ISL1208_REG_YR]) + 100; | 280 | tm->tm_year = BCD2BIN(regs[ISL1208_REG_YR]) + 100; |
291 | tm->tm_wday = BCD2BIN(regs[ISL1208_REG_DW]); | 281 | tm->tm_wday = BCD2BIN(regs[ISL1208_REG_DW]); |
292 | 282 | ||
293 | return 0; | 283 | return 0; |
294 | } | 284 | } |
295 | 285 | ||
296 | static int isl1208_i2c_read_alarm(struct i2c_client *client, | 286 | static int |
297 | struct rtc_wkalrm *alarm) | 287 | isl1208_i2c_read_alarm(struct i2c_client *client, struct rtc_wkalrm *alarm) |
298 | { | 288 | { |
299 | struct rtc_time *const tm = &alarm->time; | 289 | struct rtc_time *const tm = &alarm->time; |
300 | u8 regs[ISL1208_ALARM_SECTION_LEN] = { 0, }; | 290 | u8 regs[ISL1208_ALARM_SECTION_LEN] = { 0, }; |
@@ -307,7 +297,7 @@ static int isl1208_i2c_read_alarm(struct i2c_client *client, | |||
307 | } | 297 | } |
308 | 298 | ||
309 | sr = isl1208_i2c_read_regs(client, ISL1208_REG_SCA, regs, | 299 | sr = isl1208_i2c_read_regs(client, ISL1208_REG_SCA, regs, |
310 | ISL1208_ALARM_SECTION_LEN); | 300 | ISL1208_ALARM_SECTION_LEN); |
311 | if (sr < 0) { | 301 | if (sr < 0) { |
312 | dev_err(&client->dev, "%s: reading alarm section failed\n", | 302 | dev_err(&client->dev, "%s: reading alarm section failed\n", |
313 | __func__); | 303 | __func__); |
@@ -315,23 +305,25 @@ static int isl1208_i2c_read_alarm(struct i2c_client *client, | |||
315 | } | 305 | } |
316 | 306 | ||
317 | /* MSB of each alarm register is an enable bit */ | 307 | /* MSB of each alarm register is an enable bit */ |
318 | tm->tm_sec = BCD2BIN(regs[ISL1208_REG_SCA-ISL1208_REG_SCA] & 0x7f); | 308 | tm->tm_sec = BCD2BIN(regs[ISL1208_REG_SCA - ISL1208_REG_SCA] & 0x7f); |
319 | tm->tm_min = BCD2BIN(regs[ISL1208_REG_MNA-ISL1208_REG_SCA] & 0x7f); | 309 | tm->tm_min = BCD2BIN(regs[ISL1208_REG_MNA - ISL1208_REG_SCA] & 0x7f); |
320 | tm->tm_hour = BCD2BIN(regs[ISL1208_REG_HRA-ISL1208_REG_SCA] & 0x3f); | 310 | tm->tm_hour = BCD2BIN(regs[ISL1208_REG_HRA - ISL1208_REG_SCA] & 0x3f); |
321 | tm->tm_mday = BCD2BIN(regs[ISL1208_REG_DTA-ISL1208_REG_SCA] & 0x3f); | 311 | tm->tm_mday = BCD2BIN(regs[ISL1208_REG_DTA - ISL1208_REG_SCA] & 0x3f); |
322 | tm->tm_mon = BCD2BIN(regs[ISL1208_REG_MOA-ISL1208_REG_SCA] & 0x1f)-1; | 312 | tm->tm_mon = |
323 | tm->tm_wday = BCD2BIN(regs[ISL1208_REG_DWA-ISL1208_REG_SCA] & 0x03); | 313 | BCD2BIN(regs[ISL1208_REG_MOA - ISL1208_REG_SCA] & 0x1f) - 1; |
314 | tm->tm_wday = BCD2BIN(regs[ISL1208_REG_DWA - ISL1208_REG_SCA] & 0x03); | ||
324 | 315 | ||
325 | return 0; | 316 | return 0; |
326 | } | 317 | } |
327 | 318 | ||
328 | static int isl1208_rtc_read_time(struct device *dev, struct rtc_time *tm) | 319 | static int |
320 | isl1208_rtc_read_time(struct device *dev, struct rtc_time *tm) | ||
329 | { | 321 | { |
330 | return isl1208_i2c_read_time(to_i2c_client(dev), tm); | 322 | return isl1208_i2c_read_time(to_i2c_client(dev), tm); |
331 | } | 323 | } |
332 | 324 | ||
333 | static int isl1208_i2c_set_time(struct i2c_client *client, | 325 | static int |
334 | struct rtc_time const *tm) | 326 | isl1208_i2c_set_time(struct i2c_client *client, struct rtc_time const *tm) |
335 | { | 327 | { |
336 | int sr; | 328 | int sr; |
337 | u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; | 329 | u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; |
@@ -353,7 +345,7 @@ static int isl1208_i2c_set_time(struct i2c_client *client, | |||
353 | } | 345 | } |
354 | 346 | ||
355 | /* set WRTC */ | 347 | /* set WRTC */ |
356 | sr = i2c_smbus_write_byte_data (client, ISL1208_REG_SR, | 348 | sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, |
357 | sr | ISL1208_REG_SR_WRTC); | 349 | sr | ISL1208_REG_SR_WRTC); |
358 | if (sr < 0) { | 350 | if (sr < 0) { |
359 | dev_err(&client->dev, "%s: writing SR failed\n", __func__); | 351 | dev_err(&client->dev, "%s: writing SR failed\n", __func__); |
@@ -369,7 +361,7 @@ static int isl1208_i2c_set_time(struct i2c_client *client, | |||
369 | } | 361 | } |
370 | 362 | ||
371 | /* clear WRTC again */ | 363 | /* clear WRTC again */ |
372 | sr = i2c_smbus_write_byte_data (client, ISL1208_REG_SR, | 364 | sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, |
373 | sr & ~ISL1208_REG_SR_WRTC); | 365 | sr & ~ISL1208_REG_SR_WRTC); |
374 | if (sr < 0) { | 366 | if (sr < 0) { |
375 | dev_err(&client->dev, "%s: writing SR failed\n", __func__); | 367 | dev_err(&client->dev, "%s: writing SR failed\n", __func__); |
@@ -380,70 +372,69 @@ static int isl1208_i2c_set_time(struct i2c_client *client, | |||
380 | } | 372 | } |
381 | 373 | ||
382 | 374 | ||
383 | static int isl1208_rtc_set_time(struct device *dev, struct rtc_time *tm) | 375 | static int |
376 | isl1208_rtc_set_time(struct device *dev, struct rtc_time *tm) | ||
384 | { | 377 | { |
385 | return isl1208_i2c_set_time(to_i2c_client(dev), tm); | 378 | return isl1208_i2c_set_time(to_i2c_client(dev), tm); |
386 | } | 379 | } |
387 | 380 | ||
388 | static int isl1208_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | 381 | static int |
382 | isl1208_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | ||
389 | { | 383 | { |
390 | return isl1208_i2c_read_alarm(to_i2c_client(dev), alarm); | 384 | return isl1208_i2c_read_alarm(to_i2c_client(dev), alarm); |
391 | } | 385 | } |
392 | 386 | ||
393 | static const struct rtc_class_ops isl1208_rtc_ops = { | 387 | static const struct rtc_class_ops isl1208_rtc_ops = { |
394 | .proc = isl1208_rtc_proc, | 388 | .proc = isl1208_rtc_proc, |
395 | .read_time = isl1208_rtc_read_time, | 389 | .read_time = isl1208_rtc_read_time, |
396 | .set_time = isl1208_rtc_set_time, | 390 | .set_time = isl1208_rtc_set_time, |
397 | .read_alarm = isl1208_rtc_read_alarm, | 391 | .read_alarm = isl1208_rtc_read_alarm, |
398 | //.set_alarm = isl1208_rtc_set_alarm, | 392 | /*.set_alarm = isl1208_rtc_set_alarm, */ |
399 | }; | 393 | }; |
400 | 394 | ||
401 | /* sysfs interface */ | 395 | /* sysfs interface */ |
402 | 396 | ||
403 | static ssize_t isl1208_sysfs_show_atrim(struct device *dev, | 397 | static ssize_t |
404 | struct device_attribute *attr, | 398 | isl1208_sysfs_show_atrim(struct device *dev, |
405 | char *buf) | 399 | struct device_attribute *attr, char *buf) |
406 | { | 400 | { |
407 | int atr; | 401 | int atr = isl1208_i2c_get_atr(to_i2c_client(dev)); |
408 | |||
409 | atr = isl1208_i2c_get_atr(to_i2c_client(dev)); | ||
410 | if (atr < 0) | 402 | if (atr < 0) |
411 | return atr; | 403 | return atr; |
412 | 404 | ||
413 | return sprintf(buf, "%d.%.2d pF\n", atr>>2, (atr&0x3)*25); | 405 | return sprintf(buf, "%d.%.2d pF\n", atr >> 2, (atr & 0x3) * 25); |
414 | } | 406 | } |
407 | |||
415 | static DEVICE_ATTR(atrim, S_IRUGO, isl1208_sysfs_show_atrim, NULL); | 408 | static DEVICE_ATTR(atrim, S_IRUGO, isl1208_sysfs_show_atrim, NULL); |
416 | 409 | ||
417 | static ssize_t isl1208_sysfs_show_dtrim(struct device *dev, | 410 | static ssize_t |
418 | struct device_attribute *attr, | 411 | isl1208_sysfs_show_dtrim(struct device *dev, |
419 | char *buf) | 412 | struct device_attribute *attr, char *buf) |
420 | { | 413 | { |
421 | int dtr; | 414 | int dtr = isl1208_i2c_get_dtr(to_i2c_client(dev)); |
422 | |||
423 | dtr = isl1208_i2c_get_dtr(to_i2c_client(dev)); | ||
424 | if (dtr < 0) | 415 | if (dtr < 0) |
425 | return dtr; | 416 | return dtr; |
426 | 417 | ||
427 | return sprintf(buf, "%d ppm\n", dtr); | 418 | return sprintf(buf, "%d ppm\n", dtr); |
428 | } | 419 | } |
420 | |||
429 | static DEVICE_ATTR(dtrim, S_IRUGO, isl1208_sysfs_show_dtrim, NULL); | 421 | static DEVICE_ATTR(dtrim, S_IRUGO, isl1208_sysfs_show_dtrim, NULL); |
430 | 422 | ||
431 | static ssize_t isl1208_sysfs_show_usr(struct device *dev, | 423 | static ssize_t |
432 | struct device_attribute *attr, | 424 | isl1208_sysfs_show_usr(struct device *dev, |
433 | char *buf) | 425 | struct device_attribute *attr, char *buf) |
434 | { | 426 | { |
435 | int usr; | 427 | int usr = isl1208_i2c_get_usr(to_i2c_client(dev)); |
436 | |||
437 | usr = isl1208_i2c_get_usr(to_i2c_client(dev)); | ||
438 | if (usr < 0) | 428 | if (usr < 0) |
439 | return usr; | 429 | return usr; |
440 | 430 | ||
441 | return sprintf(buf, "0x%.4x\n", usr); | 431 | return sprintf(buf, "0x%.4x\n", usr); |
442 | } | 432 | } |
443 | 433 | ||
444 | static ssize_t isl1208_sysfs_store_usr(struct device *dev, | 434 | static ssize_t |
445 | struct device_attribute *attr, | 435 | isl1208_sysfs_store_usr(struct device *dev, |
446 | const char *buf, size_t count) | 436 | struct device_attribute *attr, |
437 | const char *buf, size_t count) | ||
447 | { | 438 | { |
448 | int usr = -1; | 439 | int usr = -1; |
449 | 440 | ||
@@ -460,124 +451,116 @@ static ssize_t isl1208_sysfs_store_usr(struct device *dev, | |||
460 | 451 | ||
461 | return isl1208_i2c_set_usr(to_i2c_client(dev), usr) ? -EIO : count; | 452 | return isl1208_i2c_set_usr(to_i2c_client(dev), usr) ? -EIO : count; |
462 | } | 453 | } |
454 | |||
463 | static DEVICE_ATTR(usr, S_IRUGO | S_IWUSR, isl1208_sysfs_show_usr, | 455 | static DEVICE_ATTR(usr, S_IRUGO | S_IWUSR, isl1208_sysfs_show_usr, |
464 | isl1208_sysfs_store_usr); | 456 | isl1208_sysfs_store_usr); |
465 | 457 | ||
466 | static int | 458 | static int |
467 | isl1208_probe(struct i2c_adapter *adapter, int addr, int kind) | 459 | isl1208_sysfs_register(struct device *dev) |
468 | { | 460 | { |
469 | int rc = 0; | 461 | int err; |
470 | struct i2c_client *new_client = NULL; | 462 | |
471 | struct rtc_device *rtc = NULL; | 463 | err = device_create_file(dev, &dev_attr_atrim); |
464 | if (err) | ||
465 | return err; | ||
472 | 466 | ||
473 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { | 467 | err = device_create_file(dev, &dev_attr_dtrim); |
474 | rc = -ENODEV; | 468 | if (err) { |
475 | goto failout; | 469 | device_remove_file(dev, &dev_attr_atrim); |
470 | return err; | ||
476 | } | 471 | } |
477 | 472 | ||
478 | new_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | 473 | err = device_create_file(dev, &dev_attr_usr); |
479 | if (new_client == NULL) { | 474 | if (err) { |
480 | rc = -ENOMEM; | 475 | device_remove_file(dev, &dev_attr_atrim); |
481 | goto failout; | 476 | device_remove_file(dev, &dev_attr_dtrim); |
482 | } | 477 | } |
483 | 478 | ||
484 | new_client->addr = addr; | 479 | return 0; |
485 | new_client->adapter = adapter; | 480 | } |
486 | new_client->driver = &isl1208_driver; | ||
487 | new_client->flags = 0; | ||
488 | strcpy(new_client->name, DRV_NAME); | ||
489 | 481 | ||
490 | if (kind < 0) { | 482 | static int |
491 | rc = isl1208_i2c_validate_client(new_client); | 483 | isl1208_sysfs_unregister(struct device *dev) |
492 | if (rc < 0) | 484 | { |
493 | goto failout; | 485 | device_remove_file(dev, &dev_attr_atrim); |
494 | } | 486 | device_remove_file(dev, &dev_attr_atrim); |
487 | device_remove_file(dev, &dev_attr_usr); | ||
488 | |||
489 | return 0; | ||
490 | } | ||
491 | |||
492 | static int | ||
493 | isl1208_probe(struct i2c_client *client) | ||
494 | { | ||
495 | int rc = 0; | ||
496 | struct rtc_device *rtc; | ||
495 | 497 | ||
496 | rc = i2c_attach_client(new_client); | 498 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) |
497 | if (rc < 0) | 499 | return -ENODEV; |
498 | goto failout; | ||
499 | 500 | ||
500 | dev_info(&new_client->dev, | 501 | if (isl1208_i2c_validate_client(client) < 0) |
502 | return -ENODEV; | ||
503 | |||
504 | dev_info(&client->dev, | ||
501 | "chip found, driver version " DRV_VERSION "\n"); | 505 | "chip found, driver version " DRV_VERSION "\n"); |
502 | 506 | ||
503 | rtc = rtc_device_register(isl1208_driver.driver.name, | 507 | rtc = rtc_device_register(isl1208_driver.driver.name, |
504 | &new_client->dev, | 508 | &client->dev, &isl1208_rtc_ops, |
505 | &isl1208_rtc_ops, THIS_MODULE); | 509 | THIS_MODULE); |
506 | 510 | if (IS_ERR(rtc)) | |
507 | if (IS_ERR(rtc)) { | 511 | return PTR_ERR(rtc); |
508 | rc = PTR_ERR(rtc); | ||
509 | goto failout_detach; | ||
510 | } | ||
511 | 512 | ||
512 | i2c_set_clientdata(new_client, rtc); | 513 | i2c_set_clientdata(client, rtc); |
513 | 514 | ||
514 | rc = isl1208_i2c_get_sr(new_client); | 515 | rc = isl1208_i2c_get_sr(client); |
515 | if (rc < 0) { | 516 | if (rc < 0) { |
516 | dev_err(&new_client->dev, "reading status failed\n"); | 517 | dev_err(&client->dev, "reading status failed\n"); |
517 | goto failout_unregister; | 518 | goto exit_unregister; |
518 | } | 519 | } |
519 | 520 | ||
520 | if (rc & ISL1208_REG_SR_RTCF) | 521 | if (rc & ISL1208_REG_SR_RTCF) |
521 | dev_warn(&new_client->dev, "rtc power failure detected, " | 522 | dev_warn(&client->dev, "rtc power failure detected, " |
522 | "please set clock.\n"); | 523 | "please set clock.\n"); |
523 | 524 | ||
524 | rc = device_create_file(&new_client->dev, &dev_attr_atrim); | 525 | rc = isl1208_sysfs_register(&client->dev); |
525 | if (rc < 0) | 526 | if (rc) |
526 | goto failout_unregister; | 527 | goto exit_unregister; |
527 | rc = device_create_file(&new_client->dev, &dev_attr_dtrim); | ||
528 | if (rc < 0) | ||
529 | goto failout_atrim; | ||
530 | rc = device_create_file(&new_client->dev, &dev_attr_usr); | ||
531 | if (rc < 0) | ||
532 | goto failout_dtrim; | ||
533 | 528 | ||
534 | return 0; | 529 | return 0; |
535 | 530 | ||
536 | failout_dtrim: | 531 | exit_unregister: |
537 | device_remove_file(&new_client->dev, &dev_attr_dtrim); | ||
538 | failout_atrim: | ||
539 | device_remove_file(&new_client->dev, &dev_attr_atrim); | ||
540 | failout_unregister: | ||
541 | rtc_device_unregister(rtc); | 532 | rtc_device_unregister(rtc); |
542 | failout_detach: | ||
543 | i2c_detach_client(new_client); | ||
544 | failout: | ||
545 | kfree(new_client); | ||
546 | return rc; | ||
547 | } | ||
548 | 533 | ||
549 | static int | 534 | return rc; |
550 | isl1208_attach_adapter (struct i2c_adapter *adapter) | ||
551 | { | ||
552 | return i2c_probe(adapter, &addr_data, isl1208_probe); | ||
553 | } | 535 | } |
554 | 536 | ||
555 | static int | 537 | static int |
556 | isl1208_detach_client(struct i2c_client *client) | 538 | isl1208_remove(struct i2c_client *client) |
557 | { | 539 | { |
558 | int rc; | 540 | struct rtc_device *rtc = i2c_get_clientdata(client); |
559 | struct rtc_device *const rtc = i2c_get_clientdata(client); | ||
560 | |||
561 | if (rtc) | ||
562 | rtc_device_unregister(rtc); /* do we need to kfree? */ | ||
563 | |||
564 | rc = i2c_detach_client(client); | ||
565 | if (rc) | ||
566 | return rc; | ||
567 | 541 | ||
568 | kfree(client); | 542 | isl1208_sysfs_unregister(&client->dev); |
543 | rtc_device_unregister(rtc); | ||
569 | 544 | ||
570 | return 0; | 545 | return 0; |
571 | } | 546 | } |
572 | 547 | ||
573 | /* module management */ | 548 | static struct i2c_driver isl1208_driver = { |
549 | .driver = { | ||
550 | .name = "rtc-isl1208", | ||
551 | }, | ||
552 | .probe = isl1208_probe, | ||
553 | .remove = isl1208_remove, | ||
554 | }; | ||
574 | 555 | ||
575 | static int __init isl1208_init(void) | 556 | static int __init |
557 | isl1208_init(void) | ||
576 | { | 558 | { |
577 | return i2c_add_driver(&isl1208_driver); | 559 | return i2c_add_driver(&isl1208_driver); |
578 | } | 560 | } |
579 | 561 | ||
580 | static void __exit isl1208_exit(void) | 562 | static void __exit |
563 | isl1208_exit(void) | ||
581 | { | 564 | { |
582 | i2c_del_driver(&isl1208_driver); | 565 | i2c_del_driver(&isl1208_driver); |
583 | } | 566 | } |
diff --git a/drivers/rtc/rtc-max6900.c b/drivers/rtc/rtc-max6900.c index 7683412970c4..ded3c0abad83 100644 --- a/drivers/rtc/rtc-max6900.c +++ b/drivers/rtc/rtc-max6900.c | |||
@@ -98,7 +98,7 @@ static int max6900_i2c_read_regs(struct i2c_client *client, u8 *buf) | |||
98 | rc = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | 98 | rc = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); |
99 | if (rc != ARRAY_SIZE(msgs)) { | 99 | if (rc != ARRAY_SIZE(msgs)) { |
100 | dev_err(&client->dev, "%s: register read failed\n", | 100 | dev_err(&client->dev, "%s: register read failed\n", |
101 | __FUNCTION__); | 101 | __func__); |
102 | return -EIO; | 102 | return -EIO; |
103 | } | 103 | } |
104 | return 0; | 104 | return 0; |
@@ -150,7 +150,7 @@ static int max6900_i2c_write_regs(struct i2c_client *client, u8 const *buf) | |||
150 | 150 | ||
151 | write_failed: | 151 | write_failed: |
152 | dev_err(&client->dev, "%s: register write failed\n", | 152 | dev_err(&client->dev, "%s: register write failed\n", |
153 | __FUNCTION__); | 153 | __func__); |
154 | return -EIO; | 154 | return -EIO; |
155 | } | 155 | } |
156 | 156 | ||
@@ -214,7 +214,7 @@ static int max6900_i2c_clear_write_protect(struct i2c_client *client) | |||
214 | rc = i2c_smbus_write_byte_data (client, MAX6900_REG_CONTROL_WRITE, 0); | 214 | rc = i2c_smbus_write_byte_data (client, MAX6900_REG_CONTROL_WRITE, 0); |
215 | if (rc < 0) { | 215 | if (rc < 0) { |
216 | dev_err(&client->dev, "%s: control register write failed\n", | 216 | dev_err(&client->dev, "%s: control register write failed\n", |
217 | __FUNCTION__); | 217 | __func__); |
218 | return -EIO; | 218 | return -EIO; |
219 | } | 219 | } |
220 | return 0; | 220 | return 0; |
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c index 1f956dc5d56e..12f0310ae89c 100644 --- a/drivers/rtc/rtc-max6902.c +++ b/drivers/rtc/rtc-max6902.c | |||
@@ -140,7 +140,7 @@ static int max6902_get_datetime(struct device *dev, struct rtc_time *dt) | |||
140 | dt->tm_year -= 1900; | 140 | dt->tm_year -= 1900; |
141 | 141 | ||
142 | #ifdef MAX6902_DEBUG | 142 | #ifdef MAX6902_DEBUG |
143 | printk("\n%s : Read RTC values\n",__FUNCTION__); | 143 | printk("\n%s : Read RTC values\n",__func__); |
144 | printk("tm_hour: %i\n",dt->tm_hour); | 144 | printk("tm_hour: %i\n",dt->tm_hour); |
145 | printk("tm_min : %i\n",dt->tm_min); | 145 | printk("tm_min : %i\n",dt->tm_min); |
146 | printk("tm_sec : %i\n",dt->tm_sec); | 146 | printk("tm_sec : %i\n",dt->tm_sec); |
@@ -158,7 +158,7 @@ static int max6902_set_datetime(struct device *dev, struct rtc_time *dt) | |||
158 | dt->tm_year = dt->tm_year+1900; | 158 | dt->tm_year = dt->tm_year+1900; |
159 | 159 | ||
160 | #ifdef MAX6902_DEBUG | 160 | #ifdef MAX6902_DEBUG |
161 | printk("\n%s : Setting RTC values\n",__FUNCTION__); | 161 | printk("\n%s : Setting RTC values\n",__func__); |
162 | printk("tm_sec : %i\n",dt->tm_sec); | 162 | printk("tm_sec : %i\n",dt->tm_sec); |
163 | printk("tm_min : %i\n",dt->tm_min); | 163 | printk("tm_min : %i\n",dt->tm_min); |
164 | printk("tm_hour: %i\n",dt->tm_hour); | 164 | printk("tm_hour: %i\n",dt->tm_hour); |
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index b3317fcc16c3..a41681d26eba 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c | |||
@@ -18,17 +18,7 @@ | |||
18 | #include <linux/bcd.h> | 18 | #include <linux/bcd.h> |
19 | #include <linux/rtc.h> | 19 | #include <linux/rtc.h> |
20 | 20 | ||
21 | #define DRV_VERSION "0.4.2" | 21 | #define DRV_VERSION "0.4.3" |
22 | |||
23 | /* Addresses to scan: none | ||
24 | * This chip cannot be reliably autodetected. An empty eeprom | ||
25 | * located at 0x51 will pass the validation routine due to | ||
26 | * the way the registers are implemented. | ||
27 | */ | ||
28 | static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; | ||
29 | |||
30 | /* Module parameters */ | ||
31 | I2C_CLIENT_INSMOD; | ||
32 | 22 | ||
33 | #define PCF8563_REG_ST1 0x00 /* status */ | 23 | #define PCF8563_REG_ST1 0x00 /* status */ |
34 | #define PCF8563_REG_ST2 0x01 | 24 | #define PCF8563_REG_ST2 0x01 |
@@ -53,8 +43,10 @@ I2C_CLIENT_INSMOD; | |||
53 | #define PCF8563_SC_LV 0x80 /* low voltage */ | 43 | #define PCF8563_SC_LV 0x80 /* low voltage */ |
54 | #define PCF8563_MO_C 0x80 /* century */ | 44 | #define PCF8563_MO_C 0x80 /* century */ |
55 | 45 | ||
46 | static struct i2c_driver pcf8563_driver; | ||
47 | |||
56 | struct pcf8563 { | 48 | struct pcf8563 { |
57 | struct i2c_client client; | 49 | struct rtc_device *rtc; |
58 | /* | 50 | /* |
59 | * The meaning of MO_C bit varies by the chip type. | 51 | * The meaning of MO_C bit varies by the chip type. |
60 | * From PCF8563 datasheet: this bit is toggled when the years | 52 | * From PCF8563 datasheet: this bit is toggled when the years |
@@ -72,16 +64,13 @@ struct pcf8563 { | |||
72 | int c_polarity; /* 0: MO_C=1 means 19xx, otherwise MO_C=1 means 20xx */ | 64 | int c_polarity; /* 0: MO_C=1 means 19xx, otherwise MO_C=1 means 20xx */ |
73 | }; | 65 | }; |
74 | 66 | ||
75 | static int pcf8563_probe(struct i2c_adapter *adapter, int address, int kind); | ||
76 | static int pcf8563_detach(struct i2c_client *client); | ||
77 | |||
78 | /* | 67 | /* |
79 | * In the routines that deal directly with the pcf8563 hardware, we use | 68 | * In the routines that deal directly with the pcf8563 hardware, we use |
80 | * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch. | 69 | * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch. |
81 | */ | 70 | */ |
82 | static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm) | 71 | static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm) |
83 | { | 72 | { |
84 | struct pcf8563 *pcf8563 = container_of(client, struct pcf8563, client); | 73 | struct pcf8563 *pcf8563 = i2c_get_clientdata(client); |
85 | unsigned char buf[13] = { PCF8563_REG_ST1 }; | 74 | unsigned char buf[13] = { PCF8563_REG_ST1 }; |
86 | 75 | ||
87 | struct i2c_msg msgs[] = { | 76 | struct i2c_msg msgs[] = { |
@@ -91,7 +80,7 @@ static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
91 | 80 | ||
92 | /* read registers */ | 81 | /* read registers */ |
93 | if ((i2c_transfer(client->adapter, msgs, 2)) != 2) { | 82 | if ((i2c_transfer(client->adapter, msgs, 2)) != 2) { |
94 | dev_err(&client->dev, "%s: read error\n", __FUNCTION__); | 83 | dev_err(&client->dev, "%s: read error\n", __func__); |
95 | return -EIO; | 84 | return -EIO; |
96 | } | 85 | } |
97 | 86 | ||
@@ -102,7 +91,7 @@ static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
102 | dev_dbg(&client->dev, | 91 | dev_dbg(&client->dev, |
103 | "%s: raw data is st1=%02x, st2=%02x, sec=%02x, min=%02x, hr=%02x, " | 92 | "%s: raw data is st1=%02x, st2=%02x, sec=%02x, min=%02x, hr=%02x, " |
104 | "mday=%02x, wday=%02x, mon=%02x, year=%02x\n", | 93 | "mday=%02x, wday=%02x, mon=%02x, year=%02x\n", |
105 | __FUNCTION__, | 94 | __func__, |
106 | buf[0], buf[1], buf[2], buf[3], | 95 | buf[0], buf[1], buf[2], buf[3], |
107 | buf[4], buf[5], buf[6], buf[7], | 96 | buf[4], buf[5], buf[6], buf[7], |
108 | buf[8]); | 97 | buf[8]); |
@@ -123,7 +112,7 @@ static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
123 | 112 | ||
124 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " | 113 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " |
125 | "mday=%d, mon=%d, year=%d, wday=%d\n", | 114 | "mday=%d, mon=%d, year=%d, wday=%d\n", |
126 | __FUNCTION__, | 115 | __func__, |
127 | tm->tm_sec, tm->tm_min, tm->tm_hour, | 116 | tm->tm_sec, tm->tm_min, tm->tm_hour, |
128 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); | 117 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); |
129 | 118 | ||
@@ -138,13 +127,13 @@ static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
138 | 127 | ||
139 | static int pcf8563_set_datetime(struct i2c_client *client, struct rtc_time *tm) | 128 | static int pcf8563_set_datetime(struct i2c_client *client, struct rtc_time *tm) |
140 | { | 129 | { |
141 | struct pcf8563 *pcf8563 = container_of(client, struct pcf8563, client); | 130 | struct pcf8563 *pcf8563 = i2c_get_clientdata(client); |
142 | int i, err; | 131 | int i, err; |
143 | unsigned char buf[9]; | 132 | unsigned char buf[9]; |
144 | 133 | ||
145 | dev_dbg(&client->dev, "%s: secs=%d, mins=%d, hours=%d, " | 134 | dev_dbg(&client->dev, "%s: secs=%d, mins=%d, hours=%d, " |
146 | "mday=%d, mon=%d, year=%d, wday=%d\n", | 135 | "mday=%d, mon=%d, year=%d, wday=%d\n", |
147 | __FUNCTION__, | 136 | __func__, |
148 | tm->tm_sec, tm->tm_min, tm->tm_hour, | 137 | tm->tm_sec, tm->tm_min, tm->tm_hour, |
149 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); | 138 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); |
150 | 139 | ||
@@ -174,7 +163,7 @@ static int pcf8563_set_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
174 | if (err != sizeof(data)) { | 163 | if (err != sizeof(data)) { |
175 | dev_err(&client->dev, | 164 | dev_err(&client->dev, |
176 | "%s: err=%d addr=%02x, data=%02x\n", | 165 | "%s: err=%d addr=%02x, data=%02x\n", |
177 | __FUNCTION__, err, data[0], data[1]); | 166 | __func__, err, data[0], data[1]); |
178 | return -EIO; | 167 | return -EIO; |
179 | } | 168 | } |
180 | }; | 169 | }; |
@@ -219,7 +208,7 @@ static int pcf8563_validate_client(struct i2c_client *client) | |||
219 | if (xfer != ARRAY_SIZE(msgs)) { | 208 | if (xfer != ARRAY_SIZE(msgs)) { |
220 | dev_err(&client->dev, | 209 | dev_err(&client->dev, |
221 | "%s: could not read register 0x%02X\n", | 210 | "%s: could not read register 0x%02X\n", |
222 | __FUNCTION__, pattern[i].reg); | 211 | __func__, pattern[i].reg); |
223 | 212 | ||
224 | return -EIO; | 213 | return -EIO; |
225 | } | 214 | } |
@@ -231,7 +220,7 @@ static int pcf8563_validate_client(struct i2c_client *client) | |||
231 | dev_dbg(&client->dev, | 220 | dev_dbg(&client->dev, |
232 | "%s: pattern=%d, reg=%x, mask=0x%02x, min=%d, " | 221 | "%s: pattern=%d, reg=%x, mask=0x%02x, min=%d, " |
233 | "max=%d, value=%d, raw=0x%02X\n", | 222 | "max=%d, value=%d, raw=0x%02X\n", |
234 | __FUNCTION__, i, pattern[i].reg, pattern[i].mask, | 223 | __func__, i, pattern[i].reg, pattern[i].mask, |
235 | pattern[i].min, pattern[i].max, | 224 | pattern[i].min, pattern[i].max, |
236 | value, buf); | 225 | value, buf); |
237 | 226 | ||
@@ -257,100 +246,67 @@ static const struct rtc_class_ops pcf8563_rtc_ops = { | |||
257 | .set_time = pcf8563_rtc_set_time, | 246 | .set_time = pcf8563_rtc_set_time, |
258 | }; | 247 | }; |
259 | 248 | ||
260 | static int pcf8563_attach(struct i2c_adapter *adapter) | 249 | static int pcf8563_probe(struct i2c_client *client) |
261 | { | ||
262 | return i2c_probe(adapter, &addr_data, pcf8563_probe); | ||
263 | } | ||
264 | |||
265 | static struct i2c_driver pcf8563_driver = { | ||
266 | .driver = { | ||
267 | .name = "pcf8563", | ||
268 | }, | ||
269 | .id = I2C_DRIVERID_PCF8563, | ||
270 | .attach_adapter = &pcf8563_attach, | ||
271 | .detach_client = &pcf8563_detach, | ||
272 | }; | ||
273 | |||
274 | static int pcf8563_probe(struct i2c_adapter *adapter, int address, int kind) | ||
275 | { | 250 | { |
276 | struct pcf8563 *pcf8563; | 251 | struct pcf8563 *pcf8563; |
277 | struct i2c_client *client; | ||
278 | struct rtc_device *rtc; | ||
279 | 252 | ||
280 | int err = 0; | 253 | int err = 0; |
281 | 254 | ||
282 | dev_dbg(&adapter->dev, "%s\n", __FUNCTION__); | 255 | dev_dbg(&client->dev, "%s\n", __func__); |
283 | 256 | ||
284 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { | 257 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) |
285 | err = -ENODEV; | 258 | return -ENODEV; |
286 | goto exit; | ||
287 | } | ||
288 | 259 | ||
289 | if (!(pcf8563 = kzalloc(sizeof(struct pcf8563), GFP_KERNEL))) { | 260 | pcf8563 = kzalloc(sizeof(struct pcf8563), GFP_KERNEL); |
290 | err = -ENOMEM; | 261 | if (!pcf8563) |
291 | goto exit; | 262 | return -ENOMEM; |
292 | } | ||
293 | |||
294 | client = &pcf8563->client; | ||
295 | client->addr = address; | ||
296 | client->driver = &pcf8563_driver; | ||
297 | client->adapter = adapter; | ||
298 | |||
299 | strlcpy(client->name, pcf8563_driver.driver.name, I2C_NAME_SIZE); | ||
300 | 263 | ||
301 | /* Verify the chip is really an PCF8563 */ | 264 | /* Verify the chip is really an PCF8563 */ |
302 | if (kind < 0) { | 265 | if (pcf8563_validate_client(client) < 0) { |
303 | if (pcf8563_validate_client(client) < 0) { | 266 | err = -ENODEV; |
304 | err = -ENODEV; | ||
305 | goto exit_kfree; | ||
306 | } | ||
307 | } | ||
308 | |||
309 | /* Inform the i2c layer */ | ||
310 | if ((err = i2c_attach_client(client))) | ||
311 | goto exit_kfree; | 267 | goto exit_kfree; |
268 | } | ||
312 | 269 | ||
313 | dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); | 270 | dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); |
314 | 271 | ||
315 | rtc = rtc_device_register(pcf8563_driver.driver.name, &client->dev, | 272 | pcf8563->rtc = rtc_device_register(pcf8563_driver.driver.name, |
316 | &pcf8563_rtc_ops, THIS_MODULE); | 273 | &client->dev, &pcf8563_rtc_ops, THIS_MODULE); |
317 | 274 | ||
318 | if (IS_ERR(rtc)) { | 275 | if (IS_ERR(pcf8563->rtc)) { |
319 | err = PTR_ERR(rtc); | 276 | err = PTR_ERR(pcf8563->rtc); |
320 | goto exit_detach; | 277 | goto exit_kfree; |
321 | } | 278 | } |
322 | 279 | ||
323 | i2c_set_clientdata(client, rtc); | 280 | i2c_set_clientdata(client, pcf8563); |
324 | 281 | ||
325 | return 0; | 282 | return 0; |
326 | 283 | ||
327 | exit_detach: | ||
328 | i2c_detach_client(client); | ||
329 | |||
330 | exit_kfree: | 284 | exit_kfree: |
331 | kfree(pcf8563); | 285 | kfree(pcf8563); |
332 | 286 | ||
333 | exit: | ||
334 | return err; | 287 | return err; |
335 | } | 288 | } |
336 | 289 | ||
337 | static int pcf8563_detach(struct i2c_client *client) | 290 | static int pcf8563_remove(struct i2c_client *client) |
338 | { | 291 | { |
339 | struct pcf8563 *pcf8563 = container_of(client, struct pcf8563, client); | 292 | struct pcf8563 *pcf8563 = i2c_get_clientdata(client); |
340 | int err; | ||
341 | struct rtc_device *rtc = i2c_get_clientdata(client); | ||
342 | 293 | ||
343 | if (rtc) | 294 | if (pcf8563->rtc) |
344 | rtc_device_unregister(rtc); | 295 | rtc_device_unregister(pcf8563->rtc); |
345 | |||
346 | if ((err = i2c_detach_client(client))) | ||
347 | return err; | ||
348 | 296 | ||
349 | kfree(pcf8563); | 297 | kfree(pcf8563); |
350 | 298 | ||
351 | return 0; | 299 | return 0; |
352 | } | 300 | } |
353 | 301 | ||
302 | static struct i2c_driver pcf8563_driver = { | ||
303 | .driver = { | ||
304 | .name = "rtc-pcf8563", | ||
305 | }, | ||
306 | .probe = pcf8563_probe, | ||
307 | .remove = pcf8563_remove, | ||
308 | }; | ||
309 | |||
354 | static int __init pcf8563_init(void) | 310 | static int __init pcf8563_init(void) |
355 | { | 311 | { |
356 | return i2c_add_driver(&pcf8563_driver); | 312 | return i2c_add_driver(&pcf8563_driver); |
diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c index 8b3997007506..3d09d8f0b1f0 100644 --- a/drivers/rtc/rtc-pcf8583.c +++ b/drivers/rtc/rtc-pcf8583.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/i2c.h> | 15 | #include <linux/i2c.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/mc146818rtc.h> | 18 | #include <linux/rtc.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/bcd.h> | 21 | #include <linux/bcd.h> |
diff --git a/drivers/rtc/rtc-rs5c313.c b/drivers/rtc/rtc-rs5c313.c index 664e89a817ed..1c14d4497c4d 100644 --- a/drivers/rtc/rtc-rs5c313.c +++ b/drivers/rtc/rtc-rs5c313.c | |||
@@ -228,7 +228,7 @@ static int rs5c313_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
228 | ndelay(700); /* CE:L */ | 228 | ndelay(700); /* CE:L */ |
229 | 229 | ||
230 | if (cnt++ > 100) { | 230 | if (cnt++ > 100) { |
231 | dev_err(dev, "%s: timeout error\n", __FUNCTION__); | 231 | dev_err(dev, "%s: timeout error\n", __func__); |
232 | return -EIO; | 232 | return -EIO; |
233 | } | 233 | } |
234 | } | 234 | } |
@@ -289,7 +289,7 @@ static int rs5c313_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
289 | ndelay(700); /* CE:L */ | 289 | ndelay(700); /* CE:L */ |
290 | 290 | ||
291 | if (cnt++ > 100) { | 291 | if (cnt++ > 100) { |
292 | dev_err(dev, "%s: timeout error\n", __FUNCTION__); | 292 | dev_err(dev, "%s: timeout error\n", __func__); |
293 | return -EIO; | 293 | return -EIO; |
294 | } | 294 | } |
295 | } | 295 | } |
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index 6b67b5097927..7e63074708eb 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c | |||
@@ -99,7 +99,7 @@ static int rs5c_get_regs(struct rs5c372 *rs5c) | |||
99 | * least 80219 chips; this works around that bug. | 99 | * least 80219 chips; this works around that bug. |
100 | */ | 100 | */ |
101 | if ((i2c_transfer(client->adapter, msgs, 1)) != 1) { | 101 | if ((i2c_transfer(client->adapter, msgs, 1)) != 1) { |
102 | pr_debug("%s: can't read registers\n", rs5c->rtc->name); | 102 | dev_warn(&client->dev, "can't read registers\n"); |
103 | return -EIO; | 103 | return -EIO; |
104 | } | 104 | } |
105 | 105 | ||
@@ -166,7 +166,7 @@ static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
166 | 166 | ||
167 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " | 167 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " |
168 | "mday=%d, mon=%d, year=%d, wday=%d\n", | 168 | "mday=%d, mon=%d, year=%d, wday=%d\n", |
169 | __FUNCTION__, | 169 | __func__, |
170 | tm->tm_sec, tm->tm_min, tm->tm_hour, | 170 | tm->tm_sec, tm->tm_min, tm->tm_hour, |
171 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); | 171 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); |
172 | 172 | ||
@@ -181,7 +181,7 @@ static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
181 | 181 | ||
182 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d " | 182 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d " |
183 | "mday=%d, mon=%d, year=%d, wday=%d\n", | 183 | "mday=%d, mon=%d, year=%d, wday=%d\n", |
184 | __FUNCTION__, | 184 | __func__, |
185 | tm->tm_sec, tm->tm_min, tm->tm_hour, | 185 | tm->tm_sec, tm->tm_min, tm->tm_hour, |
186 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); | 186 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); |
187 | 187 | ||
@@ -195,7 +195,7 @@ static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
195 | buf[7] = BIN2BCD(tm->tm_year - 100); | 195 | buf[7] = BIN2BCD(tm->tm_year - 100); |
196 | 196 | ||
197 | if ((i2c_master_send(client, buf, 8)) != 8) { | 197 | if ((i2c_master_send(client, buf, 8)) != 8) { |
198 | dev_err(&client->dev, "%s: write error\n", __FUNCTION__); | 198 | dev_err(&client->dev, "%s: write error\n", __func__); |
199 | return -EIO; | 199 | return -EIO; |
200 | } | 200 | } |
201 | 201 | ||
@@ -220,7 +220,7 @@ static int rs5c372_get_trim(struct i2c_client *client, int *osc, int *trim) | |||
220 | *osc = (tmp & RS5C372_TRIM_XSL) ? 32000 : 32768; | 220 | *osc = (tmp & RS5C372_TRIM_XSL) ? 32000 : 32768; |
221 | 221 | ||
222 | if (trim) { | 222 | if (trim) { |
223 | dev_dbg(&client->dev, "%s: raw trim=%x\n", __FUNCTION__, tmp); | 223 | dev_dbg(&client->dev, "%s: raw trim=%x\n", __func__, tmp); |
224 | tmp &= RS5C372_TRIM_MASK; | 224 | tmp &= RS5C372_TRIM_MASK; |
225 | if (tmp & 0x3e) { | 225 | if (tmp & 0x3e) { |
226 | int t = tmp & 0x3f; | 226 | int t = tmp & 0x3f; |
@@ -500,7 +500,7 @@ static int rs5c372_probe(struct i2c_client *client) | |||
500 | struct rs5c372 *rs5c372; | 500 | struct rs5c372 *rs5c372; |
501 | struct rtc_time tm; | 501 | struct rtc_time tm; |
502 | 502 | ||
503 | dev_dbg(&client->dev, "%s\n", __FUNCTION__); | 503 | dev_dbg(&client->dev, "%s\n", __func__); |
504 | 504 | ||
505 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { | 505 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { |
506 | err = -ENODEV; | 506 | err = -ENODEV; |
@@ -512,12 +512,12 @@ static int rs5c372_probe(struct i2c_client *client) | |||
512 | goto exit; | 512 | goto exit; |
513 | } | 513 | } |
514 | 514 | ||
515 | /* we read registers 0x0f then 0x00-0x0f; skip the first one */ | ||
516 | rs5c372->regs=&rs5c372->buf[1]; | ||
517 | |||
518 | rs5c372->client = client; | 515 | rs5c372->client = client; |
519 | i2c_set_clientdata(client, rs5c372); | 516 | i2c_set_clientdata(client, rs5c372); |
520 | 517 | ||
518 | /* we read registers 0x0f then 0x00-0x0f; skip the first one */ | ||
519 | rs5c372->regs = &rs5c372->buf[1]; | ||
520 | |||
521 | err = rs5c_get_regs(rs5c372); | 521 | err = rs5c_get_regs(rs5c372); |
522 | if (err < 0) | 522 | if (err < 0) |
523 | goto exit_kfree; | 523 | goto exit_kfree; |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 9f4d5129a496..f26e0cad8f16 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -68,7 +68,7 @@ static void s3c_rtc_setaie(int to) | |||
68 | { | 68 | { |
69 | unsigned int tmp; | 69 | unsigned int tmp; |
70 | 70 | ||
71 | pr_debug("%s: aie=%d\n", __FUNCTION__, to); | 71 | pr_debug("%s: aie=%d\n", __func__, to); |
72 | 72 | ||
73 | tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN; | 73 | tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN; |
74 | 74 | ||
@@ -82,7 +82,7 @@ static void s3c_rtc_setpie(int to) | |||
82 | { | 82 | { |
83 | unsigned int tmp; | 83 | unsigned int tmp; |
84 | 84 | ||
85 | pr_debug("%s: pie=%d\n", __FUNCTION__, to); | 85 | pr_debug("%s: pie=%d\n", __func__, to); |
86 | 86 | ||
87 | spin_lock_irq(&s3c_rtc_pie_lock); | 87 | spin_lock_irq(&s3c_rtc_pie_lock); |
88 | tmp = readb(s3c_rtc_base + S3C2410_TICNT) & ~S3C2410_TICNT_ENABLE; | 88 | tmp = readb(s3c_rtc_base + S3C2410_TICNT) & ~S3C2410_TICNT_ENABLE; |
@@ -457,7 +457,7 @@ static int s3c_rtc_probe(struct platform_device *pdev) | |||
457 | struct resource *res; | 457 | struct resource *res; |
458 | int ret; | 458 | int ret; |
459 | 459 | ||
460 | pr_debug("%s: probe=%p\n", __FUNCTION__, pdev); | 460 | pr_debug("%s: probe=%p\n", __func__, pdev); |
461 | 461 | ||
462 | /* find the IRQs */ | 462 | /* find the IRQs */ |
463 | 463 | ||
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index c594b34c6767..110699bb4787 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -361,7 +361,7 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
361 | 361 | ||
362 | dev_dbg(dev, "%s: tm is secs=%d, mins=%d, hours=%d, " | 362 | dev_dbg(dev, "%s: tm is secs=%d, mins=%d, hours=%d, " |
363 | "mday=%d, mon=%d, year=%d, wday=%d\n", | 363 | "mday=%d, mon=%d, year=%d, wday=%d\n", |
364 | __FUNCTION__, | 364 | __func__, |
365 | tm->tm_sec, tm->tm_min, tm->tm_hour, | 365 | tm->tm_sec, tm->tm_min, tm->tm_hour, |
366 | tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday); | 366 | tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday); |
367 | 367 | ||
diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c index 4d27ccc4fc06..2531ce4c9db0 100644 --- a/drivers/rtc/rtc-sysfs.c +++ b/drivers/rtc/rtc-sysfs.c | |||
@@ -145,6 +145,8 @@ rtc_sysfs_set_wakealarm(struct device *dev, struct device_attribute *attr, | |||
145 | unsigned long now, alarm; | 145 | unsigned long now, alarm; |
146 | struct rtc_wkalrm alm; | 146 | struct rtc_wkalrm alm; |
147 | struct rtc_device *rtc = to_rtc_device(dev); | 147 | struct rtc_device *rtc = to_rtc_device(dev); |
148 | char *buf_ptr; | ||
149 | int adjust = 0; | ||
148 | 150 | ||
149 | /* Only request alarms that trigger in the future. Disable them | 151 | /* Only request alarms that trigger in the future. Disable them |
150 | * by writing another time, e.g. 0 meaning Jan 1 1970 UTC. | 152 | * by writing another time, e.g. 0 meaning Jan 1 1970 UTC. |
@@ -154,7 +156,15 @@ rtc_sysfs_set_wakealarm(struct device *dev, struct device_attribute *attr, | |||
154 | return retval; | 156 | return retval; |
155 | rtc_tm_to_time(&alm.time, &now); | 157 | rtc_tm_to_time(&alm.time, &now); |
156 | 158 | ||
157 | alarm = simple_strtoul(buf, NULL, 0); | 159 | buf_ptr = (char *)buf; |
160 | if (*buf_ptr == '+') { | ||
161 | buf_ptr++; | ||
162 | adjust = 1; | ||
163 | } | ||
164 | alarm = simple_strtoul(buf_ptr, NULL, 0); | ||
165 | if (adjust) { | ||
166 | alarm += now; | ||
167 | } | ||
158 | if (alarm > now) { | 168 | if (alarm > now) { |
159 | /* Avoid accidentally clobbering active alarms; we can't | 169 | /* Avoid accidentally clobbering active alarms; we can't |
160 | * entirely prevent that here, without even the minimal | 170 | * entirely prevent that here, without even the minimal |
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c index 254c9fce27da..bc930022004a 100644 --- a/drivers/rtc/rtc-test.c +++ b/drivers/rtc/rtc-test.c | |||
@@ -147,7 +147,7 @@ static int __devexit test_remove(struct platform_device *plat_dev) | |||
147 | return 0; | 147 | return 0; |
148 | } | 148 | } |
149 | 149 | ||
150 | static struct platform_driver test_drv = { | 150 | static struct platform_driver test_driver = { |
151 | .probe = test_probe, | 151 | .probe = test_probe, |
152 | .remove = __devexit_p(test_remove), | 152 | .remove = __devexit_p(test_remove), |
153 | .driver = { | 153 | .driver = { |
@@ -160,7 +160,7 @@ static int __init test_init(void) | |||
160 | { | 160 | { |
161 | int err; | 161 | int err; |
162 | 162 | ||
163 | if ((err = platform_driver_register(&test_drv))) | 163 | if ((err = platform_driver_register(&test_driver))) |
164 | return err; | 164 | return err; |
165 | 165 | ||
166 | if ((test0 = platform_device_alloc("rtc-test", 0)) == NULL) { | 166 | if ((test0 = platform_device_alloc("rtc-test", 0)) == NULL) { |
@@ -191,7 +191,7 @@ exit_free_test0: | |||
191 | platform_device_put(test0); | 191 | platform_device_put(test0); |
192 | 192 | ||
193 | exit_driver_unregister: | 193 | exit_driver_unregister: |
194 | platform_driver_unregister(&test_drv); | 194 | platform_driver_unregister(&test_driver); |
195 | return err; | 195 | return err; |
196 | } | 196 | } |
197 | 197 | ||
@@ -199,7 +199,7 @@ static void __exit test_exit(void) | |||
199 | { | 199 | { |
200 | platform_device_unregister(test0); | 200 | platform_device_unregister(test0); |
201 | platform_device_unregister(test1); | 201 | platform_device_unregister(test1); |
202 | platform_driver_unregister(&test_drv); | 202 | platform_driver_unregister(&test_driver); |
203 | } | 203 | } |
204 | 204 | ||
205 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); | 205 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); |
diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c index 24203a06051a..10025d840268 100644 --- a/drivers/rtc/rtc-v3020.c +++ b/drivers/rtc/rtc-v3020.c | |||
@@ -107,7 +107,7 @@ static int v3020_read_time(struct device *dev, struct rtc_time *dt) | |||
107 | dt->tm_year = BCD2BIN(tmp)+100; | 107 | dt->tm_year = BCD2BIN(tmp)+100; |
108 | 108 | ||
109 | #ifdef DEBUG | 109 | #ifdef DEBUG |
110 | printk("\n%s : Read RTC values\n",__FUNCTION__); | 110 | printk("\n%s : Read RTC values\n",__func__); |
111 | printk("tm_hour: %i\n",dt->tm_hour); | 111 | printk("tm_hour: %i\n",dt->tm_hour); |
112 | printk("tm_min : %i\n",dt->tm_min); | 112 | printk("tm_min : %i\n",dt->tm_min); |
113 | printk("tm_sec : %i\n",dt->tm_sec); | 113 | printk("tm_sec : %i\n",dt->tm_sec); |
@@ -126,7 +126,7 @@ static int v3020_set_time(struct device *dev, struct rtc_time *dt) | |||
126 | struct v3020 *chip = dev_get_drvdata(dev); | 126 | struct v3020 *chip = dev_get_drvdata(dev); |
127 | 127 | ||
128 | #ifdef DEBUG | 128 | #ifdef DEBUG |
129 | printk("\n%s : Setting RTC values\n",__FUNCTION__); | 129 | printk("\n%s : Setting RTC values\n",__func__); |
130 | printk("tm_sec : %i\n",dt->tm_sec); | 130 | printk("tm_sec : %i\n",dt->tm_sec); |
131 | printk("tm_min : %i\n",dt->tm_min); | 131 | printk("tm_min : %i\n",dt->tm_min); |
132 | printk("tm_hour: %i\n",dt->tm_hour); | 132 | printk("tm_hour: %i\n",dt->tm_hour); |
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c index b90fb1866ce9..095282f63523 100644 --- a/drivers/rtc/rtc-x1205.c +++ b/drivers/rtc/rtc-x1205.c | |||
@@ -22,20 +22,7 @@ | |||
22 | #include <linux/rtc.h> | 22 | #include <linux/rtc.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | 24 | ||
25 | #define DRV_VERSION "1.0.7" | 25 | #define DRV_VERSION "1.0.8" |
26 | |||
27 | /* Addresses to scan: none. This chip is located at | ||
28 | * 0x6f and uses a two bytes register addressing. | ||
29 | * Two bytes need to be written to read a single register, | ||
30 | * while most other chips just require one and take the second | ||
31 | * one as the data to be written. To prevent corrupting | ||
32 | * unknown chips, the user must explicitly set the probe parameter. | ||
33 | */ | ||
34 | |||
35 | static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; | ||
36 | |||
37 | /* Insmod parameters */ | ||
38 | I2C_CLIENT_INSMOD; | ||
39 | 26 | ||
40 | /* offsets into CCR area */ | 27 | /* offsets into CCR area */ |
41 | 28 | ||
@@ -91,19 +78,7 @@ I2C_CLIENT_INSMOD; | |||
91 | 78 | ||
92 | #define X1205_HR_MIL 0x80 /* Set in ccr.hour for 24 hr mode */ | 79 | #define X1205_HR_MIL 0x80 /* Set in ccr.hour for 24 hr mode */ |
93 | 80 | ||
94 | /* Prototypes */ | 81 | static struct i2c_driver x1205_driver; |
95 | static int x1205_attach(struct i2c_adapter *adapter); | ||
96 | static int x1205_detach(struct i2c_client *client); | ||
97 | static int x1205_probe(struct i2c_adapter *adapter, int address, int kind); | ||
98 | |||
99 | static struct i2c_driver x1205_driver = { | ||
100 | .driver = { | ||
101 | .name = "x1205", | ||
102 | }, | ||
103 | .id = I2C_DRIVERID_X1205, | ||
104 | .attach_adapter = &x1205_attach, | ||
105 | .detach_client = &x1205_detach, | ||
106 | }; | ||
107 | 82 | ||
108 | /* | 83 | /* |
109 | * In the routines that deal directly with the x1205 hardware, we use | 84 | * In the routines that deal directly with the x1205 hardware, we use |
@@ -124,14 +99,14 @@ static int x1205_get_datetime(struct i2c_client *client, struct rtc_time *tm, | |||
124 | 99 | ||
125 | /* read date registers */ | 100 | /* read date registers */ |
126 | if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) { | 101 | if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) { |
127 | dev_err(&client->dev, "%s: read error\n", __FUNCTION__); | 102 | dev_err(&client->dev, "%s: read error\n", __func__); |
128 | return -EIO; | 103 | return -EIO; |
129 | } | 104 | } |
130 | 105 | ||
131 | dev_dbg(&client->dev, | 106 | dev_dbg(&client->dev, |
132 | "%s: raw read data - sec=%02x, min=%02x, hr=%02x, " | 107 | "%s: raw read data - sec=%02x, min=%02x, hr=%02x, " |
133 | "mday=%02x, mon=%02x, year=%02x, wday=%02x, y2k=%02x\n", | 108 | "mday=%02x, mon=%02x, year=%02x, wday=%02x, y2k=%02x\n", |
134 | __FUNCTION__, | 109 | __func__, |
135 | buf[0], buf[1], buf[2], buf[3], | 110 | buf[0], buf[1], buf[2], buf[3], |
136 | buf[4], buf[5], buf[6], buf[7]); | 111 | buf[4], buf[5], buf[6], buf[7]); |
137 | 112 | ||
@@ -146,7 +121,7 @@ static int x1205_get_datetime(struct i2c_client *client, struct rtc_time *tm, | |||
146 | 121 | ||
147 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " | 122 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " |
148 | "mday=%d, mon=%d, year=%d, wday=%d\n", | 123 | "mday=%d, mon=%d, year=%d, wday=%d\n", |
149 | __FUNCTION__, | 124 | __func__, |
150 | tm->tm_sec, tm->tm_min, tm->tm_hour, | 125 | tm->tm_sec, tm->tm_min, tm->tm_hour, |
151 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); | 126 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); |
152 | 127 | ||
@@ -164,7 +139,7 @@ static int x1205_get_status(struct i2c_client *client, unsigned char *sr) | |||
164 | 139 | ||
165 | /* read status register */ | 140 | /* read status register */ |
166 | if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) { | 141 | if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) { |
167 | dev_err(&client->dev, "%s: read error\n", __FUNCTION__); | 142 | dev_err(&client->dev, "%s: read error\n", __func__); |
168 | return -EIO; | 143 | return -EIO; |
169 | } | 144 | } |
170 | 145 | ||
@@ -187,7 +162,7 @@ static int x1205_set_datetime(struct i2c_client *client, struct rtc_time *tm, | |||
187 | 162 | ||
188 | dev_dbg(&client->dev, | 163 | dev_dbg(&client->dev, |
189 | "%s: secs=%d, mins=%d, hours=%d\n", | 164 | "%s: secs=%d, mins=%d, hours=%d\n", |
190 | __FUNCTION__, | 165 | __func__, |
191 | tm->tm_sec, tm->tm_min, tm->tm_hour); | 166 | tm->tm_sec, tm->tm_min, tm->tm_hour); |
192 | 167 | ||
193 | buf[CCR_SEC] = BIN2BCD(tm->tm_sec); | 168 | buf[CCR_SEC] = BIN2BCD(tm->tm_sec); |
@@ -200,7 +175,7 @@ static int x1205_set_datetime(struct i2c_client *client, struct rtc_time *tm, | |||
200 | if (datetoo) { | 175 | if (datetoo) { |
201 | dev_dbg(&client->dev, | 176 | dev_dbg(&client->dev, |
202 | "%s: mday=%d, mon=%d, year=%d, wday=%d\n", | 177 | "%s: mday=%d, mon=%d, year=%d, wday=%d\n", |
203 | __FUNCTION__, | 178 | __func__, |
204 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); | 179 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); |
205 | 180 | ||
206 | buf[CCR_MDAY] = BIN2BCD(tm->tm_mday); | 181 | buf[CCR_MDAY] = BIN2BCD(tm->tm_mday); |
@@ -216,12 +191,12 @@ static int x1205_set_datetime(struct i2c_client *client, struct rtc_time *tm, | |||
216 | 191 | ||
217 | /* this sequence is required to unlock the chip */ | 192 | /* this sequence is required to unlock the chip */ |
218 | if ((xfer = i2c_master_send(client, wel, 3)) != 3) { | 193 | if ((xfer = i2c_master_send(client, wel, 3)) != 3) { |
219 | dev_err(&client->dev, "%s: wel - %d\n", __FUNCTION__, xfer); | 194 | dev_err(&client->dev, "%s: wel - %d\n", __func__, xfer); |
220 | return -EIO; | 195 | return -EIO; |
221 | } | 196 | } |
222 | 197 | ||
223 | if ((xfer = i2c_master_send(client, rwel, 3)) != 3) { | 198 | if ((xfer = i2c_master_send(client, rwel, 3)) != 3) { |
224 | dev_err(&client->dev, "%s: rwel - %d\n", __FUNCTION__, xfer); | 199 | dev_err(&client->dev, "%s: rwel - %d\n", __func__, xfer); |
225 | return -EIO; | 200 | return -EIO; |
226 | } | 201 | } |
227 | 202 | ||
@@ -233,7 +208,7 @@ static int x1205_set_datetime(struct i2c_client *client, struct rtc_time *tm, | |||
233 | if (xfer != 3) { | 208 | if (xfer != 3) { |
234 | dev_err(&client->dev, | 209 | dev_err(&client->dev, |
235 | "%s: xfer=%d addr=%02x, data=%02x\n", | 210 | "%s: xfer=%d addr=%02x, data=%02x\n", |
236 | __FUNCTION__, | 211 | __func__, |
237 | xfer, rdata[1], rdata[2]); | 212 | xfer, rdata[1], rdata[2]); |
238 | return -EIO; | 213 | return -EIO; |
239 | } | 214 | } |
@@ -241,7 +216,7 @@ static int x1205_set_datetime(struct i2c_client *client, struct rtc_time *tm, | |||
241 | 216 | ||
242 | /* disable further writes */ | 217 | /* disable further writes */ |
243 | if ((xfer = i2c_master_send(client, diswe, 3)) != 3) { | 218 | if ((xfer = i2c_master_send(client, diswe, 3)) != 3) { |
244 | dev_err(&client->dev, "%s: diswe - %d\n", __FUNCTION__, xfer); | 219 | dev_err(&client->dev, "%s: diswe - %d\n", __func__, xfer); |
245 | return -EIO; | 220 | return -EIO; |
246 | } | 221 | } |
247 | 222 | ||
@@ -274,11 +249,11 @@ static int x1205_get_dtrim(struct i2c_client *client, int *trim) | |||
274 | 249 | ||
275 | /* read dtr register */ | 250 | /* read dtr register */ |
276 | if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) { | 251 | if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) { |
277 | dev_err(&client->dev, "%s: read error\n", __FUNCTION__); | 252 | dev_err(&client->dev, "%s: read error\n", __func__); |
278 | return -EIO; | 253 | return -EIO; |
279 | } | 254 | } |
280 | 255 | ||
281 | dev_dbg(&client->dev, "%s: raw dtr=%x\n", __FUNCTION__, dtr); | 256 | dev_dbg(&client->dev, "%s: raw dtr=%x\n", __func__, dtr); |
282 | 257 | ||
283 | *trim = 0; | 258 | *trim = 0; |
284 | 259 | ||
@@ -306,11 +281,11 @@ static int x1205_get_atrim(struct i2c_client *client, int *trim) | |||
306 | 281 | ||
307 | /* read atr register */ | 282 | /* read atr register */ |
308 | if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) { | 283 | if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) { |
309 | dev_err(&client->dev, "%s: read error\n", __FUNCTION__); | 284 | dev_err(&client->dev, "%s: read error\n", __func__); |
310 | return -EIO; | 285 | return -EIO; |
311 | } | 286 | } |
312 | 287 | ||
313 | dev_dbg(&client->dev, "%s: raw atr=%x\n", __FUNCTION__, atr); | 288 | dev_dbg(&client->dev, "%s: raw atr=%x\n", __func__, atr); |
314 | 289 | ||
315 | /* atr is a two's complement value on 6 bits, | 290 | /* atr is a two's complement value on 6 bits, |
316 | * perform sign extension. The formula is | 291 | * perform sign extension. The formula is |
@@ -319,11 +294,11 @@ static int x1205_get_atrim(struct i2c_client *client, int *trim) | |||
319 | if (atr & 0x20) | 294 | if (atr & 0x20) |
320 | atr |= 0xC0; | 295 | atr |= 0xC0; |
321 | 296 | ||
322 | dev_dbg(&client->dev, "%s: raw atr=%x (%d)\n", __FUNCTION__, atr, atr); | 297 | dev_dbg(&client->dev, "%s: raw atr=%x (%d)\n", __func__, atr, atr); |
323 | 298 | ||
324 | *trim = (atr * 250) + 11000; | 299 | *trim = (atr * 250) + 11000; |
325 | 300 | ||
326 | dev_dbg(&client->dev, "%s: real=%d\n", __FUNCTION__, *trim); | 301 | dev_dbg(&client->dev, "%s: real=%d\n", __func__, *trim); |
327 | 302 | ||
328 | return 0; | 303 | return 0; |
329 | } | 304 | } |
@@ -377,7 +352,7 @@ static int x1205_validate_client(struct i2c_client *client) | |||
377 | if ((xfer = i2c_transfer(client->adapter, msgs, 2)) != 2) { | 352 | if ((xfer = i2c_transfer(client->adapter, msgs, 2)) != 2) { |
378 | dev_err(&client->dev, | 353 | dev_err(&client->dev, |
379 | "%s: could not read register %x\n", | 354 | "%s: could not read register %x\n", |
380 | __FUNCTION__, probe_zero_pattern[i]); | 355 | __func__, probe_zero_pattern[i]); |
381 | 356 | ||
382 | return -EIO; | 357 | return -EIO; |
383 | } | 358 | } |
@@ -385,7 +360,7 @@ static int x1205_validate_client(struct i2c_client *client) | |||
385 | if ((buf & probe_zero_pattern[i+1]) != 0) { | 360 | if ((buf & probe_zero_pattern[i+1]) != 0) { |
386 | dev_err(&client->dev, | 361 | dev_err(&client->dev, |
387 | "%s: register=%02x, zero pattern=%d, value=%x\n", | 362 | "%s: register=%02x, zero pattern=%d, value=%x\n", |
388 | __FUNCTION__, probe_zero_pattern[i], i, buf); | 363 | __func__, probe_zero_pattern[i], i, buf); |
389 | 364 | ||
390 | return -ENODEV; | 365 | return -ENODEV; |
391 | } | 366 | } |
@@ -405,7 +380,7 @@ static int x1205_validate_client(struct i2c_client *client) | |||
405 | if ((xfer = i2c_transfer(client->adapter, msgs, 2)) != 2) { | 380 | if ((xfer = i2c_transfer(client->adapter, msgs, 2)) != 2) { |
406 | dev_err(&client->dev, | 381 | dev_err(&client->dev, |
407 | "%s: could not read register %x\n", | 382 | "%s: could not read register %x\n", |
408 | __FUNCTION__, probe_limits_pattern[i].reg); | 383 | __func__, probe_limits_pattern[i].reg); |
409 | 384 | ||
410 | return -EIO; | 385 | return -EIO; |
411 | } | 386 | } |
@@ -416,7 +391,7 @@ static int x1205_validate_client(struct i2c_client *client) | |||
416 | value < probe_limits_pattern[i].min) { | 391 | value < probe_limits_pattern[i].min) { |
417 | dev_dbg(&client->dev, | 392 | dev_dbg(&client->dev, |
418 | "%s: register=%x, lim pattern=%d, value=%d\n", | 393 | "%s: register=%x, lim pattern=%d, value=%d\n", |
419 | __FUNCTION__, probe_limits_pattern[i].reg, | 394 | __func__, probe_limits_pattern[i].reg, |
420 | i, value); | 395 | i, value); |
421 | 396 | ||
422 | return -ENODEV; | 397 | return -ENODEV; |
@@ -497,58 +472,49 @@ static ssize_t x1205_sysfs_show_dtrim(struct device *dev, | |||
497 | } | 472 | } |
498 | static DEVICE_ATTR(dtrim, S_IRUGO, x1205_sysfs_show_dtrim, NULL); | 473 | static DEVICE_ATTR(dtrim, S_IRUGO, x1205_sysfs_show_dtrim, NULL); |
499 | 474 | ||
500 | static int x1205_attach(struct i2c_adapter *adapter) | 475 | static int x1205_sysfs_register(struct device *dev) |
476 | { | ||
477 | int err; | ||
478 | |||
479 | err = device_create_file(dev, &dev_attr_atrim); | ||
480 | if (err) | ||
481 | return err; | ||
482 | |||
483 | err = device_create_file(dev, &dev_attr_dtrim); | ||
484 | if (err) | ||
485 | device_remove_file(dev, &dev_attr_atrim); | ||
486 | |||
487 | return err; | ||
488 | } | ||
489 | |||
490 | static void x1205_sysfs_unregister(struct device *dev) | ||
501 | { | 491 | { |
502 | return i2c_probe(adapter, &addr_data, x1205_probe); | 492 | device_remove_file(dev, &dev_attr_atrim); |
493 | device_remove_file(dev, &dev_attr_dtrim); | ||
503 | } | 494 | } |
504 | 495 | ||
505 | static int x1205_probe(struct i2c_adapter *adapter, int address, int kind) | 496 | |
497 | static int x1205_probe(struct i2c_client *client) | ||
506 | { | 498 | { |
507 | int err = 0; | 499 | int err = 0; |
508 | unsigned char sr; | 500 | unsigned char sr; |
509 | struct i2c_client *client; | ||
510 | struct rtc_device *rtc; | 501 | struct rtc_device *rtc; |
511 | 502 | ||
512 | dev_dbg(&adapter->dev, "%s\n", __FUNCTION__); | 503 | dev_dbg(&client->dev, "%s\n", __func__); |
513 | |||
514 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { | ||
515 | err = -ENODEV; | ||
516 | goto exit; | ||
517 | } | ||
518 | |||
519 | if (!(client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL))) { | ||
520 | err = -ENOMEM; | ||
521 | goto exit; | ||
522 | } | ||
523 | |||
524 | /* I2C client */ | ||
525 | client->addr = address; | ||
526 | client->driver = &x1205_driver; | ||
527 | client->adapter = adapter; | ||
528 | 504 | ||
529 | strlcpy(client->name, x1205_driver.driver.name, I2C_NAME_SIZE); | 505 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) |
530 | 506 | return -ENODEV; | |
531 | /* Verify the chip is really an X1205 */ | ||
532 | if (kind < 0) { | ||
533 | if (x1205_validate_client(client) < 0) { | ||
534 | err = -ENODEV; | ||
535 | goto exit_kfree; | ||
536 | } | ||
537 | } | ||
538 | 507 | ||
539 | /* Inform the i2c layer */ | 508 | if (x1205_validate_client(client) < 0) |
540 | if ((err = i2c_attach_client(client))) | 509 | return -ENODEV; |
541 | goto exit_kfree; | ||
542 | 510 | ||
543 | dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); | 511 | dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); |
544 | 512 | ||
545 | rtc = rtc_device_register(x1205_driver.driver.name, &client->dev, | 513 | rtc = rtc_device_register(x1205_driver.driver.name, &client->dev, |
546 | &x1205_rtc_ops, THIS_MODULE); | 514 | &x1205_rtc_ops, THIS_MODULE); |
547 | 515 | ||
548 | if (IS_ERR(rtc)) { | 516 | if (IS_ERR(rtc)) |
549 | err = PTR_ERR(rtc); | 517 | return PTR_ERR(rtc); |
550 | goto exit_detach; | ||
551 | } | ||
552 | 518 | ||
553 | i2c_set_clientdata(client, rtc); | 519 | i2c_set_clientdata(client, rtc); |
554 | 520 | ||
@@ -565,45 +531,35 @@ static int x1205_probe(struct i2c_adapter *adapter, int address, int kind) | |||
565 | else | 531 | else |
566 | dev_err(&client->dev, "couldn't read status\n"); | 532 | dev_err(&client->dev, "couldn't read status\n"); |
567 | 533 | ||
568 | err = device_create_file(&client->dev, &dev_attr_atrim); | 534 | err = x1205_sysfs_register(&client->dev); |
569 | if (err) goto exit_devreg; | 535 | if (err) |
570 | err = device_create_file(&client->dev, &dev_attr_dtrim); | 536 | goto exit_devreg; |
571 | if (err) goto exit_atrim; | ||
572 | 537 | ||
573 | return 0; | 538 | return 0; |
574 | 539 | ||
575 | exit_atrim: | ||
576 | device_remove_file(&client->dev, &dev_attr_atrim); | ||
577 | |||
578 | exit_devreg: | 540 | exit_devreg: |
579 | rtc_device_unregister(rtc); | 541 | rtc_device_unregister(rtc); |
580 | 542 | ||
581 | exit_detach: | ||
582 | i2c_detach_client(client); | ||
583 | |||
584 | exit_kfree: | ||
585 | kfree(client); | ||
586 | |||
587 | exit: | ||
588 | return err; | 543 | return err; |
589 | } | 544 | } |
590 | 545 | ||
591 | static int x1205_detach(struct i2c_client *client) | 546 | static int x1205_remove(struct i2c_client *client) |
592 | { | 547 | { |
593 | int err; | ||
594 | struct rtc_device *rtc = i2c_get_clientdata(client); | 548 | struct rtc_device *rtc = i2c_get_clientdata(client); |
595 | 549 | ||
596 | if (rtc) | 550 | rtc_device_unregister(rtc); |
597 | rtc_device_unregister(rtc); | 551 | x1205_sysfs_unregister(&client->dev); |
598 | |||
599 | if ((err = i2c_detach_client(client))) | ||
600 | return err; | ||
601 | |||
602 | kfree(client); | ||
603 | |||
604 | return 0; | 552 | return 0; |
605 | } | 553 | } |
606 | 554 | ||
555 | static struct i2c_driver x1205_driver = { | ||
556 | .driver = { | ||
557 | .name = "rtc-x1205", | ||
558 | }, | ||
559 | .probe = x1205_probe, | ||
560 | .remove = x1205_remove, | ||
561 | }; | ||
562 | |||
607 | static int __init x1205_init(void) | 563 | static int __init x1205_init(void) |
608 | { | 564 | { |
609 | return i2c_add_driver(&x1205_driver); | 565 | return i2c_add_driver(&x1205_driver); |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 04787eab1016..bb52d2fbac18 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -36,7 +36,7 @@ static int dcssblk_open(struct inode *inode, struct file *filp); | |||
36 | static int dcssblk_release(struct inode *inode, struct file *filp); | 36 | static int dcssblk_release(struct inode *inode, struct file *filp); |
37 | static int dcssblk_make_request(struct request_queue *q, struct bio *bio); | 37 | static int dcssblk_make_request(struct request_queue *q, struct bio *bio); |
38 | static int dcssblk_direct_access(struct block_device *bdev, sector_t secnum, | 38 | static int dcssblk_direct_access(struct block_device *bdev, sector_t secnum, |
39 | unsigned long *data); | 39 | void **kaddr, unsigned long *pfn); |
40 | 40 | ||
41 | static char dcssblk_segments[DCSSBLK_PARM_LEN] = "\0"; | 41 | static char dcssblk_segments[DCSSBLK_PARM_LEN] = "\0"; |
42 | 42 | ||
@@ -636,7 +636,7 @@ fail: | |||
636 | 636 | ||
637 | static int | 637 | static int |
638 | dcssblk_direct_access (struct block_device *bdev, sector_t secnum, | 638 | dcssblk_direct_access (struct block_device *bdev, sector_t secnum, |
639 | unsigned long *data) | 639 | void **kaddr, unsigned long *pfn) |
640 | { | 640 | { |
641 | struct dcssblk_dev_info *dev_info; | 641 | struct dcssblk_dev_info *dev_info; |
642 | unsigned long pgoff; | 642 | unsigned long pgoff; |
@@ -649,7 +649,9 @@ dcssblk_direct_access (struct block_device *bdev, sector_t secnum, | |||
649 | pgoff = secnum / (PAGE_SIZE / 512); | 649 | pgoff = secnum / (PAGE_SIZE / 512); |
650 | if ((pgoff+1)*PAGE_SIZE-1 > dev_info->end - dev_info->start) | 650 | if ((pgoff+1)*PAGE_SIZE-1 > dev_info->end - dev_info->start) |
651 | return -ERANGE; | 651 | return -ERANGE; |
652 | *data = (unsigned long) (dev_info->start+pgoff*PAGE_SIZE); | 652 | *kaddr = (void *) (dev_info->start+pgoff*PAGE_SIZE); |
653 | *pfn = virt_to_phys(*kaddr) >> PAGE_SHIFT; | ||
654 | |||
653 | return 0; | 655 | return 0; |
654 | } | 656 | } |
655 | 657 | ||
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c index 2aa6bfe8fdb3..f59463601874 100644 --- a/drivers/serial/68360serial.c +++ b/drivers/serial/68360serial.c | |||
@@ -51,6 +51,7 @@ extern int kgdb_output_string (const char* s, unsigned int count); | |||
51 | 51 | ||
52 | /* #ifdef CONFIG_SERIAL_CONSOLE */ /* This seems to be a post 2.0 thing - mles */ | 52 | /* #ifdef CONFIG_SERIAL_CONSOLE */ /* This seems to be a post 2.0 thing - mles */ |
53 | #include <linux/console.h> | 53 | #include <linux/console.h> |
54 | #include <linux/jiffies.h> | ||
54 | 55 | ||
55 | /* this defines the index into rs_table for the port to use | 56 | /* this defines the index into rs_table for the port to use |
56 | */ | 57 | */ |
@@ -1729,7 +1730,7 @@ static void rs_360_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1729 | msleep_interruptible(jiffies_to_msecs(char_time)); | 1730 | msleep_interruptible(jiffies_to_msecs(char_time)); |
1730 | if (signal_pending(current)) | 1731 | if (signal_pending(current)) |
1731 | break; | 1732 | break; |
1732 | if (timeout && ((orig_jiffies + timeout) < jiffies)) | 1733 | if (timeout && (time_after(jiffies, orig_jiffies + timeout))) |
1733 | break; | 1734 | break; |
1734 | /* The 'tx_cur' is really the next buffer to send. We | 1735 | /* The 'tx_cur' is really the next buffer to send. We |
1735 | * have to back up to the previous BD and wait for it | 1736 | * have to back up to the previous BD and wait for it |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 96a585e1cee8..ea41f2626458 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -1868,6 +1868,7 @@ static int serial8250_startup(struct uart_port *port) | |||
1868 | } | 1868 | } |
1869 | 1869 | ||
1870 | if (is_real_interrupt(up->port.irq)) { | 1870 | if (is_real_interrupt(up->port.irq)) { |
1871 | unsigned char iir1; | ||
1871 | /* | 1872 | /* |
1872 | * Test for UARTs that do not reassert THRE when the | 1873 | * Test for UARTs that do not reassert THRE when the |
1873 | * transmitter is idle and the interrupt has already | 1874 | * transmitter is idle and the interrupt has already |
@@ -1881,7 +1882,7 @@ static int serial8250_startup(struct uart_port *port) | |||
1881 | wait_for_xmitr(up, UART_LSR_THRE); | 1882 | wait_for_xmitr(up, UART_LSR_THRE); |
1882 | serial_out_sync(up, UART_IER, UART_IER_THRI); | 1883 | serial_out_sync(up, UART_IER, UART_IER_THRI); |
1883 | udelay(1); /* allow THRE to set */ | 1884 | udelay(1); /* allow THRE to set */ |
1884 | serial_in(up, UART_IIR); | 1885 | iir1 = serial_in(up, UART_IIR); |
1885 | serial_out(up, UART_IER, 0); | 1886 | serial_out(up, UART_IER, 0); |
1886 | serial_out_sync(up, UART_IER, UART_IER_THRI); | 1887 | serial_out_sync(up, UART_IER, UART_IER_THRI); |
1887 | udelay(1); /* allow a working UART time to re-assert THRE */ | 1888 | udelay(1); /* allow a working UART time to re-assert THRE */ |
@@ -1894,7 +1895,7 @@ static int serial8250_startup(struct uart_port *port) | |||
1894 | * If the interrupt is not reasserted, setup a timer to | 1895 | * If the interrupt is not reasserted, setup a timer to |
1895 | * kick the UART on a regular basis. | 1896 | * kick the UART on a regular basis. |
1896 | */ | 1897 | */ |
1897 | if (iir & UART_IIR_NO_INT) { | 1898 | if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { |
1898 | pr_debug("ttyS%d - using backup timer\n", port->line); | 1899 | pr_debug("ttyS%d - using backup timer\n", port->line); |
1899 | up->timer.function = serial8250_backup_timeout; | 1900 | up->timer.function = serial8250_backup_timeout; |
1900 | up->timer.data = (unsigned long)up; | 1901 | up->timer.data = (unsigned long)up; |
@@ -2228,7 +2229,9 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios, | |||
2228 | } | 2229 | } |
2229 | serial8250_set_mctrl(&up->port, up->port.mctrl); | 2230 | serial8250_set_mctrl(&up->port, up->port.mctrl); |
2230 | spin_unlock_irqrestore(&up->port.lock, flags); | 2231 | spin_unlock_irqrestore(&up->port.lock, flags); |
2231 | tty_termios_encode_baud_rate(termios, baud, baud); | 2232 | /* Don't rewrite B0 */ |
2233 | if (tty_termios_baud_rate(termios)) | ||
2234 | tty_termios_encode_baud_rate(termios, baud, baud); | ||
2232 | } | 2235 | } |
2233 | 2236 | ||
2234 | static void | 2237 | static void |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index f97224ce59da..6e57382b9137 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -775,7 +775,7 @@ pci_default_setup(struct serial_private *priv, struct pciserial_board *board, | |||
775 | * This list is ordered alphabetically by vendor then device. | 775 | * This list is ordered alphabetically by vendor then device. |
776 | * Specific entries must come before more generic entries. | 776 | * Specific entries must come before more generic entries. |
777 | */ | 777 | */ |
778 | static struct pci_serial_quirk pci_serial_quirks[] = { | 778 | static struct pci_serial_quirk pci_serial_quirks[] __refdata = { |
779 | /* | 779 | /* |
780 | * ADDI-DATA GmbH communication cards <info@addi-data.com> | 780 | * ADDI-DATA GmbH communication cards <info@addi-data.com> |
781 | */ | 781 | */ |
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 55492fa095a2..c065a704a93a 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
@@ -96,7 +96,6 @@ | |||
96 | 96 | ||
97 | /* PDC registers */ | 97 | /* PDC registers */ |
98 | #define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) | 98 | #define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) |
99 | #define UART_GET_TCR(port) __raw_readl((port)->membase + ATMEL_PDC_TCR) | ||
100 | #define UART_GET_PTSR(port) __raw_readl((port)->membase + ATMEL_PDC_PTSR) | 99 | #define UART_GET_PTSR(port) __raw_readl((port)->membase + ATMEL_PDC_PTSR) |
101 | 100 | ||
102 | #define UART_PUT_RPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RPR) | 101 | #define UART_PUT_RPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RPR) |
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index 383c4e660cd5..88e7c1d5b919 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -3582,6 +3582,8 @@ rs_tiocmset(struct tty_struct *tty, struct file *file, | |||
3582 | { | 3582 | { |
3583 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | 3583 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; |
3584 | 3584 | ||
3585 | lock_kernel(); | ||
3586 | |||
3585 | if (clear & TIOCM_RTS) | 3587 | if (clear & TIOCM_RTS) |
3586 | e100_rts(info, 0); | 3588 | e100_rts(info, 0); |
3587 | if (clear & TIOCM_DTR) | 3589 | if (clear & TIOCM_DTR) |
@@ -3601,6 +3603,8 @@ rs_tiocmset(struct tty_struct *tty, struct file *file, | |||
3601 | e100_ri_out(info, 1); | 3603 | e100_ri_out(info, 1); |
3602 | if (set & TIOCM_CD) | 3604 | if (set & TIOCM_CD) |
3603 | e100_cd_out(info, 1); | 3605 | e100_cd_out(info, 1); |
3606 | |||
3607 | unlock_kernel(); | ||
3604 | return 0; | 3608 | return 0; |
3605 | } | 3609 | } |
3606 | 3610 | ||
@@ -3610,6 +3614,7 @@ rs_tiocmget(struct tty_struct *tty, struct file *file) | |||
3610 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | 3614 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; |
3611 | unsigned int result; | 3615 | unsigned int result; |
3612 | 3616 | ||
3617 | lock_kernel(); | ||
3613 | result = | 3618 | result = |
3614 | (!E100_RTS_GET(info) ? TIOCM_RTS : 0) | 3619 | (!E100_RTS_GET(info) ? TIOCM_RTS : 0) |
3615 | | (!E100_DTR_GET(info) ? TIOCM_DTR : 0) | 3620 | | (!E100_DTR_GET(info) ? TIOCM_DTR : 0) |
@@ -3618,6 +3623,8 @@ rs_tiocmget(struct tty_struct *tty, struct file *file) | |||
3618 | | (!E100_CD_GET(info) ? TIOCM_CAR : 0) | 3623 | | (!E100_CD_GET(info) ? TIOCM_CAR : 0) |
3619 | | (!E100_CTS_GET(info) ? TIOCM_CTS : 0); | 3624 | | (!E100_CTS_GET(info) ? TIOCM_CTS : 0); |
3620 | 3625 | ||
3626 | unlock_kernel(); | ||
3627 | |||
3621 | #ifdef SERIAL_DEBUG_IO | 3628 | #ifdef SERIAL_DEBUG_IO |
3622 | printk(KERN_DEBUG "ser%i: modem state: %i 0x%08X\n", | 3629 | printk(KERN_DEBUG "ser%i: modem state: %i 0x%08X\n", |
3623 | info->line, result, result); | 3630 | info->line, result, result); |
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c index 116211fcd36f..0dddd68b20d2 100644 --- a/drivers/serial/dz.c +++ b/drivers/serial/dz.c | |||
@@ -819,7 +819,7 @@ static void dz_console_putchar(struct uart_port *uport, int ch) | |||
819 | dz_out(dport, DZ_TCR, mask); | 819 | dz_out(dport, DZ_TCR, mask); |
820 | iob(); | 820 | iob(); |
821 | udelay(2); | 821 | udelay(2); |
822 | } while (loops--); | 822 | } while (--loops); |
823 | 823 | ||
824 | if (loops) /* Cannot send otherwise. */ | 824 | if (loops) /* Cannot send otherwise. */ |
825 | dz_out(dport, DZ_TDR, ch); | 825 | dz_out(dport, DZ_TDR, ch); |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index a9ca03ead3e5..977ce820ce30 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -329,13 +329,15 @@ EXPORT_SYMBOL(uart_update_timeout); | |||
329 | * If it's still invalid, we try 9600 baud. | 329 | * If it's still invalid, we try 9600 baud. |
330 | * | 330 | * |
331 | * Update the @termios structure to reflect the baud rate | 331 | * Update the @termios structure to reflect the baud rate |
332 | * we're actually going to be using. | 332 | * we're actually going to be using. Don't do this for the case |
333 | * where B0 is requested ("hang up"). | ||
333 | */ | 334 | */ |
334 | unsigned int | 335 | unsigned int |
335 | uart_get_baud_rate(struct uart_port *port, struct ktermios *termios, | 336 | uart_get_baud_rate(struct uart_port *port, struct ktermios *termios, |
336 | struct ktermios *old, unsigned int min, unsigned int max) | 337 | struct ktermios *old, unsigned int min, unsigned int max) |
337 | { | 338 | { |
338 | unsigned int try, baud, altbaud = 38400; | 339 | unsigned int try, baud, altbaud = 38400; |
340 | int hung_up = 0; | ||
339 | upf_t flags = port->flags & UPF_SPD_MASK; | 341 | upf_t flags = port->flags & UPF_SPD_MASK; |
340 | 342 | ||
341 | if (flags == UPF_SPD_HI) | 343 | if (flags == UPF_SPD_HI) |
@@ -360,8 +362,10 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios, | |||
360 | /* | 362 | /* |
361 | * Special case: B0 rate. | 363 | * Special case: B0 rate. |
362 | */ | 364 | */ |
363 | if (baud == 0) | 365 | if (baud == 0) { |
366 | hung_up = 1; | ||
364 | baud = 9600; | 367 | baud = 9600; |
368 | } | ||
365 | 369 | ||
366 | if (baud >= min && baud <= max) | 370 | if (baud >= min && baud <= max) |
367 | return baud; | 371 | return baud; |
@@ -373,7 +377,9 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios, | |||
373 | termios->c_cflag &= ~CBAUD; | 377 | termios->c_cflag &= ~CBAUD; |
374 | if (old) { | 378 | if (old) { |
375 | baud = tty_termios_baud_rate(old); | 379 | baud = tty_termios_baud_rate(old); |
376 | tty_termios_encode_baud_rate(termios, baud, baud); | 380 | if (!hung_up) |
381 | tty_termios_encode_baud_rate(termios, | ||
382 | baud, baud); | ||
377 | old = NULL; | 383 | old = NULL; |
378 | continue; | 384 | continue; |
379 | } | 385 | } |
@@ -382,7 +388,8 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios, | |||
382 | * As a last resort, if the quotient is zero, | 388 | * As a last resort, if the quotient is zero, |
383 | * default to 9600 bps | 389 | * default to 9600 bps |
384 | */ | 390 | */ |
385 | tty_termios_encode_baud_rate(termios, 9600, 9600); | 391 | if (!hung_up) |
392 | tty_termios_encode_baud_rate(termios, 9600, 9600); | ||
386 | } | 393 | } |
387 | 394 | ||
388 | return 0; | 395 | return 0; |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index 3271379a36db..90a20a152ebf 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
@@ -1231,7 +1231,7 @@ static inline struct console *SUNZILOG_CONSOLE(void) | |||
1231 | #define SUNZILOG_CONSOLE() (NULL) | 1231 | #define SUNZILOG_CONSOLE() (NULL) |
1232 | #endif | 1232 | #endif |
1233 | 1233 | ||
1234 | static void __devinit sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channel) | 1234 | static void __devinit sunzilog_init_kbdms(struct uart_sunzilog_port *up) |
1235 | { | 1235 | { |
1236 | int baud, brg; | 1236 | int baud, brg; |
1237 | 1237 | ||
@@ -1305,7 +1305,7 @@ static void __devinit sunzilog_init_hw(struct uart_sunzilog_port *up) | |||
1305 | up->curregs[R7] = 0x7E; /* SDLC Flag */ | 1305 | up->curregs[R7] = 0x7E; /* SDLC Flag */ |
1306 | up->curregs[R9] = NV; | 1306 | up->curregs[R9] = NV; |
1307 | up->curregs[R7p] = 0x00; | 1307 | up->curregs[R7p] = 0x00; |
1308 | sunzilog_init_kbdms(up, up->port.line); | 1308 | sunzilog_init_kbdms(up); |
1309 | /* Only enable interrupts if an ISR handler available */ | 1309 | /* Only enable interrupts if an ISR handler available */ |
1310 | if (up->flags & SUNZILOG_FLAG_ISR_HANDLER) | 1310 | if (up->flags & SUNZILOG_FLAG_ISR_HANDLER) |
1311 | up->curregs[R9] |= MIE; | 1311 | up->curregs[R9] |= MIE; |
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c index 98ab649c1ff9..bb6ce6bba32f 100644 --- a/drivers/serial/vr41xx_siu.c +++ b/drivers/serial/vr41xx_siu.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for NEC VR4100 series Serial Interface Unit. | 2 | * Driver for NEC VR4100 series Serial Interface Unit. |
3 | * | 3 | * |
4 | * Copyright (C) 2004-2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> | 4 | * Copyright (C) 2004-2008 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> |
5 | * | 5 | * |
6 | * Based on drivers/serial/8250.c, by Russell King. | 6 | * Based on drivers/serial/8250.c, by Russell King. |
7 | * | 7 | * |
@@ -840,6 +840,19 @@ static int __devinit siu_console_init(void) | |||
840 | 840 | ||
841 | console_initcall(siu_console_init); | 841 | console_initcall(siu_console_init); |
842 | 842 | ||
843 | void __init vr41xx_siu_early_setup(struct uart_port *port) | ||
844 | { | ||
845 | if (port->type == PORT_UNKNOWN) | ||
846 | return; | ||
847 | |||
848 | siu_uart_ports[port->line].line = port->line; | ||
849 | siu_uart_ports[port->line].type = port->type; | ||
850 | siu_uart_ports[port->line].uartclk = SIU_BAUD_BASE * 16; | ||
851 | siu_uart_ports[port->line].mapbase = port->mapbase; | ||
852 | siu_uart_ports[port->line].mapbase = port->mapbase; | ||
853 | siu_uart_ports[port->line].ops = &siu_uart_ops; | ||
854 | } | ||
855 | |||
843 | #define SERIAL_VR41XX_CONSOLE &siu_console | 856 | #define SERIAL_VR41XX_CONSOLE &siu_console |
844 | #else | 857 | #else |
845 | #define SERIAL_VR41XX_CONSOLE NULL | 858 | #define SERIAL_VR41XX_CONSOLE NULL |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index d8107890db15..fae9e8f3d092 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -5,11 +5,9 @@ | |||
5 | # nobody's needed a slave side API yet. The master-role API is not | 5 | # nobody's needed a slave side API yet. The master-role API is not |
6 | # fully appropriate there, so it'd need some thought to do well. | 6 | # fully appropriate there, so it'd need some thought to do well. |
7 | # | 7 | # |
8 | menu "SPI support" | 8 | menuconfig SPI |
9 | depends on HAS_IOMEM | ||
10 | |||
11 | config SPI | ||
12 | bool "SPI support" | 9 | bool "SPI support" |
10 | depends on HAS_IOMEM | ||
13 | help | 11 | help |
14 | The "Serial Peripheral Interface" is a low level synchronous | 12 | The "Serial Peripheral Interface" is a low level synchronous |
15 | protocol. Chips that support SPI can have data transfer rates | 13 | protocol. Chips that support SPI can have data transfer rates |
@@ -28,9 +26,11 @@ config SPI | |||
28 | (half duplex), SSP, SSI, and PSP. This driver framework should | 26 | (half duplex), SSP, SSI, and PSP. This driver framework should |
29 | work with most such devices and controllers. | 27 | work with most such devices and controllers. |
30 | 28 | ||
29 | if SPI | ||
30 | |||
31 | config SPI_DEBUG | 31 | config SPI_DEBUG |
32 | boolean "Debug support for SPI drivers" | 32 | boolean "Debug support for SPI drivers" |
33 | depends on SPI && DEBUG_KERNEL | 33 | depends on DEBUG_KERNEL |
34 | help | 34 | help |
35 | Say "yes" to enable debug messaging (like dev_dbg and pr_debug), | 35 | Say "yes" to enable debug messaging (like dev_dbg and pr_debug), |
36 | sysfs, and debugfs support in SPI controller and protocol drivers. | 36 | sysfs, and debugfs support in SPI controller and protocol drivers. |
@@ -245,5 +245,4 @@ config SPI_TLE62X0 | |||
245 | 245 | ||
246 | # (slave support would go here) | 246 | # (slave support would go here) |
247 | 247 | ||
248 | endmenu # "SPI support" | 248 | endif # SPI |
249 | |||
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 1749a27be066..02c8e305b14f 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c | |||
@@ -616,7 +616,7 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg) | |||
616 | return -ESHUTDOWN; | 616 | return -ESHUTDOWN; |
617 | 617 | ||
618 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | 618 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
619 | if (!(xfer->tx_buf || xfer->rx_buf)) { | 619 | if (!(xfer->tx_buf || xfer->rx_buf) && xfer->len) { |
620 | dev_dbg(&spi->dev, "missing rx or tx buf\n"); | 620 | dev_dbg(&spi->dev, "missing rx or tx buf\n"); |
621 | return -EINVAL; | 621 | return -EINVAL; |
622 | } | 622 | } |
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/omap_uwire.c index 5f00bd6500ef..d9ae111c27ae 100644 --- a/drivers/spi/omap_uwire.c +++ b/drivers/spi/omap_uwire.c | |||
@@ -151,7 +151,7 @@ static int wait_uwire_csr_flag(u16 mask, u16 val, int might_not_catch) | |||
151 | if (time_after(jiffies, max_jiffies)) { | 151 | if (time_after(jiffies, max_jiffies)) { |
152 | printk(KERN_ERR "%s: timeout. reg=%#06x " | 152 | printk(KERN_ERR "%s: timeout. reg=%#06x " |
153 | "mask=%#06x val=%#06x\n", | 153 | "mask=%#06x val=%#06x\n", |
154 | __FUNCTION__, w, mask, val); | 154 | __func__, w, mask, val); |
155 | return -1; | 155 | return -1; |
156 | } | 156 | } |
157 | c++; | 157 | c++; |
@@ -437,7 +437,7 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
437 | } | 437 | } |
438 | omap_uwire_configure_mode(spi->chip_select, flags); | 438 | omap_uwire_configure_mode(spi->chip_select, flags); |
439 | pr_debug("%s: uwire flags %02x, armxor %lu KHz, SCK %lu KHz\n", | 439 | pr_debug("%s: uwire flags %02x, armxor %lu KHz, SCK %lu KHz\n", |
440 | __FUNCTION__, flags, | 440 | __func__, flags, |
441 | clk_get_rate(uwire->ck) / 1000, | 441 | clk_get_rate(uwire->ck) / 1000, |
442 | rate / 1000); | 442 | rate / 1000); |
443 | status = 0; | 443 | status = 0; |
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index 147e26a78d64..654bb58be630 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c | |||
@@ -67,8 +67,11 @@ MODULE_ALIAS("platform:pxa2xx-spi"); | |||
67 | | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM) | 67 | | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM) |
68 | 68 | ||
69 | #define DEFINE_SSP_REG(reg, off) \ | 69 | #define DEFINE_SSP_REG(reg, off) \ |
70 | static inline u32 read_##reg(void *p) { return __raw_readl(p + (off)); } \ | 70 | static inline u32 read_##reg(void const __iomem *p) \ |
71 | static inline void write_##reg(u32 v, void *p) { __raw_writel(v, p + (off)); } | 71 | { return __raw_readl(p + (off)); } \ |
72 | \ | ||
73 | static inline void write_##reg(u32 v, void __iomem *p) \ | ||
74 | { __raw_writel(v, p + (off)); } | ||
72 | 75 | ||
73 | DEFINE_SSP_REG(SSCR0, 0x00) | 76 | DEFINE_SSP_REG(SSCR0, 0x00) |
74 | DEFINE_SSP_REG(SSCR1, 0x04) | 77 | DEFINE_SSP_REG(SSCR1, 0x04) |
@@ -106,7 +109,7 @@ struct driver_data { | |||
106 | u32 *null_dma_buf; | 109 | u32 *null_dma_buf; |
107 | 110 | ||
108 | /* SSP register addresses */ | 111 | /* SSP register addresses */ |
109 | void *ioaddr; | 112 | void __iomem *ioaddr; |
110 | u32 ssdr_physical; | 113 | u32 ssdr_physical; |
111 | 114 | ||
112 | /* SSP masks*/ | 115 | /* SSP masks*/ |
@@ -173,7 +176,7 @@ static int flush(struct driver_data *drv_data) | |||
173 | { | 176 | { |
174 | unsigned long limit = loops_per_jiffy << 1; | 177 | unsigned long limit = loops_per_jiffy << 1; |
175 | 178 | ||
176 | void *reg = drv_data->ioaddr; | 179 | void __iomem *reg = drv_data->ioaddr; |
177 | 180 | ||
178 | do { | 181 | do { |
179 | while (read_SSSR(reg) & SSSR_RNE) { | 182 | while (read_SSSR(reg) & SSSR_RNE) { |
@@ -191,7 +194,7 @@ static void null_cs_control(u32 command) | |||
191 | 194 | ||
192 | static int null_writer(struct driver_data *drv_data) | 195 | static int null_writer(struct driver_data *drv_data) |
193 | { | 196 | { |
194 | void *reg = drv_data->ioaddr; | 197 | void __iomem *reg = drv_data->ioaddr; |
195 | u8 n_bytes = drv_data->n_bytes; | 198 | u8 n_bytes = drv_data->n_bytes; |
196 | 199 | ||
197 | if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) | 200 | if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) |
@@ -206,7 +209,7 @@ static int null_writer(struct driver_data *drv_data) | |||
206 | 209 | ||
207 | static int null_reader(struct driver_data *drv_data) | 210 | static int null_reader(struct driver_data *drv_data) |
208 | { | 211 | { |
209 | void *reg = drv_data->ioaddr; | 212 | void __iomem *reg = drv_data->ioaddr; |
210 | u8 n_bytes = drv_data->n_bytes; | 213 | u8 n_bytes = drv_data->n_bytes; |
211 | 214 | ||
212 | while ((read_SSSR(reg) & SSSR_RNE) | 215 | while ((read_SSSR(reg) & SSSR_RNE) |
@@ -220,7 +223,7 @@ static int null_reader(struct driver_data *drv_data) | |||
220 | 223 | ||
221 | static int u8_writer(struct driver_data *drv_data) | 224 | static int u8_writer(struct driver_data *drv_data) |
222 | { | 225 | { |
223 | void *reg = drv_data->ioaddr; | 226 | void __iomem *reg = drv_data->ioaddr; |
224 | 227 | ||
225 | if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) | 228 | if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) |
226 | || (drv_data->tx == drv_data->tx_end)) | 229 | || (drv_data->tx == drv_data->tx_end)) |
@@ -234,7 +237,7 @@ static int u8_writer(struct driver_data *drv_data) | |||
234 | 237 | ||
235 | static int u8_reader(struct driver_data *drv_data) | 238 | static int u8_reader(struct driver_data *drv_data) |
236 | { | 239 | { |
237 | void *reg = drv_data->ioaddr; | 240 | void __iomem *reg = drv_data->ioaddr; |
238 | 241 | ||
239 | while ((read_SSSR(reg) & SSSR_RNE) | 242 | while ((read_SSSR(reg) & SSSR_RNE) |
240 | && (drv_data->rx < drv_data->rx_end)) { | 243 | && (drv_data->rx < drv_data->rx_end)) { |
@@ -247,7 +250,7 @@ static int u8_reader(struct driver_data *drv_data) | |||
247 | 250 | ||
248 | static int u16_writer(struct driver_data *drv_data) | 251 | static int u16_writer(struct driver_data *drv_data) |
249 | { | 252 | { |
250 | void *reg = drv_data->ioaddr; | 253 | void __iomem *reg = drv_data->ioaddr; |
251 | 254 | ||
252 | if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) | 255 | if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) |
253 | || (drv_data->tx == drv_data->tx_end)) | 256 | || (drv_data->tx == drv_data->tx_end)) |
@@ -261,7 +264,7 @@ static int u16_writer(struct driver_data *drv_data) | |||
261 | 264 | ||
262 | static int u16_reader(struct driver_data *drv_data) | 265 | static int u16_reader(struct driver_data *drv_data) |
263 | { | 266 | { |
264 | void *reg = drv_data->ioaddr; | 267 | void __iomem *reg = drv_data->ioaddr; |
265 | 268 | ||
266 | while ((read_SSSR(reg) & SSSR_RNE) | 269 | while ((read_SSSR(reg) & SSSR_RNE) |
267 | && (drv_data->rx < drv_data->rx_end)) { | 270 | && (drv_data->rx < drv_data->rx_end)) { |
@@ -274,7 +277,7 @@ static int u16_reader(struct driver_data *drv_data) | |||
274 | 277 | ||
275 | static int u32_writer(struct driver_data *drv_data) | 278 | static int u32_writer(struct driver_data *drv_data) |
276 | { | 279 | { |
277 | void *reg = drv_data->ioaddr; | 280 | void __iomem *reg = drv_data->ioaddr; |
278 | 281 | ||
279 | if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) | 282 | if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) |
280 | || (drv_data->tx == drv_data->tx_end)) | 283 | || (drv_data->tx == drv_data->tx_end)) |
@@ -288,7 +291,7 @@ static int u32_writer(struct driver_data *drv_data) | |||
288 | 291 | ||
289 | static int u32_reader(struct driver_data *drv_data) | 292 | static int u32_reader(struct driver_data *drv_data) |
290 | { | 293 | { |
291 | void *reg = drv_data->ioaddr; | 294 | void __iomem *reg = drv_data->ioaddr; |
292 | 295 | ||
293 | while ((read_SSSR(reg) & SSSR_RNE) | 296 | while ((read_SSSR(reg) & SSSR_RNE) |
294 | && (drv_data->rx < drv_data->rx_end)) { | 297 | && (drv_data->rx < drv_data->rx_end)) { |
@@ -412,7 +415,7 @@ static void giveback(struct driver_data *drv_data) | |||
412 | msg->complete(msg->context); | 415 | msg->complete(msg->context); |
413 | } | 416 | } |
414 | 417 | ||
415 | static int wait_ssp_rx_stall(void *ioaddr) | 418 | static int wait_ssp_rx_stall(void const __iomem *ioaddr) |
416 | { | 419 | { |
417 | unsigned long limit = loops_per_jiffy << 1; | 420 | unsigned long limit = loops_per_jiffy << 1; |
418 | 421 | ||
@@ -432,9 +435,9 @@ static int wait_dma_channel_stop(int channel) | |||
432 | return limit; | 435 | return limit; |
433 | } | 436 | } |
434 | 437 | ||
435 | void dma_error_stop(struct driver_data *drv_data, const char *msg) | 438 | static void dma_error_stop(struct driver_data *drv_data, const char *msg) |
436 | { | 439 | { |
437 | void *reg = drv_data->ioaddr; | 440 | void __iomem *reg = drv_data->ioaddr; |
438 | 441 | ||
439 | /* Stop and reset */ | 442 | /* Stop and reset */ |
440 | DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; | 443 | DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; |
@@ -456,7 +459,7 @@ void dma_error_stop(struct driver_data *drv_data, const char *msg) | |||
456 | 459 | ||
457 | static void dma_transfer_complete(struct driver_data *drv_data) | 460 | static void dma_transfer_complete(struct driver_data *drv_data) |
458 | { | 461 | { |
459 | void *reg = drv_data->ioaddr; | 462 | void __iomem *reg = drv_data->ioaddr; |
460 | struct spi_message *msg = drv_data->cur_msg; | 463 | struct spi_message *msg = drv_data->cur_msg; |
461 | 464 | ||
462 | /* Clear and disable interrupts on SSP and DMA channels*/ | 465 | /* Clear and disable interrupts on SSP and DMA channels*/ |
@@ -536,7 +539,7 @@ static void dma_handler(int channel, void *data) | |||
536 | static irqreturn_t dma_transfer(struct driver_data *drv_data) | 539 | static irqreturn_t dma_transfer(struct driver_data *drv_data) |
537 | { | 540 | { |
538 | u32 irq_status; | 541 | u32 irq_status; |
539 | void *reg = drv_data->ioaddr; | 542 | void __iomem *reg = drv_data->ioaddr; |
540 | 543 | ||
541 | irq_status = read_SSSR(reg) & drv_data->mask_sr; | 544 | irq_status = read_SSSR(reg) & drv_data->mask_sr; |
542 | if (irq_status & SSSR_ROR) { | 545 | if (irq_status & SSSR_ROR) { |
@@ -570,7 +573,7 @@ static irqreturn_t dma_transfer(struct driver_data *drv_data) | |||
570 | 573 | ||
571 | static void int_error_stop(struct driver_data *drv_data, const char* msg) | 574 | static void int_error_stop(struct driver_data *drv_data, const char* msg) |
572 | { | 575 | { |
573 | void *reg = drv_data->ioaddr; | 576 | void __iomem *reg = drv_data->ioaddr; |
574 | 577 | ||
575 | /* Stop and reset SSP */ | 578 | /* Stop and reset SSP */ |
576 | write_SSSR(drv_data->clear_sr, reg); | 579 | write_SSSR(drv_data->clear_sr, reg); |
@@ -588,7 +591,7 @@ static void int_error_stop(struct driver_data *drv_data, const char* msg) | |||
588 | 591 | ||
589 | static void int_transfer_complete(struct driver_data *drv_data) | 592 | static void int_transfer_complete(struct driver_data *drv_data) |
590 | { | 593 | { |
591 | void *reg = drv_data->ioaddr; | 594 | void __iomem *reg = drv_data->ioaddr; |
592 | 595 | ||
593 | /* Stop SSP */ | 596 | /* Stop SSP */ |
594 | write_SSSR(drv_data->clear_sr, reg); | 597 | write_SSSR(drv_data->clear_sr, reg); |
@@ -614,7 +617,7 @@ static void int_transfer_complete(struct driver_data *drv_data) | |||
614 | 617 | ||
615 | static irqreturn_t interrupt_transfer(struct driver_data *drv_data) | 618 | static irqreturn_t interrupt_transfer(struct driver_data *drv_data) |
616 | { | 619 | { |
617 | void *reg = drv_data->ioaddr; | 620 | void __iomem *reg = drv_data->ioaddr; |
618 | 621 | ||
619 | u32 irq_mask = (read_SSCR1(reg) & SSCR1_TIE) ? | 622 | u32 irq_mask = (read_SSCR1(reg) & SSCR1_TIE) ? |
620 | drv_data->mask_sr : drv_data->mask_sr & ~SSSR_TFS; | 623 | drv_data->mask_sr : drv_data->mask_sr & ~SSSR_TFS; |
@@ -675,7 +678,7 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data) | |||
675 | static irqreturn_t ssp_int(int irq, void *dev_id) | 678 | static irqreturn_t ssp_int(int irq, void *dev_id) |
676 | { | 679 | { |
677 | struct driver_data *drv_data = dev_id; | 680 | struct driver_data *drv_data = dev_id; |
678 | void *reg = drv_data->ioaddr; | 681 | void __iomem *reg = drv_data->ioaddr; |
679 | 682 | ||
680 | if (!drv_data->cur_msg) { | 683 | if (!drv_data->cur_msg) { |
681 | 684 | ||
@@ -695,7 +698,8 @@ static irqreturn_t ssp_int(int irq, void *dev_id) | |||
695 | return drv_data->transfer_handler(drv_data); | 698 | return drv_data->transfer_handler(drv_data); |
696 | } | 699 | } |
697 | 700 | ||
698 | int set_dma_burst_and_threshold(struct chip_data *chip, struct spi_device *spi, | 701 | static int set_dma_burst_and_threshold(struct chip_data *chip, |
702 | struct spi_device *spi, | ||
699 | u8 bits_per_word, u32 *burst_code, | 703 | u8 bits_per_word, u32 *burst_code, |
700 | u32 *threshold) | 704 | u32 *threshold) |
701 | { | 705 | { |
@@ -809,7 +813,7 @@ static void pump_transfers(unsigned long data) | |||
809 | struct spi_transfer *previous = NULL; | 813 | struct spi_transfer *previous = NULL; |
810 | struct chip_data *chip = NULL; | 814 | struct chip_data *chip = NULL; |
811 | struct ssp_device *ssp = drv_data->ssp; | 815 | struct ssp_device *ssp = drv_data->ssp; |
812 | void *reg = drv_data->ioaddr; | 816 | void __iomem *reg = drv_data->ioaddr; |
813 | u32 clk_div = 0; | 817 | u32 clk_div = 0; |
814 | u8 bits = 0; | 818 | u8 bits = 0; |
815 | u32 speed = 0; | 819 | u32 speed = 0; |
@@ -1338,7 +1342,7 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev) | |||
1338 | struct device *dev = &pdev->dev; | 1342 | struct device *dev = &pdev->dev; |
1339 | struct pxa2xx_spi_master *platform_info; | 1343 | struct pxa2xx_spi_master *platform_info; |
1340 | struct spi_master *master; | 1344 | struct spi_master *master; |
1341 | struct driver_data *drv_data = 0; | 1345 | struct driver_data *drv_data = NULL; |
1342 | struct ssp_device *ssp; | 1346 | struct ssp_device *ssp; |
1343 | int status = 0; | 1347 | int status = 0; |
1344 | 1348 | ||
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 71e881419cdd..96cc39ecb6e2 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -214,7 +214,7 @@ int spi_bitbang_setup(struct spi_device *spi) | |||
214 | return retval; | 214 | return retval; |
215 | 215 | ||
216 | dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n", | 216 | dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n", |
217 | __FUNCTION__, spi->mode & (SPI_CPOL | SPI_CPHA), | 217 | __func__, spi->mode & (SPI_CPOL | SPI_CPHA), |
218 | spi->bits_per_word, 2 * cs->nsecs); | 218 | spi->bits_per_word, 2 * cs->nsecs); |
219 | 219 | ||
220 | /* NOTE we _need_ to call chipselect() early, ideally with adapter | 220 | /* NOTE we _need_ to call chipselect() early, ideally with adapter |
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index d4ba640366b6..c730d05bfeb6 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c | |||
@@ -270,19 +270,26 @@ struct chip_data { | |||
270 | 270 | ||
271 | static void pump_messages(struct work_struct *work); | 271 | static void pump_messages(struct work_struct *work); |
272 | 272 | ||
273 | static int flush(struct driver_data *drv_data) | 273 | static void flush(struct driver_data *drv_data) |
274 | { | 274 | { |
275 | unsigned long limit = loops_per_jiffy << 1; | ||
276 | void __iomem *regs = drv_data->regs; | 275 | void __iomem *regs = drv_data->regs; |
277 | volatile u32 d; | 276 | u32 control; |
278 | 277 | ||
279 | dev_dbg(&drv_data->pdev->dev, "flush\n"); | 278 | dev_dbg(&drv_data->pdev->dev, "flush\n"); |
279 | |||
280 | /* Wait for end of transaction */ | ||
280 | do { | 281 | do { |
281 | while (readl(regs + SPI_INT_STATUS) & SPI_STATUS_RR) | 282 | control = readl(regs + SPI_CONTROL); |
282 | d = readl(regs + SPI_RXDATA); | 283 | } while (control & SPI_CONTROL_XCH); |
283 | } while ((readl(regs + SPI_CONTROL) & SPI_CONTROL_XCH) && limit--); | 284 | |
285 | /* Release chip select if requested, transfer delays are | ||
286 | handled in pump_transfers */ | ||
287 | if (drv_data->cs_change) | ||
288 | drv_data->cs_control(SPI_CS_DEASSERT); | ||
284 | 289 | ||
285 | return limit; | 290 | /* Disable SPI to flush FIFOs */ |
291 | writel(control & ~SPI_CONTROL_SPIEN, regs + SPI_CONTROL); | ||
292 | writel(control, regs + SPI_CONTROL); | ||
286 | } | 293 | } |
287 | 294 | ||
288 | static void restore_state(struct driver_data *drv_data) | 295 | static void restore_state(struct driver_data *drv_data) |
@@ -570,6 +577,7 @@ static void giveback(struct spi_message *message, struct driver_data *drv_data) | |||
570 | writel(0, regs + SPI_INT_STATUS); | 577 | writel(0, regs + SPI_INT_STATUS); |
571 | writel(0, regs + SPI_DMA); | 578 | writel(0, regs + SPI_DMA); |
572 | 579 | ||
580 | /* Unconditioned deselct */ | ||
573 | drv_data->cs_control(SPI_CS_DEASSERT); | 581 | drv_data->cs_control(SPI_CS_DEASSERT); |
574 | 582 | ||
575 | message->state = NULL; | 583 | message->state = NULL; |
@@ -592,13 +600,10 @@ static void dma_err_handler(int channel, void *data, int errcode) | |||
592 | /* Disable both rx and tx dma channels */ | 600 | /* Disable both rx and tx dma channels */ |
593 | imx_dma_disable(drv_data->rx_channel); | 601 | imx_dma_disable(drv_data->rx_channel); |
594 | imx_dma_disable(drv_data->tx_channel); | 602 | imx_dma_disable(drv_data->tx_channel); |
595 | |||
596 | if (flush(drv_data) == 0) | ||
597 | dev_err(&drv_data->pdev->dev, | ||
598 | "dma_err_handler - flush failed\n"); | ||
599 | |||
600 | unmap_dma_buffers(drv_data); | 603 | unmap_dma_buffers(drv_data); |
601 | 604 | ||
605 | flush(drv_data); | ||
606 | |||
602 | msg->state = ERROR_STATE; | 607 | msg->state = ERROR_STATE; |
603 | tasklet_schedule(&drv_data->pump_transfers); | 608 | tasklet_schedule(&drv_data->pump_transfers); |
604 | } | 609 | } |
@@ -612,8 +617,7 @@ static void dma_tx_handler(int channel, void *data) | |||
612 | imx_dma_disable(channel); | 617 | imx_dma_disable(channel); |
613 | 618 | ||
614 | /* Now waits for TX FIFO empty */ | 619 | /* Now waits for TX FIFO empty */ |
615 | writel(readl(drv_data->regs + SPI_INT_STATUS) | SPI_INTEN_TE, | 620 | writel(SPI_INTEN_TE, drv_data->regs + SPI_INT_STATUS); |
616 | drv_data->regs + SPI_INT_STATUS); | ||
617 | } | 621 | } |
618 | 622 | ||
619 | static irqreturn_t dma_transfer(struct driver_data *drv_data) | 623 | static irqreturn_t dma_transfer(struct driver_data *drv_data) |
@@ -621,19 +625,18 @@ static irqreturn_t dma_transfer(struct driver_data *drv_data) | |||
621 | u32 status; | 625 | u32 status; |
622 | struct spi_message *msg = drv_data->cur_msg; | 626 | struct spi_message *msg = drv_data->cur_msg; |
623 | void __iomem *regs = drv_data->regs; | 627 | void __iomem *regs = drv_data->regs; |
624 | unsigned long limit; | ||
625 | 628 | ||
626 | status = readl(regs + SPI_INT_STATUS); | 629 | status = readl(regs + SPI_INT_STATUS); |
627 | 630 | ||
628 | if ((status & SPI_INTEN_RO) && (status & SPI_STATUS_RO)) { | 631 | if ((status & (SPI_INTEN_RO | SPI_STATUS_RO)) |
632 | == (SPI_INTEN_RO | SPI_STATUS_RO)) { | ||
629 | writel(status & ~SPI_INTEN, regs + SPI_INT_STATUS); | 633 | writel(status & ~SPI_INTEN, regs + SPI_INT_STATUS); |
630 | 634 | ||
635 | imx_dma_disable(drv_data->tx_channel); | ||
631 | imx_dma_disable(drv_data->rx_channel); | 636 | imx_dma_disable(drv_data->rx_channel); |
632 | unmap_dma_buffers(drv_data); | 637 | unmap_dma_buffers(drv_data); |
633 | 638 | ||
634 | if (flush(drv_data) == 0) | 639 | flush(drv_data); |
635 | dev_err(&drv_data->pdev->dev, | ||
636 | "dma_transfer - flush failed\n"); | ||
637 | 640 | ||
638 | dev_warn(&drv_data->pdev->dev, | 641 | dev_warn(&drv_data->pdev->dev, |
639 | "dma_transfer - fifo overun\n"); | 642 | "dma_transfer - fifo overun\n"); |
@@ -649,20 +652,17 @@ static irqreturn_t dma_transfer(struct driver_data *drv_data) | |||
649 | 652 | ||
650 | if (drv_data->rx) { | 653 | if (drv_data->rx) { |
651 | /* Wait end of transfer before read trailing data */ | 654 | /* Wait end of transfer before read trailing data */ |
652 | limit = loops_per_jiffy << 1; | 655 | while (readl(regs + SPI_CONTROL) & SPI_CONTROL_XCH) |
653 | while ((readl(regs + SPI_CONTROL) & SPI_CONTROL_XCH) && | 656 | cpu_relax(); |
654 | limit--); | ||
655 | |||
656 | if (limit == 0) | ||
657 | dev_err(&drv_data->pdev->dev, | ||
658 | "dma_transfer - end of tx failed\n"); | ||
659 | else | ||
660 | dev_dbg(&drv_data->pdev->dev, | ||
661 | "dma_transfer - end of tx\n"); | ||
662 | 657 | ||
663 | imx_dma_disable(drv_data->rx_channel); | 658 | imx_dma_disable(drv_data->rx_channel); |
664 | unmap_dma_buffers(drv_data); | 659 | unmap_dma_buffers(drv_data); |
665 | 660 | ||
661 | /* Release chip select if requested, transfer delays are | ||
662 | handled in pump_transfers() */ | ||
663 | if (drv_data->cs_change) | ||
664 | drv_data->cs_control(SPI_CS_DEASSERT); | ||
665 | |||
666 | /* Calculate number of trailing data and read them */ | 666 | /* Calculate number of trailing data and read them */ |
667 | dev_dbg(&drv_data->pdev->dev, | 667 | dev_dbg(&drv_data->pdev->dev, |
668 | "dma_transfer - test = 0x%08X\n", | 668 | "dma_transfer - test = 0x%08X\n", |
@@ -676,19 +676,12 @@ static irqreturn_t dma_transfer(struct driver_data *drv_data) | |||
676 | /* Write only transfer */ | 676 | /* Write only transfer */ |
677 | unmap_dma_buffers(drv_data); | 677 | unmap_dma_buffers(drv_data); |
678 | 678 | ||
679 | if (flush(drv_data) == 0) | 679 | flush(drv_data); |
680 | dev_err(&drv_data->pdev->dev, | ||
681 | "dma_transfer - flush failed\n"); | ||
682 | } | 680 | } |
683 | 681 | ||
684 | /* End of transfer, update total byte transfered */ | 682 | /* End of transfer, update total byte transfered */ |
685 | msg->actual_length += drv_data->len; | 683 | msg->actual_length += drv_data->len; |
686 | 684 | ||
687 | /* Release chip select if requested, transfer delays are | ||
688 | handled in pump_transfers() */ | ||
689 | if (drv_data->cs_change) | ||
690 | drv_data->cs_control(SPI_CS_DEASSERT); | ||
691 | |||
692 | /* Move to next transfer */ | 685 | /* Move to next transfer */ |
693 | msg->state = next_transfer(drv_data); | 686 | msg->state = next_transfer(drv_data); |
694 | 687 | ||
@@ -711,44 +704,43 @@ static irqreturn_t interrupt_wronly_transfer(struct driver_data *drv_data) | |||
711 | 704 | ||
712 | status = readl(regs + SPI_INT_STATUS); | 705 | status = readl(regs + SPI_INT_STATUS); |
713 | 706 | ||
714 | while (status & SPI_STATUS_TH) { | 707 | if (status & SPI_INTEN_TE) { |
708 | /* TXFIFO Empty Interrupt on the last transfered word */ | ||
709 | writel(status & ~SPI_INTEN, regs + SPI_INT_STATUS); | ||
715 | dev_dbg(&drv_data->pdev->dev, | 710 | dev_dbg(&drv_data->pdev->dev, |
716 | "interrupt_wronly_transfer - status = 0x%08X\n", status); | 711 | "interrupt_wronly_transfer - end of tx\n"); |
717 | 712 | ||
718 | /* Pump data */ | 713 | flush(drv_data); |
719 | if (write(drv_data)) { | ||
720 | writel(readl(regs + SPI_INT_STATUS) & ~SPI_INTEN, | ||
721 | regs + SPI_INT_STATUS); | ||
722 | 714 | ||
723 | dev_dbg(&drv_data->pdev->dev, | 715 | /* Update total byte transfered */ |
724 | "interrupt_wronly_transfer - end of tx\n"); | 716 | msg->actual_length += drv_data->len; |
725 | 717 | ||
726 | if (flush(drv_data) == 0) | 718 | /* Move to next transfer */ |
727 | dev_err(&drv_data->pdev->dev, | 719 | msg->state = next_transfer(drv_data); |
728 | "interrupt_wronly_transfer - " | ||
729 | "flush failed\n"); | ||
730 | 720 | ||
731 | /* End of transfer, update total byte transfered */ | 721 | /* Schedule transfer tasklet */ |
732 | msg->actual_length += drv_data->len; | 722 | tasklet_schedule(&drv_data->pump_transfers); |
733 | 723 | ||
734 | /* Release chip select if requested, transfer delays are | 724 | return IRQ_HANDLED; |
735 | handled in pump_transfers */ | 725 | } else { |
736 | if (drv_data->cs_change) | 726 | while (status & SPI_STATUS_TH) { |
737 | drv_data->cs_control(SPI_CS_DEASSERT); | 727 | dev_dbg(&drv_data->pdev->dev, |
728 | "interrupt_wronly_transfer - status = 0x%08X\n", | ||
729 | status); | ||
738 | 730 | ||
739 | /* Move to next transfer */ | 731 | /* Pump data */ |
740 | msg->state = next_transfer(drv_data); | 732 | if (write(drv_data)) { |
733 | /* End of TXFIFO writes, | ||
734 | now wait until TXFIFO is empty */ | ||
735 | writel(SPI_INTEN_TE, regs + SPI_INT_STATUS); | ||
736 | return IRQ_HANDLED; | ||
737 | } | ||
741 | 738 | ||
742 | /* Schedule transfer tasklet */ | 739 | status = readl(regs + SPI_INT_STATUS); |
743 | tasklet_schedule(&drv_data->pump_transfers); | ||
744 | 740 | ||
745 | return IRQ_HANDLED; | 741 | /* We did something */ |
742 | handled = IRQ_HANDLED; | ||
746 | } | 743 | } |
747 | |||
748 | status = readl(regs + SPI_INT_STATUS); | ||
749 | |||
750 | /* We did something */ | ||
751 | handled = IRQ_HANDLED; | ||
752 | } | 744 | } |
753 | 745 | ||
754 | return handled; | 746 | return handled; |
@@ -758,45 +750,31 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data) | |||
758 | { | 750 | { |
759 | struct spi_message *msg = drv_data->cur_msg; | 751 | struct spi_message *msg = drv_data->cur_msg; |
760 | void __iomem *regs = drv_data->regs; | 752 | void __iomem *regs = drv_data->regs; |
761 | u32 status; | 753 | u32 status, control; |
762 | irqreturn_t handled = IRQ_NONE; | 754 | irqreturn_t handled = IRQ_NONE; |
763 | unsigned long limit; | 755 | unsigned long limit; |
764 | 756 | ||
765 | status = readl(regs + SPI_INT_STATUS); | 757 | status = readl(regs + SPI_INT_STATUS); |
766 | 758 | ||
767 | while (status & (SPI_STATUS_TH | SPI_STATUS_RO)) { | 759 | if (status & SPI_INTEN_TE) { |
760 | /* TXFIFO Empty Interrupt on the last transfered word */ | ||
761 | writel(status & ~SPI_INTEN, regs + SPI_INT_STATUS); | ||
768 | dev_dbg(&drv_data->pdev->dev, | 762 | dev_dbg(&drv_data->pdev->dev, |
769 | "interrupt_transfer - status = 0x%08X\n", status); | 763 | "interrupt_transfer - end of tx\n"); |
770 | |||
771 | if (status & SPI_STATUS_RO) { | ||
772 | writel(readl(regs + SPI_INT_STATUS) & ~SPI_INTEN, | ||
773 | regs + SPI_INT_STATUS); | ||
774 | |||
775 | dev_warn(&drv_data->pdev->dev, | ||
776 | "interrupt_transfer - fifo overun\n" | ||
777 | " data not yet written = %d\n" | ||
778 | " data not yet read = %d\n", | ||
779 | data_to_write(drv_data), | ||
780 | data_to_read(drv_data)); | ||
781 | |||
782 | if (flush(drv_data) == 0) | ||
783 | dev_err(&drv_data->pdev->dev, | ||
784 | "interrupt_transfer - flush failed\n"); | ||
785 | |||
786 | msg->state = ERROR_STATE; | ||
787 | tasklet_schedule(&drv_data->pump_transfers); | ||
788 | 764 | ||
789 | return IRQ_HANDLED; | 765 | if (msg->state == ERROR_STATE) { |
790 | } | 766 | /* RXFIFO overrun was detected and message aborted */ |
791 | 767 | flush(drv_data); | |
792 | /* Pump data */ | 768 | } else { |
793 | read(drv_data); | 769 | /* Wait for end of transaction */ |
794 | if (write(drv_data)) { | 770 | do { |
795 | writel(readl(regs + SPI_INT_STATUS) & ~SPI_INTEN, | 771 | control = readl(regs + SPI_CONTROL); |
796 | regs + SPI_INT_STATUS); | 772 | } while (control & SPI_CONTROL_XCH); |
797 | 773 | ||
798 | dev_dbg(&drv_data->pdev->dev, | 774 | /* Release chip select if requested, transfer delays are |
799 | "interrupt_transfer - end of tx\n"); | 775 | handled in pump_transfers */ |
776 | if (drv_data->cs_change) | ||
777 | drv_data->cs_control(SPI_CS_DEASSERT); | ||
800 | 778 | ||
801 | /* Read trailing bytes */ | 779 | /* Read trailing bytes */ |
802 | limit = loops_per_jiffy << 1; | 780 | limit = loops_per_jiffy << 1; |
@@ -810,27 +788,54 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data) | |||
810 | dev_dbg(&drv_data->pdev->dev, | 788 | dev_dbg(&drv_data->pdev->dev, |
811 | "interrupt_transfer - end of rx\n"); | 789 | "interrupt_transfer - end of rx\n"); |
812 | 790 | ||
813 | /* End of transfer, update total byte transfered */ | 791 | /* Update total byte transfered */ |
814 | msg->actual_length += drv_data->len; | 792 | msg->actual_length += drv_data->len; |
815 | 793 | ||
816 | /* Release chip select if requested, transfer delays are | ||
817 | handled in pump_transfers */ | ||
818 | if (drv_data->cs_change) | ||
819 | drv_data->cs_control(SPI_CS_DEASSERT); | ||
820 | |||
821 | /* Move to next transfer */ | 794 | /* Move to next transfer */ |
822 | msg->state = next_transfer(drv_data); | 795 | msg->state = next_transfer(drv_data); |
796 | } | ||
823 | 797 | ||
824 | /* Schedule transfer tasklet */ | 798 | /* Schedule transfer tasklet */ |
825 | tasklet_schedule(&drv_data->pump_transfers); | 799 | tasklet_schedule(&drv_data->pump_transfers); |
826 | 800 | ||
827 | return IRQ_HANDLED; | 801 | return IRQ_HANDLED; |
828 | } | 802 | } else { |
803 | while (status & (SPI_STATUS_TH | SPI_STATUS_RO)) { | ||
804 | dev_dbg(&drv_data->pdev->dev, | ||
805 | "interrupt_transfer - status = 0x%08X\n", | ||
806 | status); | ||
807 | |||
808 | if (status & SPI_STATUS_RO) { | ||
809 | /* RXFIFO overrun, abort message end wait | ||
810 | until TXFIFO is empty */ | ||
811 | writel(SPI_INTEN_TE, regs + SPI_INT_STATUS); | ||
812 | |||
813 | dev_warn(&drv_data->pdev->dev, | ||
814 | "interrupt_transfer - fifo overun\n" | ||
815 | " data not yet written = %d\n" | ||
816 | " data not yet read = %d\n", | ||
817 | data_to_write(drv_data), | ||
818 | data_to_read(drv_data)); | ||
819 | |||
820 | msg->state = ERROR_STATE; | ||
821 | |||
822 | return IRQ_HANDLED; | ||
823 | } | ||
829 | 824 | ||
830 | status = readl(regs + SPI_INT_STATUS); | 825 | /* Pump data */ |
826 | read(drv_data); | ||
827 | if (write(drv_data)) { | ||
828 | /* End of TXFIFO writes, | ||
829 | now wait until TXFIFO is empty */ | ||
830 | writel(SPI_INTEN_TE, regs + SPI_INT_STATUS); | ||
831 | return IRQ_HANDLED; | ||
832 | } | ||
831 | 833 | ||
832 | /* We did something */ | 834 | status = readl(regs + SPI_INT_STATUS); |
833 | handled = IRQ_HANDLED; | 835 | |
836 | /* We did something */ | ||
837 | handled = IRQ_HANDLED; | ||
838 | } | ||
834 | } | 839 | } |
835 | 840 | ||
836 | return handled; | 841 | return handled; |
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c index be15a6213205..189f706b9e4b 100644 --- a/drivers/spi/spi_mpc83xx.c +++ b/drivers/spi/spi_mpc83xx.c | |||
@@ -310,7 +310,7 @@ static int mpc83xx_spi_setup(struct spi_device *spi) | |||
310 | return retval; | 310 | return retval; |
311 | 311 | ||
312 | dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec\n", | 312 | dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec\n", |
313 | __FUNCTION__, spi->mode & (SPI_CPOL | SPI_CPHA), | 313 | __func__, spi->mode & (SPI_CPOL | SPI_CPHA), |
314 | spi->bits_per_word, 2 * mpc83xx_spi->nsecs); | 314 | spi->bits_per_word, 2 * mpc83xx_spi->nsecs); |
315 | 315 | ||
316 | /* NOTE we _need_ to call chipselect() early, ideally with adapter | 316 | /* NOTE we _need_ to call chipselect() early, ideally with adapter |
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c index b7476b888197..34bfb7dd7764 100644 --- a/drivers/spi/spi_s3c24xx.c +++ b/drivers/spi/spi_s3c24xx.c | |||
@@ -169,7 +169,7 @@ static int s3c24xx_spi_setup(struct spi_device *spi) | |||
169 | } | 169 | } |
170 | 170 | ||
171 | dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n", | 171 | dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n", |
172 | __FUNCTION__, spi->mode, spi->bits_per_word, | 172 | __func__, spi->mode, spi->bits_per_word, |
173 | spi->max_speed_hz); | 173 | spi->max_speed_hz); |
174 | 174 | ||
175 | return 0; | 175 | return 0; |
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index cf6aef34fe25..113a0468ffcb 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c | |||
@@ -151,13 +151,13 @@ static int xilinx_spi_setup_transfer(struct spi_device *spi, | |||
151 | hz = (t) ? t->speed_hz : spi->max_speed_hz; | 151 | hz = (t) ? t->speed_hz : spi->max_speed_hz; |
152 | if (bits_per_word != 8) { | 152 | if (bits_per_word != 8) { |
153 | dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", | 153 | dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", |
154 | __FUNCTION__, bits_per_word); | 154 | __func__, bits_per_word); |
155 | return -EINVAL; | 155 | return -EINVAL; |
156 | } | 156 | } |
157 | 157 | ||
158 | if (hz && xspi->speed_hz > hz) { | 158 | if (hz && xspi->speed_hz > hz) { |
159 | dev_err(&spi->dev, "%s, unsupported clock rate %uHz\n", | 159 | dev_err(&spi->dev, "%s, unsupported clock rate %uHz\n", |
160 | __FUNCTION__, hz); | 160 | __func__, hz); |
161 | return -EINVAL; | 161 | return -EINVAL; |
162 | } | 162 | } |
163 | 163 | ||
@@ -181,7 +181,7 @@ static int xilinx_spi_setup(struct spi_device *spi) | |||
181 | 181 | ||
182 | if (spi->mode & ~MODEBITS) { | 182 | if (spi->mode & ~MODEBITS) { |
183 | dev_err(&spi->dev, "%s, unsupported mode bits %x\n", | 183 | dev_err(&spi->dev, "%s, unsupported mode bits %x\n", |
184 | __FUNCTION__, spi->mode & ~MODEBITS); | 184 | __func__, spi->mode & ~MODEBITS); |
185 | return -EINVAL; | 185 | return -EINVAL; |
186 | } | 186 | } |
187 | 187 | ||
@@ -190,7 +190,7 @@ static int xilinx_spi_setup(struct spi_device *spi) | |||
190 | return retval; | 190 | return retval; |
191 | 191 | ||
192 | dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n", | 192 | dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n", |
193 | __FUNCTION__, spi->mode & MODEBITS, spi->bits_per_word, 0); | 193 | __func__, spi->mode & MODEBITS, spi->bits_per_word, 0); |
194 | 194 | ||
195 | return 0; | 195 | return 0; |
196 | } | 196 | } |
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index d470c72b737e..5ea3093bc40f 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/device.h> | 38 | #include <linux/device.h> |
39 | #include <linux/firmware.h> | 39 | #include <linux/firmware.h> |
40 | #include <linux/mutex.h> | 40 | #include <linux/mutex.h> |
41 | #include <asm/unaligned.h> | ||
41 | 42 | ||
42 | #include "usbatm.h" | 43 | #include "usbatm.h" |
43 | 44 | ||
@@ -573,7 +574,7 @@ static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_requ | |||
573 | u32 *data, int size) | 574 | u32 *data, int size) |
574 | { | 575 | { |
575 | int ret, len; | 576 | int ret, len; |
576 | u32 *buf; | 577 | __le32 *buf; |
577 | int offb, offd; | 578 | int offb, offd; |
578 | const int stride = CMD_PACKET_SIZE / (4 * 2) - 1; | 579 | const int stride = CMD_PACKET_SIZE / (4 * 2) - 1; |
579 | int buflen = ((size - 1) / stride + 1 + size * 2) * 4; | 580 | int buflen = ((size - 1) / stride + 1 + size * 2) * 4; |
@@ -837,7 +838,7 @@ static int cxacru_fw(struct usb_device *usb_dev, enum cxacru_fw_request fw, | |||
837 | buf[offb++] = l; | 838 | buf[offb++] = l; |
838 | buf[offb++] = code1; | 839 | buf[offb++] = code1; |
839 | buf[offb++] = code2; | 840 | buf[offb++] = code2; |
840 | *((u32 *) (buf + offb)) = cpu_to_le32(addr); | 841 | put_unaligned(cpu_to_le32(addr), (__le32 *)(buf + offb)); |
841 | offb += 4; | 842 | offb += 4; |
842 | addr += l; | 843 | addr += l; |
843 | if(l) | 844 | if(l) |
@@ -874,8 +875,9 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
874 | int off; | 875 | int off; |
875 | struct usbatm_data *usbatm = instance->usbatm; | 876 | struct usbatm_data *usbatm = instance->usbatm; |
876 | struct usb_device *usb_dev = usbatm->usb_dev; | 877 | struct usb_device *usb_dev = usbatm->usb_dev; |
877 | u16 signature[] = { usb_dev->descriptor.idVendor, usb_dev->descriptor.idProduct }; | 878 | __le16 signature[] = { usb_dev->descriptor.idVendor, |
878 | u32 val; | 879 | usb_dev->descriptor.idProduct }; |
880 | __le32 val; | ||
879 | 881 | ||
880 | dbg("cxacru_upload_firmware"); | 882 | dbg("cxacru_upload_firmware"); |
881 | 883 | ||
@@ -955,7 +957,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
955 | /* Load config data (le32), doing one packet at a time */ | 957 | /* Load config data (le32), doing one packet at a time */ |
956 | if (cf) | 958 | if (cf) |
957 | for (off = 0; off < cf->size / 4; ) { | 959 | for (off = 0; off < cf->size / 4; ) { |
958 | u32 buf[CMD_PACKET_SIZE / 4 - 1]; | 960 | __le32 buf[CMD_PACKET_SIZE / 4 - 1]; |
959 | int i, len = min_t(int, cf->size / 4 - off, CMD_PACKET_SIZE / 4 / 2 - 1); | 961 | int i, len = min_t(int, cf->size / 4 - off, CMD_PACKET_SIZE / 4 / 2 - 1); |
960 | buf[0] = cpu_to_le32(len); | 962 | buf[0] = cpu_to_le32(len); |
961 | for (i = 0; i < len; i++, off++) { | 963 | for (i = 0; i < len; i++, off++) { |
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index abb7d7410e63..4220f22b6660 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
@@ -996,7 +996,7 @@ static void __uea_load_page_e4(struct uea_softc *sc, u8 pageno, int boot) | |||
996 | blockoffset = sc->dsp_firm->data + le32_to_cpu(blockidx->PageOffset); | 996 | blockoffset = sc->dsp_firm->data + le32_to_cpu(blockidx->PageOffset); |
997 | 997 | ||
998 | bi.dwSize = cpu_to_be32(blocksize); | 998 | bi.dwSize = cpu_to_be32(blocksize); |
999 | bi.dwAddress = swab32(blockidx->PageAddress); | 999 | bi.dwAddress = cpu_to_be32(le32_to_cpu(blockidx->PageAddress)); |
1000 | 1000 | ||
1001 | uea_dbg(INS_TO_USBDEV(sc), | 1001 | uea_dbg(INS_TO_USBDEV(sc), |
1002 | "sending block %u for DSP page %u size %u address %x\n", | 1002 | "sending block %u for DSP page %u size %u address %x\n", |
@@ -1040,7 +1040,7 @@ static void uea_load_page_e4(struct work_struct *work) | |||
1040 | return; | 1040 | return; |
1041 | 1041 | ||
1042 | p = (struct l1_code *) sc->dsp_firm->data; | 1042 | p = (struct l1_code *) sc->dsp_firm->data; |
1043 | if (pageno >= p->page_header[0].PageNumber) { | 1043 | if (pageno >= le16_to_cpu(p->page_header[0].PageNumber)) { |
1044 | uea_err(INS_TO_USBDEV(sc), "invalid DSP page %u requested\n", pageno); | 1044 | uea_err(INS_TO_USBDEV(sc), "invalid DSP page %u requested\n", pageno); |
1045 | return; | 1045 | return; |
1046 | } | 1046 | } |
@@ -1065,7 +1065,7 @@ static void uea_load_page_e4(struct work_struct *work) | |||
1065 | bi.bPageNumber = 0xff; | 1065 | bi.bPageNumber = 0xff; |
1066 | bi.wReserved = cpu_to_be16(UEA_RESERVED); | 1066 | bi.wReserved = cpu_to_be16(UEA_RESERVED); |
1067 | bi.dwSize = cpu_to_be32(E4_PAGE_BYTES(p->page_header[0].PageSize)); | 1067 | bi.dwSize = cpu_to_be32(E4_PAGE_BYTES(p->page_header[0].PageSize)); |
1068 | bi.dwAddress = swab32(p->page_header[0].PageAddress); | 1068 | bi.dwAddress = cpu_to_be32(le32_to_cpu(p->page_header[0].PageAddress)); |
1069 | 1069 | ||
1070 | /* send block info through the IDMA pipe */ | 1070 | /* send block info through the IDMA pipe */ |
1071 | if (uea_idma_write(sc, &bi, E4_BLOCK_INFO_SIZE)) | 1071 | if (uea_idma_write(sc, &bi, E4_BLOCK_INFO_SIZE)) |
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index fc6f3483be44..ce337cb5d137 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/drivers/usb/gadget/amd5536udc.c | |||
@@ -328,6 +328,7 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc) | |||
328 | u32 tmp; | 328 | u32 tmp; |
329 | unsigned long iflags; | 329 | unsigned long iflags; |
330 | u8 udc_csr_epix; | 330 | u8 udc_csr_epix; |
331 | unsigned maxpacket; | ||
331 | 332 | ||
332 | if (!usbep | 333 | if (!usbep |
333 | || usbep->name == ep0_string | 334 | || usbep->name == ep0_string |
@@ -354,9 +355,10 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc) | |||
354 | writel(tmp, &dev->ep[ep->num].regs->ctl); | 355 | writel(tmp, &dev->ep[ep->num].regs->ctl); |
355 | 356 | ||
356 | /* set max packet size */ | 357 | /* set max packet size */ |
358 | maxpacket = le16_to_cpu(desc->wMaxPacketSize); | ||
357 | tmp = readl(&dev->ep[ep->num].regs->bufout_maxpkt); | 359 | tmp = readl(&dev->ep[ep->num].regs->bufout_maxpkt); |
358 | tmp = AMD_ADDBITS(tmp, desc->wMaxPacketSize, UDC_EP_MAX_PKT_SIZE); | 360 | tmp = AMD_ADDBITS(tmp, maxpacket, UDC_EP_MAX_PKT_SIZE); |
359 | ep->ep.maxpacket = desc->wMaxPacketSize; | 361 | ep->ep.maxpacket = maxpacket; |
360 | writel(tmp, &dev->ep[ep->num].regs->bufout_maxpkt); | 362 | writel(tmp, &dev->ep[ep->num].regs->bufout_maxpkt); |
361 | 363 | ||
362 | /* IN ep */ | 364 | /* IN ep */ |
@@ -370,8 +372,8 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc) | |||
370 | /* double buffering: fifo size = 2 x max packet size */ | 372 | /* double buffering: fifo size = 2 x max packet size */ |
371 | tmp = AMD_ADDBITS( | 373 | tmp = AMD_ADDBITS( |
372 | tmp, | 374 | tmp, |
373 | desc->wMaxPacketSize * UDC_EPIN_BUFF_SIZE_MULT | 375 | maxpacket * UDC_EPIN_BUFF_SIZE_MULT |
374 | / UDC_DWORD_BYTES, | 376 | / UDC_DWORD_BYTES, |
375 | UDC_EPIN_BUFF_SIZE); | 377 | UDC_EPIN_BUFF_SIZE); |
376 | writel(tmp, &dev->ep[ep->num].regs->bufin_framenum); | 378 | writel(tmp, &dev->ep[ep->num].regs->bufin_framenum); |
377 | 379 | ||
@@ -390,7 +392,7 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc) | |||
390 | 392 | ||
391 | /* set max packet size UDC CSR */ | 393 | /* set max packet size UDC CSR */ |
392 | tmp = readl(&dev->csr->ne[ep->num - UDC_CSR_EP_OUT_IX_OFS]); | 394 | tmp = readl(&dev->csr->ne[ep->num - UDC_CSR_EP_OUT_IX_OFS]); |
393 | tmp = AMD_ADDBITS(tmp, desc->wMaxPacketSize, | 395 | tmp = AMD_ADDBITS(tmp, maxpacket, |
394 | UDC_CSR_NE_MAX_PKT); | 396 | UDC_CSR_NE_MAX_PKT); |
395 | writel(tmp, &dev->csr->ne[ep->num - UDC_CSR_EP_OUT_IX_OFS]); | 397 | writel(tmp, &dev->csr->ne[ep->num - UDC_CSR_EP_OUT_IX_OFS]); |
396 | 398 | ||
@@ -407,7 +409,7 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc) | |||
407 | /* set ep values */ | 409 | /* set ep values */ |
408 | tmp = readl(&dev->csr->ne[udc_csr_epix]); | 410 | tmp = readl(&dev->csr->ne[udc_csr_epix]); |
409 | /* max packet */ | 411 | /* max packet */ |
410 | tmp = AMD_ADDBITS(tmp, desc->wMaxPacketSize, UDC_CSR_NE_MAX_PKT); | 412 | tmp = AMD_ADDBITS(tmp, maxpacket, UDC_CSR_NE_MAX_PKT); |
411 | /* ep number */ | 413 | /* ep number */ |
412 | tmp = AMD_ADDBITS(tmp, desc->bEndpointAddress, UDC_CSR_NE_NUM); | 414 | tmp = AMD_ADDBITS(tmp, desc->bEndpointAddress, UDC_CSR_NE_NUM); |
413 | /* ep direction */ | 415 | /* ep direction */ |
@@ -2832,7 +2834,7 @@ __acquires(dev->lock) | |||
2832 | /* make usb request for gadget driver */ | 2834 | /* make usb request for gadget driver */ |
2833 | memset(&setup_data, 0 , sizeof(union udc_setup_data)); | 2835 | memset(&setup_data, 0 , sizeof(union udc_setup_data)); |
2834 | setup_data.request.bRequest = USB_REQ_SET_CONFIGURATION; | 2836 | setup_data.request.bRequest = USB_REQ_SET_CONFIGURATION; |
2835 | setup_data.request.wValue = dev->cur_config; | 2837 | setup_data.request.wValue = cpu_to_le16(dev->cur_config); |
2836 | 2838 | ||
2837 | /* programm the NE registers */ | 2839 | /* programm the NE registers */ |
2838 | for (i = 0; i < UDC_EP_NUM; i++) { | 2840 | for (i = 0; i < UDC_EP_NUM; i++) { |
@@ -2881,8 +2883,8 @@ __acquires(dev->lock) | |||
2881 | memset(&setup_data, 0 , sizeof(union udc_setup_data)); | 2883 | memset(&setup_data, 0 , sizeof(union udc_setup_data)); |
2882 | setup_data.request.bRequest = USB_REQ_SET_INTERFACE; | 2884 | setup_data.request.bRequest = USB_REQ_SET_INTERFACE; |
2883 | setup_data.request.bRequestType = USB_RECIP_INTERFACE; | 2885 | setup_data.request.bRequestType = USB_RECIP_INTERFACE; |
2884 | setup_data.request.wValue = dev->cur_alt; | 2886 | setup_data.request.wValue = cpu_to_le16(dev->cur_alt); |
2885 | setup_data.request.wIndex = dev->cur_intf; | 2887 | setup_data.request.wIndex = cpu_to_le16(dev->cur_intf); |
2886 | 2888 | ||
2887 | DBG(dev, "SET_INTERFACE interrupt: alt=%d intf=%d\n", | 2889 | DBG(dev, "SET_INTERFACE interrupt: alt=%d intf=%d\n", |
2888 | dev->cur_alt, dev->cur_intf); | 2890 | dev->cur_alt, dev->cur_intf); |
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 66293105d136..42036192a03c 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -1555,8 +1555,7 @@ hub_descriptor (struct usb_hub_descriptor *desc) | |||
1555 | memset (desc, 0, sizeof *desc); | 1555 | memset (desc, 0, sizeof *desc); |
1556 | desc->bDescriptorType = 0x29; | 1556 | desc->bDescriptorType = 0x29; |
1557 | desc->bDescLength = 9; | 1557 | desc->bDescLength = 9; |
1558 | desc->wHubCharacteristics = (__force __u16) | 1558 | desc->wHubCharacteristics = cpu_to_le16(0x0001); |
1559 | (__constant_cpu_to_le16 (0x0001)); | ||
1560 | desc->bNbrPorts = 1; | 1559 | desc->bNbrPorts = 1; |
1561 | desc->bitmap [0] = 0xff; | 1560 | desc->bitmap [0] = 0xff; |
1562 | desc->bitmap [1] = 0xff; | 1561 | desc->bitmap [1] = 0xff; |
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c index ff3a8513e64d..7f4d4828e3aa 100644 --- a/drivers/usb/gadget/gmidi.c +++ b/drivers/usb/gadget/gmidi.c | |||
@@ -229,7 +229,7 @@ static const struct usb_ac_header_descriptor_1 ac_header_desc = { | |||
229 | .bDescriptorType = USB_DT_CS_INTERFACE, | 229 | .bDescriptorType = USB_DT_CS_INTERFACE, |
230 | .bDescriptorSubtype = USB_MS_HEADER, | 230 | .bDescriptorSubtype = USB_MS_HEADER, |
231 | .bcdADC = __constant_cpu_to_le16(0x0100), | 231 | .bcdADC = __constant_cpu_to_le16(0x0100), |
232 | .wTotalLength = USB_DT_AC_HEADER_SIZE(1), | 232 | .wTotalLength = __constant_cpu_to_le16(USB_DT_AC_HEADER_SIZE(1)), |
233 | .bInCollection = 1, | 233 | .bInCollection = 1, |
234 | .baInterfaceNr = { | 234 | .baInterfaceNr = { |
235 | [0] = GMIDI_MS_INTERFACE, | 235 | [0] = GMIDI_MS_INTERFACE, |
@@ -253,9 +253,9 @@ static const struct usb_ms_header_descriptor ms_header_desc = { | |||
253 | .bDescriptorType = USB_DT_CS_INTERFACE, | 253 | .bDescriptorType = USB_DT_CS_INTERFACE, |
254 | .bDescriptorSubtype = USB_MS_HEADER, | 254 | .bDescriptorSubtype = USB_MS_HEADER, |
255 | .bcdMSC = __constant_cpu_to_le16(0x0100), | 255 | .bcdMSC = __constant_cpu_to_le16(0x0100), |
256 | .wTotalLength = USB_DT_MS_HEADER_SIZE | 256 | .wTotalLength = __constant_cpu_to_le16(USB_DT_MS_HEADER_SIZE |
257 | + 2*USB_DT_MIDI_IN_SIZE | 257 | + 2*USB_DT_MIDI_IN_SIZE |
258 | + 2*USB_DT_MIDI_OUT_SIZE(1), | 258 | + 2*USB_DT_MIDI_OUT_SIZE(1)), |
259 | }; | 259 | }; |
260 | 260 | ||
261 | #define JACK_IN_EMB 1 | 261 | #define JACK_IN_EMB 1 |
diff --git a/drivers/usb/gadget/m66592-udc.h b/drivers/usb/gadget/m66592-udc.h index be0a4c1f80a2..f118f00f1466 100644 --- a/drivers/usb/gadget/m66592-udc.h +++ b/drivers/usb/gadget/m66592-udc.h | |||
@@ -485,7 +485,7 @@ struct m66592 { | |||
485 | struct m66592_ep *epaddr2ep[16]; | 485 | struct m66592_ep *epaddr2ep[16]; |
486 | 486 | ||
487 | struct usb_request *ep0_req; /* for internal request */ | 487 | struct usb_request *ep0_req; /* for internal request */ |
488 | u16 ep0_data; /* for internal request */ | 488 | __le16 ep0_data; /* for internal request */ |
489 | u16 old_vbus; | 489 | u16 old_vbus; |
490 | 490 | ||
491 | struct timer_list timer; | 491 | struct timer_list timer; |
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index 4af90df8e7de..0f82fdcaef09 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c | |||
@@ -398,7 +398,7 @@ static void qh_lines ( | |||
398 | unsigned size = *sizep; | 398 | unsigned size = *sizep; |
399 | char *next = *nextp; | 399 | char *next = *nextp; |
400 | char mark; | 400 | char mark; |
401 | u32 list_end = EHCI_LIST_END(ehci); | 401 | __le32 list_end = EHCI_LIST_END(ehci); |
402 | 402 | ||
403 | if (qh->hw_qtd_next == list_end) /* NEC does this */ | 403 | if (qh->hw_qtd_next == list_end) /* NEC does this */ |
404 | mark = '@'; | 404 | mark = '@'; |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index efffef64f59d..f13d1029aeb2 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -530,7 +530,7 @@ ehci_hub_descriptor ( | |||
530 | if (HCS_INDICATOR (ehci->hcs_params)) | 530 | if (HCS_INDICATOR (ehci->hcs_params)) |
531 | temp |= 0x0080; /* per-port indicators (LEDs) */ | 531 | temp |= 0x0080; /* per-port indicators (LEDs) */ |
532 | #endif | 532 | #endif |
533 | desc->wHubCharacteristics = (__force __u16)cpu_to_le16 (temp); | 533 | desc->wHubCharacteristics = cpu_to_le16(temp); |
534 | } | 534 | } |
535 | 535 | ||
536 | /*-------------------------------------------------------------------------*/ | 536 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 5ae689139dd0..b85b54160cda 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -285,7 +285,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
285 | int stopped; | 285 | int stopped; |
286 | unsigned count = 0; | 286 | unsigned count = 0; |
287 | u8 state; | 287 | u8 state; |
288 | u32 halt = HALT_BIT(ehci); | 288 | __le32 halt = HALT_BIT(ehci); |
289 | 289 | ||
290 | if (unlikely (list_empty (&qh->qtd_list))) | 290 | if (unlikely (list_empty (&qh->qtd_list))) |
291 | return count; | 291 | return count; |
@@ -883,7 +883,7 @@ static struct ehci_qh *qh_append_tds ( | |||
883 | ) | 883 | ) |
884 | { | 884 | { |
885 | struct ehci_qh *qh = NULL; | 885 | struct ehci_qh *qh = NULL; |
886 | u32 qh_addr_mask = cpu_to_hc32(ehci, 0x7f); | 886 | __hc32 qh_addr_mask = cpu_to_hc32(ehci, 0x7f); |
887 | 887 | ||
888 | qh = (struct ehci_qh *) *ptr; | 888 | qh = (struct ehci_qh *) *ptr; |
889 | if (unlikely (qh == NULL)) { | 889 | if (unlikely (qh == NULL)) { |
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index f4fa93dabdde..16667342b3c3 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -993,7 +993,7 @@ static void prepare_setup_packet(struct r8a66597 *r8a66597, | |||
993 | struct r8a66597_td *td) | 993 | struct r8a66597_td *td) |
994 | { | 994 | { |
995 | int i; | 995 | int i; |
996 | u16 *p = (u16 *)td->urb->setup_packet; | 996 | __le16 *p = (__le16 *)td->urb->setup_packet; |
997 | unsigned long setup_addr = USBREQ; | 997 | unsigned long setup_addr = USBREQ; |
998 | 998 | ||
999 | r8a66597_write(r8a66597, make_devsel(td->address) | td->maxpacket, | 999 | r8a66597_write(r8a66597, make_devsel(td->address) | td->maxpacket, |
@@ -1001,7 +1001,7 @@ static void prepare_setup_packet(struct r8a66597 *r8a66597, | |||
1001 | r8a66597_write(r8a66597, ~(SIGN | SACK), INTSTS1); | 1001 | r8a66597_write(r8a66597, ~(SIGN | SACK), INTSTS1); |
1002 | 1002 | ||
1003 | for (i = 0; i < 4; i++) { | 1003 | for (i = 0; i < 4; i++) { |
1004 | r8a66597_write(r8a66597, cpu_to_le16(p[i]), setup_addr); | 1004 | r8a66597_write(r8a66597, le16_to_cpu(p[i]), setup_addr); |
1005 | setup_addr += 2; | 1005 | setup_addr += 2; |
1006 | } | 1006 | } |
1007 | r8a66597_write(r8a66597, SUREQ, DCPCTR); | 1007 | r8a66597_write(r8a66597, SUREQ, DCPCTR); |
@@ -2131,7 +2131,7 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
2131 | case GetPortStatus: | 2131 | case GetPortStatus: |
2132 | if (wIndex > R8A66597_MAX_ROOT_HUB) | 2132 | if (wIndex > R8A66597_MAX_ROOT_HUB) |
2133 | goto error; | 2133 | goto error; |
2134 | *(u32 *)buf = cpu_to_le32(rh->port); | 2134 | *(__le32 *)buf = cpu_to_le32(rh->port); |
2135 | break; | 2135 | break; |
2136 | case SetPortFeature: | 2136 | case SetPortFeature: |
2137 | if (wIndex > R8A66597_MAX_ROOT_HUB) | 2137 | if (wIndex > R8A66597_MAX_ROOT_HUB) |
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index 274276cf8621..3fd7a0c12078 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c | |||
@@ -1100,7 +1100,7 @@ sl811h_hub_descriptor ( | |||
1100 | /* no overcurrent errors detection/handling */ | 1100 | /* no overcurrent errors detection/handling */ |
1101 | temp |= 0x0010; | 1101 | temp |= 0x0010; |
1102 | 1102 | ||
1103 | desc->wHubCharacteristics = (__force __u16)cpu_to_le16(temp); | 1103 | desc->wHubCharacteristics = cpu_to_le16(temp); |
1104 | 1104 | ||
1105 | /* two bitmaps: ports removable, and legacy PortPwrCtrlMask */ | 1105 | /* two bitmaps: ports removable, and legacy PortPwrCtrlMask */ |
1106 | desc->bitmap[0] = 0 << 1; | 1106 | desc->bitmap[0] = 0 << 1; |
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c index a238817762ad..9b1bb347dc2d 100644 --- a/drivers/usb/serial/aircable.c +++ b/drivers/usb/serial/aircable.c | |||
@@ -209,7 +209,7 @@ static void aircable_send(struct usb_serial_port *port) | |||
209 | int count, result; | 209 | int count, result; |
210 | struct aircable_private *priv = usb_get_serial_port_data(port); | 210 | struct aircable_private *priv = usb_get_serial_port_data(port); |
211 | unsigned char* buf; | 211 | unsigned char* buf; |
212 | u16 *dbuf; | 212 | __le16 *dbuf; |
213 | dbg("%s - port %d", __func__, port->number); | 213 | dbg("%s - port %d", __func__, port->number); |
214 | if (port->write_urb_busy) | 214 | if (port->write_urb_busy) |
215 | return; | 215 | return; |
@@ -227,7 +227,7 @@ static void aircable_send(struct usb_serial_port *port) | |||
227 | 227 | ||
228 | buf[0] = TX_HEADER_0; | 228 | buf[0] = TX_HEADER_0; |
229 | buf[1] = TX_HEADER_1; | 229 | buf[1] = TX_HEADER_1; |
230 | dbuf = (u16 *)&buf[2]; | 230 | dbuf = (__le16 *)&buf[2]; |
231 | *dbuf = cpu_to_le16((u16)count); | 231 | *dbuf = cpu_to_le16((u16)count); |
232 | serial_buf_get(priv->tx_buf,buf + HCI_HEADER_LENGTH, MAX_HCI_FRAMESIZE); | 232 | serial_buf_get(priv->tx_buf,buf + HCI_HEADER_LENGTH, MAX_HCI_FRAMESIZE); |
233 | 233 | ||
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 32121794808d..0230d3c0888a 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -541,7 +541,7 @@ static int cypress_earthmate_startup (struct usb_serial *serial) | |||
541 | /* All Earthmate devices use the separated-count packet | 541 | /* All Earthmate devices use the separated-count packet |
542 | format! Idiotic. */ | 542 | format! Idiotic. */ |
543 | priv->pkt_fmt = packet_format_1; | 543 | priv->pkt_fmt = packet_format_1; |
544 | if (serial->dev->descriptor.idProduct != PRODUCT_ID_EARTHMATEUSB) { | 544 | if (serial->dev->descriptor.idProduct != cpu_to_le16(PRODUCT_ID_EARTHMATEUSB)) { |
545 | /* The old original USB Earthmate seemed able to | 545 | /* The old original USB Earthmate seemed able to |
546 | handle GET_CONFIG requests; everything they've | 546 | handle GET_CONFIG requests; everything they've |
547 | produced since that time crashes if this command is | 547 | produced since that time crashes if this command is |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 23f51a41093e..c7329f43d9c9 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -1104,7 +1104,7 @@ static int ftdi_mtxorb_hack_setup(struct usb_serial *serial) | |||
1104 | struct usb_endpoint_descriptor *ep_desc = &ep->desc; | 1104 | struct usb_endpoint_descriptor *ep_desc = &ep->desc; |
1105 | 1105 | ||
1106 | if (ep->enabled && ep_desc->wMaxPacketSize == 0) { | 1106 | if (ep->enabled && ep_desc->wMaxPacketSize == 0) { |
1107 | ep_desc->wMaxPacketSize = 0x40; | 1107 | ep_desc->wMaxPacketSize = cpu_to_le16(0x40); |
1108 | info("Fixing invalid wMaxPacketSize on read pipe"); | 1108 | info("Fixing invalid wMaxPacketSize on read pipe"); |
1109 | } | 1109 | } |
1110 | 1110 | ||
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index ce2e487f3240..06b52f4098f1 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -2993,7 +2993,7 @@ static int edge_startup (struct usb_serial *serial) | |||
2993 | usb_fill_bulk_urb(edge_serial->read_urb, dev, | 2993 | usb_fill_bulk_urb(edge_serial->read_urb, dev, |
2994 | usb_rcvbulkpipe(dev, endpoint->bEndpointAddress), | 2994 | usb_rcvbulkpipe(dev, endpoint->bEndpointAddress), |
2995 | edge_serial->bulk_in_buffer, | 2995 | edge_serial->bulk_in_buffer, |
2996 | endpoint->wMaxPacketSize, | 2996 | le16_to_cpu(endpoint->wMaxPacketSize), |
2997 | edge_bulk_in_callback, | 2997 | edge_bulk_in_callback, |
2998 | edge_serial); | 2998 | edge_serial); |
2999 | bulk_in_found = true; | 2999 | bulk_in_found = true; |
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index b395ac759888..f328948d74e3 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <linux/tty_flip.h> | 54 | #include <linux/tty_flip.h> |
55 | #include <linux/module.h> | 55 | #include <linux/module.h> |
56 | #include <asm/uaccess.h> | 56 | #include <asm/uaccess.h> |
57 | #include <asm/unaligned.h> | ||
57 | #include <linux/usb.h> | 58 | #include <linux/usb.h> |
58 | #include <linux/usb/serial.h> | 59 | #include <linux/usb/serial.h> |
59 | #include "kl5kusb105.h" | 60 | #include "kl5kusb105.h" |
@@ -235,7 +236,7 @@ static int klsi_105_get_line_state(struct usb_serial_port *port, | |||
235 | if (rc < 0) | 236 | if (rc < 0) |
236 | err("Reading line status failed (error = %d)", rc); | 237 | err("Reading line status failed (error = %d)", rc); |
237 | else { | 238 | else { |
238 | status = le16_to_cpu(*(u16 *)status_buf); | 239 | status = le16_to_cpu(get_unaligned((__le16 *)status_buf)); |
239 | 240 | ||
240 | info("%s - read status %x %x", __func__, | 241 | info("%s - read status %x %x", __func__, |
241 | status_buf[0], status_buf[1]); | 242 | status_buf[0], status_buf[1]); |
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index d92bb6501c84..a9625c180dc3 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
@@ -98,7 +98,7 @@ struct oti6858_buf { | |||
98 | 98 | ||
99 | /* format of the control packet */ | 99 | /* format of the control packet */ |
100 | struct oti6858_control_pkt { | 100 | struct oti6858_control_pkt { |
101 | u16 divisor; /* baud rate = 96000000 / (16 * divisor), LE */ | 101 | __le16 divisor; /* baud rate = 96000000 / (16 * divisor), LE */ |
102 | #define OTI6858_MAX_BAUD_RATE 3000000 | 102 | #define OTI6858_MAX_BAUD_RATE 3000000 |
103 | u8 frame_fmt; | 103 | u8 frame_fmt; |
104 | #define FMT_STOP_BITS_MASK 0xc0 | 104 | #define FMT_STOP_BITS_MASK 0xc0 |
@@ -211,7 +211,7 @@ struct oti6858_private { | |||
211 | struct delayed_work delayed_write_work; | 211 | struct delayed_work delayed_write_work; |
212 | 212 | ||
213 | struct { | 213 | struct { |
214 | u16 divisor; | 214 | __le16 divisor; |
215 | u8 frame_fmt; | 215 | u8 frame_fmt; |
216 | u8 control; | 216 | u8 control; |
217 | } pending_setup; | 217 | } pending_setup; |
@@ -450,7 +450,7 @@ static void oti6858_set_termios(struct usb_serial_port *port, | |||
450 | unsigned long flags; | 450 | unsigned long flags; |
451 | unsigned int cflag; | 451 | unsigned int cflag; |
452 | u8 frame_fmt, control; | 452 | u8 frame_fmt, control; |
453 | u16 divisor; | 453 | __le16 divisor; |
454 | int br; | 454 | int br; |
455 | 455 | ||
456 | dbg("%s(port = %d)", __func__, port->number); | 456 | dbg("%s(port = %d)", __func__, port->number); |
@@ -505,11 +505,12 @@ static void oti6858_set_termios(struct usb_serial_port *port, | |||
505 | divisor = 0; | 505 | divisor = 0; |
506 | } else { | 506 | } else { |
507 | int real_br; | 507 | int real_br; |
508 | int new_divisor; | ||
508 | br = min(br, OTI6858_MAX_BAUD_RATE); | 509 | br = min(br, OTI6858_MAX_BAUD_RATE); |
509 | 510 | ||
510 | divisor = (96000000 + 8 * br) / (16 * br); | 511 | new_divisor = (96000000 + 8 * br) / (16 * br); |
511 | real_br = 96000000 / (16 * divisor); | 512 | real_br = 96000000 / (16 * new_divisor); |
512 | divisor = cpu_to_le16(divisor); | 513 | divisor = cpu_to_le16(new_divisor); |
513 | tty_encode_baud_rate(port->tty, real_br, real_br); | 514 | tty_encode_baud_rate(port->tty, real_br, real_br); |
514 | } | 515 | } |
515 | 516 | ||
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 2282d620186e..55b2570b8b8b 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -310,17 +310,18 @@ static int spcp8x5_startup(struct usb_serial *serial) | |||
310 | struct spcp8x5_private *priv; | 310 | struct spcp8x5_private *priv; |
311 | int i; | 311 | int i; |
312 | enum spcp8x5_type type = SPCP825_007_TYPE; | 312 | enum spcp8x5_type type = SPCP825_007_TYPE; |
313 | u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); | ||
313 | 314 | ||
314 | if (serial->dev->descriptor.idProduct == 0x0201) | 315 | if (product == 0x0201) |
315 | type = SPCP825_007_TYPE; | 316 | type = SPCP825_007_TYPE; |
316 | else if (serial->dev->descriptor.idProduct == 0x0231) | 317 | else if (product == 0x0231) |
317 | type = SPCP835_TYPE; | 318 | type = SPCP835_TYPE; |
318 | else if (serial->dev->descriptor.idProduct == 0x0235) | 319 | else if (product == 0x0235) |
319 | type = SPCP825_008_TYPE; | 320 | type = SPCP825_008_TYPE; |
320 | else if (serial->dev->descriptor.idProduct == 0x0204) | 321 | else if (product == 0x0204) |
321 | type = SPCP825_INTERMATIC_TYPE; | 322 | type = SPCP825_INTERMATIC_TYPE; |
322 | else if (serial->dev->descriptor.idProduct == 0x0471 && | 323 | else if (product == 0x0471 && |
323 | serial->dev->descriptor.idVendor == 0x081e) | 324 | serial->dev->descriptor.idVendor == cpu_to_le16(0x081e)) |
324 | type = SPCP825_PHILIP_TYPE; | 325 | type = SPCP825_PHILIP_TYPE; |
325 | dev_dbg(&serial->dev->dev, "device type = %d\n", (int)type); | 326 | dev_dbg(&serial->dev->dev, "device type = %d\n", (int)type); |
326 | 327 | ||
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index e3dc8f8d0c3e..a576dc261732 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -139,6 +139,30 @@ config FB_SYS_IMAGEBLIT | |||
139 | blitting. This is used by drivers that don't provide their own | 139 | blitting. This is used by drivers that don't provide their own |
140 | (accelerated) version and the framebuffer is in system RAM. | 140 | (accelerated) version and the framebuffer is in system RAM. |
141 | 141 | ||
142 | menuconfig FB_FOREIGN_ENDIAN | ||
143 | bool "Framebuffer foreign endianness support" | ||
144 | depends on FB | ||
145 | ---help--- | ||
146 | This menu will let you enable support for the framebuffers with | ||
147 | non-native endianness (e.g. Little-Endian framebuffer on a | ||
148 | Big-Endian machine). Most probably you don't have such hardware, | ||
149 | so it's safe to say "n" here. | ||
150 | |||
151 | choice | ||
152 | prompt "Choice endianness support" | ||
153 | depends on FB_FOREIGN_ENDIAN | ||
154 | |||
155 | config FB_BOTH_ENDIAN | ||
156 | bool "Support for Big- and Little-Endian framebuffers" | ||
157 | |||
158 | config FB_BIG_ENDIAN | ||
159 | bool "Support for Big-Endian framebuffers only" | ||
160 | |||
161 | config FB_LITTLE_ENDIAN | ||
162 | bool "Support for Little-Endian framebuffers only" | ||
163 | |||
164 | endchoice | ||
165 | |||
142 | config FB_SYS_FOPS | 166 | config FB_SYS_FOPS |
143 | tristate | 167 | tristate |
144 | depends on FB | 168 | depends on FB |
@@ -149,6 +173,16 @@ config FB_DEFERRED_IO | |||
149 | depends on FB | 173 | depends on FB |
150 | default y | 174 | default y |
151 | 175 | ||
176 | config FB_METRONOME | ||
177 | tristate | ||
178 | depends on FB | ||
179 | depends on FB_DEFERRED_IO | ||
180 | |||
181 | config FB_HECUBA | ||
182 | tristate | ||
183 | depends on FB | ||
184 | depends on FB_DEFERRED_IO | ||
185 | |||
152 | config FB_SVGALIB | 186 | config FB_SVGALIB |
153 | tristate | 187 | tristate |
154 | depends on FB | 188 | depends on FB |
@@ -546,7 +580,7 @@ config FB_VGA16 | |||
546 | 580 | ||
547 | config FB_BF54X_LQ043 | 581 | config FB_BF54X_LQ043 |
548 | tristate "SHARP LQ043 TFT LCD (BF548 EZKIT)" | 582 | tristate "SHARP LQ043 TFT LCD (BF548 EZKIT)" |
549 | depends on FB && (BF54x) | 583 | depends on FB && (BF54x) && !BF542 |
550 | select FB_CFB_FILLRECT | 584 | select FB_CFB_FILLRECT |
551 | select FB_CFB_COPYAREA | 585 | select FB_CFB_COPYAREA |
552 | select FB_CFB_IMAGEBLIT | 586 | select FB_CFB_IMAGEBLIT |
@@ -674,20 +708,18 @@ config FB_IMAC | |||
674 | help | 708 | help |
675 | This is the frame buffer device driver for the Intel-based Macintosh | 709 | This is the frame buffer device driver for the Intel-based Macintosh |
676 | 710 | ||
677 | config FB_HECUBA | 711 | config FB_N411 |
678 | tristate "Hecuba board support" | 712 | tristate "N411 Apollo/Hecuba devkit support" |
679 | depends on FB && X86 && MMU | 713 | depends on FB && X86 && MMU |
680 | select FB_SYS_FILLRECT | 714 | select FB_SYS_FILLRECT |
681 | select FB_SYS_COPYAREA | 715 | select FB_SYS_COPYAREA |
682 | select FB_SYS_IMAGEBLIT | 716 | select FB_SYS_IMAGEBLIT |
683 | select FB_SYS_FOPS | 717 | select FB_SYS_FOPS |
684 | select FB_DEFERRED_IO | 718 | select FB_DEFERRED_IO |
719 | select FB_HECUBA | ||
685 | help | 720 | help |
686 | This enables support for the Hecuba board. This driver was tested | 721 | This enables support for the Apollo display controller in its |
687 | with an E-Ink 800x600 display and x86 SBCs through a 16 bit GPIO | 722 | Hecuba form using the n411 devkit. |
688 | interface (8 bit data, 4 bit control). If you anticipate using | ||
689 | this driver, say Y or M; otherwise say N. You must specify the | ||
690 | GPIO IO address to be used for setting control and data. | ||
691 | 723 | ||
692 | config FB_HGA | 724 | config FB_HGA |
693 | tristate "Hercules mono graphics support" | 725 | tristate "Hercules mono graphics support" |
@@ -1087,7 +1119,7 @@ config FB_CARILLO_RANCH | |||
1087 | This driver supports the LE80578 (Carillo Ranch) board | 1119 | This driver supports the LE80578 (Carillo Ranch) board |
1088 | 1120 | ||
1089 | config FB_INTEL | 1121 | config FB_INTEL |
1090 | tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G support (EXPERIMENTAL)" | 1122 | tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)" |
1091 | depends on FB && EXPERIMENTAL && PCI && X86 | 1123 | depends on FB && EXPERIMENTAL && PCI && X86 |
1092 | select AGP | 1124 | select AGP |
1093 | select AGP_INTEL | 1125 | select AGP_INTEL |
@@ -1097,7 +1129,7 @@ config FB_INTEL | |||
1097 | select FB_CFB_IMAGEBLIT | 1129 | select FB_CFB_IMAGEBLIT |
1098 | help | 1130 | help |
1099 | This driver supports the on-board graphics built in to the Intel | 1131 | This driver supports the on-board graphics built in to the Intel |
1100 | 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM chipsets. | 1132 | 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets. |
1101 | Say Y if you have and plan to use such a board. | 1133 | Say Y if you have and plan to use such a board. |
1102 | 1134 | ||
1103 | If you say Y here and want DDC/I2C support you must first say Y to | 1135 | If you say Y here and want DDC/I2C support you must first say Y to |
@@ -1779,6 +1811,16 @@ config FB_MBX_DEBUG | |||
1779 | 1811 | ||
1780 | If unsure, say N. | 1812 | If unsure, say N. |
1781 | 1813 | ||
1814 | config FB_FSL_DIU | ||
1815 | tristate "Freescale DIU framebuffer support" | ||
1816 | depends on FB && FSL_SOC | ||
1817 | select FB_CFB_FILLRECT | ||
1818 | select FB_CFB_COPYAREA | ||
1819 | select FB_CFB_IMAGEBLIT | ||
1820 | select PPC_LIB_RHEAP | ||
1821 | ---help--- | ||
1822 | Framebuffer driver for the Freescale SoC DIU | ||
1823 | |||
1782 | config FB_W100 | 1824 | config FB_W100 |
1783 | tristate "W100 frame buffer support" | 1825 | tristate "W100 frame buffer support" |
1784 | depends on FB && PXA_SHARPSL | 1826 | depends on FB && PXA_SHARPSL |
@@ -1893,19 +1935,18 @@ config FB_XILINX | |||
1893 | framebuffer. ML300 carries a 640*480 LCD display on the board, | 1935 | framebuffer. ML300 carries a 640*480 LCD display on the board, |
1894 | ML403 uses a standard DB15 VGA connector. | 1936 | ML403 uses a standard DB15 VGA connector. |
1895 | 1937 | ||
1896 | config FB_METRONOME | 1938 | config FB_AM200EPD |
1897 | tristate "Metronome display controller support" | 1939 | tristate "AM-200 E-Ink EPD devkit support" |
1898 | depends on FB && ARCH_PXA && MMU | 1940 | depends on FB && ARCH_PXA && MMU |
1899 | select FB_SYS_FILLRECT | 1941 | select FB_SYS_FILLRECT |
1900 | select FB_SYS_COPYAREA | 1942 | select FB_SYS_COPYAREA |
1901 | select FB_SYS_IMAGEBLIT | 1943 | select FB_SYS_IMAGEBLIT |
1902 | select FB_SYS_FOPS | 1944 | select FB_SYS_FOPS |
1903 | select FB_DEFERRED_IO | 1945 | select FB_DEFERRED_IO |
1946 | select FB_METRONOME | ||
1904 | help | 1947 | help |
1905 | This enables support for the Metronome display controller. Tested | 1948 | This enables support for the Metronome display controller used on |
1906 | with an E-Ink 800x600 display and Gumstix Connex through an AMLCD | 1949 | the E-Ink AM-200 EPD devkit. |
1907 | interface. Please read <file:Documentation/fb/metronomefb.txt> | ||
1908 | for more information. | ||
1909 | 1950 | ||
1910 | config FB_VIRTUAL | 1951 | config FB_VIRTUAL |
1911 | tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)" | 1952 | tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)" |
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index f172b9b73314..04bca35403ff 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -29,6 +29,7 @@ obj-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o | |||
29 | 29 | ||
30 | # Hardware specific drivers go first | 30 | # Hardware specific drivers go first |
31 | obj-$(CONFIG_FB_AMIGA) += amifb.o c2p.o | 31 | obj-$(CONFIG_FB_AMIGA) += amifb.o c2p.o |
32 | obj-$(CONFIG_FB_AM200EPD) += am200epd.o | ||
32 | obj-$(CONFIG_FB_ARC) += arcfb.o | 33 | obj-$(CONFIG_FB_ARC) += arcfb.o |
33 | obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o | 34 | obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o |
34 | obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o | 35 | obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o |
@@ -107,6 +108,7 @@ obj-$(CONFIG_FB_METRONOME) += metronomefb.o | |||
107 | obj-$(CONFIG_FB_S1D13XXX) += s1d13xxxfb.o | 108 | obj-$(CONFIG_FB_S1D13XXX) += s1d13xxxfb.o |
108 | obj-$(CONFIG_FB_IMX) += imxfb.o | 109 | obj-$(CONFIG_FB_IMX) += imxfb.o |
109 | obj-$(CONFIG_FB_S3C2410) += s3c2410fb.o | 110 | obj-$(CONFIG_FB_S3C2410) += s3c2410fb.o |
111 | obj-$(CONFIG_FB_FSL_DIU) += fsl-diu-fb.o | ||
110 | obj-$(CONFIG_FB_PNX4008_DUM) += pnx4008/ | 112 | obj-$(CONFIG_FB_PNX4008_DUM) += pnx4008/ |
111 | obj-$(CONFIG_FB_PNX4008_DUM_RGB) += pnx4008/ | 113 | obj-$(CONFIG_FB_PNX4008_DUM_RGB) += pnx4008/ |
112 | obj-$(CONFIG_FB_IBM_GXT4500) += gxt4500.o | 114 | obj-$(CONFIG_FB_IBM_GXT4500) += gxt4500.o |
diff --git a/drivers/video/am200epd.c b/drivers/video/am200epd.c new file mode 100644 index 000000000000..51e26c1f5e8b --- /dev/null +++ b/drivers/video/am200epd.c | |||
@@ -0,0 +1,295 @@ | |||
1 | /* | ||
2 | * linux/drivers/video/am200epd.c -- Platform device for AM200 EPD kit | ||
3 | * | ||
4 | * Copyright (C) 2008, Jaya Kumar | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file COPYING in the main directory of this archive for | ||
8 | * more details. | ||
9 | * | ||
10 | * Layout is based on skeletonfb.c by James Simmons and Geert Uytterhoeven. | ||
11 | * | ||
12 | * This work was made possible by help and equipment support from E-Ink | ||
13 | * Corporation. http://support.eink.com/community | ||
14 | * | ||
15 | * This driver is written to be used with the Metronome display controller. | ||
16 | * on the AM200 EPD prototype kit/development kit with an E-Ink 800x600 | ||
17 | * Vizplex EPD on a Gumstix board using the Lyre interface board. | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | #include <linux/module.h> | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/errno.h> | ||
24 | #include <linux/string.h> | ||
25 | #include <linux/delay.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/fb.h> | ||
28 | #include <linux/init.h> | ||
29 | #include <linux/platform_device.h> | ||
30 | #include <linux/list.h> | ||
31 | #include <linux/uaccess.h> | ||
32 | #include <linux/irq.h> | ||
33 | |||
34 | #include <video/metronomefb.h> | ||
35 | |||
36 | #include <asm/arch/pxa-regs.h> | ||
37 | |||
38 | /* register offsets for gpio control */ | ||
39 | #define LED_GPIO_PIN 51 | ||
40 | #define STDBY_GPIO_PIN 48 | ||
41 | #define RST_GPIO_PIN 49 | ||
42 | #define RDY_GPIO_PIN 32 | ||
43 | #define ERR_GPIO_PIN 17 | ||
44 | #define PCBPWR_GPIO_PIN 16 | ||
45 | |||
46 | #define AF_SEL_GPIO_N 0x3 | ||
47 | #define GAFR0_U_OFFSET(pin) ((pin - 16) * 2) | ||
48 | #define GAFR1_L_OFFSET(pin) ((pin - 32) * 2) | ||
49 | #define GAFR1_U_OFFSET(pin) ((pin - 48) * 2) | ||
50 | #define GPDR1_OFFSET(pin) (pin - 32) | ||
51 | #define GPCR1_OFFSET(pin) (pin - 32) | ||
52 | #define GPSR1_OFFSET(pin) (pin - 32) | ||
53 | #define GPCR0_OFFSET(pin) (pin) | ||
54 | #define GPSR0_OFFSET(pin) (pin) | ||
55 | |||
56 | static void am200_set_gpio_output(int pin, int val) | ||
57 | { | ||
58 | u8 index; | ||
59 | |||
60 | index = pin >> 4; | ||
61 | |||
62 | switch (index) { | ||
63 | case 1: | ||
64 | if (val) | ||
65 | GPSR0 |= (1 << GPSR0_OFFSET(pin)); | ||
66 | else | ||
67 | GPCR0 |= (1 << GPCR0_OFFSET(pin)); | ||
68 | break; | ||
69 | case 2: | ||
70 | break; | ||
71 | case 3: | ||
72 | if (val) | ||
73 | GPSR1 |= (1 << GPSR1_OFFSET(pin)); | ||
74 | else | ||
75 | GPCR1 |= (1 << GPCR1_OFFSET(pin)); | ||
76 | break; | ||
77 | default: | ||
78 | printk(KERN_ERR "unimplemented\n"); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | static void __devinit am200_init_gpio_pin(int pin, int dir) | ||
83 | { | ||
84 | u8 index; | ||
85 | /* dir 0 is output, 1 is input | ||
86 | - do 2 things here: | ||
87 | - set gpio alternate function to standard gpio | ||
88 | - set gpio direction to input or output */ | ||
89 | |||
90 | index = pin >> 4; | ||
91 | switch (index) { | ||
92 | case 1: | ||
93 | GAFR0_U &= ~(AF_SEL_GPIO_N << GAFR0_U_OFFSET(pin)); | ||
94 | |||
95 | if (dir) | ||
96 | GPDR0 &= ~(1 << pin); | ||
97 | else | ||
98 | GPDR0 |= (1 << pin); | ||
99 | break; | ||
100 | case 2: | ||
101 | GAFR1_L &= ~(AF_SEL_GPIO_N << GAFR1_L_OFFSET(pin)); | ||
102 | |||
103 | if (dir) | ||
104 | GPDR1 &= ~(1 << GPDR1_OFFSET(pin)); | ||
105 | else | ||
106 | GPDR1 |= (1 << GPDR1_OFFSET(pin)); | ||
107 | break; | ||
108 | case 3: | ||
109 | GAFR1_U &= ~(AF_SEL_GPIO_N << GAFR1_U_OFFSET(pin)); | ||
110 | |||
111 | if (dir) | ||
112 | GPDR1 &= ~(1 << GPDR1_OFFSET(pin)); | ||
113 | else | ||
114 | GPDR1 |= (1 << GPDR1_OFFSET(pin)); | ||
115 | break; | ||
116 | default: | ||
117 | printk(KERN_ERR "unimplemented\n"); | ||
118 | } | ||
119 | } | ||
120 | |||
121 | static void am200_init_gpio_regs(struct metronomefb_par *par) | ||
122 | { | ||
123 | am200_init_gpio_pin(LED_GPIO_PIN, 0); | ||
124 | am200_set_gpio_output(LED_GPIO_PIN, 0); | ||
125 | |||
126 | am200_init_gpio_pin(STDBY_GPIO_PIN, 0); | ||
127 | am200_set_gpio_output(STDBY_GPIO_PIN, 0); | ||
128 | |||
129 | am200_init_gpio_pin(RST_GPIO_PIN, 0); | ||
130 | am200_set_gpio_output(RST_GPIO_PIN, 0); | ||
131 | |||
132 | am200_init_gpio_pin(RDY_GPIO_PIN, 1); | ||
133 | |||
134 | am200_init_gpio_pin(ERR_GPIO_PIN, 1); | ||
135 | |||
136 | am200_init_gpio_pin(PCBPWR_GPIO_PIN, 0); | ||
137 | am200_set_gpio_output(PCBPWR_GPIO_PIN, 0); | ||
138 | } | ||
139 | |||
140 | static void am200_disable_lcd_controller(struct metronomefb_par *par) | ||
141 | { | ||
142 | LCSR = 0xffffffff; /* Clear LCD Status Register */ | ||
143 | LCCR0 |= LCCR0_DIS; /* Disable LCD Controller */ | ||
144 | |||
145 | /* we reset and just wait for things to settle */ | ||
146 | msleep(200); | ||
147 | } | ||
148 | |||
149 | static void am200_enable_lcd_controller(struct metronomefb_par *par) | ||
150 | { | ||
151 | LCSR = 0xffffffff; | ||
152 | FDADR0 = par->metromem_desc_dma; | ||
153 | LCCR0 |= LCCR0_ENB; | ||
154 | } | ||
155 | |||
156 | static void am200_init_lcdc_regs(struct metronomefb_par *par) | ||
157 | { | ||
158 | /* here we do: | ||
159 | - disable the lcd controller | ||
160 | - setup lcd control registers | ||
161 | - setup dma descriptor | ||
162 | - reenable lcd controller | ||
163 | */ | ||
164 | |||
165 | /* disable the lcd controller */ | ||
166 | am200_disable_lcd_controller(par); | ||
167 | |||
168 | /* setup lcd control registers */ | ||
169 | LCCR0 = LCCR0_LDM | LCCR0_SFM | LCCR0_IUM | LCCR0_EFM | LCCR0_PAS | ||
170 | | LCCR0_QDM | LCCR0_BM | LCCR0_OUM; | ||
171 | |||
172 | LCCR1 = (par->info->var.xres/2 - 1) /* pixels per line */ | ||
173 | | (27 << 10) /* hsync pulse width - 1 */ | ||
174 | | (33 << 16) /* eol pixel count */ | ||
175 | | (33 << 24); /* bol pixel count */ | ||
176 | |||
177 | LCCR2 = (par->info->var.yres - 1) /* lines per panel */ | ||
178 | | (24 << 10) /* vsync pulse width - 1 */ | ||
179 | | (2 << 16) /* eof pixel count */ | ||
180 | | (0 << 24); /* bof pixel count */ | ||
181 | |||
182 | LCCR3 = 2 /* pixel clock divisor */ | ||
183 | | (24 << 8) /* AC Bias pin freq */ | ||
184 | | LCCR3_16BPP /* BPP */ | ||
185 | | LCCR3_PCP; /* PCP falling edge */ | ||
186 | |||
187 | } | ||
188 | |||
189 | static void am200_post_dma_setup(struct metronomefb_par *par) | ||
190 | { | ||
191 | par->metromem_desc->mFDADR0 = par->metromem_desc_dma; | ||
192 | par->metromem_desc->mFSADR0 = par->metromem_dma; | ||
193 | par->metromem_desc->mFIDR0 = 0; | ||
194 | par->metromem_desc->mLDCMD0 = par->info->var.xres | ||
195 | * par->info->var.yres; | ||
196 | am200_enable_lcd_controller(par); | ||
197 | } | ||
198 | |||
199 | static void am200_free_irq(struct fb_info *info) | ||
200 | { | ||
201 | free_irq(IRQ_GPIO(RDY_GPIO_PIN), info); | ||
202 | } | ||
203 | |||
204 | static irqreturn_t am200_handle_irq(int irq, void *dev_id) | ||
205 | { | ||
206 | struct fb_info *info = dev_id; | ||
207 | struct metronomefb_par *par = info->par; | ||
208 | |||
209 | wake_up_interruptible(&par->waitq); | ||
210 | return IRQ_HANDLED; | ||
211 | } | ||
212 | |||
213 | static int am200_setup_irq(struct fb_info *info) | ||
214 | { | ||
215 | int retval; | ||
216 | |||
217 | retval = request_irq(IRQ_GPIO(RDY_GPIO_PIN), am200_handle_irq, | ||
218 | IRQF_DISABLED, "AM200", info); | ||
219 | if (retval) { | ||
220 | printk(KERN_ERR "am200epd: request_irq failed: %d\n", retval); | ||
221 | return retval; | ||
222 | } | ||
223 | |||
224 | return set_irq_type(IRQ_GPIO(RDY_GPIO_PIN), IRQT_FALLING); | ||
225 | } | ||
226 | |||
227 | static void am200_set_rst(struct metronomefb_par *par, int state) | ||
228 | { | ||
229 | am200_set_gpio_output(RST_GPIO_PIN, state); | ||
230 | } | ||
231 | |||
232 | static void am200_set_stdby(struct metronomefb_par *par, int state) | ||
233 | { | ||
234 | am200_set_gpio_output(STDBY_GPIO_PIN, state); | ||
235 | } | ||
236 | |||
237 | static int am200_wait_event(struct metronomefb_par *par) | ||
238 | { | ||
239 | return wait_event_timeout(par->waitq, (GPLR1 & 0x01), HZ); | ||
240 | } | ||
241 | |||
242 | static int am200_wait_event_intr(struct metronomefb_par *par) | ||
243 | { | ||
244 | return wait_event_interruptible_timeout(par->waitq, (GPLR1 & 0x01), HZ); | ||
245 | } | ||
246 | |||
247 | static struct metronome_board am200_board = { | ||
248 | .owner = THIS_MODULE, | ||
249 | .free_irq = am200_free_irq, | ||
250 | .setup_irq = am200_setup_irq, | ||
251 | .init_gpio_regs = am200_init_gpio_regs, | ||
252 | .init_lcdc_regs = am200_init_lcdc_regs, | ||
253 | .post_dma_setup = am200_post_dma_setup, | ||
254 | .set_rst = am200_set_rst, | ||
255 | .set_stdby = am200_set_stdby, | ||
256 | .met_wait_event = am200_wait_event, | ||
257 | .met_wait_event_intr = am200_wait_event_intr, | ||
258 | }; | ||
259 | |||
260 | static struct platform_device *am200_device; | ||
261 | |||
262 | static int __init am200_init(void) | ||
263 | { | ||
264 | int ret; | ||
265 | |||
266 | /* request our platform independent driver */ | ||
267 | request_module("metronomefb"); | ||
268 | |||
269 | am200_device = platform_device_alloc("metronomefb", -1); | ||
270 | if (!am200_device) | ||
271 | return -ENOMEM; | ||
272 | |||
273 | platform_device_add_data(am200_device, &am200_board, | ||
274 | sizeof(am200_board)); | ||
275 | |||
276 | /* this _add binds metronomefb to am200. metronomefb refcounts am200 */ | ||
277 | ret = platform_device_add(am200_device); | ||
278 | |||
279 | if (ret) | ||
280 | platform_device_put(am200_device); | ||
281 | |||
282 | return ret; | ||
283 | } | ||
284 | |||
285 | static void __exit am200_exit(void) | ||
286 | { | ||
287 | platform_device_unregister(am200_device); | ||
288 | } | ||
289 | |||
290 | module_init(am200_init); | ||
291 | module_exit(am200_exit); | ||
292 | |||
293 | MODULE_DESCRIPTION("board driver for am200 metronome epd kit"); | ||
294 | MODULE_AUTHOR("Jaya Kumar"); | ||
295 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index 4c9ec3f58c52..e6492c1048bf 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c | |||
@@ -96,7 +96,7 @@ | |||
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | #ifdef DEBUG | 98 | #ifdef DEBUG |
99 | # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) | 99 | # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args) |
100 | #else | 100 | #else |
101 | # define DPRINTK(fmt, args...) | 101 | # define DPRINTK(fmt, args...) |
102 | #endif | 102 | #endif |
diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c index 8a1b07c74394..5001bd4ef466 100644 --- a/drivers/video/arkfb.c +++ b/drivers/video/arkfb.c | |||
@@ -101,7 +101,7 @@ static const struct svga_timing_regs ark_timing_regs = { | |||
101 | 101 | ||
102 | /* Module parameters */ | 102 | /* Module parameters */ |
103 | 103 | ||
104 | static char *mode = "640x480-8@60"; | 104 | static char *mode_option __devinitdata = "640x480-8@60"; |
105 | 105 | ||
106 | #ifdef CONFIG_MTRR | 106 | #ifdef CONFIG_MTRR |
107 | static int mtrr = 1; | 107 | static int mtrr = 1; |
@@ -111,8 +111,10 @@ MODULE_AUTHOR("(c) 2007 Ondrej Zajicek <santiago@crfreenet.org>"); | |||
111 | MODULE_LICENSE("GPL"); | 111 | MODULE_LICENSE("GPL"); |
112 | MODULE_DESCRIPTION("fbdev driver for ARK 2000PV"); | 112 | MODULE_DESCRIPTION("fbdev driver for ARK 2000PV"); |
113 | 113 | ||
114 | module_param(mode, charp, 0444); | 114 | module_param(mode_option, charp, 0444); |
115 | MODULE_PARM_DESC(mode, "Default video mode ('640x480-8@60', etc)"); | 115 | MODULE_PARM_DESC(mode_option, "Default video mode ('640x480-8@60', etc)"); |
116 | module_param_named(mode, mode_option, charp, 0444); | ||
117 | MODULE_PARM_DESC(mode, "Default video mode ('640x480-8@60', etc) (deprecated)"); | ||
116 | 118 | ||
117 | #ifdef CONFIG_MTRR | 119 | #ifdef CONFIG_MTRR |
118 | module_param(mtrr, int, 0444); | 120 | module_param(mtrr, int, 0444); |
@@ -941,7 +943,7 @@ static int __devinit ark_pci_probe(struct pci_dev *dev, const struct pci_device_ | |||
941 | } | 943 | } |
942 | 944 | ||
943 | /* Allocate and fill driver data structure */ | 945 | /* Allocate and fill driver data structure */ |
944 | info = framebuffer_alloc(sizeof(struct arkfb_info), NULL); | 946 | info = framebuffer_alloc(sizeof(struct arkfb_info), &(dev->dev)); |
945 | if (! info) { | 947 | if (! info) { |
946 | dev_err(&(dev->dev), "cannot allocate memory\n"); | 948 | dev_err(&(dev->dev), "cannot allocate memory\n"); |
947 | return -ENOMEM; | 949 | return -ENOMEM; |
@@ -956,20 +958,20 @@ static int __devinit ark_pci_probe(struct pci_dev *dev, const struct pci_device_ | |||
956 | /* Prepare PCI device */ | 958 | /* Prepare PCI device */ |
957 | rc = pci_enable_device(dev); | 959 | rc = pci_enable_device(dev); |
958 | if (rc < 0) { | 960 | if (rc < 0) { |
959 | dev_err(&(dev->dev), "cannot enable PCI device\n"); | 961 | dev_err(info->dev, "cannot enable PCI device\n"); |
960 | goto err_enable_device; | 962 | goto err_enable_device; |
961 | } | 963 | } |
962 | 964 | ||
963 | rc = pci_request_regions(dev, "arkfb"); | 965 | rc = pci_request_regions(dev, "arkfb"); |
964 | if (rc < 0) { | 966 | if (rc < 0) { |
965 | dev_err(&(dev->dev), "cannot reserve framebuffer region\n"); | 967 | dev_err(info->dev, "cannot reserve framebuffer region\n"); |
966 | goto err_request_regions; | 968 | goto err_request_regions; |
967 | } | 969 | } |
968 | 970 | ||
969 | par->dac = ics5342_init(ark_dac_read_regs, ark_dac_write_regs, info); | 971 | par->dac = ics5342_init(ark_dac_read_regs, ark_dac_write_regs, info); |
970 | if (! par->dac) { | 972 | if (! par->dac) { |
971 | rc = -ENOMEM; | 973 | rc = -ENOMEM; |
972 | dev_err(&(dev->dev), "RAMDAC initialization failed\n"); | 974 | dev_err(info->dev, "RAMDAC initialization failed\n"); |
973 | goto err_dac; | 975 | goto err_dac; |
974 | } | 976 | } |
975 | 977 | ||
@@ -980,7 +982,7 @@ static int __devinit ark_pci_probe(struct pci_dev *dev, const struct pci_device_ | |||
980 | info->screen_base = pci_iomap(dev, 0, 0); | 982 | info->screen_base = pci_iomap(dev, 0, 0); |
981 | if (! info->screen_base) { | 983 | if (! info->screen_base) { |
982 | rc = -ENOMEM; | 984 | rc = -ENOMEM; |
983 | dev_err(&(dev->dev), "iomap for framebuffer failed\n"); | 985 | dev_err(info->dev, "iomap for framebuffer failed\n"); |
984 | goto err_iomap; | 986 | goto err_iomap; |
985 | } | 987 | } |
986 | 988 | ||
@@ -999,22 +1001,22 @@ static int __devinit ark_pci_probe(struct pci_dev *dev, const struct pci_device_ | |||
999 | info->pseudo_palette = (void*) (par->pseudo_palette); | 1001 | info->pseudo_palette = (void*) (par->pseudo_palette); |
1000 | 1002 | ||
1001 | /* Prepare startup mode */ | 1003 | /* Prepare startup mode */ |
1002 | rc = fb_find_mode(&(info->var), info, mode, NULL, 0, NULL, 8); | 1004 | rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8); |
1003 | if (! ((rc == 1) || (rc == 2))) { | 1005 | if (! ((rc == 1) || (rc == 2))) { |
1004 | rc = -EINVAL; | 1006 | rc = -EINVAL; |
1005 | dev_err(&(dev->dev), "mode %s not found\n", mode); | 1007 | dev_err(info->dev, "mode %s not found\n", mode_option); |
1006 | goto err_find_mode; | 1008 | goto err_find_mode; |
1007 | } | 1009 | } |
1008 | 1010 | ||
1009 | rc = fb_alloc_cmap(&info->cmap, 256, 0); | 1011 | rc = fb_alloc_cmap(&info->cmap, 256, 0); |
1010 | if (rc < 0) { | 1012 | if (rc < 0) { |
1011 | dev_err(&(dev->dev), "cannot allocate colormap\n"); | 1013 | dev_err(info->dev, "cannot allocate colormap\n"); |
1012 | goto err_alloc_cmap; | 1014 | goto err_alloc_cmap; |
1013 | } | 1015 | } |
1014 | 1016 | ||
1015 | rc = register_framebuffer(info); | 1017 | rc = register_framebuffer(info); |
1016 | if (rc < 0) { | 1018 | if (rc < 0) { |
1017 | dev_err(&(dev->dev), "cannot register framebugger\n"); | 1019 | dev_err(info->dev, "cannot register framebugger\n"); |
1018 | goto err_reg_fb; | 1020 | goto err_reg_fb; |
1019 | } | 1021 | } |
1020 | 1022 | ||
@@ -1088,7 +1090,7 @@ static int ark_pci_suspend (struct pci_dev* dev, pm_message_t state) | |||
1088 | struct fb_info *info = pci_get_drvdata(dev); | 1090 | struct fb_info *info = pci_get_drvdata(dev); |
1089 | struct arkfb_info *par = info->par; | 1091 | struct arkfb_info *par = info->par; |
1090 | 1092 | ||
1091 | dev_info(&(dev->dev), "suspend\n"); | 1093 | dev_info(info->dev, "suspend\n"); |
1092 | 1094 | ||
1093 | acquire_console_sem(); | 1095 | acquire_console_sem(); |
1094 | mutex_lock(&(par->open_lock)); | 1096 | mutex_lock(&(par->open_lock)); |
@@ -1119,7 +1121,7 @@ static int ark_pci_resume (struct pci_dev* dev) | |||
1119 | struct fb_info *info = pci_get_drvdata(dev); | 1121 | struct fb_info *info = pci_get_drvdata(dev); |
1120 | struct arkfb_info *par = info->par; | 1122 | struct arkfb_info *par = info->par; |
1121 | 1123 | ||
1122 | dev_info(&(dev->dev), "resume\n"); | 1124 | dev_info(info->dev, "resume\n"); |
1123 | 1125 | ||
1124 | acquire_console_sem(); | 1126 | acquire_console_sem(); |
1125 | mutex_lock(&(par->open_lock)); | 1127 | mutex_lock(&(par->open_lock)); |
@@ -1190,7 +1192,7 @@ static int __init arkfb_init(void) | |||
1190 | return -ENODEV; | 1192 | return -ENODEV; |
1191 | 1193 | ||
1192 | if (option && *option) | 1194 | if (option && *option) |
1193 | mode = option; | 1195 | mode_option = option; |
1194 | #endif | 1196 | #endif |
1195 | 1197 | ||
1196 | pr_debug("arkfb: initializing\n"); | 1198 | pr_debug("arkfb: initializing\n"); |
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c index 5d4fbaa53a6c..dff35474b854 100644 --- a/drivers/video/atafb.c +++ b/drivers/video/atafb.c | |||
@@ -1270,7 +1270,7 @@ again: | |||
1270 | 1270 | ||
1271 | gstart = (prescale / 2 + plen * left_margin) / prescale; | 1271 | gstart = (prescale / 2 + plen * left_margin) / prescale; |
1272 | /* gend1 is for hde (gend-gstart multiple of align), shifter's xres */ | 1272 | /* gend1 is for hde (gend-gstart multiple of align), shifter's xres */ |
1273 | gend1 = gstart + ((xres + align - 1) / align) * align * plen / prescale; | 1273 | gend1 = gstart + roundup(xres, align) * plen / prescale; |
1274 | /* gend2 is for hbb, visible xres (rest to gend1 is cut off by hblank) */ | 1274 | /* gend2 is for hbb, visible xres (rest to gend1 is cut off by hblank) */ |
1275 | gend2 = gstart + xres * plen / prescale; | 1275 | gend2 = gstart + xres * plen / prescale; |
1276 | par->HHT = plen * (left_margin + xres + right_margin) / | 1276 | par->HHT = plen * (left_margin + xres + right_margin) / |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index fc65c02306dd..8ffdf3578768 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -31,7 +31,8 @@ | |||
31 | #define ATMEL_LCDC_CVAL_DEFAULT 0xc8 | 31 | #define ATMEL_LCDC_CVAL_DEFAULT 0xc8 |
32 | #define ATMEL_LCDC_DMA_BURST_LEN 8 | 32 | #define ATMEL_LCDC_DMA_BURST_LEN 8 |
33 | 33 | ||
34 | #if defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91CAP9) | 34 | #if defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91CAP9) || \ |
35 | defined(CONFIG_ARCH_AT91SAM9RL) | ||
35 | #define ATMEL_LCDC_FIFO_SIZE 2048 | 36 | #define ATMEL_LCDC_FIFO_SIZE 2048 |
36 | #else | 37 | #else |
37 | #define ATMEL_LCDC_FIFO_SIZE 512 | 38 | #define ATMEL_LCDC_FIFO_SIZE 512 |
@@ -250,6 +251,8 @@ static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo) | |||
250 | return -ENOMEM; | 251 | return -ENOMEM; |
251 | } | 252 | } |
252 | 253 | ||
254 | memset(info->screen_base, 0, info->fix.smem_len); | ||
255 | |||
253 | return 0; | 256 | return 0; |
254 | } | 257 | } |
255 | 258 | ||
@@ -336,19 +339,35 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var, | |||
336 | break; | 339 | break; |
337 | case 15: | 340 | case 15: |
338 | case 16: | 341 | case 16: |
339 | var->red.offset = 0; | 342 | if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { |
343 | /* RGB:565 mode */ | ||
344 | var->red.offset = 11; | ||
345 | var->blue.offset = 0; | ||
346 | var->green.length = 6; | ||
347 | } else { | ||
348 | /* BGR:555 mode */ | ||
349 | var->red.offset = 0; | ||
350 | var->blue.offset = 10; | ||
351 | var->green.length = 5; | ||
352 | } | ||
340 | var->green.offset = 5; | 353 | var->green.offset = 5; |
341 | var->blue.offset = 10; | 354 | var->red.length = var->blue.length = 5; |
342 | var->red.length = var->green.length = var->blue.length = 5; | ||
343 | break; | 355 | break; |
344 | case 32: | 356 | case 32: |
345 | var->transp.offset = 24; | 357 | var->transp.offset = 24; |
346 | var->transp.length = 8; | 358 | var->transp.length = 8; |
347 | /* fall through */ | 359 | /* fall through */ |
348 | case 24: | 360 | case 24: |
349 | var->red.offset = 0; | 361 | if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { |
362 | /* RGB:888 mode */ | ||
363 | var->red.offset = 16; | ||
364 | var->blue.offset = 0; | ||
365 | } else { | ||
366 | /* BGR:888 mode */ | ||
367 | var->red.offset = 0; | ||
368 | var->blue.offset = 16; | ||
369 | } | ||
350 | var->green.offset = 8; | 370 | var->green.offset = 8; |
351 | var->blue.offset = 16; | ||
352 | var->red.length = var->green.length = var->blue.length = 8; | 371 | var->red.length = var->green.length = var->blue.length = 8; |
353 | break; | 372 | break; |
354 | default: | 373 | default: |
@@ -634,7 +653,6 @@ static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo) | |||
634 | struct fb_info *info = sinfo->info; | 653 | struct fb_info *info = sinfo->info; |
635 | int ret = 0; | 654 | int ret = 0; |
636 | 655 | ||
637 | memset_io(info->screen_base, 0, info->fix.smem_len); | ||
638 | info->var.activate |= FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW; | 656 | info->var.activate |= FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW; |
639 | 657 | ||
640 | dev_info(info->device, | 658 | dev_info(info->device, |
@@ -696,6 +714,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
696 | sinfo->atmel_lcdfb_power_control = pdata_sinfo->atmel_lcdfb_power_control; | 714 | sinfo->atmel_lcdfb_power_control = pdata_sinfo->atmel_lcdfb_power_control; |
697 | sinfo->guard_time = pdata_sinfo->guard_time; | 715 | sinfo->guard_time = pdata_sinfo->guard_time; |
698 | sinfo->lcdcon_is_backlight = pdata_sinfo->lcdcon_is_backlight; | 716 | sinfo->lcdcon_is_backlight = pdata_sinfo->lcdcon_is_backlight; |
717 | sinfo->lcd_wiring_mode = pdata_sinfo->lcd_wiring_mode; | ||
699 | } else { | 718 | } else { |
700 | dev_err(dev, "cannot get default configuration\n"); | 719 | dev_err(dev, "cannot get default configuration\n"); |
701 | goto free_info; | 720 | goto free_info; |
@@ -764,6 +783,11 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
764 | info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); | 783 | info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); |
765 | if (!info->screen_base) | 784 | if (!info->screen_base) |
766 | goto release_intmem; | 785 | goto release_intmem; |
786 | |||
787 | /* | ||
788 | * Don't clear the framebuffer -- someone may have set | ||
789 | * up a splash image. | ||
790 | */ | ||
767 | } else { | 791 | } else { |
768 | /* alocate memory buffer */ | 792 | /* alocate memory buffer */ |
769 | ret = atmel_lcdfb_alloc_video_memory(sinfo); | 793 | ret = atmel_lcdfb_alloc_video_memory(sinfo); |
@@ -903,10 +927,42 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev) | |||
903 | return 0; | 927 | return 0; |
904 | } | 928 | } |
905 | 929 | ||
930 | #ifdef CONFIG_PM | ||
931 | |||
932 | static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg) | ||
933 | { | ||
934 | struct fb_info *info = platform_get_drvdata(pdev); | ||
935 | struct atmel_lcdfb_info *sinfo = info->par; | ||
936 | |||
937 | sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL); | ||
938 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0); | ||
939 | if (sinfo->atmel_lcdfb_power_control) | ||
940 | sinfo->atmel_lcdfb_power_control(0); | ||
941 | atmel_lcdfb_stop_clock(sinfo); | ||
942 | return 0; | ||
943 | } | ||
944 | |||
945 | static int atmel_lcdfb_resume(struct platform_device *pdev) | ||
946 | { | ||
947 | struct fb_info *info = platform_get_drvdata(pdev); | ||
948 | struct atmel_lcdfb_info *sinfo = info->par; | ||
949 | |||
950 | atmel_lcdfb_start_clock(sinfo); | ||
951 | if (sinfo->atmel_lcdfb_power_control) | ||
952 | sinfo->atmel_lcdfb_power_control(1); | ||
953 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon); | ||
954 | return 0; | ||
955 | } | ||
956 | |||
957 | #else | ||
958 | #define atmel_lcdfb_suspend NULL | ||
959 | #define atmel_lcdfb_resume NULL | ||
960 | #endif | ||
961 | |||
906 | static struct platform_driver atmel_lcdfb_driver = { | 962 | static struct platform_driver atmel_lcdfb_driver = { |
907 | .remove = __exit_p(atmel_lcdfb_remove), | 963 | .remove = __exit_p(atmel_lcdfb_remove), |
908 | 964 | .suspend = atmel_lcdfb_suspend, | |
909 | // FIXME need suspend, resume | 965 | .resume = atmel_lcdfb_resume, |
910 | 966 | ||
911 | .driver = { | 967 | .driver = { |
912 | .name = "atmel_lcdfb", | 968 | .name = "atmel_lcdfb", |
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index cbd3308b6690..24ee96c4e9e9 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -91,7 +91,7 @@ | |||
91 | #undef DEBUG | 91 | #undef DEBUG |
92 | 92 | ||
93 | #ifdef DEBUG | 93 | #ifdef DEBUG |
94 | #define DBG(fmt, args...) printk(KERN_DEBUG "aty128fb: %s " fmt, __FUNCTION__, ##args); | 94 | #define DBG(fmt, args...) printk(KERN_DEBUG "aty128fb: %s " fmt, __func__, ##args); |
95 | #else | 95 | #else |
96 | #define DBG(fmt, args...) | 96 | #define DBG(fmt, args...) |
97 | #endif | 97 | #endif |
@@ -1885,7 +1885,7 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i | |||
1885 | 1885 | ||
1886 | /* range check to make sure */ | 1886 | /* range check to make sure */ |
1887 | if (ent->driver_data < ARRAY_SIZE(r128_family)) | 1887 | if (ent->driver_data < ARRAY_SIZE(r128_family)) |
1888 | strncat(video_card, r128_family[ent->driver_data], sizeof(video_card)); | 1888 | strlcat(video_card, r128_family[ent->driver_data], sizeof(video_card)); |
1889 | 1889 | ||
1890 | printk(KERN_INFO "aty128fb: %s [chip rev 0x%x] ", video_card, chip_rev); | 1890 | printk(KERN_INFO "aty128fb: %s [chip rev 0x%x] ", video_card, chip_rev); |
1891 | 1891 | ||
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 62f9c6e387cc..e4bcf5376a99 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -2621,10 +2621,13 @@ static int __devinit aty_init(struct fb_info *info) | |||
2621 | #endif /* CONFIG_FB_ATY_CT */ | 2621 | #endif /* CONFIG_FB_ATY_CT */ |
2622 | info->var = var; | 2622 | info->var = var; |
2623 | 2623 | ||
2624 | fb_alloc_cmap(&info->cmap, 256, 0); | 2624 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) |
2625 | goto aty_init_exit; | ||
2625 | 2626 | ||
2626 | if (register_framebuffer(info) < 0) | 2627 | if (register_framebuffer(info) < 0) { |
2628 | fb_dealloc_cmap(&info->cmap); | ||
2627 | goto aty_init_exit; | 2629 | goto aty_init_exit; |
2630 | } | ||
2628 | 2631 | ||
2629 | fb_list = info; | 2632 | fb_list = info; |
2630 | 2633 | ||
diff --git a/drivers/video/aty/mach64_ct.c b/drivers/video/aty/mach64_ct.c index cc9e9779b75f..c50c7cf26fe9 100644 --- a/drivers/video/aty/mach64_ct.c +++ b/drivers/video/aty/mach64_ct.c | |||
@@ -197,7 +197,7 @@ static int aty_dsp_gt(const struct fb_info *info, u32 bpp, struct pll_ct *pll) | |||
197 | pll->dsp_config = (dsp_precision << 20) | (pll->dsp_loop_latency << 16) | dsp_xclks; | 197 | pll->dsp_config = (dsp_precision << 20) | (pll->dsp_loop_latency << 16) | dsp_xclks; |
198 | #ifdef DEBUG | 198 | #ifdef DEBUG |
199 | printk("atyfb(%s): dsp_config 0x%08x, dsp_on_off 0x%08x\n", | 199 | printk("atyfb(%s): dsp_config 0x%08x, dsp_on_off 0x%08x\n", |
200 | __FUNCTION__, pll->dsp_config, pll->dsp_on_off); | 200 | __func__, pll->dsp_config, pll->dsp_on_off); |
201 | #endif | 201 | #endif |
202 | return 0; | 202 | return 0; |
203 | } | 203 | } |
@@ -225,7 +225,7 @@ static int aty_valid_pll_ct(const struct fb_info *info, u32 vclk_per, struct pll | |||
225 | (par->ref_clk_per * pll->pll_ref_div); | 225 | (par->ref_clk_per * pll->pll_ref_div); |
226 | #ifdef DEBUG | 226 | #ifdef DEBUG |
227 | printk("atyfb(%s): pllvclk=%d MHz, vclk=%d MHz\n", | 227 | printk("atyfb(%s): pllvclk=%d MHz, vclk=%d MHz\n", |
228 | __FUNCTION__, pllvclk, pllvclk / pll->vclk_post_div_real); | 228 | __func__, pllvclk, pllvclk / pll->vclk_post_div_real); |
229 | #endif | 229 | #endif |
230 | pll->pll_vclk_cntl = 0x03; /* VCLK = PLL_VCLK/VCLKx_POST */ | 230 | pll->pll_vclk_cntl = 0x03; /* VCLK = PLL_VCLK/VCLKx_POST */ |
231 | 231 | ||
@@ -269,7 +269,7 @@ static u32 aty_pll_to_var_ct(const struct fb_info *info, const union aty_pll *pl | |||
269 | } | 269 | } |
270 | #endif | 270 | #endif |
271 | #ifdef DEBUG | 271 | #ifdef DEBUG |
272 | printk("atyfb(%s): calculated 0x%08X(%i)\n", __FUNCTION__, ret, ret); | 272 | printk("atyfb(%s): calculated 0x%08X(%i)\n", __func__, ret, ret); |
273 | #endif | 273 | #endif |
274 | return ret; | 274 | return ret; |
275 | } | 275 | } |
@@ -284,11 +284,11 @@ void aty_set_pll_ct(const struct fb_info *info, const union aty_pll *pll) | |||
284 | #ifdef DEBUG | 284 | #ifdef DEBUG |
285 | printk("atyfb(%s): about to program:\n" | 285 | printk("atyfb(%s): about to program:\n" |
286 | "pll_ext_cntl=0x%02x pll_gen_cntl=0x%02x pll_vclk_cntl=0x%02x\n", | 286 | "pll_ext_cntl=0x%02x pll_gen_cntl=0x%02x pll_vclk_cntl=0x%02x\n", |
287 | __FUNCTION__, | 287 | __func__, |
288 | pll->ct.pll_ext_cntl, pll->ct.pll_gen_cntl, pll->ct.pll_vclk_cntl); | 288 | pll->ct.pll_ext_cntl, pll->ct.pll_gen_cntl, pll->ct.pll_vclk_cntl); |
289 | 289 | ||
290 | printk("atyfb(%s): setting clock %lu for FeedBackDivider %i, ReferenceDivider %i, PostDivider %i(%i)\n", | 290 | printk("atyfb(%s): setting clock %lu for FeedBackDivider %i, ReferenceDivider %i, PostDivider %i(%i)\n", |
291 | __FUNCTION__, | 291 | __func__, |
292 | par->clk_wr_offset, pll->ct.vclk_fb_div, | 292 | par->clk_wr_offset, pll->ct.vclk_fb_div, |
293 | pll->ct.pll_ref_div, pll->ct.vclk_post_div, pll->ct.vclk_post_div_real); | 293 | pll->ct.pll_ref_div, pll->ct.vclk_post_div, pll->ct.vclk_post_div_real); |
294 | #endif | 294 | #endif |
@@ -428,7 +428,7 @@ static int __devinit aty_init_pll_ct(const struct fb_info *info, | |||
428 | 428 | ||
429 | #ifdef DEBUG | 429 | #ifdef DEBUG |
430 | printk("atyfb(%s): mclk_fb_mult=%d, xclk_post_div=%d\n", | 430 | printk("atyfb(%s): mclk_fb_mult=%d, xclk_post_div=%d\n", |
431 | __FUNCTION__, pll->ct.mclk_fb_mult, pll->ct.xclk_post_div); | 431 | __func__, pll->ct.mclk_fb_mult, pll->ct.xclk_post_div); |
432 | #endif | 432 | #endif |
433 | 433 | ||
434 | memcntl = aty_ld_le32(MEM_CNTL, par); | 434 | memcntl = aty_ld_le32(MEM_CNTL, par); |
@@ -540,7 +540,7 @@ static int __devinit aty_init_pll_ct(const struct fb_info *info, | |||
540 | pllmclk = (1000000 * pll->ct.mclk_fb_mult * pll->ct.mclk_fb_div) / | 540 | pllmclk = (1000000 * pll->ct.mclk_fb_mult * pll->ct.mclk_fb_div) / |
541 | (par->ref_clk_per * pll->ct.pll_ref_div); | 541 | (par->ref_clk_per * pll->ct.pll_ref_div); |
542 | printk("atyfb(%s): pllmclk=%d MHz, xclk=%d MHz\n", | 542 | printk("atyfb(%s): pllmclk=%d MHz, xclk=%d MHz\n", |
543 | __FUNCTION__, pllmclk, pllmclk / pll->ct.xclk_post_div_real); | 543 | __func__, pllmclk, pllmclk / pll->ct.xclk_post_div_real); |
544 | #endif | 544 | #endif |
545 | 545 | ||
546 | if (M64_HAS(SDRAM_MAGIC_PLL) && (par->ram_type >= SDRAM)) | 546 | if (M64_HAS(SDRAM_MAGIC_PLL) && (par->ram_type >= SDRAM)) |
@@ -581,7 +581,7 @@ static int __devinit aty_init_pll_ct(const struct fb_info *info, | |||
581 | pllsclk = (1000000 * 2 * pll->ct.sclk_fb_div) / | 581 | pllsclk = (1000000 * 2 * pll->ct.sclk_fb_div) / |
582 | (par->ref_clk_per * pll->ct.pll_ref_div); | 582 | (par->ref_clk_per * pll->ct.pll_ref_div); |
583 | printk("atyfb(%s): use sclk, pllsclk=%d MHz, sclk=mclk=%d MHz\n", | 583 | printk("atyfb(%s): use sclk, pllsclk=%d MHz, sclk=mclk=%d MHz\n", |
584 | __FUNCTION__, pllsclk, pllsclk / sclk_post_div_real); | 584 | __func__, pllsclk, pllsclk / sclk_post_div_real); |
585 | #endif | 585 | #endif |
586 | } | 586 | } |
587 | 587 | ||
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 62867cb63fef..72cd0d2f14ec 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -52,11 +52,14 @@ | |||
52 | 52 | ||
53 | #define RADEON_VERSION "0.2.0" | 53 | #define RADEON_VERSION "0.2.0" |
54 | 54 | ||
55 | #include "radeonfb.h" | ||
56 | |||
55 | #include <linux/module.h> | 57 | #include <linux/module.h> |
56 | #include <linux/moduleparam.h> | 58 | #include <linux/moduleparam.h> |
57 | #include <linux/kernel.h> | 59 | #include <linux/kernel.h> |
58 | #include <linux/errno.h> | 60 | #include <linux/errno.h> |
59 | #include <linux/string.h> | 61 | #include <linux/string.h> |
62 | #include <linux/ctype.h> | ||
60 | #include <linux/mm.h> | 63 | #include <linux/mm.h> |
61 | #include <linux/slab.h> | 64 | #include <linux/slab.h> |
62 | #include <linux/delay.h> | 65 | #include <linux/delay.h> |
@@ -91,7 +94,6 @@ | |||
91 | 94 | ||
92 | #include "../edid.h" // MOVE THAT TO include/video | 95 | #include "../edid.h" // MOVE THAT TO include/video |
93 | #include "ati_ids.h" | 96 | #include "ati_ids.h" |
94 | #include "radeonfb.h" | ||
95 | 97 | ||
96 | #define MAX_MAPPED_VRAM (2048*2048*4) | 98 | #define MAX_MAPPED_VRAM (2048*2048*4) |
97 | #define MIN_MAPPED_VRAM (1024*768*1) | 99 | #define MIN_MAPPED_VRAM (1024*768*1) |
@@ -1488,7 +1490,7 @@ static void radeon_calc_pll_regs(struct radeonfb_info *rinfo, struct radeon_regs | |||
1488 | freq = rinfo->pll.ppll_max; | 1490 | freq = rinfo->pll.ppll_max; |
1489 | if (freq*12 < rinfo->pll.ppll_min) | 1491 | if (freq*12 < rinfo->pll.ppll_min) |
1490 | freq = rinfo->pll.ppll_min / 12; | 1492 | freq = rinfo->pll.ppll_min / 12; |
1491 | RTRACE("freq = %lu, PLL min = %u, PLL max = %u\n", | 1493 | pr_debug("freq = %lu, PLL min = %u, PLL max = %u\n", |
1492 | freq, rinfo->pll.ppll_min, rinfo->pll.ppll_max); | 1494 | freq, rinfo->pll.ppll_min, rinfo->pll.ppll_max); |
1493 | 1495 | ||
1494 | for (post_div = &post_divs[0]; post_div->divider; ++post_div) { | 1496 | for (post_div = &post_divs[0]; post_div->divider; ++post_div) { |
@@ -1509,7 +1511,7 @@ static void radeon_calc_pll_regs(struct radeonfb_info *rinfo, struct radeon_regs | |||
1509 | post_div = &post_divs[post_div->bitvalue]; | 1511 | post_div = &post_divs[post_div->bitvalue]; |
1510 | pll_output_freq = post_div->divider * freq; | 1512 | pll_output_freq = post_div->divider * freq; |
1511 | } | 1513 | } |
1512 | RTRACE("ref_div = %d, ref_clk = %d, output_freq = %d\n", | 1514 | pr_debug("ref_div = %d, ref_clk = %d, output_freq = %d\n", |
1513 | rinfo->pll.ref_div, rinfo->pll.ref_clk, | 1515 | rinfo->pll.ref_div, rinfo->pll.ref_clk, |
1514 | pll_output_freq); | 1516 | pll_output_freq); |
1515 | 1517 | ||
@@ -1519,7 +1521,7 @@ static void radeon_calc_pll_regs(struct radeonfb_info *rinfo, struct radeon_regs | |||
1519 | post_div = &post_divs[post_div->bitvalue]; | 1521 | post_div = &post_divs[post_div->bitvalue]; |
1520 | pll_output_freq = post_div->divider * freq; | 1522 | pll_output_freq = post_div->divider * freq; |
1521 | } | 1523 | } |
1522 | RTRACE("ref_div = %d, ref_clk = %d, output_freq = %d\n", | 1524 | pr_debug("ref_div = %d, ref_clk = %d, output_freq = %d\n", |
1523 | rinfo->pll.ref_div, rinfo->pll.ref_clk, | 1525 | rinfo->pll.ref_div, rinfo->pll.ref_clk, |
1524 | pll_output_freq); | 1526 | pll_output_freq); |
1525 | 1527 | ||
@@ -1528,9 +1530,9 @@ static void radeon_calc_pll_regs(struct radeonfb_info *rinfo, struct radeon_regs | |||
1528 | regs->ppll_ref_div = rinfo->pll.ref_div; | 1530 | regs->ppll_ref_div = rinfo->pll.ref_div; |
1529 | regs->ppll_div_3 = fb_div | (post_div->bitvalue << 16); | 1531 | regs->ppll_div_3 = fb_div | (post_div->bitvalue << 16); |
1530 | 1532 | ||
1531 | RTRACE("post div = 0x%x\n", post_div->bitvalue); | 1533 | pr_debug("post div = 0x%x\n", post_div->bitvalue); |
1532 | RTRACE("fb_div = 0x%x\n", fb_div); | 1534 | pr_debug("fb_div = 0x%x\n", fb_div); |
1533 | RTRACE("ppll_div_3 = 0x%x\n", regs->ppll_div_3); | 1535 | pr_debug("ppll_div_3 = 0x%x\n", regs->ppll_div_3); |
1534 | } | 1536 | } |
1535 | 1537 | ||
1536 | static int radeonfb_set_par(struct fb_info *info) | 1538 | static int radeonfb_set_par(struct fb_info *info) |
@@ -1602,9 +1604,9 @@ static int radeonfb_set_par(struct fb_info *info) | |||
1602 | dotClock = 1000000000 / pixClock; | 1604 | dotClock = 1000000000 / pixClock; |
1603 | freq = dotClock / 10; /* x100 */ | 1605 | freq = dotClock / 10; /* x100 */ |
1604 | 1606 | ||
1605 | RTRACE("hStart = %d, hEnd = %d, hTotal = %d\n", | 1607 | pr_debug("hStart = %d, hEnd = %d, hTotal = %d\n", |
1606 | hSyncStart, hSyncEnd, hTotal); | 1608 | hSyncStart, hSyncEnd, hTotal); |
1607 | RTRACE("vStart = %d, vEnd = %d, vTotal = %d\n", | 1609 | pr_debug("vStart = %d, vEnd = %d, vTotal = %d\n", |
1608 | vSyncStart, vSyncEnd, vTotal); | 1610 | vSyncStart, vSyncEnd, vTotal); |
1609 | 1611 | ||
1610 | hsync_wid = (hSyncEnd - hSyncStart) / 8; | 1612 | hsync_wid = (hSyncEnd - hSyncStart) / 8; |
@@ -1713,16 +1715,16 @@ static int radeonfb_set_par(struct fb_info *info) | |||
1713 | newmode->surf_info[i] = 0; | 1715 | newmode->surf_info[i] = 0; |
1714 | } | 1716 | } |
1715 | 1717 | ||
1716 | RTRACE("h_total_disp = 0x%x\t hsync_strt_wid = 0x%x\n", | 1718 | pr_debug("h_total_disp = 0x%x\t hsync_strt_wid = 0x%x\n", |
1717 | newmode->crtc_h_total_disp, newmode->crtc_h_sync_strt_wid); | 1719 | newmode->crtc_h_total_disp, newmode->crtc_h_sync_strt_wid); |
1718 | RTRACE("v_total_disp = 0x%x\t vsync_strt_wid = 0x%x\n", | 1720 | pr_debug("v_total_disp = 0x%x\t vsync_strt_wid = 0x%x\n", |
1719 | newmode->crtc_v_total_disp, newmode->crtc_v_sync_strt_wid); | 1721 | newmode->crtc_v_total_disp, newmode->crtc_v_sync_strt_wid); |
1720 | 1722 | ||
1721 | rinfo->bpp = mode->bits_per_pixel; | 1723 | rinfo->bpp = mode->bits_per_pixel; |
1722 | rinfo->depth = depth; | 1724 | rinfo->depth = depth; |
1723 | 1725 | ||
1724 | RTRACE("pixclock = %lu\n", (unsigned long)pixClock); | 1726 | pr_debug("pixclock = %lu\n", (unsigned long)pixClock); |
1725 | RTRACE("freq = %lu\n", (unsigned long)freq); | 1727 | pr_debug("freq = %lu\n", (unsigned long)freq); |
1726 | 1728 | ||
1727 | /* We use PPLL_DIV_3 */ | 1729 | /* We use PPLL_DIV_3 */ |
1728 | newmode->clk_cntl_index = 0x300; | 1730 | newmode->clk_cntl_index = 0x300; |
@@ -1986,7 +1988,7 @@ static void fixup_memory_mappings(struct radeonfb_info *rinfo) | |||
1986 | if (rinfo->has_CRTC2) | 1988 | if (rinfo->has_CRTC2) |
1987 | OUTREG(CRTC2_GEN_CNTL, save_crtc2_gen_cntl); | 1989 | OUTREG(CRTC2_GEN_CNTL, save_crtc2_gen_cntl); |
1988 | 1990 | ||
1989 | RTRACE("aper_base: %08x MC_FB_LOC to: %08x, MC_AGP_LOC to: %08x\n", | 1991 | pr_debug("aper_base: %08x MC_FB_LOC to: %08x, MC_AGP_LOC to: %08x\n", |
1990 | aper_base, | 1992 | aper_base, |
1991 | ((aper_base + aper_size - 1) & 0xffff0000) | (aper_base >> 16), | 1993 | ((aper_base + aper_size - 1) & 0xffff0000) | (aper_base >> 16), |
1992 | 0xffff0000 | (agp_base >> 16)); | 1994 | 0xffff0000 | (agp_base >> 16)); |
@@ -2083,7 +2085,7 @@ static void radeon_identify_vram(struct radeonfb_info *rinfo) | |||
2083 | * ToDo: identify these cases | 2085 | * ToDo: identify these cases |
2084 | */ | 2086 | */ |
2085 | 2087 | ||
2086 | RTRACE("radeonfb (%s): Found %ldk of %s %d bits wide videoram\n", | 2088 | pr_debug("radeonfb (%s): Found %ldk of %s %d bits wide videoram\n", |
2087 | pci_name(rinfo->pdev), | 2089 | pci_name(rinfo->pdev), |
2088 | rinfo->video_ram / 1024, | 2090 | rinfo->video_ram / 1024, |
2089 | rinfo->vram_ddr ? "DDR" : "SDRAM", | 2091 | rinfo->vram_ddr ? "DDR" : "SDRAM", |
@@ -2158,8 +2160,9 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev, | |||
2158 | struct fb_info *info; | 2160 | struct fb_info *info; |
2159 | struct radeonfb_info *rinfo; | 2161 | struct radeonfb_info *rinfo; |
2160 | int ret; | 2162 | int ret; |
2163 | unsigned char c1, c2; | ||
2161 | 2164 | ||
2162 | RTRACE("radeonfb_pci_register BEGIN\n"); | 2165 | pr_debug("radeonfb_pci_register BEGIN\n"); |
2163 | 2166 | ||
2164 | /* Enable device in PCI config */ | 2167 | /* Enable device in PCI config */ |
2165 | ret = pci_enable_device(pdev); | 2168 | ret = pci_enable_device(pdev); |
@@ -2185,9 +2188,15 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev, | |||
2185 | rinfo->lvds_timer.function = radeon_lvds_timer_func; | 2188 | rinfo->lvds_timer.function = radeon_lvds_timer_func; |
2186 | rinfo->lvds_timer.data = (unsigned long)rinfo; | 2189 | rinfo->lvds_timer.data = (unsigned long)rinfo; |
2187 | 2190 | ||
2188 | strcpy(rinfo->name, "ATI Radeon XX "); | 2191 | c1 = ent->device >> 8; |
2189 | rinfo->name[11] = ent->device >> 8; | 2192 | c2 = ent->device & 0xff; |
2190 | rinfo->name[12] = ent->device & 0xFF; | 2193 | if (isprint(c1) && isprint(c2)) |
2194 | snprintf(rinfo->name, sizeof(rinfo->name), | ||
2195 | "ATI Radeon %x \"%c%c\"", ent->device & 0xffff, c1, c2); | ||
2196 | else | ||
2197 | snprintf(rinfo->name, sizeof(rinfo->name), | ||
2198 | "ATI Radeon %x", ent->device & 0xffff); | ||
2199 | |||
2191 | rinfo->family = ent->driver_data & CHIP_FAMILY_MASK; | 2200 | rinfo->family = ent->driver_data & CHIP_FAMILY_MASK; |
2192 | rinfo->chipset = pdev->device; | 2201 | rinfo->chipset = pdev->device; |
2193 | rinfo->has_CRTC2 = (ent->driver_data & CHIP_HAS_CRTC2) != 0; | 2202 | rinfo->has_CRTC2 = (ent->driver_data & CHIP_HAS_CRTC2) != 0; |
@@ -2278,7 +2287,7 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev, | |||
2278 | goto err_unmap_rom; | 2287 | goto err_unmap_rom; |
2279 | } | 2288 | } |
2280 | 2289 | ||
2281 | RTRACE("radeonfb (%s): mapped %ldk videoram\n", pci_name(rinfo->pdev), | 2290 | pr_debug("radeonfb (%s): mapped %ldk videoram\n", pci_name(rinfo->pdev), |
2282 | rinfo->mapped_vram/1024); | 2291 | rinfo->mapped_vram/1024); |
2283 | 2292 | ||
2284 | /* | 2293 | /* |
@@ -2373,7 +2382,7 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev, | |||
2373 | 2382 | ||
2374 | if (rinfo->bios_seg) | 2383 | if (rinfo->bios_seg) |
2375 | radeon_unmap_ROM(rinfo, pdev); | 2384 | radeon_unmap_ROM(rinfo, pdev); |
2376 | RTRACE("radeonfb_pci_register END\n"); | 2385 | pr_debug("radeonfb_pci_register END\n"); |
2377 | 2386 | ||
2378 | return 0; | 2387 | return 0; |
2379 | err_unmap_fb: | 2388 | err_unmap_fb: |
diff --git a/drivers/video/aty/radeon_i2c.c b/drivers/video/aty/radeon_i2c.c index 7db9de681716..f9e7c29ad9bf 100644 --- a/drivers/video/aty/radeon_i2c.c +++ b/drivers/video/aty/radeon_i2c.c | |||
@@ -1,3 +1,5 @@ | |||
1 | #include "radeonfb.h" | ||
2 | |||
1 | #include <linux/module.h> | 3 | #include <linux/module.h> |
2 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
3 | #include <linux/delay.h> | 5 | #include <linux/delay.h> |
@@ -11,7 +13,6 @@ | |||
11 | #include <asm/io.h> | 13 | #include <asm/io.h> |
12 | 14 | ||
13 | #include <video/radeon.h> | 15 | #include <video/radeon.h> |
14 | #include "radeonfb.h" | ||
15 | #include "../edid.h" | 16 | #include "../edid.h" |
16 | 17 | ||
17 | static void radeon_gpio_setscl(void* data, int state) | 18 | static void radeon_gpio_setscl(void* data, int state) |
@@ -77,7 +78,7 @@ static int radeon_setup_i2c_bus(struct radeon_i2c_chan *chan, const char *name) | |||
77 | chan->algo.setscl = radeon_gpio_setscl; | 78 | chan->algo.setscl = radeon_gpio_setscl; |
78 | chan->algo.getsda = radeon_gpio_getsda; | 79 | chan->algo.getsda = radeon_gpio_getsda; |
79 | chan->algo.getscl = radeon_gpio_getscl; | 80 | chan->algo.getscl = radeon_gpio_getscl; |
80 | chan->algo.udelay = 40; | 81 | chan->algo.udelay = 10; |
81 | chan->algo.timeout = 20; | 82 | chan->algo.timeout = 20; |
82 | chan->algo.data = chan; | 83 | chan->algo.data = chan; |
83 | 84 | ||
@@ -148,21 +149,21 @@ int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn, | |||
148 | if (out_edid) | 149 | if (out_edid) |
149 | *out_edid = edid; | 150 | *out_edid = edid; |
150 | if (!edid) { | 151 | if (!edid) { |
151 | RTRACE("radeonfb: I2C (port %d) ... not found\n", conn); | 152 | pr_debug("radeonfb: I2C (port %d) ... not found\n", conn); |
152 | return MT_NONE; | 153 | return MT_NONE; |
153 | } | 154 | } |
154 | if (edid[0x14] & 0x80) { | 155 | if (edid[0x14] & 0x80) { |
155 | /* Fix detection using BIOS tables */ | 156 | /* Fix detection using BIOS tables */ |
156 | if (rinfo->is_mobility /*&& conn == ddc_dvi*/ && | 157 | if (rinfo->is_mobility /*&& conn == ddc_dvi*/ && |
157 | (INREG(LVDS_GEN_CNTL) & LVDS_ON)) { | 158 | (INREG(LVDS_GEN_CNTL) & LVDS_ON)) { |
158 | RTRACE("radeonfb: I2C (port %d) ... found LVDS panel\n", conn); | 159 | pr_debug("radeonfb: I2C (port %d) ... found LVDS panel\n", conn); |
159 | return MT_LCD; | 160 | return MT_LCD; |
160 | } else { | 161 | } else { |
161 | RTRACE("radeonfb: I2C (port %d) ... found TMDS panel\n", conn); | 162 | pr_debug("radeonfb: I2C (port %d) ... found TMDS panel\n", conn); |
162 | return MT_DFP; | 163 | return MT_DFP; |
163 | } | 164 | } |
164 | } | 165 | } |
165 | RTRACE("radeonfb: I2C (port %d) ... found CRT display\n", conn); | 166 | pr_debug("radeonfb: I2C (port %d) ... found CRT display\n", conn); |
166 | return MT_CRT; | 167 | return MT_CRT; |
167 | } | 168 | } |
168 | 169 | ||
diff --git a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c index 2030ed813429..b4d4b88afc09 100644 --- a/drivers/video/aty/radeon_monitor.c +++ b/drivers/video/aty/radeon_monitor.c | |||
@@ -69,11 +69,11 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_ | |||
69 | u8 *tmp; | 69 | u8 *tmp; |
70 | int i, mt = MT_NONE; | 70 | int i, mt = MT_NONE; |
71 | 71 | ||
72 | RTRACE("analyzing OF properties...\n"); | 72 | pr_debug("analyzing OF properties...\n"); |
73 | pmt = of_get_property(dp, "display-type", NULL); | 73 | pmt = of_get_property(dp, "display-type", NULL); |
74 | if (!pmt) | 74 | if (!pmt) |
75 | return MT_NONE; | 75 | return MT_NONE; |
76 | RTRACE("display-type: %s\n", pmt); | 76 | pr_debug("display-type: %s\n", pmt); |
77 | /* OF says "LCD" for DFP as well, we discriminate from the caller of this | 77 | /* OF says "LCD" for DFP as well, we discriminate from the caller of this |
78 | * function | 78 | * function |
79 | */ | 79 | */ |
@@ -117,7 +117,7 @@ static int __devinit radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_ | |||
117 | { | 117 | { |
118 | struct device_node *dp; | 118 | struct device_node *dp; |
119 | 119 | ||
120 | RTRACE("radeon_probe_OF_head\n"); | 120 | pr_debug("radeon_probe_OF_head\n"); |
121 | 121 | ||
122 | dp = rinfo->of_node; | 122 | dp = rinfo->of_node; |
123 | while (dp == NULL) | 123 | while (dp == NULL) |
@@ -135,7 +135,7 @@ static int __devinit radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_ | |||
135 | if (!pname) | 135 | if (!pname) |
136 | return MT_NONE; | 136 | return MT_NONE; |
137 | len = strlen(pname); | 137 | len = strlen(pname); |
138 | RTRACE("head: %s (letter: %c, head_no: %d)\n", | 138 | pr_debug("head: %s (letter: %c, head_no: %d)\n", |
139 | pname, pname[len-1], head_no); | 139 | pname, pname[len-1], head_no); |
140 | if (pname[len-1] == 'A' && head_no == 0) { | 140 | if (pname[len-1] == 'A' && head_no == 0) { |
141 | int mt = radeon_parse_montype_prop(dp, out_EDID, 0); | 141 | int mt = radeon_parse_montype_prop(dp, out_EDID, 0); |
@@ -185,7 +185,7 @@ static int __devinit radeon_get_panel_info_BIOS(struct radeonfb_info *rinfo) | |||
185 | rinfo->panel_info.xres, rinfo->panel_info.yres); | 185 | rinfo->panel_info.xres, rinfo->panel_info.yres); |
186 | 186 | ||
187 | rinfo->panel_info.pwr_delay = BIOS_IN16(tmp + 44); | 187 | rinfo->panel_info.pwr_delay = BIOS_IN16(tmp + 44); |
188 | RTRACE("BIOS provided panel power delay: %d\n", rinfo->panel_info.pwr_delay); | 188 | pr_debug("BIOS provided panel power delay: %d\n", rinfo->panel_info.pwr_delay); |
189 | if (rinfo->panel_info.pwr_delay > 2000 || rinfo->panel_info.pwr_delay <= 0) | 189 | if (rinfo->panel_info.pwr_delay > 2000 || rinfo->panel_info.pwr_delay <= 0) |
190 | rinfo->panel_info.pwr_delay = 2000; | 190 | rinfo->panel_info.pwr_delay = 2000; |
191 | 191 | ||
@@ -199,16 +199,16 @@ static int __devinit radeon_get_panel_info_BIOS(struct radeonfb_info *rinfo) | |||
199 | rinfo->panel_info.fbk_divider > 3) { | 199 | rinfo->panel_info.fbk_divider > 3) { |
200 | rinfo->panel_info.use_bios_dividers = 1; | 200 | rinfo->panel_info.use_bios_dividers = 1; |
201 | printk(KERN_INFO "radeondb: BIOS provided dividers will be used\n"); | 201 | printk(KERN_INFO "radeondb: BIOS provided dividers will be used\n"); |
202 | RTRACE("ref_divider = %x\n", rinfo->panel_info.ref_divider); | 202 | pr_debug("ref_divider = %x\n", rinfo->panel_info.ref_divider); |
203 | RTRACE("post_divider = %x\n", rinfo->panel_info.post_divider); | 203 | pr_debug("post_divider = %x\n", rinfo->panel_info.post_divider); |
204 | RTRACE("fbk_divider = %x\n", rinfo->panel_info.fbk_divider); | 204 | pr_debug("fbk_divider = %x\n", rinfo->panel_info.fbk_divider); |
205 | } | 205 | } |
206 | RTRACE("Scanning BIOS table ...\n"); | 206 | pr_debug("Scanning BIOS table ...\n"); |
207 | for(i=0; i<32; i++) { | 207 | for(i=0; i<32; i++) { |
208 | tmp0 = BIOS_IN16(tmp+64+i*2); | 208 | tmp0 = BIOS_IN16(tmp+64+i*2); |
209 | if (tmp0 == 0) | 209 | if (tmp0 == 0) |
210 | break; | 210 | break; |
211 | RTRACE(" %d x %d\n", BIOS_IN16(tmp0), BIOS_IN16(tmp0+2)); | 211 | pr_debug(" %d x %d\n", BIOS_IN16(tmp0), BIOS_IN16(tmp0+2)); |
212 | if ((BIOS_IN16(tmp0) == rinfo->panel_info.xres) && | 212 | if ((BIOS_IN16(tmp0) == rinfo->panel_info.xres) && |
213 | (BIOS_IN16(tmp0+2) == rinfo->panel_info.yres)) { | 213 | (BIOS_IN16(tmp0+2) == rinfo->panel_info.yres)) { |
214 | rinfo->panel_info.hblank = (BIOS_IN16(tmp0+17) - BIOS_IN16(tmp0+19)) * 8; | 214 | rinfo->panel_info.hblank = (BIOS_IN16(tmp0+17) - BIOS_IN16(tmp0+19)) * 8; |
@@ -227,19 +227,19 @@ static int __devinit radeon_get_panel_info_BIOS(struct radeonfb_info *rinfo) | |||
227 | /* Mark panel infos valid */ | 227 | /* Mark panel infos valid */ |
228 | rinfo->panel_info.valid = 1; | 228 | rinfo->panel_info.valid = 1; |
229 | 229 | ||
230 | RTRACE("Found panel in BIOS table:\n"); | 230 | pr_debug("Found panel in BIOS table:\n"); |
231 | RTRACE(" hblank: %d\n", rinfo->panel_info.hblank); | 231 | pr_debug(" hblank: %d\n", rinfo->panel_info.hblank); |
232 | RTRACE(" hOver_plus: %d\n", rinfo->panel_info.hOver_plus); | 232 | pr_debug(" hOver_plus: %d\n", rinfo->panel_info.hOver_plus); |
233 | RTRACE(" hSync_width: %d\n", rinfo->panel_info.hSync_width); | 233 | pr_debug(" hSync_width: %d\n", rinfo->panel_info.hSync_width); |
234 | RTRACE(" vblank: %d\n", rinfo->panel_info.vblank); | 234 | pr_debug(" vblank: %d\n", rinfo->panel_info.vblank); |
235 | RTRACE(" vOver_plus: %d\n", rinfo->panel_info.vOver_plus); | 235 | pr_debug(" vOver_plus: %d\n", rinfo->panel_info.vOver_plus); |
236 | RTRACE(" vSync_width: %d\n", rinfo->panel_info.vSync_width); | 236 | pr_debug(" vSync_width: %d\n", rinfo->panel_info.vSync_width); |
237 | RTRACE(" clock: %d\n", rinfo->panel_info.clock); | 237 | pr_debug(" clock: %d\n", rinfo->panel_info.clock); |
238 | 238 | ||
239 | return 1; | 239 | return 1; |
240 | } | 240 | } |
241 | } | 241 | } |
242 | RTRACE("Didn't find panel in BIOS table !\n"); | 242 | pr_debug("Didn't find panel in BIOS table !\n"); |
243 | 243 | ||
244 | return 0; | 244 | return 0; |
245 | } | 245 | } |
@@ -271,18 +271,18 @@ static void __devinit radeon_parse_connector_info(struct radeonfb_info *rinfo) | |||
271 | * DEBUG is enabled | 271 | * DEBUG is enabled |
272 | */ | 272 | */ |
273 | chips = BIOS_IN8(offset++) >> 4; | 273 | chips = BIOS_IN8(offset++) >> 4; |
274 | RTRACE("%d chips in connector info\n", chips); | 274 | pr_debug("%d chips in connector info\n", chips); |
275 | for (i = 0; i < chips; i++) { | 275 | for (i = 0; i < chips; i++) { |
276 | tmp = BIOS_IN8(offset++); | 276 | tmp = BIOS_IN8(offset++); |
277 | connectors = tmp & 0x0f; | 277 | connectors = tmp & 0x0f; |
278 | RTRACE(" - chip %d has %d connectors\n", tmp >> 4, connectors); | 278 | pr_debug(" - chip %d has %d connectors\n", tmp >> 4, connectors); |
279 | for (conn = 0; ; conn++) { | 279 | for (conn = 0; ; conn++) { |
280 | tmp = BIOS_IN16(offset); | 280 | tmp = BIOS_IN16(offset); |
281 | if (tmp == 0) | 281 | if (tmp == 0) |
282 | break; | 282 | break; |
283 | offset += 2; | 283 | offset += 2; |
284 | type = (tmp >> 12) & 0x0f; | 284 | type = (tmp >> 12) & 0x0f; |
285 | RTRACE(" * connector %d of type %d (%s) : %04x\n", | 285 | pr_debug(" * connector %d of type %d (%s) : %04x\n", |
286 | conn, type, __conn_type_table[type], tmp); | 286 | conn, type, __conn_type_table[type], tmp); |
287 | } | 287 | } |
288 | } | 288 | } |
@@ -449,7 +449,7 @@ void __devinit radeon_probe_screens(struct radeonfb_info *rinfo, | |||
449 | * a layout for each card ? | 449 | * a layout for each card ? |
450 | */ | 450 | */ |
451 | 451 | ||
452 | RTRACE("Using specified monitor layout: %s", monitor_layout); | 452 | pr_debug("Using specified monitor layout: %s", monitor_layout); |
453 | #ifdef CONFIG_FB_RADEON_I2C | 453 | #ifdef CONFIG_FB_RADEON_I2C |
454 | if (!ignore_edid) { | 454 | if (!ignore_edid) { |
455 | if (rinfo->mon1_type != MT_NONE) | 455 | if (rinfo->mon1_type != MT_NONE) |
@@ -479,9 +479,9 @@ void __devinit radeon_probe_screens(struct radeonfb_info *rinfo, | |||
479 | * Auto-detecting display type (well... trying to ...) | 479 | * Auto-detecting display type (well... trying to ...) |
480 | */ | 480 | */ |
481 | 481 | ||
482 | RTRACE("Starting monitor auto detection...\n"); | 482 | pr_debug("Starting monitor auto detection...\n"); |
483 | 483 | ||
484 | #if DEBUG && defined(CONFIG_FB_RADEON_I2C) | 484 | #if defined(DEBUG) && defined(CONFIG_FB_RADEON_I2C) |
485 | { | 485 | { |
486 | u8 *EDIDs[4] = { NULL, NULL, NULL, NULL }; | 486 | u8 *EDIDs[4] = { NULL, NULL, NULL, NULL }; |
487 | int mon_types[4] = {MT_NONE, MT_NONE, MT_NONE, MT_NONE}; | 487 | int mon_types[4] = {MT_NONE, MT_NONE, MT_NONE, MT_NONE}; |
@@ -756,7 +756,7 @@ void __devinit radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_ | |||
756 | if (!rinfo->panel_info.use_bios_dividers && rinfo->mon1_type != MT_CRT | 756 | if (!rinfo->panel_info.use_bios_dividers && rinfo->mon1_type != MT_CRT |
757 | && rinfo->mon1_EDID) { | 757 | && rinfo->mon1_EDID) { |
758 | struct fb_var_screeninfo var; | 758 | struct fb_var_screeninfo var; |
759 | RTRACE("Parsing EDID data for panel info\n"); | 759 | pr_debug("Parsing EDID data for panel info\n"); |
760 | if (fb_parse_edid(rinfo->mon1_EDID, &var) == 0) { | 760 | if (fb_parse_edid(rinfo->mon1_EDID, &var) == 0) { |
761 | if (var.xres >= rinfo->panel_info.xres && | 761 | if (var.xres >= rinfo->panel_info.xres && |
762 | var.yres >= rinfo->panel_info.yres) | 762 | var.yres >= rinfo->panel_info.yres) |
@@ -776,7 +776,7 @@ void __devinit radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_ | |||
776 | if (rinfo->mon1_type != MT_CRT && rinfo->panel_info.valid) { | 776 | if (rinfo->mon1_type != MT_CRT && rinfo->panel_info.valid) { |
777 | struct fb_var_screeninfo *var = &info->var; | 777 | struct fb_var_screeninfo *var = &info->var; |
778 | 778 | ||
779 | RTRACE("Setting up default mode based on panel info\n"); | 779 | pr_debug("Setting up default mode based on panel info\n"); |
780 | var->xres = rinfo->panel_info.xres; | 780 | var->xres = rinfo->panel_info.xres; |
781 | var->yres = rinfo->panel_info.yres; | 781 | var->yres = rinfo->panel_info.yres; |
782 | var->xres_virtual = rinfo->panel_info.xres; | 782 | var->xres_virtual = rinfo->panel_info.xres; |
@@ -824,7 +824,7 @@ void __devinit radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_ | |||
824 | int dbsize; | 824 | int dbsize; |
825 | char modename[32]; | 825 | char modename[32]; |
826 | 826 | ||
827 | RTRACE("Guessing panel info...\n"); | 827 | pr_debug("Guessing panel info...\n"); |
828 | if (rinfo->panel_info.xres == 0 || rinfo->panel_info.yres == 0) { | 828 | if (rinfo->panel_info.xres == 0 || rinfo->panel_info.yres == 0) { |
829 | u32 tmp = INREG(FP_HORZ_STRETCH) & HORZ_PANEL_SIZE; | 829 | u32 tmp = INREG(FP_HORZ_STRETCH) & HORZ_PANEL_SIZE; |
830 | rinfo->panel_info.xres = ((tmp >> HORZ_PANEL_SHIFT) + 1) * 8; | 830 | rinfo->panel_info.xres = ((tmp >> HORZ_PANEL_SHIFT) + 1) * 8; |
diff --git a/drivers/video/aty/radeonfb.h b/drivers/video/aty/radeonfb.h index 5eac1ce52e72..c347e38cd0b0 100644 --- a/drivers/video/aty/radeonfb.h +++ b/drivers/video/aty/radeonfb.h | |||
@@ -1,6 +1,10 @@ | |||
1 | #ifndef __RADEONFB_H__ | 1 | #ifndef __RADEONFB_H__ |
2 | #define __RADEONFB_H__ | 2 | #define __RADEONFB_H__ |
3 | 3 | ||
4 | #ifdef CONFIG_FB_RADEON_DEBUG | ||
5 | #define DEBUG 1 | ||
6 | #endif | ||
7 | |||
4 | #include <linux/module.h> | 8 | #include <linux/module.h> |
5 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
6 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
@@ -365,22 +369,6 @@ struct radeonfb_info { | |||
365 | 369 | ||
366 | 370 | ||
367 | /* | 371 | /* |
368 | * Debugging stuffs | ||
369 | */ | ||
370 | #ifdef CONFIG_FB_RADEON_DEBUG | ||
371 | #define DEBUG 1 | ||
372 | #else | ||
373 | #define DEBUG 0 | ||
374 | #endif | ||
375 | |||
376 | #if DEBUG | ||
377 | #define RTRACE printk | ||
378 | #else | ||
379 | #define RTRACE if(0) printk | ||
380 | #endif | ||
381 | |||
382 | |||
383 | /* | ||
384 | * IO macros | 372 | * IO macros |
385 | */ | 373 | */ |
386 | 374 | ||
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c index eefba3d0e4b9..49834a67a623 100644 --- a/drivers/video/bf54x-lq043fb.c +++ b/drivers/video/bf54x-lq043fb.c | |||
@@ -336,7 +336,7 @@ static int bfin_bf54x_fb_check_var(struct fb_var_screeninfo *var, | |||
336 | { | 336 | { |
337 | 337 | ||
338 | if (var->bits_per_pixel != LCD_BPP) { | 338 | if (var->bits_per_pixel != LCD_BPP) { |
339 | pr_debug("%s: depth not supported: %u BPP\n", __FUNCTION__, | 339 | pr_debug("%s: depth not supported: %u BPP\n", __func__, |
340 | var->bits_per_pixel); | 340 | var->bits_per_pixel); |
341 | return -EINVAL; | 341 | return -EINVAL; |
342 | } | 342 | } |
@@ -345,7 +345,7 @@ static int bfin_bf54x_fb_check_var(struct fb_var_screeninfo *var, | |||
345 | info->var.xres_virtual != var->xres_virtual || | 345 | info->var.xres_virtual != var->xres_virtual || |
346 | info->var.yres_virtual != var->yres_virtual) { | 346 | info->var.yres_virtual != var->yres_virtual) { |
347 | pr_debug("%s: Resolution not supported: X%u x Y%u \n", | 347 | pr_debug("%s: Resolution not supported: X%u x Y%u \n", |
348 | __FUNCTION__, var->xres, var->yres); | 348 | __func__, var->xres, var->yres); |
349 | return -EINVAL; | 349 | return -EINVAL; |
350 | } | 350 | } |
351 | 351 | ||
@@ -355,7 +355,7 @@ static int bfin_bf54x_fb_check_var(struct fb_var_screeninfo *var, | |||
355 | 355 | ||
356 | if ((info->fix.line_length * var->yres_virtual) > info->fix.smem_len) { | 356 | if ((info->fix.line_length * var->yres_virtual) > info->fix.smem_len) { |
357 | pr_debug("%s: Memory Limit requested yres_virtual = %u\n", | 357 | pr_debug("%s: Memory Limit requested yres_virtual = %u\n", |
358 | __FUNCTION__, var->yres_virtual); | 358 | __func__, var->yres_virtual); |
359 | return -ENOMEM; | 359 | return -ENOMEM; |
360 | } | 360 | } |
361 | 361 | ||
@@ -652,7 +652,7 @@ static int __init bfin_bf54x_probe(struct platform_device *pdev) | |||
652 | goto out7; | 652 | goto out7; |
653 | } | 653 | } |
654 | 654 | ||
655 | if (request_irq(info->irq, (void *)bfin_bf54x_irq_error, IRQF_DISABLED, | 655 | if (request_irq(info->irq, bfin_bf54x_irq_error, IRQF_DISABLED, |
656 | "PPI ERROR", info) < 0) { | 656 | "PPI ERROR", info) < 0) { |
657 | printk(KERN_ERR DRIVER_NAME | 657 | printk(KERN_ERR DRIVER_NAME |
658 | ": unable to request PPI ERROR IRQ\n"); | 658 | ": unable to request PPI ERROR IRQ\n"); |
diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c index 833b10c84064..275d9dab0c61 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/bw2.c | |||
@@ -339,7 +339,7 @@ static int __devinit bw2_probe(struct of_device *op, const struct of_device_id * | |||
339 | 339 | ||
340 | dev_set_drvdata(&op->dev, info); | 340 | dev_set_drvdata(&op->dev, info); |
341 | 341 | ||
342 | printk("%s: bwtwo at %lx:%lx\n", | 342 | printk(KERN_INFO "%s: bwtwo at %lx:%lx\n", |
343 | dp->full_name, par->which_io, par->physbase); | 343 | dp->full_name, par->which_io, par->physbase); |
344 | 344 | ||
345 | return 0; | 345 | return 0; |
@@ -399,10 +399,9 @@ static int __init bw2_init(void) | |||
399 | 399 | ||
400 | static void __exit bw2_exit(void) | 400 | static void __exit bw2_exit(void) |
401 | { | 401 | { |
402 | return of_unregister_driver(&bw2_driver); | 402 | of_unregister_driver(&bw2_driver); |
403 | } | 403 | } |
404 | 404 | ||
405 | |||
406 | module_init(bw2_init); | 405 | module_init(bw2_init); |
407 | module_exit(bw2_exit); | 406 | module_exit(bw2_exit); |
408 | 407 | ||
diff --git a/drivers/video/cfbcopyarea.c b/drivers/video/cfbcopyarea.c index b07e419b12d2..df03f3776dcc 100644 --- a/drivers/video/cfbcopyarea.c +++ b/drivers/video/cfbcopyarea.c | |||
@@ -44,15 +44,16 @@ | |||
44 | */ | 44 | */ |
45 | 45 | ||
46 | static void | 46 | static void |
47 | bitcpy(unsigned long __iomem *dst, int dst_idx, const unsigned long __iomem *src, | 47 | bitcpy(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
48 | int src_idx, int bits, unsigned n, u32 bswapmask) | 48 | const unsigned long __iomem *src, int src_idx, int bits, |
49 | unsigned n, u32 bswapmask) | ||
49 | { | 50 | { |
50 | unsigned long first, last; | 51 | unsigned long first, last; |
51 | int const shift = dst_idx-src_idx; | 52 | int const shift = dst_idx-src_idx; |
52 | int left, right; | 53 | int left, right; |
53 | 54 | ||
54 | first = fb_shifted_pixels_mask_long(dst_idx, bswapmask); | 55 | first = fb_shifted_pixels_mask_long(p, dst_idx, bswapmask); |
55 | last = ~fb_shifted_pixels_mask_long((dst_idx+n) % bits, bswapmask); | 56 | last = ~fb_shifted_pixels_mask_long(p, (dst_idx+n) % bits, bswapmask); |
56 | 57 | ||
57 | if (!shift) { | 58 | if (!shift) { |
58 | // Same alignment for source and dest | 59 | // Same alignment for source and dest |
@@ -202,8 +203,9 @@ bitcpy(unsigned long __iomem *dst, int dst_idx, const unsigned long __iomem *src | |||
202 | */ | 203 | */ |
203 | 204 | ||
204 | static void | 205 | static void |
205 | bitcpy_rev(unsigned long __iomem *dst, int dst_idx, const unsigned long __iomem *src, | 206 | bitcpy_rev(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
206 | int src_idx, int bits, unsigned n, u32 bswapmask) | 207 | const unsigned long __iomem *src, int src_idx, int bits, |
208 | unsigned n, u32 bswapmask) | ||
207 | { | 209 | { |
208 | unsigned long first, last; | 210 | unsigned long first, last; |
209 | int shift; | 211 | int shift; |
@@ -221,8 +223,9 @@ bitcpy_rev(unsigned long __iomem *dst, int dst_idx, const unsigned long __iomem | |||
221 | 223 | ||
222 | shift = dst_idx-src_idx; | 224 | shift = dst_idx-src_idx; |
223 | 225 | ||
224 | first = fb_shifted_pixels_mask_long(bits - 1 - dst_idx, bswapmask); | 226 | first = fb_shifted_pixels_mask_long(p, bits - 1 - dst_idx, bswapmask); |
225 | last = ~fb_shifted_pixels_mask_long(bits - 1 - ((dst_idx-n) % bits), bswapmask); | 227 | last = ~fb_shifted_pixels_mask_long(p, bits - 1 - ((dst_idx-n) % bits), |
228 | bswapmask); | ||
226 | 229 | ||
227 | if (!shift) { | 230 | if (!shift) { |
228 | // Same alignment for source and dest | 231 | // Same alignment for source and dest |
@@ -404,7 +407,7 @@ void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) | |||
404 | dst_idx &= (bytes - 1); | 407 | dst_idx &= (bytes - 1); |
405 | src += src_idx >> (ffs(bits) - 1); | 408 | src += src_idx >> (ffs(bits) - 1); |
406 | src_idx &= (bytes - 1); | 409 | src_idx &= (bytes - 1); |
407 | bitcpy_rev(dst, dst_idx, src, src_idx, bits, | 410 | bitcpy_rev(p, dst, dst_idx, src, src_idx, bits, |
408 | width*p->var.bits_per_pixel, bswapmask); | 411 | width*p->var.bits_per_pixel, bswapmask); |
409 | } | 412 | } |
410 | } else { | 413 | } else { |
@@ -413,7 +416,7 @@ void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) | |||
413 | dst_idx &= (bytes - 1); | 416 | dst_idx &= (bytes - 1); |
414 | src += src_idx >> (ffs(bits) - 1); | 417 | src += src_idx >> (ffs(bits) - 1); |
415 | src_idx &= (bytes - 1); | 418 | src_idx &= (bytes - 1); |
416 | bitcpy(dst, dst_idx, src, src_idx, bits, | 419 | bitcpy(p, dst, dst_idx, src, src_idx, bits, |
417 | width*p->var.bits_per_pixel, bswapmask); | 420 | width*p->var.bits_per_pixel, bswapmask); |
418 | dst_idx += bits_per_line; | 421 | dst_idx += bits_per_line; |
419 | src_idx += bits_per_line; | 422 | src_idx += bits_per_line; |
diff --git a/drivers/video/cfbfillrect.c b/drivers/video/cfbfillrect.c index 23d70a12e4da..64b35766b2a2 100644 --- a/drivers/video/cfbfillrect.c +++ b/drivers/video/cfbfillrect.c | |||
@@ -36,16 +36,16 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | static void | 38 | static void |
39 | bitfill_aligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat, | 39 | bitfill_aligned(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
40 | unsigned n, int bits, u32 bswapmask) | 40 | unsigned long pat, unsigned n, int bits, u32 bswapmask) |
41 | { | 41 | { |
42 | unsigned long first, last; | 42 | unsigned long first, last; |
43 | 43 | ||
44 | if (!n) | 44 | if (!n) |
45 | return; | 45 | return; |
46 | 46 | ||
47 | first = fb_shifted_pixels_mask_long(dst_idx, bswapmask); | 47 | first = fb_shifted_pixels_mask_long(p, dst_idx, bswapmask); |
48 | last = ~fb_shifted_pixels_mask_long((dst_idx+n) % bits, bswapmask); | 48 | last = ~fb_shifted_pixels_mask_long(p, (dst_idx+n) % bits, bswapmask); |
49 | 49 | ||
50 | if (dst_idx+n <= bits) { | 50 | if (dst_idx+n <= bits) { |
51 | // Single word | 51 | // Single word |
@@ -93,16 +93,16 @@ bitfill_aligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat, | |||
93 | */ | 93 | */ |
94 | 94 | ||
95 | static void | 95 | static void |
96 | bitfill_unaligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat, | 96 | bitfill_unaligned(struct fb_info *p, unsigned long __iomem *dst, int dst_idx, |
97 | int left, int right, unsigned n, int bits) | 97 | unsigned long pat, int left, int right, unsigned n, int bits) |
98 | { | 98 | { |
99 | unsigned long first, last; | 99 | unsigned long first, last; |
100 | 100 | ||
101 | if (!n) | 101 | if (!n) |
102 | return; | 102 | return; |
103 | 103 | ||
104 | first = FB_SHIFT_HIGH(~0UL, dst_idx); | 104 | first = FB_SHIFT_HIGH(p, ~0UL, dst_idx); |
105 | last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); | 105 | last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits)); |
106 | 106 | ||
107 | if (dst_idx+n <= bits) { | 107 | if (dst_idx+n <= bits) { |
108 | // Single word | 108 | // Single word |
@@ -147,8 +147,9 @@ bitfill_unaligned(unsigned long __iomem *dst, int dst_idx, unsigned long pat, | |||
147 | * Aligned pattern invert using 32/64-bit memory accesses | 147 | * Aligned pattern invert using 32/64-bit memory accesses |
148 | */ | 148 | */ |
149 | static void | 149 | static void |
150 | bitfill_aligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat, | 150 | bitfill_aligned_rev(struct fb_info *p, unsigned long __iomem *dst, |
151 | unsigned n, int bits, u32 bswapmask) | 151 | int dst_idx, unsigned long pat, unsigned n, int bits, |
152 | u32 bswapmask) | ||
152 | { | 153 | { |
153 | unsigned long val = pat, dat; | 154 | unsigned long val = pat, dat; |
154 | unsigned long first, last; | 155 | unsigned long first, last; |
@@ -156,8 +157,8 @@ bitfill_aligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat, | |||
156 | if (!n) | 157 | if (!n) |
157 | return; | 158 | return; |
158 | 159 | ||
159 | first = fb_shifted_pixels_mask_long(dst_idx, bswapmask); | 160 | first = fb_shifted_pixels_mask_long(p, dst_idx, bswapmask); |
160 | last = ~fb_shifted_pixels_mask_long((dst_idx+n) % bits, bswapmask); | 161 | last = ~fb_shifted_pixels_mask_long(p, (dst_idx+n) % bits, bswapmask); |
161 | 162 | ||
162 | if (dst_idx+n <= bits) { | 163 | if (dst_idx+n <= bits) { |
163 | // Single word | 164 | // Single word |
@@ -217,16 +218,17 @@ bitfill_aligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat, | |||
217 | */ | 218 | */ |
218 | 219 | ||
219 | static void | 220 | static void |
220 | bitfill_unaligned_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat, | 221 | bitfill_unaligned_rev(struct fb_info *p, unsigned long __iomem *dst, |
221 | int left, int right, unsigned n, int bits) | 222 | int dst_idx, unsigned long pat, int left, int right, |
223 | unsigned n, int bits) | ||
222 | { | 224 | { |
223 | unsigned long first, last, dat; | 225 | unsigned long first, last, dat; |
224 | 226 | ||
225 | if (!n) | 227 | if (!n) |
226 | return; | 228 | return; |
227 | 229 | ||
228 | first = FB_SHIFT_HIGH(~0UL, dst_idx); | 230 | first = FB_SHIFT_HIGH(p, ~0UL, dst_idx); |
229 | last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); | 231 | last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits)); |
230 | 232 | ||
231 | if (dst_idx+n <= bits) { | 233 | if (dst_idx+n <= bits) { |
232 | // Single word | 234 | // Single word |
@@ -306,7 +308,8 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect) | |||
306 | p->fbops->fb_sync(p); | 308 | p->fbops->fb_sync(p); |
307 | if (!left) { | 309 | if (!left) { |
308 | u32 bswapmask = fb_compute_bswapmask(p); | 310 | u32 bswapmask = fb_compute_bswapmask(p); |
309 | void (*fill_op32)(unsigned long __iomem *dst, int dst_idx, | 311 | void (*fill_op32)(struct fb_info *p, |
312 | unsigned long __iomem *dst, int dst_idx, | ||
310 | unsigned long pat, unsigned n, int bits, | 313 | unsigned long pat, unsigned n, int bits, |
311 | u32 bswapmask) = NULL; | 314 | u32 bswapmask) = NULL; |
312 | 315 | ||
@@ -325,16 +328,17 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect) | |||
325 | while (height--) { | 328 | while (height--) { |
326 | dst += dst_idx >> (ffs(bits) - 1); | 329 | dst += dst_idx >> (ffs(bits) - 1); |
327 | dst_idx &= (bits - 1); | 330 | dst_idx &= (bits - 1); |
328 | fill_op32(dst, dst_idx, pat, width*bpp, bits, bswapmask); | 331 | fill_op32(p, dst, dst_idx, pat, width*bpp, bits, |
332 | bswapmask); | ||
329 | dst_idx += p->fix.line_length*8; | 333 | dst_idx += p->fix.line_length*8; |
330 | } | 334 | } |
331 | } else { | 335 | } else { |
332 | int right; | 336 | int right; |
333 | int r; | 337 | int r; |
334 | int rot = (left-dst_idx) % bpp; | 338 | int rot = (left-dst_idx) % bpp; |
335 | void (*fill_op)(unsigned long __iomem *dst, int dst_idx, | 339 | void (*fill_op)(struct fb_info *p, unsigned long __iomem *dst, |
336 | unsigned long pat, int left, int right, | 340 | int dst_idx, unsigned long pat, int left, |
337 | unsigned n, int bits) = NULL; | 341 | int right, unsigned n, int bits) = NULL; |
338 | 342 | ||
339 | /* rotate pattern to correct start position */ | 343 | /* rotate pattern to correct start position */ |
340 | pat = pat << rot | pat >> (bpp-rot); | 344 | pat = pat << rot | pat >> (bpp-rot); |
@@ -355,7 +359,7 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect) | |||
355 | while (height--) { | 359 | while (height--) { |
356 | dst += dst_idx >> (ffs(bits) - 1); | 360 | dst += dst_idx >> (ffs(bits) - 1); |
357 | dst_idx &= (bits - 1); | 361 | dst_idx &= (bits - 1); |
358 | fill_op(dst, dst_idx, pat, left, right, | 362 | fill_op(p, dst, dst_idx, pat, left, right, |
359 | width*bpp, bits); | 363 | width*bpp, bits); |
360 | r = (p->fix.line_length*8) % bpp; | 364 | r = (p->fix.line_length*8) % bpp; |
361 | pat = pat << (bpp-r) | pat >> r; | 365 | pat = pat << (bpp-r) | pat >> r; |
diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c index f598907b42ad..baed57d3cfff 100644 --- a/drivers/video/cfbimgblt.c +++ b/drivers/video/cfbimgblt.c | |||
@@ -38,35 +38,31 @@ | |||
38 | #define DEBUG | 38 | #define DEBUG |
39 | 39 | ||
40 | #ifdef DEBUG | 40 | #ifdef DEBUG |
41 | #define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt,__FUNCTION__,## args) | 41 | #define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt,__func__,## args) |
42 | #else | 42 | #else |
43 | #define DPRINTK(fmt, args...) | 43 | #define DPRINTK(fmt, args...) |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | static const u32 cfb_tab8[] = { | 46 | static const u32 cfb_tab8_be[] = { |
47 | #if defined(__BIG_ENDIAN) | ||
48 | 0x00000000,0x000000ff,0x0000ff00,0x0000ffff, | 47 | 0x00000000,0x000000ff,0x0000ff00,0x0000ffff, |
49 | 0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff, | 48 | 0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff, |
50 | 0xff000000,0xff0000ff,0xff00ff00,0xff00ffff, | 49 | 0xff000000,0xff0000ff,0xff00ff00,0xff00ffff, |
51 | 0xffff0000,0xffff00ff,0xffffff00,0xffffffff | 50 | 0xffff0000,0xffff00ff,0xffffff00,0xffffffff |
52 | #elif defined(__LITTLE_ENDIAN) | 51 | }; |
52 | |||
53 | static const u32 cfb_tab8_le[] = { | ||
53 | 0x00000000,0xff000000,0x00ff0000,0xffff0000, | 54 | 0x00000000,0xff000000,0x00ff0000,0xffff0000, |
54 | 0x0000ff00,0xff00ff00,0x00ffff00,0xffffff00, | 55 | 0x0000ff00,0xff00ff00,0x00ffff00,0xffffff00, |
55 | 0x000000ff,0xff0000ff,0x00ff00ff,0xffff00ff, | 56 | 0x000000ff,0xff0000ff,0x00ff00ff,0xffff00ff, |
56 | 0x0000ffff,0xff00ffff,0x00ffffff,0xffffffff | 57 | 0x0000ffff,0xff00ffff,0x00ffffff,0xffffffff |
57 | #else | ||
58 | #error FIXME: No endianness?? | ||
59 | #endif | ||
60 | }; | 58 | }; |
61 | 59 | ||
62 | static const u32 cfb_tab16[] = { | 60 | static const u32 cfb_tab16_be[] = { |
63 | #if defined(__BIG_ENDIAN) | ||
64 | 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff | 61 | 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff |
65 | #elif defined(__LITTLE_ENDIAN) | 62 | }; |
63 | |||
64 | static const u32 cfb_tab16_le[] = { | ||
66 | 0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff | 65 | 0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff |
67 | #else | ||
68 | #error FIXME: No endianness?? | ||
69 | #endif | ||
70 | }; | 66 | }; |
71 | 67 | ||
72 | static const u32 cfb_tab32[] = { | 68 | static const u32 cfb_tab32[] = { |
@@ -98,7 +94,8 @@ static inline void color_imageblit(const struct fb_image *image, | |||
98 | val = 0; | 94 | val = 0; |
99 | 95 | ||
100 | if (start_index) { | 96 | if (start_index) { |
101 | u32 start_mask = ~fb_shifted_pixels_mask_u32(start_index, bswapmask); | 97 | u32 start_mask = ~fb_shifted_pixels_mask_u32(p, |
98 | start_index, bswapmask); | ||
102 | val = FB_READL(dst) & start_mask; | 99 | val = FB_READL(dst) & start_mask; |
103 | shift = start_index; | 100 | shift = start_index; |
104 | } | 101 | } |
@@ -108,20 +105,21 @@ static inline void color_imageblit(const struct fb_image *image, | |||
108 | color = palette[*src]; | 105 | color = palette[*src]; |
109 | else | 106 | else |
110 | color = *src; | 107 | color = *src; |
111 | color <<= FB_LEFT_POS(bpp); | 108 | color <<= FB_LEFT_POS(p, bpp); |
112 | val |= FB_SHIFT_HIGH(color, shift ^ bswapmask); | 109 | val |= FB_SHIFT_HIGH(p, color, shift ^ bswapmask); |
113 | if (shift >= null_bits) { | 110 | if (shift >= null_bits) { |
114 | FB_WRITEL(val, dst++); | 111 | FB_WRITEL(val, dst++); |
115 | 112 | ||
116 | val = (shift == null_bits) ? 0 : | 113 | val = (shift == null_bits) ? 0 : |
117 | FB_SHIFT_LOW(color, 32 - shift); | 114 | FB_SHIFT_LOW(p, color, 32 - shift); |
118 | } | 115 | } |
119 | shift += bpp; | 116 | shift += bpp; |
120 | shift &= (32 - 1); | 117 | shift &= (32 - 1); |
121 | src++; | 118 | src++; |
122 | } | 119 | } |
123 | if (shift) { | 120 | if (shift) { |
124 | u32 end_mask = fb_shifted_pixels_mask_u32(shift, bswapmask); | 121 | u32 end_mask = fb_shifted_pixels_mask_u32(p, shift, |
122 | bswapmask); | ||
125 | 123 | ||
126 | FB_WRITEL((FB_READL(dst) & end_mask) | val, dst); | 124 | FB_WRITEL((FB_READL(dst) & end_mask) | val, dst); |
127 | } | 125 | } |
@@ -152,8 +150,8 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info * | |||
152 | u32 bswapmask = fb_compute_bswapmask(p); | 150 | u32 bswapmask = fb_compute_bswapmask(p); |
153 | 151 | ||
154 | dst2 = (u32 __iomem *) dst1; | 152 | dst2 = (u32 __iomem *) dst1; |
155 | fgcolor <<= FB_LEFT_POS(bpp); | 153 | fgcolor <<= FB_LEFT_POS(p, bpp); |
156 | bgcolor <<= FB_LEFT_POS(bpp); | 154 | bgcolor <<= FB_LEFT_POS(p, bpp); |
157 | 155 | ||
158 | for (i = image->height; i--; ) { | 156 | for (i = image->height; i--; ) { |
159 | shift = val = 0; | 157 | shift = val = 0; |
@@ -164,7 +162,8 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info * | |||
164 | 162 | ||
165 | /* write leading bits */ | 163 | /* write leading bits */ |
166 | if (start_index) { | 164 | if (start_index) { |
167 | u32 start_mask = ~fb_shifted_pixels_mask_u32(start_index, bswapmask); | 165 | u32 start_mask = ~fb_shifted_pixels_mask_u32(p, |
166 | start_index, bswapmask); | ||
168 | val = FB_READL(dst) & start_mask; | 167 | val = FB_READL(dst) & start_mask; |
169 | shift = start_index; | 168 | shift = start_index; |
170 | } | 169 | } |
@@ -172,13 +171,13 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info * | |||
172 | while (j--) { | 171 | while (j--) { |
173 | l--; | 172 | l--; |
174 | color = (*s & (1 << l)) ? fgcolor : bgcolor; | 173 | color = (*s & (1 << l)) ? fgcolor : bgcolor; |
175 | val |= FB_SHIFT_HIGH(color, shift ^ bswapmask); | 174 | val |= FB_SHIFT_HIGH(p, color, shift ^ bswapmask); |
176 | 175 | ||
177 | /* Did the bitshift spill bits to the next long? */ | 176 | /* Did the bitshift spill bits to the next long? */ |
178 | if (shift >= null_bits) { | 177 | if (shift >= null_bits) { |
179 | FB_WRITEL(val, dst++); | 178 | FB_WRITEL(val, dst++); |
180 | val = (shift == null_bits) ? 0 : | 179 | val = (shift == null_bits) ? 0 : |
181 | FB_SHIFT_LOW(color,32 - shift); | 180 | FB_SHIFT_LOW(p, color, 32 - shift); |
182 | } | 181 | } |
183 | shift += bpp; | 182 | shift += bpp; |
184 | shift &= (32 - 1); | 183 | shift &= (32 - 1); |
@@ -187,7 +186,8 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info * | |||
187 | 186 | ||
188 | /* write trailing bits */ | 187 | /* write trailing bits */ |
189 | if (shift) { | 188 | if (shift) { |
190 | u32 end_mask = fb_shifted_pixels_mask_u32(shift, bswapmask); | 189 | u32 end_mask = fb_shifted_pixels_mask_u32(p, shift, |
190 | bswapmask); | ||
191 | 191 | ||
192 | FB_WRITEL((FB_READL(dst) & end_mask) | val, dst); | 192 | FB_WRITEL((FB_READL(dst) & end_mask) | val, dst); |
193 | } | 193 | } |
@@ -223,13 +223,13 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info * | |||
223 | u32 __iomem *dst; | 223 | u32 __iomem *dst; |
224 | const u32 *tab = NULL; | 224 | const u32 *tab = NULL; |
225 | int i, j, k; | 225 | int i, j, k; |
226 | 226 | ||
227 | switch (bpp) { | 227 | switch (bpp) { |
228 | case 8: | 228 | case 8: |
229 | tab = cfb_tab8; | 229 | tab = fb_be_math(p) ? cfb_tab8_be : cfb_tab8_le; |
230 | break; | 230 | break; |
231 | case 16: | 231 | case 16: |
232 | tab = cfb_tab16; | 232 | tab = fb_be_math(p) ? cfb_tab16_be : cfb_tab16_le; |
233 | break; | 233 | break; |
234 | case 32: | 234 | case 32: |
235 | default: | 235 | default: |
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index fdc9f43ec30a..0db0fecba93b 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c | |||
@@ -556,7 +556,7 @@ static int __devinit cg14_probe(struct of_device *op, const struct of_device_id | |||
556 | 556 | ||
557 | dev_set_drvdata(&op->dev, info); | 557 | dev_set_drvdata(&op->dev, info); |
558 | 558 | ||
559 | printk("%s: cgfourteen at %lx:%lx, %dMB\n", | 559 | printk(KERN_INFO "%s: cgfourteen at %lx:%lx, %dMB\n", |
560 | dp->full_name, | 560 | dp->full_name, |
561 | par->iospace, par->physbase, | 561 | par->iospace, par->physbase, |
562 | par->ramsize >> 20); | 562 | par->ramsize >> 20); |
@@ -605,7 +605,7 @@ static struct of_platform_driver cg14_driver = { | |||
605 | .remove = __devexit_p(cg14_remove), | 605 | .remove = __devexit_p(cg14_remove), |
606 | }; | 606 | }; |
607 | 607 | ||
608 | int __init cg14_init(void) | 608 | static int __init cg14_init(void) |
609 | { | 609 | { |
610 | if (fb_get_options("cg14fb", NULL)) | 610 | if (fb_get_options("cg14fb", NULL)) |
611 | return -ENODEV; | 611 | return -ENODEV; |
@@ -613,7 +613,7 @@ int __init cg14_init(void) | |||
613 | return of_register_driver(&cg14_driver, &of_bus_type); | 613 | return of_register_driver(&cg14_driver, &of_bus_type); |
614 | } | 614 | } |
615 | 615 | ||
616 | void __exit cg14_exit(void) | 616 | static void __exit cg14_exit(void) |
617 | { | 617 | { |
618 | of_unregister_driver(&cg14_driver); | 618 | of_unregister_driver(&cg14_driver); |
619 | } | 619 | } |
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c index a5c7fb331527..010ea53978f8 100644 --- a/drivers/video/cg3.c +++ b/drivers/video/cg3.c | |||
@@ -419,7 +419,7 @@ static int __devinit cg3_probe(struct of_device *op, | |||
419 | 419 | ||
420 | dev_set_drvdata(&op->dev, info); | 420 | dev_set_drvdata(&op->dev, info); |
421 | 421 | ||
422 | printk("%s: cg3 at %lx:%lx\n", | 422 | printk(KERN_INFO "%s: cg3 at %lx:%lx\n", |
423 | dp->full_name, par->which_io, par->physbase); | 423 | dp->full_name, par->which_io, par->physbase); |
424 | 424 | ||
425 | return 0; | 425 | return 0; |
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c index 549891d76ef5..fc90db6da65a 100644 --- a/drivers/video/cg6.c +++ b/drivers/video/cg6.c | |||
@@ -781,7 +781,7 @@ static int __devinit cg6_probe(struct of_device *op, | |||
781 | 781 | ||
782 | dev_set_drvdata(&op->dev, info); | 782 | dev_set_drvdata(&op->dev, info); |
783 | 783 | ||
784 | printk("%s: CGsix [%s] at %lx:%lx\n", | 784 | printk(KERN_INFO "%s: CGsix [%s] at %lx:%lx\n", |
785 | dp->full_name, info->fix.id, | 785 | dp->full_name, info->fix.id, |
786 | par->which_io, par->physbase); | 786 | par->which_io, par->physbase); |
787 | 787 | ||
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index f7e2d5add831..35ac9d956b3d 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c | |||
@@ -81,7 +81,7 @@ | |||
81 | /* debug output */ | 81 | /* debug output */ |
82 | #ifdef CIRRUSFB_DEBUG | 82 | #ifdef CIRRUSFB_DEBUG |
83 | #define DPRINTK(fmt, args...) \ | 83 | #define DPRINTK(fmt, args...) \ |
84 | printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) | 84 | printk(KERN_DEBUG "%s: " fmt, __func__ , ## args) |
85 | #else | 85 | #else |
86 | #define DPRINTK(fmt, args...) | 86 | #define DPRINTK(fmt, args...) |
87 | #endif | 87 | #endif |
@@ -91,7 +91,7 @@ | |||
91 | #define assert(expr) \ | 91 | #define assert(expr) \ |
92 | if (!(expr)) { \ | 92 | if (!(expr)) { \ |
93 | printk("Assertion failed! %s,%s,%s,line=%d\n", \ | 93 | printk("Assertion failed! %s,%s,%s,line=%d\n", \ |
94 | #expr, __FILE__, __FUNCTION__, __LINE__); \ | 94 | #expr, __FILE__, __func__, __LINE__); \ |
95 | } | 95 | } |
96 | #else | 96 | #else |
97 | #define assert(expr) | 97 | #define assert(expr) |
@@ -3117,7 +3117,7 @@ static void bestclock(long freq, long *best, long *nom, | |||
3117 | } | 3117 | } |
3118 | } | 3118 | } |
3119 | } | 3119 | } |
3120 | d = ((143181 * n) + f - 1) / f; | 3120 | d = DIV_ROUND_UP(143181 * n, f); |
3121 | if ((d >= 7) && (d <= 63)) { | 3121 | if ((d >= 7) && (d <= 63)) { |
3122 | if (d > 31) | 3122 | if (d > 31) |
3123 | d = (d / 2) * 2; | 3123 | d = (d / 2) * 2; |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 022282494d3f..8eda7b60df8f 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -92,7 +92,7 @@ | |||
92 | #include "fbcon.h" | 92 | #include "fbcon.h" |
93 | 93 | ||
94 | #ifdef FBCONDEBUG | 94 | #ifdef FBCONDEBUG |
95 | # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) | 95 | # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args) |
96 | #else | 96 | #else |
97 | # define DPRINTK(fmt, args...) | 97 | # define DPRINTK(fmt, args...) |
98 | #endif | 98 | #endif |
@@ -620,8 +620,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, | |||
620 | if (fb_get_color_depth(&info->var, &info->fix) == 1) | 620 | if (fb_get_color_depth(&info->var, &info->fix) == 1) |
621 | erase &= ~0x400; | 621 | erase &= ~0x400; |
622 | logo_height = fb_prepare_logo(info, ops->rotate); | 622 | logo_height = fb_prepare_logo(info, ops->rotate); |
623 | logo_lines = (logo_height + vc->vc_font.height - 1) / | 623 | logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); |
624 | vc->vc_font.height; | ||
625 | q = (unsigned short *) (vc->vc_origin + | 624 | q = (unsigned short *) (vc->vc_origin + |
626 | vc->vc_size_row * rows); | 625 | vc->vc_size_row * rows); |
627 | step = logo_lines * cols; | 626 | step = logo_lines * cols; |
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h index 3706307e70ed..0135e0395456 100644 --- a/drivers/video/console/fbcon.h +++ b/drivers/video/console/fbcon.h | |||
@@ -104,10 +104,14 @@ struct fbcon_ops { | |||
104 | #define attr_blink(s) \ | 104 | #define attr_blink(s) \ |
105 | ((s) & 0x8000) | 105 | ((s) & 0x8000) |
106 | 106 | ||
107 | #define mono_col(info) \ | 107 | |
108 | (~(0xfff << (max((info)->var.green.length, \ | 108 | static inline int mono_col(const struct fb_info *info) |
109 | max((info)->var.red.length, \ | 109 | { |
110 | (info)->var.blue.length)))) & 0xff) | 110 | __u32 max_len; |
111 | max_len = max(info->var.green.length, info->var.red.length); | ||
112 | max_len = max(info->var.blue.length, max_len); | ||
113 | return ~(0xfff << (max_len & 0xff)); | ||
114 | } | ||
111 | 115 | ||
112 | static inline int attr_col_ec(int shift, struct vc_data *vc, | 116 | static inline int attr_col_ec(int shift, struct vc_data *vc, |
113 | struct fb_info *info, int is_fg) | 117 | struct fb_info *info, int is_fg) |
diff --git a/drivers/video/fb_draw.h b/drivers/video/fb_draw.h index a2a0618d86a5..1db622192bde 100644 --- a/drivers/video/fb_draw.h +++ b/drivers/video/fb_draw.h | |||
@@ -94,41 +94,44 @@ static inline unsigned long fb_rev_pixels_in_long(unsigned long val, | |||
94 | return val; | 94 | return val; |
95 | } | 95 | } |
96 | 96 | ||
97 | static inline u32 fb_shifted_pixels_mask_u32(u32 index, u32 bswapmask) | 97 | static inline u32 fb_shifted_pixels_mask_u32(struct fb_info *p, u32 index, |
98 | u32 bswapmask) | ||
98 | { | 99 | { |
99 | u32 mask; | 100 | u32 mask; |
100 | 101 | ||
101 | if (!bswapmask) { | 102 | if (!bswapmask) { |
102 | mask = FB_SHIFT_HIGH(~(u32)0, index); | 103 | mask = FB_SHIFT_HIGH(p, ~(u32)0, index); |
103 | } else { | 104 | } else { |
104 | mask = 0xff << FB_LEFT_POS(8); | 105 | mask = 0xff << FB_LEFT_POS(p, 8); |
105 | mask = FB_SHIFT_LOW(mask, index & (bswapmask)) & mask; | 106 | mask = FB_SHIFT_LOW(p, mask, index & (bswapmask)) & mask; |
106 | mask = FB_SHIFT_HIGH(mask, index & ~(bswapmask)); | 107 | mask = FB_SHIFT_HIGH(p, mask, index & ~(bswapmask)); |
107 | #if defined(__i386__) || defined(__x86_64__) | 108 | #if defined(__i386__) || defined(__x86_64__) |
108 | /* Shift argument is limited to 0 - 31 on x86 based CPU's */ | 109 | /* Shift argument is limited to 0 - 31 on x86 based CPU's */ |
109 | if(index + bswapmask < 32) | 110 | if(index + bswapmask < 32) |
110 | #endif | 111 | #endif |
111 | mask |= FB_SHIFT_HIGH(~(u32)0, | 112 | mask |= FB_SHIFT_HIGH(p, ~(u32)0, |
112 | (index + bswapmask) & ~(bswapmask)); | 113 | (index + bswapmask) & ~(bswapmask)); |
113 | } | 114 | } |
114 | return mask; | 115 | return mask; |
115 | } | 116 | } |
116 | 117 | ||
117 | static inline unsigned long fb_shifted_pixels_mask_long(u32 index, u32 bswapmask) | 118 | static inline unsigned long fb_shifted_pixels_mask_long(struct fb_info *p, |
119 | u32 index, | ||
120 | u32 bswapmask) | ||
118 | { | 121 | { |
119 | unsigned long mask; | 122 | unsigned long mask; |
120 | 123 | ||
121 | if (!bswapmask) { | 124 | if (!bswapmask) { |
122 | mask = FB_SHIFT_HIGH(~0UL, index); | 125 | mask = FB_SHIFT_HIGH(p, ~0UL, index); |
123 | } else { | 126 | } else { |
124 | mask = 0xff << FB_LEFT_POS(8); | 127 | mask = 0xff << FB_LEFT_POS(p, 8); |
125 | mask = FB_SHIFT_LOW(mask, index & (bswapmask)) & mask; | 128 | mask = FB_SHIFT_LOW(p, mask, index & (bswapmask)) & mask; |
126 | mask = FB_SHIFT_HIGH(mask, index & ~(bswapmask)); | 129 | mask = FB_SHIFT_HIGH(p, mask, index & ~(bswapmask)); |
127 | #if defined(__i386__) || defined(__x86_64__) | 130 | #if defined(__i386__) || defined(__x86_64__) |
128 | /* Shift argument is limited to 0 - 31 on x86 based CPU's */ | 131 | /* Shift argument is limited to 0 - 31 on x86 based CPU's */ |
129 | if(index + bswapmask < BITS_PER_LONG) | 132 | if(index + bswapmask < BITS_PER_LONG) |
130 | #endif | 133 | #endif |
131 | mask |= FB_SHIFT_HIGH(~0UL, | 134 | mask |= FB_SHIFT_HIGH(p, ~0UL, |
132 | (index + bswapmask) & ~(bswapmask)); | 135 | (index + bswapmask) & ~(bswapmask)); |
133 | } | 136 | } |
134 | return mask; | 137 | return mask; |
@@ -158,8 +161,8 @@ static inline unsigned long fb_rev_pixels_in_long(unsigned long val, | |||
158 | return val; | 161 | return val; |
159 | } | 162 | } |
160 | 163 | ||
161 | #define fb_shifted_pixels_mask_u32(i, b) FB_SHIFT_HIGH(~(u32)0, (i)) | 164 | #define fb_shifted_pixels_mask_u32(p, i, b) FB_SHIFT_HIGH((p), ~(u32)0, (i)) |
162 | #define fb_shifted_pixels_mask_long(i, b) FB_SHIFT_HIGH(~0UL, (i)) | 165 | #define fb_shifted_pixels_mask_long(p, i, b) FB_SHIFT_HIGH((p), ~0UL, (i)) |
163 | #define fb_compute_bswapmask(...) 0 | 166 | #define fb_compute_bswapmask(...) 0 |
164 | 167 | ||
165 | #endif /* CONFIG_FB_CFB_REV_PIXELS_IN_BYTE */ | 168 | #endif /* CONFIG_FB_CFB_REV_PIXELS_IN_BYTE */ |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 01072f4b3e8f..776f7fcd2fbf 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/linux_logo.h> | 27 | #include <linux/linux_logo.h> |
28 | #include <linux/proc_fs.h> | 28 | #include <linux/proc_fs.h> |
29 | #include <linux/seq_file.h> | ||
29 | #include <linux/console.h> | 30 | #include <linux/console.h> |
30 | #ifdef CONFIG_KMOD | 31 | #ifdef CONFIG_KMOD |
31 | #include <linux/kmod.h> | 32 | #include <linux/kmod.h> |
@@ -632,27 +633,51 @@ int fb_prepare_logo(struct fb_info *info, int rotate) { return 0; } | |||
632 | int fb_show_logo(struct fb_info *info, int rotate) { return 0; } | 633 | int fb_show_logo(struct fb_info *info, int rotate) { return 0; } |
633 | #endif /* CONFIG_LOGO */ | 634 | #endif /* CONFIG_LOGO */ |
634 | 635 | ||
635 | static int fbmem_read_proc(char *buf, char **start, off_t offset, | 636 | static void *fb_seq_start(struct seq_file *m, loff_t *pos) |
636 | int len, int *eof, void *private) | ||
637 | { | 637 | { |
638 | struct fb_info **fi; | 638 | return (*pos < FB_MAX) ? pos : NULL; |
639 | int clen; | 639 | } |
640 | 640 | ||
641 | clen = 0; | 641 | static void *fb_seq_next(struct seq_file *m, void *v, loff_t *pos) |
642 | for (fi = registered_fb; fi < ®istered_fb[FB_MAX] && clen < 4000; | 642 | { |
643 | fi++) | 643 | (*pos)++; |
644 | if (*fi) | 644 | return (*pos < FB_MAX) ? pos : NULL; |
645 | clen += sprintf(buf + clen, "%d %s\n", | 645 | } |
646 | (*fi)->node, | 646 | |
647 | (*fi)->fix.id); | 647 | static void fb_seq_stop(struct seq_file *m, void *v) |
648 | *start = buf + offset; | 648 | { |
649 | if (clen > offset) | 649 | } |
650 | clen -= offset; | 650 | |
651 | else | 651 | static int fb_seq_show(struct seq_file *m, void *v) |
652 | clen = 0; | 652 | { |
653 | return clen < len ? clen : len; | 653 | int i = *(loff_t *)v; |
654 | struct fb_info *fi = registered_fb[i]; | ||
655 | |||
656 | if (fi) | ||
657 | seq_printf(m, "%d %s\n", fi->node, fi->fix.id); | ||
658 | return 0; | ||
659 | } | ||
660 | |||
661 | static const struct seq_operations proc_fb_seq_ops = { | ||
662 | .start = fb_seq_start, | ||
663 | .next = fb_seq_next, | ||
664 | .stop = fb_seq_stop, | ||
665 | .show = fb_seq_show, | ||
666 | }; | ||
667 | |||
668 | static int proc_fb_open(struct inode *inode, struct file *file) | ||
669 | { | ||
670 | return seq_open(file, &proc_fb_seq_ops); | ||
654 | } | 671 | } |
655 | 672 | ||
673 | static const struct file_operations fb_proc_fops = { | ||
674 | .owner = THIS_MODULE, | ||
675 | .open = proc_fb_open, | ||
676 | .read = seq_read, | ||
677 | .llseek = seq_lseek, | ||
678 | .release = seq_release, | ||
679 | }; | ||
680 | |||
656 | static ssize_t | 681 | static ssize_t |
657 | fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 682 | fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) |
658 | { | 683 | { |
@@ -1057,7 +1082,7 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
1057 | case FBIOPUT_CON2FBMAP: | 1082 | case FBIOPUT_CON2FBMAP: |
1058 | if (copy_from_user(&con2fb, argp, sizeof(con2fb))) | 1083 | if (copy_from_user(&con2fb, argp, sizeof(con2fb))) |
1059 | return - EFAULT; | 1084 | return - EFAULT; |
1060 | if (con2fb.console < 0 || con2fb.console > MAX_NR_CONSOLES) | 1085 | if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) |
1061 | return -EINVAL; | 1086 | return -EINVAL; |
1062 | if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX) | 1087 | if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX) |
1063 | return -EINVAL; | 1088 | return -EINVAL; |
@@ -1352,6 +1377,32 @@ static const struct file_operations fb_fops = { | |||
1352 | 1377 | ||
1353 | struct class *fb_class; | 1378 | struct class *fb_class; |
1354 | EXPORT_SYMBOL(fb_class); | 1379 | EXPORT_SYMBOL(fb_class); |
1380 | |||
1381 | static int fb_check_foreignness(struct fb_info *fi) | ||
1382 | { | ||
1383 | const bool foreign_endian = fi->flags & FBINFO_FOREIGN_ENDIAN; | ||
1384 | |||
1385 | fi->flags &= ~FBINFO_FOREIGN_ENDIAN; | ||
1386 | |||
1387 | #ifdef __BIG_ENDIAN | ||
1388 | fi->flags |= foreign_endian ? 0 : FBINFO_BE_MATH; | ||
1389 | #else | ||
1390 | fi->flags |= foreign_endian ? FBINFO_BE_MATH : 0; | ||
1391 | #endif /* __BIG_ENDIAN */ | ||
1392 | |||
1393 | if (fi->flags & FBINFO_BE_MATH && !fb_be_math(fi)) { | ||
1394 | pr_err("%s: enable CONFIG_FB_BIG_ENDIAN to " | ||
1395 | "support this framebuffer\n", fi->fix.id); | ||
1396 | return -ENOSYS; | ||
1397 | } else if (!(fi->flags & FBINFO_BE_MATH) && fb_be_math(fi)) { | ||
1398 | pr_err("%s: enable CONFIG_FB_LITTLE_ENDIAN to " | ||
1399 | "support this framebuffer\n", fi->fix.id); | ||
1400 | return -ENOSYS; | ||
1401 | } | ||
1402 | |||
1403 | return 0; | ||
1404 | } | ||
1405 | |||
1355 | /** | 1406 | /** |
1356 | * register_framebuffer - registers a frame buffer device | 1407 | * register_framebuffer - registers a frame buffer device |
1357 | * @fb_info: frame buffer info structure | 1408 | * @fb_info: frame buffer info structure |
@@ -1371,6 +1422,10 @@ register_framebuffer(struct fb_info *fb_info) | |||
1371 | 1422 | ||
1372 | if (num_registered_fb == FB_MAX) | 1423 | if (num_registered_fb == FB_MAX) |
1373 | return -ENXIO; | 1424 | return -ENXIO; |
1425 | |||
1426 | if (fb_check_foreignness(fb_info)) | ||
1427 | return -ENOSYS; | ||
1428 | |||
1374 | num_registered_fb++; | 1429 | num_registered_fb++; |
1375 | for (i = 0 ; i < FB_MAX; i++) | 1430 | for (i = 0 ; i < FB_MAX; i++) |
1376 | if (!registered_fb[i]) | 1431 | if (!registered_fb[i]) |
@@ -1503,7 +1558,7 @@ void fb_set_suspend(struct fb_info *info, int state) | |||
1503 | static int __init | 1558 | static int __init |
1504 | fbmem_init(void) | 1559 | fbmem_init(void) |
1505 | { | 1560 | { |
1506 | create_proc_read_entry("fb", 0, NULL, fbmem_read_proc, NULL); | 1561 | proc_create("fb", 0, NULL, &fb_proc_fops); |
1507 | 1562 | ||
1508 | if (register_chrdev(FB_MAJOR,"fb",&fb_fops)) | 1563 | if (register_chrdev(FB_MAJOR,"fb",&fb_fops)) |
1509 | printk("unable to get major %d for fb devs\n", FB_MAJOR); | 1564 | printk("unable to get major %d for fb devs\n", FB_MAJOR); |
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c index d7e24889650e..93dca3e2aa50 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/ffb.c | |||
@@ -32,7 +32,6 @@ | |||
32 | static int ffb_setcolreg(unsigned, unsigned, unsigned, unsigned, | 32 | static int ffb_setcolreg(unsigned, unsigned, unsigned, unsigned, |
33 | unsigned, struct fb_info *); | 33 | unsigned, struct fb_info *); |
34 | static int ffb_blank(int, struct fb_info *); | 34 | static int ffb_blank(int, struct fb_info *); |
35 | static void ffb_init_fix(struct fb_info *); | ||
36 | 35 | ||
37 | static void ffb_imageblit(struct fb_info *, const struct fb_image *); | 36 | static void ffb_imageblit(struct fb_info *, const struct fb_image *); |
38 | static void ffb_fillrect(struct fb_info *, const struct fb_fillrect *); | 37 | static void ffb_fillrect(struct fb_info *, const struct fb_fillrect *); |
@@ -1001,7 +1000,7 @@ static int __devinit ffb_probe(struct of_device *op, | |||
1001 | 1000 | ||
1002 | dev_set_drvdata(&op->dev, info); | 1001 | dev_set_drvdata(&op->dev, info); |
1003 | 1002 | ||
1004 | printk("%s: %s at %016lx, type %d, " | 1003 | printk(KERN_INFO "%s: %s at %016lx, type %d, " |
1005 | "DAC pnum[%x] rev[%d] manuf_rev[%d]\n", | 1004 | "DAC pnum[%x] rev[%d] manuf_rev[%d]\n", |
1006 | dp->full_name, | 1005 | dp->full_name, |
1007 | ((par->flags & FFB_FLAG_AFB) ? "AFB" : "FFB"), | 1006 | ((par->flags & FFB_FLAG_AFB) ? "AFB" : "FFB"), |
@@ -1062,7 +1061,7 @@ static struct of_platform_driver ffb_driver = { | |||
1062 | .remove = __devexit_p(ffb_remove), | 1061 | .remove = __devexit_p(ffb_remove), |
1063 | }; | 1062 | }; |
1064 | 1063 | ||
1065 | int __init ffb_init(void) | 1064 | static int __init ffb_init(void) |
1066 | { | 1065 | { |
1067 | if (fb_get_options("ffb", NULL)) | 1066 | if (fb_get_options("ffb", NULL)) |
1068 | return -ENODEV; | 1067 | return -ENODEV; |
@@ -1070,7 +1069,7 @@ int __init ffb_init(void) | |||
1070 | return of_register_driver(&ffb_driver, &of_bus_type); | 1069 | return of_register_driver(&ffb_driver, &of_bus_type); |
1071 | } | 1070 | } |
1072 | 1071 | ||
1073 | void __exit ffb_exit(void) | 1072 | static void __exit ffb_exit(void) |
1074 | { | 1073 | { |
1075 | of_unregister_driver(&ffb_driver); | 1074 | of_unregister_driver(&ffb_driver); |
1076 | } | 1075 | } |
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c new file mode 100644 index 000000000000..b50bb03cb5ab --- /dev/null +++ b/drivers/video/fsl-diu-fb.c | |||
@@ -0,0 +1,1721 @@ | |||
1 | /* | ||
2 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * | ||
4 | * Freescale DIU Frame Buffer device driver | ||
5 | * | ||
6 | * Authors: Hongjun Chen <hong-jun.chen@freescale.com> | ||
7 | * Paul Widmer <paul.widmer@freescale.com> | ||
8 | * Srikanth Srinivasan <srikanth.srinivasan@freescale.com> | ||
9 | * York Sun <yorksun@freescale.com> | ||
10 | * | ||
11 | * Based on imxfb.c Copyright (C) 2004 S.Hauer, Pengutronix | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #include <linux/module.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/string.h> | ||
24 | #include <linux/slab.h> | ||
25 | #include <linux/fb.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/dma-mapping.h> | ||
28 | #include <linux/platform_device.h> | ||
29 | #include <linux/interrupt.h> | ||
30 | #include <linux/clk.h> | ||
31 | #include <linux/uaccess.h> | ||
32 | #include <linux/vmalloc.h> | ||
33 | |||
34 | #include <linux/of_platform.h> | ||
35 | |||
36 | #include <sysdev/fsl_soc.h> | ||
37 | #include "fsl-diu-fb.h" | ||
38 | |||
39 | /* | ||
40 | * These parameters give default parameters | ||
41 | * for video output 1024x768, | ||
42 | * FIXME - change timing to proper amounts | ||
43 | * hsync 31.5kHz, vsync 60Hz | ||
44 | */ | ||
45 | static struct fb_videomode __devinitdata fsl_diu_default_mode = { | ||
46 | .refresh = 60, | ||
47 | .xres = 1024, | ||
48 | .yres = 768, | ||
49 | .pixclock = 15385, | ||
50 | .left_margin = 160, | ||
51 | .right_margin = 24, | ||
52 | .upper_margin = 29, | ||
53 | .lower_margin = 3, | ||
54 | .hsync_len = 136, | ||
55 | .vsync_len = 6, | ||
56 | .sync = FB_SYNC_COMP_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
57 | .vmode = FB_VMODE_NONINTERLACED | ||
58 | }; | ||
59 | |||
60 | static struct fb_videomode __devinitdata fsl_diu_mode_db[] = { | ||
61 | { | ||
62 | .name = "1024x768-60", | ||
63 | .refresh = 60, | ||
64 | .xres = 1024, | ||
65 | .yres = 768, | ||
66 | .pixclock = 15385, | ||
67 | .left_margin = 160, | ||
68 | .right_margin = 24, | ||
69 | .upper_margin = 29, | ||
70 | .lower_margin = 3, | ||
71 | .hsync_len = 136, | ||
72 | .vsync_len = 6, | ||
73 | .sync = FB_SYNC_COMP_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
74 | .vmode = FB_VMODE_NONINTERLACED | ||
75 | }, | ||
76 | { | ||
77 | .name = "1024x768-70", | ||
78 | .refresh = 70, | ||
79 | .xres = 1024, | ||
80 | .yres = 768, | ||
81 | .pixclock = 16886, | ||
82 | .left_margin = 3, | ||
83 | .right_margin = 3, | ||
84 | .upper_margin = 2, | ||
85 | .lower_margin = 2, | ||
86 | .hsync_len = 40, | ||
87 | .vsync_len = 18, | ||
88 | .sync = FB_SYNC_COMP_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
89 | .vmode = FB_VMODE_NONINTERLACED | ||
90 | }, | ||
91 | { | ||
92 | .name = "1024x768-75", | ||
93 | .refresh = 75, | ||
94 | .xres = 1024, | ||
95 | .yres = 768, | ||
96 | .pixclock = 15009, | ||
97 | .left_margin = 3, | ||
98 | .right_margin = 3, | ||
99 | .upper_margin = 2, | ||
100 | .lower_margin = 2, | ||
101 | .hsync_len = 80, | ||
102 | .vsync_len = 32, | ||
103 | .sync = FB_SYNC_COMP_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
104 | .vmode = FB_VMODE_NONINTERLACED | ||
105 | }, | ||
106 | { | ||
107 | .name = "1280x1024-60", | ||
108 | .refresh = 60, | ||
109 | .xres = 1280, | ||
110 | .yres = 1024, | ||
111 | .pixclock = 9375, | ||
112 | .left_margin = 38, | ||
113 | .right_margin = 128, | ||
114 | .upper_margin = 2, | ||
115 | .lower_margin = 7, | ||
116 | .hsync_len = 216, | ||
117 | .vsync_len = 37, | ||
118 | .sync = FB_SYNC_COMP_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
119 | .vmode = FB_VMODE_NONINTERLACED | ||
120 | }, | ||
121 | { | ||
122 | .name = "1280x1024-70", | ||
123 | .refresh = 70, | ||
124 | .xres = 1280, | ||
125 | .yres = 1024, | ||
126 | .pixclock = 9380, | ||
127 | .left_margin = 6, | ||
128 | .right_margin = 6, | ||
129 | .upper_margin = 4, | ||
130 | .lower_margin = 4, | ||
131 | .hsync_len = 60, | ||
132 | .vsync_len = 94, | ||
133 | .sync = FB_SYNC_COMP_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
134 | .vmode = FB_VMODE_NONINTERLACED | ||
135 | }, | ||
136 | { | ||
137 | .name = "1280x1024-75", | ||
138 | .refresh = 75, | ||
139 | .xres = 1280, | ||
140 | .yres = 1024, | ||
141 | .pixclock = 9380, | ||
142 | .left_margin = 6, | ||
143 | .right_margin = 6, | ||
144 | .upper_margin = 4, | ||
145 | .lower_margin = 4, | ||
146 | .hsync_len = 60, | ||
147 | .vsync_len = 15, | ||
148 | .sync = FB_SYNC_COMP_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
149 | .vmode = FB_VMODE_NONINTERLACED | ||
150 | }, | ||
151 | { | ||
152 | .name = "320x240", /* for AOI only */ | ||
153 | .refresh = 60, | ||
154 | .xres = 320, | ||
155 | .yres = 240, | ||
156 | .pixclock = 15385, | ||
157 | .left_margin = 0, | ||
158 | .right_margin = 0, | ||
159 | .upper_margin = 0, | ||
160 | .lower_margin = 0, | ||
161 | .hsync_len = 0, | ||
162 | .vsync_len = 0, | ||
163 | .sync = FB_SYNC_COMP_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
164 | .vmode = FB_VMODE_NONINTERLACED | ||
165 | }, | ||
166 | { | ||
167 | .name = "1280x480-60", | ||
168 | .refresh = 60, | ||
169 | .xres = 1280, | ||
170 | .yres = 480, | ||
171 | .pixclock = 18939, | ||
172 | .left_margin = 353, | ||
173 | .right_margin = 47, | ||
174 | .upper_margin = 39, | ||
175 | .lower_margin = 4, | ||
176 | .hsync_len = 8, | ||
177 | .vsync_len = 2, | ||
178 | .sync = FB_SYNC_COMP_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
179 | .vmode = FB_VMODE_NONINTERLACED | ||
180 | }, | ||
181 | }; | ||
182 | |||
183 | static char *fb_mode = "1024x768-32@60"; | ||
184 | static unsigned long default_bpp = 32; | ||
185 | static int monitor_port; | ||
186 | |||
187 | #if defined(CONFIG_NOT_COHERENT_CACHE) | ||
188 | static u8 *coherence_data; | ||
189 | static size_t coherence_data_size; | ||
190 | static unsigned int d_cache_line_size; | ||
191 | #endif | ||
192 | |||
193 | static DEFINE_SPINLOCK(diu_lock); | ||
194 | |||
195 | struct fsl_diu_data { | ||
196 | struct fb_info *fsl_diu_info[FSL_AOI_NUM - 1]; | ||
197 | /*FSL_AOI_NUM has one dummy AOI */ | ||
198 | struct device_attribute dev_attr; | ||
199 | struct diu_ad *dummy_ad; | ||
200 | void *dummy_aoi_virt; | ||
201 | unsigned int irq; | ||
202 | int fb_enabled; | ||
203 | int monitor_port; | ||
204 | }; | ||
205 | |||
206 | struct mfb_info { | ||
207 | int index; | ||
208 | int type; | ||
209 | char *id; | ||
210 | int registered; | ||
211 | int blank; | ||
212 | unsigned long pseudo_palette[16]; | ||
213 | struct diu_ad *ad; | ||
214 | int cursor_reset; | ||
215 | unsigned char g_alpha; | ||
216 | unsigned int count; | ||
217 | int x_aoi_d; /* aoi display x offset to physical screen */ | ||
218 | int y_aoi_d; /* aoi display y offset to physical screen */ | ||
219 | struct fsl_diu_data *parent; | ||
220 | }; | ||
221 | |||
222 | |||
223 | static struct mfb_info mfb_template[] = { | ||
224 | { /* AOI 0 for plane 0 */ | ||
225 | .index = 0, | ||
226 | .type = MFB_TYPE_OUTPUT, | ||
227 | .id = "Panel0", | ||
228 | .registered = 0, | ||
229 | .count = 0, | ||
230 | .x_aoi_d = 0, | ||
231 | .y_aoi_d = 0, | ||
232 | }, | ||
233 | { /* AOI 0 for plane 1 */ | ||
234 | .index = 1, | ||
235 | .type = MFB_TYPE_OUTPUT, | ||
236 | .id = "Panel1 AOI0", | ||
237 | .registered = 0, | ||
238 | .g_alpha = 0xff, | ||
239 | .count = 0, | ||
240 | .x_aoi_d = 0, | ||
241 | .y_aoi_d = 0, | ||
242 | }, | ||
243 | { /* AOI 1 for plane 1 */ | ||
244 | .index = 2, | ||
245 | .type = MFB_TYPE_OUTPUT, | ||
246 | .id = "Panel1 AOI1", | ||
247 | .registered = 0, | ||
248 | .g_alpha = 0xff, | ||
249 | .count = 0, | ||
250 | .x_aoi_d = 0, | ||
251 | .y_aoi_d = 480, | ||
252 | }, | ||
253 | { /* AOI 0 for plane 2 */ | ||
254 | .index = 3, | ||
255 | .type = MFB_TYPE_OUTPUT, | ||
256 | .id = "Panel2 AOI0", | ||
257 | .registered = 0, | ||
258 | .g_alpha = 0xff, | ||
259 | .count = 0, | ||
260 | .x_aoi_d = 640, | ||
261 | .y_aoi_d = 0, | ||
262 | }, | ||
263 | { /* AOI 1 for plane 2 */ | ||
264 | .index = 4, | ||
265 | .type = MFB_TYPE_OUTPUT, | ||
266 | .id = "Panel2 AOI1", | ||
267 | .registered = 0, | ||
268 | .g_alpha = 0xff, | ||
269 | .count = 0, | ||
270 | .x_aoi_d = 640, | ||
271 | .y_aoi_d = 480, | ||
272 | }, | ||
273 | }; | ||
274 | |||
275 | static struct diu_hw dr = { | ||
276 | .mode = MFB_MODE1, | ||
277 | .reg_lock = __SPIN_LOCK_UNLOCKED(diu_hw.reg_lock), | ||
278 | }; | ||
279 | |||
280 | static struct diu_pool pool; | ||
281 | |||
282 | /* To allocate memory for framebuffer. First try __get_free_pages(). If it | ||
283 | * fails, try rh_alloc. The reason is __get_free_pages() cannot allocate | ||
284 | * very large memory (more than 4MB). We don't want to allocate all memory | ||
285 | * in rheap since small memory allocation/deallocation will fragment the | ||
286 | * rheap and make the furture large allocation fail. | ||
287 | */ | ||
288 | |||
289 | void *fsl_diu_alloc(unsigned long size, phys_addr_t *phys) | ||
290 | { | ||
291 | void *virt; | ||
292 | |||
293 | pr_debug("size=%lu\n", size); | ||
294 | |||
295 | virt = (void *)__get_free_pages(GFP_DMA | __GFP_ZERO, get_order(size)); | ||
296 | if (virt) { | ||
297 | *phys = virt_to_phys(virt); | ||
298 | pr_debug("virt %p, phys=%llx\n", virt, (uint64_t) *phys); | ||
299 | return virt; | ||
300 | } | ||
301 | if (!diu_ops.diu_mem) { | ||
302 | printk(KERN_INFO "%s: no diu_mem." | ||
303 | " To reserve more memory, put 'diufb=15M' " | ||
304 | "in the command line\n", __func__); | ||
305 | return NULL; | ||
306 | } | ||
307 | |||
308 | virt = (void *)rh_alloc(&diu_ops.diu_rh_info, size, "DIU"); | ||
309 | if (virt) { | ||
310 | *phys = virt_to_bus(virt); | ||
311 | memset(virt, 0, size); | ||
312 | } | ||
313 | |||
314 | pr_debug("rh virt=%p phys=%lx\n", virt, *phys); | ||
315 | |||
316 | return virt; | ||
317 | } | ||
318 | |||
319 | void fsl_diu_free(void *p, unsigned long size) | ||
320 | { | ||
321 | pr_debug("p=%p size=%lu\n", p, size); | ||
322 | |||
323 | if (!p) | ||
324 | return; | ||
325 | |||
326 | if ((p >= diu_ops.diu_mem) && | ||
327 | (p < (diu_ops.diu_mem + diu_ops.diu_size))) { | ||
328 | pr_debug("rh\n"); | ||
329 | rh_free(&diu_ops.diu_rh_info, (unsigned long) p); | ||
330 | } else { | ||
331 | pr_debug("dma\n"); | ||
332 | free_pages((unsigned long)p, get_order(size)); | ||
333 | } | ||
334 | } | ||
335 | |||
336 | static int fsl_diu_enable_panel(struct fb_info *info) | ||
337 | { | ||
338 | struct mfb_info *pmfbi, *cmfbi, *mfbi = info->par; | ||
339 | struct diu *hw = dr.diu_reg; | ||
340 | struct diu_ad *ad = mfbi->ad; | ||
341 | struct fsl_diu_data *machine_data = mfbi->parent; | ||
342 | int res = 0; | ||
343 | |||
344 | pr_debug("enable_panel index %d\n", mfbi->index); | ||
345 | if (mfbi->type != MFB_TYPE_OFF) { | ||
346 | switch (mfbi->index) { | ||
347 | case 0: /* plane 0 */ | ||
348 | if (hw->desc[0] != ad->paddr) | ||
349 | out_be32(&hw->desc[0], ad->paddr); | ||
350 | break; | ||
351 | case 1: /* plane 1 AOI 0 */ | ||
352 | cmfbi = machine_data->fsl_diu_info[2]->par; | ||
353 | if (hw->desc[1] != ad->paddr) { /* AOI0 closed */ | ||
354 | if (cmfbi->count > 0) /* AOI1 open */ | ||
355 | ad->next_ad = | ||
356 | cpu_to_le32(cmfbi->ad->paddr); | ||
357 | else | ||
358 | ad->next_ad = 0; | ||
359 | out_be32(&hw->desc[1], ad->paddr); | ||
360 | } | ||
361 | break; | ||
362 | case 3: /* plane 2 AOI 0 */ | ||
363 | cmfbi = machine_data->fsl_diu_info[4]->par; | ||
364 | if (hw->desc[2] != ad->paddr) { /* AOI0 closed */ | ||
365 | if (cmfbi->count > 0) /* AOI1 open */ | ||
366 | ad->next_ad = | ||
367 | cpu_to_le32(cmfbi->ad->paddr); | ||
368 | else | ||
369 | ad->next_ad = 0; | ||
370 | out_be32(&hw->desc[2], ad->paddr); | ||
371 | } | ||
372 | break; | ||
373 | case 2: /* plane 1 AOI 1 */ | ||
374 | pmfbi = machine_data->fsl_diu_info[1]->par; | ||
375 | ad->next_ad = 0; | ||
376 | if (hw->desc[1] == machine_data->dummy_ad->paddr) | ||
377 | out_be32(&hw->desc[1], ad->paddr); | ||
378 | else /* AOI0 open */ | ||
379 | pmfbi->ad->next_ad = cpu_to_le32(ad->paddr); | ||
380 | break; | ||
381 | case 4: /* plane 2 AOI 1 */ | ||
382 | pmfbi = machine_data->fsl_diu_info[3]->par; | ||
383 | ad->next_ad = 0; | ||
384 | if (hw->desc[2] == machine_data->dummy_ad->paddr) | ||
385 | out_be32(&hw->desc[2], ad->paddr); | ||
386 | else /* AOI0 was open */ | ||
387 | pmfbi->ad->next_ad = cpu_to_le32(ad->paddr); | ||
388 | break; | ||
389 | default: | ||
390 | res = -EINVAL; | ||
391 | break; | ||
392 | } | ||
393 | } else | ||
394 | res = -EINVAL; | ||
395 | return res; | ||
396 | } | ||
397 | |||
398 | static int fsl_diu_disable_panel(struct fb_info *info) | ||
399 | { | ||
400 | struct mfb_info *pmfbi, *cmfbi, *mfbi = info->par; | ||
401 | struct diu *hw = dr.diu_reg; | ||
402 | struct diu_ad *ad = mfbi->ad; | ||
403 | struct fsl_diu_data *machine_data = mfbi->parent; | ||
404 | int res = 0; | ||
405 | |||
406 | switch (mfbi->index) { | ||
407 | case 0: /* plane 0 */ | ||
408 | if (hw->desc[0] != machine_data->dummy_ad->paddr) | ||
409 | out_be32(&hw->desc[0], | ||
410 | machine_data->dummy_ad->paddr); | ||
411 | break; | ||
412 | case 1: /* plane 1 AOI 0 */ | ||
413 | cmfbi = machine_data->fsl_diu_info[2]->par; | ||
414 | if (cmfbi->count > 0) /* AOI1 is open */ | ||
415 | out_be32(&hw->desc[1], cmfbi->ad->paddr); | ||
416 | /* move AOI1 to the first */ | ||
417 | else /* AOI1 was closed */ | ||
418 | out_be32(&hw->desc[1], | ||
419 | machine_data->dummy_ad->paddr); | ||
420 | /* close AOI 0 */ | ||
421 | break; | ||
422 | case 3: /* plane 2 AOI 0 */ | ||
423 | cmfbi = machine_data->fsl_diu_info[4]->par; | ||
424 | if (cmfbi->count > 0) /* AOI1 is open */ | ||
425 | out_be32(&hw->desc[2], cmfbi->ad->paddr); | ||
426 | /* move AOI1 to the first */ | ||
427 | else /* AOI1 was closed */ | ||
428 | out_be32(&hw->desc[2], | ||
429 | machine_data->dummy_ad->paddr); | ||
430 | /* close AOI 0 */ | ||
431 | break; | ||
432 | case 2: /* plane 1 AOI 1 */ | ||
433 | pmfbi = machine_data->fsl_diu_info[1]->par; | ||
434 | if (hw->desc[1] != ad->paddr) { | ||
435 | /* AOI1 is not the first in the chain */ | ||
436 | if (pmfbi->count > 0) | ||
437 | /* AOI0 is open, must be the first */ | ||
438 | pmfbi->ad->next_ad = 0; | ||
439 | } else /* AOI1 is the first in the chain */ | ||
440 | out_be32(&hw->desc[1], machine_data->dummy_ad->paddr); | ||
441 | /* close AOI 1 */ | ||
442 | break; | ||
443 | case 4: /* plane 2 AOI 1 */ | ||
444 | pmfbi = machine_data->fsl_diu_info[3]->par; | ||
445 | if (hw->desc[2] != ad->paddr) { | ||
446 | /* AOI1 is not the first in the chain */ | ||
447 | if (pmfbi->count > 0) | ||
448 | /* AOI0 is open, must be the first */ | ||
449 | pmfbi->ad->next_ad = 0; | ||
450 | } else /* AOI1 is the first in the chain */ | ||
451 | out_be32(&hw->desc[2], machine_data->dummy_ad->paddr); | ||
452 | /* close AOI 1 */ | ||
453 | break; | ||
454 | default: | ||
455 | res = -EINVAL; | ||
456 | break; | ||
457 | } | ||
458 | |||
459 | return res; | ||
460 | } | ||
461 | |||
462 | static void enable_lcdc(struct fb_info *info) | ||
463 | { | ||
464 | struct diu *hw = dr.diu_reg; | ||
465 | struct mfb_info *mfbi = info->par; | ||
466 | struct fsl_diu_data *machine_data = mfbi->parent; | ||
467 | |||
468 | if (!machine_data->fb_enabled) { | ||
469 | out_be32(&hw->diu_mode, dr.mode); | ||
470 | machine_data->fb_enabled++; | ||
471 | } | ||
472 | } | ||
473 | |||
474 | static void disable_lcdc(struct fb_info *info) | ||
475 | { | ||
476 | struct diu *hw = dr.diu_reg; | ||
477 | struct mfb_info *mfbi = info->par; | ||
478 | struct fsl_diu_data *machine_data = mfbi->parent; | ||
479 | |||
480 | if (machine_data->fb_enabled) { | ||
481 | out_be32(&hw->diu_mode, 0); | ||
482 | machine_data->fb_enabled = 0; | ||
483 | } | ||
484 | } | ||
485 | |||
486 | static void adjust_aoi_size_position(struct fb_var_screeninfo *var, | ||
487 | struct fb_info *info) | ||
488 | { | ||
489 | struct mfb_info *lower_aoi_mfbi, *upper_aoi_mfbi, *mfbi = info->par; | ||
490 | struct fsl_diu_data *machine_data = mfbi->parent; | ||
491 | int available_height, upper_aoi_bottom, index = mfbi->index; | ||
492 | int lower_aoi_is_open, upper_aoi_is_open; | ||
493 | __u32 base_plane_width, base_plane_height, upper_aoi_height; | ||
494 | |||
495 | base_plane_width = machine_data->fsl_diu_info[0]->var.xres; | ||
496 | base_plane_height = machine_data->fsl_diu_info[0]->var.yres; | ||
497 | |||
498 | switch (index) { | ||
499 | case 0: | ||
500 | if (mfbi->x_aoi_d != 0) | ||
501 | mfbi->x_aoi_d = 0; | ||
502 | if (mfbi->y_aoi_d != 0) | ||
503 | mfbi->y_aoi_d = 0; | ||
504 | break; | ||
505 | case 1: /* AOI 0 */ | ||
506 | case 3: | ||
507 | lower_aoi_mfbi = machine_data->fsl_diu_info[index+1]->par; | ||
508 | lower_aoi_is_open = lower_aoi_mfbi->count > 0 ? 1 : 0; | ||
509 | if (var->xres > base_plane_width) | ||
510 | var->xres = base_plane_width; | ||
511 | if ((mfbi->x_aoi_d + var->xres) > base_plane_width) | ||
512 | mfbi->x_aoi_d = base_plane_width - var->xres; | ||
513 | |||
514 | if (lower_aoi_is_open) | ||
515 | available_height = lower_aoi_mfbi->y_aoi_d; | ||
516 | else | ||
517 | available_height = base_plane_height; | ||
518 | if (var->yres > available_height) | ||
519 | var->yres = available_height; | ||
520 | if ((mfbi->y_aoi_d + var->yres) > available_height) | ||
521 | mfbi->y_aoi_d = available_height - var->yres; | ||
522 | break; | ||
523 | case 2: /* AOI 1 */ | ||
524 | case 4: | ||
525 | upper_aoi_mfbi = machine_data->fsl_diu_info[index-1]->par; | ||
526 | upper_aoi_height = | ||
527 | machine_data->fsl_diu_info[index-1]->var.yres; | ||
528 | upper_aoi_bottom = upper_aoi_mfbi->y_aoi_d + upper_aoi_height; | ||
529 | upper_aoi_is_open = upper_aoi_mfbi->count > 0 ? 1 : 0; | ||
530 | if (var->xres > base_plane_width) | ||
531 | var->xres = base_plane_width; | ||
532 | if ((mfbi->x_aoi_d + var->xres) > base_plane_width) | ||
533 | mfbi->x_aoi_d = base_plane_width - var->xres; | ||
534 | if (mfbi->y_aoi_d < 0) | ||
535 | mfbi->y_aoi_d = 0; | ||
536 | if (upper_aoi_is_open) { | ||
537 | if (mfbi->y_aoi_d < upper_aoi_bottom) | ||
538 | mfbi->y_aoi_d = upper_aoi_bottom; | ||
539 | available_height = base_plane_height | ||
540 | - upper_aoi_bottom; | ||
541 | } else | ||
542 | available_height = base_plane_height; | ||
543 | if (var->yres > available_height) | ||
544 | var->yres = available_height; | ||
545 | if ((mfbi->y_aoi_d + var->yres) > base_plane_height) | ||
546 | mfbi->y_aoi_d = base_plane_height - var->yres; | ||
547 | break; | ||
548 | } | ||
549 | } | ||
550 | /* | ||
551 | * Checks to see if the hardware supports the state requested by var passed | ||
552 | * in. This function does not alter the hardware state! If the var passed in | ||
553 | * is slightly off by what the hardware can support then we alter the var | ||
554 | * PASSED in to what we can do. If the hardware doesn't support mode change | ||
555 | * a -EINVAL will be returned by the upper layers. | ||
556 | */ | ||
557 | static int fsl_diu_check_var(struct fb_var_screeninfo *var, | ||
558 | struct fb_info *info) | ||
559 | { | ||
560 | unsigned long htotal, vtotal; | ||
561 | |||
562 | pr_debug("check_var xres: %d\n", var->xres); | ||
563 | pr_debug("check_var yres: %d\n", var->yres); | ||
564 | |||
565 | if (var->xres_virtual < var->xres) | ||
566 | var->xres_virtual = var->xres; | ||
567 | if (var->yres_virtual < var->yres) | ||
568 | var->yres_virtual = var->yres; | ||
569 | |||
570 | if (var->xoffset < 0) | ||
571 | var->xoffset = 0; | ||
572 | |||
573 | if (var->yoffset < 0) | ||
574 | var->yoffset = 0; | ||
575 | |||
576 | if (var->xoffset + info->var.xres > info->var.xres_virtual) | ||
577 | var->xoffset = info->var.xres_virtual - info->var.xres; | ||
578 | |||
579 | if (var->yoffset + info->var.yres > info->var.yres_virtual) | ||
580 | var->yoffset = info->var.yres_virtual - info->var.yres; | ||
581 | |||
582 | if ((var->bits_per_pixel != 32) && (var->bits_per_pixel != 24) && | ||
583 | (var->bits_per_pixel != 16)) | ||
584 | var->bits_per_pixel = default_bpp; | ||
585 | |||
586 | switch (var->bits_per_pixel) { | ||
587 | case 16: | ||
588 | var->red.length = 5; | ||
589 | var->red.offset = 11; | ||
590 | var->red.msb_right = 0; | ||
591 | |||
592 | var->green.length = 6; | ||
593 | var->green.offset = 5; | ||
594 | var->green.msb_right = 0; | ||
595 | |||
596 | var->blue.length = 5; | ||
597 | var->blue.offset = 0; | ||
598 | var->blue.msb_right = 0; | ||
599 | |||
600 | var->transp.length = 0; | ||
601 | var->transp.offset = 0; | ||
602 | var->transp.msb_right = 0; | ||
603 | break; | ||
604 | case 24: | ||
605 | var->red.length = 8; | ||
606 | var->red.offset = 0; | ||
607 | var->red.msb_right = 0; | ||
608 | |||
609 | var->green.length = 8; | ||
610 | var->green.offset = 8; | ||
611 | var->green.msb_right = 0; | ||
612 | |||
613 | var->blue.length = 8; | ||
614 | var->blue.offset = 16; | ||
615 | var->blue.msb_right = 0; | ||
616 | |||
617 | var->transp.length = 0; | ||
618 | var->transp.offset = 0; | ||
619 | var->transp.msb_right = 0; | ||
620 | break; | ||
621 | case 32: | ||
622 | var->red.length = 8; | ||
623 | var->red.offset = 16; | ||
624 | var->red.msb_right = 0; | ||
625 | |||
626 | var->green.length = 8; | ||
627 | var->green.offset = 8; | ||
628 | var->green.msb_right = 0; | ||
629 | |||
630 | var->blue.length = 8; | ||
631 | var->blue.offset = 0; | ||
632 | var->blue.msb_right = 0; | ||
633 | |||
634 | var->transp.length = 8; | ||
635 | var->transp.offset = 24; | ||
636 | var->transp.msb_right = 0; | ||
637 | |||
638 | break; | ||
639 | } | ||
640 | /* If the pixclock is below the minimum spec'd value then set to | ||
641 | * refresh rate for 60Hz since this is supported by most monitors. | ||
642 | * Refer to Documentation/fb/ for calculations. | ||
643 | */ | ||
644 | if ((var->pixclock < MIN_PIX_CLK) || (var->pixclock > MAX_PIX_CLK)) { | ||
645 | htotal = var->xres + var->right_margin + var->hsync_len + | ||
646 | var->left_margin; | ||
647 | vtotal = var->yres + var->lower_margin + var->vsync_len + | ||
648 | var->upper_margin; | ||
649 | var->pixclock = (vtotal * htotal * 6UL) / 100UL; | ||
650 | var->pixclock = KHZ2PICOS(var->pixclock); | ||
651 | pr_debug("pixclock set for 60Hz refresh = %u ps\n", | ||
652 | var->pixclock); | ||
653 | } | ||
654 | |||
655 | var->height = -1; | ||
656 | var->width = -1; | ||
657 | var->grayscale = 0; | ||
658 | |||
659 | /* Copy nonstd field to/from sync for fbset usage */ | ||
660 | var->sync |= var->nonstd; | ||
661 | var->nonstd |= var->sync; | ||
662 | |||
663 | adjust_aoi_size_position(var, info); | ||
664 | return 0; | ||
665 | } | ||
666 | |||
667 | static void set_fix(struct fb_info *info) | ||
668 | { | ||
669 | struct fb_fix_screeninfo *fix = &info->fix; | ||
670 | struct fb_var_screeninfo *var = &info->var; | ||
671 | struct mfb_info *mfbi = info->par; | ||
672 | |||
673 | strncpy(fix->id, mfbi->id, strlen(mfbi->id)); | ||
674 | fix->line_length = var->xres_virtual * var->bits_per_pixel / 8; | ||
675 | fix->type = FB_TYPE_PACKED_PIXELS; | ||
676 | fix->accel = FB_ACCEL_NONE; | ||
677 | fix->visual = FB_VISUAL_TRUECOLOR; | ||
678 | fix->xpanstep = 1; | ||
679 | fix->ypanstep = 1; | ||
680 | } | ||
681 | |||
682 | static void update_lcdc(struct fb_info *info) | ||
683 | { | ||
684 | struct fb_var_screeninfo *var = &info->var; | ||
685 | struct mfb_info *mfbi = info->par; | ||
686 | struct fsl_diu_data *machine_data = mfbi->parent; | ||
687 | struct diu *hw; | ||
688 | int i, j; | ||
689 | char __iomem *cursor_base, *gamma_table_base; | ||
690 | |||
691 | u32 temp; | ||
692 | |||
693 | hw = dr.diu_reg; | ||
694 | |||
695 | if (mfbi->type == MFB_TYPE_OFF) { | ||
696 | fsl_diu_disable_panel(info); | ||
697 | return; | ||
698 | } | ||
699 | |||
700 | diu_ops.set_monitor_port(machine_data->monitor_port); | ||
701 | gamma_table_base = pool.gamma.vaddr; | ||
702 | cursor_base = pool.cursor.vaddr; | ||
703 | /* Prep for DIU init - gamma table, cursor table */ | ||
704 | |||
705 | for (i = 0; i <= 2; i++) | ||
706 | for (j = 0; j <= 255; j++) | ||
707 | *gamma_table_base++ = j; | ||
708 | |||
709 | diu_ops.set_gamma_table(machine_data->monitor_port, pool.gamma.vaddr); | ||
710 | |||
711 | pr_debug("update-lcdc: HW - %p\n Disabling DIU\n", hw); | ||
712 | disable_lcdc(info); | ||
713 | |||
714 | /* Program DIU registers */ | ||
715 | |||
716 | out_be32(&hw->gamma, pool.gamma.paddr); | ||
717 | out_be32(&hw->cursor, pool.cursor.paddr); | ||
718 | |||
719 | out_be32(&hw->bgnd, 0x007F7F7F); /* BGND */ | ||
720 | out_be32(&hw->bgnd_wb, 0); /* BGND_WB */ | ||
721 | out_be32(&hw->disp_size, (var->yres << 16 | var->xres)); | ||
722 | /* DISP SIZE */ | ||
723 | pr_debug("DIU xres: %d\n", var->xres); | ||
724 | pr_debug("DIU yres: %d\n", var->yres); | ||
725 | |||
726 | out_be32(&hw->wb_size, 0); /* WB SIZE */ | ||
727 | out_be32(&hw->wb_mem_addr, 0); /* WB MEM ADDR */ | ||
728 | |||
729 | /* Horizontal and vertical configuration register */ | ||
730 | temp = var->left_margin << 22 | /* BP_H */ | ||
731 | var->hsync_len << 11 | /* PW_H */ | ||
732 | var->right_margin; /* FP_H */ | ||
733 | |||
734 | out_be32(&hw->hsyn_para, temp); | ||
735 | |||
736 | temp = var->upper_margin << 22 | /* BP_V */ | ||
737 | var->vsync_len << 11 | /* PW_V */ | ||
738 | var->lower_margin; /* FP_V */ | ||
739 | |||
740 | out_be32(&hw->vsyn_para, temp); | ||
741 | |||
742 | pr_debug("DIU right_margin - %d\n", var->right_margin); | ||
743 | pr_debug("DIU left_margin - %d\n", var->left_margin); | ||
744 | pr_debug("DIU hsync_len - %d\n", var->hsync_len); | ||
745 | pr_debug("DIU upper_margin - %d\n", var->upper_margin); | ||
746 | pr_debug("DIU lower_margin - %d\n", var->lower_margin); | ||
747 | pr_debug("DIU vsync_len - %d\n", var->vsync_len); | ||
748 | pr_debug("DIU HSYNC - 0x%08x\n", hw->hsyn_para); | ||
749 | pr_debug("DIU VSYNC - 0x%08x\n", hw->vsyn_para); | ||
750 | |||
751 | diu_ops.set_pixel_clock(var->pixclock); | ||
752 | |||
753 | out_be32(&hw->syn_pol, 0); /* SYNC SIGNALS POLARITY */ | ||
754 | out_be32(&hw->thresholds, 0x00037800); /* The Thresholds */ | ||
755 | out_be32(&hw->int_status, 0); /* INTERRUPT STATUS */ | ||
756 | out_be32(&hw->plut, 0x01F5F666); | ||
757 | |||
758 | /* Enable the DIU */ | ||
759 | enable_lcdc(info); | ||
760 | } | ||
761 | |||
762 | static int map_video_memory(struct fb_info *info) | ||
763 | { | ||
764 | phys_addr_t phys; | ||
765 | |||
766 | pr_debug("info->var.xres_virtual = %d\n", info->var.xres_virtual); | ||
767 | pr_debug("info->var.yres_virtual = %d\n", info->var.yres_virtual); | ||
768 | pr_debug("info->fix.line_length = %d\n", info->fix.line_length); | ||
769 | |||
770 | info->fix.smem_len = info->fix.line_length * info->var.yres_virtual; | ||
771 | pr_debug("MAP_VIDEO_MEMORY: smem_len = %d\n", info->fix.smem_len); | ||
772 | info->screen_base = fsl_diu_alloc(info->fix.smem_len, &phys); | ||
773 | if (info->screen_base == 0) { | ||
774 | printk(KERN_ERR "Unable to allocate fb memory\n"); | ||
775 | return -ENOMEM; | ||
776 | } | ||
777 | info->fix.smem_start = (unsigned long) phys; | ||
778 | info->screen_size = info->fix.smem_len; | ||
779 | |||
780 | pr_debug("Allocated fb @ paddr=0x%08lx, size=%d.\n", | ||
781 | info->fix.smem_start, | ||
782 | info->fix.smem_len); | ||
783 | pr_debug("screen base %p\n", info->screen_base); | ||
784 | |||
785 | return 0; | ||
786 | } | ||
787 | |||
788 | static void unmap_video_memory(struct fb_info *info) | ||
789 | { | ||
790 | fsl_diu_free(info->screen_base, info->fix.smem_len); | ||
791 | info->screen_base = 0; | ||
792 | info->fix.smem_start = 0; | ||
793 | info->fix.smem_len = 0; | ||
794 | } | ||
795 | |||
796 | /* | ||
797 | * Using the fb_var_screeninfo in fb_info we set the resolution of this | ||
798 | * particular framebuffer. This function alters the fb_fix_screeninfo stored | ||
799 | * in fb_info. It does not alter var in fb_info since we are using that | ||
800 | * data. This means we depend on the data in var inside fb_info to be | ||
801 | * supported by the hardware. fsl_diu_check_var is always called before | ||
802 | * fsl_diu_set_par to ensure this. | ||
803 | */ | ||
804 | static int fsl_diu_set_par(struct fb_info *info) | ||
805 | { | ||
806 | unsigned long len; | ||
807 | struct fb_var_screeninfo *var = &info->var; | ||
808 | struct mfb_info *mfbi = info->par; | ||
809 | struct fsl_diu_data *machine_data = mfbi->parent; | ||
810 | struct diu_ad *ad = mfbi->ad; | ||
811 | struct diu *hw; | ||
812 | |||
813 | hw = dr.diu_reg; | ||
814 | |||
815 | set_fix(info); | ||
816 | mfbi->cursor_reset = 1; | ||
817 | |||
818 | len = info->var.yres_virtual * info->fix.line_length; | ||
819 | /* Alloc & dealloc each time resolution/bpp change */ | ||
820 | if (len != info->fix.smem_len) { | ||
821 | if (info->fix.smem_start) | ||
822 | unmap_video_memory(info); | ||
823 | pr_debug("SET PAR: smem_len = %d\n", info->fix.smem_len); | ||
824 | |||
825 | /* Memory allocation for framebuffer */ | ||
826 | if (map_video_memory(info)) { | ||
827 | printk(KERN_ERR "Unable to allocate fb memory 1\n"); | ||
828 | return -ENOMEM; | ||
829 | } | ||
830 | } | ||
831 | |||
832 | ad->pix_fmt = | ||
833 | diu_ops.get_pixel_format(var->bits_per_pixel, | ||
834 | machine_data->monitor_port); | ||
835 | ad->addr = cpu_to_le32(info->fix.smem_start); | ||
836 | ad->src_size_g_alpha = cpu_to_le32((var->yres << 12) | | ||
837 | var->xres) | mfbi->g_alpha; | ||
838 | /* fix me. AOI should not be greater than display size */ | ||
839 | ad->aoi_size = cpu_to_le32((var->yres << 16) | var->xres); | ||
840 | ad->offset_xyi = 0; | ||
841 | ad->offset_xyd = cpu_to_le32((mfbi->y_aoi_d << 16) | mfbi->x_aoi_d); | ||
842 | |||
843 | /* Disable chroma keying function */ | ||
844 | ad->ckmax_r = 0; | ||
845 | ad->ckmax_g = 0; | ||
846 | ad->ckmax_b = 0; | ||
847 | |||
848 | ad->ckmin_r = 255; | ||
849 | ad->ckmin_g = 255; | ||
850 | ad->ckmin_b = 255; | ||
851 | |||
852 | if (mfbi->index == 0) | ||
853 | update_lcdc(info); | ||
854 | return 0; | ||
855 | } | ||
856 | |||
857 | static inline __u32 CNVT_TOHW(__u32 val, __u32 width) | ||
858 | { | ||
859 | return ((val<<width) + 0x7FFF - val)>>16; | ||
860 | } | ||
861 | |||
862 | /* | ||
863 | * Set a single color register. The values supplied have a 16 bit magnitude | ||
864 | * which needs to be scaled in this function for the hardware. Things to take | ||
865 | * into consideration are how many color registers, if any, are supported with | ||
866 | * the current color visual. With truecolor mode no color palettes are | ||
867 | * supported. Here a psuedo palette is created which we store the value in | ||
868 | * pseudo_palette in struct fb_info. For pseudocolor mode we have a limited | ||
869 | * color palette. | ||
870 | */ | ||
871 | static int fsl_diu_setcolreg(unsigned regno, unsigned red, unsigned green, | ||
872 | unsigned blue, unsigned transp, struct fb_info *info) | ||
873 | { | ||
874 | int ret = 1; | ||
875 | |||
876 | /* | ||
877 | * If greyscale is true, then we convert the RGB value | ||
878 | * to greyscale no matter what visual we are using. | ||
879 | */ | ||
880 | if (info->var.grayscale) | ||
881 | red = green = blue = (19595 * red + 38470 * green + | ||
882 | 7471 * blue) >> 16; | ||
883 | switch (info->fix.visual) { | ||
884 | case FB_VISUAL_TRUECOLOR: | ||
885 | /* | ||
886 | * 16-bit True Colour. We encode the RGB value | ||
887 | * according to the RGB bitfield information. | ||
888 | */ | ||
889 | if (regno < 16) { | ||
890 | u32 *pal = info->pseudo_palette; | ||
891 | u32 v; | ||
892 | |||
893 | red = CNVT_TOHW(red, info->var.red.length); | ||
894 | green = CNVT_TOHW(green, info->var.green.length); | ||
895 | blue = CNVT_TOHW(blue, info->var.blue.length); | ||
896 | transp = CNVT_TOHW(transp, info->var.transp.length); | ||
897 | |||
898 | v = (red << info->var.red.offset) | | ||
899 | (green << info->var.green.offset) | | ||
900 | (blue << info->var.blue.offset) | | ||
901 | (transp << info->var.transp.offset); | ||
902 | |||
903 | pal[regno] = v; | ||
904 | ret = 0; | ||
905 | } | ||
906 | break; | ||
907 | case FB_VISUAL_STATIC_PSEUDOCOLOR: | ||
908 | case FB_VISUAL_PSEUDOCOLOR: | ||
909 | break; | ||
910 | } | ||
911 | |||
912 | return ret; | ||
913 | } | ||
914 | |||
915 | /* | ||
916 | * Pan (or wrap, depending on the `vmode' field) the display using the | ||
917 | * 'xoffset' and 'yoffset' fields of the 'var' structure. If the values | ||
918 | * don't fit, return -EINVAL. | ||
919 | */ | ||
920 | static int fsl_diu_pan_display(struct fb_var_screeninfo *var, | ||
921 | struct fb_info *info) | ||
922 | { | ||
923 | if ((info->var.xoffset == var->xoffset) && | ||
924 | (info->var.yoffset == var->yoffset)) | ||
925 | return 0; /* No change, do nothing */ | ||
926 | |||
927 | if (var->xoffset < 0 || var->yoffset < 0 | ||
928 | || var->xoffset + info->var.xres > info->var.xres_virtual | ||
929 | || var->yoffset + info->var.yres > info->var.yres_virtual) | ||
930 | return -EINVAL; | ||
931 | |||
932 | info->var.xoffset = var->xoffset; | ||
933 | info->var.yoffset = var->yoffset; | ||
934 | |||
935 | if (var->vmode & FB_VMODE_YWRAP) | ||
936 | info->var.vmode |= FB_VMODE_YWRAP; | ||
937 | else | ||
938 | info->var.vmode &= ~FB_VMODE_YWRAP; | ||
939 | |||
940 | return 0; | ||
941 | } | ||
942 | |||
943 | /* | ||
944 | * Blank the screen if blank_mode != 0, else unblank. Return 0 if blanking | ||
945 | * succeeded, != 0 if un-/blanking failed. | ||
946 | * blank_mode == 2: suspend vsync | ||
947 | * blank_mode == 3: suspend hsync | ||
948 | * blank_mode == 4: powerdown | ||
949 | */ | ||
950 | static int fsl_diu_blank(int blank_mode, struct fb_info *info) | ||
951 | { | ||
952 | struct mfb_info *mfbi = info->par; | ||
953 | |||
954 | mfbi->blank = blank_mode; | ||
955 | |||
956 | switch (blank_mode) { | ||
957 | case FB_BLANK_VSYNC_SUSPEND: | ||
958 | case FB_BLANK_HSYNC_SUSPEND: | ||
959 | /* FIXME: fixes to enable_panel and enable lcdc needed */ | ||
960 | case FB_BLANK_NORMAL: | ||
961 | /* fsl_diu_disable_panel(info);*/ | ||
962 | break; | ||
963 | case FB_BLANK_POWERDOWN: | ||
964 | /* disable_lcdc(info); */ | ||
965 | break; | ||
966 | case FB_BLANK_UNBLANK: | ||
967 | /* fsl_diu_enable_panel(info);*/ | ||
968 | break; | ||
969 | } | ||
970 | |||
971 | return 0; | ||
972 | } | ||
973 | |||
974 | static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd, | ||
975 | unsigned long arg) | ||
976 | { | ||
977 | struct mfb_info *mfbi = info->par; | ||
978 | struct diu_ad *ad = mfbi->ad; | ||
979 | struct mfb_chroma_key ck; | ||
980 | unsigned char global_alpha; | ||
981 | struct aoi_display_offset aoi_d; | ||
982 | __u32 pix_fmt; | ||
983 | void __user *buf = (void __user *)arg; | ||
984 | |||
985 | if (!arg) | ||
986 | return -EINVAL; | ||
987 | switch (cmd) { | ||
988 | case MFB_SET_PIXFMT: | ||
989 | if (copy_from_user(&pix_fmt, buf, sizeof(pix_fmt))) | ||
990 | return -EFAULT; | ||
991 | ad->pix_fmt = pix_fmt; | ||
992 | pr_debug("Set pixel format to 0x%08x\n", ad->pix_fmt); | ||
993 | break; | ||
994 | case MFB_GET_PIXFMT: | ||
995 | pix_fmt = ad->pix_fmt; | ||
996 | if (copy_to_user(buf, &pix_fmt, sizeof(pix_fmt))) | ||
997 | return -EFAULT; | ||
998 | pr_debug("get pixel format 0x%08x\n", ad->pix_fmt); | ||
999 | break; | ||
1000 | case MFB_SET_AOID: | ||
1001 | if (copy_from_user(&aoi_d, buf, sizeof(aoi_d))) | ||
1002 | return -EFAULT; | ||
1003 | mfbi->x_aoi_d = aoi_d.x_aoi_d; | ||
1004 | mfbi->y_aoi_d = aoi_d.y_aoi_d; | ||
1005 | pr_debug("set AOI display offset of index %d to (%d,%d)\n", | ||
1006 | mfbi->index, aoi_d.x_aoi_d, aoi_d.y_aoi_d); | ||
1007 | fsl_diu_check_var(&info->var, info); | ||
1008 | fsl_diu_set_par(info); | ||
1009 | break; | ||
1010 | case MFB_GET_AOID: | ||
1011 | aoi_d.x_aoi_d = mfbi->x_aoi_d; | ||
1012 | aoi_d.y_aoi_d = mfbi->y_aoi_d; | ||
1013 | if (copy_to_user(buf, &aoi_d, sizeof(aoi_d))) | ||
1014 | return -EFAULT; | ||
1015 | pr_debug("get AOI display offset of index %d (%d,%d)\n", | ||
1016 | mfbi->index, aoi_d.x_aoi_d, aoi_d.y_aoi_d); | ||
1017 | break; | ||
1018 | case MFB_GET_ALPHA: | ||
1019 | global_alpha = mfbi->g_alpha; | ||
1020 | if (copy_to_user(buf, &global_alpha, sizeof(global_alpha))) | ||
1021 | return -EFAULT; | ||
1022 | pr_debug("get global alpha of index %d\n", mfbi->index); | ||
1023 | break; | ||
1024 | case MFB_SET_ALPHA: | ||
1025 | /* set panel information */ | ||
1026 | if (copy_from_user(&global_alpha, buf, sizeof(global_alpha))) | ||
1027 | return -EFAULT; | ||
1028 | ad->src_size_g_alpha = (ad->src_size_g_alpha & (~0xff)) | | ||
1029 | (global_alpha & 0xff); | ||
1030 | mfbi->g_alpha = global_alpha; | ||
1031 | pr_debug("set global alpha for index %d\n", mfbi->index); | ||
1032 | break; | ||
1033 | case MFB_SET_CHROMA_KEY: | ||
1034 | /* set panel winformation */ | ||
1035 | if (copy_from_user(&ck, buf, sizeof(ck))) | ||
1036 | return -EFAULT; | ||
1037 | |||
1038 | if (ck.enable && | ||
1039 | (ck.red_max < ck.red_min || | ||
1040 | ck.green_max < ck.green_min || | ||
1041 | ck.blue_max < ck.blue_min)) | ||
1042 | return -EINVAL; | ||
1043 | |||
1044 | if (!ck.enable) { | ||
1045 | ad->ckmax_r = 0; | ||
1046 | ad->ckmax_g = 0; | ||
1047 | ad->ckmax_b = 0; | ||
1048 | ad->ckmin_r = 255; | ||
1049 | ad->ckmin_g = 255; | ||
1050 | ad->ckmin_b = 255; | ||
1051 | } else { | ||
1052 | ad->ckmax_r = ck.red_max; | ||
1053 | ad->ckmax_g = ck.green_max; | ||
1054 | ad->ckmax_b = ck.blue_max; | ||
1055 | ad->ckmin_r = ck.red_min; | ||
1056 | ad->ckmin_g = ck.green_min; | ||
1057 | ad->ckmin_b = ck.blue_min; | ||
1058 | } | ||
1059 | pr_debug("set chroma key\n"); | ||
1060 | break; | ||
1061 | case FBIOGET_GWINFO: | ||
1062 | if (mfbi->type == MFB_TYPE_OFF) | ||
1063 | return -ENODEV; | ||
1064 | /* get graphic window information */ | ||
1065 | if (copy_to_user(buf, ad, sizeof(*ad))) | ||
1066 | return -EFAULT; | ||
1067 | break; | ||
1068 | case FBIOGET_HWCINFO: | ||
1069 | pr_debug("FBIOGET_HWCINFO:0x%08x\n", FBIOGET_HWCINFO); | ||
1070 | break; | ||
1071 | case FBIOPUT_MODEINFO: | ||
1072 | pr_debug("FBIOPUT_MODEINFO:0x%08x\n", FBIOPUT_MODEINFO); | ||
1073 | break; | ||
1074 | case FBIOGET_DISPINFO: | ||
1075 | pr_debug("FBIOGET_DISPINFO:0x%08x\n", FBIOGET_DISPINFO); | ||
1076 | break; | ||
1077 | |||
1078 | default: | ||
1079 | printk(KERN_ERR "Unknown ioctl command (0x%08X)\n", cmd); | ||
1080 | return -ENOIOCTLCMD; | ||
1081 | } | ||
1082 | |||
1083 | return 0; | ||
1084 | } | ||
1085 | |||
1086 | /* turn on fb if count == 1 | ||
1087 | */ | ||
1088 | static int fsl_diu_open(struct fb_info *info, int user) | ||
1089 | { | ||
1090 | struct mfb_info *mfbi = info->par; | ||
1091 | int res = 0; | ||
1092 | |||
1093 | spin_lock(&diu_lock); | ||
1094 | mfbi->count++; | ||
1095 | if (mfbi->count == 1) { | ||
1096 | pr_debug("open plane index %d\n", mfbi->index); | ||
1097 | fsl_diu_check_var(&info->var, info); | ||
1098 | res = fsl_diu_set_par(info); | ||
1099 | if (res < 0) | ||
1100 | mfbi->count--; | ||
1101 | else { | ||
1102 | res = fsl_diu_enable_panel(info); | ||
1103 | if (res < 0) | ||
1104 | mfbi->count--; | ||
1105 | } | ||
1106 | } | ||
1107 | |||
1108 | spin_unlock(&diu_lock); | ||
1109 | return res; | ||
1110 | } | ||
1111 | |||
1112 | /* turn off fb if count == 0 | ||
1113 | */ | ||
1114 | static int fsl_diu_release(struct fb_info *info, int user) | ||
1115 | { | ||
1116 | struct mfb_info *mfbi = info->par; | ||
1117 | int res = 0; | ||
1118 | |||
1119 | spin_lock(&diu_lock); | ||
1120 | mfbi->count--; | ||
1121 | if (mfbi->count == 0) { | ||
1122 | pr_debug("release plane index %d\n", mfbi->index); | ||
1123 | res = fsl_diu_disable_panel(info); | ||
1124 | if (res < 0) | ||
1125 | mfbi->count++; | ||
1126 | } | ||
1127 | spin_unlock(&diu_lock); | ||
1128 | return res; | ||
1129 | } | ||
1130 | |||
1131 | static struct fb_ops fsl_diu_ops = { | ||
1132 | .owner = THIS_MODULE, | ||
1133 | .fb_check_var = fsl_diu_check_var, | ||
1134 | .fb_set_par = fsl_diu_set_par, | ||
1135 | .fb_setcolreg = fsl_diu_setcolreg, | ||
1136 | .fb_blank = fsl_diu_blank, | ||
1137 | .fb_pan_display = fsl_diu_pan_display, | ||
1138 | .fb_fillrect = cfb_fillrect, | ||
1139 | .fb_copyarea = cfb_copyarea, | ||
1140 | .fb_imageblit = cfb_imageblit, | ||
1141 | .fb_ioctl = fsl_diu_ioctl, | ||
1142 | .fb_open = fsl_diu_open, | ||
1143 | .fb_release = fsl_diu_release, | ||
1144 | }; | ||
1145 | |||
1146 | static int init_fbinfo(struct fb_info *info) | ||
1147 | { | ||
1148 | struct mfb_info *mfbi = info->par; | ||
1149 | |||
1150 | info->device = NULL; | ||
1151 | info->var.activate = FB_ACTIVATE_NOW; | ||
1152 | info->fbops = &fsl_diu_ops; | ||
1153 | info->flags = FBINFO_FLAG_DEFAULT; | ||
1154 | info->pseudo_palette = &mfbi->pseudo_palette; | ||
1155 | |||
1156 | /* Allocate colormap */ | ||
1157 | fb_alloc_cmap(&info->cmap, 16, 0); | ||
1158 | return 0; | ||
1159 | } | ||
1160 | |||
1161 | static int install_fb(struct fb_info *info) | ||
1162 | { | ||
1163 | int rc; | ||
1164 | struct mfb_info *mfbi = info->par; | ||
1165 | const char *aoi_mode, *init_aoi_mode = "320x240"; | ||
1166 | |||
1167 | if (init_fbinfo(info)) | ||
1168 | return -EINVAL; | ||
1169 | |||
1170 | if (mfbi->index == 0) /* plane 0 */ | ||
1171 | aoi_mode = fb_mode; | ||
1172 | else | ||
1173 | aoi_mode = init_aoi_mode; | ||
1174 | pr_debug("mode used = %s\n", aoi_mode); | ||
1175 | rc = fb_find_mode(&info->var, info, aoi_mode, fsl_diu_mode_db, | ||
1176 | ARRAY_SIZE(fsl_diu_mode_db), &fsl_diu_default_mode, default_bpp); | ||
1177 | |||
1178 | switch (rc) { | ||
1179 | case 1: | ||
1180 | pr_debug("using mode specified in @mode\n"); | ||
1181 | break; | ||
1182 | case 2: | ||
1183 | pr_debug("using mode specified in @mode " | ||
1184 | "with ignored refresh rate\n"); | ||
1185 | break; | ||
1186 | case 3: | ||
1187 | pr_debug("using mode default mode\n"); | ||
1188 | break; | ||
1189 | case 4: | ||
1190 | pr_debug("using mode from list\n"); | ||
1191 | break; | ||
1192 | default: | ||
1193 | pr_debug("rc = %d\n", rc); | ||
1194 | pr_debug("failed to find mode\n"); | ||
1195 | return -EINVAL; | ||
1196 | break; | ||
1197 | } | ||
1198 | |||
1199 | pr_debug("xres_virtual %d\n", info->var.xres_virtual); | ||
1200 | pr_debug("bits_per_pixel %d\n", info->var.bits_per_pixel); | ||
1201 | |||
1202 | pr_debug("info->var.yres_virtual = %d\n", info->var.yres_virtual); | ||
1203 | pr_debug("info->fix.line_length = %d\n", info->fix.line_length); | ||
1204 | |||
1205 | if (mfbi->type == MFB_TYPE_OFF) | ||
1206 | mfbi->blank = FB_BLANK_NORMAL; | ||
1207 | else | ||
1208 | mfbi->blank = FB_BLANK_UNBLANK; | ||
1209 | |||
1210 | if (fsl_diu_check_var(&info->var, info)) { | ||
1211 | printk(KERN_ERR "fb_check_var failed"); | ||
1212 | fb_dealloc_cmap(&info->cmap); | ||
1213 | return -EINVAL; | ||
1214 | } | ||
1215 | |||
1216 | if (fsl_diu_set_par(info)) { | ||
1217 | printk(KERN_ERR "fb_set_par failed"); | ||
1218 | fb_dealloc_cmap(&info->cmap); | ||
1219 | return -EINVAL; | ||
1220 | } | ||
1221 | |||
1222 | if (register_framebuffer(info) < 0) { | ||
1223 | printk(KERN_ERR "register_framebuffer failed"); | ||
1224 | unmap_video_memory(info); | ||
1225 | fb_dealloc_cmap(&info->cmap); | ||
1226 | return -EINVAL; | ||
1227 | } | ||
1228 | |||
1229 | mfbi->registered = 1; | ||
1230 | printk(KERN_INFO "fb%d: %s fb device registered successfully.\n", | ||
1231 | info->node, info->fix.id); | ||
1232 | |||
1233 | return 0; | ||
1234 | } | ||
1235 | |||
1236 | static void __exit uninstall_fb(struct fb_info *info) | ||
1237 | { | ||
1238 | struct mfb_info *mfbi = info->par; | ||
1239 | |||
1240 | if (!mfbi->registered) | ||
1241 | return; | ||
1242 | |||
1243 | unregister_framebuffer(info); | ||
1244 | unmap_video_memory(info); | ||
1245 | if (&info->cmap) | ||
1246 | fb_dealloc_cmap(&info->cmap); | ||
1247 | |||
1248 | mfbi->registered = 0; | ||
1249 | } | ||
1250 | |||
1251 | static irqreturn_t fsl_diu_isr(int irq, void *dev_id) | ||
1252 | { | ||
1253 | struct diu *hw = dr.diu_reg; | ||
1254 | unsigned int status = in_be32(&hw->int_status); | ||
1255 | |||
1256 | if (status) { | ||
1257 | /* This is the workaround for underrun */ | ||
1258 | if (status & INT_UNDRUN) { | ||
1259 | out_be32(&hw->diu_mode, 0); | ||
1260 | pr_debug("Err: DIU occurs underrun!\n"); | ||
1261 | udelay(1); | ||
1262 | out_be32(&hw->diu_mode, 1); | ||
1263 | } | ||
1264 | #if defined(CONFIG_NOT_COHERENT_CACHE) | ||
1265 | else if (status & INT_VSYNC) { | ||
1266 | unsigned int i; | ||
1267 | for (i = 0; i < coherence_data_size; | ||
1268 | i += d_cache_line_size) | ||
1269 | __asm__ __volatile__ ( | ||
1270 | "dcbz 0, %[input]" | ||
1271 | ::[input]"r"(&coherence_data[i])); | ||
1272 | } | ||
1273 | #endif | ||
1274 | return IRQ_HANDLED; | ||
1275 | } | ||
1276 | return IRQ_NONE; | ||
1277 | } | ||
1278 | |||
1279 | static int request_irq_local(int irq) | ||
1280 | { | ||
1281 | unsigned long status, ints; | ||
1282 | struct diu *hw; | ||
1283 | int ret; | ||
1284 | |||
1285 | hw = dr.diu_reg; | ||
1286 | |||
1287 | /* Read to clear the status */ | ||
1288 | status = in_be32(&hw->int_status); | ||
1289 | |||
1290 | ret = request_irq(irq, fsl_diu_isr, 0, "diu", 0); | ||
1291 | if (ret) | ||
1292 | pr_info("Request diu IRQ failed.\n"); | ||
1293 | else { | ||
1294 | ints = INT_PARERR | INT_LS_BF_VS; | ||
1295 | #if !defined(CONFIG_NOT_COHERENT_CACHE) | ||
1296 | ints |= INT_VSYNC; | ||
1297 | #endif | ||
1298 | if (dr.mode == MFB_MODE2 || dr.mode == MFB_MODE3) | ||
1299 | ints |= INT_VSYNC_WB; | ||
1300 | |||
1301 | /* Read to clear the status */ | ||
1302 | status = in_be32(&hw->int_status); | ||
1303 | out_be32(&hw->int_mask, ints); | ||
1304 | } | ||
1305 | return ret; | ||
1306 | } | ||
1307 | |||
1308 | static void free_irq_local(int irq) | ||
1309 | { | ||
1310 | struct diu *hw = dr.diu_reg; | ||
1311 | |||
1312 | /* Disable all LCDC interrupt */ | ||
1313 | out_be32(&hw->int_mask, 0x1f); | ||
1314 | |||
1315 | free_irq(irq, 0); | ||
1316 | } | ||
1317 | |||
1318 | #ifdef CONFIG_PM | ||
1319 | /* | ||
1320 | * Power management hooks. Note that we won't be called from IRQ context, | ||
1321 | * unlike the blank functions above, so we may sleep. | ||
1322 | */ | ||
1323 | static int fsl_diu_suspend(struct of_device *dev, pm_message_t state) | ||
1324 | { | ||
1325 | struct fsl_diu_data *machine_data; | ||
1326 | |||
1327 | machine_data = dev_get_drvdata(&ofdev->dev); | ||
1328 | disable_lcdc(machine_data->fsl_diu_info[0]); | ||
1329 | |||
1330 | return 0; | ||
1331 | } | ||
1332 | |||
1333 | static int fsl_diu_resume(struct of_device *dev) | ||
1334 | { | ||
1335 | struct fsl_diu_data *machine_data; | ||
1336 | |||
1337 | machine_data = dev_get_drvdata(&ofdev->dev); | ||
1338 | enable_lcdc(machine_data->fsl_diu_info[0]); | ||
1339 | |||
1340 | return 0; | ||
1341 | } | ||
1342 | |||
1343 | #else | ||
1344 | #define fsl_diu_suspend NULL | ||
1345 | #define fsl_diu_resume NULL | ||
1346 | #endif /* CONFIG_PM */ | ||
1347 | |||
1348 | /* Align to 64-bit(8-byte), 32-byte, etc. */ | ||
1349 | static int allocate_buf(struct diu_addr *buf, u32 size, u32 bytes_align) | ||
1350 | { | ||
1351 | u32 offset, ssize; | ||
1352 | u32 mask; | ||
1353 | dma_addr_t paddr = 0; | ||
1354 | |||
1355 | ssize = size + bytes_align; | ||
1356 | buf->vaddr = dma_alloc_coherent(0, ssize, &paddr, GFP_DMA | __GFP_ZERO); | ||
1357 | if (!buf->vaddr) | ||
1358 | return -ENOMEM; | ||
1359 | |||
1360 | buf->paddr = (__u32) paddr; | ||
1361 | |||
1362 | mask = bytes_align - 1; | ||
1363 | offset = (u32)buf->paddr & mask; | ||
1364 | if (offset) { | ||
1365 | buf->offset = bytes_align - offset; | ||
1366 | buf->paddr = (u32)buf->paddr + offset; | ||
1367 | } else | ||
1368 | buf->offset = 0; | ||
1369 | return 0; | ||
1370 | } | ||
1371 | |||
1372 | static void free_buf(struct diu_addr *buf, u32 size, u32 bytes_align) | ||
1373 | { | ||
1374 | dma_free_coherent(0, size + bytes_align, | ||
1375 | buf->vaddr, (buf->paddr - buf->offset)); | ||
1376 | return; | ||
1377 | } | ||
1378 | |||
1379 | static ssize_t store_monitor(struct device *device, | ||
1380 | struct device_attribute *attr, const char *buf, size_t count) | ||
1381 | { | ||
1382 | int old_monitor_port; | ||
1383 | unsigned long val; | ||
1384 | struct fsl_diu_data *machine_data = | ||
1385 | container_of(attr, struct fsl_diu_data, dev_attr); | ||
1386 | |||
1387 | if (strict_strtoul(buf, 10, &val)) | ||
1388 | return 0; | ||
1389 | |||
1390 | old_monitor_port = machine_data->monitor_port; | ||
1391 | machine_data->monitor_port = diu_ops.set_sysfs_monitor_port(val); | ||
1392 | |||
1393 | if (old_monitor_port != machine_data->monitor_port) { | ||
1394 | /* All AOIs need adjust pixel format | ||
1395 | * fsl_diu_set_par only change the pixsel format here | ||
1396 | * unlikely to fail. */ | ||
1397 | fsl_diu_set_par(machine_data->fsl_diu_info[0]); | ||
1398 | fsl_diu_set_par(machine_data->fsl_diu_info[1]); | ||
1399 | fsl_diu_set_par(machine_data->fsl_diu_info[2]); | ||
1400 | fsl_diu_set_par(machine_data->fsl_diu_info[3]); | ||
1401 | fsl_diu_set_par(machine_data->fsl_diu_info[4]); | ||
1402 | } | ||
1403 | return count; | ||
1404 | } | ||
1405 | |||
1406 | static ssize_t show_monitor(struct device *device, | ||
1407 | struct device_attribute *attr, char *buf) | ||
1408 | { | ||
1409 | struct fsl_diu_data *machine_data = | ||
1410 | container_of(attr, struct fsl_diu_data, dev_attr); | ||
1411 | return diu_ops.show_monitor_port(machine_data->monitor_port, buf); | ||
1412 | } | ||
1413 | |||
1414 | static int fsl_diu_probe(struct of_device *ofdev, | ||
1415 | const struct of_device_id *match) | ||
1416 | { | ||
1417 | struct device_node *np = ofdev->node; | ||
1418 | struct mfb_info *mfbi; | ||
1419 | phys_addr_t dummy_ad_addr; | ||
1420 | int ret, i, error = 0; | ||
1421 | struct resource res; | ||
1422 | struct fsl_diu_data *machine_data; | ||
1423 | |||
1424 | machine_data = kzalloc(sizeof(struct fsl_diu_data), GFP_KERNEL); | ||
1425 | if (!machine_data) | ||
1426 | return -ENOMEM; | ||
1427 | |||
1428 | for (i = 0; i < ARRAY_SIZE(machine_data->fsl_diu_info); i++) { | ||
1429 | machine_data->fsl_diu_info[i] = | ||
1430 | framebuffer_alloc(sizeof(struct mfb_info), &ofdev->dev); | ||
1431 | if (!machine_data->fsl_diu_info[i]) { | ||
1432 | dev_err(&ofdev->dev, "cannot allocate memory\n"); | ||
1433 | ret = -ENOMEM; | ||
1434 | goto error2; | ||
1435 | } | ||
1436 | mfbi = machine_data->fsl_diu_info[i]->par; | ||
1437 | memcpy(mfbi, &mfb_template[i], sizeof(struct mfb_info)); | ||
1438 | mfbi->parent = machine_data; | ||
1439 | } | ||
1440 | |||
1441 | ret = of_address_to_resource(np, 0, &res); | ||
1442 | if (ret) { | ||
1443 | dev_err(&ofdev->dev, "could not obtain DIU address\n"); | ||
1444 | goto error; | ||
1445 | } | ||
1446 | if (!res.start) { | ||
1447 | dev_err(&ofdev->dev, "invalid DIU address\n"); | ||
1448 | goto error; | ||
1449 | } | ||
1450 | dev_dbg(&ofdev->dev, "%s, res.start: 0x%08x\n", __func__, res.start); | ||
1451 | |||
1452 | dr.diu_reg = ioremap(res.start, sizeof(struct diu)); | ||
1453 | if (!dr.diu_reg) { | ||
1454 | dev_err(&ofdev->dev, "Err: can't map DIU registers!\n"); | ||
1455 | ret = -EFAULT; | ||
1456 | goto error2; | ||
1457 | } | ||
1458 | |||
1459 | out_be32(&dr.diu_reg->diu_mode, 0); /* disable DIU anyway*/ | ||
1460 | |||
1461 | /* Get the IRQ of the DIU */ | ||
1462 | machine_data->irq = irq_of_parse_and_map(np, 0); | ||
1463 | |||
1464 | if (!machine_data->irq) { | ||
1465 | dev_err(&ofdev->dev, "could not get DIU IRQ\n"); | ||
1466 | ret = -EINVAL; | ||
1467 | goto error; | ||
1468 | } | ||
1469 | machine_data->monitor_port = monitor_port; | ||
1470 | |||
1471 | /* Area descriptor memory pool aligns to 64-bit boundary */ | ||
1472 | if (allocate_buf(&pool.ad, sizeof(struct diu_ad) * FSL_AOI_NUM, 8)) | ||
1473 | return -ENOMEM; | ||
1474 | |||
1475 | /* Get memory for Gamma Table - 32-byte aligned memory */ | ||
1476 | if (allocate_buf(&pool.gamma, 768, 32)) { | ||
1477 | ret = -ENOMEM; | ||
1478 | goto error; | ||
1479 | } | ||
1480 | |||
1481 | /* For performance, cursor bitmap buffer aligns to 32-byte boundary */ | ||
1482 | if (allocate_buf(&pool.cursor, MAX_CURS * MAX_CURS * 2, 32)) { | ||
1483 | ret = -ENOMEM; | ||
1484 | goto error; | ||
1485 | } | ||
1486 | |||
1487 | i = ARRAY_SIZE(machine_data->fsl_diu_info); | ||
1488 | machine_data->dummy_ad = (struct diu_ad *) | ||
1489 | ((u32)pool.ad.vaddr + pool.ad.offset) + i; | ||
1490 | machine_data->dummy_ad->paddr = pool.ad.paddr + | ||
1491 | i * sizeof(struct diu_ad); | ||
1492 | machine_data->dummy_aoi_virt = fsl_diu_alloc(64, &dummy_ad_addr); | ||
1493 | if (!machine_data->dummy_aoi_virt) { | ||
1494 | ret = -ENOMEM; | ||
1495 | goto error; | ||
1496 | } | ||
1497 | machine_data->dummy_ad->addr = cpu_to_le32(dummy_ad_addr); | ||
1498 | machine_data->dummy_ad->pix_fmt = 0x88882317; | ||
1499 | machine_data->dummy_ad->src_size_g_alpha = cpu_to_le32((4 << 12) | 4); | ||
1500 | machine_data->dummy_ad->aoi_size = cpu_to_le32((4 << 16) | 2); | ||
1501 | machine_data->dummy_ad->offset_xyi = 0; | ||
1502 | machine_data->dummy_ad->offset_xyd = 0; | ||
1503 | machine_data->dummy_ad->next_ad = 0; | ||
1504 | |||
1505 | out_be32(&dr.diu_reg->desc[0], machine_data->dummy_ad->paddr); | ||
1506 | out_be32(&dr.diu_reg->desc[1], machine_data->dummy_ad->paddr); | ||
1507 | out_be32(&dr.diu_reg->desc[2], machine_data->dummy_ad->paddr); | ||
1508 | |||
1509 | for (i = 0; i < ARRAY_SIZE(machine_data->fsl_diu_info); i++) { | ||
1510 | machine_data->fsl_diu_info[i]->fix.smem_start = 0; | ||
1511 | mfbi = machine_data->fsl_diu_info[i]->par; | ||
1512 | mfbi->ad = (struct diu_ad *)((u32)pool.ad.vaddr | ||
1513 | + pool.ad.offset) + i; | ||
1514 | mfbi->ad->paddr = pool.ad.paddr + i * sizeof(struct diu_ad); | ||
1515 | ret = install_fb(machine_data->fsl_diu_info[i]); | ||
1516 | if (ret) { | ||
1517 | dev_err(&ofdev->dev, | ||
1518 | "Failed to register framebuffer %d\n", | ||
1519 | i); | ||
1520 | goto error; | ||
1521 | } | ||
1522 | } | ||
1523 | |||
1524 | if (request_irq_local(machine_data->irq)) { | ||
1525 | dev_err(machine_data->fsl_diu_info[0]->dev, | ||
1526 | "could not request irq for diu."); | ||
1527 | goto error; | ||
1528 | } | ||
1529 | |||
1530 | machine_data->dev_attr.attr.name = "monitor"; | ||
1531 | machine_data->dev_attr.attr.mode = S_IRUGO|S_IWUSR; | ||
1532 | machine_data->dev_attr.show = show_monitor; | ||
1533 | machine_data->dev_attr.store = store_monitor; | ||
1534 | error = device_create_file(machine_data->fsl_diu_info[0]->dev, | ||
1535 | &machine_data->dev_attr); | ||
1536 | if (error) { | ||
1537 | dev_err(machine_data->fsl_diu_info[0]->dev, | ||
1538 | "could not create sysfs %s file\n", | ||
1539 | machine_data->dev_attr.attr.name); | ||
1540 | } | ||
1541 | |||
1542 | dev_set_drvdata(&ofdev->dev, machine_data); | ||
1543 | return 0; | ||
1544 | |||
1545 | error: | ||
1546 | for (i = ARRAY_SIZE(machine_data->fsl_diu_info); | ||
1547 | i > 0; i--) | ||
1548 | uninstall_fb(machine_data->fsl_diu_info[i - 1]); | ||
1549 | if (pool.ad.vaddr) | ||
1550 | free_buf(&pool.ad, sizeof(struct diu_ad) * FSL_AOI_NUM, 8); | ||
1551 | if (pool.gamma.vaddr) | ||
1552 | free_buf(&pool.gamma, 768, 32); | ||
1553 | if (pool.cursor.vaddr) | ||
1554 | free_buf(&pool.cursor, MAX_CURS * MAX_CURS * 2, 32); | ||
1555 | if (machine_data->dummy_aoi_virt) | ||
1556 | fsl_diu_free(machine_data->dummy_aoi_virt, 64); | ||
1557 | iounmap(dr.diu_reg); | ||
1558 | |||
1559 | error2: | ||
1560 | for (i = 0; i < ARRAY_SIZE(machine_data->fsl_diu_info); i++) | ||
1561 | if (machine_data->fsl_diu_info[i]) | ||
1562 | framebuffer_release(machine_data->fsl_diu_info[i]); | ||
1563 | kfree(machine_data); | ||
1564 | |||
1565 | return ret; | ||
1566 | } | ||
1567 | |||
1568 | |||
1569 | static int fsl_diu_remove(struct of_device *ofdev) | ||
1570 | { | ||
1571 | struct fsl_diu_data *machine_data; | ||
1572 | int i; | ||
1573 | |||
1574 | machine_data = dev_get_drvdata(&ofdev->dev); | ||
1575 | disable_lcdc(machine_data->fsl_diu_info[0]); | ||
1576 | free_irq_local(machine_data->irq); | ||
1577 | for (i = ARRAY_SIZE(machine_data->fsl_diu_info); i > 0; i--) | ||
1578 | uninstall_fb(machine_data->fsl_diu_info[i - 1]); | ||
1579 | if (pool.ad.vaddr) | ||
1580 | free_buf(&pool.ad, sizeof(struct diu_ad) * FSL_AOI_NUM, 8); | ||
1581 | if (pool.gamma.vaddr) | ||
1582 | free_buf(&pool.gamma, 768, 32); | ||
1583 | if (pool.cursor.vaddr) | ||
1584 | free_buf(&pool.cursor, MAX_CURS * MAX_CURS * 2, 32); | ||
1585 | if (machine_data->dummy_aoi_virt) | ||
1586 | fsl_diu_free(machine_data->dummy_aoi_virt, 64); | ||
1587 | iounmap(dr.diu_reg); | ||
1588 | for (i = 0; i < ARRAY_SIZE(machine_data->fsl_diu_info); i++) | ||
1589 | if (machine_data->fsl_diu_info[i]) | ||
1590 | framebuffer_release(machine_data->fsl_diu_info[i]); | ||
1591 | kfree(machine_data); | ||
1592 | |||
1593 | return 0; | ||
1594 | } | ||
1595 | |||
1596 | #ifndef MODULE | ||
1597 | static int __init fsl_diu_setup(char *options) | ||
1598 | { | ||
1599 | char *opt; | ||
1600 | unsigned long val; | ||
1601 | |||
1602 | if (!options || !*options) | ||
1603 | return 0; | ||
1604 | |||
1605 | while ((opt = strsep(&options, ",")) != NULL) { | ||
1606 | if (!*opt) | ||
1607 | continue; | ||
1608 | if (!strncmp(opt, "monitor=", 8)) { | ||
1609 | if (!strict_strtoul(opt + 8, 10, &val) && (val <= 2)) | ||
1610 | monitor_port = val; | ||
1611 | } else if (!strncmp(opt, "bpp=", 4)) { | ||
1612 | if (!strict_strtoul(opt + 4, 10, &val)) | ||
1613 | default_bpp = val; | ||
1614 | } else | ||
1615 | fb_mode = opt; | ||
1616 | } | ||
1617 | |||
1618 | return 0; | ||
1619 | } | ||
1620 | #endif | ||
1621 | |||
1622 | static struct of_device_id fsl_diu_match[] = { | ||
1623 | { | ||
1624 | .compatible = "fsl,diu", | ||
1625 | }, | ||
1626 | {} | ||
1627 | }; | ||
1628 | MODULE_DEVICE_TABLE(of, fsl_diu_match); | ||
1629 | |||
1630 | static struct of_platform_driver fsl_diu_driver = { | ||
1631 | .owner = THIS_MODULE, | ||
1632 | .name = "fsl_diu", | ||
1633 | .match_table = fsl_diu_match, | ||
1634 | .probe = fsl_diu_probe, | ||
1635 | .remove = fsl_diu_remove, | ||
1636 | .suspend = fsl_diu_suspend, | ||
1637 | .resume = fsl_diu_resume, | ||
1638 | }; | ||
1639 | |||
1640 | static int __init fsl_diu_init(void) | ||
1641 | { | ||
1642 | #ifdef CONFIG_NOT_COHERENT_CACHE | ||
1643 | struct device_node *np; | ||
1644 | const u32 *prop; | ||
1645 | #endif | ||
1646 | int ret; | ||
1647 | #ifndef MODULE | ||
1648 | char *option; | ||
1649 | |||
1650 | /* | ||
1651 | * For kernel boot options (in 'video=xxxfb:<options>' format) | ||
1652 | */ | ||
1653 | if (fb_get_options("fslfb", &option)) | ||
1654 | return -ENODEV; | ||
1655 | fsl_diu_setup(option); | ||
1656 | #endif | ||
1657 | printk(KERN_INFO "Freescale DIU driver\n"); | ||
1658 | |||
1659 | #ifdef CONFIG_NOT_COHERENT_CACHE | ||
1660 | np = of_find_node_by_type(NULL, "cpu"); | ||
1661 | if (!np) { | ||
1662 | printk(KERN_ERR "Err: can't find device node 'cpu'\n"); | ||
1663 | return -ENODEV; | ||
1664 | } | ||
1665 | |||
1666 | prop = of_get_property(np, "d-cache-size", NULL); | ||
1667 | if (prop == NULL) | ||
1668 | return -ENODEV; | ||
1669 | |||
1670 | /* Freescale PLRU requires 13/8 times the cache size to do a proper | ||
1671 | displacement flush | ||
1672 | */ | ||
1673 | coherence_data_size = *prop * 13; | ||
1674 | coherence_data_size /= 8; | ||
1675 | |||
1676 | prop = of_get_property(np, "d-cache-line-size", NULL); | ||
1677 | if (prop == NULL) | ||
1678 | return -ENODEV; | ||
1679 | d_cache_line_size = *prop; | ||
1680 | |||
1681 | of_node_put(np); | ||
1682 | coherence_data = vmalloc(coherence_data_size); | ||
1683 | if (!coherence_data) | ||
1684 | return -ENOMEM; | ||
1685 | #endif | ||
1686 | ret = of_register_platform_driver(&fsl_diu_driver); | ||
1687 | if (ret) { | ||
1688 | printk(KERN_ERR | ||
1689 | "fsl-diu: failed to register platform driver\n"); | ||
1690 | #if defined(CONFIG_NOT_COHERENT_CACHE) | ||
1691 | vfree(coherence_data); | ||
1692 | #endif | ||
1693 | iounmap(dr.diu_reg); | ||
1694 | } | ||
1695 | return ret; | ||
1696 | } | ||
1697 | |||
1698 | static void __exit fsl_diu_exit(void) | ||
1699 | { | ||
1700 | of_unregister_platform_driver(&fsl_diu_driver); | ||
1701 | #if defined(CONFIG_NOT_COHERENT_CACHE) | ||
1702 | vfree(coherence_data); | ||
1703 | #endif | ||
1704 | } | ||
1705 | |||
1706 | module_init(fsl_diu_init); | ||
1707 | module_exit(fsl_diu_exit); | ||
1708 | |||
1709 | MODULE_AUTHOR("York Sun <yorksun@freescale.com>"); | ||
1710 | MODULE_DESCRIPTION("Freescale DIU framebuffer driver"); | ||
1711 | MODULE_LICENSE("GPL"); | ||
1712 | |||
1713 | module_param_named(mode, fb_mode, charp, 0); | ||
1714 | MODULE_PARM_DESC(mode, | ||
1715 | "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\" "); | ||
1716 | module_param_named(bpp, default_bpp, ulong, 0); | ||
1717 | MODULE_PARM_DESC(bpp, "Specify bit-per-pixel if not specified mode"); | ||
1718 | module_param_named(monitor, monitor_port, int, 0); | ||
1719 | MODULE_PARM_DESC(monitor, | ||
1720 | "Specify the monitor port (0, 1 or 2) if supported by the platform"); | ||
1721 | |||
diff --git a/drivers/video/fsl-diu-fb.h b/drivers/video/fsl-diu-fb.h new file mode 100644 index 000000000000..fc295d7ea463 --- /dev/null +++ b/drivers/video/fsl-diu-fb.h | |||
@@ -0,0 +1,223 @@ | |||
1 | /* | ||
2 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * | ||
4 | * Freescale DIU Frame Buffer device driver | ||
5 | * | ||
6 | * Authors: Hongjun Chen <hong-jun.chen@freescale.com> | ||
7 | * Paul Widmer <paul.widmer@freescale.com> | ||
8 | * Srikanth Srinivasan <srikanth.srinivasan@freescale.com> | ||
9 | * York Sun <yorksun@freescale.com> | ||
10 | * | ||
11 | * Based on imxfb.c Copyright (C) 2004 S.Hauer, Pengutronix | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #ifndef __FSL_DIU_FB_H__ | ||
21 | #define __FSL_DIU_FB_H__ | ||
22 | |||
23 | /* Arbitrary threshold to determine the allocation method | ||
24 | * See mpc8610fb_set_par(), map_video_memory(), and unmap_video_memory() | ||
25 | */ | ||
26 | #define MEM_ALLOC_THRESHOLD (1024*768*4+32) | ||
27 | /* Minimum value that the pixel clock can be set to in pico seconds | ||
28 | * This is determined by platform clock/3 where the minimum platform | ||
29 | * clock is 533MHz. This gives 5629 pico seconds. | ||
30 | */ | ||
31 | #define MIN_PIX_CLK 5629 | ||
32 | #define MAX_PIX_CLK 96096 | ||
33 | |||
34 | #include <linux/types.h> | ||
35 | |||
36 | struct mfb_alpha { | ||
37 | int enable; | ||
38 | int alpha; | ||
39 | }; | ||
40 | |||
41 | struct mfb_chroma_key { | ||
42 | int enable; | ||
43 | __u8 red_max; | ||
44 | __u8 green_max; | ||
45 | __u8 blue_max; | ||
46 | __u8 red_min; | ||
47 | __u8 green_min; | ||
48 | __u8 blue_min; | ||
49 | }; | ||
50 | |||
51 | struct aoi_display_offset { | ||
52 | int x_aoi_d; | ||
53 | int y_aoi_d; | ||
54 | }; | ||
55 | |||
56 | #define MFB_SET_CHROMA_KEY _IOW('M', 1, struct mfb_chroma_key) | ||
57 | #define MFB_WAIT_FOR_VSYNC _IOW('F', 0x20, u_int32_t) | ||
58 | #define MFB_SET_BRIGHTNESS _IOW('M', 3, __u8) | ||
59 | |||
60 | #define MFB_SET_ALPHA 0x80014d00 | ||
61 | #define MFB_GET_ALPHA 0x40014d00 | ||
62 | #define MFB_SET_AOID 0x80084d04 | ||
63 | #define MFB_GET_AOID 0x40084d04 | ||
64 | #define MFB_SET_PIXFMT 0x80014d08 | ||
65 | #define MFB_GET_PIXFMT 0x40014d08 | ||
66 | |||
67 | #define FBIOGET_GWINFO 0x46E0 | ||
68 | #define FBIOPUT_GWINFO 0x46E1 | ||
69 | |||
70 | #ifdef __KERNEL__ | ||
71 | #include <linux/spinlock.h> | ||
72 | |||
73 | /* | ||
74 | * These are the fields of area descriptor(in DDR memory) for every plane | ||
75 | */ | ||
76 | struct diu_ad { | ||
77 | /* Word 0(32-bit) in DDR memory */ | ||
78 | /* __u16 comp; */ | ||
79 | /* __u16 pixel_s:2; */ | ||
80 | /* __u16 pallete:1; */ | ||
81 | /* __u16 red_c:2; */ | ||
82 | /* __u16 green_c:2; */ | ||
83 | /* __u16 blue_c:2; */ | ||
84 | /* __u16 alpha_c:3; */ | ||
85 | /* __u16 byte_f:1; */ | ||
86 | /* __u16 res0:3; */ | ||
87 | |||
88 | __be32 pix_fmt; /* hard coding pixel format */ | ||
89 | |||
90 | /* Word 1(32-bit) in DDR memory */ | ||
91 | __le32 addr; | ||
92 | |||
93 | /* Word 2(32-bit) in DDR memory */ | ||
94 | /* __u32 delta_xs:11; */ | ||
95 | /* __u32 res1:1; */ | ||
96 | /* __u32 delta_ys:11; */ | ||
97 | /* __u32 res2:1; */ | ||
98 | /* __u32 g_alpha:8; */ | ||
99 | __le32 src_size_g_alpha; | ||
100 | |||
101 | /* Word 3(32-bit) in DDR memory */ | ||
102 | /* __u32 delta_xi:11; */ | ||
103 | /* __u32 res3:5; */ | ||
104 | /* __u32 delta_yi:11; */ | ||
105 | /* __u32 res4:3; */ | ||
106 | /* __u32 flip:2; */ | ||
107 | __le32 aoi_size; | ||
108 | |||
109 | /* Word 4(32-bit) in DDR memory */ | ||
110 | /*__u32 offset_xi:11; | ||
111 | __u32 res5:5; | ||
112 | __u32 offset_yi:11; | ||
113 | __u32 res6:5; | ||
114 | */ | ||
115 | __le32 offset_xyi; | ||
116 | |||
117 | /* Word 5(32-bit) in DDR memory */ | ||
118 | /*__u32 offset_xd:11; | ||
119 | __u32 res7:5; | ||
120 | __u32 offset_yd:11; | ||
121 | __u32 res8:5; */ | ||
122 | __le32 offset_xyd; | ||
123 | |||
124 | |||
125 | /* Word 6(32-bit) in DDR memory */ | ||
126 | __u8 ckmax_r; | ||
127 | __u8 ckmax_g; | ||
128 | __u8 ckmax_b; | ||
129 | __u8 res9; | ||
130 | |||
131 | /* Word 7(32-bit) in DDR memory */ | ||
132 | __u8 ckmin_r; | ||
133 | __u8 ckmin_g; | ||
134 | __u8 ckmin_b; | ||
135 | __u8 res10; | ||
136 | /* __u32 res10:8; */ | ||
137 | |||
138 | /* Word 8(32-bit) in DDR memory */ | ||
139 | __le32 next_ad; | ||
140 | |||
141 | /* Word 9(32-bit) in DDR memory, just for 64-bit aligned */ | ||
142 | __u32 paddr; | ||
143 | } __attribute__ ((packed)); | ||
144 | |||
145 | /* DIU register map */ | ||
146 | struct diu { | ||
147 | __be32 desc[3]; | ||
148 | __be32 gamma; | ||
149 | __be32 pallete; | ||
150 | __be32 cursor; | ||
151 | __be32 curs_pos; | ||
152 | __be32 diu_mode; | ||
153 | __be32 bgnd; | ||
154 | __be32 bgnd_wb; | ||
155 | __be32 disp_size; | ||
156 | __be32 wb_size; | ||
157 | __be32 wb_mem_addr; | ||
158 | __be32 hsyn_para; | ||
159 | __be32 vsyn_para; | ||
160 | __be32 syn_pol; | ||
161 | __be32 thresholds; | ||
162 | __be32 int_status; | ||
163 | __be32 int_mask; | ||
164 | __be32 colorbar[8]; | ||
165 | __be32 filling; | ||
166 | __be32 plut; | ||
167 | } __attribute__ ((packed)); | ||
168 | |||
169 | struct diu_hw { | ||
170 | struct diu *diu_reg; | ||
171 | spinlock_t reg_lock; | ||
172 | |||
173 | __u32 mode; /* DIU operation mode */ | ||
174 | }; | ||
175 | |||
176 | struct diu_addr { | ||
177 | __u8 __iomem *vaddr; /* Virtual address */ | ||
178 | dma_addr_t paddr; /* Physical address */ | ||
179 | __u32 offset; | ||
180 | }; | ||
181 | |||
182 | struct diu_pool { | ||
183 | struct diu_addr ad; | ||
184 | struct diu_addr gamma; | ||
185 | struct diu_addr pallete; | ||
186 | struct diu_addr cursor; | ||
187 | }; | ||
188 | |||
189 | #define FSL_DIU_BASE_OFFSET 0x2C000 /* Offset of DIU */ | ||
190 | #define INT_LCDC 64 /* DIU interrupt number */ | ||
191 | |||
192 | #define FSL_AOI_NUM 6 /* 5 AOIs and one dummy AOI */ | ||
193 | /* 1 for plane 0, 2 for plane 1&2 each */ | ||
194 | |||
195 | /* Minimum X and Y resolutions */ | ||
196 | #define MIN_XRES 64 | ||
197 | #define MIN_YRES 64 | ||
198 | |||
199 | /* HW cursor parameters */ | ||
200 | #define MAX_CURS 32 | ||
201 | |||
202 | /* Modes of operation of DIU */ | ||
203 | #define MFB_MODE0 0 /* DIU off */ | ||
204 | #define MFB_MODE1 1 /* All three planes output to display */ | ||
205 | #define MFB_MODE2 2 /* Plane 1 to display, planes 2+3 written back*/ | ||
206 | #define MFB_MODE3 3 /* All three planes written back to memory */ | ||
207 | #define MFB_MODE4 4 /* Color bar generation */ | ||
208 | |||
209 | /* INT_STATUS/INT_MASK field descriptions */ | ||
210 | #define INT_VSYNC 0x01 /* Vsync interrupt */ | ||
211 | #define INT_VSYNC_WB 0x02 /* Vsync interrupt for write back operation */ | ||
212 | #define INT_UNDRUN 0x04 /* Under run exception interrupt */ | ||
213 | #define INT_PARERR 0x08 /* Display parameters error interrupt */ | ||
214 | #define INT_LS_BF_VS 0x10 /* Lines before vsync. interrupt */ | ||
215 | |||
216 | /* Panels'operation modes */ | ||
217 | #define MFB_TYPE_OUTPUT 0 /* Panel output to display */ | ||
218 | #define MFB_TYPE_OFF 1 /* Panel off */ | ||
219 | #define MFB_TYPE_WB 2 /* Panel written back to memory */ | ||
220 | #define MFB_TYPE_TEST 3 /* Panel generate color bar */ | ||
221 | |||
222 | #endif /* __KERNEL__ */ | ||
223 | #endif /* __FSL_DIU_FB_H__ */ | ||
diff --git a/drivers/video/geode/Kconfig b/drivers/video/geode/Kconfig index 7608429b3943..c5d8ba4b9fc3 100644 --- a/drivers/video/geode/Kconfig +++ b/drivers/video/geode/Kconfig | |||
@@ -38,26 +38,6 @@ config FB_GEODE_GX | |||
38 | 38 | ||
39 | If unsure, say N. | 39 | If unsure, say N. |
40 | 40 | ||
41 | config FB_GEODE_GX_SET_FBSIZE | ||
42 | bool "Manually specify the Geode GX framebuffer size" | ||
43 | depends on FB_GEODE_GX | ||
44 | default n | ||
45 | ---help--- | ||
46 | If you want to manually specify the size of your GX framebuffer, | ||
47 | say Y here, otherwise say N to dynamically probe it. | ||
48 | |||
49 | Say N unless you know what you are doing. | ||
50 | |||
51 | config FB_GEODE_GX_FBSIZE | ||
52 | hex "Size of the GX framebuffer, in bytes" | ||
53 | depends on FB_GEODE_GX_SET_FBSIZE | ||
54 | default "0x1600000" | ||
55 | ---help--- | ||
56 | Specify the size of the GX framebuffer. Normally, you will | ||
57 | want this to be MB aligned. Common values are 0x80000 (8MB) | ||
58 | and 0x1600000 (16MB). Don't change this unless you know what | ||
59 | you are doing | ||
60 | |||
61 | config FB_GEODE_GX1 | 41 | config FB_GEODE_GX1 |
62 | tristate "AMD Geode GX1 framebuffer support (EXPERIMENTAL)" | 42 | tristate "AMD Geode GX1 framebuffer support (EXPERIMENTAL)" |
63 | depends on FB && FB_GEODE && EXPERIMENTAL | 43 | depends on FB && FB_GEODE && EXPERIMENTAL |
diff --git a/drivers/video/geode/Makefile b/drivers/video/geode/Makefile index 957304b45fba..5c98da126883 100644 --- a/drivers/video/geode/Makefile +++ b/drivers/video/geode/Makefile | |||
@@ -5,5 +5,5 @@ obj-$(CONFIG_FB_GEODE_GX) += gxfb.o | |||
5 | obj-$(CONFIG_FB_GEODE_LX) += lxfb.o | 5 | obj-$(CONFIG_FB_GEODE_LX) += lxfb.o |
6 | 6 | ||
7 | gx1fb-objs := gx1fb_core.o display_gx1.o video_cs5530.o | 7 | gx1fb-objs := gx1fb_core.o display_gx1.o video_cs5530.o |
8 | gxfb-objs := gxfb_core.o display_gx.o video_gx.o | 8 | gxfb-objs := gxfb_core.o display_gx.o video_gx.o suspend_gx.o |
9 | lxfb-objs := lxfb_core.o lxfb_ops.o | 9 | lxfb-objs := lxfb_core.o lxfb_ops.o |
diff --git a/drivers/video/geode/display_gx.c b/drivers/video/geode/display_gx.c index 0f16e4bffc6c..e759895bf3d3 100644 --- a/drivers/video/geode/display_gx.c +++ b/drivers/video/geode/display_gx.c | |||
@@ -17,31 +17,40 @@ | |||
17 | #include <asm/io.h> | 17 | #include <asm/io.h> |
18 | #include <asm/div64.h> | 18 | #include <asm/div64.h> |
19 | #include <asm/delay.h> | 19 | #include <asm/delay.h> |
20 | #include <asm/geode.h> | ||
20 | 21 | ||
21 | #include "geodefb.h" | 22 | #include "gxfb.h" |
22 | #include "display_gx.h" | ||
23 | 23 | ||
24 | #ifdef CONFIG_FB_GEODE_GX_SET_FBSIZE | ||
25 | unsigned int gx_frame_buffer_size(void) | ||
26 | { | ||
27 | return CONFIG_FB_GEODE_GX_FBSIZE; | ||
28 | } | ||
29 | #else | ||
30 | unsigned int gx_frame_buffer_size(void) | 24 | unsigned int gx_frame_buffer_size(void) |
31 | { | 25 | { |
32 | unsigned int val; | 26 | unsigned int val; |
33 | 27 | ||
34 | /* FB size is reported by a virtual register */ | 28 | if (!geode_has_vsa2()) { |
29 | uint32_t hi, lo; | ||
30 | |||
31 | /* The number of pages is (PMAX - PMIN)+1 */ | ||
32 | rdmsr(MSR_GLIU_P2D_RO0, lo, hi); | ||
33 | |||
34 | /* PMAX */ | ||
35 | val = ((hi & 0xff) << 12) | ((lo & 0xfff00000) >> 20); | ||
36 | /* PMIN */ | ||
37 | val -= (lo & 0x000fffff); | ||
38 | val += 1; | ||
39 | |||
40 | /* The page size is 4k */ | ||
41 | return (val << 12); | ||
42 | } | ||
43 | |||
44 | /* FB size can be obtained from the VSA II */ | ||
35 | /* Virtual register class = 0x02 */ | 45 | /* Virtual register class = 0x02 */ |
36 | /* VG_MEM_SIZE(512Kb units) = 0x00 */ | 46 | /* VG_MEM_SIZE(512Kb units) = 0x00 */ |
37 | 47 | ||
38 | outw(0xFC53, 0xAC1C); | 48 | outw(VSA_VR_UNLOCK, VSA_VRC_INDEX); |
39 | outw(0x0200, 0xAC1C); | 49 | outw(VSA_VR_MEM_SIZE, VSA_VRC_INDEX); |
40 | 50 | ||
41 | val = (unsigned int)(inw(0xAC1E)) & 0xFFl; | 51 | val = (unsigned int)(inw(VSA_VRC_DATA)) & 0xFFl; |
42 | return (val << 19); | 52 | return (val << 19); |
43 | } | 53 | } |
44 | #endif | ||
45 | 54 | ||
46 | int gx_line_delta(int xres, int bpp) | 55 | int gx_line_delta(int xres, int bpp) |
47 | { | 56 | { |
@@ -49,75 +58,76 @@ int gx_line_delta(int xres, int bpp) | |||
49 | return (xres * (bpp >> 3) + 7) & ~0x7; | 58 | return (xres * (bpp >> 3) + 7) & ~0x7; |
50 | } | 59 | } |
51 | 60 | ||
52 | static void gx_set_mode(struct fb_info *info) | 61 | void gx_set_mode(struct fb_info *info) |
53 | { | 62 | { |
54 | struct geodefb_par *par = info->par; | 63 | struct gxfb_par *par = info->par; |
55 | u32 gcfg, dcfg; | 64 | u32 gcfg, dcfg; |
56 | int hactive, hblankstart, hsyncstart, hsyncend, hblankend, htotal; | 65 | int hactive, hblankstart, hsyncstart, hsyncend, hblankend, htotal; |
57 | int vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal; | 66 | int vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal; |
58 | 67 | ||
59 | /* Unlock the display controller registers. */ | 68 | /* Unlock the display controller registers. */ |
60 | readl(par->dc_regs + DC_UNLOCK); | 69 | write_dc(par, DC_UNLOCK, DC_UNLOCK_UNLOCK); |
61 | writel(DC_UNLOCK_CODE, par->dc_regs + DC_UNLOCK); | ||
62 | 70 | ||
63 | gcfg = readl(par->dc_regs + DC_GENERAL_CFG); | 71 | gcfg = read_dc(par, DC_GENERAL_CFG); |
64 | dcfg = readl(par->dc_regs + DC_DISPLAY_CFG); | 72 | dcfg = read_dc(par, DC_DISPLAY_CFG); |
65 | 73 | ||
66 | /* Disable the timing generator. */ | 74 | /* Disable the timing generator. */ |
67 | dcfg &= ~(DC_DCFG_TGEN); | 75 | dcfg &= ~DC_DISPLAY_CFG_TGEN; |
68 | writel(dcfg, par->dc_regs + DC_DISPLAY_CFG); | 76 | write_dc(par, DC_DISPLAY_CFG, dcfg); |
69 | 77 | ||
70 | /* Wait for pending memory requests before disabling the FIFO load. */ | 78 | /* Wait for pending memory requests before disabling the FIFO load. */ |
71 | udelay(100); | 79 | udelay(100); |
72 | 80 | ||
73 | /* Disable FIFO load and compression. */ | 81 | /* Disable FIFO load and compression. */ |
74 | gcfg &= ~(DC_GCFG_DFLE | DC_GCFG_CMPE | DC_GCFG_DECE); | 82 | gcfg &= ~(DC_GENERAL_CFG_DFLE | DC_GENERAL_CFG_CMPE | |
75 | writel(gcfg, par->dc_regs + DC_GENERAL_CFG); | 83 | DC_GENERAL_CFG_DECE); |
84 | write_dc(par, DC_GENERAL_CFG, gcfg); | ||
76 | 85 | ||
77 | /* Setup DCLK and its divisor. */ | 86 | /* Setup DCLK and its divisor. */ |
78 | par->vid_ops->set_dclk(info); | 87 | gx_set_dclk_frequency(info); |
79 | 88 | ||
80 | /* | 89 | /* |
81 | * Setup new mode. | 90 | * Setup new mode. |
82 | */ | 91 | */ |
83 | 92 | ||
84 | /* Clear all unused feature bits. */ | 93 | /* Clear all unused feature bits. */ |
85 | gcfg &= DC_GCFG_YUVM | DC_GCFG_VDSE; | 94 | gcfg &= DC_GENERAL_CFG_YUVM | DC_GENERAL_CFG_VDSE; |
86 | dcfg = 0; | 95 | dcfg = 0; |
87 | 96 | ||
88 | /* Set FIFO priority (default 6/5) and enable. */ | 97 | /* Set FIFO priority (default 6/5) and enable. */ |
89 | /* FIXME: increase fifo priority for 1280x1024 and higher modes? */ | 98 | /* FIXME: increase fifo priority for 1280x1024 and higher modes? */ |
90 | gcfg |= (6 << DC_GCFG_DFHPEL_POS) | (5 << DC_GCFG_DFHPSL_POS) | DC_GCFG_DFLE; | 99 | gcfg |= (6 << DC_GENERAL_CFG_DFHPEL_SHIFT) | |
100 | (5 << DC_GENERAL_CFG_DFHPSL_SHIFT) | DC_GENERAL_CFG_DFLE; | ||
91 | 101 | ||
92 | /* Framebuffer start offset. */ | 102 | /* Framebuffer start offset. */ |
93 | writel(0, par->dc_regs + DC_FB_ST_OFFSET); | 103 | write_dc(par, DC_FB_ST_OFFSET, 0); |
94 | 104 | ||
95 | /* Line delta and line buffer length. */ | 105 | /* Line delta and line buffer length. */ |
96 | writel(info->fix.line_length >> 3, par->dc_regs + DC_GFX_PITCH); | 106 | write_dc(par, DC_GFX_PITCH, info->fix.line_length >> 3); |
97 | writel(((info->var.xres * info->var.bits_per_pixel/8) >> 3) + 2, | 107 | write_dc(par, DC_LINE_SIZE, |
98 | par->dc_regs + DC_LINE_SIZE); | 108 | ((info->var.xres * info->var.bits_per_pixel/8) >> 3) + 2); |
99 | 109 | ||
100 | 110 | ||
101 | /* Enable graphics and video data and unmask address lines. */ | 111 | /* Enable graphics and video data and unmask address lines. */ |
102 | dcfg |= DC_DCFG_GDEN | DC_DCFG_VDEN | DC_DCFG_A20M | DC_DCFG_A18M; | 112 | dcfg |= DC_DISPLAY_CFG_GDEN | DC_DISPLAY_CFG_VDEN | |
113 | DC_DISPLAY_CFG_A20M | DC_DISPLAY_CFG_A18M; | ||
103 | 114 | ||
104 | /* Set pixel format. */ | 115 | /* Set pixel format. */ |
105 | switch (info->var.bits_per_pixel) { | 116 | switch (info->var.bits_per_pixel) { |
106 | case 8: | 117 | case 8: |
107 | dcfg |= DC_DCFG_DISP_MODE_8BPP; | 118 | dcfg |= DC_DISPLAY_CFG_DISP_MODE_8BPP; |
108 | break; | 119 | break; |
109 | case 16: | 120 | case 16: |
110 | dcfg |= DC_DCFG_DISP_MODE_16BPP; | 121 | dcfg |= DC_DISPLAY_CFG_DISP_MODE_16BPP; |
111 | dcfg |= DC_DCFG_16BPP_MODE_565; | ||
112 | break; | 122 | break; |
113 | case 32: | 123 | case 32: |
114 | dcfg |= DC_DCFG_DISP_MODE_24BPP; | 124 | dcfg |= DC_DISPLAY_CFG_DISP_MODE_24BPP; |
115 | dcfg |= DC_DCFG_PALB; | 125 | dcfg |= DC_DISPLAY_CFG_PALB; |
116 | break; | 126 | break; |
117 | } | 127 | } |
118 | 128 | ||
119 | /* Enable timing generator. */ | 129 | /* Enable timing generator. */ |
120 | dcfg |= DC_DCFG_TGEN; | 130 | dcfg |= DC_DISPLAY_CFG_TGEN; |
121 | 131 | ||
122 | /* Horizontal and vertical timings. */ | 132 | /* Horizontal and vertical timings. */ |
123 | hactive = info->var.xres; | 133 | hactive = info->var.xres; |
@@ -134,28 +144,34 @@ static void gx_set_mode(struct fb_info *info) | |||
134 | vblankend = vsyncend + info->var.upper_margin; | 144 | vblankend = vsyncend + info->var.upper_margin; |
135 | vtotal = vblankend; | 145 | vtotal = vblankend; |
136 | 146 | ||
137 | writel((hactive - 1) | ((htotal - 1) << 16), par->dc_regs + DC_H_ACTIVE_TIMING); | 147 | write_dc(par, DC_H_ACTIVE_TIMING, (hactive - 1) | |
138 | writel((hblankstart - 1) | ((hblankend - 1) << 16), par->dc_regs + DC_H_BLANK_TIMING); | 148 | ((htotal - 1) << 16)); |
139 | writel((hsyncstart - 1) | ((hsyncend - 1) << 16), par->dc_regs + DC_H_SYNC_TIMING); | 149 | write_dc(par, DC_H_BLANK_TIMING, (hblankstart - 1) | |
150 | ((hblankend - 1) << 16)); | ||
151 | write_dc(par, DC_H_SYNC_TIMING, (hsyncstart - 1) | | ||
152 | ((hsyncend - 1) << 16)); | ||
140 | 153 | ||
141 | writel((vactive - 1) | ((vtotal - 1) << 16), par->dc_regs + DC_V_ACTIVE_TIMING); | 154 | write_dc(par, DC_V_ACTIVE_TIMING, (vactive - 1) | |
142 | writel((vblankstart - 1) | ((vblankend - 1) << 16), par->dc_regs + DC_V_BLANK_TIMING); | 155 | ((vtotal - 1) << 16)); |
143 | writel((vsyncstart - 1) | ((vsyncend - 1) << 16), par->dc_regs + DC_V_SYNC_TIMING); | 156 | write_dc(par, DC_V_BLANK_TIMING, (vblankstart - 1) | |
157 | ((vblankend - 1) << 16)); | ||
158 | write_dc(par, DC_V_SYNC_TIMING, (vsyncstart - 1) | | ||
159 | ((vsyncend - 1) << 16)); | ||
144 | 160 | ||
145 | /* Write final register values. */ | 161 | /* Write final register values. */ |
146 | writel(dcfg, par->dc_regs + DC_DISPLAY_CFG); | 162 | write_dc(par, DC_DISPLAY_CFG, dcfg); |
147 | writel(gcfg, par->dc_regs + DC_GENERAL_CFG); | 163 | write_dc(par, DC_GENERAL_CFG, gcfg); |
148 | 164 | ||
149 | par->vid_ops->configure_display(info); | 165 | gx_configure_display(info); |
150 | 166 | ||
151 | /* Relock display controller registers */ | 167 | /* Relock display controller registers */ |
152 | writel(0, par->dc_regs + DC_UNLOCK); | 168 | write_dc(par, DC_UNLOCK, DC_UNLOCK_LOCK); |
153 | } | 169 | } |
154 | 170 | ||
155 | static void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno, | 171 | void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno, |
156 | unsigned red, unsigned green, unsigned blue) | 172 | unsigned red, unsigned green, unsigned blue) |
157 | { | 173 | { |
158 | struct geodefb_par *par = info->par; | 174 | struct gxfb_par *par = info->par; |
159 | int val; | 175 | int val; |
160 | 176 | ||
161 | /* Hardware palette is in RGB 8-8-8 format. */ | 177 | /* Hardware palette is in RGB 8-8-8 format. */ |
@@ -163,11 +179,6 @@ static void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno, | |||
163 | val |= (green) & 0x00ff00; | 179 | val |= (green) & 0x00ff00; |
164 | val |= (blue >> 8) & 0x0000ff; | 180 | val |= (blue >> 8) & 0x0000ff; |
165 | 181 | ||
166 | writel(regno, par->dc_regs + DC_PAL_ADDRESS); | 182 | write_dc(par, DC_PAL_ADDRESS, regno); |
167 | writel(val, par->dc_regs + DC_PAL_DATA); | 183 | write_dc(par, DC_PAL_DATA, val); |
168 | } | 184 | } |
169 | |||
170 | struct geode_dc_ops gx_dc_ops = { | ||
171 | .set_mode = gx_set_mode, | ||
172 | .set_palette_reg = gx_set_hw_palette_reg, | ||
173 | }; | ||
diff --git a/drivers/video/geode/display_gx.h b/drivers/video/geode/display_gx.h deleted file mode 100644 index 0af33f329e88..000000000000 --- a/drivers/video/geode/display_gx.h +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | /* | ||
2 | * Geode GX display controller | ||
3 | * | ||
4 | * Copyright (C) 2006 Arcom Control Systems Ltd. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | #ifndef __DISPLAY_GX_H__ | ||
12 | #define __DISPLAY_GX_H__ | ||
13 | |||
14 | unsigned int gx_frame_buffer_size(void); | ||
15 | int gx_line_delta(int xres, int bpp); | ||
16 | |||
17 | extern struct geode_dc_ops gx_dc_ops; | ||
18 | |||
19 | /* MSR that tells us if a TFT or CRT is attached */ | ||
20 | #define GLD_MSR_CONFIG 0xC0002001 | ||
21 | #define GLD_MSR_CONFIG_DM_FP 0x40 | ||
22 | |||
23 | /* Display controller registers */ | ||
24 | |||
25 | #define DC_UNLOCK 0x00 | ||
26 | # define DC_UNLOCK_CODE 0x00004758 | ||
27 | |||
28 | #define DC_GENERAL_CFG 0x04 | ||
29 | # define DC_GCFG_DFLE 0x00000001 | ||
30 | # define DC_GCFG_CURE 0x00000002 | ||
31 | # define DC_GCFG_ICNE 0x00000004 | ||
32 | # define DC_GCFG_VIDE 0x00000008 | ||
33 | # define DC_GCFG_CMPE 0x00000020 | ||
34 | # define DC_GCFG_DECE 0x00000040 | ||
35 | # define DC_GCFG_VGAE 0x00000080 | ||
36 | # define DC_GCFG_DFHPSL_MASK 0x00000F00 | ||
37 | # define DC_GCFG_DFHPSL_POS 8 | ||
38 | # define DC_GCFG_DFHPEL_MASK 0x0000F000 | ||
39 | # define DC_GCFG_DFHPEL_POS 12 | ||
40 | # define DC_GCFG_STFM 0x00010000 | ||
41 | # define DC_GCFG_FDTY 0x00020000 | ||
42 | # define DC_GCFG_VGAFT 0x00040000 | ||
43 | # define DC_GCFG_VDSE 0x00080000 | ||
44 | # define DC_GCFG_YUVM 0x00100000 | ||
45 | # define DC_GCFG_VFSL 0x00800000 | ||
46 | # define DC_GCFG_SIGE 0x01000000 | ||
47 | # define DC_GCFG_SGRE 0x02000000 | ||
48 | # define DC_GCFG_SGFR 0x04000000 | ||
49 | # define DC_GCFG_CRC_MODE 0x08000000 | ||
50 | # define DC_GCFG_DIAG 0x10000000 | ||
51 | # define DC_GCFG_CFRW 0x20000000 | ||
52 | |||
53 | #define DC_DISPLAY_CFG 0x08 | ||
54 | # define DC_DCFG_TGEN 0x00000001 | ||
55 | # define DC_DCFG_GDEN 0x00000008 | ||
56 | # define DC_DCFG_VDEN 0x00000010 | ||
57 | # define DC_DCFG_TRUP 0x00000040 | ||
58 | # define DC_DCFG_DISP_MODE_MASK 0x00000300 | ||
59 | # define DC_DCFG_DISP_MODE_8BPP 0x00000000 | ||
60 | # define DC_DCFG_DISP_MODE_16BPP 0x00000100 | ||
61 | # define DC_DCFG_DISP_MODE_24BPP 0x00000200 | ||
62 | # define DC_DCFG_16BPP_MODE_MASK 0x00000c00 | ||
63 | # define DC_DCFG_16BPP_MODE_565 0x00000000 | ||
64 | # define DC_DCFG_16BPP_MODE_555 0x00000100 | ||
65 | # define DC_DCFG_16BPP_MODE_444 0x00000200 | ||
66 | # define DC_DCFG_DCEN 0x00080000 | ||
67 | # define DC_DCFG_PALB 0x02000000 | ||
68 | # define DC_DCFG_FRLK 0x04000000 | ||
69 | # define DC_DCFG_VISL 0x08000000 | ||
70 | # define DC_DCFG_FRSL 0x20000000 | ||
71 | # define DC_DCFG_A18M 0x40000000 | ||
72 | # define DC_DCFG_A20M 0x80000000 | ||
73 | |||
74 | #define DC_FB_ST_OFFSET 0x10 | ||
75 | |||
76 | #define DC_LINE_SIZE 0x30 | ||
77 | # define DC_LINE_SIZE_FB_LINE_SIZE_MASK 0x000007ff | ||
78 | # define DC_LINE_SIZE_FB_LINE_SIZE_POS 0 | ||
79 | # define DC_LINE_SIZE_CB_LINE_SIZE_MASK 0x007f0000 | ||
80 | # define DC_LINE_SIZE_CB_LINE_SIZE_POS 16 | ||
81 | # define DC_LINE_SIZE_VID_LINE_SIZE_MASK 0xff000000 | ||
82 | # define DC_LINE_SIZE_VID_LINE_SIZE_POS 24 | ||
83 | |||
84 | #define DC_GFX_PITCH 0x34 | ||
85 | # define DC_GFX_PITCH_FB_PITCH_MASK 0x0000ffff | ||
86 | # define DC_GFX_PITCH_FB_PITCH_POS 0 | ||
87 | # define DC_GFX_PITCH_CB_PITCH_MASK 0xffff0000 | ||
88 | # define DC_GFX_PITCH_CB_PITCH_POS 16 | ||
89 | |||
90 | #define DC_H_ACTIVE_TIMING 0x40 | ||
91 | #define DC_H_BLANK_TIMING 0x44 | ||
92 | #define DC_H_SYNC_TIMING 0x48 | ||
93 | #define DC_V_ACTIVE_TIMING 0x50 | ||
94 | #define DC_V_BLANK_TIMING 0x54 | ||
95 | #define DC_V_SYNC_TIMING 0x58 | ||
96 | |||
97 | #define DC_PAL_ADDRESS 0x70 | ||
98 | #define DC_PAL_DATA 0x74 | ||
99 | |||
100 | #define DC_GLIU0_MEM_OFFSET 0x84 | ||
101 | #endif /* !__DISPLAY_GX1_H__ */ | ||
diff --git a/drivers/video/geode/gxfb.h b/drivers/video/geode/gxfb.h new file mode 100644 index 000000000000..16a96f8fd8c5 --- /dev/null +++ b/drivers/video/geode/gxfb.h | |||
@@ -0,0 +1,358 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008 Andres Salomon <dilinger@debian.org> | ||
3 | * | ||
4 | * Geode GX2 header information | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | #ifndef _GXFB_H_ | ||
12 | #define _GXFB_H_ | ||
13 | |||
14 | #include <linux/io.h> | ||
15 | |||
16 | #define GP_REG_COUNT (0x50 / 4) | ||
17 | #define DC_REG_COUNT (0x90 / 4) | ||
18 | #define VP_REG_COUNT (0x138 / 8) | ||
19 | #define FP_REG_COUNT (0x68 / 8) | ||
20 | |||
21 | #define DC_PAL_COUNT 0x104 | ||
22 | |||
23 | struct gxfb_par { | ||
24 | int enable_crt; | ||
25 | void __iomem *dc_regs; | ||
26 | void __iomem *vid_regs; | ||
27 | void __iomem *gp_regs; | ||
28 | #ifdef CONFIG_PM | ||
29 | int powered_down; | ||
30 | |||
31 | /* register state, for power management functionality */ | ||
32 | struct { | ||
33 | uint64_t padsel; | ||
34 | uint64_t dotpll; | ||
35 | } msr; | ||
36 | |||
37 | uint32_t gp[GP_REG_COUNT]; | ||
38 | uint32_t dc[DC_REG_COUNT]; | ||
39 | uint64_t vp[VP_REG_COUNT]; | ||
40 | uint64_t fp[FP_REG_COUNT]; | ||
41 | |||
42 | uint32_t pal[DC_PAL_COUNT]; | ||
43 | #endif | ||
44 | }; | ||
45 | |||
46 | unsigned int gx_frame_buffer_size(void); | ||
47 | int gx_line_delta(int xres, int bpp); | ||
48 | void gx_set_mode(struct fb_info *info); | ||
49 | void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno, | ||
50 | unsigned red, unsigned green, unsigned blue); | ||
51 | |||
52 | void gx_set_dclk_frequency(struct fb_info *info); | ||
53 | void gx_configure_display(struct fb_info *info); | ||
54 | int gx_blank_display(struct fb_info *info, int blank_mode); | ||
55 | |||
56 | #ifdef CONFIG_PM | ||
57 | int gx_powerdown(struct fb_info *info); | ||
58 | int gx_powerup(struct fb_info *info); | ||
59 | #endif | ||
60 | |||
61 | |||
62 | /* Graphics Processor registers (table 6-23 from the data book) */ | ||
63 | enum gp_registers { | ||
64 | GP_DST_OFFSET = 0, | ||
65 | GP_SRC_OFFSET, | ||
66 | GP_STRIDE, | ||
67 | GP_WID_HEIGHT, | ||
68 | |||
69 | GP_SRC_COLOR_FG, | ||
70 | GP_SRC_COLOR_BG, | ||
71 | GP_PAT_COLOR_0, | ||
72 | GP_PAT_COLOR_1, | ||
73 | |||
74 | GP_PAT_COLOR_2, | ||
75 | GP_PAT_COLOR_3, | ||
76 | GP_PAT_COLOR_4, | ||
77 | GP_PAT_COLOR_5, | ||
78 | |||
79 | GP_PAT_DATA_0, | ||
80 | GP_PAT_DATA_1, | ||
81 | GP_RASTER_MODE, | ||
82 | GP_VECTOR_MODE, | ||
83 | |||
84 | GP_BLT_MODE, | ||
85 | GP_BLT_STATUS, | ||
86 | GP_HST_SRC, | ||
87 | GP_BASE_OFFSET, /* 0x4c */ | ||
88 | }; | ||
89 | |||
90 | #define GP_BLT_STATUS_BLT_PENDING (1 << 2) | ||
91 | #define GP_BLT_STATUS_BLT_BUSY (1 << 0) | ||
92 | |||
93 | |||
94 | /* Display Controller registers (table 6-38 from the data book) */ | ||
95 | enum dc_registers { | ||
96 | DC_UNLOCK = 0, | ||
97 | DC_GENERAL_CFG, | ||
98 | DC_DISPLAY_CFG, | ||
99 | DC_RSVD_0, | ||
100 | |||
101 | DC_FB_ST_OFFSET, | ||
102 | DC_CB_ST_OFFSET, | ||
103 | DC_CURS_ST_OFFSET, | ||
104 | DC_ICON_ST_OFFSET, | ||
105 | |||
106 | DC_VID_Y_ST_OFFSET, | ||
107 | DC_VID_U_ST_OFFSET, | ||
108 | DC_VID_V_ST_OFFSET, | ||
109 | DC_RSVD_1, | ||
110 | |||
111 | DC_LINE_SIZE, | ||
112 | DC_GFX_PITCH, | ||
113 | DC_VID_YUV_PITCH, | ||
114 | DC_RSVD_2, | ||
115 | |||
116 | DC_H_ACTIVE_TIMING, | ||
117 | DC_H_BLANK_TIMING, | ||
118 | DC_H_SYNC_TIMING, | ||
119 | DC_RSVD_3, | ||
120 | |||
121 | DC_V_ACTIVE_TIMING, | ||
122 | DC_V_BLANK_TIMING, | ||
123 | DC_V_SYNC_TIMING, | ||
124 | DC_RSVD_4, | ||
125 | |||
126 | DC_CURSOR_X, | ||
127 | DC_CURSOR_Y, | ||
128 | DC_ICON_X, | ||
129 | DC_LINE_CNT, | ||
130 | |||
131 | DC_PAL_ADDRESS, | ||
132 | DC_PAL_DATA, | ||
133 | DC_DFIFO_DIAG, | ||
134 | DC_CFIFO_DIAG, | ||
135 | |||
136 | DC_VID_DS_DELTA, | ||
137 | DC_GLIU0_MEM_OFFSET, | ||
138 | DC_RSVD_5, | ||
139 | DC_DV_ACC, /* 0x8c */ | ||
140 | }; | ||
141 | |||
142 | #define DC_UNLOCK_LOCK 0x00000000 | ||
143 | #define DC_UNLOCK_UNLOCK 0x00004758 /* magic value */ | ||
144 | |||
145 | #define DC_GENERAL_CFG_YUVM (1 << 20) | ||
146 | #define DC_GENERAL_CFG_VDSE (1 << 19) | ||
147 | #define DC_GENERAL_CFG_DFHPEL_SHIFT 12 | ||
148 | #define DC_GENERAL_CFG_DFHPSL_SHIFT 8 | ||
149 | #define DC_GENERAL_CFG_DECE (1 << 6) | ||
150 | #define DC_GENERAL_CFG_CMPE (1 << 5) | ||
151 | #define DC_GENERAL_CFG_VIDE (1 << 3) | ||
152 | #define DC_GENERAL_CFG_ICNE (1 << 2) | ||
153 | #define DC_GENERAL_CFG_CURE (1 << 1) | ||
154 | #define DC_GENERAL_CFG_DFLE (1 << 0) | ||
155 | |||
156 | #define DC_DISPLAY_CFG_A20M (1 << 31) | ||
157 | #define DC_DISPLAY_CFG_A18M (1 << 30) | ||
158 | #define DC_DISPLAY_CFG_PALB (1 << 25) | ||
159 | #define DC_DISPLAY_CFG_DISP_MODE_24BPP (1 << 9) | ||
160 | #define DC_DISPLAY_CFG_DISP_MODE_16BPP (1 << 8) | ||
161 | #define DC_DISPLAY_CFG_DISP_MODE_8BPP (0) | ||
162 | #define DC_DISPLAY_CFG_VDEN (1 << 4) | ||
163 | #define DC_DISPLAY_CFG_GDEN (1 << 3) | ||
164 | #define DC_DISPLAY_CFG_TGEN (1 << 0) | ||
165 | |||
166 | |||
167 | /* | ||
168 | * Video Processor registers (table 6-54). | ||
169 | * There is space for 64 bit values, but we never use more than the | ||
170 | * lower 32 bits. The actual register save/restore code only bothers | ||
171 | * to restore those 32 bits. | ||
172 | */ | ||
173 | enum vp_registers { | ||
174 | VP_VCFG = 0, | ||
175 | VP_DCFG, | ||
176 | |||
177 | VP_VX, | ||
178 | VP_VY, | ||
179 | |||
180 | VP_VS, | ||
181 | VP_VCK, | ||
182 | |||
183 | VP_VCM, | ||
184 | VP_GAR, | ||
185 | |||
186 | VP_GDR, | ||
187 | VP_RSVD_0, | ||
188 | |||
189 | VP_MISC, | ||
190 | VP_CCS, | ||
191 | |||
192 | VP_RSVD_1, | ||
193 | VP_RSVD_2, | ||
194 | |||
195 | VP_RSVD_3, | ||
196 | VP_VDC, | ||
197 | |||
198 | VP_VCO, | ||
199 | VP_CRC, | ||
200 | |||
201 | VP_CRC32, | ||
202 | VP_VDE, | ||
203 | |||
204 | VP_CCK, | ||
205 | VP_CCM, | ||
206 | |||
207 | VP_CC1, | ||
208 | VP_CC2, | ||
209 | |||
210 | VP_A1X, | ||
211 | VP_A1Y, | ||
212 | |||
213 | VP_A1C, | ||
214 | VP_A1T, | ||
215 | |||
216 | VP_A2X, | ||
217 | VP_A2Y, | ||
218 | |||
219 | VP_A2C, | ||
220 | VP_A2T, | ||
221 | |||
222 | VP_A3X, | ||
223 | VP_A3Y, | ||
224 | |||
225 | VP_A3C, | ||
226 | VP_A3T, | ||
227 | |||
228 | VP_VRR, | ||
229 | VP_AWT, | ||
230 | |||
231 | VP_VTM, /* 0x130 */ | ||
232 | }; | ||
233 | |||
234 | #define VP_VCFG_VID_EN (1 << 0) | ||
235 | |||
236 | #define VP_DCFG_DAC_VREF (1 << 26) | ||
237 | #define VP_DCFG_GV_GAM (1 << 21) | ||
238 | #define VP_DCFG_VG_CK (1 << 20) | ||
239 | #define VP_DCFG_CRT_SYNC_SKW_DEFAULT (1 << 16) | ||
240 | #define VP_DCFG_CRT_SYNC_SKW ((1 << 14) | (1 << 15) | (1 << 16)) | ||
241 | #define VP_DCFG_CRT_VSYNC_POL (1 << 9) | ||
242 | #define VP_DCFG_CRT_HSYNC_POL (1 << 8) | ||
243 | #define VP_DCFG_FP_DATA_EN (1 << 7) /* undocumented */ | ||
244 | #define VP_DCFG_FP_PWR_EN (1 << 6) /* undocumented */ | ||
245 | #define VP_DCFG_DAC_BL_EN (1 << 3) | ||
246 | #define VP_DCFG_VSYNC_EN (1 << 2) | ||
247 | #define VP_DCFG_HSYNC_EN (1 << 1) | ||
248 | #define VP_DCFG_CRT_EN (1 << 0) | ||
249 | |||
250 | #define VP_MISC_GAM_EN (1 << 0) | ||
251 | #define VP_MISC_DACPWRDN (1 << 10) | ||
252 | #define VP_MISC_APWRDN (1 << 11) | ||
253 | |||
254 | |||
255 | /* | ||
256 | * Flat Panel registers (table 6-55). | ||
257 | * Also 64 bit registers; see above note about 32-bit handling. | ||
258 | */ | ||
259 | |||
260 | /* we're actually in the VP register space, starting at address 0x400 */ | ||
261 | #define VP_FP_START 0x400 | ||
262 | |||
263 | enum fp_registers { | ||
264 | FP_PT1 = 0, | ||
265 | FP_PT2, | ||
266 | |||
267 | FP_PM, | ||
268 | FP_DFC, | ||
269 | |||
270 | FP_BLFSR, | ||
271 | FP_RLFSR, | ||
272 | |||
273 | FP_FMI, | ||
274 | FP_FMD, | ||
275 | |||
276 | FP_RSVD_0, | ||
277 | FP_DCA, | ||
278 | |||
279 | FP_DMD, | ||
280 | FP_CRC, | ||
281 | |||
282 | FP_FBB, /* 0x460 */ | ||
283 | }; | ||
284 | |||
285 | #define FP_PT1_VSIZE_SHIFT 16 /* undocumented? */ | ||
286 | #define FP_PT1_VSIZE_MASK 0x7FF0000 /* undocumented? */ | ||
287 | |||
288 | #define FP_PT2_HSP (1 << 22) | ||
289 | #define FP_PT2_VSP (1 << 23) | ||
290 | |||
291 | #define FP_PM_P (1 << 24) /* panel power on */ | ||
292 | #define FP_PM_PANEL_PWR_UP (1 << 3) /* r/o */ | ||
293 | #define FP_PM_PANEL_PWR_DOWN (1 << 2) /* r/o */ | ||
294 | #define FP_PM_PANEL_OFF (1 << 1) /* r/o */ | ||
295 | #define FP_PM_PANEL_ON (1 << 0) /* r/o */ | ||
296 | |||
297 | #define FP_DFC_NFI ((1 << 4) | (1 << 5) | (1 << 6)) | ||
298 | |||
299 | |||
300 | /* register access functions */ | ||
301 | |||
302 | static inline uint32_t read_gp(struct gxfb_par *par, int reg) | ||
303 | { | ||
304 | return readl(par->gp_regs + 4*reg); | ||
305 | } | ||
306 | |||
307 | static inline void write_gp(struct gxfb_par *par, int reg, uint32_t val) | ||
308 | { | ||
309 | writel(val, par->gp_regs + 4*reg); | ||
310 | } | ||
311 | |||
312 | static inline uint32_t read_dc(struct gxfb_par *par, int reg) | ||
313 | { | ||
314 | return readl(par->dc_regs + 4*reg); | ||
315 | } | ||
316 | |||
317 | static inline void write_dc(struct gxfb_par *par, int reg, uint32_t val) | ||
318 | { | ||
319 | writel(val, par->dc_regs + 4*reg); | ||
320 | } | ||
321 | |||
322 | static inline uint32_t read_vp(struct gxfb_par *par, int reg) | ||
323 | { | ||
324 | return readl(par->vid_regs + 8*reg); | ||
325 | } | ||
326 | |||
327 | static inline void write_vp(struct gxfb_par *par, int reg, uint32_t val) | ||
328 | { | ||
329 | writel(val, par->vid_regs + 8*reg); | ||
330 | } | ||
331 | |||
332 | static inline uint32_t read_fp(struct gxfb_par *par, int reg) | ||
333 | { | ||
334 | return readl(par->vid_regs + 8*reg + VP_FP_START); | ||
335 | } | ||
336 | |||
337 | static inline void write_fp(struct gxfb_par *par, int reg, uint32_t val) | ||
338 | { | ||
339 | writel(val, par->vid_regs + 8*reg + VP_FP_START); | ||
340 | } | ||
341 | |||
342 | |||
343 | /* MSRs are defined in asm/geode.h; their bitfields are here */ | ||
344 | |||
345 | #define MSR_GLCP_SYS_RSTPLL_DOTPOSTDIV3 (1 << 3) | ||
346 | #define MSR_GLCP_SYS_RSTPLL_DOTPREMULT2 (1 << 2) | ||
347 | #define MSR_GLCP_SYS_RSTPLL_DOTPREDIV2 (1 << 1) | ||
348 | |||
349 | #define MSR_GLCP_DOTPLL_LOCK (1 << 25) /* r/o */ | ||
350 | #define MSR_GLCP_DOTPLL_BYPASS (1 << 15) | ||
351 | #define MSR_GLCP_DOTPLL_DOTRESET (1 << 0) | ||
352 | |||
353 | #define MSR_GX_MSR_PADSEL_MASK 0x3FFFFFFF /* undocumented? */ | ||
354 | #define MSR_GX_MSR_PADSEL_TFT 0x1FFFFFFF /* undocumented? */ | ||
355 | |||
356 | #define MSR_GX_GLD_MSR_CONFIG_FP (1 << 3) | ||
357 | |||
358 | #endif | ||
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c index cf841efa229a..de2b8f9876a5 100644 --- a/drivers/video/geode/gxfb_core.c +++ b/drivers/video/geode/gxfb_core.c | |||
@@ -28,17 +28,20 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/fb.h> | 30 | #include <linux/fb.h> |
31 | #include <linux/console.h> | ||
32 | #include <linux/suspend.h> | ||
31 | #include <linux/init.h> | 33 | #include <linux/init.h> |
32 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
35 | #include <asm/geode.h> | ||
33 | 36 | ||
34 | #include "geodefb.h" | 37 | #include "gxfb.h" |
35 | #include "display_gx.h" | ||
36 | #include "video_gx.h" | ||
37 | 38 | ||
38 | static char *mode_option; | 39 | static char *mode_option; |
40 | static int vram; | ||
41 | static int vt_switch; | ||
39 | 42 | ||
40 | /* Modes relevant to the GX (taken from modedb.c) */ | 43 | /* Modes relevant to the GX (taken from modedb.c) */ |
41 | static const struct fb_videomode gx_modedb[] __initdata = { | 44 | static struct fb_videomode gx_modedb[] __initdata = { |
42 | /* 640x480-60 VESA */ | 45 | /* 640x480-60 VESA */ |
43 | { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2, | 46 | { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2, |
44 | 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, | 47 | 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, |
@@ -105,6 +108,35 @@ static const struct fb_videomode gx_modedb[] __initdata = { | |||
105 | FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, | 108 | FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, |
106 | }; | 109 | }; |
107 | 110 | ||
111 | #ifdef CONFIG_OLPC | ||
112 | #include <asm/olpc.h> | ||
113 | |||
114 | static struct fb_videomode gx_dcon_modedb[] __initdata = { | ||
115 | /* The only mode the DCON has is 1200x900 */ | ||
116 | { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3, | ||
117 | FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
118 | FB_VMODE_NONINTERLACED, 0 } | ||
119 | }; | ||
120 | |||
121 | static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) | ||
122 | { | ||
123 | if (olpc_has_dcon()) { | ||
124 | *modedb = (struct fb_videomode *) gx_dcon_modedb; | ||
125 | *size = ARRAY_SIZE(gx_dcon_modedb); | ||
126 | } else { | ||
127 | *modedb = (struct fb_videomode *) gx_modedb; | ||
128 | *size = ARRAY_SIZE(gx_modedb); | ||
129 | } | ||
130 | } | ||
131 | |||
132 | #else | ||
133 | static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) | ||
134 | { | ||
135 | *modedb = (struct fb_videomode *) gx_modedb; | ||
136 | *size = ARRAY_SIZE(gx_modedb); | ||
137 | } | ||
138 | #endif | ||
139 | |||
108 | static int gxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | 140 | static int gxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
109 | { | 141 | { |
110 | if (var->xres > 1600 || var->yres > 1200) | 142 | if (var->xres > 1600 || var->yres > 1200) |
@@ -139,8 +171,6 @@ static int gxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
139 | 171 | ||
140 | static int gxfb_set_par(struct fb_info *info) | 172 | static int gxfb_set_par(struct fb_info *info) |
141 | { | 173 | { |
142 | struct geodefb_par *par = info->par; | ||
143 | |||
144 | if (info->var.bits_per_pixel > 8) { | 174 | if (info->var.bits_per_pixel > 8) { |
145 | info->fix.visual = FB_VISUAL_TRUECOLOR; | 175 | info->fix.visual = FB_VISUAL_TRUECOLOR; |
146 | fb_dealloc_cmap(&info->cmap); | 176 | fb_dealloc_cmap(&info->cmap); |
@@ -151,7 +181,7 @@ static int gxfb_set_par(struct fb_info *info) | |||
151 | 181 | ||
152 | info->fix.line_length = gx_line_delta(info->var.xres, info->var.bits_per_pixel); | 182 | info->fix.line_length = gx_line_delta(info->var.xres, info->var.bits_per_pixel); |
153 | 183 | ||
154 | par->dc_ops->set_mode(info); | 184 | gx_set_mode(info); |
155 | 185 | ||
156 | return 0; | 186 | return 0; |
157 | } | 187 | } |
@@ -167,8 +197,6 @@ static int gxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
167 | unsigned blue, unsigned transp, | 197 | unsigned blue, unsigned transp, |
168 | struct fb_info *info) | 198 | struct fb_info *info) |
169 | { | 199 | { |
170 | struct geodefb_par *par = info->par; | ||
171 | |||
172 | if (info->var.grayscale) { | 200 | if (info->var.grayscale) { |
173 | /* grayscale = 0.30*R + 0.59*G + 0.11*B */ | 201 | /* grayscale = 0.30*R + 0.59*G + 0.11*B */ |
174 | red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; | 202 | red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; |
@@ -191,7 +219,7 @@ static int gxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
191 | if (regno >= 256) | 219 | if (regno >= 256) |
192 | return -EINVAL; | 220 | return -EINVAL; |
193 | 221 | ||
194 | par->dc_ops->set_palette_reg(info, regno, red, green, blue); | 222 | gx_set_hw_palette_reg(info, regno, red, green, blue); |
195 | } | 223 | } |
196 | 224 | ||
197 | return 0; | 225 | return 0; |
@@ -199,15 +227,12 @@ static int gxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
199 | 227 | ||
200 | static int gxfb_blank(int blank_mode, struct fb_info *info) | 228 | static int gxfb_blank(int blank_mode, struct fb_info *info) |
201 | { | 229 | { |
202 | struct geodefb_par *par = info->par; | 230 | return gx_blank_display(info, blank_mode); |
203 | |||
204 | return par->vid_ops->blank_display(info, blank_mode); | ||
205 | } | 231 | } |
206 | 232 | ||
207 | static int __init gxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev) | 233 | static int __init gxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev) |
208 | { | 234 | { |
209 | struct geodefb_par *par = info->par; | 235 | struct gxfb_par *par = info->par; |
210 | int fb_len; | ||
211 | int ret; | 236 | int ret; |
212 | 237 | ||
213 | ret = pci_enable_device(dev); | 238 | ret = pci_enable_device(dev); |
@@ -229,24 +254,31 @@ static int __init gxfb_map_video_memory(struct fb_info *info, struct pci_dev *de | |||
229 | if (!par->dc_regs) | 254 | if (!par->dc_regs) |
230 | return -ENOMEM; | 255 | return -ENOMEM; |
231 | 256 | ||
232 | ret = pci_request_region(dev, 0, "gxfb (framebuffer)"); | 257 | ret = pci_request_region(dev, 1, "gxfb (graphics processor)"); |
233 | if (ret < 0) | 258 | if (ret < 0) |
234 | return ret; | 259 | return ret; |
235 | if ((fb_len = gx_frame_buffer_size()) < 0) | 260 | par->gp_regs = ioremap(pci_resource_start(dev, 1), |
261 | pci_resource_len(dev, 1)); | ||
262 | |||
263 | if (!par->gp_regs) | ||
236 | return -ENOMEM; | 264 | return -ENOMEM; |
265 | |||
266 | ret = pci_request_region(dev, 0, "gxfb (framebuffer)"); | ||
267 | if (ret < 0) | ||
268 | return ret; | ||
269 | |||
237 | info->fix.smem_start = pci_resource_start(dev, 0); | 270 | info->fix.smem_start = pci_resource_start(dev, 0); |
238 | info->fix.smem_len = fb_len; | 271 | info->fix.smem_len = vram ? vram : gx_frame_buffer_size(); |
239 | info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); | 272 | info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); |
240 | if (!info->screen_base) | 273 | if (!info->screen_base) |
241 | return -ENOMEM; | 274 | return -ENOMEM; |
242 | 275 | ||
243 | /* Set the 16MB aligned base address of the graphics memory region | 276 | /* Set the 16MiB aligned base address of the graphics memory region |
244 | * in the display controller */ | 277 | * in the display controller */ |
245 | 278 | ||
246 | writel(info->fix.smem_start & 0xFF000000, | 279 | write_dc(par, DC_GLIU0_MEM_OFFSET, info->fix.smem_start & 0xFF000000); |
247 | par->dc_regs + DC_GLIU0_MEM_OFFSET); | ||
248 | 280 | ||
249 | dev_info(&dev->dev, "%d Kibyte of video memory at 0x%lx\n", | 281 | dev_info(&dev->dev, "%d KiB of video memory at 0x%lx\n", |
250 | info->fix.smem_len / 1024, info->fix.smem_start); | 282 | info->fix.smem_len / 1024, info->fix.smem_start); |
251 | 283 | ||
252 | return 0; | 284 | return 0; |
@@ -266,11 +298,12 @@ static struct fb_ops gxfb_ops = { | |||
266 | 298 | ||
267 | static struct fb_info * __init gxfb_init_fbinfo(struct device *dev) | 299 | static struct fb_info * __init gxfb_init_fbinfo(struct device *dev) |
268 | { | 300 | { |
269 | struct geodefb_par *par; | 301 | struct gxfb_par *par; |
270 | struct fb_info *info; | 302 | struct fb_info *info; |
271 | 303 | ||
272 | /* Alloc enough space for the pseudo palette. */ | 304 | /* Alloc enough space for the pseudo palette. */ |
273 | info = framebuffer_alloc(sizeof(struct geodefb_par) + sizeof(u32) * 16, dev); | 305 | info = framebuffer_alloc(sizeof(struct gxfb_par) + sizeof(u32) * 16, |
306 | dev); | ||
274 | if (!info) | 307 | if (!info) |
275 | return NULL; | 308 | return NULL; |
276 | 309 | ||
@@ -296,29 +329,64 @@ static struct fb_info * __init gxfb_init_fbinfo(struct device *dev) | |||
296 | info->flags = FBINFO_DEFAULT; | 329 | info->flags = FBINFO_DEFAULT; |
297 | info->node = -1; | 330 | info->node = -1; |
298 | 331 | ||
299 | info->pseudo_palette = (void *)par + sizeof(struct geodefb_par); | 332 | info->pseudo_palette = (void *)par + sizeof(struct gxfb_par); |
300 | 333 | ||
301 | info->var.grayscale = 0; | 334 | info->var.grayscale = 0; |
302 | 335 | ||
303 | return info; | 336 | return info; |
304 | } | 337 | } |
305 | 338 | ||
339 | #ifdef CONFIG_PM | ||
340 | static int gxfb_suspend(struct pci_dev *pdev, pm_message_t state) | ||
341 | { | ||
342 | struct fb_info *info = pci_get_drvdata(pdev); | ||
343 | |||
344 | if (state.event == PM_EVENT_SUSPEND) { | ||
345 | acquire_console_sem(); | ||
346 | gx_powerdown(info); | ||
347 | fb_set_suspend(info, 1); | ||
348 | release_console_sem(); | ||
349 | } | ||
350 | |||
351 | /* there's no point in setting PCI states; we emulate PCI, so | ||
352 | * we don't end up getting power savings anyways */ | ||
353 | |||
354 | return 0; | ||
355 | } | ||
356 | |||
357 | static int gxfb_resume(struct pci_dev *pdev) | ||
358 | { | ||
359 | struct fb_info *info = pci_get_drvdata(pdev); | ||
360 | int ret; | ||
361 | |||
362 | acquire_console_sem(); | ||
363 | ret = gx_powerup(info); | ||
364 | if (ret) { | ||
365 | printk(KERN_ERR "gxfb: power up failed!\n"); | ||
366 | return ret; | ||
367 | } | ||
368 | |||
369 | fb_set_suspend(info, 0); | ||
370 | release_console_sem(); | ||
371 | return 0; | ||
372 | } | ||
373 | #endif | ||
374 | |||
306 | static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 375 | static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
307 | { | 376 | { |
308 | struct geodefb_par *par; | 377 | struct gxfb_par *par; |
309 | struct fb_info *info; | 378 | struct fb_info *info; |
310 | int ret; | 379 | int ret; |
311 | unsigned long val; | 380 | unsigned long val; |
312 | 381 | ||
382 | struct fb_videomode *modedb_ptr; | ||
383 | unsigned int modedb_size; | ||
384 | |||
313 | info = gxfb_init_fbinfo(&pdev->dev); | 385 | info = gxfb_init_fbinfo(&pdev->dev); |
314 | if (!info) | 386 | if (!info) |
315 | return -ENOMEM; | 387 | return -ENOMEM; |
316 | par = info->par; | 388 | par = info->par; |
317 | 389 | ||
318 | /* GX display controller and GX video device. */ | ||
319 | par->dc_ops = &gx_dc_ops; | ||
320 | par->vid_ops = &gx_vid_ops; | ||
321 | |||
322 | if ((ret = gxfb_map_video_memory(info, pdev)) < 0) { | 390 | if ((ret = gxfb_map_video_memory(info, pdev)) < 0) { |
323 | dev_err(&pdev->dev, "failed to map frame buffer or controller registers\n"); | 391 | dev_err(&pdev->dev, "failed to map frame buffer or controller registers\n"); |
324 | goto err; | 392 | goto err; |
@@ -326,15 +394,16 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i | |||
326 | 394 | ||
327 | /* Figure out if this is a TFT or CRT part */ | 395 | /* Figure out if this is a TFT or CRT part */ |
328 | 396 | ||
329 | rdmsrl(GLD_MSR_CONFIG, val); | 397 | rdmsrl(MSR_GX_GLD_MSR_CONFIG, val); |
330 | 398 | ||
331 | if ((val & GLD_MSR_CONFIG_DM_FP) == GLD_MSR_CONFIG_DM_FP) | 399 | if ((val & MSR_GX_GLD_MSR_CONFIG_FP) == MSR_GX_GLD_MSR_CONFIG_FP) |
332 | par->enable_crt = 0; | 400 | par->enable_crt = 0; |
333 | else | 401 | else |
334 | par->enable_crt = 1; | 402 | par->enable_crt = 1; |
335 | 403 | ||
404 | get_modedb(&modedb_ptr, &modedb_size); | ||
336 | ret = fb_find_mode(&info->var, info, mode_option, | 405 | ret = fb_find_mode(&info->var, info, mode_option, |
337 | gx_modedb, ARRAY_SIZE(gx_modedb), NULL, 16); | 406 | modedb_ptr, modedb_size, NULL, 16); |
338 | if (ret == 0 || ret == 4) { | 407 | if (ret == 0 || ret == 4) { |
339 | dev_err(&pdev->dev, "could not find valid video mode\n"); | 408 | dev_err(&pdev->dev, "could not find valid video mode\n"); |
340 | ret = -EINVAL; | 409 | ret = -EINVAL; |
@@ -348,6 +417,8 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i | |||
348 | gxfb_check_var(&info->var, info); | 417 | gxfb_check_var(&info->var, info); |
349 | gxfb_set_par(info); | 418 | gxfb_set_par(info); |
350 | 419 | ||
420 | pm_set_vt_switch(vt_switch); | ||
421 | |||
351 | if (register_framebuffer(info) < 0) { | 422 | if (register_framebuffer(info) < 0) { |
352 | ret = -EINVAL; | 423 | ret = -EINVAL; |
353 | goto err; | 424 | goto err; |
@@ -369,6 +440,10 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i | |||
369 | iounmap(par->dc_regs); | 440 | iounmap(par->dc_regs); |
370 | pci_release_region(pdev, 2); | 441 | pci_release_region(pdev, 2); |
371 | } | 442 | } |
443 | if (par->gp_regs) { | ||
444 | iounmap(par->gp_regs); | ||
445 | pci_release_region(pdev, 1); | ||
446 | } | ||
372 | 447 | ||
373 | if (info) | 448 | if (info) |
374 | framebuffer_release(info); | 449 | framebuffer_release(info); |
@@ -378,7 +453,7 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i | |||
378 | static void gxfb_remove(struct pci_dev *pdev) | 453 | static void gxfb_remove(struct pci_dev *pdev) |
379 | { | 454 | { |
380 | struct fb_info *info = pci_get_drvdata(pdev); | 455 | struct fb_info *info = pci_get_drvdata(pdev); |
381 | struct geodefb_par *par = info->par; | 456 | struct gxfb_par *par = info->par; |
382 | 457 | ||
383 | unregister_framebuffer(info); | 458 | unregister_framebuffer(info); |
384 | 459 | ||
@@ -391,15 +466,16 @@ static void gxfb_remove(struct pci_dev *pdev) | |||
391 | iounmap(par->dc_regs); | 466 | iounmap(par->dc_regs); |
392 | pci_release_region(pdev, 2); | 467 | pci_release_region(pdev, 2); |
393 | 468 | ||
469 | iounmap(par->gp_regs); | ||
470 | pci_release_region(pdev, 1); | ||
471 | |||
394 | pci_set_drvdata(pdev, NULL); | 472 | pci_set_drvdata(pdev, NULL); |
395 | 473 | ||
396 | framebuffer_release(info); | 474 | framebuffer_release(info); |
397 | } | 475 | } |
398 | 476 | ||
399 | static struct pci_device_id gxfb_id_table[] = { | 477 | static struct pci_device_id gxfb_id_table[] = { |
400 | { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_GX_VIDEO, | 478 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_GX_VIDEO) }, |
401 | PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY << 16, | ||
402 | 0xff0000, 0 }, | ||
403 | { 0, } | 479 | { 0, } |
404 | }; | 480 | }; |
405 | 481 | ||
@@ -410,6 +486,10 @@ static struct pci_driver gxfb_driver = { | |||
410 | .id_table = gxfb_id_table, | 486 | .id_table = gxfb_id_table, |
411 | .probe = gxfb_probe, | 487 | .probe = gxfb_probe, |
412 | .remove = gxfb_remove, | 488 | .remove = gxfb_remove, |
489 | #ifdef CONFIG_PM | ||
490 | .suspend = gxfb_suspend, | ||
491 | .resume = gxfb_resume, | ||
492 | #endif | ||
413 | }; | 493 | }; |
414 | 494 | ||
415 | #ifndef MODULE | 495 | #ifndef MODULE |
@@ -456,5 +536,11 @@ module_exit(gxfb_cleanup); | |||
456 | module_param(mode_option, charp, 0); | 536 | module_param(mode_option, charp, 0); |
457 | MODULE_PARM_DESC(mode_option, "video mode (<x>x<y>[-<bpp>][@<refr>])"); | 537 | MODULE_PARM_DESC(mode_option, "video mode (<x>x<y>[-<bpp>][@<refr>])"); |
458 | 538 | ||
539 | module_param(vram, int, 0); | ||
540 | MODULE_PARM_DESC(vram, "video memory size"); | ||
541 | |||
542 | module_param(vt_switch, int, 0); | ||
543 | MODULE_PARM_DESC(vt_switch, "enable VT switch during suspend/resume"); | ||
544 | |||
459 | MODULE_DESCRIPTION("Framebuffer driver for the AMD Geode GX"); | 545 | MODULE_DESCRIPTION("Framebuffer driver for the AMD Geode GX"); |
460 | MODULE_LICENSE("GPL"); | 546 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/video/geode/lxfb.h b/drivers/video/geode/lxfb.h index ca13c48d19b0..3b9416f4ee20 100644 --- a/drivers/video/geode/lxfb.h +++ b/drivers/video/geode/lxfb.h | |||
@@ -3,17 +3,46 @@ | |||
3 | 3 | ||
4 | #include <linux/fb.h> | 4 | #include <linux/fb.h> |
5 | 5 | ||
6 | #define GP_REG_COUNT (0x7c / 4) | ||
7 | #define DC_REG_COUNT (0xf0 / 4) | ||
8 | #define VP_REG_COUNT (0x158 / 8) | ||
9 | #define FP_REG_COUNT (0x60 / 8) | ||
10 | |||
11 | #define DC_PAL_COUNT 0x104 | ||
12 | #define DC_HFILT_COUNT 0x100 | ||
13 | #define DC_VFILT_COUNT 0x100 | ||
14 | #define VP_COEFF_SIZE 0x1000 | ||
15 | |||
6 | #define OUTPUT_CRT 0x01 | 16 | #define OUTPUT_CRT 0x01 |
7 | #define OUTPUT_PANEL 0x02 | 17 | #define OUTPUT_PANEL 0x02 |
8 | 18 | ||
9 | struct lxfb_par { | 19 | struct lxfb_par { |
10 | int output; | 20 | int output; |
11 | int panel_width; | ||
12 | int panel_height; | ||
13 | 21 | ||
14 | void __iomem *gp_regs; | 22 | void __iomem *gp_regs; |
15 | void __iomem *dc_regs; | 23 | void __iomem *dc_regs; |
16 | void __iomem *df_regs; | 24 | void __iomem *vp_regs; |
25 | #ifdef CONFIG_PM | ||
26 | int powered_down; | ||
27 | |||
28 | /* register state, for power mgmt functionality */ | ||
29 | struct { | ||
30 | uint64_t padsel; | ||
31 | uint64_t dotpll; | ||
32 | uint64_t dfglcfg; | ||
33 | uint64_t dcspare; | ||
34 | } msr; | ||
35 | |||
36 | uint32_t gp[GP_REG_COUNT]; | ||
37 | uint32_t dc[DC_REG_COUNT]; | ||
38 | uint64_t vp[VP_REG_COUNT]; | ||
39 | uint64_t fp[FP_REG_COUNT]; | ||
40 | |||
41 | uint32_t pal[DC_PAL_COUNT]; | ||
42 | uint32_t hcoeff[DC_HFILT_COUNT * 2]; | ||
43 | uint32_t vcoeff[DC_VFILT_COUNT]; | ||
44 | uint32_t vp_coeff[VP_COEFF_SIZE / 4]; | ||
45 | #endif | ||
17 | }; | 46 | }; |
18 | 47 | ||
19 | static inline unsigned int lx_get_pitch(unsigned int xres, int bpp) | 48 | static inline unsigned int lx_get_pitch(unsigned int xres, int bpp) |
@@ -29,171 +58,383 @@ int lx_blank_display(struct fb_info *, int); | |||
29 | void lx_set_palette_reg(struct fb_info *, unsigned int, unsigned int, | 58 | void lx_set_palette_reg(struct fb_info *, unsigned int, unsigned int, |
30 | unsigned int, unsigned int); | 59 | unsigned int, unsigned int); |
31 | 60 | ||
32 | /* MSRS */ | 61 | #ifdef CONFIG_PM |
62 | int lx_powerdown(struct fb_info *info); | ||
63 | int lx_powerup(struct fb_info *info); | ||
64 | #endif | ||
65 | |||
66 | |||
67 | /* Graphics Processor registers (table 6-29 from the data book) */ | ||
68 | enum gp_registers { | ||
69 | GP_DST_OFFSET = 0, | ||
70 | GP_SRC_OFFSET, | ||
71 | GP_STRIDE, | ||
72 | GP_WID_HEIGHT, | ||
73 | |||
74 | GP_SRC_COLOR_FG, | ||
75 | GP_SRC_COLOR_BG, | ||
76 | GP_PAT_COLOR_0, | ||
77 | GP_PAT_COLOR_1, | ||
78 | |||
79 | GP_PAT_COLOR_2, | ||
80 | GP_PAT_COLOR_3, | ||
81 | GP_PAT_COLOR_4, | ||
82 | GP_PAT_COLOR_5, | ||
83 | |||
84 | GP_PAT_DATA_0, | ||
85 | GP_PAT_DATA_1, | ||
86 | GP_RASTER_MODE, | ||
87 | GP_VECTOR_MODE, | ||
88 | |||
89 | GP_BLT_MODE, | ||
90 | GP_BLT_STATUS, | ||
91 | GP_HST_SRC, | ||
92 | GP_BASE_OFFSET, | ||
93 | |||
94 | GP_CMD_TOP, | ||
95 | GP_CMD_BOT, | ||
96 | GP_CMD_READ, | ||
97 | GP_CMD_WRITE, | ||
98 | |||
99 | GP_CH3_OFFSET, | ||
100 | GP_CH3_MODE_STR, | ||
101 | GP_CH3_WIDHI, | ||
102 | GP_CH3_HSRC, | ||
103 | |||
104 | GP_LUT_INDEX, | ||
105 | GP_LUT_DATA, | ||
106 | GP_INT_CNTRL, /* 0x78 */ | ||
107 | }; | ||
108 | |||
109 | #define GP_BLT_STATUS_CE (1 << 4) /* cmd buf empty */ | ||
110 | #define GP_BLT_STATUS_PB (1 << 0) /* primative busy */ | ||
111 | |||
112 | |||
113 | /* Display Controller registers (table 6-47 from the data book) */ | ||
114 | enum dc_registers { | ||
115 | DC_UNLOCK = 0, | ||
116 | DC_GENERAL_CFG, | ||
117 | DC_DISPLAY_CFG, | ||
118 | DC_ARB_CFG, | ||
119 | |||
120 | DC_FB_ST_OFFSET, | ||
121 | DC_CB_ST_OFFSET, | ||
122 | DC_CURS_ST_OFFSET, | ||
123 | DC_RSVD_0, | ||
124 | |||
125 | DC_VID_Y_ST_OFFSET, | ||
126 | DC_VID_U_ST_OFFSET, | ||
127 | DC_VID_V_ST_OFFSET, | ||
128 | DC_DV_TOP, | ||
129 | |||
130 | DC_LINE_SIZE, | ||
131 | DC_GFX_PITCH, | ||
132 | DC_VID_YUV_PITCH, | ||
133 | DC_RSVD_1, | ||
134 | |||
135 | DC_H_ACTIVE_TIMING, | ||
136 | DC_H_BLANK_TIMING, | ||
137 | DC_H_SYNC_TIMING, | ||
138 | DC_RSVD_2, | ||
139 | |||
140 | DC_V_ACTIVE_TIMING, | ||
141 | DC_V_BLANK_TIMING, | ||
142 | DC_V_SYNC_TIMING, | ||
143 | DC_FB_ACTIVE, | ||
144 | |||
145 | DC_CURSOR_X, | ||
146 | DC_CURSOR_Y, | ||
147 | DC_RSVD_3, | ||
148 | DC_LINE_CNT, | ||
149 | |||
150 | DC_PAL_ADDRESS, | ||
151 | DC_PAL_DATA, | ||
152 | DC_DFIFO_DIAG, | ||
153 | DC_CFIFO_DIAG, | ||
154 | |||
155 | DC_VID_DS_DELTA, | ||
156 | DC_GLIU0_MEM_OFFSET, | ||
157 | DC_DV_CTL, | ||
158 | DC_DV_ACCESS, | ||
159 | |||
160 | DC_GFX_SCALE, | ||
161 | DC_IRQ_FILT_CTL, | ||
162 | DC_FILT_COEFF1, | ||
163 | DC_FILT_COEFF2, | ||
164 | |||
165 | DC_VBI_EVEN_CTL, | ||
166 | DC_VBI_ODD_CTL, | ||
167 | DC_VBI_HOR, | ||
168 | DC_VBI_LN_ODD, | ||
169 | |||
170 | DC_VBI_LN_EVEN, | ||
171 | DC_VBI_PITCH, | ||
172 | DC_CLR_KEY, | ||
173 | DC_CLR_KEY_MASK, | ||
174 | |||
175 | DC_CLR_KEY_X, | ||
176 | DC_CLR_KEY_Y, | ||
177 | DC_IRQ, | ||
178 | DC_RSVD_4, | ||
179 | |||
180 | DC_RSVD_5, | ||
181 | DC_GENLK_CTL, | ||
182 | DC_VID_EVEN_Y_ST_OFFSET, | ||
183 | DC_VID_EVEN_U_ST_OFFSET, | ||
184 | |||
185 | DC_VID_EVEN_V_ST_OFFSET, | ||
186 | DC_V_ACTIVE_EVEN_TIMING, | ||
187 | DC_V_BLANK_EVEN_TIMING, | ||
188 | DC_V_SYNC_EVEN_TIMING, /* 0xec */ | ||
189 | }; | ||
190 | |||
191 | #define DC_UNLOCK_LOCK 0x00000000 | ||
192 | #define DC_UNLOCK_UNLOCK 0x00004758 /* magic value */ | ||
193 | |||
194 | #define DC_GENERAL_CFG_FDTY (1 << 17) | ||
195 | #define DC_GENERAL_CFG_DFHPEL_SHIFT (12) | ||
196 | #define DC_GENERAL_CFG_DFHPSL_SHIFT (8) | ||
197 | #define DC_GENERAL_CFG_VGAE (1 << 7) | ||
198 | #define DC_GENERAL_CFG_DECE (1 << 6) | ||
199 | #define DC_GENERAL_CFG_CMPE (1 << 5) | ||
200 | #define DC_GENERAL_CFG_VIDE (1 << 3) | ||
201 | #define DC_GENERAL_CFG_DFLE (1 << 0) | ||
202 | |||
203 | #define DC_DISPLAY_CFG_VISL (1 << 27) | ||
204 | #define DC_DISPLAY_CFG_PALB (1 << 25) | ||
205 | #define DC_DISPLAY_CFG_DCEN (1 << 24) | ||
206 | #define DC_DISPLAY_CFG_DISP_MODE_24BPP (1 << 9) | ||
207 | #define DC_DISPLAY_CFG_DISP_MODE_16BPP (1 << 8) | ||
208 | #define DC_DISPLAY_CFG_DISP_MODE_8BPP (0) | ||
209 | #define DC_DISPLAY_CFG_TRUP (1 << 6) | ||
210 | #define DC_DISPLAY_CFG_VDEN (1 << 4) | ||
211 | #define DC_DISPLAY_CFG_GDEN (1 << 3) | ||
212 | #define DC_DISPLAY_CFG_TGEN (1 << 0) | ||
213 | |||
214 | #define DC_DV_TOP_DV_TOP_EN (1 << 0) | ||
215 | |||
216 | #define DC_DV_CTL_DV_LINE_SIZE ((1 << 10) | (1 << 11)) | ||
217 | #define DC_DV_CTL_DV_LINE_SIZE_1K (0) | ||
218 | #define DC_DV_CTL_DV_LINE_SIZE_2K (1 << 10) | ||
219 | #define DC_DV_CTL_DV_LINE_SIZE_4K (1 << 11) | ||
220 | #define DC_DV_CTL_DV_LINE_SIZE_8K ((1 << 10) | (1 << 11)) | ||
221 | #define DC_DV_CTL_CLEAR_DV_RAM (1 << 0) | ||
222 | |||
223 | #define DC_IRQ_FILT_CTL_H_FILT_SEL (1 << 10) | ||
224 | |||
225 | #define DC_CLR_KEY_CLR_KEY_EN (1 << 24) | ||
226 | |||
227 | #define DC_IRQ_VIP_VSYNC_IRQ_STATUS (1 << 21) /* undocumented? */ | ||
228 | #define DC_IRQ_STATUS (1 << 20) /* undocumented? */ | ||
229 | #define DC_IRQ_VIP_VSYNC_LOSS_IRQ_MASK (1 << 1) | ||
230 | #define DC_IRQ_MASK (1 << 0) | ||
33 | 231 | ||
34 | #define MSR_LX_GLD_CONFIG 0x48002001 | 232 | #define DC_GENLK_CTL_FLICK_SEL_MASK (0x0F << 28) |
35 | #define MSR_LX_GLCP_DOTPLL 0x4c000015 | 233 | #define DC_GENLK_CTL_ALPHA_FLICK_EN (1 << 25) |
36 | #define MSR_LX_DF_PADSEL 0x48002011 | 234 | #define DC_GENLK_CTL_FLICK_EN (1 << 24) |
37 | #define MSR_LX_DC_SPARE 0x80000011 | 235 | #define DC_GENLK_CTL_GENLK_EN (1 << 18) |
38 | #define MSR_LX_DF_GLCONFIG 0x48002001 | ||
39 | |||
40 | #define MSR_LX_GLIU0_P2D_RO0 0x10000029 | ||
41 | |||
42 | #define GLCP_DOTPLL_RESET (1 << 0) | ||
43 | #define GLCP_DOTPLL_BYPASS (1 << 15) | ||
44 | #define GLCP_DOTPLL_HALFPIX (1 << 24) | ||
45 | #define GLCP_DOTPLL_LOCK (1 << 25) | ||
46 | |||
47 | #define DF_CONFIG_OUTPUT_MASK 0x38 | ||
48 | #define DF_OUTPUT_PANEL 0x08 | ||
49 | #define DF_OUTPUT_CRT 0x00 | ||
50 | #define DF_SIMULTANEOUS_CRT_AND_FP (1 << 15) | ||
51 | |||
52 | #define DF_DEFAULT_TFT_PAD_SEL_LOW 0xDFFFFFFF | ||
53 | #define DF_DEFAULT_TFT_PAD_SEL_HIGH 0x0000003F | ||
54 | |||
55 | #define DC_SPARE_DISABLE_CFIFO_HGO 0x00000800 | ||
56 | #define DC_SPARE_VFIFO_ARB_SELECT 0x00000400 | ||
57 | #define DC_SPARE_WM_LPEN_OVRD 0x00000200 | ||
58 | #define DC_SPARE_LOAD_WM_LPEN_MASK 0x00000100 | ||
59 | #define DC_SPARE_DISABLE_INIT_VID_PRI 0x00000080 | ||
60 | #define DC_SPARE_DISABLE_VFIFO_WM 0x00000040 | ||
61 | #define DC_SPARE_DISABLE_CWD_CHECK 0x00000020 | ||
62 | #define DC_SPARE_PIX8_PAN_FIX 0x00000010 | ||
63 | #define DC_SPARE_FIRST_REQ_MASK 0x00000002 | ||
64 | |||
65 | /* Registers */ | ||
66 | |||
67 | #define DC_UNLOCK 0x00 | ||
68 | #define DC_UNLOCK_CODE 0x4758 | ||
69 | 236 | ||
70 | #define DC_GENERAL_CFG 0x04 | ||
71 | #define DC_GCFG_DFLE (1 << 0) | ||
72 | #define DC_GCFG_VIDE (1 << 3) | ||
73 | #define DC_GCFG_VGAE (1 << 7) | ||
74 | #define DC_GCFG_CMPE (1 << 5) | ||
75 | #define DC_GCFG_DECE (1 << 6) | ||
76 | #define DC_GCFG_FDTY (1 << 17) | ||
77 | 237 | ||
78 | #define DC_DISPLAY_CFG 0x08 | 238 | /* |
79 | #define DC_DCFG_TGEN (1 << 0) | 239 | * Video Processor registers (table 6-71). |
80 | #define DC_DCFG_GDEN (1 << 3) | 240 | * There is space for 64 bit values, but we never use more than the |
81 | #define DC_DCFG_VDEN (1 << 4) | 241 | * lower 32 bits. The actual register save/restore code only bothers |
82 | #define DC_DCFG_TRUP (1 << 6) | 242 | * to restore those 32 bits. |
83 | #define DC_DCFG_DCEN (1 << 24) | 243 | */ |
84 | #define DC_DCFG_PALB (1 << 25) | 244 | enum vp_registers { |
85 | #define DC_DCFG_VISL (1 << 27) | 245 | VP_VCFG = 0, |
246 | VP_DCFG, | ||
86 | 247 | ||
87 | #define DC_DCFG_16BPP 0x0 | 248 | VP_VX, |
249 | VP_VY, | ||
88 | 250 | ||
89 | #define DC_DCFG_DISP_MODE_MASK 0x00000300 | 251 | VP_SCL, |
90 | #define DC_DCFG_DISP_MODE_8BPP 0x00000000 | 252 | VP_VCK, |
91 | #define DC_DCFG_DISP_MODE_16BPP 0x00000100 | ||
92 | #define DC_DCFG_DISP_MODE_24BPP 0x00000200 | ||
93 | #define DC_DCFG_DISP_MODE_32BPP 0x00000300 | ||
94 | 253 | ||
254 | VP_VCM, | ||
255 | VP_PAR, | ||
95 | 256 | ||
96 | #define DC_ARB_CFG 0x0C | 257 | VP_PDR, |
258 | VP_SLR, | ||
97 | 259 | ||
98 | #define DC_FB_START 0x10 | 260 | VP_MISC, |
99 | #define DC_CB_START 0x14 | 261 | VP_CCS, |
100 | #define DC_CURSOR_START 0x18 | ||
101 | 262 | ||
102 | #define DC_DV_TOP 0x2C | 263 | VP_VYS, |
103 | #define DC_DV_TOP_ENABLE (1 << 0) | 264 | VP_VXS, |
104 | 265 | ||
105 | #define DC_LINE_SIZE 0x30 | 266 | VP_RSVD_0, |
106 | #define DC_GRAPHICS_PITCH 0x34 | 267 | VP_VDC, |
107 | #define DC_H_ACTIVE_TIMING 0x40 | 268 | |
108 | #define DC_H_BLANK_TIMING 0x44 | 269 | VP_RSVD_1, |
109 | #define DC_H_SYNC_TIMING 0x48 | 270 | VP_CRC, |
110 | #define DC_V_ACTIVE_TIMING 0x50 | 271 | |
111 | #define DC_V_BLANK_TIMING 0x54 | 272 | VP_CRC32, |
112 | #define DC_V_SYNC_TIMING 0x58 | 273 | VP_VDE, |
113 | #define DC_FB_ACTIVE 0x5C | 274 | |
275 | VP_CCK, | ||
276 | VP_CCM, | ||
277 | |||
278 | VP_CC1, | ||
279 | VP_CC2, | ||
280 | |||
281 | VP_A1X, | ||
282 | VP_A1Y, | ||
283 | |||
284 | VP_A1C, | ||
285 | VP_A1T, | ||
286 | |||
287 | VP_A2X, | ||
288 | VP_A2Y, | ||
289 | |||
290 | VP_A2C, | ||
291 | VP_A2T, | ||
292 | |||
293 | VP_A3X, | ||
294 | VP_A3Y, | ||
295 | |||
296 | VP_A3C, | ||
297 | VP_A3T, | ||
298 | |||
299 | VP_VRR, | ||
300 | VP_AWT, | ||
301 | |||
302 | VP_VTM, | ||
303 | VP_VYE, | ||
304 | |||
305 | VP_A1YE, | ||
306 | VP_A2YE, | ||
307 | |||
308 | VP_A3YE, /* 0x150 */ | ||
309 | |||
310 | VP_VCR = 0x1000, /* 0x1000 - 0x1fff */ | ||
311 | }; | ||
114 | 312 | ||
115 | #define DC_PAL_ADDRESS 0x70 | 313 | #define VP_VCFG_VID_EN (1 << 0) |
116 | #define DC_PAL_DATA 0x74 | ||
117 | 314 | ||
118 | #define DC_PHY_MEM_OFFSET 0x84 | 315 | #define VP_DCFG_GV_GAM (1 << 21) |
316 | #define VP_DCFG_PWR_SEQ_DELAY ((1 << 17) | (1 << 18) | (1 << 19)) | ||
317 | #define VP_DCFG_PWR_SEQ_DELAY_DEFAULT (1 << 19) /* undocumented */ | ||
318 | #define VP_DCFG_CRT_SYNC_SKW ((1 << 14) | (1 << 15) | (1 << 16)) | ||
319 | #define VP_DCFG_CRT_SYNC_SKW_DEFAULT (1 << 16) | ||
320 | #define VP_DCFG_CRT_VSYNC_POL (1 << 9) | ||
321 | #define VP_DCFG_CRT_HSYNC_POL (1 << 8) | ||
322 | #define VP_DCFG_DAC_BL_EN (1 << 3) | ||
323 | #define VP_DCFG_VSYNC_EN (1 << 2) | ||
324 | #define VP_DCFG_HSYNC_EN (1 << 1) | ||
325 | #define VP_DCFG_CRT_EN (1 << 0) | ||
119 | 326 | ||
120 | #define DC_DV_CTL 0x88 | 327 | #define VP_MISC_APWRDN (1 << 11) |
121 | #define DC_DV_LINE_SIZE_MASK 0x00000C00 | 328 | #define VP_MISC_DACPWRDN (1 << 10) |
122 | #define DC_DV_LINE_SIZE_1024 0x00000000 | 329 | #define VP_MISC_BYP_BOTH (1 << 0) |
123 | #define DC_DV_LINE_SIZE_2048 0x00000400 | ||
124 | #define DC_DV_LINE_SIZE_4096 0x00000800 | ||
125 | #define DC_DV_LINE_SIZE_8192 0x00000C00 | ||
126 | 330 | ||
127 | 331 | ||
128 | #define DC_GFX_SCALE 0x90 | 332 | /* |
129 | #define DC_IRQ_FILT_CTL 0x94 | 333 | * Flat Panel registers (table 6-71). |
334 | * Also 64 bit registers; see above note about 32-bit handling. | ||
335 | */ | ||
130 | 336 | ||
337 | /* we're actually in the VP register space, starting at address 0x400 */ | ||
338 | #define VP_FP_START 0x400 | ||
131 | 339 | ||
132 | #define DC_IRQ 0xC8 | 340 | enum fp_registers { |
133 | #define DC_IRQ_MASK (1 << 0) | 341 | FP_PT1 = 0, |
134 | #define DC_VSYNC_IRQ_MASK (1 << 1) | 342 | FP_PT2, |
135 | #define DC_IRQ_STATUS (1 << 20) | ||
136 | #define DC_VSYNC_IRQ_STATUS (1 << 21) | ||
137 | |||
138 | #define DC_GENLCK_CTRL 0xD4 | ||
139 | #define DC_GENLCK_ENABLE (1 << 18) | ||
140 | #define DC_GC_ALPHA_FLICK_ENABLE (1 << 25) | ||
141 | #define DC_GC_FLICKER_FILTER_ENABLE (1 << 24) | ||
142 | #define DC_GC_FLICKER_FILTER_MASK (0x0F << 28) | ||
143 | |||
144 | #define DC_COLOR_KEY 0xB8 | ||
145 | #define DC_CLR_KEY_ENABLE (1 << 24) | ||
146 | |||
147 | |||
148 | #define DC3_DV_LINE_SIZE_MASK 0x00000C00 | ||
149 | #define DC3_DV_LINE_SIZE_1024 0x00000000 | ||
150 | #define DC3_DV_LINE_SIZE_2048 0x00000400 | ||
151 | #define DC3_DV_LINE_SIZE_4096 0x00000800 | ||
152 | #define DC3_DV_LINE_SIZE_8192 0x00000C00 | ||
153 | |||
154 | #define DF_VIDEO_CFG 0x0 | ||
155 | #define DF_VCFG_VID_EN (1 << 0) | ||
156 | |||
157 | #define DF_DISPLAY_CFG 0x08 | ||
158 | |||
159 | #define DF_DCFG_CRT_EN (1 << 0) | ||
160 | #define DF_DCFG_HSYNC_EN (1 << 1) | ||
161 | #define DF_DCFG_VSYNC_EN (1 << 2) | ||
162 | #define DF_DCFG_DAC_BL_EN (1 << 3) | ||
163 | #define DF_DCFG_CRT_HSYNC_POL (1 << 8) | ||
164 | #define DF_DCFG_CRT_VSYNC_POL (1 << 9) | ||
165 | #define DF_DCFG_GV_PAL_BYP (1 << 21) | ||
166 | 343 | ||
167 | #define DF_DCFG_CRT_SYNC_SKW_INIT 0x10000 | 344 | FP_PM, |
168 | #define DF_DCFG_CRT_SYNC_SKW_MASK 0x1c000 | 345 | FP_DFC, |
169 | 346 | ||
170 | #define DF_DCFG_PWR_SEQ_DLY_INIT 0x80000 | 347 | FP_RSVD_0, |
171 | #define DF_DCFG_PWR_SEQ_DLY_MASK 0xe0000 | 348 | FP_RSVD_1, |
172 | 349 | ||
173 | #define DF_MISC 0x50 | 350 | FP_RSVD_2, |
351 | FP_RSVD_3, | ||
352 | |||
353 | FP_RSVD_4, | ||
354 | FP_DCA, | ||
355 | |||
356 | FP_DMD, | ||
357 | FP_CRC, /* 0x458 */ | ||
358 | }; | ||
359 | |||
360 | #define FP_PT2_SCRC (1 << 27) /* shfclk free */ | ||
361 | |||
362 | #define FP_PM_P (1 << 24) /* panel power ctl */ | ||
363 | #define FP_PM_PANEL_PWR_UP (1 << 3) /* r/o */ | ||
364 | #define FP_PM_PANEL_PWR_DOWN (1 << 2) /* r/o */ | ||
365 | #define FP_PM_PANEL_OFF (1 << 1) /* r/o */ | ||
366 | #define FP_PM_PANEL_ON (1 << 0) /* r/o */ | ||
367 | |||
368 | #define FP_DFC_BC ((1 << 4) | (1 << 5) | (1 << 6)) | ||
369 | |||
370 | |||
371 | /* register access functions */ | ||
372 | |||
373 | static inline uint32_t read_gp(struct lxfb_par *par, int reg) | ||
374 | { | ||
375 | return readl(par->gp_regs + 4*reg); | ||
376 | } | ||
377 | |||
378 | static inline void write_gp(struct lxfb_par *par, int reg, uint32_t val) | ||
379 | { | ||
380 | writel(val, par->gp_regs + 4*reg); | ||
381 | } | ||
382 | |||
383 | static inline uint32_t read_dc(struct lxfb_par *par, int reg) | ||
384 | { | ||
385 | return readl(par->dc_regs + 4*reg); | ||
386 | } | ||
387 | |||
388 | static inline void write_dc(struct lxfb_par *par, int reg, uint32_t val) | ||
389 | { | ||
390 | writel(val, par->dc_regs + 4*reg); | ||
391 | } | ||
392 | |||
393 | static inline uint32_t read_vp(struct lxfb_par *par, int reg) | ||
394 | { | ||
395 | return readl(par->vp_regs + 8*reg); | ||
396 | } | ||
397 | |||
398 | static inline void write_vp(struct lxfb_par *par, int reg, uint32_t val) | ||
399 | { | ||
400 | writel(val, par->vp_regs + 8*reg); | ||
401 | } | ||
402 | |||
403 | static inline uint32_t read_fp(struct lxfb_par *par, int reg) | ||
404 | { | ||
405 | return readl(par->vp_regs + 8*reg + VP_FP_START); | ||
406 | } | ||
407 | |||
408 | static inline void write_fp(struct lxfb_par *par, int reg, uint32_t val) | ||
409 | { | ||
410 | writel(val, par->vp_regs + 8*reg + VP_FP_START); | ||
411 | } | ||
174 | 412 | ||
175 | #define DF_MISC_GAM_BYPASS (1 << 0) | ||
176 | #define DF_MISC_DAC_PWRDN (1 << 10) | ||
177 | #define DF_MISC_A_PWRDN (1 << 11) | ||
178 | 413 | ||
179 | #define DF_PAR 0x38 | 414 | /* MSRs are defined in asm/geode.h; their bitfields are here */ |
180 | #define DF_PDR 0x40 | ||
181 | #define DF_ALPHA_CONTROL_1 0xD8 | ||
182 | #define DF_VIDEO_REQUEST 0x120 | ||
183 | 415 | ||
184 | #define DF_PANEL_TIM1 0x400 | 416 | #define MSR_GLCP_DOTPLL_LOCK (1 << 25) /* r/o */ |
185 | #define DF_DEFAULT_TFT_PMTIM1 0x0 | 417 | #define MSR_GLCP_DOTPLL_HALFPIX (1 << 24) |
418 | #define MSR_GLCP_DOTPLL_BYPASS (1 << 15) | ||
419 | #define MSR_GLCP_DOTPLL_DOTRESET (1 << 0) | ||
186 | 420 | ||
187 | #define DF_PANEL_TIM2 0x408 | 421 | /* note: this is actually the VP's GLD_MSR_CONFIG */ |
188 | #define DF_DEFAULT_TFT_PMTIM2 0x08000000 | 422 | #define MSR_LX_GLD_MSR_CONFIG_FMT ((1 << 3) | (1 << 4) | (1 << 5)) |
423 | #define MSR_LX_GLD_MSR_CONFIG_FMT_FP (1 << 3) | ||
424 | #define MSR_LX_GLD_MSR_CONFIG_FMT_CRT (0) | ||
425 | #define MSR_LX_GLD_MSR_CONFIG_FPC (1 << 15) /* FP *and* CRT */ | ||
189 | 426 | ||
190 | #define DF_FP_PM 0x410 | 427 | #define MSR_LX_MSR_PADSEL_TFT_SEL_LOW 0xDFFFFFFF /* ??? */ |
191 | #define DF_FP_PM_P (1 << 24) | 428 | #define MSR_LX_MSR_PADSEL_TFT_SEL_HIGH 0x0000003F /* ??? */ |
192 | 429 | ||
193 | #define DF_DITHER_CONTROL 0x418 | 430 | #define MSR_LX_SPARE_MSR_DIS_CFIFO_HGO (1 << 11) /* undocumented */ |
194 | #define DF_DEFAULT_TFT_DITHCTL 0x00000070 | 431 | #define MSR_LX_SPARE_MSR_VFIFO_ARB_SEL (1 << 10) /* undocumented */ |
195 | #define GP_BLT_STATUS 0x44 | 432 | #define MSR_LX_SPARE_MSR_WM_LPEN_OVRD (1 << 9) /* undocumented */ |
196 | #define GP_BS_BLT_BUSY (1 << 0) | 433 | #define MSR_LX_SPARE_MSR_LOAD_WM_LPEN_M (1 << 8) /* undocumented */ |
197 | #define GP_BS_CB_EMPTY (1 << 4) | 434 | #define MSR_LX_SPARE_MSR_DIS_INIT_V_PRI (1 << 7) /* undocumented */ |
435 | #define MSR_LX_SPARE_MSR_DIS_VIFO_WM (1 << 6) | ||
436 | #define MSR_LX_SPARE_MSR_DIS_CWD_CHECK (1 << 5) /* undocumented */ | ||
437 | #define MSR_LX_SPARE_MSR_PIX8_PAN_FIX (1 << 4) /* undocumented */ | ||
438 | #define MSR_LX_SPARE_MSR_FIRST_REQ_MASK (1 << 1) /* undocumented */ | ||
198 | 439 | ||
199 | #endif | 440 | #endif |
diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c index eb6b88171538..2cd9b74d2225 100644 --- a/drivers/video/geode/lxfb_core.c +++ b/drivers/video/geode/lxfb_core.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/console.h> | 17 | #include <linux/console.h> |
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/suspend.h> | ||
20 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
21 | #include <linux/fb.h> | 22 | #include <linux/fb.h> |
22 | #include <linux/init.h> | 23 | #include <linux/init.h> |
@@ -27,14 +28,15 @@ | |||
27 | 28 | ||
28 | static char *mode_option; | 29 | static char *mode_option; |
29 | static int noclear, nopanel, nocrt; | 30 | static int noclear, nopanel, nocrt; |
30 | static int fbsize; | 31 | static int vram; |
32 | static int vt_switch; | ||
31 | 33 | ||
32 | /* Most of these modes are sorted in ascending order, but | 34 | /* Most of these modes are sorted in ascending order, but |
33 | * since the first entry in this table is the "default" mode, | 35 | * since the first entry in this table is the "default" mode, |
34 | * we try to make it something sane - 640x480-60 is sane | 36 | * we try to make it something sane - 640x480-60 is sane |
35 | */ | 37 | */ |
36 | 38 | ||
37 | static const struct fb_videomode geode_modedb[] __initdata = { | 39 | static struct fb_videomode geode_modedb[] __initdata = { |
38 | /* 640x480-60 */ | 40 | /* 640x480-60 */ |
39 | { NULL, 60, 640, 480, 39682, 48, 8, 25, 2, 88, 2, | 41 | { NULL, 60, 640, 480, 39682, 48, 8, 25, 2, 88, 2, |
40 | FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | 42 | FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
@@ -215,6 +217,35 @@ static const struct fb_videomode geode_modedb[] __initdata = { | |||
215 | 0, FB_VMODE_NONINTERLACED, 0 }, | 217 | 0, FB_VMODE_NONINTERLACED, 0 }, |
216 | }; | 218 | }; |
217 | 219 | ||
220 | #ifdef CONFIG_OLPC | ||
221 | #include <asm/olpc.h> | ||
222 | |||
223 | static struct fb_videomode olpc_dcon_modedb[] __initdata = { | ||
224 | /* The only mode the DCON has is 1200x900 */ | ||
225 | { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3, | ||
226 | FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
227 | FB_VMODE_NONINTERLACED, 0 } | ||
228 | }; | ||
229 | |||
230 | static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) | ||
231 | { | ||
232 | if (olpc_has_dcon()) { | ||
233 | *modedb = (struct fb_videomode *) olpc_dcon_modedb; | ||
234 | *size = ARRAY_SIZE(olpc_dcon_modedb); | ||
235 | } else { | ||
236 | *modedb = (struct fb_videomode *) geode_modedb; | ||
237 | *size = ARRAY_SIZE(geode_modedb); | ||
238 | } | ||
239 | } | ||
240 | |||
241 | #else | ||
242 | static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) | ||
243 | { | ||
244 | *modedb = (struct fb_videomode *) geode_modedb; | ||
245 | *size = ARRAY_SIZE(geode_modedb); | ||
246 | } | ||
247 | #endif | ||
248 | |||
218 | static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | 249 | static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
219 | { | 250 | { |
220 | if (var->xres > 1920 || var->yres > 1440) | 251 | if (var->xres > 1920 || var->yres > 1440) |
@@ -333,13 +364,13 @@ static int __init lxfb_map_video_memory(struct fb_info *info, | |||
333 | if (ret) | 364 | if (ret) |
334 | return ret; | 365 | return ret; |
335 | 366 | ||
336 | ret = pci_request_region(dev, 3, "lxfb-vip"); | 367 | ret = pci_request_region(dev, 3, "lxfb-vp"); |
337 | 368 | ||
338 | if (ret) | 369 | if (ret) |
339 | return ret; | 370 | return ret; |
340 | 371 | ||
341 | info->fix.smem_start = pci_resource_start(dev, 0); | 372 | info->fix.smem_start = pci_resource_start(dev, 0); |
342 | info->fix.smem_len = fbsize ? fbsize : lx_framebuffer_size(); | 373 | info->fix.smem_len = vram ? vram : lx_framebuffer_size(); |
343 | 374 | ||
344 | info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); | 375 | info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); |
345 | 376 | ||
@@ -360,18 +391,15 @@ static int __init lxfb_map_video_memory(struct fb_info *info, | |||
360 | if (par->dc_regs == NULL) | 391 | if (par->dc_regs == NULL) |
361 | return ret; | 392 | return ret; |
362 | 393 | ||
363 | par->df_regs = ioremap(pci_resource_start(dev, 3), | 394 | par->vp_regs = ioremap(pci_resource_start(dev, 3), |
364 | pci_resource_len(dev, 3)); | 395 | pci_resource_len(dev, 3)); |
365 | 396 | ||
366 | if (par->df_regs == NULL) | 397 | if (par->vp_regs == NULL) |
367 | return ret; | 398 | return ret; |
368 | 399 | ||
369 | writel(DC_UNLOCK_CODE, par->dc_regs + DC_UNLOCK); | 400 | write_dc(par, DC_UNLOCK, DC_UNLOCK_UNLOCK); |
370 | 401 | write_dc(par, DC_GLIU0_MEM_OFFSET, info->fix.smem_start & 0xFF000000); | |
371 | writel(info->fix.smem_start & 0xFF000000, | 402 | write_dc(par, DC_UNLOCK, DC_UNLOCK_LOCK); |
372 | par->dc_regs + DC_PHY_MEM_OFFSET); | ||
373 | |||
374 | writel(0, par->dc_regs + DC_UNLOCK); | ||
375 | 403 | ||
376 | dev_info(&dev->dev, "%d KB of video memory at 0x%lx\n", | 404 | dev_info(&dev->dev, "%d KB of video memory at 0x%lx\n", |
377 | info->fix.smem_len / 1024, info->fix.smem_start); | 405 | info->fix.smem_len / 1024, info->fix.smem_start); |
@@ -431,6 +459,45 @@ static struct fb_info * __init lxfb_init_fbinfo(struct device *dev) | |||
431 | return info; | 459 | return info; |
432 | } | 460 | } |
433 | 461 | ||
462 | #ifdef CONFIG_PM | ||
463 | static int lxfb_suspend(struct pci_dev *pdev, pm_message_t state) | ||
464 | { | ||
465 | struct fb_info *info = pci_get_drvdata(pdev); | ||
466 | |||
467 | if (state.event == PM_EVENT_SUSPEND) { | ||
468 | acquire_console_sem(); | ||
469 | lx_powerdown(info); | ||
470 | fb_set_suspend(info, 1); | ||
471 | release_console_sem(); | ||
472 | } | ||
473 | |||
474 | /* there's no point in setting PCI states; we emulate PCI, so | ||
475 | * we don't end up getting power savings anyways */ | ||
476 | |||
477 | return 0; | ||
478 | } | ||
479 | |||
480 | static int lxfb_resume(struct pci_dev *pdev) | ||
481 | { | ||
482 | struct fb_info *info = pci_get_drvdata(pdev); | ||
483 | int ret; | ||
484 | |||
485 | acquire_console_sem(); | ||
486 | ret = lx_powerup(info); | ||
487 | if (ret) { | ||
488 | printk(KERN_ERR "lxfb: power up failed!\n"); | ||
489 | return ret; | ||
490 | } | ||
491 | |||
492 | fb_set_suspend(info, 0); | ||
493 | release_console_sem(); | ||
494 | return 0; | ||
495 | } | ||
496 | #else | ||
497 | #define lxfb_suspend NULL | ||
498 | #define lxfb_resume NULL | ||
499 | #endif | ||
500 | |||
434 | static int __init lxfb_probe(struct pci_dev *pdev, | 501 | static int __init lxfb_probe(struct pci_dev *pdev, |
435 | const struct pci_device_id *id) | 502 | const struct pci_device_id *id) |
436 | { | 503 | { |
@@ -439,7 +506,7 @@ static int __init lxfb_probe(struct pci_dev *pdev, | |||
439 | int ret; | 506 | int ret; |
440 | 507 | ||
441 | struct fb_videomode *modedb_ptr; | 508 | struct fb_videomode *modedb_ptr; |
442 | int modedb_size; | 509 | unsigned int modedb_size; |
443 | 510 | ||
444 | info = lxfb_init_fbinfo(&pdev->dev); | 511 | info = lxfb_init_fbinfo(&pdev->dev); |
445 | 512 | ||
@@ -464,9 +531,7 @@ static int __init lxfb_probe(struct pci_dev *pdev, | |||
464 | 531 | ||
465 | /* Set up the mode database */ | 532 | /* Set up the mode database */ |
466 | 533 | ||
467 | modedb_ptr = (struct fb_videomode *) geode_modedb; | 534 | get_modedb(&modedb_ptr, &modedb_size); |
468 | modedb_size = ARRAY_SIZE(geode_modedb); | ||
469 | |||
470 | ret = fb_find_mode(&info->var, info, mode_option, | 535 | ret = fb_find_mode(&info->var, info, mode_option, |
471 | modedb_ptr, modedb_size, NULL, 16); | 536 | modedb_ptr, modedb_size, NULL, 16); |
472 | 537 | ||
@@ -487,6 +552,8 @@ static int __init lxfb_probe(struct pci_dev *pdev, | |||
487 | lxfb_check_var(&info->var, info); | 552 | lxfb_check_var(&info->var, info); |
488 | lxfb_set_par(info); | 553 | lxfb_set_par(info); |
489 | 554 | ||
555 | pm_set_vt_switch(vt_switch); | ||
556 | |||
490 | if (register_framebuffer(info) < 0) { | 557 | if (register_framebuffer(info) < 0) { |
491 | ret = -EINVAL; | 558 | ret = -EINVAL; |
492 | goto err; | 559 | goto err; |
@@ -510,8 +577,8 @@ err: | |||
510 | iounmap(par->dc_regs); | 577 | iounmap(par->dc_regs); |
511 | pci_release_region(pdev, 2); | 578 | pci_release_region(pdev, 2); |
512 | } | 579 | } |
513 | if (par->df_regs) { | 580 | if (par->vp_regs) { |
514 | iounmap(par->df_regs); | 581 | iounmap(par->vp_regs); |
515 | pci_release_region(pdev, 3); | 582 | pci_release_region(pdev, 3); |
516 | } | 583 | } |
517 | 584 | ||
@@ -537,7 +604,7 @@ static void lxfb_remove(struct pci_dev *pdev) | |||
537 | iounmap(par->dc_regs); | 604 | iounmap(par->dc_regs); |
538 | pci_release_region(pdev, 2); | 605 | pci_release_region(pdev, 2); |
539 | 606 | ||
540 | iounmap(par->df_regs); | 607 | iounmap(par->vp_regs); |
541 | pci_release_region(pdev, 3); | 608 | pci_release_region(pdev, 3); |
542 | 609 | ||
543 | pci_set_drvdata(pdev, NULL); | 610 | pci_set_drvdata(pdev, NULL); |
@@ -556,6 +623,8 @@ static struct pci_driver lxfb_driver = { | |||
556 | .id_table = lxfb_id_table, | 623 | .id_table = lxfb_id_table, |
557 | .probe = lxfb_probe, | 624 | .probe = lxfb_probe, |
558 | .remove = lxfb_remove, | 625 | .remove = lxfb_remove, |
626 | .suspend = lxfb_suspend, | ||
627 | .resume = lxfb_resume, | ||
559 | }; | 628 | }; |
560 | 629 | ||
561 | #ifndef MODULE | 630 | #ifndef MODULE |
@@ -570,9 +639,7 @@ static int __init lxfb_setup(char *options) | |||
570 | if (!*opt) | 639 | if (!*opt) |
571 | continue; | 640 | continue; |
572 | 641 | ||
573 | if (!strncmp(opt, "fbsize:", 7)) | 642 | if (!strcmp(opt, "noclear")) |
574 | fbsize = simple_strtoul(opt+7, NULL, 0); | ||
575 | else if (!strcmp(opt, "noclear")) | ||
576 | noclear = 1; | 643 | noclear = 1; |
577 | else if (!strcmp(opt, "nopanel")) | 644 | else if (!strcmp(opt, "nopanel")) |
578 | nopanel = 1; | 645 | nopanel = 1; |
@@ -609,8 +676,11 @@ module_exit(lxfb_cleanup); | |||
609 | module_param(mode_option, charp, 0); | 676 | module_param(mode_option, charp, 0); |
610 | MODULE_PARM_DESC(mode_option, "video mode (<x>x<y>[-<bpp>][@<refr>])"); | 677 | MODULE_PARM_DESC(mode_option, "video mode (<x>x<y>[-<bpp>][@<refr>])"); |
611 | 678 | ||
612 | module_param(fbsize, int, 0); | 679 | module_param(vram, int, 0); |
613 | MODULE_PARM_DESC(fbsize, "video memory size"); | 680 | MODULE_PARM_DESC(vram, "video memory size"); |
681 | |||
682 | module_param(vt_switch, int, 0); | ||
683 | MODULE_PARM_DESC(vt_switch, "enable VT switch during suspend/resume"); | ||
614 | 684 | ||
615 | MODULE_DESCRIPTION("Framebuffer driver for the AMD Geode LX"); | 685 | MODULE_DESCRIPTION("Framebuffer driver for the AMD Geode LX"); |
616 | MODULE_LICENSE("GPL"); | 686 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/video/geode/lxfb_ops.c b/drivers/video/geode/lxfb_ops.c index 4fbc99be96ef..cd9d4cc26954 100644 --- a/drivers/video/geode/lxfb_ops.c +++ b/drivers/video/geode/lxfb_ops.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/fb.h> | 13 | #include <linux/fb.h> |
14 | #include <linux/uaccess.h> | 14 | #include <linux/uaccess.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <asm/geode.h> | ||
16 | 17 | ||
17 | #include "lxfb.h" | 18 | #include "lxfb.h" |
18 | 19 | ||
@@ -34,35 +35,85 @@ static const struct { | |||
34 | unsigned int pllval; | 35 | unsigned int pllval; |
35 | unsigned int freq; | 36 | unsigned int freq; |
36 | } pll_table[] = { | 37 | } pll_table[] = { |
37 | { 0x000031AC, 24923 }, | 38 | { 0x000131AC, 6231 }, |
38 | { 0x0000215D, 25175 }, | 39 | { 0x0001215D, 6294 }, |
39 | { 0x00001087, 27000 }, | 40 | { 0x00011087, 6750 }, |
40 | { 0x0000216C, 28322 }, | 41 | { 0x0001216C, 7081 }, |
41 | { 0x0000218D, 28560 }, | 42 | { 0x0001218D, 7140 }, |
42 | { 0x000010C9, 31200 }, | 43 | { 0x000110C9, 7800 }, |
43 | { 0x00003147, 31500 }, | 44 | { 0x00013147, 7875 }, |
44 | { 0x000010A7, 33032 }, | 45 | { 0x000110A7, 8258 }, |
45 | { 0x00002159, 35112 }, | 46 | { 0x00012159, 8778 }, |
46 | { 0x00004249, 35500 }, | 47 | { 0x00014249, 8875 }, |
47 | { 0x00000057, 36000 }, | 48 | { 0x00010057, 9000 }, |
48 | { 0x0000219A, 37889 }, | 49 | { 0x0001219A, 9472 }, |
49 | { 0x00002158, 39168 }, | 50 | { 0x00012158, 9792 }, |
50 | { 0x00000045, 40000 }, | 51 | { 0x00010045, 10000 }, |
51 | { 0x00000089, 43163 }, | 52 | { 0x00010089, 10791 }, |
52 | { 0x000010E7, 44900 }, | 53 | { 0x000110E7, 11225 }, |
53 | { 0x00002136, 45720 }, | 54 | { 0x00012136, 11430 }, |
54 | { 0x00003207, 49500 }, | 55 | { 0x00013207, 12375 }, |
55 | { 0x00002187, 50000 }, | 56 | { 0x00012187, 12500 }, |
56 | { 0x00004286, 56250 }, | 57 | { 0x00014286, 14063 }, |
57 | { 0x000010E5, 60065 }, | 58 | { 0x000110E5, 15016 }, |
58 | { 0x00004214, 65000 }, | 59 | { 0x00014214, 16250 }, |
59 | { 0x00001105, 68179 }, | 60 | { 0x00011105, 17045 }, |
60 | { 0x000031E4, 74250 }, | 61 | { 0x000131E4, 18563 }, |
61 | { 0x00003183, 75000 }, | 62 | { 0x00013183, 18750 }, |
62 | { 0x00004284, 78750 }, | 63 | { 0x00014284, 19688 }, |
63 | { 0x00001104, 81600 }, | 64 | { 0x00011104, 20400 }, |
64 | { 0x00006363, 94500 }, | 65 | { 0x00016363, 23625 }, |
65 | { 0x00005303, 97520 }, | 66 | { 0x00015303, 24380 }, |
67 | { 0x000031AC, 24923 }, | ||
68 | { 0x0000215D, 25175 }, | ||
69 | { 0x00001087, 27000 }, | ||
70 | { 0x0000216C, 28322 }, | ||
71 | { 0x0000218D, 28560 }, | ||
72 | { 0x00010041, 29913 }, | ||
73 | { 0x000010C9, 31200 }, | ||
74 | { 0x00003147, 31500 }, | ||
75 | { 0x000141A1, 32400 }, | ||
76 | { 0x000010A7, 33032 }, | ||
77 | { 0x00012182, 33375 }, | ||
78 | { 0x000141B1, 33750 }, | ||
79 | { 0x00002159, 35112 }, | ||
80 | { 0x00004249, 35500 }, | ||
81 | { 0x00000057, 36000 }, | ||
82 | { 0x000141E1, 37125 }, | ||
83 | { 0x0000219A, 37889 }, | ||
84 | { 0x00002158, 39168 }, | ||
85 | { 0x00000045, 40000 }, | ||
86 | { 0x000131A1, 40500 }, | ||
87 | { 0x00010061, 42301 }, | ||
88 | { 0x00000089, 43163 }, | ||
89 | { 0x00012151, 43875 }, | ||
90 | { 0x000010E7, 44900 }, | ||
91 | { 0x00002136, 45720 }, | ||
92 | { 0x000152E1, 47250 }, | ||
93 | { 0x00010071, 48000 }, | ||
94 | { 0x00003207, 49500 }, | ||
95 | { 0x00002187, 50000 }, | ||
96 | { 0x00014291, 50625 }, | ||
97 | { 0x00011101, 51188 }, | ||
98 | { 0x00017481, 54563 }, | ||
99 | { 0x00004286, 56250 }, | ||
100 | { 0x00014170, 57375 }, | ||
101 | { 0x00016210, 58500 }, | ||
102 | { 0x000010E5, 60065 }, | ||
103 | { 0x00013140, 62796 }, | ||
104 | { 0x00004214, 65000 }, | ||
105 | { 0x00016250, 65250 }, | ||
106 | { 0x00001105, 68179 }, | ||
107 | { 0x000141C0, 69600 }, | ||
108 | { 0x00015220, 70160 }, | ||
109 | { 0x00010050, 72000 }, | ||
110 | { 0x000031E4, 74250 }, | ||
111 | { 0x00003183, 75000 }, | ||
112 | { 0x00004284, 78750 }, | ||
113 | { 0x00012130, 80052 }, | ||
114 | { 0x00001104, 81600 }, | ||
115 | { 0x00006363, 94500 }, | ||
116 | { 0x00005303, 97520 }, | ||
66 | { 0x00002183, 100187 }, | 117 | { 0x00002183, 100187 }, |
67 | { 0x00002122, 101420 }, | 118 | { 0x00002122, 101420 }, |
68 | { 0x00001081, 108000 }, | 119 | { 0x00001081, 108000 }, |
@@ -101,16 +152,16 @@ static void lx_set_dotpll(u32 pllval) | |||
101 | u32 dotpll_lo, dotpll_hi; | 152 | u32 dotpll_lo, dotpll_hi; |
102 | int i; | 153 | int i; |
103 | 154 | ||
104 | rdmsr(MSR_LX_GLCP_DOTPLL, dotpll_lo, dotpll_hi); | 155 | rdmsr(MSR_GLCP_DOTPLL, dotpll_lo, dotpll_hi); |
105 | 156 | ||
106 | if ((dotpll_lo & GLCP_DOTPLL_LOCK) && (dotpll_hi == pllval)) | 157 | if ((dotpll_lo & MSR_GLCP_DOTPLL_LOCK) && (dotpll_hi == pllval)) |
107 | return; | 158 | return; |
108 | 159 | ||
109 | dotpll_hi = pllval; | 160 | dotpll_hi = pllval; |
110 | dotpll_lo &= ~(GLCP_DOTPLL_BYPASS | GLCP_DOTPLL_HALFPIX); | 161 | dotpll_lo &= ~(MSR_GLCP_DOTPLL_BYPASS | MSR_GLCP_DOTPLL_HALFPIX); |
111 | dotpll_lo |= GLCP_DOTPLL_RESET; | 162 | dotpll_lo |= MSR_GLCP_DOTPLL_DOTRESET; |
112 | 163 | ||
113 | wrmsr(MSR_LX_GLCP_DOTPLL, dotpll_lo, dotpll_hi); | 164 | wrmsr(MSR_GLCP_DOTPLL, dotpll_lo, dotpll_hi); |
114 | 165 | ||
115 | /* Wait 100us for the PLL to lock */ | 166 | /* Wait 100us for the PLL to lock */ |
116 | 167 | ||
@@ -119,15 +170,15 @@ static void lx_set_dotpll(u32 pllval) | |||
119 | /* Now, loop for the lock bit */ | 170 | /* Now, loop for the lock bit */ |
120 | 171 | ||
121 | for (i = 0; i < 1000; i++) { | 172 | for (i = 0; i < 1000; i++) { |
122 | rdmsr(MSR_LX_GLCP_DOTPLL, dotpll_lo, dotpll_hi); | 173 | rdmsr(MSR_GLCP_DOTPLL, dotpll_lo, dotpll_hi); |
123 | if (dotpll_lo & GLCP_DOTPLL_LOCK) | 174 | if (dotpll_lo & MSR_GLCP_DOTPLL_LOCK) |
124 | break; | 175 | break; |
125 | } | 176 | } |
126 | 177 | ||
127 | /* Clear the reset bit */ | 178 | /* Clear the reset bit */ |
128 | 179 | ||
129 | dotpll_lo &= ~GLCP_DOTPLL_RESET; | 180 | dotpll_lo &= ~MSR_GLCP_DOTPLL_DOTRESET; |
130 | wrmsr(MSR_LX_GLCP_DOTPLL, dotpll_lo, dotpll_hi); | 181 | wrmsr(MSR_GLCP_DOTPLL, dotpll_lo, dotpll_hi); |
131 | } | 182 | } |
132 | 183 | ||
133 | /* Set the clock based on the frequency specified by the current mode */ | 184 | /* Set the clock based on the frequency specified by the current mode */ |
@@ -137,7 +188,7 @@ static void lx_set_clock(struct fb_info *info) | |||
137 | unsigned int diff, min, best = 0; | 188 | unsigned int diff, min, best = 0; |
138 | unsigned int freq, i; | 189 | unsigned int freq, i; |
139 | 190 | ||
140 | freq = (unsigned int) (0x3b9aca00 / info->var.pixclock); | 191 | freq = (unsigned int) (1000000000 / info->var.pixclock); |
141 | 192 | ||
142 | min = abs(pll_table[0].freq - freq); | 193 | min = abs(pll_table[0].freq - freq); |
143 | 194 | ||
@@ -149,7 +200,7 @@ static void lx_set_clock(struct fb_info *info) | |||
149 | } | 200 | } |
150 | } | 201 | } |
151 | 202 | ||
152 | lx_set_dotpll(pll_table[best].pllval & 0x7FFF); | 203 | lx_set_dotpll(pll_table[best].pllval & 0x00017FFF); |
153 | } | 204 | } |
154 | 205 | ||
155 | static void lx_graphics_disable(struct fb_info *info) | 206 | static void lx_graphics_disable(struct fb_info *info) |
@@ -159,63 +210,62 @@ static void lx_graphics_disable(struct fb_info *info) | |||
159 | 210 | ||
160 | /* Note: This assumes that the video is in a quitet state */ | 211 | /* Note: This assumes that the video is in a quitet state */ |
161 | 212 | ||
162 | writel(0, par->df_regs + DF_ALPHA_CONTROL_1); | 213 | write_vp(par, VP_A1T, 0); |
163 | writel(0, par->df_regs + DF_ALPHA_CONTROL_1 + 32); | 214 | write_vp(par, VP_A2T, 0); |
164 | writel(0, par->df_regs + DF_ALPHA_CONTROL_1 + 64); | 215 | write_vp(par, VP_A3T, 0); |
165 | 216 | ||
166 | /* Turn off the VGA and video enable */ | 217 | /* Turn off the VGA and video enable */ |
167 | val = readl (par->dc_regs + DC_GENERAL_CFG) & | 218 | val = read_dc(par, DC_GENERAL_CFG) & ~(DC_GENERAL_CFG_VGAE | |
168 | ~(DC_GCFG_VGAE | DC_GCFG_VIDE); | 219 | DC_GENERAL_CFG_VIDE); |
169 | 220 | ||
170 | writel(val, par->dc_regs + DC_GENERAL_CFG); | 221 | write_dc(par, DC_GENERAL_CFG, val); |
171 | 222 | ||
172 | val = readl(par->df_regs + DF_VIDEO_CFG) & ~DF_VCFG_VID_EN; | 223 | val = read_vp(par, VP_VCFG) & ~VP_VCFG_VID_EN; |
173 | writel(val, par->df_regs + DF_VIDEO_CFG); | 224 | write_vp(par, VP_VCFG, val); |
174 | 225 | ||
175 | writel( DC_IRQ_MASK | DC_VSYNC_IRQ_MASK | | 226 | write_dc(par, DC_IRQ, DC_IRQ_MASK | DC_IRQ_VIP_VSYNC_LOSS_IRQ_MASK | |
176 | DC_IRQ_STATUS | DC_VSYNC_IRQ_STATUS, | 227 | DC_IRQ_STATUS | DC_IRQ_VIP_VSYNC_IRQ_STATUS); |
177 | par->dc_regs + DC_IRQ); | ||
178 | 228 | ||
179 | val = readl(par->dc_regs + DC_GENLCK_CTRL) & ~DC_GENLCK_ENABLE; | 229 | val = read_dc(par, DC_GENLK_CTL) & ~DC_GENLK_CTL_GENLK_EN; |
180 | writel(val, par->dc_regs + DC_GENLCK_CTRL); | 230 | write_dc(par, DC_GENLK_CTL, val); |
181 | 231 | ||
182 | val = readl(par->dc_regs + DC_COLOR_KEY) & ~DC_CLR_KEY_ENABLE; | 232 | val = read_dc(par, DC_CLR_KEY); |
183 | writel(val & ~DC_CLR_KEY_ENABLE, par->dc_regs + DC_COLOR_KEY); | 233 | write_dc(par, DC_CLR_KEY, val & ~DC_CLR_KEY_CLR_KEY_EN); |
184 | 234 | ||
185 | /* We don't actually blank the panel, due to the long latency | 235 | /* turn off the panel */ |
186 | involved with bringing it back */ | 236 | write_fp(par, FP_PM, read_fp(par, FP_PM) & ~FP_PM_P); |
187 | 237 | ||
188 | val = readl(par->df_regs + DF_MISC) | DF_MISC_DAC_PWRDN; | 238 | val = read_vp(par, VP_MISC) | VP_MISC_DACPWRDN; |
189 | writel(val, par->df_regs + DF_MISC); | 239 | write_vp(par, VP_MISC, val); |
190 | 240 | ||
191 | /* Turn off the display */ | 241 | /* Turn off the display */ |
192 | 242 | ||
193 | val = readl(par->df_regs + DF_DISPLAY_CFG); | 243 | val = read_vp(par, VP_DCFG); |
194 | writel(val & ~(DF_DCFG_CRT_EN | DF_DCFG_HSYNC_EN | DF_DCFG_VSYNC_EN | | 244 | write_vp(par, VP_DCFG, val & ~(VP_DCFG_CRT_EN | VP_DCFG_HSYNC_EN | |
195 | DF_DCFG_DAC_BL_EN), par->df_regs + DF_DISPLAY_CFG); | 245 | VP_DCFG_VSYNC_EN | VP_DCFG_DAC_BL_EN)); |
196 | 246 | ||
197 | gcfg = readl(par->dc_regs + DC_GENERAL_CFG); | 247 | gcfg = read_dc(par, DC_GENERAL_CFG); |
198 | gcfg &= ~(DC_GCFG_CMPE | DC_GCFG_DECE); | 248 | gcfg &= ~(DC_GENERAL_CFG_CMPE | DC_GENERAL_CFG_DECE); |
199 | writel(gcfg, par->dc_regs + DC_GENERAL_CFG); | 249 | write_dc(par, DC_GENERAL_CFG, gcfg); |
200 | 250 | ||
201 | /* Turn off the TGEN */ | 251 | /* Turn off the TGEN */ |
202 | val = readl(par->dc_regs + DC_DISPLAY_CFG); | 252 | val = read_dc(par, DC_DISPLAY_CFG); |
203 | val &= ~DC_DCFG_TGEN; | 253 | val &= ~DC_DISPLAY_CFG_TGEN; |
204 | writel(val, par->dc_regs + DC_DISPLAY_CFG); | 254 | write_dc(par, DC_DISPLAY_CFG, val); |
205 | 255 | ||
206 | /* Wait 1000 usecs to ensure that the TGEN is clear */ | 256 | /* Wait 1000 usecs to ensure that the TGEN is clear */ |
207 | udelay(1000); | 257 | udelay(1000); |
208 | 258 | ||
209 | /* Turn off the FIFO loader */ | 259 | /* Turn off the FIFO loader */ |
210 | 260 | ||
211 | gcfg &= ~DC_GCFG_DFLE; | 261 | gcfg &= ~DC_GENERAL_CFG_DFLE; |
212 | writel(gcfg, par->dc_regs + DC_GENERAL_CFG); | 262 | write_dc(par, DC_GENERAL_CFG, gcfg); |
213 | 263 | ||
214 | /* Lastly, wait for the GP to go idle */ | 264 | /* Lastly, wait for the GP to go idle */ |
215 | 265 | ||
216 | do { | 266 | do { |
217 | val = readl(par->gp_regs + GP_BLT_STATUS); | 267 | val = read_gp(par, GP_BLT_STATUS); |
218 | } while ((val & GP_BS_BLT_BUSY) || !(val & GP_BS_CB_EMPTY)); | 268 | } while ((val & GP_BLT_STATUS_PB) || !(val & GP_BLT_STATUS_CE)); |
219 | } | 269 | } |
220 | 270 | ||
221 | static void lx_graphics_enable(struct fb_info *info) | 271 | static void lx_graphics_enable(struct fb_info *info) |
@@ -224,80 +274,85 @@ static void lx_graphics_enable(struct fb_info *info) | |||
224 | u32 temp, config; | 274 | u32 temp, config; |
225 | 275 | ||
226 | /* Set the video request register */ | 276 | /* Set the video request register */ |
227 | writel(0, par->df_regs + DF_VIDEO_REQUEST); | 277 | write_vp(par, VP_VRR, 0); |
228 | 278 | ||
229 | /* Set up the polarities */ | 279 | /* Set up the polarities */ |
230 | 280 | ||
231 | config = readl(par->df_regs + DF_DISPLAY_CFG); | 281 | config = read_vp(par, VP_DCFG); |
232 | 282 | ||
233 | config &= ~(DF_DCFG_CRT_SYNC_SKW_MASK | DF_DCFG_PWR_SEQ_DLY_MASK | | 283 | config &= ~(VP_DCFG_CRT_SYNC_SKW | VP_DCFG_PWR_SEQ_DELAY | |
234 | DF_DCFG_CRT_HSYNC_POL | DF_DCFG_CRT_VSYNC_POL); | 284 | VP_DCFG_CRT_HSYNC_POL | VP_DCFG_CRT_VSYNC_POL); |
235 | 285 | ||
236 | config |= (DF_DCFG_CRT_SYNC_SKW_INIT | DF_DCFG_PWR_SEQ_DLY_INIT | | 286 | config |= (VP_DCFG_CRT_SYNC_SKW_DEFAULT | VP_DCFG_PWR_SEQ_DELAY_DEFAULT |
237 | DF_DCFG_GV_PAL_BYP); | 287 | | VP_DCFG_GV_GAM); |
238 | 288 | ||
239 | if (info->var.sync & FB_SYNC_HOR_HIGH_ACT) | 289 | if (info->var.sync & FB_SYNC_HOR_HIGH_ACT) |
240 | config |= DF_DCFG_CRT_HSYNC_POL; | 290 | config |= VP_DCFG_CRT_HSYNC_POL; |
241 | 291 | ||
242 | if (info->var.sync & FB_SYNC_VERT_HIGH_ACT) | 292 | if (info->var.sync & FB_SYNC_VERT_HIGH_ACT) |
243 | config |= DF_DCFG_CRT_VSYNC_POL; | 293 | config |= VP_DCFG_CRT_VSYNC_POL; |
244 | 294 | ||
245 | if (par->output & OUTPUT_PANEL) { | 295 | if (par->output & OUTPUT_PANEL) { |
246 | u32 msrlo, msrhi; | 296 | u32 msrlo, msrhi; |
247 | 297 | ||
248 | writel(DF_DEFAULT_TFT_PMTIM1, | 298 | write_fp(par, FP_PT1, 0); |
249 | par->df_regs + DF_PANEL_TIM1); | 299 | write_fp(par, FP_PT2, FP_PT2_SCRC); |
250 | writel(DF_DEFAULT_TFT_PMTIM2, | 300 | write_fp(par, FP_DFC, FP_DFC_BC); |
251 | par->df_regs + DF_PANEL_TIM2); | ||
252 | writel(DF_DEFAULT_TFT_DITHCTL, | ||
253 | par->df_regs + DF_DITHER_CONTROL); | ||
254 | 301 | ||
255 | msrlo = DF_DEFAULT_TFT_PAD_SEL_LOW; | 302 | msrlo = MSR_LX_MSR_PADSEL_TFT_SEL_LOW; |
256 | msrhi = DF_DEFAULT_TFT_PAD_SEL_HIGH; | 303 | msrhi = MSR_LX_MSR_PADSEL_TFT_SEL_HIGH; |
257 | 304 | ||
258 | wrmsr(MSR_LX_DF_PADSEL, msrlo, msrhi); | 305 | wrmsr(MSR_LX_MSR_PADSEL, msrlo, msrhi); |
259 | } | 306 | } |
260 | 307 | ||
261 | if (par->output & OUTPUT_CRT) { | 308 | if (par->output & OUTPUT_CRT) { |
262 | config |= DF_DCFG_CRT_EN | DF_DCFG_HSYNC_EN | | 309 | config |= VP_DCFG_CRT_EN | VP_DCFG_HSYNC_EN | |
263 | DF_DCFG_VSYNC_EN | DF_DCFG_DAC_BL_EN; | 310 | VP_DCFG_VSYNC_EN | VP_DCFG_DAC_BL_EN; |
264 | } | 311 | } |
265 | 312 | ||
266 | writel(config, par->df_regs + DF_DISPLAY_CFG); | 313 | write_vp(par, VP_DCFG, config); |
267 | 314 | ||
268 | /* Turn the CRT dacs back on */ | 315 | /* Turn the CRT dacs back on */ |
269 | 316 | ||
270 | if (par->output & OUTPUT_CRT) { | 317 | if (par->output & OUTPUT_CRT) { |
271 | temp = readl(par->df_regs + DF_MISC); | 318 | temp = read_vp(par, VP_MISC); |
272 | temp &= ~(DF_MISC_DAC_PWRDN | DF_MISC_A_PWRDN); | 319 | temp &= ~(VP_MISC_DACPWRDN | VP_MISC_APWRDN); |
273 | writel(temp, par->df_regs + DF_MISC); | 320 | write_vp(par, VP_MISC, temp); |
274 | } | 321 | } |
275 | 322 | ||
276 | /* Turn the panel on (if it isn't already) */ | 323 | /* Turn the panel on (if it isn't already) */ |
277 | 324 | if (par->output & OUTPUT_PANEL) | |
278 | if (par->output & OUTPUT_PANEL) { | 325 | write_fp(par, FP_PM, read_fp(par, FP_PM) | FP_PM_P); |
279 | temp = readl(par->df_regs + DF_FP_PM); | ||
280 | |||
281 | if (!(temp & 0x09)) | ||
282 | writel(temp | DF_FP_PM_P, par->df_regs + DF_FP_PM); | ||
283 | } | ||
284 | |||
285 | temp = readl(par->df_regs + DF_MISC); | ||
286 | temp = readl(par->df_regs + DF_DISPLAY_CFG); | ||
287 | } | 326 | } |
288 | 327 | ||
289 | unsigned int lx_framebuffer_size(void) | 328 | unsigned int lx_framebuffer_size(void) |
290 | { | 329 | { |
291 | unsigned int val; | 330 | unsigned int val; |
292 | 331 | ||
332 | if (!geode_has_vsa2()) { | ||
333 | uint32_t hi, lo; | ||
334 | |||
335 | /* The number of pages is (PMAX - PMIN)+1 */ | ||
336 | rdmsr(MSR_GLIU_P2D_RO0, lo, hi); | ||
337 | |||
338 | /* PMAX */ | ||
339 | val = ((hi & 0xff) << 12) | ((lo & 0xfff00000) >> 20); | ||
340 | /* PMIN */ | ||
341 | val -= (lo & 0x000fffff); | ||
342 | val += 1; | ||
343 | |||
344 | /* The page size is 4k */ | ||
345 | return (val << 12); | ||
346 | } | ||
347 | |||
293 | /* The frame buffer size is reported by a VSM in VSA II */ | 348 | /* The frame buffer size is reported by a VSM in VSA II */ |
294 | /* Virtual Register Class = 0x02 */ | 349 | /* Virtual Register Class = 0x02 */ |
295 | /* VG_MEM_SIZE (1MB units) = 0x00 */ | 350 | /* VG_MEM_SIZE (1MB units) = 0x00 */ |
296 | 351 | ||
297 | outw(0xFC53, 0xAC1C); | 352 | outw(VSA_VR_UNLOCK, VSA_VRC_INDEX); |
298 | outw(0x0200, 0xAC1C); | 353 | outw(VSA_VR_MEM_SIZE, VSA_VRC_INDEX); |
299 | 354 | ||
300 | val = (unsigned int)(inw(0xAC1E)) & 0xFE; | 355 | val = (unsigned int)(inw(VSA_VRC_DATA)) & 0xFE; |
301 | return (val << 20); | 356 | return (val << 20); |
302 | } | 357 | } |
303 | 358 | ||
@@ -313,7 +368,7 @@ void lx_set_mode(struct fb_info *info) | |||
313 | int vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal; | 368 | int vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal; |
314 | 369 | ||
315 | /* Unlock the DC registers */ | 370 | /* Unlock the DC registers */ |
316 | writel(DC_UNLOCK_CODE, par->dc_regs + DC_UNLOCK); | 371 | write_dc(par, DC_UNLOCK, DC_UNLOCK_UNLOCK); |
317 | 372 | ||
318 | lx_graphics_disable(info); | 373 | lx_graphics_disable(info); |
319 | 374 | ||
@@ -321,102 +376,104 @@ void lx_set_mode(struct fb_info *info) | |||
321 | 376 | ||
322 | /* Set output mode */ | 377 | /* Set output mode */ |
323 | 378 | ||
324 | rdmsrl(MSR_LX_DF_GLCONFIG, msrval); | 379 | rdmsrl(MSR_LX_GLD_MSR_CONFIG, msrval); |
325 | msrval &= ~DF_CONFIG_OUTPUT_MASK; | 380 | msrval &= ~MSR_LX_GLD_MSR_CONFIG_FMT; |
326 | 381 | ||
327 | if (par->output & OUTPUT_PANEL) { | 382 | if (par->output & OUTPUT_PANEL) { |
328 | msrval |= DF_OUTPUT_PANEL; | 383 | msrval |= MSR_LX_GLD_MSR_CONFIG_FMT_FP; |
329 | 384 | ||
330 | if (par->output & OUTPUT_CRT) | 385 | if (par->output & OUTPUT_CRT) |
331 | msrval |= DF_SIMULTANEOUS_CRT_AND_FP; | 386 | msrval |= MSR_LX_GLD_MSR_CONFIG_FPC; |
332 | else | 387 | else |
333 | msrval &= ~DF_SIMULTANEOUS_CRT_AND_FP; | 388 | msrval &= ~MSR_LX_GLD_MSR_CONFIG_FPC; |
334 | } else { | 389 | } else |
335 | msrval |= DF_OUTPUT_CRT; | 390 | msrval |= MSR_LX_GLD_MSR_CONFIG_FMT_CRT; |
336 | } | ||
337 | 391 | ||
338 | wrmsrl(MSR_LX_DF_GLCONFIG, msrval); | 392 | wrmsrl(MSR_LX_GLD_MSR_CONFIG, msrval); |
339 | 393 | ||
340 | /* Clear the various buffers */ | 394 | /* Clear the various buffers */ |
341 | /* FIXME: Adjust for panning here */ | 395 | /* FIXME: Adjust for panning here */ |
342 | 396 | ||
343 | writel(0, par->dc_regs + DC_FB_START); | 397 | write_dc(par, DC_FB_ST_OFFSET, 0); |
344 | writel(0, par->dc_regs + DC_CB_START); | 398 | write_dc(par, DC_CB_ST_OFFSET, 0); |
345 | writel(0, par->dc_regs + DC_CURSOR_START); | 399 | write_dc(par, DC_CURS_ST_OFFSET, 0); |
346 | 400 | ||
347 | /* FIXME: Add support for interlacing */ | 401 | /* FIXME: Add support for interlacing */ |
348 | /* FIXME: Add support for scaling */ | 402 | /* FIXME: Add support for scaling */ |
349 | 403 | ||
350 | val = readl(par->dc_regs + DC_GENLCK_CTRL); | 404 | val = read_dc(par, DC_GENLK_CTL); |
351 | val &= ~(DC_GC_ALPHA_FLICK_ENABLE | | 405 | val &= ~(DC_GENLK_CTL_ALPHA_FLICK_EN | DC_GENLK_CTL_FLICK_EN | |
352 | DC_GC_FLICKER_FILTER_ENABLE | DC_GC_FLICKER_FILTER_MASK); | 406 | DC_GENLK_CTL_FLICK_SEL_MASK); |
353 | 407 | ||
354 | /* Default scaling params */ | 408 | /* Default scaling params */ |
355 | 409 | ||
356 | writel((0x4000 << 16) | 0x4000, par->dc_regs + DC_GFX_SCALE); | 410 | write_dc(par, DC_GFX_SCALE, (0x4000 << 16) | 0x4000); |
357 | writel(0, par->dc_regs + DC_IRQ_FILT_CTL); | 411 | write_dc(par, DC_IRQ_FILT_CTL, 0); |
358 | writel(val, par->dc_regs + DC_GENLCK_CTRL); | 412 | write_dc(par, DC_GENLK_CTL, val); |
359 | 413 | ||
360 | /* FIXME: Support compression */ | 414 | /* FIXME: Support compression */ |
361 | 415 | ||
362 | if (info->fix.line_length > 4096) | 416 | if (info->fix.line_length > 4096) |
363 | dv = DC_DV_LINE_SIZE_8192; | 417 | dv = DC_DV_CTL_DV_LINE_SIZE_8K; |
364 | else if (info->fix.line_length > 2048) | 418 | else if (info->fix.line_length > 2048) |
365 | dv = DC_DV_LINE_SIZE_4096; | 419 | dv = DC_DV_CTL_DV_LINE_SIZE_4K; |
366 | else if (info->fix.line_length > 1024) | 420 | else if (info->fix.line_length > 1024) |
367 | dv = DC_DV_LINE_SIZE_2048; | 421 | dv = DC_DV_CTL_DV_LINE_SIZE_2K; |
368 | else | 422 | else |
369 | dv = DC_DV_LINE_SIZE_1024; | 423 | dv = DC_DV_CTL_DV_LINE_SIZE_1K; |
370 | 424 | ||
371 | max = info->fix.line_length * info->var.yres; | 425 | max = info->fix.line_length * info->var.yres; |
372 | max = (max + 0x3FF) & 0xFFFFFC00; | 426 | max = (max + 0x3FF) & 0xFFFFFC00; |
373 | 427 | ||
374 | writel(max | DC_DV_TOP_ENABLE, par->dc_regs + DC_DV_TOP); | 428 | write_dc(par, DC_DV_TOP, max | DC_DV_TOP_DV_TOP_EN); |
375 | 429 | ||
376 | val = readl(par->dc_regs + DC_DV_CTL) & ~DC_DV_LINE_SIZE_MASK; | 430 | val = read_dc(par, DC_DV_CTL) & ~DC_DV_CTL_DV_LINE_SIZE; |
377 | writel(val | dv, par->dc_regs + DC_DV_CTL); | 431 | write_dc(par, DC_DV_CTL, val | dv); |
378 | 432 | ||
379 | size = info->var.xres * (info->var.bits_per_pixel >> 3); | 433 | size = info->var.xres * (info->var.bits_per_pixel >> 3); |
380 | 434 | ||
381 | writel(info->fix.line_length >> 3, par->dc_regs + DC_GRAPHICS_PITCH); | 435 | write_dc(par, DC_GFX_PITCH, info->fix.line_length >> 3); |
382 | writel((size + 7) >> 3, par->dc_regs + DC_LINE_SIZE); | 436 | write_dc(par, DC_LINE_SIZE, (size + 7) >> 3); |
383 | 437 | ||
384 | /* Set default watermark values */ | 438 | /* Set default watermark values */ |
385 | 439 | ||
386 | rdmsrl(MSR_LX_DC_SPARE, msrval); | 440 | rdmsrl(MSR_LX_SPARE_MSR, msrval); |
387 | 441 | ||
388 | msrval &= ~(DC_SPARE_DISABLE_CFIFO_HGO | DC_SPARE_VFIFO_ARB_SELECT | | 442 | msrval &= ~(MSR_LX_SPARE_MSR_DIS_CFIFO_HGO |
389 | DC_SPARE_LOAD_WM_LPEN_MASK | DC_SPARE_WM_LPEN_OVRD | | 443 | | MSR_LX_SPARE_MSR_VFIFO_ARB_SEL |
390 | DC_SPARE_DISABLE_INIT_VID_PRI | DC_SPARE_DISABLE_VFIFO_WM); | 444 | | MSR_LX_SPARE_MSR_LOAD_WM_LPEN_M |
391 | msrval |= DC_SPARE_DISABLE_VFIFO_WM | DC_SPARE_DISABLE_INIT_VID_PRI; | 445 | | MSR_LX_SPARE_MSR_WM_LPEN_OVRD); |
392 | wrmsrl(MSR_LX_DC_SPARE, msrval); | 446 | msrval |= MSR_LX_SPARE_MSR_DIS_VIFO_WM | |
393 | 447 | MSR_LX_SPARE_MSR_DIS_INIT_V_PRI; | |
394 | gcfg = DC_GCFG_DFLE; /* Display fifo enable */ | 448 | wrmsrl(MSR_LX_SPARE_MSR, msrval); |
395 | gcfg |= 0xB600; /* Set default priority */ | 449 | |
396 | gcfg |= DC_GCFG_FDTY; /* Set the frame dirty mode */ | 450 | gcfg = DC_GENERAL_CFG_DFLE; /* Display fifo enable */ |
397 | 451 | gcfg |= (0x6 << DC_GENERAL_CFG_DFHPSL_SHIFT) | /* default priority */ | |
398 | dcfg = DC_DCFG_VDEN; /* Enable video data */ | 452 | (0xb << DC_GENERAL_CFG_DFHPEL_SHIFT); |
399 | dcfg |= DC_DCFG_GDEN; /* Enable graphics */ | 453 | gcfg |= DC_GENERAL_CFG_FDTY; /* Set the frame dirty mode */ |
400 | dcfg |= DC_DCFG_TGEN; /* Turn on the timing generator */ | 454 | |
401 | dcfg |= DC_DCFG_TRUP; /* Update timings immediately */ | 455 | dcfg = DC_DISPLAY_CFG_VDEN; /* Enable video data */ |
402 | dcfg |= DC_DCFG_PALB; /* Palette bypass in > 8 bpp modes */ | 456 | dcfg |= DC_DISPLAY_CFG_GDEN; /* Enable graphics */ |
403 | dcfg |= DC_DCFG_VISL; | 457 | dcfg |= DC_DISPLAY_CFG_TGEN; /* Turn on the timing generator */ |
404 | dcfg |= DC_DCFG_DCEN; /* Always center the display */ | 458 | dcfg |= DC_DISPLAY_CFG_TRUP; /* Update timings immediately */ |
459 | dcfg |= DC_DISPLAY_CFG_PALB; /* Palette bypass in > 8 bpp modes */ | ||
460 | dcfg |= DC_DISPLAY_CFG_VISL; | ||
461 | dcfg |= DC_DISPLAY_CFG_DCEN; /* Always center the display */ | ||
405 | 462 | ||
406 | /* Set the current BPP mode */ | 463 | /* Set the current BPP mode */ |
407 | 464 | ||
408 | switch (info->var.bits_per_pixel) { | 465 | switch (info->var.bits_per_pixel) { |
409 | case 8: | 466 | case 8: |
410 | dcfg |= DC_DCFG_DISP_MODE_8BPP; | 467 | dcfg |= DC_DISPLAY_CFG_DISP_MODE_8BPP; |
411 | break; | 468 | break; |
412 | 469 | ||
413 | case 16: | 470 | case 16: |
414 | dcfg |= DC_DCFG_DISP_MODE_16BPP | DC_DCFG_16BPP; | 471 | dcfg |= DC_DISPLAY_CFG_DISP_MODE_16BPP; |
415 | break; | 472 | break; |
416 | 473 | ||
417 | case 32: | 474 | case 32: |
418 | case 24: | 475 | case 24: |
419 | dcfg |= DC_DCFG_DISP_MODE_24BPP; | 476 | dcfg |= DC_DISPLAY_CFG_DISP_MODE_24BPP; |
420 | break; | 477 | break; |
421 | } | 478 | } |
422 | 479 | ||
@@ -436,35 +493,31 @@ void lx_set_mode(struct fb_info *info) | |||
436 | vblankend = vsyncend + info->var.upper_margin; | 493 | vblankend = vsyncend + info->var.upper_margin; |
437 | vtotal = vblankend; | 494 | vtotal = vblankend; |
438 | 495 | ||
439 | writel((hactive - 1) | ((htotal - 1) << 16), | 496 | write_dc(par, DC_H_ACTIVE_TIMING, (hactive - 1) | ((htotal - 1) << 16)); |
440 | par->dc_regs + DC_H_ACTIVE_TIMING); | 497 | write_dc(par, DC_H_BLANK_TIMING, |
441 | writel((hblankstart - 1) | ((hblankend - 1) << 16), | 498 | (hblankstart - 1) | ((hblankend - 1) << 16)); |
442 | par->dc_regs + DC_H_BLANK_TIMING); | 499 | write_dc(par, DC_H_SYNC_TIMING, |
443 | writel((hsyncstart - 1) | ((hsyncend - 1) << 16), | 500 | (hsyncstart - 1) | ((hsyncend - 1) << 16)); |
444 | par->dc_regs + DC_H_SYNC_TIMING); | ||
445 | |||
446 | writel((vactive - 1) | ((vtotal - 1) << 16), | ||
447 | par->dc_regs + DC_V_ACTIVE_TIMING); | ||
448 | 501 | ||
449 | writel((vblankstart - 1) | ((vblankend - 1) << 16), | 502 | write_dc(par, DC_V_ACTIVE_TIMING, (vactive - 1) | ((vtotal - 1) << 16)); |
450 | par->dc_regs + DC_V_BLANK_TIMING); | 503 | write_dc(par, DC_V_BLANK_TIMING, |
504 | (vblankstart - 1) | ((vblankend - 1) << 16)); | ||
505 | write_dc(par, DC_V_SYNC_TIMING, | ||
506 | (vsyncstart - 1) | ((vsyncend - 1) << 16)); | ||
451 | 507 | ||
452 | writel((vsyncstart - 1) | ((vsyncend - 1) << 16), | 508 | write_dc(par, DC_FB_ACTIVE, |
453 | par->dc_regs + DC_V_SYNC_TIMING); | 509 | (info->var.xres - 1) << 16 | (info->var.yres - 1)); |
454 | |||
455 | writel( (info->var.xres - 1) << 16 | (info->var.yres - 1), | ||
456 | par->dc_regs + DC_FB_ACTIVE); | ||
457 | 510 | ||
458 | /* And re-enable the graphics output */ | 511 | /* And re-enable the graphics output */ |
459 | lx_graphics_enable(info); | 512 | lx_graphics_enable(info); |
460 | 513 | ||
461 | /* Write the two main configuration registers */ | 514 | /* Write the two main configuration registers */ |
462 | writel(dcfg, par->dc_regs + DC_DISPLAY_CFG); | 515 | write_dc(par, DC_DISPLAY_CFG, dcfg); |
463 | writel(0, par->dc_regs + DC_ARB_CFG); | 516 | write_dc(par, DC_ARB_CFG, 0); |
464 | writel(gcfg, par->dc_regs + DC_GENERAL_CFG); | 517 | write_dc(par, DC_GENERAL_CFG, gcfg); |
465 | 518 | ||
466 | /* Lock the DC registers */ | 519 | /* Lock the DC registers */ |
467 | writel(0, par->dc_regs + DC_UNLOCK); | 520 | write_dc(par, DC_UNLOCK, DC_UNLOCK_LOCK); |
468 | } | 521 | } |
469 | 522 | ||
470 | void lx_set_palette_reg(struct fb_info *info, unsigned regno, | 523 | void lx_set_palette_reg(struct fb_info *info, unsigned regno, |
@@ -479,58 +532,310 @@ void lx_set_palette_reg(struct fb_info *info, unsigned regno, | |||
479 | val |= (green) & 0x00ff00; | 532 | val |= (green) & 0x00ff00; |
480 | val |= (blue >> 8) & 0x0000ff; | 533 | val |= (blue >> 8) & 0x0000ff; |
481 | 534 | ||
482 | writel(regno, par->dc_regs + DC_PAL_ADDRESS); | 535 | write_dc(par, DC_PAL_ADDRESS, regno); |
483 | writel(val, par->dc_regs + DC_PAL_DATA); | 536 | write_dc(par, DC_PAL_DATA, val); |
484 | } | 537 | } |
485 | 538 | ||
486 | int lx_blank_display(struct fb_info *info, int blank_mode) | 539 | int lx_blank_display(struct fb_info *info, int blank_mode) |
487 | { | 540 | { |
488 | struct lxfb_par *par = info->par; | 541 | struct lxfb_par *par = info->par; |
489 | u32 dcfg, fp_pm; | 542 | u32 dcfg, fp_pm; |
490 | int blank, hsync, vsync; | 543 | int blank, hsync, vsync, crt; |
491 | 544 | ||
492 | /* CRT power saving modes. */ | 545 | /* CRT power saving modes. */ |
493 | switch (blank_mode) { | 546 | switch (blank_mode) { |
494 | case FB_BLANK_UNBLANK: | 547 | case FB_BLANK_UNBLANK: |
495 | blank = 0; hsync = 1; vsync = 1; | 548 | blank = 0; hsync = 1; vsync = 1; crt = 1; |
496 | break; | 549 | break; |
497 | case FB_BLANK_NORMAL: | 550 | case FB_BLANK_NORMAL: |
498 | blank = 1; hsync = 1; vsync = 1; | 551 | blank = 1; hsync = 1; vsync = 1; crt = 1; |
499 | break; | 552 | break; |
500 | case FB_BLANK_VSYNC_SUSPEND: | 553 | case FB_BLANK_VSYNC_SUSPEND: |
501 | blank = 1; hsync = 1; vsync = 0; | 554 | blank = 1; hsync = 1; vsync = 0; crt = 1; |
502 | break; | 555 | break; |
503 | case FB_BLANK_HSYNC_SUSPEND: | 556 | case FB_BLANK_HSYNC_SUSPEND: |
504 | blank = 1; hsync = 0; vsync = 1; | 557 | blank = 1; hsync = 0; vsync = 1; crt = 1; |
505 | break; | 558 | break; |
506 | case FB_BLANK_POWERDOWN: | 559 | case FB_BLANK_POWERDOWN: |
507 | blank = 1; hsync = 0; vsync = 0; | 560 | blank = 1; hsync = 0; vsync = 0; crt = 0; |
508 | break; | 561 | break; |
509 | default: | 562 | default: |
510 | return -EINVAL; | 563 | return -EINVAL; |
511 | } | 564 | } |
512 | 565 | ||
513 | dcfg = readl(par->df_regs + DF_DISPLAY_CFG); | 566 | dcfg = read_vp(par, VP_DCFG); |
514 | dcfg &= ~(DF_DCFG_DAC_BL_EN | 567 | dcfg &= ~(VP_DCFG_DAC_BL_EN | VP_DCFG_HSYNC_EN | VP_DCFG_VSYNC_EN | |
515 | | DF_DCFG_HSYNC_EN | DF_DCFG_VSYNC_EN); | 568 | VP_DCFG_CRT_EN); |
516 | if (!blank) | 569 | if (!blank) |
517 | dcfg |= DF_DCFG_DAC_BL_EN; | 570 | dcfg |= VP_DCFG_DAC_BL_EN; |
518 | if (hsync) | 571 | if (hsync) |
519 | dcfg |= DF_DCFG_HSYNC_EN; | 572 | dcfg |= VP_DCFG_HSYNC_EN; |
520 | if (vsync) | 573 | if (vsync) |
521 | dcfg |= DF_DCFG_VSYNC_EN; | 574 | dcfg |= VP_DCFG_VSYNC_EN; |
522 | writel(dcfg, par->df_regs + DF_DISPLAY_CFG); | 575 | if (crt) |
576 | dcfg |= VP_DCFG_CRT_EN; | ||
577 | write_vp(par, VP_DCFG, dcfg); | ||
523 | 578 | ||
524 | /* Power on/off flat panel */ | 579 | /* Power on/off flat panel */ |
525 | 580 | ||
526 | if (par->output & OUTPUT_PANEL) { | 581 | if (par->output & OUTPUT_PANEL) { |
527 | fp_pm = readl(par->df_regs + DF_FP_PM); | 582 | fp_pm = read_fp(par, FP_PM); |
528 | if (blank_mode == FB_BLANK_POWERDOWN) | 583 | if (blank_mode == FB_BLANK_POWERDOWN) |
529 | fp_pm &= ~DF_FP_PM_P; | 584 | fp_pm &= ~FP_PM_P; |
530 | else | 585 | else |
531 | fp_pm |= DF_FP_PM_P; | 586 | fp_pm |= FP_PM_P; |
532 | writel(fp_pm, par->df_regs + DF_FP_PM); | 587 | write_fp(par, FP_PM, fp_pm); |
533 | } | 588 | } |
534 | 589 | ||
535 | return 0; | 590 | return 0; |
536 | } | 591 | } |
592 | |||
593 | #ifdef CONFIG_PM | ||
594 | |||
595 | static void lx_save_regs(struct lxfb_par *par) | ||
596 | { | ||
597 | uint32_t filt; | ||
598 | int i; | ||
599 | |||
600 | /* wait for the BLT engine to stop being busy */ | ||
601 | do { | ||
602 | i = read_gp(par, GP_BLT_STATUS); | ||
603 | } while ((i & GP_BLT_STATUS_PB) || !(i & GP_BLT_STATUS_CE)); | ||
604 | |||
605 | /* save MSRs */ | ||
606 | rdmsrl(MSR_LX_MSR_PADSEL, par->msr.padsel); | ||
607 | rdmsrl(MSR_GLCP_DOTPLL, par->msr.dotpll); | ||
608 | rdmsrl(MSR_LX_GLD_MSR_CONFIG, par->msr.dfglcfg); | ||
609 | rdmsrl(MSR_LX_SPARE_MSR, par->msr.dcspare); | ||
610 | |||
611 | write_dc(par, DC_UNLOCK, DC_UNLOCK_UNLOCK); | ||
612 | |||
613 | /* save registers */ | ||
614 | memcpy(par->gp, par->gp_regs, sizeof(par->gp)); | ||
615 | memcpy(par->dc, par->dc_regs, sizeof(par->dc)); | ||
616 | memcpy(par->vp, par->vp_regs, sizeof(par->vp)); | ||
617 | memcpy(par->fp, par->vp_regs + VP_FP_START, sizeof(par->fp)); | ||
618 | |||
619 | /* save the palette */ | ||
620 | write_dc(par, DC_PAL_ADDRESS, 0); | ||
621 | for (i = 0; i < ARRAY_SIZE(par->pal); i++) | ||
622 | par->pal[i] = read_dc(par, DC_PAL_DATA); | ||
623 | |||
624 | /* save the horizontal filter coefficients */ | ||
625 | filt = par->dc[DC_IRQ_FILT_CTL] | DC_IRQ_FILT_CTL_H_FILT_SEL; | ||
626 | for (i = 0; i < ARRAY_SIZE(par->hcoeff); i += 2) { | ||
627 | write_dc(par, DC_IRQ_FILT_CTL, (filt & 0xffffff00) | i); | ||
628 | par->hcoeff[i] = read_dc(par, DC_FILT_COEFF1); | ||
629 | par->hcoeff[i + 1] = read_dc(par, DC_FILT_COEFF2); | ||
630 | } | ||
631 | |||
632 | /* save the vertical filter coefficients */ | ||
633 | filt &= ~DC_IRQ_FILT_CTL_H_FILT_SEL; | ||
634 | for (i = 0; i < ARRAY_SIZE(par->vcoeff); i++) { | ||
635 | write_dc(par, DC_IRQ_FILT_CTL, (filt & 0xffffff00) | i); | ||
636 | par->vcoeff[i] = read_dc(par, DC_FILT_COEFF1); | ||
637 | } | ||
638 | |||
639 | /* save video coeff ram */ | ||
640 | memcpy(par->vp_coeff, par->vp_regs + VP_VCR, sizeof(par->vp_coeff)); | ||
641 | } | ||
642 | |||
643 | static void lx_restore_gfx_proc(struct lxfb_par *par) | ||
644 | { | ||
645 | int i; | ||
646 | |||
647 | /* a bunch of registers require GP_RASTER_MODE to be set first */ | ||
648 | write_gp(par, GP_RASTER_MODE, par->gp[GP_RASTER_MODE]); | ||
649 | |||
650 | for (i = 0; i < ARRAY_SIZE(par->gp); i++) { | ||
651 | switch (i) { | ||
652 | case GP_RASTER_MODE: | ||
653 | case GP_VECTOR_MODE: | ||
654 | case GP_BLT_MODE: | ||
655 | case GP_BLT_STATUS: | ||
656 | case GP_HST_SRC: | ||
657 | /* FIXME: restore LUT data */ | ||
658 | case GP_LUT_INDEX: | ||
659 | case GP_LUT_DATA: | ||
660 | /* don't restore these registers */ | ||
661 | break; | ||
662 | |||
663 | default: | ||
664 | write_gp(par, i, par->gp[i]); | ||
665 | } | ||
666 | } | ||
667 | } | ||
668 | |||
669 | static void lx_restore_display_ctlr(struct lxfb_par *par) | ||
670 | { | ||
671 | uint32_t filt; | ||
672 | int i; | ||
673 | |||
674 | wrmsrl(MSR_LX_SPARE_MSR, par->msr.dcspare); | ||
675 | |||
676 | for (i = 0; i < ARRAY_SIZE(par->dc); i++) { | ||
677 | switch (i) { | ||
678 | case DC_UNLOCK: | ||
679 | /* unlock the DC; runs first */ | ||
680 | write_dc(par, DC_UNLOCK, DC_UNLOCK_UNLOCK); | ||
681 | break; | ||
682 | |||
683 | case DC_GENERAL_CFG: | ||
684 | case DC_DISPLAY_CFG: | ||
685 | /* disable all while restoring */ | ||
686 | write_dc(par, i, 0); | ||
687 | break; | ||
688 | |||
689 | case DC_DV_CTL: | ||
690 | /* set all ram to dirty */ | ||
691 | write_dc(par, i, par->dc[i] | DC_DV_CTL_CLEAR_DV_RAM); | ||
692 | |||
693 | case DC_RSVD_1: | ||
694 | case DC_RSVD_2: | ||
695 | case DC_RSVD_3: | ||
696 | case DC_LINE_CNT: | ||
697 | case DC_PAL_ADDRESS: | ||
698 | case DC_PAL_DATA: | ||
699 | case DC_DFIFO_DIAG: | ||
700 | case DC_CFIFO_DIAG: | ||
701 | case DC_FILT_COEFF1: | ||
702 | case DC_FILT_COEFF2: | ||
703 | case DC_RSVD_4: | ||
704 | case DC_RSVD_5: | ||
705 | /* don't restore these registers */ | ||
706 | break; | ||
707 | |||
708 | default: | ||
709 | write_dc(par, i, par->dc[i]); | ||
710 | } | ||
711 | } | ||
712 | |||
713 | /* restore the palette */ | ||
714 | write_dc(par, DC_PAL_ADDRESS, 0); | ||
715 | for (i = 0; i < ARRAY_SIZE(par->pal); i++) | ||
716 | write_dc(par, DC_PAL_DATA, par->pal[i]); | ||
717 | |||
718 | /* restore the horizontal filter coefficients */ | ||
719 | filt = par->dc[DC_IRQ_FILT_CTL] | DC_IRQ_FILT_CTL_H_FILT_SEL; | ||
720 | for (i = 0; i < ARRAY_SIZE(par->hcoeff); i += 2) { | ||
721 | write_dc(par, DC_IRQ_FILT_CTL, (filt & 0xffffff00) | i); | ||
722 | write_dc(par, DC_FILT_COEFF1, par->hcoeff[i]); | ||
723 | write_dc(par, DC_FILT_COEFF2, par->hcoeff[i + 1]); | ||
724 | } | ||
725 | |||
726 | /* restore the vertical filter coefficients */ | ||
727 | filt &= ~DC_IRQ_FILT_CTL_H_FILT_SEL; | ||
728 | for (i = 0; i < ARRAY_SIZE(par->vcoeff); i++) { | ||
729 | write_dc(par, DC_IRQ_FILT_CTL, (filt & 0xffffff00) | i); | ||
730 | write_dc(par, DC_FILT_COEFF1, par->vcoeff[i]); | ||
731 | } | ||
732 | } | ||
733 | |||
734 | static void lx_restore_video_proc(struct lxfb_par *par) | ||
735 | { | ||
736 | int i; | ||
737 | |||
738 | wrmsrl(MSR_LX_GLD_MSR_CONFIG, par->msr.dfglcfg); | ||
739 | wrmsrl(MSR_LX_MSR_PADSEL, par->msr.padsel); | ||
740 | |||
741 | for (i = 0; i < ARRAY_SIZE(par->vp); i++) { | ||
742 | switch (i) { | ||
743 | case VP_VCFG: | ||
744 | case VP_DCFG: | ||
745 | case VP_PAR: | ||
746 | case VP_PDR: | ||
747 | case VP_CCS: | ||
748 | case VP_RSVD_0: | ||
749 | /* case VP_VDC: */ /* why should this not be restored? */ | ||
750 | case VP_RSVD_1: | ||
751 | case VP_CRC32: | ||
752 | /* don't restore these registers */ | ||
753 | break; | ||
754 | |||
755 | default: | ||
756 | write_vp(par, i, par->vp[i]); | ||
757 | } | ||
758 | } | ||
759 | |||
760 | /* restore video coeff ram */ | ||
761 | memcpy(par->vp_regs + VP_VCR, par->vp_coeff, sizeof(par->vp_coeff)); | ||
762 | } | ||
763 | |||
764 | static void lx_restore_regs(struct lxfb_par *par) | ||
765 | { | ||
766 | int i; | ||
767 | |||
768 | lx_set_dotpll((u32) (par->msr.dotpll >> 32)); | ||
769 | lx_restore_gfx_proc(par); | ||
770 | lx_restore_display_ctlr(par); | ||
771 | lx_restore_video_proc(par); | ||
772 | |||
773 | /* Flat Panel */ | ||
774 | for (i = 0; i < ARRAY_SIZE(par->fp); i++) { | ||
775 | switch (i) { | ||
776 | case FP_PM: | ||
777 | case FP_RSVD_0: | ||
778 | case FP_RSVD_1: | ||
779 | case FP_RSVD_2: | ||
780 | case FP_RSVD_3: | ||
781 | case FP_RSVD_4: | ||
782 | /* don't restore these registers */ | ||
783 | break; | ||
784 | |||
785 | default: | ||
786 | write_fp(par, i, par->fp[i]); | ||
787 | } | ||
788 | } | ||
789 | |||
790 | /* control the panel */ | ||
791 | if (par->fp[FP_PM] & FP_PM_P) { | ||
792 | /* power on the panel if not already power{ed,ing} on */ | ||
793 | if (!(read_fp(par, FP_PM) & | ||
794 | (FP_PM_PANEL_ON|FP_PM_PANEL_PWR_UP))) | ||
795 | write_fp(par, FP_PM, par->fp[FP_PM]); | ||
796 | } else { | ||
797 | /* power down the panel if not already power{ed,ing} down */ | ||
798 | if (!(read_fp(par, FP_PM) & | ||
799 | (FP_PM_PANEL_OFF|FP_PM_PANEL_PWR_DOWN))) | ||
800 | write_fp(par, FP_PM, par->fp[FP_PM]); | ||
801 | } | ||
802 | |||
803 | /* turn everything on */ | ||
804 | write_vp(par, VP_VCFG, par->vp[VP_VCFG]); | ||
805 | write_vp(par, VP_DCFG, par->vp[VP_DCFG]); | ||
806 | write_dc(par, DC_DISPLAY_CFG, par->dc[DC_DISPLAY_CFG]); | ||
807 | /* do this last; it will enable the FIFO load */ | ||
808 | write_dc(par, DC_GENERAL_CFG, par->dc[DC_GENERAL_CFG]); | ||
809 | |||
810 | /* lock the door behind us */ | ||
811 | write_dc(par, DC_UNLOCK, DC_UNLOCK_LOCK); | ||
812 | } | ||
813 | |||
814 | int lx_powerdown(struct fb_info *info) | ||
815 | { | ||
816 | struct lxfb_par *par = info->par; | ||
817 | |||
818 | if (par->powered_down) | ||
819 | return 0; | ||
820 | |||
821 | lx_save_regs(par); | ||
822 | lx_graphics_disable(info); | ||
823 | |||
824 | par->powered_down = 1; | ||
825 | return 0; | ||
826 | } | ||
827 | |||
828 | int lx_powerup(struct fb_info *info) | ||
829 | { | ||
830 | struct lxfb_par *par = info->par; | ||
831 | |||
832 | if (!par->powered_down) | ||
833 | return 0; | ||
834 | |||
835 | lx_restore_regs(par); | ||
836 | |||
837 | par->powered_down = 0; | ||
838 | return 0; | ||
839 | } | ||
840 | |||
841 | #endif | ||
diff --git a/drivers/video/geode/suspend_gx.c b/drivers/video/geode/suspend_gx.c new file mode 100644 index 000000000000..9aff32ef8bb6 --- /dev/null +++ b/drivers/video/geode/suspend_gx.c | |||
@@ -0,0 +1,267 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 Advanced Micro Devices, Inc. | ||
3 | * Copyright (C) 2008 Andres Salomon <dilinger@debian.org> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | */ | ||
10 | #include <linux/fb.h> | ||
11 | #include <asm/io.h> | ||
12 | #include <asm/msr.h> | ||
13 | #include <asm/geode.h> | ||
14 | #include <asm/delay.h> | ||
15 | |||
16 | #include "gxfb.h" | ||
17 | |||
18 | #ifdef CONFIG_PM | ||
19 | |||
20 | static void gx_save_regs(struct gxfb_par *par) | ||
21 | { | ||
22 | int i; | ||
23 | |||
24 | /* wait for the BLT engine to stop being busy */ | ||
25 | do { | ||
26 | i = read_gp(par, GP_BLT_STATUS); | ||
27 | } while (i & (GP_BLT_STATUS_BLT_PENDING | GP_BLT_STATUS_BLT_BUSY)); | ||
28 | |||
29 | /* save MSRs */ | ||
30 | rdmsrl(MSR_GX_MSR_PADSEL, par->msr.padsel); | ||
31 | rdmsrl(MSR_GLCP_DOTPLL, par->msr.dotpll); | ||
32 | |||
33 | write_dc(par, DC_UNLOCK, DC_UNLOCK_UNLOCK); | ||
34 | |||
35 | /* save registers */ | ||
36 | memcpy(par->gp, par->gp_regs, sizeof(par->gp)); | ||
37 | memcpy(par->dc, par->dc_regs, sizeof(par->dc)); | ||
38 | memcpy(par->vp, par->vid_regs, sizeof(par->vp)); | ||
39 | memcpy(par->fp, par->vid_regs + VP_FP_START, sizeof(par->fp)); | ||
40 | |||
41 | /* save the palette */ | ||
42 | write_dc(par, DC_PAL_ADDRESS, 0); | ||
43 | for (i = 0; i < ARRAY_SIZE(par->pal); i++) | ||
44 | par->pal[i] = read_dc(par, DC_PAL_DATA); | ||
45 | } | ||
46 | |||
47 | static void gx_set_dotpll(uint32_t dotpll_hi) | ||
48 | { | ||
49 | uint32_t dotpll_lo; | ||
50 | int i; | ||
51 | |||
52 | rdmsrl(MSR_GLCP_DOTPLL, dotpll_lo); | ||
53 | dotpll_lo |= MSR_GLCP_DOTPLL_DOTRESET; | ||
54 | dotpll_lo &= ~MSR_GLCP_DOTPLL_BYPASS; | ||
55 | wrmsr(MSR_GLCP_DOTPLL, dotpll_lo, dotpll_hi); | ||
56 | |||
57 | /* wait for the PLL to lock */ | ||
58 | for (i = 0; i < 200; i++) { | ||
59 | rdmsrl(MSR_GLCP_DOTPLL, dotpll_lo); | ||
60 | if (dotpll_lo & MSR_GLCP_DOTPLL_LOCK) | ||
61 | break; | ||
62 | udelay(1); | ||
63 | } | ||
64 | |||
65 | /* PLL set, unlock */ | ||
66 | dotpll_lo &= ~MSR_GLCP_DOTPLL_DOTRESET; | ||
67 | wrmsr(MSR_GLCP_DOTPLL, dotpll_lo, dotpll_hi); | ||
68 | } | ||
69 | |||
70 | static void gx_restore_gfx_proc(struct gxfb_par *par) | ||
71 | { | ||
72 | int i; | ||
73 | |||
74 | for (i = 0; i < ARRAY_SIZE(par->gp); i++) { | ||
75 | switch (i) { | ||
76 | case GP_VECTOR_MODE: | ||
77 | case GP_BLT_MODE: | ||
78 | case GP_BLT_STATUS: | ||
79 | case GP_HST_SRC: | ||
80 | /* don't restore these registers */ | ||
81 | break; | ||
82 | default: | ||
83 | write_gp(par, i, par->gp[i]); | ||
84 | } | ||
85 | } | ||
86 | } | ||
87 | |||
88 | static void gx_restore_display_ctlr(struct gxfb_par *par) | ||
89 | { | ||
90 | int i; | ||
91 | |||
92 | for (i = 0; i < ARRAY_SIZE(par->dc); i++) { | ||
93 | switch (i) { | ||
94 | case DC_UNLOCK: | ||
95 | /* unlock the DC; runs first */ | ||
96 | write_dc(par, DC_UNLOCK, DC_UNLOCK_UNLOCK); | ||
97 | break; | ||
98 | |||
99 | case DC_GENERAL_CFG: | ||
100 | /* write without the enables */ | ||
101 | write_dc(par, i, par->dc[i] & ~(DC_GENERAL_CFG_VIDE | | ||
102 | DC_GENERAL_CFG_ICNE | | ||
103 | DC_GENERAL_CFG_CURE | | ||
104 | DC_GENERAL_CFG_DFLE)); | ||
105 | break; | ||
106 | |||
107 | case DC_DISPLAY_CFG: | ||
108 | /* write without the enables */ | ||
109 | write_dc(par, i, par->dc[i] & ~(DC_DISPLAY_CFG_VDEN | | ||
110 | DC_DISPLAY_CFG_GDEN | | ||
111 | DC_DISPLAY_CFG_TGEN)); | ||
112 | break; | ||
113 | |||
114 | case DC_RSVD_0: | ||
115 | case DC_RSVD_1: | ||
116 | case DC_RSVD_2: | ||
117 | case DC_RSVD_3: | ||
118 | case DC_RSVD_4: | ||
119 | case DC_LINE_CNT: | ||
120 | case DC_PAL_ADDRESS: | ||
121 | case DC_PAL_DATA: | ||
122 | case DC_DFIFO_DIAG: | ||
123 | case DC_CFIFO_DIAG: | ||
124 | case DC_RSVD_5: | ||
125 | /* don't restore these registers */ | ||
126 | break; | ||
127 | default: | ||
128 | write_dc(par, i, par->dc[i]); | ||
129 | } | ||
130 | } | ||
131 | |||
132 | /* restore the palette */ | ||
133 | write_dc(par, DC_PAL_ADDRESS, 0); | ||
134 | for (i = 0; i < ARRAY_SIZE(par->pal); i++) | ||
135 | write_dc(par, DC_PAL_DATA, par->pal[i]); | ||
136 | } | ||
137 | |||
138 | static void gx_restore_video_proc(struct gxfb_par *par) | ||
139 | { | ||
140 | int i; | ||
141 | |||
142 | wrmsrl(MSR_GX_MSR_PADSEL, par->msr.padsel); | ||
143 | |||
144 | for (i = 0; i < ARRAY_SIZE(par->vp); i++) { | ||
145 | switch (i) { | ||
146 | case VP_VCFG: | ||
147 | /* don't enable video yet */ | ||
148 | write_vp(par, i, par->vp[i] & ~VP_VCFG_VID_EN); | ||
149 | break; | ||
150 | |||
151 | case VP_DCFG: | ||
152 | /* don't enable CRT yet */ | ||
153 | write_vp(par, i, par->vp[i] & | ||
154 | ~(VP_DCFG_DAC_BL_EN | VP_DCFG_VSYNC_EN | | ||
155 | VP_DCFG_HSYNC_EN | VP_DCFG_CRT_EN)); | ||
156 | break; | ||
157 | |||
158 | case VP_GAR: | ||
159 | case VP_GDR: | ||
160 | case VP_RSVD_0: | ||
161 | case VP_RSVD_1: | ||
162 | case VP_RSVD_2: | ||
163 | case VP_RSVD_3: | ||
164 | case VP_CRC32: | ||
165 | case VP_AWT: | ||
166 | case VP_VTM: | ||
167 | /* don't restore these registers */ | ||
168 | break; | ||
169 | default: | ||
170 | write_vp(par, i, par->vp[i]); | ||
171 | } | ||
172 | } | ||
173 | } | ||
174 | |||
175 | static void gx_restore_regs(struct gxfb_par *par) | ||
176 | { | ||
177 | int i; | ||
178 | |||
179 | gx_set_dotpll((uint32_t) (par->msr.dotpll >> 32)); | ||
180 | gx_restore_gfx_proc(par); | ||
181 | gx_restore_display_ctlr(par); | ||
182 | gx_restore_video_proc(par); | ||
183 | |||
184 | /* Flat Panel */ | ||
185 | for (i = 0; i < ARRAY_SIZE(par->fp); i++) { | ||
186 | if (i != FP_PM && i != FP_RSVD_0) | ||
187 | write_fp(par, i, par->fp[i]); | ||
188 | } | ||
189 | } | ||
190 | |||
191 | static void gx_disable_graphics(struct gxfb_par *par) | ||
192 | { | ||
193 | /* shut down the engine */ | ||
194 | write_vp(par, VP_VCFG, par->vp[VP_VCFG] & ~VP_VCFG_VID_EN); | ||
195 | write_vp(par, VP_DCFG, par->vp[VP_DCFG] & ~(VP_DCFG_DAC_BL_EN | | ||
196 | VP_DCFG_VSYNC_EN | VP_DCFG_HSYNC_EN | VP_DCFG_CRT_EN)); | ||
197 | |||
198 | /* turn off the flat panel */ | ||
199 | write_fp(par, FP_PM, par->fp[FP_PM] & ~FP_PM_P); | ||
200 | |||
201 | |||
202 | /* turn off display */ | ||
203 | write_dc(par, DC_UNLOCK, DC_UNLOCK_UNLOCK); | ||
204 | write_dc(par, DC_GENERAL_CFG, par->dc[DC_GENERAL_CFG] & | ||
205 | ~(DC_GENERAL_CFG_VIDE | DC_GENERAL_CFG_ICNE | | ||
206 | DC_GENERAL_CFG_CURE | DC_GENERAL_CFG_DFLE)); | ||
207 | write_dc(par, DC_DISPLAY_CFG, par->dc[DC_DISPLAY_CFG] & | ||
208 | ~(DC_DISPLAY_CFG_VDEN | DC_DISPLAY_CFG_GDEN | | ||
209 | DC_DISPLAY_CFG_TGEN)); | ||
210 | write_dc(par, DC_UNLOCK, DC_UNLOCK_LOCK); | ||
211 | } | ||
212 | |||
213 | static void gx_enable_graphics(struct gxfb_par *par) | ||
214 | { | ||
215 | uint32_t fp; | ||
216 | |||
217 | fp = read_fp(par, FP_PM); | ||
218 | if (par->fp[FP_PM] & FP_PM_P) { | ||
219 | /* power on the panel if not already power{ed,ing} on */ | ||
220 | if (!(fp & (FP_PM_PANEL_ON|FP_PM_PANEL_PWR_UP))) | ||
221 | write_fp(par, FP_PM, par->fp[FP_PM]); | ||
222 | } else { | ||
223 | /* power down the panel if not already power{ed,ing} down */ | ||
224 | if (!(fp & (FP_PM_PANEL_OFF|FP_PM_PANEL_PWR_DOWN))) | ||
225 | write_fp(par, FP_PM, par->fp[FP_PM]); | ||
226 | } | ||
227 | |||
228 | /* turn everything on */ | ||
229 | write_vp(par, VP_VCFG, par->vp[VP_VCFG]); | ||
230 | write_vp(par, VP_DCFG, par->vp[VP_DCFG]); | ||
231 | write_dc(par, DC_DISPLAY_CFG, par->dc[DC_DISPLAY_CFG]); | ||
232 | /* do this last; it will enable the FIFO load */ | ||
233 | write_dc(par, DC_GENERAL_CFG, par->dc[DC_GENERAL_CFG]); | ||
234 | |||
235 | /* lock the door behind us */ | ||
236 | write_dc(par, DC_UNLOCK, DC_UNLOCK_LOCK); | ||
237 | } | ||
238 | |||
239 | int gx_powerdown(struct fb_info *info) | ||
240 | { | ||
241 | struct gxfb_par *par = info->par; | ||
242 | |||
243 | if (par->powered_down) | ||
244 | return 0; | ||
245 | |||
246 | gx_save_regs(par); | ||
247 | gx_disable_graphics(par); | ||
248 | |||
249 | par->powered_down = 1; | ||
250 | return 0; | ||
251 | } | ||
252 | |||
253 | int gx_powerup(struct fb_info *info) | ||
254 | { | ||
255 | struct gxfb_par *par = info->par; | ||
256 | |||
257 | if (!par->powered_down) | ||
258 | return 0; | ||
259 | |||
260 | gx_restore_regs(par); | ||
261 | gx_enable_graphics(par); | ||
262 | |||
263 | par->powered_down = 0; | ||
264 | return 0; | ||
265 | } | ||
266 | |||
267 | #endif | ||
diff --git a/drivers/video/geode/video_gx.c b/drivers/video/geode/video_gx.c index febf09c63492..b8d52a8360db 100644 --- a/drivers/video/geode/video_gx.c +++ b/drivers/video/geode/video_gx.c | |||
@@ -16,9 +16,9 @@ | |||
16 | #include <asm/io.h> | 16 | #include <asm/io.h> |
17 | #include <asm/delay.h> | 17 | #include <asm/delay.h> |
18 | #include <asm/msr.h> | 18 | #include <asm/msr.h> |
19 | #include <asm/geode.h> | ||
19 | 20 | ||
20 | #include "geodefb.h" | 21 | #include "gxfb.h" |
21 | #include "video_gx.h" | ||
22 | 22 | ||
23 | 23 | ||
24 | /* | 24 | /* |
@@ -117,7 +117,7 @@ static const struct gx_pll_entry gx_pll_table_14MHz[] = { | |||
117 | { 4357, 0, 0x0000057D }, /* 229.5000 */ | 117 | { 4357, 0, 0x0000057D }, /* 229.5000 */ |
118 | }; | 118 | }; |
119 | 119 | ||
120 | static void gx_set_dclk_frequency(struct fb_info *info) | 120 | void gx_set_dclk_frequency(struct fb_info *info) |
121 | { | 121 | { |
122 | const struct gx_pll_entry *pll_table; | 122 | const struct gx_pll_entry *pll_table; |
123 | int pll_table_len; | 123 | int pll_table_len; |
@@ -178,110 +178,116 @@ static void gx_set_dclk_frequency(struct fb_info *info) | |||
178 | static void | 178 | static void |
179 | gx_configure_tft(struct fb_info *info) | 179 | gx_configure_tft(struct fb_info *info) |
180 | { | 180 | { |
181 | struct geodefb_par *par = info->par; | 181 | struct gxfb_par *par = info->par; |
182 | unsigned long val; | 182 | unsigned long val; |
183 | unsigned long fp; | 183 | unsigned long fp; |
184 | 184 | ||
185 | /* Set up the DF pad select MSR */ | 185 | /* Set up the DF pad select MSR */ |
186 | 186 | ||
187 | rdmsrl(GX_VP_MSR_PAD_SELECT, val); | 187 | rdmsrl(MSR_GX_MSR_PADSEL, val); |
188 | val &= ~GX_VP_PAD_SELECT_MASK; | 188 | val &= ~MSR_GX_MSR_PADSEL_MASK; |
189 | val |= GX_VP_PAD_SELECT_TFT; | 189 | val |= MSR_GX_MSR_PADSEL_TFT; |
190 | wrmsrl(GX_VP_MSR_PAD_SELECT, val); | 190 | wrmsrl(MSR_GX_MSR_PADSEL, val); |
191 | 191 | ||
192 | /* Turn off the panel */ | 192 | /* Turn off the panel */ |
193 | 193 | ||
194 | fp = readl(par->vid_regs + GX_FP_PM); | 194 | fp = read_fp(par, FP_PM); |
195 | fp &= ~GX_FP_PM_P; | 195 | fp &= ~FP_PM_P; |
196 | writel(fp, par->vid_regs + GX_FP_PM); | 196 | write_fp(par, FP_PM, fp); |
197 | 197 | ||
198 | /* Set timing 1 */ | 198 | /* Set timing 1 */ |
199 | 199 | ||
200 | fp = readl(par->vid_regs + GX_FP_PT1); | 200 | fp = read_fp(par, FP_PT1); |
201 | fp &= GX_FP_PT1_VSIZE_MASK; | 201 | fp &= FP_PT1_VSIZE_MASK; |
202 | fp |= info->var.yres << GX_FP_PT1_VSIZE_SHIFT; | 202 | fp |= info->var.yres << FP_PT1_VSIZE_SHIFT; |
203 | writel(fp, par->vid_regs + GX_FP_PT1); | 203 | write_fp(par, FP_PT1, fp); |
204 | 204 | ||
205 | /* Timing 2 */ | 205 | /* Timing 2 */ |
206 | /* Set bits that are always on for TFT */ | 206 | /* Set bits that are always on for TFT */ |
207 | 207 | ||
208 | fp = 0x0F100000; | 208 | fp = 0x0F100000; |
209 | 209 | ||
210 | /* Add sync polarity */ | 210 | /* Configure sync polarity */ |
211 | 211 | ||
212 | if (!(info->var.sync & FB_SYNC_VERT_HIGH_ACT)) | 212 | if (!(info->var.sync & FB_SYNC_VERT_HIGH_ACT)) |
213 | fp |= GX_FP_PT2_VSP; | 213 | fp |= FP_PT2_VSP; |
214 | 214 | ||
215 | if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT)) | 215 | if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT)) |
216 | fp |= GX_FP_PT2_HSP; | 216 | fp |= FP_PT2_HSP; |
217 | 217 | ||
218 | writel(fp, par->vid_regs + GX_FP_PT2); | 218 | write_fp(par, FP_PT2, fp); |
219 | 219 | ||
220 | /* Set the dither control */ | 220 | /* Set the dither control */ |
221 | writel(0x70, par->vid_regs + GX_FP_DFC); | 221 | write_fp(par, FP_DFC, FP_DFC_NFI); |
222 | 222 | ||
223 | /* Enable the FP data and power (in case the BIOS didn't) */ | 223 | /* Enable the FP data and power (in case the BIOS didn't) */ |
224 | 224 | ||
225 | fp = readl(par->vid_regs + GX_DCFG); | 225 | fp = read_vp(par, VP_DCFG); |
226 | fp |= GX_DCFG_FP_PWR_EN | GX_DCFG_FP_DATA_EN; | 226 | fp |= VP_DCFG_FP_PWR_EN | VP_DCFG_FP_DATA_EN; |
227 | writel(fp, par->vid_regs + GX_DCFG); | 227 | write_vp(par, VP_DCFG, fp); |
228 | 228 | ||
229 | /* Unblank the panel */ | 229 | /* Unblank the panel */ |
230 | 230 | ||
231 | fp = readl(par->vid_regs + GX_FP_PM); | 231 | fp = read_fp(par, FP_PM); |
232 | fp |= GX_FP_PM_P; | 232 | fp |= FP_PM_P; |
233 | writel(fp, par->vid_regs + GX_FP_PM); | 233 | write_fp(par, FP_PM, fp); |
234 | } | 234 | } |
235 | 235 | ||
236 | static void gx_configure_display(struct fb_info *info) | 236 | void gx_configure_display(struct fb_info *info) |
237 | { | 237 | { |
238 | struct geodefb_par *par = info->par; | 238 | struct gxfb_par *par = info->par; |
239 | u32 dcfg, misc; | 239 | u32 dcfg, misc; |
240 | 240 | ||
241 | /* Set up the MISC register */ | ||
242 | |||
243 | misc = readl(par->vid_regs + GX_MISC); | ||
244 | |||
245 | /* Power up the DAC */ | ||
246 | misc &= ~(GX_MISC_A_PWRDN | GX_MISC_DAC_PWRDN); | ||
247 | |||
248 | /* Disable gamma correction */ | ||
249 | misc |= GX_MISC_GAM_EN; | ||
250 | |||
251 | writel(misc, par->vid_regs + GX_MISC); | ||
252 | |||
253 | /* Write the display configuration */ | 241 | /* Write the display configuration */ |
254 | dcfg = readl(par->vid_regs + GX_DCFG); | 242 | dcfg = read_vp(par, VP_DCFG); |
255 | 243 | ||
256 | /* Disable hsync and vsync */ | 244 | /* Disable hsync and vsync */ |
257 | dcfg &= ~(GX_DCFG_VSYNC_EN | GX_DCFG_HSYNC_EN); | 245 | dcfg &= ~(VP_DCFG_VSYNC_EN | VP_DCFG_HSYNC_EN); |
258 | writel(dcfg, par->vid_regs + GX_DCFG); | 246 | write_vp(par, VP_DCFG, dcfg); |
259 | 247 | ||
260 | /* Clear bits from existing mode. */ | 248 | /* Clear bits from existing mode. */ |
261 | dcfg &= ~(GX_DCFG_CRT_SYNC_SKW_MASK | 249 | dcfg &= ~(VP_DCFG_CRT_SYNC_SKW |
262 | | GX_DCFG_CRT_HSYNC_POL | GX_DCFG_CRT_VSYNC_POL | 250 | | VP_DCFG_CRT_HSYNC_POL | VP_DCFG_CRT_VSYNC_POL |
263 | | GX_DCFG_VSYNC_EN | GX_DCFG_HSYNC_EN); | 251 | | VP_DCFG_VSYNC_EN | VP_DCFG_HSYNC_EN); |
264 | 252 | ||
265 | /* Set default sync skew. */ | 253 | /* Set default sync skew. */ |
266 | dcfg |= GX_DCFG_CRT_SYNC_SKW_DFLT; | 254 | dcfg |= VP_DCFG_CRT_SYNC_SKW_DEFAULT; |
267 | 255 | ||
268 | /* Enable hsync and vsync. */ | 256 | /* Enable hsync and vsync. */ |
269 | dcfg |= GX_DCFG_HSYNC_EN | GX_DCFG_VSYNC_EN; | 257 | dcfg |= VP_DCFG_HSYNC_EN | VP_DCFG_VSYNC_EN; |
270 | 258 | ||
271 | /* Sync polarities. */ | 259 | misc = read_vp(par, VP_MISC); |
272 | if (info->var.sync & FB_SYNC_HOR_HIGH_ACT) | 260 | |
273 | dcfg |= GX_DCFG_CRT_HSYNC_POL; | 261 | /* Disable gamma correction */ |
274 | if (info->var.sync & FB_SYNC_VERT_HIGH_ACT) | 262 | misc |= VP_MISC_GAM_EN; |
275 | dcfg |= GX_DCFG_CRT_VSYNC_POL; | 263 | |
264 | if (par->enable_crt) { | ||
265 | |||
266 | /* Power up the CRT DACs */ | ||
267 | misc &= ~(VP_MISC_APWRDN | VP_MISC_DACPWRDN); | ||
268 | write_vp(par, VP_MISC, misc); | ||
269 | |||
270 | /* Only change the sync polarities if we are running | ||
271 | * in CRT mode. The FP polarities will be handled in | ||
272 | * gxfb_configure_tft */ | ||
273 | if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT)) | ||
274 | dcfg |= VP_DCFG_CRT_HSYNC_POL; | ||
275 | if (!(info->var.sync & FB_SYNC_VERT_HIGH_ACT)) | ||
276 | dcfg |= VP_DCFG_CRT_VSYNC_POL; | ||
277 | } else { | ||
278 | /* Power down the CRT DACs if in FP mode */ | ||
279 | misc |= (VP_MISC_APWRDN | VP_MISC_DACPWRDN); | ||
280 | write_vp(par, VP_MISC, misc); | ||
281 | } | ||
276 | 282 | ||
277 | /* Enable the display logic */ | 283 | /* Enable the display logic */ |
278 | /* Set up the DACS to blank normally */ | 284 | /* Set up the DACS to blank normally */ |
279 | 285 | ||
280 | dcfg |= GX_DCFG_CRT_EN | GX_DCFG_DAC_BL_EN; | 286 | dcfg |= VP_DCFG_CRT_EN | VP_DCFG_DAC_BL_EN; |
281 | 287 | ||
282 | /* Enable the external DAC VREF? */ | 288 | /* Enable the external DAC VREF? */ |
283 | 289 | ||
284 | writel(dcfg, par->vid_regs + GX_DCFG); | 290 | write_vp(par, VP_DCFG, dcfg); |
285 | 291 | ||
286 | /* Set up the flat panel (if it is enabled) */ | 292 | /* Set up the flat panel (if it is enabled) */ |
287 | 293 | ||
@@ -289,59 +295,55 @@ static void gx_configure_display(struct fb_info *info) | |||
289 | gx_configure_tft(info); | 295 | gx_configure_tft(info); |
290 | } | 296 | } |
291 | 297 | ||
292 | static int gx_blank_display(struct fb_info *info, int blank_mode) | 298 | int gx_blank_display(struct fb_info *info, int blank_mode) |
293 | { | 299 | { |
294 | struct geodefb_par *par = info->par; | 300 | struct gxfb_par *par = info->par; |
295 | u32 dcfg, fp_pm; | 301 | u32 dcfg, fp_pm; |
296 | int blank, hsync, vsync; | 302 | int blank, hsync, vsync, crt; |
297 | 303 | ||
298 | /* CRT power saving modes. */ | 304 | /* CRT power saving modes. */ |
299 | switch (blank_mode) { | 305 | switch (blank_mode) { |
300 | case FB_BLANK_UNBLANK: | 306 | case FB_BLANK_UNBLANK: |
301 | blank = 0; hsync = 1; vsync = 1; | 307 | blank = 0; hsync = 1; vsync = 1; crt = 1; |
302 | break; | 308 | break; |
303 | case FB_BLANK_NORMAL: | 309 | case FB_BLANK_NORMAL: |
304 | blank = 1; hsync = 1; vsync = 1; | 310 | blank = 1; hsync = 1; vsync = 1; crt = 1; |
305 | break; | 311 | break; |
306 | case FB_BLANK_VSYNC_SUSPEND: | 312 | case FB_BLANK_VSYNC_SUSPEND: |
307 | blank = 1; hsync = 1; vsync = 0; | 313 | blank = 1; hsync = 1; vsync = 0; crt = 1; |
308 | break; | 314 | break; |
309 | case FB_BLANK_HSYNC_SUSPEND: | 315 | case FB_BLANK_HSYNC_SUSPEND: |
310 | blank = 1; hsync = 0; vsync = 1; | 316 | blank = 1; hsync = 0; vsync = 1; crt = 1; |
311 | break; | 317 | break; |
312 | case FB_BLANK_POWERDOWN: | 318 | case FB_BLANK_POWERDOWN: |
313 | blank = 1; hsync = 0; vsync = 0; | 319 | blank = 1; hsync = 0; vsync = 0; crt = 0; |
314 | break; | 320 | break; |
315 | default: | 321 | default: |
316 | return -EINVAL; | 322 | return -EINVAL; |
317 | } | 323 | } |
318 | dcfg = readl(par->vid_regs + GX_DCFG); | 324 | dcfg = read_vp(par, VP_DCFG); |
319 | dcfg &= ~(GX_DCFG_DAC_BL_EN | 325 | dcfg &= ~(VP_DCFG_DAC_BL_EN | VP_DCFG_HSYNC_EN | VP_DCFG_VSYNC_EN | |
320 | | GX_DCFG_HSYNC_EN | GX_DCFG_VSYNC_EN); | 326 | VP_DCFG_CRT_EN); |
321 | if (!blank) | 327 | if (!blank) |
322 | dcfg |= GX_DCFG_DAC_BL_EN; | 328 | dcfg |= VP_DCFG_DAC_BL_EN; |
323 | if (hsync) | 329 | if (hsync) |
324 | dcfg |= GX_DCFG_HSYNC_EN; | 330 | dcfg |= VP_DCFG_HSYNC_EN; |
325 | if (vsync) | 331 | if (vsync) |
326 | dcfg |= GX_DCFG_VSYNC_EN; | 332 | dcfg |= VP_DCFG_VSYNC_EN; |
327 | writel(dcfg, par->vid_regs + GX_DCFG); | 333 | if (crt) |
334 | dcfg |= VP_DCFG_CRT_EN; | ||
335 | write_vp(par, VP_DCFG, dcfg); | ||
328 | 336 | ||
329 | /* Power on/off flat panel. */ | 337 | /* Power on/off flat panel. */ |
330 | 338 | ||
331 | if (par->enable_crt == 0) { | 339 | if (par->enable_crt == 0) { |
332 | fp_pm = readl(par->vid_regs + GX_FP_PM); | 340 | fp_pm = read_fp(par, FP_PM); |
333 | if (blank_mode == FB_BLANK_POWERDOWN) | 341 | if (blank_mode == FB_BLANK_POWERDOWN) |
334 | fp_pm &= ~GX_FP_PM_P; | 342 | fp_pm &= ~FP_PM_P; |
335 | else | 343 | else |
336 | fp_pm |= GX_FP_PM_P; | 344 | fp_pm |= FP_PM_P; |
337 | writel(fp_pm, par->vid_regs + GX_FP_PM); | 345 | write_fp(par, FP_PM, fp_pm); |
338 | } | 346 | } |
339 | 347 | ||
340 | return 0; | 348 | return 0; |
341 | } | 349 | } |
342 | |||
343 | struct geode_vid_ops gx_vid_ops = { | ||
344 | .set_dclk = gx_set_dclk_frequency, | ||
345 | .configure_display = gx_configure_display, | ||
346 | .blank_display = gx_blank_display, | ||
347 | }; | ||
diff --git a/drivers/video/geode/video_gx.h b/drivers/video/geode/video_gx.h deleted file mode 100644 index ce28d8f382dc..000000000000 --- a/drivers/video/geode/video_gx.h +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | /* | ||
2 | * Geode GX video device | ||
3 | * | ||
4 | * Copyright (C) 2006 Arcom Control Systems Ltd. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | #ifndef __VIDEO_GX_H__ | ||
12 | #define __VIDEO_GX_H__ | ||
13 | |||
14 | extern struct geode_vid_ops gx_vid_ops; | ||
15 | |||
16 | /* GX Flatpanel control MSR */ | ||
17 | #define GX_VP_MSR_PAD_SELECT 0xC0002011 | ||
18 | #define GX_VP_PAD_SELECT_MASK 0x3FFFFFFF | ||
19 | #define GX_VP_PAD_SELECT_TFT 0x1FFFFFFF | ||
20 | |||
21 | /* Geode GX video processor registers */ | ||
22 | |||
23 | #define GX_DCFG 0x0008 | ||
24 | # define GX_DCFG_CRT_EN 0x00000001 | ||
25 | # define GX_DCFG_HSYNC_EN 0x00000002 | ||
26 | # define GX_DCFG_VSYNC_EN 0x00000004 | ||
27 | # define GX_DCFG_DAC_BL_EN 0x00000008 | ||
28 | # define GX_DCFG_FP_PWR_EN 0x00000040 | ||
29 | # define GX_DCFG_FP_DATA_EN 0x00000080 | ||
30 | # define GX_DCFG_CRT_HSYNC_POL 0x00000100 | ||
31 | # define GX_DCFG_CRT_VSYNC_POL 0x00000200 | ||
32 | # define GX_DCFG_CRT_SYNC_SKW_MASK 0x0001C000 | ||
33 | # define GX_DCFG_CRT_SYNC_SKW_DFLT 0x00010000 | ||
34 | # define GX_DCFG_VG_CK 0x00100000 | ||
35 | # define GX_DCFG_GV_GAM 0x00200000 | ||
36 | # define GX_DCFG_DAC_VREF 0x04000000 | ||
37 | |||
38 | /* Geode GX MISC video configuration */ | ||
39 | |||
40 | #define GX_MISC 0x50 | ||
41 | #define GX_MISC_GAM_EN 0x00000001 | ||
42 | #define GX_MISC_DAC_PWRDN 0x00000400 | ||
43 | #define GX_MISC_A_PWRDN 0x00000800 | ||
44 | |||
45 | /* Geode GX flat panel display control registers */ | ||
46 | |||
47 | #define GX_FP_PT1 0x0400 | ||
48 | #define GX_FP_PT1_VSIZE_MASK 0x7FF0000 | ||
49 | #define GX_FP_PT1_VSIZE_SHIFT 16 | ||
50 | |||
51 | #define GX_FP_PT2 0x408 | ||
52 | #define GX_FP_PT2_VSP (1 << 23) | ||
53 | #define GX_FP_PT2_HSP (1 << 22) | ||
54 | |||
55 | #define GX_FP_PM 0x410 | ||
56 | # define GX_FP_PM_P 0x01000000 | ||
57 | |||
58 | #define GX_FP_DFC 0x418 | ||
59 | |||
60 | /* Geode GX clock control MSRs */ | ||
61 | |||
62 | #define MSR_GLCP_SYS_RSTPLL 0x4c000014 | ||
63 | # define MSR_GLCP_SYS_RSTPLL_DOTPREDIV2 (0x0000000000000002ull) | ||
64 | # define MSR_GLCP_SYS_RSTPLL_DOTPREMULT2 (0x0000000000000004ull) | ||
65 | # define MSR_GLCP_SYS_RSTPLL_DOTPOSTDIV3 (0x0000000000000008ull) | ||
66 | |||
67 | #define MSR_GLCP_DOTPLL 0x4c000015 | ||
68 | # define MSR_GLCP_DOTPLL_DOTRESET (0x0000000000000001ull) | ||
69 | # define MSR_GLCP_DOTPLL_BYPASS (0x0000000000008000ull) | ||
70 | # define MSR_GLCP_DOTPLL_LOCK (0x0000000002000000ull) | ||
71 | |||
72 | #endif /* !__VIDEO_GX_H__ */ | ||
diff --git a/drivers/video/gxt4500.c b/drivers/video/gxt4500.c index e92337bef50d..564557792bed 100644 --- a/drivers/video/gxt4500.c +++ b/drivers/video/gxt4500.c | |||
@@ -238,7 +238,7 @@ static int calc_pll(int period_ps, struct gxt4500_par *par) | |||
238 | for (pdiv1 = 1; pdiv1 <= 8; ++pdiv1) { | 238 | for (pdiv1 = 1; pdiv1 <= 8; ++pdiv1) { |
239 | for (pdiv2 = 1; pdiv2 <= pdiv1; ++pdiv2) { | 239 | for (pdiv2 = 1; pdiv2 <= pdiv1; ++pdiv2) { |
240 | postdiv = pdiv1 * pdiv2; | 240 | postdiv = pdiv1 * pdiv2; |
241 | pll_period = (period_ps + postdiv - 1) / postdiv; | 241 | pll_period = DIV_ROUND_UP(period_ps, postdiv); |
242 | /* keep pll in range 350..600 MHz */ | 242 | /* keep pll in range 350..600 MHz */ |
243 | if (pll_period < 1666 || pll_period > 2857) | 243 | if (pll_period < 1666 || pll_period > 2857) |
244 | continue; | 244 | continue; |
diff --git a/drivers/video/hecubafb.c b/drivers/video/hecubafb.c index 94e0df8a6f60..0b4bffbe67c8 100644 --- a/drivers/video/hecubafb.c +++ b/drivers/video/hecubafb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/video/hecubafb.c -- FB driver for Hecuba controller | 2 | * linux/drivers/video/hecubafb.c -- FB driver for Hecuba/Apollo controller |
3 | * | 3 | * |
4 | * Copyright (C) 2006, Jaya Kumar | 4 | * Copyright (C) 2006, Jaya Kumar |
5 | * This work was sponsored by CIS(M) Sdn Bhd | 5 | * This work was sponsored by CIS(M) Sdn Bhd |
@@ -17,18 +17,13 @@ | |||
17 | * values. There are other commands that the display is capable of, | 17 | * values. There are other commands that the display is capable of, |
18 | * beyond the 5 used here but they are more complex. | 18 | * beyond the 5 used here but they are more complex. |
19 | * | 19 | * |
20 | * This driver is written to be used with the Hecuba display controller | 20 | * This driver is written to be used with the Hecuba display architecture. |
21 | * board, and tested with the EInk 800x600 display in 1 bit mode. | 21 | * The actual display chip is called Apollo and the interface electronics |
22 | * The interface between Hecuba and the host is TTL based GPIO. The | 22 | * it needs is called Hecuba. |
23 | * GPIO requirements are 8 writable data lines and 6 lines for control. | ||
24 | * Only 4 of the controls are actually used here but 6 for future use. | ||
25 | * The driver requires the IO addresses for data and control GPIO at | ||
26 | * load time. It is also possible to use this display with a standard | ||
27 | * PC parallel port. | ||
28 | * | 23 | * |
29 | * General notes: | 24 | * It is intended to be architecture independent. A board specific driver |
30 | * - User must set hecubafb_enable=1 to enable it | 25 | * must be used to perform all the physical IO interactions. An example |
31 | * - User must set dio_addr=0xIOADDR cio_addr=0xIOADDR c2io_addr=0xIOADDR | 26 | * is provided as n411.c |
32 | * | 27 | * |
33 | */ | 28 | */ |
34 | 29 | ||
@@ -47,34 +42,12 @@ | |||
47 | #include <linux/list.h> | 42 | #include <linux/list.h> |
48 | #include <linux/uaccess.h> | 43 | #include <linux/uaccess.h> |
49 | 44 | ||
50 | /* Apollo controller specific defines */ | 45 | #include <video/hecubafb.h> |
51 | #define APOLLO_START_NEW_IMG 0xA0 | ||
52 | #define APOLLO_STOP_IMG_DATA 0xA1 | ||
53 | #define APOLLO_DISPLAY_IMG 0xA2 | ||
54 | #define APOLLO_ERASE_DISPLAY 0xA3 | ||
55 | #define APOLLO_INIT_DISPLAY 0xA4 | ||
56 | |||
57 | /* Hecuba interface specific defines */ | ||
58 | /* WUP is inverted, CD is inverted, DS is inverted */ | ||
59 | #define HCB_NWUP_BIT 0x01 | ||
60 | #define HCB_NDS_BIT 0x02 | ||
61 | #define HCB_RW_BIT 0x04 | ||
62 | #define HCB_NCD_BIT 0x08 | ||
63 | #define HCB_ACK_BIT 0x80 | ||
64 | 46 | ||
65 | /* Display specific information */ | 47 | /* Display specific information */ |
66 | #define DPY_W 600 | 48 | #define DPY_W 600 |
67 | #define DPY_H 800 | 49 | #define DPY_H 800 |
68 | 50 | ||
69 | struct hecubafb_par { | ||
70 | unsigned long dio_addr; | ||
71 | unsigned long cio_addr; | ||
72 | unsigned long c2io_addr; | ||
73 | unsigned char ctl; | ||
74 | struct fb_info *info; | ||
75 | unsigned int irq; | ||
76 | }; | ||
77 | |||
78 | static struct fb_fix_screeninfo hecubafb_fix __devinitdata = { | 51 | static struct fb_fix_screeninfo hecubafb_fix __devinitdata = { |
79 | .id = "hecubafb", | 52 | .id = "hecubafb", |
80 | .type = FB_TYPE_PACKED_PIXELS, | 53 | .type = FB_TYPE_PACKED_PIXELS, |
@@ -82,6 +55,7 @@ static struct fb_fix_screeninfo hecubafb_fix __devinitdata = { | |||
82 | .xpanstep = 0, | 55 | .xpanstep = 0, |
83 | .ypanstep = 0, | 56 | .ypanstep = 0, |
84 | .ywrapstep = 0, | 57 | .ywrapstep = 0, |
58 | .line_length = DPY_W, | ||
85 | .accel = FB_ACCEL_NONE, | 59 | .accel = FB_ACCEL_NONE, |
86 | }; | 60 | }; |
87 | 61 | ||
@@ -94,136 +68,51 @@ static struct fb_var_screeninfo hecubafb_var __devinitdata = { | |||
94 | .nonstd = 1, | 68 | .nonstd = 1, |
95 | }; | 69 | }; |
96 | 70 | ||
97 | static unsigned long dio_addr; | 71 | /* main hecubafb functions */ |
98 | static unsigned long cio_addr; | ||
99 | static unsigned long c2io_addr; | ||
100 | static unsigned long splashval; | ||
101 | static unsigned int nosplash; | ||
102 | static unsigned int hecubafb_enable; | ||
103 | static unsigned int irq; | ||
104 | |||
105 | static DECLARE_WAIT_QUEUE_HEAD(hecubafb_waitq); | ||
106 | |||
107 | static void hcb_set_ctl(struct hecubafb_par *par) | ||
108 | { | ||
109 | outb(par->ctl, par->cio_addr); | ||
110 | } | ||
111 | |||
112 | static unsigned char hcb_get_ctl(struct hecubafb_par *par) | ||
113 | { | ||
114 | return inb(par->c2io_addr); | ||
115 | } | ||
116 | |||
117 | static void hcb_set_data(struct hecubafb_par *par, unsigned char value) | ||
118 | { | ||
119 | outb(value, par->dio_addr); | ||
120 | } | ||
121 | |||
122 | static int __devinit apollo_init_control(struct hecubafb_par *par) | ||
123 | { | ||
124 | unsigned char ctl; | ||
125 | /* for init, we want the following setup to be set: | ||
126 | WUP = lo | ||
127 | ACK = hi | ||
128 | DS = hi | ||
129 | RW = hi | ||
130 | CD = lo | ||
131 | */ | ||
132 | |||
133 | /* write WUP to lo, DS to hi, RW to hi, CD to lo */ | ||
134 | par->ctl = HCB_NWUP_BIT | HCB_RW_BIT | HCB_NCD_BIT ; | ||
135 | par->ctl &= ~HCB_NDS_BIT; | ||
136 | hcb_set_ctl(par); | ||
137 | |||
138 | /* check ACK is not lo */ | ||
139 | ctl = hcb_get_ctl(par); | ||
140 | if ((ctl & HCB_ACK_BIT)) { | ||
141 | printk(KERN_ERR "Fail because ACK is already low\n"); | ||
142 | return -ENXIO; | ||
143 | } | ||
144 | |||
145 | return 0; | ||
146 | } | ||
147 | |||
148 | static void hcb_wait_for_ack(struct hecubafb_par *par) | ||
149 | { | ||
150 | |||
151 | int timeout; | ||
152 | unsigned char ctl; | ||
153 | |||
154 | timeout=500; | ||
155 | do { | ||
156 | ctl = hcb_get_ctl(par); | ||
157 | if ((ctl & HCB_ACK_BIT)) | ||
158 | return; | ||
159 | udelay(1); | ||
160 | } while (timeout--); | ||
161 | printk(KERN_ERR "timed out waiting for ack\n"); | ||
162 | } | ||
163 | |||
164 | static void hcb_wait_for_ack_clear(struct hecubafb_par *par) | ||
165 | { | ||
166 | |||
167 | int timeout; | ||
168 | unsigned char ctl; | ||
169 | |||
170 | timeout=500; | ||
171 | do { | ||
172 | ctl = hcb_get_ctl(par); | ||
173 | if (!(ctl & HCB_ACK_BIT)) | ||
174 | return; | ||
175 | udelay(1); | ||
176 | } while (timeout--); | ||
177 | printk(KERN_ERR "timed out waiting for clear\n"); | ||
178 | } | ||
179 | 72 | ||
180 | static void apollo_send_data(struct hecubafb_par *par, unsigned char data) | 73 | static void apollo_send_data(struct hecubafb_par *par, unsigned char data) |
181 | { | 74 | { |
182 | /* set data */ | 75 | /* set data */ |
183 | hcb_set_data(par, data); | 76 | par->board->set_data(par, data); |
184 | 77 | ||
185 | /* set DS low */ | 78 | /* set DS low */ |
186 | par->ctl |= HCB_NDS_BIT; | 79 | par->board->set_ctl(par, HCB_DS_BIT, 0); |
187 | hcb_set_ctl(par); | ||
188 | 80 | ||
189 | hcb_wait_for_ack(par); | 81 | /* wait for ack */ |
82 | par->board->wait_for_ack(par, 0); | ||
190 | 83 | ||
191 | /* set DS hi */ | 84 | /* set DS hi */ |
192 | par->ctl &= ~(HCB_NDS_BIT); | 85 | par->board->set_ctl(par, HCB_DS_BIT, 1); |
193 | hcb_set_ctl(par); | ||
194 | 86 | ||
195 | hcb_wait_for_ack_clear(par); | 87 | /* wait for ack to clear */ |
88 | par->board->wait_for_ack(par, 1); | ||
196 | } | 89 | } |
197 | 90 | ||
198 | static void apollo_send_command(struct hecubafb_par *par, unsigned char data) | 91 | static void apollo_send_command(struct hecubafb_par *par, unsigned char data) |
199 | { | 92 | { |
200 | /* command so set CD to high */ | 93 | /* command so set CD to high */ |
201 | par->ctl &= ~(HCB_NCD_BIT); | 94 | par->board->set_ctl(par, HCB_CD_BIT, 1); |
202 | hcb_set_ctl(par); | ||
203 | 95 | ||
204 | /* actually strobe with command */ | 96 | /* actually strobe with command */ |
205 | apollo_send_data(par, data); | 97 | apollo_send_data(par, data); |
206 | 98 | ||
207 | /* clear CD back to low */ | 99 | /* clear CD back to low */ |
208 | par->ctl |= (HCB_NCD_BIT); | 100 | par->board->set_ctl(par, HCB_CD_BIT, 0); |
209 | hcb_set_ctl(par); | ||
210 | } | 101 | } |
211 | 102 | ||
212 | /* main hecubafb functions */ | ||
213 | |||
214 | static void hecubafb_dpy_update(struct hecubafb_par *par) | 103 | static void hecubafb_dpy_update(struct hecubafb_par *par) |
215 | { | 104 | { |
216 | int i; | 105 | int i; |
217 | unsigned char *buf = (unsigned char __force *)par->info->screen_base; | 106 | unsigned char *buf = (unsigned char __force *)par->info->screen_base; |
218 | 107 | ||
219 | apollo_send_command(par, 0xA0); | 108 | apollo_send_command(par, APOLLO_START_NEW_IMG); |
220 | 109 | ||
221 | for (i=0; i < (DPY_W*DPY_H/8); i++) { | 110 | for (i=0; i < (DPY_W*DPY_H/8); i++) { |
222 | apollo_send_data(par, *(buf++)); | 111 | apollo_send_data(par, *(buf++)); |
223 | } | 112 | } |
224 | 113 | ||
225 | apollo_send_command(par, 0xA1); | 114 | apollo_send_command(par, APOLLO_STOP_IMG_DATA); |
226 | apollo_send_command(par, 0xA2); | 115 | apollo_send_command(par, APOLLO_DISPLAY_IMG); |
227 | } | 116 | } |
228 | 117 | ||
229 | /* this is called back from the deferred io workqueue */ | 118 | /* this is called back from the deferred io workqueue */ |
@@ -270,41 +159,43 @@ static void hecubafb_imageblit(struct fb_info *info, | |||
270 | static ssize_t hecubafb_write(struct fb_info *info, const char __user *buf, | 159 | static ssize_t hecubafb_write(struct fb_info *info, const char __user *buf, |
271 | size_t count, loff_t *ppos) | 160 | size_t count, loff_t *ppos) |
272 | { | 161 | { |
273 | unsigned long p; | 162 | struct hecubafb_par *par = info->par; |
274 | int err=-EINVAL; | 163 | unsigned long p = *ppos; |
275 | struct hecubafb_par *par; | 164 | void *dst; |
276 | unsigned int xres; | 165 | int err = 0; |
277 | unsigned int fbmemlength; | 166 | unsigned long total_size; |
278 | 167 | ||
279 | p = *ppos; | 168 | if (info->state != FBINFO_STATE_RUNNING) |
280 | par = info->par; | 169 | return -EPERM; |
281 | xres = info->var.xres; | ||
282 | fbmemlength = (xres * info->var.yres)/8; | ||
283 | 170 | ||
284 | if (p > fbmemlength) | 171 | total_size = info->fix.smem_len; |
285 | return -ENOSPC; | ||
286 | 172 | ||
287 | err = 0; | 173 | if (p > total_size) |
288 | if ((count + p) > fbmemlength) { | 174 | return -EFBIG; |
289 | count = fbmemlength - p; | 175 | |
290 | err = -ENOSPC; | 176 | if (count > total_size) { |
177 | err = -EFBIG; | ||
178 | count = total_size; | ||
291 | } | 179 | } |
292 | 180 | ||
293 | if (count) { | 181 | if (count + p > total_size) { |
294 | char *base_addr; | 182 | if (!err) |
183 | err = -ENOSPC; | ||
295 | 184 | ||
296 | base_addr = (char __force *)info->screen_base; | 185 | count = total_size - p; |
297 | count -= copy_from_user(base_addr + p, buf, count); | ||
298 | *ppos += count; | ||
299 | err = -EFAULT; | ||
300 | } | 186 | } |
301 | 187 | ||
302 | hecubafb_dpy_update(par); | 188 | dst = (void __force *) (info->screen_base + p); |
189 | |||
190 | if (copy_from_user(dst, buf, count)) | ||
191 | err = -EFAULT; | ||
303 | 192 | ||
304 | if (count) | 193 | if (!err) |
305 | return count; | 194 | *ppos += count; |
306 | 195 | ||
307 | return err; | 196 | hecubafb_dpy_update(par); |
197 | |||
198 | return (err) ? err : count; | ||
308 | } | 199 | } |
309 | 200 | ||
310 | static struct fb_ops hecubafb_ops = { | 201 | static struct fb_ops hecubafb_ops = { |
@@ -324,11 +215,21 @@ static struct fb_deferred_io hecubafb_defio = { | |||
324 | static int __devinit hecubafb_probe(struct platform_device *dev) | 215 | static int __devinit hecubafb_probe(struct platform_device *dev) |
325 | { | 216 | { |
326 | struct fb_info *info; | 217 | struct fb_info *info; |
218 | struct hecuba_board *board; | ||
327 | int retval = -ENOMEM; | 219 | int retval = -ENOMEM; |
328 | int videomemorysize; | 220 | int videomemorysize; |
329 | unsigned char *videomemory; | 221 | unsigned char *videomemory; |
330 | struct hecubafb_par *par; | 222 | struct hecubafb_par *par; |
331 | 223 | ||
224 | /* pick up board specific routines */ | ||
225 | board = dev->dev.platform_data; | ||
226 | if (!board) | ||
227 | return -EINVAL; | ||
228 | |||
229 | /* try to count device specific driver, if can't, platform recalls */ | ||
230 | if (!try_module_get(board->owner)) | ||
231 | return -ENODEV; | ||
232 | |||
332 | videomemorysize = (DPY_W*DPY_H)/8; | 233 | videomemorysize = (DPY_W*DPY_H)/8; |
333 | 234 | ||
334 | if (!(videomemory = vmalloc(videomemorysize))) | 235 | if (!(videomemory = vmalloc(videomemorysize))) |
@@ -338,9 +239,9 @@ static int __devinit hecubafb_probe(struct platform_device *dev) | |||
338 | 239 | ||
339 | info = framebuffer_alloc(sizeof(struct hecubafb_par), &dev->dev); | 240 | info = framebuffer_alloc(sizeof(struct hecubafb_par), &dev->dev); |
340 | if (!info) | 241 | if (!info) |
341 | goto err; | 242 | goto err_fballoc; |
342 | 243 | ||
343 | info->screen_base = (char __iomem *) videomemory; | 244 | info->screen_base = (char __force __iomem *)videomemory; |
344 | info->fbops = &hecubafb_ops; | 245 | info->fbops = &hecubafb_ops; |
345 | 246 | ||
346 | info->var = hecubafb_var; | 247 | info->var = hecubafb_var; |
@@ -348,14 +249,10 @@ static int __devinit hecubafb_probe(struct platform_device *dev) | |||
348 | info->fix.smem_len = videomemorysize; | 249 | info->fix.smem_len = videomemorysize; |
349 | par = info->par; | 250 | par = info->par; |
350 | par->info = info; | 251 | par->info = info; |
252 | par->board = board; | ||
253 | par->send_command = apollo_send_command; | ||
254 | par->send_data = apollo_send_data; | ||
351 | 255 | ||
352 | if (!dio_addr || !cio_addr || !c2io_addr) { | ||
353 | printk(KERN_WARNING "no IO addresses supplied\n"); | ||
354 | goto err1; | ||
355 | } | ||
356 | par->dio_addr = dio_addr; | ||
357 | par->cio_addr = cio_addr; | ||
358 | par->c2io_addr = c2io_addr; | ||
359 | info->flags = FBINFO_FLAG_DEFAULT; | 256 | info->flags = FBINFO_FLAG_DEFAULT; |
360 | 257 | ||
361 | info->fbdefio = &hecubafb_defio; | 258 | info->fbdefio = &hecubafb_defio; |
@@ -363,7 +260,7 @@ static int __devinit hecubafb_probe(struct platform_device *dev) | |||
363 | 260 | ||
364 | retval = register_framebuffer(info); | 261 | retval = register_framebuffer(info); |
365 | if (retval < 0) | 262 | if (retval < 0) |
366 | goto err1; | 263 | goto err_fbreg; |
367 | platform_set_drvdata(dev, info); | 264 | platform_set_drvdata(dev, info); |
368 | 265 | ||
369 | printk(KERN_INFO | 266 | printk(KERN_INFO |
@@ -371,25 +268,16 @@ static int __devinit hecubafb_probe(struct platform_device *dev) | |||
371 | info->node, videomemorysize >> 10); | 268 | info->node, videomemorysize >> 10); |
372 | 269 | ||
373 | /* this inits the dpy */ | 270 | /* this inits the dpy */ |
374 | apollo_init_control(par); | 271 | retval = par->board->init(par); |
375 | 272 | if (retval < 0) | |
376 | apollo_send_command(par, APOLLO_INIT_DISPLAY); | 273 | goto err_fbreg; |
377 | apollo_send_data(par, 0x81); | ||
378 | |||
379 | /* have to wait while display resets */ | ||
380 | udelay(1000); | ||
381 | |||
382 | /* if we were told to splash the screen, we just clear it */ | ||
383 | if (!nosplash) { | ||
384 | apollo_send_command(par, APOLLO_ERASE_DISPLAY); | ||
385 | apollo_send_data(par, splashval); | ||
386 | } | ||
387 | 274 | ||
388 | return 0; | 275 | return 0; |
389 | err1: | 276 | err_fbreg: |
390 | framebuffer_release(info); | 277 | framebuffer_release(info); |
391 | err: | 278 | err_fballoc: |
392 | vfree(videomemory); | 279 | vfree(videomemory); |
280 | module_put(board->owner); | ||
393 | return retval; | 281 | return retval; |
394 | } | 282 | } |
395 | 283 | ||
@@ -398,9 +286,13 @@ static int __devexit hecubafb_remove(struct platform_device *dev) | |||
398 | struct fb_info *info = platform_get_drvdata(dev); | 286 | struct fb_info *info = platform_get_drvdata(dev); |
399 | 287 | ||
400 | if (info) { | 288 | if (info) { |
289 | struct hecubafb_par *par = info->par; | ||
401 | fb_deferred_io_cleanup(info); | 290 | fb_deferred_io_cleanup(info); |
402 | unregister_framebuffer(info); | 291 | unregister_framebuffer(info); |
403 | vfree((void __force *)info->screen_base); | 292 | vfree((void __force *)info->screen_base); |
293 | if (par->board->remove) | ||
294 | par->board->remove(par); | ||
295 | module_put(par->board->owner); | ||
404 | framebuffer_release(info); | 296 | framebuffer_release(info); |
405 | } | 297 | } |
406 | return 0; | 298 | return 0; |
@@ -410,62 +302,24 @@ static struct platform_driver hecubafb_driver = { | |||
410 | .probe = hecubafb_probe, | 302 | .probe = hecubafb_probe, |
411 | .remove = hecubafb_remove, | 303 | .remove = hecubafb_remove, |
412 | .driver = { | 304 | .driver = { |
305 | .owner = THIS_MODULE, | ||
413 | .name = "hecubafb", | 306 | .name = "hecubafb", |
414 | }, | 307 | }, |
415 | }; | 308 | }; |
416 | 309 | ||
417 | static struct platform_device *hecubafb_device; | ||
418 | |||
419 | static int __init hecubafb_init(void) | 310 | static int __init hecubafb_init(void) |
420 | { | 311 | { |
421 | int ret; | 312 | return platform_driver_register(&hecubafb_driver); |
422 | |||
423 | if (!hecubafb_enable) { | ||
424 | printk(KERN_ERR "Use hecubafb_enable to enable the device\n"); | ||
425 | return -ENXIO; | ||
426 | } | ||
427 | |||
428 | ret = platform_driver_register(&hecubafb_driver); | ||
429 | if (!ret) { | ||
430 | hecubafb_device = platform_device_alloc("hecubafb", 0); | ||
431 | if (hecubafb_device) | ||
432 | ret = platform_device_add(hecubafb_device); | ||
433 | else | ||
434 | ret = -ENOMEM; | ||
435 | |||
436 | if (ret) { | ||
437 | platform_device_put(hecubafb_device); | ||
438 | platform_driver_unregister(&hecubafb_driver); | ||
439 | } | ||
440 | } | ||
441 | return ret; | ||
442 | |||
443 | } | 313 | } |
444 | 314 | ||
445 | static void __exit hecubafb_exit(void) | 315 | static void __exit hecubafb_exit(void) |
446 | { | 316 | { |
447 | platform_device_unregister(hecubafb_device); | ||
448 | platform_driver_unregister(&hecubafb_driver); | 317 | platform_driver_unregister(&hecubafb_driver); |
449 | } | 318 | } |
450 | 319 | ||
451 | module_param(nosplash, uint, 0); | ||
452 | MODULE_PARM_DESC(nosplash, "Disable doing the splash screen"); | ||
453 | module_param(hecubafb_enable, uint, 0); | ||
454 | MODULE_PARM_DESC(hecubafb_enable, "Enable communication with Hecuba board"); | ||
455 | module_param(dio_addr, ulong, 0); | ||
456 | MODULE_PARM_DESC(dio_addr, "IO address for data, eg: 0x480"); | ||
457 | module_param(cio_addr, ulong, 0); | ||
458 | MODULE_PARM_DESC(cio_addr, "IO address for control, eg: 0x400"); | ||
459 | module_param(c2io_addr, ulong, 0); | ||
460 | MODULE_PARM_DESC(c2io_addr, "IO address for secondary control, eg: 0x408"); | ||
461 | module_param(splashval, ulong, 0); | ||
462 | MODULE_PARM_DESC(splashval, "Splash pattern: 0x00 is black, 0x01 is white"); | ||
463 | module_param(irq, uint, 0); | ||
464 | MODULE_PARM_DESC(irq, "IRQ for the Hecuba board"); | ||
465 | |||
466 | module_init(hecubafb_init); | 320 | module_init(hecubafb_init); |
467 | module_exit(hecubafb_exit); | 321 | module_exit(hecubafb_exit); |
468 | 322 | ||
469 | MODULE_DESCRIPTION("fbdev driver for Hecuba board"); | 323 | MODULE_DESCRIPTION("fbdev driver for Hecuba/Apollo controller"); |
470 | MODULE_AUTHOR("Jaya Kumar"); | 324 | MODULE_AUTHOR("Jaya Kumar"); |
471 | MODULE_LICENSE("GPL"); | 325 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c index 3ab91bf21576..15d50b9906ce 100644 --- a/drivers/video/imsttfb.c +++ b/drivers/video/imsttfb.c | |||
@@ -1151,8 +1151,10 @@ imsttfb_load_cursor_image(struct imstt_par *par, int width, int height, __u8 fgc | |||
1151 | par->cmap_regs[TVPCRDAT] = 0xff; eieio(); | 1151 | par->cmap_regs[TVPCRDAT] = 0xff; eieio(); |
1152 | } | 1152 | } |
1153 | par->cmap_regs[TVPCADRW] = 0x00; eieio(); | 1153 | par->cmap_regs[TVPCADRW] = 0x00; eieio(); |
1154 | for (x = 0; x < 12; x++) | 1154 | for (x = 0; x < 12; x++) { |
1155 | par->cmap_regs[TVPCDATA] = fgc; eieio(); | 1155 | par->cmap_regs[TVPCDATA] = fgc; |
1156 | eieio(); | ||
1157 | } | ||
1156 | } | 1158 | } |
1157 | return 1; | 1159 | return 1; |
1158 | } | 1160 | } |
@@ -1476,7 +1478,7 @@ imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1476 | 1478 | ||
1477 | dp = pci_device_to_OF_node(pdev); | 1479 | dp = pci_device_to_OF_node(pdev); |
1478 | if(dp) | 1480 | if(dp) |
1479 | printk(KERN_INFO "%s: OF name %s\n",__FUNCTION__, dp->name); | 1481 | printk(KERN_INFO "%s: OF name %s\n",__func__, dp->name); |
1480 | else | 1482 | else |
1481 | printk(KERN_ERR "imsttfb: no OF node for pci device\n"); | 1483 | printk(KERN_ERR "imsttfb: no OF node for pci device\n"); |
1482 | #endif /* CONFIG_PPC_OF */ | 1484 | #endif /* CONFIG_PPC_OF */ |
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 11609552a387..94e4d3ac1a05 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c | |||
@@ -415,7 +415,7 @@ static void imxfb_setup_gpio(struct imxfb_info *fbi) | |||
415 | static int imxfb_suspend(struct platform_device *dev, pm_message_t state) | 415 | static int imxfb_suspend(struct platform_device *dev, pm_message_t state) |
416 | { | 416 | { |
417 | struct imxfb_info *fbi = platform_get_drvdata(dev); | 417 | struct imxfb_info *fbi = platform_get_drvdata(dev); |
418 | pr_debug("%s\n",__FUNCTION__); | 418 | pr_debug("%s\n",__func__); |
419 | 419 | ||
420 | imxfb_disable_controller(fbi); | 420 | imxfb_disable_controller(fbi); |
421 | return 0; | 421 | return 0; |
@@ -424,7 +424,7 @@ static int imxfb_suspend(struct platform_device *dev, pm_message_t state) | |||
424 | static int imxfb_resume(struct platform_device *dev) | 424 | static int imxfb_resume(struct platform_device *dev) |
425 | { | 425 | { |
426 | struct imxfb_info *fbi = platform_get_drvdata(dev); | 426 | struct imxfb_info *fbi = platform_get_drvdata(dev); |
427 | pr_debug("%s\n",__FUNCTION__); | 427 | pr_debug("%s\n",__func__); |
428 | 428 | ||
429 | imxfb_enable_controller(fbi); | 429 | imxfb_enable_controller(fbi); |
430 | return 0; | 430 | return 0; |
@@ -440,7 +440,7 @@ static int __init imxfb_init_fbinfo(struct device *dev) | |||
440 | struct fb_info *info = dev_get_drvdata(dev); | 440 | struct fb_info *info = dev_get_drvdata(dev); |
441 | struct imxfb_info *fbi = info->par; | 441 | struct imxfb_info *fbi = info->par; |
442 | 442 | ||
443 | pr_debug("%s\n",__FUNCTION__); | 443 | pr_debug("%s\n",__func__); |
444 | 444 | ||
445 | info->pseudo_palette = kmalloc( sizeof(u32) * 16, GFP_KERNEL); | 445 | info->pseudo_palette = kmalloc( sizeof(u32) * 16, GFP_KERNEL); |
446 | if (!info->pseudo_palette) | 446 | if (!info->pseudo_palette) |
diff --git a/drivers/video/intelfb/intelfb.h b/drivers/video/intelfb/intelfb.h index 836796177942..3325fbd68ab3 100644 --- a/drivers/video/intelfb/intelfb.h +++ b/drivers/video/intelfb/intelfb.h | |||
@@ -12,9 +12,9 @@ | |||
12 | #endif | 12 | #endif |
13 | 13 | ||
14 | /*** Version/name ***/ | 14 | /*** Version/name ***/ |
15 | #define INTELFB_VERSION "0.9.4" | 15 | #define INTELFB_VERSION "0.9.5" |
16 | #define INTELFB_MODULE_NAME "intelfb" | 16 | #define INTELFB_MODULE_NAME "intelfb" |
17 | #define SUPPORTED_CHIPSETS "830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM" | 17 | #define SUPPORTED_CHIPSETS "830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM" |
18 | 18 | ||
19 | 19 | ||
20 | /*** Debug/feature defines ***/ | 20 | /*** Debug/feature defines ***/ |
@@ -58,6 +58,8 @@ | |||
58 | #define PCI_DEVICE_ID_INTEL_915GM 0x2592 | 58 | #define PCI_DEVICE_ID_INTEL_915GM 0x2592 |
59 | #define PCI_DEVICE_ID_INTEL_945G 0x2772 | 59 | #define PCI_DEVICE_ID_INTEL_945G 0x2772 |
60 | #define PCI_DEVICE_ID_INTEL_945GM 0x27A2 | 60 | #define PCI_DEVICE_ID_INTEL_945GM 0x27A2 |
61 | #define PCI_DEVICE_ID_INTEL_965G 0x29A2 | ||
62 | #define PCI_DEVICE_ID_INTEL_965GM 0x2A02 | ||
61 | 63 | ||
62 | /* Size of MMIO region */ | 64 | /* Size of MMIO region */ |
63 | #define INTEL_REG_SIZE 0x80000 | 65 | #define INTEL_REG_SIZE 0x80000 |
@@ -158,6 +160,8 @@ enum intel_chips { | |||
158 | INTEL_915GM, | 160 | INTEL_915GM, |
159 | INTEL_945G, | 161 | INTEL_945G, |
160 | INTEL_945GM, | 162 | INTEL_945GM, |
163 | INTEL_965G, | ||
164 | INTEL_965GM, | ||
161 | }; | 165 | }; |
162 | 166 | ||
163 | struct intelfb_hwstate { | 167 | struct intelfb_hwstate { |
@@ -358,7 +362,9 @@ struct intelfb_info { | |||
358 | #define IS_I9XX(dinfo) (((dinfo)->chipset == INTEL_915G) || \ | 362 | #define IS_I9XX(dinfo) (((dinfo)->chipset == INTEL_915G) || \ |
359 | ((dinfo)->chipset == INTEL_915GM) || \ | 363 | ((dinfo)->chipset == INTEL_915GM) || \ |
360 | ((dinfo)->chipset == INTEL_945G) || \ | 364 | ((dinfo)->chipset == INTEL_945G) || \ |
361 | ((dinfo)->chipset==INTEL_945GM)) | 365 | ((dinfo)->chipset == INTEL_945GM) || \ |
366 | ((dinfo)->chipset == INTEL_965G) || \ | ||
367 | ((dinfo)->chipset == INTEL_965GM)) | ||
362 | 368 | ||
363 | #ifndef FBIO_WAITFORVSYNC | 369 | #ifndef FBIO_WAITFORVSYNC |
364 | #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) | 370 | #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) |
diff --git a/drivers/video/intelfb/intelfb_i2c.c b/drivers/video/intelfb/intelfb_i2c.c index 94c08bb5acf1..ca95f09d8b43 100644 --- a/drivers/video/intelfb/intelfb_i2c.c +++ b/drivers/video/intelfb/intelfb_i2c.c | |||
@@ -169,6 +169,8 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo) | |||
169 | /* has some LVDS + tv-out */ | 169 | /* has some LVDS + tv-out */ |
170 | case INTEL_945G: | 170 | case INTEL_945G: |
171 | case INTEL_945GM: | 171 | case INTEL_945GM: |
172 | case INTEL_965G: | ||
173 | case INTEL_965GM: | ||
172 | /* SDVO ports have a single control bus - 2 devices */ | 174 | /* SDVO ports have a single control bus - 2 devices */ |
173 | dinfo->output[i].type = INTELFB_OUTPUT_SDVO; | 175 | dinfo->output[i].type = INTELFB_OUTPUT_SDVO; |
174 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, | 176 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, |
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index 481d58f7535d..e44303f9bc52 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * intelfb | 2 | * intelfb |
3 | * | 3 | * |
4 | * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G/915GM/ | 4 | * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G/915GM/ |
5 | * 945G/945GM integrated graphics chips. | 5 | * 945G/945GM/965G/965GM integrated graphics chips. |
6 | * | 6 | * |
7 | * Copyright © 2002, 2003 David Dawes <dawes@xfree86.org> | 7 | * Copyright © 2002, 2003 David Dawes <dawes@xfree86.org> |
8 | * 2004 Sylvain Meyer | 8 | * 2004 Sylvain Meyer |
@@ -99,6 +99,9 @@ | |||
99 | * Add vram option to reserve more memory than stolen by BIOS | 99 | * Add vram option to reserve more memory than stolen by BIOS |
100 | * Fix intelfbhw_pan_display typo | 100 | * Fix intelfbhw_pan_display typo |
101 | * Add __initdata annotations | 101 | * Add __initdata annotations |
102 | * | ||
103 | * 04/2008 - Version 0.9.5 | ||
104 | * Add support for 965G/965GM. (Maik Broemme <mbroemme@plusserver.de>) | ||
102 | */ | 105 | */ |
103 | 106 | ||
104 | #include <linux/module.h> | 107 | #include <linux/module.h> |
@@ -180,6 +183,8 @@ static struct pci_device_id intelfb_pci_table[] __devinitdata = { | |||
180 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_915GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_915GM }, | 183 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_915GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_915GM }, |
181 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_945G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_945G }, | 184 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_945G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_945G }, |
182 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_945GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_945GM }, | 185 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_945GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_945GM }, |
186 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_965G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_965G }, | ||
187 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_965GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_965GM }, | ||
183 | { 0, } | 188 | { 0, } |
184 | }; | 189 | }; |
185 | 190 | ||
@@ -549,7 +554,10 @@ static int __devinit intelfb_pci_register(struct pci_dev *pdev, | |||
549 | if ((ent->device == PCI_DEVICE_ID_INTEL_915G) || | 554 | if ((ent->device == PCI_DEVICE_ID_INTEL_915G) || |
550 | (ent->device == PCI_DEVICE_ID_INTEL_915GM) || | 555 | (ent->device == PCI_DEVICE_ID_INTEL_915GM) || |
551 | (ent->device == PCI_DEVICE_ID_INTEL_945G) || | 556 | (ent->device == PCI_DEVICE_ID_INTEL_945G) || |
552 | (ent->device == PCI_DEVICE_ID_INTEL_945GM)) { | 557 | (ent->device == PCI_DEVICE_ID_INTEL_945GM) || |
558 | (ent->device == PCI_DEVICE_ID_INTEL_965G) || | ||
559 | (ent->device == PCI_DEVICE_ID_INTEL_965GM)) { | ||
560 | |||
553 | aperture_bar = 2; | 561 | aperture_bar = 2; |
554 | mmio_bar = 0; | 562 | mmio_bar = 0; |
555 | } | 563 | } |
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c index fa1fff553565..8e6d6a4db0ad 100644 --- a/drivers/video/intelfb/intelfbhw.c +++ b/drivers/video/intelfb/intelfbhw.c | |||
@@ -143,6 +143,18 @@ int intelfbhw_get_chipset(struct pci_dev *pdev, struct intelfb_info *dinfo) | |||
143 | dinfo->mobile = 1; | 143 | dinfo->mobile = 1; |
144 | dinfo->pll_index = PLLS_I9xx; | 144 | dinfo->pll_index = PLLS_I9xx; |
145 | return 0; | 145 | return 0; |
146 | case PCI_DEVICE_ID_INTEL_965G: | ||
147 | dinfo->name = "Intel(R) 965G"; | ||
148 | dinfo->chipset = INTEL_965G; | ||
149 | dinfo->mobile = 0; | ||
150 | dinfo->pll_index = PLLS_I9xx; | ||
151 | return 0; | ||
152 | case PCI_DEVICE_ID_INTEL_965GM: | ||
153 | dinfo->name = "Intel(R) 965GM"; | ||
154 | dinfo->chipset = INTEL_965GM; | ||
155 | dinfo->mobile = 1; | ||
156 | dinfo->pll_index = PLLS_I9xx; | ||
157 | return 0; | ||
146 | default: | 158 | default: |
147 | return 1; | 159 | return 1; |
148 | } | 160 | } |
@@ -174,7 +186,9 @@ int intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size, | |||
174 | case PCI_DEVICE_ID_INTEL_915GM: | 186 | case PCI_DEVICE_ID_INTEL_915GM: |
175 | case PCI_DEVICE_ID_INTEL_945G: | 187 | case PCI_DEVICE_ID_INTEL_945G: |
176 | case PCI_DEVICE_ID_INTEL_945GM: | 188 | case PCI_DEVICE_ID_INTEL_945GM: |
177 | /* 915 and 945 chipsets support a 256MB aperture. | 189 | case PCI_DEVICE_ID_INTEL_965G: |
190 | case PCI_DEVICE_ID_INTEL_965GM: | ||
191 | /* 915, 945 and 965 chipsets support a 256MB aperture. | ||
178 | Aperture size is determined by inspected the | 192 | Aperture size is determined by inspected the |
179 | base address of the aperture. */ | 193 | base address of the aperture. */ |
180 | if (pci_resource_start(pdev, 2) & 0x08000000) | 194 | if (pci_resource_start(pdev, 2) & 0x08000000) |
diff --git a/drivers/video/leo.c b/drivers/video/leo.c index 45b9a5d55dec..f3160fc29795 100644 --- a/drivers/video/leo.c +++ b/drivers/video/leo.c | |||
@@ -614,7 +614,7 @@ static int __devinit leo_probe(struct of_device *op, const struct of_device_id * | |||
614 | 614 | ||
615 | dev_set_drvdata(&op->dev, info); | 615 | dev_set_drvdata(&op->dev, info); |
616 | 616 | ||
617 | printk("%s: leo at %lx:%lx\n", | 617 | printk(KERN_INFO "%s: leo at %lx:%lx\n", |
618 | dp->full_name, | 618 | dp->full_name, |
619 | par->which_io, par->physbase); | 619 | par->which_io, par->physbase); |
620 | 620 | ||
diff --git a/drivers/video/matrox/matroxfb_DAC1064.c b/drivers/video/matrox/matroxfb_DAC1064.c index c4b570b4a4df..0ce3b0a89798 100644 --- a/drivers/video/matrox/matroxfb_DAC1064.c +++ b/drivers/video/matrox/matroxfb_DAC1064.c | |||
@@ -37,7 +37,7 @@ static void DAC1064_calcclock(CPMINFO unsigned int freq, unsigned int fmax, unsi | |||
37 | unsigned int fvco; | 37 | unsigned int fvco; |
38 | unsigned int p; | 38 | unsigned int p; |
39 | 39 | ||
40 | DBG(__FUNCTION__) | 40 | DBG(__func__) |
41 | 41 | ||
42 | /* only for devices older than G450 */ | 42 | /* only for devices older than G450 */ |
43 | 43 | ||
@@ -83,7 +83,7 @@ static const unsigned char MGA1064_DAC[] = { | |||
83 | static void DAC1064_setpclk(WPMINFO unsigned long fout) { | 83 | static void DAC1064_setpclk(WPMINFO unsigned long fout) { |
84 | unsigned int m, n, p; | 84 | unsigned int m, n, p; |
85 | 85 | ||
86 | DBG(__FUNCTION__) | 86 | DBG(__func__) |
87 | 87 | ||
88 | DAC1064_calcclock(PMINFO fout, ACCESS_FBINFO(max_pixel_clock), &m, &n, &p); | 88 | DAC1064_calcclock(PMINFO fout, ACCESS_FBINFO(max_pixel_clock), &m, &n, &p); |
89 | ACCESS_FBINFO(hw).DACclk[0] = m; | 89 | ACCESS_FBINFO(hw).DACclk[0] = m; |
@@ -95,7 +95,7 @@ static void DAC1064_setmclk(WPMINFO int oscinfo, unsigned long fmem) { | |||
95 | u_int32_t mx; | 95 | u_int32_t mx; |
96 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); | 96 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); |
97 | 97 | ||
98 | DBG(__FUNCTION__) | 98 | DBG(__func__) |
99 | 99 | ||
100 | if (ACCESS_FBINFO(devflags.noinit)) { | 100 | if (ACCESS_FBINFO(devflags.noinit)) { |
101 | /* read MCLK and give up... */ | 101 | /* read MCLK and give up... */ |
@@ -338,7 +338,7 @@ void DAC1064_global_restore(WPMINFO2) { | |||
338 | static int DAC1064_init_1(WPMINFO struct my_timming* m) { | 338 | static int DAC1064_init_1(WPMINFO struct my_timming* m) { |
339 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); | 339 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); |
340 | 340 | ||
341 | DBG(__FUNCTION__) | 341 | DBG(__func__) |
342 | 342 | ||
343 | memcpy(hw->DACreg, MGA1064_DAC, sizeof(MGA1064_DAC_regs)); | 343 | memcpy(hw->DACreg, MGA1064_DAC, sizeof(MGA1064_DAC_regs)); |
344 | switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { | 344 | switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { |
@@ -374,7 +374,7 @@ static int DAC1064_init_1(WPMINFO struct my_timming* m) { | |||
374 | static int DAC1064_init_2(WPMINFO struct my_timming* m) { | 374 | static int DAC1064_init_2(WPMINFO struct my_timming* m) { |
375 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); | 375 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); |
376 | 376 | ||
377 | DBG(__FUNCTION__) | 377 | DBG(__func__) |
378 | 378 | ||
379 | if (ACCESS_FBINFO(fbcon).var.bits_per_pixel > 16) { /* 256 entries */ | 379 | if (ACCESS_FBINFO(fbcon).var.bits_per_pixel > 16) { /* 256 entries */ |
380 | int i; | 380 | int i; |
@@ -418,7 +418,7 @@ static void DAC1064_restore_1(WPMINFO2) { | |||
418 | 418 | ||
419 | CRITFLAGS | 419 | CRITFLAGS |
420 | 420 | ||
421 | DBG(__FUNCTION__) | 421 | DBG(__func__) |
422 | 422 | ||
423 | CRITBEGIN | 423 | CRITBEGIN |
424 | 424 | ||
@@ -448,7 +448,7 @@ static void DAC1064_restore_2(WPMINFO2) { | |||
448 | unsigned int i; | 448 | unsigned int i; |
449 | #endif | 449 | #endif |
450 | 450 | ||
451 | DBG(__FUNCTION__) | 451 | DBG(__func__) |
452 | 452 | ||
453 | #ifdef DEBUG | 453 | #ifdef DEBUG |
454 | dprintk(KERN_DEBUG "DAC1064regs "); | 454 | dprintk(KERN_DEBUG "DAC1064regs "); |
@@ -521,7 +521,7 @@ static struct matrox_altout g450out = { | |||
521 | static int MGA1064_init(WPMINFO struct my_timming* m) { | 521 | static int MGA1064_init(WPMINFO struct my_timming* m) { |
522 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); | 522 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); |
523 | 523 | ||
524 | DBG(__FUNCTION__) | 524 | DBG(__func__) |
525 | 525 | ||
526 | if (DAC1064_init_1(PMINFO m)) return 1; | 526 | if (DAC1064_init_1(PMINFO m)) return 1; |
527 | if (matroxfb_vgaHWinit(PMINFO m)) return 1; | 527 | if (matroxfb_vgaHWinit(PMINFO m)) return 1; |
@@ -543,7 +543,7 @@ static int MGA1064_init(WPMINFO struct my_timming* m) { | |||
543 | static int MGAG100_init(WPMINFO struct my_timming* m) { | 543 | static int MGAG100_init(WPMINFO struct my_timming* m) { |
544 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); | 544 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); |
545 | 545 | ||
546 | DBG(__FUNCTION__) | 546 | DBG(__func__) |
547 | 547 | ||
548 | if (DAC1064_init_1(PMINFO m)) return 1; | 548 | if (DAC1064_init_1(PMINFO m)) return 1; |
549 | hw->MXoptionReg &= ~0x2000; | 549 | hw->MXoptionReg &= ~0x2000; |
@@ -565,7 +565,7 @@ static int MGAG100_init(WPMINFO struct my_timming* m) { | |||
565 | #ifdef CONFIG_FB_MATROX_MYSTIQUE | 565 | #ifdef CONFIG_FB_MATROX_MYSTIQUE |
566 | static void MGA1064_ramdac_init(WPMINFO2) { | 566 | static void MGA1064_ramdac_init(WPMINFO2) { |
567 | 567 | ||
568 | DBG(__FUNCTION__) | 568 | DBG(__func__) |
569 | 569 | ||
570 | /* ACCESS_FBINFO(features.DAC1064.vco_freq_min) = 120000; */ | 570 | /* ACCESS_FBINFO(features.DAC1064.vco_freq_min) = 120000; */ |
571 | ACCESS_FBINFO(features.pll.vco_freq_min) = 62000; | 571 | ACCESS_FBINFO(features.pll.vco_freq_min) = 62000; |
@@ -594,7 +594,7 @@ static void MGAG100_progPixClock(CPMINFO int flags, int m, int n, int p) { | |||
594 | int selClk; | 594 | int selClk; |
595 | int clk; | 595 | int clk; |
596 | 596 | ||
597 | DBG(__FUNCTION__) | 597 | DBG(__func__) |
598 | 598 | ||
599 | outDAC1064(PMINFO M1064_XPIXCLKCTRL, inDAC1064(PMINFO M1064_XPIXCLKCTRL) | M1064_XPIXCLKCTRL_DIS | | 599 | outDAC1064(PMINFO M1064_XPIXCLKCTRL, inDAC1064(PMINFO M1064_XPIXCLKCTRL) | M1064_XPIXCLKCTRL_DIS | |
600 | M1064_XPIXCLKCTRL_PLL_UP); | 600 | M1064_XPIXCLKCTRL_PLL_UP); |
@@ -636,7 +636,7 @@ static void MGAG100_progPixClock(CPMINFO int flags, int m, int n, int p) { | |||
636 | static void MGAG100_setPixClock(CPMINFO int flags, int freq) { | 636 | static void MGAG100_setPixClock(CPMINFO int flags, int freq) { |
637 | unsigned int m, n, p; | 637 | unsigned int m, n, p; |
638 | 638 | ||
639 | DBG(__FUNCTION__) | 639 | DBG(__func__) |
640 | 640 | ||
641 | DAC1064_calcclock(PMINFO freq, ACCESS_FBINFO(max_pixel_clock), &m, &n, &p); | 641 | DAC1064_calcclock(PMINFO freq, ACCESS_FBINFO(max_pixel_clock), &m, &n, &p); |
642 | MGAG100_progPixClock(PMINFO flags, m, n, p); | 642 | MGAG100_progPixClock(PMINFO flags, m, n, p); |
@@ -650,7 +650,7 @@ static int MGA1064_preinit(WPMINFO2) { | |||
650 | 2048, 0}; | 650 | 2048, 0}; |
651 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); | 651 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); |
652 | 652 | ||
653 | DBG(__FUNCTION__) | 653 | DBG(__func__) |
654 | 654 | ||
655 | /* ACCESS_FBINFO(capable.cfb4) = 0; ... preinitialized by 0 */ | 655 | /* ACCESS_FBINFO(capable.cfb4) = 0; ... preinitialized by 0 */ |
656 | ACCESS_FBINFO(capable.text) = 1; | 656 | ACCESS_FBINFO(capable.text) = 1; |
@@ -683,7 +683,7 @@ static int MGA1064_preinit(WPMINFO2) { | |||
683 | 683 | ||
684 | static void MGA1064_reset(WPMINFO2) { | 684 | static void MGA1064_reset(WPMINFO2) { |
685 | 685 | ||
686 | DBG(__FUNCTION__); | 686 | DBG(__func__); |
687 | 687 | ||
688 | MGA1064_ramdac_init(PMINFO2); | 688 | MGA1064_ramdac_init(PMINFO2); |
689 | } | 689 | } |
@@ -819,7 +819,7 @@ static int MGAG100_preinit(WPMINFO2) { | |||
819 | u_int32_t q; | 819 | u_int32_t q; |
820 | #endif | 820 | #endif |
821 | 821 | ||
822 | DBG(__FUNCTION__) | 822 | DBG(__func__) |
823 | 823 | ||
824 | /* there are some instabilities if in_div > 19 && vco < 61000 */ | 824 | /* there are some instabilities if in_div > 19 && vco < 61000 */ |
825 | if (ACCESS_FBINFO(devflags.g450dac)) { | 825 | if (ACCESS_FBINFO(devflags.g450dac)) { |
@@ -956,7 +956,7 @@ static void MGAG100_reset(WPMINFO2) { | |||
956 | u_int8_t b; | 956 | u_int8_t b; |
957 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); | 957 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); |
958 | 958 | ||
959 | DBG(__FUNCTION__) | 959 | DBG(__func__) |
960 | 960 | ||
961 | { | 961 | { |
962 | #ifdef G100_BROKEN_IBM_82351 | 962 | #ifdef G100_BROKEN_IBM_82351 |
@@ -1015,7 +1015,7 @@ static void MGA1064_restore(WPMINFO2) { | |||
1015 | 1015 | ||
1016 | CRITFLAGS | 1016 | CRITFLAGS |
1017 | 1017 | ||
1018 | DBG(__FUNCTION__) | 1018 | DBG(__func__) |
1019 | 1019 | ||
1020 | CRITBEGIN | 1020 | CRITBEGIN |
1021 | 1021 | ||
@@ -1041,7 +1041,7 @@ static void MGAG100_restore(WPMINFO2) { | |||
1041 | 1041 | ||
1042 | CRITFLAGS | 1042 | CRITFLAGS |
1043 | 1043 | ||
1044 | DBG(__FUNCTION__) | 1044 | DBG(__func__) |
1045 | 1045 | ||
1046 | CRITBEGIN | 1046 | CRITBEGIN |
1047 | 1047 | ||
diff --git a/drivers/video/matrox/matroxfb_Ti3026.c b/drivers/video/matrox/matroxfb_Ti3026.c index 9445cdb759b1..13524821e242 100644 --- a/drivers/video/matrox/matroxfb_Ti3026.c +++ b/drivers/video/matrox/matroxfb_Ti3026.c | |||
@@ -283,7 +283,7 @@ static int Ti3026_calcclock(CPMINFO unsigned int freq, unsigned int fmax, int* i | |||
283 | unsigned int fvco; | 283 | unsigned int fvco; |
284 | unsigned int lin, lfeed, lpost; | 284 | unsigned int lin, lfeed, lpost; |
285 | 285 | ||
286 | DBG(__FUNCTION__) | 286 | DBG(__func__) |
287 | 287 | ||
288 | fvco = PLL_calcclock(PMINFO freq, fmax, &lin, &lfeed, &lpost); | 288 | fvco = PLL_calcclock(PMINFO freq, fmax, &lin, &lfeed, &lpost); |
289 | fvco >>= (*post = lpost); | 289 | fvco >>= (*post = lpost); |
@@ -297,7 +297,7 @@ static int Ti3026_setpclk(WPMINFO int clk) { | |||
297 | unsigned int pixfeed, pixin, pixpost; | 297 | unsigned int pixfeed, pixin, pixpost; |
298 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); | 298 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); |
299 | 299 | ||
300 | DBG(__FUNCTION__) | 300 | DBG(__func__) |
301 | 301 | ||
302 | f_pll = Ti3026_calcclock(PMINFO clk, ACCESS_FBINFO(max_pixel_clock), &pixin, &pixfeed, &pixpost); | 302 | f_pll = Ti3026_calcclock(PMINFO clk, ACCESS_FBINFO(max_pixel_clock), &pixin, &pixfeed, &pixpost); |
303 | 303 | ||
@@ -365,7 +365,7 @@ static int Ti3026_init(WPMINFO struct my_timming* m) { | |||
365 | u_int8_t muxctrl = isInterleave(MINFO) ? TVP3026_XMUXCTRL_MEMORY_64BIT : TVP3026_XMUXCTRL_MEMORY_32BIT; | 365 | u_int8_t muxctrl = isInterleave(MINFO) ? TVP3026_XMUXCTRL_MEMORY_64BIT : TVP3026_XMUXCTRL_MEMORY_32BIT; |
366 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); | 366 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); |
367 | 367 | ||
368 | DBG(__FUNCTION__) | 368 | DBG(__func__) |
369 | 369 | ||
370 | memcpy(hw->DACreg, MGADACbpp32, sizeof(hw->DACreg)); | 370 | memcpy(hw->DACreg, MGADACbpp32, sizeof(hw->DACreg)); |
371 | switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { | 371 | switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { |
@@ -440,7 +440,7 @@ static void ti3026_setMCLK(WPMINFO int fout){ | |||
440 | unsigned int rfhcnt, mclk_ctl; | 440 | unsigned int rfhcnt, mclk_ctl; |
441 | int tmout; | 441 | int tmout; |
442 | 442 | ||
443 | DBG(__FUNCTION__) | 443 | DBG(__func__) |
444 | 444 | ||
445 | f_pll = Ti3026_calcclock(PMINFO fout, ACCESS_FBINFO(max_pixel_clock), &mclk_n, &mclk_m, &mclk_p); | 445 | f_pll = Ti3026_calcclock(PMINFO fout, ACCESS_FBINFO(max_pixel_clock), &mclk_n, &mclk_m, &mclk_p); |
446 | 446 | ||
@@ -534,7 +534,7 @@ static void ti3026_setMCLK(WPMINFO int fout){ | |||
534 | 534 | ||
535 | static void ti3026_ramdac_init(WPMINFO2) { | 535 | static void ti3026_ramdac_init(WPMINFO2) { |
536 | 536 | ||
537 | DBG(__FUNCTION__) | 537 | DBG(__func__) |
538 | 538 | ||
539 | ACCESS_FBINFO(features.pll.vco_freq_min) = 110000; | 539 | ACCESS_FBINFO(features.pll.vco_freq_min) = 110000; |
540 | ACCESS_FBINFO(features.pll.ref_freq) = 114545; | 540 | ACCESS_FBINFO(features.pll.ref_freq) = 114545; |
@@ -554,7 +554,7 @@ static void Ti3026_restore(WPMINFO2) { | |||
554 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); | 554 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); |
555 | CRITFLAGS | 555 | CRITFLAGS |
556 | 556 | ||
557 | DBG(__FUNCTION__) | 557 | DBG(__func__) |
558 | 558 | ||
559 | #ifdef DEBUG | 559 | #ifdef DEBUG |
560 | dprintk(KERN_INFO "EXTVGA regs: "); | 560 | dprintk(KERN_INFO "EXTVGA regs: "); |
@@ -662,7 +662,7 @@ static void Ti3026_restore(WPMINFO2) { | |||
662 | 662 | ||
663 | static void Ti3026_reset(WPMINFO2) { | 663 | static void Ti3026_reset(WPMINFO2) { |
664 | 664 | ||
665 | DBG(__FUNCTION__) | 665 | DBG(__func__) |
666 | 666 | ||
667 | ti3026_ramdac_init(PMINFO2); | 667 | ti3026_ramdac_init(PMINFO2); |
668 | } | 668 | } |
@@ -680,7 +680,7 @@ static int Ti3026_preinit(WPMINFO2) { | |||
680 | 2048, 0}; | 680 | 2048, 0}; |
681 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); | 681 | struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); |
682 | 682 | ||
683 | DBG(__FUNCTION__) | 683 | DBG(__func__) |
684 | 684 | ||
685 | ACCESS_FBINFO(millenium) = 1; | 685 | ACCESS_FBINFO(millenium) = 1; |
686 | ACCESS_FBINFO(milleniumII) = (ACCESS_FBINFO(pcidev)->device != PCI_DEVICE_ID_MATROX_MIL); | 686 | ACCESS_FBINFO(milleniumII) = (ACCESS_FBINFO(pcidev)->device != PCI_DEVICE_ID_MATROX_MIL); |
diff --git a/drivers/video/matrox/matroxfb_accel.c b/drivers/video/matrox/matroxfb_accel.c index 3660d2673bdc..9c3aeee1cc4f 100644 --- a/drivers/video/matrox/matroxfb_accel.c +++ b/drivers/video/matrox/matroxfb_accel.c | |||
@@ -113,7 +113,7 @@ void matrox_cfbX_init(WPMINFO2) { | |||
113 | u_int32_t mopmode; | 113 | u_int32_t mopmode; |
114 | int accel; | 114 | int accel; |
115 | 115 | ||
116 | DBG(__FUNCTION__) | 116 | DBG(__func__) |
117 | 117 | ||
118 | mpitch = ACCESS_FBINFO(fbcon).var.xres_virtual; | 118 | mpitch = ACCESS_FBINFO(fbcon).var.xres_virtual; |
119 | 119 | ||
@@ -199,7 +199,7 @@ static void matrox_accel_bmove(WPMINFO int vxres, int sy, int sx, int dy, int dx | |||
199 | int start, end; | 199 | int start, end; |
200 | CRITFLAGS | 200 | CRITFLAGS |
201 | 201 | ||
202 | DBG(__FUNCTION__) | 202 | DBG(__func__) |
203 | 203 | ||
204 | CRITBEGIN | 204 | CRITBEGIN |
205 | 205 | ||
@@ -235,7 +235,7 @@ static void matrox_accel_bmove_lin(WPMINFO int vxres, int sy, int sx, int dy, in | |||
235 | int start, end; | 235 | int start, end; |
236 | CRITFLAGS | 236 | CRITFLAGS |
237 | 237 | ||
238 | DBG(__FUNCTION__) | 238 | DBG(__func__) |
239 | 239 | ||
240 | CRITBEGIN | 240 | CRITBEGIN |
241 | 241 | ||
@@ -287,7 +287,7 @@ static void matroxfb_accel_clear(WPMINFO u_int32_t color, int sy, int sx, int he | |||
287 | int width) { | 287 | int width) { |
288 | CRITFLAGS | 288 | CRITFLAGS |
289 | 289 | ||
290 | DBG(__FUNCTION__) | 290 | DBG(__func__) |
291 | 291 | ||
292 | CRITBEGIN | 292 | CRITBEGIN |
293 | 293 | ||
@@ -315,7 +315,7 @@ static void matroxfb_cfb4_clear(WPMINFO u_int32_t bgx, int sy, int sx, int heigh | |||
315 | int whattodo; | 315 | int whattodo; |
316 | CRITFLAGS | 316 | CRITFLAGS |
317 | 317 | ||
318 | DBG(__FUNCTION__) | 318 | DBG(__func__) |
319 | 319 | ||
320 | CRITBEGIN | 320 | CRITBEGIN |
321 | 321 | ||
@@ -388,7 +388,7 @@ static void matroxfb_1bpp_imageblit(WPMINFO u_int32_t fgx, u_int32_t bgx, | |||
388 | int easy; | 388 | int easy; |
389 | CRITFLAGS | 389 | CRITFLAGS |
390 | 390 | ||
391 | DBG_HEAVY(__FUNCTION__); | 391 | DBG_HEAVY(__func__); |
392 | 392 | ||
393 | step = (width + 7) >> 3; | 393 | step = (width + 7) >> 3; |
394 | charcell = height * step; | 394 | charcell = height * step; |
@@ -469,7 +469,7 @@ static void matroxfb_1bpp_imageblit(WPMINFO u_int32_t fgx, u_int32_t bgx, | |||
469 | static void matroxfb_imageblit(struct fb_info* info, const struct fb_image* image) { | 469 | static void matroxfb_imageblit(struct fb_info* info, const struct fb_image* image) { |
470 | MINFO_FROM_INFO(info); | 470 | MINFO_FROM_INFO(info); |
471 | 471 | ||
472 | DBG_HEAVY(__FUNCTION__); | 472 | DBG_HEAVY(__func__); |
473 | 473 | ||
474 | if (image->depth == 1) { | 474 | if (image->depth == 1) { |
475 | u_int32_t fgx, bgx; | 475 | u_int32_t fgx, bgx; |
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c index b25972ac6eeb..54e82f35353d 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/matrox/matroxfb_base.c | |||
@@ -312,7 +312,7 @@ static void matrox_pan_var(WPMINFO struct fb_var_screeninfo *var) { | |||
312 | 312 | ||
313 | CRITFLAGS | 313 | CRITFLAGS |
314 | 314 | ||
315 | DBG(__FUNCTION__) | 315 | DBG(__func__) |
316 | 316 | ||
317 | if (ACCESS_FBINFO(dead)) | 317 | if (ACCESS_FBINFO(dead)) |
318 | return; | 318 | return; |
@@ -392,7 +392,7 @@ static int matroxfb_open(struct fb_info *info, int user) | |||
392 | { | 392 | { |
393 | MINFO_FROM_INFO(info); | 393 | MINFO_FROM_INFO(info); |
394 | 394 | ||
395 | DBG_LOOP(__FUNCTION__) | 395 | DBG_LOOP(__func__) |
396 | 396 | ||
397 | if (ACCESS_FBINFO(dead)) { | 397 | if (ACCESS_FBINFO(dead)) { |
398 | return -ENXIO; | 398 | return -ENXIO; |
@@ -408,7 +408,7 @@ static int matroxfb_release(struct fb_info *info, int user) | |||
408 | { | 408 | { |
409 | MINFO_FROM_INFO(info); | 409 | MINFO_FROM_INFO(info); |
410 | 410 | ||
411 | DBG_LOOP(__FUNCTION__) | 411 | DBG_LOOP(__func__) |
412 | 412 | ||
413 | if (user) { | 413 | if (user) { |
414 | if (0 == --ACCESS_FBINFO(userusecount)) { | 414 | if (0 == --ACCESS_FBINFO(userusecount)) { |
@@ -425,7 +425,7 @@ static int matroxfb_pan_display(struct fb_var_screeninfo *var, | |||
425 | struct fb_info* info) { | 425 | struct fb_info* info) { |
426 | MINFO_FROM_INFO(info); | 426 | MINFO_FROM_INFO(info); |
427 | 427 | ||
428 | DBG(__FUNCTION__) | 428 | DBG(__func__) |
429 | 429 | ||
430 | matrox_pan_var(PMINFO var); | 430 | matrox_pan_var(PMINFO var); |
431 | return 0; | 431 | return 0; |
@@ -434,7 +434,7 @@ static int matroxfb_pan_display(struct fb_var_screeninfo *var, | |||
434 | static int matroxfb_get_final_bppShift(CPMINFO int bpp) { | 434 | static int matroxfb_get_final_bppShift(CPMINFO int bpp) { |
435 | int bppshft2; | 435 | int bppshft2; |
436 | 436 | ||
437 | DBG(__FUNCTION__) | 437 | DBG(__func__) |
438 | 438 | ||
439 | bppshft2 = bpp; | 439 | bppshft2 = bpp; |
440 | if (!bppshft2) { | 440 | if (!bppshft2) { |
@@ -451,7 +451,7 @@ static int matroxfb_test_and_set_rounding(CPMINFO int xres, int bpp) { | |||
451 | int over; | 451 | int over; |
452 | int rounding; | 452 | int rounding; |
453 | 453 | ||
454 | DBG(__FUNCTION__) | 454 | DBG(__func__) |
455 | 455 | ||
456 | switch (bpp) { | 456 | switch (bpp) { |
457 | case 0: return xres; | 457 | case 0: return xres; |
@@ -482,7 +482,7 @@ static int matroxfb_pitch_adjust(CPMINFO int xres, int bpp) { | |||
482 | const int* width; | 482 | const int* width; |
483 | int xres_new; | 483 | int xres_new; |
484 | 484 | ||
485 | DBG(__FUNCTION__) | 485 | DBG(__func__) |
486 | 486 | ||
487 | if (!bpp) return xres; | 487 | if (!bpp) return xres; |
488 | 488 | ||
@@ -504,7 +504,7 @@ static int matroxfb_pitch_adjust(CPMINFO int xres, int bpp) { | |||
504 | 504 | ||
505 | static int matroxfb_get_cmap_len(struct fb_var_screeninfo *var) { | 505 | static int matroxfb_get_cmap_len(struct fb_var_screeninfo *var) { |
506 | 506 | ||
507 | DBG(__FUNCTION__) | 507 | DBG(__func__) |
508 | 508 | ||
509 | switch (var->bits_per_pixel) { | 509 | switch (var->bits_per_pixel) { |
510 | case 4: | 510 | case 4: |
@@ -548,7 +548,7 @@ static int matroxfb_decode_var(CPMINFO struct fb_var_screeninfo *var, int *visua | |||
548 | unsigned int vramlen; | 548 | unsigned int vramlen; |
549 | unsigned int memlen; | 549 | unsigned int memlen; |
550 | 550 | ||
551 | DBG(__FUNCTION__) | 551 | DBG(__func__) |
552 | 552 | ||
553 | switch (bpp) { | 553 | switch (bpp) { |
554 | case 4: if (!ACCESS_FBINFO(capable.cfb4)) return -EINVAL; | 554 | case 4: if (!ACCESS_FBINFO(capable.cfb4)) return -EINVAL; |
@@ -648,7 +648,7 @@ static int matroxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
648 | struct matrox_fb_info* minfo = container_of(fb_info, struct matrox_fb_info, fbcon); | 648 | struct matrox_fb_info* minfo = container_of(fb_info, struct matrox_fb_info, fbcon); |
649 | #endif | 649 | #endif |
650 | 650 | ||
651 | DBG(__FUNCTION__) | 651 | DBG(__func__) |
652 | 652 | ||
653 | /* | 653 | /* |
654 | * Set a single color register. The values supplied are | 654 | * Set a single color register. The values supplied are |
@@ -707,7 +707,7 @@ static int matroxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
707 | static void matroxfb_init_fix(WPMINFO2) | 707 | static void matroxfb_init_fix(WPMINFO2) |
708 | { | 708 | { |
709 | struct fb_fix_screeninfo *fix = &ACCESS_FBINFO(fbcon).fix; | 709 | struct fb_fix_screeninfo *fix = &ACCESS_FBINFO(fbcon).fix; |
710 | DBG(__FUNCTION__) | 710 | DBG(__func__) |
711 | 711 | ||
712 | strcpy(fix->id,"MATROX"); | 712 | strcpy(fix->id,"MATROX"); |
713 | 713 | ||
@@ -722,7 +722,7 @@ static void matroxfb_init_fix(WPMINFO2) | |||
722 | static void matroxfb_update_fix(WPMINFO2) | 722 | static void matroxfb_update_fix(WPMINFO2) |
723 | { | 723 | { |
724 | struct fb_fix_screeninfo *fix = &ACCESS_FBINFO(fbcon).fix; | 724 | struct fb_fix_screeninfo *fix = &ACCESS_FBINFO(fbcon).fix; |
725 | DBG(__FUNCTION__) | 725 | DBG(__func__) |
726 | 726 | ||
727 | fix->smem_start = ACCESS_FBINFO(video.base) + ACCESS_FBINFO(curr.ydstorg.bytes); | 727 | fix->smem_start = ACCESS_FBINFO(video.base) + ACCESS_FBINFO(curr.ydstorg.bytes); |
728 | fix->smem_len = ACCESS_FBINFO(video.len_usable) - ACCESS_FBINFO(curr.ydstorg.bytes); | 728 | fix->smem_len = ACCESS_FBINFO(video.len_usable) - ACCESS_FBINFO(curr.ydstorg.bytes); |
@@ -753,7 +753,7 @@ static int matroxfb_set_par(struct fb_info *info) | |||
753 | struct fb_var_screeninfo *var; | 753 | struct fb_var_screeninfo *var; |
754 | MINFO_FROM_INFO(info); | 754 | MINFO_FROM_INFO(info); |
755 | 755 | ||
756 | DBG(__FUNCTION__) | 756 | DBG(__func__) |
757 | 757 | ||
758 | if (ACCESS_FBINFO(dead)) { | 758 | if (ACCESS_FBINFO(dead)) { |
759 | return -ENXIO; | 759 | return -ENXIO; |
@@ -876,7 +876,7 @@ static int matroxfb_ioctl(struct fb_info *info, | |||
876 | void __user *argp = (void __user *)arg; | 876 | void __user *argp = (void __user *)arg; |
877 | MINFO_FROM_INFO(info); | 877 | MINFO_FROM_INFO(info); |
878 | 878 | ||
879 | DBG(__FUNCTION__) | 879 | DBG(__func__) |
880 | 880 | ||
881 | if (ACCESS_FBINFO(dead)) { | 881 | if (ACCESS_FBINFO(dead)) { |
882 | return -ENXIO; | 882 | return -ENXIO; |
@@ -1175,7 +1175,7 @@ static int matroxfb_blank(int blank, struct fb_info *info) | |||
1175 | CRITFLAGS | 1175 | CRITFLAGS |
1176 | MINFO_FROM_INFO(info); | 1176 | MINFO_FROM_INFO(info); |
1177 | 1177 | ||
1178 | DBG(__FUNCTION__) | 1178 | DBG(__func__) |
1179 | 1179 | ||
1180 | if (ACCESS_FBINFO(dead)) | 1180 | if (ACCESS_FBINFO(dead)) |
1181 | return 1; | 1181 | return 1; |
@@ -1287,7 +1287,7 @@ static int matroxfb_getmemory(WPMINFO unsigned int maxSize, unsigned int *realSi | |||
1287 | unsigned char bytes[32]; | 1287 | unsigned char bytes[32]; |
1288 | unsigned char* tmp; | 1288 | unsigned char* tmp; |
1289 | 1289 | ||
1290 | DBG(__FUNCTION__) | 1290 | DBG(__func__) |
1291 | 1291 | ||
1292 | vm = ACCESS_FBINFO(video.vbase); | 1292 | vm = ACCESS_FBINFO(video.vbase); |
1293 | maxSize &= ~0x1FFFFF; /* must be X*2MB (really it must be 2 or X*4MB) */ | 1293 | maxSize &= ~0x1FFFFF; /* must be X*2MB (really it must be 2 or X*4MB) */ |
@@ -1593,7 +1593,7 @@ static int initMatrox2(WPMINFO struct board* b){ | |||
1593 | { }, | 1593 | { }, |
1594 | }; | 1594 | }; |
1595 | 1595 | ||
1596 | DBG(__FUNCTION__) | 1596 | DBG(__func__) |
1597 | 1597 | ||
1598 | /* set default values... */ | 1598 | /* set default values... */ |
1599 | vesafb_defined.accel_flags = FB_ACCELF_TEXT; | 1599 | vesafb_defined.accel_flags = FB_ACCELF_TEXT; |
@@ -2006,7 +2006,7 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm | |||
2006 | #ifndef CONFIG_FB_MATROX_MULTIHEAD | 2006 | #ifndef CONFIG_FB_MATROX_MULTIHEAD |
2007 | static int registered = 0; | 2007 | static int registered = 0; |
2008 | #endif | 2008 | #endif |
2009 | DBG(__FUNCTION__) | 2009 | DBG(__func__) |
2010 | 2010 | ||
2011 | svid = pdev->subsystem_vendor; | 2011 | svid = pdev->subsystem_vendor; |
2012 | sid = pdev->subsystem_device; | 2012 | sid = pdev->subsystem_device; |
@@ -2301,7 +2301,7 @@ static void __exit matrox_done(void) { | |||
2301 | static int __init matroxfb_setup(char *options) { | 2301 | static int __init matroxfb_setup(char *options) { |
2302 | char *this_opt; | 2302 | char *this_opt; |
2303 | 2303 | ||
2304 | DBG(__FUNCTION__) | 2304 | DBG(__func__) |
2305 | 2305 | ||
2306 | if (!options || !*options) | 2306 | if (!options || !*options) |
2307 | return 0; | 2307 | return 0; |
@@ -2444,7 +2444,7 @@ static int __init matroxfb_init(void) | |||
2444 | char *option = NULL; | 2444 | char *option = NULL; |
2445 | int err = 0; | 2445 | int err = 0; |
2446 | 2446 | ||
2447 | DBG(__FUNCTION__) | 2447 | DBG(__func__) |
2448 | 2448 | ||
2449 | if (fb_get_options("matroxfb", &option)) | 2449 | if (fb_get_options("matroxfb", &option)) |
2450 | return -ENODEV; | 2450 | return -ENODEV; |
@@ -2556,7 +2556,7 @@ MODULE_PARM_DESC(cmode, "Specify the video depth that should be used (8bit defau | |||
2556 | 2556 | ||
2557 | int __init init_module(void){ | 2557 | int __init init_module(void){ |
2558 | 2558 | ||
2559 | DBG(__FUNCTION__) | 2559 | DBG(__func__) |
2560 | 2560 | ||
2561 | if (disabled) | 2561 | if (disabled) |
2562 | return -ENXIO; | 2562 | return -ENXIO; |
diff --git a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c index a6ab5b6a58d0..7ac4c5f6145d 100644 --- a/drivers/video/matrox/matroxfb_crtc2.c +++ b/drivers/video/matrox/matroxfb_crtc2.c | |||
@@ -420,7 +420,7 @@ static int matroxfb_dh_ioctl(struct fb_info *info, | |||
420 | #define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon)) | 420 | #define m2info (container_of(info, struct matroxfb_dh_fb_info, fbcon)) |
421 | MINFO_FROM(m2info->primary_dev); | 421 | MINFO_FROM(m2info->primary_dev); |
422 | 422 | ||
423 | DBG(__FUNCTION__) | 423 | DBG(__func__) |
424 | 424 | ||
425 | switch (cmd) { | 425 | switch (cmd) { |
426 | case FBIOGET_VBLANK: | 426 | case FBIOGET_VBLANK: |
diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c index 0cd58f84fb46..89da27bd5c49 100644 --- a/drivers/video/matrox/matroxfb_maven.c +++ b/drivers/video/matrox/matroxfb_maven.c | |||
@@ -220,7 +220,7 @@ static int matroxfb_PLL_mavenclock(const struct matrox_pll_features2* pll, | |||
220 | unsigned int scrlen; | 220 | unsigned int scrlen; |
221 | unsigned int fmax; | 221 | unsigned int fmax; |
222 | 222 | ||
223 | DBG(__FUNCTION__) | 223 | DBG(__func__) |
224 | 224 | ||
225 | scrlen = htotal * (vtotal - 1); | 225 | scrlen = htotal * (vtotal - 1); |
226 | fwant = htotal * vtotal; | 226 | fwant = htotal * vtotal; |
diff --git a/drivers/video/matrox/matroxfb_misc.c b/drivers/video/matrox/matroxfb_misc.c index ab7fb50bc1de..aaa3e538e5da 100644 --- a/drivers/video/matrox/matroxfb_misc.c +++ b/drivers/video/matrox/matroxfb_misc.c | |||
@@ -90,13 +90,13 @@ | |||
90 | #include <linux/matroxfb.h> | 90 | #include <linux/matroxfb.h> |
91 | 91 | ||
92 | void matroxfb_DAC_out(CPMINFO int reg, int val) { | 92 | void matroxfb_DAC_out(CPMINFO int reg, int val) { |
93 | DBG_REG(__FUNCTION__) | 93 | DBG_REG(__func__) |
94 | mga_outb(M_RAMDAC_BASE+M_X_INDEX, reg); | 94 | mga_outb(M_RAMDAC_BASE+M_X_INDEX, reg); |
95 | mga_outb(M_RAMDAC_BASE+M_X_DATAREG, val); | 95 | mga_outb(M_RAMDAC_BASE+M_X_DATAREG, val); |
96 | } | 96 | } |
97 | 97 | ||
98 | int matroxfb_DAC_in(CPMINFO int reg) { | 98 | int matroxfb_DAC_in(CPMINFO int reg) { |
99 | DBG_REG(__FUNCTION__) | 99 | DBG_REG(__func__) |
100 | mga_outb(M_RAMDAC_BASE+M_X_INDEX, reg); | 100 | mga_outb(M_RAMDAC_BASE+M_X_INDEX, reg); |
101 | return mga_inb(M_RAMDAC_BASE+M_X_DATAREG); | 101 | return mga_inb(M_RAMDAC_BASE+M_X_DATAREG); |
102 | } | 102 | } |
@@ -104,7 +104,7 @@ int matroxfb_DAC_in(CPMINFO int reg) { | |||
104 | void matroxfb_var2my(struct fb_var_screeninfo* var, struct my_timming* mt) { | 104 | void matroxfb_var2my(struct fb_var_screeninfo* var, struct my_timming* mt) { |
105 | unsigned int pixclock = var->pixclock; | 105 | unsigned int pixclock = var->pixclock; |
106 | 106 | ||
107 | DBG(__FUNCTION__) | 107 | DBG(__func__) |
108 | 108 | ||
109 | if (!pixclock) pixclock = 10000; /* 10ns = 100MHz */ | 109 | if (!pixclock) pixclock = 10000; /* 10ns = 100MHz */ |
110 | mt->pixclock = 1000000000 / pixclock; | 110 | mt->pixclock = 1000000000 / pixclock; |
@@ -131,7 +131,7 @@ int matroxfb_PLL_calcclock(const struct matrox_pll_features* pll, unsigned int f | |||
131 | unsigned int fwant; | 131 | unsigned int fwant; |
132 | unsigned int p; | 132 | unsigned int p; |
133 | 133 | ||
134 | DBG(__FUNCTION__) | 134 | DBG(__func__) |
135 | 135 | ||
136 | fwant = freq; | 136 | fwant = freq; |
137 | 137 | ||
@@ -192,7 +192,7 @@ int matroxfb_vgaHWinit(WPMINFO struct my_timming* m) { | |||
192 | int i; | 192 | int i; |
193 | struct matrox_hw_state * const hw = &ACCESS_FBINFO(hw); | 193 | struct matrox_hw_state * const hw = &ACCESS_FBINFO(hw); |
194 | 194 | ||
195 | DBG(__FUNCTION__) | 195 | DBG(__func__) |
196 | 196 | ||
197 | hw->SEQ[0] = 0x00; | 197 | hw->SEQ[0] = 0x00; |
198 | hw->SEQ[1] = 0x01; /* or 0x09 */ | 198 | hw->SEQ[1] = 0x01; /* or 0x09 */ |
@@ -336,7 +336,7 @@ void matroxfb_vgaHWrestore(WPMINFO2) { | |||
336 | struct matrox_hw_state * const hw = &ACCESS_FBINFO(hw); | 336 | struct matrox_hw_state * const hw = &ACCESS_FBINFO(hw); |
337 | CRITFLAGS | 337 | CRITFLAGS |
338 | 338 | ||
339 | DBG(__FUNCTION__) | 339 | DBG(__func__) |
340 | 340 | ||
341 | dprintk(KERN_INFO "MiscOutReg: %02X\n", hw->MiscOutReg); | 341 | dprintk(KERN_INFO "MiscOutReg: %02X\n", hw->MiscOutReg); |
342 | dprintk(KERN_INFO "SEQ regs: "); | 342 | dprintk(KERN_INFO "SEQ regs: "); |
diff --git a/drivers/video/metronomefb.c b/drivers/video/metronomefb.c index e9a89fd82757..249791286367 100644 --- a/drivers/video/metronomefb.c +++ b/drivers/video/metronomefb.c | |||
@@ -13,12 +13,10 @@ | |||
13 | * Corporation. http://support.eink.com/community | 13 | * Corporation. http://support.eink.com/community |
14 | * | 14 | * |
15 | * This driver is written to be used with the Metronome display controller. | 15 | * This driver is written to be used with the Metronome display controller. |
16 | * It was tested with an E-Ink 800x600 Vizplex EPD on a Gumstix Connex board | 16 | * It is intended to be architecture independent. A board specific driver |
17 | * using the Lyre interface board. | 17 | * must be used to perform all the physical IO interactions. An example |
18 | * is provided as am200epd.c | ||
18 | * | 19 | * |
19 | * General notes: | ||
20 | * - User must set metronomefb_enable=1 to enable it. | ||
21 | * - See Documentation/fb/metronomefb.txt for how metronome works. | ||
22 | */ | 20 | */ |
23 | #include <linux/module.h> | 21 | #include <linux/module.h> |
24 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
@@ -38,9 +36,11 @@ | |||
38 | #include <linux/uaccess.h> | 36 | #include <linux/uaccess.h> |
39 | #include <linux/irq.h> | 37 | #include <linux/irq.h> |
40 | 38 | ||
41 | #include <asm/arch/pxa-regs.h> | 39 | #include <video/metronomefb.h> |
40 | |||
42 | #include <asm/unaligned.h> | 41 | #include <asm/unaligned.h> |
43 | 42 | ||
43 | |||
44 | #define DEBUG 1 | 44 | #define DEBUG 1 |
45 | #ifdef DEBUG | 45 | #ifdef DEBUG |
46 | #define DPRINTK(f, a...) printk(KERN_DEBUG "%s: " f, __func__ , ## a) | 46 | #define DPRINTK(f, a...) printk(KERN_DEBUG "%s: " f, __func__ , ## a) |
@@ -53,35 +53,6 @@ | |||
53 | #define DPY_W 832 | 53 | #define DPY_W 832 |
54 | #define DPY_H 622 | 54 | #define DPY_H 622 |
55 | 55 | ||
56 | struct metromem_desc { | ||
57 | u32 mFDADR0; | ||
58 | u32 mFSADR0; | ||
59 | u32 mFIDR0; | ||
60 | u32 mLDCMD0; | ||
61 | }; | ||
62 | |||
63 | struct metromem_cmd { | ||
64 | u16 opcode; | ||
65 | u16 args[((64-2)/2)]; | ||
66 | u16 csum; | ||
67 | }; | ||
68 | |||
69 | struct metronomefb_par { | ||
70 | unsigned char *metromem; | ||
71 | struct metromem_desc *metromem_desc; | ||
72 | struct metromem_cmd *metromem_cmd; | ||
73 | unsigned char *metromem_wfm; | ||
74 | unsigned char *metromem_img; | ||
75 | u16 *metromem_img_csum; | ||
76 | u16 *csum_table; | ||
77 | int metromemsize; | ||
78 | dma_addr_t metromem_dma; | ||
79 | dma_addr_t metromem_desc_dma; | ||
80 | struct fb_info *info; | ||
81 | wait_queue_head_t waitq; | ||
82 | u8 frame_count; | ||
83 | }; | ||
84 | |||
85 | /* frame differs from image. frame includes non-visible pixels */ | 56 | /* frame differs from image. frame includes non-visible pixels */ |
86 | struct epd_frame { | 57 | struct epd_frame { |
87 | int fw; /* frame width */ | 58 | int fw; /* frame width */ |
@@ -120,8 +91,7 @@ static struct fb_var_screeninfo metronomefb_var __devinitdata = { | |||
120 | .transp = { 0, 0, 0 }, | 91 | .transp = { 0, 0, 0 }, |
121 | }; | 92 | }; |
122 | 93 | ||
123 | static unsigned int metronomefb_enable; | 94 | /* the waveform structure that is coming from userspace firmware */ |
124 | |||
125 | struct waveform_hdr { | 95 | struct waveform_hdr { |
126 | u8 stuff[32]; | 96 | u8 stuff[32]; |
127 | 97 | ||
@@ -301,165 +271,6 @@ static int load_waveform(u8 *mem, size_t size, u8 *metromem, int m, int t, | |||
301 | return 0; | 271 | return 0; |
302 | } | 272 | } |
303 | 273 | ||
304 | /* register offsets for gpio control */ | ||
305 | #define LED_GPIO_PIN 51 | ||
306 | #define STDBY_GPIO_PIN 48 | ||
307 | #define RST_GPIO_PIN 49 | ||
308 | #define RDY_GPIO_PIN 32 | ||
309 | #define ERR_GPIO_PIN 17 | ||
310 | #define PCBPWR_GPIO_PIN 16 | ||
311 | |||
312 | #define AF_SEL_GPIO_N 0x3 | ||
313 | #define GAFR0_U_OFFSET(pin) ((pin - 16) * 2) | ||
314 | #define GAFR1_L_OFFSET(pin) ((pin - 32) * 2) | ||
315 | #define GAFR1_U_OFFSET(pin) ((pin - 48) * 2) | ||
316 | #define GPDR1_OFFSET(pin) (pin - 32) | ||
317 | #define GPCR1_OFFSET(pin) (pin - 32) | ||
318 | #define GPSR1_OFFSET(pin) (pin - 32) | ||
319 | #define GPCR0_OFFSET(pin) (pin) | ||
320 | #define GPSR0_OFFSET(pin) (pin) | ||
321 | |||
322 | static void metronome_set_gpio_output(int pin, int val) | ||
323 | { | ||
324 | u8 index; | ||
325 | |||
326 | index = pin >> 4; | ||
327 | |||
328 | switch (index) { | ||
329 | case 1: | ||
330 | if (val) | ||
331 | GPSR0 |= (1 << GPSR0_OFFSET(pin)); | ||
332 | else | ||
333 | GPCR0 |= (1 << GPCR0_OFFSET(pin)); | ||
334 | break; | ||
335 | case 2: | ||
336 | break; | ||
337 | case 3: | ||
338 | if (val) | ||
339 | GPSR1 |= (1 << GPSR1_OFFSET(pin)); | ||
340 | else | ||
341 | GPCR1 |= (1 << GPCR1_OFFSET(pin)); | ||
342 | break; | ||
343 | default: | ||
344 | printk(KERN_ERR "unimplemented\n"); | ||
345 | } | ||
346 | } | ||
347 | |||
348 | static void __devinit metronome_init_gpio_pin(int pin, int dir) | ||
349 | { | ||
350 | u8 index; | ||
351 | /* dir 0 is output, 1 is input | ||
352 | - do 2 things here: | ||
353 | - set gpio alternate function to standard gpio | ||
354 | - set gpio direction to input or output */ | ||
355 | |||
356 | index = pin >> 4; | ||
357 | switch (index) { | ||
358 | case 1: | ||
359 | GAFR0_U &= ~(AF_SEL_GPIO_N << GAFR0_U_OFFSET(pin)); | ||
360 | |||
361 | if (dir) | ||
362 | GPDR0 &= ~(1 << pin); | ||
363 | else | ||
364 | GPDR0 |= (1 << pin); | ||
365 | break; | ||
366 | case 2: | ||
367 | GAFR1_L &= ~(AF_SEL_GPIO_N << GAFR1_L_OFFSET(pin)); | ||
368 | |||
369 | if (dir) | ||
370 | GPDR1 &= ~(1 << GPDR1_OFFSET(pin)); | ||
371 | else | ||
372 | GPDR1 |= (1 << GPDR1_OFFSET(pin)); | ||
373 | break; | ||
374 | case 3: | ||
375 | GAFR1_U &= ~(AF_SEL_GPIO_N << GAFR1_U_OFFSET(pin)); | ||
376 | |||
377 | if (dir) | ||
378 | GPDR1 &= ~(1 << GPDR1_OFFSET(pin)); | ||
379 | else | ||
380 | GPDR1 |= (1 << GPDR1_OFFSET(pin)); | ||
381 | break; | ||
382 | default: | ||
383 | printk(KERN_ERR "unimplemented\n"); | ||
384 | } | ||
385 | } | ||
386 | |||
387 | static void __devinit metronome_init_gpio_regs(void) | ||
388 | { | ||
389 | metronome_init_gpio_pin(LED_GPIO_PIN, 0); | ||
390 | metronome_set_gpio_output(LED_GPIO_PIN, 0); | ||
391 | |||
392 | metronome_init_gpio_pin(STDBY_GPIO_PIN, 0); | ||
393 | metronome_set_gpio_output(STDBY_GPIO_PIN, 0); | ||
394 | |||
395 | metronome_init_gpio_pin(RST_GPIO_PIN, 0); | ||
396 | metronome_set_gpio_output(RST_GPIO_PIN, 0); | ||
397 | |||
398 | metronome_init_gpio_pin(RDY_GPIO_PIN, 1); | ||
399 | |||
400 | metronome_init_gpio_pin(ERR_GPIO_PIN, 1); | ||
401 | |||
402 | metronome_init_gpio_pin(PCBPWR_GPIO_PIN, 0); | ||
403 | metronome_set_gpio_output(PCBPWR_GPIO_PIN, 0); | ||
404 | } | ||
405 | |||
406 | static void metronome_disable_lcd_controller(struct metronomefb_par *par) | ||
407 | { | ||
408 | LCSR = 0xffffffff; /* Clear LCD Status Register */ | ||
409 | LCCR0 |= LCCR0_DIS; /* Disable LCD Controller */ | ||
410 | |||
411 | /* we reset and just wait for things to settle */ | ||
412 | msleep(200); | ||
413 | } | ||
414 | |||
415 | static void metronome_enable_lcd_controller(struct metronomefb_par *par) | ||
416 | { | ||
417 | LCSR = 0xffffffff; | ||
418 | FDADR0 = par->metromem_desc_dma; | ||
419 | LCCR0 |= LCCR0_ENB; | ||
420 | } | ||
421 | |||
422 | static void __devinit metronome_init_lcdc_regs(struct metronomefb_par *par) | ||
423 | { | ||
424 | /* here we do: | ||
425 | - disable the lcd controller | ||
426 | - setup lcd control registers | ||
427 | - setup dma descriptor | ||
428 | - reenable lcd controller | ||
429 | */ | ||
430 | |||
431 | /* disable the lcd controller */ | ||
432 | metronome_disable_lcd_controller(par); | ||
433 | |||
434 | /* setup lcd control registers */ | ||
435 | LCCR0 = LCCR0_LDM | LCCR0_SFM | LCCR0_IUM | LCCR0_EFM | LCCR0_PAS | ||
436 | | LCCR0_QDM | LCCR0_BM | LCCR0_OUM; | ||
437 | |||
438 | LCCR1 = (epd_frame_table[0].fw/2 - 1) /* pixels per line */ | ||
439 | | (27 << 10) /* hsync pulse width - 1 */ | ||
440 | | (33 << 16) /* eol pixel count */ | ||
441 | | (33 << 24); /* bol pixel count */ | ||
442 | |||
443 | LCCR2 = (epd_frame_table[0].fh - 1) /* lines per panel */ | ||
444 | | (24 << 10) /* vsync pulse width - 1 */ | ||
445 | | (2 << 16) /* eof pixel count */ | ||
446 | | (0 << 24); /* bof pixel count */ | ||
447 | |||
448 | LCCR3 = 2 /* pixel clock divisor */ | ||
449 | | (24 << 8) /* AC Bias pin freq */ | ||
450 | | LCCR3_16BPP /* BPP */ | ||
451 | | LCCR3_PCP; /* PCP falling edge */ | ||
452 | |||
453 | /* setup dma descriptor */ | ||
454 | par->metromem_desc->mFDADR0 = par->metromem_desc_dma; | ||
455 | par->metromem_desc->mFSADR0 = par->metromem_dma; | ||
456 | par->metromem_desc->mFIDR0 = 0; | ||
457 | par->metromem_desc->mLDCMD0 = epd_frame_table[0].fw | ||
458 | * epd_frame_table[0].fh; | ||
459 | /* reenable lcd controller */ | ||
460 | metronome_enable_lcd_controller(par); | ||
461 | } | ||
462 | |||
463 | static int metronome_display_cmd(struct metronomefb_par *par) | 274 | static int metronome_display_cmd(struct metronomefb_par *par) |
464 | { | 275 | { |
465 | int i; | 276 | int i; |
@@ -493,8 +304,7 @@ static int metronome_display_cmd(struct metronomefb_par *par) | |||
493 | par->metromem_cmd->csum = cs; | 304 | par->metromem_cmd->csum = cs; |
494 | par->metromem_cmd->opcode = opcode; /* display cmd */ | 305 | par->metromem_cmd->opcode = opcode; /* display cmd */ |
495 | 306 | ||
496 | i = wait_event_interruptible_timeout(par->waitq, (GPLR1 & 0x01), HZ); | 307 | return par->board->met_wait_event_intr(par); |
497 | return i; | ||
498 | } | 308 | } |
499 | 309 | ||
500 | static int __devinit metronome_powerup_cmd(struct metronomefb_par *par) | 310 | static int __devinit metronome_powerup_cmd(struct metronomefb_par *par) |
@@ -518,13 +328,12 @@ static int __devinit metronome_powerup_cmd(struct metronomefb_par *par) | |||
518 | par->metromem_cmd->csum = cs; | 328 | par->metromem_cmd->csum = cs; |
519 | 329 | ||
520 | msleep(1); | 330 | msleep(1); |
521 | metronome_set_gpio_output(RST_GPIO_PIN, 1); | 331 | par->board->set_rst(par, 1); |
522 | 332 | ||
523 | msleep(1); | 333 | msleep(1); |
524 | metronome_set_gpio_output(STDBY_GPIO_PIN, 1); | 334 | par->board->set_stdby(par, 1); |
525 | 335 | ||
526 | i = wait_event_timeout(par->waitq, (GPLR1 & 0x01), HZ); | 336 | return par->board->met_wait_event(par); |
527 | return i; | ||
528 | } | 337 | } |
529 | 338 | ||
530 | static int __devinit metronome_config_cmd(struct metronomefb_par *par) | 339 | static int __devinit metronome_config_cmd(struct metronomefb_par *par) |
@@ -569,8 +378,7 @@ static int __devinit metronome_config_cmd(struct metronomefb_par *par) | |||
569 | par->metromem_cmd->csum = cs; | 378 | par->metromem_cmd->csum = cs; |
570 | par->metromem_cmd->opcode = 0xCC10; /* config cmd */ | 379 | par->metromem_cmd->opcode = 0xCC10; /* config cmd */ |
571 | 380 | ||
572 | i = wait_event_timeout(par->waitq, (GPLR1 & 0x01), HZ); | 381 | return par->board->met_wait_event(par); |
573 | return i; | ||
574 | } | 382 | } |
575 | 383 | ||
576 | static int __devinit metronome_init_cmd(struct metronomefb_par *par) | 384 | static int __devinit metronome_init_cmd(struct metronomefb_par *par) |
@@ -596,16 +404,19 @@ static int __devinit metronome_init_cmd(struct metronomefb_par *par) | |||
596 | par->metromem_cmd->csum = cs; | 404 | par->metromem_cmd->csum = cs; |
597 | par->metromem_cmd->opcode = 0xCC20; /* init cmd */ | 405 | par->metromem_cmd->opcode = 0xCC20; /* init cmd */ |
598 | 406 | ||
599 | i = wait_event_timeout(par->waitq, (GPLR1 & 0x01), HZ); | 407 | return par->board->met_wait_event(par); |
600 | return i; | ||
601 | } | 408 | } |
602 | 409 | ||
603 | static int __devinit metronome_init_regs(struct metronomefb_par *par) | 410 | static int __devinit metronome_init_regs(struct metronomefb_par *par) |
604 | { | 411 | { |
605 | int res; | 412 | int res; |
606 | 413 | ||
607 | metronome_init_gpio_regs(); | 414 | par->board->init_gpio_regs(par); |
608 | metronome_init_lcdc_regs(par); | 415 | |
416 | par->board->init_lcdc_regs(par); | ||
417 | |||
418 | /* now that lcd is setup, setup dma descriptor */ | ||
419 | par->board->post_dma_setup(par); | ||
609 | 420 | ||
610 | res = metronome_powerup_cmd(par); | 421 | res = metronome_powerup_cmd(par); |
611 | if (res) | 422 | if (res) |
@@ -616,8 +427,6 @@ static int __devinit metronome_init_regs(struct metronomefb_par *par) | |||
616 | return res; | 427 | return res; |
617 | 428 | ||
618 | res = metronome_init_cmd(par); | 429 | res = metronome_init_cmd(par); |
619 | if (res) | ||
620 | return res; | ||
621 | 430 | ||
622 | return res; | 431 | return res; |
623 | } | 432 | } |
@@ -632,7 +441,7 @@ static void metronomefb_dpy_update(struct metronomefb_par *par) | |||
632 | 441 | ||
633 | cksum = calc_img_cksum((u16 *) par->metromem_img, | 442 | cksum = calc_img_cksum((u16 *) par->metromem_img, |
634 | (epd_frame_table[0].fw * DPY_H)/2); | 443 | (epd_frame_table[0].fw * DPY_H)/2); |
635 | *((u16 *) (par->metromem_img) + | 444 | *((u16 *)(par->metromem_img) + |
636 | (epd_frame_table[0].fw * DPY_H)/2) = cksum; | 445 | (epd_frame_table[0].fw * DPY_H)/2) = cksum; |
637 | metronome_display_cmd(par); | 446 | metronome_display_cmd(par); |
638 | } | 447 | } |
@@ -641,8 +450,8 @@ static u16 metronomefb_dpy_update_page(struct metronomefb_par *par, int index) | |||
641 | { | 450 | { |
642 | int i; | 451 | int i; |
643 | u16 csum = 0; | 452 | u16 csum = 0; |
644 | u16 *buf = (u16 __force *) (par->info->screen_base + index); | 453 | u16 *buf = (u16 __force *)(par->info->screen_base + index); |
645 | u16 *img = (u16 *) (par->metromem_img + index); | 454 | u16 *img = (u16 *)(par->metromem_img + index); |
646 | 455 | ||
647 | /* swizzle from vm to metromem and recalc cksum at the same time*/ | 456 | /* swizzle from vm to metromem and recalc cksum at the same time*/ |
648 | for (i = 0; i < PAGE_SIZE/2; i++) { | 457 | for (i = 0; i < PAGE_SIZE/2; i++) { |
@@ -678,7 +487,7 @@ static void metronomefb_fillrect(struct fb_info *info, | |||
678 | { | 487 | { |
679 | struct metronomefb_par *par = info->par; | 488 | struct metronomefb_par *par = info->par; |
680 | 489 | ||
681 | cfb_fillrect(info, rect); | 490 | sys_fillrect(info, rect); |
682 | metronomefb_dpy_update(par); | 491 | metronomefb_dpy_update(par); |
683 | } | 492 | } |
684 | 493 | ||
@@ -687,7 +496,7 @@ static void metronomefb_copyarea(struct fb_info *info, | |||
687 | { | 496 | { |
688 | struct metronomefb_par *par = info->par; | 497 | struct metronomefb_par *par = info->par; |
689 | 498 | ||
690 | cfb_copyarea(info, area); | 499 | sys_copyarea(info, area); |
691 | metronomefb_dpy_update(par); | 500 | metronomefb_dpy_update(par); |
692 | } | 501 | } |
693 | 502 | ||
@@ -696,7 +505,7 @@ static void metronomefb_imageblit(struct fb_info *info, | |||
696 | { | 505 | { |
697 | struct metronomefb_par *par = info->par; | 506 | struct metronomefb_par *par = info->par; |
698 | 507 | ||
699 | cfb_imageblit(info, image); | 508 | sys_imageblit(info, image); |
700 | metronomefb_dpy_update(par); | 509 | metronomefb_dpy_update(par); |
701 | } | 510 | } |
702 | 511 | ||
@@ -733,7 +542,7 @@ static ssize_t metronomefb_write(struct fb_info *info, const char __user *buf, | |||
733 | count = total_size - p; | 542 | count = total_size - p; |
734 | } | 543 | } |
735 | 544 | ||
736 | dst = (void __force *) (info->screen_base + p); | 545 | dst = (void __force *)(info->screen_base + p); |
737 | 546 | ||
738 | if (copy_from_user(dst, buf, count)) | 547 | if (copy_from_user(dst, buf, count)) |
739 | err = -EFAULT; | 548 | err = -EFAULT; |
@@ -759,18 +568,10 @@ static struct fb_deferred_io metronomefb_defio = { | |||
759 | .deferred_io = metronomefb_dpy_deferred_io, | 568 | .deferred_io = metronomefb_dpy_deferred_io, |
760 | }; | 569 | }; |
761 | 570 | ||
762 | static irqreturn_t metronome_handle_irq(int irq, void *dev_id) | ||
763 | { | ||
764 | struct fb_info *info = dev_id; | ||
765 | struct metronomefb_par *par = info->par; | ||
766 | |||
767 | wake_up_interruptible(&par->waitq); | ||
768 | return IRQ_HANDLED; | ||
769 | } | ||
770 | |||
771 | static int __devinit metronomefb_probe(struct platform_device *dev) | 571 | static int __devinit metronomefb_probe(struct platform_device *dev) |
772 | { | 572 | { |
773 | struct fb_info *info; | 573 | struct fb_info *info; |
574 | struct metronome_board *board; | ||
774 | int retval = -ENOMEM; | 575 | int retval = -ENOMEM; |
775 | int videomemorysize; | 576 | int videomemorysize; |
776 | unsigned char *videomemory; | 577 | unsigned char *videomemory; |
@@ -779,17 +580,26 @@ static int __devinit metronomefb_probe(struct platform_device *dev) | |||
779 | int cmd_size, wfm_size, img_size, padding_size, totalsize; | 580 | int cmd_size, wfm_size, img_size, padding_size, totalsize; |
780 | int i; | 581 | int i; |
781 | 582 | ||
583 | /* pick up board specific routines */ | ||
584 | board = dev->dev.platform_data; | ||
585 | if (!board) | ||
586 | return -EINVAL; | ||
587 | |||
588 | /* try to count device specific driver, if can't, platform recalls */ | ||
589 | if (!try_module_get(board->owner)) | ||
590 | return -ENODEV; | ||
591 | |||
782 | /* we have two blocks of memory. | 592 | /* we have two blocks of memory. |
783 | info->screen_base which is vm, and is the fb used by apps. | 593 | info->screen_base which is vm, and is the fb used by apps. |
784 | par->metromem which is physically contiguous memory and | 594 | par->metromem which is physically contiguous memory and |
785 | contains the display controller commands, waveform, | 595 | contains the display controller commands, waveform, |
786 | processed image data and padding. this is the data pulled | 596 | processed image data and padding. this is the data pulled |
787 | by the pxa255's LCD controller and pushed to Metronome */ | 597 | by the device's LCD controller and pushed to Metronome */ |
788 | 598 | ||
789 | videomemorysize = (DPY_W*DPY_H); | 599 | videomemorysize = (DPY_W*DPY_H); |
790 | videomemory = vmalloc(videomemorysize); | 600 | videomemory = vmalloc(videomemorysize); |
791 | if (!videomemory) | 601 | if (!videomemory) |
792 | return retval; | 602 | return -ENOMEM; |
793 | 603 | ||
794 | memset(videomemory, 0, videomemorysize); | 604 | memset(videomemory, 0, videomemorysize); |
795 | 605 | ||
@@ -797,7 +607,7 @@ static int __devinit metronomefb_probe(struct platform_device *dev) | |||
797 | if (!info) | 607 | if (!info) |
798 | goto err_vfree; | 608 | goto err_vfree; |
799 | 609 | ||
800 | info->screen_base = (char __iomem *) videomemory; | 610 | info->screen_base = (char __force __iomem *)videomemory; |
801 | info->fbops = &metronomefb_ops; | 611 | info->fbops = &metronomefb_ops; |
802 | 612 | ||
803 | info->var = metronomefb_var; | 613 | info->var = metronomefb_var; |
@@ -805,6 +615,7 @@ static int __devinit metronomefb_probe(struct platform_device *dev) | |||
805 | info->fix.smem_len = videomemorysize; | 615 | info->fix.smem_len = videomemorysize; |
806 | par = info->par; | 616 | par = info->par; |
807 | par->info = info; | 617 | par->info = info; |
618 | par->board = board; | ||
808 | init_waitqueue_head(&par->waitq); | 619 | init_waitqueue_head(&par->waitq); |
809 | 620 | ||
810 | /* this table caches per page csum values. */ | 621 | /* this table caches per page csum values. */ |
@@ -849,11 +660,10 @@ static int __devinit metronomefb_probe(struct platform_device *dev) | |||
849 | par->metromem_desc_dma = par->metromem_dma + cmd_size + wfm_size | 660 | par->metromem_desc_dma = par->metromem_dma + cmd_size + wfm_size |
850 | + img_size + padding_size; | 661 | + img_size + padding_size; |
851 | 662 | ||
852 | /* load the waveform in. assume mode 3, temp 31 for now */ | 663 | /* load the waveform in. assume mode 3, temp 31 for now |
853 | /* a) request the waveform file from userspace | 664 | a) request the waveform file from userspace |
854 | b) process waveform and decode into metromem */ | 665 | b) process waveform and decode into metromem */ |
855 | 666 | retval = request_firmware(&fw_entry, "metronome.wbf", &dev->dev); | |
856 | retval = request_firmware(&fw_entry, "waveform.wbf", &dev->dev); | ||
857 | if (retval < 0) { | 667 | if (retval < 0) { |
858 | printk(KERN_ERR "metronomefb: couldn't get waveform\n"); | 668 | printk(KERN_ERR "metronomefb: couldn't get waveform\n"); |
859 | goto err_dma_free; | 669 | goto err_dma_free; |
@@ -861,19 +671,14 @@ static int __devinit metronomefb_probe(struct platform_device *dev) | |||
861 | 671 | ||
862 | retval = load_waveform((u8 *) fw_entry->data, fw_entry->size, | 672 | retval = load_waveform((u8 *) fw_entry->data, fw_entry->size, |
863 | par->metromem_wfm, 3, 31, &par->frame_count); | 673 | par->metromem_wfm, 3, 31, &par->frame_count); |
674 | release_firmware(fw_entry); | ||
864 | if (retval < 0) { | 675 | if (retval < 0) { |
865 | printk(KERN_ERR "metronomefb: couldn't process waveform\n"); | 676 | printk(KERN_ERR "metronomefb: couldn't process waveform\n"); |
866 | goto err_ld_wfm; | 677 | goto err_dma_free; |
867 | } | 678 | } |
868 | release_firmware(fw_entry); | ||
869 | 679 | ||
870 | retval = request_irq(IRQ_GPIO(RDY_GPIO_PIN), metronome_handle_irq, | 680 | if (board->setup_irq(info)) |
871 | IRQF_DISABLED, "Metronome", info); | 681 | goto err_dma_free; |
872 | if (retval) { | ||
873 | dev_err(&dev->dev, "request_irq failed: %d\n", retval); | ||
874 | goto err_ld_wfm; | ||
875 | } | ||
876 | set_irq_type(IRQ_GPIO(RDY_GPIO_PIN), IRQT_FALLING); | ||
877 | 682 | ||
878 | retval = metronome_init_regs(par); | 683 | retval = metronome_init_regs(par); |
879 | if (retval < 0) | 684 | if (retval < 0) |
@@ -913,9 +718,7 @@ err_cmap: | |||
913 | err_fb_rel: | 718 | err_fb_rel: |
914 | framebuffer_release(info); | 719 | framebuffer_release(info); |
915 | err_free_irq: | 720 | err_free_irq: |
916 | free_irq(IRQ_GPIO(RDY_GPIO_PIN), info); | 721 | board->free_irq(info); |
917 | err_ld_wfm: | ||
918 | release_firmware(fw_entry); | ||
919 | err_dma_free: | 722 | err_dma_free: |
920 | dma_free_writecombine(&dev->dev, par->metromemsize, par->metromem, | 723 | dma_free_writecombine(&dev->dev, par->metromemsize, par->metromem, |
921 | par->metromem_dma); | 724 | par->metromem_dma); |
@@ -923,6 +726,7 @@ err_csum_table: | |||
923 | vfree(par->csum_table); | 726 | vfree(par->csum_table); |
924 | err_vfree: | 727 | err_vfree: |
925 | vfree(videomemory); | 728 | vfree(videomemory); |
729 | module_put(board->owner); | ||
926 | return retval; | 730 | return retval; |
927 | } | 731 | } |
928 | 732 | ||
@@ -939,7 +743,8 @@ static int __devexit metronomefb_remove(struct platform_device *dev) | |||
939 | vfree(par->csum_table); | 743 | vfree(par->csum_table); |
940 | unregister_framebuffer(info); | 744 | unregister_framebuffer(info); |
941 | vfree((void __force *)info->screen_base); | 745 | vfree((void __force *)info->screen_base); |
942 | free_irq(IRQ_GPIO(RDY_GPIO_PIN), info); | 746 | par->board->free_irq(info); |
747 | module_put(par->board->owner); | ||
943 | framebuffer_release(info); | 748 | framebuffer_release(info); |
944 | } | 749 | } |
945 | return 0; | 750 | return 0; |
@@ -949,48 +754,21 @@ static struct platform_driver metronomefb_driver = { | |||
949 | .probe = metronomefb_probe, | 754 | .probe = metronomefb_probe, |
950 | .remove = metronomefb_remove, | 755 | .remove = metronomefb_remove, |
951 | .driver = { | 756 | .driver = { |
757 | .owner = THIS_MODULE, | ||
952 | .name = "metronomefb", | 758 | .name = "metronomefb", |
953 | }, | 759 | }, |
954 | }; | 760 | }; |
955 | 761 | ||
956 | static struct platform_device *metronomefb_device; | ||
957 | |||
958 | static int __init metronomefb_init(void) | 762 | static int __init metronomefb_init(void) |
959 | { | 763 | { |
960 | int ret; | 764 | return platform_driver_register(&metronomefb_driver); |
961 | |||
962 | if (!metronomefb_enable) { | ||
963 | printk(KERN_ERR | ||
964 | "Use metronomefb_enable to enable the device\n"); | ||
965 | return -ENXIO; | ||
966 | } | ||
967 | |||
968 | ret = platform_driver_register(&metronomefb_driver); | ||
969 | if (!ret) { | ||
970 | metronomefb_device = platform_device_alloc("metronomefb", 0); | ||
971 | if (metronomefb_device) | ||
972 | ret = platform_device_add(metronomefb_device); | ||
973 | else | ||
974 | ret = -ENOMEM; | ||
975 | |||
976 | if (ret) { | ||
977 | platform_device_put(metronomefb_device); | ||
978 | platform_driver_unregister(&metronomefb_driver); | ||
979 | } | ||
980 | } | ||
981 | return ret; | ||
982 | |||
983 | } | 765 | } |
984 | 766 | ||
985 | static void __exit metronomefb_exit(void) | 767 | static void __exit metronomefb_exit(void) |
986 | { | 768 | { |
987 | platform_device_unregister(metronomefb_device); | ||
988 | platform_driver_unregister(&metronomefb_driver); | 769 | platform_driver_unregister(&metronomefb_driver); |
989 | } | 770 | } |
990 | 771 | ||
991 | module_param(metronomefb_enable, uint, 0); | ||
992 | MODULE_PARM_DESC(metronomefb_enable, "Enable communication with Metronome"); | ||
993 | |||
994 | module_init(metronomefb_init); | 772 | module_init(metronomefb_init); |
995 | module_exit(metronomefb_exit); | 773 | module_exit(metronomefb_exit); |
996 | 774 | ||
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index 08d072552233..473562191586 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c | |||
@@ -22,7 +22,7 @@ | |||
22 | ((v).xres == (x) && (v).yres == (y)) | 22 | ((v).xres == (x) && (v).yres == (y)) |
23 | 23 | ||
24 | #ifdef DEBUG | 24 | #ifdef DEBUG |
25 | #define DPRINTK(fmt, args...) printk("modedb %s: " fmt, __FUNCTION__ , ## args) | 25 | #define DPRINTK(fmt, args...) printk("modedb %s: " fmt, __func__ , ## args) |
26 | #else | 26 | #else |
27 | #define DPRINTK(fmt, args...) | 27 | #define DPRINTK(fmt, args...) |
28 | #endif | 28 | #endif |
@@ -522,7 +522,7 @@ int fb_find_mode(struct fb_var_screeninfo *var, | |||
522 | int res_specified = 0, bpp_specified = 0, refresh_specified = 0; | 522 | int res_specified = 0, bpp_specified = 0, refresh_specified = 0; |
523 | unsigned int xres = 0, yres = 0, bpp = default_bpp, refresh = 0; | 523 | unsigned int xres = 0, yres = 0, bpp = default_bpp, refresh = 0; |
524 | int yres_specified = 0, cvt = 0, rb = 0, interlace = 0, margins = 0; | 524 | int yres_specified = 0, cvt = 0, rb = 0, interlace = 0, margins = 0; |
525 | u32 best, diff; | 525 | u32 best, diff, tdiff; |
526 | 526 | ||
527 | for (i = namelen-1; i >= 0; i--) { | 527 | for (i = namelen-1; i >= 0; i--) { |
528 | switch (name[i]) { | 528 | switch (name[i]) { |
@@ -651,19 +651,27 @@ done: | |||
651 | return (refresh_specified) ? 2 : 1; | 651 | return (refresh_specified) ? 2 : 1; |
652 | } | 652 | } |
653 | 653 | ||
654 | diff = xres + yres; | 654 | diff = 2 * (xres + yres); |
655 | best = -1; | 655 | best = -1; |
656 | DPRINTK("Trying best-fit modes\n"); | 656 | DPRINTK("Trying best-fit modes\n"); |
657 | for (i = 0; i < dbsize; i++) { | 657 | for (i = 0; i < dbsize; i++) { |
658 | if (xres <= db[i].xres && yres <= db[i].yres) { | ||
659 | DPRINTK("Trying %ix%i\n", db[i].xres, db[i].yres); | 658 | DPRINTK("Trying %ix%i\n", db[i].xres, db[i].yres); |
660 | if (!fb_try_mode(var, info, &db[i], bpp)) { | 659 | if (!fb_try_mode(var, info, &db[i], bpp)) { |
661 | if (diff > (db[i].xres - xres) + (db[i].yres - yres)) { | 660 | tdiff = abs(db[i].xres - xres) + |
662 | diff = (db[i].xres - xres) + (db[i].yres - yres); | 661 | abs(db[i].yres - yres); |
663 | best = i; | 662 | |
664 | } | 663 | /* |
664 | * Penalize modes with resolutions smaller | ||
665 | * than requested. | ||
666 | */ | ||
667 | if (xres > db[i].xres || yres > db[i].yres) | ||
668 | tdiff += xres + yres; | ||
669 | |||
670 | if (diff > tdiff) { | ||
671 | diff = tdiff; | ||
672 | best = i; | ||
673 | } | ||
665 | } | 674 | } |
666 | } | ||
667 | } | 675 | } |
668 | if (best != -1) { | 676 | if (best != -1) { |
669 | fb_try_mode(var, info, &db[best], bpp); | 677 | fb_try_mode(var, info, &db[best], bpp); |
diff --git a/drivers/video/n411.c b/drivers/video/n411.c new file mode 100644 index 000000000000..935830fea7b6 --- /dev/null +++ b/drivers/video/n411.c | |||
@@ -0,0 +1,202 @@ | |||
1 | /* | ||
2 | * linux/drivers/video/n411.c -- Platform device for N411 EPD kit | ||
3 | * | ||
4 | * Copyright (C) 2008, Jaya Kumar | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file COPYING in the main directory of this archive for | ||
8 | * more details. | ||
9 | * | ||
10 | * Layout is based on skeletonfb.c by James Simmons and Geert Uytterhoeven. | ||
11 | * | ||
12 | * This driver is written to be used with the Hecuba display controller | ||
13 | * board, and tested with the EInk 800x600 display in 1 bit mode. | ||
14 | * The interface between Hecuba and the host is TTL based GPIO. The | ||
15 | * GPIO requirements are 8 writable data lines and 6 lines for control. | ||
16 | * Only 4 of the controls are actually used here but 6 for future use. | ||
17 | * The driver requires the IO addresses for data and control GPIO at | ||
18 | * load time. It is also possible to use this display with a standard | ||
19 | * PC parallel port. | ||
20 | * | ||
21 | * General notes: | ||
22 | * - User must set dio_addr=0xIOADDR cio_addr=0xIOADDR c2io_addr=0xIOADDR | ||
23 | * | ||
24 | */ | ||
25 | |||
26 | #include <linux/module.h> | ||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <linux/string.h> | ||
30 | #include <linux/delay.h> | ||
31 | #include <linux/interrupt.h> | ||
32 | #include <linux/fb.h> | ||
33 | #include <linux/init.h> | ||
34 | #include <linux/platform_device.h> | ||
35 | #include <linux/list.h> | ||
36 | #include <linux/uaccess.h> | ||
37 | #include <linux/irq.h> | ||
38 | |||
39 | #include <video/hecubafb.h> | ||
40 | |||
41 | static unsigned long dio_addr; | ||
42 | static unsigned long cio_addr; | ||
43 | static unsigned long c2io_addr; | ||
44 | static unsigned long splashval; | ||
45 | static unsigned int nosplash; | ||
46 | static unsigned char ctl; | ||
47 | |||
48 | static void n411_set_ctl(struct hecubafb_par *par, unsigned char bit, unsigned | ||
49 | char state) | ||
50 | { | ||
51 | switch (bit) { | ||
52 | case HCB_CD_BIT: | ||
53 | if (state) | ||
54 | ctl &= ~(HCB_CD_BIT); | ||
55 | else | ||
56 | ctl |= HCB_CD_BIT; | ||
57 | break; | ||
58 | case HCB_DS_BIT: | ||
59 | if (state) | ||
60 | ctl &= ~(HCB_DS_BIT); | ||
61 | else | ||
62 | ctl |= HCB_DS_BIT; | ||
63 | break; | ||
64 | } | ||
65 | outb(ctl, cio_addr); | ||
66 | } | ||
67 | |||
68 | static unsigned char n411_get_ctl(struct hecubafb_par *par) | ||
69 | { | ||
70 | return inb(c2io_addr); | ||
71 | } | ||
72 | |||
73 | static void n411_set_data(struct hecubafb_par *par, unsigned char value) | ||
74 | { | ||
75 | outb(value, dio_addr); | ||
76 | } | ||
77 | |||
78 | static void n411_wait_for_ack(struct hecubafb_par *par, int clear) | ||
79 | { | ||
80 | int timeout; | ||
81 | unsigned char tmp; | ||
82 | |||
83 | timeout = 500; | ||
84 | do { | ||
85 | tmp = n411_get_ctl(par); | ||
86 | if ((tmp & HCB_ACK_BIT) && (!clear)) | ||
87 | return; | ||
88 | else if (!(tmp & HCB_ACK_BIT) && (clear)) | ||
89 | return; | ||
90 | udelay(1); | ||
91 | } while (timeout--); | ||
92 | printk(KERN_ERR "timed out waiting for ack\n"); | ||
93 | } | ||
94 | |||
95 | static int n411_init_control(struct hecubafb_par *par) | ||
96 | { | ||
97 | unsigned char tmp; | ||
98 | /* for init, we want the following setup to be set: | ||
99 | WUP = lo | ||
100 | ACK = hi | ||
101 | DS = hi | ||
102 | RW = hi | ||
103 | CD = lo | ||
104 | */ | ||
105 | |||
106 | /* write WUP to lo, DS to hi, RW to hi, CD to lo */ | ||
107 | ctl = HCB_WUP_BIT | HCB_RW_BIT | HCB_CD_BIT ; | ||
108 | n411_set_ctl(par, HCB_DS_BIT, 1); | ||
109 | |||
110 | /* check ACK is not lo */ | ||
111 | tmp = n411_get_ctl(par); | ||
112 | if (tmp & HCB_ACK_BIT) { | ||
113 | printk(KERN_ERR "Fail because ACK is already low\n"); | ||
114 | return -ENXIO; | ||
115 | } | ||
116 | |||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | |||
121 | static int n411_init_board(struct hecubafb_par *par) | ||
122 | { | ||
123 | int retval; | ||
124 | |||
125 | retval = n411_init_control(par); | ||
126 | if (retval) | ||
127 | return retval; | ||
128 | |||
129 | par->send_command(par, APOLLO_INIT_DISPLAY); | ||
130 | par->send_data(par, 0x81); | ||
131 | |||
132 | /* have to wait while display resets */ | ||
133 | udelay(1000); | ||
134 | |||
135 | /* if we were told to splash the screen, we just clear it */ | ||
136 | if (!nosplash) { | ||
137 | par->send_command(par, APOLLO_ERASE_DISPLAY); | ||
138 | par->send_data(par, splashval); | ||
139 | } | ||
140 | |||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | static struct hecuba_board n411_board = { | ||
145 | .owner = THIS_MODULE, | ||
146 | .init = n411_init_board, | ||
147 | .set_ctl = n411_set_ctl, | ||
148 | .set_data = n411_set_data, | ||
149 | .wait_for_ack = n411_wait_for_ack, | ||
150 | }; | ||
151 | |||
152 | static struct platform_device *n411_device; | ||
153 | static int __init n411_init(void) | ||
154 | { | ||
155 | int ret; | ||
156 | if (!dio_addr || !cio_addr || !c2io_addr) { | ||
157 | printk(KERN_WARNING "no IO addresses supplied\n"); | ||
158 | return -EINVAL; | ||
159 | } | ||
160 | |||
161 | /* request our platform independent driver */ | ||
162 | request_module("hecubafb"); | ||
163 | |||
164 | n411_device = platform_device_alloc("hecubafb", -1); | ||
165 | if (!n411_device) | ||
166 | return -ENOMEM; | ||
167 | |||
168 | platform_device_add_data(n411_device, &n411_board, sizeof(n411_board)); | ||
169 | |||
170 | /* this _add binds hecubafb to n411. hecubafb refcounts n411 */ | ||
171 | ret = platform_device_add(n411_device); | ||
172 | |||
173 | if (ret) | ||
174 | platform_device_put(n411_device); | ||
175 | |||
176 | return ret; | ||
177 | |||
178 | } | ||
179 | |||
180 | static void __exit n411_exit(void) | ||
181 | { | ||
182 | platform_device_unregister(n411_device); | ||
183 | } | ||
184 | |||
185 | module_init(n411_init); | ||
186 | module_exit(n411_exit); | ||
187 | |||
188 | module_param(nosplash, uint, 0); | ||
189 | MODULE_PARM_DESC(nosplash, "Disable doing the splash screen"); | ||
190 | module_param(dio_addr, ulong, 0); | ||
191 | MODULE_PARM_DESC(dio_addr, "IO address for data, eg: 0x480"); | ||
192 | module_param(cio_addr, ulong, 0); | ||
193 | MODULE_PARM_DESC(cio_addr, "IO address for control, eg: 0x400"); | ||
194 | module_param(c2io_addr, ulong, 0); | ||
195 | MODULE_PARM_DESC(c2io_addr, "IO address for secondary control, eg: 0x408"); | ||
196 | module_param(splashval, ulong, 0); | ||
197 | MODULE_PARM_DESC(splashval, "Splash pattern: 0x00 is black, 0x01 is white"); | ||
198 | |||
199 | MODULE_DESCRIPTION("board driver for n411 hecuba/apollo epd kit"); | ||
200 | MODULE_AUTHOR("Jaya Kumar"); | ||
201 | MODULE_LICENSE("GPL"); | ||
202 | |||
diff --git a/drivers/video/nvidia/nv_hw.c b/drivers/video/nvidia/nv_hw.c index d1a10549f543..ed20a9871b33 100644 --- a/drivers/video/nvidia/nv_hw.c +++ b/drivers/video/nvidia/nv_hw.c | |||
@@ -129,7 +129,7 @@ typedef struct { | |||
129 | int nvclk_khz; | 129 | int nvclk_khz; |
130 | char mem_page_miss; | 130 | char mem_page_miss; |
131 | char mem_latency; | 131 | char mem_latency; |
132 | int memory_type; | 132 | u32 memory_type; |
133 | int memory_width; | 133 | int memory_width; |
134 | char enable_video; | 134 | char enable_video; |
135 | char gr_during_vid; | 135 | char gr_during_vid; |
@@ -719,7 +719,7 @@ static void nForceUpdateArbitrationSettings(unsigned VClk, | |||
719 | memctrl >>= 16; | 719 | memctrl >>= 16; |
720 | 720 | ||
721 | if ((memctrl == 0x1A9) || (memctrl == 0x1AB) || (memctrl == 0x1ED)) { | 721 | if ((memctrl == 0x1A9) || (memctrl == 0x1AB) || (memctrl == 0x1ED)) { |
722 | int dimm[3]; | 722 | u32 dimm[3]; |
723 | 723 | ||
724 | dev = pci_get_bus_and_slot(0, 2); | 724 | dev = pci_get_bus_and_slot(0, 2); |
725 | pci_read_config_dword(dev, 0x40, &dimm[0]); | 725 | pci_read_config_dword(dev, 0x40, &dimm[0]); |
diff --git a/drivers/video/nvidia/nv_setup.c b/drivers/video/nvidia/nv_setup.c index 82579d3a9970..d9627b57eb4d 100644 --- a/drivers/video/nvidia/nv_setup.c +++ b/drivers/video/nvidia/nv_setup.c | |||
@@ -265,12 +265,12 @@ static void nv10GetConfig(struct nvidia_par *par) | |||
265 | 265 | ||
266 | dev = pci_get_bus_and_slot(0, 1); | 266 | dev = pci_get_bus_and_slot(0, 1); |
267 | if ((par->Chipset & 0xffff) == 0x01a0) { | 267 | if ((par->Chipset & 0xffff) == 0x01a0) { |
268 | int amt = 0; | 268 | u32 amt; |
269 | 269 | ||
270 | pci_read_config_dword(dev, 0x7c, &amt); | 270 | pci_read_config_dword(dev, 0x7c, &amt); |
271 | par->RamAmountKBytes = (((amt >> 6) & 31) + 1) * 1024; | 271 | par->RamAmountKBytes = (((amt >> 6) & 31) + 1) * 1024; |
272 | } else if ((par->Chipset & 0xffff) == 0x01f0) { | 272 | } else if ((par->Chipset & 0xffff) == 0x01f0) { |
273 | int amt = 0; | 273 | u32 amt; |
274 | 274 | ||
275 | pci_read_config_dword(dev, 0x84, &amt); | 275 | pci_read_config_dword(dev, 0x84, &amt); |
276 | par->RamAmountKBytes = (((amt >> 4) & 127) + 1) * 1024; | 276 | par->RamAmountKBytes = (((amt >> 4) & 127) + 1) * 1024; |
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index 596652d2831f..9dbb5a5a267b 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/nvidia/nvidia.c | |||
@@ -43,14 +43,14 @@ | |||
43 | #define NVTRACE if (0) printk | 43 | #define NVTRACE if (0) printk |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #define NVTRACE_ENTER(...) NVTRACE("%s START\n", __FUNCTION__) | 46 | #define NVTRACE_ENTER(...) NVTRACE("%s START\n", __func__) |
47 | #define NVTRACE_LEAVE(...) NVTRACE("%s END\n", __FUNCTION__) | 47 | #define NVTRACE_LEAVE(...) NVTRACE("%s END\n", __func__) |
48 | 48 | ||
49 | #ifdef CONFIG_FB_NVIDIA_DEBUG | 49 | #ifdef CONFIG_FB_NVIDIA_DEBUG |
50 | #define assert(expr) \ | 50 | #define assert(expr) \ |
51 | if (!(expr)) { \ | 51 | if (!(expr)) { \ |
52 | printk( "Assertion failed! %s,%s,%s,line=%d\n",\ | 52 | printk( "Assertion failed! %s,%s,%s,line=%d\n",\ |
53 | #expr,__FILE__,__FUNCTION__,__LINE__); \ | 53 | #expr,__FILE__,__func__,__LINE__); \ |
54 | BUG(); \ | 54 | BUG(); \ |
55 | } | 55 | } |
56 | #else | 56 | #else |
@@ -1559,7 +1559,6 @@ static int __devinit nvidiafb_init(void) | |||
1559 | 1559 | ||
1560 | module_init(nvidiafb_init); | 1560 | module_init(nvidiafb_init); |
1561 | 1561 | ||
1562 | #ifdef MODULE | ||
1563 | static void __exit nvidiafb_exit(void) | 1562 | static void __exit nvidiafb_exit(void) |
1564 | { | 1563 | { |
1565 | pci_unregister_driver(&nvidiafb_driver); | 1564 | pci_unregister_driver(&nvidiafb_driver); |
@@ -1615,5 +1614,3 @@ MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) " | |||
1615 | MODULE_AUTHOR("Antonino Daplas"); | 1614 | MODULE_AUTHOR("Antonino Daplas"); |
1616 | MODULE_DESCRIPTION("Framebuffer driver for nVidia graphics chipset"); | 1615 | MODULE_DESCRIPTION("Framebuffer driver for nVidia graphics chipset"); |
1617 | MODULE_LICENSE("GPL"); | 1616 | MODULE_LICENSE("GPL"); |
1618 | #endif /* MODULE */ | ||
1619 | |||
diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 452433d46973..d7b3dcc0dc43 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c | |||
@@ -248,7 +248,7 @@ static void __iomem *offb_map_reg(struct device_node *np, int index, | |||
248 | static void __init offb_init_fb(const char *name, const char *full_name, | 248 | static void __init offb_init_fb(const char *name, const char *full_name, |
249 | int width, int height, int depth, | 249 | int width, int height, int depth, |
250 | int pitch, unsigned long address, | 250 | int pitch, unsigned long address, |
251 | struct device_node *dp) | 251 | int foreign_endian, struct device_node *dp) |
252 | { | 252 | { |
253 | unsigned long res_size = pitch * height * (depth + 7) / 8; | 253 | unsigned long res_size = pitch * height * (depth + 7) / 8; |
254 | struct offb_par *par = &default_par; | 254 | struct offb_par *par = &default_par; |
@@ -397,7 +397,7 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
397 | info->screen_base = ioremap(address, fix->smem_len); | 397 | info->screen_base = ioremap(address, fix->smem_len); |
398 | info->par = par; | 398 | info->par = par; |
399 | info->pseudo_palette = (void *) (info + 1); | 399 | info->pseudo_palette = (void *) (info + 1); |
400 | info->flags = FBINFO_DEFAULT; | 400 | info->flags = FBINFO_DEFAULT | foreign_endian; |
401 | 401 | ||
402 | fb_alloc_cmap(&info->cmap, 256, 0); | 402 | fb_alloc_cmap(&info->cmap, 256, 0); |
403 | 403 | ||
@@ -424,6 +424,15 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) | |||
424 | u64 rstart, address = OF_BAD_ADDR; | 424 | u64 rstart, address = OF_BAD_ADDR; |
425 | const u32 *pp, *addrp, *up; | 425 | const u32 *pp, *addrp, *up; |
426 | u64 asize; | 426 | u64 asize; |
427 | int foreign_endian = 0; | ||
428 | |||
429 | #ifdef __BIG_ENDIAN | ||
430 | if (of_get_property(dp, "little-endian", NULL)) | ||
431 | foreign_endian = FBINFO_FOREIGN_ENDIAN; | ||
432 | #else | ||
433 | if (of_get_property(dp, "big-endian", NULL)) | ||
434 | foreign_endian = FBINFO_FOREIGN_ENDIAN; | ||
435 | #endif | ||
427 | 436 | ||
428 | pp = of_get_property(dp, "linux,bootx-depth", &len); | 437 | pp = of_get_property(dp, "linux,bootx-depth", &len); |
429 | if (pp == NULL) | 438 | if (pp == NULL) |
@@ -509,7 +518,7 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) | |||
509 | offb_init_fb(no_real_node ? "bootx" : dp->name, | 518 | offb_init_fb(no_real_node ? "bootx" : dp->name, |
510 | no_real_node ? "display" : dp->full_name, | 519 | no_real_node ? "display" : dp->full_name, |
511 | width, height, depth, pitch, address, | 520 | width, height, depth, pitch, address, |
512 | no_real_node ? NULL : dp); | 521 | foreign_endian, no_real_node ? NULL : dp); |
513 | } | 522 | } |
514 | } | 523 | } |
515 | 524 | ||
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c index 58496061142d..c95874fe9076 100644 --- a/drivers/video/p9100.c +++ b/drivers/video/p9100.c | |||
@@ -310,7 +310,7 @@ static int __devinit p9100_probe(struct of_device *op, const struct of_device_id | |||
310 | 310 | ||
311 | dev_set_drvdata(&op->dev, info); | 311 | dev_set_drvdata(&op->dev, info); |
312 | 312 | ||
313 | printk("%s: p9100 at %lx:%lx\n", | 313 | printk(KERN_INFO "%s: p9100 at %lx:%lx\n", |
314 | dp->full_name, | 314 | dp->full_name, |
315 | par->which_io, par->physbase); | 315 | par->which_io, par->physbase); |
316 | 316 | ||
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c index 30181b593829..3f1ca2adda3d 100644 --- a/drivers/video/pm2fb.c +++ b/drivers/video/pm2fb.c | |||
@@ -56,7 +56,7 @@ | |||
56 | #undef PM2FB_MASTER_DEBUG | 56 | #undef PM2FB_MASTER_DEBUG |
57 | #ifdef PM2FB_MASTER_DEBUG | 57 | #ifdef PM2FB_MASTER_DEBUG |
58 | #define DPRINTK(a, b...) \ | 58 | #define DPRINTK(a, b...) \ |
59 | printk(KERN_DEBUG "pm2fb: %s: " a, __FUNCTION__ , ## b) | 59 | printk(KERN_DEBUG "pm2fb: %s: " a, __func__ , ## b) |
60 | #else | 60 | #else |
61 | #define DPRINTK(a, b...) | 61 | #define DPRINTK(a, b...) |
62 | #endif | 62 | #endif |
@@ -67,7 +67,7 @@ | |||
67 | * Driver data | 67 | * Driver data |
68 | */ | 68 | */ |
69 | static int hwcursor = 1; | 69 | static int hwcursor = 1; |
70 | static char *mode __devinitdata; | 70 | static char *mode_option __devinitdata; |
71 | 71 | ||
72 | /* | 72 | /* |
73 | * The XFree GLINT driver will (I think to implement hardware cursor | 73 | * The XFree GLINT driver will (I think to implement hardware cursor |
@@ -1680,17 +1680,19 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev, | |||
1680 | info->pixmap.scan_align = 1; | 1680 | info->pixmap.scan_align = 1; |
1681 | } | 1681 | } |
1682 | 1682 | ||
1683 | if (!mode) | 1683 | if (!mode_option) |
1684 | mode = "640x480@60"; | 1684 | mode_option = "640x480@60"; |
1685 | 1685 | ||
1686 | err = fb_find_mode(&info->var, info, mode, NULL, 0, NULL, 8); | 1686 | err = fb_find_mode(&info->var, info, mode_option, NULL, 0, NULL, 8); |
1687 | if (!err || err == 4) | 1687 | if (!err || err == 4) |
1688 | info->var = pm2fb_var; | 1688 | info->var = pm2fb_var; |
1689 | 1689 | ||
1690 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) | 1690 | retval = fb_alloc_cmap(&info->cmap, 256, 0); |
1691 | if (retval < 0) | ||
1691 | goto err_exit_both; | 1692 | goto err_exit_both; |
1692 | 1693 | ||
1693 | if (register_framebuffer(info) < 0) | 1694 | retval = register_framebuffer(info); |
1695 | if (retval < 0) | ||
1694 | goto err_exit_all; | 1696 | goto err_exit_all; |
1695 | 1697 | ||
1696 | printk(KERN_INFO "fb%d: %s frame buffer device, memory = %dK.\n", | 1698 | printk(KERN_INFO "fb%d: %s frame buffer device, memory = %dK.\n", |
@@ -1797,7 +1799,7 @@ static int __init pm2fb_setup(char *options) | |||
1797 | else if (!strncmp(this_opt, "noaccel", 7)) | 1799 | else if (!strncmp(this_opt, "noaccel", 7)) |
1798 | noaccel = 1; | 1800 | noaccel = 1; |
1799 | else | 1801 | else |
1800 | mode = this_opt; | 1802 | mode_option = this_opt; |
1801 | } | 1803 | } |
1802 | return 0; | 1804 | return 0; |
1803 | } | 1805 | } |
@@ -1833,8 +1835,10 @@ static void __exit pm2fb_exit(void) | |||
1833 | #ifdef MODULE | 1835 | #ifdef MODULE |
1834 | module_exit(pm2fb_exit); | 1836 | module_exit(pm2fb_exit); |
1835 | 1837 | ||
1836 | module_param(mode, charp, 0); | 1838 | module_param(mode_option, charp, 0); |
1837 | MODULE_PARM_DESC(mode, "Preferred video mode e.g. '648x480-8@60'"); | 1839 | MODULE_PARM_DESC(mode_option, "Initial video mode e.g. '648x480-8@60'"); |
1840 | module_param_named(mode, mode_option, charp, 0); | ||
1841 | MODULE_PARM_DESC(mode, "Initial video mode e.g. '648x480-8@60' (deprecated)"); | ||
1838 | module_param(lowhsync, bool, 0); | 1842 | module_param(lowhsync, bool, 0); |
1839 | MODULE_PARM_DESC(lowhsync, "Force horizontal sync low regardless of mode"); | 1843 | MODULE_PARM_DESC(lowhsync, "Force horizontal sync low regardless of mode"); |
1840 | module_param(lowvsync, bool, 0); | 1844 | module_param(lowvsync, bool, 0); |
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c index 5dba8cdd0517..68089d1456c2 100644 --- a/drivers/video/pm3fb.c +++ b/drivers/video/pm3fb.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #undef PM3FB_MASTER_DEBUG | 45 | #undef PM3FB_MASTER_DEBUG |
46 | #ifdef PM3FB_MASTER_DEBUG | 46 | #ifdef PM3FB_MASTER_DEBUG |
47 | #define DPRINTK(a, b...) \ | 47 | #define DPRINTK(a, b...) \ |
48 | printk(KERN_DEBUG "pm3fb: %s: " a, __FUNCTION__ , ## b) | 48 | printk(KERN_DEBUG "pm3fb: %s: " a, __func__ , ## b) |
49 | #else | 49 | #else |
50 | #define DPRINTK(a, b...) | 50 | #define DPRINTK(a, b...) |
51 | #endif | 51 | #endif |
@@ -1571,6 +1571,8 @@ module_exit(pm3fb_exit); | |||
1571 | #endif | 1571 | #endif |
1572 | module_init(pm3fb_init); | 1572 | module_init(pm3fb_init); |
1573 | 1573 | ||
1574 | module_param(mode_option, charp, 0); | ||
1575 | MODULE_PARM_DESC(mode_option, "Initial video mode e.g. '648x480-8@60'"); | ||
1574 | module_param(noaccel, bool, 0); | 1576 | module_param(noaccel, bool, 0); |
1575 | MODULE_PARM_DESC(noaccel, "Disable acceleration"); | 1577 | MODULE_PARM_DESC(noaccel, "Disable acceleration"); |
1576 | module_param(hwcursor, int, 0644); | 1578 | module_param(hwcursor, int, 0644); |
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index 5c47968e7f21..d94c57ffbdb1 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c | |||
@@ -56,10 +56,6 @@ | |||
56 | #include "rivafb.h" | 56 | #include "rivafb.h" |
57 | #include "nvreg.h" | 57 | #include "nvreg.h" |
58 | 58 | ||
59 | #ifndef CONFIG_PCI /* sanity check */ | ||
60 | #error This driver requires PCI support. | ||
61 | #endif | ||
62 | |||
63 | /* version number of this driver */ | 59 | /* version number of this driver */ |
64 | #define RIVAFB_VERSION "0.9.5b" | 60 | #define RIVAFB_VERSION "0.9.5b" |
65 | 61 | ||
@@ -74,14 +70,14 @@ | |||
74 | #define NVTRACE if(0) printk | 70 | #define NVTRACE if(0) printk |
75 | #endif | 71 | #endif |
76 | 72 | ||
77 | #define NVTRACE_ENTER(...) NVTRACE("%s START\n", __FUNCTION__) | 73 | #define NVTRACE_ENTER(...) NVTRACE("%s START\n", __func__) |
78 | #define NVTRACE_LEAVE(...) NVTRACE("%s END\n", __FUNCTION__) | 74 | #define NVTRACE_LEAVE(...) NVTRACE("%s END\n", __func__) |
79 | 75 | ||
80 | #ifdef CONFIG_FB_RIVA_DEBUG | 76 | #ifdef CONFIG_FB_RIVA_DEBUG |
81 | #define assert(expr) \ | 77 | #define assert(expr) \ |
82 | if(!(expr)) { \ | 78 | if(!(expr)) { \ |
83 | printk( "Assertion failed! %s,%s,%s,line=%d\n",\ | 79 | printk( "Assertion failed! %s,%s,%s,line=%d\n",\ |
84 | #expr,__FILE__,__FUNCTION__,__LINE__); \ | 80 | #expr,__FILE__,__func__,__LINE__); \ |
85 | BUG(); \ | 81 | BUG(); \ |
86 | } | 82 | } |
87 | #else | 83 | #else |
@@ -2213,14 +2209,12 @@ static int __devinit rivafb_init(void) | |||
2213 | 2209 | ||
2214 | module_init(rivafb_init); | 2210 | module_init(rivafb_init); |
2215 | 2211 | ||
2216 | #ifdef MODULE | ||
2217 | static void __exit rivafb_exit(void) | 2212 | static void __exit rivafb_exit(void) |
2218 | { | 2213 | { |
2219 | pci_unregister_driver(&rivafb_driver); | 2214 | pci_unregister_driver(&rivafb_driver); |
2220 | } | 2215 | } |
2221 | 2216 | ||
2222 | module_exit(rivafb_exit); | 2217 | module_exit(rivafb_exit); |
2223 | #endif /* MODULE */ | ||
2224 | 2218 | ||
2225 | module_param(noaccel, bool, 0); | 2219 | module_param(noaccel, bool, 0); |
2226 | MODULE_PARM_DESC(noaccel, "bool: disable acceleration"); | 2220 | MODULE_PARM_DESC(noaccel, "bool: disable acceleration"); |
diff --git a/drivers/video/riva/nv_driver.c b/drivers/video/riva/nv_driver.c index a11026812d1b..f3694cf17e58 100644 --- a/drivers/video/riva/nv_driver.c +++ b/drivers/video/riva/nv_driver.c | |||
@@ -41,11 +41,6 @@ | |||
41 | #include "rivafb.h" | 41 | #include "rivafb.h" |
42 | #include "nvreg.h" | 42 | #include "nvreg.h" |
43 | 43 | ||
44 | |||
45 | #ifndef CONFIG_PCI /* sanity check */ | ||
46 | #error This driver requires PCI support. | ||
47 | #endif | ||
48 | |||
49 | #define PFX "rivafb: " | 44 | #define PFX "rivafb: " |
50 | 45 | ||
51 | static inline unsigned char MISCin(struct riva_par *par) | 46 | static inline unsigned char MISCin(struct riva_par *par) |
@@ -163,7 +158,7 @@ unsigned long riva_get_memlen(struct riva_par *par) | |||
163 | unsigned long memlen = 0; | 158 | unsigned long memlen = 0; |
164 | unsigned int chipset = par->Chipset; | 159 | unsigned int chipset = par->Chipset; |
165 | struct pci_dev* dev; | 160 | struct pci_dev* dev; |
166 | int amt; | 161 | u32 amt; |
167 | 162 | ||
168 | switch (chip->Architecture) { | 163 | switch (chip->Architecture) { |
169 | case NV_ARCH_03: | 164 | case NV_ARCH_03: |
diff --git a/drivers/video/riva/riva_hw.c b/drivers/video/riva/riva_hw.c index 13307703a9f0..78fdbf5178d7 100644 --- a/drivers/video/riva/riva_hw.c +++ b/drivers/video/riva/riva_hw.c | |||
@@ -231,7 +231,7 @@ typedef struct { | |||
231 | int nvclk_khz; | 231 | int nvclk_khz; |
232 | char mem_page_miss; | 232 | char mem_page_miss; |
233 | char mem_latency; | 233 | char mem_latency; |
234 | int memory_type; | 234 | u32 memory_type; |
235 | int memory_width; | 235 | int memory_width; |
236 | char enable_video; | 236 | char enable_video; |
237 | char gr_during_vid; | 237 | char gr_during_vid; |
@@ -2107,7 +2107,7 @@ static void nv10GetConfig | |||
2107 | ) | 2107 | ) |
2108 | { | 2108 | { |
2109 | struct pci_dev* dev; | 2109 | struct pci_dev* dev; |
2110 | int amt; | 2110 | u32 amt; |
2111 | 2111 | ||
2112 | #ifdef __BIG_ENDIAN | 2112 | #ifdef __BIG_ENDIAN |
2113 | /* turn on big endian register access */ | 2113 | /* turn on big endian register access */ |
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index 71fa6edb5c47..13b38cbbe4cf 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c | |||
@@ -430,9 +430,9 @@ static void s3c2410fb_activate_var(struct fb_info *info) | |||
430 | struct fb_var_screeninfo *var = &info->var; | 430 | struct fb_var_screeninfo *var = &info->var; |
431 | int clkdiv = s3c2410fb_calc_pixclk(fbi, var->pixclock) / 2; | 431 | int clkdiv = s3c2410fb_calc_pixclk(fbi, var->pixclock) / 2; |
432 | 432 | ||
433 | dprintk("%s: var->xres = %d\n", __FUNCTION__, var->xres); | 433 | dprintk("%s: var->xres = %d\n", __func__, var->xres); |
434 | dprintk("%s: var->yres = %d\n", __FUNCTION__, var->yres); | 434 | dprintk("%s: var->yres = %d\n", __func__, var->yres); |
435 | dprintk("%s: var->bpp = %d\n", __FUNCTION__, var->bits_per_pixel); | 435 | dprintk("%s: var->bpp = %d\n", __func__, var->bits_per_pixel); |
436 | 436 | ||
437 | if (type == S3C2410_LCDCON1_TFT) { | 437 | if (type == S3C2410_LCDCON1_TFT) { |
438 | s3c2410fb_calculate_tft_lcd_regs(info, &fbi->regs); | 438 | s3c2410fb_calculate_tft_lcd_regs(info, &fbi->regs); |
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c index 7d53bc23b9c7..2972f112dbed 100644 --- a/drivers/video/s3fb.c +++ b/drivers/video/s3fb.c | |||
@@ -132,10 +132,10 @@ static const struct svga_timing_regs s3_timing_regs = { | |||
132 | /* Module parameters */ | 132 | /* Module parameters */ |
133 | 133 | ||
134 | 134 | ||
135 | static char *mode = "640x480-8@60"; | 135 | static char *mode_option __devinitdata = "640x480-8@60"; |
136 | 136 | ||
137 | #ifdef CONFIG_MTRR | 137 | #ifdef CONFIG_MTRR |
138 | static int mtrr = 1; | 138 | static int mtrr __devinitdata = 1; |
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | static int fasttext = 1; | 141 | static int fasttext = 1; |
@@ -145,8 +145,10 @@ MODULE_AUTHOR("(c) 2006-2007 Ondrej Zajicek <santiago@crfreenet.org>"); | |||
145 | MODULE_LICENSE("GPL"); | 145 | MODULE_LICENSE("GPL"); |
146 | MODULE_DESCRIPTION("fbdev driver for S3 Trio/Virge"); | 146 | MODULE_DESCRIPTION("fbdev driver for S3 Trio/Virge"); |
147 | 147 | ||
148 | module_param(mode, charp, 0444); | 148 | module_param(mode_option, charp, 0444); |
149 | MODULE_PARM_DESC(mode, "Default video mode ('640x480-8@60', etc)"); | 149 | MODULE_PARM_DESC(mode_option, "Default video mode ('640x480-8@60', etc)"); |
150 | module_param_named(mode, mode_option, charp, 0444); | ||
151 | MODULE_PARM_DESC(mode, "Default video mode ('640x480-8@60', etc) (deprecated)"); | ||
150 | 152 | ||
151 | #ifdef CONFIG_MTRR | 153 | #ifdef CONFIG_MTRR |
152 | module_param(mtrr, int, 0444); | 154 | module_param(mtrr, int, 0444); |
@@ -886,7 +888,7 @@ static int __devinit s3_pci_probe(struct pci_dev *dev, const struct pci_device_i | |||
886 | } | 888 | } |
887 | 889 | ||
888 | /* Allocate and fill driver data structure */ | 890 | /* Allocate and fill driver data structure */ |
889 | info = framebuffer_alloc(sizeof(struct s3fb_info), NULL); | 891 | info = framebuffer_alloc(sizeof(struct s3fb_info), &(dev->dev)); |
890 | if (!info) { | 892 | if (!info) { |
891 | dev_err(&(dev->dev), "cannot allocate memory\n"); | 893 | dev_err(&(dev->dev), "cannot allocate memory\n"); |
892 | return -ENOMEM; | 894 | return -ENOMEM; |
@@ -901,13 +903,13 @@ static int __devinit s3_pci_probe(struct pci_dev *dev, const struct pci_device_i | |||
901 | /* Prepare PCI device */ | 903 | /* Prepare PCI device */ |
902 | rc = pci_enable_device(dev); | 904 | rc = pci_enable_device(dev); |
903 | if (rc < 0) { | 905 | if (rc < 0) { |
904 | dev_err(&(dev->dev), "cannot enable PCI device\n"); | 906 | dev_err(info->dev, "cannot enable PCI device\n"); |
905 | goto err_enable_device; | 907 | goto err_enable_device; |
906 | } | 908 | } |
907 | 909 | ||
908 | rc = pci_request_regions(dev, "s3fb"); | 910 | rc = pci_request_regions(dev, "s3fb"); |
909 | if (rc < 0) { | 911 | if (rc < 0) { |
910 | dev_err(&(dev->dev), "cannot reserve framebuffer region\n"); | 912 | dev_err(info->dev, "cannot reserve framebuffer region\n"); |
911 | goto err_request_regions; | 913 | goto err_request_regions; |
912 | } | 914 | } |
913 | 915 | ||
@@ -919,7 +921,7 @@ static int __devinit s3_pci_probe(struct pci_dev *dev, const struct pci_device_i | |||
919 | info->screen_base = pci_iomap(dev, 0, 0); | 921 | info->screen_base = pci_iomap(dev, 0, 0); |
920 | if (! info->screen_base) { | 922 | if (! info->screen_base) { |
921 | rc = -ENOMEM; | 923 | rc = -ENOMEM; |
922 | dev_err(&(dev->dev), "iomap for framebuffer failed\n"); | 924 | dev_err(info->dev, "iomap for framebuffer failed\n"); |
923 | goto err_iomap; | 925 | goto err_iomap; |
924 | } | 926 | } |
925 | 927 | ||
@@ -960,22 +962,22 @@ static int __devinit s3_pci_probe(struct pci_dev *dev, const struct pci_device_i | |||
960 | info->pseudo_palette = (void*) (par->pseudo_palette); | 962 | info->pseudo_palette = (void*) (par->pseudo_palette); |
961 | 963 | ||
962 | /* Prepare startup mode */ | 964 | /* Prepare startup mode */ |
963 | rc = fb_find_mode(&(info->var), info, mode, NULL, 0, NULL, 8); | 965 | rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8); |
964 | if (! ((rc == 1) || (rc == 2))) { | 966 | if (! ((rc == 1) || (rc == 2))) { |
965 | rc = -EINVAL; | 967 | rc = -EINVAL; |
966 | dev_err(&(dev->dev), "mode %s not found\n", mode); | 968 | dev_err(info->dev, "mode %s not found\n", mode_option); |
967 | goto err_find_mode; | 969 | goto err_find_mode; |
968 | } | 970 | } |
969 | 971 | ||
970 | rc = fb_alloc_cmap(&info->cmap, 256, 0); | 972 | rc = fb_alloc_cmap(&info->cmap, 256, 0); |
971 | if (rc < 0) { | 973 | if (rc < 0) { |
972 | dev_err(&(dev->dev), "cannot allocate colormap\n"); | 974 | dev_err(info->dev, "cannot allocate colormap\n"); |
973 | goto err_alloc_cmap; | 975 | goto err_alloc_cmap; |
974 | } | 976 | } |
975 | 977 | ||
976 | rc = register_framebuffer(info); | 978 | rc = register_framebuffer(info); |
977 | if (rc < 0) { | 979 | if (rc < 0) { |
978 | dev_err(&(dev->dev), "cannot register framebuffer\n"); | 980 | dev_err(info->dev, "cannot register framebuffer\n"); |
979 | goto err_reg_fb; | 981 | goto err_reg_fb; |
980 | } | 982 | } |
981 | 983 | ||
@@ -1051,7 +1053,7 @@ static int s3_pci_suspend(struct pci_dev* dev, pm_message_t state) | |||
1051 | struct fb_info *info = pci_get_drvdata(dev); | 1053 | struct fb_info *info = pci_get_drvdata(dev); |
1052 | struct s3fb_info *par = info->par; | 1054 | struct s3fb_info *par = info->par; |
1053 | 1055 | ||
1054 | dev_info(&(dev->dev), "suspend\n"); | 1056 | dev_info(info->dev, "suspend\n"); |
1055 | 1057 | ||
1056 | acquire_console_sem(); | 1058 | acquire_console_sem(); |
1057 | mutex_lock(&(par->open_lock)); | 1059 | mutex_lock(&(par->open_lock)); |
@@ -1083,7 +1085,7 @@ static int s3_pci_resume(struct pci_dev* dev) | |||
1083 | struct s3fb_info *par = info->par; | 1085 | struct s3fb_info *par = info->par; |
1084 | int err; | 1086 | int err; |
1085 | 1087 | ||
1086 | dev_info(&(dev->dev), "resume\n"); | 1088 | dev_info(info->dev, "resume\n"); |
1087 | 1089 | ||
1088 | acquire_console_sem(); | 1090 | acquire_console_sem(); |
1089 | mutex_lock(&(par->open_lock)); | 1091 | mutex_lock(&(par->open_lock)); |
@@ -1100,7 +1102,7 @@ static int s3_pci_resume(struct pci_dev* dev) | |||
1100 | if (err) { | 1102 | if (err) { |
1101 | mutex_unlock(&(par->open_lock)); | 1103 | mutex_unlock(&(par->open_lock)); |
1102 | release_console_sem(); | 1104 | release_console_sem(); |
1103 | dev_err(&(dev->dev), "error %d enabling device for resume\n", err); | 1105 | dev_err(info->dev, "error %d enabling device for resume\n", err); |
1104 | return err; | 1106 | return err; |
1105 | } | 1107 | } |
1106 | pci_set_master(dev); | 1108 | pci_set_master(dev); |
@@ -1168,7 +1170,7 @@ static int __init s3fb_setup(char *options) | |||
1168 | else if (!strncmp(opt, "fasttext:", 9)) | 1170 | else if (!strncmp(opt, "fasttext:", 9)) |
1169 | fasttext = simple_strtoul(opt + 9, NULL, 0); | 1171 | fasttext = simple_strtoul(opt + 9, NULL, 0); |
1170 | else | 1172 | else |
1171 | mode = opt; | 1173 | mode_option = opt; |
1172 | } | 1174 | } |
1173 | 1175 | ||
1174 | return 0; | 1176 | return 0; |
diff --git a/drivers/video/sa1100fb.h b/drivers/video/sa1100fb.h index 48066ef3af05..f465b27ed860 100644 --- a/drivers/video/sa1100fb.h +++ b/drivers/video/sa1100fb.h | |||
@@ -132,7 +132,7 @@ struct sa1100fb_info { | |||
132 | * Debug macros | 132 | * Debug macros |
133 | */ | 133 | */ |
134 | #if DEBUG | 134 | #if DEBUG |
135 | # define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args) | 135 | # define DPRINTK(fmt, args...) printk("%s: " fmt, __func__ , ## args) |
136 | #else | 136 | #else |
137 | # define DPRINTK(fmt, args...) | 137 | # define DPRINTK(fmt, args...) |
138 | #endif | 138 | #endif |
diff --git a/drivers/video/savage/savagefb-i2c.c b/drivers/video/savage/savagefb-i2c.c index 35c1ce62b216..783d4adffb93 100644 --- a/drivers/video/savage/savagefb-i2c.c +++ b/drivers/video/savage/savagefb-i2c.c | |||
@@ -140,7 +140,7 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, | |||
140 | chan->adapter.id = I2C_HW_B_SAVAGE; | 140 | chan->adapter.id = I2C_HW_B_SAVAGE; |
141 | chan->adapter.algo_data = &chan->algo; | 141 | chan->adapter.algo_data = &chan->algo; |
142 | chan->adapter.dev.parent = &chan->par->pcidev->dev; | 142 | chan->adapter.dev.parent = &chan->par->pcidev->dev; |
143 | chan->algo.udelay = 40; | 143 | chan->algo.udelay = 10; |
144 | chan->algo.timeout = 20; | 144 | chan->algo.timeout = 20; |
145 | chan->algo.data = chan; | 145 | chan->algo.data = chan; |
146 | 146 | ||
diff --git a/drivers/video/sis/sis.h b/drivers/video/sis/sis.h index 9b05da6268f7..a14e82211037 100644 --- a/drivers/video/sis/sis.h +++ b/drivers/video/sis/sis.h | |||
@@ -55,7 +55,7 @@ | |||
55 | #undef SISFBDEBUG | 55 | #undef SISFBDEBUG |
56 | 56 | ||
57 | #ifdef SISFBDEBUG | 57 | #ifdef SISFBDEBUG |
58 | #define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) | 58 | #define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args) |
59 | #define TWDEBUG(x) printk(KERN_INFO x "\n"); | 59 | #define TWDEBUG(x) printk(KERN_INFO x "\n"); |
60 | #else | 60 | #else |
61 | #define DPRINTK(fmt, args...) | 61 | #define DPRINTK(fmt, args...) |
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c index 97784f9c184d..5b11a00f49bc 100644 --- a/drivers/video/sstfb.c +++ b/drivers/video/sstfb.c | |||
@@ -1006,7 +1006,7 @@ static int sst_set_pll_att_ti(struct fb_info *info, | |||
1006 | break; | 1006 | break; |
1007 | default: | 1007 | default: |
1008 | dprintk("%s: wrong clock code '%d'\n", | 1008 | dprintk("%s: wrong clock code '%d'\n", |
1009 | __FUNCTION__, clock); | 1009 | __func__, clock); |
1010 | return 0; | 1010 | return 0; |
1011 | } | 1011 | } |
1012 | udelay(300); | 1012 | udelay(300); |
@@ -1048,7 +1048,7 @@ static int sst_set_pll_ics(struct fb_info *info, | |||
1048 | break; | 1048 | break; |
1049 | default: | 1049 | default: |
1050 | dprintk("%s: wrong clock code '%d'\n", | 1050 | dprintk("%s: wrong clock code '%d'\n", |
1051 | __FUNCTION__, clock); | 1051 | __func__, clock); |
1052 | return 0; | 1052 | return 0; |
1053 | } | 1053 | } |
1054 | udelay(300); | 1054 | udelay(300); |
@@ -1079,7 +1079,7 @@ static void sst_set_vidmod_att_ti(struct fb_info *info, const int bpp) | |||
1079 | sst_dac_write(DACREG_RMR, (cr0 & 0x0f) | DACREG_CR0_16BPP); | 1079 | sst_dac_write(DACREG_RMR, (cr0 & 0x0f) | DACREG_CR0_16BPP); |
1080 | break; | 1080 | break; |
1081 | default: | 1081 | default: |
1082 | dprintk("%s: bad depth '%u'\n", __FUNCTION__, bpp); | 1082 | dprintk("%s: bad depth '%u'\n", __func__, bpp); |
1083 | break; | 1083 | break; |
1084 | } | 1084 | } |
1085 | } | 1085 | } |
@@ -1093,7 +1093,7 @@ static void sst_set_vidmod_ics(struct fb_info *info, const int bpp) | |||
1093 | sst_dac_write(DACREG_ICS_CMD, DACREG_ICS_CMD_16BPP); | 1093 | sst_dac_write(DACREG_ICS_CMD, DACREG_ICS_CMD_16BPP); |
1094 | break; | 1094 | break; |
1095 | default: | 1095 | default: |
1096 | dprintk("%s: bad depth '%u'\n", __FUNCTION__, bpp); | 1096 | dprintk("%s: bad depth '%u'\n", __func__, bpp); |
1097 | break; | 1097 | break; |
1098 | } | 1098 | } |
1099 | } | 1099 | } |
@@ -1133,7 +1133,7 @@ static int __devinit sst_detect_dactype(struct fb_info *info, struct sstfb_par * | |||
1133 | } | 1133 | } |
1134 | if (!ret) | 1134 | if (!ret) |
1135 | return 0; | 1135 | return 0; |
1136 | f_dprintk("%s found %s\n", __FUNCTION__, dacs[i].name); | 1136 | f_dprintk("%s found %s\n", __func__, dacs[i].name); |
1137 | par->dac_sw = dacs[i]; | 1137 | par->dac_sw = dacs[i]; |
1138 | return 1; | 1138 | return 1; |
1139 | } | 1139 | } |
diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c index f98be301140c..598d35eff935 100644 --- a/drivers/video/stifb.c +++ b/drivers/video/stifb.c | |||
@@ -164,11 +164,11 @@ static int __initdata stifb_bpp_pref[MAX_STI_ROMS]; | |||
164 | # define DEBUG_ON() debug_on=1 | 164 | # define DEBUG_ON() debug_on=1 |
165 | # define WRITE_BYTE(value,fb,reg) do { if (debug_on) \ | 165 | # define WRITE_BYTE(value,fb,reg) do { if (debug_on) \ |
166 | printk(KERN_DEBUG "%30s: WRITE_BYTE(0x%06x) = 0x%02x (old=0x%02x)\n", \ | 166 | printk(KERN_DEBUG "%30s: WRITE_BYTE(0x%06x) = 0x%02x (old=0x%02x)\n", \ |
167 | __FUNCTION__, reg, value, READ_BYTE(fb,reg)); \ | 167 | __func__, reg, value, READ_BYTE(fb,reg)); \ |
168 | gsc_writeb((value),(fb)->info.fix.mmio_start + (reg)); } while (0) | 168 | gsc_writeb((value),(fb)->info.fix.mmio_start + (reg)); } while (0) |
169 | # define WRITE_WORD(value,fb,reg) do { if (debug_on) \ | 169 | # define WRITE_WORD(value,fb,reg) do { if (debug_on) \ |
170 | printk(KERN_DEBUG "%30s: WRITE_WORD(0x%06x) = 0x%08x (old=0x%08x)\n", \ | 170 | printk(KERN_DEBUG "%30s: WRITE_WORD(0x%06x) = 0x%08x (old=0x%08x)\n", \ |
171 | __FUNCTION__, reg, value, READ_WORD(fb,reg)); \ | 171 | __func__, reg, value, READ_WORD(fb,reg)); \ |
172 | gsc_writel((value),(fb)->info.fix.mmio_start + (reg)); } while (0) | 172 | gsc_writel((value),(fb)->info.fix.mmio_start + (reg)); } while (0) |
173 | #endif /* DEBUG_STIFB_REGS */ | 173 | #endif /* DEBUG_STIFB_REGS */ |
174 | 174 | ||
diff --git a/drivers/video/syscopyarea.c b/drivers/video/syscopyarea.c index 37af10ab8f52..a352d5f46bbf 100644 --- a/drivers/video/syscopyarea.c +++ b/drivers/video/syscopyarea.c | |||
@@ -26,15 +26,15 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | static void | 28 | static void |
29 | bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, | 29 | bitcpy(struct fb_info *p, unsigned long *dst, int dst_idx, |
30 | int src_idx, int bits, unsigned n) | 30 | const unsigned long *src, int src_idx, int bits, unsigned n) |
31 | { | 31 | { |
32 | unsigned long first, last; | 32 | unsigned long first, last; |
33 | int const shift = dst_idx-src_idx; | 33 | int const shift = dst_idx-src_idx; |
34 | int left, right; | 34 | int left, right; |
35 | 35 | ||
36 | first = FB_SHIFT_HIGH(~0UL, dst_idx); | 36 | first = FB_SHIFT_HIGH(p, ~0UL, dst_idx); |
37 | last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); | 37 | last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits)); |
38 | 38 | ||
39 | if (!shift) { | 39 | if (!shift) { |
40 | /* Same alignment for source and dest */ | 40 | /* Same alignment for source and dest */ |
@@ -167,8 +167,8 @@ bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, | |||
167 | */ | 167 | */ |
168 | 168 | ||
169 | static void | 169 | static void |
170 | bitcpy_rev(unsigned long *dst, int dst_idx, const unsigned long *src, | 170 | bitcpy_rev(struct fb_info *p, unsigned long *dst, int dst_idx, |
171 | int src_idx, int bits, unsigned n) | 171 | const unsigned long *src, int src_idx, int bits, unsigned n) |
172 | { | 172 | { |
173 | unsigned long first, last; | 173 | unsigned long first, last; |
174 | int shift; | 174 | int shift; |
@@ -186,8 +186,8 @@ bitcpy_rev(unsigned long *dst, int dst_idx, const unsigned long *src, | |||
186 | 186 | ||
187 | shift = dst_idx-src_idx; | 187 | shift = dst_idx-src_idx; |
188 | 188 | ||
189 | first = FB_SHIFT_LOW(~0UL, bits - 1 - dst_idx); | 189 | first = FB_SHIFT_LOW(p, ~0UL, bits - 1 - dst_idx); |
190 | last = ~(FB_SHIFT_LOW(~0UL, bits - 1 - ((dst_idx-n) % bits))); | 190 | last = ~(FB_SHIFT_LOW(p, ~0UL, bits - 1 - ((dst_idx-n) % bits))); |
191 | 191 | ||
192 | if (!shift) { | 192 | if (!shift) { |
193 | /* Same alignment for source and dest */ | 193 | /* Same alignment for source and dest */ |
@@ -353,7 +353,7 @@ void sys_copyarea(struct fb_info *p, const struct fb_copyarea *area) | |||
353 | dst_idx &= (bytes - 1); | 353 | dst_idx &= (bytes - 1); |
354 | src += src_idx >> (ffs(bits) - 1); | 354 | src += src_idx >> (ffs(bits) - 1); |
355 | src_idx &= (bytes - 1); | 355 | src_idx &= (bytes - 1); |
356 | bitcpy_rev(dst, dst_idx, src, src_idx, bits, | 356 | bitcpy_rev(p, dst, dst_idx, src, src_idx, bits, |
357 | width*p->var.bits_per_pixel); | 357 | width*p->var.bits_per_pixel); |
358 | } | 358 | } |
359 | } else { | 359 | } else { |
@@ -362,7 +362,7 @@ void sys_copyarea(struct fb_info *p, const struct fb_copyarea *area) | |||
362 | dst_idx &= (bytes - 1); | 362 | dst_idx &= (bytes - 1); |
363 | src += src_idx >> (ffs(bits) - 1); | 363 | src += src_idx >> (ffs(bits) - 1); |
364 | src_idx &= (bytes - 1); | 364 | src_idx &= (bytes - 1); |
365 | bitcpy(dst, dst_idx, src, src_idx, bits, | 365 | bitcpy(p, dst, dst_idx, src, src_idx, bits, |
366 | width*p->var.bits_per_pixel); | 366 | width*p->var.bits_per_pixel); |
367 | dst_idx += bits_per_line; | 367 | dst_idx += bits_per_line; |
368 | src_idx += bits_per_line; | 368 | src_idx += bits_per_line; |
diff --git a/drivers/video/sysfillrect.c b/drivers/video/sysfillrect.c index a261e9e6a675..f94d6b6e29ee 100644 --- a/drivers/video/sysfillrect.c +++ b/drivers/video/sysfillrect.c | |||
@@ -22,16 +22,16 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | static void | 24 | static void |
25 | bitfill_aligned(unsigned long *dst, int dst_idx, unsigned long pat, | 25 | bitfill_aligned(struct fb_info *p, unsigned long *dst, int dst_idx, |
26 | unsigned n, int bits) | 26 | unsigned long pat, unsigned n, int bits) |
27 | { | 27 | { |
28 | unsigned long first, last; | 28 | unsigned long first, last; |
29 | 29 | ||
30 | if (!n) | 30 | if (!n) |
31 | return; | 31 | return; |
32 | 32 | ||
33 | first = FB_SHIFT_HIGH(~0UL, dst_idx); | 33 | first = FB_SHIFT_HIGH(p, ~0UL, dst_idx); |
34 | last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); | 34 | last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits)); |
35 | 35 | ||
36 | if (dst_idx+n <= bits) { | 36 | if (dst_idx+n <= bits) { |
37 | /* Single word */ | 37 | /* Single word */ |
@@ -78,16 +78,16 @@ bitfill_aligned(unsigned long *dst, int dst_idx, unsigned long pat, | |||
78 | */ | 78 | */ |
79 | 79 | ||
80 | static void | 80 | static void |
81 | bitfill_unaligned(unsigned long *dst, int dst_idx, unsigned long pat, | 81 | bitfill_unaligned(struct fb_info *p, unsigned long *dst, int dst_idx, |
82 | int left, int right, unsigned n, int bits) | 82 | unsigned long pat, int left, int right, unsigned n, int bits) |
83 | { | 83 | { |
84 | unsigned long first, last; | 84 | unsigned long first, last; |
85 | 85 | ||
86 | if (!n) | 86 | if (!n) |
87 | return; | 87 | return; |
88 | 88 | ||
89 | first = FB_SHIFT_HIGH(~0UL, dst_idx); | 89 | first = FB_SHIFT_HIGH(p, ~0UL, dst_idx); |
90 | last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); | 90 | last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits)); |
91 | 91 | ||
92 | if (dst_idx+n <= bits) { | 92 | if (dst_idx+n <= bits) { |
93 | /* Single word */ | 93 | /* Single word */ |
@@ -132,8 +132,8 @@ bitfill_unaligned(unsigned long *dst, int dst_idx, unsigned long pat, | |||
132 | * Aligned pattern invert using 32/64-bit memory accesses | 132 | * Aligned pattern invert using 32/64-bit memory accesses |
133 | */ | 133 | */ |
134 | static void | 134 | static void |
135 | bitfill_aligned_rev(unsigned long *dst, int dst_idx, unsigned long pat, | 135 | bitfill_aligned_rev(struct fb_info *p, unsigned long *dst, int dst_idx, |
136 | unsigned n, int bits) | 136 | unsigned long pat, unsigned n, int bits) |
137 | { | 137 | { |
138 | unsigned long val = pat; | 138 | unsigned long val = pat; |
139 | unsigned long first, last; | 139 | unsigned long first, last; |
@@ -141,8 +141,8 @@ bitfill_aligned_rev(unsigned long *dst, int dst_idx, unsigned long pat, | |||
141 | if (!n) | 141 | if (!n) |
142 | return; | 142 | return; |
143 | 143 | ||
144 | first = FB_SHIFT_HIGH(~0UL, dst_idx); | 144 | first = FB_SHIFT_HIGH(p, ~0UL, dst_idx); |
145 | last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); | 145 | last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits)); |
146 | 146 | ||
147 | if (dst_idx+n <= bits) { | 147 | if (dst_idx+n <= bits) { |
148 | /* Single word */ | 148 | /* Single word */ |
@@ -188,16 +188,17 @@ bitfill_aligned_rev(unsigned long *dst, int dst_idx, unsigned long pat, | |||
188 | */ | 188 | */ |
189 | 189 | ||
190 | static void | 190 | static void |
191 | bitfill_unaligned_rev(unsigned long *dst, int dst_idx, unsigned long pat, | 191 | bitfill_unaligned_rev(struct fb_info *p, unsigned long *dst, int dst_idx, |
192 | int left, int right, unsigned n, int bits) | 192 | unsigned long pat, int left, int right, unsigned n, |
193 | int bits) | ||
193 | { | 194 | { |
194 | unsigned long first, last; | 195 | unsigned long first, last; |
195 | 196 | ||
196 | if (!n) | 197 | if (!n) |
197 | return; | 198 | return; |
198 | 199 | ||
199 | first = FB_SHIFT_HIGH(~0UL, dst_idx); | 200 | first = FB_SHIFT_HIGH(p, ~0UL, dst_idx); |
200 | last = ~(FB_SHIFT_HIGH(~0UL, (dst_idx+n) % bits)); | 201 | last = ~(FB_SHIFT_HIGH(p, ~0UL, (dst_idx+n) % bits)); |
201 | 202 | ||
202 | if (dst_idx+n <= bits) { | 203 | if (dst_idx+n <= bits) { |
203 | /* Single word */ | 204 | /* Single word */ |
@@ -267,9 +268,9 @@ void sys_fillrect(struct fb_info *p, const struct fb_fillrect *rect) | |||
267 | if (p->fbops->fb_sync) | 268 | if (p->fbops->fb_sync) |
268 | p->fbops->fb_sync(p); | 269 | p->fbops->fb_sync(p); |
269 | if (!left) { | 270 | if (!left) { |
270 | void (*fill_op32)(unsigned long *dst, int dst_idx, | 271 | void (*fill_op32)(struct fb_info *p, unsigned long *dst, |
271 | unsigned long pat, unsigned n, int bits) = | 272 | int dst_idx, unsigned long pat, unsigned n, |
272 | NULL; | 273 | int bits) = NULL; |
273 | 274 | ||
274 | switch (rect->rop) { | 275 | switch (rect->rop) { |
275 | case ROP_XOR: | 276 | case ROP_XOR: |
@@ -287,16 +288,16 @@ void sys_fillrect(struct fb_info *p, const struct fb_fillrect *rect) | |||
287 | while (height--) { | 288 | while (height--) { |
288 | dst += dst_idx >> (ffs(bits) - 1); | 289 | dst += dst_idx >> (ffs(bits) - 1); |
289 | dst_idx &= (bits - 1); | 290 | dst_idx &= (bits - 1); |
290 | fill_op32(dst, dst_idx, pat, width*bpp, bits); | 291 | fill_op32(p, dst, dst_idx, pat, width*bpp, bits); |
291 | dst_idx += p->fix.line_length*8; | 292 | dst_idx += p->fix.line_length*8; |
292 | } | 293 | } |
293 | } else { | 294 | } else { |
294 | int right; | 295 | int right; |
295 | int r; | 296 | int r; |
296 | int rot = (left-dst_idx) % bpp; | 297 | int rot = (left-dst_idx) % bpp; |
297 | void (*fill_op)(unsigned long *dst, int dst_idx, | 298 | void (*fill_op)(struct fb_info *p, unsigned long *dst, |
298 | unsigned long pat, int left, int right, | 299 | int dst_idx, unsigned long pat, int left, |
299 | unsigned n, int bits) = NULL; | 300 | int right, unsigned n, int bits) = NULL; |
300 | 301 | ||
301 | /* rotate pattern to correct start position */ | 302 | /* rotate pattern to correct start position */ |
302 | pat = pat << rot | pat >> (bpp-rot); | 303 | pat = pat << rot | pat >> (bpp-rot); |
@@ -318,7 +319,7 @@ void sys_fillrect(struct fb_info *p, const struct fb_fillrect *rect) | |||
318 | while (height--) { | 319 | while (height--) { |
319 | dst += dst_idx >> (ffs(bits) - 1); | 320 | dst += dst_idx >> (ffs(bits) - 1); |
320 | dst_idx &= (bits - 1); | 321 | dst_idx &= (bits - 1); |
321 | fill_op(dst, dst_idx, pat, left, right, | 322 | fill_op(p, dst, dst_idx, pat, left, right, |
322 | width*bpp, bits); | 323 | width*bpp, bits); |
323 | r = (p->fix.line_length*8) % bpp; | 324 | r = (p->fix.line_length*8) % bpp; |
324 | pat = pat << (bpp-r) | pat >> r; | 325 | pat = pat << (bpp-r) | pat >> r; |
diff --git a/drivers/video/sysimgblt.c b/drivers/video/sysimgblt.c index bd7e7e9d155f..186c6f607be2 100644 --- a/drivers/video/sysimgblt.c +++ b/drivers/video/sysimgblt.c | |||
@@ -18,35 +18,31 @@ | |||
18 | #define DEBUG | 18 | #define DEBUG |
19 | 19 | ||
20 | #ifdef DEBUG | 20 | #ifdef DEBUG |
21 | #define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt,__FUNCTION__,## args) | 21 | #define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt,__func__,## args) |
22 | #else | 22 | #else |
23 | #define DPRINTK(fmt, args...) | 23 | #define DPRINTK(fmt, args...) |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | static const u32 cfb_tab8[] = { | 26 | static const u32 cfb_tab8_be[] = { |
27 | #if defined(__BIG_ENDIAN) | ||
28 | 0x00000000,0x000000ff,0x0000ff00,0x0000ffff, | 27 | 0x00000000,0x000000ff,0x0000ff00,0x0000ffff, |
29 | 0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff, | 28 | 0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff, |
30 | 0xff000000,0xff0000ff,0xff00ff00,0xff00ffff, | 29 | 0xff000000,0xff0000ff,0xff00ff00,0xff00ffff, |
31 | 0xffff0000,0xffff00ff,0xffffff00,0xffffffff | 30 | 0xffff0000,0xffff00ff,0xffffff00,0xffffffff |
32 | #elif defined(__LITTLE_ENDIAN) | 31 | }; |
32 | |||
33 | static const u32 cfb_tab8_le[] = { | ||
33 | 0x00000000,0xff000000,0x00ff0000,0xffff0000, | 34 | 0x00000000,0xff000000,0x00ff0000,0xffff0000, |
34 | 0x0000ff00,0xff00ff00,0x00ffff00,0xffffff00, | 35 | 0x0000ff00,0xff00ff00,0x00ffff00,0xffffff00, |
35 | 0x000000ff,0xff0000ff,0x00ff00ff,0xffff00ff, | 36 | 0x000000ff,0xff0000ff,0x00ff00ff,0xffff00ff, |
36 | 0x0000ffff,0xff00ffff,0x00ffffff,0xffffffff | 37 | 0x0000ffff,0xff00ffff,0x00ffffff,0xffffffff |
37 | #else | ||
38 | #error FIXME: No endianness?? | ||
39 | #endif | ||
40 | }; | 38 | }; |
41 | 39 | ||
42 | static const u32 cfb_tab16[] = { | 40 | static const u32 cfb_tab16_be[] = { |
43 | #if defined(__BIG_ENDIAN) | ||
44 | 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff | 41 | 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff |
45 | #elif defined(__LITTLE_ENDIAN) | 42 | }; |
43 | |||
44 | static const u32 cfb_tab16_le[] = { | ||
46 | 0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff | 45 | 0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff |
47 | #else | ||
48 | #error FIXME: No endianness?? | ||
49 | #endif | ||
50 | }; | 46 | }; |
51 | 47 | ||
52 | static const u32 cfb_tab32[] = { | 48 | static const u32 cfb_tab32[] = { |
@@ -72,7 +68,7 @@ static void color_imageblit(const struct fb_image *image, struct fb_info *p, | |||
72 | val = 0; | 68 | val = 0; |
73 | 69 | ||
74 | if (start_index) { | 70 | if (start_index) { |
75 | u32 start_mask = ~(FB_SHIFT_HIGH(~(u32)0, | 71 | u32 start_mask = ~(FB_SHIFT_HIGH(p, ~(u32)0, |
76 | start_index)); | 72 | start_index)); |
77 | val = *dst & start_mask; | 73 | val = *dst & start_mask; |
78 | shift = start_index; | 74 | shift = start_index; |
@@ -83,20 +79,20 @@ static void color_imageblit(const struct fb_image *image, struct fb_info *p, | |||
83 | color = palette[*src]; | 79 | color = palette[*src]; |
84 | else | 80 | else |
85 | color = *src; | 81 | color = *src; |
86 | color <<= FB_LEFT_POS(bpp); | 82 | color <<= FB_LEFT_POS(p, bpp); |
87 | val |= FB_SHIFT_HIGH(color, shift); | 83 | val |= FB_SHIFT_HIGH(p, color, shift); |
88 | if (shift >= null_bits) { | 84 | if (shift >= null_bits) { |
89 | *dst++ = val; | 85 | *dst++ = val; |
90 | 86 | ||
91 | val = (shift == null_bits) ? 0 : | 87 | val = (shift == null_bits) ? 0 : |
92 | FB_SHIFT_LOW(color, 32 - shift); | 88 | FB_SHIFT_LOW(p, color, 32 - shift); |
93 | } | 89 | } |
94 | shift += bpp; | 90 | shift += bpp; |
95 | shift &= (32 - 1); | 91 | shift &= (32 - 1); |
96 | src++; | 92 | src++; |
97 | } | 93 | } |
98 | if (shift) { | 94 | if (shift) { |
99 | u32 end_mask = FB_SHIFT_HIGH(~(u32)0, shift); | 95 | u32 end_mask = FB_SHIFT_HIGH(p, ~(u32)0, shift); |
100 | 96 | ||
101 | *dst &= end_mask; | 97 | *dst &= end_mask; |
102 | *dst |= val; | 98 | *dst |= val; |
@@ -125,8 +121,8 @@ static void slow_imageblit(const struct fb_image *image, struct fb_info *p, | |||
125 | u32 i, j, l; | 121 | u32 i, j, l; |
126 | 122 | ||
127 | dst2 = dst1; | 123 | dst2 = dst1; |
128 | fgcolor <<= FB_LEFT_POS(bpp); | 124 | fgcolor <<= FB_LEFT_POS(p, bpp); |
129 | bgcolor <<= FB_LEFT_POS(bpp); | 125 | bgcolor <<= FB_LEFT_POS(p, bpp); |
130 | 126 | ||
131 | for (i = image->height; i--; ) { | 127 | for (i = image->height; i--; ) { |
132 | shift = val = 0; | 128 | shift = val = 0; |
@@ -137,7 +133,8 @@ static void slow_imageblit(const struct fb_image *image, struct fb_info *p, | |||
137 | 133 | ||
138 | /* write leading bits */ | 134 | /* write leading bits */ |
139 | if (start_index) { | 135 | if (start_index) { |
140 | u32 start_mask = ~(FB_SHIFT_HIGH(~(u32)0,start_index)); | 136 | u32 start_mask = ~(FB_SHIFT_HIGH(p, ~(u32)0, |
137 | start_index)); | ||
141 | val = *dst & start_mask; | 138 | val = *dst & start_mask; |
142 | shift = start_index; | 139 | shift = start_index; |
143 | } | 140 | } |
@@ -145,13 +142,13 @@ static void slow_imageblit(const struct fb_image *image, struct fb_info *p, | |||
145 | while (j--) { | 142 | while (j--) { |
146 | l--; | 143 | l--; |
147 | color = (*s & (1 << l)) ? fgcolor : bgcolor; | 144 | color = (*s & (1 << l)) ? fgcolor : bgcolor; |
148 | val |= FB_SHIFT_HIGH(color, shift); | 145 | val |= FB_SHIFT_HIGH(p, color, shift); |
149 | 146 | ||
150 | /* Did the bitshift spill bits to the next long? */ | 147 | /* Did the bitshift spill bits to the next long? */ |
151 | if (shift >= null_bits) { | 148 | if (shift >= null_bits) { |
152 | *dst++ = val; | 149 | *dst++ = val; |
153 | val = (shift == null_bits) ? 0 : | 150 | val = (shift == null_bits) ? 0 : |
154 | FB_SHIFT_LOW(color,32 - shift); | 151 | FB_SHIFT_LOW(p, color, 32 - shift); |
155 | } | 152 | } |
156 | shift += bpp; | 153 | shift += bpp; |
157 | shift &= (32 - 1); | 154 | shift &= (32 - 1); |
@@ -160,7 +157,7 @@ static void slow_imageblit(const struct fb_image *image, struct fb_info *p, | |||
160 | 157 | ||
161 | /* write trailing bits */ | 158 | /* write trailing bits */ |
162 | if (shift) { | 159 | if (shift) { |
163 | u32 end_mask = FB_SHIFT_HIGH(~(u32)0, shift); | 160 | u32 end_mask = FB_SHIFT_HIGH(p, ~(u32)0, shift); |
164 | 161 | ||
165 | *dst &= end_mask; | 162 | *dst &= end_mask; |
166 | *dst |= val; | 163 | *dst |= val; |
@@ -199,10 +196,10 @@ static void fast_imageblit(const struct fb_image *image, struct fb_info *p, | |||
199 | 196 | ||
200 | switch (bpp) { | 197 | switch (bpp) { |
201 | case 8: | 198 | case 8: |
202 | tab = cfb_tab8; | 199 | tab = fb_be_math(p) ? cfb_tab8_be : cfb_tab8_le; |
203 | break; | 200 | break; |
204 | case 16: | 201 | case 16: |
205 | tab = cfb_tab16; | 202 | tab = fb_be_math(p) ? cfb_tab16_be : cfb_tab16_le; |
206 | break; | 203 | break; |
207 | case 32: | 204 | case 32: |
208 | default: | 205 | default: |
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c index e5a9ddb3c8be..a71774305772 100644 --- a/drivers/video/tcx.c +++ b/drivers/video/tcx.c | |||
@@ -419,7 +419,7 @@ static int __devinit tcx_init_one(struct of_device *op) | |||
419 | par->mmap_map[6].size = SBUS_MMAP_EMPTY; | 419 | par->mmap_map[6].size = SBUS_MMAP_EMPTY; |
420 | } | 420 | } |
421 | 421 | ||
422 | par->physbase = 0; | 422 | par->physbase = op->resource[0].start; |
423 | par->which_io = op->resource[0].flags & IORESOURCE_BITS; | 423 | par->which_io = op->resource[0].flags & IORESOURCE_BITS; |
424 | 424 | ||
425 | for (i = 0; i < TCX_MMAP_ENTRIES; i++) { | 425 | for (i = 0; i < TCX_MMAP_ENTRIES; i++) { |
@@ -470,10 +470,10 @@ static int __devinit tcx_init_one(struct of_device *op) | |||
470 | 470 | ||
471 | dev_set_drvdata(&op->dev, info); | 471 | dev_set_drvdata(&op->dev, info); |
472 | 472 | ||
473 | printk("%s: TCX at %lx:%lx, %s\n", | 473 | printk(KERN_INFO "%s: TCX at %lx:%lx, %s\n", |
474 | dp->full_name, | 474 | dp->full_name, |
475 | par->which_io, | 475 | par->which_io, |
476 | op->resource[0].start, | 476 | par->physbase, |
477 | par->lowdepth ? "8-bit only" : "24-bit depth"); | 477 | par->lowdepth ? "8-bit only" : "24-bit depth"); |
478 | 478 | ||
479 | return 0; | 479 | return 0; |
@@ -527,7 +527,7 @@ static struct of_platform_driver tcx_driver = { | |||
527 | .remove = __devexit_p(tcx_remove), | 527 | .remove = __devexit_p(tcx_remove), |
528 | }; | 528 | }; |
529 | 529 | ||
530 | int __init tcx_init(void) | 530 | static int __init tcx_init(void) |
531 | { | 531 | { |
532 | if (fb_get_options("tcxfb", NULL)) | 532 | if (fb_get_options("tcxfb", NULL)) |
533 | return -ENODEV; | 533 | return -ENODEV; |
@@ -535,7 +535,7 @@ int __init tcx_init(void) | |||
535 | return of_register_driver(&tcx_driver, &of_bus_type); | 535 | return of_register_driver(&tcx_driver, &of_bus_type); |
536 | } | 536 | } |
537 | 537 | ||
538 | void __exit tcx_exit(void) | 538 | static void __exit tcx_exit(void) |
539 | { | 539 | { |
540 | of_unregister_driver(&tcx_driver); | 540 | of_unregister_driver(&tcx_driver); |
541 | } | 541 | } |
diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c index 71e179ea5f95..ea9f19d25597 100644 --- a/drivers/video/tdfxfb.c +++ b/drivers/video/tdfxfb.c | |||
@@ -70,7 +70,7 @@ | |||
70 | 70 | ||
71 | #include <video/tdfx.h> | 71 | #include <video/tdfx.h> |
72 | 72 | ||
73 | #define DPRINTK(a, b...) pr_debug("fb: %s: " a, __FUNCTION__ , ## b) | 73 | #define DPRINTK(a, b...) pr_debug("fb: %s: " a, __func__ , ## b) |
74 | 74 | ||
75 | #ifdef CONFIG_MTRR | 75 | #ifdef CONFIG_MTRR |
76 | #include <asm/mtrr.h> | 76 | #include <asm/mtrr.h> |
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c index 0a4e07d43d2d..bd54cd0de39a 100644 --- a/drivers/video/tridentfb.c +++ b/drivers/video/tridentfb.c | |||
@@ -58,7 +58,7 @@ static int displaytype; | |||
58 | /* defaults which are normally overriden by user values */ | 58 | /* defaults which are normally overriden by user values */ |
59 | 59 | ||
60 | /* video mode */ | 60 | /* video mode */ |
61 | static char *mode = "640x480"; | 61 | static char *mode_option __devinitdata = "640x480"; |
62 | static int bpp = 8; | 62 | static int bpp = 8; |
63 | 63 | ||
64 | static int noaccel; | 64 | static int noaccel; |
@@ -73,7 +73,10 @@ static int memsize; | |||
73 | static int memdiff; | 73 | static int memdiff; |
74 | static int nativex; | 74 | static int nativex; |
75 | 75 | ||
76 | module_param(mode, charp, 0); | 76 | module_param(mode_option, charp, 0); |
77 | MODULE_PARM_DESC(mode_option, "Initial video mode e.g. '648x480-8@60'"); | ||
78 | module_param_named(mode, mode_option, charp, 0); | ||
79 | MODULE_PARM_DESC(mode, "Initial video mode e.g. '648x480-8@60' (deprecated)"); | ||
77 | module_param(bpp, int, 0); | 80 | module_param(bpp, int, 0); |
78 | module_param(center, int, 0); | 81 | module_param(center, int, 0); |
79 | module_param(stretch, int, 0); | 82 | module_param(stretch, int, 0); |
@@ -1297,7 +1300,8 @@ static int __devinit trident_pci_probe(struct pci_dev * dev, | |||
1297 | #endif | 1300 | #endif |
1298 | fb_info.pseudo_palette = pseudo_pal; | 1301 | fb_info.pseudo_palette = pseudo_pal; |
1299 | 1302 | ||
1300 | if (!fb_find_mode(&default_var, &fb_info, mode, NULL, 0, NULL, bpp)) { | 1303 | if (!fb_find_mode(&default_var, &fb_info, |
1304 | mode_option, NULL, 0, NULL, bpp)) { | ||
1301 | err = -EINVAL; | 1305 | err = -EINVAL; |
1302 | goto out_unmap2; | 1306 | goto out_unmap2; |
1303 | } | 1307 | } |
@@ -1385,7 +1389,7 @@ static struct pci_driver tridentfb_pci_driver = { | |||
1385 | * video=trident:800x600,bpp=16,noaccel | 1389 | * video=trident:800x600,bpp=16,noaccel |
1386 | */ | 1390 | */ |
1387 | #ifndef MODULE | 1391 | #ifndef MODULE |
1388 | static int tridentfb_setup(char *options) | 1392 | static int __init tridentfb_setup(char *options) |
1389 | { | 1393 | { |
1390 | char *opt; | 1394 | char *opt; |
1391 | if (!options || !*options) | 1395 | if (!options || !*options) |
@@ -1412,7 +1416,7 @@ static int tridentfb_setup(char *options) | |||
1412 | else if (!strncmp(opt, "nativex=", 8)) | 1416 | else if (!strncmp(opt, "nativex=", 8)) |
1413 | nativex = simple_strtoul(opt + 8, NULL, 0); | 1417 | nativex = simple_strtoul(opt + 8, NULL, 0); |
1414 | else | 1418 | else |
1415 | mode = opt; | 1419 | mode_option = opt; |
1416 | } | 1420 | } |
1417 | return 0; | 1421 | return 0; |
1418 | } | 1422 | } |
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index 93361656316c..cdbb56edb6cb 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c | |||
@@ -181,7 +181,8 @@ static int uvesafb_exec(struct uvesafb_ktask *task) | |||
181 | /* If all slots are taken -- bail out. */ | 181 | /* If all slots are taken -- bail out. */ |
182 | if (uvfb_tasks[seq]) { | 182 | if (uvfb_tasks[seq]) { |
183 | mutex_unlock(&uvfb_lock); | 183 | mutex_unlock(&uvfb_lock); |
184 | return -EBUSY; | 184 | err = -EBUSY; |
185 | goto out; | ||
185 | } | 186 | } |
186 | 187 | ||
187 | /* Save a pointer to the kernel part of the task struct. */ | 188 | /* Save a pointer to the kernel part of the task struct. */ |
@@ -205,7 +206,6 @@ static int uvesafb_exec(struct uvesafb_ktask *task) | |||
205 | err = cn_netlink_send(m, 0, gfp_any()); | 206 | err = cn_netlink_send(m, 0, gfp_any()); |
206 | } | 207 | } |
207 | } | 208 | } |
208 | kfree(m); | ||
209 | 209 | ||
210 | if (!err && !(task->t.flags & TF_EXIT)) | 210 | if (!err && !(task->t.flags & TF_EXIT)) |
211 | err = !wait_for_completion_timeout(task->done, | 211 | err = !wait_for_completion_timeout(task->done, |
@@ -218,7 +218,8 @@ static int uvesafb_exec(struct uvesafb_ktask *task) | |||
218 | seq++; | 218 | seq++; |
219 | if (seq >= UVESAFB_TASKS_MAX) | 219 | if (seq >= UVESAFB_TASKS_MAX) |
220 | seq = 0; | 220 | seq = 0; |
221 | 221 | out: | |
222 | kfree(m); | ||
222 | return err; | 223 | return err; |
223 | } | 224 | } |
224 | 225 | ||
@@ -885,7 +886,7 @@ static int __devinit uvesafb_vbe_init_mode(struct fb_info *info) | |||
885 | } | 886 | } |
886 | 887 | ||
887 | /* fb_find_mode() failed */ | 888 | /* fb_find_mode() failed */ |
888 | if (i == 0 || i >= 3) { | 889 | if (i == 0) { |
889 | info->var.xres = 640; | 890 | info->var.xres = 640; |
890 | info->var.yres = 480; | 891 | info->var.yres = 480; |
891 | mode = (struct fb_videomode *) | 892 | mode = (struct fb_videomode *) |
diff --git a/drivers/video/vermilion/vermilion.c b/drivers/video/vermilion/vermilion.c index 2aa71eb67c2b..c18f1884b550 100644 --- a/drivers/video/vermilion/vermilion.c +++ b/drivers/video/vermilion/vermilion.c | |||
@@ -112,8 +112,9 @@ static int vmlfb_alloc_vram_area(struct vram_area *va, unsigned max_order, | |||
112 | 112 | ||
113 | /* | 113 | /* |
114 | * It seems like __get_free_pages only ups the usage count | 114 | * It seems like __get_free_pages only ups the usage count |
115 | * of the first page. This doesn't work with nopage mapping, so | 115 | * of the first page. This doesn't work with fault mapping, so |
116 | * up the usage count once more. | 116 | * up the usage count once more (XXX: should use split_page or |
117 | * compound page). | ||
117 | */ | 118 | */ |
118 | 119 | ||
119 | memset((void *)va->logical, 0x00, va->size); | 120 | memset((void *)va->logical, 0x00, va->size); |
diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c index 4c3a63308df1..536ab11623f0 100644 --- a/drivers/video/vt8623fb.c +++ b/drivers/video/vt8623fb.c | |||
@@ -100,7 +100,7 @@ static struct svga_timing_regs vt8623_timing_regs = { | |||
100 | 100 | ||
101 | /* Module parameters */ | 101 | /* Module parameters */ |
102 | 102 | ||
103 | static char *mode = "640x480-8@60"; | 103 | static char *mode_option = "640x480-8@60"; |
104 | 104 | ||
105 | #ifdef CONFIG_MTRR | 105 | #ifdef CONFIG_MTRR |
106 | static int mtrr = 1; | 106 | static int mtrr = 1; |
@@ -110,8 +110,10 @@ MODULE_AUTHOR("(c) 2006 Ondrej Zajicek <santiago@crfreenet.org>"); | |||
110 | MODULE_LICENSE("GPL"); | 110 | MODULE_LICENSE("GPL"); |
111 | MODULE_DESCRIPTION("fbdev driver for integrated graphics core in VIA VT8623 [CLE266]"); | 111 | MODULE_DESCRIPTION("fbdev driver for integrated graphics core in VIA VT8623 [CLE266]"); |
112 | 112 | ||
113 | module_param(mode, charp, 0644); | 113 | module_param(mode_option, charp, 0644); |
114 | MODULE_PARM_DESC(mode, "Default video mode ('640x480-8@60', etc)"); | 114 | MODULE_PARM_DESC(mode_option, "Default video mode ('640x480-8@60', etc)"); |
115 | module_param_named(mode, mode_option, charp, 0); | ||
116 | MODULE_PARM_DESC(mode, "Default video mode e.g. '648x480-8@60' (deprecated)"); | ||
115 | 117 | ||
116 | #ifdef CONFIG_MTRR | 118 | #ifdef CONFIG_MTRR |
117 | module_param(mtrr, int, 0444); | 119 | module_param(mtrr, int, 0444); |
@@ -434,6 +436,10 @@ static int vt8623fb_set_par(struct fb_info *info) | |||
434 | svga_wcrt_multi(vt8623_offset_regs, offset_value); | 436 | svga_wcrt_multi(vt8623_offset_regs, offset_value); |
435 | svga_wseq_multi(vt8623_fetch_count_regs, fetch_value); | 437 | svga_wseq_multi(vt8623_fetch_count_regs, fetch_value); |
436 | 438 | ||
439 | /* Clear H/V Skew */ | ||
440 | svga_wcrt_mask(0x03, 0x00, 0x60); | ||
441 | svga_wcrt_mask(0x05, 0x00, 0x60); | ||
442 | |||
437 | if (info->var.vmode & FB_VMODE_DOUBLE) | 443 | if (info->var.vmode & FB_VMODE_DOUBLE) |
438 | svga_wcrt_mask(0x09, 0x80, 0x80); | 444 | svga_wcrt_mask(0x09, 0x80, 0x80); |
439 | else | 445 | else |
@@ -655,7 +661,7 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi | |||
655 | } | 661 | } |
656 | 662 | ||
657 | /* Allocate and fill driver data structure */ | 663 | /* Allocate and fill driver data structure */ |
658 | info = framebuffer_alloc(sizeof(struct vt8623fb_info), NULL); | 664 | info = framebuffer_alloc(sizeof(struct vt8623fb_info), &(dev->dev)); |
659 | if (! info) { | 665 | if (! info) { |
660 | dev_err(&(dev->dev), "cannot allocate memory\n"); | 666 | dev_err(&(dev->dev), "cannot allocate memory\n"); |
661 | return -ENOMEM; | 667 | return -ENOMEM; |
@@ -671,13 +677,13 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi | |||
671 | 677 | ||
672 | rc = pci_enable_device(dev); | 678 | rc = pci_enable_device(dev); |
673 | if (rc < 0) { | 679 | if (rc < 0) { |
674 | dev_err(&(dev->dev), "cannot enable PCI device\n"); | 680 | dev_err(info->dev, "cannot enable PCI device\n"); |
675 | goto err_enable_device; | 681 | goto err_enable_device; |
676 | } | 682 | } |
677 | 683 | ||
678 | rc = pci_request_regions(dev, "vt8623fb"); | 684 | rc = pci_request_regions(dev, "vt8623fb"); |
679 | if (rc < 0) { | 685 | if (rc < 0) { |
680 | dev_err(&(dev->dev), "cannot reserve framebuffer region\n"); | 686 | dev_err(info->dev, "cannot reserve framebuffer region\n"); |
681 | goto err_request_regions; | 687 | goto err_request_regions; |
682 | } | 688 | } |
683 | 689 | ||
@@ -690,14 +696,14 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi | |||
690 | info->screen_base = pci_iomap(dev, 0, 0); | 696 | info->screen_base = pci_iomap(dev, 0, 0); |
691 | if (! info->screen_base) { | 697 | if (! info->screen_base) { |
692 | rc = -ENOMEM; | 698 | rc = -ENOMEM; |
693 | dev_err(&(dev->dev), "iomap for framebuffer failed\n"); | 699 | dev_err(info->dev, "iomap for framebuffer failed\n"); |
694 | goto err_iomap_1; | 700 | goto err_iomap_1; |
695 | } | 701 | } |
696 | 702 | ||
697 | par->mmio_base = pci_iomap(dev, 1, 0); | 703 | par->mmio_base = pci_iomap(dev, 1, 0); |
698 | if (! par->mmio_base) { | 704 | if (! par->mmio_base) { |
699 | rc = -ENOMEM; | 705 | rc = -ENOMEM; |
700 | dev_err(&(dev->dev), "iomap for MMIO failed\n"); | 706 | dev_err(info->dev, "iomap for MMIO failed\n"); |
701 | goto err_iomap_2; | 707 | goto err_iomap_2; |
702 | } | 708 | } |
703 | 709 | ||
@@ -708,7 +714,7 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi | |||
708 | if ((16 <= memsize1) && (memsize1 <= 64) && (memsize1 == memsize2)) | 714 | if ((16 <= memsize1) && (memsize1 <= 64) && (memsize1 == memsize2)) |
709 | info->screen_size = memsize1 << 20; | 715 | info->screen_size = memsize1 << 20; |
710 | else { | 716 | else { |
711 | dev_err(&(dev->dev), "memory size detection failed (%x %x), suppose 16 MB\n", memsize1, memsize2); | 717 | dev_err(info->dev, "memory size detection failed (%x %x), suppose 16 MB\n", memsize1, memsize2); |
712 | info->screen_size = 16 << 20; | 718 | info->screen_size = 16 << 20; |
713 | } | 719 | } |
714 | 720 | ||
@@ -722,22 +728,22 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi | |||
722 | 728 | ||
723 | /* Prepare startup mode */ | 729 | /* Prepare startup mode */ |
724 | 730 | ||
725 | rc = fb_find_mode(&(info->var), info, mode, NULL, 0, NULL, 8); | 731 | rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8); |
726 | if (! ((rc == 1) || (rc == 2))) { | 732 | if (! ((rc == 1) || (rc == 2))) { |
727 | rc = -EINVAL; | 733 | rc = -EINVAL; |
728 | dev_err(&(dev->dev), "mode %s not found\n", mode); | 734 | dev_err(info->dev, "mode %s not found\n", mode_option); |
729 | goto err_find_mode; | 735 | goto err_find_mode; |
730 | } | 736 | } |
731 | 737 | ||
732 | rc = fb_alloc_cmap(&info->cmap, 256, 0); | 738 | rc = fb_alloc_cmap(&info->cmap, 256, 0); |
733 | if (rc < 0) { | 739 | if (rc < 0) { |
734 | dev_err(&(dev->dev), "cannot allocate colormap\n"); | 740 | dev_err(info->dev, "cannot allocate colormap\n"); |
735 | goto err_alloc_cmap; | 741 | goto err_alloc_cmap; |
736 | } | 742 | } |
737 | 743 | ||
738 | rc = register_framebuffer(info); | 744 | rc = register_framebuffer(info); |
739 | if (rc < 0) { | 745 | if (rc < 0) { |
740 | dev_err(&(dev->dev), "cannot register framebugger\n"); | 746 | dev_err(info->dev, "cannot register framebugger\n"); |
741 | goto err_reg_fb; | 747 | goto err_reg_fb; |
742 | } | 748 | } |
743 | 749 | ||
@@ -811,7 +817,7 @@ static int vt8623_pci_suspend(struct pci_dev* dev, pm_message_t state) | |||
811 | struct fb_info *info = pci_get_drvdata(dev); | 817 | struct fb_info *info = pci_get_drvdata(dev); |
812 | struct vt8623fb_info *par = info->par; | 818 | struct vt8623fb_info *par = info->par; |
813 | 819 | ||
814 | dev_info(&(dev->dev), "suspend\n"); | 820 | dev_info(info->dev, "suspend\n"); |
815 | 821 | ||
816 | acquire_console_sem(); | 822 | acquire_console_sem(); |
817 | mutex_lock(&(par->open_lock)); | 823 | mutex_lock(&(par->open_lock)); |
@@ -842,7 +848,7 @@ static int vt8623_pci_resume(struct pci_dev* dev) | |||
842 | struct fb_info *info = pci_get_drvdata(dev); | 848 | struct fb_info *info = pci_get_drvdata(dev); |
843 | struct vt8623fb_info *par = info->par; | 849 | struct vt8623fb_info *par = info->par; |
844 | 850 | ||
845 | dev_info(&(dev->dev), "resume\n"); | 851 | dev_info(info->dev, "resume\n"); |
846 | 852 | ||
847 | acquire_console_sem(); | 853 | acquire_console_sem(); |
848 | mutex_lock(&(par->open_lock)); | 854 | mutex_lock(&(par->open_lock)); |
@@ -913,7 +919,7 @@ static int __init vt8623fb_init(void) | |||
913 | return -ENODEV; | 919 | return -ENODEV; |
914 | 920 | ||
915 | if (option && *option) | 921 | if (option && *option) |
916 | mode = option; | 922 | mode_option = option; |
917 | #endif | 923 | #endif |
918 | 924 | ||
919 | pr_debug("vt8623fb: initializing\n"); | 925 | pr_debug("vt8623fb: initializing\n"); |
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c index 003c49a490eb..30469bf906e5 100644 --- a/drivers/video/w100fb.c +++ b/drivers/video/w100fb.c | |||
@@ -765,8 +765,10 @@ int __init w100fb_probe(struct platform_device *pdev) | |||
765 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); | 765 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); |
766 | return 0; | 766 | return 0; |
767 | out: | 767 | out: |
768 | fb_dealloc_cmap(&info->cmap); | 768 | if (info) { |
769 | kfree(info->pseudo_palette); | 769 | fb_dealloc_cmap(&info->cmap); |
770 | kfree(info->pseudo_palette); | ||
771 | } | ||
770 | if (remapped_fbuf != NULL) | 772 | if (remapped_fbuf != NULL) |
771 | iounmap(remapped_fbuf); | 773 | iounmap(remapped_fbuf); |
772 | if (remapped_regs != NULL) | 774 | if (remapped_regs != NULL) |