1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (C) 2013--2024 Intel Corporation */
4 #ifndef IPU6_BUTTRESS_H
5 #define IPU6_BUTTRESS_H
7 #include <linux/completion.h>
8 #include <linux/irqreturn.h>
9 #include <linux/list.h>
10 #include <linux/mutex.h>
15 struct ipu6_bus_device
;
17 #define BUTTRESS_PS_FREQ_STEP 25U
18 #define BUTTRESS_MIN_FORCE_PS_FREQ (BUTTRESS_PS_FREQ_STEP * 8)
19 #define BUTTRESS_MAX_FORCE_PS_FREQ (BUTTRESS_PS_FREQ_STEP * 32)
21 #define BUTTRESS_IS_FREQ_STEP 25U
22 #define BUTTRESS_MIN_FORCE_IS_FREQ (BUTTRESS_IS_FREQ_STEP * 8)
23 #define BUTTRESS_MAX_FORCE_IS_FREQ (BUTTRESS_IS_FREQ_STEP * 22)
25 struct ipu6_buttress_ctrl
{
26 u32 freq_ctl
, pwr_sts_shift
, pwr_sts_mask
, pwr_sts_on
, pwr_sts_off
;
28 unsigned int qos_floor
;
32 struct ipu6_buttress_ipc
{
33 struct completion send_complete
;
34 struct completion recv_complete
;
46 struct ipu6_buttress
{
47 struct mutex power_mutex
, auth_mutex
, cons_mutex
, ipc_mutex
;
48 struct ipu6_buttress_ipc cse
;
49 struct list_head constraints
;
55 struct ipu6_ipc_buttress_bulk_msg
{
62 int ipu6_buttress_ipc_reset(struct ipu6_device
*isp
,
63 struct ipu6_buttress_ipc
*ipc
);
64 int ipu6_buttress_map_fw_image(struct ipu6_bus_device
*sys
,
65 const struct firmware
*fw
,
66 struct sg_table
*sgt
);
67 void ipu6_buttress_unmap_fw_image(struct ipu6_bus_device
*sys
,
68 struct sg_table
*sgt
);
69 int ipu6_buttress_power(struct device
*dev
, struct ipu6_buttress_ctrl
*ctrl
,
71 bool ipu6_buttress_get_secure_mode(struct ipu6_device
*isp
);
72 int ipu6_buttress_authenticate(struct ipu6_device
*isp
);
73 int ipu6_buttress_reset_authentication(struct ipu6_device
*isp
);
74 bool ipu6_buttress_auth_done(struct ipu6_device
*isp
);
75 int ipu6_buttress_start_tsc_sync(struct ipu6_device
*isp
);
76 void ipu6_buttress_tsc_read(struct ipu6_device
*isp
, u64
*val
);
77 u64
ipu6_buttress_tsc_ticks_to_ns(u64 ticks
, const struct ipu6_device
*isp
);
79 irqreturn_t
ipu6_buttress_isr(int irq
, void *isp_ptr
);
80 irqreturn_t
ipu6_buttress_isr_threaded(int irq
, void *isp_ptr
);
81 int ipu6_buttress_init(struct ipu6_device
*isp
);
82 void ipu6_buttress_exit(struct ipu6_device
*isp
);
83 void ipu6_buttress_csi_port_config(struct ipu6_device
*isp
,
84 u32 legacy
, u32 combo
);
85 void ipu6_buttress_restore(struct ipu6_device
*isp
);
86 #endif /* IPU6_BUTTRESS_H */