Re: [PATCH v6] i2c: rk3x: handle dynamic clock rate changes correctly

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

 



Max,

On Tue, Nov 18, 2014 at 3:18 PM, Max Schwarz <max.schwarz@xxxxxxxxx> wrote:
> -static int rk3x_i2c_calc_divs(unsigned long i2c_rate, unsigned long scl_rate,
> -                              unsigned long *div_low, unsigned long *div_high)
> +/**
> + * Calculate divider values for desired SCL frequency
> + *
> + * @clk_rate: I2C input clock rate
> + * @scl_rate: Desired SCL rate
> + * @div_low: Divider output for low
> + * @div_high: Divider output for high
> + *
> + * Returns: 0 on success, -EINVAL on unreachable SCL rate. In that case
> + * a best-effort divider value is returned in divs.

I don't think it's returning a best-effort divider with your current
pach.  It will return an error and leave the "div_high" or "div_low"
as some value > 0xffff.

I'll also note that your patch doesn't fix the bug in the old code
that a divider of 0xffff exactly is considered an error.

I kinda doubt that anyone ever trips this condition, but I figured I'd
mention it.

-Doug
--
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