diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2022-04-05 16:22:20 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2022-04-05 18:23:04 +0200 |
commit | baa914cd81f51f4e4f3bae5bb59764b32ad8c353 (patch) | |
tree | 1280e121f94f0b86c18dc0062ab0cbdf77c9add4 /drivers/firewire/core-cdev.c | |
parent | e70b6693cec229717dda683699ae1fd9ed160e3d (diff) | |
download | lwn-baa914cd81f51f4e4f3bae5bb59764b32ad8c353.tar.gz lwn-baa914cd81f51f4e4f3bae5bb59764b32ad8c353.zip |
firewire: add kernel API to access CYCLE_TIME register
1394 OHCI specification defined Isochronous Cycle Timer Register to get
value of CYCLE_TIME register defined by IEEE 1394 for CSR architecture
defined by ISO/IEC 13213. Unit driver can calculate packet time by
compute with the value of CYCLE_TIME and timeStamp field in descriptor
of each isochronous and asynchronous context. The resolution of CYCLE_TIME
is 49.576 MHz, while the one of timeStamp is 8,000 Hz.
Current implementation of Linux FireWire subsystem allows the driver to
get the value of CYCLE_TIMER CSR register by transaction service. The
transaction service has overhead in regard of access to MMIO register.
This commit adds kernel API for unit driver to access the register
directly.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20220405072221.226217-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'drivers/firewire/core-cdev.c')
-rw-r--r-- | drivers/firewire/core-cdev.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 9f89c17730b1..8e9670036e5c 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c @@ -1216,7 +1216,9 @@ static int ioctl_get_cycle_timer2(struct client *client, union ioctl_arg *arg) local_irq_disable(); - cycle_time = card->driver->read_csr(card, CSR_CYCLE_TIME); + ret = fw_card_read_cycle_time(card, &cycle_time); + if (ret < 0) + goto end; switch (a->clk_id) { case CLOCK_REALTIME: ktime_get_real_ts64(&ts); break; @@ -1225,7 +1227,7 @@ static int ioctl_get_cycle_timer2(struct client *client, union ioctl_arg *arg) default: ret = -EINVAL; } - +end: local_irq_enable(); a->tv_sec = ts.tv_sec; |