[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200901082046.GO1891694@smile.fi.intel.com>
Date: Tue, 1 Sep 2020 11:20:46 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Evan Nimmo <evan.nimmo@...iedtelesis.co.nz>
Cc: wsa@...nel.org, jdelvare@...e.de, jarkko.nikula@...ux.intel.com,
chris.packham@...iedtelesis.co.nz, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] i2c: algo-pca: Reapply i2c bus settings after reset
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
Powered by blists - more mailing lists