From: "Uwe Kleine-König" <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: viresh kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org,
ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ@public.gmane.org,
Viresh Kumar <viresh.kumar-qxv4g6HH51o@public.gmane.org>,
Linus Walleij
<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH V4 Resend 1/2] i2c/adapter: Add bus recovery infrastructure
Date: Fri, 28 Sep 2012 09:27:35 +0200 [thread overview]
Message-ID: <20120928072735.GC16606@pengutronix.de> (raw)
In-Reply-To: <CAOh2x=nm+iiw3pcKtRcWjBnnjc0+p1kQ7zcqjHHyX9351cZDHQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Hello,
On Fri, Sep 28, 2012 at 09:11:34AM +0530, viresh kumar wrote:
> >> + ndelay(delay);
> >> + gpio_set_value(bri->scl_gpio, val);
> >> +
> >> + /* break if sda got high, check only when scl line is high */
> >> + if (!bri->skip_sda_polling && val)
> >> + if (gpio_get_value(bri->sda_gpio))
> >> + break;
> > I'm not sure it's worth to conditionally shortcut here. Either always or
> > never shortcut.
>
> This was done, because few platforms may not have configuration bits to read
> status of sda line.. For them skip_sda_polling was required.
>
> Whereas, others would need this to see if we can return early.
What is the upside of returning early? I'd say, just don't do it.
> >> + * @put_gpio: called after recover_bus() to get padmux configured for scl line
> >> + * as scl. Only required if is_gpio_recovery == true.
> >> + * @scl_gpio: gpio number of the scl line. Only required if is_gpio_recovery ==
> >> + * true.
> >> + * @sda_gpio: gpio number of the sda line. Only required if is_gpio_recovery ==
> >> + * true and skip_sda_polling == false.
> >> + * @scl_gpio_flags: flag for gpio_request_one of scl_gpio. 0 implies
> >> + * GPIOF_OUT_INIT_LOW.
> > IMHO you should not make this configurable but use
> >
> > GPIOF_OUT_INIT_HIGH | GPIOF_OPEN_DRAIN
>
> Discussed here:
> http://www.spinics.net/lists/linux-i2c/msg07325.html
Why do you default to GPIOF_OUT_INIT_LOW? The idle state of scl is high.
Using low here introduces an additional clk pulse.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2012-09-28 7:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-27 5:11 [PATCH V4 Resend 1/2] i2c/adapter: Add bus recovery infrastructure Viresh Kumar
[not found] ` <fce6ddd7e8061ed0f428d48973d73b75c9ae585c.1346044190.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-08-27 5:11 ` [PATCH V4 Resend 2/2] i2c/designware: Provide i2c bus recovery support Viresh Kumar
2012-09-27 14:28 ` [PATCH V4 Resend 1/2] i2c/adapter: Add bus recovery infrastructure Uwe Kleine-König
[not found] ` <20120927142825.GB16606-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-09-28 3:41 ` viresh kumar
[not found] ` <CAOh2x=nm+iiw3pcKtRcWjBnnjc0+p1kQ7zcqjHHyX9351cZDHQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-28 7:00 ` Wolfram Sang
[not found] ` <20120928070055.GA17047-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-09-28 7:05 ` Viresh Kumar
2012-10-04 4:26 ` Viresh Kumar
2012-09-28 7:27 ` Uwe Kleine-König [this message]
[not found] ` <20120928072735.GC16606-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-09-28 7:36 ` Viresh Kumar
[not found] ` <CAKohpo=BCyu2M18TZKhGUUkOKi4y-g-=-dmvY8dzefJTFtgAvA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-28 7:39 ` Viresh Kumar
2012-09-28 8:35 ` Viresh Kumar
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=20120928072735.GC16606@pengutronix.de \
--to=u.kleine-koenig-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=spear-devel-nkJGhpqTU55BDgjK7y7TUQ@public.gmane.org \
--cc=viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=viresh.kumar-qxv4g6HH51o@public.gmane.org \
--cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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).