hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/extcon/extcon-sm5502.c
....@@ -1,13 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * extcon-sm5502.c - Silicon Mitus SM5502 extcon drvier to support USB switches
34 *
45 * Copyright (c) 2014 Samsung Electronics Co., Ltd
56 * Author: Chanwoo Choi <cw00.choi@samsung.com>
6
- *
7
- * This program is free software; you can redistribute it and/or modify it
8
- * under the terms of the GNU General Public License as published by the
9
- * Free Software Foundation; either version 2 of the License, or (at your
10
- * option) any later version.
117 */
128
139 #include <linux/err.h>
....@@ -252,7 +248,7 @@
252248 dev_err(info->dev, "Unknown DM_CON/DP_CON switch type (%d)\n",
253249 con_sw);
254250 return -EINVAL;
255
- };
251
+ }
256252
257253 switch (vbus_sw) {
258254 case VBUSIN_SWITCH_OPEN:
....@@ -271,7 +267,7 @@
271267 default:
272268 dev_err(info->dev, "Unknown VBUS switch type (%d)\n", vbus_sw);
273269 return -EINVAL;
274
- };
270
+ }
275271
276272 return 0;
277273 }
....@@ -279,7 +275,7 @@
279275 /* Return cable type of attached or detached accessories */
280276 static unsigned int sm5502_muic_get_cable_type(struct sm5502_muic_info *info)
281277 {
282
- unsigned int cable_type = -1, adc, dev_type1;
278
+ unsigned int cable_type, adc, dev_type1;
283279 int ret;
284280
285281 /* Read ADC value according to external cable or button */
....@@ -360,13 +356,13 @@
360356 "cannot identify the cable type: adc(0x%x)\n",
361357 adc);
362358 return -EINVAL;
363
- };
359
+ }
364360 break;
365361 default:
366362 dev_err(info->dev,
367363 "failed to identify the cable type: adc(0x%x)\n", adc);
368364 return -EINVAL;
369
- };
365
+ }
370366
371367 return cable_type;
372368 }
....@@ -408,7 +404,7 @@
408404 dev_dbg(info->dev,
409405 "cannot handle this cable_type (0x%x)\n", cable_type);
410406 return 0;
411
- };
407
+ }
412408
413409 /* Change internal hardware path(DM_CON/DP_CON, VBUSIN) */
414410 ret = sm5502_muic_set_path(info, con_sw, vbus_sw, attached);
....@@ -604,7 +600,7 @@
604600
605601 ret = devm_request_threaded_irq(info->dev, virq, NULL,
606602 sm5502_muic_irq_handler,
607
- IRQF_NO_SUSPEND,
603
+ IRQF_NO_SUSPEND | IRQF_ONESHOT,
608604 muic_irq->name, info);
609605 if (ret) {
610606 dev_err(info->dev,