mirror of
https://github.com/torvalds/linux.git
synced 2024-12-18 09:02:17 +00:00
spi: Allow setting pump to RT priority
-----BEGIN PGP SIGNATURE----- iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlzmo+4THGJyb29uaWVA a2VybmVsLm9yZwAKCRAk1otyXVSH0KFUB/9jkeEtH2Hxe1GvbjOhD+ox6lUpx/U7 48xFqUmwOawWGJWuf4UkWXPR52NCHqKmGr8AJJX8jLkfbBD63IeP7LC4d9Z44Wph PXg9pex0fZakVks9/GJax7uPjs7eckccn1O0tfdthxKYGkHizZW2tTJh8e0HZ7hh gwhvJFaGngE/eD9sdlFBEN1ja3VmBlLNwKKsaO21324XoxDOM+crQSPumk4qtJMC Tlsb2wmDM8rSyhQXKUKzRo6mEfc7IZCJRldAs9iG00MHQaQixvk5iU5ookEoRoX/ hFtu1r2njpiecfsCW0ubN/16jTTdVww00VcLedUDgoBSB00hn0ISRPCj =n8mZ -----END PGP SIGNATURE----- Merge tag 'spi-rt-pump' into chrome-platform/for-next Immutable branch between spi and chrome-platform for driver changes to allow setting spi pump to RT priority. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
This commit is contained in:
commit
2a5f857291
@ -1364,10 +1364,32 @@ static void spi_pump_messages(struct kthread_work *work)
|
||||
__spi_pump_messages(ctlr, true);
|
||||
}
|
||||
|
||||
static int spi_init_queue(struct spi_controller *ctlr)
|
||||
/**
|
||||
* spi_set_thread_rt - set the controller to pump at realtime priority
|
||||
* @ctlr: controller to boost priority of
|
||||
*
|
||||
* This can be called because the controller requested realtime priority
|
||||
* (by setting the ->rt value before calling spi_register_controller()) or
|
||||
* because a device on the bus said that its transfers needed realtime
|
||||
* priority.
|
||||
*
|
||||
* NOTE: at the moment if any device on a bus says it needs realtime then
|
||||
* the thread will be at realtime priority for all transfers on that
|
||||
* controller. If this eventually becomes a problem we may see if we can
|
||||
* find a way to boost the priority only temporarily during relevant
|
||||
* transfers.
|
||||
*/
|
||||
static void spi_set_thread_rt(struct spi_controller *ctlr)
|
||||
{
|
||||
struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 };
|
||||
|
||||
dev_info(&ctlr->dev,
|
||||
"will run message pump with realtime priority\n");
|
||||
sched_setscheduler(ctlr->kworker_task, SCHED_FIFO, ¶m);
|
||||
}
|
||||
|
||||
static int spi_init_queue(struct spi_controller *ctlr)
|
||||
{
|
||||
ctlr->running = false;
|
||||
ctlr->busy = false;
|
||||
|
||||
@ -1387,11 +1409,8 @@ static int spi_init_queue(struct spi_controller *ctlr)
|
||||
* request and the scheduling of the message pump thread. Without this
|
||||
* setting the message pump thread will remain at default priority.
|
||||
*/
|
||||
if (ctlr->rt) {
|
||||
dev_info(&ctlr->dev,
|
||||
"will run message pump with realtime priority\n");
|
||||
sched_setscheduler(ctlr->kworker_task, SCHED_FIFO, ¶m);
|
||||
}
|
||||
if (ctlr->rt)
|
||||
spi_set_thread_rt(ctlr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2982,6 +3001,11 @@ int spi_setup(struct spi_device *spi)
|
||||
|
||||
spi_set_cs(spi, false);
|
||||
|
||||
if (spi->rt && !spi->controller->rt) {
|
||||
spi->controller->rt = true;
|
||||
spi_set_thread_rt(spi->controller);
|
||||
}
|
||||
|
||||
dev_dbg(&spi->dev, "setup mode %d, %s%s%s%s%u bits/w, %u Hz max --> %d\n",
|
||||
(int) (spi->mode & (SPI_CPOL | SPI_CPHA)),
|
||||
(spi->mode & SPI_CS_HIGH) ? "cs_high, " : "",
|
||||
|
@ -109,6 +109,7 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats,
|
||||
* This may be changed by the device's driver, or left at the
|
||||
* default (0) indicating protocol words are eight bit bytes.
|
||||
* The spi_transfer.bits_per_word can override this for each transfer.
|
||||
* @rt: Make the pump thread real time priority.
|
||||
* @irq: Negative, or the number passed to request_irq() to receive
|
||||
* interrupts from this device.
|
||||
* @controller_state: Controller's runtime state
|
||||
@ -143,6 +144,7 @@ struct spi_device {
|
||||
u32 max_speed_hz;
|
||||
u8 chip_select;
|
||||
u8 bits_per_word;
|
||||
bool rt;
|
||||
u32 mode;
|
||||
#define SPI_CPHA 0x01 /* clock phase */
|
||||
#define SPI_CPOL 0x02 /* clock polarity */
|
||||
|
Loading…
Reference in New Issue
Block a user