Update extcon for 4.20
Detailed description for this pull request: 1. Add SPDX license identifiers for Maxim and Intel extcon drivers 2. Clean-up extcon-intel-cht-wc.c driver without operation changes 3. Fix build warning of extcon core and use kasprintf instead of snprintf -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJbsfEPAAoJEJzN3yze689TFrMQALUoPNsAA5ki97i2tz5MDGe6 HrEm+YnxhJILobhaLTUOLdojqLJA/WmSGcUPbvIWEJzGE3/BiXiM14g3r8o2HkdY wmq7UP7CHJFFkq4uNNpsfWdWCoilQl+60fPXS4nnNxFH3vOJAtfkLHO0Ge5v8XOp v0IaCBZpYM8iIZpGYooI/UnsXCblRWxhYCQHi+ahuvVfjsm30gyW+5fNz2bsYPrn TllTnrznI21OWB2fFJs3hReS4zipTlBNwZzAz0hJWjoEaZNAnsyjmSske553hVYe 7nyoZcSdXiJ6NDGDqFnOxe/TQ4lvxQVJXS9+7cjbK+Brf0E59TkZb2qhoNICCK6S xqaraQdZGX94ozO/4ckpSlR5PLTqR/jqSTjKIVHENc+E/rDb5+Xxrju/wrXZ7Y4y Cm3mNbvOS88EpI0GiScXBDKyELVh+sBeccfzrApfYbUrnLY3bJBN4c+D5sStFHiM 37L8DpMKlPkEIs2FPBNQcuYYkp/w6StQ0wqFvK2NONDC9OGzop7AxgGSMrj+vLun LOMlQGL/wDi5dNXw3tQTinDKihH6u0T8E+i9RtyWwlW/B1zVV4eEyM9qrYgnMDRF kPxU7mr8imyo1sSK1rBtN9baRZkZQ0W/rZaFLV2zpLwIkn33fQvqFumA0KsACUXl l6xHvLniI6slK9PIBDg9 =l7nU -----END PGP SIGNATURE----- Merge tag 'extcon-next-for-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-next Chanwoo writes: Update extcon for 4.20 Detailed description for this pull request: 1. Add SPDX license identifiers for Maxim and Intel extcon drivers 2. Clean-up extcon-intel-cht-wc.c driver without operation changes 3. Fix build warning of extcon core and use kasprintf instead of snprintf * tag 'extcon-next-for-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon: extcon: int3496: Convert to use SPDX identifier extcon: cht-wc: Convert to use SPDX identifier extcon: cht-wc: Correct USBID bit field handling extcon: cht-wc: Fix definition names according to spec extcon: cht-wc: Return from default case to avoid warnings extcon: Switch to use kasprintf() instead of open coded extcon: Make static analyzer happy about union assignment extcon: maxim: Add SPDX license identifiers
This commit is contained in:
commit
91c45a7a01
@ -1,18 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Extcon charger detection driver for Intel Cherrytrail Whiskey Cove PMIC
|
||||
* Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com>
|
||||
*
|
||||
* Based on various non upstream patches to support the CHT Whiskey Cove PMIC:
|
||||
* Copyright (C) 2013-2015 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*/
|
||||
|
||||
#include <linux/extcon-provider.h>
|
||||
@ -32,10 +24,10 @@
|
||||
#define CHT_WC_CHGRCTRL0_EMRGCHREN BIT(1)
|
||||
#define CHT_WC_CHGRCTRL0_EXTCHRDIS BIT(2)
|
||||
#define CHT_WC_CHGRCTRL0_SWCONTROL BIT(3)
|
||||
#define CHT_WC_CHGRCTRL0_TTLCK_MASK BIT(4)
|
||||
#define CHT_WC_CHGRCTRL0_CCSM_OFF_MASK BIT(5)
|
||||
#define CHT_WC_CHGRCTRL0_DBPOFF_MASK BIT(6)
|
||||
#define CHT_WC_CHGRCTRL0_WDT_NOKICK BIT(7)
|
||||
#define CHT_WC_CHGRCTRL0_TTLCK BIT(4)
|
||||
#define CHT_WC_CHGRCTRL0_CCSM_OFF BIT(5)
|
||||
#define CHT_WC_CHGRCTRL0_DBPOFF BIT(6)
|
||||
#define CHT_WC_CHGRCTRL0_CHR_WDT_NOKICK BIT(7)
|
||||
|
||||
#define CHT_WC_CHGRCTRL1 0x5e17
|
||||
|
||||
@ -52,7 +44,7 @@
|
||||
#define CHT_WC_USBSRC_TYPE_ACA 4
|
||||
#define CHT_WC_USBSRC_TYPE_SE1 5
|
||||
#define CHT_WC_USBSRC_TYPE_MHL 6
|
||||
#define CHT_WC_USBSRC_TYPE_FLOAT_DP_DN 7
|
||||
#define CHT_WC_USBSRC_TYPE_FLOATING 7
|
||||
#define CHT_WC_USBSRC_TYPE_OTHER 8
|
||||
#define CHT_WC_USBSRC_TYPE_DCP_EXTPHY 9
|
||||
|
||||
@ -61,9 +53,12 @@
|
||||
#define CHT_WC_PWRSRC_STS 0x6e1e
|
||||
#define CHT_WC_PWRSRC_VBUS BIT(0)
|
||||
#define CHT_WC_PWRSRC_DC BIT(1)
|
||||
#define CHT_WC_PWRSRC_BAT BIT(2)
|
||||
#define CHT_WC_PWRSRC_ID_GND BIT(3)
|
||||
#define CHT_WC_PWRSRC_ID_FLOAT BIT(4)
|
||||
#define CHT_WC_PWRSRC_BATT BIT(2)
|
||||
#define CHT_WC_PWRSRC_USBID_MASK GENMASK(4, 3)
|
||||
#define CHT_WC_PWRSRC_USBID_SHIFT 3
|
||||
#define CHT_WC_PWRSRC_RID_ACA 0
|
||||
#define CHT_WC_PWRSRC_RID_GND 1
|
||||
#define CHT_WC_PWRSRC_RID_FLOAT 2
|
||||
|
||||
#define CHT_WC_VBUS_GPIO_CTLO 0x6e2d
|
||||
#define CHT_WC_VBUS_GPIO_CTLO_OUTPUT BIT(0)
|
||||
@ -104,16 +99,20 @@ struct cht_wc_extcon_data {
|
||||
|
||||
static int cht_wc_extcon_get_id(struct cht_wc_extcon_data *ext, int pwrsrc_sts)
|
||||
{
|
||||
if (pwrsrc_sts & CHT_WC_PWRSRC_ID_GND)
|
||||
switch ((pwrsrc_sts & CHT_WC_PWRSRC_USBID_MASK) >> CHT_WC_PWRSRC_USBID_SHIFT) {
|
||||
case CHT_WC_PWRSRC_RID_GND:
|
||||
return USB_ID_GND;
|
||||
if (pwrsrc_sts & CHT_WC_PWRSRC_ID_FLOAT)
|
||||
case CHT_WC_PWRSRC_RID_FLOAT:
|
||||
return USB_ID_FLOAT;
|
||||
|
||||
/*
|
||||
* Once we have iio support for the gpadc we should read the USBID
|
||||
* gpadc channel here and determine ACA role based on that.
|
||||
*/
|
||||
return USB_ID_FLOAT;
|
||||
case CHT_WC_PWRSRC_RID_ACA:
|
||||
default:
|
||||
/*
|
||||
* Once we have IIO support for the GPADC we should read
|
||||
* the USBID GPADC channel here and determine ACA role
|
||||
* based on that.
|
||||
*/
|
||||
return USB_ID_FLOAT;
|
||||
}
|
||||
}
|
||||
|
||||
static int cht_wc_extcon_get_charger(struct cht_wc_extcon_data *ext,
|
||||
@ -156,9 +155,9 @@ static int cht_wc_extcon_get_charger(struct cht_wc_extcon_data *ext,
|
||||
dev_warn(ext->dev,
|
||||
"Unhandled charger type %d, defaulting to SDP\n",
|
||||
ret);
|
||||
/* Fall through, treat as SDP */
|
||||
return EXTCON_CHG_USB_SDP;
|
||||
case CHT_WC_USBSRC_TYPE_SDP:
|
||||
case CHT_WC_USBSRC_TYPE_FLOAT_DP_DN:
|
||||
case CHT_WC_USBSRC_TYPE_FLOATING:
|
||||
case CHT_WC_USBSRC_TYPE_OTHER:
|
||||
return EXTCON_CHG_USB_SDP;
|
||||
case CHT_WC_USBSRC_TYPE_CDP:
|
||||
@ -279,7 +278,7 @@ static int cht_wc_extcon_sw_control(struct cht_wc_extcon_data *ext, bool enable)
|
||||
{
|
||||
int ret, mask, val;
|
||||
|
||||
mask = CHT_WC_CHGRCTRL0_SWCONTROL | CHT_WC_CHGRCTRL0_CCSM_OFF_MASK;
|
||||
mask = CHT_WC_CHGRCTRL0_SWCONTROL | CHT_WC_CHGRCTRL0_CCSM_OFF;
|
||||
val = enable ? mask : 0;
|
||||
ret = regmap_update_bits(ext->regmap, CHT_WC_CHGRCTRL0, mask, val);
|
||||
if (ret)
|
||||
@ -292,6 +291,7 @@ static int cht_wc_extcon_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent);
|
||||
struct cht_wc_extcon_data *ext;
|
||||
unsigned long mask = ~(CHT_WC_PWRSRC_VBUS | CHT_WC_PWRSRC_USBID_MASK);
|
||||
int irq, ret;
|
||||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
@ -352,9 +352,7 @@ static int cht_wc_extcon_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
/* Unmask irqs */
|
||||
ret = regmap_write(ext->regmap, CHT_WC_PWRSRC_IRQ_MASK,
|
||||
(int)~(CHT_WC_PWRSRC_VBUS | CHT_WC_PWRSRC_ID_GND |
|
||||
CHT_WC_PWRSRC_ID_FLOAT));
|
||||
ret = regmap_write(ext->regmap, CHT_WC_PWRSRC_IRQ_MASK, mask);
|
||||
if (ret) {
|
||||
dev_err(ext->dev, "Error writing irq-mask: %d\n", ret);
|
||||
goto disable_sw_control;
|
||||
|
@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Intel INT3496 ACPI device extcon driver
|
||||
*
|
||||
@ -7,15 +8,6 @@
|
||||
*
|
||||
* Copyright (c) 2014, Intel Corporation.
|
||||
* Author: David Cohen <david.a.cohen@linux.intel.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/acpi.h>
|
||||
@ -192,4 +184,4 @@ module_platform_driver(int3496_driver);
|
||||
|
||||
MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
|
||||
MODULE_DESCRIPTION("Intel INT3496 ACPI device extcon driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
@ -1,20 +1,10 @@
|
||||
/*
|
||||
* extcon-max14577.c - MAX14577/77836 extcon driver to support MUIC
|
||||
*
|
||||
* Copyright (C) 2013,2014 Samsung Electronics
|
||||
* Chanwoo Choi <cw00.choi@samsung.com>
|
||||
* Krzysztof Kozlowski <krzk@kernel.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
//
|
||||
// extcon-max14577.c - MAX14577/77836 extcon driver to support MUIC
|
||||
//
|
||||
// Copyright (C) 2013,2014 Samsung Electronics
|
||||
// Chanwoo Choi <cw00.choi@samsung.com>
|
||||
// Krzysztof Kozlowski <krzk@kernel.org>
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
|
@ -1,19 +1,9 @@
|
||||
/*
|
||||
* extcon-max77693.c - MAX77693 extcon driver to support MAX77693 MUIC
|
||||
*
|
||||
* Copyright (C) 2012 Samsung Electrnoics
|
||||
* Chanwoo Choi <cw00.choi@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
//
|
||||
// extcon-max77693.c - MAX77693 extcon driver to support MAX77693 MUIC
|
||||
//
|
||||
// Copyright (C) 2012 Samsung Electrnoics
|
||||
// Chanwoo Choi <cw00.choi@samsung.com>
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
|
@ -1,15 +1,10 @@
|
||||
/*
|
||||
* extcon-max77843.c - Maxim MAX77843 extcon driver to support
|
||||
* MUIC(Micro USB Interface Controller)
|
||||
*
|
||||
* Copyright (C) 2015 Samsung Electronics
|
||||
* Author: Jaewon Kim <jaewon02.kim@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
//
|
||||
// extcon-max77843.c - Maxim MAX77843 extcon driver to support
|
||||
// MUIC(Micro USB Interface Controller)
|
||||
//
|
||||
// Copyright (C) 2015 Samsung Electronics
|
||||
// Author: Jaewon Kim <jaewon02.kim@samsung.com>
|
||||
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/i2c.h>
|
||||
|
@ -1,19 +1,9 @@
|
||||
/*
|
||||
* extcon-max8997.c - MAX8997 extcon driver to support MAX8997 MUIC
|
||||
*
|
||||
* Copyright (C) 2012 Samsung Electronics
|
||||
* Donggeun Kim <dg77.kim@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
//
|
||||
// extcon-max8997.c - MAX8997 extcon driver to support MAX8997 MUIC
|
||||
//
|
||||
// Copyright (C) 2012 Samsung Electronics
|
||||
// Donggeun Kim <dg77.kim@samsung.com>
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
|
@ -628,7 +628,7 @@ int extcon_get_property(struct extcon_dev *edev, unsigned int id,
|
||||
unsigned long flags;
|
||||
int index, ret = 0;
|
||||
|
||||
*prop_val = (union extcon_property_value)(0);
|
||||
*prop_val = (union extcon_property_value){0};
|
||||
|
||||
if (!edev)
|
||||
return -EINVAL;
|
||||
@ -1123,7 +1123,6 @@ int extcon_dev_register(struct extcon_dev *edev)
|
||||
(unsigned long)atomic_inc_return(&edev_no));
|
||||
|
||||
if (edev->max_supported) {
|
||||
char buf[10];
|
||||
char *str;
|
||||
struct extcon_cable *cable;
|
||||
|
||||
@ -1137,9 +1136,7 @@ int extcon_dev_register(struct extcon_dev *edev)
|
||||
for (index = 0; index < edev->max_supported; index++) {
|
||||
cable = &edev->cables[index];
|
||||
|
||||
snprintf(buf, 10, "cable.%d", index);
|
||||
str = kzalloc(strlen(buf) + 1,
|
||||
GFP_KERNEL);
|
||||
str = kasprintf(GFP_KERNEL, "cable.%d", index);
|
||||
if (!str) {
|
||||
for (index--; index >= 0; index--) {
|
||||
cable = &edev->cables[index];
|
||||
@ -1149,7 +1146,6 @@ int extcon_dev_register(struct extcon_dev *edev)
|
||||
|
||||
goto err_alloc_cables;
|
||||
}
|
||||
strcpy(str, buf);
|
||||
|
||||
cable->edev = edev;
|
||||
cable->cable_index = index;
|
||||
@ -1172,7 +1168,6 @@ int extcon_dev_register(struct extcon_dev *edev)
|
||||
}
|
||||
|
||||
if (edev->max_supported && edev->mutually_exclusive) {
|
||||
char buf[80];
|
||||
char *name;
|
||||
|
||||
/* Count the size of mutually_exclusive array */
|
||||
@ -1197,9 +1192,8 @@ int extcon_dev_register(struct extcon_dev *edev)
|
||||
}
|
||||
|
||||
for (index = 0; edev->mutually_exclusive[index]; index++) {
|
||||
sprintf(buf, "0x%x", edev->mutually_exclusive[index]);
|
||||
name = kzalloc(strlen(buf) + 1,
|
||||
GFP_KERNEL);
|
||||
name = kasprintf(GFP_KERNEL, "0x%x",
|
||||
edev->mutually_exclusive[index]);
|
||||
if (!name) {
|
||||
for (index--; index >= 0; index--) {
|
||||
kfree(edev->d_attrs_muex[index].attr.
|
||||
@ -1210,7 +1204,6 @@ int extcon_dev_register(struct extcon_dev *edev)
|
||||
ret = -ENOMEM;
|
||||
goto err_muex;
|
||||
}
|
||||
strcpy(name, buf);
|
||||
sysfs_attr_init(&edev->d_attrs_muex[index].attr);
|
||||
edev->d_attrs_muex[index].attr.name = name;
|
||||
edev->d_attrs_muex[index].attr.mode = 0000;
|
||||
|
Loading…
Reference in New Issue
Block a user