All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Hawa, Hanna" <hhhawa@amazon.com>, Wolfram Sang <wsa@kernel.org>,
	jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com,
	jsd@semihalf.com, linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org, dwmw@amazon.co.uk, benh@amazon.com,
	ronenk@amazon.com, talel@amazon.com, jonnyc@amazon.com,
	hanochu@amazon.com, farbere@amazon.com, itamark@amazon.com
Subject: Re: [PATCH v2 1/1] i2c: designware: set pinctrl recovery information from device pinctrl
Date: Thu, 15 Dec 2022 17:22:09 +0200	[thread overview]
Message-ID: <Y5s7ofYGaec8+zIA@smile.fi.intel.com> (raw)
In-Reply-To: <CACRpkdbawj+Wg2D75MdZavcfyjRa2JRAvqROnNLVH7oMcZTdMg@mail.gmail.com>

On Thu, Dec 15, 2022 at 03:06:13PM +0100, Linus Walleij wrote:
> On Thu, Dec 15, 2022 at 11:28 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Dec 15, 2022 at 10:15:35AM +0200, Hawa, Hanna wrote:
> > > On 12/14/2022 6:09 PM, Andy Shevchenko wrote:

...

> > > > > +     if (dev->dev->pins && dev->dev->pins->p)
> > > > > +             rinfo->pinctrl = dev->dev->pins->p;
> > > > Hmm... I don't see how this field is being used.
> > > > Can you elaborate?
> > >
> > > This field is used in i2c_generic_scl_recovery(), if it's not NULL then the
> > > flow will set the state to GPIO before running the recovery mechanism.
> > >         if (bri->pinctrl)
> > >                 pinctrl_select_state(bri->pinctrl, bri->pins_gpio);
> >
> > OK, but why that function doesn't use the dev->pins->p if it's defined?
> > (As a fallback when rinfo->pinctrl is NULL.)
> 
> I don't understand the context of these things so can't say much
> about it.

Main question here is that, is it possible that GPIOs that back up I²C bus are
on the different pin control device that the bus pins themselves?

And while writing above I think it may be the case if we use additional
GPIO pins over the I²C bus for purpose of recovery. In such case the pin control
device can be different.

At the same time, the fallback option might still work, in case the pinctrl not
overridden and I²C bus has backed GPIO function (on SCL/SDA).

...

> > > I saw that that the change failed in complication for SPARC architecture, as
> > > the pins field is wraparound with CONFIG_PINCTRL in device struct. I though
> > > on two options to solve the compilation error, first by adding wraparound of
> > > CONFIG_PINCTRL when accessing the pins field. And the second option is to
> > > add get function in pinctrl/devinfo.h file, which return the pins field, or
> > > NULL in case the PINCTRL is not defined. Which option you think we can go
> > > with?
> >
> > Getter with a stub sounds better to me, so you won't access some device core
> > fields.
> >
> > Linus, what do you think about all these (including previous paragraph)?
> 
> A getter may be a good solution, it depends, it can also be pushed
> somewhere local in the designware i2c driver can it not?

Yeah, but my point in the above paragraph that it uses the generic recovery
mechanism which may (or may not?) utilise the same pin control as I²C bus
sitting on).

> I am thinking that the rest of the code that is using that field is
> certainly not going to work without pinctrl either.

-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2022-12-15 15:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14 14:27 [PATCH v2 1/1] i2c: designware: set pinctrl recovery information from device pinctrl Hanna Hawa
2022-12-14 16:09 ` Andy Shevchenko
2022-12-15  8:15   ` Hawa, Hanna
2022-12-15 10:27     ` Andy Shevchenko
2022-12-15 14:06       ` Linus Walleij
2022-12-15 14:25         ` Hawa, Hanna
2022-12-15 15:22         ` Andy Shevchenko [this message]
2022-12-16 13:50       ` Hawa, Hanna
2022-12-16 14:46         ` Andy Shevchenko
2022-12-19 19:35           ` Hawa, Hanna
2022-12-20 10:54             ` Andy Shevchenko
2022-12-14 19:14 ` kernel test robot
2022-12-15  0:17 ` kernel test robot

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=Y5s7ofYGaec8+zIA@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=benh@amazon.com \
    --cc=dwmw@amazon.co.uk \
    --cc=farbere@amazon.com \
    --cc=hanochu@amazon.com \
    --cc=hhhawa@amazon.com \
    --cc=itamark@amazon.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jonnyc@amazon.com \
    --cc=jsd@semihalf.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=ronenk@amazon.com \
    --cc=talel@amazon.com \
    --cc=wsa@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 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.