Skip to content

Commit e330a69

Browse files
xodus7kartben
authored andcommitted
drivers: i3c: i3c_dw: mark device busy during transfers
Prevent the device from being automatically suspended during transfers. Signed-off-by: Corey Wharton <[email protected]>
1 parent 6ed98bf commit e330a69

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

drivers/i3c/i3c_dw.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,8 @@ static int dw_i3c_xfers(const struct device *dev, struct i3c_device_desc *target
753753
return ret;
754754
}
755755

756+
pm_device_busy_set(dev);
757+
756758
memset(xfer, 0, sizeof(struct dw_i3c_xfer));
757759

758760
xfer->ncmds = num_msgs;
@@ -883,6 +885,7 @@ static int dw_i3c_xfers(const struct device *dev, struct i3c_device_desc *target
883885
ret = xfer->ret;
884886

885887
error:
888+
pm_device_busy_clear(dev);
886889
k_mutex_unlock(&data->mt);
887890

888891
return ret;
@@ -942,6 +945,8 @@ static int dw_i3c_i2c_transfer(const struct device *dev, struct i3c_i2c_device_d
942945
return ret;
943946
}
944947

948+
pm_device_busy_set(dev);
949+
945950
memset(xfer, 0, sizeof(struct dw_i3c_xfer));
946951

947952
xfer->ncmds = num_msgs;
@@ -997,6 +1002,7 @@ static int dw_i3c_i2c_transfer(const struct device *dev, struct i3c_i2c_device_d
9971002
ret = xfer->ret;
9981003

9991004
error:
1005+
pm_device_busy_clear(dev);
10001006
k_mutex_unlock(&data->mt);
10011007

10021008
return ret;
@@ -1694,6 +1700,8 @@ static int dw_i3c_do_ccc(const struct device *dev, struct i3c_ccc_payload *paylo
16941700
return ret;
16951701
}
16961702

1703+
pm_device_busy_set(dev);
1704+
16971705
memset(xfer, 0, sizeof(struct dw_i3c_xfer));
16981706
xfer->ret = -1;
16991707

@@ -1787,6 +1795,7 @@ static int dw_i3c_do_ccc(const struct device *dev, struct i3c_ccc_payload *paylo
17871795

17881796
ret = xfer->ret;
17891797
error:
1798+
pm_device_busy_clear(dev);
17901799
k_mutex_unlock(&data->mt);
17911800

17921801
return ret;
@@ -1903,6 +1912,9 @@ static int dw_i3c_do_daa(const struct device *dev)
19031912
LOG_ERR("%s: Mutex err (%d)", dev->name, ret);
19041913
return ret;
19051914
}
1915+
1916+
pm_device_busy_set(dev);
1917+
19061918
memset(xfer, 0, sizeof(struct dw_i3c_xfer));
19071919

19081920
xfer->ncmds = 1;
@@ -1916,14 +1928,15 @@ static int dw_i3c_do_daa(const struct device *dev)
19161928

19171929
start_xfer(dev);
19181930
ret = k_sem_take(&data->sem_xfer, K_MSEC(1000));
1931+
1932+
pm_device_busy_clear(dev);
1933+
k_mutex_unlock(&data->mt);
1934+
19191935
if (ret) {
19201936
LOG_ERR("%s: Semaphore err (%d)", dev->name, ret);
1921-
k_mutex_unlock(&data->mt);
19221937
return ret;
19231938
}
19241939

1925-
k_mutex_unlock(&data->mt);
1926-
19271940
if (data->maxdevs == cmd->rx_len) {
19281941
newdevs = 0;
19291942
} else {

0 commit comments

Comments
 (0)