Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 674b5d58 authored by Darren Hart's avatar Darren Hart Committed by Darren Hart (VMware)
Browse files

Merge branch 'linux-leds/dell-laptop-changes-for-4.12'

Merge branch 'dell-laptop-changes-for-4.12' of
git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git


to avoid linux-next merge conflict with dell-laptop.c.

Signed-off-by: default avatarDarren Hart (VMware) <dvhart@infradead.org>
parents 6b8e7d8f ab768386
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -463,15 +463,6 @@ config LEDS_ADP5520
	  To compile this driver as a module, choose M here: the module will
	  be called leds-adp5520.

config LEDS_DELL_NETBOOKS
	tristate "External LED on Dell Business Netbooks"
	depends on LEDS_CLASS
	depends on X86 && ACPI_WMI
	depends on DELL_SMBIOS
	help
	  This adds support for the Latitude 2100 and similar
	  notebooks that have an external LED.

config LEDS_MC13783
	tristate "LED Support for MC13XXX PMIC"
	depends on LEDS_CLASS
+0 −1
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o
obj-$(CONFIG_LEDS_INTEL_SS4200)		+= leds-ss4200.o
obj-$(CONFIG_LEDS_LT3593)		+= leds-lt3593.o
obj-$(CONFIG_LEDS_ADP5520)		+= leds-adp5520.o
obj-$(CONFIG_LEDS_DELL_NETBOOKS)	+= dell-led.o
obj-$(CONFIG_LEDS_MC13783)		+= leds-mc13783.o
obj-$(CONFIG_LEDS_NS2)			+= leds-ns2.o
obj-$(CONFIG_LEDS_NETXBIG)		+= leds-netxbig.o
+31 −2
Original line number Diff line number Diff line
@@ -31,12 +31,16 @@
#define MAX_NAME_LEN	8

struct led_trigger_cpu {
	bool is_active;
	char name[MAX_NAME_LEN];
	struct led_trigger *_trig;
};

static DEFINE_PER_CPU(struct led_trigger_cpu, cpu_trig);

static struct led_trigger *trig_cpu_all;
static atomic_t num_active_cpus = ATOMIC_INIT(0);

/**
 * ledtrig_cpu - emit a CPU event as a trigger
 * @evt: CPU event to be emitted
@@ -47,26 +51,46 @@ static DEFINE_PER_CPU(struct led_trigger_cpu, cpu_trig);
void ledtrig_cpu(enum cpu_led_event ledevt)
{
	struct led_trigger_cpu *trig = this_cpu_ptr(&cpu_trig);
	bool is_active = trig->is_active;

	/* Locate the correct CPU LED */
	switch (ledevt) {
	case CPU_LED_IDLE_END:
	case CPU_LED_START:
		/* Will turn the LED on, max brightness */
		led_trigger_event(trig->_trig, LED_FULL);
		is_active = true;
		break;

	case CPU_LED_IDLE_START:
	case CPU_LED_STOP:
	case CPU_LED_HALTED:
		/* Will turn the LED off */
		led_trigger_event(trig->_trig, LED_OFF);
		is_active = false;
		break;

	default:
		/* Will leave the LED as it is */
		break;
	}

	if (is_active != trig->is_active) {
		unsigned int active_cpus;
		unsigned int total_cpus;

		/* Update trigger state */
		trig->is_active = is_active;
		atomic_add(is_active ? 1 : -1, &num_active_cpus);
		active_cpus = atomic_read(&num_active_cpus);
		total_cpus = num_present_cpus();

		led_trigger_event(trig->_trig,
			is_active ? LED_FULL : LED_OFF);


		led_trigger_event(trig_cpu_all,
			DIV_ROUND_UP(LED_FULL * active_cpus, total_cpus));

	}
}
EXPORT_SYMBOL(ledtrig_cpu);

@@ -112,6 +136,11 @@ static int __init ledtrig_cpu_init(void)
	/* Supports up to 9999 cpu cores */
	BUILD_BUG_ON(CONFIG_NR_CPUS > 9999);

	/*
	 * Registering a trigger for all CPUs.
	 */
	led_trigger_register_simple("cpu", &trig_cpu_all);

	/*
	 * Registering CPU led trigger for each CPU core here
	 * ignores CPU hotplug, but after this CPU hotplug works
+8 −0
Original line number Diff line number Diff line
@@ -141,6 +141,14 @@ config DELL_WMI_AIO
	  To compile this driver as a module, choose M here: the module will
	  be called dell-wmi-aio.

config DELL_WMI_LED
	tristate "External LED on Dell Business Netbooks"
	depends on LEDS_CLASS
	depends on ACPI_WMI
	help
	  This adds support for the Latitude 2100 and similar
	  notebooks that have an external LED.

config DELL_SMO8800
	tristate "Dell Latitude freefall driver (ACPI SMO88XX)"
	depends on ACPI
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ obj-$(CONFIG_DELL_SMBIOS) += dell-smbios.o
obj-$(CONFIG_DELL_LAPTOP)	+= dell-laptop.o
obj-$(CONFIG_DELL_WMI)		+= dell-wmi.o
obj-$(CONFIG_DELL_WMI_AIO)	+= dell-wmi-aio.o
obj-$(CONFIG_DELL_WMI_LED)	+= dell-wmi-led.o
obj-$(CONFIG_DELL_SMO8800)	+= dell-smo8800.o
obj-$(CONFIG_DELL_RBTN)		+= dell-rbtn.o
obj-$(CONFIG_ACER_WMI)		+= acer-wmi.o
Loading