Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 548e6695 authored by Weifeng Voon's avatar Weifeng Voon Committed by Wolfram Sang
Browse files

i2c: designware: set the common config before the if else



DW_IC_CON_MASTER, DW_IC_CON_SLAVE_DISABLE and DW_IC_CON_RESTART_EN are
common config that need to be set for i2c designware master. So, configure
it first without having to repeat inside the if else.

Signed-off-by: default avatarWeifeng Voon <weifeng.voon@intel.com>
Signed-off-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent d608c3d9
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -217,12 +217,14 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
		I2C_FUNC_SMBUS_BYTE_DATA |
		I2C_FUNC_SMBUS_WORD_DATA |
		I2C_FUNC_SMBUS_I2C_BLOCK;
	if (dev->clk_freq == 100000)

	dev->master_cfg = DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE |
			DW_IC_CON_RESTART_EN | DW_IC_CON_SPEED_STD;
			  DW_IC_CON_RESTART_EN;

	if (dev->clk_freq == 100000)
		dev->master_cfg |= DW_IC_CON_SPEED_STD;
	else
		dev->master_cfg =  DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE |
			DW_IC_CON_RESTART_EN | DW_IC_CON_SPEED_FAST;
		dev->master_cfg |= DW_IC_CON_SPEED_FAST;

	dev->clk = devm_clk_get(&pdev->dev, NULL);
	if (!i2c_dw_plat_prepare_clk(dev, true)) {