/* Helper functions for Thinkpad LED control; * to be included from codec driver */ #if IS_ENABLED(CONFIG_THINKPAD_ACPI) #include #include static int (*led_set_func)(int, bool); static void (*old_vmaster_hook)(void *, int); static bool is_thinkpad(struct hda_codec *codec) { return (codec->core.subsystem_id >> 16 == 0x17aa) && (acpi_dev_found("LEN0068") || acpi_dev_found("LEN0268") || acpi_dev_found("IBM0068")); } static void update_tpacpi_mute_led(void *private_data, int enabled) { if (old_vmaster_hook) old_vmaster_hook(private_data, enabled); if (led_set_func) led_set_func(TPACPI_LED_MUTE, !enabled); } static void update_tpacpi_micmute_led(struct hda_codec *codec, struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { if (!ucontrol || !led_set_func) return; if (strcmp("Capture Switch", ucontrol->id.name) == 0 && ucontrol->id.index == 0) { /* TODO: How do I verify if it's a mono or stereo here? */ bool val = ucontrol->value.integer.value[0] || ucontrol->value.integer.value[1]; led_set_func(TPACPI_LED_MICMUTE, !val); } } static void hda_fixup_thinkpad_acpi(struct hda_codec *codec, const struct hda_fixup *fix, int action) { struct hda_gen_spec *spec = codec->spec; bool removefunc = false; if (action == HDA_FIXUP_ACT_PROBE) { if (!is_thinkpad(codec)) return; if (!led_set_func) led_set_func = symbol_request(tpacpi_led_set); if (!led_set_func) { codec_warn(codec, "Failed to find thinkpad-acpi symbol tpacpi_led_set\n"); return; } removefunc = true; if (led_set_func(TPACPI_LED_MUTE, false) >= 0) { old_vmaster_hook = spec->vmaster_mute.hook; spec->vmaster_mute.hook = update_tpacpi_mute_led; removefunc = false; } if (led_set_func(TPACPI_LED_MICMUTE, false) >= 0) { if (spec->num_adc_nids > 1 && !spec->dyn_adc_switch) codec_dbg(codec, "Skipping micmute LED control due to several ADCs"); else { spec->cap_sync_hook = update_tpacpi_micmute_led; removefunc = false; } } } if (led_set_func && (action == HDA_FIXUP_ACT_FREE || removefunc)) { symbol_put(tpacpi_led_set); led_set_func = NULL; old_vmaster_hook = NULL; } } #else /* CONFIG_THINKPAD_ACPI */ static void hda_fixup_thinkpad_acpi(struct hda_codec *codec, const struct hda_fixup *fix, int action) { } #endif /* CONFIG_THINKPAD_ACPI */ age.h'>
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-25 14:05:56 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-25 14:05:56 -0800
commitb272f732f888d4cf43c943a40c9aaa836f9b7431 (patch)
treeda9cac6b9d12b83592c16d3503c0e3f2f00f146f /include/xen/page.h
parent10bbe7599e2755d3f3e100103967788b8b5a4bce (diff)
parent008b69e4d52f2cbee3ed0d0502edd78155000b1a (diff)
Merge branch 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull SMP hotplug notifier removal from Thomas Gleixner: "This is the final cleanup of the hotplug notifier infrastructure. The series has been reintgrated in the last two days because there came a new driver using the old infrastructure via the SCSI tree. Summary: - convert the last leftover drivers utilizing notifiers - fixup for a completely broken hotplug user - prevent setup of already used states - removal of the notifiers - treewide cleanup of hotplug state names - consolidation of state space There is a sphinx based documentation pending, but that needs review from the documentation folks" * 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: irqchip/armada-xp: Consolidate hotplug state space irqchip/gic: Consolidate hotplug state space coresight/etm3/4x: Consolidate hotplug state space cpu/hotplug: Cleanup state names cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions staging/lustre/libcfs: Convert to hotplug state machine scsi/bnx2i: Convert to hotplug state machine scsi/bnx2fc: Convert to hotplug state machine cpu/hotplug: Prevent overwriting of callbacks x86/msr: Remove bogus cleanup from the error path bus: arm-ccn: Prevent hotplug callback leak perf/x86/intel/cstate: Prevent hotplug callback leak ARM/imx/mmcd: Fix broken cpu hotplug handling scsi: qedi: Convert to hotplug state machine
Diffstat (limited to 'include/xen/page.h')