Skip to content

Commit 61988e0

Browse files
committed
Merge branch 'thermal-int340x'
Merge int340x thermal driver fix for 5.16-rc1. * thermal-int340x: thermal/drivers/int340x: processor_thermal: Suppot 64 bit RFIM responses
2 parents 567af70 + aeb58c8 commit 61988e0

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

drivers/thermal/intel/int340x_thermal/processor_thermal_device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void proc_thermal_rfim_remove(struct pci_dev *pdev);
8080
int proc_thermal_mbox_add(struct pci_dev *pdev, struct proc_thermal_device *proc_priv);
8181
void proc_thermal_mbox_remove(struct pci_dev *pdev);
8282

83-
int processor_thermal_send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u32 *cmd_resp);
83+
int processor_thermal_send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u64 *cmd_resp);
8484
int proc_thermal_add(struct device *dev, struct proc_thermal_device *priv);
8585
void proc_thermal_remove(struct proc_thermal_device *proc_priv);
8686
int proc_thermal_suspend(struct device *dev);

drivers/thermal/intel/int340x_thermal/processor_thermal_mbox.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
static DEFINE_MUTEX(mbox_lock);
2525

26-
static int send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u32 *cmd_resp)
26+
static int send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u64 *cmd_resp)
2727
{
2828
struct proc_thermal_device *proc_priv;
2929
u32 retries, data;
@@ -68,12 +68,16 @@ static int send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u32 *cm
6868
goto unlock_mbox;
6969
}
7070

71-
if (cmd_id == MBOX_CMD_WORKLOAD_TYPE_READ) {
72-
data = readl((void __iomem *) (proc_priv->mmio_base + MBOX_OFFSET_DATA));
73-
*cmd_resp = data & 0xff;
74-
}
75-
7671
ret = 0;
72+
73+
if (!cmd_resp)
74+
break;
75+
76+
if (cmd_id == MBOX_CMD_WORKLOAD_TYPE_READ)
77+
*cmd_resp = readl((void __iomem *) (proc_priv->mmio_base + MBOX_OFFSET_DATA));
78+
else
79+
*cmd_resp = readq((void __iomem *) (proc_priv->mmio_base + MBOX_OFFSET_DATA));
80+
7781
break;
7882
} while (--retries);
7983

@@ -82,7 +86,7 @@ static int send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u32 *cm
8286
return ret;
8387
}
8488

85-
int processor_thermal_send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u32 *cmd_resp)
89+
int processor_thermal_send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u64 *cmd_resp)
8690
{
8791
return send_mbox_cmd(pdev, cmd_id, cmd_data, cmd_resp);
8892
}
@@ -153,7 +157,7 @@ static ssize_t workload_type_show(struct device *dev,
153157
char *buf)
154158
{
155159
struct pci_dev *pdev = to_pci_dev(dev);
156-
u32 cmd_resp;
160+
u64 cmd_resp;
157161
int ret;
158162

159163
ret = send_mbox_cmd(pdev, MBOX_CMD_WORKLOAD_TYPE_READ, 0, &cmd_resp);
@@ -187,7 +191,7 @@ static bool workload_req_created;
187191

188192
int proc_thermal_mbox_add(struct pci_dev *pdev, struct proc_thermal_device *proc_priv)
189193
{
190-
u32 cmd_resp;
194+
u64 cmd_resp;
191195
int ret;
192196

193197
/* Check if there is a mailbox support, if fails return success */

drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static ssize_t rfi_restriction_store(struct device *dev,
195195
const char *buf, size_t count)
196196
{
197197
u16 cmd_id = 0x0008;
198-
u32 cmd_resp;
198+
u64 cmd_resp;
199199
u32 input;
200200
int ret;
201201

@@ -215,29 +215,29 @@ static ssize_t rfi_restriction_show(struct device *dev,
215215
char *buf)
216216
{
217217
u16 cmd_id = 0x0007;
218-
u32 cmd_resp;
218+
u64 cmd_resp;
219219
int ret;
220220

221221
ret = processor_thermal_send_mbox_cmd(to_pci_dev(dev), cmd_id, 0, &cmd_resp);
222222
if (ret)
223223
return ret;
224224

225-
return sprintf(buf, "%u\n", cmd_resp);
225+
return sprintf(buf, "%llu\n", cmd_resp);
226226
}
227227

228228
static ssize_t ddr_data_rate_show(struct device *dev,
229229
struct device_attribute *attr,
230230
char *buf)
231231
{
232232
u16 cmd_id = 0x0107;
233-
u32 cmd_resp;
233+
u64 cmd_resp;
234234
int ret;
235235

236236
ret = processor_thermal_send_mbox_cmd(to_pci_dev(dev), cmd_id, 0, &cmd_resp);
237237
if (ret)
238238
return ret;
239239

240-
return sprintf(buf, "%u\n", cmd_resp);
240+
return sprintf(buf, "%llu\n", cmd_resp);
241241
}
242242

243243
static DEVICE_ATTR_RW(rfi_restriction);

0 commit comments

Comments
 (0)