summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Weigelt <info@metux.net>2019-07-15 10:57:28 -0400
committerJacek Anaszewski <jacek.anaszewski@gmail.com>2019-07-22 15:55:09 -0400
commit0344e6166bbf90ad3fe05497ffe754bd65f9e7ac (patch)
tree531673ba8163a19a167bc1fd3771326e02409982
parent967ea03cc345d86c8e134d7610e61a3012046407 (diff)
leds: apu: drop superseeded apu2/3 led support
This driver only supports gpio-attached LEDs on apu1/2/3 boards, but neither gpio's themselves, nor other gpio-attached devices (eg. front button). For apu2+ a newer, more complete driver exists, based on a generic driver for the AMD SOCs gpio-controller, supporting LEDs as well other devices. Therefore these boards don't need legacy support from this driver anymore. Both drivers claim the same device, so only one driver may exist in a system, putting distros in the position to decide between either apu2+ keys or apu1 led support. Therefore drop the apu2+ led support from the old driver, solve the conflict and reduce unnecessary code. Signed-off-by: Enrico Weigelt <info@metux.net> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
-rw-r--r--drivers/leds/Kconfig5
-rw-r--r--drivers/leds/leds-apu.c124
2 files changed, 10 insertions, 119 deletions
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index b0fdeef10bd9..f7a3dd7ecf3d 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -74,9 +74,12 @@ config LEDS_APU
74 depends on LEDS_CLASS 74 depends on LEDS_CLASS
75 depends on X86 && DMI 75 depends on X86 && DMI
76 help 76 help
77 This driver makes the PC Engines APU/APU2/APU3 front panel LEDs 77 This driver makes the PC Engines APU1 front panel LEDs
78 accessible from userspace programs through the LED subsystem. 78 accessible from userspace programs through the LED subsystem.
79 79
80 If you're looking for APU2/3, use the pcengines-apu2 driver.
81 (symbol CONFIG_PCENGINES_APU2)
82
80 To compile this driver as a module, choose M here: the 83 To compile this driver as a module, choose M here: the
81 module will be called leds-apu. 84 module will be called leds-apu.
82 85
diff --git a/drivers/leds/leds-apu.c b/drivers/leds/leds-apu.c
index 8d42e46e2de3..140093a0494d 100644
--- a/drivers/leds/leds-apu.c
+++ b/drivers/leds/leds-apu.c
@@ -47,12 +47,6 @@
47#define APU1_NUM_GPIO 3 47#define APU1_NUM_GPIO 3
48#define APU1_IOSIZE sizeof(u8) 48#define APU1_IOSIZE sizeof(u8)
49 49
50#define APU2_FCH_ACPI_MMIO_BASE 0xFED80000
51#define APU2_FCH_GPIO_BASE (APU2_FCH_ACPI_MMIO_BASE + 0x1500)
52#define APU2_GPIO_BIT_WRITE 22
53#define APU2_APU2_NUM_GPIO 4
54#define APU2_IOSIZE sizeof(u32)
55
56/* LED access parameters */ 50/* LED access parameters */
57struct apu_param { 51struct apu_param {
58 void __iomem *addr; /* for ioread/iowrite */ 52 void __iomem *addr; /* for ioread/iowrite */
@@ -75,7 +69,6 @@ struct apu_led_profile {
75/* Supported platform types */ 69/* Supported platform types */
76enum apu_led_platform_types { 70enum apu_led_platform_types {
77 APU1_LED_PLATFORM, 71 APU1_LED_PLATFORM,
78 APU2_LED_PLATFORM,
79}; 72};
80 73
81struct apu_led_pdata { 74struct apu_led_pdata {
@@ -96,19 +89,6 @@ static const struct apu_led_profile apu1_led_profile[] = {
96 { "apu:green:3", LED_OFF, APU1_FCH_GPIO_BASE + 2 * APU1_IOSIZE }, 89 { "apu:green:3", LED_OFF, APU1_FCH_GPIO_BASE + 2 * APU1_IOSIZE },
97}; 90};
98 91
99static const struct apu_led_profile apu2_led_profile[] = {
100 { "apu2:green:1", LED_ON, APU2_FCH_GPIO_BASE + 68 * APU2_IOSIZE },
101 { "apu2:green:2", LED_OFF, APU2_FCH_GPIO_BASE + 69 * APU2_IOSIZE },
102 { "apu2:green:3", LED_OFF, APU2_FCH_GPIO_BASE + 70 * APU2_IOSIZE },
103};
104
105/* Same as apu2_led_profile, but with "3" in the LED names. */
106static 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
112static const struct dmi_system_id apu_led_dmi_table[] __initconst = { 92static const struct dmi_system_id apu_led_dmi_table[] __initconst = {
113 { 93 {
114 .ident = "apu", 94 .ident = "apu",
@@ -117,54 +97,6 @@ static const struct dmi_system_id apu_led_dmi_table[] __initconst = {
117 DMI_MATCH(DMI_PRODUCT_NAME, "APU") 97 DMI_MATCH(DMI_PRODUCT_NAME, "APU")
118 } 98 }
119 }, 99 },
120 /* PC Engines APU2 with "Legacy" bios < 4.0.8 */
121 {
122 .ident = "apu2",
123 .matches = {
124 DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"),
125 DMI_MATCH(DMI_BOARD_NAME, "APU2")
126 }
127 },
128 /* PC Engines APU2 with "Legacy" bios >= 4.0.8 */
129 {
130 .ident = "apu2",
131 .matches = {
132 DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"),
133 DMI_MATCH(DMI_BOARD_NAME, "apu2")
134 }
135 },
136 /* PC Engines APU2 with "Mainline" bios */
137 {
138 .ident = "apu2",
139 .matches = {
140 DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"),
141 DMI_MATCH(DMI_BOARD_NAME, "PC Engines apu2")
142 }
143 },
144 /* PC Engines APU3 with "Legacy" bios < 4.0.8 */
145 {
146 .ident = "apu3",
147 .matches = {
148 DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"),
149 DMI_MATCH(DMI_BOARD_NAME, "APU3")
150 }
151 },
152 /* PC Engines APU3 with "Legacy" bios >= 4.0.8 */
153 {
154 .ident = "apu3",
155 .matches = {
156 DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"),
157 DMI_MATCH(DMI_BOARD_NAME, "apu3")
158 }
159 },
160 /* PC Engines APU2 with "Mainline" bios */
161 {
162 .ident = "apu3",
163 .matches = {
164 DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"),
165 DMI_MATCH(DMI_BOARD_NAME, "PC Engines apu3")
166 }
167 },
168 {} 100 {}
169}; 101};
170MODULE_DEVICE_TABLE(dmi, apu_led_dmi_table); 102MODULE_DEVICE_TABLE(dmi, apu_led_dmi_table);
@@ -178,25 +110,6 @@ static void apu1_led_brightness_set(struct led_classdev *led, enum led_brightnes
178 spin_unlock(&apu_led->lock); 110 spin_unlock(&apu_led->lock);
179} 111}
180 112
181static void apu2_led_brightness_set(struct led_classdev *led, enum led_brightness value)
182{
183 struct apu_led_priv *pled = cdev_to_priv(led);
184 u32 value_new;
185
186 spin_lock(&apu_led->lock);
187
188 value_new = ioread32(pled->param.addr);
189
190 if (value)
191 value_new &= ~BIT(APU2_GPIO_BIT_WRITE);
192 else
193 value_new |= BIT(APU2_GPIO_BIT_WRITE);
194
195 iowrite32(value_new, pled->param.addr);
196
197 spin_unlock(&apu_led->lock);
198}
199
200static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld) 113static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld)
201{ 114{
202 int i; 115 int i;
@@ -219,8 +132,6 @@ static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld)
219 led_cdev->flags = LED_CORE_SUSPENDRESUME; 132 led_cdev->flags = LED_CORE_SUSPENDRESUME;
220 if (apu_led->platform == APU1_LED_PLATFORM) 133 if (apu_led->platform == APU1_LED_PLATFORM)
221 led_cdev->brightness_set = apu1_led_brightness_set; 134 led_cdev->brightness_set = apu1_led_brightness_set;
222 else if (apu_led->platform == APU2_LED_PLATFORM)
223 led_cdev->brightness_set = apu2_led_brightness_set;
224 135
225 pled->param.addr = devm_ioremap(dev, 136 pled->param.addr = devm_ioremap(dev,
226 apu_led->profile[i].offset, apu_led->iosize); 137 apu_led->profile[i].offset, apu_led->iosize);
@@ -254,27 +165,10 @@ static int __init apu_led_probe(struct platform_device *pdev)
254 165
255 apu_led->pdev = pdev; 166 apu_led->pdev = pdev;
256 167
257 if (dmi_match(DMI_PRODUCT_NAME, "APU")) { 168 apu_led->profile = apu1_led_profile;
258 apu_led->profile = apu1_led_profile; 169 apu_led->platform = APU1_LED_PLATFORM;
259 apu_led->platform = APU1_LED_PLATFORM; 170 apu_led->num_led_instances = ARRAY_SIZE(apu1_led_profile);
260 apu_led->num_led_instances = ARRAY_SIZE(apu1_led_profile); 171 apu_led->iosize = APU1_IOSIZE;
261 apu_led->iosize = APU1_IOSIZE;
262 } else if (dmi_match(DMI_BOARD_NAME, "APU2") ||
263 dmi_match(DMI_BOARD_NAME, "apu2") ||
264 dmi_match(DMI_BOARD_NAME, "PC Engines apu2")) {
265 apu_led->profile = apu2_led_profile;
266 apu_led->platform = APU2_LED_PLATFORM;
267 apu_led->num_led_instances = ARRAY_SIZE(apu2_led_profile);
268 apu_led->iosize = APU2_IOSIZE;
269 } else if (dmi_match(DMI_BOARD_NAME, "APU3") ||
270 dmi_match(DMI_BOARD_NAME, "apu3") ||
271 dmi_match(DMI_BOARD_NAME, "PC Engines apu3")) {
272 apu_led->profile = apu3_led_profile;
273 /* Otherwise identical to APU2. */
274 apu_led->platform = APU2_LED_PLATFORM;
275 apu_led->num_led_instances = ARRAY_SIZE(apu3_led_profile);
276 apu_led->iosize = APU2_IOSIZE;
277 }
278 172
279 spin_lock_init(&apu_led->lock); 173 spin_lock_init(&apu_led->lock);
280 return apu_led_config(&pdev->dev, apu_led); 174 return apu_led_config(&pdev->dev, apu_led);
@@ -295,13 +189,7 @@ static int __init apu_led_init(void)
295 pr_err("No PC Engines board detected\n"); 189 pr_err("No PC Engines board detected\n");
296 return -ENODEV; 190 return -ENODEV;
297 } 191 }
298 if (!(dmi_match(DMI_PRODUCT_NAME, "APU") || 192 if (!(dmi_match(DMI_PRODUCT_NAME, "APU"))) {
299 dmi_match(DMI_PRODUCT_NAME, "APU2") ||
300 dmi_match(DMI_PRODUCT_NAME, "apu2") ||
301 dmi_match(DMI_PRODUCT_NAME, "PC Engines apu2") ||
302 dmi_match(DMI_PRODUCT_NAME, "APU3") ||
303 dmi_match(DMI_PRODUCT_NAME, "apu3") ||
304 dmi_match(DMI_PRODUCT_NAME, "PC Engines apu3"))) {
305 pr_err("Unknown PC Engines board: %s\n", 193 pr_err("Unknown PC Engines board: %s\n",
306 dmi_get_system_info(DMI_PRODUCT_NAME)); 194 dmi_get_system_info(DMI_PRODUCT_NAME));
307 return -ENODEV; 195 return -ENODEV;
@@ -337,6 +225,6 @@ module_init(apu_led_init);
337module_exit(apu_led_exit); 225module_exit(apu_led_exit);
338 226
339MODULE_AUTHOR("Alan Mizrahi"); 227MODULE_AUTHOR("Alan Mizrahi");
340MODULE_DESCRIPTION("PC Engines APU family LED driver"); 228MODULE_DESCRIPTION("PC Engines APU1 front LED driver");
341MODULE_LICENSE("GPL v2"); 229MODULE_LICENSE("GPL v2");
342MODULE_ALIAS("platform:leds_apu"); 230MODULE_ALIAS("platform:leds_apu");