Re: [PATCH] i2c: algo-pca: Reapply i2c bus settings after reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux