From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Evan Nimmo <evan.nimmo@alliedtelesis.co.nz>
Cc: wsa@kernel.org, jdelvare@suse.de, jarkko.nikula@linux.intel.com,
chris.packham@alliedtelesis.co.nz, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: algo-pca: Reapply i2c bus settings after reset
Date: Tue, 1 Sep 2020 11:20:46 +0300 [thread overview]
Message-ID: <20200901082046.GO1891694@smile.fi.intel.com> (raw)
In-Reply-To: <20200901005713.27453-1-evan.nimmo@alliedtelesis.co.nz>
On Tue, Sep 01, 2020 at 12:57:13PM +1200, Evan Nimmo wrote:
Thanks for the patch, my nit-picks, comments below.
> If something goes wrong (such as the SCL being stuck low) then we need
> to reset the pca chip. The issue with this is that on reset we lose all
pca -> PCA (here and where it applicable below).
> config settings and the chip ends up in a disabled state which results
> in a lock up/high cpu usage. We need to re-apply any configuration that
> had previously been set and re-enable the chip.
...
> + /* We need to apply any configuration settings that
> + * were calculated in the pca_init function. The reset
> + * results in these changes being set back to defaults.
> + */
/*
* Multi-line comments usually go
* like this.
*/
...
> + clock = pca_clock(pca_data);
> +
> + /* Store settings as these will be needed when the pca chip is reset */
> + pca_data->bus_settings.clock_freq = clock;
> +
> pca_reset(pca_data);
>
> - clock = pca_clock(pca_data);
> printk(KERN_INFO "%s: Clock frequency is %dkHz\n",
> adap->name, freqs[clock]);
Seems this message is attached to above call. Can we move it as well?
...
> +/**
> + * struct i2c_bus_settings - The configured i2c bus settings
> + * @mode: Configured i2c bus mode (PCA9665)
> + * @tlow: Configured SCL LOW period (PCA9665)
> + * @thi: Configured SCL HIGH period (PCA9665)
> + * @clock_freq: The configured clock frequency (PCA9564)
> + */
> +struct i2c_bus_settings {
> + int mode;
> + int tlow;
> + int thi;
> + int clock_freq;
> +};
This is a good candidate to have it in generic header for sake of the
unification. Possible users:
struct tegra_i2c_hw_feature
struct cci_data::struct hw_params
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2020-09-01 8:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-01 0:57 [PATCH] i2c: algo-pca: Reapply i2c bus settings after reset Evan Nimmo
2020-09-01 8:20 ` Andy Shevchenko [this message]
2020-09-01 8:46 ` Wolfram Sang
2020-09-01 8:50 ` Andy Shevchenko
2020-09-01 20:58 ` Chris Packham
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=20200901082046.GO1891694@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=chris.packham@alliedtelesis.co.nz \
--cc=evan.nimmo@alliedtelesis.co.nz \
--cc=jarkko.nikula@linux.intel.com \
--cc=jdelvare@suse.de \
--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