From: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: u.kleine-koenig-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
Subject: Re: [PATCH V6 1/2] i2c/adapter: Add bus recovery infrastructure
Date: Fri, 30 Nov 2012 15:11:29 +0100 [thread overview]
Message-ID: <20121130141129.GG23231@pengutronix.de> (raw)
In-Reply-To: <CAKohpokLD60N087_ae8-JY-4b4Opn+OrTErt0MwFsTgnSwFb0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2764 bytes --]
On Sun, Nov 25, 2012 at 09:34:46AM +0530, Viresh Kumar wrote:
> Hi Wolfram,
>
> Thanks for sharing your opinion.
>
> On 25 November 2012 02:29, Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> > On Thu, Oct 04, 2012 at 04:34:53PM +0530, Viresh Kumar wrote:
>
> >> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
>
> >> +static int i2c_get_gpios_for_recovery(struct i2c_adapter *adap)
> >> +{
> >> + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
> >> + struct device *dev = &adap->dev;
> >> + int ret = 0;
> >> +
> >> + if (bri->get_gpio) {
> >> + ret = bri->get_gpio(bri->scl_gpio);
> >> + if (ret) {
> >> + dev_warn(dev, "scl get_gpio: %d\n", bri->scl_gpio);
> >
> > This warning is probably not very helpful to a user.
>
> This is what i thought about it: This is a platform specific routine and
> most probably it will fail the first time this code is ever hit and so a
> warning would be very helpful for them.
>
> But, now i think platforms should have these prints in their get_gpio
> implementations. And we can make it have return type void.
The warning could be made helpful if properly rephrased. Actually, I
think returning an err is OK here, but if there is a warning it should
be a proper human readable sentence.
> >> + if (unlikely(ret ||
> >
> > Since the unlikely() are not in hot-paths, you probably better skip
> > them.
>
> It will be removed as get_gpio() would have return type void.
Keep in mind that it was not the only one. I think V7 had still one
left.
> >> + * @skip_sda_polling: if true, bus recovery will not poll sda line to check if
> >> + * it became high or not. Only required if recover_bus == NULL.
> >
> > Does a user really need to set this?
>
> This was done for platforms and i2c controllers which don't have configuration
> to control scl line. So i still feel we need it.
It might be needed internally, still not sure if a user needs to set it.
If so, there should be more documentation when she wants to use this.
> >> + * @clock_rate_khz: clock rate of dummy clock in khz. Required for both gpio and
> >> + * scl type recovery.
> >
> > Does a user really need this? We could probably use something close to
> > 100kHz always?
>
> Not sure. Doesn't it depend on the current clk rate of controller ?
> If not then yes it can be 100 KHz
It should be OK to drive the bus at x kHz and recover from it at y kHz
(as long as y < 100).
Regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2012-11-30 14:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-04 11:04 [PATCH V6 1/2] i2c/adapter: Add bus recovery infrastructure Viresh Kumar
[not found] ` <9adb13c1a2e35dce401b0a50e455fe1be76285a7.1349348405.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-10-04 11:04 ` [PATCH V6 2/2] i2c/designware: Provide i2c bus recovery support Viresh Kumar
[not found] ` <6262d3a8e87858d938362c4aa44caf40938f2be9.1349348405.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-24 21:03 ` Wolfram Sang
[not found] ` <20121124210314.GC3210-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-25 4:11 ` Viresh Kumar
[not found] ` <CAKohpokdx91dkK3vBsjBMtc9iHypM_ZK2oJm5vcjkdiT-eW7vQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-30 14:15 ` Wolfram Sang
2012-10-19 13:33 ` [PATCH V6 1/2] i2c/adapter: Add bus recovery infrastructure Viresh Kumar
[not found] ` <CAKohpokgrKVpGOcT=H7TvNCQyKwHfcUPetXj-_Ug1pP35nyFEg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-31 8:58 ` Viresh Kumar
2012-11-24 20:59 ` Wolfram Sang
[not found] ` <20121124205931.GB3210-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-25 4:04 ` Viresh Kumar
[not found] ` <CAKohpokLD60N087_ae8-JY-4b4Opn+OrTErt0MwFsTgnSwFb0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-30 14:11 ` Wolfram Sang [this message]
[not found] ` <20121130141129.GG23231-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-12-03 2:47 ` 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=20121130141129.GG23231@pengutronix.de \
--to=w.sang-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=spear-devel-nkJGhpqTU55BDgjK7y7TUQ@public.gmane.org \
--cc=u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@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 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.