mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	spi: sc18is602: Add reset control via gpio pin.
This sc18is602 has a reset pin that may need to be deasserted. Add optional binding to specifiy the reset pin via a gpio and deassert during probe. Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
		
							parent
							
								
									29b4817d40
								
							
						
					
					
						commit
						f99008013e
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -23,6 +23,7 @@
 | 
			
		|||
#include <linux/pm_runtime.h>
 | 
			
		||||
#include <linux/of.h>
 | 
			
		||||
#include <linux/platform_data/sc18is602.h>
 | 
			
		||||
#include <linux/gpio/consumer.h>
 | 
			
		||||
 | 
			
		||||
enum chips { sc18is602, sc18is602b, sc18is603 };
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -50,6 +51,8 @@ struct sc18is602 {
 | 
			
		|||
	u8			buffer[SC18IS602_BUFSIZ + 1];
 | 
			
		||||
	int			tlen;	/* Data queued for tx in buffer */
 | 
			
		||||
	int			rindex;	/* Receive data index in buffer */
 | 
			
		||||
 | 
			
		||||
	struct gpio_desc	*reset;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static int sc18is602_wait_ready(struct sc18is602 *hw, int len)
 | 
			
		||||
| 
						 | 
				
			
			@ -257,6 +260,12 @@ static int sc18is602_probe(struct i2c_client *client,
 | 
			
		|||
	hw = spi_master_get_devdata(master);
 | 
			
		||||
	i2c_set_clientdata(client, hw);
 | 
			
		||||
 | 
			
		||||
	/* assert reset and then release */
 | 
			
		||||
	hw->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
 | 
			
		||||
	if (IS_ERR(hw->reset))
 | 
			
		||||
		return PTR_ERR(hw->reset);
 | 
			
		||||
	gpiod_set_value(hw->reset, 0);
 | 
			
		||||
 | 
			
		||||
	hw->master = master;
 | 
			
		||||
	hw->client = client;
 | 
			
		||||
	hw->dev = dev;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue