Message ID | 20190430162910.16771-2-ard.biesheuvel@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | synquacer - wire up Atmel SHA204A as RNG in DT and ACPI mode | expand |
On Tue, Apr 30, 2019 at 06:29:05PM +0200, Ard Biesheuvel wrote: > Currently, the I2C ACPI enumeration code only permits the max bus rate > to be discovered before enumerating the slaves on the bus. In some > cases, drivers for slave devices may require this information, e.g., > some ATmel crypto drivers need to generate a so-called wake token > of a fixed duration, regardless of the bus rate. > > So tweak the code so i2c_acpi_lookup_speed() is able to obtain this > information after enumeration as well. > > Cc: Mika Westerberg <mika.westerberg@linux.intel.com> Looks fine by me, Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Adding Jarkko just in case I missed something. > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> > --- > drivers/i2c/i2c-core-acpi.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c > index 272800692088..7240cc07abb4 100644 > --- a/drivers/i2c/i2c-core-acpi.c > +++ b/drivers/i2c/i2c-core-acpi.c > @@ -115,8 +115,7 @@ static int i2c_acpi_do_lookup(struct acpi_device *adev, > struct list_head resource_list; > int ret; > > - if (acpi_bus_get_status(adev) || !adev->status.present || > - acpi_device_enumerated(adev)) > + if (acpi_bus_get_status(adev) || !adev->status.present) > return -EINVAL; > > if (acpi_match_device_ids(adev, i2c_acpi_ignored_device_ids) == 0) > @@ -151,6 +150,9 @@ static int i2c_acpi_get_info(struct acpi_device *adev, > lookup.info = info; > lookup.index = -1; > > + if (acpi_device_enumerated(adev)) > + return -EINVAL; > + > ret = i2c_acpi_do_lookup(adev, &lookup); > if (ret) > return ret; > -- > 2.20.1
diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index 272800692088..7240cc07abb4 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c @@ -115,8 +115,7 @@ static int i2c_acpi_do_lookup(struct acpi_device *adev, struct list_head resource_list; int ret; - if (acpi_bus_get_status(adev) || !adev->status.present || - acpi_device_enumerated(adev)) + if (acpi_bus_get_status(adev) || !adev->status.present) return -EINVAL; if (acpi_match_device_ids(adev, i2c_acpi_ignored_device_ids) == 0) @@ -151,6 +150,9 @@ static int i2c_acpi_get_info(struct acpi_device *adev, lookup.info = info; lookup.index = -1; + if (acpi_device_enumerated(adev)) + return -EINVAL; + ret = i2c_acpi_do_lookup(adev, &lookup); if (ret) return ret;
Currently, the I2C ACPI enumeration code only permits the max bus rate to be discovered before enumerating the slaves on the bus. In some cases, drivers for slave devices may require this information, e.g., some ATmel crypto drivers need to generate a so-called wake token of a fixed duration, regardless of the bus rate. So tweak the code so i2c_acpi_lookup_speed() is able to obtain this information after enumeration as well. Cc: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> --- drivers/i2c/i2c-core-acpi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)