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

Merge tag 'extcon-next-for-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into usb-next

Chanwoo writes:

Update extcon for 4.15

Detailed description for this pull request:
1. Split out extcon header file for consumer and provider device
: The extcon has two type of extcon devices as following.
- 'extcon provider deivce' adds new extcon device and detect
the state/properties of external connector. Also, it notifies the
state/properties to the extcon consumer device.
- 'extcon consumer device' gets the change state/properties
from extcon provider device.

Prior to that, include/linux/extcon.h contains all exported API
for both provider and consumer device driver. To clarify the meaning
of header file and to remove the wrong use-case on consumer device.
- include/linux/extcon-provider.h includes API for the provider device driver.
- include/linux/extcon.h includes the API for the consumer device driver.

2. Support the SmartDock accessory on extcon-max77843.c device driver
- Support the SmartDock accessory which detects following connectors
at the same time.
: USB host throught USB hub for mouse, keyboard and so on.
: MHL connector for video output.
: Charger connector for battery charging.
- It tested with Unitek Y-2165 MHL+OTG Hub Smart Phone Dock.

3. Fix the minor issue of extcon driver
- Delete the unneeded initialization in extcon-max14577.
- Make extcon_info static const in order to fix the warning.

+258 -145
+1 -1
drivers/extcon/extcon-adc-jack.c
··· 26 26 #include <linux/workqueue.h> 27 27 #include <linux/iio/consumer.h> 28 28 #include <linux/extcon/extcon-adc-jack.h> 29 - #include <linux/extcon.h> 29 + #include <linux/extcon-provider.h> 30 30 31 31 /** 32 32 * struct adc_jack_data - internal data for adc_jack device driver
+1 -1
drivers/extcon/extcon-arizona.c
··· 27 27 #include <linux/pm_runtime.h> 28 28 #include <linux/property.h> 29 29 #include <linux/regulator/consumer.h> 30 - #include <linux/extcon.h> 30 + #include <linux/extcon-provider.h> 31 31 32 32 #include <sound/soc.h> 33 33
+1 -1
drivers/extcon/extcon-axp288.c
··· 22 22 #include <linux/platform_device.h> 23 23 #include <linux/property.h> 24 24 #include <linux/notifier.h> 25 - #include <linux/extcon.h> 25 + #include <linux/extcon-provider.h> 26 26 #include <linux/regmap.h> 27 27 #include <linux/gpio.h> 28 28 #include <linux/gpio/consumer.h>
+1 -1
drivers/extcon/extcon-gpio.c
··· 17 17 * GNU General Public License for more details. 18 18 */ 19 19 20 - #include <linux/extcon.h> 20 + #include <linux/extcon-provider.h> 21 21 #include <linux/extcon/extcon-gpio.h> 22 22 #include <linux/gpio.h> 23 23 #include <linux/gpio/consumer.h>
+1 -1
drivers/extcon/extcon-intel-cht-wc.c
··· 15 15 * more details. 16 16 */ 17 17 18 - #include <linux/extcon.h> 18 + #include <linux/extcon-provider.h> 19 19 #include <linux/interrupt.h> 20 20 #include <linux/kernel.h> 21 21 #include <linux/mfd/intel_soc_pmic.h>
+1 -1
drivers/extcon/extcon-intel-int3496.c
··· 19 19 */ 20 20 21 21 #include <linux/acpi.h> 22 - #include <linux/extcon.h> 22 + #include <linux/extcon-provider.h> 23 23 #include <linux/gpio.h> 24 24 #include <linux/interrupt.h> 25 25 #include <linux/module.h>
+2 -2
drivers/extcon/extcon-max14577.c
··· 23 23 #include <linux/platform_device.h> 24 24 #include <linux/mfd/max14577.h> 25 25 #include <linux/mfd/max14577-private.h> 26 - #include <linux/extcon.h> 26 + #include <linux/extcon-provider.h> 27 27 28 28 #define DELAY_MS_DEFAULT 17000 /* unit: millisecond */ 29 29 ··· 204 204 static int max14577_muic_set_path(struct max14577_muic_info *info, 205 205 u8 val, bool attached) 206 206 { 207 - int ret = 0; 208 207 u8 ctrl1, ctrl2 = 0; 208 + int ret; 209 209 210 210 /* Set open state to path before changing hw path */ 211 211 ret = max14577_update_reg(info->max14577->regmap,
+1 -1
drivers/extcon/extcon-max3355.c
··· 9 9 * may be copied, distributed, and modified under those terms. 10 10 */ 11 11 12 - #include <linux/extcon.h> 12 + #include <linux/extcon-provider.h> 13 13 #include <linux/gpio.h> 14 14 #include <linux/gpio/consumer.h> 15 15 #include <linux/interrupt.h>
+1 -1
drivers/extcon/extcon-max77693.c
··· 26 26 #include <linux/mfd/max77693.h> 27 27 #include <linux/mfd/max77693-common.h> 28 28 #include <linux/mfd/max77693-private.h> 29 - #include <linux/extcon.h> 29 + #include <linux/extcon-provider.h> 30 30 #include <linux/regmap.h> 31 31 #include <linux/irqdomain.h> 32 32
+80 -15
drivers/extcon/extcon-max77843.c
··· 11 11 * (at your option) any later version. 12 12 */ 13 13 14 - #include <linux/extcon.h> 14 + #include <linux/extcon-provider.h> 15 15 #include <linux/i2c.h> 16 16 #include <linux/interrupt.h> 17 17 #include <linux/kernel.h> ··· 80 80 MAX77843_MUIC_ADC_REMOTE_S12_BUTTON, 81 81 MAX77843_MUIC_ADC_RESERVED_ACC_1, 82 82 MAX77843_MUIC_ADC_RESERVED_ACC_2, 83 - MAX77843_MUIC_ADC_RESERVED_ACC_3, 83 + MAX77843_MUIC_ADC_RESERVED_ACC_3, /* SmartDock */ 84 84 MAX77843_MUIC_ADC_RESERVED_ACC_4, 85 85 MAX77843_MUIC_ADC_RESERVED_ACC_5, 86 86 MAX77843_MUIC_ADC_AUDIO_DEVICE_TYPE2, ··· 119 119 MAX77843_MUIC_CHG_SPECIAL_BIAS, 120 120 MAX77843_MUIC_CHG_RESERVED, 121 121 MAX77843_MUIC_CHG_GND, 122 + MAX77843_MUIC_CHG_DOCK, 122 123 }; 123 124 124 125 static const unsigned int max77843_extcon_cable[] = { ··· 131 130 EXTCON_CHG_USB_FAST, 132 131 EXTCON_CHG_USB_SLOW, 133 132 EXTCON_DISP_MHL, 133 + EXTCON_DOCK, 134 134 EXTCON_JIG, 135 135 EXTCON_NONE, 136 136 }; ··· 202 200 }; 203 201 204 202 static int max77843_muic_set_path(struct max77843_muic_info *info, 205 - u8 val, bool attached) 203 + u8 val, bool attached, bool nobccomp) 206 204 { 207 205 struct max77693_dev *max77843 = info->max77843; 208 206 int ret = 0; ··· 212 210 ctrl1 = val; 213 211 else 214 212 ctrl1 = MAX77843_MUIC_CONTROL1_SW_OPEN; 213 + if (nobccomp) { 214 + /* Disable BC1.2 protocol and force manual switch control */ 215 + ctrl1 |= MAX77843_MUIC_CONTROL1_NOBCCOMP_MASK; 216 + } 215 217 216 218 ret = regmap_update_bits(max77843->regmap_muic, 217 219 MAX77843_MUIC_REG_CONTROL1, 218 - MAX77843_MUIC_CONTROL1_COM_SW, ctrl1); 220 + MAX77843_MUIC_CONTROL1_COM_SW | 221 + MAX77843_MUIC_CONTROL1_NOBCCOMP_MASK, 222 + ctrl1); 219 223 if (ret < 0) { 220 224 dev_err(info->dev, "Cannot switch MUIC port\n"); 221 225 return ret; ··· 246 238 ctrl1, ctrl2, attached ? "attached" : "detached"); 247 239 248 240 return 0; 241 + } 242 + 243 + static void max77843_charger_set_otg_vbus(struct max77843_muic_info *info, 244 + bool on) 245 + { 246 + struct max77693_dev *max77843 = info->max77843; 247 + unsigned int cnfg00; 248 + 249 + if (on) 250 + cnfg00 = MAX77843_CHG_OTG_MASK | MAX77843_CHG_BOOST_MASK; 251 + else 252 + cnfg00 = MAX77843_CHG_ENABLE | MAX77843_CHG_BUCK_MASK; 253 + 254 + regmap_update_bits(max77843->regmap_chg, MAX77843_CHG_REG_CHG_CNFG_00, 255 + MAX77843_CHG_MODE_MASK, cnfg00); 249 256 } 250 257 251 258 static int max77843_muic_get_cable_type(struct max77843_muic_info *info, ··· 307 284 *attached = true; 308 285 cable_type = MAX77843_MUIC_CHG_GND; 309 286 info->prev_chg_type = MAX77843_MUIC_CHG_GND; 287 + } 288 + break; 289 + } 290 + 291 + if (adc == MAX77843_MUIC_ADC_RESERVED_ACC_3) { /* SmartDock */ 292 + if (chg_type == MAX77843_MUIC_CHG_NONE) { 293 + *attached = false; 294 + cable_type = info->prev_chg_type; 295 + info->prev_chg_type = MAX77843_MUIC_CHG_NONE; 296 + } else { 297 + *attached = true; 298 + cable_type = MAX77843_MUIC_CHG_DOCK; 299 + info->prev_chg_type = MAX77843_MUIC_CHG_DOCK; 310 300 } 311 301 break; 312 302 } ··· 386 350 case MAX77843_MUIC_GND_USB_HOST_VB: 387 351 ret = max77843_muic_set_path(info, 388 352 MAX77843_MUIC_CONTROL1_SW_USB, 389 - attached); 353 + attached, false); 390 354 if (ret < 0) 391 355 return ret; 392 356 393 357 extcon_set_state_sync(info->edev, EXTCON_USB_HOST, attached); 358 + max77843_charger_set_otg_vbus(info, attached); 394 359 break; 395 360 case MAX77843_MUIC_GND_MHL_VB: 396 361 case MAX77843_MUIC_GND_MHL: 397 362 ret = max77843_muic_set_path(info, 398 363 MAX77843_MUIC_CONTROL1_SW_OPEN, 399 - attached); 364 + attached, false); 400 365 if (ret < 0) 401 366 return ret; 402 367 ··· 433 396 return -EINVAL; 434 397 } 435 398 436 - ret = max77843_muic_set_path(info, path, attached); 399 + ret = max77843_muic_set_path(info, path, attached, false); 437 400 if (ret < 0) 438 401 return ret; 439 402 440 403 extcon_set_state_sync(info->edev, EXTCON_JIG, attached); 404 + 405 + return 0; 406 + } 407 + 408 + static int max77843_muic_dock_handler(struct max77843_muic_info *info, 409 + bool attached) 410 + { 411 + int ret; 412 + 413 + dev_dbg(info->dev, "external connector is %s (adc: 0x10)\n", 414 + attached ? "attached" : "detached"); 415 + 416 + ret = max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_USB, 417 + attached, attached); 418 + if (ret < 0) 419 + return ret; 420 + 421 + extcon_set_state_sync(info->edev, EXTCON_DISP_MHL, attached); 422 + extcon_set_state_sync(info->edev, EXTCON_USB_HOST, attached); 423 + extcon_set_state_sync(info->edev, EXTCON_DOCK, attached); 441 424 442 425 return 0; 443 426 } ··· 476 419 info->prev_cable_type); 477 420 478 421 switch (cable_type) { 422 + case MAX77843_MUIC_ADC_RESERVED_ACC_3: /* SmartDock */ 423 + ret = max77843_muic_dock_handler(info, attached); 424 + if (ret < 0) 425 + return ret; 426 + break; 479 427 case MAX77843_MUIC_ADC_GROUND: 480 428 ret = max77843_muic_adc_gnd_handler(info); 481 429 if (ret < 0) ··· 508 446 case MAX77843_MUIC_ADC_REMOTE_S12_BUTTON: 509 447 case MAX77843_MUIC_ADC_RESERVED_ACC_1: 510 448 case MAX77843_MUIC_ADC_RESERVED_ACC_2: 511 - case MAX77843_MUIC_ADC_RESERVED_ACC_3: 512 449 case MAX77843_MUIC_ADC_RESERVED_ACC_4: 513 450 case MAX77843_MUIC_ADC_RESERVED_ACC_5: 514 451 case MAX77843_MUIC_ADC_AUDIO_DEVICE_TYPE2: ··· 551 490 case MAX77843_MUIC_CHG_USB: 552 491 ret = max77843_muic_set_path(info, 553 492 MAX77843_MUIC_CONTROL1_SW_USB, 554 - attached); 493 + attached, false); 555 494 if (ret < 0) 556 495 return ret; 557 496 ··· 562 501 case MAX77843_MUIC_CHG_DOWNSTREAM: 563 502 ret = max77843_muic_set_path(info, 564 503 MAX77843_MUIC_CONTROL1_SW_OPEN, 565 - attached); 504 + attached, false); 566 505 if (ret < 0) 567 506 return ret; 568 507 ··· 572 511 case MAX77843_MUIC_CHG_DEDICATED: 573 512 ret = max77843_muic_set_path(info, 574 513 MAX77843_MUIC_CONTROL1_SW_OPEN, 575 - attached); 514 + attached, false); 576 515 if (ret < 0) 577 516 return ret; 578 517 ··· 582 521 case MAX77843_MUIC_CHG_SPECIAL_500MA: 583 522 ret = max77843_muic_set_path(info, 584 523 MAX77843_MUIC_CONTROL1_SW_OPEN, 585 - attached); 524 + attached, false); 586 525 if (ret < 0) 587 526 return ret; 588 527 ··· 592 531 case MAX77843_MUIC_CHG_SPECIAL_1A: 593 532 ret = max77843_muic_set_path(info, 594 533 MAX77843_MUIC_CONTROL1_SW_OPEN, 595 - attached); 534 + attached, false); 596 535 if (ret < 0) 597 536 return ret; 598 537 ··· 611 550 extcon_set_state_sync(info->edev, EXTCON_CHG_USB_DCP, 612 551 false); 613 552 break; 553 + case MAX77843_MUIC_CHG_DOCK: 554 + extcon_set_state_sync(info->edev, EXTCON_CHG_USB_DCP, attached); 555 + break; 614 556 case MAX77843_MUIC_CHG_NONE: 615 557 break; 616 558 default: ··· 622 558 attached ? "attached" : "detached", chg_type); 623 559 624 560 max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_OPEN, 625 - attached); 561 + attached, false); 626 562 return -EINVAL; 627 563 } 628 564 ··· 862 798 max77843_muic_set_debounce_time(info, MAX77843_DEBOUNCE_TIME_25MS); 863 799 864 800 /* Set initial path for UART */ 865 - max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_UART, true); 801 + max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_UART, true, 802 + false); 866 803 867 804 /* Check revision number of MUIC device */ 868 805 ret = regmap_read(max77843->regmap_muic, MAX77843_MUIC_REG_ID, &id);
+1 -1
drivers/extcon/extcon-max8997.c
··· 25 25 #include <linux/kobject.h> 26 26 #include <linux/mfd/max8997.h> 27 27 #include <linux/mfd/max8997-private.h> 28 - #include <linux/extcon.h> 28 + #include <linux/extcon-provider.h> 29 29 #include <linux/irqdomain.h> 30 30 31 31 #define DEV_NAME "max8997-muic"
+1 -1
drivers/extcon/extcon-qcom-spmi-misc.c
··· 15 15 * GNU General Public License for more details. 16 16 */ 17 17 18 - #include <linux/extcon.h> 18 + #include <linux/extcon-provider.h> 19 19 #include <linux/init.h> 20 20 #include <linux/interrupt.h> 21 21 #include <linux/kernel.h>
+1 -1
drivers/extcon/extcon-rt8973a.c
··· 20 20 #include <linux/platform_device.h> 21 21 #include <linux/regmap.h> 22 22 #include <linux/slab.h> 23 - #include <linux/extcon.h> 23 + #include <linux/extcon-provider.h> 24 24 25 25 #include "extcon-rt8973a.h" 26 26
+1 -1
drivers/extcon/extcon-sm5502.c
··· 19 19 #include <linux/platform_device.h> 20 20 #include <linux/regmap.h> 21 21 #include <linux/slab.h> 22 - #include <linux/extcon.h> 22 + #include <linux/extcon-provider.h> 23 23 24 24 #include "extcon-sm5502.h" 25 25
+1 -1
drivers/extcon/extcon-usb-gpio.c
··· 14 14 * GNU General Public License for more details. 15 15 */ 16 16 17 - #include <linux/extcon.h> 17 + #include <linux/extcon-provider.h> 18 18 #include <linux/gpio.h> 19 19 #include <linux/gpio/consumer.h> 20 20 #include <linux/init.h>
+1 -1
drivers/extcon/extcon-usbc-cros-ec.c
··· 14 14 * GNU General Public License for more details. 15 15 */ 16 16 17 - #include <linux/extcon.h> 17 + #include <linux/extcon-provider.h> 18 18 #include <linux/kernel.h> 19 19 #include <linux/mfd/cros_ec.h> 20 20 #include <linux/module.h>
+1 -1
drivers/extcon/extcon.c
··· 36 36 37 37 #define SUPPORTED_CABLE_MAX 32 38 38 39 - struct __extcon_info { 39 + static const struct __extcon_info { 40 40 unsigned int type; 41 41 unsigned int id; 42 42 const char *name;
+1 -1
drivers/extcon/extcon.h
··· 1 1 #ifndef __LINUX_EXTCON_INTERNAL_H__ 2 2 #define __LINUX_EXTCON_INTERNAL_H__ 3 3 4 - #include <linux/extcon.h> 4 + #include <linux/extcon-provider.h> 5 5 6 6 /** 7 7 * struct extcon_dev - An extcon device represents one external connector.
+1 -1
drivers/phy/allwinner/phy-sun4i-usb.c
··· 24 24 #include <linux/clk.h> 25 25 #include <linux/delay.h> 26 26 #include <linux/err.h> 27 - #include <linux/extcon.h> 27 + #include <linux/extcon-provider.h> 28 28 #include <linux/io.h> 29 29 #include <linux/interrupt.h> 30 30 #include <linux/kernel.h>
+1 -1
drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
··· 12 12 */ 13 13 14 14 #include <linux/delay.h> 15 - #include <linux/extcon.h> 15 + #include <linux/extcon-provider.h> 16 16 #include <linux/gpio.h> 17 17 #include <linux/gpio/consumer.h> 18 18 #include <linux/init.h>
+1 -1
drivers/phy/renesas/phy-rcar-gen3-usb2.c
··· 12 12 * published by the Free Software Foundation. 13 13 */ 14 14 15 - #include <linux/extcon.h> 15 + #include <linux/extcon-provider.h> 16 16 #include <linux/interrupt.h> 17 17 #include <linux/io.h> 18 18 #include <linux/module.h>
+1 -1
drivers/phy/rockchip/phy-rockchip-inno-usb2.c
··· 17 17 #include <linux/clk.h> 18 18 #include <linux/clk-provider.h> 19 19 #include <linux/delay.h> 20 - #include <linux/extcon.h> 20 + #include <linux/extcon-provider.h> 21 21 #include <linux/interrupt.h> 22 22 #include <linux/io.h> 23 23 #include <linux/gpio/consumer.h>
+1 -1
drivers/power/supply/qcom_smbb.c
··· 34 34 #include <linux/power_supply.h> 35 35 #include <linux/regmap.h> 36 36 #include <linux/slab.h> 37 - #include <linux/extcon.h> 37 + #include <linux/extcon-provider.h> 38 38 #include <linux/regulator/driver.h> 39 39 40 40 #define SMBB_CHG_VMAX 0x040
+1 -1
drivers/usb/gadget/udc/renesas_usb3.c
··· 12 12 #include <linux/delay.h> 13 13 #include <linux/dma-mapping.h> 14 14 #include <linux/err.h> 15 - #include <linux/extcon.h> 15 + #include <linux/extcon-provider.h> 16 16 #include <linux/interrupt.h> 17 17 #include <linux/io.h> 18 18 #include <linux/module.h>
+1 -1
drivers/usb/phy/phy-tahvo.c
··· 23 23 #include <linux/io.h> 24 24 #include <linux/clk.h> 25 25 #include <linux/usb.h> 26 - #include <linux/extcon.h> 26 + #include <linux/extcon-provider.h> 27 27 #include <linux/kernel.h> 28 28 #include <linux/module.h> 29 29 #include <linux/usb/otg.h>
+142
include/linux/extcon-provider.h
··· 1 + /* 2 + * External Connector (extcon) framework 3 + * - linux/include/linux/extcon-provider.h for extcon provider device driver. 4 + * 5 + * Copyright (C) 2017 Samsung Electronics 6 + * Author: Chanwoo Choi <cw00.choi@samsung.com> 7 + * 8 + * This software is licensed under the terms of the GNU General Public 9 + * License version 2, as published by the Free Software Foundation, and 10 + * may be copied, distributed, and modified under those terms. 11 + * 12 + * This program is distributed in the hope that it will be useful, 13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + * GNU General Public License for more details. 16 + */ 17 + 18 + #ifndef __LINUX_EXTCON_PROVIDER_H__ 19 + #define __LINUX_EXTCON_PROVIDER_H__ 20 + 21 + #include <linux/extcon.h> 22 + 23 + struct extcon_dev; 24 + 25 + #if IS_ENABLED(CONFIG_EXTCON) 26 + 27 + /* Following APIs register/unregister the extcon device. */ 28 + extern int extcon_dev_register(struct extcon_dev *edev); 29 + extern void extcon_dev_unregister(struct extcon_dev *edev); 30 + extern int devm_extcon_dev_register(struct device *dev, 31 + struct extcon_dev *edev); 32 + extern void devm_extcon_dev_unregister(struct device *dev, 33 + struct extcon_dev *edev); 34 + 35 + /* Following APIs allocate/free the memory of the extcon device. */ 36 + extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable); 37 + extern void extcon_dev_free(struct extcon_dev *edev); 38 + extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, 39 + const unsigned int *cable); 40 + extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev); 41 + 42 + /* Synchronize the state and property value for each external connector. */ 43 + extern int extcon_sync(struct extcon_dev *edev, unsigned int id); 44 + 45 + /* 46 + * Following APIs set the connected state of each external connector. 47 + * The 'id' argument indicates the defined external connector. 48 + */ 49 + extern int extcon_set_state(struct extcon_dev *edev, unsigned int id, 50 + bool state); 51 + extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, 52 + bool state); 53 + 54 + /* 55 + * Following APIs set the property of each external connector. 56 + * The 'id' argument indicates the defined external connector 57 + * and the 'prop' indicates the extcon property. 58 + * 59 + * And extcon_set_property_capability() set the capability of the property 60 + * for each external connector. They are used to set the capability of the 61 + * property of each external connector based on the id and property. 62 + */ 63 + extern int extcon_set_property(struct extcon_dev *edev, unsigned int id, 64 + unsigned int prop, 65 + union extcon_property_value prop_val); 66 + extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id, 67 + unsigned int prop, 68 + union extcon_property_value prop_val); 69 + extern int extcon_set_property_capability(struct extcon_dev *edev, 70 + unsigned int id, unsigned int prop); 71 + 72 + #else /* CONFIG_EXTCON */ 73 + static inline int extcon_dev_register(struct extcon_dev *edev) 74 + { 75 + return 0; 76 + } 77 + 78 + static inline void extcon_dev_unregister(struct extcon_dev *edev) { } 79 + 80 + static inline int devm_extcon_dev_register(struct device *dev, 81 + struct extcon_dev *edev) 82 + { 83 + return -EINVAL; 84 + } 85 + 86 + static inline void devm_extcon_dev_unregister(struct device *dev, 87 + struct extcon_dev *edev) { } 88 + 89 + static inline struct extcon_dev *extcon_dev_allocate(const unsigned int *cable) 90 + { 91 + return ERR_PTR(-ENOSYS); 92 + } 93 + 94 + static inline void extcon_dev_free(struct extcon_dev *edev) { } 95 + 96 + static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, 97 + const unsigned int *cable) 98 + { 99 + return ERR_PTR(-ENOSYS); 100 + } 101 + 102 + static inline void devm_extcon_dev_free(struct extcon_dev *edev) { } 103 + 104 + 105 + static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id, 106 + bool state) 107 + { 108 + return 0; 109 + } 110 + 111 + static inline int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, 112 + bool state) 113 + { 114 + return 0; 115 + } 116 + 117 + static inline int extcon_sync(struct extcon_dev *edev, unsigned int id) 118 + { 119 + return 0; 120 + } 121 + 122 + static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id, 123 + unsigned int prop, 124 + union extcon_property_value prop_val) 125 + { 126 + return 0; 127 + } 128 + 129 + static inline int extcon_set_property_sync(struct extcon_dev *edev, 130 + unsigned int id, unsigned int prop, 131 + union extcon_property_value prop_val) 132 + { 133 + return 0; 134 + } 135 + 136 + static inline int extcon_set_property_capability(struct extcon_dev *edev, 137 + unsigned int id, unsigned int prop) 138 + { 139 + return 0; 140 + } 141 + #endif /* CONFIG_EXTCON */ 142 + #endif /* __LINUX_EXTCON_PROVIDER_H__ */
+5 -104
include/linux/extcon.h
··· 1 1 /* 2 2 * External Connector (extcon) framework 3 + * - linux/include/linux/extcon.h for extcon consumer device driver. 3 4 * 4 5 * Copyright (C) 2015 Samsung Electronics 5 6 * Author: Chanwoo Choi <cw00.choi@samsung.com> ··· 171 170 int intval; /* type : integer (intval) */ 172 171 }; 173 172 174 - struct extcon_cable; 175 173 struct extcon_dev; 176 174 177 175 #if IS_ENABLED(CONFIG_EXTCON) 178 - 179 - /* Following APIs register/unregister the extcon device. */ 180 - extern int extcon_dev_register(struct extcon_dev *edev); 181 - extern void extcon_dev_unregister(struct extcon_dev *edev); 182 - extern int devm_extcon_dev_register(struct device *dev, 183 - struct extcon_dev *edev); 184 - extern void devm_extcon_dev_unregister(struct device *dev, 185 - struct extcon_dev *edev); 186 - 187 - /* Following APIs allocate/free the memory of the extcon device. */ 188 - extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable); 189 - extern void extcon_dev_free(struct extcon_dev *edev); 190 - extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, 191 - const unsigned int *cable); 192 - extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev); 193 - 194 - /* Synchronize the state and property value for each external connector. */ 195 - extern int extcon_sync(struct extcon_dev *edev, unsigned int id); 196 - 197 176 /* 198 - * Following APIs get/set the connected state of each external connector. 177 + * Following APIs get the connected state of each external connector. 199 178 * The 'id' argument indicates the defined external connector. 200 179 */ 201 180 extern int extcon_get_state(struct extcon_dev *edev, unsigned int id); 202 - extern int extcon_set_state(struct extcon_dev *edev, unsigned int id, 203 - bool state); 204 - extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, 205 - bool state); 206 181 207 182 /* 208 - * Following APIs get/set the property of each external connector. 183 + * Following APIs get the property of each external connector. 209 184 * The 'id' argument indicates the defined external connector 210 185 * and the 'prop' indicates the extcon property. 211 186 * 212 - * And extcon_get/set_property_capability() set the capability of the property 213 - * for each external connector. They are used to set the capability of the 187 + * And extcon_get_property_capability() get the capability of the property 188 + * for each external connector. They are used to get the capability of the 214 189 * property of each external connector based on the id and property. 215 190 */ 216 191 extern int extcon_get_property(struct extcon_dev *edev, unsigned int id, 217 192 unsigned int prop, 218 193 union extcon_property_value *prop_val); 219 - extern int extcon_set_property(struct extcon_dev *edev, unsigned int id, 220 - unsigned int prop, 221 - union extcon_property_value prop_val); 222 - extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id, 223 - unsigned int prop, 224 - union extcon_property_value prop_val); 225 194 extern int extcon_get_property_capability(struct extcon_dev *edev, 226 - unsigned int id, unsigned int prop); 227 - extern int extcon_set_property_capability(struct extcon_dev *edev, 228 195 unsigned int id, unsigned int prop); 229 196 230 197 /* ··· 237 268 extern const char *extcon_get_edev_name(struct extcon_dev *edev); 238 269 239 270 #else /* CONFIG_EXTCON */ 240 - static inline int extcon_dev_register(struct extcon_dev *edev) 241 - { 242 - return 0; 243 - } 244 - 245 - static inline void extcon_dev_unregister(struct extcon_dev *edev) { } 246 - 247 - static inline int devm_extcon_dev_register(struct device *dev, 248 - struct extcon_dev *edev) 249 - { 250 - return -EINVAL; 251 - } 252 - 253 - static inline void devm_extcon_dev_unregister(struct device *dev, 254 - struct extcon_dev *edev) { } 255 - 256 - static inline struct extcon_dev *extcon_dev_allocate(const unsigned int *cable) 257 - { 258 - return ERR_PTR(-ENOSYS); 259 - } 260 - 261 - static inline void extcon_dev_free(struct extcon_dev *edev) { } 262 - 263 - static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, 264 - const unsigned int *cable) 265 - { 266 - return ERR_PTR(-ENOSYS); 267 - } 268 - 269 - static inline void devm_extcon_dev_free(struct extcon_dev *edev) { } 270 - 271 - 272 271 static inline int extcon_get_state(struct extcon_dev *edev, unsigned int id) 273 - { 274 - return 0; 275 - } 276 - 277 - static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id, 278 - bool state) 279 - { 280 - return 0; 281 - } 282 - 283 - static inline int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, 284 - bool state) 285 - { 286 - return 0; 287 - } 288 - 289 - static inline int extcon_sync(struct extcon_dev *edev, unsigned int id) 290 272 { 291 273 return 0; 292 274 } ··· 248 328 { 249 329 return 0; 250 330 } 251 - static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id, 252 - unsigned int prop, 253 - union extcon_property_value prop_val) 254 - { 255 - return 0; 256 - } 257 - 258 - static inline int extcon_set_property_sync(struct extcon_dev *edev, 259 - unsigned int id, unsigned int prop, 260 - union extcon_property_value prop_val) 261 - { 262 - return 0; 263 - } 264 331 265 332 static inline int extcon_get_property_capability(struct extcon_dev *edev, 266 - unsigned int id, unsigned int prop) 267 - { 268 - return 0; 269 - } 270 - 271 - static inline int extcon_set_property_capability(struct extcon_dev *edev, 272 333 unsigned int id, unsigned int prop) 273 334 { 274 335 return 0;
+5
include/linux/mfd/max77843-private.h
··· 245 245 #define MAX77843_CHG_OVER_CURRENT_BAT (0x06 << 4) 246 246 247 247 /* MAX77843 CHG_CNFG_00 register */ 248 + #define MAX77843_CHG_MODE_MASK 0x0f 248 249 #define MAX77843_CHG_DISABLE 0x00 249 250 #define MAX77843_CHG_ENABLE 0x05 250 251 #define MAX77843_CHG_MASK 0x01 252 + #define MAX77843_CHG_OTG_MASK 0x02 251 253 #define MAX77843_CHG_BUCK_MASK 0x04 254 + #define MAX77843_CHG_BOOST_MASK 0x08 252 255 253 256 /* MAX77843 CHG_CNFG_01 register */ 254 257 #define MAX77843_CHG_RESTART_THRESHOLD_100 0x00 ··· 350 347 /* MAX77843 CONTROL register */ 351 348 #define MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT 0 352 349 #define MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT 3 350 + #define MAX77843_MUIC_CONTROL1_NOBCCOMP_SHIFT 6 353 351 #define MAX77843_MUIC_CONTROL1_IDBEN_SHIFT 7 354 352 #define MAX77843_MUIC_CONTROL2_LOWPWR_SHIFT 0 355 353 #define MAX77843_MUIC_CONTROL2_ADCEN_SHIFT 1 ··· 367 363 #define MAX77843_MUIC_CONTROL1_COMP1SW_MASK (0x7 << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT) 368 364 #define MAX77843_MUIC_CONTROL1_COMP2SW_MASK (0x7 << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT) 369 365 #define MAX77843_MUIC_CONTROL1_IDBEN_MASK BIT(MAX77843_MUIC_CONTROL1_IDBEN_SHIFT) 366 + #define MAX77843_MUIC_CONTROL1_NOBCCOMP_MASK BIT(MAX77843_MUIC_CONTROL1_NOBCCOMP_SHIFT) 370 367 #define MAX77843_MUIC_CONTROL2_LOWPWR_MASK BIT(MAX77843_MUIC_CONTROL2_LOWPWR_SHIFT) 371 368 #define MAX77843_MUIC_CONTROL2_ADCEN_MASK BIT(MAX77843_MUIC_CONTROL2_ADCEN_SHIFT) 372 369 #define MAX77843_MUIC_CONTROL2_CPEN_MASK BIT(MAX77843_MUIC_CONTROL2_CPEN_SHIFT)
+1 -1
include/linux/mfd/palmas.h
··· 20 20 #include <linux/leds.h> 21 21 #include <linux/regmap.h> 22 22 #include <linux/regulator/driver.h> 23 - #include <linux/extcon.h> 23 + #include <linux/extcon-provider.h> 24 24 #include <linux/of_gpio.h> 25 25 #include <linux/usb/phy_companion.h> 26 26