public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: John Stultz <john.stultz@linaro.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Wolfram Sang <wsa@kernel.org>,
	linux-i2c@vger.kernel.org
Subject: Re: [PATCH] i2c: designware: Fix functionality in !CONFIG_ACPI case
Date: Tue, 23 Jun 2020 11:45:30 +0300	[thread overview]
Message-ID: <20200623084530.GO2428291@smile.fi.intel.com> (raw)
In-Reply-To: <d6c317ee-4f97-9c57-6b04-1eabd814b6ce@linux.intel.com>

On Tue, Jun 23, 2020 at 10:59:40AM +0300, Jarkko Nikula wrote:
> Hi
> 
> On 6/23/20 5:51 AM, John Stultz wrote:
> > On the HiKey board, where CONFIG_ACPI is not set, we started
> > to see a graphics regression where the adv7511 HDMI bridge driver
> > wasn't probing. This was due to the i2c bus failing to start up.
> > 
> > I bisected the problem down to commit f9288fcc5c615 ("i2c:
> > designware: Move ACPI parts into common module") and after
> > looking at it a bit, I realized that change moved some
> > initialization into i2c_dw_acpi_adjust_bus_speed(). However,
> > i2c_dw_acpi_adjust_bus_speed() is only functional if CONFIG_ACPI
> > is set.
> > 
> > This patch pulls i2c_dw_acpi_adjust_bus_speed() out of the
> > ifdef CONFIG_ACPI conditional, and gets the board working again.
> > 
> > Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> > Cc: Wolfram Sang <wsa@kernel.org>
> > Cc: linux-i2c@vger.kernel.org
> > Fixes: f9288fcc5c615 ("i2c: designware: Move ACPI parts into common module")
> > Signed-off-by: John Stultz <john.stultz@linaro.org>
> > ---
> >   drivers/i2c/busses/i2c-designware-common.c | 4 ++--
> >   drivers/i2c/busses/i2c-designware-core.h   | 3 +--
> >   2 files changed, 3 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c
> > index e3a8640db7da..33de185e15f2 100644
> > --- a/drivers/i2c/busses/i2c-designware-common.c
> > +++ b/drivers/i2c/busses/i2c-designware-common.c
> > @@ -286,6 +286,8 @@ int i2c_dw_acpi_configure(struct device *device)
> >   }
> >   EXPORT_SYMBOL_GPL(i2c_dw_acpi_configure);
> > +#endif	/* CONFIG_ACPI */
> > +
> 
> I think the regression is in these lines below that were moved from probe to
> i2c_dw_acpi_adjust_bus_speed() and cause that neither "cloock-frequency"
> device property or I2C_MAX_FAST_MODE_FREQ affect the bus speed when
> CONFIG_ACPI is not set.
> 
> +       /*
> +        * Find bus speed from the "clock-frequency" device property, ACPI
> +        * or by using fast mode if neither is set.
> +        */
> +       if (acpi_speed && t->bus_freq_hz)
> +               t->bus_freq_hz = min(t->bus_freq_hz, acpi_speed);
> +       else if (acpi_speed || t->bus_freq_hz)
> +               t->bus_freq_hz = max(t->bus_freq_hz, acpi_speed);
> +       else
> +               t->bus_freq_hz = I2C_MAX_FAST_MODE_FREQ;
> 
> Andy: what you think should the i2c_dw_acpi_adjust_bus_speed() fixed to
> return adjusted speed or zero if not found (also for !CONFIG_ACPI) and move
> above lines back to probe? It looks more clear to me that way and should fix
> the regression I think.

I have split it to two functions and renamed accordingly. Will send patch soon,
after some testing.

-- 
With Best Regards,
Andy Shevchenko



      parent reply	other threads:[~2020-06-23  8:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23  2:51 [PATCH] i2c: designware: Fix functionality in !CONFIG_ACPI case John Stultz
2020-06-23  7:59 ` Jarkko Nikula
2020-06-23  8:33   ` Jarkko Nikula
2020-06-23  8:45   ` Andy Shevchenko [this message]

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=20200623084530.GO2428291@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox