From: Grant Feng <von81@163.com>
To: von81@163.com, jacek.anaszewski@gmail.com, pavel@ucw.cz,
dmurphy@ti.com, robh+dt@kernel.org, linux-leds@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup
Date: Sat, 8 Aug 2020 11:37:30 +0800 [thread overview]
Message-ID: <20200808033731.15695-1-von81@163.com> (raw)
generate a 5ms low pulse on sdb pin when startup, then the chip
becomes more stable in the complex EM environment.
Signed-off-by: Grant Feng <von81@163.com>
---
drivers/leds/leds-is31fl319x.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c
index ca6634b8683c..5c499a5895e0 100644
--- a/drivers/leds/leds-is31fl319x.c
+++ b/drivers/leds/leds-is31fl319x.c
@@ -16,6 +16,8 @@
#include <linux/of_device.h>
#include <linux/regmap.h>
#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
/* register numbers */
#define IS31FL319X_SHUTDOWN 0x00
@@ -61,6 +63,7 @@
struct is31fl319x_chip {
const struct is31fl319x_chipdef *cdef;
struct i2c_client *client;
+ struct gpio_desc *sdb_gpio;
struct regmap *regmap;
struct mutex lock;
u32 audio_gain_db;
@@ -207,6 +210,15 @@ static int is31fl319x_parse_dt(struct device *dev,
if (!np)
return -ENODEV;
+ is31->sdb_gpio = devm_gpiod_get_optional(dev,
+ "sdb",
+ GPIOD_OUT_HIGH);
+ if (IS_ERR(is31->sdb_gpio)) {
+ ret = PTR_ERR(is31->sdb_gpio);
+ dev_err(dev, "Failed to get sdb gpio: %d\n", ret);
+ return ret;
+ }
+
of_dev_id = of_match_device(of_is31fl319x_match, dev);
if (!of_dev_id) {
dev_err(dev, "Failed to match device with supported chips\n");
@@ -350,6 +362,12 @@ static int is31fl319x_probe(struct i2c_client *client,
if (err)
goto free_mutex;
+ if (is31->sdb_gpio) {
+ gpiod_direction_output(is31->sdb_gpio, 0);
+ mdelay(5);
+ gpiod_direction_output(is31->sdb_gpio, 1);
+ }
+
is31->client = client;
is31->regmap = devm_regmap_init_i2c(client, ®map_config);
if (IS_ERR(is31->regmap)) {
--
2.17.1
next reply other threads:[~2020-08-08 3:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-08 3:37 Grant Feng [this message]
2020-08-08 3:37 ` [PATCH v2 2/2] leds: Add an optional property named 'sdb-gpios' Grant Feng
2020-08-24 22:21 ` Rob Herring
2020-08-25 8:05 ` Grant Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200808033731.15695-1-von81@163.com \
--to=von81@163.com \
--cc=devicetree@vger.kernel.org \
--cc=dmurphy@ti.com \
--cc=jacek.anaszewski@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).