Andy Shevchenko
e286044bf5
platform/x86: serial-multi-instantiate: Sort ACPI IDs by HID
...
It's easier to maintain the sorted table.
Keep the sorting order in sync with one in drivers/acpi/scan.c.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20220709211653.18938-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2022-07-10 17:59:57 +02:00
Andy Shevchenko
f3e13bbc6f
platform/x86: serial-multi-instantiate: Get rid of redundant 'else'
...
In the snippets like the following
if (...)
return / goto / break / continue ...;
else
...
the 'else' is redundant. Get rid of it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20220709211653.18938-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2022-07-10 17:59:54 +02:00
Andy Shevchenko
ed7adc2b69
platform/x86: serial-multi-instantiate: Use while (i--) pattern to clean up
...
Use more natural while (i--) patter to clean up allocated resources.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20220709211653.18938-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2022-07-10 17:59:51 +02:00
Andy Shevchenko
14a9aa99ac
platform/x86: serial-multi-instantiate: Improve dev_err_probe() messaging
...
Drop duplicate print of returned value in the messages and use pattern
return dev_err_probe(...) where it's possible.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Link: https://lore.kernel.org/r/20220709211653.18938-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2022-07-10 17:59:44 +02:00
Andy Shevchenko
8b50c48d59
platform/x86: serial-multi-instantiate: Drop duplicate check
...
The device_get_match_data() checks for firmware node to be present,
there is no need to check for ACPI companion.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20220709211653.18938-2-andriy.shevchenko@linux.intel.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2022-07-10 17:59:41 +02:00
Andy Shevchenko
2b5b27826a
platform/x86: serial-multi-instantiate: Improve autodetection
...
Instead of calling specific resource counter, let just probe each
of the type and see what it says. Return -ENOENT if no resources
found.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20220709211653.18938-1-andriy.shevchenko@linux.intel.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2022-07-10 17:59:23 +02:00
Lucas Tanure
d9c01c530c
ACPI / scan: Create platform device for CS35L41
...
The ACPI device with CSC3551 or CLSA0100 are sound cards
with multiple instances of CS35L41 connected by I2C or SPI
to the main CPU.
We add an ID to the ignore_serial_bus_ids list to enumerate
all I2C or SPI devices correctly.
The same IDs are also added into serial-multi-instantiate
so that the driver can correctly enumerate the ACPI.
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com >
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com >
Link: https://lore.kernel.org/r/20220121172431.6876-10-sbinding@opensource.cirrus.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2022-02-02 18:12:41 +01:00
Stefan Binding
68f201f906
platform/x86: serial-multi-instantiate: Add SPI support
...
Add support for spi bus in serial-multi-instantiate driver
Some peripherals can have either a I2C or a SPI connection
to the host (but not both) but use the same HID for both
types. So it is not possible to use the HID to determine
whether it is I2C or SPI. The driver must check the node
to see if it contains I2cSerialBus or SpiSerialBus entries.
For backwards-compatibility with the existing nodes I2C is
checked first and if such entries are found ONLY I2C devices
are created. Since some existing nodes that were already
handled by this driver could also contain unrelated
SpiSerialBus nodes that were previously ignored, and this
preserves that behavior. If there is ever a need to handle
a node where both I2C and SPI devices must be instantiated
this can be added in future.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com >
Link: https://lore.kernel.org/r/20220121172431.6876-8-sbinding@opensource.cirrus.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2022-02-02 18:10:02 +01:00
Lucas Tanure
35a36cbb7b
platform/x86: serial-multi-instantiate: Reorganize I2C functions
...
Reorganize I2C functions to accommodate SPI support
Split the probe and factor out parts of the code
that will be used in the SPI support
Also switched from strlcpy() to strscpy()
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com >
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com >
Link: https://lore.kernel.org/r/20220121172431.6876-7-sbinding@opensource.cirrus.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2022-02-02 18:10:02 +01:00
Lucas Tanure
5e63b2ea3d
platform/x86: i2c-multi-instantiate: Rename it for a generic serial driver name
...
Rename I2C multi instantiate driver to serial-multi-instantiate for
upcoming addition of SPI support
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com >
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com >
Link: https://lore.kernel.org/r/20220121172431.6876-6-sbinding@opensource.cirrus.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2022-02-02 18:10:02 +01:00