Re: [PATCH] i2c: designware: Fix false warning from i2c_dw_clk_rate()

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

 



On Thu, 2017-05-11 at 15:49 +0300, Jarkko Nikula wrote:
> Commit bd698d24b1b5 ("i2c: designware: Get selected speed mode
> sda-hold-time via ACPI") causes a false warning from i2c_dw_clk_rate()
> in case platform doesn't provide explicit input clock but provides
> valid
> SCL timing parameters via ACPI.
> 
> After above commit timing parameters only for the selected speed is
> get
> but code in i2c_dw_init() tries to calculate missing parameters using
> the input clock which leads to a warning when there is no input clock
> defined.
> 
> Fix this by reordering the code such a way that timing parameters
> validation/calculation and setting is done for the selected speed
> only.
> While at it do the calculation only once during the first call.

> +static void i2c_dw_set_timings(struct dw_i2c_dev *dev)
> +{
> +	u32 reg;
> +
> +	/* set standard and fast speed deviders for high/low periods
> */
> +	dev->sda_falling_time = dev->sda_falling_time ?: 300; /* ns
> */
> +	dev->scl_falling_time = dev->scl_falling_time ?: 300; /* ns
> */
> +
> +	switch (dev->master_cfg & DW_IC_CON_SPEED_MASK) {
> +	case DW_IC_CON_SPEED_STD:
> +		i2c_dw_set_timings_sm(dev);
> +		break;
> +	case DW_IC_CON_SPEED_FAST:
> +		i2c_dw_set_timings_fm(dev);
> +		break;
> +	case DW_IC_CON_SPEED_HIGH:
> +		i2c_dw_set_timings_hsm(dev);
> +		break;
>  	}

I would put same suffixes to the helper functions, i.e.
_sm -> _std
_fm -> _fast
_hsm-> _high

> +}

-- 
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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