* [U-Boot] [PATCH] dm: i2c-gpio: Remove redundant dm_gpio_set_value() call
@ 2015-04-26 3:05 Axel Lin
2015-04-28 3:20 ` Simon Glass
0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2015-04-26 3:05 UTC (permalink / raw)
To: u-boot
dm_gpio_set_dir_flags() will also set gpio output value when switching to
gpio output. So it's not necessary to call dm_gpio_set_value() after
dm_gpio_set_dir_flags() call.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/i2c/i2c-gpio.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c
index ed899d4..a8b83c5 100644
--- a/drivers/i2c/i2c-gpio.c
+++ b/drivers/i2c/i2c-gpio.c
@@ -41,18 +41,19 @@ static int i2c_gpio_sda_get(struct gpio_desc *sda)
static void i2c_gpio_sda_set(struct gpio_desc *sda, int bit)
{
- if (bit) {
+ if (bit)
dm_gpio_set_dir_flags(sda, GPIOD_IS_IN);
- } else {
+ else
dm_gpio_set_dir_flags(sda, GPIOD_IS_OUT);
- dm_gpio_set_value(sda, 0);
- }
}
static void i2c_gpio_scl_set(struct gpio_desc *scl, int bit)
{
- dm_gpio_set_dir_flags(scl, GPIOD_IS_OUT);
- dm_gpio_set_value(scl, bit);
+ ulong flags = GPIOD_IS_OUT;
+
+ if (bit)
+ flags |= GPIOD_IS_OUT_ACTIVE;
+ dm_gpio_set_dir_flags(scl, flags);
}
static void i2c_gpio_write_bit(struct gpio_desc *scl, struct gpio_desc *sda,
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] dm: i2c-gpio: Remove redundant dm_gpio_set_value() call
2015-04-26 3:05 [U-Boot] [PATCH] dm: i2c-gpio: Remove redundant dm_gpio_set_value() call Axel Lin
@ 2015-04-28 3:20 ` Simon Glass
2015-05-05 3:16 ` Simon Glass
0 siblings, 1 reply; 3+ messages in thread
From: Simon Glass @ 2015-04-28 3:20 UTC (permalink / raw)
To: u-boot
On 25 April 2015 at 21:05, Axel Lin <axel.lin@ingics.com> wrote:
> dm_gpio_set_dir_flags() will also set gpio output value when switching to
> gpio output. So it's not necessary to call dm_gpio_set_value() after
> dm_gpio_set_dir_flags() call.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/i2c/i2c-gpio.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
Acked-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] dm: i2c-gpio: Remove redundant dm_gpio_set_value() call
2015-04-28 3:20 ` Simon Glass
@ 2015-05-05 3:16 ` Simon Glass
0 siblings, 0 replies; 3+ messages in thread
From: Simon Glass @ 2015-05-05 3:16 UTC (permalink / raw)
To: u-boot
On 27 April 2015 at 21:20, Simon Glass <sjg@chromium.org> wrote:
> On 25 April 2015 at 21:05, Axel Lin <axel.lin@ingics.com> wrote:
>> dm_gpio_set_dir_flags() will also set gpio output value when switching to
>> gpio output. So it's not necessary to call dm_gpio_set_value() after
>> dm_gpio_set_dir_flags() call.
>>
>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>> ---
>> drivers/i2c/i2c-gpio.c | 13 +++++++------
>> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>
Applied to u-boot-dm, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-05 3:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-26 3:05 [U-Boot] [PATCH] dm: i2c-gpio: Remove redundant dm_gpio_set_value() call Axel Lin
2015-04-28 3:20 ` Simon Glass
2015-05-05 3:16 ` Simon Glass
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.