int nv50_fan_pwm_ctrl(struct nouveau_therm *therm, int line, bool enable) { u32 data = enable ? 0x00000001 : 0x00000000; int ctrl, id, ret = pwm_info(therm, &line, &ctrl, &id); if (ret == 0) nv_mask(therm, ctrl, 0x00010001 << line, data << line); return ret; }
int nv50_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty) { int ctrl, id, ret = pwm_info(therm, &line, &ctrl, &id); if (ret) return ret; nv_wr32(therm, 0x00e114 + (id * 8), divs); nv_wr32(therm, 0x00e118 + (id * 8), duty | 0x80000000); return 0; }
static int nvd0_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty) { int indx = pwm_info(therm, line); if (indx < 0) return indx; nv_wr32(therm, 0x00e114 + (indx * 8), divs); nv_wr32(therm, 0x00e118 + (indx * 8), duty | 0x80000000); return 0; }
static int nvd0_fan_pwm_ctrl(struct nouveau_therm *therm, int line, bool enable) { u32 data = enable ? 0x00000040 : 0x00000000; int indx = pwm_info(therm, line); if (indx < 0) return indx; nv_mask(therm, 0x00d610 + (line * 0x04), 0x000000c0, data); return 0; }
int nvd0_fan_pwm_get(struct nouveau_device *device, int line, u32 *divs, u32 *duty) { int indx = pwm_info(device, line); if (indx < 0) return indx; if (nv_rd32(device, 0x00d610 + (line * 0x04)) & 0x00000040) { *divs = nv_rd32(device, 0x00e114 + (indx * 8)); *duty = nv_rd32(device, 0x00e118 + (indx * 8)); return 0; } return -EINVAL; }
int nv50_fan_pwm_get(struct nouveau_therm *therm, int line, u32 *divs, u32 *duty) { int ctrl, id, ret = pwm_info(therm, &line, &ctrl, &id); if (ret) return ret; if (nv_rd32(therm, ctrl) & (1 << line)) { *divs = nv_rd32(therm, 0x00e114 + (id * 8)); *duty = nv_rd32(therm, 0x00e118 + (id * 8)); return 0; } return -EINVAL; }