Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

leds: Modify PC Engines apu/apu2 driver to support apu3

PC Engines apu3 is an improved version of the apu2, using the same SoC
and almost everything else.

This patch reuses as much as possible from the apu2 definitions, to
avoid redundancy.

Signed-off-by: Raffaello D. Di Napoli <rafdev@dinapo.li>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>

authored by

Raffaello D. Di Napoli and committed by
Jacek Anaszewski
8cb21086 d30c8d20

+46 -3
+3 -2
drivers/leds/Kconfig
··· 57 57 depends on PINCTRL 58 58 help 59 59 This option enables support for the LEDs on the AAT1290. 60 + 60 61 config LEDS_APU 61 - tristate "Front panel LED support for PC Engines APU/APU2 boards" 62 + tristate "Front panel LED support for PC Engines APU/APU2/APU3 boards" 62 63 depends on LEDS_CLASS 63 64 depends on X86 && DMI 64 65 help 65 - This driver makes the PC Engines APU/APU2 front panel LEDs 66 + This driver makes the PC Engines APU/APU2/APU3 front panel LEDs 66 67 accessible from userspace programs through the LED subsystem. 67 68 68 69 To compile this driver as a module, choose M here: the
+43 -1
drivers/leds/leds-apu.c
··· 102 102 { "apu2:green:3", LED_OFF, APU2_FCH_GPIO_BASE + 70 * APU2_IOSIZE }, 103 103 }; 104 104 105 + /* Same as apu2_led_profile, but with "3" in the LED names. */ 106 + static const struct apu_led_profile apu3_led_profile[] = { 107 + { "apu3:green:1", LED_ON, APU2_FCH_GPIO_BASE + 68 * APU2_IOSIZE }, 108 + { "apu3:green:2", LED_OFF, APU2_FCH_GPIO_BASE + 69 * APU2_IOSIZE }, 109 + { "apu3:green:3", LED_OFF, APU2_FCH_GPIO_BASE + 70 * APU2_IOSIZE }, 110 + }; 111 + 105 112 static const struct dmi_system_id apu_led_dmi_table[] __initconst = { 106 113 { 107 114 .ident = "apu", ··· 139 132 .matches = { 140 133 DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"), 141 134 DMI_MATCH(DMI_BOARD_NAME, "PC Engines apu2") 135 + } 136 + }, 137 + /* PC Engines APU3 with "Legacy" bios < 4.0.8 */ 138 + { 139 + .ident = "apu3", 140 + .matches = { 141 + DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"), 142 + DMI_MATCH(DMI_BOARD_NAME, "APU3") 143 + } 144 + }, 145 + /* PC Engines APU3 with "Legacy" bios >= 4.0.8 */ 146 + { 147 + .ident = "apu3", 148 + .matches = { 149 + DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"), 150 + DMI_MATCH(DMI_BOARD_NAME, "apu3") 151 + } 152 + }, 153 + /* PC Engines APU2 with "Mainline" bios */ 154 + { 155 + .ident = "apu3", 156 + .matches = { 157 + DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"), 158 + DMI_MATCH(DMI_BOARD_NAME, "PC Engines apu3") 142 159 } 143 160 }, 144 161 {} ··· 266 235 apu_led->platform = APU2_LED_PLATFORM; 267 236 apu_led->num_led_instances = ARRAY_SIZE(apu2_led_profile); 268 237 apu_led->iosize = APU2_IOSIZE; 238 + } else if (dmi_match(DMI_BOARD_NAME, "APU3") || 239 + dmi_match(DMI_BOARD_NAME, "apu3") || 240 + dmi_match(DMI_BOARD_NAME, "PC Engines apu3")) { 241 + apu_led->profile = apu3_led_profile; 242 + /* Otherwise identical to APU2. */ 243 + apu_led->platform = APU2_LED_PLATFORM; 244 + apu_led->num_led_instances = ARRAY_SIZE(apu3_led_profile); 245 + apu_led->iosize = APU2_IOSIZE; 269 246 } 270 247 271 248 spin_lock_init(&apu_led->lock); ··· 298 259 if (!(dmi_match(DMI_PRODUCT_NAME, "APU") || 299 260 dmi_match(DMI_PRODUCT_NAME, "APU2") || 300 261 dmi_match(DMI_PRODUCT_NAME, "apu2") || 301 - dmi_match(DMI_PRODUCT_NAME, "PC Engines apu2"))) { 262 + dmi_match(DMI_PRODUCT_NAME, "PC Engines apu2") || 263 + dmi_match(DMI_PRODUCT_NAME, "APU3") || 264 + dmi_match(DMI_PRODUCT_NAME, "apu3") || 265 + dmi_match(DMI_PRODUCT_NAME, "PC Engines apu3"))) { 302 266 pr_err("Unknown PC Engines board: %s\n", 303 267 dmi_get_system_info(DMI_PRODUCT_NAME)); 304 268 return -ENODEV;