aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-01-06 04:27:34 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-01-06 04:27:34 -0500
commit1928e87bcf185f56008d0746f887b691c1cb8c4a (patch)
treebc8db9e9cb40b73742d05e2e68189bd647687249 /drivers
parentca9c20ce2b383032b71bdae9ec0b468d428ca8d4 (diff)
parent3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/video/sh_mobile_lcdcfb.c Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpica/evgpeinit.c3
-rw-r--r--drivers/acpi/battery.c5
-rw-r--r--drivers/acpi/scan.c97
-rw-r--r--drivers/ata/Kconfig22
-rw-r--r--drivers/ata/Makefile2
-rw-r--r--drivers/ata/libata-core.c24
-rw-r--r--drivers/ata/libata-eh.c17
-rw-r--r--drivers/ata/libata-sff.c7
-rw-r--r--drivers/ata/pata_cs5536.c20
-rw-r--r--drivers/atm/atmtcp.c5
-rw-r--r--drivers/bluetooth/hci_ldisc.c6
-rw-r--r--drivers/char/agp/intel-gtt.c11
-rw-r--r--drivers/char/ramoops.c12
-rw-r--r--drivers/dma/mv_xor.c2
-rw-r--r--drivers/gpio/cs5535-gpio.c19
-rw-r--r--drivers/gpio/gpiolib.c3
-rw-r--r--drivers/gpio/rdc321x-gpio.c2
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c7
-rw-r--r--drivers/gpu/drm/i915/dvo_ch7017.c2
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c23
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h10
-rw-r--r--drivers/gpu/drm/i915/intel_display.c21
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c37
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c19
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h5
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c12
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c7
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c27
-rw-r--r--drivers/gpu/drm/radeon/evergreend.h1
-rw-r--r--drivers/gpu/drm/radeon/r600.c10
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c19
-rw-r--r--drivers/gpu/drm/radeon/radeon_fb.c2
-rw-r--r--drivers/hwmon/s3c-hwmon.c2
-rw-r--r--drivers/isdn/gigaset/capi.c1
-rw-r--r--drivers/leds/led-class.c2
-rw-r--r--drivers/media/IR/keymaps/rc-rc6-mce.c21
-rw-r--r--drivers/media/IR/lirc_dev.c29
-rw-r--r--drivers/media/IR/mceusb.c174
-rw-r--r--drivers/media/IR/nuvoton-cir.c10
-rw-r--r--drivers/media/IR/streamzap.c21
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c19
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c99
-rw-r--r--drivers/media/video/cx88/cx88-cards.c7
-rw-r--r--drivers/media/video/cx88/cx88-video.c27
-rw-r--r--drivers/media/video/cx88/cx88.h6
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c2
-rw-r--r--drivers/media/video/mx2_camera.c2
-rw-r--r--drivers/media/video/s5p-fimc/fimc-capture.c51
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.c54
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.h24
-rw-r--r--drivers/media/video/s5p-fimc/regs-fimc.h3
-rw-r--r--drivers/media/video/sh_mobile_ceu_camera.c2
-rw-r--r--drivers/media/video/soc_camera.c4
-rw-r--r--drivers/media/video/wm8775.c104
-rw-r--r--drivers/mfd/ab8500-core.c2
-rw-r--r--drivers/mfd/wm831x-core.c8
-rw-r--r--drivers/mmc/core/core.c1
-rw-r--r--drivers/mmc/host/at91_mci.c13
-rw-r--r--drivers/mmc/host/atmel-mci.c18
-rw-r--r--drivers/net/atl1c/atl1c_main.c39
-rw-r--r--drivers/net/atlx/atl1.c10
-rw-r--r--drivers/net/benet/be.h2
-rw-r--r--drivers/net/benet/be_cmds.c75
-rw-r--r--drivers/net/benet/be_main.c2
-rw-r--r--drivers/net/bonding/bond_ipv6.c7
-rw-r--r--drivers/net/bonding/bond_main.c42
-rw-r--r--drivers/net/bonding/bonding.h4
-rw-r--r--drivers/net/cnic.c10
-rw-r--r--drivers/net/ehea/ehea_ethtool.c7
-rw-r--r--drivers/net/epic100.c4
-rw-r--r--drivers/net/hamachi.c4
-rw-r--r--drivers/net/pcmcia/axnet_cs.c1
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c1
-rw-r--r--drivers/net/ppp_generic.c9
-rw-r--r--drivers/net/skfp/skfddi.c2
-rw-r--r--drivers/net/starfire.c2
-rw-r--r--drivers/net/sundance.c4
-rw-r--r--drivers/net/tehuti.c4
-rw-r--r--drivers/net/tg3.c2
-rw-r--r--drivers/net/typhoon.c1
-rw-r--r--drivers/net/usb/asix.c4
-rw-r--r--drivers/net/usb/mcs7830.c14
-rw-r--r--drivers/net/veth.c4
-rw-r--r--drivers/net/wireless/hostap/hostap_main.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c88
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.h25
-rw-r--r--drivers/net/wireless/libertas/cfg.c2
-rw-r--r--drivers/net/wireless/p54/p54usb.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c9
-rw-r--r--drivers/net/yellowfin.c4
-rw-r--r--drivers/of/of_i2c.c2
-rw-r--r--drivers/pci/hotplug/pciehp_acpi.c3
-rw-r--r--drivers/platform/x86/intel_ips.c36
-rw-r--r--drivers/platform/x86/intel_ips.h21
-rw-r--r--drivers/rtc/rtc-rs5c372.c2
-rw-r--r--drivers/scsi/bfa/bfa_fcs.c4
-rw-r--r--drivers/scsi/bfa/bfa_fcs_fcpim.c6
-rw-r--r--drivers/scsi/bfa/bfa_fcs_lport.c10
-rw-r--r--drivers/scsi/bfa/bfa_fcs_rport.c6
-rw-r--r--drivers/scsi/bfa/bfa_ioc.c8
-rw-r--r--drivers/scsi/bfa/bfa_svc.c28
-rw-r--r--drivers/scsi/bfa/bfad.c8
-rw-r--r--drivers/scsi/bfa/bfad_drv.h2
-rw-r--r--drivers/scsi/bfa/bfad_im.c21
-rw-r--r--drivers/sh/intc/core.c1
-rw-r--r--drivers/spi/coldfire_qspi.c2
-rw-r--r--drivers/spi/mpc52xx_spi.c2
-rw-r--r--drivers/spi/omap2_mcspi.c39
-rw-r--r--drivers/spi/spi.c3
-rw-r--r--drivers/spi/spi_fsl_espi.c35
-rw-r--r--drivers/staging/zram/zram_drv.c6
-rw-r--r--drivers/usb/atm/ueagle-atm.c22
-rw-r--r--drivers/video/backlight/cr_bllcd.c1
-rw-r--r--drivers/video/fbmem.c2
-rw-r--r--drivers/video/sh_mobile_hdmi.c16
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c4
-rw-r--r--drivers/watchdog/rdc321x_wdt.c2
125 files changed, 1193 insertions, 694 deletions
diff --git a/drivers/acpi/acpica/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c
index 2c7def95f721..4c8dea513b66 100644
--- a/drivers/acpi/acpica/evgpeinit.c
+++ b/drivers/acpi/acpica/evgpeinit.c
@@ -408,6 +408,9 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle,
408 return_ACPI_STATUS(AE_OK); 408 return_ACPI_STATUS(AE_OK);
409 } 409 }
410 410
411 /* Disable the GPE in case it's been enabled already. */
412 (void)acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE);
413
411 /* 414 /*
412 * Add the GPE information from above to the gpe_event_info block for 415 * Add the GPE information from above to the gpe_event_info block for
413 * use during dispatch of this GPE. 416 * use during dispatch of this GPE.
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 9fb9d5ac939d..95649d373071 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -130,8 +130,6 @@ struct acpi_battery {
130 unsigned long flags; 130 unsigned long flags;
131}; 131};
132 132
133static int acpi_battery_update(struct acpi_battery *battery);
134
135#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); 133#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
136 134
137inline int acpi_battery_present(struct acpi_battery *battery) 135inline int acpi_battery_present(struct acpi_battery *battery)
@@ -186,9 +184,6 @@ static int acpi_battery_get_property(struct power_supply *psy,
186 int ret = 0; 184 int ret = 0;
187 struct acpi_battery *battery = to_acpi_battery(psy); 185 struct acpi_battery *battery = to_acpi_battery(psy);
188 186
189 if (acpi_battery_update(battery))
190 return -ENODEV;
191
192 if (acpi_battery_present(battery)) { 187 if (acpi_battery_present(battery)) {
193 /* run battery update only if it is present */ 188 /* run battery update only if it is present */
194 acpi_battery_get_state(battery); 189 acpi_battery_get_state(battery);
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 2b6c21d86b98..29ef505c487b 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -705,54 +705,85 @@ static int acpi_bus_get_perf_flags(struct acpi_device *device)
705} 705}
706 706
707static acpi_status 707static acpi_status
708acpi_bus_extract_wakeup_device_power_package(struct acpi_device *device, 708acpi_bus_extract_wakeup_device_power_package(acpi_handle handle,
709 union acpi_object *package) 709 struct acpi_device_wakeup *wakeup)
710{ 710{
711 int i = 0; 711 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
712 union acpi_object *package = NULL;
712 union acpi_object *element = NULL; 713 union acpi_object *element = NULL;
714 acpi_status status;
715 int i = 0;
713 716
714 if (!device || !package || (package->package.count < 2)) 717 if (!wakeup)
715 return AE_BAD_PARAMETER; 718 return AE_BAD_PARAMETER;
716 719
720 /* _PRW */
721 status = acpi_evaluate_object(handle, "_PRW", NULL, &buffer);
722 if (ACPI_FAILURE(status)) {
723 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRW"));
724 return status;
725 }
726
727 package = (union acpi_object *)buffer.pointer;
728
729 if (!package || (package->package.count < 2)) {
730 status = AE_BAD_DATA;
731 goto out;
732 }
733
717 element = &(package->package.elements[0]); 734 element = &(package->package.elements[0]);
718 if (!element) 735 if (!element) {
719 return AE_BAD_PARAMETER; 736 status = AE_BAD_DATA;
737 goto out;
738 }
720 if (element->type == ACPI_TYPE_PACKAGE) { 739 if (element->type == ACPI_TYPE_PACKAGE) {
721 if ((element->package.count < 2) || 740 if ((element->package.count < 2) ||
722 (element->package.elements[0].type != 741 (element->package.elements[0].type !=
723 ACPI_TYPE_LOCAL_REFERENCE) 742 ACPI_TYPE_LOCAL_REFERENCE)
724 || (element->package.elements[1].type != ACPI_TYPE_INTEGER)) 743 || (element->package.elements[1].type != ACPI_TYPE_INTEGER)) {
725 return AE_BAD_DATA; 744 status = AE_BAD_DATA;
726 device->wakeup.gpe_device = 745 goto out;
746 }
747 wakeup->gpe_device =
727 element->package.elements[0].reference.handle; 748 element->package.elements[0].reference.handle;
728 device->wakeup.gpe_number = 749 wakeup->gpe_number =
729 (u32) element->package.elements[1].integer.value; 750 (u32) element->package.elements[1].integer.value;
730 } else if (element->type == ACPI_TYPE_INTEGER) { 751 } else if (element->type == ACPI_TYPE_INTEGER) {
731 device->wakeup.gpe_number = element->integer.value; 752 wakeup->gpe_device = NULL;
732 } else 753 wakeup->gpe_number = element->integer.value;
733 return AE_BAD_DATA; 754 } else {
755 status = AE_BAD_DATA;
756 goto out;
757 }
734 758
735 element = &(package->package.elements[1]); 759 element = &(package->package.elements[1]);
736 if (element->type != ACPI_TYPE_INTEGER) { 760 if (element->type != ACPI_TYPE_INTEGER) {
737 return AE_BAD_DATA; 761 status = AE_BAD_DATA;
762 goto out;
738 } 763 }
739 device->wakeup.sleep_state = element->integer.value; 764 wakeup->sleep_state = element->integer.value;
740 765
741 if ((package->package.count - 2) > ACPI_MAX_HANDLES) { 766 if ((package->package.count - 2) > ACPI_MAX_HANDLES) {
742 return AE_NO_MEMORY; 767 status = AE_NO_MEMORY;
768 goto out;
743 } 769 }
744 device->wakeup.resources.count = package->package.count - 2; 770 wakeup->resources.count = package->package.count - 2;
745 for (i = 0; i < device->wakeup.resources.count; i++) { 771 for (i = 0; i < wakeup->resources.count; i++) {
746 element = &(package->package.elements[i + 2]); 772 element = &(package->package.elements[i + 2]);
747 if (element->type != ACPI_TYPE_LOCAL_REFERENCE) 773 if (element->type != ACPI_TYPE_LOCAL_REFERENCE) {
748 return AE_BAD_DATA; 774 status = AE_BAD_DATA;
775 goto out;
776 }
749 777
750 device->wakeup.resources.handles[i] = element->reference.handle; 778 wakeup->resources.handles[i] = element->reference.handle;
751 } 779 }
752 780
753 acpi_gpe_can_wake(device->wakeup.gpe_device, device->wakeup.gpe_number); 781 acpi_gpe_can_wake(wakeup->gpe_device, wakeup->gpe_number);
754 782
755 return AE_OK; 783 out:
784 kfree(buffer.pointer);
785
786 return status;
756} 787}
757 788
758static void acpi_bus_set_run_wake_flags(struct acpi_device *device) 789static void acpi_bus_set_run_wake_flags(struct acpi_device *device)
@@ -787,26 +818,15 @@ static void acpi_bus_set_run_wake_flags(struct acpi_device *device)
787static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) 818static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
788{ 819{
789 acpi_status status = 0; 820 acpi_status status = 0;
790 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
791 union acpi_object *package = NULL;
792 int psw_error; 821 int psw_error;
793 822
794 /* _PRW */ 823 status = acpi_bus_extract_wakeup_device_power_package(device->handle,
795 status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); 824 &device->wakeup);
796 if (ACPI_FAILURE(status)) {
797 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRW"));
798 goto end;
799 }
800
801 package = (union acpi_object *)buffer.pointer;
802 status = acpi_bus_extract_wakeup_device_power_package(device, package);
803 if (ACPI_FAILURE(status)) { 825 if (ACPI_FAILURE(status)) {
804 ACPI_EXCEPTION((AE_INFO, status, "Extracting _PRW package")); 826 ACPI_EXCEPTION((AE_INFO, status, "Extracting _PRW package"));
805 goto end; 827 goto end;
806 } 828 }
807 829
808 kfree(buffer.pointer);
809
810 device->wakeup.flags.valid = 1; 830 device->wakeup.flags.valid = 1;
811 device->wakeup.prepare_count = 0; 831 device->wakeup.prepare_count = 0;
812 acpi_bus_set_run_wake_flags(device); 832 acpi_bus_set_run_wake_flags(device);
@@ -1351,6 +1371,7 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl,
1351 struct acpi_bus_ops *ops = context; 1371 struct acpi_bus_ops *ops = context;
1352 int type; 1372 int type;
1353 unsigned long long sta; 1373 unsigned long long sta;
1374 struct acpi_device_wakeup wakeup;
1354 struct acpi_device *device; 1375 struct acpi_device *device;
1355 acpi_status status; 1376 acpi_status status;
1356 int result; 1377 int result;
@@ -1360,8 +1381,10 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl,
1360 return AE_OK; 1381 return AE_OK;
1361 1382
1362 if (!(sta & ACPI_STA_DEVICE_PRESENT) && 1383 if (!(sta & ACPI_STA_DEVICE_PRESENT) &&
1363 !(sta & ACPI_STA_DEVICE_FUNCTIONING)) 1384 !(sta & ACPI_STA_DEVICE_FUNCTIONING)) {
1385 acpi_bus_extract_wakeup_device_power_package(handle, &wakeup);
1364 return AE_CTRL_DEPTH; 1386 return AE_CTRL_DEPTH;
1387 }
1365 1388
1366 /* 1389 /*
1367 * We may already have an acpi_device from a previous enumeration. If 1390 * We may already have an acpi_device from a previous enumeration. If
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 11ec911016c6..36e2319264bd 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -128,16 +128,6 @@ config PDC_ADMA
128 128
129 If unsure, say N. 129 If unsure, say N.
130 130
131config PATA_MPC52xx
132 tristate "Freescale MPC52xx SoC internal IDE"
133 depends on PPC_MPC52xx && PPC_BESTCOMM
134 select PPC_BESTCOMM_ATA
135 help
136 This option enables support for integrated IDE controller
137 of the Freescale MPC52xx SoC.
138
139 If unsure, say N.
140
141config PATA_OCTEON_CF 131config PATA_OCTEON_CF
142 tristate "OCTEON Boot Bus Compact Flash support" 132 tristate "OCTEON Boot Bus Compact Flash support"
143 depends on CPU_CAVIUM_OCTEON 133 depends on CPU_CAVIUM_OCTEON
@@ -366,7 +356,7 @@ config PATA_CS5535
366 356
367config PATA_CS5536 357config PATA_CS5536
368 tristate "CS5536 PATA support" 358 tristate "CS5536 PATA support"
369 depends on PCI && X86 && !X86_64 359 depends on PCI
370 help 360 help
371 This option enables support for the AMD CS5536 361 This option enables support for the AMD CS5536
372 companion chip used with the Geode LX processor family. 362 companion chip used with the Geode LX processor family.
@@ -491,6 +481,16 @@ config PATA_MARVELL
491 481
492 If unsure, say N. 482 If unsure, say N.
493 483
484config PATA_MPC52xx
485 tristate "Freescale MPC52xx SoC internal IDE"
486 depends on PPC_MPC52xx && PPC_BESTCOMM
487 select PPC_BESTCOMM_ATA
488 help
489 This option enables support for integrated IDE controller
490 of the Freescale MPC52xx SoC.
491
492 If unsure, say N.
493
494config PATA_NETCELL 494config PATA_NETCELL
495 tristate "NETCELL Revolution RAID support" 495 tristate "NETCELL Revolution RAID support"
496 depends on PCI 496 depends on PCI
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index c501af5b12b9..2b67c900a459 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -11,7 +11,6 @@ obj-$(CONFIG_SATA_DWC) += sata_dwc_460ex.o
11 11
12# SFF w/ custom DMA 12# SFF w/ custom DMA
13obj-$(CONFIG_PDC_ADMA) += pdc_adma.o 13obj-$(CONFIG_PDC_ADMA) += pdc_adma.o
14obj-$(CONFIG_PATA_MPC52xx) += pata_mpc52xx.o
15obj-$(CONFIG_PATA_OCTEON_CF) += pata_octeon_cf.o 14obj-$(CONFIG_PATA_OCTEON_CF) += pata_octeon_cf.o
16obj-$(CONFIG_SATA_QSTOR) += sata_qstor.o 15obj-$(CONFIG_SATA_QSTOR) += sata_qstor.o
17obj-$(CONFIG_SATA_SX4) += sata_sx4.o 16obj-$(CONFIG_SATA_SX4) += sata_sx4.o
@@ -52,6 +51,7 @@ obj-$(CONFIG_PATA_IT821X) += pata_it821x.o
52obj-$(CONFIG_PATA_JMICRON) += pata_jmicron.o 51obj-$(CONFIG_PATA_JMICRON) += pata_jmicron.o
53obj-$(CONFIG_PATA_MACIO) += pata_macio.o 52obj-$(CONFIG_PATA_MACIO) += pata_macio.o
54obj-$(CONFIG_PATA_MARVELL) += pata_marvell.o 53obj-$(CONFIG_PATA_MARVELL) += pata_marvell.o
54obj-$(CONFIG_PATA_MPC52xx) += pata_mpc52xx.o
55obj-$(CONFIG_PATA_NETCELL) += pata_netcell.o 55obj-$(CONFIG_PATA_NETCELL) += pata_netcell.o
56obj-$(CONFIG_PATA_NINJA32) += pata_ninja32.o 56obj-$(CONFIG_PATA_NINJA32) += pata_ninja32.o
57obj-$(CONFIG_PATA_NS87415) += pata_ns87415.o 57obj-$(CONFIG_PATA_NS87415) += pata_ns87415.o
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 7f77c67d267c..f23d6d46b95b 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4807,9 +4807,6 @@ static void ata_verify_xfer(struct ata_queued_cmd *qc)
4807{ 4807{
4808 struct ata_device *dev = qc->dev; 4808 struct ata_device *dev = qc->dev;
4809 4809
4810 if (ata_tag_internal(qc->tag))
4811 return;
4812
4813 if (ata_is_nodata(qc->tf.protocol)) 4810 if (ata_is_nodata(qc->tf.protocol))
4814 return; 4811 return;
4815 4812
@@ -4858,14 +4855,23 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
4858 if (unlikely(qc->err_mask)) 4855 if (unlikely(qc->err_mask))
4859 qc->flags |= ATA_QCFLAG_FAILED; 4856 qc->flags |= ATA_QCFLAG_FAILED;
4860 4857
4861 if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) { 4858 /*
4862 /* always fill result TF for failed qc */ 4859 * Finish internal commands without any further processing
4860 * and always with the result TF filled.
4861 */
4862 if (unlikely(ata_tag_internal(qc->tag))) {
4863 fill_result_tf(qc); 4863 fill_result_tf(qc);
4864 __ata_qc_complete(qc);
4865 return;
4866 }
4864 4867
4865 if (!ata_tag_internal(qc->tag)) 4868 /*
4866 ata_qc_schedule_eh(qc); 4869 * Non-internal qc has failed. Fill the result TF and
4867 else 4870 * summon EH.
4868 __ata_qc_complete(qc); 4871 */
4872 if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) {
4873 fill_result_tf(qc);
4874 ata_qc_schedule_eh(qc);
4869 return; 4875 return;
4870 } 4876 }
4871 4877
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 5e590504f3aa..17a637877d03 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -3275,6 +3275,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3275 struct ata_port *ap = ata_is_host_link(link) ? link->ap : NULL; 3275 struct ata_port *ap = ata_is_host_link(link) ? link->ap : NULL;
3276 struct ata_eh_context *ehc = &link->eh_context; 3276 struct ata_eh_context *ehc = &link->eh_context;
3277 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; 3277 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL;
3278 enum ata_lpm_policy old_policy = link->lpm_policy;
3278 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; 3279 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM;
3279 unsigned int err_mask; 3280 unsigned int err_mask;
3280 int rc; 3281 int rc;
@@ -3338,6 +3339,14 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3338 goto fail; 3339 goto fail;
3339 } 3340 }
3340 3341
3342 /*
3343 * Low level driver acked the transition. Issue DIPM command
3344 * with the new policy set.
3345 */
3346 link->lpm_policy = policy;
3347 if (ap && ap->slave_link)
3348 ap->slave_link->lpm_policy = policy;
3349
3341 /* host config updated, enable DIPM if transitioning to MIN_POWER */ 3350 /* host config updated, enable DIPM if transitioning to MIN_POWER */
3342 ata_for_each_dev(dev, link, ENABLED) { 3351 ata_for_each_dev(dev, link, ENABLED) {
3343 if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) { 3352 if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) {
@@ -3353,12 +3362,14 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3353 } 3362 }
3354 } 3363 }
3355 3364
3356 link->lpm_policy = policy;
3357 if (ap && ap->slave_link)
3358 ap->slave_link->lpm_policy = policy;
3359 return 0; 3365 return 0;
3360 3366
3361fail: 3367fail:
3368 /* restore the old policy */
3369 link->lpm_policy = old_policy;
3370 if (ap && ap->slave_link)
3371 ap->slave_link->lpm_policy = old_policy;
3372
3362 /* if no device or only one more chance is left, disable LPM */ 3373 /* if no device or only one more chance is left, disable LPM */
3363 if (!dev || ehc->tries[dev->devno] <= 2) { 3374 if (!dev || ehc->tries[dev->devno] <= 2) {
3364 ata_link_printk(link, KERN_WARNING, 3375 ata_link_printk(link, KERN_WARNING,
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index d05387d1e14b..484697fef386 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1532,11 +1532,10 @@ static unsigned int __ata_sff_port_intr(struct ata_port *ap,
1532 if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) 1532 if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR))
1533 return ata_sff_idle_irq(ap); 1533 return ata_sff_idle_irq(ap);
1534 break; 1534 break;
1535 case HSM_ST: 1535 case HSM_ST_IDLE:
1536 case HSM_ST_LAST:
1537 break;
1538 default:
1539 return ata_sff_idle_irq(ap); 1536 return ata_sff_idle_irq(ap);
1537 default:
1538 break;
1540 } 1539 }
1541 1540
1542 /* check main status, clearing INTRQ if needed */ 1541 /* check main status, clearing INTRQ if needed */
diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c
index 21ee23f89e88..628c8fae5937 100644
--- a/drivers/ata/pata_cs5536.c
+++ b/drivers/ata/pata_cs5536.c
@@ -37,10 +37,22 @@
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/libata.h> 38#include <linux/libata.h>
39#include <scsi/scsi_host.h> 39#include <scsi/scsi_host.h>
40
41#ifdef CONFIG_X86_32
40#include <asm/msr.h> 42#include <asm/msr.h>
43static int use_msr;
44module_param_named(msr, use_msr, int, 0644);
45MODULE_PARM_DESC(msr, "Force using MSR to configure IDE function (Default: 0)");
46#else
47#undef rdmsr /* avoid accidental MSR usage on, e.g. x86-64 */
48#undef wrmsr
49#define rdmsr(x, y, z) do { } while (0)
50#define wrmsr(x, y, z) do { } while (0)
51#define use_msr 0
52#endif
41 53
42#define DRV_NAME "pata_cs5536" 54#define DRV_NAME "pata_cs5536"
43#define DRV_VERSION "0.0.7" 55#define DRV_VERSION "0.0.8"
44 56
45enum { 57enum {
46 CFG = 0, 58 CFG = 0,
@@ -75,8 +87,6 @@ enum {
75 IDE_ETC_NODMA = 0x03, 87 IDE_ETC_NODMA = 0x03,
76}; 88};
77 89
78static int use_msr;
79
80static const u32 msr_reg[4] = { 90static const u32 msr_reg[4] = {
81 MSR_IDE_CFG, MSR_IDE_DTC, MSR_IDE_CAST, MSR_IDE_ETC, 91 MSR_IDE_CFG, MSR_IDE_DTC, MSR_IDE_CAST, MSR_IDE_ETC,
82}; 92};
@@ -88,7 +98,7 @@ static const u8 pci_reg[4] = {
88static inline int cs5536_read(struct pci_dev *pdev, int reg, u32 *val) 98static inline int cs5536_read(struct pci_dev *pdev, int reg, u32 *val)
89{ 99{
90 if (unlikely(use_msr)) { 100 if (unlikely(use_msr)) {
91 u32 dummy; 101 u32 dummy __maybe_unused;
92 102
93 rdmsr(msr_reg[reg], *val, dummy); 103 rdmsr(msr_reg[reg], *val, dummy);
94 return 0; 104 return 0;
@@ -294,8 +304,6 @@ MODULE_DESCRIPTION("low-level driver for the CS5536 IDE controller");
294MODULE_LICENSE("GPL"); 304MODULE_LICENSE("GPL");
295MODULE_DEVICE_TABLE(pci, cs5536); 305MODULE_DEVICE_TABLE(pci, cs5536);
296MODULE_VERSION(DRV_VERSION); 306MODULE_VERSION(DRV_VERSION);
297module_param_named(msr, use_msr, int, 0644);
298MODULE_PARM_DESC(msr, "Force using MSR to configure IDE function (Default: 0)");
299 307
300module_init(cs5536_init); 308module_init(cs5536_init);
301module_exit(cs5536_exit); 309module_exit(cs5536_exit);
diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index 2b464b631f22..0b0625054a87 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -392,7 +392,10 @@ static int atmtcp_attach(struct atm_vcc *vcc,int itf)
392 atm_dev_put(dev); 392 atm_dev_put(dev);
393 return -EMEDIUMTYPE; 393 return -EMEDIUMTYPE;
394 } 394 }
395 if (PRIV(dev)->vcc) return -EBUSY; 395 if (PRIV(dev)->vcc) {
396 atm_dev_put(dev);
397 return -EBUSY;
398 }
396 } 399 }
397 else { 400 else {
398 int error; 401 int error;
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 720148294e64..3c6cabcb7d84 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -311,8 +311,10 @@ static void hci_uart_tty_close(struct tty_struct *tty)
311 311
312 if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { 312 if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) {
313 hu->proto->close(hu); 313 hu->proto->close(hu);
314 hci_unregister_dev(hdev); 314 if (hdev) {
315 hci_free_dev(hdev); 315 hci_unregister_dev(hdev);
316 hci_free_dev(hdev);
317 }
316 } 318 }
317 } 319 }
318} 320}
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 16a2847b7cdb..29ac6d499fa6 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -1192,12 +1192,19 @@ static void i9xx_chipset_flush(void)
1192 writel(1, intel_private.i9xx_flush_page); 1192 writel(1, intel_private.i9xx_flush_page);
1193} 1193}
1194 1194
1195static void i965_write_entry(dma_addr_t addr, unsigned int entry, 1195static void i965_write_entry(dma_addr_t addr,
1196 unsigned int entry,
1196 unsigned int flags) 1197 unsigned int flags)
1197{ 1198{
1199 u32 pte_flags;
1200
1201 pte_flags = I810_PTE_VALID;
1202 if (flags == AGP_USER_CACHED_MEMORY)
1203 pte_flags |= I830_PTE_SYSTEM_CACHED;
1204
1198 /* Shift high bits down */ 1205 /* Shift high bits down */
1199 addr |= (addr >> 28) & 0xf0; 1206 addr |= (addr >> 28) & 0xf0;
1200 writel(addr | I810_PTE_VALID, intel_private.gtt + entry); 1207 writel(addr | pte_flags, intel_private.gtt + entry);
1201} 1208}
1202 1209
1203static bool gen6_check_flags(unsigned int flags) 1210static bool gen6_check_flags(unsigned int flags)
diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
index 73dcb0ee41fd..d3d63be2cd37 100644
--- a/drivers/char/ramoops.c
+++ b/drivers/char/ramoops.c
@@ -29,7 +29,6 @@
29#include <linux/ramoops.h> 29#include <linux/ramoops.h>
30 30
31#define RAMOOPS_KERNMSG_HDR "====" 31#define RAMOOPS_KERNMSG_HDR "===="
32#define RAMOOPS_HEADER_SIZE (5 + sizeof(struct timeval))
33 32
34#define RECORD_SIZE 4096 33#define RECORD_SIZE 4096
35 34
@@ -65,8 +64,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
65 struct ramoops_context, dump); 64 struct ramoops_context, dump);
66 unsigned long s1_start, s2_start; 65 unsigned long s1_start, s2_start;
67 unsigned long l1_cpy, l2_cpy; 66 unsigned long l1_cpy, l2_cpy;
68 int res; 67 int res, hdr_size;
69 char *buf; 68 char *buf, *buf_orig;
70 struct timeval timestamp; 69 struct timeval timestamp;
71 70
72 /* Only dump oopses if dump_oops is set */ 71 /* Only dump oopses if dump_oops is set */
@@ -74,6 +73,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
74 return; 73 return;
75 74
76 buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE)); 75 buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE));
76 buf_orig = buf;
77
77 memset(buf, '\0', RECORD_SIZE); 78 memset(buf, '\0', RECORD_SIZE);
78 res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR); 79 res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR);
79 buf += res; 80 buf += res;
@@ -81,8 +82,9 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
81 res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec); 82 res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec);
82 buf += res; 83 buf += res;
83 84
84 l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE)); 85 hdr_size = buf - buf_orig;
85 l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE) - l2_cpy); 86 l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - hdr_size));
87 l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - hdr_size) - l2_cpy);
86 88
87 s2_start = l2 - l2_cpy; 89 s2_start = l2 - l2_cpy;
88 s1_start = l1 - l1_cpy; 90 s1_start = l1 - l1_cpy;
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 411d5bf50fc4..a25f5f61e0e0 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -449,7 +449,7 @@ mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan)
449static void mv_xor_tasklet(unsigned long data) 449static void mv_xor_tasklet(unsigned long data)
450{ 450{
451 struct mv_xor_chan *chan = (struct mv_xor_chan *) data; 451 struct mv_xor_chan *chan = (struct mv_xor_chan *) data;
452 __mv_xor_slot_cleanup(chan); 452 mv_xor_slot_cleanup(chan);
453} 453}
454 454
455static struct mv_xor_desc_slot * 455static struct mv_xor_desc_slot *
diff --git a/drivers/gpio/cs5535-gpio.c b/drivers/gpio/cs5535-gpio.c
index 599f6c9e0fbf..d3e55a0ae92b 100644
--- a/drivers/gpio/cs5535-gpio.c
+++ b/drivers/gpio/cs5535-gpio.c
@@ -56,15 +56,26 @@ static struct cs5535_gpio_chip {
56 * registers, see include/linux/cs5535.h. 56 * registers, see include/linux/cs5535.h.
57 */ 57 */
58 58
59static void errata_outl(u32 val, unsigned long addr) 59static void errata_outl(struct cs5535_gpio_chip *chip, u32 val,
60 unsigned int reg)
60{ 61{
62 unsigned long addr = chip->base + 0x80 + reg;
63
61 /* 64 /*
62 * According to the CS5536 errata (#36), after suspend 65 * According to the CS5536 errata (#36), after suspend
63 * a write to the high bank GPIO register will clear all 66 * a write to the high bank GPIO register will clear all
64 * non-selected bits; the recommended workaround is a 67 * non-selected bits; the recommended workaround is a
65 * read-modify-write operation. 68 * read-modify-write operation.
69 *
70 * Don't apply this errata to the edge status GPIOs, as writing
71 * to their lower bits will clear them.
66 */ 72 */
67 val |= inl(addr); 73 if (reg != GPIO_POSITIVE_EDGE_STS && reg != GPIO_NEGATIVE_EDGE_STS) {
74 if (val & 0xffff)
75 val |= (inl(addr) & 0xffff); /* ignore the high bits */
76 else
77 val |= (inl(addr) ^ (val >> 16));
78 }
68 outl(val, addr); 79 outl(val, addr);
69} 80}
70 81
@@ -76,7 +87,7 @@ static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset,
76 outl(1 << offset, chip->base + reg); 87 outl(1 << offset, chip->base + reg);
77 else 88 else
78 /* high bank register */ 89 /* high bank register */
79 errata_outl(1 << (offset - 16), chip->base + 0x80 + reg); 90 errata_outl(chip, 1 << (offset - 16), reg);
80} 91}
81 92
82void cs5535_gpio_set(unsigned offset, unsigned int reg) 93void cs5535_gpio_set(unsigned offset, unsigned int reg)
@@ -98,7 +109,7 @@ static void __cs5535_gpio_clear(struct cs5535_gpio_chip *chip, unsigned offset,
98 outl(1 << (offset + 16), chip->base + reg); 109 outl(1 << (offset + 16), chip->base + reg);
99 else 110 else
100 /* high bank register */ 111 /* high bank register */
101 errata_outl(1 << offset, chip->base + 0x80 + reg); 112 errata_outl(chip, 1 << offset, reg);
102} 113}
103 114
104void cs5535_gpio_clear(unsigned offset, unsigned int reg) 115void cs5535_gpio_clear(unsigned offset, unsigned int reg)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 21da9c19a0cb..649550e2cae9 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1281,6 +1281,9 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
1281 err = gpio_direction_output(gpio, 1281 err = gpio_direction_output(gpio,
1282 (flags & GPIOF_INIT_HIGH) ? 1 : 0); 1282 (flags & GPIOF_INIT_HIGH) ? 1 : 0);
1283 1283
1284 if (err)
1285 gpio_free(gpio);
1286
1284 return err; 1287 return err;
1285} 1288}
1286EXPORT_SYMBOL_GPL(gpio_request_one); 1289EXPORT_SYMBOL_GPL(gpio_request_one);
diff --git a/drivers/gpio/rdc321x-gpio.c b/drivers/gpio/rdc321x-gpio.c
index 2762698e0204..897e0577e65e 100644
--- a/drivers/gpio/rdc321x-gpio.c
+++ b/drivers/gpio/rdc321x-gpio.c
@@ -135,7 +135,7 @@ static int __devinit rdc321x_gpio_probe(struct platform_device *pdev)
135 struct rdc321x_gpio *rdc321x_gpio_dev; 135 struct rdc321x_gpio *rdc321x_gpio_dev;
136 struct rdc321x_gpio_pdata *pdata; 136 struct rdc321x_gpio_pdata *pdata;
137 137
138 pdata = pdev->dev.platform_data; 138 pdata = platform_get_drvdata(pdev);
139 if (!pdata) { 139 if (!pdata) {
140 dev_err(&pdev->dev, "no platform data supplied\n"); 140 dev_err(&pdev->dev, "no platform data supplied\n");
141 return -ENODEV; 141 return -ENODEV;
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index bede10a03407..2d4e17a004db 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -241,7 +241,7 @@ void drm_helper_disable_unused_functions(struct drm_device *dev)
241 } 241 }
242 242
243 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { 243 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
244 if (encoder->crtc && !drm_helper_encoder_in_use(encoder)) { 244 if (!drm_helper_encoder_in_use(encoder)) {
245 drm_encoder_disable(encoder); 245 drm_encoder_disable(encoder);
246 /* disconnector encoder from any connector */ 246 /* disconnector encoder from any connector */
247 encoder->crtc = NULL; 247 encoder->crtc = NULL;
@@ -874,7 +874,10 @@ static void output_poll_execute(struct work_struct *work)
874 continue; 874 continue;
875 875
876 connector->status = connector->funcs->detect(connector, false); 876 connector->status = connector->funcs->detect(connector, false);
877 DRM_DEBUG_KMS("connector status updated to %d\n", connector->status); 877 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
878 connector->base.id,
879 drm_get_connector_name(connector),
880 old_status, connector->status);
878 if (old_status != connector->status) 881 if (old_status != connector->status)
879 changed = true; 882 changed = true;
880 } 883 }
diff --git a/drivers/gpu/drm/i915/dvo_ch7017.c b/drivers/gpu/drm/i915/dvo_ch7017.c
index af70337567ce..d3e8c540f778 100644
--- a/drivers/gpu/drm/i915/dvo_ch7017.c
+++ b/drivers/gpu/drm/i915/dvo_ch7017.c
@@ -242,7 +242,7 @@ fail:
242 242
243static enum drm_connector_status ch7017_detect(struct intel_dvo_device *dvo) 243static enum drm_connector_status ch7017_detect(struct intel_dvo_device *dvo)
244{ 244{
245 return connector_status_unknown; 245 return connector_status_connected;
246} 246}
247 247
248static enum drm_mode_status ch7017_mode_valid(struct intel_dvo_device *dvo, 248static enum drm_mode_status ch7017_mode_valid(struct intel_dvo_device *dvo,
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index e6800819bca8..cb900dc83d95 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -34,6 +34,7 @@
34#include "i915_drm.h" 34#include "i915_drm.h"
35#include "i915_drv.h" 35#include "i915_drv.h"
36#include "i915_trace.h" 36#include "i915_trace.h"
37#include "../../../platform/x86/intel_ips.h"
37#include <linux/pci.h> 38#include <linux/pci.h>
38#include <linux/vgaarb.h> 39#include <linux/vgaarb.h>
39#include <linux/acpi.h> 40#include <linux/acpi.h>
@@ -1871,6 +1872,26 @@ out_unlock:
1871EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable); 1872EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable);
1872 1873
1873/** 1874/**
1875 * Tells the intel_ips driver that the i915 driver is now loaded, if
1876 * IPS got loaded first.
1877 *
1878 * This awkward dance is so that neither module has to depend on the
1879 * other in order for IPS to do the appropriate communication of
1880 * GPU turbo limits to i915.
1881 */
1882static void
1883ips_ping_for_i915_load(void)
1884{
1885 void (*link)(void);
1886
1887 link = symbol_get(ips_link_to_i915_driver);
1888 if (link) {
1889 link();
1890 symbol_put(ips_link_to_i915_driver);
1891 }
1892}
1893
1894/**
1874 * i915_driver_load - setup chip and create an initial config 1895 * i915_driver_load - setup chip and create an initial config
1875 * @dev: DRM device 1896 * @dev: DRM device
1876 * @flags: startup flags 1897 * @flags: startup flags
@@ -2075,6 +2096,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
2075 dev_priv->mchdev_lock = &mchdev_lock; 2096 dev_priv->mchdev_lock = &mchdev_lock;
2076 spin_unlock(&mchdev_lock); 2097 spin_unlock(&mchdev_lock);
2077 2098
2099 ips_ping_for_i915_load();
2100
2078 return 0; 2101 return 0;
2079 2102
2080out_workqueue_free: 2103out_workqueue_free:
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 878fc766a12c..cb8f43429279 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2471,6 +2471,9 @@
2471# define MARIUNIT_CLOCK_GATE_DISABLE (1 << 18) 2471# define MARIUNIT_CLOCK_GATE_DISABLE (1 << 18)
2472# define SVSMUNIT_CLOCK_GATE_DISABLE (1 << 1) 2472# define SVSMUNIT_CLOCK_GATE_DISABLE (1 << 1)
2473 2473
2474#define PCH_3DCGDIS1 0x46024
2475# define VFMUNIT_CLOCK_GATE_DISABLE (1 << 11)
2476
2474#define FDI_PLL_FREQ_CTL 0x46030 2477#define FDI_PLL_FREQ_CTL 0x46030
2475#define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24) 2478#define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24)
2476#define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00 2479#define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00
@@ -2588,6 +2591,13 @@
2588#define ILK_DISPLAY_CHICKEN2 0x42004 2591#define ILK_DISPLAY_CHICKEN2 0x42004
2589#define ILK_DPARB_GATE (1<<22) 2592#define ILK_DPARB_GATE (1<<22)
2590#define ILK_VSDPFD_FULL (1<<21) 2593#define ILK_VSDPFD_FULL (1<<21)
2594#define ILK_DISPLAY_CHICKEN_FUSES 0x42014
2595#define ILK_INTERNAL_GRAPHICS_DISABLE (1<<31)
2596#define ILK_INTERNAL_DISPLAY_DISABLE (1<<30)
2597#define ILK_DISPLAY_DEBUG_DISABLE (1<<29)
2598#define ILK_HDCP_DISABLE (1<<25)
2599#define ILK_eDP_A_DISABLE (1<<24)
2600#define ILK_DESKTOP (1<<23)
2591#define ILK_DSPCLK_GATE 0x42020 2601#define ILK_DSPCLK_GATE 0x42020
2592#define ILK_DPARB_CLK_GATE (1<<5) 2602#define ILK_DPARB_CLK_GATE (1<<5)
2593/* According to spec this bit 7/8/9 of 0x42020 should be set to enable FBC */ 2603/* According to spec this bit 7/8/9 of 0x42020 should be set to enable FBC */
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index d9b7092439ef..fca523288aca 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5379,6 +5379,23 @@ static int intel_encoder_clones(struct drm_device *dev, int type_mask)
5379 return index_mask; 5379 return index_mask;
5380} 5380}
5381 5381
5382static bool has_edp_a(struct drm_device *dev)
5383{
5384 struct drm_i915_private *dev_priv = dev->dev_private;
5385
5386 if (!IS_MOBILE(dev))
5387 return false;
5388
5389 if ((I915_READ(DP_A) & DP_DETECTED) == 0)
5390 return false;
5391
5392 if (IS_GEN5(dev) &&
5393 (I915_READ(ILK_DISPLAY_CHICKEN_FUSES) & ILK_eDP_A_DISABLE))
5394 return false;
5395
5396 return true;
5397}
5398
5382static void intel_setup_outputs(struct drm_device *dev) 5399static void intel_setup_outputs(struct drm_device *dev)
5383{ 5400{
5384 struct drm_i915_private *dev_priv = dev->dev_private; 5401 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -5396,7 +5413,7 @@ static void intel_setup_outputs(struct drm_device *dev)
5396 if (HAS_PCH_SPLIT(dev)) { 5413 if (HAS_PCH_SPLIT(dev)) {
5397 dpd_is_edp = intel_dpd_is_edp(dev); 5414 dpd_is_edp = intel_dpd_is_edp(dev);
5398 5415
5399 if (IS_MOBILE(dev) && (I915_READ(DP_A) & DP_DETECTED)) 5416 if (has_edp_a(dev))
5400 intel_dp_init(dev, DP_A); 5417 intel_dp_init(dev, DP_A);
5401 5418
5402 if (dpd_is_edp && (I915_READ(PCH_DP_D) & DP_DETECTED)) 5419 if (dpd_is_edp && (I915_READ(PCH_DP_D) & DP_DETECTED))
@@ -5825,6 +5842,8 @@ void intel_init_clock_gating(struct drm_device *dev)
5825 I915_WRITE(PCH_3DCGDIS0, 5842 I915_WRITE(PCH_3DCGDIS0,
5826 MARIUNIT_CLOCK_GATE_DISABLE | 5843 MARIUNIT_CLOCK_GATE_DISABLE |
5827 SVSMUNIT_CLOCK_GATE_DISABLE); 5844 SVSMUNIT_CLOCK_GATE_DISABLE);
5845 I915_WRITE(PCH_3DCGDIS1,
5846 VFMUNIT_CLOCK_GATE_DISABLE);
5828 } 5847 }
5829 5848
5830 I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate); 5849 I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index df648cb4c296..864417cffe9a 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -479,6 +479,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
479 uint16_t address = algo_data->address; 479 uint16_t address = algo_data->address;
480 uint8_t msg[5]; 480 uint8_t msg[5];
481 uint8_t reply[2]; 481 uint8_t reply[2];
482 unsigned retry;
482 int msg_bytes; 483 int msg_bytes;
483 int reply_bytes; 484 int reply_bytes;
484 int ret; 485 int ret;
@@ -513,14 +514,33 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
513 break; 514 break;
514 } 515 }
515 516
516 for (;;) { 517 for (retry = 0; retry < 5; retry++) {
517 ret = intel_dp_aux_ch(intel_dp, 518 ret = intel_dp_aux_ch(intel_dp,
518 msg, msg_bytes, 519 msg, msg_bytes,
519 reply, reply_bytes); 520 reply, reply_bytes);
520 if (ret < 0) { 521 if (ret < 0) {
521 DRM_DEBUG_KMS("aux_ch failed %d\n", ret); 522 DRM_DEBUG_KMS("aux_ch failed %d\n", ret);
522 return ret; 523 return ret;
523 } 524 }
525
526 switch (reply[0] & AUX_NATIVE_REPLY_MASK) {
527 case AUX_NATIVE_REPLY_ACK:
528 /* I2C-over-AUX Reply field is only valid
529 * when paired with AUX ACK.
530 */
531 break;
532 case AUX_NATIVE_REPLY_NACK:
533 DRM_DEBUG_KMS("aux_ch native nack\n");
534 return -EREMOTEIO;
535 case AUX_NATIVE_REPLY_DEFER:
536 udelay(100);
537 continue;
538 default:
539 DRM_ERROR("aux_ch invalid native reply 0x%02x\n",
540 reply[0]);
541 return -EREMOTEIO;
542 }
543
524 switch (reply[0] & AUX_I2C_REPLY_MASK) { 544 switch (reply[0] & AUX_I2C_REPLY_MASK) {
525 case AUX_I2C_REPLY_ACK: 545 case AUX_I2C_REPLY_ACK:
526 if (mode == MODE_I2C_READ) { 546 if (mode == MODE_I2C_READ) {
@@ -528,17 +548,20 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
528 } 548 }
529 return reply_bytes - 1; 549 return reply_bytes - 1;
530 case AUX_I2C_REPLY_NACK: 550 case AUX_I2C_REPLY_NACK:
531 DRM_DEBUG_KMS("aux_ch nack\n"); 551 DRM_DEBUG_KMS("aux_i2c nack\n");
532 return -EREMOTEIO; 552 return -EREMOTEIO;
533 case AUX_I2C_REPLY_DEFER: 553 case AUX_I2C_REPLY_DEFER:
534 DRM_DEBUG_KMS("aux_ch defer\n"); 554 DRM_DEBUG_KMS("aux_i2c defer\n");
535 udelay(100); 555 udelay(100);
536 break; 556 break;
537 default: 557 default:
538 DRM_ERROR("aux_ch invalid reply 0x%02x\n", reply[0]); 558 DRM_ERROR("aux_i2c invalid reply 0x%02x\n", reply[0]);
539 return -EREMOTEIO; 559 return -EREMOTEIO;
540 } 560 }
541 } 561 }
562
563 DRM_ERROR("too many retries, giving up\n");
564 return -EREMOTEIO;
542} 565}
543 566
544static int 567static int
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 89a65be8a3f3..31cd7e33e820 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -696,20 +696,17 @@ int intel_wait_ring_buffer(struct drm_device *dev,
696 drm_i915_private_t *dev_priv = dev->dev_private; 696 drm_i915_private_t *dev_priv = dev->dev_private;
697 u32 head; 697 u32 head;
698 698
699 head = intel_read_status_page(ring, 4);
700 if (head) {
701 ring->head = head & HEAD_ADDR;
702 ring->space = ring->head - (ring->tail + 8);
703 if (ring->space < 0)
704 ring->space += ring->size;
705 if (ring->space >= n)
706 return 0;
707 }
708
709 trace_i915_ring_wait_begin (dev); 699 trace_i915_ring_wait_begin (dev);
710 end = jiffies + 3 * HZ; 700 end = jiffies + 3 * HZ;
711 do { 701 do {
712 ring->head = I915_READ_HEAD(ring) & HEAD_ADDR; 702 /* If the reported head position has wrapped or hasn't advanced,
703 * fallback to the slow and accurate path.
704 */
705 head = intel_read_status_page(ring, 4);
706 if (head < ring->actual_head)
707 head = I915_READ_HEAD(ring);
708 ring->actual_head = head;
709 ring->head = head & HEAD_ADDR;
713 ring->space = ring->head - (ring->tail + 8); 710 ring->space = ring->head - (ring->tail + 8);
714 if (ring->space < 0) 711 if (ring->space < 0)
715 ring->space += ring->size; 712 ring->space += ring->size;
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 3126c2681983..d2cd0f1efeed 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -30,8 +30,9 @@ struct intel_ring_buffer {
30 struct drm_device *dev; 30 struct drm_device *dev;
31 struct drm_gem_object *gem_object; 31 struct drm_gem_object *gem_object;
32 32
33 unsigned int head; 33 u32 actual_head;
34 unsigned int tail; 34 u32 head;
35 u32 tail;
35 int space; 36 int space;
36 struct intel_hw_status_page status_page; 37 struct intel_hw_status_page status_page;
37 38
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index d97e6cb52d34..6bc42fa2a6ec 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1908,9 +1908,12 @@ intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv,
1908 speed = mapping->i2c_speed; 1908 speed = mapping->i2c_speed;
1909 } 1909 }
1910 1910
1911 sdvo->i2c = &dev_priv->gmbus[pin].adapter; 1911 if (pin < GMBUS_NUM_PORTS) {
1912 intel_gmbus_set_speed(sdvo->i2c, speed); 1912 sdvo->i2c = &dev_priv->gmbus[pin].adapter;
1913 intel_gmbus_force_bit(sdvo->i2c, true); 1913 intel_gmbus_set_speed(sdvo->i2c, speed);
1914 intel_gmbus_force_bit(sdvo->i2c, true);
1915 } else
1916 sdvo->i2c = &dev_priv->gmbus[GMBUS_PORT_DPB].adapter;
1914} 1917}
1915 1918
1916static bool 1919static bool
@@ -2037,13 +2040,14 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
2037 SDVO_COLORIMETRY_RGB256); 2040 SDVO_COLORIMETRY_RGB256);
2038 connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; 2041 connector->connector_type = DRM_MODE_CONNECTOR_HDMIA;
2039 2042
2040 intel_sdvo_add_hdmi_properties(intel_sdvo_connector);
2041 intel_sdvo->is_hdmi = true; 2043 intel_sdvo->is_hdmi = true;
2042 } 2044 }
2043 intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) | 2045 intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
2044 (1 << INTEL_ANALOG_CLONE_BIT)); 2046 (1 << INTEL_ANALOG_CLONE_BIT));
2045 2047
2046 intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); 2048 intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo);
2049 if (intel_sdvo->is_hdmi)
2050 intel_sdvo_add_hdmi_properties(intel_sdvo_connector);
2047 2051
2048 return true; 2052 return true;
2049} 2053}
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index df2b6f2b35f8..9fbabaa6ee44 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -253,7 +253,8 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
253 case DRM_MODE_DPMS_SUSPEND: 253 case DRM_MODE_DPMS_SUSPEND:
254 case DRM_MODE_DPMS_OFF: 254 case DRM_MODE_DPMS_OFF:
255 drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id); 255 drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id);
256 atombios_blank_crtc(crtc, ATOM_ENABLE); 256 if (radeon_crtc->enabled)
257 atombios_blank_crtc(crtc, ATOM_ENABLE);
257 if (ASIC_IS_DCE3(rdev)) 258 if (ASIC_IS_DCE3(rdev))
258 atombios_enable_crtc_memreq(crtc, ATOM_DISABLE); 259 atombios_enable_crtc_memreq(crtc, ATOM_DISABLE);
259 atombios_enable_crtc(crtc, ATOM_DISABLE); 260 atombios_enable_crtc(crtc, ATOM_DISABLE);
@@ -530,7 +531,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
530 dp_clock = dig_connector->dp_clock; 531 dp_clock = dig_connector->dp_clock;
531 } 532 }
532 } 533 }
533 534#if 0 /* doesn't work properly on some laptops */
534 /* use recommended ref_div for ss */ 535 /* use recommended ref_div for ss */
535 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { 536 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
536 if (ss_enabled) { 537 if (ss_enabled) {
@@ -540,7 +541,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
540 } 541 }
541 } 542 }
542 } 543 }
543 544#endif
544 if (ASIC_IS_AVIVO(rdev)) { 545 if (ASIC_IS_AVIVO(rdev)) {
545 /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */ 546 /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */
546 if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1) 547 if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1)
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 4dc5b4714c5a..7b337c361a12 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -748,6 +748,8 @@ void evergreen_pcie_gart_tlb_flush(struct radeon_device *rdev)
748 unsigned i; 748 unsigned i;
749 u32 tmp; 749 u32 tmp;
750 750
751 WREG32(HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1);
752
751 WREG32(VM_CONTEXT0_REQUEST_RESPONSE, REQUEST_TYPE(1)); 753 WREG32(VM_CONTEXT0_REQUEST_RESPONSE, REQUEST_TYPE(1));
752 for (i = 0; i < rdev->usec_timeout; i++) { 754 for (i = 0; i < rdev->usec_timeout; i++) {
753 /* read MC_STATUS */ 755 /* read MC_STATUS */
@@ -1922,7 +1924,6 @@ bool evergreen_gpu_is_lockup(struct radeon_device *rdev)
1922static int evergreen_gpu_soft_reset(struct radeon_device *rdev) 1924static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1923{ 1925{
1924 struct evergreen_mc_save save; 1926 struct evergreen_mc_save save;
1925 u32 srbm_reset = 0;
1926 u32 grbm_reset = 0; 1927 u32 grbm_reset = 0;
1927 1928
1928 dev_info(rdev->dev, "GPU softreset \n"); 1929 dev_info(rdev->dev, "GPU softreset \n");
@@ -1961,16 +1962,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1961 udelay(50); 1962 udelay(50);
1962 WREG32(GRBM_SOFT_RESET, 0); 1963 WREG32(GRBM_SOFT_RESET, 0);
1963 (void)RREG32(GRBM_SOFT_RESET); 1964 (void)RREG32(GRBM_SOFT_RESET);
1964
1965 /* reset all the system blocks */
1966 srbm_reset = SRBM_SOFT_RESET_ALL_MASK;
1967
1968 dev_info(rdev->dev, " SRBM_SOFT_RESET=0x%08X\n", srbm_reset);
1969 WREG32(SRBM_SOFT_RESET, srbm_reset);
1970 (void)RREG32(SRBM_SOFT_RESET);
1971 udelay(50);
1972 WREG32(SRBM_SOFT_RESET, 0);
1973 (void)RREG32(SRBM_SOFT_RESET);
1974 /* Wait a little for things to settle down */ 1965 /* Wait a little for things to settle down */
1975 udelay(50); 1966 udelay(50);
1976 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", 1967 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n",
@@ -1981,10 +1972,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1981 RREG32(GRBM_STATUS_SE1)); 1972 RREG32(GRBM_STATUS_SE1));
1982 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", 1973 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n",
1983 RREG32(SRBM_STATUS)); 1974 RREG32(SRBM_STATUS));
1984 /* After reset we need to reinit the asic as GPU often endup in an
1985 * incoherent state.
1986 */
1987 atom_asic_init(rdev->mode_info.atom_context);
1988 evergreen_mc_resume(rdev, &save); 1975 evergreen_mc_resume(rdev, &save);
1989 return 0; 1976 return 0;
1990} 1977}
@@ -2596,6 +2583,11 @@ int evergreen_resume(struct radeon_device *rdev)
2596{ 2583{
2597 int r; 2584 int r;
2598 2585
2586 /* reset the asic, the gfx blocks are often in a bad state
2587 * after the driver is unloaded or after a resume
2588 */
2589 if (radeon_asic_reset(rdev))
2590 dev_warn(rdev->dev, "GPU reset failed !\n");
2599 /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw, 2591 /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw,
2600 * posting will perform necessary task to bring back GPU into good 2592 * posting will perform necessary task to bring back GPU into good
2601 * shape. 2593 * shape.
@@ -2712,6 +2704,11 @@ int evergreen_init(struct radeon_device *rdev)
2712 r = radeon_atombios_init(rdev); 2704 r = radeon_atombios_init(rdev);
2713 if (r) 2705 if (r)
2714 return r; 2706 return r;
2707 /* reset the asic, the gfx blocks are often in a bad state
2708 * after the driver is unloaded or after a resume
2709 */
2710 if (radeon_asic_reset(rdev))
2711 dev_warn(rdev->dev, "GPU reset failed !\n");
2715 /* Post card if necessary */ 2712 /* Post card if necessary */
2716 if (!evergreen_card_posted(rdev)) { 2713 if (!evergreen_card_posted(rdev)) {
2717 if (!rdev->bios) { 2714 if (!rdev->bios) {
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index 113c70cc8b39..a73b53c44359 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -174,6 +174,7 @@
174#define HDP_NONSURFACE_BASE 0x2C04 174#define HDP_NONSURFACE_BASE 0x2C04
175#define HDP_NONSURFACE_INFO 0x2C08 175#define HDP_NONSURFACE_INFO 0x2C08
176#define HDP_NONSURFACE_SIZE 0x2C0C 176#define HDP_NONSURFACE_SIZE 0x2C0C
177#define HDP_MEM_COHERENCY_FLUSH_CNTL 0x5480
177#define HDP_REG_COHERENCY_FLUSH_CNTL 0x54A0 178#define HDP_REG_COHERENCY_FLUSH_CNTL 0x54A0
178#define HDP_TILING_CONFIG 0x2F3C 179#define HDP_TILING_CONFIG 0x2F3C
179 180
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 4d7a2e1bdb90..9c92db7c896b 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1342,13 +1342,19 @@ bool r600_gpu_is_lockup(struct radeon_device *rdev)
1342 u32 srbm_status; 1342 u32 srbm_status;
1343 u32 grbm_status; 1343 u32 grbm_status;
1344 u32 grbm_status2; 1344 u32 grbm_status2;
1345 struct r100_gpu_lockup *lockup;
1345 int r; 1346 int r;
1346 1347
1348 if (rdev->family >= CHIP_RV770)
1349 lockup = &rdev->config.rv770.lockup;
1350 else
1351 lockup = &rdev->config.r600.lockup;
1352
1347 srbm_status = RREG32(R_000E50_SRBM_STATUS); 1353 srbm_status = RREG32(R_000E50_SRBM_STATUS);
1348 grbm_status = RREG32(R_008010_GRBM_STATUS); 1354 grbm_status = RREG32(R_008010_GRBM_STATUS);
1349 grbm_status2 = RREG32(R_008014_GRBM_STATUS2); 1355 grbm_status2 = RREG32(R_008014_GRBM_STATUS2);
1350 if (!G_008010_GUI_ACTIVE(grbm_status)) { 1356 if (!G_008010_GUI_ACTIVE(grbm_status)) {
1351 r100_gpu_lockup_update(&rdev->config.r300.lockup, &rdev->cp); 1357 r100_gpu_lockup_update(lockup, &rdev->cp);
1352 return false; 1358 return false;
1353 } 1359 }
1354 /* force CP activities */ 1360 /* force CP activities */
@@ -1360,7 +1366,7 @@ bool r600_gpu_is_lockup(struct radeon_device *rdev)
1360 radeon_ring_unlock_commit(rdev); 1366 radeon_ring_unlock_commit(rdev);
1361 } 1367 }
1362 rdev->cp.rptr = RREG32(R600_CP_RB_RPTR); 1368 rdev->cp.rptr = RREG32(R600_CP_RB_RPTR);
1363 return r100_gpu_cp_is_lockup(rdev, &rdev->config.r300.lockup, &rdev->cp); 1369 return r100_gpu_cp_is_lockup(rdev, lockup, &rdev->cp);
1364} 1370}
1365 1371
1366int r600_asic_reset(struct radeon_device *rdev) 1372int r600_asic_reset(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 0f90fc3482ce..7831e0890210 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -315,11 +315,10 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)
315 if (array_mode == V_0280A0_ARRAY_LINEAR_GENERAL) { 315 if (array_mode == V_0280A0_ARRAY_LINEAR_GENERAL) {
316 /* the initial DDX does bad things with the CB size occasionally */ 316 /* the initial DDX does bad things with the CB size occasionally */
317 /* it rounds up height too far for slice tile max but the BO is smaller */ 317 /* it rounds up height too far for slice tile max but the BO is smaller */
318 tmp = (height - 7) * 8 * bpe; 318 /* r600c,g also seem to flush at bad times in some apps resulting in
319 if ((tmp + track->cb_color_bo_offset[i]) > radeon_bo_size(track->cb_color_bo[i])) { 319 * bogus values here. So for linear just allow anything to avoid breaking
320 dev_warn(p->dev, "%s offset[%d] %d %d %lu too big\n", __func__, i, track->cb_color_bo_offset[i], tmp, radeon_bo_size(track->cb_color_bo[i])); 320 * broken userspace.
321 return -EINVAL; 321 */
322 }
323 } else { 322 } else {
324 dev_warn(p->dev, "%s offset[%d] %d %d %lu too big\n", __func__, i, track->cb_color_bo_offset[i], tmp, radeon_bo_size(track->cb_color_bo[i])); 323 dev_warn(p->dev, "%s offset[%d] %d %d %lu too big\n", __func__, i, track->cb_color_bo_offset[i], tmp, radeon_bo_size(track->cb_color_bo[i]));
325 return -EINVAL; 324 return -EINVAL;
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index e12e79326cb1..501966a13f48 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -910,11 +910,6 @@ int radeon_resume_kms(struct drm_device *dev)
910 radeon_pm_resume(rdev); 910 radeon_pm_resume(rdev);
911 radeon_restore_bios_scratch_regs(rdev); 911 radeon_restore_bios_scratch_regs(rdev);
912 912
913 /* turn on display hw */
914 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
915 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
916 }
917
918 radeon_fbdev_set_suspend(rdev, 0); 913 radeon_fbdev_set_suspend(rdev, 0);
919 release_console_sem(); 914 release_console_sem();
920 915
@@ -922,6 +917,10 @@ int radeon_resume_kms(struct drm_device *dev)
922 radeon_hpd_init(rdev); 917 radeon_hpd_init(rdev);
923 /* blat the mode back in */ 918 /* blat the mode back in */
924 drm_helper_resume_force_mode(dev); 919 drm_helper_resume_force_mode(dev);
920 /* turn on display hw */
921 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
922 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
923 }
925 return 0; 924 return 0;
926} 925}
927 926
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 88e4ea925900..60e689f2d048 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -232,9 +232,28 @@ static struct drm_driver driver_old = {
232 232
233static struct drm_driver kms_driver; 233static struct drm_driver kms_driver;
234 234
235static void radeon_kick_out_firmware_fb(struct pci_dev *pdev)
236{
237 struct apertures_struct *ap;
238 bool primary = false;
239
240 ap = alloc_apertures(1);
241 ap->ranges[0].base = pci_resource_start(pdev, 0);
242 ap->ranges[0].size = pci_resource_len(pdev, 0);
243
244#ifdef CONFIG_X86
245 primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
246#endif
247 remove_conflicting_framebuffers(ap, "radeondrmfb", primary);
248 kfree(ap);
249}
250
235static int __devinit 251static int __devinit
236radeon_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 252radeon_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
237{ 253{
254 /* Get rid of things like offb */
255 radeon_kick_out_firmware_fb(pdev);
256
238 return drm_get_pci_dev(pdev, ent, &kms_driver); 257 return drm_get_pci_dev(pdev, ent, &kms_driver);
239} 258}
240 259
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index efa211898fe6..6abea32be5e8 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -245,7 +245,7 @@ static int radeonfb_create(struct radeon_fbdev *rfbdev,
245 goto out_unref; 245 goto out_unref;
246 } 246 }
247 info->apertures->ranges[0].base = rdev->ddev->mode_config.fb_base; 247 info->apertures->ranges[0].base = rdev->ddev->mode_config.fb_base;
248 info->apertures->ranges[0].size = rdev->mc.real_vram_size; 248 info->apertures->ranges[0].size = rdev->mc.aper_size;
249 249
250 info->fix.mmio_start = 0; 250 info->fix.mmio_start = 0;
251 info->fix.mmio_len = 0; 251 info->fix.mmio_len = 0;
diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c
index 05248f2d7581..92b42db43bcf 100644
--- a/drivers/hwmon/s3c-hwmon.c
+++ b/drivers/hwmon/s3c-hwmon.c
@@ -234,7 +234,6 @@ static int s3c_hwmon_create_attr(struct device *dev,
234 attr->index = channel; 234 attr->index = channel;
235 attr->dev_attr.attr.name = attrs->in_name; 235 attr->dev_attr.attr.name = attrs->in_name;
236 attr->dev_attr.attr.mode = S_IRUGO; 236 attr->dev_attr.attr.mode = S_IRUGO;
237 attr->dev_attr.attr.owner = THIS_MODULE;
238 attr->dev_attr.show = s3c_hwmon_ch_show; 237 attr->dev_attr.show = s3c_hwmon_ch_show;
239 238
240 ret = device_create_file(dev, &attr->dev_attr); 239 ret = device_create_file(dev, &attr->dev_attr);
@@ -252,7 +251,6 @@ static int s3c_hwmon_create_attr(struct device *dev,
252 attr->index = channel; 251 attr->index = channel;
253 attr->dev_attr.attr.name = attrs->label_name; 252 attr->dev_attr.attr.name = attrs->label_name;
254 attr->dev_attr.attr.mode = S_IRUGO; 253 attr->dev_attr.attr.mode = S_IRUGO;
255 attr->dev_attr.attr.owner = THIS_MODULE;
256 attr->dev_attr.show = s3c_hwmon_label_show; 254 attr->dev_attr.show = s3c_hwmon_label_show;
257 255
258 ret = device_create_file(dev, &attr->dev_attr); 256 ret = device_create_file(dev, &attr->dev_attr);
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index bcc174e4f3b1..658e75f18d05 100644
--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -1900,6 +1900,7 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif,
1900 if (b3skb == NULL) { 1900 if (b3skb == NULL) {
1901 dev_err(cs->dev, "%s: out of memory\n", __func__); 1901 dev_err(cs->dev, "%s: out of memory\n", __func__);
1902 send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); 1902 send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR);
1903 kfree(b3cmsg);
1903 return; 1904 return;
1904 } 1905 }
1905 capi_cmsg2message(b3cmsg, 1906 capi_cmsg2message(b3cmsg,
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 211e21f34bd5..d5a4ade88991 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -267,7 +267,7 @@ void led_blink_set(struct led_classdev *led_cdev,
267 unsigned long *delay_off) 267 unsigned long *delay_off)
268{ 268{
269 if (led_cdev->blink_set && 269 if (led_cdev->blink_set &&
270 led_cdev->blink_set(led_cdev, delay_on, delay_off)) 270 !led_cdev->blink_set(led_cdev, delay_on, delay_off))
271 return; 271 return;
272 272
273 /* blink with 1 Hz as default if nothing specified */ 273 /* blink with 1 Hz as default if nothing specified */
diff --git a/drivers/media/IR/keymaps/rc-rc6-mce.c b/drivers/media/IR/keymaps/rc-rc6-mce.c
index 1b7adabbcee9..6da955dfef48 100644
--- a/drivers/media/IR/keymaps/rc-rc6-mce.c
+++ b/drivers/media/IR/keymaps/rc-rc6-mce.c
@@ -26,8 +26,8 @@ static struct ir_scancode rc6_mce[] = {
26 26
27 { 0x800f040a, KEY_DELETE }, 27 { 0x800f040a, KEY_DELETE },
28 { 0x800f040b, KEY_ENTER }, 28 { 0x800f040b, KEY_ENTER },
29 { 0x800f040c, KEY_POWER }, 29 { 0x800f040c, KEY_POWER }, /* PC Power */
30 { 0x800f040d, KEY_PROG1 }, /* Windows MCE button */ 30 { 0x800f040d, KEY_PROG1 }, /* Windows MCE button */
31 { 0x800f040e, KEY_MUTE }, 31 { 0x800f040e, KEY_MUTE },
32 { 0x800f040f, KEY_INFO }, 32 { 0x800f040f, KEY_INFO },
33 33
@@ -56,31 +56,32 @@ static struct ir_scancode rc6_mce[] = {
56 { 0x800f0422, KEY_OK }, 56 { 0x800f0422, KEY_OK },
57 { 0x800f0423, KEY_EXIT }, 57 { 0x800f0423, KEY_EXIT },
58 { 0x800f0424, KEY_DVD }, 58 { 0x800f0424, KEY_DVD },
59 { 0x800f0425, KEY_TUNER }, /* LiveTV */ 59 { 0x800f0425, KEY_TUNER }, /* LiveTV */
60 { 0x800f0426, KEY_EPG }, /* Guide */ 60 { 0x800f0426, KEY_EPG }, /* Guide */
61 { 0x800f0427, KEY_ZOOM }, /* Aspect */ 61 { 0x800f0427, KEY_ZOOM }, /* Aspect */
62 62
63 { 0x800f043a, KEY_BRIGHTNESSUP }, 63 { 0x800f043a, KEY_BRIGHTNESSUP },
64 64
65 { 0x800f0446, KEY_TV }, 65 { 0x800f0446, KEY_TV },
66 { 0x800f0447, KEY_AUDIO }, /* My Music */ 66 { 0x800f0447, KEY_AUDIO }, /* My Music */
67 { 0x800f0448, KEY_PVR }, /* RecordedTV */ 67 { 0x800f0448, KEY_PVR }, /* RecordedTV */
68 { 0x800f0449, KEY_CAMERA }, 68 { 0x800f0449, KEY_CAMERA },
69 { 0x800f044a, KEY_VIDEO }, 69 { 0x800f044a, KEY_VIDEO },
70 { 0x800f044c, KEY_LANGUAGE }, 70 { 0x800f044c, KEY_LANGUAGE },
71 { 0x800f044d, KEY_TITLE }, 71 { 0x800f044d, KEY_TITLE },
72 { 0x800f044e, KEY_PRINT }, /* Print - HP OEM version of remote */ 72 { 0x800f044e, KEY_PRINT }, /* Print - HP OEM version of remote */
73 73
74 { 0x800f0450, KEY_RADIO }, 74 { 0x800f0450, KEY_RADIO },
75 75
76 { 0x800f045a, KEY_SUBTITLE }, /* Caption/Teletext */ 76 { 0x800f045a, KEY_SUBTITLE }, /* Caption/Teletext */
77 { 0x800f045b, KEY_RED }, 77 { 0x800f045b, KEY_RED },
78 { 0x800f045c, KEY_GREEN }, 78 { 0x800f045c, KEY_GREEN },
79 { 0x800f045d, KEY_YELLOW }, 79 { 0x800f045d, KEY_YELLOW },
80 { 0x800f045e, KEY_BLUE }, 80 { 0x800f045e, KEY_BLUE },
81 81
82 { 0x800f0465, KEY_POWER2 }, /* TV Power */
82 { 0x800f046e, KEY_PLAYPAUSE }, 83 { 0x800f046e, KEY_PLAYPAUSE },
83 { 0x800f046f, KEY_MEDIA }, /* Start media application (NEW) */ 84 { 0x800f046f, KEY_MEDIA }, /* Start media application (NEW) */
84 85
85 { 0x800f0480, KEY_BRIGHTNESSDOWN }, 86 { 0x800f0480, KEY_BRIGHTNESSDOWN },
86 { 0x800f0481, KEY_PLAYPAUSE }, 87 { 0x800f0481, KEY_PLAYPAUSE },
diff --git a/drivers/media/IR/lirc_dev.c b/drivers/media/IR/lirc_dev.c
index 8418b14ee4d2..756656e17bdd 100644
--- a/drivers/media/IR/lirc_dev.c
+++ b/drivers/media/IR/lirc_dev.c
@@ -522,10 +522,8 @@ unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait)
522 522
523 dev_dbg(ir->d.dev, LOGHEAD "poll called\n", ir->d.name, ir->d.minor); 523 dev_dbg(ir->d.dev, LOGHEAD "poll called\n", ir->d.name, ir->d.minor);
524 524
525 if (!ir->attached) { 525 if (!ir->attached)
526 mutex_unlock(&ir->irctl_lock);
527 return POLLERR; 526 return POLLERR;
528 }
529 527
530 poll_wait(file, &ir->buf->wait_poll, wait); 528 poll_wait(file, &ir->buf->wait_poll, wait);
531 529
@@ -649,18 +647,18 @@ ssize_t lirc_dev_fop_read(struct file *file,
649 if (!buf) 647 if (!buf)
650 return -ENOMEM; 648 return -ENOMEM;
651 649
652 if (mutex_lock_interruptible(&ir->irctl_lock)) 650 if (mutex_lock_interruptible(&ir->irctl_lock)) {
653 return -ERESTARTSYS; 651 ret = -ERESTARTSYS;
652 goto out_unlocked;
653 }
654 if (!ir->attached) { 654 if (!ir->attached) {
655 mutex_unlock(&ir->irctl_lock); 655 ret = -ENODEV;
656 return -ENODEV; 656 goto out_locked;
657 } 657 }
658 658
659 if (length % ir->chunk_size) { 659 if (length % ir->chunk_size) {
660 dev_dbg(ir->d.dev, LOGHEAD "read result = -EINVAL\n", 660 ret = -EINVAL;
661 ir->d.name, ir->d.minor); 661 goto out_locked;
662 mutex_unlock(&ir->irctl_lock);
663 return -EINVAL;
664 } 662 }
665 663
666 /* 664 /*
@@ -711,18 +709,23 @@ ssize_t lirc_dev_fop_read(struct file *file,
711 lirc_buffer_read(ir->buf, buf); 709 lirc_buffer_read(ir->buf, buf);
712 ret = copy_to_user((void *)buffer+written, buf, 710 ret = copy_to_user((void *)buffer+written, buf,
713 ir->buf->chunk_size); 711 ir->buf->chunk_size);
714 written += ir->buf->chunk_size; 712 if (!ret)
713 written += ir->buf->chunk_size;
714 else
715 ret = -EFAULT;
715 } 716 }
716 } 717 }
717 718
718 remove_wait_queue(&ir->buf->wait_poll, &wait); 719 remove_wait_queue(&ir->buf->wait_poll, &wait);
719 set_current_state(TASK_RUNNING); 720 set_current_state(TASK_RUNNING);
721
722out_locked:
720 mutex_unlock(&ir->irctl_lock); 723 mutex_unlock(&ir->irctl_lock);
721 724
722out_unlocked: 725out_unlocked:
723 kfree(buf); 726 kfree(buf);
724 dev_dbg(ir->d.dev, LOGHEAD "read result = %s (%d)\n", 727 dev_dbg(ir->d.dev, LOGHEAD "read result = %s (%d)\n",
725 ir->d.name, ir->d.minor, ret ? "-EFAULT" : "OK", ret); 728 ir->d.name, ir->d.minor, ret ? "<fail>" : "<ok>", ret);
726 729
727 return ret ? ret : written; 730 return ret ? ret : written;
728} 731}
diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c
index 9dce684fd231..392ca24132da 100644
--- a/drivers/media/IR/mceusb.c
+++ b/drivers/media/IR/mceusb.c
@@ -35,10 +35,10 @@
35#include <linux/device.h> 35#include <linux/device.h>
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/usb.h>
39#include <linux/input.h> 38#include <linux/input.h>
39#include <linux/usb.h>
40#include <linux/usb/input.h>
40#include <media/ir-core.h> 41#include <media/ir-core.h>
41#include <media/ir-common.h>
42 42
43#define DRIVER_VERSION "1.91" 43#define DRIVER_VERSION "1.91"
44#define DRIVER_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" 44#define DRIVER_AUTHOR "Jarod Wilson <jarod@wilsonet.com>"
@@ -49,6 +49,7 @@
49#define USB_BUFLEN 32 /* USB reception buffer length */ 49#define USB_BUFLEN 32 /* USB reception buffer length */
50#define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */ 50#define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */
51#define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */ 51#define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */
52#define MS_TO_NS(msec) ((msec) * 1000)
52 53
53/* MCE constants */ 54/* MCE constants */
54#define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */ 55#define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */
@@ -74,6 +75,7 @@
74#define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */ 75#define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */
75 76
76/* Sub-commands, which follow MCE_COMMAND_HEADER or MCE_HW_CMD_HEADER */ 77/* Sub-commands, which follow MCE_COMMAND_HEADER or MCE_HW_CMD_HEADER */
78#define MCE_CMD_SIG_END 0x01 /* End of signal */
77#define MCE_CMD_PING 0x03 /* Ping device */ 79#define MCE_CMD_PING 0x03 /* Ping device */
78#define MCE_CMD_UNKNOWN 0x04 /* Unknown */ 80#define MCE_CMD_UNKNOWN 0x04 /* Unknown */
79#define MCE_CMD_UNKNOWN2 0x05 /* Unknown */ 81#define MCE_CMD_UNKNOWN2 0x05 /* Unknown */
@@ -91,6 +93,7 @@
91#define MCE_CMD_G_TXMASK 0x13 /* Set TX port bitmask */ 93#define MCE_CMD_G_TXMASK 0x13 /* Set TX port bitmask */
92#define MCE_CMD_S_RXSENSOR 0x14 /* Set RX sensor (std/learning) */ 94#define MCE_CMD_S_RXSENSOR 0x14 /* Set RX sensor (std/learning) */
93#define MCE_CMD_G_RXSENSOR 0x15 /* Get RX sensor (std/learning) */ 95#define MCE_CMD_G_RXSENSOR 0x15 /* Get RX sensor (std/learning) */
96#define MCE_RSP_PULSE_COUNT 0x15 /* RX pulse count (only if learning) */
94#define MCE_CMD_TX_PORTS 0x16 /* Get number of TX ports */ 97#define MCE_CMD_TX_PORTS 0x16 /* Get number of TX ports */
95#define MCE_CMD_G_WAKESRC 0x17 /* Get wake source */ 98#define MCE_CMD_G_WAKESRC 0x17 /* Get wake source */
96#define MCE_CMD_UNKNOWN7 0x18 /* Unknown */ 99#define MCE_CMD_UNKNOWN7 0x18 /* Unknown */
@@ -146,14 +149,16 @@ enum mceusb_model_type {
146 MCE_GEN3, 149 MCE_GEN3,
147 MCE_GEN2_TX_INV, 150 MCE_GEN2_TX_INV,
148 POLARIS_EVK, 151 POLARIS_EVK,
152 CX_HYBRID_TV,
149}; 153};
150 154
151struct mceusb_model { 155struct mceusb_model {
152 u32 mce_gen1:1; 156 u32 mce_gen1:1;
153 u32 mce_gen2:1; 157 u32 mce_gen2:1;
154 u32 mce_gen3:1; 158 u32 mce_gen3:1;
155 u32 tx_mask_inverted:1; 159 u32 tx_mask_normal:1;
156 u32 is_polaris:1; 160 u32 is_polaris:1;
161 u32 no_tx:1;
157 162
158 const char *rc_map; /* Allow specify a per-board map */ 163 const char *rc_map; /* Allow specify a per-board map */
159 const char *name; /* per-board name */ 164 const char *name; /* per-board name */
@@ -162,18 +167,18 @@ struct mceusb_model {
162static const struct mceusb_model mceusb_model[] = { 167static const struct mceusb_model mceusb_model[] = {
163 [MCE_GEN1] = { 168 [MCE_GEN1] = {
164 .mce_gen1 = 1, 169 .mce_gen1 = 1,
165 .tx_mask_inverted = 1, 170 .tx_mask_normal = 1,
166 }, 171 },
167 [MCE_GEN2] = { 172 [MCE_GEN2] = {
168 .mce_gen2 = 1, 173 .mce_gen2 = 1,
169 }, 174 },
170 [MCE_GEN2_TX_INV] = { 175 [MCE_GEN2_TX_INV] = {
171 .mce_gen2 = 1, 176 .mce_gen2 = 1,
172 .tx_mask_inverted = 1, 177 .tx_mask_normal = 1,
173 }, 178 },
174 [MCE_GEN3] = { 179 [MCE_GEN3] = {
175 .mce_gen3 = 1, 180 .mce_gen3 = 1,
176 .tx_mask_inverted = 1, 181 .tx_mask_normal = 1,
177 }, 182 },
178 [POLARIS_EVK] = { 183 [POLARIS_EVK] = {
179 .is_polaris = 1, 184 .is_polaris = 1,
@@ -183,7 +188,12 @@ static const struct mceusb_model mceusb_model[] = {
183 * to allow testing it 188 * to allow testing it
184 */ 189 */
185 .rc_map = RC_MAP_RC5_HAUPPAUGE_NEW, 190 .rc_map = RC_MAP_RC5_HAUPPAUGE_NEW,
186 .name = "cx231xx MCE IR", 191 .name = "Conexant Hybrid TV (cx231xx) MCE IR",
192 },
193 [CX_HYBRID_TV] = {
194 .is_polaris = 1,
195 .no_tx = 1, /* tx isn't wired up at all */
196 .name = "Conexant Hybrid TV (cx231xx) MCE IR",
187 }, 197 },
188}; 198};
189 199
@@ -273,6 +283,8 @@ static struct usb_device_id mceusb_dev_table[] = {
273 { USB_DEVICE(VENDOR_FORMOSA, 0xe03c) }, 283 { USB_DEVICE(VENDOR_FORMOSA, 0xe03c) },
274 /* Formosa Industrial Computing */ 284 /* Formosa Industrial Computing */
275 { USB_DEVICE(VENDOR_FORMOSA, 0xe03e) }, 285 { USB_DEVICE(VENDOR_FORMOSA, 0xe03e) },
286 /* Fintek eHome Infrared Transceiver (HP branded) */
287 { USB_DEVICE(VENDOR_FINTEK, 0x5168) },
276 /* Fintek eHome Infrared Transceiver */ 288 /* Fintek eHome Infrared Transceiver */
277 { USB_DEVICE(VENDOR_FINTEK, 0x0602) }, 289 { USB_DEVICE(VENDOR_FINTEK, 0x0602) },
278 /* Fintek eHome Infrared Transceiver (in the AOpen MP45) */ 290 /* Fintek eHome Infrared Transceiver (in the AOpen MP45) */
@@ -292,9 +304,12 @@ static struct usb_device_id mceusb_dev_table[] = {
292 { USB_DEVICE(VENDOR_NORTHSTAR, 0xe004) }, 304 { USB_DEVICE(VENDOR_NORTHSTAR, 0xe004) },
293 /* TiVo PC IR Receiver */ 305 /* TiVo PC IR Receiver */
294 { USB_DEVICE(VENDOR_TIVO, 0x2000) }, 306 { USB_DEVICE(VENDOR_TIVO, 0x2000) },
295 /* Conexant SDK */ 307 /* Conexant Hybrid TV "Shelby" Polaris SDK */
296 { USB_DEVICE(VENDOR_CONEXANT, 0x58a1), 308 { USB_DEVICE(VENDOR_CONEXANT, 0x58a1),
297 .driver_info = POLARIS_EVK }, 309 .driver_info = POLARIS_EVK },
310 /* Conexant Hybrid TV RDU253S Polaris */
311 { USB_DEVICE(VENDOR_CONEXANT, 0x58a5),
312 .driver_info = CX_HYBRID_TV },
298 /* Terminating entry */ 313 /* Terminating entry */
299 { } 314 { }
300}; 315};
@@ -303,7 +318,10 @@ static struct usb_device_id mceusb_dev_table[] = {
303struct mceusb_dev { 318struct mceusb_dev {
304 /* ir-core bits */ 319 /* ir-core bits */
305 struct ir_dev_props *props; 320 struct ir_dev_props *props;
306 struct ir_raw_event rawir; 321
322 /* optional features we can enable */
323 bool carrier_report_enabled;
324 bool learning_enabled;
307 325
308 /* core device bits */ 326 /* core device bits */
309 struct device *dev; 327 struct device *dev;
@@ -318,6 +336,8 @@ struct mceusb_dev {
318 /* buffers and dma */ 336 /* buffers and dma */
319 unsigned char *buf_in; 337 unsigned char *buf_in;
320 unsigned int len_in; 338 unsigned int len_in;
339 dma_addr_t dma_in;
340 dma_addr_t dma_out;
321 341
322 enum { 342 enum {
323 CMD_HEADER = 0, 343 CMD_HEADER = 0,
@@ -325,15 +345,14 @@ struct mceusb_dev {
325 CMD_DATA, 345 CMD_DATA,
326 PARSE_IRDATA, 346 PARSE_IRDATA,
327 } parser_state; 347 } parser_state;
328 u8 cmd, rem; /* Remaining IR data bytes in packet */
329 348
330 dma_addr_t dma_in; 349 u8 cmd, rem; /* Remaining IR data bytes in packet */
331 dma_addr_t dma_out;
332 350
333 struct { 351 struct {
334 u32 connected:1; 352 u32 connected:1;
335 u32 tx_mask_inverted:1; 353 u32 tx_mask_normal:1;
336 u32 microsoft_gen1:1; 354 u32 microsoft_gen1:1;
355 u32 no_tx:1;
337 } flags; 356 } flags;
338 357
339 /* transmit support */ 358 /* transmit support */
@@ -408,9 +427,10 @@ static int mceusb_cmdsize(u8 cmd, u8 subcmd)
408 case MCE_CMD_UNKNOWN: 427 case MCE_CMD_UNKNOWN:
409 case MCE_CMD_S_CARRIER: 428 case MCE_CMD_S_CARRIER:
410 case MCE_CMD_S_TIMEOUT: 429 case MCE_CMD_S_TIMEOUT:
411 case MCE_CMD_G_RXSENSOR: 430 case MCE_RSP_PULSE_COUNT:
412 datasize = 2; 431 datasize = 2;
413 break; 432 break;
433 case MCE_CMD_SIG_END:
414 case MCE_CMD_S_TXMASK: 434 case MCE_CMD_S_TXMASK:
415 case MCE_CMD_S_RXSENSOR: 435 case MCE_CMD_S_RXSENSOR:
416 datasize = 1; 436 datasize = 1;
@@ -433,7 +453,7 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
433 return; 453 return;
434 454
435 /* skip meaningless 0xb1 0x60 header bytes on orig receiver */ 455 /* skip meaningless 0xb1 0x60 header bytes on orig receiver */
436 if (ir->flags.microsoft_gen1 && !out) 456 if (ir->flags.microsoft_gen1 && !out && !offset)
437 skip = 2; 457 skip = 2;
438 458
439 if (len <= skip) 459 if (len <= skip)
@@ -491,6 +511,9 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
491 break; 511 break;
492 case MCE_COMMAND_HEADER: 512 case MCE_COMMAND_HEADER:
493 switch (subcmd) { 513 switch (subcmd) {
514 case MCE_CMD_SIG_END:
515 dev_info(dev, "End of signal\n");
516 break;
494 case MCE_CMD_PING: 517 case MCE_CMD_PING:
495 dev_info(dev, "Ping\n"); 518 dev_info(dev, "Ping\n");
496 break; 519 break;
@@ -525,10 +548,11 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
525 inout, data1 == 0x02 ? "short" : "long"); 548 inout, data1 == 0x02 ? "short" : "long");
526 break; 549 break;
527 case MCE_CMD_G_RXSENSOR: 550 case MCE_CMD_G_RXSENSOR:
528 if (len == 2) 551 /* aka MCE_RSP_PULSE_COUNT */
552 if (out)
529 dev_info(dev, "Get receive sensor\n"); 553 dev_info(dev, "Get receive sensor\n");
530 else 554 else if (ir->learning_enabled)
531 dev_info(dev, "Received pulse count is %d\n", 555 dev_info(dev, "RX pulse count: %d\n",
532 ((data1 << 8) | data2)); 556 ((data1 << 8) | data2));
533 break; 557 break;
534 case MCE_RSP_CMD_INVALID: 558 case MCE_RSP_CMD_INVALID:
@@ -724,16 +748,16 @@ out:
724 return ret ? ret : n; 748 return ret ? ret : n;
725} 749}
726 750
727/* Sets active IR outputs -- mce devices typically (all?) have two */ 751/* Sets active IR outputs -- mce devices typically have two */
728static int mceusb_set_tx_mask(void *priv, u32 mask) 752static int mceusb_set_tx_mask(void *priv, u32 mask)
729{ 753{
730 struct mceusb_dev *ir = priv; 754 struct mceusb_dev *ir = priv;
731 755
732 if (ir->flags.tx_mask_inverted) 756 if (ir->flags.tx_mask_normal)
757 ir->tx_mask = mask;
758 else
733 ir->tx_mask = (mask != MCE_DEFAULT_TX_MASK ? 759 ir->tx_mask = (mask != MCE_DEFAULT_TX_MASK ?
734 mask ^ MCE_DEFAULT_TX_MASK : mask) << 1; 760 mask ^ MCE_DEFAULT_TX_MASK : mask) << 1;
735 else
736 ir->tx_mask = mask;
737 761
738 return 0; 762 return 0;
739} 763}
@@ -752,7 +776,7 @@ static int mceusb_set_tx_carrier(void *priv, u32 carrier)
752 776
753 if (carrier == 0) { 777 if (carrier == 0) {
754 ir->carrier = carrier; 778 ir->carrier = carrier;
755 cmdbuf[2] = 0x01; 779 cmdbuf[2] = MCE_CMD_SIG_END;
756 cmdbuf[3] = MCE_IRDATA_TRAILER; 780 cmdbuf[3] = MCE_IRDATA_TRAILER;
757 dev_dbg(ir->dev, "%s: disabling carrier " 781 dev_dbg(ir->dev, "%s: disabling carrier "
758 "modulation\n", __func__); 782 "modulation\n", __func__);
@@ -782,6 +806,34 @@ static int mceusb_set_tx_carrier(void *priv, u32 carrier)
782 return carrier; 806 return carrier;
783} 807}
784 808
809/*
810 * We don't do anything but print debug spew for many of the command bits
811 * we receive from the hardware, but some of them are useful information
812 * we want to store so that we can use them.
813 */
814static void mceusb_handle_command(struct mceusb_dev *ir, int index)
815{
816 u8 hi = ir->buf_in[index + 1] & 0xff;
817 u8 lo = ir->buf_in[index + 2] & 0xff;
818
819 switch (ir->buf_in[index]) {
820 /* 2-byte return value commands */
821 case MCE_CMD_S_TIMEOUT:
822 ir->props->timeout = MS_TO_NS((hi << 8 | lo) / 2);
823 break;
824
825 /* 1-byte return value commands */
826 case MCE_CMD_S_TXMASK:
827 ir->tx_mask = hi;
828 break;
829 case MCE_CMD_S_RXSENSOR:
830 ir->learning_enabled = (hi == 0x02);
831 break;
832 default:
833 break;
834 }
835}
836
785static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) 837static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
786{ 838{
787 DEFINE_IR_RAW_EVENT(rawir); 839 DEFINE_IR_RAW_EVENT(rawir);
@@ -791,39 +843,30 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
791 if (ir->flags.microsoft_gen1) 843 if (ir->flags.microsoft_gen1)
792 i = 2; 844 i = 2;
793 845
846 /* if there's no data, just return now */
847 if (buf_len <= i)
848 return;
849
794 for (; i < buf_len; i++) { 850 for (; i < buf_len; i++) {
795 switch (ir->parser_state) { 851 switch (ir->parser_state) {
796 case SUBCMD: 852 case SUBCMD:
797 ir->rem = mceusb_cmdsize(ir->cmd, ir->buf_in[i]); 853 ir->rem = mceusb_cmdsize(ir->cmd, ir->buf_in[i]);
798 mceusb_dev_printdata(ir, ir->buf_in, i - 1, 854 mceusb_dev_printdata(ir, ir->buf_in, i - 1,
799 ir->rem + 2, false); 855 ir->rem + 2, false);
856 mceusb_handle_command(ir, i);
800 ir->parser_state = CMD_DATA; 857 ir->parser_state = CMD_DATA;
801 break; 858 break;
802 case PARSE_IRDATA: 859 case PARSE_IRDATA:
803 ir->rem--; 860 ir->rem--;
804 rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); 861 rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0);
805 rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) 862 rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK)
806 * MCE_TIME_UNIT * 1000; 863 * MS_TO_NS(MCE_TIME_UNIT);
807
808 if ((ir->buf_in[i] & MCE_PULSE_MASK) == 0x7f) {
809 if (ir->rawir.pulse == rawir.pulse) {
810 ir->rawir.duration += rawir.duration;
811 } else {
812 ir->rawir.duration = rawir.duration;
813 ir->rawir.pulse = rawir.pulse;
814 }
815 if (ir->rem)
816 break;
817 }
818 rawir.duration += ir->rawir.duration;
819 ir->rawir.duration = 0;
820 ir->rawir.pulse = rawir.pulse;
821 864
822 dev_dbg(ir->dev, "Storing %s with duration %d\n", 865 dev_dbg(ir->dev, "Storing %s with duration %d\n",
823 rawir.pulse ? "pulse" : "space", 866 rawir.pulse ? "pulse" : "space",
824 rawir.duration); 867 rawir.duration);
825 868
826 ir_raw_event_store(ir->idev, &rawir); 869 ir_raw_event_store_with_filter(ir->idev, &rawir);
827 break; 870 break;
828 case CMD_DATA: 871 case CMD_DATA:
829 ir->rem--; 872 ir->rem--;
@@ -839,17 +882,10 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
839 continue; 882 continue;
840 } 883 }
841 ir->rem = (ir->cmd & MCE_PACKET_LENGTH_MASK); 884 ir->rem = (ir->cmd & MCE_PACKET_LENGTH_MASK);
842 mceusb_dev_printdata(ir, ir->buf_in, i, ir->rem + 1, false); 885 mceusb_dev_printdata(ir, ir->buf_in,
843 if (ir->rem) { 886 i, ir->rem + 1, false);
887 if (ir->rem)
844 ir->parser_state = PARSE_IRDATA; 888 ir->parser_state = PARSE_IRDATA;
845 break;
846 }
847 /*
848 * a package with len=0 (e. g. 0x80) means end of
849 * data. We could use it to do the call to
850 * ir_raw_event_handle(). For now, we don't need to
851 * use it.
852 */
853 break; 889 break;
854 } 890 }
855 891
@@ -984,9 +1020,11 @@ static void mceusb_get_parameters(struct mceusb_dev *ir)
984 mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ)); 1020 mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ));
985 mce_sync_in(ir, NULL, maxp); 1021 mce_sync_in(ir, NULL, maxp);
986 1022
987 /* get the transmitter bitmask */ 1023 if (!ir->flags.no_tx) {
988 mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK)); 1024 /* get the transmitter bitmask */
989 mce_sync_in(ir, NULL, maxp); 1025 mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK));
1026 mce_sync_in(ir, NULL, maxp);
1027 }
990 1028
991 /* get receiver timeout value */ 1029 /* get receiver timeout value */
992 mce_async_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT)); 1030 mce_async_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT));
@@ -1035,12 +1073,18 @@ static struct input_dev *mceusb_init_input_dev(struct mceusb_dev *ir)
1035 props->priv = ir; 1073 props->priv = ir;
1036 props->driver_type = RC_DRIVER_IR_RAW; 1074 props->driver_type = RC_DRIVER_IR_RAW;
1037 props->allowed_protos = IR_TYPE_ALL; 1075 props->allowed_protos = IR_TYPE_ALL;
1038 props->s_tx_mask = mceusb_set_tx_mask; 1076 props->timeout = MS_TO_NS(1000);
1039 props->s_tx_carrier = mceusb_set_tx_carrier; 1077 if (!ir->flags.no_tx) {
1040 props->tx_ir = mceusb_tx_ir; 1078 props->s_tx_mask = mceusb_set_tx_mask;
1079 props->s_tx_carrier = mceusb_set_tx_carrier;
1080 props->tx_ir = mceusb_tx_ir;
1081 }
1041 1082
1042 ir->props = props; 1083 ir->props = props;
1043 1084
1085 usb_to_input_id(ir->usbdev, &idev->id);
1086 idev->dev.parent = ir->dev;
1087
1044 if (mceusb_model[ir->model].rc_map) 1088 if (mceusb_model[ir->model].rc_map)
1045 rc_map = mceusb_model[ir->model].rc_map; 1089 rc_map = mceusb_model[ir->model].rc_map;
1046 1090
@@ -1074,16 +1118,16 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
1074 enum mceusb_model_type model = id->driver_info; 1118 enum mceusb_model_type model = id->driver_info;
1075 bool is_gen3; 1119 bool is_gen3;
1076 bool is_microsoft_gen1; 1120 bool is_microsoft_gen1;
1077 bool tx_mask_inverted; 1121 bool tx_mask_normal;
1078 bool is_polaris; 1122 bool is_polaris;
1079 1123
1080 dev_dbg(&intf->dev, ": %s called\n", __func__); 1124 dev_dbg(&intf->dev, "%s called\n", __func__);
1081 1125
1082 idesc = intf->cur_altsetting; 1126 idesc = intf->cur_altsetting;
1083 1127
1084 is_gen3 = mceusb_model[model].mce_gen3; 1128 is_gen3 = mceusb_model[model].mce_gen3;
1085 is_microsoft_gen1 = mceusb_model[model].mce_gen1; 1129 is_microsoft_gen1 = mceusb_model[model].mce_gen1;
1086 tx_mask_inverted = mceusb_model[model].tx_mask_inverted; 1130 tx_mask_normal = mceusb_model[model].tx_mask_normal;
1087 is_polaris = mceusb_model[model].is_polaris; 1131 is_polaris = mceusb_model[model].is_polaris;
1088 1132
1089 if (is_polaris) { 1133 if (is_polaris) {
@@ -1107,7 +1151,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
1107 ep_in = ep; 1151 ep_in = ep;
1108 ep_in->bmAttributes = USB_ENDPOINT_XFER_INT; 1152 ep_in->bmAttributes = USB_ENDPOINT_XFER_INT;
1109 ep_in->bInterval = 1; 1153 ep_in->bInterval = 1;
1110 dev_dbg(&intf->dev, ": acceptable inbound endpoint " 1154 dev_dbg(&intf->dev, "acceptable inbound endpoint "
1111 "found\n"); 1155 "found\n");
1112 } 1156 }
1113 1157
@@ -1122,12 +1166,12 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
1122 ep_out = ep; 1166 ep_out = ep;
1123 ep_out->bmAttributes = USB_ENDPOINT_XFER_INT; 1167 ep_out->bmAttributes = USB_ENDPOINT_XFER_INT;
1124 ep_out->bInterval = 1; 1168 ep_out->bInterval = 1;
1125 dev_dbg(&intf->dev, ": acceptable outbound endpoint " 1169 dev_dbg(&intf->dev, "acceptable outbound endpoint "
1126 "found\n"); 1170 "found\n");
1127 } 1171 }
1128 } 1172 }
1129 if (ep_in == NULL) { 1173 if (ep_in == NULL) {
1130 dev_dbg(&intf->dev, ": inbound and/or endpoint not found\n"); 1174 dev_dbg(&intf->dev, "inbound and/or endpoint not found\n");
1131 return -ENODEV; 1175 return -ENODEV;
1132 } 1176 }
1133 1177
@@ -1150,11 +1194,10 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
1150 ir->dev = &intf->dev; 1194 ir->dev = &intf->dev;
1151 ir->len_in = maxp; 1195 ir->len_in = maxp;
1152 ir->flags.microsoft_gen1 = is_microsoft_gen1; 1196 ir->flags.microsoft_gen1 = is_microsoft_gen1;
1153 ir->flags.tx_mask_inverted = tx_mask_inverted; 1197 ir->flags.tx_mask_normal = tx_mask_normal;
1198 ir->flags.no_tx = mceusb_model[model].no_tx;
1154 ir->model = model; 1199 ir->model = model;
1155 1200
1156 init_ir_raw_event(&ir->rawir);
1157
1158 /* Saving usb interface data for use by the transmitter routine */ 1201 /* Saving usb interface data for use by the transmitter routine */
1159 ir->usb_ep_in = ep_in; 1202 ir->usb_ep_in = ep_in;
1160 ir->usb_ep_out = ep_out; 1203 ir->usb_ep_out = ep_out;
@@ -1191,7 +1234,8 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
1191 1234
1192 mceusb_get_parameters(ir); 1235 mceusb_get_parameters(ir);
1193 1236
1194 mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK); 1237 if (!ir->flags.no_tx)
1238 mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK);
1195 1239
1196 usb_set_intfdata(intf, ir); 1240 usb_set_intfdata(intf, ir);
1197 1241
diff --git a/drivers/media/IR/nuvoton-cir.c b/drivers/media/IR/nuvoton-cir.c
index 301be53aee85..acc729c79cec 100644
--- a/drivers/media/IR/nuvoton-cir.c
+++ b/drivers/media/IR/nuvoton-cir.c
@@ -603,6 +603,8 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt)
603 count = nvt->pkts; 603 count = nvt->pkts;
604 nvt_dbg_verbose("Processing buffer of len %d", count); 604 nvt_dbg_verbose("Processing buffer of len %d", count);
605 605
606 init_ir_raw_event(&rawir);
607
606 for (i = 0; i < count; i++) { 608 for (i = 0; i < count; i++) {
607 nvt->pkts--; 609 nvt->pkts--;
608 sample = nvt->buf[i]; 610 sample = nvt->buf[i];
@@ -643,11 +645,15 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt)
643 * indicates end of IR signal, but new data incoming. In both 645 * indicates end of IR signal, but new data incoming. In both
644 * cases, it means we're ready to call ir_raw_event_handle 646 * cases, it means we're ready to call ir_raw_event_handle
645 */ 647 */
646 if (sample == BUF_PULSE_BIT || ((sample != BUF_LEN_MASK) && 648 if ((sample == BUF_PULSE_BIT) && nvt->pkts) {
647 (sample & BUF_REPEAT_MASK) == BUF_REPEAT_BYTE)) 649 nvt_dbg("Calling ir_raw_event_handle (signal end)\n");
648 ir_raw_event_handle(nvt->rdev); 650 ir_raw_event_handle(nvt->rdev);
651 }
649 } 652 }
650 653
654 nvt_dbg("Calling ir_raw_event_handle (buffer empty)\n");
655 ir_raw_event_handle(nvt->rdev);
656
651 if (nvt->pkts) { 657 if (nvt->pkts) {
652 nvt_dbg("Odd, pkts should be 0 now... (its %u)", nvt->pkts); 658 nvt_dbg("Odd, pkts should be 0 now... (its %u)", nvt->pkts);
653 nvt->pkts = 0; 659 nvt->pkts = 0;
diff --git a/drivers/media/IR/streamzap.c b/drivers/media/IR/streamzap.c
index 548381c35bfd..3a20aef67d08 100644
--- a/drivers/media/IR/streamzap.c
+++ b/drivers/media/IR/streamzap.c
@@ -34,8 +34,9 @@
34#include <linux/device.h> 34#include <linux/device.h>
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/usb.h>
38#include <linux/input.h> 37#include <linux/input.h>
38#include <linux/usb.h>
39#include <linux/usb/input.h>
39#include <media/ir-core.h> 40#include <media/ir-core.h>
40 41
41#define DRIVER_VERSION "1.61" 42#define DRIVER_VERSION "1.61"
@@ -140,7 +141,9 @@ static struct usb_driver streamzap_driver = {
140 141
141static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir) 142static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir)
142{ 143{
143 ir_raw_event_store(sz->idev, &rawir); 144 dev_dbg(sz->dev, "Storing %s with duration %u us\n",
145 (rawir.pulse ? "pulse" : "space"), rawir.duration);
146 ir_raw_event_store_with_filter(sz->idev, &rawir);
144} 147}
145 148
146static void sz_push_full_pulse(struct streamzap_ir *sz, 149static void sz_push_full_pulse(struct streamzap_ir *sz,
@@ -167,7 +170,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz,
167 rawir.duration *= 1000; 170 rawir.duration *= 1000;
168 rawir.duration &= IR_MAX_DURATION; 171 rawir.duration &= IR_MAX_DURATION;
169 } 172 }
170 dev_dbg(sz->dev, "ls %u\n", rawir.duration);
171 sz_push(sz, rawir); 173 sz_push(sz, rawir);
172 174
173 sz->idle = false; 175 sz->idle = false;
@@ -180,7 +182,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz,
180 sz->sum += rawir.duration; 182 sz->sum += rawir.duration;
181 rawir.duration *= 1000; 183 rawir.duration *= 1000;
182 rawir.duration &= IR_MAX_DURATION; 184 rawir.duration &= IR_MAX_DURATION;
183 dev_dbg(sz->dev, "p %u\n", rawir.duration);
184 sz_push(sz, rawir); 185 sz_push(sz, rawir);
185} 186}
186 187
@@ -200,7 +201,6 @@ static void sz_push_full_space(struct streamzap_ir *sz,
200 rawir.duration += SZ_RESOLUTION / 2; 201 rawir.duration += SZ_RESOLUTION / 2;
201 sz->sum += rawir.duration; 202 sz->sum += rawir.duration;
202 rawir.duration *= 1000; 203 rawir.duration *= 1000;
203 dev_dbg(sz->dev, "s %u\n", rawir.duration);
204 sz_push(sz, rawir); 204 sz_push(sz, rawir);
205} 205}
206 206
@@ -221,8 +221,6 @@ static void streamzap_callback(struct urb *urb)
221 struct streamzap_ir *sz; 221 struct streamzap_ir *sz;
222 unsigned int i; 222 unsigned int i;
223 int len; 223 int len;
224 static int timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) &
225 IR_MAX_DURATION) | 0x03000000);
226 224
227 if (!urb) 225 if (!urb)
228 return; 226 return;
@@ -246,7 +244,7 @@ static void streamzap_callback(struct urb *urb)
246 244
247 dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len); 245 dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len);
248 for (i = 0; i < len; i++) { 246 for (i = 0; i < len; i++) {
249 dev_dbg(sz->dev, "sz idx %d: %x\n", 247 dev_dbg(sz->dev, "sz->buf_in[%d]: %x\n",
250 i, (unsigned char)sz->buf_in[i]); 248 i, (unsigned char)sz->buf_in[i]);
251 switch (sz->decoder_state) { 249 switch (sz->decoder_state) {
252 case PulseSpace: 250 case PulseSpace:
@@ -273,7 +271,7 @@ static void streamzap_callback(struct urb *urb)
273 DEFINE_IR_RAW_EVENT(rawir); 271 DEFINE_IR_RAW_EVENT(rawir);
274 272
275 rawir.pulse = false; 273 rawir.pulse = false;
276 rawir.duration = timeout; 274 rawir.duration = sz->props->timeout;
277 sz->idle = true; 275 sz->idle = true;
278 if (sz->timeout_enabled) 276 if (sz->timeout_enabled)
279 sz_push(sz, rawir); 277 sz_push(sz, rawir);
@@ -335,6 +333,9 @@ static struct input_dev *streamzap_init_input_dev(struct streamzap_ir *sz)
335 333
336 sz->props = props; 334 sz->props = props;
337 335
336 usb_to_input_id(sz->usbdev, &idev->id);
337 idev->dev.parent = sz->dev;
338
338 ret = ir_input_register(idev, RC_MAP_STREAMZAP, props, DRIVER_NAME); 339 ret = ir_input_register(idev, RC_MAP_STREAMZAP, props, DRIVER_NAME);
339 if (ret < 0) { 340 if (ret < 0) {
340 dev_err(dev, "remote input device register failed\n"); 341 dev_err(dev, "remote input device register failed\n");
@@ -444,6 +445,8 @@ static int __devinit streamzap_probe(struct usb_interface *intf,
444 sz->decoder_state = PulseSpace; 445 sz->decoder_state = PulseSpace;
445 /* FIXME: don't yet have a way to set this */ 446 /* FIXME: don't yet have a way to set this */
446 sz->timeout_enabled = true; 447 sz->timeout_enabled = true;
448 sz->props->timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) &
449 IR_MAX_DURATION) | 0x03000000);
447 #if 0 450 #if 0
448 /* not yet supported, depends on patches from maxim */ 451 /* not yet supported, depends on patches from maxim */
449 /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ 452 /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index dfb198d0415b..f16461844c5c 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1989,8 +1989,23 @@ static int cx25840_probe(struct i2c_client *client,
1989 v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops, 1989 v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops,
1990 V4L2_CID_HUE, -128, 127, 1, 0); 1990 V4L2_CID_HUE, -128, 127, 1, 0);
1991 if (!is_cx2583x(state)) { 1991 if (!is_cx2583x(state)) {
1992 default_volume = 228 - cx25840_read(client, 0x8d4); 1992 default_volume = cx25840_read(client, 0x8d4);
1993 default_volume = ((default_volume / 2) + 23) << 9; 1993 /*
1994 * Enforce the legacy PVR-350/MSP3400 to PVR-150/CX25843 volume
1995 * scale mapping limits to avoid -ERANGE errors when
1996 * initializing the volume control
1997 */
1998 if (default_volume > 228) {
1999 /* Bottom out at -96 dB, v4l2 vol range 0x2e00-0x2fff */
2000 default_volume = 228;
2001 cx25840_write(client, 0x8d4, 228);
2002 }
2003 else if (default_volume < 20) {
2004 /* Top out at + 8 dB, v4l2 vol range 0xfe00-0xffff */
2005 default_volume = 20;
2006 cx25840_write(client, 0x8d4, 20);
2007 }
2008 default_volume = (((228 - default_volume) >> 1) + 23) << 9;
1994 2009
1995 state->volume = v4l2_ctrl_new_std(&state->hdl, 2010 state->volume = v4l2_ctrl_new_std(&state->hdl,
1996 &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME, 2011 &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME,
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index 4aaa47c0eabf..54b7fcd469a8 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -40,7 +40,6 @@
40#include <sound/control.h> 40#include <sound/control.h>
41#include <sound/initval.h> 41#include <sound/initval.h>
42#include <sound/tlv.h> 42#include <sound/tlv.h>
43#include <media/wm8775.h>
44 43
45#include "cx88.h" 44#include "cx88.h"
46#include "cx88-reg.h" 45#include "cx88-reg.h"
@@ -587,47 +586,26 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol,
587 int left, right, v, b; 586 int left, right, v, b;
588 int changed = 0; 587 int changed = 0;
589 u32 old; 588 u32 old;
590 struct v4l2_control client_ctl;
591
592 /* Pass volume & balance onto any WM8775 */
593 if (value->value.integer.value[0] >= value->value.integer.value[1]) {
594 v = value->value.integer.value[0] << 10;
595 b = value->value.integer.value[0] ?
596 (0x8000 * value->value.integer.value[1]) / value->value.integer.value[0] :
597 0x8000;
598 } else {
599 v = value->value.integer.value[1] << 10;
600 b = value->value.integer.value[1] ?
601 0xffff - (0x8000 * value->value.integer.value[0]) / value->value.integer.value[1] :
602 0x8000;
603 }
604 client_ctl.value = v;
605 client_ctl.id = V4L2_CID_AUDIO_VOLUME;
606 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
607
608 client_ctl.value = b;
609 client_ctl.id = V4L2_CID_AUDIO_BALANCE;
610 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
611 589
612 left = value->value.integer.value[0] & 0x3f; 590 left = value->value.integer.value[0] & 0x3f;
613 right = value->value.integer.value[1] & 0x3f; 591 right = value->value.integer.value[1] & 0x3f;
614 b = right - left; 592 b = right - left;
615 if (b < 0) { 593 if (b < 0) {
616 v = 0x3f - left; 594 v = 0x3f - left;
617 b = (-b) | 0x40; 595 b = (-b) | 0x40;
618 } else { 596 } else {
619 v = 0x3f - right; 597 v = 0x3f - right;
620 } 598 }
621 /* Do we really know this will always be called with IRQs on? */ 599 /* Do we really know this will always be called with IRQs on? */
622 spin_lock_irq(&chip->reg_lock); 600 spin_lock_irq(&chip->reg_lock);
623 old = cx_read(AUD_VOL_CTL); 601 old = cx_read(AUD_VOL_CTL);
624 if (v != (old & 0x3f)) { 602 if (v != (old & 0x3f)) {
625 cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, (old & ~0x3f) | v); 603 cx_write(AUD_VOL_CTL, (old & ~0x3f) | v);
626 changed = 1; 604 changed = 1;
627 } 605 }
628 if ((cx_read(AUD_BAL_CTL) & 0x7f) != b) { 606 if (cx_read(AUD_BAL_CTL) != b) {
629 cx_write(AUD_BAL_CTL, b); 607 cx_write(AUD_BAL_CTL, b);
630 changed = 1; 608 changed = 1;
631 } 609 }
632 spin_unlock_irq(&chip->reg_lock); 610 spin_unlock_irq(&chip->reg_lock);
633 611
@@ -640,7 +618,7 @@ static const struct snd_kcontrol_new snd_cx88_volume = {
640 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 618 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
641 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 619 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
642 SNDRV_CTL_ELEM_ACCESS_TLV_READ, 620 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
643 .name = "Analog-TV Volume", 621 .name = "Playback Volume",
644 .info = snd_cx88_volume_info, 622 .info = snd_cx88_volume_info,
645 .get = snd_cx88_volume_get, 623 .get = snd_cx88_volume_get,
646 .put = snd_cx88_volume_put, 624 .put = snd_cx88_volume_put,
@@ -671,14 +649,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol,
671 vol = cx_read(AUD_VOL_CTL); 649 vol = cx_read(AUD_VOL_CTL);
672 if (value->value.integer.value[0] != !(vol & bit)) { 650 if (value->value.integer.value[0] != !(vol & bit)) {
673 vol ^= bit; 651 vol ^= bit;
674 cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol); 652 cx_write(AUD_VOL_CTL, vol);
675 /* Pass mute onto any WM8775 */
676 if ((1<<6) == bit) {
677 struct v4l2_control client_ctl;
678 client_ctl.value = 0 != (vol & bit);
679 client_ctl.id = V4L2_CID_AUDIO_MUTE;
680 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
681 }
682 ret = 1; 653 ret = 1;
683 } 654 }
684 spin_unlock_irq(&chip->reg_lock); 655 spin_unlock_irq(&chip->reg_lock);
@@ -687,7 +658,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol,
687 658
688static const struct snd_kcontrol_new snd_cx88_dac_switch = { 659static const struct snd_kcontrol_new snd_cx88_dac_switch = {
689 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 660 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
690 .name = "Audio-Out Switch", 661 .name = "Playback Switch",
691 .info = snd_ctl_boolean_mono_info, 662 .info = snd_ctl_boolean_mono_info,
692 .get = snd_cx88_switch_get, 663 .get = snd_cx88_switch_get,
693 .put = snd_cx88_switch_put, 664 .put = snd_cx88_switch_put,
@@ -696,49 +667,13 @@ static const struct snd_kcontrol_new snd_cx88_dac_switch = {
696 667
697static const struct snd_kcontrol_new snd_cx88_source_switch = { 668static const struct snd_kcontrol_new snd_cx88_source_switch = {
698 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 669 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
699 .name = "Analog-TV Switch", 670 .name = "Capture Switch",
700 .info = snd_ctl_boolean_mono_info, 671 .info = snd_ctl_boolean_mono_info,
701 .get = snd_cx88_switch_get, 672 .get = snd_cx88_switch_get,
702 .put = snd_cx88_switch_put, 673 .put = snd_cx88_switch_put,
703 .private_value = (1<<6), 674 .private_value = (1<<6),
704}; 675};
705 676
706static int snd_cx88_alc_get(struct snd_kcontrol *kcontrol,
707 struct snd_ctl_elem_value *value)
708{
709 snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
710 struct cx88_core *core = chip->core;
711 struct v4l2_control client_ctl;
712
713 client_ctl.id = V4L2_CID_AUDIO_LOUDNESS;
714 call_hw(core, WM8775_GID, core, g_ctrl, &client_ctl);
715 value->value.integer.value[0] = client_ctl.value ? 1 : 0;
716
717 return 0;
718}
719
720static int snd_cx88_alc_put(struct snd_kcontrol *kcontrol,
721 struct snd_ctl_elem_value *value)
722{
723 snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
724 struct cx88_core *core = chip->core;
725 struct v4l2_control client_ctl;
726
727 client_ctl.value = 0 != value->value.integer.value[0];
728 client_ctl.id = V4L2_CID_AUDIO_LOUDNESS;
729 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
730
731 return 0;
732}
733
734static struct snd_kcontrol_new snd_cx88_alc_switch = {
735 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
736 .name = "Line-In ALC Switch",
737 .info = snd_ctl_boolean_mono_info,
738 .get = snd_cx88_alc_get,
739 .put = snd_cx88_alc_put,
740};
741
742/**************************************************************************** 677/****************************************************************************
743 Basic Flow for Sound Devices 678 Basic Flow for Sound Devices
744 ****************************************************************************/ 679 ****************************************************************************/
@@ -860,7 +795,6 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
860{ 795{
861 struct snd_card *card; 796 struct snd_card *card;
862 snd_cx88_card_t *chip; 797 snd_cx88_card_t *chip;
863 struct v4l2_subdev *sd;
864 int err; 798 int err;
865 799
866 if (devno >= SNDRV_CARDS) 800 if (devno >= SNDRV_CARDS)
@@ -896,15 +830,6 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
896 if (err < 0) 830 if (err < 0)
897 goto error; 831 goto error;
898 832
899 /* If there's a wm8775 then add a Line-In ALC switch */
900 list_for_each_entry(sd, &chip->core->v4l2_dev.subdevs, list) {
901 if (WM8775_GID == sd->grp_id) {
902 snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch,
903 chip));
904 break;
905 }
906 }
907
908 strcpy (card->driver, "CX88x"); 833 strcpy (card->driver, "CX88x");
909 sprintf(card->shortname, "Conexant CX%x", pci->device); 834 sprintf(card->shortname, "Conexant CX%x", pci->device);
910 sprintf(card->longname, "%s at %#llx", 835 sprintf(card->longname, "%s at %#llx",
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 9b9e169cce90..0ccc2afd7266 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1007,15 +1007,22 @@ static const struct cx88_board cx88_boards[] = {
1007 .radio_type = UNSET, 1007 .radio_type = UNSET,
1008 .tuner_addr = ADDR_UNSET, 1008 .tuner_addr = ADDR_UNSET,
1009 .radio_addr = ADDR_UNSET, 1009 .radio_addr = ADDR_UNSET,
1010 .audio_chip = V4L2_IDENT_WM8775,
1010 .input = {{ 1011 .input = {{
1011 .type = CX88_VMUX_DVB, 1012 .type = CX88_VMUX_DVB,
1012 .vmux = 0, 1013 .vmux = 0,
1014 /* 2: Line-In */
1015 .audioroute = 2,
1013 },{ 1016 },{
1014 .type = CX88_VMUX_COMPOSITE1, 1017 .type = CX88_VMUX_COMPOSITE1,
1015 .vmux = 1, 1018 .vmux = 1,
1019 /* 2: Line-In */
1020 .audioroute = 2,
1016 },{ 1021 },{
1017 .type = CX88_VMUX_SVIDEO, 1022 .type = CX88_VMUX_SVIDEO,
1018 .vmux = 2, 1023 .vmux = 2,
1024 /* 2: Line-In */
1025 .audioroute = 2,
1019 }}, 1026 }},
1020 .mpeg = CX88_MPEG_DVB, 1027 .mpeg = CX88_MPEG_DVB,
1021 }, 1028 },
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 62cea9549404..d9249e5a04c9 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -40,7 +40,6 @@
40#include "cx88.h" 40#include "cx88.h"
41#include <media/v4l2-common.h> 41#include <media/v4l2-common.h>
42#include <media/v4l2-ioctl.h> 42#include <media/v4l2-ioctl.h>
43#include <media/wm8775.h>
44 43
45MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); 44MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards");
46MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 45MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
@@ -977,7 +976,6 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
977 const struct cx88_ctrl *c = NULL; 976 const struct cx88_ctrl *c = NULL;
978 u32 value,mask; 977 u32 value,mask;
979 int i; 978 int i;
980 struct v4l2_control client_ctl;
981 979
982 for (i = 0; i < CX8800_CTLS; i++) { 980 for (i = 0; i < CX8800_CTLS; i++) {
983 if (cx8800_ctls[i].v.id == ctl->id) { 981 if (cx8800_ctls[i].v.id == ctl->id) {
@@ -991,27 +989,6 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
991 ctl->value = c->v.minimum; 989 ctl->value = c->v.minimum;
992 if (ctl->value > c->v.maximum) 990 if (ctl->value > c->v.maximum)
993 ctl->value = c->v.maximum; 991 ctl->value = c->v.maximum;
994
995 /* Pass changes onto any WM8775 */
996 client_ctl.id = ctl->id;
997 switch (ctl->id) {
998 case V4L2_CID_AUDIO_MUTE:
999 client_ctl.value = ctl->value;
1000 break;
1001 case V4L2_CID_AUDIO_VOLUME:
1002 client_ctl.value = (ctl->value) ?
1003 (0x90 + ctl->value) << 8 : 0;
1004 break;
1005 case V4L2_CID_AUDIO_BALANCE:
1006 client_ctl.value = ctl->value << 9;
1007 break;
1008 default:
1009 client_ctl.id = 0;
1010 break;
1011 }
1012 if (client_ctl.id)
1013 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
1014
1015 mask=c->mask; 992 mask=c->mask;
1016 switch (ctl->id) { 993 switch (ctl->id) {
1017 case V4L2_CID_AUDIO_BALANCE: 994 case V4L2_CID_AUDIO_BALANCE:
@@ -1558,9 +1535,7 @@ static int radio_queryctrl (struct file *file, void *priv,
1558 if (c->id < V4L2_CID_BASE || 1535 if (c->id < V4L2_CID_BASE ||
1559 c->id >= V4L2_CID_LASTP1) 1536 c->id >= V4L2_CID_LASTP1)
1560 return -EINVAL; 1537 return -EINVAL;
1561 if (c->id == V4L2_CID_AUDIO_MUTE || 1538 if (c->id == V4L2_CID_AUDIO_MUTE) {
1562 c->id == V4L2_CID_AUDIO_VOLUME ||
1563 c->id == V4L2_CID_AUDIO_BALANCE) {
1564 for (i = 0; i < CX8800_CTLS; i++) { 1539 for (i = 0; i < CX8800_CTLS; i++) {
1565 if (cx8800_ctls[i].v.id == c->id) 1540 if (cx8800_ctls[i].v.id == c->id)
1566 break; 1541 break;
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index e8c732e7ae4f..c9981e77416a 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -398,19 +398,17 @@ static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev)
398 return container_of(v4l2_dev, struct cx88_core, v4l2_dev); 398 return container_of(v4l2_dev, struct cx88_core, v4l2_dev);
399} 399}
400 400
401#define call_hw(core, grpid, o, f, args...) \ 401#define call_all(core, o, f, args...) \
402 do { \ 402 do { \
403 if (!core->i2c_rc) { \ 403 if (!core->i2c_rc) { \
404 if (core->gate_ctrl) \ 404 if (core->gate_ctrl) \
405 core->gate_ctrl(core, 1); \ 405 core->gate_ctrl(core, 1); \
406 v4l2_device_call_all(&core->v4l2_dev, grpid, o, f, ##args); \ 406 v4l2_device_call_all(&core->v4l2_dev, 0, o, f, ##args); \
407 if (core->gate_ctrl) \ 407 if (core->gate_ctrl) \
408 core->gate_ctrl(core, 0); \ 408 core->gate_ctrl(core, 0); \
409 } \ 409 } \
410 } while (0) 410 } while (0)
411 411
412#define call_all(core, o, f, args...) call_hw(core, 0, o, f, ##args)
413
414struct cx8800_dev; 412struct cx8800_dev;
415struct cx8802_dev; 413struct cx8802_dev;
416 414
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 908e3bc88303..2c3007280032 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -2377,7 +2377,7 @@ static const struct v4l2_file_operations radio_fops = {
2377 .owner = THIS_MODULE, 2377 .owner = THIS_MODULE,
2378 .open = em28xx_v4l2_open, 2378 .open = em28xx_v4l2_open,
2379 .release = em28xx_v4l2_close, 2379 .release = em28xx_v4l2_close,
2380 .ioctl = video_ioctl2, 2380 .unlocked_ioctl = video_ioctl2,
2381}; 2381};
2382 2382
2383static const struct v4l2_ioctl_ops radio_ioctl_ops = { 2383static const struct v4l2_ioctl_ops radio_ioctl_ops = {
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index 072bd2d1cfad..13565cba237d 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -807,8 +807,6 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd,
807 807
808 if (common_flags & SOCAM_PCLK_SAMPLE_RISING) 808 if (common_flags & SOCAM_PCLK_SAMPLE_RISING)
809 csicr1 |= CSICR1_REDGE; 809 csicr1 |= CSICR1_REDGE;
810 if (common_flags & SOCAM_PCLK_SAMPLE_FALLING)
811 csicr1 |= CSICR1_INV_PCLK;
812 if (common_flags & SOCAM_VSYNC_ACTIVE_HIGH) 810 if (common_flags & SOCAM_VSYNC_ACTIVE_HIGH)
813 csicr1 |= CSICR1_SOF_POL; 811 csicr1 |= CSICR1_SOF_POL;
814 if (common_flags & SOCAM_HSYNC_ACTIVE_HIGH) 812 if (common_flags & SOCAM_HSYNC_ACTIVE_HIGH)
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c
index 1b93207c89e8..2f500809f53d 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -522,6 +522,7 @@ static int fimc_cap_streamon(struct file *file, void *priv,
522 INIT_LIST_HEAD(&fimc->vid_cap.active_buf_q); 522 INIT_LIST_HEAD(&fimc->vid_cap.active_buf_q);
523 fimc->vid_cap.active_buf_cnt = 0; 523 fimc->vid_cap.active_buf_cnt = 0;
524 fimc->vid_cap.frame_count = 0; 524 fimc->vid_cap.frame_count = 0;
525 fimc->vid_cap.buf_index = fimc_hw_get_frame_index(fimc);
525 526
526 set_bit(ST_CAPT_PEND, &fimc->state); 527 set_bit(ST_CAPT_PEND, &fimc->state);
527 ret = videobuf_streamon(&fimc->vid_cap.vbq); 528 ret = videobuf_streamon(&fimc->vid_cap.vbq);
@@ -652,6 +653,50 @@ static int fimc_cap_s_ctrl(struct file *file, void *priv,
652 return ret; 653 return ret;
653} 654}
654 655
656static int fimc_cap_cropcap(struct file *file, void *fh,
657 struct v4l2_cropcap *cr)
658{
659 struct fimc_frame *f;
660 struct fimc_ctx *ctx = fh;
661 struct fimc_dev *fimc = ctx->fimc_dev;
662
663 if (cr->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
664 return -EINVAL;
665
666 if (mutex_lock_interruptible(&fimc->lock))
667 return -ERESTARTSYS;
668
669 f = &ctx->s_frame;
670 cr->bounds.left = 0;
671 cr->bounds.top = 0;
672 cr->bounds.width = f->o_width;
673 cr->bounds.height = f->o_height;
674 cr->defrect = cr->bounds;
675
676 mutex_unlock(&fimc->lock);
677 return 0;
678}
679
680static int fimc_cap_g_crop(struct file *file, void *fh, struct v4l2_crop *cr)
681{
682 struct fimc_frame *f;
683 struct fimc_ctx *ctx = file->private_data;
684 struct fimc_dev *fimc = ctx->fimc_dev;
685
686
687 if (mutex_lock_interruptible(&fimc->lock))
688 return -ERESTARTSYS;
689
690 f = &ctx->s_frame;
691 cr->c.left = f->offs_h;
692 cr->c.top = f->offs_v;
693 cr->c.width = f->width;
694 cr->c.height = f->height;
695
696 mutex_unlock(&fimc->lock);
697 return 0;
698}
699
655static int fimc_cap_s_crop(struct file *file, void *fh, 700static int fimc_cap_s_crop(struct file *file, void *fh,
656 struct v4l2_crop *cr) 701 struct v4l2_crop *cr)
657{ 702{
@@ -716,9 +761,9 @@ static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops = {
716 .vidioc_g_ctrl = fimc_vidioc_g_ctrl, 761 .vidioc_g_ctrl = fimc_vidioc_g_ctrl,
717 .vidioc_s_ctrl = fimc_cap_s_ctrl, 762 .vidioc_s_ctrl = fimc_cap_s_ctrl,
718 763
719 .vidioc_g_crop = fimc_vidioc_g_crop, 764 .vidioc_g_crop = fimc_cap_g_crop,
720 .vidioc_s_crop = fimc_cap_s_crop, 765 .vidioc_s_crop = fimc_cap_s_crop,
721 .vidioc_cropcap = fimc_vidioc_cropcap, 766 .vidioc_cropcap = fimc_cap_cropcap,
722 767
723 .vidioc_enum_input = fimc_cap_enum_input, 768 .vidioc_enum_input = fimc_cap_enum_input,
724 .vidioc_s_input = fimc_cap_s_input, 769 .vidioc_s_input = fimc_cap_s_input,
@@ -785,7 +830,7 @@ int fimc_register_capture_device(struct fimc_dev *fimc)
785 videobuf_queue_dma_contig_init(&vid_cap->vbq, &fimc_qops, 830 videobuf_queue_dma_contig_init(&vid_cap->vbq, &fimc_qops,
786 vid_cap->v4l2_dev.dev, &fimc->irqlock, 831 vid_cap->v4l2_dev.dev, &fimc->irqlock,
787 V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, 832 V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE,
788 sizeof(struct fimc_vid_buffer), (void *)ctx); 833 sizeof(struct fimc_vid_buffer), (void *)ctx, NULL);
789 834
790 ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); 835 ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1);
791 if (ret) { 836 if (ret) {
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c
index 2e7c547894b6..bb99f2d805d3 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -50,8 +50,8 @@ static struct fimc_fmt fimc_formats[] = {
50 .planes_cnt = 1, 50 .planes_cnt = 1,
51 .flags = FMT_FLAGS_M2M, 51 .flags = FMT_FLAGS_M2M,
52 }, { 52 }, {
53 .name = "XRGB-8-8-8-8, 24 bpp", 53 .name = "XRGB-8-8-8-8, 32 bpp",
54 .fourcc = V4L2_PIX_FMT_RGB24, 54 .fourcc = V4L2_PIX_FMT_RGB32,
55 .depth = 32, 55 .depth = 32,
56 .color = S5P_FIMC_RGB888, 56 .color = S5P_FIMC_RGB888,
57 .buff_cnt = 1, 57 .buff_cnt = 1,
@@ -983,6 +983,7 @@ int fimc_vidioc_queryctrl(struct file *file, void *priv,
983{ 983{
984 struct fimc_ctx *ctx = priv; 984 struct fimc_ctx *ctx = priv;
985 struct v4l2_queryctrl *c; 985 struct v4l2_queryctrl *c;
986 int ret = -EINVAL;
986 987
987 c = get_ctrl(qc->id); 988 c = get_ctrl(qc->id);
988 if (c) { 989 if (c) {
@@ -990,10 +991,14 @@ int fimc_vidioc_queryctrl(struct file *file, void *priv,
990 return 0; 991 return 0;
991 } 992 }
992 993
993 if (ctx->state & FIMC_CTX_CAP) 994 if (ctx->state & FIMC_CTX_CAP) {
994 return v4l2_subdev_call(ctx->fimc_dev->vid_cap.sd, 995 if (mutex_lock_interruptible(&ctx->fimc_dev->lock))
996 return -ERESTARTSYS;
997 ret = v4l2_subdev_call(ctx->fimc_dev->vid_cap.sd,
995 core, queryctrl, qc); 998 core, queryctrl, qc);
996 return -EINVAL; 999 mutex_unlock(&ctx->fimc_dev->lock);
1000 }
1001 return ret;
997} 1002}
998 1003
999int fimc_vidioc_g_ctrl(struct file *file, void *priv, 1004int fimc_vidioc_g_ctrl(struct file *file, void *priv,
@@ -1115,7 +1120,7 @@ static int fimc_m2m_s_ctrl(struct file *file, void *priv,
1115 return 0; 1120 return 0;
1116} 1121}
1117 1122
1118int fimc_vidioc_cropcap(struct file *file, void *fh, 1123static int fimc_m2m_cropcap(struct file *file, void *fh,
1119 struct v4l2_cropcap *cr) 1124 struct v4l2_cropcap *cr)
1120{ 1125{
1121 struct fimc_frame *frame; 1126 struct fimc_frame *frame;
@@ -1139,7 +1144,7 @@ int fimc_vidioc_cropcap(struct file *file, void *fh,
1139 return 0; 1144 return 0;
1140} 1145}
1141 1146
1142int fimc_vidioc_g_crop(struct file *file, void *fh, struct v4l2_crop *cr) 1147static int fimc_m2m_g_crop(struct file *file, void *fh, struct v4l2_crop *cr)
1143{ 1148{
1144 struct fimc_frame *frame; 1149 struct fimc_frame *frame;
1145 struct fimc_ctx *ctx = file->private_data; 1150 struct fimc_ctx *ctx = file->private_data;
@@ -1167,22 +1172,22 @@ int fimc_try_crop(struct fimc_ctx *ctx, struct v4l2_crop *cr)
1167 struct fimc_frame *f; 1172 struct fimc_frame *f;
1168 u32 min_size, halign; 1173 u32 min_size, halign;
1169 1174
1170 f = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ?
1171 &ctx->s_frame : &ctx->d_frame;
1172
1173 if (cr->c.top < 0 || cr->c.left < 0) { 1175 if (cr->c.top < 0 || cr->c.left < 0) {
1174 v4l2_err(&fimc->m2m.v4l2_dev, 1176 v4l2_err(&fimc->m2m.v4l2_dev,
1175 "doesn't support negative values for top & left\n"); 1177 "doesn't support negative values for top & left\n");
1176 return -EINVAL; 1178 return -EINVAL;
1177 } 1179 }
1178 1180
1179 f = ctx_get_frame(ctx, cr->type); 1181 if (cr->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
1180 if (IS_ERR(f)) 1182 f = (ctx->state & FIMC_CTX_CAP) ? &ctx->s_frame : &ctx->d_frame;
1181 return PTR_ERR(f); 1183 else if (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
1184 ctx->state & FIMC_CTX_M2M)
1185 f = &ctx->s_frame;
1186 else
1187 return -EINVAL;
1182 1188
1183 min_size = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) 1189 min_size = (f == &ctx->s_frame) ?
1184 ? fimc->variant->min_inp_pixsize 1190 fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize;
1185 : fimc->variant->min_out_pixsize;
1186 1191
1187 if (ctx->state & FIMC_CTX_M2M) { 1192 if (ctx->state & FIMC_CTX_M2M) {
1188 if (fimc->id == 1 && fimc->variant->pix_hoff) 1193 if (fimc->id == 1 && fimc->variant->pix_hoff)
@@ -1233,6 +1238,9 @@ static int fimc_m2m_s_crop(struct file *file, void *fh, struct v4l2_crop *cr)
1233 f = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ? 1238 f = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ?
1234 &ctx->s_frame : &ctx->d_frame; 1239 &ctx->s_frame : &ctx->d_frame;
1235 1240
1241 if (mutex_lock_interruptible(&fimc->lock))
1242 return -ERESTARTSYS;
1243
1236 spin_lock_irqsave(&ctx->slock, flags); 1244 spin_lock_irqsave(&ctx->slock, flags);
1237 if (~ctx->state & (FIMC_SRC_FMT | FIMC_DST_FMT)) { 1245 if (~ctx->state & (FIMC_SRC_FMT | FIMC_DST_FMT)) {
1238 /* Check to see if scaling ratio is within supported range */ 1246 /* Check to see if scaling ratio is within supported range */
@@ -1241,9 +1249,9 @@ static int fimc_m2m_s_crop(struct file *file, void *fh, struct v4l2_crop *cr)
1241 else 1249 else
1242 ret = fimc_check_scaler_ratio(&cr->c, &ctx->s_frame); 1250 ret = fimc_check_scaler_ratio(&cr->c, &ctx->s_frame);
1243 if (ret) { 1251 if (ret) {
1244 spin_unlock_irqrestore(&ctx->slock, flags);
1245 v4l2_err(&fimc->m2m.v4l2_dev, "Out of scaler range"); 1252 v4l2_err(&fimc->m2m.v4l2_dev, "Out of scaler range");
1246 return -EINVAL; 1253 ret = -EINVAL;
1254 goto scr_unlock;
1247 } 1255 }
1248 } 1256 }
1249 ctx->state |= FIMC_PARAMS; 1257 ctx->state |= FIMC_PARAMS;
@@ -1253,7 +1261,9 @@ static int fimc_m2m_s_crop(struct file *file, void *fh, struct v4l2_crop *cr)
1253 f->width = cr->c.width; 1261 f->width = cr->c.width;
1254 f->height = cr->c.height; 1262 f->height = cr->c.height;
1255 1263
1264scr_unlock:
1256 spin_unlock_irqrestore(&ctx->slock, flags); 1265 spin_unlock_irqrestore(&ctx->slock, flags);
1266 mutex_unlock(&fimc->lock);
1257 return 0; 1267 return 0;
1258} 1268}
1259 1269
@@ -1285,9 +1295,9 @@ static const struct v4l2_ioctl_ops fimc_m2m_ioctl_ops = {
1285 .vidioc_g_ctrl = fimc_vidioc_g_ctrl, 1295 .vidioc_g_ctrl = fimc_vidioc_g_ctrl,
1286 .vidioc_s_ctrl = fimc_m2m_s_ctrl, 1296 .vidioc_s_ctrl = fimc_m2m_s_ctrl,
1287 1297
1288 .vidioc_g_crop = fimc_vidioc_g_crop, 1298 .vidioc_g_crop = fimc_m2m_g_crop,
1289 .vidioc_s_crop = fimc_m2m_s_crop, 1299 .vidioc_s_crop = fimc_m2m_s_crop,
1290 .vidioc_cropcap = fimc_vidioc_cropcap 1300 .vidioc_cropcap = fimc_m2m_cropcap
1291 1301
1292}; 1302};
1293 1303
@@ -1396,7 +1406,7 @@ static const struct v4l2_file_operations fimc_m2m_fops = {
1396 .open = fimc_m2m_open, 1406 .open = fimc_m2m_open,
1397 .release = fimc_m2m_release, 1407 .release = fimc_m2m_release,
1398 .poll = fimc_m2m_poll, 1408 .poll = fimc_m2m_poll,
1399 .ioctl = video_ioctl2, 1409 .unlocked_ioctl = video_ioctl2,
1400 .mmap = fimc_m2m_mmap, 1410 .mmap = fimc_m2m_mmap,
1401}; 1411};
1402 1412
@@ -1736,6 +1746,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv310 = {
1736 .pix_hoff = 1, 1746 .pix_hoff = 1,
1737 .has_inp_rot = 1, 1747 .has_inp_rot = 1,
1738 .has_out_rot = 1, 1748 .has_out_rot = 1,
1749 .has_cistatus2 = 1,
1739 .min_inp_pixsize = 16, 1750 .min_inp_pixsize = 16,
1740 .min_out_pixsize = 16, 1751 .min_out_pixsize = 16,
1741 .hor_offs_align = 1, 1752 .hor_offs_align = 1,
@@ -1745,6 +1756,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv310 = {
1745 1756
1746static struct samsung_fimc_variant fimc2_variant_s5pv310 = { 1757static struct samsung_fimc_variant fimc2_variant_s5pv310 = {
1747 .pix_hoff = 1, 1758 .pix_hoff = 1,
1759 .has_cistatus2 = 1,
1748 .min_inp_pixsize = 16, 1760 .min_inp_pixsize = 16,
1749 .min_out_pixsize = 16, 1761 .min_out_pixsize = 16,
1750 .hor_offs_align = 1, 1762 .hor_offs_align = 1,
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h b/drivers/media/video/s5p-fimc/fimc-core.h
index 3e1078516560..4f047d35f8ad 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.h
+++ b/drivers/media/video/s5p-fimc/fimc-core.h
@@ -13,13 +13,15 @@
13 13
14/*#define DEBUG*/ 14/*#define DEBUG*/
15 15
16#include <linux/sched.h>
16#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/videodev2.h>
17#include <media/videobuf-core.h> 19#include <media/videobuf-core.h>
18#include <media/v4l2-device.h> 20#include <media/v4l2-device.h>
19#include <media/v4l2-mem2mem.h> 21#include <media/v4l2-mem2mem.h>
20#include <media/v4l2-mediabus.h> 22#include <media/v4l2-mediabus.h>
21#include <media/s3c_fimc.h> 23#include <media/s3c_fimc.h>
22#include <linux/videodev2.h> 24
23#include "regs-fimc.h" 25#include "regs-fimc.h"
24 26
25#define err(fmt, args...) \ 27#define err(fmt, args...) \
@@ -369,6 +371,7 @@ struct fimc_pix_limit {
369 * @pix_hoff: indicate whether horizontal offset is in pixels or in bytes 371 * @pix_hoff: indicate whether horizontal offset is in pixels or in bytes
370 * @has_inp_rot: set if has input rotator 372 * @has_inp_rot: set if has input rotator
371 * @has_out_rot: set if has output rotator 373 * @has_out_rot: set if has output rotator
374 * @has_cistatus2: 1 if CISTATUS2 register is present in this IP revision
372 * @pix_limit: pixel size constraints for the scaler 375 * @pix_limit: pixel size constraints for the scaler
373 * @min_inp_pixsize: minimum input pixel size 376 * @min_inp_pixsize: minimum input pixel size
374 * @min_out_pixsize: minimum output pixel size 377 * @min_out_pixsize: minimum output pixel size
@@ -379,6 +382,7 @@ struct samsung_fimc_variant {
379 unsigned int pix_hoff:1; 382 unsigned int pix_hoff:1;
380 unsigned int has_inp_rot:1; 383 unsigned int has_inp_rot:1;
381 unsigned int has_out_rot:1; 384 unsigned int has_out_rot:1;
385 unsigned int has_cistatus2:1;
382 struct fimc_pix_limit *pix_limit; 386 struct fimc_pix_limit *pix_limit;
383 u16 min_inp_pixsize; 387 u16 min_inp_pixsize;
384 u16 min_out_pixsize; 388 u16 min_out_pixsize;
@@ -554,11 +558,19 @@ static inline struct fimc_frame *ctx_get_frame(struct fimc_ctx *ctx,
554 return frame; 558 return frame;
555} 559}
556 560
561/* Return an index to the buffer actually being written. */
557static inline u32 fimc_hw_get_frame_index(struct fimc_dev *dev) 562static inline u32 fimc_hw_get_frame_index(struct fimc_dev *dev)
558{ 563{
559 u32 reg = readl(dev->regs + S5P_CISTATUS); 564 u32 reg;
560 return (reg & S5P_CISTATUS_FRAMECNT_MASK) >> 565
561 S5P_CISTATUS_FRAMECNT_SHIFT; 566 if (dev->variant->has_cistatus2) {
567 reg = readl(dev->regs + S5P_CISTATUS2) & 0x3F;
568 return reg > 0 ? --reg : reg;
569 } else {
570 reg = readl(dev->regs + S5P_CISTATUS);
571 return (reg & S5P_CISTATUS_FRAMECNT_MASK) >>
572 S5P_CISTATUS_FRAMECNT_SHIFT;
573 }
562} 574}
563 575
564/* -----------------------------------------------------*/ 576/* -----------------------------------------------------*/
@@ -594,10 +606,6 @@ int fimc_vidioc_g_fmt(struct file *file, void *priv,
594 struct v4l2_format *f); 606 struct v4l2_format *f);
595int fimc_vidioc_try_fmt(struct file *file, void *priv, 607int fimc_vidioc_try_fmt(struct file *file, void *priv,
596 struct v4l2_format *f); 608 struct v4l2_format *f);
597int fimc_vidioc_g_crop(struct file *file, void *fh,
598 struct v4l2_crop *cr);
599int fimc_vidioc_cropcap(struct file *file, void *fh,
600 struct v4l2_cropcap *cr);
601int fimc_vidioc_queryctrl(struct file *file, void *priv, 609int fimc_vidioc_queryctrl(struct file *file, void *priv,
602 struct v4l2_queryctrl *qc); 610 struct v4l2_queryctrl *qc);
603int fimc_vidioc_g_ctrl(struct file *file, void *priv, 611int fimc_vidioc_g_ctrl(struct file *file, void *priv,
diff --git a/drivers/media/video/s5p-fimc/regs-fimc.h b/drivers/media/video/s5p-fimc/regs-fimc.h
index a57daedb5b5c..57e33f84fcfa 100644
--- a/drivers/media/video/s5p-fimc/regs-fimc.h
+++ b/drivers/media/video/s5p-fimc/regs-fimc.h
@@ -165,6 +165,9 @@
165#define S5P_CISTATUS_VVALID_A (1 << 15) 165#define S5P_CISTATUS_VVALID_A (1 << 15)
166#define S5P_CISTATUS_VVALID_B (1 << 14) 166#define S5P_CISTATUS_VVALID_B (1 << 14)
167 167
168/* Indexes to the last and the currently processed buffer. */
169#define S5P_CISTATUS2 0x68
170
168/* Image capture control */ 171/* Image capture control */
169#define S5P_CIIMGCPT 0xc0 172#define S5P_CIIMGCPT 0xc0
170#define S5P_CIIMGCPT_IMGCPTEN (1 << 31) 173#define S5P_CIIMGCPT_IMGCPTEN (1 << 31)
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index 5c209afb0ac8..2486520582f2 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -1980,7 +1980,7 @@ static int __devinit sh_mobile_ceu_probe(struct platform_device *pdev)
1980 * we complete the completion. 1980 * we complete the completion.
1981 */ 1981 */
1982 1982
1983 if (!csi2->driver || !csi2->driver->owner) { 1983 if (!csi2->driver) {
1984 complete(&wait.completion); 1984 complete(&wait.completion);
1985 /* Either too late, or probing failed */ 1985 /* Either too late, or probing failed */
1986 bus_unregister_notifier(&platform_bus_type, &wait.notifier); 1986 bus_unregister_notifier(&platform_bus_type, &wait.notifier);
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index 335120c2021b..052bd6dfa5a7 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -405,13 +405,13 @@ static int soc_camera_open(struct file *file)
405 ret = soc_camera_set_fmt(icd, &f); 405 ret = soc_camera_set_fmt(icd, &f);
406 if (ret < 0) 406 if (ret < 0)
407 goto esfmt; 407 goto esfmt;
408
409 ici->ops->init_videobuf(&icd->vb_vidq, icd);
408 } 410 }
409 411
410 file->private_data = icd; 412 file->private_data = icd;
411 dev_dbg(&icd->dev, "camera device open\n"); 413 dev_dbg(&icd->dev, "camera device open\n");
412 414
413 ici->ops->init_videobuf(&icd->vb_vidq, icd);
414
415 mutex_unlock(&icd->video_lock); 415 mutex_unlock(&icd->video_lock);
416 416
417 return 0; 417 return 0;
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c
index 135525649086..fe8ef6419f83 100644
--- a/drivers/media/video/wm8775.c
+++ b/drivers/media/video/wm8775.c
@@ -35,7 +35,6 @@
35#include <media/v4l2-device.h> 35#include <media/v4l2-device.h>
36#include <media/v4l2-chip-ident.h> 36#include <media/v4l2-chip-ident.h>
37#include <media/v4l2-ctrls.h> 37#include <media/v4l2-ctrls.h>
38#include <media/wm8775.h>
39 38
40MODULE_DESCRIPTION("wm8775 driver"); 39MODULE_DESCRIPTION("wm8775 driver");
41MODULE_AUTHOR("Ulf Eklund, Hans Verkuil"); 40MODULE_AUTHOR("Ulf Eklund, Hans Verkuil");
@@ -51,16 +50,10 @@ enum {
51 TOT_REGS 50 TOT_REGS
52}; 51};
53 52
54#define ALC_HOLD 0x85 /* R17: use zero cross detection, ALC hold time 42.6 ms */
55#define ALC_EN 0x100 /* R17: ALC enable */
56
57struct wm8775_state { 53struct wm8775_state {
58 struct v4l2_subdev sd; 54 struct v4l2_subdev sd;
59 struct v4l2_ctrl_handler hdl; 55 struct v4l2_ctrl_handler hdl;
60 struct v4l2_ctrl *mute; 56 struct v4l2_ctrl *mute;
61 struct v4l2_ctrl *vol;
62 struct v4l2_ctrl *bal;
63 struct v4l2_ctrl *loud;
64 u8 input; /* Last selected input (0-0xf) */ 57 u8 input; /* Last selected input (0-0xf) */
65}; 58};
66 59
@@ -92,30 +85,6 @@ static int wm8775_write(struct v4l2_subdev *sd, int reg, u16 val)
92 return -1; 85 return -1;
93} 86}
94 87
95static void wm8775_set_audio(struct v4l2_subdev *sd, int quietly)
96{
97 struct wm8775_state *state = to_state(sd);
98 u8 vol_l, vol_r;
99 int muted = 0 != state->mute->val;
100 u16 volume = (u16)state->vol->val;
101 u16 balance = (u16)state->bal->val;
102
103 /* normalize ( 65535 to 0 -> 255 to 0 (+24dB to -103dB) ) */
104 vol_l = (min(65536 - balance, 32768) * volume) >> 23;
105 vol_r = (min(balance, (u16)32768) * volume) >> 23;
106
107 /* Mute */
108 if (muted || quietly)
109 wm8775_write(sd, R21, 0x0c0 | state->input);
110
111 wm8775_write(sd, R14, vol_l | 0x100); /* 0x100= Left channel ADC zero cross enable */
112 wm8775_write(sd, R15, vol_r | 0x100); /* 0x100= Right channel ADC zero cross enable */
113
114 /* Un-mute */
115 if (!muted)
116 wm8775_write(sd, R21, state->input);
117}
118
119static int wm8775_s_routing(struct v4l2_subdev *sd, 88static int wm8775_s_routing(struct v4l2_subdev *sd,
120 u32 input, u32 output, u32 config) 89 u32 input, u32 output, u32 config)
121{ 90{
@@ -133,26 +102,25 @@ static int wm8775_s_routing(struct v4l2_subdev *sd,
133 state->input = input; 102 state->input = input;
134 if (!v4l2_ctrl_g_ctrl(state->mute)) 103 if (!v4l2_ctrl_g_ctrl(state->mute))
135 return 0; 104 return 0;
136 if (!v4l2_ctrl_g_ctrl(state->vol)) 105 wm8775_write(sd, R21, 0x0c0);
137 return 0; 106 wm8775_write(sd, R14, 0x1d4);
138 if (!v4l2_ctrl_g_ctrl(state->bal)) 107 wm8775_write(sd, R15, 0x1d4);
139 return 0; 108 wm8775_write(sd, R21, 0x100 + state->input);
140 wm8775_set_audio(sd, 1);
141 return 0; 109 return 0;
142} 110}
143 111
144static int wm8775_s_ctrl(struct v4l2_ctrl *ctrl) 112static int wm8775_s_ctrl(struct v4l2_ctrl *ctrl)
145{ 113{
146 struct v4l2_subdev *sd = to_sd(ctrl); 114 struct v4l2_subdev *sd = to_sd(ctrl);
115 struct wm8775_state *state = to_state(sd);
147 116
148 switch (ctrl->id) { 117 switch (ctrl->id) {
149 case V4L2_CID_AUDIO_MUTE: 118 case V4L2_CID_AUDIO_MUTE:
150 case V4L2_CID_AUDIO_VOLUME: 119 wm8775_write(sd, R21, 0x0c0);
151 case V4L2_CID_AUDIO_BALANCE: 120 wm8775_write(sd, R14, 0x1d4);
152 wm8775_set_audio(sd, 0); 121 wm8775_write(sd, R15, 0x1d4);
153 return 0; 122 if (!ctrl->val)
154 case V4L2_CID_AUDIO_LOUDNESS: 123 wm8775_write(sd, R21, 0x100 + state->input);
155 wm8775_write(sd, R17, (ctrl->val ? ALC_EN : 0) | ALC_HOLD);
156 return 0; 124 return 0;
157 } 125 }
158 return -EINVAL; 126 return -EINVAL;
@@ -176,7 +144,16 @@ static int wm8775_log_status(struct v4l2_subdev *sd)
176 144
177static int wm8775_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq) 145static int wm8775_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq)
178{ 146{
179 wm8775_set_audio(sd, 0); 147 struct wm8775_state *state = to_state(sd);
148
149 /* If I remove this, then it can happen that I have no
150 sound the first time I tune from static to a valid channel.
151 It's difficult to reproduce and is almost certainly related
152 to the zero cross detect circuit. */
153 wm8775_write(sd, R21, 0x0c0);
154 wm8775_write(sd, R14, 0x1d4);
155 wm8775_write(sd, R15, 0x1d4);
156 wm8775_write(sd, R21, 0x100 + state->input);
180 return 0; 157 return 0;
181} 158}
182 159
@@ -226,7 +203,6 @@ static int wm8775_probe(struct i2c_client *client,
226{ 203{
227 struct wm8775_state *state; 204 struct wm8775_state *state;
228 struct v4l2_subdev *sd; 205 struct v4l2_subdev *sd;
229 int err;
230 206
231 /* Check if the adapter supports the needed features */ 207 /* Check if the adapter supports the needed features */
232 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 208 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
@@ -240,21 +216,15 @@ static int wm8775_probe(struct i2c_client *client,
240 return -ENOMEM; 216 return -ENOMEM;
241 sd = &state->sd; 217 sd = &state->sd;
242 v4l2_i2c_subdev_init(sd, client, &wm8775_ops); 218 v4l2_i2c_subdev_init(sd, client, &wm8775_ops);
243 sd->grp_id = WM8775_GID; /* subdev group id */
244 state->input = 2; 219 state->input = 2;
245 220
246 v4l2_ctrl_handler_init(&state->hdl, 4); 221 v4l2_ctrl_handler_init(&state->hdl, 1);
247 state->mute = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops, 222 state->mute = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops,
248 V4L2_CID_AUDIO_MUTE, 0, 1, 1, 0); 223 V4L2_CID_AUDIO_MUTE, 0, 1, 1, 0);
249 state->vol = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops,
250 V4L2_CID_AUDIO_VOLUME, 0, 65535, (65535+99)/100, 0xCF00); /* 0dB*/
251 state->bal = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops,
252 V4L2_CID_AUDIO_BALANCE, 0, 65535, (65535+99)/100, 32768);
253 state->loud = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops,
254 V4L2_CID_AUDIO_LOUDNESS, 0, 1, 1, 1);
255 sd->ctrl_handler = &state->hdl; 224 sd->ctrl_handler = &state->hdl;
256 err = state->hdl.error; 225 if (state->hdl.error) {
257 if (err) { 226 int err = state->hdl.error;
227
258 v4l2_ctrl_handler_free(&state->hdl); 228 v4l2_ctrl_handler_free(&state->hdl);
259 kfree(state); 229 kfree(state);
260 return err; 230 return err;
@@ -266,25 +236,29 @@ static int wm8775_probe(struct i2c_client *client,
266 wm8775_write(sd, R23, 0x000); 236 wm8775_write(sd, R23, 0x000);
267 /* Disable zero cross detect timeout */ 237 /* Disable zero cross detect timeout */
268 wm8775_write(sd, R7, 0x000); 238 wm8775_write(sd, R7, 0x000);
269 /* HPF enable, I2S mode, 24-bit */ 239 /* Left justified, 24-bit mode */
270 wm8775_write(sd, R11, 0x022); 240 wm8775_write(sd, R11, 0x021);
271 /* Master mode, clock ratio 256fs */ 241 /* Master mode, clock ratio 256fs */
272 wm8775_write(sd, R12, 0x102); 242 wm8775_write(sd, R12, 0x102);
273 /* Powered up */ 243 /* Powered up */
274 wm8775_write(sd, R13, 0x000); 244 wm8775_write(sd, R13, 0x000);
275 /* ALC stereo, ALC target level -5dB FS, ALC max gain +8dB */ 245 /* ADC gain +2.5dB, enable zero cross */
276 wm8775_write(sd, R16, 0x1bb); 246 wm8775_write(sd, R14, 0x1d4);
277 /* Set ALC mode and hold time */ 247 /* ADC gain +2.5dB, enable zero cross */
278 wm8775_write(sd, R17, (state->loud->val ? ALC_EN : 0) | ALC_HOLD); 248 wm8775_write(sd, R15, 0x1d4);
249 /* ALC Stereo, ALC target level -1dB FS max gain +8dB */
250 wm8775_write(sd, R16, 0x1bf);
251 /* Enable gain control, use zero cross detection,
252 ALC hold time 42.6 ms */
253 wm8775_write(sd, R17, 0x185);
279 /* ALC gain ramp up delay 34 s, ALC gain ramp down delay 33 ms */ 254 /* ALC gain ramp up delay 34 s, ALC gain ramp down delay 33 ms */
280 wm8775_write(sd, R18, 0x0a2); 255 wm8775_write(sd, R18, 0x0a2);
281 /* Enable noise gate, threshold -72dBfs */ 256 /* Enable noise gate, threshold -72dBfs */
282 wm8775_write(sd, R19, 0x005); 257 wm8775_write(sd, R19, 0x005);
283 /* Transient window 4ms, ALC min gain -5dB */ 258 /* Transient window 4ms, lower PGA gain limit -1dB */
284 wm8775_write(sd, R20, 0x0fb); 259 wm8775_write(sd, R20, 0x07a);
285 260 /* LRBOTH = 1, use input 2. */
286 wm8775_set_audio(sd, 1); /* set volume/mute/mux */ 261 wm8775_write(sd, R21, 0x102);
287
288 return 0; 262 return 0;
289} 263}
290 264
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index dbe1c93c1af3..d9640a623ff4 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -303,7 +303,7 @@ static irqreturn_t ab8500_irq(int irq, void *dev)
303 continue; 303 continue;
304 304
305 do { 305 do {
306 int bit = __ffs(status); 306 int bit = __ffs(value);
307 int line = i * 8 + bit; 307 int line = i * 8 + bit;
308 308
309 handle_nested_irq(ab8500->irq_base + line); 309 handle_nested_irq(ab8500->irq_base + line);
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 7d2563fc15c6..76cadcf3b1fe 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -1455,7 +1455,11 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1455 dev_err(wm831x->dev, "Failed to read parent ID: %d\n", ret); 1455 dev_err(wm831x->dev, "Failed to read parent ID: %d\n", ret);
1456 goto err; 1456 goto err;
1457 } 1457 }
1458 if (ret != 0x6204) { 1458 switch (ret) {
1459 case 0x6204:
1460 case 0x6246:
1461 break;
1462 default:
1459 dev_err(wm831x->dev, "Device is not a WM831x: ID %x\n", ret); 1463 dev_err(wm831x->dev, "Device is not a WM831x: ID %x\n", ret);
1460 ret = -EINVAL; 1464 ret = -EINVAL;
1461 goto err; 1465 goto err;
@@ -1620,7 +1624,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1620 case WM8325: 1624 case WM8325:
1621 ret = mfd_add_devices(wm831x->dev, -1, 1625 ret = mfd_add_devices(wm831x->dev, -1,
1622 wm8320_devs, ARRAY_SIZE(wm8320_devs), 1626 wm8320_devs, ARRAY_SIZE(wm8320_devs),
1623 NULL, 0); 1627 NULL, wm831x->irq_base);
1624 break; 1628 break;
1625 1629
1626 default: 1630 default:
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 31ae07a36576..57dcf8fa774a 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1773,6 +1773,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
1773 1773
1774 case PM_POST_SUSPEND: 1774 case PM_POST_SUSPEND:
1775 case PM_POST_HIBERNATION: 1775 case PM_POST_HIBERNATION:
1776 case PM_POST_RESTORE:
1776 1777
1777 spin_lock_irqsave(&host->lock, flags); 1778 spin_lock_irqsave(&host->lock, flags);
1778 host->rescan_disable = 0; 1779 host->rescan_disable = 0;
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index 591ab540b407..d3e6a962f423 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -69,6 +69,7 @@
69#include <linux/highmem.h> 69#include <linux/highmem.h>
70 70
71#include <linux/mmc/host.h> 71#include <linux/mmc/host.h>
72#include <linux/mmc/sdio.h>
72 73
73#include <asm/io.h> 74#include <asm/io.h>
74#include <asm/irq.h> 75#include <asm/irq.h>
@@ -493,10 +494,14 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command
493 else if (data->flags & MMC_DATA_WRITE) 494 else if (data->flags & MMC_DATA_WRITE)
494 cmdr |= AT91_MCI_TRCMD_START; 495 cmdr |= AT91_MCI_TRCMD_START;
495 496
496 if (data->flags & MMC_DATA_STREAM) 497 if (cmd->opcode == SD_IO_RW_EXTENDED) {
497 cmdr |= AT91_MCI_TRTYP_STREAM; 498 cmdr |= AT91_MCI_TRTYP_SDIO_BLOCK;
498 if (data->blocks > 1) 499 } else {
499 cmdr |= AT91_MCI_TRTYP_MULTIPLE; 500 if (data->flags & MMC_DATA_STREAM)
501 cmdr |= AT91_MCI_TRTYP_STREAM;
502 if (data->blocks > 1)
503 cmdr |= AT91_MCI_TRTYP_MULTIPLE;
504 }
500 } 505 }
501 else { 506 else {
502 block_length = 0; 507 block_length = 0;
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 301351a5d838..ad2a7a032cdf 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -26,6 +26,7 @@
26#include <linux/stat.h> 26#include <linux/stat.h>
27 27
28#include <linux/mmc/host.h> 28#include <linux/mmc/host.h>
29#include <linux/mmc/sdio.h>
29 30
30#include <mach/atmel-mci.h> 31#include <mach/atmel-mci.h>
31#include <linux/atmel-mci.h> 32#include <linux/atmel-mci.h>
@@ -532,12 +533,17 @@ static u32 atmci_prepare_command(struct mmc_host *mmc,
532 data = cmd->data; 533 data = cmd->data;
533 if (data) { 534 if (data) {
534 cmdr |= MCI_CMDR_START_XFER; 535 cmdr |= MCI_CMDR_START_XFER;
535 if (data->flags & MMC_DATA_STREAM) 536
536 cmdr |= MCI_CMDR_STREAM; 537 if (cmd->opcode == SD_IO_RW_EXTENDED) {
537 else if (data->blocks > 1) 538 cmdr |= MCI_CMDR_SDIO_BLOCK;
538 cmdr |= MCI_CMDR_MULTI_BLOCK; 539 } else {
539 else 540 if (data->flags & MMC_DATA_STREAM)
540 cmdr |= MCI_CMDR_BLOCK; 541 cmdr |= MCI_CMDR_STREAM;
542 else if (data->blocks > 1)
543 cmdr |= MCI_CMDR_MULTI_BLOCK;
544 else
545 cmdr |= MCI_CMDR_BLOCK;
546 }
541 547
542 if (data->flags & MMC_DATA_READ) 548 if (data->flags & MMC_DATA_READ)
543 cmdr |= MCI_CMDR_TRDIR_READ; 549 cmdr |= MCI_CMDR_TRDIR_READ;
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index 09b099bfab2b..bdf11d89a499 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -702,6 +702,7 @@ static int __devinit atl1c_sw_init(struct atl1c_adapter *adapter)
702 702
703 703
704 adapter->wol = 0; 704 adapter->wol = 0;
705 device_set_wakeup_enable(&pdev->dev, false);
705 adapter->link_speed = SPEED_0; 706 adapter->link_speed = SPEED_0;
706 adapter->link_duplex = FULL_DUPLEX; 707 adapter->link_duplex = FULL_DUPLEX;
707 adapter->num_rx_queues = AT_DEF_RECEIVE_QUEUE; 708 adapter->num_rx_queues = AT_DEF_RECEIVE_QUEUE;
@@ -2444,8 +2445,9 @@ static int atl1c_close(struct net_device *netdev)
2444 return 0; 2445 return 0;
2445} 2446}
2446 2447
2447static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) 2448static int atl1c_suspend(struct device *dev)
2448{ 2449{
2450 struct pci_dev *pdev = to_pci_dev(dev);
2449 struct net_device *netdev = pci_get_drvdata(pdev); 2451 struct net_device *netdev = pci_get_drvdata(pdev);
2450 struct atl1c_adapter *adapter = netdev_priv(netdev); 2452 struct atl1c_adapter *adapter = netdev_priv(netdev);
2451 struct atl1c_hw *hw = &adapter->hw; 2453 struct atl1c_hw *hw = &adapter->hw;
@@ -2454,7 +2456,6 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state)
2454 u32 wol_ctrl_data = 0; 2456 u32 wol_ctrl_data = 0;
2455 u16 mii_intr_status_data = 0; 2457 u16 mii_intr_status_data = 0;
2456 u32 wufc = adapter->wol; 2458 u32 wufc = adapter->wol;
2457 int retval = 0;
2458 2459
2459 atl1c_disable_l0s_l1(hw); 2460 atl1c_disable_l0s_l1(hw);
2460 if (netif_running(netdev)) { 2461 if (netif_running(netdev)) {
@@ -2462,9 +2463,6 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state)
2462 atl1c_down(adapter); 2463 atl1c_down(adapter);
2463 } 2464 }
2464 netif_device_detach(netdev); 2465 netif_device_detach(netdev);
2465 retval = pci_save_state(pdev);
2466 if (retval)
2467 return retval;
2468 2466
2469 if (wufc) 2467 if (wufc)
2470 if (atl1c_phy_power_saving(hw) != 0) 2468 if (atl1c_phy_power_saving(hw) != 0)
@@ -2525,12 +2523,8 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state)
2525 AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data); 2523 AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data);
2526 AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); 2524 AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data);
2527 2525
2528 /* pcie patch */
2529 device_set_wakeup_enable(&pdev->dev, 1);
2530
2531 AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_DEFAULT | 2526 AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_DEFAULT |
2532 GPHY_CTRL_EXT_RESET); 2527 GPHY_CTRL_EXT_RESET);
2533 pci_prepare_to_sleep(pdev);
2534 } else { 2528 } else {
2535 AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_POWER_SAVING); 2529 AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_POWER_SAVING);
2536 master_ctrl_data |= MASTER_CTRL_CLK_SEL_DIS; 2530 master_ctrl_data |= MASTER_CTRL_CLK_SEL_DIS;
@@ -2540,25 +2534,17 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state)
2540 AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); 2534 AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data);
2541 AT_WRITE_REG(hw, REG_WOL_CTRL, 0); 2535 AT_WRITE_REG(hw, REG_WOL_CTRL, 0);
2542 hw->phy_configured = false; /* re-init PHY when resume */ 2536 hw->phy_configured = false; /* re-init PHY when resume */
2543 pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
2544 } 2537 }
2545 2538
2546 pci_disable_device(pdev);
2547 pci_set_power_state(pdev, pci_choose_state(pdev, state));
2548
2549 return 0; 2539 return 0;
2550} 2540}
2551 2541
2552static int atl1c_resume(struct pci_dev *pdev) 2542static int atl1c_resume(struct device *dev)
2553{ 2543{
2544 struct pci_dev *pdev = to_pci_dev(dev);
2554 struct net_device *netdev = pci_get_drvdata(pdev); 2545 struct net_device *netdev = pci_get_drvdata(pdev);
2555 struct atl1c_adapter *adapter = netdev_priv(netdev); 2546 struct atl1c_adapter *adapter = netdev_priv(netdev);
2556 2547
2557 pci_set_power_state(pdev, PCI_D0);
2558 pci_restore_state(pdev);
2559 pci_enable_wake(pdev, PCI_D3hot, 0);
2560 pci_enable_wake(pdev, PCI_D3cold, 0);
2561
2562 AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0); 2548 AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0);
2563 atl1c_reset_pcie(&adapter->hw, ATL1C_PCIE_L0S_L1_DISABLE | 2549 atl1c_reset_pcie(&adapter->hw, ATL1C_PCIE_L0S_L1_DISABLE |
2564 ATL1C_PCIE_PHY_RESET); 2550 ATL1C_PCIE_PHY_RESET);
@@ -2582,7 +2568,12 @@ static int atl1c_resume(struct pci_dev *pdev)
2582 2568
2583static void atl1c_shutdown(struct pci_dev *pdev) 2569static void atl1c_shutdown(struct pci_dev *pdev)
2584{ 2570{
2585 atl1c_suspend(pdev, PMSG_SUSPEND); 2571 struct net_device *netdev = pci_get_drvdata(pdev);
2572 struct atl1c_adapter *adapter = netdev_priv(netdev);
2573
2574 atl1c_suspend(&pdev->dev);
2575 pci_wake_from_d3(pdev, adapter->wol);
2576 pci_set_power_state(pdev, PCI_D3hot);
2586} 2577}
2587 2578
2588static const struct net_device_ops atl1c_netdev_ops = { 2579static const struct net_device_ops atl1c_netdev_ops = {
@@ -2886,16 +2877,16 @@ static struct pci_error_handlers atl1c_err_handler = {
2886 .resume = atl1c_io_resume, 2877 .resume = atl1c_io_resume,
2887}; 2878};
2888 2879
2880static SIMPLE_DEV_PM_OPS(atl1c_pm_ops, atl1c_suspend, atl1c_resume);
2881
2889static struct pci_driver atl1c_driver = { 2882static struct pci_driver atl1c_driver = {
2890 .name = atl1c_driver_name, 2883 .name = atl1c_driver_name,
2891 .id_table = atl1c_pci_tbl, 2884 .id_table = atl1c_pci_tbl,
2892 .probe = atl1c_probe, 2885 .probe = atl1c_probe,
2893 .remove = __devexit_p(atl1c_remove), 2886 .remove = __devexit_p(atl1c_remove),
2894 /* Power Managment Hooks */
2895 .suspend = atl1c_suspend,
2896 .resume = atl1c_resume,
2897 .shutdown = atl1c_shutdown, 2887 .shutdown = atl1c_shutdown,
2898 .err_handler = &atl1c_err_handler 2888 .err_handler = &atl1c_err_handler,
2889 .driver.pm = &atl1c_pm_ops,
2899}; 2890};
2900 2891
2901/* 2892/*
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 53363108994e..3acf5123a6ef 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -3504,6 +3504,8 @@ static int atl1_set_ringparam(struct net_device *netdev,
3504 struct atl1_rfd_ring rfd_old, rfd_new; 3504 struct atl1_rfd_ring rfd_old, rfd_new;
3505 struct atl1_rrd_ring rrd_old, rrd_new; 3505 struct atl1_rrd_ring rrd_old, rrd_new;
3506 struct atl1_ring_header rhdr_old, rhdr_new; 3506 struct atl1_ring_header rhdr_old, rhdr_new;
3507 struct atl1_smb smb;
3508 struct atl1_cmb cmb;
3507 int err; 3509 int err;
3508 3510
3509 tpd_old = adapter->tpd_ring; 3511 tpd_old = adapter->tpd_ring;
@@ -3544,11 +3546,19 @@ static int atl1_set_ringparam(struct net_device *netdev,
3544 adapter->rrd_ring = rrd_old; 3546 adapter->rrd_ring = rrd_old;
3545 adapter->tpd_ring = tpd_old; 3547 adapter->tpd_ring = tpd_old;
3546 adapter->ring_header = rhdr_old; 3548 adapter->ring_header = rhdr_old;
3549 /*
3550 * Save SMB and CMB, since atl1_free_ring_resources
3551 * will clear them.
3552 */
3553 smb = adapter->smb;
3554 cmb = adapter->cmb;
3547 atl1_free_ring_resources(adapter); 3555 atl1_free_ring_resources(adapter);
3548 adapter->rfd_ring = rfd_new; 3556 adapter->rfd_ring = rfd_new;
3549 adapter->rrd_ring = rrd_new; 3557 adapter->rrd_ring = rrd_new;
3550 adapter->tpd_ring = tpd_new; 3558 adapter->tpd_ring = tpd_new;
3551 adapter->ring_header = rhdr_new; 3559 adapter->ring_header = rhdr_new;
3560 adapter->smb = smb;
3561 adapter->cmb = cmb;
3552 3562
3553 err = atl1_up(adapter); 3563 err = atl1_up(adapter);
3554 if (err) 3564 if (err)
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 4594a28b1f66..d64313b7090e 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -234,7 +234,7 @@ struct be_adapter {
234 u8 __iomem *db; /* Door Bell */ 234 u8 __iomem *db; /* Door Bell */
235 u8 __iomem *pcicfg; /* PCI config space */ 235 u8 __iomem *pcicfg; /* PCI config space */
236 236
237 spinlock_t mbox_lock; /* For serializing mbox cmds to BE card */ 237 struct mutex mbox_lock; /* For serializing mbox cmds to BE card */
238 struct be_dma_mem mbox_mem; 238 struct be_dma_mem mbox_mem;
239 /* Mbox mem is adjusted to align to 16 bytes. The allocated addr 239 /* Mbox mem is adjusted to align to 16 bytes. The allocated addr
240 * is stored for freeing purpose */ 240 * is stored for freeing purpose */
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index e4465d222a7d..1c8c79c9d214 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -462,7 +462,8 @@ int be_cmd_fw_init(struct be_adapter *adapter)
462 u8 *wrb; 462 u8 *wrb;
463 int status; 463 int status;
464 464
465 spin_lock(&adapter->mbox_lock); 465 if (mutex_lock_interruptible(&adapter->mbox_lock))
466 return -1;
466 467
467 wrb = (u8 *)wrb_from_mbox(adapter); 468 wrb = (u8 *)wrb_from_mbox(adapter);
468 *wrb++ = 0xFF; 469 *wrb++ = 0xFF;
@@ -476,7 +477,7 @@ int be_cmd_fw_init(struct be_adapter *adapter)
476 477
477 status = be_mbox_notify_wait(adapter); 478 status = be_mbox_notify_wait(adapter);
478 479
479 spin_unlock(&adapter->mbox_lock); 480 mutex_unlock(&adapter->mbox_lock);
480 return status; 481 return status;
481} 482}
482 483
@@ -491,7 +492,8 @@ int be_cmd_fw_clean(struct be_adapter *adapter)
491 if (adapter->eeh_err) 492 if (adapter->eeh_err)
492 return -EIO; 493 return -EIO;
493 494
494 spin_lock(&adapter->mbox_lock); 495 if (mutex_lock_interruptible(&adapter->mbox_lock))
496 return -1;
495 497
496 wrb = (u8 *)wrb_from_mbox(adapter); 498 wrb = (u8 *)wrb_from_mbox(adapter);
497 *wrb++ = 0xFF; 499 *wrb++ = 0xFF;
@@ -505,7 +507,7 @@ int be_cmd_fw_clean(struct be_adapter *adapter)
505 507
506 status = be_mbox_notify_wait(adapter); 508 status = be_mbox_notify_wait(adapter);
507 509
508 spin_unlock(&adapter->mbox_lock); 510 mutex_unlock(&adapter->mbox_lock);
509 return status; 511 return status;
510} 512}
511int be_cmd_eq_create(struct be_adapter *adapter, 513int be_cmd_eq_create(struct be_adapter *adapter,
@@ -516,7 +518,8 @@ int be_cmd_eq_create(struct be_adapter *adapter,
516 struct be_dma_mem *q_mem = &eq->dma_mem; 518 struct be_dma_mem *q_mem = &eq->dma_mem;
517 int status; 519 int status;
518 520
519 spin_lock(&adapter->mbox_lock); 521 if (mutex_lock_interruptible(&adapter->mbox_lock))
522 return -1;
520 523
521 wrb = wrb_from_mbox(adapter); 524 wrb = wrb_from_mbox(adapter);
522 req = embedded_payload(wrb); 525 req = embedded_payload(wrb);
@@ -546,7 +549,7 @@ int be_cmd_eq_create(struct be_adapter *adapter,
546 eq->created = true; 549 eq->created = true;
547 } 550 }
548 551
549 spin_unlock(&adapter->mbox_lock); 552 mutex_unlock(&adapter->mbox_lock);
550 return status; 553 return status;
551} 554}
552 555
@@ -558,7 +561,8 @@ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
558 struct be_cmd_req_mac_query *req; 561 struct be_cmd_req_mac_query *req;
559 int status; 562 int status;
560 563
561 spin_lock(&adapter->mbox_lock); 564 if (mutex_lock_interruptible(&adapter->mbox_lock))
565 return -1;
562 566
563 wrb = wrb_from_mbox(adapter); 567 wrb = wrb_from_mbox(adapter);
564 req = embedded_payload(wrb); 568 req = embedded_payload(wrb);
@@ -583,7 +587,7 @@ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
583 memcpy(mac_addr, resp->mac.addr, ETH_ALEN); 587 memcpy(mac_addr, resp->mac.addr, ETH_ALEN);
584 } 588 }
585 589
586 spin_unlock(&adapter->mbox_lock); 590 mutex_unlock(&adapter->mbox_lock);
587 return status; 591 return status;
588} 592}
589 593
@@ -667,7 +671,8 @@ int be_cmd_cq_create(struct be_adapter *adapter,
667 void *ctxt; 671 void *ctxt;
668 int status; 672 int status;
669 673
670 spin_lock(&adapter->mbox_lock); 674 if (mutex_lock_interruptible(&adapter->mbox_lock))
675 return -1;
671 676
672 wrb = wrb_from_mbox(adapter); 677 wrb = wrb_from_mbox(adapter);
673 req = embedded_payload(wrb); 678 req = embedded_payload(wrb);
@@ -701,7 +706,7 @@ int be_cmd_cq_create(struct be_adapter *adapter,
701 cq->created = true; 706 cq->created = true;
702 } 707 }
703 708
704 spin_unlock(&adapter->mbox_lock); 709 mutex_unlock(&adapter->mbox_lock);
705 710
706 return status; 711 return status;
707} 712}
@@ -724,7 +729,8 @@ int be_cmd_mccq_create(struct be_adapter *adapter,
724 void *ctxt; 729 void *ctxt;
725 int status; 730 int status;
726 731
727 spin_lock(&adapter->mbox_lock); 732 if (mutex_lock_interruptible(&adapter->mbox_lock))
733 return -1;
728 734
729 wrb = wrb_from_mbox(adapter); 735 wrb = wrb_from_mbox(adapter);
730 req = embedded_payload(wrb); 736 req = embedded_payload(wrb);
@@ -754,7 +760,7 @@ int be_cmd_mccq_create(struct be_adapter *adapter,
754 mccq->id = le16_to_cpu(resp->id); 760 mccq->id = le16_to_cpu(resp->id);
755 mccq->created = true; 761 mccq->created = true;
756 } 762 }
757 spin_unlock(&adapter->mbox_lock); 763 mutex_unlock(&adapter->mbox_lock);
758 764
759 return status; 765 return status;
760} 766}
@@ -769,7 +775,8 @@ int be_cmd_txq_create(struct be_adapter *adapter,
769 void *ctxt; 775 void *ctxt;
770 int status; 776 int status;
771 777
772 spin_lock(&adapter->mbox_lock); 778 if (mutex_lock_interruptible(&adapter->mbox_lock))
779 return -1;
773 780
774 wrb = wrb_from_mbox(adapter); 781 wrb = wrb_from_mbox(adapter);
775 req = embedded_payload(wrb); 782 req = embedded_payload(wrb);
@@ -801,7 +808,7 @@ int be_cmd_txq_create(struct be_adapter *adapter,
801 txq->created = true; 808 txq->created = true;
802 } 809 }
803 810
804 spin_unlock(&adapter->mbox_lock); 811 mutex_unlock(&adapter->mbox_lock);
805 812
806 return status; 813 return status;
807} 814}
@@ -816,7 +823,8 @@ int be_cmd_rxq_create(struct be_adapter *adapter,
816 struct be_dma_mem *q_mem = &rxq->dma_mem; 823 struct be_dma_mem *q_mem = &rxq->dma_mem;
817 int status; 824 int status;
818 825
819 spin_lock(&adapter->mbox_lock); 826 if (mutex_lock_interruptible(&adapter->mbox_lock))
827 return -1;
820 828
821 wrb = wrb_from_mbox(adapter); 829 wrb = wrb_from_mbox(adapter);
822 req = embedded_payload(wrb); 830 req = embedded_payload(wrb);
@@ -843,7 +851,7 @@ int be_cmd_rxq_create(struct be_adapter *adapter,
843 *rss_id = resp->rss_id; 851 *rss_id = resp->rss_id;
844 } 852 }
845 853
846 spin_unlock(&adapter->mbox_lock); 854 mutex_unlock(&adapter->mbox_lock);
847 855
848 return status; 856 return status;
849} 857}
@@ -862,7 +870,8 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
862 if (adapter->eeh_err) 870 if (adapter->eeh_err)
863 return -EIO; 871 return -EIO;
864 872
865 spin_lock(&adapter->mbox_lock); 873 if (mutex_lock_interruptible(&adapter->mbox_lock))
874 return -1;
866 875
867 wrb = wrb_from_mbox(adapter); 876 wrb = wrb_from_mbox(adapter);
868 req = embedded_payload(wrb); 877 req = embedded_payload(wrb);
@@ -899,7 +908,7 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
899 908
900 status = be_mbox_notify_wait(adapter); 909 status = be_mbox_notify_wait(adapter);
901 910
902 spin_unlock(&adapter->mbox_lock); 911 mutex_unlock(&adapter->mbox_lock);
903 912
904 return status; 913 return status;
905} 914}
@@ -915,7 +924,8 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags,
915 struct be_cmd_req_if_create *req; 924 struct be_cmd_req_if_create *req;
916 int status; 925 int status;
917 926
918 spin_lock(&adapter->mbox_lock); 927 if (mutex_lock_interruptible(&adapter->mbox_lock))
928 return -1;
919 929
920 wrb = wrb_from_mbox(adapter); 930 wrb = wrb_from_mbox(adapter);
921 req = embedded_payload(wrb); 931 req = embedded_payload(wrb);
@@ -941,7 +951,7 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags,
941 *pmac_id = le32_to_cpu(resp->pmac_id); 951 *pmac_id = le32_to_cpu(resp->pmac_id);
942 } 952 }
943 953
944 spin_unlock(&adapter->mbox_lock); 954 mutex_unlock(&adapter->mbox_lock);
945 return status; 955 return status;
946} 956}
947 957
@@ -955,7 +965,8 @@ int be_cmd_if_destroy(struct be_adapter *adapter, u32 interface_id)
955 if (adapter->eeh_err) 965 if (adapter->eeh_err)
956 return -EIO; 966 return -EIO;
957 967
958 spin_lock(&adapter->mbox_lock); 968 if (mutex_lock_interruptible(&adapter->mbox_lock))
969 return -1;
959 970
960 wrb = wrb_from_mbox(adapter); 971 wrb = wrb_from_mbox(adapter);
961 req = embedded_payload(wrb); 972 req = embedded_payload(wrb);
@@ -970,7 +981,7 @@ int be_cmd_if_destroy(struct be_adapter *adapter, u32 interface_id)
970 981
971 status = be_mbox_notify_wait(adapter); 982 status = be_mbox_notify_wait(adapter);
972 983
973 spin_unlock(&adapter->mbox_lock); 984 mutex_unlock(&adapter->mbox_lock);
974 985
975 return status; 986 return status;
976} 987}
@@ -1060,7 +1071,8 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver)
1060 struct be_cmd_req_get_fw_version *req; 1071 struct be_cmd_req_get_fw_version *req;
1061 int status; 1072 int status;
1062 1073
1063 spin_lock(&adapter->mbox_lock); 1074 if (mutex_lock_interruptible(&adapter->mbox_lock))
1075 return -1;
1064 1076
1065 wrb = wrb_from_mbox(adapter); 1077 wrb = wrb_from_mbox(adapter);
1066 req = embedded_payload(wrb); 1078 req = embedded_payload(wrb);
@@ -1077,7 +1089,7 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver)
1077 strncpy(fw_ver, resp->firmware_version_string, FW_VER_LEN); 1089 strncpy(fw_ver, resp->firmware_version_string, FW_VER_LEN);
1078 } 1090 }
1079 1091
1080 spin_unlock(&adapter->mbox_lock); 1092 mutex_unlock(&adapter->mbox_lock);
1081 return status; 1093 return status;
1082} 1094}
1083 1095
@@ -1322,7 +1334,8 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
1322 struct be_cmd_req_query_fw_cfg *req; 1334 struct be_cmd_req_query_fw_cfg *req;
1323 int status; 1335 int status;
1324 1336
1325 spin_lock(&adapter->mbox_lock); 1337 if (mutex_lock_interruptible(&adapter->mbox_lock))
1338 return -1;
1326 1339
1327 wrb = wrb_from_mbox(adapter); 1340 wrb = wrb_from_mbox(adapter);
1328 req = embedded_payload(wrb); 1341 req = embedded_payload(wrb);
@@ -1341,7 +1354,7 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
1341 *caps = le32_to_cpu(resp->function_caps); 1354 *caps = le32_to_cpu(resp->function_caps);
1342 } 1355 }
1343 1356
1344 spin_unlock(&adapter->mbox_lock); 1357 mutex_unlock(&adapter->mbox_lock);
1345 return status; 1358 return status;
1346} 1359}
1347 1360
@@ -1352,7 +1365,8 @@ int be_cmd_reset_function(struct be_adapter *adapter)
1352 struct be_cmd_req_hdr *req; 1365 struct be_cmd_req_hdr *req;
1353 int status; 1366 int status;
1354 1367
1355 spin_lock(&adapter->mbox_lock); 1368 if (mutex_lock_interruptible(&adapter->mbox_lock))
1369 return -1;
1356 1370
1357 wrb = wrb_from_mbox(adapter); 1371 wrb = wrb_from_mbox(adapter);
1358 req = embedded_payload(wrb); 1372 req = embedded_payload(wrb);
@@ -1365,7 +1379,7 @@ int be_cmd_reset_function(struct be_adapter *adapter)
1365 1379
1366 status = be_mbox_notify_wait(adapter); 1380 status = be_mbox_notify_wait(adapter);
1367 1381
1368 spin_unlock(&adapter->mbox_lock); 1382 mutex_unlock(&adapter->mbox_lock);
1369 return status; 1383 return status;
1370} 1384}
1371 1385
@@ -1376,7 +1390,8 @@ int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, u16 table_size)
1376 u32 myhash[10]; 1390 u32 myhash[10];
1377 int status; 1391 int status;
1378 1392
1379 spin_lock(&adapter->mbox_lock); 1393 if (mutex_lock_interruptible(&adapter->mbox_lock))
1394 return -1;
1380 1395
1381 wrb = wrb_from_mbox(adapter); 1396 wrb = wrb_from_mbox(adapter);
1382 req = embedded_payload(wrb); 1397 req = embedded_payload(wrb);
@@ -1396,7 +1411,7 @@ int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, u16 table_size)
1396 1411
1397 status = be_mbox_notify_wait(adapter); 1412 status = be_mbox_notify_wait(adapter);
1398 1413
1399 spin_unlock(&adapter->mbox_lock); 1414 mutex_unlock(&adapter->mbox_lock);
1400 return status; 1415 return status;
1401} 1416}
1402 1417
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 93354eee2cfd..fd251b59b7f9 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -2677,7 +2677,7 @@ static int be_ctrl_init(struct be_adapter *adapter)
2677 } 2677 }
2678 memset(mc_cmd_mem->va, 0, mc_cmd_mem->size); 2678 memset(mc_cmd_mem->va, 0, mc_cmd_mem->size);
2679 2679
2680 spin_lock_init(&adapter->mbox_lock); 2680 mutex_init(&adapter->mbox_lock);
2681 spin_lock_init(&adapter->mcc_lock); 2681 spin_lock_init(&adapter->mcc_lock);
2682 spin_lock_init(&adapter->mcc_cq_lock); 2682 spin_lock_init(&adapter->mcc_cq_lock);
2683 2683
diff --git a/drivers/net/bonding/bond_ipv6.c b/drivers/net/bonding/bond_ipv6.c
index 121b073a6c3f..84fbd4ebd778 100644
--- a/drivers/net/bonding/bond_ipv6.c
+++ b/drivers/net/bonding/bond_ipv6.c
@@ -88,7 +88,12 @@ static void bond_na_send(struct net_device *slave_dev,
88 } 88 }
89 89
90 if (vlan_id) { 90 if (vlan_id) {
91 skb = vlan_put_tag(skb, vlan_id); 91 /* The Ethernet header is not present yet, so it is
92 * too early to insert a VLAN tag. Force use of an
93 * out-of-line tag here and let dev_hard_start_xmit()
94 * insert it if the slave hardware can't.
95 */
96 skb = __vlan_hwaccel_put_tag(skb, vlan_id);
92 if (!skb) { 97 if (!skb) {
93 pr_err("failed to insert VLAN tag\n"); 98 pr_err("failed to insert VLAN tag\n");
94 return; 99 return;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d0ea760ce419..3b16c34ed86e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -418,36 +418,11 @@ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr)
418 * @bond: bond device that got this skb for tx. 418 * @bond: bond device that got this skb for tx.
419 * @skb: hw accel VLAN tagged skb to transmit 419 * @skb: hw accel VLAN tagged skb to transmit
420 * @slave_dev: slave that is supposed to xmit this skbuff 420 * @slave_dev: slave that is supposed to xmit this skbuff
421 *
422 * When the bond gets an skb to transmit that is
423 * already hardware accelerated VLAN tagged, and it
424 * needs to relay this skb to a slave that is not
425 * hw accel capable, the skb needs to be "unaccelerated",
426 * i.e. strip the hwaccel tag and re-insert it as part
427 * of the payload.
428 */ 421 */
429int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, 422int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
430 struct net_device *slave_dev) 423 struct net_device *slave_dev)
431{ 424{
432 unsigned short uninitialized_var(vlan_id); 425 skb->dev = slave_dev;
433
434 /* Test vlan_list not vlgrp to catch and handle 802.1p tags */
435 if (!list_empty(&bond->vlan_list) &&
436 !(slave_dev->features & NETIF_F_HW_VLAN_TX) &&
437 vlan_get_tag(skb, &vlan_id) == 0) {
438 skb->dev = slave_dev;
439 skb = vlan_put_tag(skb, vlan_id);
440 if (!skb) {
441 /* vlan_put_tag() frees the skb in case of error,
442 * so return success here so the calling functions
443 * won't attempt to free is again.
444 */
445 return 0;
446 }
447 } else {
448 skb->dev = slave_dev;
449 }
450
451 skb->priority = 1; 426 skb->priority = 1;
452#ifdef CONFIG_NET_POLL_CONTROLLER 427#ifdef CONFIG_NET_POLL_CONTROLLER
453 if (unlikely(bond->dev->priv_flags & IFF_IN_NETPOLL)) { 428 if (unlikely(bond->dev->priv_flags & IFF_IN_NETPOLL)) {
@@ -1203,11 +1178,13 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
1203 bond_do_fail_over_mac(bond, new_active, 1178 bond_do_fail_over_mac(bond, new_active,
1204 old_active); 1179 old_active);
1205 1180
1206 bond->send_grat_arp = bond->params.num_grat_arp; 1181 if (netif_running(bond->dev)) {
1207 bond_send_gratuitous_arp(bond); 1182 bond->send_grat_arp = bond->params.num_grat_arp;
1183 bond_send_gratuitous_arp(bond);
1208 1184
1209 bond->send_unsol_na = bond->params.num_unsol_na; 1185 bond->send_unsol_na = bond->params.num_unsol_na;
1210 bond_send_unsolicited_na(bond); 1186 bond_send_unsolicited_na(bond);
1187 }
1211 1188
1212 write_unlock_bh(&bond->curr_slave_lock); 1189 write_unlock_bh(&bond->curr_slave_lock);
1213 read_unlock(&bond->lock); 1190 read_unlock(&bond->lock);
@@ -1221,8 +1198,9 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
1221 1198
1222 /* resend IGMP joins since active slave has changed or 1199 /* resend IGMP joins since active slave has changed or
1223 * all were sent on curr_active_slave */ 1200 * all were sent on curr_active_slave */
1224 if ((USES_PRIMARY(bond->params.mode) && new_active) || 1201 if (((USES_PRIMARY(bond->params.mode) && new_active) ||
1225 bond->params.mode == BOND_MODE_ROUNDROBIN) { 1202 bond->params.mode == BOND_MODE_ROUNDROBIN) &&
1203 netif_running(bond->dev)) {
1226 bond->igmp_retrans = bond->params.resend_igmp; 1204 bond->igmp_retrans = bond->params.resend_igmp;
1227 queue_delayed_work(bond->wq, &bond->mcast_work, 0); 1205 queue_delayed_work(bond->wq, &bond->mcast_work, 0);
1228 } 1206 }
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index c2f081352a03..4feeb2d650a4 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -269,11 +269,11 @@ static inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct n
269 269
270 bond_for_each_slave(bond, slave, i) { 270 bond_for_each_slave(bond, slave, i) {
271 if (slave->dev == slave_dev) { 271 if (slave->dev == slave_dev) {
272 break; 272 return slave;
273 } 273 }
274 } 274 }
275 275
276 return slave; 276 return 0;
277} 277}
278 278
279static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) 279static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 92bac19ad60a..6dff32196c92 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -940,7 +940,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
940 &udev->l2_ring_map, 940 &udev->l2_ring_map,
941 GFP_KERNEL | __GFP_COMP); 941 GFP_KERNEL | __GFP_COMP);
942 if (!udev->l2_ring) 942 if (!udev->l2_ring)
943 return -ENOMEM; 943 goto err_udev;
944 944
945 udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size; 945 udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size;
946 udev->l2_buf_size = PAGE_ALIGN(udev->l2_buf_size); 946 udev->l2_buf_size = PAGE_ALIGN(udev->l2_buf_size);
@@ -948,7 +948,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
948 &udev->l2_buf_map, 948 &udev->l2_buf_map,
949 GFP_KERNEL | __GFP_COMP); 949 GFP_KERNEL | __GFP_COMP);
950 if (!udev->l2_buf) 950 if (!udev->l2_buf)
951 return -ENOMEM; 951 goto err_dma;
952 952
953 write_lock(&cnic_dev_lock); 953 write_lock(&cnic_dev_lock);
954 list_add(&udev->list, &cnic_udev_list); 954 list_add(&udev->list, &cnic_udev_list);
@@ -959,6 +959,12 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
959 cp->udev = udev; 959 cp->udev = udev;
960 960
961 return 0; 961 return 0;
962 err_dma:
963 dma_free_coherent(&udev->pdev->dev, udev->l2_ring_size,
964 udev->l2_ring, udev->l2_ring_map);
965 err_udev:
966 kfree(udev);
967 return -ENOMEM;
962} 968}
963 969
964static int cnic_init_uio(struct cnic_dev *dev) 970static int cnic_init_uio(struct cnic_dev *dev)
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c
index 1f37ee6b2a26..d6cf502906cf 100644
--- a/drivers/net/ehea/ehea_ethtool.c
+++ b/drivers/net/ehea/ehea_ethtool.c
@@ -263,6 +263,13 @@ static void ehea_get_ethtool_stats(struct net_device *dev,
263 263
264static int ehea_set_flags(struct net_device *dev, u32 data) 264static int ehea_set_flags(struct net_device *dev, u32 data)
265{ 265{
266 /* Avoid changing the VLAN flags */
267 if ((data & (ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN)) !=
268 (ethtool_op_get_flags(dev) & (ETH_FLAG_RXVLAN |
269 ETH_FLAG_TXVLAN))){
270 return -EINVAL;
271 }
272
266 return ethtool_op_set_flags(dev, data, ETH_FLAG_LRO 273 return ethtool_op_set_flags(dev, data, ETH_FLAG_LRO
267 | ETH_FLAG_TXVLAN 274 | ETH_FLAG_TXVLAN
268 | ETH_FLAG_RXVLAN); 275 | ETH_FLAG_RXVLAN);
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index aa56963ad558..c353bf3113cc 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -935,7 +935,7 @@ static void epic_init_ring(struct net_device *dev)
935 935
936 /* Fill in the Rx buffers. Handle allocation failure gracefully. */ 936 /* Fill in the Rx buffers. Handle allocation failure gracefully. */
937 for (i = 0; i < RX_RING_SIZE; i++) { 937 for (i = 0; i < RX_RING_SIZE; i++) {
938 struct sk_buff *skb = dev_alloc_skb(ep->rx_buf_sz); 938 struct sk_buff *skb = dev_alloc_skb(ep->rx_buf_sz + 2);
939 ep->rx_skbuff[i] = skb; 939 ep->rx_skbuff[i] = skb;
940 if (skb == NULL) 940 if (skb == NULL)
941 break; 941 break;
@@ -1233,7 +1233,7 @@ static int epic_rx(struct net_device *dev, int budget)
1233 entry = ep->dirty_rx % RX_RING_SIZE; 1233 entry = ep->dirty_rx % RX_RING_SIZE;
1234 if (ep->rx_skbuff[entry] == NULL) { 1234 if (ep->rx_skbuff[entry] == NULL) {
1235 struct sk_buff *skb; 1235 struct sk_buff *skb;
1236 skb = ep->rx_skbuff[entry] = dev_alloc_skb(ep->rx_buf_sz); 1236 skb = ep->rx_skbuff[entry] = dev_alloc_skb(ep->rx_buf_sz + 2);
1237 if (skb == NULL) 1237 if (skb == NULL)
1238 break; 1238 break;
1239 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ 1239 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index 9a6485892b3d..80d25ed53344 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -1202,7 +1202,7 @@ static void hamachi_init_ring(struct net_device *dev)
1202 } 1202 }
1203 /* Fill in the Rx buffers. Handle allocation failure gracefully. */ 1203 /* Fill in the Rx buffers. Handle allocation failure gracefully. */
1204 for (i = 0; i < RX_RING_SIZE; i++) { 1204 for (i = 0; i < RX_RING_SIZE; i++) {
1205 struct sk_buff *skb = dev_alloc_skb(hmp->rx_buf_sz); 1205 struct sk_buff *skb = dev_alloc_skb(hmp->rx_buf_sz + 2);
1206 hmp->rx_skbuff[i] = skb; 1206 hmp->rx_skbuff[i] = skb;
1207 if (skb == NULL) 1207 if (skb == NULL)
1208 break; 1208 break;
@@ -1669,7 +1669,7 @@ static int hamachi_rx(struct net_device *dev)
1669 entry = hmp->dirty_rx % RX_RING_SIZE; 1669 entry = hmp->dirty_rx % RX_RING_SIZE;
1670 desc = &(hmp->rx_ring[entry]); 1670 desc = &(hmp->rx_ring[entry]);
1671 if (hmp->rx_skbuff[entry] == NULL) { 1671 if (hmp->rx_skbuff[entry] == NULL) {
1672 struct sk_buff *skb = dev_alloc_skb(hmp->rx_buf_sz); 1672 struct sk_buff *skb = dev_alloc_skb(hmp->rx_buf_sz + 2);
1673 1673
1674 hmp->rx_skbuff[entry] = skb; 1674 hmp->rx_skbuff[entry] = skb;
1675 if (skb == NULL) 1675 if (skb == NULL)
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 8a4d19e5de06..f1047dd8a526 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -690,6 +690,7 @@ static void block_output(struct net_device *dev, int count,
690static struct pcmcia_device_id axnet_ids[] = { 690static struct pcmcia_device_id axnet_ids[] = {
691 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x016c, 0x0081), 691 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x016c, 0x0081),
692 PCMCIA_DEVICE_MANF_CARD(0x018a, 0x0301), 692 PCMCIA_DEVICE_MANF_CARD(0x018a, 0x0301),
693 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x2328),
693 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0301), 694 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0301),
694 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0303), 695 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0303),
695 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309), 696 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309),
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index d05c44692f08..2c158910f7ea 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1493,7 +1493,6 @@ static struct pcmcia_device_id pcnet_ids[] = {
1493 PCMCIA_DEVICE_MANF_CARD(0x0149, 0x4530), 1493 PCMCIA_DEVICE_MANF_CARD(0x0149, 0x4530),
1494 PCMCIA_DEVICE_MANF_CARD(0x0149, 0xc1ab), 1494 PCMCIA_DEVICE_MANF_CARD(0x0149, 0xc1ab),
1495 PCMCIA_DEVICE_MANF_CARD(0x0186, 0x0110), 1495 PCMCIA_DEVICE_MANF_CARD(0x0186, 0x0110),
1496 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x2328),
1497 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x8041), 1496 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x8041),
1498 PCMCIA_DEVICE_MANF_CARD(0x0213, 0x2452), 1497 PCMCIA_DEVICE_MANF_CARD(0x0213, 0x2452),
1499 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0300), 1498 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0300),
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 39659976a1ac..89294b43c4a9 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -1285,6 +1285,11 @@ ppp_push(struct ppp *ppp)
1285} 1285}
1286 1286
1287#ifdef CONFIG_PPP_MULTILINK 1287#ifdef CONFIG_PPP_MULTILINK
1288static bool mp_protocol_compress __read_mostly = true;
1289module_param(mp_protocol_compress, bool, S_IRUGO | S_IWUSR);
1290MODULE_PARM_DESC(mp_protocol_compress,
1291 "compress protocol id in multilink fragments");
1292
1288/* 1293/*
1289 * Divide a packet to be transmitted into fragments and 1294 * Divide a packet to be transmitted into fragments and
1290 * send them out the individual links. 1295 * send them out the individual links.
@@ -1347,10 +1352,10 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
1347 if (nfree == 0 || nfree < navail / 2) 1352 if (nfree == 0 || nfree < navail / 2)
1348 return 0; /* can't take now, leave it in xmit_pending */ 1353 return 0; /* can't take now, leave it in xmit_pending */
1349 1354
1350 /* Do protocol field compression (XXX this should be optional) */ 1355 /* Do protocol field compression */
1351 p = skb->data; 1356 p = skb->data;
1352 len = skb->len; 1357 len = skb->len;
1353 if (*p == 0) { 1358 if (*p == 0 && mp_protocol_compress) {
1354 ++p; 1359 ++p;
1355 --len; 1360 --len;
1356 } 1361 }
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
index 0a66fed52e8e..16c62659cdd9 100644
--- a/drivers/net/skfp/skfddi.c
+++ b/drivers/net/skfp/skfddi.c
@@ -412,7 +412,7 @@ static int skfp_driver_init(struct net_device *dev)
412 bp->SharedMemAddr = pci_alloc_consistent(&bp->pdev, 412 bp->SharedMemAddr = pci_alloc_consistent(&bp->pdev,
413 bp->SharedMemSize, 413 bp->SharedMemSize,
414 &bp->SharedMemDMA); 414 &bp->SharedMemDMA);
415 if (!bp->SharedMemSize) { 415 if (!bp->SharedMemAddr) {
416 printk("could not allocate mem for "); 416 printk("could not allocate mem for ");
417 printk("hardware module: %ld byte\n", 417 printk("hardware module: %ld byte\n",
418 bp->SharedMemSize); 418 bp->SharedMemSize);
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 4adf12422787..a4f2bd52e546 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -148,7 +148,7 @@ static int full_duplex[MAX_UNITS] = {0, };
148 * This SUCKS. 148 * This SUCKS.
149 * We need a much better method to determine if dma_addr_t is 64-bit. 149 * We need a much better method to determine if dma_addr_t is 64-bit.
150 */ 150 */
151#if (defined(__i386__) && defined(CONFIG_HIGHMEM64G)) || defined(__x86_64__) || defined (__ia64__) || defined(__alpha__) || defined(__mips64__) || (defined(__mips__) && defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) || (defined(__powerpc64__) || defined(CONFIG_PHYS_64BIT)) 151#if (defined(__i386__) && defined(CONFIG_HIGHMEM64G)) || defined(__x86_64__) || defined (__ia64__) || defined(__alpha__) || (defined(CONFIG_MIPS) && ((defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) || defined(CONFIG_64BIT))) || (defined(__powerpc64__) || defined(CONFIG_PHYS_64BIT))
152/* 64-bit dma_addr_t */ 152/* 64-bit dma_addr_t */
153#define ADDR_64BITS /* This chip uses 64 bit addresses. */ 153#define ADDR_64BITS /* This chip uses 64 bit addresses. */
154#define netdrv_addr_t __le64 154#define netdrv_addr_t __le64
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index 3ed2a67bd6d3..b409d7ec4ac1 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -1016,7 +1016,7 @@ static void init_ring(struct net_device *dev)
1016 1016
1017 /* Fill in the Rx buffers. Handle allocation failure gracefully. */ 1017 /* Fill in the Rx buffers. Handle allocation failure gracefully. */
1018 for (i = 0; i < RX_RING_SIZE; i++) { 1018 for (i = 0; i < RX_RING_SIZE; i++) {
1019 struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz); 1019 struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + 2);
1020 np->rx_skbuff[i] = skb; 1020 np->rx_skbuff[i] = skb;
1021 if (skb == NULL) 1021 if (skb == NULL)
1022 break; 1022 break;
@@ -1407,7 +1407,7 @@ static void refill_rx (struct net_device *dev)
1407 struct sk_buff *skb; 1407 struct sk_buff *skb;
1408 entry = np->dirty_rx % RX_RING_SIZE; 1408 entry = np->dirty_rx % RX_RING_SIZE;
1409 if (np->rx_skbuff[entry] == NULL) { 1409 if (np->rx_skbuff[entry] == NULL) {
1410 skb = dev_alloc_skb(np->rx_buf_sz); 1410 skb = dev_alloc_skb(np->rx_buf_sz + 2);
1411 np->rx_skbuff[entry] = skb; 1411 np->rx_skbuff[entry] = skb;
1412 if (skb == NULL) 1412 if (skb == NULL)
1413 break; /* Better luck next round. */ 1413 break; /* Better luck next round. */
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 8b3dc1eb4015..296000bf5a25 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -324,7 +324,7 @@ static int bdx_fw_load(struct bdx_priv *priv)
324 ENTER; 324 ENTER;
325 master = READ_REG(priv, regINIT_SEMAPHORE); 325 master = READ_REG(priv, regINIT_SEMAPHORE);
326 if (!READ_REG(priv, regINIT_STATUS) && master) { 326 if (!READ_REG(priv, regINIT_STATUS) && master) {
327 rc = request_firmware(&fw, "tehuti/firmware.bin", &priv->pdev->dev); 327 rc = request_firmware(&fw, "tehuti/bdx.bin", &priv->pdev->dev);
328 if (rc) 328 if (rc)
329 goto out; 329 goto out;
330 bdx_tx_push_desc_safe(priv, (char *)fw->data, fw->size); 330 bdx_tx_push_desc_safe(priv, (char *)fw->data, fw->size);
@@ -2510,4 +2510,4 @@ module_exit(bdx_module_exit);
2510MODULE_LICENSE("GPL"); 2510MODULE_LICENSE("GPL");
2511MODULE_AUTHOR(DRIVER_AUTHOR); 2511MODULE_AUTHOR(DRIVER_AUTHOR);
2512MODULE_DESCRIPTION(BDX_DRV_DESC); 2512MODULE_DESCRIPTION(BDX_DRV_DESC);
2513MODULE_FIRMWARE("tehuti/firmware.bin"); 2513MODULE_FIRMWARE("tehuti/bdx.bin");
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 30ccbb6d097a..6f97b7bbcbf1 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -12658,7 +12658,7 @@ static void __devinit tg3_read_vpd(struct tg3 *tp)
12658 cnt = pci_read_vpd(tp->pdev, pos, 12658 cnt = pci_read_vpd(tp->pdev, pos,
12659 TG3_NVM_VPD_LEN - pos, 12659 TG3_NVM_VPD_LEN - pos,
12660 &vpd_data[pos]); 12660 &vpd_data[pos]);
12661 if (cnt == -ETIMEDOUT || -EINTR) 12661 if (cnt == -ETIMEDOUT || cnt == -EINTR)
12662 cnt = 0; 12662 cnt = 0;
12663 else if (cnt < 0) 12663 else if (cnt < 0)
12664 goto out_not_found; 12664 goto out_not_found;
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 5b83c3f35f47..a3c46f6a15e7 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -1004,7 +1004,6 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
1004 } 1004 }
1005 1005
1006 strcpy(info->driver, KBUILD_MODNAME); 1006 strcpy(info->driver, KBUILD_MODNAME);
1007 strcpy(info->version, UTS_RELEASE);
1008 strcpy(info->bus_info, pci_name(pci_dev)); 1007 strcpy(info->bus_info, pci_name(pci_dev));
1009} 1008}
1010 1009
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index aea4645be7f6..6140b56cce53 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -1508,6 +1508,10 @@ static const struct usb_device_id products [] = {
1508 USB_DEVICE (0x0b95, 0x1780), 1508 USB_DEVICE (0x0b95, 0x1780),
1509 .driver_info = (unsigned long) &ax88178_info, 1509 .driver_info = (unsigned long) &ax88178_info,
1510}, { 1510}, {
1511 // Logitec LAN-GTJ/U2A
1512 USB_DEVICE (0x0789, 0x0160),
1513 .driver_info = (unsigned long) &ax88178_info,
1514}, {
1511 // Linksys USB200M Rev 2 1515 // Linksys USB200M Rev 2
1512 USB_DEVICE (0x13b1, 0x0018), 1516 USB_DEVICE (0x13b1, 0x0018),
1513 .driver_info = (unsigned long) &ax88772_info, 1517 .driver_info = (unsigned long) &ax88772_info,
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index a6281e3987b5..2b791392e788 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * MOSCHIP MCS7830 based USB 2.0 Ethernet Devices 2 * MOSCHIP MCS7830 based (7730/7830/7832) USB 2.0 Ethernet Devices
3 * 3 *
4 * based on usbnet.c, asix.c and the vendor provided mcs7830 driver 4 * based on usbnet.c, asix.c and the vendor provided mcs7830 driver
5 * 5 *
@@ -11,6 +11,9 @@
11 * 11 *
12 * Definitions gathered from MOSCHIP, Data Sheet_7830DA.pdf (thanks!). 12 * Definitions gathered from MOSCHIP, Data Sheet_7830DA.pdf (thanks!).
13 * 13 *
14 * 2010-12-19: add 7832 USB PID ("functionality same as MCS7830"),
15 * per active notification by manufacturer
16 *
14 * TODO: 17 * TODO:
15 * - support HIF_REG_CONFIG_SLEEPMODE/HIF_REG_CONFIG_TXENABLE (via autopm?) 18 * - support HIF_REG_CONFIG_SLEEPMODE/HIF_REG_CONFIG_TXENABLE (via autopm?)
16 * - implement ethtool_ops get_pauseparam/set_pauseparam 19 * - implement ethtool_ops get_pauseparam/set_pauseparam
@@ -60,6 +63,7 @@
60#define MCS7830_MAX_MCAST 64 63#define MCS7830_MAX_MCAST 64
61 64
62#define MCS7830_VENDOR_ID 0x9710 65#define MCS7830_VENDOR_ID 0x9710
66#define MCS7832_PRODUCT_ID 0x7832
63#define MCS7830_PRODUCT_ID 0x7830 67#define MCS7830_PRODUCT_ID 0x7830
64#define MCS7730_PRODUCT_ID 0x7730 68#define MCS7730_PRODUCT_ID 0x7730
65 69
@@ -351,7 +355,7 @@ static int mcs7830_set_autoneg(struct usbnet *dev, int ptrUserPhyMode)
351 if (!ret) 355 if (!ret)
352 ret = mcs7830_write_phy(dev, MII_BMCR, 356 ret = mcs7830_write_phy(dev, MII_BMCR,
353 BMCR_ANENABLE | BMCR_ANRESTART ); 357 BMCR_ANENABLE | BMCR_ANRESTART );
354 return ret < 0 ? : 0; 358 return ret;
355} 359}
356 360
357 361
@@ -626,7 +630,7 @@ static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
626} 630}
627 631
628static const struct driver_info moschip_info = { 632static const struct driver_info moschip_info = {
629 .description = "MOSCHIP 7830/7730 usb-NET adapter", 633 .description = "MOSCHIP 7830/7832/7730 usb-NET adapter",
630 .bind = mcs7830_bind, 634 .bind = mcs7830_bind,
631 .rx_fixup = mcs7830_rx_fixup, 635 .rx_fixup = mcs7830_rx_fixup,
632 .flags = FLAG_ETHER, 636 .flags = FLAG_ETHER,
@@ -645,6 +649,10 @@ static const struct driver_info sitecom_info = {
645 649
646static const struct usb_device_id products[] = { 650static const struct usb_device_id products[] = {
647 { 651 {
652 USB_DEVICE(MCS7830_VENDOR_ID, MCS7832_PRODUCT_ID),
653 .driver_info = (unsigned long) &moschip_info,
654 },
655 {
648 USB_DEVICE(MCS7830_VENDOR_ID, MCS7830_PRODUCT_ID), 656 USB_DEVICE(MCS7830_VENDOR_ID, MCS7830_PRODUCT_ID),
649 .driver_info = (unsigned long) &moschip_info, 657 .driver_info = (unsigned long) &moschip_info,
650 }, 658 },
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 0bbc0c323135..cc83fa71c3ff 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -166,7 +166,9 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
166 if (!(rcv->flags & IFF_UP)) 166 if (!(rcv->flags & IFF_UP))
167 goto tx_drop; 167 goto tx_drop;
168 168
169 if (dev->features & NETIF_F_NO_CSUM) 169 /* don't change ip_summed == CHECKSUM_PARTIAL, as that
170 will cause bad checksum on forwarded packets */
171 if (skb->ip_summed == CHECKSUM_NONE)
170 skb->ip_summed = rcv_priv->ip_summed; 172 skb->ip_summed = rcv_priv->ip_summed;
171 173
172 length = skb->len + ETH_HLEN; 174 length = skb->len + ETH_HLEN;
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index 25a2722c8a98..1d9aed645723 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -891,7 +891,6 @@ void hostap_setup_dev(struct net_device *dev, local_info_t *local,
891 891
892 SET_ETHTOOL_OPS(dev, &prism2_ethtool_ops); 892 SET_ETHTOOL_OPS(dev, &prism2_ethtool_ops);
893 893
894 netif_stop_queue(dev);
895} 894}
896 895
897static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked) 896static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked)
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index db540910b110..0e027f787fbc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -315,6 +315,7 @@ struct iwl_cfg iwl100_bgn_cfg = {
315 .mod_params = &iwlagn_mod_params, 315 .mod_params = &iwlagn_mod_params,
316 .base_params = &iwl1000_base_params, 316 .base_params = &iwl1000_base_params,
317 .ht_params = &iwl1000_ht_params, 317 .ht_params = &iwl1000_ht_params,
318 .use_new_eeprom_reading = true,
318}; 319};
319 320
320struct iwl_cfg iwl100_bg_cfg = { 321struct iwl_cfg iwl100_bg_cfg = {
@@ -330,6 +331,7 @@ struct iwl_cfg iwl100_bg_cfg = {
330 .ops = &iwl1000_ops, 331 .ops = &iwl1000_ops,
331 .mod_params = &iwlagn_mod_params, 332 .mod_params = &iwlagn_mod_params,
332 .base_params = &iwl1000_base_params, 333 .base_params = &iwl1000_base_params,
334 .use_new_eeprom_reading = true,
333}; 335};
334 336
335MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); 337MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 11e6532fc573..0ceeaac85eda 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -561,6 +561,7 @@ struct iwl_cfg iwl6000g2a_2agn_cfg = {
561 .ht_params = &iwl6000_ht_params, 561 .ht_params = &iwl6000_ht_params,
562 .need_dc_calib = true, 562 .need_dc_calib = true,
563 .need_temp_offset_calib = true, 563 .need_temp_offset_calib = true,
564 .use_new_eeprom_reading = true,
564}; 565};
565 566
566struct iwl_cfg iwl6000g2a_2abg_cfg = { 567struct iwl_cfg iwl6000g2a_2abg_cfg = {
@@ -578,6 +579,7 @@ struct iwl_cfg iwl6000g2a_2abg_cfg = {
578 .base_params = &iwl6000_base_params, 579 .base_params = &iwl6000_base_params,
579 .need_dc_calib = true, 580 .need_dc_calib = true,
580 .need_temp_offset_calib = true, 581 .need_temp_offset_calib = true,
582 .use_new_eeprom_reading = true,
581}; 583};
582 584
583struct iwl_cfg iwl6000g2a_2bg_cfg = { 585struct iwl_cfg iwl6000g2a_2bg_cfg = {
@@ -595,6 +597,7 @@ struct iwl_cfg iwl6000g2a_2bg_cfg = {
595 .base_params = &iwl6000_base_params, 597 .base_params = &iwl6000_base_params,
596 .need_dc_calib = true, 598 .need_dc_calib = true,
597 .need_temp_offset_calib = true, 599 .need_temp_offset_calib = true,
600 .use_new_eeprom_reading = true,
598}; 601};
599 602
600struct iwl_cfg iwl6000g2b_2agn_cfg = { 603struct iwl_cfg iwl6000g2b_2agn_cfg = {
@@ -616,6 +619,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = {
616 .need_temp_offset_calib = true, 619 .need_temp_offset_calib = true,
617 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 620 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
618 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 621 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
622 .use_new_eeprom_reading = true,
619}; 623};
620 624
621struct iwl_cfg iwl6000g2b_2abg_cfg = { 625struct iwl_cfg iwl6000g2b_2abg_cfg = {
@@ -636,6 +640,7 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = {
636 .need_temp_offset_calib = true, 640 .need_temp_offset_calib = true,
637 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 641 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
638 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 642 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
643 .use_new_eeprom_reading = true,
639}; 644};
640 645
641struct iwl_cfg iwl6000g2b_2bgn_cfg = { 646struct iwl_cfg iwl6000g2b_2bgn_cfg = {
@@ -657,6 +662,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = {
657 .need_temp_offset_calib = true, 662 .need_temp_offset_calib = true,
658 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 663 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
659 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 664 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
665 .use_new_eeprom_reading = true,
660}; 666};
661 667
662struct iwl_cfg iwl6000g2b_2bg_cfg = { 668struct iwl_cfg iwl6000g2b_2bg_cfg = {
@@ -677,6 +683,7 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = {
677 .need_temp_offset_calib = true, 683 .need_temp_offset_calib = true,
678 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 684 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
679 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 685 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
686 .use_new_eeprom_reading = true,
680}; 687};
681 688
682struct iwl_cfg iwl6000g2b_bgn_cfg = { 689struct iwl_cfg iwl6000g2b_bgn_cfg = {
@@ -698,6 +705,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = {
698 .need_temp_offset_calib = true, 705 .need_temp_offset_calib = true,
699 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 706 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
700 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 707 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
708 .use_new_eeprom_reading = true,
701}; 709};
702 710
703struct iwl_cfg iwl6000g2b_bg_cfg = { 711struct iwl_cfg iwl6000g2b_bg_cfg = {
@@ -718,6 +726,7 @@ struct iwl_cfg iwl6000g2b_bg_cfg = {
718 .need_temp_offset_calib = true, 726 .need_temp_offset_calib = true,
719 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 727 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
720 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 728 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
729 .use_new_eeprom_reading = true,
721}; 730};
722 731
723/* 732/*
@@ -804,6 +813,7 @@ struct iwl_cfg iwl6050g2_bgn_cfg = {
804 .base_params = &iwl6050_base_params, 813 .base_params = &iwl6050_base_params,
805 .ht_params = &iwl6000_ht_params, 814 .ht_params = &iwl6000_ht_params,
806 .need_dc_calib = true, 815 .need_dc_calib = true,
816 .use_new_eeprom_reading = true,
807}; 817};
808 818
809struct iwl_cfg iwl6050_2abg_cfg = { 819struct iwl_cfg iwl6050_2abg_cfg = {
@@ -857,6 +867,7 @@ struct iwl_cfg iwl130_bgn_cfg = {
857 .need_dc_calib = true, 867 .need_dc_calib = true,
858 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 868 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
859 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 869 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
870 .use_new_eeprom_reading = true,
860}; 871};
861 872
862struct iwl_cfg iwl130_bg_cfg = { 873struct iwl_cfg iwl130_bg_cfg = {
@@ -876,6 +887,7 @@ struct iwl_cfg iwl130_bg_cfg = {
876 .need_dc_calib = true, 887 .need_dc_calib = true,
877 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 888 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
878 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 889 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
890 .use_new_eeprom_reading = true,
879}; 891};
880 892
881MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); 893MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
index a650baba0809..9eeeda18748d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
@@ -392,7 +392,7 @@ static s8 iwl_update_channel_txpower(struct iwl_priv *priv,
392/** 392/**
393 * iwlcore_eeprom_enhanced_txpower: process enhanced tx power info 393 * iwlcore_eeprom_enhanced_txpower: process enhanced tx power info
394 */ 394 */
395void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv) 395static void iwlcore_eeprom_enhanced_txpower_old(struct iwl_priv *priv)
396{ 396{
397 int eeprom_section_count = 0; 397 int eeprom_section_count = 0;
398 int section, element; 398 int section, element;
@@ -419,7 +419,8 @@ void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv)
419 * always check for valid entry before process 419 * always check for valid entry before process
420 * the information 420 * the information
421 */ 421 */
422 if (!enhanced_txpower->common || enhanced_txpower->reserved) 422 if (!(enhanced_txpower->flags || enhanced_txpower->channel) ||
423 enhanced_txpower->delta_20_in_40)
423 continue; 424 continue;
424 425
425 for (element = 0; element < eeprom_section_count; element++) { 426 for (element = 0; element < eeprom_section_count; element++) {
@@ -452,3 +453,86 @@ void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv)
452 } 453 }
453 } 454 }
454} 455}
456
457static void
458iwlcore_eeprom_enh_txp_read_element(struct iwl_priv *priv,
459 struct iwl_eeprom_enhanced_txpwr *txp,
460 s8 max_txpower_avg)
461{
462 int ch_idx;
463 bool is_ht40 = txp->flags & IWL_EEPROM_ENH_TXP_FL_40MHZ;
464 enum ieee80211_band band;
465
466 band = txp->flags & IWL_EEPROM_ENH_TXP_FL_BAND_52G ?
467 IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ;
468
469 for (ch_idx = 0; ch_idx < priv->channel_count; ch_idx++) {
470 struct iwl_channel_info *ch_info = &priv->channel_info[ch_idx];
471
472 /* update matching channel or from common data only */
473 if (txp->channel != 0 && ch_info->channel != txp->channel)
474 continue;
475
476 /* update matching band only */
477 if (band != ch_info->band)
478 continue;
479
480 if (ch_info->max_power_avg < max_txpower_avg && !is_ht40) {
481 ch_info->max_power_avg = max_txpower_avg;
482 ch_info->curr_txpow = max_txpower_avg;
483 ch_info->scan_power = max_txpower_avg;
484 }
485
486 if (is_ht40 && ch_info->ht40_max_power_avg < max_txpower_avg)
487 ch_info->ht40_max_power_avg = max_txpower_avg;
488 }
489}
490
491#define EEPROM_TXP_OFFS (0x00 | INDIRECT_ADDRESS | INDIRECT_TXP_LIMIT)
492#define EEPROM_TXP_ENTRY_LEN sizeof(struct iwl_eeprom_enhanced_txpwr)
493#define EEPROM_TXP_SZ_OFFS (0x00 | INDIRECT_ADDRESS | INDIRECT_TXP_LIMIT_SIZE)
494
495static void iwlcore_eeprom_enhanced_txpower_new(struct iwl_priv *priv)
496{
497 struct iwl_eeprom_enhanced_txpwr *txp_array, *txp;
498 int idx, entries;
499 __le16 *txp_len;
500 s8 max_txp_avg, max_txp_avg_halfdbm;
501
502 BUILD_BUG_ON(sizeof(struct iwl_eeprom_enhanced_txpwr) != 8);
503
504 /* the length is in 16-bit words, but we want entries */
505 txp_len = (__le16 *) iwlagn_eeprom_query_addr(priv, EEPROM_TXP_SZ_OFFS);
506 entries = le16_to_cpup(txp_len) * 2 / EEPROM_TXP_ENTRY_LEN;
507
508 txp_array = (void *) iwlagn_eeprom_query_addr(priv, EEPROM_TXP_OFFS);
509 for (idx = 0; idx < entries; idx++) {
510 txp = &txp_array[idx];
511
512 /* skip invalid entries */
513 if (!(txp->flags & IWL_EEPROM_ENH_TXP_FL_VALID))
514 continue;
515
516 max_txp_avg = iwl_get_max_txpower_avg(priv, txp_array, idx,
517 &max_txp_avg_halfdbm);
518
519 /*
520 * Update the user limit values values to the highest
521 * power supported by any channel
522 */
523 if (max_txp_avg > priv->tx_power_user_lmt)
524 priv->tx_power_user_lmt = max_txp_avg;
525 if (max_txp_avg_halfdbm > priv->tx_power_lmt_in_half_dbm)
526 priv->tx_power_lmt_in_half_dbm = max_txp_avg_halfdbm;
527
528 iwlcore_eeprom_enh_txp_read_element(priv, txp, max_txp_avg);
529 }
530}
531
532void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv)
533{
534 if (priv->cfg->use_new_eeprom_reading)
535 iwlcore_eeprom_enhanced_txpower_new(priv);
536 else
537 iwlcore_eeprom_enhanced_txpower_old(priv);
538}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index b555edd53354..554afb7d9670 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -569,6 +569,12 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
569 case INDIRECT_REGULATORY: 569 case INDIRECT_REGULATORY:
570 offset = iwl_eeprom_query16(priv, EEPROM_LINK_REGULATORY); 570 offset = iwl_eeprom_query16(priv, EEPROM_LINK_REGULATORY);
571 break; 571 break;
572 case INDIRECT_TXP_LIMIT:
573 offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT);
574 break;
575 case INDIRECT_TXP_LIMIT_SIZE:
576 offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT_SIZE);
577 break;
572 case INDIRECT_CALIBRATION: 578 case INDIRECT_CALIBRATION:
573 offset = iwl_eeprom_query16(priv, EEPROM_LINK_CALIBRATION); 579 offset = iwl_eeprom_query16(priv, EEPROM_LINK_CALIBRATION);
574 break; 580 break;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 64527def059f..954ecc2c34c4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -390,6 +390,7 @@ struct iwl_cfg {
390 const bool need_temp_offset_calib; /* if used set to true */ 390 const bool need_temp_offset_calib; /* if used set to true */
391 u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; 391 u8 scan_rx_antennas[IEEE80211_NUM_BANDS];
392 u8 scan_tx_antennas[IEEE80211_NUM_BANDS]; 392 u8 scan_tx_antennas[IEEE80211_NUM_BANDS];
393 const bool use_new_eeprom_reading; /* temporary, remove later */
393}; 394};
394 395
395/*************************** 396/***************************
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index d9b590625ae4..e3a279d2d0b6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -120,6 +120,17 @@ struct iwl_eeprom_channel {
120 s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ 120 s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */
121} __packed; 121} __packed;
122 122
123enum iwl_eeprom_enhanced_txpwr_flags {
124 IWL_EEPROM_ENH_TXP_FL_VALID = BIT(0),
125 IWL_EEPROM_ENH_TXP_FL_BAND_52G = BIT(1),
126 IWL_EEPROM_ENH_TXP_FL_OFDM = BIT(2),
127 IWL_EEPROM_ENH_TXP_FL_40MHZ = BIT(3),
128 IWL_EEPROM_ENH_TXP_FL_HT_AP = BIT(4),
129 IWL_EEPROM_ENH_TXP_FL_RES1 = BIT(5),
130 IWL_EEPROM_ENH_TXP_FL_RES2 = BIT(6),
131 IWL_EEPROM_ENH_TXP_FL_COMMON_TYPE = BIT(7),
132};
133
123/** 134/**
124 * iwl_eeprom_enhanced_txpwr structure 135 * iwl_eeprom_enhanced_txpwr structure
125 * This structure presents the enhanced regulatory tx power limit layout 136 * This structure presents the enhanced regulatory tx power limit layout
@@ -127,21 +138,23 @@ struct iwl_eeprom_channel {
127 * Enhanced regulatory tx power portion of eeprom image can be broken down 138 * Enhanced regulatory tx power portion of eeprom image can be broken down
128 * into individual structures; each one is 8 bytes in size and contain the 139 * into individual structures; each one is 8 bytes in size and contain the
129 * following information 140 * following information
130 * @common: (desc + channel) not used by driver, should _NOT_ be "zero" 141 * @flags: entry flags
142 * @channel: channel number
131 * @chain_a_max_pwr: chain a max power in 1/2 dBm 143 * @chain_a_max_pwr: chain a max power in 1/2 dBm
132 * @chain_b_max_pwr: chain b max power in 1/2 dBm 144 * @chain_b_max_pwr: chain b max power in 1/2 dBm
133 * @chain_c_max_pwr: chain c max power in 1/2 dBm 145 * @chain_c_max_pwr: chain c max power in 1/2 dBm
134 * @reserved: not used, should be "zero" 146 * @delta_20_in_40: 20-in-40 deltas (hi/lo)
135 * @mimo2_max_pwr: mimo2 max power in 1/2 dBm 147 * @mimo2_max_pwr: mimo2 max power in 1/2 dBm
136 * @mimo3_max_pwr: mimo3 max power in 1/2 dBm 148 * @mimo3_max_pwr: mimo3 max power in 1/2 dBm
137 * 149 *
138 */ 150 */
139struct iwl_eeprom_enhanced_txpwr { 151struct iwl_eeprom_enhanced_txpwr {
140 __le16 common; 152 u8 flags;
153 u8 channel;
141 s8 chain_a_max; 154 s8 chain_a_max;
142 s8 chain_b_max; 155 s8 chain_b_max;
143 s8 chain_c_max; 156 s8 chain_c_max;
144 s8 reserved; 157 u8 delta_20_in_40;
145 s8 mimo2_max; 158 s8 mimo2_max;
146 s8 mimo3_max; 159 s8 mimo3_max;
147} __packed; 160} __packed;
@@ -186,6 +199,8 @@ struct iwl_eeprom_enhanced_txpwr {
186#define EEPROM_LINK_CALIBRATION (2*0x67) 199#define EEPROM_LINK_CALIBRATION (2*0x67)
187#define EEPROM_LINK_PROCESS_ADJST (2*0x68) 200#define EEPROM_LINK_PROCESS_ADJST (2*0x68)
188#define EEPROM_LINK_OTHERS (2*0x69) 201#define EEPROM_LINK_OTHERS (2*0x69)
202#define EEPROM_LINK_TXP_LIMIT (2*0x6a)
203#define EEPROM_LINK_TXP_LIMIT_SIZE (2*0x6b)
189 204
190/* agn regulatory - indirect access */ 205/* agn regulatory - indirect access */
191#define EEPROM_REG_BAND_1_CHANNELS ((0x08)\ 206#define EEPROM_REG_BAND_1_CHANNELS ((0x08)\
@@ -389,6 +404,8 @@ struct iwl_eeprom_calib_info {
389#define INDIRECT_CALIBRATION 0x00040000 404#define INDIRECT_CALIBRATION 0x00040000
390#define INDIRECT_PROCESS_ADJST 0x00050000 405#define INDIRECT_PROCESS_ADJST 0x00050000
391#define INDIRECT_OTHERS 0x00060000 406#define INDIRECT_OTHERS 0x00060000
407#define INDIRECT_TXP_LIMIT 0x00070000
408#define INDIRECT_TXP_LIMIT_SIZE 0x00080000
392#define INDIRECT_ADDRESS 0x00100000 409#define INDIRECT_ADDRESS 0x00100000
393 410
394/* General */ 411/* General */
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 373930afc26b..113f4f204657 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -619,7 +619,7 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy,
619 print_ssid(ssid_buf, ssid, ssid_len), 619 print_ssid(ssid_buf, ssid, ssid_len),
620 LBS_SCAN_RSSI_TO_MBM(rssi)/100); 620 LBS_SCAN_RSSI_TO_MBM(rssi)/100);
621 621
622 if (channel || 622 if (channel &&
623 !(channel->flags & IEEE80211_CHAN_DISABLED)) 623 !(channel->flags & IEEE80211_CHAN_DISABLED))
624 cfg80211_inform_bss(wiphy, channel, 624 cfg80211_inform_bss(wiphy, channel,
625 bssid, le64_to_cpu(*(__le64 *)tsfdesc), 625 bssid, le64_to_cpu(*(__le64 *)tsfdesc),
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index d5bc21e5a02c..2325e56a9b0b 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -43,6 +43,7 @@ MODULE_FIRMWARE("isl3887usb");
43 43
44static struct usb_device_id p54u_table[] __devinitdata = { 44static struct usb_device_id p54u_table[] __devinitdata = {
45 /* Version 1 devices (pci chip + net2280) */ 45 /* Version 1 devices (pci chip + net2280) */
46 {USB_DEVICE(0x0411, 0x0050)}, /* Buffalo WLI2-USB2-G54 */
46 {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */ 47 {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */
47 {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ 48 {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */
48 {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */ 49 {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */
@@ -56,9 +57,13 @@ static struct usb_device_id p54u_table[] __devinitdata = {
56 {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ 57 {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */
57 {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ 58 {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */
58 {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */ 59 {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */
60 {USB_DEVICE(0x0db0, 0x6826)}, /* MSI UB54G (MS-6826) */
59 {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */ 61 {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */
60 {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */ 62 {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */
63 {USB_DEVICE(0x1435, 0x0210)}, /* Inventel UR054G */
64 {USB_DEVICE(0x15a9, 0x0002)}, /* Gemtek WUBI-100GW 802.11g */
61 {USB_DEVICE(0x1630, 0x0005)}, /* 2Wire 802.11g USB (v1) / Z-Com */ 65 {USB_DEVICE(0x1630, 0x0005)}, /* 2Wire 802.11g USB (v1) / Z-Com */
66 {USB_DEVICE(0x182d, 0x096b)}, /* Sitecom WL-107 */
62 {USB_DEVICE(0x1915, 0x2234)}, /* Linksys WUSB54G OEM */ 67 {USB_DEVICE(0x1915, 0x2234)}, /* Linksys WUSB54G OEM */
63 {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */ 68 {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */
64 {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */ 69 {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */
@@ -94,6 +99,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
94 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ 99 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */
95 {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ 100 {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */
96 {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ 101 {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */
102 {USB_DEVICE(0x2001, 0x3705)}, /* D-Link DWL-G120 rev C1 */
97 {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */ 103 {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */
98 {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ 104 {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */
99 {USB_DEVICE(0x413c, 0x8104)}, /* Cohiba Proto board */ 105 {USB_DEVICE(0x413c, 0x8104)}, /* Cohiba Proto board */
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index b26739535986..09a67905c230 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -912,6 +912,7 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
912 __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); 912 __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags);
913 __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); 913 __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags);
914 __set_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags); 914 __set_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags);
915 __set_bit(DRIVER_REQUIRE_TASKLET_CONTEXT, &rt2x00dev->flags);
915 if (!modparam_nohwcrypt) 916 if (!modparam_nohwcrypt)
916 __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags); 917 __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
917 __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags); 918 __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags);
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 94fe589acfaa..ab43e7ca2a23 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -664,6 +664,7 @@ enum rt2x00_flags {
664 DRIVER_REQUIRE_COPY_IV, 664 DRIVER_REQUIRE_COPY_IV,
665 DRIVER_REQUIRE_L2PAD, 665 DRIVER_REQUIRE_L2PAD,
666 DRIVER_REQUIRE_TXSTATUS_FIFO, 666 DRIVER_REQUIRE_TXSTATUS_FIFO,
667 DRIVER_REQUIRE_TASKLET_CONTEXT,
667 668
668 /* 669 /*
669 * Driver features 670 * Driver features
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 5ba79b935f09..d019830ca840 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -390,9 +390,12 @@ void rt2x00lib_txdone(struct queue_entry *entry,
390 * through a mac80211 library call (RTS/CTS) then we should not 390 * through a mac80211 library call (RTS/CTS) then we should not
391 * send the status report back. 391 * send the status report back.
392 */ 392 */
393 if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) 393 if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) {
394 ieee80211_tx_status(rt2x00dev->hw, entry->skb); 394 if (test_bit(DRIVER_REQUIRE_TASKLET_CONTEXT, &rt2x00dev->flags))
395 else 395 ieee80211_tx_status(rt2x00dev->hw, entry->skb);
396 else
397 ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb);
398 } else
396 dev_kfree_skb_any(entry->skb); 399 dev_kfree_skb_any(entry->skb);
397 400
398 /* 401 /*
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index cd1b3dcd61db..ec47e22fa186 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -744,7 +744,7 @@ static int yellowfin_init_ring(struct net_device *dev)
744 } 744 }
745 745
746 for (i = 0; i < RX_RING_SIZE; i++) { 746 for (i = 0; i < RX_RING_SIZE; i++) {
747 struct sk_buff *skb = dev_alloc_skb(yp->rx_buf_sz); 747 struct sk_buff *skb = dev_alloc_skb(yp->rx_buf_sz + 2);
748 yp->rx_skbuff[i] = skb; 748 yp->rx_skbuff[i] = skb;
749 if (skb == NULL) 749 if (skb == NULL)
750 break; 750 break;
@@ -1157,7 +1157,7 @@ static int yellowfin_rx(struct net_device *dev)
1157 for (; yp->cur_rx - yp->dirty_rx > 0; yp->dirty_rx++) { 1157 for (; yp->cur_rx - yp->dirty_rx > 0; yp->dirty_rx++) {
1158 entry = yp->dirty_rx % RX_RING_SIZE; 1158 entry = yp->dirty_rx % RX_RING_SIZE;
1159 if (yp->rx_skbuff[entry] == NULL) { 1159 if (yp->rx_skbuff[entry] == NULL) {
1160 struct sk_buff *skb = dev_alloc_skb(yp->rx_buf_sz); 1160 struct sk_buff *skb = dev_alloc_skb(yp->rx_buf_sz + 2);
1161 if (skb == NULL) 1161 if (skb == NULL)
1162 break; /* Better luck next round. */ 1162 break; /* Better luck next round. */
1163 yp->rx_skbuff[entry] = skb; 1163 yp->rx_skbuff[entry] = skb;
diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index c85d3c7421fc..f37fbeb66a44 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -61,7 +61,7 @@ void of_i2c_register_devices(struct i2c_adapter *adap)
61 info.of_node = of_node_get(node); 61 info.of_node = of_node_get(node);
62 info.archdata = &dev_ad; 62 info.archdata = &dev_ad;
63 63
64 request_module("%s", info.type); 64 request_module("%s%s", I2C_MODULE_PREFIX, info.type);
65 65
66 result = i2c_new_device(adap, &info); 66 result = i2c_new_device(adap, &info);
67 if (result == NULL) { 67 if (result == NULL) {
diff --git a/drivers/pci/hotplug/pciehp_acpi.c b/drivers/pci/hotplug/pciehp_acpi.c
index 2574700db461..5f7226223a62 100644
--- a/drivers/pci/hotplug/pciehp_acpi.c
+++ b/drivers/pci/hotplug/pciehp_acpi.c
@@ -115,7 +115,8 @@ static struct pcie_port_service_driver __initdata dummy_driver = {
115static int __init select_detection_mode(void) 115static int __init select_detection_mode(void)
116{ 116{
117 struct dummy_slot *slot, *tmp; 117 struct dummy_slot *slot, *tmp;
118 pcie_port_service_register(&dummy_driver); 118 if (pcie_port_service_register(&dummy_driver))
119 return PCIEHP_DETECT_ACPI;
119 pcie_port_service_unregister(&dummy_driver); 120 pcie_port_service_unregister(&dummy_driver);
120 list_for_each_entry_safe(slot, tmp, &dummy_slots, list) { 121 list_for_each_entry_safe(slot, tmp, &dummy_slots, list) {
121 list_del(&slot->list); 122 list_del(&slot->list);
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index c44a5e8b8b82..f0b3ad13c273 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -75,6 +75,7 @@
75#include <drm/i915_drm.h> 75#include <drm/i915_drm.h>
76#include <asm/msr.h> 76#include <asm/msr.h>
77#include <asm/processor.h> 77#include <asm/processor.h>
78#include "intel_ips.h"
78 79
79#define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32 80#define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32
80 81
@@ -245,6 +246,7 @@
245#define thm_writel(off, val) writel((val), ips->regmap + (off)) 246#define thm_writel(off, val) writel((val), ips->regmap + (off))
246 247
247static const int IPS_ADJUST_PERIOD = 5000; /* ms */ 248static const int IPS_ADJUST_PERIOD = 5000; /* ms */
249static bool late_i915_load = false;
248 250
249/* For initial average collection */ 251/* For initial average collection */
250static const int IPS_SAMPLE_PERIOD = 200; /* ms */ 252static const int IPS_SAMPLE_PERIOD = 200; /* ms */
@@ -339,6 +341,9 @@ struct ips_driver {
339 u64 orig_turbo_ratios; 341 u64 orig_turbo_ratios;
340}; 342};
341 343
344static bool
345ips_gpu_turbo_enabled(struct ips_driver *ips);
346
342/** 347/**
343 * ips_cpu_busy - is CPU busy? 348 * ips_cpu_busy - is CPU busy?
344 * @ips: IPS driver struct 349 * @ips: IPS driver struct
@@ -517,7 +522,7 @@ static void ips_disable_cpu_turbo(struct ips_driver *ips)
517 */ 522 */
518static bool ips_gpu_busy(struct ips_driver *ips) 523static bool ips_gpu_busy(struct ips_driver *ips)
519{ 524{
520 if (!ips->gpu_turbo_enabled) 525 if (!ips_gpu_turbo_enabled(ips))
521 return false; 526 return false;
522 527
523 return ips->gpu_busy(); 528 return ips->gpu_busy();
@@ -532,7 +537,7 @@ static bool ips_gpu_busy(struct ips_driver *ips)
532 */ 537 */
533static void ips_gpu_raise(struct ips_driver *ips) 538static void ips_gpu_raise(struct ips_driver *ips)
534{ 539{
535 if (!ips->gpu_turbo_enabled) 540 if (!ips_gpu_turbo_enabled(ips))
536 return; 541 return;
537 542
538 if (!ips->gpu_raise()) 543 if (!ips->gpu_raise())
@@ -549,7 +554,7 @@ static void ips_gpu_raise(struct ips_driver *ips)
549 */ 554 */
550static void ips_gpu_lower(struct ips_driver *ips) 555static void ips_gpu_lower(struct ips_driver *ips)
551{ 556{
552 if (!ips->gpu_turbo_enabled) 557 if (!ips_gpu_turbo_enabled(ips))
553 return; 558 return;
554 559
555 if (!ips->gpu_lower()) 560 if (!ips->gpu_lower())
@@ -1454,6 +1459,31 @@ out_err:
1454 return false; 1459 return false;
1455} 1460}
1456 1461
1462static bool
1463ips_gpu_turbo_enabled(struct ips_driver *ips)
1464{
1465 if (!ips->gpu_busy && late_i915_load) {
1466 if (ips_get_i915_syms(ips)) {
1467 dev_info(&ips->dev->dev,
1468 "i915 driver attached, reenabling gpu turbo\n");
1469 ips->gpu_turbo_enabled = !(thm_readl(THM_HTS) & HTS_GTD_DIS);
1470 }
1471 }
1472
1473 return ips->gpu_turbo_enabled;
1474}
1475
1476void
1477ips_link_to_i915_driver()
1478{
1479 /* We can't cleanly get at the various ips_driver structs from
1480 * this caller (the i915 driver), so just set a flag saying
1481 * that it's time to try getting the symbols again.
1482 */
1483 late_i915_load = true;
1484}
1485EXPORT_SYMBOL_GPL(ips_link_to_i915_driver);
1486
1457static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = { 1487static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = {
1458 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 1488 { PCI_DEVICE(PCI_VENDOR_ID_INTEL,
1459 PCI_DEVICE_ID_INTEL_THERMAL_SENSOR), }, 1489 PCI_DEVICE_ID_INTEL_THERMAL_SENSOR), },
diff --git a/drivers/platform/x86/intel_ips.h b/drivers/platform/x86/intel_ips.h
new file mode 100644
index 000000000000..73299beff5b3
--- /dev/null
+++ b/drivers/platform/x86/intel_ips.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright (c) 2010 Intel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * The full GNU General Public License is included in this distribution in
18 * the file called "COPYING".
19 */
20
21void ips_link_to_i915_driver(void);
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 90cf0a6ff23e..dd14e202c2c8 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -207,7 +207,7 @@ static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm)
207static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm) 207static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm)
208{ 208{
209 struct rs5c372 *rs5c = i2c_get_clientdata(client); 209 struct rs5c372 *rs5c = i2c_get_clientdata(client);
210 unsigned char buf[8]; 210 unsigned char buf[7];
211 int addr; 211 int addr;
212 212
213 dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d " 213 dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d "
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c
index c94502dfac66..045d7e87b632 100644
--- a/drivers/scsi/bfa/bfa_fcs.c
+++ b/drivers/scsi/bfa/bfa_fcs.c
@@ -677,7 +677,7 @@ bfa_fcs_fabric_sm_isolated(struct bfa_fcs_fabric_s *fabric,
677 bfa_trc(fabric->fcs, event); 677 bfa_trc(fabric->fcs, event);
678 wwn2str(pwwn_ptr, fabric->bport.port_cfg.pwwn); 678 wwn2str(pwwn_ptr, fabric->bport.port_cfg.pwwn);
679 679
680 BFA_LOG(KERN_INFO, bfad, log_level, 680 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
681 "Port is isolated due to VF_ID mismatch. " 681 "Port is isolated due to VF_ID mismatch. "
682 "PWWN: %s Port VF_ID: %04x switch port VF_ID: %04x.", 682 "PWWN: %s Port VF_ID: %04x switch port VF_ID: %04x.",
683 pwwn_ptr, fabric->fcs->port_vfid, 683 pwwn_ptr, fabric->fcs->port_vfid,
@@ -1411,7 +1411,7 @@ bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric,
1411 wwn2str(pwwn_ptr, bfa_fcs_lport_get_pwwn(&fabric->bport)); 1411 wwn2str(pwwn_ptr, bfa_fcs_lport_get_pwwn(&fabric->bport));
1412 wwn2str(fwwn_ptr, 1412 wwn2str(fwwn_ptr,
1413 bfa_fcs_lport_get_fabric_name(&fabric->bport)); 1413 bfa_fcs_lport_get_fabric_name(&fabric->bport));
1414 BFA_LOG(KERN_WARNING, bfad, log_level, 1414 BFA_LOG(KERN_WARNING, bfad, bfa_log_level,
1415 "Base port WWN = %s Fabric WWN = %s\n", 1415 "Base port WWN = %s Fabric WWN = %s\n",
1416 pwwn_ptr, fwwn_ptr); 1416 pwwn_ptr, fwwn_ptr);
1417 } 1417 }
diff --git a/drivers/scsi/bfa/bfa_fcs_fcpim.c b/drivers/scsi/bfa/bfa_fcs_fcpim.c
index 9662bcdeb41d..413b58eef93a 100644
--- a/drivers/scsi/bfa/bfa_fcs_fcpim.c
+++ b/drivers/scsi/bfa/bfa_fcs_fcpim.c
@@ -261,7 +261,7 @@ bfa_fcs_itnim_sm_hcb_online(struct bfa_fcs_itnim_s *itnim,
261 bfa_fcb_itnim_online(itnim->itnim_drv); 261 bfa_fcb_itnim_online(itnim->itnim_drv);
262 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(itnim->rport->port)); 262 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(itnim->rport->port));
263 wwn2str(rpwwn_buf, itnim->rport->pwwn); 263 wwn2str(rpwwn_buf, itnim->rport->pwwn);
264 BFA_LOG(KERN_INFO, bfad, log_level, 264 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
265 "Target (WWN = %s) is online for initiator (WWN = %s)\n", 265 "Target (WWN = %s) is online for initiator (WWN = %s)\n",
266 rpwwn_buf, lpwwn_buf); 266 rpwwn_buf, lpwwn_buf);
267 break; 267 break;
@@ -301,11 +301,11 @@ bfa_fcs_itnim_sm_online(struct bfa_fcs_itnim_s *itnim,
301 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(itnim->rport->port)); 301 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(itnim->rport->port));
302 wwn2str(rpwwn_buf, itnim->rport->pwwn); 302 wwn2str(rpwwn_buf, itnim->rport->pwwn);
303 if (bfa_fcs_lport_is_online(itnim->rport->port) == BFA_TRUE) 303 if (bfa_fcs_lport_is_online(itnim->rport->port) == BFA_TRUE)
304 BFA_LOG(KERN_ERR, bfad, log_level, 304 BFA_LOG(KERN_ERR, bfad, bfa_log_level,
305 "Target (WWN = %s) connectivity lost for " 305 "Target (WWN = %s) connectivity lost for "
306 "initiator (WWN = %s)\n", rpwwn_buf, lpwwn_buf); 306 "initiator (WWN = %s)\n", rpwwn_buf, lpwwn_buf);
307 else 307 else
308 BFA_LOG(KERN_INFO, bfad, log_level, 308 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
309 "Target (WWN = %s) offlined by initiator (WWN = %s)\n", 309 "Target (WWN = %s) offlined by initiator (WWN = %s)\n",
310 rpwwn_buf, lpwwn_buf); 310 rpwwn_buf, lpwwn_buf);
311 break; 311 break;
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c
index 377cbfff6f2e..8d651309302b 100644
--- a/drivers/scsi/bfa/bfa_fcs_lport.c
+++ b/drivers/scsi/bfa/bfa_fcs_lport.c
@@ -491,7 +491,7 @@ bfa_fcs_lport_online_actions(struct bfa_fcs_lport_s *port)
491 __port_action[port->fabric->fab_type].online(port); 491 __port_action[port->fabric->fab_type].online(port);
492 492
493 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); 493 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port));
494 BFA_LOG(KERN_INFO, bfad, log_level, 494 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
495 "Logical port online: WWN = %s Role = %s\n", 495 "Logical port online: WWN = %s Role = %s\n",
496 lpwwn_buf, "Initiator"); 496 lpwwn_buf, "Initiator");
497 497
@@ -512,11 +512,11 @@ bfa_fcs_lport_offline_actions(struct bfa_fcs_lport_s *port)
512 512
513 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); 513 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port));
514 if (bfa_fcs_fabric_is_online(port->fabric) == BFA_TRUE) 514 if (bfa_fcs_fabric_is_online(port->fabric) == BFA_TRUE)
515 BFA_LOG(KERN_ERR, bfad, log_level, 515 BFA_LOG(KERN_ERR, bfad, bfa_log_level,
516 "Logical port lost fabric connectivity: WWN = %s Role = %s\n", 516 "Logical port lost fabric connectivity: WWN = %s Role = %s\n",
517 lpwwn_buf, "Initiator"); 517 lpwwn_buf, "Initiator");
518 else 518 else
519 BFA_LOG(KERN_INFO, bfad, log_level, 519 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
520 "Logical port taken offline: WWN = %s Role = %s\n", 520 "Logical port taken offline: WWN = %s Role = %s\n",
521 lpwwn_buf, "Initiator"); 521 lpwwn_buf, "Initiator");
522 522
@@ -573,7 +573,7 @@ bfa_fcs_lport_deleted(struct bfa_fcs_lport_s *port)
573 char lpwwn_buf[BFA_STRING_32]; 573 char lpwwn_buf[BFA_STRING_32];
574 574
575 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); 575 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port));
576 BFA_LOG(KERN_INFO, bfad, log_level, 576 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
577 "Logical port deleted: WWN = %s Role = %s\n", 577 "Logical port deleted: WWN = %s Role = %s\n",
578 lpwwn_buf, "Initiator"); 578 lpwwn_buf, "Initiator");
579 579
@@ -878,7 +878,7 @@ bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport,
878 vport ? vport->vport_drv : NULL); 878 vport ? vport->vport_drv : NULL);
879 879
880 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(lport)); 880 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(lport));
881 BFA_LOG(KERN_INFO, bfad, log_level, 881 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
882 "New logical port created: WWN = %s Role = %s\n", 882 "New logical port created: WWN = %s Role = %s\n",
883 lpwwn_buf, "Initiator"); 883 lpwwn_buf, "Initiator");
884 884
diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c
index 47f35c0ef29a..cf4a6e73e60d 100644
--- a/drivers/scsi/bfa/bfa_fcs_rport.c
+++ b/drivers/scsi/bfa/bfa_fcs_rport.c
@@ -2056,7 +2056,7 @@ bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport)
2056 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); 2056 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port));
2057 wwn2str(rpwwn_buf, rport->pwwn); 2057 wwn2str(rpwwn_buf, rport->pwwn);
2058 if (!BFA_FCS_PID_IS_WKA(rport->pid)) 2058 if (!BFA_FCS_PID_IS_WKA(rport->pid))
2059 BFA_LOG(KERN_INFO, bfad, log_level, 2059 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
2060 "Remote port (WWN = %s) online for logical port (WWN = %s)\n", 2060 "Remote port (WWN = %s) online for logical port (WWN = %s)\n",
2061 rpwwn_buf, lpwwn_buf); 2061 rpwwn_buf, lpwwn_buf);
2062} 2062}
@@ -2075,12 +2075,12 @@ bfa_fcs_rport_offline_action(struct bfa_fcs_rport_s *rport)
2075 wwn2str(rpwwn_buf, rport->pwwn); 2075 wwn2str(rpwwn_buf, rport->pwwn);
2076 if (!BFA_FCS_PID_IS_WKA(rport->pid)) { 2076 if (!BFA_FCS_PID_IS_WKA(rport->pid)) {
2077 if (bfa_fcs_lport_is_online(rport->port) == BFA_TRUE) 2077 if (bfa_fcs_lport_is_online(rport->port) == BFA_TRUE)
2078 BFA_LOG(KERN_ERR, bfad, log_level, 2078 BFA_LOG(KERN_ERR, bfad, bfa_log_level,
2079 "Remote port (WWN = %s) connectivity lost for " 2079 "Remote port (WWN = %s) connectivity lost for "
2080 "logical port (WWN = %s)\n", 2080 "logical port (WWN = %s)\n",
2081 rpwwn_buf, lpwwn_buf); 2081 rpwwn_buf, lpwwn_buf);
2082 else 2082 else
2083 BFA_LOG(KERN_INFO, bfad, log_level, 2083 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
2084 "Remote port (WWN = %s) offlined by " 2084 "Remote port (WWN = %s) offlined by "
2085 "logical port (WWN = %s)\n", 2085 "logical port (WWN = %s)\n",
2086 rpwwn_buf, lpwwn_buf); 2086 rpwwn_buf, lpwwn_buf);
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c
index 54475b53a5ab..9f4aa391ea9d 100644
--- a/drivers/scsi/bfa/bfa_ioc.c
+++ b/drivers/scsi/bfa/bfa_ioc.c
@@ -402,7 +402,7 @@ bfa_ioc_sm_op_entry(struct bfa_ioc_s *ioc)
402 402
403 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_OK); 403 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_OK);
404 bfa_ioc_hb_monitor(ioc); 404 bfa_ioc_hb_monitor(ioc);
405 BFA_LOG(KERN_INFO, bfad, log_level, "IOC enabled\n"); 405 BFA_LOG(KERN_INFO, bfad, bfa_log_level, "IOC enabled\n");
406} 406}
407 407
408static void 408static void
@@ -444,7 +444,7 @@ bfa_ioc_sm_disabling_entry(struct bfa_ioc_s *ioc)
444{ 444{
445 struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; 445 struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad;
446 bfa_iocpf_disable(ioc); 446 bfa_iocpf_disable(ioc);
447 BFA_LOG(KERN_INFO, bfad, log_level, "IOC disabled\n"); 447 BFA_LOG(KERN_INFO, bfad, bfa_log_level, "IOC disabled\n");
448} 448}
449 449
450/* 450/*
@@ -565,7 +565,7 @@ bfa_ioc_sm_fail_entry(struct bfa_ioc_s *ioc)
565 notify->cbfn(notify->cbarg); 565 notify->cbfn(notify->cbarg);
566 } 566 }
567 567
568 BFA_LOG(KERN_CRIT, bfad, log_level, 568 BFA_LOG(KERN_CRIT, bfad, bfa_log_level,
569 "Heart Beat of IOC has failed\n"); 569 "Heart Beat of IOC has failed\n");
570} 570}
571 571
@@ -1812,7 +1812,7 @@ bfa_ioc_pf_fwmismatch(struct bfa_ioc_s *ioc)
1812 * Provide enable completion callback. 1812 * Provide enable completion callback.
1813 */ 1813 */
1814 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); 1814 ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE);
1815 BFA_LOG(KERN_WARNING, bfad, log_level, 1815 BFA_LOG(KERN_WARNING, bfad, bfa_log_level,
1816 "Running firmware version is incompatible " 1816 "Running firmware version is incompatible "
1817 "with the driver version\n"); 1817 "with the driver version\n");
1818} 1818}
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c
index c768143f4805..37e16ac8f249 100644
--- a/drivers/scsi/bfa/bfa_svc.c
+++ b/drivers/scsi/bfa/bfa_svc.c
@@ -2138,7 +2138,7 @@ bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport,
2138 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, 2138 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2139 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); 2139 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable");
2140 wwn2str(pwwn_buf, fcport->pwwn); 2140 wwn2str(pwwn_buf, fcport->pwwn);
2141 BFA_LOG(KERN_INFO, bfad, log_level, 2141 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
2142 "Base port disabled: WWN = %s\n", pwwn_buf); 2142 "Base port disabled: WWN = %s\n", pwwn_buf);
2143 break; 2143 break;
2144 2144
@@ -2198,7 +2198,7 @@ bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport,
2198 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, 2198 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2199 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); 2199 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable");
2200 wwn2str(pwwn_buf, fcport->pwwn); 2200 wwn2str(pwwn_buf, fcport->pwwn);
2201 BFA_LOG(KERN_INFO, bfad, log_level, 2201 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
2202 "Base port disabled: WWN = %s\n", pwwn_buf); 2202 "Base port disabled: WWN = %s\n", pwwn_buf);
2203 break; 2203 break;
2204 2204
@@ -2251,7 +2251,7 @@ bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport,
2251 2251
2252 bfa_fcport_scn(fcport, BFA_PORT_LINKUP, BFA_FALSE); 2252 bfa_fcport_scn(fcport, BFA_PORT_LINKUP, BFA_FALSE);
2253 wwn2str(pwwn_buf, fcport->pwwn); 2253 wwn2str(pwwn_buf, fcport->pwwn);
2254 BFA_LOG(KERN_INFO, bfad, log_level, 2254 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
2255 "Base port online: WWN = %s\n", pwwn_buf); 2255 "Base port online: WWN = %s\n", pwwn_buf);
2256 break; 2256 break;
2257 2257
@@ -2277,7 +2277,7 @@ bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport,
2277 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, 2277 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2278 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); 2278 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable");
2279 wwn2str(pwwn_buf, fcport->pwwn); 2279 wwn2str(pwwn_buf, fcport->pwwn);
2280 BFA_LOG(KERN_INFO, bfad, log_level, 2280 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
2281 "Base port disabled: WWN = %s\n", pwwn_buf); 2281 "Base port disabled: WWN = %s\n", pwwn_buf);
2282 break; 2282 break;
2283 2283
@@ -2322,9 +2322,9 @@ bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport,
2322 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, 2322 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2323 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); 2323 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable");
2324 wwn2str(pwwn_buf, fcport->pwwn); 2324 wwn2str(pwwn_buf, fcport->pwwn);
2325 BFA_LOG(KERN_INFO, bfad, log_level, 2325 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
2326 "Base port offline: WWN = %s\n", pwwn_buf); 2326 "Base port offline: WWN = %s\n", pwwn_buf);
2327 BFA_LOG(KERN_INFO, bfad, log_level, 2327 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
2328 "Base port disabled: WWN = %s\n", pwwn_buf); 2328 "Base port disabled: WWN = %s\n", pwwn_buf);
2329 break; 2329 break;
2330 2330
@@ -2336,10 +2336,10 @@ bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport,
2336 BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkdown"); 2336 BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkdown");
2337 wwn2str(pwwn_buf, fcport->pwwn); 2337 wwn2str(pwwn_buf, fcport->pwwn);
2338 if (BFA_PORT_IS_DISABLED(fcport->bfa)) 2338 if (BFA_PORT_IS_DISABLED(fcport->bfa))
2339 BFA_LOG(KERN_INFO, bfad, log_level, 2339 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
2340 "Base port offline: WWN = %s\n", pwwn_buf); 2340 "Base port offline: WWN = %s\n", pwwn_buf);
2341 else 2341 else
2342 BFA_LOG(KERN_ERR, bfad, log_level, 2342 BFA_LOG(KERN_ERR, bfad, bfa_log_level,
2343 "Base port (WWN = %s) " 2343 "Base port (WWN = %s) "
2344 "lost fabric connectivity\n", pwwn_buf); 2344 "lost fabric connectivity\n", pwwn_buf);
2345 break; 2345 break;
@@ -2349,10 +2349,10 @@ bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport,
2349 bfa_fcport_reset_linkinfo(fcport); 2349 bfa_fcport_reset_linkinfo(fcport);
2350 wwn2str(pwwn_buf, fcport->pwwn); 2350 wwn2str(pwwn_buf, fcport->pwwn);
2351 if (BFA_PORT_IS_DISABLED(fcport->bfa)) 2351 if (BFA_PORT_IS_DISABLED(fcport->bfa))
2352 BFA_LOG(KERN_INFO, bfad, log_level, 2352 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
2353 "Base port offline: WWN = %s\n", pwwn_buf); 2353 "Base port offline: WWN = %s\n", pwwn_buf);
2354 else 2354 else
2355 BFA_LOG(KERN_ERR, bfad, log_level, 2355 BFA_LOG(KERN_ERR, bfad, bfa_log_level,
2356 "Base port (WWN = %s) " 2356 "Base port (WWN = %s) "
2357 "lost fabric connectivity\n", pwwn_buf); 2357 "lost fabric connectivity\n", pwwn_buf);
2358 break; 2358 break;
@@ -2363,10 +2363,10 @@ bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport,
2363 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE); 2363 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2364 wwn2str(pwwn_buf, fcport->pwwn); 2364 wwn2str(pwwn_buf, fcport->pwwn);
2365 if (BFA_PORT_IS_DISABLED(fcport->bfa)) 2365 if (BFA_PORT_IS_DISABLED(fcport->bfa))
2366 BFA_LOG(KERN_INFO, bfad, log_level, 2366 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
2367 "Base port offline: WWN = %s\n", pwwn_buf); 2367 "Base port offline: WWN = %s\n", pwwn_buf);
2368 else 2368 else
2369 BFA_LOG(KERN_ERR, bfad, log_level, 2369 BFA_LOG(KERN_ERR, bfad, bfa_log_level,
2370 "Base port (WWN = %s) " 2370 "Base port (WWN = %s) "
2371 "lost fabric connectivity\n", pwwn_buf); 2371 "lost fabric connectivity\n", pwwn_buf);
2372 break; 2372 break;
@@ -2497,7 +2497,7 @@ bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport,
2497 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, 2497 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2498 BFA_PL_EID_PORT_ENABLE, 0, "Port Enable"); 2498 BFA_PL_EID_PORT_ENABLE, 0, "Port Enable");
2499 wwn2str(pwwn_buf, fcport->pwwn); 2499 wwn2str(pwwn_buf, fcport->pwwn);
2500 BFA_LOG(KERN_INFO, bfad, log_level, 2500 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
2501 "Base port enabled: WWN = %s\n", pwwn_buf); 2501 "Base port enabled: WWN = %s\n", pwwn_buf);
2502 break; 2502 break;
2503 2503
@@ -2551,7 +2551,7 @@ bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport,
2551 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, 2551 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2552 BFA_PL_EID_PORT_ENABLE, 0, "Port Enable"); 2552 BFA_PL_EID_PORT_ENABLE, 0, "Port Enable");
2553 wwn2str(pwwn_buf, fcport->pwwn); 2553 wwn2str(pwwn_buf, fcport->pwwn);
2554 BFA_LOG(KERN_INFO, bfad, log_level, 2554 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
2555 "Base port enabled: WWN = %s\n", pwwn_buf); 2555 "Base port enabled: WWN = %s\n", pwwn_buf);
2556 break; 2556 break;
2557 2557
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index 1f938974b848..6797720213b2 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -50,7 +50,7 @@ int reqq_size, rspq_size, num_sgpgs;
50int rport_del_timeout = BFA_FCS_RPORT_DEF_DEL_TIMEOUT; 50int rport_del_timeout = BFA_FCS_RPORT_DEF_DEL_TIMEOUT;
51int bfa_lun_queue_depth = BFAD_LUN_QUEUE_DEPTH; 51int bfa_lun_queue_depth = BFAD_LUN_QUEUE_DEPTH;
52int bfa_io_max_sge = BFAD_IO_MAX_SGE; 52int bfa_io_max_sge = BFAD_IO_MAX_SGE;
53int log_level = 3; /* WARNING log level */ 53int bfa_log_level = 3; /* WARNING log level */
54int ioc_auto_recover = BFA_TRUE; 54int ioc_auto_recover = BFA_TRUE;
55int bfa_linkup_delay = -1; 55int bfa_linkup_delay = -1;
56int fdmi_enable = BFA_TRUE; 56int fdmi_enable = BFA_TRUE;
@@ -108,8 +108,8 @@ module_param(bfa_lun_queue_depth, int, S_IRUGO | S_IWUSR);
108MODULE_PARM_DESC(bfa_lun_queue_depth, "Lun queue depth, default=32, Range[>0]"); 108MODULE_PARM_DESC(bfa_lun_queue_depth, "Lun queue depth, default=32, Range[>0]");
109module_param(bfa_io_max_sge, int, S_IRUGO | S_IWUSR); 109module_param(bfa_io_max_sge, int, S_IRUGO | S_IWUSR);
110MODULE_PARM_DESC(bfa_io_max_sge, "Max io scatter/gather elements, default=255"); 110MODULE_PARM_DESC(bfa_io_max_sge, "Max io scatter/gather elements, default=255");
111module_param(log_level, int, S_IRUGO | S_IWUSR); 111module_param(bfa_log_level, int, S_IRUGO | S_IWUSR);
112MODULE_PARM_DESC(log_level, "Driver log level, default=3, " 112MODULE_PARM_DESC(bfa_log_level, "Driver log level, default=3, "
113 "Range[Critical:1|Error:2|Warning:3|Info:4]"); 113 "Range[Critical:1|Error:2|Warning:3|Info:4]");
114module_param(ioc_auto_recover, int, S_IRUGO | S_IWUSR); 114module_param(ioc_auto_recover, int, S_IRUGO | S_IWUSR);
115MODULE_PARM_DESC(ioc_auto_recover, "IOC auto recovery, default=1, " 115MODULE_PARM_DESC(ioc_auto_recover, "IOC auto recovery, default=1, "
@@ -1112,7 +1112,7 @@ bfad_start_ops(struct bfad_s *bfad) {
1112 } else 1112 } else
1113 bfad_os_rport_online_wait(bfad); 1113 bfad_os_rport_online_wait(bfad);
1114 1114
1115 BFA_LOG(KERN_INFO, bfad, log_level, "bfa device claimed\n"); 1115 BFA_LOG(KERN_INFO, bfad, bfa_log_level, "bfa device claimed\n");
1116 1116
1117 return BFA_STATUS_OK; 1117 return BFA_STATUS_OK;
1118} 1118}
diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h
index 97f9b6c0937e..d5ce2349ac59 100644
--- a/drivers/scsi/bfa/bfad_drv.h
+++ b/drivers/scsi/bfa/bfad_drv.h
@@ -337,7 +337,7 @@ extern int num_sgpgs;
337extern int rport_del_timeout; 337extern int rport_del_timeout;
338extern int bfa_lun_queue_depth; 338extern int bfa_lun_queue_depth;
339extern int bfa_io_max_sge; 339extern int bfa_io_max_sge;
340extern int log_level; 340extern int bfa_log_level;
341extern int ioc_auto_recover; 341extern int ioc_auto_recover;
342extern int bfa_linkup_delay; 342extern int bfa_linkup_delay;
343extern int msix_disable_cb; 343extern int msix_disable_cb;
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 8ca967dee66d..fbad5e9b2402 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -225,7 +225,8 @@ bfad_im_abort_handler(struct scsi_cmnd *cmnd)
225 } 225 }
226 226
227 bfa_trc(bfad, hal_io->iotag); 227 bfa_trc(bfad, hal_io->iotag);
228 BFA_LOG(KERN_INFO, bfad, log_level, "scsi%d: abort cmnd %p iotag %x\n", 228 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
229 "scsi%d: abort cmnd %p iotag %x\n",
229 im_port->shost->host_no, cmnd, hal_io->iotag); 230 im_port->shost->host_no, cmnd, hal_io->iotag);
230 (void) bfa_ioim_abort(hal_io); 231 (void) bfa_ioim_abort(hal_io);
231 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 232 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
@@ -241,7 +242,7 @@ bfad_im_abort_handler(struct scsi_cmnd *cmnd)
241 242
242 cmnd->scsi_done(cmnd); 243 cmnd->scsi_done(cmnd);
243 bfa_trc(bfad, hal_io->iotag); 244 bfa_trc(bfad, hal_io->iotag);
244 BFA_LOG(KERN_INFO, bfad, log_level, 245 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
245 "scsi%d: complete abort 0x%p iotag 0x%x\n", 246 "scsi%d: complete abort 0x%p iotag 0x%x\n",
246 im_port->shost->host_no, cmnd, hal_io->iotag); 247 im_port->shost->host_no, cmnd, hal_io->iotag);
247 return SUCCESS; 248 return SUCCESS;
@@ -260,7 +261,7 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd,
260 261
261 tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); 262 tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd);
262 if (!tskim) { 263 if (!tskim) {
263 BFA_LOG(KERN_ERR, bfad, log_level, 264 BFA_LOG(KERN_ERR, bfad, bfa_log_level,
264 "target reset, fail to allocate tskim\n"); 265 "target reset, fail to allocate tskim\n");
265 rc = BFA_STATUS_FAILED; 266 rc = BFA_STATUS_FAILED;
266 goto out; 267 goto out;
@@ -311,7 +312,7 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)
311 312
312 tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); 313 tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd);
313 if (!tskim) { 314 if (!tskim) {
314 BFA_LOG(KERN_ERR, bfad, log_level, 315 BFA_LOG(KERN_ERR, bfad, bfa_log_level,
315 "LUN reset, fail to allocate tskim"); 316 "LUN reset, fail to allocate tskim");
316 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 317 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
317 rc = FAILED; 318 rc = FAILED;
@@ -336,7 +337,7 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)
336 337
337 task_status = cmnd->SCp.Status >> 1; 338 task_status = cmnd->SCp.Status >> 1;
338 if (task_status != BFI_TSKIM_STS_OK) { 339 if (task_status != BFI_TSKIM_STS_OK) {
339 BFA_LOG(KERN_ERR, bfad, log_level, 340 BFA_LOG(KERN_ERR, bfad, bfa_log_level,
340 "LUN reset failure, status: %d\n", task_status); 341 "LUN reset failure, status: %d\n", task_status);
341 rc = FAILED; 342 rc = FAILED;
342 } 343 }
@@ -380,7 +381,7 @@ bfad_im_reset_bus_handler(struct scsi_cmnd *cmnd)
380 381
381 task_status = cmnd->SCp.Status >> 1; 382 task_status = cmnd->SCp.Status >> 1;
382 if (task_status != BFI_TSKIM_STS_OK) { 383 if (task_status != BFI_TSKIM_STS_OK) {
383 BFA_LOG(KERN_ERR, bfad, log_level, 384 BFA_LOG(KERN_ERR, bfad, bfa_log_level,
384 "target reset failure," 385 "target reset failure,"
385 " status: %d\n", task_status); 386 " status: %d\n", task_status);
386 err_cnt++; 387 err_cnt++;
@@ -460,7 +461,7 @@ bfa_fcb_itnim_free(struct bfad_s *bfad, struct bfad_itnim_s *itnim_drv)
460 fcid = bfa_fcs_itnim_get_fcid(&itnim_drv->fcs_itnim); 461 fcid = bfa_fcs_itnim_get_fcid(&itnim_drv->fcs_itnim);
461 wwn2str(wwpn_str, wwpn); 462 wwn2str(wwpn_str, wwpn);
462 fcid2str(fcid_str, fcid); 463 fcid2str(fcid_str, fcid);
463 BFA_LOG(KERN_INFO, bfad, log_level, 464 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
464 "ITNIM FREE scsi%d: FCID: %s WWPN: %s\n", 465 "ITNIM FREE scsi%d: FCID: %s WWPN: %s\n",
465 port->im_port->shost->host_no, 466 port->im_port->shost->host_no,
466 fcid_str, wwpn_str); 467 fcid_str, wwpn_str);
@@ -589,7 +590,7 @@ void
589bfad_im_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port) 590bfad_im_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port)
590{ 591{
591 bfa_trc(bfad, bfad->inst_no); 592 bfa_trc(bfad, bfad->inst_no);
592 BFA_LOG(KERN_INFO, bfad, log_level, "Free scsi%d\n", 593 BFA_LOG(KERN_INFO, bfad, bfa_log_level, "Free scsi%d\n",
593 im_port->shost->host_no); 594 im_port->shost->host_no);
594 595
595 fc_remove_host(im_port->shost); 596 fc_remove_host(im_port->shost);
@@ -1048,7 +1049,7 @@ bfad_im_itnim_work_handler(struct work_struct *work)
1048 fcid2str(fcid_str, fcid); 1049 fcid2str(fcid_str, fcid);
1049 list_add_tail(&itnim->list_entry, 1050 list_add_tail(&itnim->list_entry,
1050 &im_port->itnim_mapped_list); 1051 &im_port->itnim_mapped_list);
1051 BFA_LOG(KERN_INFO, bfad, log_level, 1052 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
1052 "ITNIM ONLINE Target: %d:0:%d " 1053 "ITNIM ONLINE Target: %d:0:%d "
1053 "FCID: %s WWPN: %s\n", 1054 "FCID: %s WWPN: %s\n",
1054 im_port->shost->host_no, 1055 im_port->shost->host_no,
@@ -1081,7 +1082,7 @@ bfad_im_itnim_work_handler(struct work_struct *work)
1081 wwn2str(wwpn_str, wwpn); 1082 wwn2str(wwpn_str, wwpn);
1082 fcid2str(fcid_str, fcid); 1083 fcid2str(fcid_str, fcid);
1083 list_del(&itnim->list_entry); 1084 list_del(&itnim->list_entry);
1084 BFA_LOG(KERN_INFO, bfad, log_level, 1085 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
1085 "ITNIM OFFLINE Target: %d:0:%d " 1086 "ITNIM OFFLINE Target: %d:0:%d "
1086 "FCID: %s WWPN: %s\n", 1087 "FCID: %s WWPN: %s\n",
1087 im_port->shost->host_no, 1088 im_port->shost->host_no,
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index e5e9e6735f7d..9739431092d1 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -198,6 +198,7 @@ int __init register_intc_controller(struct intc_desc *desc)
198 list_add_tail(&d->list, &intc_list); 198 list_add_tail(&d->list, &intc_list);
199 199
200 raw_spin_lock_init(&d->lock); 200 raw_spin_lock_init(&d->lock);
201 INIT_RADIX_TREE(&d->tree, GFP_ATOMIC);
201 202
202 d->index = nr_intc_controllers; 203 d->index = nr_intc_controllers;
203 204
diff --git a/drivers/spi/coldfire_qspi.c b/drivers/spi/coldfire_qspi.c
index 052b3c7fa6a0..8856bcca9d29 100644
--- a/drivers/spi/coldfire_qspi.c
+++ b/drivers/spi/coldfire_qspi.c
@@ -317,7 +317,7 @@ static void mcfqspi_work(struct work_struct *work)
317 msg = container_of(mcfqspi->msgq.next, struct spi_message, 317 msg = container_of(mcfqspi->msgq.next, struct spi_message,
318 queue); 318 queue);
319 319
320 list_del_init(&mcfqspi->msgq); 320 list_del_init(&msg->queue);
321 spin_unlock_irqrestore(&mcfqspi->lock, flags); 321 spin_unlock_irqrestore(&mcfqspi->lock, flags);
322 322
323 spi = msg->spi; 323 spi = msg->spi;
diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c
index ec9f0b1bf864..84439f655601 100644
--- a/drivers/spi/mpc52xx_spi.c
+++ b/drivers/spi/mpc52xx_spi.c
@@ -563,7 +563,7 @@ static struct of_platform_driver mpc52xx_spi_of_driver = {
563 .of_match_table = mpc52xx_spi_match, 563 .of_match_table = mpc52xx_spi_match,
564 }, 564 },
565 .probe = mpc52xx_spi_probe, 565 .probe = mpc52xx_spi_probe,
566 .remove = __exit_p(mpc52xx_spi_remove), 566 .remove = __devexit_p(mpc52xx_spi_remove),
567}; 567};
568 568
569static int __init mpc52xx_spi_init(void) 569static int __init mpc52xx_spi_init(void)
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index 2a651e61bfbf..951a160fc27f 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -1305,10 +1305,49 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev)
1305/* work with hotplug and coldplug */ 1305/* work with hotplug and coldplug */
1306MODULE_ALIAS("platform:omap2_mcspi"); 1306MODULE_ALIAS("platform:omap2_mcspi");
1307 1307
1308#ifdef CONFIG_SUSPEND
1309/*
1310 * When SPI wake up from off-mode, CS is in activate state. If it was in
1311 * unactive state when driver was suspend, then force it to unactive state at
1312 * wake up.
1313 */
1314static int omap2_mcspi_resume(struct device *dev)
1315{
1316 struct spi_master *master = dev_get_drvdata(dev);
1317 struct omap2_mcspi *mcspi = spi_master_get_devdata(master);
1318 struct omap2_mcspi_cs *cs;
1319
1320 omap2_mcspi_enable_clocks(mcspi);
1321 list_for_each_entry(cs, &omap2_mcspi_ctx[master->bus_num - 1].cs,
1322 node) {
1323 if ((cs->chconf0 & OMAP2_MCSPI_CHCONF_FORCE) == 0) {
1324
1325 /*
1326 * We need to toggle CS state for OMAP take this
1327 * change in account.
1328 */
1329 MOD_REG_BIT(cs->chconf0, OMAP2_MCSPI_CHCONF_FORCE, 1);
1330 __raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0);
1331 MOD_REG_BIT(cs->chconf0, OMAP2_MCSPI_CHCONF_FORCE, 0);
1332 __raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0);
1333 }
1334 }
1335 omap2_mcspi_disable_clocks(mcspi);
1336 return 0;
1337}
1338#else
1339#define omap2_mcspi_resume NULL
1340#endif
1341
1342static const struct dev_pm_ops omap2_mcspi_pm_ops = {
1343 .resume = omap2_mcspi_resume,
1344};
1345
1308static struct platform_driver omap2_mcspi_driver = { 1346static struct platform_driver omap2_mcspi_driver = {
1309 .driver = { 1347 .driver = {
1310 .name = "omap2_mcspi", 1348 .name = "omap2_mcspi",
1311 .owner = THIS_MODULE, 1349 .owner = THIS_MODULE,
1350 .pm = &omap2_mcspi_pm_ops
1312 }, 1351 },
1313 .remove = __exit_p(omap2_mcspi_remove), 1352 .remove = __exit_p(omap2_mcspi_remove),
1314}; 1353};
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 709c836607de..b02d0cbce890 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -584,8 +584,7 @@ void spi_unregister_master(struct spi_master *master)
584 list_del(&master->list); 584 list_del(&master->list);
585 mutex_unlock(&board_lock); 585 mutex_unlock(&board_lock);
586 586
587 dummy = device_for_each_child(master->dev.parent, &master->dev, 587 dummy = device_for_each_child(&master->dev, NULL, __unregister);
588 __unregister);
589 device_unregister(&master->dev); 588 device_unregister(&master->dev);
590} 589}
591EXPORT_SYMBOL_GPL(spi_unregister_master); 590EXPORT_SYMBOL_GPL(spi_unregister_master);
diff --git a/drivers/spi/spi_fsl_espi.c b/drivers/spi/spi_fsl_espi.c
index e3b4f6451966..a99e2333b949 100644
--- a/drivers/spi/spi_fsl_espi.c
+++ b/drivers/spi/spi_fsl_espi.c
@@ -258,18 +258,18 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t)
258 return mpc8xxx_spi->count; 258 return mpc8xxx_spi->count;
259} 259}
260 260
261static void fsl_espi_addr2cmd(unsigned int addr, u8 *cmd) 261static inline void fsl_espi_addr2cmd(unsigned int addr, u8 *cmd)
262{ 262{
263 if (cmd[1] && cmd[2] && cmd[3]) { 263 if (cmd) {
264 cmd[1] = (u8)(addr >> 16); 264 cmd[1] = (u8)(addr >> 16);
265 cmd[2] = (u8)(addr >> 8); 265 cmd[2] = (u8)(addr >> 8);
266 cmd[3] = (u8)(addr >> 0); 266 cmd[3] = (u8)(addr >> 0);
267 } 267 }
268} 268}
269 269
270static unsigned int fsl_espi_cmd2addr(u8 *cmd) 270static inline unsigned int fsl_espi_cmd2addr(u8 *cmd)
271{ 271{
272 if (cmd[1] && cmd[2] && cmd[3]) 272 if (cmd)
273 return cmd[1] << 16 | cmd[2] << 8 | cmd[3] << 0; 273 return cmd[1] << 16 | cmd[2] << 8 | cmd[3] << 0;
274 274
275 return 0; 275 return 0;
@@ -395,9 +395,11 @@ static void fsl_espi_rw_trans(struct spi_message *m,
395 } 395 }
396 } 396 }
397 397
398 addr = fsl_espi_cmd2addr(local_buf); 398 if (pos > 0) {
399 addr += pos; 399 addr = fsl_espi_cmd2addr(local_buf);
400 fsl_espi_addr2cmd(addr, local_buf); 400 addr += pos;
401 fsl_espi_addr2cmd(addr, local_buf);
402 }
401 403
402 espi_trans->n_tx = n_tx; 404 espi_trans->n_tx = n_tx;
403 espi_trans->n_rx = trans_len; 405 espi_trans->n_rx = trans_len;
@@ -507,16 +509,29 @@ void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events)
507 509
508 /* We need handle RX first */ 510 /* We need handle RX first */
509 if (events & SPIE_NE) { 511 if (events & SPIE_NE) {
510 u32 rx_data; 512 u32 rx_data, tmp;
513 u8 rx_data_8;
511 514
512 /* Spin until RX is done */ 515 /* Spin until RX is done */
513 while (SPIE_RXCNT(events) < min(4, mspi->len)) { 516 while (SPIE_RXCNT(events) < min(4, mspi->len)) {
514 cpu_relax(); 517 cpu_relax();
515 events = mpc8xxx_spi_read_reg(&reg_base->event); 518 events = mpc8xxx_spi_read_reg(&reg_base->event);
516 } 519 }
517 mspi->len -= 4;
518 520
519 rx_data = mpc8xxx_spi_read_reg(&reg_base->receive); 521 if (mspi->len >= 4) {
522 rx_data = mpc8xxx_spi_read_reg(&reg_base->receive);
523 } else {
524 tmp = mspi->len;
525 rx_data = 0;
526 while (tmp--) {
527 rx_data_8 = in_8((u8 *)&reg_base->receive);
528 rx_data |= (rx_data_8 << (tmp * 8));
529 }
530
531 rx_data <<= (4 - mspi->len) * 8;
532 }
533
534 mspi->len -= 4;
520 535
521 if (mspi->rx) 536 if (mspi->rx)
522 mspi->get_rx(rx_data, mspi); 537 mspi->get_rx(rx_data, mspi);
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 8c3c057aa847..d0e9e0207539 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -435,12 +435,6 @@ static int zram_make_request(struct request_queue *queue, struct bio *bio)
435 int ret = 0; 435 int ret = 0;
436 struct zram *zram = queue->queuedata; 436 struct zram *zram = queue->queuedata;
437 437
438 if (unlikely(!zram->init_done)) {
439 set_bit(BIO_UPTODATE, &bio->bi_flags);
440 bio_endio(bio, 0);
441 return 0;
442 }
443
444 if (!valid_io_request(zram, bio)) { 438 if (!valid_io_request(zram, bio)) {
445 zram_stat64_inc(zram, &zram->stats.invalid_io); 439 zram_stat64_inc(zram, &zram->stats.invalid_io);
446 bio_io_error(bio); 440 bio_io_error(bio);
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 44447f54942f..99ac70e32556 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -2206,8 +2206,11 @@ static int uea_boot(struct uea_softc *sc)
2206 goto err1; 2206 goto err1;
2207 } 2207 }
2208 2208
2209 sc->kthread = kthread_run(uea_kthread, sc, "ueagle-atm"); 2209 /* Create worker thread, but don't start it here. Start it after
2210 if (sc->kthread == ERR_PTR(-ENOMEM)) { 2210 * all usbatm generic initialization is done.
2211 */
2212 sc->kthread = kthread_create(uea_kthread, sc, "ueagle-atm");
2213 if (IS_ERR(sc->kthread)) {
2211 uea_err(INS_TO_USBDEV(sc), "failed to create thread\n"); 2214 uea_err(INS_TO_USBDEV(sc), "failed to create thread\n");
2212 goto err2; 2215 goto err2;
2213 } 2216 }
@@ -2624,6 +2627,7 @@ static struct usbatm_driver uea_usbatm_driver = {
2624static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id) 2627static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id)
2625{ 2628{
2626 struct usb_device *usb = interface_to_usbdev(intf); 2629 struct usb_device *usb = interface_to_usbdev(intf);
2630 int ret;
2627 2631
2628 uea_enters(usb); 2632 uea_enters(usb);
2629 uea_info(usb, "ADSL device founded vid (%#X) pid (%#X) Rev (%#X): %s\n", 2633 uea_info(usb, "ADSL device founded vid (%#X) pid (%#X) Rev (%#X): %s\n",
@@ -2637,7 +2641,19 @@ static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id)
2637 if (UEA_IS_PREFIRM(id)) 2641 if (UEA_IS_PREFIRM(id))
2638 return uea_load_firmware(usb, UEA_CHIP_VERSION(id)); 2642 return uea_load_firmware(usb, UEA_CHIP_VERSION(id));
2639 2643
2640 return usbatm_usb_probe(intf, id, &uea_usbatm_driver); 2644 ret = usbatm_usb_probe(intf, id, &uea_usbatm_driver);
2645 if (ret == 0) {
2646 struct usbatm_data *usbatm = usb_get_intfdata(intf);
2647 struct uea_softc *sc = usbatm->driver_data;
2648
2649 /* Ensure carrier is initialized to off as early as possible */
2650 UPDATE_ATM_SIGNAL(ATM_PHY_SIG_LOST);
2651
2652 /* Only start the worker thread when all init is done */
2653 wake_up_process(sc->kthread);
2654 }
2655
2656 return ret;
2641} 2657}
2642 2658
2643static void uea_disconnect(struct usb_interface *intf) 2659static void uea_disconnect(struct usb_interface *intf)
diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c
index a4f4546f0be0..397d15eb1ea8 100644
--- a/drivers/video/backlight/cr_bllcd.c
+++ b/drivers/video/backlight/cr_bllcd.c
@@ -242,6 +242,7 @@ static int cr_backlight_remove(struct platform_device *pdev)
242 backlight_device_unregister(crp->cr_backlight_device); 242 backlight_device_unregister(crp->cr_backlight_device);
243 lcd_device_unregister(crp->cr_lcd_device); 243 lcd_device_unregister(crp->cr_lcd_device);
244 pci_dev_put(lpc_dev); 244 pci_dev_put(lpc_dev);
245 kfree(crp);
245 246
246 return 0; 247 return 0;
247} 248}
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 0e6aa3d96a42..4ac1201ad6c2 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1458,7 +1458,7 @@ static bool apertures_overlap(struct aperture *gen, struct aperture *hw)
1458 if (gen->base == hw->base) 1458 if (gen->base == hw->base)
1459 return true; 1459 return true;
1460 /* is the generic aperture base inside the hw base->hw base+size */ 1460 /* is the generic aperture base inside the hw base->hw base+size */
1461 if (gen->base > hw->base && gen->base <= hw->base + hw->size) 1461 if (gen->base > hw->base && gen->base < hw->base + hw->size)
1462 return true; 1462 return true;
1463 return false; 1463 return false;
1464} 1464}
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
index 76f9fac9020f..8c59cc8c5a9c 100644
--- a/drivers/video/sh_mobile_hdmi.c
+++ b/drivers/video/sh_mobile_hdmi.c
@@ -845,6 +845,9 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
845 found_rate_error = rate_error; 845 found_rate_error = rate_error;
846 } 846 }
847 847
848 hdmi->var.width = hdmi->monspec.max_x * 10;
849 hdmi->var.height = hdmi->monspec.max_y * 10;
850
848 /* 851 /*
849 * TODO 1: if no ->info is present, postpone running the config until 852 * TODO 1: if no ->info is present, postpone running the config until
850 * after ->info first gets registered. 853 * after ->info first gets registered.
@@ -1031,8 +1034,12 @@ static bool sh_hdmi_must_reconfigure(struct sh_hdmi *hdmi)
1031 dev_dbg(info->dev, "Old %ux%u, new %ux%u\n", 1034 dev_dbg(info->dev, "Old %ux%u, new %ux%u\n",
1032 mode1.xres, mode1.yres, mode2.xres, mode2.yres); 1035 mode1.xres, mode1.yres, mode2.xres, mode2.yres);
1033 1036
1034 if (fb_mode_is_equal(&mode1, &mode2)) 1037 if (fb_mode_is_equal(&mode1, &mode2)) {
1038 /* It can be a different monitor with an equal video-mode */
1039 old_var->width = new_var->width;
1040 old_var->height = new_var->height;
1035 return false; 1041 return false;
1042 }
1036 1043
1037 dev_dbg(info->dev, "Switching %u -> %u lines\n", 1044 dev_dbg(info->dev, "Switching %u -> %u lines\n",
1038 mode1.yres, mode2.yres); 1045 mode1.yres, mode2.yres);
@@ -1129,8 +1136,11 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
1129 * on, if we run a resume here, the logo disappears 1136 * on, if we run a resume here, the logo disappears
1130 */ 1137 */
1131 if (lock_fb_info(hdmi->info)) { 1138 if (lock_fb_info(hdmi->info)) {
1132 sh_hdmi_display_on(hdmi, hdmi->info); 1139 struct fb_info *info = hdmi->info;
1133 unlock_fb_info(hdmi->info); 1140 info->var.width = hdmi->var.width;
1141 info->var.height = hdmi->var.height;
1142 sh_hdmi_display_on(hdmi, info);
1143 unlock_fb_info(info);
1134 } 1144 }
1135 } else { 1145 } else {
1136 /* New monitor or have to wake up */ 1146 /* New monitor or have to wake up */
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index cffec90afa93..bd4840a8a6b7 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -1280,12 +1280,14 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
1280 mode = &default_720p; 1280 mode = &default_720p;
1281 num_cfg = 1; 1281 num_cfg = 1;
1282 } else { 1282 } else {
1283 num_cfg = ch->cfg.num_cfg; 1283 num_cfg = cfg->num_cfg;
1284 } 1284 }
1285 1285
1286 fb_videomode_to_modelist(mode, num_cfg, &info->modelist); 1286 fb_videomode_to_modelist(mode, num_cfg, &info->modelist);
1287 1287
1288 fb_videomode_to_var(var, mode); 1288 fb_videomode_to_var(var, mode);
1289 var->width = cfg->lcd_size_cfg.width;
1290 var->height = cfg->lcd_size_cfg.height;
1289 /* Default Y virtual resolution is 2x panel size */ 1291 /* Default Y virtual resolution is 2x panel size */
1290 var->yres_virtual = var->yres * 2; 1292 var->yres_virtual = var->yres * 2;
1291 var->activate = FB_ACTIVATE_NOW; 1293 var->activate = FB_ACTIVATE_NOW;
diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c
index 428f8a1583e8..3939e53f5f98 100644
--- a/drivers/watchdog/rdc321x_wdt.c
+++ b/drivers/watchdog/rdc321x_wdt.c
@@ -231,7 +231,7 @@ static int __devinit rdc321x_wdt_probe(struct platform_device *pdev)
231 struct resource *r; 231 struct resource *r;
232 struct rdc321x_wdt_pdata *pdata; 232 struct rdc321x_wdt_pdata *pdata;
233 233
234 pdata = pdev->dev.platform_data; 234 pdata = platform_get_drvdata(pdev);
235 if (!pdata) { 235 if (!pdata) {
236 dev_err(&pdev->dev, "no platform data supplied\n"); 236 dev_err(&pdev->dev, "no platform data supplied\n");
237 return -ENODEV; 237 return -ENODEV;