Skip to content

Commit

Permalink
spi: export spi_transfer_cs_change_delay_exec function
Browse files Browse the repository at this point in the history
For SPI controller that implements transfer_one_message, it needs to
insert the delay that required by cs change event between the transfers.
Add a wrapper for the local function _spi_transfer_cs_change_delay_exec
and export it for SPI controller driver to use.

Signed-off-by: William Zhang <william.zhang@broadcom.com>
Link: https://lore.kernel.org/r/20230209200246.141520-9-william.zhang@broadcom.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
William Zhang authored and Mark Brown committed Feb 10, 2023
1 parent 2ea9b08 commit 6e80133
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions drivers/spi/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,13 @@ static void _spi_transfer_cs_change_delay(struct spi_message *msg,
}
}

void spi_transfer_cs_change_delay_exec(struct spi_message *msg,
struct spi_transfer *xfer)
{
_spi_transfer_cs_change_delay(msg, xfer);
}
EXPORT_SYMBOL_GPL(spi_transfer_cs_change_delay_exec);

/*
* spi_transfer_one_message - Default implementation of transfer_one_message()
*
Expand Down
5 changes: 3 additions & 2 deletions include/linux/spi/spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct spi_controller;
struct spi_transfer;
struct spi_controller_mem_ops;
struct spi_controller_mem_caps;
struct spi_message;

/*
* INTERFACES between SPI master-side drivers and SPI slave protocol handlers,
Expand Down Expand Up @@ -119,6 +120,8 @@ struct spi_delay {

extern int spi_delay_to_ns(struct spi_delay *_delay, struct spi_transfer *xfer);
extern int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer);
extern void spi_transfer_cs_change_delay_exec(struct spi_message *msg,
struct spi_transfer *xfer);

/**
* struct spi_device - Controller side proxy for an SPI slave device
Expand Down Expand Up @@ -283,8 +286,6 @@ static inline void spi_set_csgpiod(struct spi_device *spi, u8 idx, struct gpio_d
spi->cs_gpiod = csgpiod;
}

struct spi_message;

/**
* struct spi_driver - Host side "protocol" driver
* @id_table: List of SPI devices supported by this driver
Expand Down

0 comments on commit 6e80133

Please sign in to comment.