summaryrefslogtreecommitdiff
path: root/include/linux/spi
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2022-02-01 20:39:36 +0300
committerMark Brown <broonie@kernel.org>2022-02-01 20:39:36 +0300
commit70ee8d48f465b0e8dbbfe38f4c854ffa2aeb06ba (patch)
treee7d2a436c5083f0d09426e2eeb8a432d38713d6d /include/linux/spi
parentb651d1da86aa525c5a5b2bd61f528353c28d589d (diff)
parente612af7acef2459f1afd885f4107748995a05963 (diff)
downloadlinux-70ee8d48f465b0e8dbbfe38f4c854ffa2aeb06ba.tar.xz
spi: Enhance and export helpers for ACPI resources
Merge series from Stefan Binding <sbinding@opensource.cirrus.com>: This series enhances the helpers for ACPI resources to cope with multiple resources and exports them for use in the x86 platform code's multi-instantiate driver.
Diffstat (limited to 'include/linux/spi')
-rw-r--r--include/linux/spi/spi.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 7ab3fed7b804..394b4241d989 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -16,6 +16,7 @@
#include <linux/gpio/consumer.h>
#include <uapi/linux/spi/spi.h>
+#include <linux/acpi.h>
struct dma_chan;
struct software_node;
@@ -759,6 +760,13 @@ extern int devm_spi_register_controller(struct device *dev,
struct spi_controller *ctlr);
extern void spi_unregister_controller(struct spi_controller *ctlr);
+#if IS_ENABLED(CONFIG_ACPI)
+extern struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
+ struct acpi_device *adev,
+ int index);
+int acpi_spi_count_resources(struct acpi_device *adev);
+#endif
+
/*
* SPI resource management while processing a SPI message
*/
@@ -1452,8 +1460,20 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n)
* use spi_new_device() to describe each device. You can also call
* spi_unregister_device() to start making that device vanish, but
* normally that would be handled by spi_unregister_controller().
+ *
+ * You can also use spi_alloc_device() and spi_add_device() to use a two
+ * stage registration sequence for each spi_device. This gives the caller
+ * some more control over the spi_device structure before it is registered,
+ * but requires that caller to initialize fields that would otherwise
+ * be defined using the board info.
*/
extern struct spi_device *
+spi_alloc_device(struct spi_controller *ctlr);
+
+extern int
+spi_add_device(struct spi_device *spi);
+
+extern struct spi_device *
spi_new_device(struct spi_controller *, struct spi_board_info *);
extern void spi_unregister_device(struct spi_device *spi);