Message ID | 20200224151530.31713-19-andriy.shevchenko@linux.intel.com |
---|---|
State | Superseded |
Headers | show |
Series | [v1,01/40] i2c: qup: Move bus frequency definitions to i2c.h | expand |
Hi Andy! On 2/24/20 5:15 PM, Andy Shevchenko wrote: > Since we have generic definitions for bus frequencies, let's use them. > > Cc: Vladimir Zapolskiy <vz@mleia.com> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/i2c/busses/i2c-lpc2k.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c > index deea18b14add..159ebec5861c 100644 > --- a/drivers/i2c/busses/i2c-lpc2k.c > +++ b/drivers/i2c/busses/i2c-lpc2k.c > @@ -396,7 +396,7 @@ static int i2c_lpc2k_probe(struct platform_device *pdev) > ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", > &bus_clk_rate); > if (ret) > - bus_clk_rate = 100000; /* 100 kHz default clock rate */ > + bus_clk_rate = I2C_STANDARD_MODE_FREQ; /* 100 kHz default clock rate */ The line above becomes longer than 80 symbols, please fix it by simply removing the comment, note that it might be an issue through the series. Could I2C_STD_MODE_FREQ be a shorter and still acceptable name? > > clkrate = clk_get_rate(i2c->clk); > if (clkrate == 0) { > @@ -407,9 +407,9 @@ static int i2c_lpc2k_probe(struct platform_device *pdev) > > /* Setup I2C dividers to generate clock with proper duty cycle */ > clkrate = clkrate / bus_clk_rate; > - if (bus_clk_rate <= 100000) > + if (bus_clk_rate <= I2C_STANDARD_MODE_FREQ) > scl_high = (clkrate * I2C_STD_MODE_DUTY) / 100; > - else if (bus_clk_rate <= 400000) > + else if (bus_clk_rate <= I2C_FAST_MODE_FREQ) > scl_high = (clkrate * I2C_FAST_MODE_DUTY) / 100; > else > scl_high = (clkrate * I2C_FAST_MODE_PLUS_DUTY) / 100; > After the requested fix: Acked-by: Vladimir Zapolskiy <vz@mleia.com> -- Best wishes, Vladimir
On Mon, Feb 24, 2020 at 05:35:54PM +0200, Vladimir Zapolskiy wrote: > On 2/24/20 5:15 PM, Andy Shevchenko wrote: > > Since we have generic definitions for bus frequencies, let's use them. > > - bus_clk_rate = 100000; /* 100 kHz default clock rate */ > > + bus_clk_rate = I2C_STANDARD_MODE_FREQ; /* 100 kHz default clock rate */ > > The line above becomes longer than 80 symbols, please fix it by simply > removing the comment, note that it might be an issue through the series. Will do. > Could I2C_STD_MODE_FREQ be a shorter and still acceptable name? I/m fine with it, but I will wait for Wolfram and others to comment. > After the requested fix: > > Acked-by: Vladimir Zapolskiy <vz@mleia.com> Thanks!
diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c index deea18b14add..159ebec5861c 100644 --- a/drivers/i2c/busses/i2c-lpc2k.c +++ b/drivers/i2c/busses/i2c-lpc2k.c @@ -396,7 +396,7 @@ static int i2c_lpc2k_probe(struct platform_device *pdev) ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", &bus_clk_rate); if (ret) - bus_clk_rate = 100000; /* 100 kHz default clock rate */ + bus_clk_rate = I2C_STANDARD_MODE_FREQ; /* 100 kHz default clock rate */ clkrate = clk_get_rate(i2c->clk); if (clkrate == 0) { @@ -407,9 +407,9 @@ static int i2c_lpc2k_probe(struct platform_device *pdev) /* Setup I2C dividers to generate clock with proper duty cycle */ clkrate = clkrate / bus_clk_rate; - if (bus_clk_rate <= 100000) + if (bus_clk_rate <= I2C_STANDARD_MODE_FREQ) scl_high = (clkrate * I2C_STD_MODE_DUTY) / 100; - else if (bus_clk_rate <= 400000) + else if (bus_clk_rate <= I2C_FAST_MODE_FREQ) scl_high = (clkrate * I2C_FAST_MODE_DUTY) / 100; else scl_high = (clkrate * I2C_FAST_MODE_PLUS_DUTY) / 100;
Since we have generic definitions for bus frequencies, let's use them. Cc: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/i2c/busses/i2c-lpc2k.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)