Skip to content

Commit 092185f

Browse files
author
Frantisek Hrbata
committed
Merge: ISH updates and bug fixes
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/1437 ``` Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2131760 Upstream status: v6.0-rc7 Aligned with v6.0-rc7. Signed-off-by: Tony Camuso <tcamuso@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
2 parents 5b545a5 + 52a26b5 commit 092185f

File tree

6 files changed

+48
-32
lines changed

6 files changed

+48
-32
lines changed

drivers/hid/intel-ish-hid/ipc/hw-ish.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
#define TGL_H_DEVICE_ID 0x43FC
3131
#define ADL_S_DEVICE_ID 0x7AF8
3232
#define ADL_P_DEVICE_ID 0x51FC
33+
#define ADL_N_DEVICE_ID 0x54FC
34+
#define RPL_S_DEVICE_ID 0x7A78
35+
#define MTL_P_DEVICE_ID 0x7E45
3336

3437
#define REVISION_ID_CHT_A0 0x6
3538
#define REVISION_ID_CHT_Ax_SI 0x0

drivers/hid/intel-ish-hid/ipc/ipc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ static void _ish_sync_fw_clock(struct ishtp_device *dev)
578578
static unsigned long prev_sync;
579579
uint64_t usec;
580580

581-
if (prev_sync && jiffies - prev_sync < 20 * HZ)
581+
if (prev_sync && time_before(jiffies, prev_sync + 20 * HZ))
582582
return;
583583

584584
prev_sync = jiffies;

drivers/hid/intel-ish-hid/ipc/pci-ish.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ static const struct pci_device_id ish_pci_tbl[] = {
4141
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, TGL_H_DEVICE_ID)},
4242
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, ADL_S_DEVICE_ID)},
4343
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, ADL_P_DEVICE_ID)},
44+
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, ADL_N_DEVICE_ID)},
45+
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, RPL_S_DEVICE_ID)},
46+
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, MTL_P_DEVICE_ID)},
4447
{0, }
4548
};
4649
MODULE_DEVICE_TABLE(pci, ish_pci_tbl);

drivers/hid/intel-ish-hid/ishtp-hid-client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static void process_recv(struct ishtp_cl *hid_ishtp_cl, void *recv_buf,
328328

329329
/**
330330
* ish_cl_event_cb() - bus driver callback for incoming message/packet
331-
* @device: Pointer to the the ishtp client device for which this message
331+
* @device: Pointer to the ishtp client device for which this message
332332
* is targeted
333333
*
334334
* Remove the packet from the list and process the message by calling

drivers/hid/intel-ish-hid/ishtp-hid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ struct report_list {
105105
* @multi_packet_cnt: Count of fragmented packet count
106106
*
107107
* This structure is used to store completion flags and per client data like
108-
* like report description, number of HID devices etc.
108+
* report description, number of HID devices etc.
109109
*/
110110
struct ishtp_cl_data {
111111
/* completion flags */

drivers/hid/intel-ish-hid/ishtp/client.c

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -626,13 +626,14 @@ static void ishtp_cl_read_complete(struct ishtp_cl_rb *rb)
626626
}
627627

628628
/**
629-
* ipc_tx_callback() - IPC tx callback function
629+
* ipc_tx_send() - IPC tx send function
630630
* @prm: Pointer to client device instance
631631
*
632-
* Send message over IPC either first time or on callback on previous message
633-
* completion
632+
* Send message over IPC. Message will be split into fragments
633+
* if message size is bigger than IPC FIFO size, and all
634+
* fragments will be sent one by one.
634635
*/
635-
static void ipc_tx_callback(void *prm)
636+
static void ipc_tx_send(void *prm)
636637
{
637638
struct ishtp_cl *cl = prm;
638639
struct ishtp_cl_tx_ring *cl_msg;
@@ -677,32 +678,41 @@ static void ipc_tx_callback(void *prm)
677678
list);
678679
rem = cl_msg->send_buf.size - cl->tx_offs;
679680

680-
ishtp_hdr.host_addr = cl->host_client_id;
681-
ishtp_hdr.fw_addr = cl->fw_client_id;
682-
ishtp_hdr.reserved = 0;
683-
pmsg = cl_msg->send_buf.data + cl->tx_offs;
681+
while (rem > 0) {
682+
ishtp_hdr.host_addr = cl->host_client_id;
683+
ishtp_hdr.fw_addr = cl->fw_client_id;
684+
ishtp_hdr.reserved = 0;
685+
pmsg = cl_msg->send_buf.data + cl->tx_offs;
686+
687+
if (rem <= dev->mtu) {
688+
/* Last fragment or only one packet */
689+
ishtp_hdr.length = rem;
690+
ishtp_hdr.msg_complete = 1;
691+
/* Submit to IPC queue with no callback */
692+
ishtp_write_message(dev, &ishtp_hdr, pmsg);
693+
cl->tx_offs = 0;
694+
cl->sending = 0;
684695

685-
if (rem <= dev->mtu) {
686-
ishtp_hdr.length = rem;
687-
ishtp_hdr.msg_complete = 1;
688-
cl->sending = 0;
689-
list_del_init(&cl_msg->list); /* Must be before write */
690-
spin_unlock_irqrestore(&cl->tx_list_spinlock, tx_flags);
691-
/* Submit to IPC queue with no callback */
692-
ishtp_write_message(dev, &ishtp_hdr, pmsg);
693-
spin_lock_irqsave(&cl->tx_free_list_spinlock, tx_free_flags);
694-
list_add_tail(&cl_msg->list, &cl->tx_free_list.list);
695-
++cl->tx_ring_free_size;
696-
spin_unlock_irqrestore(&cl->tx_free_list_spinlock,
697-
tx_free_flags);
698-
} else {
699-
/* Send IPC fragment */
700-
spin_unlock_irqrestore(&cl->tx_list_spinlock, tx_flags);
701-
cl->tx_offs += dev->mtu;
702-
ishtp_hdr.length = dev->mtu;
703-
ishtp_hdr.msg_complete = 0;
704-
ishtp_send_msg(dev, &ishtp_hdr, pmsg, ipc_tx_callback, cl);
696+
break;
697+
} else {
698+
/* Send ipc fragment */
699+
ishtp_hdr.length = dev->mtu;
700+
ishtp_hdr.msg_complete = 0;
701+
/* All fregments submitted to IPC queue with no callback */
702+
ishtp_write_message(dev, &ishtp_hdr, pmsg);
703+
cl->tx_offs += dev->mtu;
704+
rem = cl_msg->send_buf.size - cl->tx_offs;
705+
}
705706
}
707+
708+
list_del_init(&cl_msg->list);
709+
spin_unlock_irqrestore(&cl->tx_list_spinlock, tx_flags);
710+
711+
spin_lock_irqsave(&cl->tx_free_list_spinlock, tx_free_flags);
712+
list_add_tail(&cl_msg->list, &cl->tx_free_list.list);
713+
++cl->tx_ring_free_size;
714+
spin_unlock_irqrestore(&cl->tx_free_list_spinlock,
715+
tx_free_flags);
706716
}
707717

708718
/**
@@ -720,7 +730,7 @@ static void ishtp_cl_send_msg_ipc(struct ishtp_device *dev,
720730
return;
721731

722732
cl->tx_offs = 0;
723-
ipc_tx_callback(cl);
733+
ipc_tx_send(cl);
724734
++cl->send_msg_cnt_ipc;
725735
}
726736

0 commit comments

Comments
 (0)