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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'extcon-next-for-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-testing

Chanwoo writes:

Update extcon for 4.6

Detailed description for patchset:
1. Add new EXTCON_CHG_USB_SDP type
- SDP (Standard Downstream Port) USB Charging Port
means the charging connector.a

2. Add the VBUS detection by using GPIO on extcon-palmas
- Beaglex15 board uses the extcon-palmas driver
But, beaglex15 board need the GPIO support for VBUS
detection.

3. Fix the minor issue of extcon drivers

+92 -13
+1 -2
arch/arm/boot/dts/am57xx-beagle-x15.dts
··· 562 562 extcon_usb2: tps659038_usb { 563 563 compatible = "ti,palmas-usb-vid"; 564 564 ti,enable-vbus-detection; 565 - ti,enable-id-detection; 566 - id-gpios = <&gpio7 24 GPIO_ACTIVE_HIGH>; 565 + vbus-gpio = <&gpio4 21 GPIO_ACTIVE_HIGH>; 567 566 }; 568 567 569 568 };
+2 -2
drivers/extcon/extcon-arizona.c
··· 185 185 break; 186 186 }; 187 187 188 - mutex_lock(&arizona->dapm->card->dapm_mutex); 188 + snd_soc_dapm_mutex_lock(arizona->dapm); 189 189 190 190 arizona->hpdet_clamp = clamp; 191 191 ··· 227 227 ret); 228 228 } 229 229 230 - mutex_unlock(&arizona->dapm->card->dapm_mutex); 230 + snd_soc_dapm_mutex_unlock(arizona->dapm); 231 231 } 232 232 233 233 static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode)
+1 -1
drivers/extcon/extcon-gpio.c
··· 126 126 INIT_DELAYED_WORK(&data->work, gpio_extcon_work); 127 127 128 128 /* 129 - * Request the interrput of gpio to detect whether external connector 129 + * Request the interrupt of gpio to detect whether external connector 130 130 * is attached or detached. 131 131 */ 132 132 ret = devm_request_any_context_irq(&pdev->dev, data->irq,
+3
drivers/extcon/extcon-max14577.c
··· 150 150 151 151 static const unsigned int max14577_extcon_cable[] = { 152 152 EXTCON_USB, 153 + EXTCON_CHG_USB_SDP, 153 154 EXTCON_CHG_USB_DCP, 154 155 EXTCON_CHG_USB_FAST, 155 156 EXTCON_CHG_USB_SLOW, ··· 455 454 return ret; 456 455 457 456 extcon_set_cable_state_(info->edev, EXTCON_USB, attached); 457 + extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP, 458 + attached); 458 459 break; 459 460 case MAX14577_CHARGER_TYPE_DEDICATED_CHG: 460 461 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
+11 -1
drivers/extcon/extcon-max77693.c
··· 204 204 static const unsigned int max77693_extcon_cable[] = { 205 205 EXTCON_USB, 206 206 EXTCON_USB_HOST, 207 + EXTCON_CHG_USB_SDP, 207 208 EXTCON_CHG_USB_DCP, 208 209 EXTCON_CHG_USB_FAST, 209 210 EXTCON_CHG_USB_SLOW, ··· 513 512 break; 514 513 case MAX77693_MUIC_ADC_AV_CABLE_NOLOAD: /* Dock-Audio */ 515 514 dock_id = EXTCON_DOCK; 516 - if (!attached) 515 + if (!attached) { 517 516 extcon_set_cable_state_(info->edev, EXTCON_USB, false); 517 + extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP, 518 + false); 519 + } 518 520 break; 519 521 default: 520 522 dev_err(info->dev, "failed to detect %s dock device\n", ··· 605 601 if (ret < 0) 606 602 return ret; 607 603 extcon_set_cable_state_(info->edev, EXTCON_USB, attached); 604 + extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP, 605 + attached); 608 606 break; 609 607 case MAX77693_MUIC_GND_MHL: 610 608 case MAX77693_MUIC_GND_MHL_VB: ··· 836 830 */ 837 831 extcon_set_cable_state_(info->edev, EXTCON_USB, 838 832 attached); 833 + extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP, 834 + attached); 839 835 840 836 if (!cable_attached) 841 837 extcon_set_cable_state_(info->edev, EXTCON_DOCK, ··· 906 898 return ret; 907 899 908 900 extcon_set_cable_state_(info->edev, EXTCON_USB, 901 + attached); 902 + extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP, 909 903 attached); 910 904 break; 911 905 case MAX77693_CHARGER_TYPE_DEDICATED_CHG:
+4 -1
drivers/extcon/extcon-max77843.c
··· 122 122 static const unsigned int max77843_extcon_cable[] = { 123 123 EXTCON_USB, 124 124 EXTCON_USB_HOST, 125 + EXTCON_CHG_USB_SDP, 125 126 EXTCON_CHG_USB_DCP, 126 127 EXTCON_CHG_USB_CDP, 127 128 EXTCON_CHG_USB_FAST, ··· 487 486 return ret; 488 487 489 488 extcon_set_cable_state_(info->edev, EXTCON_USB, attached); 489 + extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP, 490 + attached); 490 491 break; 491 492 case MAX77843_MUIC_CHG_DOWNSTREAM: 492 493 ret = max77843_muic_set_path(info, ··· 806 803 /* Clear IRQ bits before request IRQs */ 807 804 ret = regmap_bulk_read(max77843->regmap_muic, 808 805 MAX77843_MUIC_REG_INT1, info->status, 809 - MAX77843_MUIC_IRQ_NUM); 806 + MAX77843_MUIC_STATUS_NUM); 810 807 if (ret) { 811 808 dev_err(&pdev->dev, "Failed to Clear IRQ bits\n"); 812 809 goto err_muic_irq;
+3
drivers/extcon/extcon-max8997.c
··· 148 148 static const unsigned int max8997_extcon_cable[] = { 149 149 EXTCON_USB, 150 150 EXTCON_USB_HOST, 151 + EXTCON_CHG_USB_SDP, 151 152 EXTCON_CHG_USB_DCP, 152 153 EXTCON_CHG_USB_FAST, 153 154 EXTCON_CHG_USB_SLOW, ··· 335 334 break; 336 335 case MAX8997_USB_DEVICE: 337 336 extcon_set_cable_state_(info->edev, EXTCON_USB, attached); 337 + extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP, 338 + attached); 338 339 break; 339 340 default: 340 341 dev_err(info->dev, "failed to detect %s usb cable\n",
+52 -2
drivers/extcon/extcon-palmas.c
··· 216 216 return PTR_ERR(palmas_usb->id_gpiod); 217 217 } 218 218 219 + palmas_usb->vbus_gpiod = devm_gpiod_get_optional(&pdev->dev, "vbus", 220 + GPIOD_IN); 221 + if (IS_ERR(palmas_usb->vbus_gpiod)) { 222 + dev_err(&pdev->dev, "failed to get vbus gpio\n"); 223 + return PTR_ERR(palmas_usb->vbus_gpiod); 224 + } 225 + 219 226 if (palmas_usb->enable_id_detection && palmas_usb->id_gpiod) { 220 227 palmas_usb->enable_id_detection = false; 221 228 palmas_usb->enable_gpio_id_detection = true; 229 + } 230 + 231 + if (palmas_usb->enable_vbus_detection && palmas_usb->vbus_gpiod) { 232 + palmas_usb->enable_vbus_detection = false; 233 + palmas_usb->enable_gpio_vbus_detection = true; 222 234 } 223 235 224 236 if (palmas_usb->enable_gpio_id_detection) { ··· 278 266 palmas_usb->id_irq, 279 267 NULL, palmas_id_irq_handler, 280 268 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | 281 - IRQF_ONESHOT | IRQF_EARLY_RESUME, 269 + IRQF_ONESHOT, 282 270 "palmas_usb_id", palmas_usb); 283 271 if (status < 0) { 284 272 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", ··· 316 304 palmas_usb->vbus_irq, NULL, 317 305 palmas_vbus_irq_handler, 318 306 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | 319 - IRQF_ONESHOT | IRQF_EARLY_RESUME, 307 + IRQF_ONESHOT, 320 308 "palmas_usb_vbus", palmas_usb); 321 309 if (status < 0) { 322 310 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", 323 311 palmas_usb->vbus_irq, status); 312 + return status; 313 + } 314 + } else if (palmas_usb->enable_gpio_vbus_detection) { 315 + /* remux GPIO_1 as VBUSDET */ 316 + status = palmas_update_bits(palmas, 317 + PALMAS_PU_PD_OD_BASE, 318 + PALMAS_PRIMARY_SECONDARY_PAD1, 319 + PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK, 320 + (1 << PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT)); 321 + if (status < 0) { 322 + dev_err(&pdev->dev, "can't remux GPIO1\n"); 323 + return status; 324 + } 325 + 326 + palmas_usb->vbus_otg_irq = regmap_irq_get_virq(palmas->irq_data, 327 + PALMAS_VBUS_OTG_IRQ); 328 + palmas_usb->gpio_vbus_irq = gpiod_to_irq(palmas_usb->vbus_gpiod); 329 + if (palmas_usb->gpio_vbus_irq < 0) { 330 + dev_err(&pdev->dev, "failed to get vbus irq\n"); 331 + return palmas_usb->gpio_vbus_irq; 332 + } 333 + status = devm_request_threaded_irq(&pdev->dev, 334 + palmas_usb->gpio_vbus_irq, 335 + NULL, 336 + palmas_vbus_irq_handler, 337 + IRQF_TRIGGER_FALLING | 338 + IRQF_TRIGGER_RISING | 339 + IRQF_ONESHOT | 340 + IRQF_EARLY_RESUME, 341 + "palmas_usb_vbus", 342 + palmas_usb); 343 + if (status < 0) { 344 + dev_err(&pdev->dev, 345 + "failed to request handler for vbus irq\n"); 324 346 return status; 325 347 } 326 348 } ··· 383 337 if (device_may_wakeup(dev)) { 384 338 if (palmas_usb->enable_vbus_detection) 385 339 enable_irq_wake(palmas_usb->vbus_irq); 340 + if (palmas_usb->enable_gpio_vbus_detection) 341 + enable_irq_wake(palmas_usb->gpio_vbus_irq); 386 342 if (palmas_usb->enable_id_detection) 387 343 enable_irq_wake(palmas_usb->id_irq); 388 344 if (palmas_usb->enable_gpio_id_detection) ··· 400 352 if (device_may_wakeup(dev)) { 401 353 if (palmas_usb->enable_vbus_detection) 402 354 disable_irq_wake(palmas_usb->vbus_irq); 355 + if (palmas_usb->enable_gpio_vbus_detection) 356 + disable_irq_wake(palmas_usb->gpio_vbus_irq); 403 357 if (palmas_usb->enable_id_detection) 404 358 disable_irq_wake(palmas_usb->id_irq); 405 359 if (palmas_usb->enable_gpio_id_detection)
+6 -2
drivers/extcon/extcon-rt8973a.c
··· 93 93 static const unsigned int rt8973a_extcon_cable[] = { 94 94 EXTCON_USB, 95 95 EXTCON_USB_HOST, 96 + EXTCON_CHG_USB_SDP, 96 97 EXTCON_CHG_USB_DCP, 97 98 EXTCON_JIG, 98 99 EXTCON_NONE, ··· 399 398 400 399 /* Change the state of external accessory */ 401 400 extcon_set_cable_state_(info->edev, id, attached); 401 + if (id == EXTCON_USB) 402 + extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP, 403 + attached); 402 404 403 405 return 0; 404 406 } ··· 667 663 #ifdef CONFIG_PM_SLEEP 668 664 static int rt8973a_muic_suspend(struct device *dev) 669 665 { 670 - struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); 666 + struct i2c_client *i2c = to_i2c_client(dev); 671 667 struct rt8973a_muic_info *info = i2c_get_clientdata(i2c); 672 668 673 669 enable_irq_wake(info->irq); ··· 677 673 678 674 static int rt8973a_muic_resume(struct device *dev) 679 675 { 680 - struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); 676 + struct i2c_client *i2c = to_i2c_client(dev); 681 677 struct rt8973a_muic_info *info = i2c_get_clientdata(i2c); 682 678 683 679 disable_irq_wake(info->irq);
+6 -2
drivers/extcon/extcon-sm5502.c
··· 95 95 static const unsigned int sm5502_extcon_cable[] = { 96 96 EXTCON_USB, 97 97 EXTCON_USB_HOST, 98 + EXTCON_CHG_USB_SDP, 98 99 EXTCON_CHG_USB_DCP, 99 100 EXTCON_NONE, 100 101 }; ··· 412 411 413 412 /* Change the state of external accessory */ 414 413 extcon_set_cable_state_(info->edev, id, attached); 414 + if (id == EXTCON_USB) 415 + extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP, 416 + attached); 415 417 416 418 return 0; 417 419 } ··· 659 655 #ifdef CONFIG_PM_SLEEP 660 656 static int sm5502_muic_suspend(struct device *dev) 661 657 { 662 - struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); 658 + struct i2c_client *i2c = to_i2c_client(dev); 663 659 struct sm5502_muic_info *info = i2c_get_clientdata(i2c); 664 660 665 661 enable_irq_wake(info->irq); ··· 669 665 670 666 static int sm5502_muic_resume(struct device *dev) 671 667 { 672 - struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); 668 + struct i2c_client *i2c = to_i2c_client(dev); 673 669 struct sm5502_muic_info *info = i2c_get_clientdata(i2c); 674 670 675 671 disable_irq_wake(info->irq);
+3
include/linux/mfd/palmas.h
··· 580 580 int vbus_irq; 581 581 582 582 int gpio_id_irq; 583 + int gpio_vbus_irq; 583 584 struct gpio_desc *id_gpiod; 585 + struct gpio_desc *vbus_gpiod; 584 586 unsigned long sw_debounce_jiffies; 585 587 struct delayed_work wq_detectid; 586 588 ··· 591 589 bool enable_vbus_detection; 592 590 bool enable_id_detection; 593 591 bool enable_gpio_id_detection; 592 + bool enable_gpio_vbus_detection; 594 593 }; 595 594 596 595 #define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)