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

Commit bd698d24 authored by chin.yew.tan@intel.com's avatar chin.yew.tan@intel.com Committed by Wolfram Sang
Browse files

i2c: designware: Get selected speed mode sda-hold-time via ACPI



Sda-hold-time is an important parameter for tuning i2c to meet the
electrical specification especially for high speed. I2C with incorrect
sda-hold-time may cause lost arbitration error. Instead of loading all
speed mode settings, only selected speed mode settings are loaded.

Signed-off-by: default avatarTan Chin Yew <chin.yew.tan@intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 2a03d499
Loading
Loading
Loading
Loading
+22 −9
Original line number Diff line number Diff line
@@ -85,7 +85,6 @@ static void dw_i2c_acpi_params(struct platform_device *pdev, char method[],

		*hcnt = (u16)objs[0].integer.value;
		*lcnt = (u16)objs[1].integer.value;
		if (sda_hold)
		*sda_hold = (u32)objs[2].integer.value;
	}

@@ -105,14 +104,28 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
	dev->rx_fifo_depth = 32;

	/*
	 * Try to get SDA hold time and *CNT values from an ACPI method if
	 * it exists for both supported speed modes.
	 * Try to get SDA hold time and *CNT values from an ACPI method for
	 * selected speed modes.
	 */
	dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev->ss_lcnt, NULL);
	switch (dev->clk_freq) {
	case 100000:
		dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev->ss_lcnt,
				   &dev->sda_hold_time);
		break;
	case 1000000:
		dw_i2c_acpi_params(pdev, "FPCN", &dev->fp_hcnt, &dev->fp_lcnt,
				   &dev->sda_hold_time);
		break;
	case 3400000:
		dw_i2c_acpi_params(pdev, "HSCN", &dev->hs_hcnt, &dev->hs_lcnt,
				   &dev->sda_hold_time);
		break;
	case 400000:
	default:
		dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev->fs_lcnt,
				   &dev->sda_hold_time);
	dw_i2c_acpi_params(pdev, "FPCN", &dev->fp_hcnt, &dev->fp_lcnt, NULL);
	dw_i2c_acpi_params(pdev, "HSCN", &dev->hs_hcnt, &dev->hs_lcnt, NULL);
		break;
	}

	id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->dev);
	if (id && id->driver_data)