summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-03-23 15:11:12 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-03-23 15:11:12 -0700
commit40037e4f8b2f7d33b8d266f139bf345962c48d46 (patch)
tree177880adcf13999593f2f09ed4432b665e4868bd /drivers
parent182966e1cd74ec0e326cd376de241803ee79741b (diff)
parentef248d9bd616b04df8be25539a4dc5db4b6c56f4 (diff)
downloadlinux-40037e4f8b2f7d33b8d266f139bf345962c48d46.tar.bz2
Merge tag 'sound-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai: "It's been a fairly calm development cycle. There are a few last-minute ALSA core fixes, most notably for covering PCM ioctl races, but the most of rest are device-specific changes. Below are some highlights: ALSA core: - Fixes for PCM ioctl races that may lead to UAF - Fix for oversized allocations in PCM OSS layer ASoC: - Start of moving SoF to support multiple IPC mechanisms - Use of NHLT ACPI table to reduce the amount of quirking required for Intel systems - Preliminary works forthcoming Intel AVS driver for legacy Intel DSP firmwares - Support for AMD PDM, Atmel PDMC, Awinic AW8738, i.MX cards with TLV320AIC31xx, Intel machines with CS35L41 and ESSX8336, Mediatek MT8181 wideband bluetooth, nVidia Tegra234, Qualcomm SC7280, Renesas RZ/V2L, Texas Instruments TAS585M HD-audio: - Driver re-binding fix for HD-audio - Updates for Intel ADL and Tegra234, various platform quirks for Dell, HP, Lenovo, ASUS, Samsung and Clevo machines USB-audio: - Quirk updates for Scarlett2, RODE, Corsair devices" * tag 'sound-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (486 commits) ALSA: hda/realtek: Add alc256-samsung-headphone fixup ALSA: pci: fix reading of swapped values from pcmreg in AC97 codec ALSA: pcm: Add stream lock during PCM reset ioctl operations ALSA: pcm: Fix races among concurrent prealloc proc writes ALSA: pcm: Fix races among concurrent prepare and hw_params/hw_free calls ALSA: pcm: Fix races among concurrent read/write and buffer changes ALSA: pcm: Fix races among concurrent hw_params and hw_free calls ASoC: atmel: mchp-pdmc: print the correct property name MAINTAINERS: Add Shengjiu to maintainer list of sound/soc/fsl ASoC: SOF: Add a new dai_get_clk topology IPC op ASoC: SOF: topology: Add ops for setting up and tearing down pipelines ASoC: SOF: expose sof_route_setup() ASoC: SOF: Add dai_link_fixup PCM op for IPC3 ASoC: SOF: Add trigger PCM op for IPC3 ASoC: SOF: Define hw_params PCM op for IPC3 ASoC: SOF: Introduce IPC3 PCM hw_free op ASoC: SOF: pcm: expose the sof_pcm_setup_connected_widgets() function ASoC: SOF: Introduce IPC-specific PCM ops ASoC: SOF: Add bytes_ext control IPC ops for IPC3 ASoC: SOF: Add bytes_get/put control IPC ops for IPC3 ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/scan.c16
-rw-r--r--drivers/gpu/drm/rockchip/cdn-dp-core.c28
-rw-r--r--drivers/gpu/drm/rockchip/cdn-dp-core.h4
-rw-r--r--drivers/platform/x86/Kconfig12
-rw-r--r--drivers/platform/x86/Makefile2
-rw-r--r--drivers/platform/x86/i2c-multi-instantiate.c174
-rw-r--r--drivers/platform/x86/serial-multi-instantiate.c348
-rw-r--r--drivers/soundwire/dmi-quirks.c2
8 files changed, 398 insertions, 188 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 5ffd87ac42b3..c116e3a65ab4 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1735,17 +1735,21 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)
bool is_serial_bus_slave = false;
static const struct acpi_device_id ignore_serial_bus_ids[] = {
/*
- * These devices have multiple I2cSerialBus resources and an i2c-client
- * must be instantiated for each, each with its own i2c_device_id.
- * Normally we only instantiate an i2c-client for the first resource,
- * using the ACPI HID as id. These special cases are handled by the
- * drivers/platform/x86/i2c-multi-instantiate.c driver, which knows
- * which i2c_device_id to use for each resource.
+ * These devices have multiple SerialBus resources and a client
+ * device must be instantiated for each of them, each with
+ * its own device id.
+ * Normally we only instantiate one client device for the first
+ * resource, using the ACPI HID as id. These special cases are handled
+ * by the drivers/platform/x86/serial-multi-instantiate.c driver, which
+ * knows which client device id to use for each resource.
*/
{"BSG1160", },
{"BSG2150", },
+ {"CSC3551", },
{"INT33FE", },
{"INT3515", },
+ /* Non-conforming _HID for Cirrus Logic already released */
+ {"CLSA0100", },
/*
* HIDs of device with an UartSerialBusV2 resource for which userspace
* expects a regular tty cdev to be created (instead of the in kernel
diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index 16497c31d9f9..edd6a1fc46cd 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -586,6 +586,13 @@ static bool cdn_dp_check_link_status(struct cdn_dp_device *dp)
return drm_dp_channel_eq_ok(link_status, min(port->lanes, sink_lanes));
}
+static void cdn_dp_audio_handle_plugged_change(struct cdn_dp_device *dp,
+ bool plugged)
+{
+ if (dp->codec_dev)
+ dp->plugged_cb(dp->codec_dev, plugged);
+}
+
static void cdn_dp_encoder_enable(struct drm_encoder *encoder)
{
struct cdn_dp_device *dp = encoder_to_dp(encoder);
@@ -641,6 +648,9 @@ static void cdn_dp_encoder_enable(struct drm_encoder *encoder)
DRM_DEV_ERROR(dp->dev, "Failed to valid video %d\n", ret);
goto out;
}
+
+ cdn_dp_audio_handle_plugged_change(dp, true);
+
out:
mutex_unlock(&dp->lock);
}
@@ -651,6 +661,8 @@ static void cdn_dp_encoder_disable(struct drm_encoder *encoder)
int ret;
mutex_lock(&dp->lock);
+ cdn_dp_audio_handle_plugged_change(dp, false);
+
if (dp->active) {
ret = cdn_dp_disable(dp);
if (ret) {
@@ -846,11 +858,27 @@ static int cdn_dp_audio_get_eld(struct device *dev, void *data,
return 0;
}
+static int cdn_dp_audio_hook_plugged_cb(struct device *dev, void *data,
+ hdmi_codec_plugged_cb fn,
+ struct device *codec_dev)
+{
+ struct cdn_dp_device *dp = dev_get_drvdata(dev);
+
+ mutex_lock(&dp->lock);
+ dp->plugged_cb = fn;
+ dp->codec_dev = codec_dev;
+ cdn_dp_audio_handle_plugged_change(dp, dp->connected);
+ mutex_unlock(&dp->lock);
+
+ return 0;
+}
+
static const struct hdmi_codec_ops audio_codec_ops = {
.hw_params = cdn_dp_audio_hw_params,
.audio_shutdown = cdn_dp_audio_shutdown,
.mute_stream = cdn_dp_audio_mute_stream,
.get_eld = cdn_dp_audio_get_eld,
+ .hook_plugged_cb = cdn_dp_audio_hook_plugged_cb,
.no_capture_mute = 1,
};
diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.h b/drivers/gpu/drm/rockchip/cdn-dp-core.h
index 81ac9b658a70..d808a9de45ed 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.h
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.h
@@ -10,6 +10,7 @@
#include <drm/drm_dp_helper.h>
#include <drm/drm_panel.h>
#include <drm/drm_probe_helper.h>
+#include <sound/hdmi-codec.h>
#include "rockchip_drm_drv.h"
@@ -101,5 +102,8 @@ struct cdn_dp_device {
u8 dpcd[DP_RECEIVER_CAP_SIZE];
bool sink_has_audio;
+
+ hdmi_codec_plugged_cb plugged_cb;
+ struct device *codec_dev;
};
#endif /* _CDN_DP_CORE_H */
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 24deeeb29af2..8d1eec208854 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -990,16 +990,16 @@ config TOPSTAR_LAPTOP
If you have a Topstar laptop, say Y or M here.
-config I2C_MULTI_INSTANTIATE
- tristate "I2C multi instantiate pseudo device driver"
- depends on I2C && ACPI
+config SERIAL_MULTI_INSTANTIATE
+ tristate "Serial bus multi instantiate pseudo device driver"
+ depends on I2C && SPI && ACPI
help
- Some ACPI-based systems list multiple i2c-devices in a single ACPI
- firmware-node. This driver will instantiate separate i2c-clients
+ Some ACPI-based systems list multiple devices in a single ACPI
+ firmware-node. This driver will instantiate separate clients
for each device in the firmware-node.
To compile this driver as a module, choose M here: the module
- will be called i2c-multi-instantiate.
+ will be called serial-multi-instantiate.
config MLX_PLATFORM
tristate "Mellanox Technologies platform support"
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index c12a9b044fd8..9527088bba7f 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -110,7 +110,7 @@ obj-$(CONFIG_TOPSTAR_LAPTOP) += topstar-laptop.o
# Platform drivers
obj-$(CONFIG_FW_ATTR_CLASS) += firmware_attributes_class.o
-obj-$(CONFIG_I2C_MULTI_INSTANTIATE) += i2c-multi-instantiate.o
+obj-$(CONFIG_SERIAL_MULTI_INSTANTIATE) += serial-multi-instantiate.o
obj-$(CONFIG_MLX_PLATFORM) += mlx-platform.o
obj-$(CONFIG_TOUCHSCREEN_DMI) += touchscreen_dmi.o
obj-$(CONFIG_WIRELESS_HOTKEY) += wireless-hotkey.o
diff --git a/drivers/platform/x86/i2c-multi-instantiate.c b/drivers/platform/x86/i2c-multi-instantiate.c
deleted file mode 100644
index 4956a1df5b90..000000000000
--- a/drivers/platform/x86/i2c-multi-instantiate.c
+++ /dev/null
@@ -1,174 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * I2C multi-instantiate driver, pseudo driver to instantiate multiple
- * i2c-clients from a single fwnode.
- *
- * Copyright 2018 Hans de Goede <hdegoede@redhat.com>
- */
-
-#include <linux/acpi.h>
-#include <linux/bits.h>
-#include <linux/i2c.h>
-#include <linux/interrupt.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/property.h>
-#include <linux/types.h>
-
-#define IRQ_RESOURCE_TYPE GENMASK(1, 0)
-#define IRQ_RESOURCE_NONE 0
-#define IRQ_RESOURCE_GPIO 1
-#define IRQ_RESOURCE_APIC 2
-
-struct i2c_inst_data {
- const char *type;
- unsigned int flags;
- int irq_idx;
-};
-
-struct i2c_multi_inst_data {
- int num_clients;
- struct i2c_client *clients[];
-};
-
-static int i2c_multi_inst_probe(struct platform_device *pdev)
-{
- struct i2c_multi_inst_data *multi;
- const struct i2c_inst_data *inst_data;
- struct i2c_board_info board_info = {};
- struct device *dev = &pdev->dev;
- struct acpi_device *adev;
- char name[32];
- int i, ret;
-
- inst_data = device_get_match_data(dev);
- if (!inst_data) {
- dev_err(dev, "Error ACPI match data is missing\n");
- return -ENODEV;
- }
-
- adev = ACPI_COMPANION(dev);
-
- /* Count number of clients to instantiate */
- ret = i2c_acpi_client_count(adev);
- if (ret < 0)
- return ret;
-
- multi = devm_kmalloc(dev, struct_size(multi, clients, ret), GFP_KERNEL);
- if (!multi)
- return -ENOMEM;
-
- multi->num_clients = ret;
-
- for (i = 0; i < multi->num_clients && inst_data[i].type; i++) {
- memset(&board_info, 0, sizeof(board_info));
- strlcpy(board_info.type, inst_data[i].type, I2C_NAME_SIZE);
- snprintf(name, sizeof(name), "%s-%s.%d", dev_name(dev),
- inst_data[i].type, i);
- board_info.dev_name = name;
- switch (inst_data[i].flags & IRQ_RESOURCE_TYPE) {
- case IRQ_RESOURCE_GPIO:
- ret = acpi_dev_gpio_irq_get(adev, inst_data[i].irq_idx);
- if (ret < 0) {
- dev_err(dev, "Error requesting irq at index %d: %d\n",
- inst_data[i].irq_idx, ret);
- goto error;
- }
- board_info.irq = ret;
- break;
- case IRQ_RESOURCE_APIC:
- ret = platform_get_irq(pdev, inst_data[i].irq_idx);
- if (ret < 0) {
- dev_dbg(dev, "Error requesting irq at index %d: %d\n",
- inst_data[i].irq_idx, ret);
- goto error;
- }
- board_info.irq = ret;
- break;
- default:
- board_info.irq = 0;
- break;
- }
- multi->clients[i] = i2c_acpi_new_device(dev, i, &board_info);
- if (IS_ERR(multi->clients[i])) {
- ret = dev_err_probe(dev, PTR_ERR(multi->clients[i]),
- "Error creating i2c-client, idx %d\n", i);
- goto error;
- }
- }
- if (i < multi->num_clients) {
- dev_err(dev, "Error finding driver, idx %d\n", i);
- ret = -ENODEV;
- goto error;
- }
-
- platform_set_drvdata(pdev, multi);
- return 0;
-
-error:
- while (--i >= 0)
- i2c_unregister_device(multi->clients[i]);
-
- return ret;
-}
-
-static int i2c_multi_inst_remove(struct platform_device *pdev)
-{
- struct i2c_multi_inst_data *multi = platform_get_drvdata(pdev);
- int i;
-
- for (i = 0; i < multi->num_clients; i++)
- i2c_unregister_device(multi->clients[i]);
-
- return 0;
-}
-
-static const struct i2c_inst_data bsg1160_data[] = {
- { "bmc150_accel", IRQ_RESOURCE_GPIO, 0 },
- { "bmc150_magn" },
- { "bmg160" },
- {}
-};
-
-static const struct i2c_inst_data bsg2150_data[] = {
- { "bmc150_accel", IRQ_RESOURCE_GPIO, 0 },
- { "bmc150_magn" },
- /* The resources describe a 3th client, but it is not really there. */
- { "bsg2150_dummy_dev" },
- {}
-};
-
-static const struct i2c_inst_data int3515_data[] = {
- { "tps6598x", IRQ_RESOURCE_APIC, 0 },
- { "tps6598x", IRQ_RESOURCE_APIC, 1 },
- { "tps6598x", IRQ_RESOURCE_APIC, 2 },
- { "tps6598x", IRQ_RESOURCE_APIC, 3 },
- {}
-};
-
-/*
- * Note new device-ids must also be added to i2c_multi_instantiate_ids in
- * drivers/acpi/scan.c: acpi_device_enumeration_by_parent().
- */
-static const struct acpi_device_id i2c_multi_inst_acpi_ids[] = {
- { "BSG1160", (unsigned long)bsg1160_data },
- { "BSG2150", (unsigned long)bsg2150_data },
- { "INT3515", (unsigned long)int3515_data },
- { }
-};
-MODULE_DEVICE_TABLE(acpi, i2c_multi_inst_acpi_ids);
-
-static struct platform_driver i2c_multi_inst_driver = {
- .driver = {
- .name = "I2C multi instantiate pseudo device driver",
- .acpi_match_table = i2c_multi_inst_acpi_ids,
- },
- .probe = i2c_multi_inst_probe,
- .remove = i2c_multi_inst_remove,
-};
-module_platform_driver(i2c_multi_inst_driver);
-
-MODULE_DESCRIPTION("I2C multi instantiate pseudo device driver");
-MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
-MODULE_LICENSE("GPL");
diff --git a/drivers/platform/x86/serial-multi-instantiate.c b/drivers/platform/x86/serial-multi-instantiate.c
new file mode 100644
index 000000000000..1e8063b7c169
--- /dev/null
+++ b/drivers/platform/x86/serial-multi-instantiate.c
@@ -0,0 +1,348 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Serial multi-instantiate driver, pseudo driver to instantiate multiple
+ * client devices from a single fwnode.
+ *
+ * Copyright 2018 Hans de Goede <hdegoede@redhat.com>
+ */
+
+#include <linux/acpi.h>
+#include <linux/bits.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/property.h>
+#include <linux/spi/spi.h>
+#include <linux/types.h>
+
+#define IRQ_RESOURCE_TYPE GENMASK(1, 0)
+#define IRQ_RESOURCE_NONE 0
+#define IRQ_RESOURCE_GPIO 1
+#define IRQ_RESOURCE_APIC 2
+
+enum smi_bus_type {
+ SMI_I2C,
+ SMI_SPI,
+ SMI_AUTO_DETECT,
+};
+
+struct smi_instance {
+ const char *type;
+ unsigned int flags;
+ int irq_idx;
+};
+
+struct smi_node {
+ enum smi_bus_type bus_type;
+ struct smi_instance instances[];
+};
+
+struct smi {
+ int i2c_num;
+ int spi_num;
+ struct i2c_client **i2c_devs;
+ struct spi_device **spi_devs;
+};
+
+static int smi_get_irq(struct platform_device *pdev, struct acpi_device *adev,
+ const struct smi_instance *inst)
+{
+ int ret;
+
+ switch (inst->flags & IRQ_RESOURCE_TYPE) {
+ case IRQ_RESOURCE_GPIO:
+ ret = acpi_dev_gpio_irq_get(adev, inst->irq_idx);
+ break;
+ case IRQ_RESOURCE_APIC:
+ ret = platform_get_irq(pdev, inst->irq_idx);
+ break;
+ default:
+ return 0;
+ }
+
+ if (ret < 0)
+ dev_err_probe(&pdev->dev, ret, "Error requesting irq at index %d: %d\n",
+ inst->irq_idx, ret);
+
+ return ret;
+}
+
+static void smi_devs_unregister(struct smi *smi)
+{
+ while (smi->i2c_num > 0)
+ i2c_unregister_device(smi->i2c_devs[--smi->i2c_num]);
+
+ while (smi->spi_num > 0)
+ spi_unregister_device(smi->spi_devs[--smi->spi_num]);
+}
+
+/**
+ * smi_spi_probe - Instantiate multiple SPI devices from inst array
+ * @pdev: Platform device
+ * @adev: ACPI device
+ * @smi: Internal struct for Serial multi instantiate driver
+ * @inst_array: Array of instances to probe
+ *
+ * Returns the number of SPI devices instantiate, Zero if none is found or a negative error code.
+ */
+static int smi_spi_probe(struct platform_device *pdev, struct acpi_device *adev, struct smi *smi,
+ const struct smi_instance *inst_array)
+{
+ struct device *dev = &pdev->dev;
+ struct spi_controller *ctlr;
+ struct spi_device *spi_dev;
+ char name[50];
+ int i, ret, count;
+
+ ret = acpi_spi_count_resources(adev);
+ if (ret < 0)
+ return ret;
+ else if (!ret)
+ return -ENODEV;
+
+ count = ret;
+
+ smi->spi_devs = devm_kcalloc(dev, count, sizeof(*smi->spi_devs), GFP_KERNEL);
+ if (!smi->spi_devs)
+ return -ENOMEM;
+
+ for (i = 0; i < count && inst_array[i].type; i++) {
+
+ spi_dev = acpi_spi_device_alloc(NULL, adev, i);
+ if (IS_ERR(spi_dev)) {
+ ret = PTR_ERR(spi_dev);
+ dev_err_probe(dev, ret, "failed to allocate SPI device %s from ACPI: %d\n",
+ dev_name(&adev->dev), ret);
+ goto error;
+ }
+
+ ctlr = spi_dev->controller;
+
+ strscpy(spi_dev->modalias, inst_array[i].type, sizeof(spi_dev->modalias));
+
+ ret = smi_get_irq(pdev, adev, &inst_array[i]);
+ if (ret < 0) {
+ spi_dev_put(spi_dev);
+ goto error;
+ }
+ spi_dev->irq = ret;
+
+ snprintf(name, sizeof(name), "%s-%s-%s.%d", dev_name(&ctlr->dev), dev_name(dev),
+ inst_array[i].type, i);
+ spi_dev->dev.init_name = name;
+
+ ret = spi_add_device(spi_dev);
+ if (ret) {
+ dev_err_probe(&ctlr->dev, ret,
+ "failed to add SPI device %s from ACPI: %d\n",
+ dev_name(&adev->dev), ret);
+ spi_dev_put(spi_dev);
+ goto error;
+ }
+
+ dev_dbg(dev, "SPI device %s using chip select %u", name, spi_dev->chip_select);
+
+ smi->spi_devs[i] = spi_dev;
+ smi->spi_num++;
+ }
+
+ if (smi->spi_num < count) {
+ dev_dbg(dev, "Error finding driver, idx %d\n", i);
+ ret = -ENODEV;
+ goto error;
+ }
+
+ dev_info(dev, "Instantiated %d SPI devices.\n", smi->spi_num);
+
+ return 0;
+error:
+ smi_devs_unregister(smi);
+
+ return ret;
+}
+
+/**
+ * smi_i2c_probe - Instantiate multiple I2C devices from inst array
+ * @pdev: Platform device
+ * @adev: ACPI device
+ * @smi: Internal struct for Serial multi instantiate driver
+ * @inst_array: Array of instances to probe
+ *
+ * Returns the number of I2C devices instantiate, Zero if none is found or a negative error code.
+ */
+static int smi_i2c_probe(struct platform_device *pdev, struct acpi_device *adev, struct smi *smi,
+ const struct smi_instance *inst_array)
+{
+ struct i2c_board_info board_info = {};
+ struct device *dev = &pdev->dev;
+ char name[32];
+ int i, ret, count;
+
+ ret = i2c_acpi_client_count(adev);
+ if (ret < 0)
+ return ret;
+ else if (!ret)
+ return -ENODEV;
+
+ count = ret;
+
+ smi->i2c_devs = devm_kcalloc(dev, count, sizeof(*smi->i2c_devs), GFP_KERNEL);
+ if (!smi->i2c_devs)
+ return -ENOMEM;
+
+ for (i = 0; i < count && inst_array[i].type; i++) {
+ memset(&board_info, 0, sizeof(board_info));
+ strscpy(board_info.type, inst_array[i].type, I2C_NAME_SIZE);
+ snprintf(name, sizeof(name), "%s-%s.%d", dev_name(dev), inst_array[i].type, i);
+ board_info.dev_name = name;
+
+ ret = smi_get_irq(pdev, adev, &inst_array[i]);
+ if (ret < 0)
+ goto error;
+ board_info.irq = ret;
+
+ smi->i2c_devs[i] = i2c_acpi_new_device(dev, i, &board_info);
+ if (IS_ERR(smi->i2c_devs[i])) {
+ ret = dev_err_probe(dev, PTR_ERR(smi->i2c_devs[i]),
+ "Error creating i2c-client, idx %d\n", i);
+ goto error;
+ }
+ smi->i2c_num++;
+ }
+ if (smi->i2c_num < count) {
+ dev_dbg(dev, "Error finding driver, idx %d\n", i);
+ ret = -ENODEV;
+ goto error;
+ }
+
+ dev_info(dev, "Instantiated %d I2C devices.\n", smi->i2c_num);
+
+ return 0;
+error:
+ smi_devs_unregister(smi);
+
+ return ret;
+}
+
+static int smi_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ const struct smi_node *node;
+ struct acpi_device *adev;
+ struct smi *smi;
+
+ adev = ACPI_COMPANION(dev);
+ if (!adev)
+ return -ENODEV;
+
+ node = device_get_match_data(dev);
+ if (!node) {
+ dev_dbg(dev, "Error ACPI match data is missing\n");
+ return -ENODEV;
+ }
+
+ smi = devm_kzalloc(dev, sizeof(*smi), GFP_KERNEL);
+ if (!smi)
+ return -ENOMEM;
+
+ platform_set_drvdata(pdev, smi);
+
+ switch (node->bus_type) {
+ case SMI_I2C:
+ return smi_i2c_probe(pdev, adev, smi, node->instances);
+ case SMI_SPI:
+ return smi_spi_probe(pdev, adev, smi, node->instances);
+ case SMI_AUTO_DETECT:
+ if (i2c_acpi_client_count(adev) > 0)
+ return smi_i2c_probe(pdev, adev, smi, node->instances);
+ else
+ return smi_spi_probe(pdev, adev, smi, node->instances);
+ default:
+ return -EINVAL;
+ }
+
+ return 0; /* never reached */
+}
+
+static int smi_remove(struct platform_device *pdev)
+{
+ struct smi *smi = platform_get_drvdata(pdev);
+
+ smi_devs_unregister(smi);
+
+ return 0;
+}
+
+static const struct smi_node bsg1160_data = {
+ .instances = {
+ { "bmc150_accel", IRQ_RESOURCE_GPIO, 0 },
+ { "bmc150_magn" },
+ { "bmg160" },
+ {}
+ },
+ .bus_type = SMI_I2C,
+};
+
+static const struct smi_node bsg2150_data = {
+ .instances = {
+ { "bmc150_accel", IRQ_RESOURCE_GPIO, 0 },
+ { "bmc150_magn" },
+ /* The resources describe a 3th client, but it is not really there. */
+ { "bsg2150_dummy_dev" },
+ {}
+ },
+ .bus_type = SMI_I2C,
+};
+
+static const struct smi_node int3515_data = {
+ .instances = {
+ { "tps6598x", IRQ_RESOURCE_APIC, 0 },
+ { "tps6598x", IRQ_RESOURCE_APIC, 1 },
+ { "tps6598x", IRQ_RESOURCE_APIC, 2 },
+ { "tps6598x", IRQ_RESOURCE_APIC, 3 },
+ {}
+ },
+ .bus_type = SMI_I2C,
+};
+
+static const struct smi_node cs35l41_hda = {
+ .instances = {
+ { "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 },
+ { "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 },
+ { "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 },
+ { "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 },
+ {}
+ },
+ .bus_type = SMI_AUTO_DETECT,
+};
+
+/*
+ * Note new device-ids must also be added to ignore_serial_bus_ids in
+ * drivers/acpi/scan.c: acpi_device_enumeration_by_parent().
+ */
+static const struct acpi_device_id smi_acpi_ids[] = {
+ { "BSG1160", (unsigned long)&bsg1160_data },
+ { "BSG2150", (unsigned long)&bsg2150_data },
+ { "INT3515", (unsigned long)&int3515_data },
+ { "CSC3551", (unsigned long)&cs35l41_hda },
+ /* Non-conforming _HID for Cirrus Logic already released */
+ { "CLSA0100", (unsigned long)&cs35l41_hda },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, smi_acpi_ids);
+
+static struct platform_driver smi_driver = {
+ .driver = {
+ .name = "Serial bus multi instantiate pseudo device driver",
+ .acpi_match_table = smi_acpi_ids,
+ },
+ .probe = smi_probe,
+ .remove = smi_remove,
+};
+module_platform_driver(smi_driver);
+
+MODULE_DESCRIPTION("Serial multi instantiate pseudo device driver");
+MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
+MODULE_LICENSE("GPL");
diff --git a/drivers/soundwire/dmi-quirks.c b/drivers/soundwire/dmi-quirks.c
index 0ca2a3e3a02e..747983743a14 100644
--- a/drivers/soundwire/dmi-quirks.c
+++ b/drivers/soundwire/dmi-quirks.c
@@ -59,7 +59,7 @@ static const struct dmi_system_id adr_remap_quirk_table[] = {
{
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
- DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x360 Convertible"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x360 Conv"),
},
.driver_data = (void *)intel_tgl_bios,
},