File Index
Files and directories
Sign in
FILE

nct6694.h

File preview with syntax highlighting.

linux-6.19.14/include/linux/mfd/nct6694.h C
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * Copyright (C) 2025 Nuvoton Technology Corp.
  4 *
  5 * Nuvoton NCT6694 USB transaction and data structure.
  6 */
  7
  8#ifndef __MFD_NCT6694_H
  9#define __MFD_NCT6694_H
 10
 11#define NCT6694_VENDOR_ID	0x0416
 12#define NCT6694_PRODUCT_ID	0x200B
 13#define NCT6694_INT_IN_EP	0x81
 14#define NCT6694_BULK_IN_EP	0x02
 15#define NCT6694_BULK_OUT_EP	0x03
 16
 17#define NCT6694_HCTRL_SET	0x40
 18#define NCT6694_HCTRL_GET	0x80
 19
 20#define NCT6694_URB_TIMEOUT	1000
 21
 22enum nct6694_irq_id {
 23	NCT6694_IRQ_GPIO0 = 0,
 24	NCT6694_IRQ_GPIO1,
 25	NCT6694_IRQ_GPIO2,
 26	NCT6694_IRQ_GPIO3,
 27	NCT6694_IRQ_GPIO4,
 28	NCT6694_IRQ_GPIO5,
 29	NCT6694_IRQ_GPIO6,
 30	NCT6694_IRQ_GPIO7,
 31	NCT6694_IRQ_GPIO8,
 32	NCT6694_IRQ_GPIO9,
 33	NCT6694_IRQ_GPIOA,
 34	NCT6694_IRQ_GPIOB,
 35	NCT6694_IRQ_GPIOC,
 36	NCT6694_IRQ_GPIOD,
 37	NCT6694_IRQ_GPIOE,
 38	NCT6694_IRQ_GPIOF,
 39	NCT6694_IRQ_CAN0,
 40	NCT6694_IRQ_CAN1,
 41	NCT6694_IRQ_RTC,
 42	NCT6694_NR_IRQS,
 43};
 44
 45enum nct6694_response_err_status {
 46	NCT6694_NO_ERROR = 0,
 47	NCT6694_FORMAT_ERROR,
 48	NCT6694_RESERVED1,
 49	NCT6694_RESERVED2,
 50	NCT6694_NOT_SUPPORT_ERROR,
 51	NCT6694_NO_RESPONSE_ERROR,
 52	NCT6694_TIMEOUT_ERROR,
 53	NCT6694_PENDING,
 54};
 55
 56struct __packed nct6694_cmd_header {
 57	u8 rsv1;
 58	u8 mod;
 59	union __packed {
 60		__le16 offset;
 61		struct __packed {
 62			u8 cmd;
 63			u8 sel;
 64		};
 65	};
 66	u8 hctrl;
 67	u8 rsv2;
 68	__le16 len;
 69};
 70
 71struct __packed nct6694_response_header {
 72	u8 sequence_id;
 73	u8 sts;
 74	u8 reserved[4];
 75	__le16 len;
 76};
 77
 78union __packed nct6694_usb_msg {
 79	struct nct6694_cmd_header cmd_header;
 80	struct nct6694_response_header response_header;
 81};
 82
 83struct nct6694 {
 84	struct device *dev;
 85	struct ida gpio_ida;
 86	struct ida i2c_ida;
 87	struct ida canfd_ida;
 88	struct ida wdt_ida;
 89	struct irq_domain *domain;
 90	struct mutex access_lock;
 91	spinlock_t irq_lock;
 92	struct urb *int_in_urb;
 93	struct usb_device *udev;
 94	union nct6694_usb_msg *usb_msg;
 95	__le32 *int_buffer;
 96	unsigned int irq_enable;
 97};
 98
 99int nct6694_read_msg(struct nct6694 *nct6694, const struct nct6694_cmd_header *cmd_hd, void *buf);
100int nct6694_write_msg(struct nct6694 *nct6694, const struct nct6694_cmd_header *cmd_hd, void *buf);
101
102#endif
~/ Read-only file preview.