From: Len Brown Date: Wed, 24 Jun 2009 05:19:50 +0000 (-0400) Subject: Merge branches 'acerhdf', 'acpi-pci-bind', 'bjorn-pci-root', 'bugzilla-12904', 'bugzi... X-Git-Tag: v2.6.31-rc1~12^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fbe8cddd2d85979d273d7937a2b8a47498694d91;p=profile%2Fcommon%2Fkernel-common.git Merge branches 'acerhdf', 'acpi-pci-bind', 'bjorn-pci-root', 'bugzilla-12904', 'bugzilla-13121', 'bugzilla-13396', 'bugzilla-13533', 'bugzilla-13612', 'c3_lock', 'hid-cleanups', 'misc-2.6.31', 'pdc-leak-fix', 'pnpacpi', 'power_nocheck', 'thinkpad_acpi', 'video' and 'wmi' into release --- fbe8cddd2d85979d273d7937a2b8a47498694d91 diff --cc MAINTAINERS index 303129a,e9457fe,cf4abdd,cf4abdd,cf4abdd,cf4abdd,cf4abdd,cf4abdd,cf4abdd,77cbfb1,77cbfb1,cf4abdd,cf4abdd,77cbfb1,77cbfb1,cf4abdd,cf4abdd,cf4abdd..7d9d374 --- a/MAINTAINERS +++ b/MAINTAINERS @@@@@@@@@@@@@@@@@@@ -2020,20 -1985,10 -1978,10 -1978,10 -1978,10 -1978,10 -1978,10 -1978,10 -1978,10 -1969,10 -1969,10 -1978,10 -1978,10 -1969,10 -1969,10 -1978,10 -1978,10 -1978,10 +2027,20 @@@@@@@@@@@@@@@@@@@ F: Documentation/edac.tx F: drivers/edac/edac_* F: include/linux/edac.h +++++++++++++++++EDAC-AMD64 +++++++++++++++++P: Doug Thompson +++++++++++++++++M: dougthompson@xmission.com +++++++++++++++++P: Borislav Petkov +++++++++++++++++M: borislav.petkov@amd.com +++++++++++++++++L: bluesmoke-devel@lists.sourceforge.net (moderated for non-subscribers) +++++++++++++++++W: bluesmoke.sourceforge.net +++++++++++++++++S: Supported +++++++++++++++++F: drivers/edac/amd64_edac* +++++++++++++++++ EDAC-E752X P: Mark Gross -- -- P: Doug Thompson M: mark.gross@intel.com ++ ++ P: Doug Thompson M: dougthompson@xmission.com L: bluesmoke-devel@lists.sourceforge.net (moderated for non-subscribers) W: bluesmoke.sourceforge.net @@@@@@@@@@@@@@@@@@@ -2316,7 -2265,8 -2258,8 -2258,8 -2258,8 -2258,8 -2258,8 -2258,8 -2258,8 -2249,8 -2249,8 -2258,8 -2258,8 -2249,8 -2249,8 -2258,8 -2258,8 -2258,8 +2323,7 @@@@@@@@@@@@@@@@@@@ P: Li Yan M: leoli@freescale.com P: Zhang Wei M: zw@zh-kernel.org -- -- L: linuxppc-embedded@ozlabs.org -- -- L: linux-kernel@vger.kernel.org ++ ++ L: linuxppc-dev@ozlabs.org -------- -- ---L: linux-kernel@vger.kernel.org S: Maintained F: drivers/dma/fsldma.* diff --cc arch/x86/kernel/acpi/boot.c index 6310861,723989d,723989d,723989d,723989d,723989d,723989d,723989d,723989d,723989d,723989d,f54e0e5,723989d,723989d,723989d,723989d,723989d,723989d..6b8ca3a --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@@@@@@@@@@@@@@@@@@ -1223,16 -1207,82 -1207,82 -1207,82 -1207,82 -1207,82 -1207,82 -1207,82 -1207,82 -1207,82 -1207,82 -1137,82 -1207,82 -1207,82 -1207,82 -1207,82 -1207,82 -1207,82 +1153,16 @@@@@@@@@@@@@@@@@@@ int mp_register_gsi(struct device *dev ioapic_pin); return gsi; } ----------------- if (test_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed)) { ----------------- pr_debug("Pin %d-%d already programmed\n", ----------------- mp_ioapic_routing[ioapic].apic_id, ioapic_pin); -----------------#ifdef CONFIG_X86_32 ----------------- return (gsi < IRQ_COMPRESSION_START ? gsi : gsi_to_irq[gsi]); -----------------#else ----------------- return gsi; -----------------#endif ----------------- } ----------------- set_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed); -----------------#ifdef CONFIG_X86_32 ----------------- /* ----------------- * For GSI >= 64, use IRQ compression ----------------- */ ----------------- if ((gsi >= IRQ_COMPRESSION_START) ----------------- && (triggering == ACPI_LEVEL_SENSITIVE)) { ----------------- /* ----------------- * For PCI devices assign IRQs in order, avoiding gaps ----------------- * due to unused I/O APIC pins. ----------------- */ ----------------- int irq = gsi; ----------------- if (gsi < MAX_GSI_NUM) { ----------------- /* ----------------- * Retain the VIA chipset work-around (gsi > 15), but ----------------- * avoid a problem where the 8254 timer (IRQ0) is setup ----------------- * via an override (so it's not on pin 0 of the ioapic), ----------------- * and at the same time, the pin 0 interrupt is a PCI ----------------- * type. The gsi > 15 test could cause these two pins ----------------- * to be shared as IRQ0, and they are not shareable. ----------------- * So test for this condition, and if necessary, avoid ----------------- * the pin collision. ----------------- */ ----------------- gsi = pci_irq++; ----------------- /* ----------------- * Don't assign IRQ used by ACPI SCI ----------------- */ ----------------- if (gsi == acpi_gbl_FADT.sci_interrupt) ----------------- gsi = pci_irq++; ----------------- gsi_to_irq[irq] = gsi; ----------------- } else { ----------------- printk(KERN_ERR "GSI %u is too high\n", gsi); ----------------- return gsi; ----------------- } ----------------- } -----------------#endif ----------------- io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, ----------------- triggering == ACPI_EDGE_SENSITIVE ? 0 : 1, ----------------- polarity == ACPI_ACTIVE_HIGH ? 0 : 1); ----------------- return gsi; -----------------} +++++++++++++++++ if (enable_update_mptable) +++++++++++++++++ mp_config_acpi_gsi(dev, gsi, trigger, polarity); -----------------int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin, ----------------- u32 gsi, int triggering, int polarity) -----------------{ -----------------#ifdef CONFIG_X86_MPPARSE ----------------- struct mpc_intsrc mp_irq; ----------------- int ioapic; ---------- ------ ---------- ------ if (!acpi_ioapic) ---------- ------ return 0; +++++++++++++++++ set_io_apic_irq_attr(&irq_attr, ioapic, ioapic_pin, +++++++++++++++++ trigger == ACPI_EDGE_SENSITIVE ? 0 : 1, +++++++++++++++++ polarity == ACPI_ACTIVE_HIGH ? 0 : 1); +++++++++++++++++ io_apic_set_pci_routing(dev, gsi, &irq_attr); - if (!acpi_ioapic) - return 0; - ----------------- /* print the entry should happen on mptable identically */ ----------------- mp_irq.type = MP_INTSRC; ----------------- mp_irq.irqtype = mp_INT; ----------------- mp_irq.irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) | ----------------- (polarity == ACPI_ACTIVE_HIGH ? 1 : 3); ----------------- mp_irq.srcbus = number; ----------------- mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3); ----------------- ioapic = mp_find_ioapic(gsi); ----------------- mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id; ----------------- mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi); ----------------- ----------------- save_mp_irq(&mp_irq); -----------------#endif ----------------- return 0; +++++++++++++++++ return gsi; } /* diff --cc drivers/acpi/processor_idle.c index 10a2d91,10a2d91,10a2d91,10a2d91,10a2d91,10a2d91,10a2d91,10a2d91,10a2d91,4840c79,72069ba,1f60ccb,10a2d91,72069ba,72069ba,10a2d91,10a2d91,10a2d91..0efa59e --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@@@@@@@@@@@@@@@@@@ -839,7 -839,7 -839,7 -839,7 -839,7 -839,7 -839,7 -839,7 -839,7 -838,6 -835,6 -835,7 -839,7 -835,6 -835,6 -839,7 -839,7 -839,7 +838,7 @@@@@@@@@@@@@@@@@@@ static int acpi_idle_enter_c1(struct cp return 0; } --------- - --- acpi_state_timer_broadcast(pr, cx, 1); +++++++++++ ++++++ lapic_timer_state_broadcast(pr, cx, 1); kt1 = ktime_get_real(); acpi_idle_do_entry(cx); kt2 = ktime_get_real(); @@@@@@@@@@@@@@@@@@@ -847,7 -847,7 -847,7 -847,7 -847,7 -847,7 -847,7 -847,7 -847,7 -845,6 -842,6 -843,7 -847,7 -842,6 -842,6 -847,7 -847,7 -847,7 +846,7 @@@@@@@@@@@@@@@@@@@ local_irq_enable(); cx->usage++; --------- - --- acpi_state_timer_broadcast(pr, cx, 0); +++++++++++ ++++++ lapic_timer_state_broadcast(pr, cx, 0); return idle_time; } diff --cc drivers/acpi/video.c index 1bdfb37,1bdfb37,5adbf93,1bdfb37,1bdfb37,1eff162,a63566b,1bdfb37,1bdfb37,810cca9,810cca9,1bdfb37,1bdfb37,810cca9,810cca9,1bdfb37,9de143a,1bdfb37..8851315 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@@@@@@@@@@@@@@@@@@ -570,22 -570,22 -570,22 -570,22 -570,22 -570,30 -571,22 -570,22 -570,22 -570,6 -570,6 -570,22 -570,22 -570,6 -570,6 -570,22 -570,22 -570,22 +571,30 @@@@@@@@@@@@@@@@@@@ static struct dmi_system_id video_dmi_t DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5710Z"), }, }, ++ ++ { ++ ++ .callback = video_set_bqc_offset, ++ ++ .ident = "eMachines E510", ++ ++ .matches = { ++ ++ DMI_MATCH(DMI_BOARD_VENDOR, "EMACHINES"), ++ ++ DMI_MATCH(DMI_PRODUCT_NAME, "eMachines E510"), ++ ++ }, ++ ++ }, ++ ++ { ++ ++ .callback = video_set_bqc_offset, ++ ++ .ident = "Acer Aspire 5315", ++ ++ .matches = { ++ ++ DMI_MATCH(DMI_BOARD_VENDOR, "Acer"), ++ ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5315"), ++ ++ }, ++ ++ }, +++++ ++++++++++++ { +++++ ++++++++++++ .callback = video_set_bqc_offset, +++++ ++++++++++++ .ident = "Acer Aspire 7720", +++++ ++++++++++++ .matches = { +++++ ++++++++++++ DMI_MATCH(DMI_BOARD_VENDOR, "Acer"), +++++ ++++++++++++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"), +++++ ++++++++++++ }, +++++ ++++++++++++ }, {} }; @@@@@@@@@@@@@@@@@@@ -2350,12 -2350,12 -2350,12 -2350,12 -2350,12 -2358,12 -2383,9 -2350,12 -2350,12 -2334,12 -2334,12 -2350,12 -2350,12 -2334,12 -2334,12 -2350,12 -2356,12 -2350,12 +2397,9 @@@@@@@@@@@@@@@@@@@ static int __init acpi_video_init(void return acpi_video_register(); } ------ -- -- ---void acpi_video_exit(void) -- -- void __exit acpi_video_exit(void) ++++++ +++++++++++static void __exit acpi_video_exit(void) { ------ ----------- ------ ----------- acpi_bus_unregister_driver(&acpi_video_bus); ------ ----------- ------ ----------- remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); ++++++ +++++++++++ acpi_video_unregister(); return; } diff --cc drivers/platform/x86/hp-wmi.c index 16fffe44,50d9019,50d9019,50d9019,50d9019,50d9019,50d9019,50d9019,50d9019,50d9019,50d9019,50d9019,50d9019,50d9019,50d9019,50d9019,50d9019,46a7a6e..4ac2311 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c @@@@@@@@@@@@@@@@@@@ -151,22 -151,34 -151,34 -151,34 -151,34 -151,34 -151,34 -151,34 -151,34 -151,34 -151,34 -151,34 -151,34 -151,34 -151,34 -151,34 -151,34 -150,49 +150,37 @@@@@@@@@@@@@@@@@@@ static int hp_wmi_als_state(void static int hp_wmi_dock_state(void) { ----------------- return hp_wmi_perform_query(HPWMI_DOCK_QUERY, 0, 0); ---------------- } +++++++++++++++++ int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, 0); + ---------------- static int hp_wmi_wifi_set(void *data, enum rfkill_state state) ---------------- { ---------------- if (state) ---------------- return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, 0x101); ---------------- else ---------------- return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, 0x100); +++++++++++++++++ if (ret < 0) +++++++++++++++++ return ret; +++++++++++++++++ +++++++++++++++++ return ret & 0x1; + } + ---------------- static int hp_wmi_bluetooth_set(void *data, enum rfkill_state state) +++++++++++++++++ static int hp_wmi_tablet_state(void) + { ---------------- if (state) ---------------- return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, 0x202); ---------------- else ---------------- return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, 0x200); +++++++++++++++++ int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, 0); +++++++++++++++++ +++++++++++++++++ if (ret < 0) +++++++++++++++++ return ret; +++++++++++++++++ +++++++++++++++++ return (ret & 0x4) ? 1 : 0; } ---------------- static int hp_wmi_wwan_set(void *data, enum rfkill_state state) -static int hp_wmi_wifi_set(void *data, enum rfkill_state state) +++++++++++++++++static int hp_wmi_set_block(void *data, bool blocked) { ----------------- if (state) ---------------- return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, 0x404); - return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, 0x101); ----------------- else ---------------- return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, 0x400); - return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, 0x100); -} +++++++++++++++++ unsigned long b = (unsigned long) data; +++++++++++++++++ int query = BIT(b + 8) | ((!!blocked) << b); ++++++++++++++++ -static int hp_wmi_bluetooth_set(void *data, enum rfkill_state state) -{ - if (state) - return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, 0x202); - else - return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, 0x200); +++++++++++++++++ return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, query); } ---------------- static int hp_wmi_wifi_state(void) -static int hp_wmi_wwan_set(void *data, enum rfkill_state state) -{ - if (state) - return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, 0x404); - else - return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, 0x400); -} +++++++++++++++++static const struct rfkill_ops hp_wmi_rfkill_ops = { +++++++++++++++++ .set_block = hp_wmi_set_block, +++++++++++++++++}; ++++++++++++++++ -static int hp_wmi_wifi_state(void) +++++++++++++++++static bool hp_wmi_wifi_state(void) { int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0); @@@@@@@@@@@@@@@@@@@ -326,23 -338,23 -338,23 -338,23 -338,23 -338,23 -338,23 -338,23 -338,23 -338,23 -338,23 -338,23 -338,23 -338,23 -338,23 -338,23 -338,23 -362,23 +350,23 @@@@@@@@@@@@@@@@@@@ static void hp_wmi_notify(u32 value, vo key->keycode, 0); input_sync(hp_wmi_input_dev); break; ----------------- case KE_SW: ----------------- input_report_switch(hp_wmi_input_dev, ----------------- key->keycode, ----------------- hp_wmi_dock_state()); ----------------- input_sync(hp_wmi_input_dev); ----------------- break; } +++++++++++++++++ } else if (eventcode == 0x1) { +++++++++++++++++ input_report_switch(hp_wmi_input_dev, SW_DOCK, +++++++++++++++++ hp_wmi_dock_state()); +++++++++++++++++ input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE, +++++++++++++++++ hp_wmi_tablet_state()); +++++++++++++++++ input_sync(hp_wmi_input_dev); } else if (eventcode == 0x5) { if (wifi_rfkill) ----------------- rfkill_force_state(wifi_rfkill, ----------------- hp_wmi_wifi_state()); +++++++++++++++++ rfkill_set_sw_state(wifi_rfkill, +++++++++++++++++ hp_wmi_wifi_state()); if (bluetooth_rfkill) ----------------- rfkill_force_state(bluetooth_rfkill, ----------------- hp_wmi_bluetooth_state()); +++++++++++++++++ rfkill_set_sw_state(bluetooth_rfkill, +++++++++++++++++ hp_wmi_bluetooth_state()); if (wwan_rfkill) ----------------- rfkill_force_state(wwan_rfkill, ----------------- hp_wmi_wwan_state()); +++++++++++++++++ rfkill_set_sw_state(wwan_rfkill, +++++++++++++++++ hp_wmi_wwan_state()); } else printk(KERN_INFO "HP WMI: Unknown key pressed - %x\n", eventcode); @@@@@@@@@@@@@@@@@@@ -416,15 -428,16 -428,16 -428,16 -428,16 -428,16 -428,16 -428,16 -428,16 -428,16 -428,16 -428,16 -428,16 -428,16 -428,16 -428,16 -428,16 -454,19 +442,18 @@@@@@@@@@@@@@@@@@@ static int __init hp_wmi_bios_setup(str err = device_create_file(&device->dev, &dev_attr_dock); if (err) goto add_sysfs_error; +++++++++++++++++ err = device_create_file(&device->dev, &dev_attr_tablet); +++++++++++++++++ if (err) +++++++++++++++++ goto add_sysfs_error; if (wireless & 0x1) { ----------------- wifi_rfkill = rfkill_allocate(&device->dev, RFKILL_TYPE_WLAN); ----------------- wifi_rfkill->name = "hp-wifi"; ----------------- wifi_rfkill->state = hp_wmi_wifi_state(); ----------------- wifi_rfkill->toggle_radio = hp_wmi_wifi_set; ----------------- wifi_rfkill->user_claim_unsupported = 1; +++++++++++++++++ wifi_rfkill = rfkill_alloc("hp-wifi", &device->dev, +++++++++++++++++ RFKILL_TYPE_WLAN, +++++++++++++++++ &hp_wmi_rfkill_ops, +++++++++++++++++ (void *) 0); err = rfkill_register(wifi_rfkill); if (err) ----------------- goto add_sysfs_error; +++++++++++++++++ goto register_wifi_error; } if (wireless & 0x2) { diff --cc drivers/platform/x86/thinkpad_acpi.c index 40d64c0,912be65,912be65,912be65,912be65,912be65,912be65,912be65,912be65,912be65,912be65,912be65,912be65,912be65,912be65,27ca676,912be65,912be65..a463fd7 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@@@@@@@@@@@@@@@@@@ -2503,32 -2230,15 -2230,15 -2230,15 -2230,15 -2230,15 -2230,15 -2230,15 -2230,15 -2230,15 -2230,15 -2230,15 -2230,15 -2230,15 -2230,15 -2301,15 -2230,15 -2230,15 +2574,32 @@@@@@@@@@@@@@@@@@@ static void tpacpi_send_radiosw_update( { int wlsw; ----------------- /* Sync these BEFORE sending any rfkill events */ ----------------- if (tp_features.bluetooth) ----------------- bluetooth_update_rfk(); ----------------- if (tp_features.wan) ----------------- wan_update_rfk(); ----------------- if (tp_features.uwb) ----------------- uwb_update_rfk(); +++++++++++++++++ /* +++++++++++++++++ * We must sync all rfkill controllers *before* issuing any +++++++++++++++++ * rfkill input events, or we will race the rfkill core input +++++++++++++++++ * handler. +++++++++++++++++ * +++++++++++++++++ * tpacpi_inputdev_send_mutex works as a syncronization point +++++++++++++++++ * for the above. +++++++++++++++++ * +++++++++++++++++ * We optimize to avoid numerous calls to hotkey_get_wlsw. +++++++++++++++++ */ +++++++++++++++++ +++++++++++++++++ wlsw = hotkey_get_wlsw(); ++++++++++++++ ++ - if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) { +++++++++++++++++ /* Sync hw blocking state first if it is hw-blocked */ +++++++++++++++++ if (wlsw == TPACPI_RFK_RADIO_OFF) +++++++++++++++++ tpacpi_rfk_update_hwblock_state(true); +++++++++++++++++ +++++++++++++++++ /* Sync sw blocking state */ +++++++++++++++++ tpacpi_rfk_update_swstate_all(); + -------------- -- if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) { +++++++++++++++++ /* Sync hw blocking state last if it is hw-unblocked */ +++++++++++++++++ if (wlsw == TPACPI_RFK_RADIO_ON) +++++++++++++++++ tpacpi_rfk_update_hwblock_state(false); +++++++++++++++++ +++++++++++++++++ /* Issue rfkill input event for WLSW switch */ +++++++++++++++++ if (!(wlsw < 0)) { mutex_lock(&tpacpi_inputdev_send_mutex); input_report_switch(tpacpi_inputdev, @@@@@@@@@@@@@@@@@@@ -3374,16 -3088,41 -3088,41 -3088,41 -3088,41 -3088,41 -3088,41 -3088,41 -3088,41 -3088,41 -3088,41 -3088,41 -3088,41 -3088,41 -3088,41 -3159,41 -3088,41 -3088,41 +3445,16 @@@@@@@@@@@@@@@@@@@ static int bluetooth_get_status(void return -EIO; return ((status & TP_ACPI_BLUETOOTH_RADIOSSW) != 0) ? ----------------- RFKILL_STATE_UNBLOCKED : RFKILL_STATE_SOFT_BLOCKED; - } - - static void bluetooth_update_rfk(void) - { - int status; - - if (!tpacpi_bluetooth_rfkill) - return; - - status = bluetooth_get_radiosw(); - if (status < 0) - return; - rfkill_force_state(tpacpi_bluetooth_rfkill, status); - - vdbg_printk(TPACPI_DBG_RFKILL, - "forced rfkill state to %d\n", - status); +++++++++++++++++ TPACPI_RFK_RADIO_ON : TPACPI_RFK_RADIO_OFF; } -------------- --static void bluetooth_update_rfk(void) - static int bluetooth_set_radiosw(int radio_on, int update_rfk) +++++++++++++++++static int bluetooth_set_status(enum tpacpi_rfkill_state state) { int status; -------------- -- if (!tpacpi_bluetooth_rfkill) -------------- -- return; - if (!tp_features.bluetooth) - return -ENODEV; ----------------- -------------- -- status = bluetooth_get_radiosw(); -------------- -- if (status < 0) -------------- -- return; -------------- -- rfkill_force_state(tpacpi_bluetooth_rfkill, status); - /* WLSW overrides bluetooth in firmware/hardware, but there is no - * reason to risk weird behaviour. */ - if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status - && radio_on) - return -EPERM; ----------------- vdbg_printk(TPACPI_DBG_RFKILL, -------------- -- "forced rfkill state to %d\n", -------------- -- status); -------------- --} -------------- -- -------------- --static int bluetooth_set_radiosw(int radio_on, int update_rfk) -------------- --{ -------------- -- int status; -------------- -- -------------- -- if (!tp_features.bluetooth) -------------- -- return -ENODEV; -------------- -- -------------- -- /* WLSW overrides bluetooth in firmware/hardware, but there is no -------------- -- * reason to risk weird behaviour. */ -------------- -- if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status -------------- -- && radio_on) -------------- -- return -EPERM; -------------- -- -------------- -- vdbg_printk(TPACPI_DBG_RFKILL, ----------------- "will %s bluetooth\n", radio_on ? "enable" : "disable"); +++++++++++++++++ "will attempt to %s bluetooth\n", +++++++++++++++++ (state == TPACPI_RFK_RADIO_ON) ? "enable" : "disable"); #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES if (dbg_bluetoothemul) { @@@@@@@@@@@@@@@@@@@ -3501,35 -3277,71 -3277,71 -3277,71 -3277,71 -3277,71 -3277,71 -3277,71 -3277,71 -3277,71 -3277,71 -3277,71 -3277,71 -3277,71 -3277,71 -3348,71 -3277,71 -3277,71 +3572,35 @@@@@@@@@@@@@@@@@@@ static int __init bluetooth_init(struc if (!tp_features.bluetooth) return 1; ----------------- res = sysfs_create_group(&tpacpi_pdev->dev.kobj, ----------------- &bluetooth_attr_group); ----------------- if (res) ----------------- return res; ----------------- res = tpacpi_new_rfkill(TPACPI_RFK_BLUETOOTH_SW_ID, ----------------- &tpacpi_bluetooth_rfkill, -------------- -- RFKILL_TYPE_BLUETOOTH, -------------- -- TPACPI_RFK_BLUETOOTH_SW_NAME, -------------- -- true, -------------- -- tpacpi_bluetooth_rfk_set, -------------- -- tpacpi_bluetooth_rfk_get); -------------- -- if (res) { -------------- -- bluetooth_exit(); -------------- -- return res; -------------- -- } -------------- -- -------------- -- return 0; -------------- --} -------------- -- -------------- --/* procfs -------------------------------------------------------------- */ -------------- --static int bluetooth_read(char *p) -------------- --{ -------------- -- int len = 0; -------------- -- int status = bluetooth_get_radiosw(); -------------- -- -------------- -- if (!tp_features.bluetooth) -------------- -- len += sprintf(p + len, "status:\t\tnot supported\n"); -------------- -- else { -------------- -- len += sprintf(p + len, "status:\t\t%s\n", -------------- -- (status == RFKILL_STATE_UNBLOCKED) ? -------------- -- "enabled" : "disabled"); -------------- -- len += sprintf(p + len, "commands:\tenable, disable\n"); -------------- -- } -------------- -- -------------- -- return len; -------------- --} -------------- -- -------------- --static int bluetooth_write(char *buf) -------------- --{ -------------- -- char *cmd; -------------- -- int state = -1; -------------- -- -------------- -- if (!tp_features.bluetooth) -------------- -- return -ENODEV; -------------- -- -------------- -- while ((cmd = next_cmd(&buf))) { -------------- -- if (strlencmp(cmd, "enable") == 0) { -------------- -- state = 1; -------------- -- } else if (strlencmp(cmd, "disable") == 0) { -------------- -- state = 0; -------------- -- } else -------------- -- return -EINVAL; -------------- -- } +++++++++++++++++ &bluetooth_tprfk_ops, ++++++++++++++ ++ RFKILL_TYPE_BLUETOOTH, ++++++++++++++ ++ TPACPI_RFK_BLUETOOTH_SW_NAME, - true, - tpacpi_bluetooth_rfk_set, - tpacpi_bluetooth_rfk_get); +++++++++++++++++ true); +++++++++++++++++ if (res) +++++++++++++++++ return res; + -------------- -- if (state != -1) { -------------- -- tpacpi_disclose_usertask("procfs bluetooth", -------------- -- "attempt to %s\n", -------------- -- state ? "enable" : "disable"); -------------- -- bluetooth_set_radiosw(state, 1); +++++++++++++++++ res = sysfs_create_group(&tpacpi_pdev->dev.kobj, +++++++++++++++++ &bluetooth_attr_group); ++++++++++++++ ++ if (res) { - bluetooth_exit(); +++++++++++++++++ tpacpi_destroy_rfkill(TPACPI_RFK_BLUETOOTH_SW_ID); ++++++++++++++ ++ return res; } return 0; } ++++++++++++++ ++/* procfs -------------------------------------------------------------- */ ++++++++++++++ ++static int bluetooth_read(char *p) ++++++++++++++ ++{ - int len = 0; - int status = bluetooth_get_radiosw(); - - if (!tp_features.bluetooth) - len += sprintf(p + len, "status:\t\tnot supported\n"); - else { - len += sprintf(p + len, "status:\t\t%s\n", - (status == RFKILL_STATE_UNBLOCKED) ? - "enabled" : "disabled"); - len += sprintf(p + len, "commands:\tenable, disable\n"); - } - - return len; +++++++++++++++++ return tpacpi_rfk_procfs_read(TPACPI_RFK_BLUETOOTH_SW_ID, p); ++++++++++++++ ++} ++++++++++++++ ++ ++++++++++++++ ++static int bluetooth_write(char *buf) ++++++++++++++ ++{ - char *cmd; - int state = -1; - - if (!tp_features.bluetooth) - return -ENODEV; - - while ((cmd = next_cmd(&buf))) { - if (strlencmp(cmd, "enable") == 0) { - state = 1; - } else if (strlencmp(cmd, "disable") == 0) { - state = 0; - } else - return -EINVAL; - } - - if (state != -1) { - tpacpi_disclose_usertask("procfs bluetooth", - "attempt to %s\n", - state ? "enable" : "disable"); - bluetooth_set_radiosw(state, 1); - } - - return 0; +++++++++++++++++ return tpacpi_rfk_procfs_write(TPACPI_RFK_BLUETOOTH_SW_ID, buf); ++++++++++++++ ++} ++++++++++++++ ++ static struct ibm_struct bluetooth_driver_data = { .name = "bluetooth", .read = bluetooth_read,