summaryrefslogtreecommitdiffstats
path: root/include/linux/spi
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2023-02-01 16:56:47 +0000
committerMark Brown <broonie@kernel.org>2023-02-01 16:56:47 +0000
commitbf7499553732e68d1b3156ae9ce494c6ab9668d1 (patch)
treebd0c1fe9b2db451afa18b8a99bb5ea44898b260f /include/linux/spi
parentd4bde04318c0d33705e9a77d4c7df72f262011e0 (diff)
parent303feb3cc06ac0665d0ee9c1414941200e60e8a3 (diff)
downloadlinux-stable-bf7499553732e68d1b3156ae9ce494c6ab9668d1.tar.gz
linux-stable-bf7499553732e68d1b3156ae9ce494c6ab9668d1.tar.bz2
linux-stable-bf7499553732e68d1b3156ae9ce494c6ab9668d1.zip
spi: Abstract access to chip selects
Merge series from Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>: In preparation for supporting devices with multiple chip selects add an interface for accessing the chip selects via a function.
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 9a32495fbb1f..9b23a1d0dd0d 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -263,6 +263,26 @@ static inline void *spi_get_drvdata(struct spi_device *spi)
return dev_get_drvdata(&spi->dev);
}
+static inline u8 spi_get_chipselect(struct spi_device *spi, u8 idx)
+{
+ return spi->chip_select;
+}
+
+static inline void spi_set_chipselect(struct spi_device *spi, u8 idx, u8 chipselect)
+{
+ spi->chip_select = chipselect;
+}
+
+static inline struct gpio_desc *spi_get_csgpiod(struct spi_device *spi, u8 idx)
+{
+ return spi->cs_gpiod;
+}
+
+static inline void spi_set_csgpiod(struct spi_device *spi, u8 idx, struct gpio_desc *csgpiod)
+{
+ spi->cs_gpiod = csgpiod;
+}
+
struct spi_message;
/**