Skip to content

Commit 49cef24

Browse files
hoshinolinajannau
authored andcommitted
media: apple: isp: Implement posted commands
Useful for shutdown type commands which may not be acked... Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent a385225 commit 49cef24

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

drivers/media/platform/apple/isp/isp-cmd.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
#define CISP_OPCODE_GET(x) (((u64)(x)) >> CISP_OPCODE_SHIFT)
1111

1212
#define CISP_TIMEOUT msecs_to_jiffies(3000)
13-
#define CISP_SEND_IN(x, a) (cisp_send((x), &(a), sizeof(a), 0))
14-
#define CISP_SEND_INOUT(x, a) (cisp_send((x), &(a), sizeof(a), sizeof(a)))
13+
#define CISP_SEND_IN(x, a) (cisp_send((x), &(a), sizeof(a), 0, CISP_TIMEOUT))
14+
#define CISP_SEND_INOUT(x, a) (cisp_send((x), &(a), sizeof(a), sizeof(a), CISP_TIMEOUT))
1515
#define CISP_SEND_OUT(x, a) (cisp_send_read((x), (a), sizeof(*a), sizeof(*a)))
16+
#define CISP_POST_IN(x, a) (cisp_send((x), &(a), sizeof(a), 0, 0))
1617

17-
static int cisp_send(struct apple_isp *isp, void *args, u32 insize, u32 outsize)
18+
static int cisp_send(struct apple_isp *isp, void *args, u32 insize, u32 outsize, int timeout)
1819
{
1920
struct isp_channel *chan = isp->chan_io;
2021
struct isp_message *req = &chan->req;
@@ -25,7 +26,7 @@ static int cisp_send(struct apple_isp *isp, void *args, u32 insize, u32 outsize)
2526
req->arg2 = outsize;
2627

2728
memcpy(isp->cmd_virt, args, insize);
28-
err = ipc_chan_send(isp, chan, CISP_TIMEOUT);
29+
err = ipc_chan_send(isp, chan, timeout);
2930
if (err) {
3031
u64 opcode;
3132
memcpy(&opcode, args, sizeof(opcode));
@@ -42,7 +43,7 @@ static int cisp_send_read(struct apple_isp *isp, void *args, u32 insize,
4243
u32 outsize)
4344
{
4445
/* TODO do I need to lock the iova space? */
45-
int err = cisp_send(isp, args, insize, outsize);
46+
int err = cisp_send(isp, args, insize, outsize, CISP_TIMEOUT);
4647
if (err)
4748
return err;
4849

drivers/media/platform/apple/isp/isp-ipc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ int ipc_chan_send(struct apple_isp *isp, struct isp_channel *chan,
168168

169169
isp_mbox_write32(isp, ISP_MBOX_IRQ_DOORBELL, chan->doorbell);
170170

171+
if (!timeout)
172+
return 0;
173+
171174
t = wait_event_interruptible_timeout(isp->wait, chan_tx_done(isp, chan),
172175
timeout);
173176
if (t == 0) {

0 commit comments

Comments
 (0)