lkml.org 
[lkml]   [2013]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/2] i2c designware make SCL and SDA falling time configurable
    On 09/10/13 18:55, Mika Westerberg wrote:
    > On Tue, Oct 08, 2013 at 05:00:54PM +0200, Romain Baeriswyl wrote:
    >> static void __i2c_dw_enable(struct dw_i2c_dev *dev, bool enable)
    >> @@ -286,6 +287,7 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
    >> u32 input_clock_khz;
    >> u32 hcnt, lcnt;
    >> u32 reg;
    >> + u32 sda_falling_time, scl_falling_time;
    >>
    >> input_clock_khz = dev->get_clk_rate_khz(dev);
    >>
    >> @@ -307,15 +309,25 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
    >>
    >> /* set standard and fast speed deviders for high/low periods */
    >>
    >> + if (dev->sda_falling_time)
    >> + sda_falling_time = dev->sda_falling_time;
    >> + else
    >> + sda_falling_time = 300; /* ns */
    >
    > I think this looks better:
    >
    > sda_falling_time = dev->sda_falling_time ? dev->sda_falling_time : 300;

    You can also use the gcc-ism, which is a bit more concise:

    sda_falling_time = dev->sda_falling_time ?: 300;

    ~Ryan



    \
     
     \ /
      Last update: 2013-10-10 03:41    [W:3.071 / U:0.524 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site