mirror of
				https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
				synced 2025-10-31 11:03:14 +00:00 
			
		
		
		
	 6084f1bf0c
			
		
	
	
		6084f1bf0c
		
	
	
	
	
		
			
			gpio_vbus provides simple GPIO VBUS sensing for peripheral controllers with an internal transceiver. Optionally, a second GPIO can be used to control D+ pullup. It also interfaces with the regulator framework to limit charging currents when powered via USB. gpio_vbus requests the regulator supplying "vbus_draw" and can enable/disable it or limit its current depending on USB state. [dbrownell@users.sourceforge.net: use drivers/otg, cleanups ] Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
		
			
				
	
	
		
			31 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  * A simple GPIO VBUS sensing driver for B peripheral only devices
 | |
|  * with internal transceivers.
 | |
|  * Optionally D+ pullup can be controlled by a second GPIO.
 | |
|  *
 | |
|  * Copyright (c) 2008 Philipp Zabel <philipp.zabel@gmail.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.
 | |
|  *
 | |
|  */
 | |
| 
 | |
| /**
 | |
|  * struct gpio_vbus_mach_info - configuration for gpio_vbus
 | |
|  * @gpio_vbus: VBUS sensing GPIO
 | |
|  * @gpio_pullup: optional D+ or D- pullup GPIO (else negative/invalid)
 | |
|  * @gpio_vbus_inverted: true if gpio_vbus is active low
 | |
|  * @gpio_pullup_inverted: true if gpio_pullup is active low
 | |
|  *
 | |
|  * The VBUS sensing GPIO should have a pulldown, which will normally be
 | |
|  * part of a resistor ladder turning a 4.0V-5.25V level on VBUS into a
 | |
|  * value the GPIO detects as active.  Some systems will use comparators.
 | |
|  */
 | |
| struct gpio_vbus_mach_info {
 | |
| 	int gpio_vbus;
 | |
| 	int gpio_pullup;
 | |
| 	bool gpio_vbus_inverted;
 | |
| 	bool gpio_pullup_inverted;
 | |
| };
 |