File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 88#include <linux/bitfield.h>
99#include <linux/delay.h>
1010#include <linux/firmware.h>
11+ #include <linux/gpio/consumer.h>
1112#include <linux/i2c.h>
1213#include <linux/module.h>
1314#include <linux/of.h>
@@ -737,6 +738,7 @@ static int tps23881_i2c_probe(struct i2c_client *client)
737738{
738739 struct device * dev = & client -> dev ;
739740 struct tps23881_priv * priv ;
741+ struct gpio_desc * reset ;
740742 int ret ;
741743 u8 val ;
742744
@@ -749,6 +751,25 @@ static int tps23881_i2c_probe(struct i2c_client *client)
749751 if (!priv )
750752 return - ENOMEM ;
751753
754+ reset = devm_gpiod_get_optional (dev , "reset" , GPIOD_OUT_HIGH );
755+ if (IS_ERR (reset ))
756+ return dev_err_probe (& client -> dev , PTR_ERR (reset ), "Failed to get reset GPIO\n" );
757+
758+ if (reset ) {
759+ /* TPS23880 datasheet (Rev G) indicates minimum reset pulse is 5us */
760+ usleep_range (5 , 10 );
761+ gpiod_set_value_cansleep (reset , 0 ); /* De-assert reset */
762+
763+ /* TPS23880 datasheet indicates the minimum time after power on reset
764+ * should be 20ms, but the document describing how to load SRAM ("How
765+ * to Load TPS2388x SRAM and Parity Code over I2C" (Rev E))
766+ * indicates we should delay that programming by at least 50ms. So
767+ * we'll wait the entire 50ms here to ensure we're safe to go to the
768+ * SRAM loading proceedure.
769+ */
770+ msleep (50 );
771+ }
772+
752773 ret = i2c_smbus_read_byte_data (client , TPS23881_REG_DEVID );
753774 if (ret < 0 )
754775 return ret ;
You can’t perform that action at this time.
0 commit comments