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.21' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-next

Chanwoo writes:

Update extcon for 4.21

Detailed description for this pull request:
1. Fix minor issue of Maxim MUIC (Micro USB IC) device driver
- Avoid forcing UART path on probe for extcon-max77843/77693/14577/8997.c
- Set USB path in USB device mode for extcon-max8997.c

* tag 'extcon-next-for-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon:
extcon: max8997: Fix lack of path setting in USB device mode
extcon: max8997: Avoid forcing UART path on drive probe
extcon: max14577: Avoid forcing UART path on drive probe
extcon: max77693: Avoid forcing UART path on drive probe
extcon: max77843: Avoid forcing UART path on drive probe

+59 -15
+13 -2
drivers/extcon/extcon-max14577.c
··· 657 657 struct max14577 *max14577 = dev_get_drvdata(pdev->dev.parent); 658 658 struct max14577_muic_info *info; 659 659 int delay_jiffies; 660 + int cable_type; 661 + bool attached; 660 662 int ret; 661 663 int i; 662 664 u8 id; ··· 727 725 info->path_uart = CTRL1_SW_UART; 728 726 delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT); 729 727 730 - /* Set initial path for UART */ 731 - max14577_muic_set_path(info, info->path_uart, true); 728 + /* Set initial path for UART when JIG is connected to get serial logs */ 729 + ret = max14577_bulk_read(info->max14577->regmap, 730 + MAX14577_MUIC_REG_STATUS1, info->status, 2); 731 + if (ret) { 732 + dev_err(info->dev, "Cannot read STATUS registers\n"); 733 + return ret; 734 + } 735 + cable_type = max14577_muic_get_cable_type(info, MAX14577_CABLE_GROUP_ADC, 736 + &attached); 737 + if (attached && cable_type == MAX14577_MUIC_ADC_FACTORY_MODE_UART_OFF) 738 + max14577_muic_set_path(info, info->path_uart, true); 732 739 733 740 /* Check revision number of MUIC device*/ 734 741 ret = max14577_read_reg(info->max14577->regmap,
+14 -2
drivers/extcon/extcon-max77693.c
··· 1072 1072 struct max77693_reg_data *init_data; 1073 1073 int num_init_data; 1074 1074 int delay_jiffies; 1075 + int cable_type; 1076 + bool attached; 1075 1077 int ret; 1076 1078 int i; 1077 1079 unsigned int id; ··· 1214 1212 delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT); 1215 1213 } 1216 1214 1217 - /* Set initial path for UART */ 1218 - max77693_muic_set_path(info, info->path_uart, true); 1215 + /* Set initial path for UART when JIG is connected to get serial logs */ 1216 + ret = regmap_bulk_read(info->max77693->regmap_muic, 1217 + MAX77693_MUIC_REG_STATUS1, info->status, 2); 1218 + if (ret) { 1219 + dev_err(info->dev, "failed to read MUIC register\n"); 1220 + return ret; 1221 + } 1222 + cable_type = max77693_muic_get_cable_type(info, 1223 + MAX77693_CABLE_GROUP_ADC, &attached); 1224 + if (attached && (cable_type == MAX77693_MUIC_ADC_FACTORY_MODE_UART_ON || 1225 + cable_type == MAX77693_MUIC_ADC_FACTORY_MODE_UART_OFF)) 1226 + max77693_muic_set_path(info, info->path_uart, true); 1219 1227 1220 1228 /* Check revision number of MUIC device*/ 1221 1229 ret = regmap_read(info->max77693->regmap_muic,
+15 -3
drivers/extcon/extcon-max77843.c
··· 812 812 struct max77693_dev *max77843 = dev_get_drvdata(pdev->dev.parent); 813 813 struct max77843_muic_info *info; 814 814 unsigned int id; 815 + int cable_type; 816 + bool attached; 815 817 int i, ret; 816 818 817 819 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); ··· 858 856 /* Set ADC debounce time */ 859 857 max77843_muic_set_debounce_time(info, MAX77843_DEBOUNCE_TIME_25MS); 860 858 861 - /* Set initial path for UART */ 862 - max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_UART, true, 863 - false); 859 + /* Set initial path for UART when JIG is connected to get serial logs */ 860 + ret = regmap_bulk_read(max77843->regmap_muic, 861 + MAX77843_MUIC_REG_STATUS1, info->status, 862 + MAX77843_MUIC_STATUS_NUM); 863 + if (ret) { 864 + dev_err(info->dev, "Cannot read STATUS registers\n"); 865 + goto err_muic_irq; 866 + } 867 + cable_type = max77843_muic_get_cable_type(info, MAX77843_CABLE_GROUP_ADC, 868 + &attached); 869 + if (attached && cable_type == MAX77843_MUIC_ADC_FACTORY_MODE_UART_OFF) 870 + max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_UART, 871 + true, false); 864 872 865 873 /* Check revision number of MUIC device */ 866 874 ret = regmap_read(max77843->regmap_muic, MAX77843_MUIC_REG_ID, &id);
+17 -8
drivers/extcon/extcon-max8997.c
··· 311 311 { 312 312 int ret = 0; 313 313 314 - if (usb_type == MAX8997_USB_HOST) { 315 - ret = max8997_muic_set_path(info, info->path_usb, attached); 316 - if (ret < 0) { 317 - dev_err(info->dev, "failed to update muic register\n"); 318 - return ret; 319 - } 314 + ret = max8997_muic_set_path(info, info->path_usb, attached); 315 + if (ret < 0) { 316 + dev_err(info->dev, "failed to update muic register\n"); 317 + return ret; 320 318 } 321 319 322 320 switch (usb_type) { ··· 630 632 struct max8997_platform_data *pdata = dev_get_platdata(max8997->dev); 631 633 struct max8997_muic_info *info; 632 634 int delay_jiffies; 635 + int cable_type; 636 + bool attached; 633 637 int ret, i; 634 638 635 639 info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_muic_info), ··· 724 724 delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT); 725 725 } 726 726 727 - /* Set initial path for UART */ 728 - max8997_muic_set_path(info, info->path_uart, true); 727 + /* Set initial path for UART when JIG is connected to get serial logs */ 728 + ret = max8997_bulk_read(info->muic, MAX8997_MUIC_REG_STATUS1, 729 + 2, info->status); 730 + if (ret) { 731 + dev_err(info->dev, "failed to read MUIC register\n"); 732 + return ret; 733 + } 734 + cable_type = max8997_muic_get_cable_type(info, 735 + MAX8997_CABLE_GROUP_ADC, &attached); 736 + if (attached && cable_type == MAX8997_MUIC_ADC_FACTORY_MODE_UART_OFF) 737 + max8997_muic_set_path(info, info->path_uart, true); 729 738 730 739 /* Set ADC debounce time */ 731 740 max8997_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS);