summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/occ/common.h
blob: 0602196d6704835564f3d16da1610f73e7092874 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* SPDX-License-Identifier: GPL-2.0 */

#ifndef OCC_COMMON_H
#define OCC_COMMON_H

struct device;

#define OCC_RESP_DATA_BYTES		4089

/*
 * Same response format for all OCC versions.
 * Allocate the largest possible response.
 */
struct occ_response {
	u8 seq_no;
	u8 cmd_type;
	u8 return_status;
	__be16 data_length;
	u8 data[OCC_RESP_DATA_BYTES];
	__be16 checksum;
} __packed;

struct occ {
	struct device *bus_dev;

	struct occ_response resp;

	u8 poll_cmd_data;		/* to perform OCC poll command */
	int (*send_cmd)(struct occ *occ, u8 *cmd);
};

int occ_setup(struct occ *occ, const char *name);

#endif /* OCC_COMMON_H */