| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * extcon-sm5502.c - Silicon Mitus SM5502 extcon drvier to support USB switches |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2014 Samsung Electronics Co., Ltd |
|---|
| 5 | 6 | * 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. |
|---|
| 11 | 7 | */ |
|---|
| 12 | 8 | |
|---|
| 13 | 9 | #include <linux/err.h> |
|---|
| .. | .. |
|---|
| 252 | 248 | dev_err(info->dev, "Unknown DM_CON/DP_CON switch type (%d)\n", |
|---|
| 253 | 249 | con_sw); |
|---|
| 254 | 250 | return -EINVAL; |
|---|
| 255 | | - }; |
|---|
| 251 | + } |
|---|
| 256 | 252 | |
|---|
| 257 | 253 | switch (vbus_sw) { |
|---|
| 258 | 254 | case VBUSIN_SWITCH_OPEN: |
|---|
| .. | .. |
|---|
| 271 | 267 | default: |
|---|
| 272 | 268 | dev_err(info->dev, "Unknown VBUS switch type (%d)\n", vbus_sw); |
|---|
| 273 | 269 | return -EINVAL; |
|---|
| 274 | | - }; |
|---|
| 270 | + } |
|---|
| 275 | 271 | |
|---|
| 276 | 272 | return 0; |
|---|
| 277 | 273 | } |
|---|
| .. | .. |
|---|
| 279 | 275 | /* Return cable type of attached or detached accessories */ |
|---|
| 280 | 276 | static unsigned int sm5502_muic_get_cable_type(struct sm5502_muic_info *info) |
|---|
| 281 | 277 | { |
|---|
| 282 | | - unsigned int cable_type = -1, adc, dev_type1; |
|---|
| 278 | + unsigned int cable_type, adc, dev_type1; |
|---|
| 283 | 279 | int ret; |
|---|
| 284 | 280 | |
|---|
| 285 | 281 | /* Read ADC value according to external cable or button */ |
|---|
| .. | .. |
|---|
| 360 | 356 | "cannot identify the cable type: adc(0x%x)\n", |
|---|
| 361 | 357 | adc); |
|---|
| 362 | 358 | return -EINVAL; |
|---|
| 363 | | - }; |
|---|
| 359 | + } |
|---|
| 364 | 360 | break; |
|---|
| 365 | 361 | default: |
|---|
| 366 | 362 | dev_err(info->dev, |
|---|
| 367 | 363 | "failed to identify the cable type: adc(0x%x)\n", adc); |
|---|
| 368 | 364 | return -EINVAL; |
|---|
| 369 | | - }; |
|---|
| 365 | + } |
|---|
| 370 | 366 | |
|---|
| 371 | 367 | return cable_type; |
|---|
| 372 | 368 | } |
|---|
| .. | .. |
|---|
| 408 | 404 | dev_dbg(info->dev, |
|---|
| 409 | 405 | "cannot handle this cable_type (0x%x)\n", cable_type); |
|---|
| 410 | 406 | return 0; |
|---|
| 411 | | - }; |
|---|
| 407 | + } |
|---|
| 412 | 408 | |
|---|
| 413 | 409 | /* Change internal hardware path(DM_CON/DP_CON, VBUSIN) */ |
|---|
| 414 | 410 | ret = sm5502_muic_set_path(info, con_sw, vbus_sw, attached); |
|---|
| .. | .. |
|---|
| 604 | 600 | |
|---|
| 605 | 601 | ret = devm_request_threaded_irq(info->dev, virq, NULL, |
|---|
| 606 | 602 | sm5502_muic_irq_handler, |
|---|
| 607 | | - IRQF_NO_SUSPEND, |
|---|
| 603 | + IRQF_NO_SUSPEND | IRQF_ONESHOT, |
|---|
| 608 | 604 | muic_irq->name, info); |
|---|
| 609 | 605 | if (ret) { |
|---|
| 610 | 606 | dev_err(info->dev, |
|---|