di 86 arch/arc/include/asm/disasm.h int zz, aa, x, pref, di; di 103 arch/arc/kernel/disasm.c state->di = BITS(state->words[0], 11, 11); di 104 arch/arc/kernel/disasm.c if (state->di) di 124 arch/arc/kernel/disasm.c state->di = BITS(state->words[0], 5, 5); di 125 arch/arc/kernel/disasm.c if (state->di) di 210 arch/arc/kernel/disasm.c state->di = BITS(state->words[0], 15, 15); di 211 arch/arc/kernel/disasm.c if (state->di) di 229 arch/arc/kernel/unaligned.c if ((state.zz == 1) || (state.di)) di 102 arch/ia64/include/asm/processor.h __u64 di : 1; di 54 arch/mips/include/asm/asmmacro.h di di 35 arch/mips/include/asm/mach-paravirt/kernel-entry-init.h di di 828 arch/mips/math-emu/cp1emu.c #define DIFROMREG(di, x) \ di 829 arch/mips/math-emu/cp1emu.c ((di) = get_fpr64(&ctx->fpr[(x) & ~(cop1_64bit(xcp) ^ 1)], 0)) di 831 arch/mips/math-emu/cp1emu.c #define DITOREG(di, x) \ di 835 arch/mips/math-emu/cp1emu.c set_fpr64(&ctx->fpr[fpr], 0, di); \ di 43 arch/mips/sni/setup.c DISPLAY_STATUS *di; di 45 arch/mips/sni/setup.c di = ArcGetDisplayStatus(1); di 47 arch/mips/sni/setup.c if (di) { di 48 arch/mips/sni/setup.c si->orig_x = di->CursorXPosition; di 49 arch/mips/sni/setup.c si->orig_y = di->CursorYPosition; di 50 arch/mips/sni/setup.c si->orig_video_cols = di->CursorMaxXPosition; di 51 arch/mips/sni/setup.c si->orig_video_lines = di->CursorMaxYPosition; di 51 arch/x86/boot/apm.c boot_params.apm_bios_info.dseg_len = oreg.di; di 243 arch/x86/boot/boot.h u16 di, hdi; di 29 arch/x86/boot/memory.c ireg.di = (size_t)&buf; di 43 arch/x86/boot/video-vesa.c ireg.di = (size_t)&vginfo; di 67 arch/x86/boot/video-vesa.c ireg.di = (size_t)&vminfo; di 115 arch/x86/boot/video-vesa.c ireg.di = (size_t)&vminfo; di 201 arch/x86/boot/video-vesa.c boot_params.screen_info.vesapm_off = oreg.di; di 265 arch/x86/boot/video-vesa.c ireg.di =(size_t)&boot_params.edid_info; /* (ES:)Pointer to block */ di 55 arch/x86/entry/common.c audit_syscall_entry(regs->orig_ax, regs->di, di 100 arch/x86/entry/common.c sd.args[0] = regs->di; di 113 arch/x86/entry/common.c sd.args[4] = regs->di; di 344 arch/x86/entry/common.c (unsigned int)regs->di, (unsigned int)regs->bp); di 82 arch/x86/entry/vsyscall/vsyscall_64.c regs->sp, regs->ax, regs->si, regs->di); di 187 arch/x86/entry/vsyscall/vsyscall_64.c if (!write_ok_or_segv(regs->di, sizeof(struct timeval)) || di 197 arch/x86/entry/vsyscall/vsyscall_64.c if (!write_ok_or_segv(regs->di, sizeof(time_t))) { di 206 arch/x86/entry/vsyscall/vsyscall_64.c if (!write_ok_or_segv(regs->di, sizeof(unsigned)) || di 206 arch/x86/events/intel/ds.c u64 si, di, bp, sp; di 214 arch/x86/events/intel/ds.c u64 si, di, bp, sp; di 226 arch/x86/events/intel/ds.c u64 si, di, bp, sp; di 255 arch/x86/events/intel/ds.c u64 si, di, bp, sp; di 1406 arch/x86/events/intel/ds.c regs->di = pebs->di; di 1489 arch/x86/events/intel/ds.c regs->di = gprs->di; di 88 arch/x86/ia32/ia32_signal.c COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); di 192 arch/x86/ia32/ia32_signal.c put_user_ex(regs->di, &sc->di); di 38 arch/x86/include/asm/asm-prototypes.h INDIRECT_THUNK(di) di 47 arch/x86/include/asm/asm.h #define _ASM_DI __ASM_REG(di) di 92 arch/x86/include/asm/asm.h #define _ASM_ARG1W di di 112 arch/x86/include/asm/elf.h _r->si = 0; _r->di = 0; _r->bp = 0; \ di 127 arch/x86/include/asm/elf.h pr_reg[4] = regs->di; \ di 177 arch/x86/include/asm/elf.h regs->si = regs->di = regs->bp = 0; di 223 arch/x86/include/asm/elf.h (pr_reg)[14] = (regs)->di; \ di 89 arch/x86/include/asm/kexec.h asm volatile("movl %%edi,%0" : "=m"(newregs->di)); di 103 arch/x86/include/asm/kexec.h asm volatile("movq %%rdi,%0" : "=m"(newregs->di)); di 206 arch/x86/include/asm/perf_event.h u64 flags, ip, ax, cx, dx, bx, sp, bp, si, di; di 287 arch/x86/include/asm/processor.h unsigned long di; di 31 arch/x86/include/asm/ptrace.h unsigned long di; di 76 arch/x86/include/asm/ptrace.h unsigned long di; di 316 arch/x86/include/asm/ptrace.h offsetof(struct pt_regs, di), di 51 arch/x86/include/asm/switch_to.h unsigned long di; di 126 arch/x86/include/asm/syscall.h *args++ = regs->di; di 131 arch/x86/include/asm/syscall.h *args++ = regs->di; di 150 arch/x86/include/asm/syscall.h regs->di = *args++; di 155 arch/x86/include/asm/syscall.h regs->di = *args++; di 14 arch/x86/include/asm/syscall_wrapper.h ,,regs->di,,regs->si,,regs->dx \ di 22 arch/x86/include/asm/syscall_wrapper.h ,,(unsigned int)regs->di,,(unsigned int)regs->bp) di 83 arch/x86/include/asm/user_32.h unsigned long di; di 84 arch/x86/include/asm/user_64.h unsigned long di; di 114 arch/x86/include/asm/xen/interface_64.h __DECL_REG(di); di 207 arch/x86/include/uapi/asm/sigcontext.h __u32 di; di 247 arch/x86/include/uapi/asm/sigcontext.h __u64 di; di 58 arch/x86/kernel/asm-offsets.c OFFSET(IA32_SIGCONTEXT_di, sigcontext_32, di); di 31 arch/x86/kernel/asm-offsets_32.c OFFSET(PT_EDI, pt_regs, di); di 62 arch/x86/kernel/asm-offsets_64.c ENTRY(di); di 45 arch/x86/kernel/doublefault.c t->si, t->di); di 56 arch/x86/kernel/kgdb.c { "di", 4, offsetof(struct pt_regs, di) }, di 69 arch/x86/kernel/kgdb.c { "di", 8, offsetof(struct pt_regs, di) }, di 26 arch/x86/kernel/perf_regs.c PT_REGS_OFFSET(PERF_REG_X86_DI, di), di 160 arch/x86/kernel/perf_regs.c regs_user_copy->di = user_regs->di; di 77 arch/x86/kernel/process_32.c regs->si, regs->di, regs->bp, regs->sp); di 141 arch/x86/kernel/process_32.c frame->di = arg; di 84 arch/x86/kernel/process_64.c regs->dx, regs->si, regs->di); di 81 arch/x86/kernel/ptrace.c REG_OFFSET_NAME(di), di 881 arch/x86/kernel/ptrace.c R32(edi, di); di 954 arch/x86/kernel/ptrace.c R32(edi, di); di 118 arch/x86/kernel/signal.c COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); di 173 arch/x86/kernel/signal.c put_user_ex(regs->di, &sc->di); di 500 arch/x86/kernel/signal.c regs->di = sig; di 590 arch/x86/kernel/signal.c regs->di = ksig->sig; di 494 arch/x86/kernel/unwind_orc.c if (!get_reg(state, offsetof(struct pt_regs, di), &sp)) { di 461 arch/x86/kernel/uprobes.c return ®s->di; di 832 arch/x86/kernel/uprobes.c reg_offset = offsetof(struct pt_regs, di); di 129 arch/x86/kernel/vm86_32.c put_user_ex(regs->pt.di, &user->regs.edi); di 293 arch/x86/kernel/vm86_32.c get_user_ex(vm86regs.pt.di, &user_vm86->regs.edi); di 1307 arch/x86/kvm/emulate.c unsigned di = reg_read(ctxt, VCPU_REGS_RDI); di 1327 arch/x86/kvm/emulate.c modrm_ea += bx + di; di 1333 arch/x86/kvm/emulate.c modrm_ea += bp + di; di 1339 arch/x86/kvm/emulate.c modrm_ea += di; di 3062 arch/x86/kvm/emulate.c tss->di = reg_read(ctxt, VCPU_REGS_RDI); di 3086 arch/x86/kvm/emulate.c *reg_write(ctxt, VCPU_REGS_RDI) = tss->di; di 52 arch/x86/kvm/tss.h u16 di; di 133 arch/x86/lib/insn-eval.c if (regoff == offsetof(struct pt_regs, di) && is_string_insn(insn)) di 189 arch/x86/lib/insn-eval.c case offsetof(struct pt_regs, di): di 409 arch/x86/lib/insn-eval.c offsetof(struct pt_regs, di), di 516 arch/x86/lib/insn-eval.c offsetof(struct pt_regs, di), di 523 arch/x86/lib/insn-eval.c offsetof(struct pt_regs, di), di 525 arch/x86/lib/insn-eval.c offsetof(struct pt_regs, di), di 40 arch/x86/math-emu/get_address.c offsetof(struct pt_regs, di) di 352 arch/x86/math-emu/get_address.c address += FPU_info->regs->bx + FPU_info->regs->di; di 360 arch/x86/math-emu/get_address.c address += FPU_info->regs->bp + FPU_info->regs->di; di 368 arch/x86/math-emu/get_address.c address += FPU_info->regs->di; di 119 arch/x86/mm/mmio-mod.c regs->si, regs->di, regs->bp, regs->sp); di 124 arch/x86/mm/mmio-mod.c regs->si, regs->di, regs->bp, regs->sp); di 296 arch/x86/mm/pf_in.c rv = (unsigned char *)®s->di; di 359 arch/x86/mm/pf_in.c rv = ®s->di; di 174 arch/x86/um/signal.c GETREG(DI, di); di 253 arch/x86/um/signal.c PUTREG(DI, di); di 2842 drivers/block/drbd/drbd_receiver.c struct digest_info *di = NULL; di 2930 drivers/block/drbd/drbd_receiver.c di = kmalloc(sizeof(*di) + pi->size, GFP_NOIO); di 2931 drivers/block/drbd/drbd_receiver.c if (!di) di 2934 drivers/block/drbd/drbd_receiver.c di->digest_size = pi->size; di 2935 drivers/block/drbd/drbd_receiver.c di->digest = (((char *)di)+sizeof(struct digest_info)); di 2937 drivers/block/drbd/drbd_receiver.c peer_req->digest = di; di 2940 drivers/block/drbd/drbd_receiver.c if (drbd_recv_all(peer_device->connection, di->digest, pi->size)) di 1172 drivers/block/drbd/drbd_worker.c struct digest_info *di; di 1188 drivers/block/drbd/drbd_worker.c di = peer_req->digest; di 1196 drivers/block/drbd/drbd_worker.c D_ASSERT(device, digest_size == di->digest_size); di 1201 drivers/block/drbd/drbd_worker.c eq = !memcmp(digest, di->digest, digest_size); di 1214 drivers/block/drbd/drbd_worker.c kfree(di); di 1293 drivers/block/drbd/drbd_worker.c struct digest_info *di; di 1314 drivers/block/drbd/drbd_worker.c di = peer_req->digest; di 1322 drivers/block/drbd/drbd_worker.c D_ASSERT(device, digest_size == di->digest_size); di 1323 drivers/block/drbd/drbd_worker.c eq = !memcmp(digest, di->digest, digest_size); di 1555 drivers/block/pktcdvd.c static int pkt_get_disc_info(struct pktcdvd_device *pd, disc_information *di) di 1561 drivers/block/pktcdvd.c init_cdrom_command(&cgc, di, sizeof(*di), CGC_DATA_READ); di 1573 drivers/block/pktcdvd.c cgc.buflen = be16_to_cpu(di->disc_information_length) + di 1574 drivers/block/pktcdvd.c sizeof(di->disc_information_length); di 1613 drivers/block/pktcdvd.c disc_information di; di 1618 drivers/block/pktcdvd.c ret = pkt_get_disc_info(pd, &di); di 1622 drivers/block/pktcdvd.c last_track = (di.last_track_msb << 8) | di.last_track_lsb; di 1771 drivers/block/pktcdvd.c static int pkt_writable_disc(struct pktcdvd_device *pd, disc_information *di) di 1791 drivers/block/pktcdvd.c if (di->disc_type == 0xff) { di 1796 drivers/block/pktcdvd.c if (di->disc_type != 0x20 && di->disc_type != 0) { di 1797 drivers/block/pktcdvd.c pkt_err(pd, "wrong disc type (%x)\n", di->disc_type); di 1801 drivers/block/pktcdvd.c if (di->erasable == 0) { di 1806 drivers/block/pktcdvd.c if (di->border_status == PACKET_SESSION_RESERVED) { di 1818 drivers/block/pktcdvd.c disc_information di; di 1828 drivers/block/pktcdvd.c memset(&di, 0, sizeof(disc_information)); di 1831 drivers/block/pktcdvd.c ret = pkt_get_disc_info(pd, &di); di 1837 drivers/block/pktcdvd.c if (!pkt_writable_disc(pd, &di)) di 1840 drivers/block/pktcdvd.c pd->type = di.erasable ? PACKET_CDRW : PACKET_CDR; di 375 drivers/cdrom/cdrom.c disc_information *di) di 382 drivers/cdrom/cdrom.c init_cdrom_command(&cgc, di, sizeof(*di), CGC_DATA_READ); di 394 drivers/cdrom/cdrom.c buflen = be16_to_cpu(di->disc_information_length) + di 395 drivers/cdrom/cdrom.c sizeof(di->disc_information_length); di 538 drivers/cdrom/cdrom.c disc_information di; di 541 drivers/cdrom/cdrom.c ret = cdrom_get_disc_info(cdi, &di); di 542 drivers/cdrom/cdrom.c if (ret < 0 || ret < (int)offsetof(typeof(di),disc_type)) di 546 drivers/cdrom/cdrom.c if (di.mrw_status == CDM_MRW_BGFORMAT_ACTIVE) { di 749 drivers/cdrom/cdrom.c disc_information di; di 752 drivers/cdrom/cdrom.c ret = cdrom_get_disc_info(cdi, &di); di 753 drivers/cdrom/cdrom.c if (ret < 0 || ret < offsetof(typeof(di), n_first_track)) di 756 drivers/cdrom/cdrom.c return di.erasable; di 778 drivers/cdrom/cdrom.c disc_information di; di 789 drivers/cdrom/cdrom.c ret = cdrom_get_disc_info(cdi, &di); di 790 drivers/cdrom/cdrom.c if (ret < 0 || ret < offsetof(typeof(di),disc_type)) di 793 drivers/cdrom/cdrom.c if (!di.erasable) di 804 drivers/cdrom/cdrom.c pr_info("open: mrw_status '%s'\n", mrw_format_status[di.mrw_status]); di 805 drivers/cdrom/cdrom.c if (!di.mrw_status) di 807 drivers/cdrom/cdrom.c else if (di.mrw_status == CDM_MRW_BGFORMAT_INACTIVE && di 2843 drivers/cdrom/cdrom.c disc_information di; di 2851 drivers/cdrom/cdrom.c ret = cdrom_get_disc_info(cdi, &di); di 2852 drivers/cdrom/cdrom.c if (ret < (int)(offsetof(typeof(di), last_track_lsb) di 2853 drivers/cdrom/cdrom.c + sizeof(di.last_track_lsb))) di 2857 drivers/cdrom/cdrom.c last_track = (di.last_track_msb << 8) | di.last_track_lsb; di 2908 drivers/cdrom/cdrom.c disc_information di; di 2916 drivers/cdrom/cdrom.c ret = cdrom_get_disc_info(cdi, &di); di 2917 drivers/cdrom/cdrom.c if (ret < 0 || ret < offsetof(typeof(di), last_track_lsb) di 2918 drivers/cdrom/cdrom.c + sizeof(di.last_track_lsb)) di 2922 drivers/cdrom/cdrom.c last_track = (di.last_track_msb << 8) | di.last_track_lsb; di 293 drivers/gpu/drm/imx/imx-ldb.c struct drm_display_info *di = &connector->display_info; di 295 drivers/gpu/drm/imx/imx-ldb.c if (di->num_bus_formats) di 296 drivers/gpu/drm/imx/imx-ldb.c bus_format = di->bus_formats[0]; di 352 drivers/gpu/drm/imx/imx-ldb.c struct drm_display_info *di = &conn_state->connector->display_info; di 356 drivers/gpu/drm/imx/imx-ldb.c if (!bus_format && di->num_bus_formats) { di 357 drivers/gpu/drm/imx/imx-ldb.c bus_format = di->bus_formats[0]; di 358 drivers/gpu/drm/imx/imx-ldb.c imx_crtc_state->bus_flags = di->bus_flags; di 39 drivers/gpu/drm/imx/ipuv3-crtc.c struct ipu_di *di; di 58 drivers/gpu/drm/imx/ipuv3-crtc.c ipu_di_enable(ipu_crtc->di); di 88 drivers/gpu/drm/imx/ipuv3-crtc.c ipu_di_disable(ipu_crtc->di); di 220 drivers/gpu/drm/imx/ipuv3-crtc.c ret = ipu_di_adjust_videomode(ipu_crtc->di, &vm); di 310 drivers/gpu/drm/imx/ipuv3-crtc.c ipu_dc_init_sync(ipu_crtc->dc, ipu_crtc->di, di 313 drivers/gpu/drm/imx/ipuv3-crtc.c ipu_di_init_sync_panel(ipu_crtc->di, &sig_cfg); di 330 drivers/gpu/drm/imx/ipuv3-crtc.c if (!IS_ERR_OR_NULL(ipu_crtc->di)) di 331 drivers/gpu/drm/imx/ipuv3-crtc.c ipu_di_put(ipu_crtc->di); di 346 drivers/gpu/drm/imx/ipuv3-crtc.c ipu_crtc->di = ipu_di_get(ipu, pdata->di); di 347 drivers/gpu/drm/imx/ipuv3-crtc.c if (IS_ERR(ipu_crtc->di)) { di 348 drivers/gpu/drm/imx/ipuv3-crtc.c ret = PTR_ERR(ipu_crtc->di); di 112 drivers/gpu/drm/imx/parallel-display.c struct drm_display_info *di = &conn_state->connector->display_info; di 115 drivers/gpu/drm/imx/parallel-display.c if (!imxpd->bus_format && di->num_bus_formats) { di 116 drivers/gpu/drm/imx/parallel-display.c imx_crtc_state->bus_flags = di->bus_flags; di 117 drivers/gpu/drm/imx/parallel-display.c imx_crtc_state->bus_format = di->bus_formats[0]; di 39 drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/conn.h u8 di; di 92 drivers/gpu/drm/nouveau/nvkm/engine/disp/conn.c info->di, info->sr, info->lcdid); di 62 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c nvkm_perfdom_find(struct nvkm_pm *pm, int di) di 68 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c if (tmp++ == di) di 75 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c nvkm_perfsig_find(struct nvkm_pm *pm, u8 di, u8 si, struct nvkm_perfdom **pdom) di 80 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c dom = nvkm_perfdom_find(pm, di); di 444 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c int di, ret = -ENOSYS; di 450 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c di = (args->v0.iter & 0xff) - 1; di 455 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c if (di >= (int)domain_nr) di 458 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c if (di >= 0) { di 459 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c dom = nvkm_perfdom_find(pm, di); di 463 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c args->v0.id = di; di 472 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c if (++di < domain_nr) { di 473 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c args->v0.iter = ++di; di 88 drivers/gpu/drm/nouveau/nvkm/subdev/bios/conn.c info->di = (nvbios_rd08(bios, data + 0x02) & 0xf0) >> 4; di 117 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c struct drm_display_info *di = &connector->display_info; di 121 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c if ((di->color_formats & mask)) { di 123 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c di->color_formats &= ~mask; di 124 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c di->color_formats |= DRM_COLOR_FORMAT_RGB444; di 125 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c di->bpc = 8; di 236 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c struct drm_display_info *di = &conn_state->connector->display_info; di 248 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c s->output_bpc = di->bpc; di 89 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c unsigned long eax, ebx, ecx, edx, si = 0, di = 0; di 92 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c (protocol | GUESTMSG_FLAG_COOKIE), si, di, di 95 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c eax, ebx, ecx, edx, si, di); di 102 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c channel->cookie_low = di; di 118 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c unsigned long eax, ebx, ecx, edx, si, di; di 122 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c di = channel->cookie_low; di 125 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c 0, si, di, di 128 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c eax, ebx, ecx, edx, si, di); di 148 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c unsigned long si, di, eax, ebx, ecx, edx; di 155 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c di = channel->cookie_low; di 159 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c msg_len, si, di, di 163 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c eax, ebx, ecx, edx, si, di); di 178 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c di = channel->cookie_low; di 181 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c word, si, di, di 184 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c eax, ebx, ecx, edx, si, di); di 203 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c unsigned long si, di, eax, ebx, ecx, edx; di 209 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c di = (uintptr_t) reply; di 213 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c reply_len, si, di, di 216 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c eax, ebx, ecx, edx, si, di); di 227 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c di = channel->cookie_low; di 230 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c MESSAGE_STATUS_SUCCESS, si, di, di 233 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c eax, ebx, ecx, edx, si, di); di 257 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c unsigned long eax, ebx, ecx, edx, si, di; di 266 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c di = channel->cookie_low; di 269 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c msg_len, si, di, di 272 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c eax, ebx, ecx, edx, si, di); di 310 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c unsigned long eax, ebx, ecx, edx, si, di; di 324 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c di = channel->cookie_low; di 327 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c 0, si, di, di 330 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c eax, ebx, ecx, edx, si, di); di 368 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c di = channel->cookie_low; di 371 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c MESSAGE_STATUS_SUCCESS, si, di, di 374 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c eax, ebx, ecx, edx, si, di); di 59 drivers/gpu/drm/vmwgfx/vmwgfx_msg.h eax, ebx, ecx, edx, si, di) \ di 67 drivers/gpu/drm/vmwgfx/vmwgfx_msg.h "=D"(di) : \ di 103 drivers/gpu/drm/vmwgfx/vmwgfx_msg.h eax, ebx, ecx, edx, si, di) \ di 114 drivers/gpu/drm/vmwgfx/vmwgfx_msg.h "=D"(di) : \ di 128 drivers/gpu/drm/vmwgfx/vmwgfx_msg.h eax, ebx, ecx, edx, si, di) \ di 139 drivers/gpu/drm/vmwgfx/vmwgfx_msg.h "=D"(di) : \ di 162 drivers/gpu/drm/vmwgfx/vmwgfx_msg.h eax, ebx, ecx, edx, si, di) \ di 175 drivers/gpu/drm/vmwgfx/vmwgfx_msg.h "=D"(di) : \ di 189 drivers/gpu/drm/vmwgfx/vmwgfx_msg.h eax, ebx, ecx, edx, si, di) \ di 202 drivers/gpu/drm/vmwgfx/vmwgfx_msg.h "=D"(di) : \ di 1185 drivers/gpu/ipu-v3/ipu-common.c .di = 0, di 1194 drivers/gpu/ipu-v3/ipu-common.c .di = 1, di 91 drivers/gpu/ipu-v3/ipu-dc.c unsigned int di; di 160 drivers/gpu/ipu-v3/ipu-dc.c int ipu_dc_init_sync(struct ipu_dc *dc, struct ipu_di *di, bool interlaced, di 168 drivers/gpu/ipu-v3/ipu-dc.c dc->di = ipu_di_get_num(di); di 181 drivers/gpu/ipu-v3/ipu-dc.c if (dc->di) di 220 drivers/gpu/ipu-v3/ipu-dc.c writel(width, priv->dc_reg + DC_DISP_CONF2(dc->di)); di 123 drivers/gpu/ipu-v3/ipu-di.c static inline u32 ipu_di_read(struct ipu_di *di, unsigned offset) di 125 drivers/gpu/ipu-v3/ipu-di.c return readl(di->base + offset); di 128 drivers/gpu/ipu-v3/ipu-di.c static inline void ipu_di_write(struct ipu_di *di, u32 value, unsigned offset) di 130 drivers/gpu/ipu-v3/ipu-di.c writel(value, di->base + offset); di 133 drivers/gpu/ipu-v3/ipu-di.c static void ipu_di_data_wave_config(struct ipu_di *di, di 140 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, reg, DI_DW_GEN(wave_gen)); di 143 drivers/gpu/ipu-v3/ipu-di.c static void ipu_di_data_pin_config(struct ipu_di *di, int wave_gen, int di_pin, di 148 drivers/gpu/ipu-v3/ipu-di.c reg = ipu_di_read(di, DI_DW_GEN(wave_gen)); di 151 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, reg, DI_DW_GEN(wave_gen)); di 153 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, (down << 16) | up, DI_DW_SET(wave_gen, set)); di 156 drivers/gpu/ipu-v3/ipu-di.c static void ipu_di_sync_config(struct ipu_di *di, struct di_sync_config *config, di 170 drivers/gpu/ipu-v3/ipu-di.c dev_err(di->ipu->dev, "DI%d counters out of range.\n", di 171 drivers/gpu/ipu-v3/ipu-di.c di->id); di 179 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, reg, DI_SW_GEN0(wave_gen)); di 193 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, reg, DI_SW_GEN1(wave_gen)); di 195 drivers/gpu/ipu-v3/ipu-di.c reg = ipu_di_read(di, DI_STP_REP(wave_gen)); di 198 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, reg, DI_STP_REP(wave_gen)); di 202 drivers/gpu/ipu-v3/ipu-di.c static void ipu_di_sync_config_interlaced(struct ipu_di *di, di 260 drivers/gpu/ipu-v3/ipu-di.c ipu_di_sync_config(di, cfg, 0, ARRAY_SIZE(cfg)); di 262 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, v_total / 2 - 1, DI_SCR_CONF); di 265 drivers/gpu/ipu-v3/ipu-di.c static void ipu_di_sync_config_noninterlaced(struct ipu_di *di, di 386 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, v_total - 1, DI_SCR_CONF); di 388 drivers/gpu/ipu-v3/ipu-di.c ipu_di_sync_config(di, cfg, 0, ARRAY_SIZE(cfg)); di 390 drivers/gpu/ipu-v3/ipu-di.c ipu_di_sync_config(di, cfg_vga, 0, ARRAY_SIZE(cfg_vga)); di 393 drivers/gpu/ipu-v3/ipu-di.c static void ipu_di_config_clock(struct ipu_di *di, di 406 drivers/gpu/ipu-v3/ipu-di.c clk = di->clk_di; di 447 drivers/gpu/ipu-v3/ipu-di.c clkrate = clk_get_rate(di->clk_ipu); di 454 drivers/gpu/ipu-v3/ipu-di.c dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %d.%u%%\n", di 459 drivers/gpu/ipu-v3/ipu-di.c clk = di->clk_ipu; di 466 drivers/gpu/ipu-v3/ipu-di.c clk = di->clk_di; di 478 drivers/gpu/ipu-v3/ipu-di.c di->clk_di_pixel = clk; di 481 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, clkgen0, DI_BS_CLKGEN0); di 489 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, (clkgen0 >> 4) << 16, DI_BS_CLKGEN1); di 492 drivers/gpu/ipu-v3/ipu-di.c val = ipu_di_read(di, DI_GENERAL) & ~DI_GEN_DI_CLK_EXT; di 493 drivers/gpu/ipu-v3/ipu-di.c if (clk == di->clk_di) di 495 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, val, DI_GENERAL); di 497 drivers/gpu/ipu-v3/ipu-di.c dev_dbg(di->ipu->dev, "Want %luHz IPU %luHz DI %luHz using %s, %luHz\n", di 499 drivers/gpu/ipu-v3/ipu-di.c clk_get_rate(di->clk_ipu), di 500 drivers/gpu/ipu-v3/ipu-di.c clk_get_rate(di->clk_di), di 501 drivers/gpu/ipu-v3/ipu-di.c clk == di->clk_di ? "DI" : "IPU", di 502 drivers/gpu/ipu-v3/ipu-di.c clk_get_rate(di->clk_di_pixel) / (clkgen0 >> 4)); di 509 drivers/gpu/ipu-v3/ipu-di.c int ipu_di_adjust_videomode(struct ipu_di *di, struct videomode *mode) di 525 drivers/gpu/ipu-v3/ipu-di.c dev_warn(di->ipu->dev, "failed to adjust videomode\n"); di 529 drivers/gpu/ipu-v3/ipu-di.c dev_dbg(di->ipu->dev, "videomode adapted for IPU restrictions\n"); di 557 drivers/gpu/ipu-v3/ipu-di.c int ipu_di_init_sync_panel(struct ipu_di *di, struct ipu_di_signal_cfg *sig) di 563 drivers/gpu/ipu-v3/ipu-di.c dev_dbg(di->ipu->dev, "disp %d: panel size = %d x %d\n", di 564 drivers/gpu/ipu-v3/ipu-di.c di->id, sig->mode.hactive, sig->mode.vactive); di 566 drivers/gpu/ipu-v3/ipu-di.c dev_dbg(di->ipu->dev, "Clocks: IPU %luHz DI %luHz Needed %luHz\n", di 567 drivers/gpu/ipu-v3/ipu-di.c clk_get_rate(di->clk_ipu), di 568 drivers/gpu/ipu-v3/ipu-di.c clk_get_rate(di->clk_di), di 573 drivers/gpu/ipu-v3/ipu-di.c ipu_di_config_clock(di, sig); di 575 drivers/gpu/ipu-v3/ipu-di.c div = ipu_di_read(di, DI_BS_CLKGEN0) & 0xfff; di 580 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, (div << 16), DI_BS_CLKGEN1); di 582 drivers/gpu/ipu-v3/ipu-di.c ipu_di_data_wave_config(di, SYNC_WAVE, div - 1, div - 1); di 583 drivers/gpu/ipu-v3/ipu-di.c ipu_di_data_pin_config(di, SYNC_WAVE, DI_PIN15, 3, 0, div * 2); di 585 drivers/gpu/ipu-v3/ipu-di.c di_gen = ipu_di_read(di, DI_GENERAL) & DI_GEN_DI_CLK_EXT; di 589 drivers/gpu/ipu-v3/ipu-di.c ipu_di_sync_config_interlaced(di, sig); di 596 drivers/gpu/ipu-v3/ipu-di.c ipu_di_sync_config_noninterlaced(di, sig, div); di 599 drivers/gpu/ipu-v3/ipu-di.c if (di->id == 1) di 616 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, di_gen, DI_GENERAL); di 618 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, (--vsync_cnt << DI_VSYNC_SEL_OFFSET) | 0x00000002, di 621 drivers/gpu/ipu-v3/ipu-di.c reg = ipu_di_read(di, DI_POL); di 629 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, reg, DI_POL); di 637 drivers/gpu/ipu-v3/ipu-di.c int ipu_di_enable(struct ipu_di *di) di 641 drivers/gpu/ipu-v3/ipu-di.c WARN_ON(IS_ERR(di->clk_di_pixel)); di 643 drivers/gpu/ipu-v3/ipu-di.c ret = clk_prepare_enable(di->clk_di_pixel); di 647 drivers/gpu/ipu-v3/ipu-di.c ipu_module_enable(di->ipu, di->module); di 653 drivers/gpu/ipu-v3/ipu-di.c int ipu_di_disable(struct ipu_di *di) di 655 drivers/gpu/ipu-v3/ipu-di.c WARN_ON(IS_ERR(di->clk_di_pixel)); di 657 drivers/gpu/ipu-v3/ipu-di.c ipu_module_disable(di->ipu, di->module); di 659 drivers/gpu/ipu-v3/ipu-di.c clk_disable_unprepare(di->clk_di_pixel); di 665 drivers/gpu/ipu-v3/ipu-di.c int ipu_di_get_num(struct ipu_di *di) di 667 drivers/gpu/ipu-v3/ipu-di.c return di->id; di 675 drivers/gpu/ipu-v3/ipu-di.c struct ipu_di *di; di 680 drivers/gpu/ipu-v3/ipu-di.c di = ipu->di_priv[disp]; di 684 drivers/gpu/ipu-v3/ipu-di.c if (di->inuse) { di 685 drivers/gpu/ipu-v3/ipu-di.c di = ERR_PTR(-EBUSY); di 689 drivers/gpu/ipu-v3/ipu-di.c di->inuse = true; di 693 drivers/gpu/ipu-v3/ipu-di.c return di; di 697 drivers/gpu/ipu-v3/ipu-di.c void ipu_di_put(struct ipu_di *di) di 701 drivers/gpu/ipu-v3/ipu-di.c di->inuse = false; di 711 drivers/gpu/ipu-v3/ipu-di.c struct ipu_di *di; di 716 drivers/gpu/ipu-v3/ipu-di.c di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); di 717 drivers/gpu/ipu-v3/ipu-di.c if (!di) di 720 drivers/gpu/ipu-v3/ipu-di.c ipu->di_priv[id] = di; di 722 drivers/gpu/ipu-v3/ipu-di.c di->clk_di = devm_clk_get(dev, id ? "di1" : "di0"); di 723 drivers/gpu/ipu-v3/ipu-di.c if (IS_ERR(di->clk_di)) di 724 drivers/gpu/ipu-v3/ipu-di.c return PTR_ERR(di->clk_di); di 726 drivers/gpu/ipu-v3/ipu-di.c di->module = module; di 727 drivers/gpu/ipu-v3/ipu-di.c di->id = id; di 728 drivers/gpu/ipu-v3/ipu-di.c di->clk_ipu = clk_ipu; di 729 drivers/gpu/ipu-v3/ipu-di.c di->base = devm_ioremap(dev, base, PAGE_SIZE); di 730 drivers/gpu/ipu-v3/ipu-di.c if (!di->base) di 733 drivers/gpu/ipu-v3/ipu-di.c ipu_di_write(di, 0x10, DI_BS_CLKGEN0); di 736 drivers/gpu/ipu-v3/ipu-di.c id, base, di->base); di 737 drivers/gpu/ipu-v3/ipu-di.c di->inuse = false; di 738 drivers/gpu/ipu-v3/ipu-di.c di->ipu = ipu; di 102 drivers/input/serio/hil_mlc.c memcpy(&mlc->di[idx], &mlc->di_scratch, sizeof(mlc->di_scratch)); di 120 drivers/input/serio/hil_mlc.c if (!memcmp(mlc->di + idx, &mlc->di_scratch, di 814 drivers/input/serio/hil_mlc.c idx = mlc->di[map->didx].idd; di 817 drivers/input/serio/hil_mlc.c idx = mlc->di[map->didx].rsc; di 820 drivers/input/serio/hil_mlc.c idx = mlc->di[map->didx].exd; di 823 drivers/input/serio/hil_mlc.c idx = mlc->di[map->didx].rnm; di 377 drivers/isdn/mISDN/socket.c struct mISDN_devinfo di; di 379 drivers/isdn/mISDN/socket.c memset(&di, 0, sizeof(di)); di 380 drivers/isdn/mISDN/socket.c di.id = dev->id; di 381 drivers/isdn/mISDN/socket.c di.Dprotocols = dev->Dprotocols; di 382 drivers/isdn/mISDN/socket.c di.Bprotocols = dev->Bprotocols | get_all_Bprotocols(); di 383 drivers/isdn/mISDN/socket.c di.protocol = dev->D.protocol; di 384 drivers/isdn/mISDN/socket.c memcpy(di.channelmap, dev->channelmap, di 385 drivers/isdn/mISDN/socket.c sizeof(di.channelmap)); di 386 drivers/isdn/mISDN/socket.c di.nrbchan = dev->nrbchan; di 387 drivers/isdn/mISDN/socket.c strscpy(di.name, dev_name(&dev->dev), sizeof(di.name)); di 388 drivers/isdn/mISDN/socket.c if (copy_to_user((void __user *)arg, &di, sizeof(di))) di 660 drivers/isdn/mISDN/socket.c struct mISDN_devinfo di; di 662 drivers/isdn/mISDN/socket.c memset(&di, 0, sizeof(di)); di 663 drivers/isdn/mISDN/socket.c di.id = dev->id; di 664 drivers/isdn/mISDN/socket.c di.Dprotocols = dev->Dprotocols; di 665 drivers/isdn/mISDN/socket.c di.Bprotocols = dev->Bprotocols | get_all_Bprotocols(); di 666 drivers/isdn/mISDN/socket.c di.protocol = dev->D.protocol; di 667 drivers/isdn/mISDN/socket.c memcpy(di.channelmap, dev->channelmap, di 668 drivers/isdn/mISDN/socket.c sizeof(di.channelmap)); di 669 drivers/isdn/mISDN/socket.c di.nrbchan = dev->nrbchan; di 670 drivers/isdn/mISDN/socket.c strscpy(di.name, dev_name(&dev->dev), sizeof(di.name)); di 671 drivers/isdn/mISDN/socket.c if (copy_to_user((void __user *)arg, &di, sizeof(di))) di 159 drivers/mtd/ubi/build.c ubi_do_get_device_info(ubi, &nt.di); di 191 drivers/mtd/ubi/build.c ubi_do_get_device_info(ubi, &nt.di); di 278 drivers/mtd/ubi/gluebi.c static int gluebi_create(struct ubi_device_info *di, di 298 drivers/mtd/ubi/gluebi.c if (!di->ro_mode) di 301 drivers/mtd/ubi/gluebi.c mtd->writesize = di->min_io_size; di 451 drivers/mtd/ubi/gluebi.c gluebi_create(&nt->di, &nt->vi); di 26 drivers/mtd/ubi/kapi.c void ubi_do_get_device_info(struct ubi_device *ubi, struct ubi_device_info *di) di 28 drivers/mtd/ubi/kapi.c di->ubi_num = ubi->ubi_num; di 29 drivers/mtd/ubi/kapi.c di->leb_size = ubi->leb_size; di 30 drivers/mtd/ubi/kapi.c di->leb_start = ubi->leb_start; di 31 drivers/mtd/ubi/kapi.c di->min_io_size = ubi->min_io_size; di 32 drivers/mtd/ubi/kapi.c di->max_write_size = ubi->max_write_size; di 33 drivers/mtd/ubi/kapi.c di->ro_mode = ubi->ro_mode; di 34 drivers/mtd/ubi/kapi.c di->cdev = ubi->cdev.dev; di 46 drivers/mtd/ubi/kapi.c int ubi_get_device_info(int ubi_num, struct ubi_device_info *di) di 55 drivers/mtd/ubi/kapi.c ubi_do_get_device_info(ubi, di); di 954 drivers/mtd/ubi/ubi.h void ubi_do_get_device_info(struct ubi_device *ubi, struct ubi_device_info *di); di 7051 drivers/net/ethernet/broadcom/tg3.c u32 si, di, cpycnt, src_prod_idx; di 7075 drivers/net/ethernet/broadcom/tg3.c di = dpr->rx_std_prod_idx; di 7077 drivers/net/ethernet/broadcom/tg3.c for (i = di; i < di + cpycnt; i++) { di 7079 drivers/net/ethernet/broadcom/tg3.c cpycnt = i - di; di 7094 drivers/net/ethernet/broadcom/tg3.c memcpy(&dpr->rx_std_buffers[di], di 7098 drivers/net/ethernet/broadcom/tg3.c for (i = 0; i < cpycnt; i++, di++, si++) { di 7101 drivers/net/ethernet/broadcom/tg3.c dbd = &dpr->rx_std[di]; di 7133 drivers/net/ethernet/broadcom/tg3.c di = dpr->rx_jmb_prod_idx; di 7135 drivers/net/ethernet/broadcom/tg3.c for (i = di; i < di + cpycnt; i++) { di 7137 drivers/net/ethernet/broadcom/tg3.c cpycnt = i - di; di 7152 drivers/net/ethernet/broadcom/tg3.c memcpy(&dpr->rx_jmb_buffers[di], di 7156 drivers/net/ethernet/broadcom/tg3.c for (i = 0; i < cpycnt; i++, di++, si++) { di 7159 drivers/net/ethernet/broadcom/tg3.c dbd = &dpr->rx_jmb[di].std; di 469 drivers/net/ethernet/mellanox/mlx5/core/en.h struct mlx5e_dma_info di; di 572 drivers/net/ethernet/mellanox/mlx5/core/en.h struct mlx5e_dma_info *di; di 635 drivers/net/ethernet/mellanox/mlx5/core/en.h struct mlx5e_dma_info *di; di 60 drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c struct mlx5e_dma_info *di, struct xdp_buff *xdp) di 108 drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c dma_addr = di->addr + (xdpf->data - (void *)xdpf); di 114 drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c xdpi.page.di = *di; di 121 drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di, di 138 drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c xdp.handle = di->xsk.handle; di 153 drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c if (unlikely(!mlx5e_xmit_xdp_buff(rq->xdpsq, rq, di, &xdp))) di 165 drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c mlx5e_page_dma_unmap(rq, di); di 375 drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c mlx5e_page_release_dynamic(xdpi.page.rq, &xdpi.page.di, recycle); di 65 drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di, di 93 drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c struct mlx5e_dma_info *di = &wi->umr.dma_info[page_idx]; di 113 drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c va = di->xsk.data; di 117 drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c dma_sync_single_for_cpu(rq->pdev, di->addr, frag_size, DMA_BIDIRECTIONAL); di 121 drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c consumed = mlx5e_xdp_handle(rq, di, va, &rx_headroom, &cqe_bcnt32, true); di 156 drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c struct mlx5e_dma_info *di = wi->di; di 169 drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c va = di->xsk.data; di 173 drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c dma_sync_single_for_cpu(rq->pdev, di->addr, frag_size, DMA_BIDIRECTIONAL); di 182 drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c consumed = mlx5e_xdp_handle(rq, di, va, &rx_headroom, &cqe_bcnt, true); di 319 drivers/net/ethernet/mellanox/mlx5/core/en_main.c next_frag.di = &rq->wqe.di[0]; di 329 drivers/net/ethernet/mellanox/mlx5/core/en_main.c next_frag.di++; di 351 drivers/net/ethernet/mellanox/mlx5/core/en_main.c rq->wqe.di = kvzalloc_node(array_size(len, sizeof(*rq->wqe.di)), di 353 drivers/net/ethernet/mellanox/mlx5/core/en_main.c if (!rq->wqe.di) di 363 drivers/net/ethernet/mellanox/mlx5/core/en_main.c kvfree(rq->wqe.di); di 317 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c err = mlx5e_page_alloc(rq, frag->di); di 327 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c mlx5e_page_release(rq, frag->di, recycle); di 347 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c wqe->data[i].addr = cpu_to_be64(frag->di->addr + di 409 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c struct mlx5e_dma_info *di, u32 frag_offset, u32 len, di 413 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c di->addr + frag_offset, di 415 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c page_ref_inc(di->page); di 417 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c di->page, frag_offset, len, truesize); di 1061 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c struct mlx5e_dma_info *di = wi->di; di 1068 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c va = page_address(di->page) + wi->offset; di 1072 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c dma_sync_single_range_for_cpu(rq->pdev, di->addr, wi->offset, di 1078 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c consumed = mlx5e_xdp_handle(rq, di, va, &rx_headroom, &cqe_bcnt, false); di 1088 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c page_ref_inc(di->page); di 1120 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c mlx5e_add_skb_frag(rq, skb, wi->di, wi->offset + frag_headlen, di 1129 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c mlx5e_copy_skb_header(rq->pdev, skb, head_wi->di, head_wi->offset, headlen); di 1241 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c struct mlx5e_dma_info *di = &wi->umr.dma_info[page_idx]; di 1244 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c struct mlx5e_dma_info *head_di = di; di 1257 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c di++; di 1267 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c mlx5e_add_skb_frag(rq, skb, di, frag_offset, di 1271 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c di++; di 1286 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c struct mlx5e_dma_info *di = &wi->umr.dma_info[page_idx]; di 1300 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c va = page_address(di->page) + head_offset; di 1304 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c dma_sync_single_range_for_cpu(rq->pdev, di->addr, head_offset, di 1310 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c consumed = mlx5e_xdp_handle(rq, di, va, &rx_headroom, &cqe_bcnt32, false); di 1323 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c page_ref_inc(di->page); di 1075 drivers/net/ethernet/micrel/ks8851.c struct ethtool_drvinfo *di) di 1077 drivers/net/ethernet/micrel/ks8851.c strlcpy(di->driver, "KS8851", sizeof(di->driver)); di 1078 drivers/net/ethernet/micrel/ks8851.c strlcpy(di->version, "1.00", sizeof(di->version)); di 1079 drivers/net/ethernet/micrel/ks8851.c strlcpy(di->bus_info, dev_name(dev->dev.parent), sizeof(di->bus_info)); di 987 drivers/net/ethernet/micrel/ks8851_mll.c struct ethtool_drvinfo *di) di 989 drivers/net/ethernet/micrel/ks8851_mll.c strlcpy(di->driver, DRV_NAME, sizeof(di->driver)); di 990 drivers/net/ethernet/micrel/ks8851_mll.c strlcpy(di->version, "1.00", sizeof(di->version)); di 991 drivers/net/ethernet/micrel/ks8851_mll.c strlcpy(di->bus_info, dev_name(netdev->dev.parent), di 992 drivers/net/ethernet/micrel/ks8851_mll.c sizeof(di->bus_info)); di 1022 drivers/net/wireless/broadcom/brcm80211/brcmsmac/ampdu.c p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED); di 1082 drivers/net/wireless/broadcom/brcm80211/brcmsmac/ampdu.c p = dma_getnexttxp(wlc->hw->di[queue], di 38 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c #define DMA64TXREGOFFS(di, field) (di->d64txregbase + DMA64REGOFFS(field)) di 39 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c #define DMA64RXREGOFFS(di, field) (di->d64rxregbase + DMA64REGOFFS(field)) di 313 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static uint txd(struct dma_info *di, uint x) di 315 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return xxd(x, di->ntxd); di 318 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static uint rxd(struct dma_info *di, uint x) di 320 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return xxd(x, di->nrxd); di 323 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static uint nexttxd(struct dma_info *di, uint i) di 325 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return txd(di, i + 1); di 328 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static uint prevtxd(struct dma_info *di, uint i) di 330 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return txd(di, i - 1); di 333 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static uint nextrxd(struct dma_info *di, uint i) di 335 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return rxd(di, i + 1); di 338 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static uint ntxdactive(struct dma_info *di, uint h, uint t) di 340 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return txd(di, t-h); di 343 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static uint nrxdactive(struct dma_info *di, uint h, uint t) di 345 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return rxd(di, t-h); di 348 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags) di 352 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di == NULL) di 355 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dmactrlflags = di->dma.dmactrlflags; di 363 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c control = bcma_read32(di->core, DMA64TXREGOFFS(di, control)); di 364 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64TXREGOFFS(di, control), di 366 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (bcma_read32(di->core, DMA64TXREGOFFS(di, control)) & di 371 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64TXREGOFFS(di, control), di 378 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dma.dmactrlflags = dmactrlflags; di 383 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static bool _dma64_addrext(struct dma_info *di, uint ctrl_offset) di 386 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_set32(di->core, ctrl_offset, D64_XC_AE); di 387 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c w = bcma_read32(di->core, ctrl_offset); di 388 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_mask32(di->core, ctrl_offset, ~D64_XC_AE); di 396 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static bool _dma_isaddrext(struct dma_info *di) di 401 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->d64txregbase != 0) { di 402 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (!_dma64_addrext(di, DMA64TXREGOFFS(di, control))) di 403 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, di 405 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->name); di 407 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c } else if (di->d64rxregbase != 0) { di 408 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (!_dma64_addrext(di, DMA64RXREGOFFS(di, control))) di 409 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, di 411 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->name); di 418 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static bool _dma_descriptor_align(struct dma_info *di) di 423 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->d64txregbase != 0) { di 424 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64TXREGOFFS(di, addrlow), 0xff0); di 425 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c addrl = bcma_read32(di->core, DMA64TXREGOFFS(di, addrlow)); di 428 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c } else if (di->d64rxregbase != 0) { di 429 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64RXREGOFFS(di, addrlow), 0xff0); di 430 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c addrl = bcma_read32(di->core, DMA64RXREGOFFS(di, addrlow)); di 441 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static void *dma_alloc_consistent(struct dma_info *di, uint size, di 451 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return dma_alloc_coherent(di->dmadev, size, pap, GFP_ATOMIC); di 469 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static void *dma_ringalloc(struct dma_info *di, u32 boundary, uint size, di 477 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c va = dma_alloc_consistent(di, size, *alignbits, alloced, descpa); di 486 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dma_free_coherent(di->dmadev, size, va, *descpa); di 487 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c va = dma_alloc_consistent(di, size, *alignbits, di 493 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static bool dma64_alloc(struct dma_info *di, uint direction) di 504 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c size = (direction == DMA_TX) ? (di->ntxd * ddlen) : (di->nrxd * ddlen); di 505 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c align_bits = di->dmadesc_align; di 509 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits, di 510 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c &alloced, &di->txdpaorig); di 512 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, di 514 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->name); di 518 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->txd64 = (struct dma64desc *) di 520 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->txdalign = (uint) ((s8 *)di->txd64 - (s8 *) va); di 521 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->txdpa = di->txdpaorig + di->txdalign; di 522 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->txdalloc = alloced; di 524 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits, di 525 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c &alloced, &di->rxdpaorig); di 527 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, di 529 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->name); di 533 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxd64 = (struct dma64desc *) di 535 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxdalign = (uint) ((s8 *)di->rxd64 - (s8 *) va); di 536 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxdpa = di->rxdpaorig + di->rxdalign; di 537 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxdalloc = alloced; di 543 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static bool _dma_alloc(struct dma_info *di, uint direction) di 545 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return dma64_alloc(di, direction); di 555 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di; di 561 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di = kzalloc(sizeof(struct dma_info), GFP_ATOMIC); di 562 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di == NULL) di 565 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dma64 = di 569 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->core = core; di 570 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->d64txregbase = txregbase; di 571 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->d64rxregbase = rxregbase; di 578 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c _dma_ctrlflags(di, DMA_CTRL_ROC | DMA_CTRL_PEN, 0); di 580 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s: %s flags 0x%x ntxd %d nrxd %d " di 583 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dma.dmactrlflags, ntxd, nrxd, rxbufsize, di 587 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c strncpy(di->name, name, MAXNAMEL); di 588 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->name[MAXNAMEL - 1] = '\0'; di 590 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dmadev = core->dma_dev; di 593 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->ntxd = (u16) ntxd; di 594 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->nrxd = (u16) nrxd; di 597 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxextrahdrroom = di 600 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxbufsize = (u16) (rxbufsize - di->rxextrahdrroom); di 602 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxbufsize = (u16) rxbufsize; di 604 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->nrxpost = (u16) nrxpost; di 605 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxoffset = (u8) rxoffset; di 614 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->ddoffsetlow = 0; di 615 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dataoffsetlow = 0; di 619 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->ddoffsetlow = 0; di 620 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->ddoffsethigh = SI_PCIE_DMA_H32; di 622 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dataoffsetlow = di->ddoffsetlow; di 623 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dataoffsethigh = di->ddoffsethigh; di 628 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->addrext = false; di 631 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->addrext = false; di 633 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->addrext = _dma_isaddrext(di); di 636 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->aligndesc_4k = _dma_descriptor_align(di); di 637 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->aligndesc_4k) { di 638 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dmadesc_align = D64RINGALIGN_BITS; di 641 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dmadesc_align = D64RINGALIGN_BITS - 1; di 643 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dmadesc_align = 4; /* 16 byte alignment */ di 646 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "DMA descriptor align_needed %d, align %d\n", di 647 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->aligndesc_4k, di->dmadesc_align); di 652 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->txp = kzalloc(size, GFP_ATOMIC); di 653 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->txp == NULL) di 660 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxp = kzalloc(size, GFP_ATOMIC); di 661 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->rxp == NULL) di 670 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (!_dma_alloc(di, DMA_TX)) di 679 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (!_dma_alloc(di, DMA_RX)) di 683 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if ((di->ddoffsetlow != 0) && !di->addrext) { di 684 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->txdpa > SI_PCI_DMA_SZ) { di 685 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, di 687 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->name, (u32)di->txdpa); di 690 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->rxdpa > SI_PCI_DMA_SZ) { di 691 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, di 693 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->name, (u32)di->rxdpa); di 699 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_c_ampdu_reset_session(&di->ampdu_session, wlc); di 701 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, di 703 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->ddoffsetlow, di->ddoffsethigh, di 704 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dataoffsetlow, di->dataoffsethigh, di 705 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->addrext); di 707 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return (struct dma_pub *) di; di 710 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dma_detach((struct dma_pub *)di); di 715 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring, di 721 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if ((di->dataoffsetlow == 0) || !(pa & PCI32ADDR_HIGH)) { di 722 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c ddring[outidx].addrlow = cpu_to_le32(pa + di->dataoffsetlow); di 723 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c ddring[outidx].addrhigh = cpu_to_le32(di->dataoffsethigh); di 734 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c ddring[outidx].addrlow = cpu_to_le32(pa + di->dataoffsetlow); di 735 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c ddring[outidx].addrhigh = cpu_to_le32(di->dataoffsethigh); di 739 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->dma.dmactrlflags & DMA_CTRL_PEN) { di 749 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 751 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s:\n", di->name); di 754 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->txd64) di 755 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dma_free_coherent(di->dmadev, di->txdalloc, di 756 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c ((s8 *)di->txd64 - di->txdalign), di 757 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c (di->txdpaorig)); di 758 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->rxd64) di 759 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dma_free_coherent(di->dmadev, di->rxdalloc, di 760 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c ((s8 *)di->rxd64 - di->rxdalign), di 761 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c (di->rxdpaorig)); di 764 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c kfree(di->txp); di 765 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c kfree(di->rxp); di 768 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c kfree(di); di 774 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c _dma_ddtable_init(struct dma_info *di, uint direction, dma_addr_t pa) di 776 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (!di->aligndesc_4k) { di 778 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->xmtptrbase = pa; di 780 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rcvptrbase = pa; di 783 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if ((di->ddoffsetlow == 0) di 786 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64TXREGOFFS(di, addrlow), di 787 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c pa + di->ddoffsetlow); di 788 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64TXREGOFFS(di, addrhigh), di 789 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->ddoffsethigh); di 791 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64RXREGOFFS(di, addrlow), di 792 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c pa + di->ddoffsetlow); di 793 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64RXREGOFFS(di, addrhigh), di 794 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->ddoffsethigh); di 805 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64TXREGOFFS(di, addrlow), di 806 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c pa + di->ddoffsetlow); di 807 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64TXREGOFFS(di, addrhigh), di 808 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->ddoffsethigh); di 809 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_maskset32(di->core, DMA64TXREGOFFS(di, control), di 812 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64RXREGOFFS(di, addrlow), di 813 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c pa + di->ddoffsetlow); di 814 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64RXREGOFFS(di, addrhigh), di 815 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->ddoffsethigh); di 816 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_maskset32(di->core, DMA64RXREGOFFS(di, control), di 822 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static void _dma_rxenable(struct dma_info *di) di 824 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c uint dmactrlflags = di->dma.dmactrlflags; di 827 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s:\n", di->name); di 829 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c control = D64_RC_RE | (bcma_read32(di->core, di 830 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c DMA64RXREGOFFS(di, control)) & di 839 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64RXREGOFFS(di, control), di 840 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c ((di->rxoffset << D64_RC_RO_SHIFT) | control)); di 845 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 847 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s:\n", di->name); di 849 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->nrxd == 0) di 852 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxin = di->rxout = 0; di 855 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c memset(di->rxd64, '\0', di->nrxd * sizeof(struct dma64desc)); di 860 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (!di->aligndesc_4k) di 861 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c _dma_ddtable_init(di, DMA_RX, di->rxdpa); di 863 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c _dma_rxenable(di); di 865 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->aligndesc_4k) di 866 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c _dma_ddtable_init(di, DMA_RX, di->rxdpa); di 869 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall) di 875 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c i = di->rxin; di 878 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (i == di->rxout) di 882 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c B2I(((bcma_read32(di->core, di 883 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c DMA64RXREGOFFS(di, status0)) & D64_RS0_CD_MASK) - di 884 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rcvptrbase) & D64_RS0_CD_MASK, struct dma64desc); di 891 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c rxp = di->rxp[i]; di 892 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxp[i] = NULL; di 894 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c pa = le32_to_cpu(di->rxd64[i].addrlow) - di->dataoffsetlow; di 897 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dma_unmap_single(di->dmadev, pa, di->rxbufsize, DMA_FROM_DEVICE); di 899 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxd64[i].addrlow = cpu_to_le32(0xdeadbeef); di 900 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxd64[i].addrhigh = cpu_to_le32(0xdeadbeef); di 902 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxin = nextrxd(di, i); di 907 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static struct sk_buff *_dma_getnextrxp(struct dma_info *di, bool forceall) di 909 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->nrxd == 0) di 912 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return dma64_getnextrxp(di, forceall); di 927 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 937 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c p = _dma_getnextrxp(di, false); di 942 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s: dma_rx len %d\n", di->name, len); di 946 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c pkt_len = min((di->rxoffset + len), di->rxbufsize); di 949 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c resid = len - (di->rxbufsize - di->rxoffset); di 953 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c while ((resid > 0) && (p = _dma_getnextrxp(di, false))) { di 954 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c pkt_len = min_t(uint, resid, di->rxbufsize); di 957 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c resid -= di->rxbufsize; di 965 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c B2I(((bcma_read32(di->core, di 966 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c DMA64RXREGOFFS(di, status0)) & di 967 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c D64_RS0_CD_MASK) - di->rcvptrbase) & di 969 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, di 971 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxin, di->rxout, cur); di 975 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if ((di->dma.dmactrlflags & DMA_CTRL_RXMULTI) == 0) { di 976 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s: bad frame length (%d)\n", di 977 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->name, len); di 982 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dma.rxgiants++; di 992 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static bool dma64_rxidle(struct dma_info *di) di 994 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s:\n", di->name); di 996 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->nrxd == 0) di 999 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return ((bcma_read32(di->core, di 1000 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c DMA64RXREGOFFS(di, status0)) & D64_RS0_CD_MASK) == di 1001 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c (bcma_read32(di->core, DMA64RXREGOFFS(di, ptr)) & di 1005 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static bool dma64_txidle(struct dma_info *di) di 1007 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->ntxd == 0) di 1010 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return ((bcma_read32(di->core, di 1011 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c DMA64TXREGOFFS(di, status0)) & D64_XS0_CD_MASK) == di 1012 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c (bcma_read32(di->core, DMA64TXREGOFFS(di, ptr)) & di 1025 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1043 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c rxin = di->rxin; di 1044 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c rxout = di->rxout; di 1046 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c n = di->nrxpost - nrxdactive(di, rxin, rxout); di 1048 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s: post %d\n", di->name, n); di 1050 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->rxbufsize > BCMEXTRAHDROOM) di 1051 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c extra_offset = di->rxextrahdrroom; di 1058 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c p = brcmu_pkt_buf_get_skb(di->rxbufsize + extra_offset); di 1061 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s: out of rxbufs\n", di 1062 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->name); di 1063 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (i == 0 && dma64_rxidle(di)) { di 1064 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s: ring is empty !\n", di 1065 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->name); di 1068 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dma.rxnobuf++; di 1080 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c pa = dma_map_single(di->dmadev, p->data, di->rxbufsize, di 1082 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (dma_mapping_error(di->dmadev, pa)) { di 1088 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxp[rxout] = p; di 1092 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (rxout == (di->nrxd - 1)) di 1095 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dma64_dd_upd(di, di->rxd64, pa, rxout, &flags, di 1096 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxbufsize); di 1097 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c rxout = nextrxd(di, rxout); di 1100 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rxout = rxout; di 1103 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64RXREGOFFS(di, ptr), di 1104 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->rcvptrbase + I2B(rxout, struct dma64desc)); di 1111 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1114 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s:\n", di->name); di 1116 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c while ((p = _dma_getnextrxp(di, true))) di 1131 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1134 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return (unsigned long)&(di->dma.txavail); di 1142 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1145 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s:\n", di->name); di 1147 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->ntxd == 0) di 1150 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->txin = di->txout = 0; di 1151 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dma.txavail = di->ntxd - 1; di 1154 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c memset(di->txd64, '\0', (di->ntxd * sizeof(struct dma64desc))); di 1159 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (!di->aligndesc_4k) di 1160 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c _dma_ddtable_init(di, DMA_TX, di->txdpa); di 1162 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if ((di->dma.dmactrlflags & DMA_CTRL_PEN) == 0) di 1164 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_set32(di->core, DMA64TXREGOFFS(di, control), control); di 1169 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->aligndesc_4k) di 1170 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c _dma_ddtable_init(di, DMA_TX, di->txdpa); di 1175 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1177 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s:\n", di->name); di 1179 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->ntxd == 0) di 1182 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_set32(di->core, DMA64TXREGOFFS(di, control), D64_XC_SE); di 1187 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1189 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s:\n", di->name); di 1191 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->ntxd == 0) di 1194 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_mask32(di->core, DMA64TXREGOFFS(di, control), ~D64_XC_SE); di 1199 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1201 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return (di->ntxd == 0) || di 1202 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c ((bcma_read32(di->core, di 1203 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c DMA64TXREGOFFS(di, control)) & D64_XC_SE) == di 1209 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1212 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s: %s\n", di 1213 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->name, di 1218 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->txin == di->txout) di 1223 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (!(di->dma.dmactrlflags & DMA_CTRL_UNFRAMED)) di 1230 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1233 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->ntxd == 0) di 1237 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64TXREGOFFS(di, control), D64_XC_SE); di 1239 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c (bcma_read32(di->core, DMA64TXREGOFFS(di, status0)) & di 1244 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64TXREGOFFS(di, control), 0); di 1246 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c (bcma_read32(di->core, DMA64TXREGOFFS(di, status0)) & di 1257 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1260 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->nrxd == 0) di 1263 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64RXREGOFFS(di, control), 0); di 1265 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c (bcma_read32(di->core, DMA64RXREGOFFS(di, status0)) & di 1271 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static void dma_txenq(struct dma_info *di, struct sk_buff *p) di 1279 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c txout = di->txout; di 1281 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (WARN_ON(nexttxd(di, txout) == di->txin)) di 1291 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c pa = dma_map_single(di->dmadev, data, len, DMA_TO_DEVICE); di 1293 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (dma_mapping_error(di->dmadev, pa)) { di 1303 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (txout == (di->ntxd - 1)) di 1306 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dma64_dd_upd(di, di->txd64, pa, txout, &flags, len); di 1308 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c txout = nexttxd(di, txout); di 1311 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->txp[prevtxd(di, txout)] = p; di 1314 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->txout = txout; di 1317 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static void ampdu_finalize(struct dma_info *di) di 1319 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct brcms_ampdu_session *session = &di->ampdu_session; di 1336 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dma_txenq(di, p); di 1339 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64TXREGOFFS(di, ptr), di 1340 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->xmtptrbase + I2B(di->txout, struct dma64desc)); di 1344 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static void prep_ampdu_frame(struct dma_info *di, struct sk_buff *p) di 1346 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct brcms_ampdu_session *session = &di->ampdu_session; di 1355 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c ampdu_finalize(di); di 1363 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c static void dma_update_txavail(struct dma_info *di) di 1369 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) - di 1370 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c skb_queue_len(&di->ampdu_session.skb_list) - 1; di 1382 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1383 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct brcms_ampdu_session *session = &di->ampdu_session; di 1392 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->dma.txavail == 0 || nexttxd(di, di->txout) == di->txin) di 1398 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c prep_ampdu_frame(di, p); di 1400 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dma_txenq(di, p); di 1403 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dma_update_txavail(di); di 1413 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dma.txavail == 0 || dma64_txidle(di)) di 1414 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c ampdu_finalize(di); di 1416 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c bcma_write32(di->core, DMA64TXREGOFFS(di, ptr), di 1417 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->xmtptrbase + I2B(di->txout, struct dma64desc)); di 1423 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s: out of txds !!!\n", di->name); di 1425 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dma.txavail = 0; di 1426 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->dma.txnobuf++; di 1432 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1433 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct brcms_ampdu_session *session = &di->ampdu_session; di 1436 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c ampdu_finalize(di); di 1441 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1442 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c return ntxdactive(di, di->txin, di->txout); di 1451 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1452 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct brcms_ampdu_session *session = &di->ampdu_session; di 1454 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (!skb_queue_empty(&session->skb_list) && dma64_txidle(di)) di 1455 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c ampdu_finalize(di); di 1470 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(pub, struct dma_info, dma); di 1475 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "%s: %s\n", di 1476 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->name, di 1481 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if (di->ntxd == 0) di 1486 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c start = di->txin; di 1488 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c end = di->txout; di 1490 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c end = (u16) (B2I(((bcma_read32(di->core, di 1491 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c DMA64TXREGOFFS(di, status0)) & di 1492 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c D64_XS0_CD_MASK) - di->xmtptrbase) & di 1497 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c (u16)(bcma_read32(di->core, di 1498 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c DMA64TXREGOFFS(di, status1)) & di 1501 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c (active_desc - di->xmtptrbase) & D64_XS0_CD_MASK; di 1504 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c end = prevtxd(di, active_desc); di 1508 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c if ((start == 0) && (end > di->txout)) di 1511 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c for (i = start; i != end && !txp; i = nexttxd(di, i)) { di 1515 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c pa = le32_to_cpu(di->txd64[i].addrlow) - di->dataoffsetlow; di 1518 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c (le32_to_cpu(di->txd64[i].ctrl2) & di 1521 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->txd64[i].addrlow = cpu_to_le32(0xdeadbeef); di 1522 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->txd64[i].addrhigh = cpu_to_le32(0xdeadbeef); di 1524 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c txp = di->txp[i]; di 1525 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->txp[i] = NULL; di 1527 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dma_unmap_single(di->dmadev, pa, size, DMA_TO_DEVICE); di 1530 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c di->txin = i; di 1533 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c dma_update_txavail(di); di 1538 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c brcms_dbg_dma(di->core, "bogus curr: start %d end %d txout %d\n", di 1539 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c start, end, di->txout); di 1552 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c struct dma_info *di = container_of(dmah, struct dma_info, dma); di 1553 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c uint i = di->txin; di 1554 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c uint end = di->txout; di 1559 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c skb = di->txp[i]; di 1564 drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c i = nexttxd(di, i); di 406 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c for (i = 0; i < ARRAY_SIZE(wlc->hw->di); i++) di 407 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c if (wlc->hw->di[i]) di 408 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c pending += dma_txpending(wlc->hw->di[i]); di 874 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma = wlc->hw->di[queue]; di 876 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED); di 1127 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c if (wlc_hw->di[0] == NULL) { /* Init FIFOs */ di 1135 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c wlc_hw->di[0] = dma_attach(name, wlc, di 1141 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_attach_err |= (NULL == wlc_hw->di[0]); di 1149 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c wlc_hw->di[1] = dma_attach(name, wlc, di 1152 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_attach_err |= (NULL == wlc_hw->di[1]); di 1159 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c wlc_hw->di[2] = dma_attach(name, wlc, di 1162 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_attach_err |= (NULL == wlc_hw->di[2]); di 1168 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c wlc_hw->di[3] = dma_attach(name, wlc, di 1172 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_attach_err |= (NULL == wlc_hw->di[3]); di 1184 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c if (wlc_hw->di[i]) di 1186 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c (uint *) dma_getvar(wlc_hw->di[i], di 1201 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c if (wlc_hw->di[j]) { di 1202 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_detach(wlc_hw->di[j]); di 1203 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c wlc_hw->di[j] = NULL; di 1991 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c struct dma_pub *di = wlc_hw->di[fifo]; di 1992 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c return dma_rxreset(di); di 2021 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c if ((wlc_hw->di[i]) && (!dma_txreset(wlc_hw->di[i]))) di 2026 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c if ((wlc_hw->di[RX_FIFO]) di 2456 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c if (wlc_hw->di[tx_fifo]) { di 2465 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_txsuspend(wlc_hw->di[tx_fifo]); di 2480 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c if (wlc_hw->di[tx_fifo]) di 2481 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_txresume(wlc_hw->di[tx_fifo]); di 2906 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c if (wlc_hw->di[i]) { di 2907 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_txreclaim(wlc_hw->di[i], DMA_RANGE_ALL); di 2915 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_rxreclaim(wlc_hw->di[RX_FIFO]); di 3129 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c if (wlc->hw->di[i]) di 3130 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_counterreset(wlc->hw->di[i]); di 3344 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c if (wlc_hw->di[i]) di 3345 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_txinit(wlc_hw->di[i]); di 3349 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_rxinit(wlc_hw->di[RX_FIFO]); di 3350 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_rxfill(wlc_hw->di[RX_FIFO]); di 4231 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_rxfill(wlc->hw->di[RX_FIFO]); di 6858 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma = wlc->hw->di[fifo]; di 6923 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c struct dma_pub *dma = wlc->hw->di[fifo]; di 7568 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dmah = hw->di[i]; di 7584 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c for (i = 0; i < ARRAY_SIZE(wlc->hw->di); i++) di 7585 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c if (wlc->hw->di[i]) di 7586 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_kick_tx(wlc->hw->di[i]); di 7725 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c morepending = dma_rx(wlc_hw->di[fifo], &recv_frames); di 7730 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c dma_rxfill(wlc_hw->di[fifo]); di 317 drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.h struct dma_pub *di[NFIFO]; /* dma handles, per fifo */ di 466 drivers/net/wireless/intersil/p54/p54spi.c struct p54s_tx_info *di = (struct p54s_tx_info *) mi->data; di 469 drivers/net/wireless/intersil/p54/p54spi.c BUILD_BUG_ON(sizeof(*di) > sizeof((mi->data))); di 472 drivers/net/wireless/intersil/p54/p54spi.c list_add_tail(&di->tx_list, &priv->tx_pending); di 549 drivers/net/wireless/marvell/mwl8k.c struct mwl8k_device_info *di = priv->device_info; di 552 drivers/net/wireless/marvell/mwl8k.c if (di->helper_image != NULL) { di 554 drivers/net/wireless/marvell/mwl8k.c rc = mwl8k_request_fw(priv, di->helper_image, di 557 drivers/net/wireless/marvell/mwl8k.c rc = mwl8k_request_fw(priv, di->helper_image, di 561 drivers/net/wireless/marvell/mwl8k.c pci_name(priv->pdev), di->helper_image); di 4803 drivers/net/wireless/marvell/mwl8k.c struct mwl8k_device_info *di; di 4816 drivers/net/wireless/marvell/mwl8k.c di = priv->device_info; di 4819 drivers/net/wireless/marvell/mwl8k.c if (!priv->ap_fw && di->fw_image_ap) { di 4823 drivers/net/wireless/marvell/mwl8k.c rc = mwl8k_reload_firmware(hw, di->fw_image_ap); di 4830 drivers/net/wireless/marvell/mwl8k.c if (priv->ap_fw && di->fw_image_sta) { di 4839 drivers/net/wireless/marvell/mwl8k.c di->fw_image_sta); di 4904 drivers/net/wireless/marvell/mwl8k.c struct mwl8k_device_info *di; di 4914 drivers/net/wireless/marvell/mwl8k.c di = priv->device_info; di 4918 drivers/net/wireless/marvell/mwl8k.c rc = mwl8k_reload_firmware(hw, di->fw_image_ap); di 4920 drivers/net/wireless/marvell/mwl8k.c rc = mwl8k_reload_firmware(hw, di->fw_image_sta); di 5730 drivers/net/wireless/marvell/mwl8k.c struct mwl8k_device_info *di = priv->device_info; di 5737 drivers/net/wireless/marvell/mwl8k.c pci_name(priv->pdev), di->helper_image); di 5776 drivers/net/wireless/marvell/mwl8k.c pci_name(priv->pdev), di->helper_image); di 6188 drivers/net/wireless/marvell/mwl8k.c struct mwl8k_device_info *di; di 6259 drivers/net/wireless/marvell/mwl8k.c di = priv->device_info; di 6260 drivers/net/wireless/marvell/mwl8k.c if (ap_mode_default && di->fw_image_ap) { di 6261 drivers/net/wireless/marvell/mwl8k.c priv->fw_pref = di->fw_image_ap; di 6262 drivers/net/wireless/marvell/mwl8k.c priv->fw_alt = di->fw_image_sta; di 6263 drivers/net/wireless/marvell/mwl8k.c } else if (!ap_mode_default && di->fw_image_sta) { di 6264 drivers/net/wireless/marvell/mwl8k.c priv->fw_pref = di->fw_image_sta; di 6265 drivers/net/wireless/marvell/mwl8k.c priv->fw_alt = di->fw_image_ap; di 6266 drivers/net/wireless/marvell/mwl8k.c } else if (ap_mode_default && !di->fw_image_ap && di->fw_image_sta) { di 6268 drivers/net/wireless/marvell/mwl8k.c priv->fw_pref = di->fw_image_sta; di 6269 drivers/net/wireless/marvell/mwl8k.c } else if (!ap_mode_default && !di->fw_image_sta && di->fw_image_ap) { di 6271 drivers/net/wireless/marvell/mwl8k.c priv->fw_pref = di->fw_image_ap; di 140 drivers/power/supply/ab8500_btemp.c static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di, di 145 drivers/power/supply/ab8500_btemp.c if (is_ab8500_1p1_or_earlier(di->parent)) { di 153 drivers/power/supply/ab8500_btemp.c if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL) { di 159 drivers/power/supply/ab8500_btemp.c - di->bm->gnd_lift_resistance * inst_curr) di 160 drivers/power/supply/ab8500_btemp.c / di->curr_source; di 178 drivers/power/supply/ab8500_btemp.c static int ab8500_btemp_read_batctrl_voltage(struct ab8500_btemp *di) di 183 drivers/power/supply/ab8500_btemp.c vbtemp = ab8500_gpadc_convert(di->gpadc, BAT_CTRL); di 185 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, di 201 drivers/power/supply/ab8500_btemp.c static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di, di 211 drivers/power/supply/ab8500_btemp.c if (is_ab8500_1p1_or_earlier(di->parent)) di 215 drivers/power/supply/ab8500_btemp.c if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) { di 217 drivers/power/supply/ab8500_btemp.c if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA) di 222 drivers/power/supply/ab8500_btemp.c dev_dbg(di->dev, "Set BATCTRL %duA\n", di->curr_source); di 224 drivers/power/supply/ab8500_btemp.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 228 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "%s failed setting cmp_force\n", di 240 drivers/power/supply/ab8500_btemp.c ret = abx500_set_register_interruptible(di->dev, di 244 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "%s failed enabling current source\n", di 248 drivers/power/supply/ab8500_btemp.c } else if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) { di 249 drivers/power/supply/ab8500_btemp.c dev_dbg(di->dev, "Disable BATCTRL curr source\n"); di 253 drivers/power/supply/ab8500_btemp.c di->dev, di 259 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "%s failed disabling current source\n", di 265 drivers/power/supply/ab8500_btemp.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 270 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "%s failed enabling PU and comp\n", di 283 drivers/power/supply/ab8500_btemp.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 287 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "%s failed disabling force comp\n", di 300 drivers/power/supply/ab8500_btemp.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 306 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "%s failed disabling current source\n", di 312 drivers/power/supply/ab8500_btemp.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 317 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "%s failed enabling PU and comp\n", di 331 drivers/power/supply/ab8500_btemp.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 335 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "%s failed disabling force comp\n", di 350 drivers/power/supply/ab8500_btemp.c static int ab8500_btemp_get_batctrl_res(struct ab8500_btemp *di) di 362 drivers/power/supply/ab8500_btemp.c ret = ab8500_btemp_curr_source_enable(di, true); di 364 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "%s curr source enabled failed\n", __func__); di 368 drivers/power/supply/ab8500_btemp.c if (!di->fg) di 369 drivers/power/supply/ab8500_btemp.c di->fg = ab8500_fg_get(); di 370 drivers/power/supply/ab8500_btemp.c if (!di->fg) { di 371 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "No fg found\n"); di 375 drivers/power/supply/ab8500_btemp.c ret = ab8500_fg_inst_curr_start(di->fg); di 378 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "Failed to start current measurement\n"); di 384 drivers/power/supply/ab8500_btemp.c } while (!ab8500_fg_inst_curr_started(di->fg)); di 389 drivers/power/supply/ab8500_btemp.c batctrl += ab8500_btemp_read_batctrl_voltage(di); di 392 drivers/power/supply/ab8500_btemp.c } while (!ab8500_fg_inst_curr_done(di->fg)); di 395 drivers/power/supply/ab8500_btemp.c ret = ab8500_fg_inst_curr_finalize(di->fg, &inst_curr); di 397 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "Failed to finalize current measurement\n"); di 401 drivers/power/supply/ab8500_btemp.c res = ab8500_btemp_batctrl_volt_to_res(di, batctrl, inst_curr); di 403 drivers/power/supply/ab8500_btemp.c ret = ab8500_btemp_curr_source_enable(di, false); di 405 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "%s curr source disable failed\n", __func__); di 409 drivers/power/supply/ab8500_btemp.c dev_dbg(di->dev, "%s batctrl: %d res: %d inst_curr: %d samples: %d\n", di 425 drivers/power/supply/ab8500_btemp.c static int ab8500_btemp_res_to_temp(struct ab8500_btemp *di, di 456 drivers/power/supply/ab8500_btemp.c static int ab8500_btemp_measure_temp(struct ab8500_btemp *di) di 463 drivers/power/supply/ab8500_btemp.c id = di->bm->batt_id; di 465 drivers/power/supply/ab8500_btemp.c if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && di 468 drivers/power/supply/ab8500_btemp.c rbat = ab8500_btemp_get_batctrl_res(di); di 470 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "%s get batctrl res failed\n", di 479 drivers/power/supply/ab8500_btemp.c temp = ab8500_btemp_res_to_temp(di, di 480 drivers/power/supply/ab8500_btemp.c di->bm->bat_type[id].r_to_t_tbl, di 481 drivers/power/supply/ab8500_btemp.c di->bm->bat_type[id].n_temp_tbl_elements, rbat); di 483 drivers/power/supply/ab8500_btemp.c vntc = ab8500_gpadc_convert(di->gpadc, BTEMP_BALL); di 485 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, di 496 drivers/power/supply/ab8500_btemp.c temp = ab8500_btemp_res_to_temp(di, di 497 drivers/power/supply/ab8500_btemp.c di->bm->bat_type[id].r_to_t_tbl, di 498 drivers/power/supply/ab8500_btemp.c di->bm->bat_type[id].n_temp_tbl_elements, rntc); di 501 drivers/power/supply/ab8500_btemp.c dev_dbg(di->dev, "Battery temperature is %d\n", temp); di 513 drivers/power/supply/ab8500_btemp.c static int ab8500_btemp_id(struct ab8500_btemp *di) di 518 drivers/power/supply/ab8500_btemp.c di->curr_source = BTEMP_BATCTRL_CURR_SRC_7UA; di 519 drivers/power/supply/ab8500_btemp.c di->bm->batt_id = BATTERY_UNKNOWN; di 521 drivers/power/supply/ab8500_btemp.c res = ab8500_btemp_get_batctrl_res(di); di 523 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "%s get batctrl res failed\n", __func__); di 528 drivers/power/supply/ab8500_btemp.c for (i = BATTERY_UNKNOWN + 1; i < di->bm->n_btypes; i++) { di 529 drivers/power/supply/ab8500_btemp.c if ((res <= di->bm->bat_type[i].resis_high) && di 530 drivers/power/supply/ab8500_btemp.c (res >= di->bm->bat_type[i].resis_low)) { di 531 drivers/power/supply/ab8500_btemp.c dev_dbg(di->dev, "Battery detected on %s" di 534 drivers/power/supply/ab8500_btemp.c di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL ? di 536 drivers/power/supply/ab8500_btemp.c di->bm->bat_type[i].resis_low, res, di 537 drivers/power/supply/ab8500_btemp.c di->bm->bat_type[i].resis_high, i); di 539 drivers/power/supply/ab8500_btemp.c di->bm->batt_id = i; di 544 drivers/power/supply/ab8500_btemp.c if (di->bm->batt_id == BATTERY_UNKNOWN) { di 545 drivers/power/supply/ab8500_btemp.c dev_warn(di->dev, "Battery identified as unknown" di 554 drivers/power/supply/ab8500_btemp.c if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && di 555 drivers/power/supply/ab8500_btemp.c di->bm->batt_id == 1) { di 556 drivers/power/supply/ab8500_btemp.c dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n"); di 557 drivers/power/supply/ab8500_btemp.c di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA; di 560 drivers/power/supply/ab8500_btemp.c return di->bm->batt_id; di 573 drivers/power/supply/ab8500_btemp.c struct ab8500_btemp *di = container_of(work, di 576 drivers/power/supply/ab8500_btemp.c if (!di->initialized) { di 578 drivers/power/supply/ab8500_btemp.c if (ab8500_btemp_id(di) < 0) di 579 drivers/power/supply/ab8500_btemp.c dev_warn(di->dev, "failed to identify the battery\n"); di 582 drivers/power/supply/ab8500_btemp.c bat_temp = ab8500_btemp_measure_temp(di); di 589 drivers/power/supply/ab8500_btemp.c if ((bat_temp == di->prev_bat_temp) || !di->initialized) { di 590 drivers/power/supply/ab8500_btemp.c if ((di->bat_temp != di->prev_bat_temp) || !di->initialized) { di 591 drivers/power/supply/ab8500_btemp.c di->initialized = true; di 592 drivers/power/supply/ab8500_btemp.c di->bat_temp = bat_temp; di 593 drivers/power/supply/ab8500_btemp.c power_supply_changed(di->btemp_psy); di 595 drivers/power/supply/ab8500_btemp.c } else if (bat_temp < di->prev_bat_temp) { di 596 drivers/power/supply/ab8500_btemp.c di->bat_temp--; di 597 drivers/power/supply/ab8500_btemp.c power_supply_changed(di->btemp_psy); di 598 drivers/power/supply/ab8500_btemp.c } else if (bat_temp > di->prev_bat_temp) { di 599 drivers/power/supply/ab8500_btemp.c di->bat_temp++; di 600 drivers/power/supply/ab8500_btemp.c power_supply_changed(di->btemp_psy); di 602 drivers/power/supply/ab8500_btemp.c di->prev_bat_temp = bat_temp; di 604 drivers/power/supply/ab8500_btemp.c if (di->events.ac_conn || di->events.usb_conn) di 605 drivers/power/supply/ab8500_btemp.c interval = di->bm->temp_interval_chg; di 607 drivers/power/supply/ab8500_btemp.c interval = di->bm->temp_interval_nochg; di 610 drivers/power/supply/ab8500_btemp.c queue_delayed_work(di->btemp_wq, di 611 drivers/power/supply/ab8500_btemp.c &di->btemp_periodic_work, di 624 drivers/power/supply/ab8500_btemp.c struct ab8500_btemp *di = _di; di 625 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "Battery removal detected!\n"); di 627 drivers/power/supply/ab8500_btemp.c di->events.batt_rem = true; di 628 drivers/power/supply/ab8500_btemp.c power_supply_changed(di->btemp_psy); di 642 drivers/power/supply/ab8500_btemp.c struct ab8500_btemp *di = _di; di 644 drivers/power/supply/ab8500_btemp.c if (is_ab8500_3p3_or_earlier(di->parent)) { di 645 drivers/power/supply/ab8500_btemp.c dev_dbg(di->dev, "Ignore false btemp low irq" di 648 drivers/power/supply/ab8500_btemp.c dev_crit(di->dev, "Battery temperature lower than -10deg c\n"); di 650 drivers/power/supply/ab8500_btemp.c di->events.btemp_low = true; di 651 drivers/power/supply/ab8500_btemp.c di->events.btemp_high = false; di 652 drivers/power/supply/ab8500_btemp.c di->events.btemp_medhigh = false; di 653 drivers/power/supply/ab8500_btemp.c di->events.btemp_lowmed = false; di 654 drivers/power/supply/ab8500_btemp.c power_supply_changed(di->btemp_psy); di 669 drivers/power/supply/ab8500_btemp.c struct ab8500_btemp *di = _di; di 671 drivers/power/supply/ab8500_btemp.c dev_crit(di->dev, "Battery temperature is higher than MAX temp\n"); di 673 drivers/power/supply/ab8500_btemp.c di->events.btemp_high = true; di 674 drivers/power/supply/ab8500_btemp.c di->events.btemp_medhigh = false; di 675 drivers/power/supply/ab8500_btemp.c di->events.btemp_lowmed = false; di 676 drivers/power/supply/ab8500_btemp.c di->events.btemp_low = false; di 677 drivers/power/supply/ab8500_btemp.c power_supply_changed(di->btemp_psy); di 691 drivers/power/supply/ab8500_btemp.c struct ab8500_btemp *di = _di; di 693 drivers/power/supply/ab8500_btemp.c dev_dbg(di->dev, "Battery temperature is between low and medium\n"); di 695 drivers/power/supply/ab8500_btemp.c di->events.btemp_lowmed = true; di 696 drivers/power/supply/ab8500_btemp.c di->events.btemp_medhigh = false; di 697 drivers/power/supply/ab8500_btemp.c di->events.btemp_high = false; di 698 drivers/power/supply/ab8500_btemp.c di->events.btemp_low = false; di 699 drivers/power/supply/ab8500_btemp.c power_supply_changed(di->btemp_psy); di 713 drivers/power/supply/ab8500_btemp.c struct ab8500_btemp *di = _di; di 715 drivers/power/supply/ab8500_btemp.c dev_dbg(di->dev, "Battery temperature is between medium and high\n"); di 717 drivers/power/supply/ab8500_btemp.c di->events.btemp_medhigh = true; di 718 drivers/power/supply/ab8500_btemp.c di->events.btemp_lowmed = false; di 719 drivers/power/supply/ab8500_btemp.c di->events.btemp_high = false; di 720 drivers/power/supply/ab8500_btemp.c di->events.btemp_low = false; di 721 drivers/power/supply/ab8500_btemp.c power_supply_changed(di->btemp_psy); di 734 drivers/power/supply/ab8500_btemp.c static void ab8500_btemp_periodic(struct ab8500_btemp *di, di 737 drivers/power/supply/ab8500_btemp.c dev_dbg(di->dev, "Enable periodic temperature measurements: %d\n", di 743 drivers/power/supply/ab8500_btemp.c cancel_delayed_work_sync(&di->btemp_periodic_work); di 746 drivers/power/supply/ab8500_btemp.c queue_delayed_work(di->btemp_wq, &di->btemp_periodic_work, 0); di 755 drivers/power/supply/ab8500_btemp.c int ab8500_btemp_get_temp(struct ab8500_btemp *di) di 763 drivers/power/supply/ab8500_btemp.c if (is_ab8500_3p3_or_earlier(di->parent)) { di 764 drivers/power/supply/ab8500_btemp.c temp = di->bat_temp * 10; di 766 drivers/power/supply/ab8500_btemp.c if (di->events.btemp_low) { di 767 drivers/power/supply/ab8500_btemp.c if (temp > di->btemp_ranges.btemp_low_limit) di 768 drivers/power/supply/ab8500_btemp.c temp = di->btemp_ranges.btemp_low_limit * 10; di 770 drivers/power/supply/ab8500_btemp.c temp = di->bat_temp * 10; di 771 drivers/power/supply/ab8500_btemp.c } else if (di->events.btemp_high) { di 772 drivers/power/supply/ab8500_btemp.c if (temp < di->btemp_ranges.btemp_high_limit) di 773 drivers/power/supply/ab8500_btemp.c temp = di->btemp_ranges.btemp_high_limit * 10; di 775 drivers/power/supply/ab8500_btemp.c temp = di->bat_temp * 10; di 776 drivers/power/supply/ab8500_btemp.c } else if (di->events.btemp_lowmed) { di 777 drivers/power/supply/ab8500_btemp.c if (temp > di->btemp_ranges.btemp_med_limit) di 778 drivers/power/supply/ab8500_btemp.c temp = di->btemp_ranges.btemp_med_limit * 10; di 780 drivers/power/supply/ab8500_btemp.c temp = di->bat_temp * 10; di 781 drivers/power/supply/ab8500_btemp.c } else if (di->events.btemp_medhigh) { di 782 drivers/power/supply/ab8500_btemp.c if (temp < di->btemp_ranges.btemp_med_limit) di 783 drivers/power/supply/ab8500_btemp.c temp = di->btemp_ranges.btemp_med_limit * 10; di 785 drivers/power/supply/ab8500_btemp.c temp = di->bat_temp * 10; di 787 drivers/power/supply/ab8500_btemp.c temp = di->bat_temp * 10; di 823 drivers/power/supply/ab8500_btemp.c struct ab8500_btemp *di = power_supply_get_drvdata(psy); di 828 drivers/power/supply/ab8500_btemp.c if (di->events.batt_rem) di 834 drivers/power/supply/ab8500_btemp.c val->intval = di->bm->bat_type[di->bm->batt_id].name; di 837 drivers/power/supply/ab8500_btemp.c val->intval = ab8500_btemp_get_temp(di); di 850 drivers/power/supply/ab8500_btemp.c struct ab8500_btemp *di; di 855 drivers/power/supply/ab8500_btemp.c di = power_supply_get_drvdata(psy); di 878 drivers/power/supply/ab8500_btemp.c if (!ret.intval && di->events.ac_conn) { di 879 drivers/power/supply/ab8500_btemp.c di->events.ac_conn = false; di 882 drivers/power/supply/ab8500_btemp.c else if (ret.intval && !di->events.ac_conn) { di 883 drivers/power/supply/ab8500_btemp.c di->events.ac_conn = true; di 884 drivers/power/supply/ab8500_btemp.c if (!di->events.usb_conn) di 885 drivers/power/supply/ab8500_btemp.c ab8500_btemp_periodic(di, true); di 890 drivers/power/supply/ab8500_btemp.c if (!ret.intval && di->events.usb_conn) { di 891 drivers/power/supply/ab8500_btemp.c di->events.usb_conn = false; di 894 drivers/power/supply/ab8500_btemp.c else if (ret.intval && !di->events.usb_conn) { di 895 drivers/power/supply/ab8500_btemp.c di->events.usb_conn = true; di 896 drivers/power/supply/ab8500_btemp.c if (!di->events.ac_conn) di 897 drivers/power/supply/ab8500_btemp.c ab8500_btemp_periodic(di, true); di 922 drivers/power/supply/ab8500_btemp.c struct ab8500_btemp *di = power_supply_get_drvdata(psy); di 925 drivers/power/supply/ab8500_btemp.c di->btemp_psy, ab8500_btemp_get_ext_psy_data); di 940 drivers/power/supply/ab8500_btemp.c struct ab8500_btemp *di = platform_get_drvdata(pdev); di 942 drivers/power/supply/ab8500_btemp.c ab8500_btemp_periodic(di, true); di 950 drivers/power/supply/ab8500_btemp.c struct ab8500_btemp *di = platform_get_drvdata(pdev); di 952 drivers/power/supply/ab8500_btemp.c ab8500_btemp_periodic(di, false); di 963 drivers/power/supply/ab8500_btemp.c struct ab8500_btemp *di = platform_get_drvdata(pdev); di 969 drivers/power/supply/ab8500_btemp.c free_irq(irq, di); di 973 drivers/power/supply/ab8500_btemp.c destroy_workqueue(di->btemp_wq); di 976 drivers/power/supply/ab8500_btemp.c power_supply_unregister(di->btemp_psy); di 1000 drivers/power/supply/ab8500_btemp.c struct ab8500_btemp *di; di 1004 drivers/power/supply/ab8500_btemp.c di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); di 1005 drivers/power/supply/ab8500_btemp.c if (!di) { di 1014 drivers/power/supply/ab8500_btemp.c di->bm = plat; di 1017 drivers/power/supply/ab8500_btemp.c ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm); di 1025 drivers/power/supply/ab8500_btemp.c di->dev = &pdev->dev; di 1026 drivers/power/supply/ab8500_btemp.c di->parent = dev_get_drvdata(pdev->dev.parent); di 1027 drivers/power/supply/ab8500_btemp.c di->gpadc = ab8500_gpadc_get("ab8500-gpadc.0"); di 1029 drivers/power/supply/ab8500_btemp.c di->initialized = false; di 1033 drivers/power/supply/ab8500_btemp.c psy_cfg.drv_data = di; di 1036 drivers/power/supply/ab8500_btemp.c di->btemp_wq = di 1038 drivers/power/supply/ab8500_btemp.c if (di->btemp_wq == NULL) { di 1039 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "failed to create work queue\n"); di 1044 drivers/power/supply/ab8500_btemp.c INIT_DEFERRABLE_WORK(&di->btemp_periodic_work, di 1048 drivers/power/supply/ab8500_btemp.c di->btemp_ranges.btemp_low_limit = BTEMP_THERMAL_LOW_LIMIT; di 1049 drivers/power/supply/ab8500_btemp.c di->btemp_ranges.btemp_med_limit = BTEMP_THERMAL_MED_LIMIT; di 1051 drivers/power/supply/ab8500_btemp.c ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, di 1054 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 1060 drivers/power/supply/ab8500_btemp.c di->btemp_ranges.btemp_high_limit = di 1064 drivers/power/supply/ab8500_btemp.c di->btemp_ranges.btemp_high_limit = di 1068 drivers/power/supply/ab8500_btemp.c di->btemp_ranges.btemp_high_limit = di 1074 drivers/power/supply/ab8500_btemp.c di->btemp_psy = power_supply_register(di->dev, &ab8500_btemp_desc, di 1076 drivers/power/supply/ab8500_btemp.c if (IS_ERR(di->btemp_psy)) { di 1077 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "failed to register BTEMP psy\n"); di 1078 drivers/power/supply/ab8500_btemp.c ret = PTR_ERR(di->btemp_psy); di 1087 drivers/power/supply/ab8500_btemp.c ab8500_btemp_irq[i].name, di); di 1090 drivers/power/supply/ab8500_btemp.c dev_err(di->dev, "failed to request %s IRQ %d: %d\n" di 1094 drivers/power/supply/ab8500_btemp.c dev_dbg(di->dev, "Requested %s IRQ %d: %d\n", di 1098 drivers/power/supply/ab8500_btemp.c platform_set_drvdata(pdev, di); di 1101 drivers/power/supply/ab8500_btemp.c ab8500_btemp_periodic(di, true); di 1102 drivers/power/supply/ab8500_btemp.c list_add_tail(&di->node, &ab8500_btemp_list); di 1107 drivers/power/supply/ab8500_btemp.c power_supply_unregister(di->btemp_psy); di 1112 drivers/power/supply/ab8500_btemp.c free_irq(irq, di); di 1115 drivers/power/supply/ab8500_btemp.c destroy_workqueue(di->btemp_wq); di 342 drivers/power/supply/ab8500_charger.c static void ab8500_enable_disable_sw_fallback(struct ab8500_charger *di, di 351 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "SW Fallback: %d\n", fallback); di 353 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) { di 364 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, bank, reg, &val); di 366 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%d read failed\n", __LINE__); di 370 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) { di 372 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, 0x11, 0x00, 0x2); di 374 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%d write failed\n", __LINE__); di 385 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, bank, reg, val); di 387 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%d write failed\n", __LINE__); di 391 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) { di 393 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, 0x11, 0x00, 0x0); di 395 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%d write failed\n", __LINE__); di 407 drivers/power/supply/ab8500_charger.c static void ab8500_power_supply_changed(struct ab8500_charger *di, di 410 drivers/power/supply/ab8500_charger.c if (di->autopower_cfg) { di 411 drivers/power/supply/ab8500_charger.c if (!di->usb.charger_connected && di 412 drivers/power/supply/ab8500_charger.c !di->ac.charger_connected && di 413 drivers/power/supply/ab8500_charger.c di->autopower) { di 414 drivers/power/supply/ab8500_charger.c di->autopower = false; di 415 drivers/power/supply/ab8500_charger.c ab8500_enable_disable_sw_fallback(di, false); di 416 drivers/power/supply/ab8500_charger.c } else if (!di->autopower && di 417 drivers/power/supply/ab8500_charger.c (di->ac.charger_connected || di 418 drivers/power/supply/ab8500_charger.c di->usb.charger_connected)) { di 419 drivers/power/supply/ab8500_charger.c di->autopower = true; di 420 drivers/power/supply/ab8500_charger.c ab8500_enable_disable_sw_fallback(di, true); di 426 drivers/power/supply/ab8500_charger.c static void ab8500_charger_set_usb_connected(struct ab8500_charger *di, di 429 drivers/power/supply/ab8500_charger.c if (connected != di->usb.charger_connected) { di 430 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "USB connected:%i\n", connected); di 431 drivers/power/supply/ab8500_charger.c di->usb.charger_connected = connected; di 434 drivers/power/supply/ab8500_charger.c di->flags.vbus_drop_end = false; di 436 drivers/power/supply/ab8500_charger.c sysfs_notify(&di->usb_chg.psy->dev.kobj, NULL, "present"); di 439 drivers/power/supply/ab8500_charger.c mutex_lock(&di->charger_attached_mutex); di 440 drivers/power/supply/ab8500_charger.c mutex_unlock(&di->charger_attached_mutex); di 442 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) di 443 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 444 drivers/power/supply/ab8500_charger.c &di->usb_charger_attached_work, di 447 drivers/power/supply/ab8500_charger.c cancel_delayed_work_sync(&di->usb_charger_attached_work); di 448 drivers/power/supply/ab8500_charger.c mutex_lock(&di->charger_attached_mutex); di 449 drivers/power/supply/ab8500_charger.c mutex_unlock(&di->charger_attached_mutex); di 460 drivers/power/supply/ab8500_charger.c static int ab8500_charger_get_ac_voltage(struct ab8500_charger *di) di 465 drivers/power/supply/ab8500_charger.c if (di->ac.charger_connected) { di 466 drivers/power/supply/ab8500_charger.c vch = ab8500_gpadc_convert(di->gpadc, MAIN_CHARGER_V); di 468 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s gpadc conv failed,\n", __func__); di 481 drivers/power/supply/ab8500_charger.c static int ab8500_charger_ac_cv(struct ab8500_charger *di) di 487 drivers/power/supply/ab8500_charger.c if (di->ac.charger_online) { di 488 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, di 491 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 511 drivers/power/supply/ab8500_charger.c static int ab8500_charger_get_vbus_voltage(struct ab8500_charger *di) di 516 drivers/power/supply/ab8500_charger.c if (di->usb.charger_connected) { di 517 drivers/power/supply/ab8500_charger.c vch = ab8500_gpadc_convert(di->gpadc, VBUS_V); di 519 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s gpadc conv failed\n", __func__); di 533 drivers/power/supply/ab8500_charger.c static int ab8500_charger_get_usb_current(struct ab8500_charger *di) di 538 drivers/power/supply/ab8500_charger.c if (di->usb.charger_online) { di 539 drivers/power/supply/ab8500_charger.c ich = ab8500_gpadc_convert(di->gpadc, USB_CHARGER_C); di 541 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s gpadc conv failed\n", __func__); di 555 drivers/power/supply/ab8500_charger.c static int ab8500_charger_get_ac_current(struct ab8500_charger *di) di 560 drivers/power/supply/ab8500_charger.c if (di->ac.charger_online) { di 561 drivers/power/supply/ab8500_charger.c ich = ab8500_gpadc_convert(di->gpadc, MAIN_CHARGER_C); di 563 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s gpadc conv failed\n", __func__); di 576 drivers/power/supply/ab8500_charger.c static int ab8500_charger_usb_cv(struct ab8500_charger *di) di 582 drivers/power/supply/ab8500_charger.c if (di->usb.charger_online) { di 583 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, di 586 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 618 drivers/power/supply/ab8500_charger.c static int ab8500_charger_detect_chargers(struct ab8500_charger *di, bool probe) di 625 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, di 628 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 646 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, di 649 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 652 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, di 670 drivers/power/supply/ab8500_charger.c static int ab8500_charger_max_usb_curr(struct ab8500_charger *di, di 675 drivers/power/supply/ab8500_charger.c di->usb_device_is_unrecognised = false; di 688 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "USB Type - Standard host is " di 690 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P5; di 691 drivers/power/supply/ab8500_charger.c di->is_aca_rid = 0; di 694 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P5; di 695 drivers/power/supply/ab8500_charger.c di->is_aca_rid = 0; di 698 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P5; di 699 drivers/power/supply/ab8500_charger.c di->is_aca_rid = 0; di 702 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P9; di 703 drivers/power/supply/ab8500_charger.c di->is_aca_rid = 0; di 710 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "USB_STAT_ACA_RID_A detected\n"); di 711 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P5; di 712 drivers/power/supply/ab8500_charger.c di->is_aca_rid = 1; di 719 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_1P3; di 720 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "USB Type - 0x%02x MaxCurr: %d", link_status, di 721 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max); di 722 drivers/power/supply/ab8500_charger.c di->is_aca_rid = 1; di 725 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P5; di 726 drivers/power/supply/ab8500_charger.c di->is_aca_rid = 0; di 729 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_1P5; di 730 drivers/power/supply/ab8500_charger.c di->is_aca_rid = 0; di 734 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_1P5; di 735 drivers/power/supply/ab8500_charger.c di->is_aca_rid = 1; di 738 drivers/power/supply/ab8500_charger.c if (di->vbus_detected) { di 739 drivers/power/supply/ab8500_charger.c di->usb_device_is_unrecognised = true; di 740 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "USB Type - Legacy charger.\n"); di 741 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = di 747 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "USB Type - Charging not allowed\n"); di 748 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P05; di 752 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) { di 753 drivers/power/supply/ab8500_charger.c di->flags.vbus_collapse = true; di 754 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "USB Type - USB_STAT_RESERVED " di 759 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "USB Type - Charging not allowed\n"); di 760 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = di 762 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "USB Type - 0x%02x MaxCurr: %d", di 764 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max); di 772 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P5; di 773 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "USB Type - 0x%02x MaxCurr: %d", link_status, di 774 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max); di 777 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "USB Type invalid - try charging anyway\n"); di 778 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P5; di 782 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "USB Type - Unknown\n"); di 783 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P05; di 788 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.set_max = di->max_usb_in_curr.usb_type_max; di 789 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "USB Type - 0x%02x MaxCurr: %d", di 790 drivers/power/supply/ab8500_charger.c link_status, di->max_usb_in_curr.set_max); di 802 drivers/power/supply/ab8500_charger.c static int ab8500_charger_read_usb_type(struct ab8500_charger *di) di 807 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 810 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 813 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) di 814 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, AB8500_USB, di 817 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 820 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 825 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) di 829 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_max_usb_curr(di, di 842 drivers/power/supply/ab8500_charger.c static int ab8500_charger_detect_usb_type(struct ab8500_charger *di) di 854 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 857 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "%s AB8500_IT_SOURCE21_REG %x\n", di 860 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 864 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) di 865 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 868 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 871 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 874 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "%s AB8500_USB_LINE_STAT_REG %x\n", __func__, di 883 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) di 892 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_max_usb_curr(di, di 1004 drivers/power/supply/ab8500_charger.c static int ab8500_current_to_regval(struct ab8500_charger *di, int curr) di 1008 drivers/power/supply/ab8500_charger.c if (curr < di->bm->chg_output_curr[0]) di 1011 drivers/power/supply/ab8500_charger.c for (i = 0; i < di->bm->n_chg_out_curr; i++) { di 1012 drivers/power/supply/ab8500_charger.c if (curr < di->bm->chg_output_curr[i]) di 1017 drivers/power/supply/ab8500_charger.c i = di->bm->n_chg_out_curr - 1; di 1018 drivers/power/supply/ab8500_charger.c if (curr == di->bm->chg_output_curr[i]) di 1024 drivers/power/supply/ab8500_charger.c static int ab8500_vbus_in_curr_to_regval(struct ab8500_charger *di, int curr) di 1028 drivers/power/supply/ab8500_charger.c if (curr < di->bm->chg_input_curr[0]) di 1031 drivers/power/supply/ab8500_charger.c for (i = 0; i < di->bm->n_chg_in_curr; i++) { di 1032 drivers/power/supply/ab8500_charger.c if (curr < di->bm->chg_input_curr[i]) di 1037 drivers/power/supply/ab8500_charger.c i = di->bm->n_chg_in_curr - 1; di 1038 drivers/power/supply/ab8500_charger.c if (curr == di->bm->chg_input_curr[i]) di 1053 drivers/power/supply/ab8500_charger.c static int ab8500_charger_get_usb_cur(struct ab8500_charger *di) di 1056 drivers/power/supply/ab8500_charger.c switch (di->usb_state.usb_current) { di 1058 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P09; di 1061 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P19; di 1064 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P29; di 1067 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P38; di 1070 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P5; di 1073 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P05; di 1077 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.set_max = di->max_usb_in_curr.usb_type_max; di 1090 drivers/power/supply/ab8500_charger.c static bool ab8500_charger_check_continue_stepping(struct ab8500_charger *di, di 1094 drivers/power/supply/ab8500_charger.c return !di->flags.vbus_drop_end; di 1112 drivers/power/supply/ab8500_charger.c static int ab8500_charger_set_current(struct ab8500_charger *di, di 1121 drivers/power/supply/ab8500_charger.c atomic_inc(&di->current_stepping_sessions); di 1123 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, di 1126 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s read failed\n", __func__); di 1134 drivers/power/supply/ab8500_charger.c curr_index = ab8500_current_to_regval(di, ich); di 1136 drivers/power/supply/ab8500_charger.c if (!di->ac.charger_connected) di 1142 drivers/power/supply/ab8500_charger.c curr_index = ab8500_vbus_in_curr_to_regval(di, ich); di 1145 drivers/power/supply/ab8500_charger.c if (!di->usb.charger_connected) di 1151 drivers/power/supply/ab8500_charger.c curr_index = ab8500_current_to_regval(di, ich); di 1156 drivers/power/supply/ab8500_charger.c if (!di->usb.charger_connected && !di->ac.charger_connected) di 1161 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s current register not valid\n", __func__); di 1167 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "requested current limit out-of-range\n"); di 1174 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "%s current not changed for reg: 0x%02x\n", di 1180 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "%s set charger current: %d mA for reg: 0x%02x\n", di 1184 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, AB8500_CHARGER, di 1187 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s write failed\n", __func__); di 1190 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "curr change_1 to: %x for 0x%02x\n", di 1192 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, di 1195 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s write failed\n", __func__); di 1204 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "curr change_2 to: %x for 0x%02x\n", di 1206 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, di 1209 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s write failed\n", __func__); di 1215 drivers/power/supply/ab8500_charger.c allow = ab8500_charger_check_continue_stepping(di, reg); di 1220 drivers/power/supply/ab8500_charger.c atomic_dec(&di->current_stepping_sessions); di 1233 drivers/power/supply/ab8500_charger.c static int ab8500_charger_set_vbus_in_curr(struct ab8500_charger *di, di 1240 drivers/power/supply/ab8500_charger.c min_value = min(di->bm->chg_params->usb_curr_max, ich_in); di 1241 drivers/power/supply/ab8500_charger.c if (di->max_usb_in_curr.set_max > 0) di 1242 drivers/power/supply/ab8500_charger.c min_value = min(di->max_usb_in_curr.set_max, min_value); di 1244 drivers/power/supply/ab8500_charger.c if (di->usb_state.usb_current >= 0) di 1245 drivers/power/supply/ab8500_charger.c min_value = min(di->usb_state.usb_current, min_value); di 1249 drivers/power/supply/ab8500_charger.c if (di->vbat < VBAT_TRESH_IP_CUR_RED) di 1253 drivers/power/supply/ab8500_charger.c if (di->vbat < VBAT_TRESH_IP_CUR_RED) di 1260 drivers/power/supply/ab8500_charger.c dev_info(di->dev, "VBUS input current limit set to %d mA\n", min_value); di 1262 drivers/power/supply/ab8500_charger.c mutex_lock(&di->usb_ipt_crnt_lock); di 1263 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_set_current(di, min_value, di 1265 drivers/power/supply/ab8500_charger.c mutex_unlock(&di->usb_ipt_crnt_lock); di 1278 drivers/power/supply/ab8500_charger.c static int ab8500_charger_set_main_in_curr(struct ab8500_charger *di, di 1281 drivers/power/supply/ab8500_charger.c return ab8500_charger_set_current(di, ich_in, di 1293 drivers/power/supply/ab8500_charger.c static int ab8500_charger_set_output_curr(struct ab8500_charger *di, di 1296 drivers/power/supply/ab8500_charger.c return ab8500_charger_set_current(di, ich_out, di 1308 drivers/power/supply/ab8500_charger.c static int ab8500_charger_led_en(struct ab8500_charger *di, int on) di 1314 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, AB8500_CHARGER, di 1318 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "Power ON LED failed\n"); di 1322 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, AB8500_CHARGER, di 1326 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "Set LED PWM duty cycle failed\n"); di 1331 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, AB8500_CHARGER, di 1335 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "Power-off LED failed\n"); di 1362 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = to_ab8500_charger_ac_device_info(charger); di 1366 drivers/power/supply/ab8500_charger.c if (!di->ac.charger_connected) { di 1367 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "AC charger not connected\n"); di 1372 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "Enable AC: %dmV %dmA\n", vset, iset); di 1384 drivers/power/supply/ab8500_charger.c if (!di->vddadc_en_ac) { di 1385 drivers/power/supply/ab8500_charger.c ret = regulator_enable(di->regu); di 1387 drivers/power/supply/ab8500_charger.c dev_warn(di->dev, di 1390 drivers/power/supply/ab8500_charger.c di->vddadc_en_ac = true; di 1395 drivers/power/supply/ab8500_charger.c curr_index = ab8500_current_to_regval(di, iset); di 1396 drivers/power/supply/ab8500_charger.c input_curr_index = ab8500_current_to_regval(di, di 1397 drivers/power/supply/ab8500_charger.c di->bm->chg_params->ac_curr_max); di 1399 drivers/power/supply/ab8500_charger.c dev_err(di->dev, di 1406 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, AB8500_CHARGER, di 1409 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s write failed\n", __func__); di 1413 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_set_main_in_curr(di, di 1414 drivers/power/supply/ab8500_charger.c di->bm->chg_params->ac_curr_max); di 1416 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s Failed to set MainChInputCurr\n", di 1421 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_set_output_curr(di, iset); di 1423 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s " di 1430 drivers/power/supply/ab8500_charger.c if (!di->bm->enable_overshoot) di 1434 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, AB8500_CHARGER, di 1437 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s write failed\n", __func__); di 1442 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_led_en(di, true); di 1444 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to enable LED\n"); di 1446 drivers/power/supply/ab8500_charger.c di->ac.charger_online = 1; di 1449 drivers/power/supply/ab8500_charger.c if (is_ab8500_1p1_or_earlier(di->parent)) { di 1460 drivers/power/supply/ab8500_charger.c if (di->ac_conn) { di 1461 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 1462 drivers/power/supply/ab8500_charger.c &di->kick_wd_work, di 1473 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, di 1477 drivers/power/supply/ab8500_charger.c dev_err(di->dev, di 1482 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_set_output_curr(di, 0); di 1484 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s " di 1490 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, di 1494 drivers/power/supply/ab8500_charger.c dev_err(di->dev, di 1500 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_led_en(di, false); di 1502 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to disable LED\n"); di 1504 drivers/power/supply/ab8500_charger.c di->ac.charger_online = 0; di 1505 drivers/power/supply/ab8500_charger.c di->ac.wd_expired = false; di 1508 drivers/power/supply/ab8500_charger.c if (di->vddadc_en_ac) { di 1509 drivers/power/supply/ab8500_charger.c regulator_disable(di->regu); di 1510 drivers/power/supply/ab8500_charger.c di->vddadc_en_ac = false; di 1513 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "%s Disabled AC charging\n", __func__); di 1515 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->ac_chg.psy); di 1538 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = to_ab8500_charger_usb_device_info(charger); di 1542 drivers/power/supply/ab8500_charger.c if (!di->usb.charger_connected) { di 1543 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "USB charger not connected\n"); di 1557 drivers/power/supply/ab8500_charger.c if (!di->vddadc_en_usb) { di 1558 drivers/power/supply/ab8500_charger.c ret = regulator_enable(di->regu); di 1560 drivers/power/supply/ab8500_charger.c dev_warn(di->dev, di 1563 drivers/power/supply/ab8500_charger.c di->vddadc_en_usb = true; di 1567 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "Enable USB: %dmV %dmA\n", vset, ich_out); di 1571 drivers/power/supply/ab8500_charger.c curr_index = ab8500_current_to_regval(di, ich_out); di 1573 drivers/power/supply/ab8500_charger.c dev_err(di->dev, di 1580 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, AB8500_CHARGER, di 1583 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s write failed\n", __func__); di 1587 drivers/power/supply/ab8500_charger.c if (!di->bm->enable_overshoot) di 1591 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, di 1593 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, AB8500_CHARGER, di 1596 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s write failed\n", __func__); di 1601 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_led_en(di, true); di 1603 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to enable LED\n"); di 1605 drivers/power/supply/ab8500_charger.c di->usb.charger_online = 1; di 1608 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_set_vbus_in_curr(di, di 1609 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max); di 1611 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "setting USBChInputCurr failed\n"); di 1616 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_set_output_curr(di, ich_out); di 1618 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s " di 1624 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, &di->check_vbat_work, HZ); di 1628 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "%s Disabled USB charging\n", __func__); di 1629 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, di 1633 drivers/power/supply/ab8500_charger.c dev_err(di->dev, di 1638 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_led_en(di, false); di 1640 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to disable LED\n"); di 1642 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_set_vbus_in_curr(di, 0); di 1644 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "setting USBChInputCurr failed\n"); di 1649 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_set_output_curr(di, 0); di 1651 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s " di 1656 drivers/power/supply/ab8500_charger.c di->usb.charger_online = 0; di 1657 drivers/power/supply/ab8500_charger.c di->usb.wd_expired = false; di 1660 drivers/power/supply/ab8500_charger.c if (di->vddadc_en_usb) { di 1661 drivers/power/supply/ab8500_charger.c regulator_disable(di->regu); di 1662 drivers/power/supply/ab8500_charger.c di->vddadc_en_usb = false; di 1665 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "%s Disabled USB charging\n", __func__); di 1668 drivers/power/supply/ab8500_charger.c cancel_delayed_work(&di->check_vbat_work); di 1671 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->usb_chg.psy); di 1714 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = to_ab8500_charger_usb_device_info(charger); di 1716 drivers/power/supply/ab8500_charger.c if (!di->usb.charger_connected) di 1719 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, di 1722 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "ab8500 read failed %d\n", __LINE__); di 1725 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "USB charger ctrl: 0x%02x\n", usbch_ctrl1); di 1728 drivers/power/supply/ab8500_charger.c dev_info(di->dev, "Charging has been disabled abnormally and will be re-enabled\n"); di 1730 drivers/power/supply/ab8500_charger.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 1734 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "ab8500 write failed %d\n", __LINE__); di 1738 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_usb_en(&di->usb_chg, true, vset, iset); di 1740 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "Failed to enable VBUS charger %d\n", di 1763 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = to_ab8500_charger_ac_device_info(charger); di 1765 drivers/power/supply/ab8500_charger.c if (!di->ac.charger_connected) di 1768 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, di 1771 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "ab8500 read failed %d\n", __LINE__); di 1774 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "AC charger ctrl: 0x%02x\n", mainch_ctrl1); di 1777 drivers/power/supply/ab8500_charger.c dev_info(di->dev, "Charging has been disabled abnormally and will be re-enabled\n"); di 1779 drivers/power/supply/ab8500_charger.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 1784 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "ab8500 write failed %d\n", __LINE__); di 1788 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_ac_en(&di->usb_chg, true, vset, iset); di 1790 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to enable AC charger %d\n", di 1808 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di; di 1811 drivers/power/supply/ab8500_charger.c di = to_ab8500_charger_ac_device_info(charger); di 1813 drivers/power/supply/ab8500_charger.c di = to_ab8500_charger_usb_device_info(charger); di 1817 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, AB8500_CHARGER, di 1820 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "Failed to kick WD!\n"); di 1836 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di; di 1839 drivers/power/supply/ab8500_charger.c di = to_ab8500_charger_ac_device_info(charger); di 1841 drivers/power/supply/ab8500_charger.c di = to_ab8500_charger_usb_device_info(charger); di 1845 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_set_output_curr(di, ich_out); di 1847 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s " di 1854 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, AB8500_CHARGER, di 1857 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s write failed\n", __func__); di 1869 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di; di 1877 drivers/power/supply/ab8500_charger.c di = to_ab8500_charger_usb_device_info(usb_chg); di 1896 drivers/power/supply/ab8500_charger.c di->vbat = ret.intval / 1000; di 1921 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = container_of(work, di 1925 drivers/power/supply/ab8500_charger.c di->usb_chg.psy, ab8500_charger_get_ext_psy_data); di 1928 drivers/power/supply/ab8500_charger.c if (di->old_vbat == 0) di 1929 drivers/power/supply/ab8500_charger.c di->old_vbat = di->vbat; di 1931 drivers/power/supply/ab8500_charger.c if (!((di->old_vbat <= VBAT_TRESH_IP_CUR_RED && di 1932 drivers/power/supply/ab8500_charger.c di->vbat <= VBAT_TRESH_IP_CUR_RED) || di 1933 drivers/power/supply/ab8500_charger.c (di->old_vbat > VBAT_TRESH_IP_CUR_RED && di 1934 drivers/power/supply/ab8500_charger.c di->vbat > VBAT_TRESH_IP_CUR_RED))) { di 1936 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "Vbat did cross threshold, curr: %d, new: %d," di 1937 drivers/power/supply/ab8500_charger.c " old: %d\n", di->max_usb_in_curr.usb_type_max, di 1938 drivers/power/supply/ab8500_charger.c di->vbat, di->old_vbat); di 1939 drivers/power/supply/ab8500_charger.c ab8500_charger_set_vbus_in_curr(di, di 1940 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max); di 1941 drivers/power/supply/ab8500_charger.c power_supply_changed(di->usb_chg.psy); di 1944 drivers/power/supply/ab8500_charger.c di->old_vbat = di->vbat; di 1950 drivers/power/supply/ab8500_charger.c if (di->vbat < (VBAT_TRESH_IP_CUR_RED + 100) && di 1951 drivers/power/supply/ab8500_charger.c (di->vbat > (VBAT_TRESH_IP_CUR_RED - 100))) di 1954 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, &di->check_vbat_work, t * HZ); di 1968 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = container_of(work, di 1972 drivers/power/supply/ab8500_charger.c if (di->flags.mainextchnotok) { di 1973 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 1976 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 1980 drivers/power/supply/ab8500_charger.c di->flags.mainextchnotok = false; di 1981 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->ac_chg.psy); di 1984 drivers/power/supply/ab8500_charger.c if (di->flags.vbus_ovv) { di 1985 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 1989 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 1993 drivers/power/supply/ab8500_charger.c di->flags.vbus_ovv = false; di 1994 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->usb_chg.psy); di 1998 drivers/power/supply/ab8500_charger.c if (di->flags.mainextchnotok || di->flags.vbus_ovv) { di 1999 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 2000 drivers/power/supply/ab8500_charger.c &di->check_hw_failure_work, round_jiffies(HZ)); di 2022 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = container_of(work, di 2025 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, AB8500_CHARGER, di 2028 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "Failed to kick WD!\n"); di 2031 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 2032 drivers/power/supply/ab8500_charger.c &di->kick_wd_work, round_jiffies(WD_KICK_INTERVAL)); di 2045 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = container_of(work, di 2053 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_detect_chargers(di, false); di 2058 drivers/power/supply/ab8500_charger.c di->ac.charger_connected = 1; di 2059 drivers/power/supply/ab8500_charger.c di->ac_conn = true; di 2061 drivers/power/supply/ab8500_charger.c di->ac.charger_connected = 0; di 2064 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->ac_chg.psy); di 2065 drivers/power/supply/ab8500_charger.c sysfs_notify(&di->ac_chg.psy->dev.kobj, NULL, "present"); di 2070 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = container_of(work, di 2078 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 2083 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "ab8500 read failed %d\n", __LINE__); di 2092 drivers/power/supply/ab8500_charger.c ab8500_charger_usb_en(&di->usb_chg, 0, 0, 0); di 2094 drivers/power/supply/ab8500_charger.c mutex_lock(&di->charger_attached_mutex); di 2095 drivers/power/supply/ab8500_charger.c mutex_unlock(&di->charger_attached_mutex); di 2100 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 2101 drivers/power/supply/ab8500_charger.c &di->usb_charger_attached_work, di 2108 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = container_of(work, di 2117 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 2122 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "ab8500 read failed %d\n", __LINE__); di 2132 drivers/power/supply/ab8500_charger.c ab8500_charger_ac_en(&di->ac_chg, 0, 0, 0); di 2133 drivers/power/supply/ab8500_charger.c queue_work(di->charger_wq, &di->ac_work); di 2135 drivers/power/supply/ab8500_charger.c mutex_lock(&di->charger_attached_mutex); di 2136 drivers/power/supply/ab8500_charger.c mutex_unlock(&di->charger_attached_mutex); di 2141 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 2142 drivers/power/supply/ab8500_charger.c &di->ac_charger_attached_work, di 2156 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = container_of(work, di 2164 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_detect_chargers(di, false); di 2169 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "%s di->vbus_detected = false\n", __func__); di 2170 drivers/power/supply/ab8500_charger.c di->vbus_detected = false; di 2171 drivers/power/supply/ab8500_charger.c ab8500_charger_set_usb_connected(di, false); di 2172 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->usb_chg.psy); di 2174 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "%s di->vbus_detected = true\n", __func__); di 2175 drivers/power/supply/ab8500_charger.c di->vbus_detected = true; di 2177 drivers/power/supply/ab8500_charger.c if (is_ab8500_1p1_or_earlier(di->parent)) { di 2178 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_detect_usb_type(di); di 2180 drivers/power/supply/ab8500_charger.c ab8500_charger_set_usb_connected(di, true); di 2181 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di 2182 drivers/power/supply/ab8500_charger.c di->usb_chg.psy); di 2192 drivers/power/supply/ab8500_charger.c if (di->vbus_detected_start) { di 2193 drivers/power/supply/ab8500_charger.c di->vbus_detected_start = false; di 2194 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_detect_usb_type(di); di 2196 drivers/power/supply/ab8500_charger.c ab8500_charger_set_usb_connected(di, di 2198 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di 2199 drivers/power/supply/ab8500_charger.c di->usb_chg.psy); di 2214 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = di 2219 drivers/power/supply/ab8500_charger.c if (!di->usb.charger_online) { di 2220 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_set_vbus_in_curr(di, di 2221 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max); di 2226 drivers/power/supply/ab8500_charger.c ab8500_charger_set_usb_connected(di, true); di 2227 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->usb_chg.psy); di 2243 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = container_of(work, di 2251 drivers/power/supply/ab8500_charger.c detected_chargers = ab8500_charger_detect_chargers(di, false); di 2261 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) di 2262 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, AB8500_USB, di 2265 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, AB8500_USB, di 2269 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "UsbLineStatus register = 0x%02x\n", val); di 2271 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "Error reading USB link status\n"); di 2273 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) di 2281 drivers/power/supply/ab8500_charger.c di->invalid_charger_detect_state == 0) { di 2282 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, di 2285 drivers/power/supply/ab8500_charger.c abx500_mask_and_set_register_interruptible(di->dev, di 2289 drivers/power/supply/ab8500_charger.c abx500_mask_and_set_register_interruptible(di->dev, di 2292 drivers/power/supply/ab8500_charger.c di->invalid_charger_detect_state = 1; di 2297 drivers/power/supply/ab8500_charger.c if (di->invalid_charger_detect_state == 1) { di 2298 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, di 2301 drivers/power/supply/ab8500_charger.c abx500_mask_and_set_register_interruptible(di->dev, di 2305 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) di 2306 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 2310 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 2314 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "USB link status= 0x%02x\n", di 2316 drivers/power/supply/ab8500_charger.c di->invalid_charger_detect_state = 2; di 2319 drivers/power/supply/ab8500_charger.c di->invalid_charger_detect_state = 0; di 2323 drivers/power/supply/ab8500_charger.c di->vbus_detected = false; di 2324 drivers/power/supply/ab8500_charger.c ab8500_charger_set_usb_connected(di, false); di 2325 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->usb_chg.psy); di 2329 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev,"%s di->vbus_detected = true\n",__func__); di 2330 drivers/power/supply/ab8500_charger.c di->vbus_detected = true; di 2331 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_read_usb_type(di); di 2335 drivers/power/supply/ab8500_charger.c ab8500_charger_set_usb_connected(di, false); di 2336 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->usb_chg.psy); di 2341 drivers/power/supply/ab8500_charger.c if (di->usb_device_is_unrecognised) { di 2342 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, di 2347 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 2348 drivers/power/supply/ab8500_charger.c &di->attach_work, di 2350 drivers/power/supply/ab8500_charger.c } else if (di->is_aca_rid == 1) { di 2352 drivers/power/supply/ab8500_charger.c di->is_aca_rid++; di 2353 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, di 2356 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 2357 drivers/power/supply/ab8500_charger.c &di->attach_work, di 2360 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 2361 drivers/power/supply/ab8500_charger.c &di->attach_work, di 2371 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = container_of(work, di 2374 drivers/power/supply/ab8500_charger.c if (!di->vbus_detected) { di 2375 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, di 2381 drivers/power/supply/ab8500_charger.c spin_lock_irqsave(&di->usb_state.usb_lock, flags); di 2382 drivers/power/supply/ab8500_charger.c di->usb_state.state = di->usb_state.state_tmp; di 2383 drivers/power/supply/ab8500_charger.c di->usb_state.usb_current = di->usb_state.usb_current_tmp; di 2384 drivers/power/supply/ab8500_charger.c spin_unlock_irqrestore(&di->usb_state.usb_lock, flags); di 2386 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "%s USB state: 0x%02x mA: %d\n", di 2387 drivers/power/supply/ab8500_charger.c __func__, di->usb_state.state, di->usb_state.usb_current); di 2389 drivers/power/supply/ab8500_charger.c switch (di->usb_state.state) { di 2394 drivers/power/supply/ab8500_charger.c ab8500_charger_set_usb_connected(di, false); di 2395 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->usb_chg.psy); di 2410 drivers/power/supply/ab8500_charger.c if (!ab8500_charger_get_usb_cur(di)) { di 2412 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_set_vbus_in_curr(di, di 2413 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max); di 2417 drivers/power/supply/ab8500_charger.c ab8500_charger_set_usb_connected(di, true); di 2418 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->usb_chg.psy); di 2439 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = container_of(work, di 2443 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 2446 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 2449 drivers/power/supply/ab8500_charger.c prev_status = di->flags.usbchargernotok; di 2452 drivers/power/supply/ab8500_charger.c di->flags.usbchargernotok = true; di 2454 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 2455 drivers/power/supply/ab8500_charger.c &di->check_usbchgnotok_work, HZ); di 2457 drivers/power/supply/ab8500_charger.c di->flags.usbchargernotok = false; di 2458 drivers/power/supply/ab8500_charger.c di->flags.vbus_collapse = false; di 2461 drivers/power/supply/ab8500_charger.c if (prev_status != di->flags.usbchargernotok) di 2462 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->usb_chg.psy); di 2477 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = container_of(work, di 2481 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 2484 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 2488 drivers/power/supply/ab8500_charger.c di->flags.main_thermal_prot = true; di 2490 drivers/power/supply/ab8500_charger.c di->flags.main_thermal_prot = false; di 2492 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->ac_chg.psy); di 2507 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = container_of(work, di 2511 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, di 2514 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 2518 drivers/power/supply/ab8500_charger.c di->flags.usb_thermal_prot = true; di 2520 drivers/power/supply/ab8500_charger.c di->flags.usb_thermal_prot = false; di 2522 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->usb_chg.psy); di 2534 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2536 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "Main charger unplugged\n"); di 2537 drivers/power/supply/ab8500_charger.c queue_work(di->charger_wq, &di->ac_work); di 2539 drivers/power/supply/ab8500_charger.c cancel_delayed_work_sync(&di->ac_charger_attached_work); di 2540 drivers/power/supply/ab8500_charger.c mutex_lock(&di->charger_attached_mutex); di 2541 drivers/power/supply/ab8500_charger.c mutex_unlock(&di->charger_attached_mutex); di 2555 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2557 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "Main charger plugged\n"); di 2558 drivers/power/supply/ab8500_charger.c queue_work(di->charger_wq, &di->ac_work); di 2560 drivers/power/supply/ab8500_charger.c mutex_lock(&di->charger_attached_mutex); di 2561 drivers/power/supply/ab8500_charger.c mutex_unlock(&di->charger_attached_mutex); di 2563 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) di 2564 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 2565 drivers/power/supply/ab8500_charger.c &di->ac_charger_attached_work, di 2579 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2581 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "Main charger not ok\n"); di 2582 drivers/power/supply/ab8500_charger.c di->flags.mainextchnotok = true; di 2583 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->ac_chg.psy); di 2586 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, &di->check_hw_failure_work, 0); di 2601 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2603 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, di 2605 drivers/power/supply/ab8500_charger.c queue_work(di->charger_wq, &di->check_main_thermal_prot_work); di 2620 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2622 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, di 2624 drivers/power/supply/ab8500_charger.c queue_work(di->charger_wq, &di->check_main_thermal_prot_work); di 2631 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = container_of(work, di 2636 drivers/power/supply/ab8500_charger.c di->flags.vbus_drop_end = false; di 2639 drivers/power/supply/ab8500_charger.c abx500_set_register_interruptible(di->dev, di 2642 drivers/power/supply/ab8500_charger.c ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, di 2645 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s read failed\n", __func__); di 2649 drivers/power/supply/ab8500_charger.c curr = di->bm->chg_input_curr[ di 2652 drivers/power/supply/ab8500_charger.c if (di->max_usb_in_curr.calculated_max != curr) { di 2654 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.calculated_max = curr; di 2655 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, di 2657 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.calculated_max); di 2663 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.set_max = di 2664 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.calculated_max; di 2665 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, di 2667 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.set_max); di 2670 drivers/power/supply/ab8500_charger.c if (di->usb.charger_connected) di 2671 drivers/power/supply/ab8500_charger.c ab8500_charger_set_vbus_in_curr(di, di 2672 drivers/power/supply/ab8500_charger.c di->max_usb_in_curr.usb_type_max); di 2684 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2686 drivers/power/supply/ab8500_charger.c di->vbus_detected = false; di 2687 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "VBUS falling detected\n"); di 2688 drivers/power/supply/ab8500_charger.c queue_work(di->charger_wq, &di->detect_usb_type_work); di 2702 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2704 drivers/power/supply/ab8500_charger.c di->vbus_detected = true; di 2705 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "VBUS rising detected\n"); di 2707 drivers/power/supply/ab8500_charger.c queue_work(di->charger_wq, &di->detect_usb_type_work); di 2721 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2723 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "USB link status changed\n"); di 2725 drivers/power/supply/ab8500_charger.c queue_work(di->charger_wq, &di->usb_link_status_work); di 2740 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2742 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, di 2744 drivers/power/supply/ab8500_charger.c queue_work(di->charger_wq, &di->check_usb_thermal_prot_work); di 2759 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2761 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, di 2763 drivers/power/supply/ab8500_charger.c queue_work(di->charger_wq, &di->check_usb_thermal_prot_work); di 2777 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2779 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "Not allowed USB charger detected\n"); di 2780 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, &di->check_usbchgnotok_work, 0); di 2794 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2796 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "Charger watchdog expired\n"); di 2802 drivers/power/supply/ab8500_charger.c if (di->ac.charger_online) { di 2803 drivers/power/supply/ab8500_charger.c di->ac.wd_expired = true; di 2804 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->ac_chg.psy); di 2806 drivers/power/supply/ab8500_charger.c if (di->usb.charger_online) { di 2807 drivers/power/supply/ab8500_charger.c di->usb.wd_expired = true; di 2808 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->usb_chg.psy); di 2823 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2825 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "VBUS charger drop ended\n"); di 2826 drivers/power/supply/ab8500_charger.c di->flags.vbus_drop_end = true; di 2832 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, &di->vbus_drop_end_work, di 2847 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = _di; di 2849 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "VBUS overvoltage detected\n"); di 2850 drivers/power/supply/ab8500_charger.c di->flags.vbus_ovv = true; di 2851 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->usb_chg.psy); di 2854 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, &di->check_hw_failure_work, 0); di 2877 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di; di 2880 drivers/power/supply/ab8500_charger.c di = to_ab8500_charger_ac_device_info(psy_to_ux500_charger(psy)); di 2884 drivers/power/supply/ab8500_charger.c if (di->flags.mainextchnotok) di 2886 drivers/power/supply/ab8500_charger.c else if (di->ac.wd_expired || di->usb.wd_expired) di 2888 drivers/power/supply/ab8500_charger.c else if (di->flags.main_thermal_prot) di 2894 drivers/power/supply/ab8500_charger.c val->intval = di->ac.charger_online; di 2897 drivers/power/supply/ab8500_charger.c val->intval = di->ac.charger_connected; di 2900 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_get_ac_voltage(di); di 2902 drivers/power/supply/ab8500_charger.c di->ac.charger_voltage = ret; di 2904 drivers/power/supply/ab8500_charger.c val->intval = di->ac.charger_voltage * 1000; di 2911 drivers/power/supply/ab8500_charger.c di->ac.cv_active = ab8500_charger_ac_cv(di); di 2912 drivers/power/supply/ab8500_charger.c val->intval = di->ac.cv_active; di 2915 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_get_ac_current(di); di 2917 drivers/power/supply/ab8500_charger.c di->ac.charger_current = ret; di 2918 drivers/power/supply/ab8500_charger.c val->intval = di->ac.charger_current * 1000; di 2944 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di; di 2947 drivers/power/supply/ab8500_charger.c di = to_ab8500_charger_usb_device_info(psy_to_ux500_charger(psy)); di 2951 drivers/power/supply/ab8500_charger.c if (di->flags.usbchargernotok) di 2953 drivers/power/supply/ab8500_charger.c else if (di->ac.wd_expired || di->usb.wd_expired) di 2955 drivers/power/supply/ab8500_charger.c else if (di->flags.usb_thermal_prot) di 2957 drivers/power/supply/ab8500_charger.c else if (di->flags.vbus_ovv) di 2963 drivers/power/supply/ab8500_charger.c val->intval = di->usb.charger_online; di 2966 drivers/power/supply/ab8500_charger.c val->intval = di->usb.charger_connected; di 2969 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_get_vbus_voltage(di); di 2971 drivers/power/supply/ab8500_charger.c di->usb.charger_voltage = ret; di 2972 drivers/power/supply/ab8500_charger.c val->intval = di->usb.charger_voltage * 1000; di 2979 drivers/power/supply/ab8500_charger.c di->usb.cv_active = ab8500_charger_usb_cv(di); di 2980 drivers/power/supply/ab8500_charger.c val->intval = di->usb.cv_active; di 2983 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_get_usb_current(di); di 2985 drivers/power/supply/ab8500_charger.c di->usb.charger_current = ret; di 2986 drivers/power/supply/ab8500_charger.c val->intval = di->usb.charger_current * 1000; di 2993 drivers/power/supply/ab8500_charger.c if (di->flags.vbus_collapse) di 3011 drivers/power/supply/ab8500_charger.c static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) di 3016 drivers/power/supply/ab8500_charger.c if (!is_ab8500_1p1_or_earlier(di->parent)) { di 3017 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, di 3021 drivers/power/supply/ab8500_charger.c dev_err(di->dev, di 3026 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, di 3030 drivers/power/supply/ab8500_charger.c dev_err(di->dev, di 3036 drivers/power/supply/ab8500_charger.c if (is_ab8505_2p0(di->parent)) di 3037 drivers/power/supply/ab8500_charger.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 3046 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, di 3051 drivers/power/supply/ab8500_charger.c dev_err(di->dev, di 3057 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, di 3060 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to enable main WD in OTP\n"); di 3065 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, di 3069 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to enable main watchdog\n"); di 3082 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, di 3087 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to kick main watchdog\n"); di 3092 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, di 3096 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to disable main watchdog\n"); di 3101 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, AB8500_CHARGER, di 3104 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to set charger watchdog timeout\n"); di 3108 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_led_en(di, false); di 3110 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to disable LED\n"); di 3114 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, di 3117 drivers/power/supply/ab8500_charger.c (di->bm->bkup_bat_v & 0x3) | di->bm->bkup_bat_i); di 3119 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to setup backup battery charging\n"); di 3124 drivers/power/supply/ab8500_charger.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 3128 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s mask and set failed\n", __func__); di 3159 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = di 3164 drivers/power/supply/ab8500_charger.c if (!di) di 3168 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "not a standard host, returning\n"); di 3175 drivers/power/supply/ab8500_charger.c if ((di->usb_state.usb_current == 2) && (mA > 2)) di 3186 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "%s usb_state: 0x%02x mA: %d\n", di 3189 drivers/power/supply/ab8500_charger.c spin_lock(&di->usb_state.usb_lock); di 3190 drivers/power/supply/ab8500_charger.c di->usb_state.state_tmp = bm_usb_state; di 3191 drivers/power/supply/ab8500_charger.c di->usb_state.usb_current_tmp = mA; di 3192 drivers/power/supply/ab8500_charger.c spin_unlock(&di->usb_state.usb_lock); di 3198 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, &di->usb_state_changed_work, HZ/2); di 3207 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = platform_get_drvdata(pdev); di 3218 drivers/power/supply/ab8500_charger.c if (di->ac_conn && is_ab8500_1p1_or_earlier(di->parent)) { di 3219 drivers/power/supply/ab8500_charger.c ret = abx500_set_register_interruptible(di->dev, AB8500_CHARGER, di 3222 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "Failed to kick WD!\n"); di 3225 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, &di->kick_wd_work, di 3230 drivers/power/supply/ab8500_charger.c if (di->flags.mainextchnotok || di->flags.vbus_ovv) { di 3231 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 3232 drivers/power/supply/ab8500_charger.c &di->check_hw_failure_work, 0); di 3235 drivers/power/supply/ab8500_charger.c if (di->flags.vbus_drop_end) di 3236 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, &di->vbus_drop_end_work, 0); di 3244 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = platform_get_drvdata(pdev); di 3247 drivers/power/supply/ab8500_charger.c cancel_delayed_work(&di->check_hw_failure_work); di 3248 drivers/power/supply/ab8500_charger.c cancel_delayed_work(&di->vbus_drop_end_work); di 3250 drivers/power/supply/ab8500_charger.c flush_delayed_work(&di->attach_work); di 3251 drivers/power/supply/ab8500_charger.c flush_delayed_work(&di->usb_charger_attached_work); di 3252 drivers/power/supply/ab8500_charger.c flush_delayed_work(&di->ac_charger_attached_work); di 3253 drivers/power/supply/ab8500_charger.c flush_delayed_work(&di->check_usbchgnotok_work); di 3254 drivers/power/supply/ab8500_charger.c flush_delayed_work(&di->check_vbat_work); di 3255 drivers/power/supply/ab8500_charger.c flush_delayed_work(&di->kick_wd_work); di 3257 drivers/power/supply/ab8500_charger.c flush_work(&di->usb_link_status_work); di 3258 drivers/power/supply/ab8500_charger.c flush_work(&di->ac_work); di 3259 drivers/power/supply/ab8500_charger.c flush_work(&di->detect_usb_type_work); di 3261 drivers/power/supply/ab8500_charger.c if (atomic_read(&di->current_stepping_sessions)) di 3277 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di = platform_get_drvdata(pdev); di 3281 drivers/power/supply/ab8500_charger.c ab8500_charger_ac_en(&di->ac_chg, false, 0, 0); di 3284 drivers/power/supply/ab8500_charger.c ab8500_charger_usb_en(&di->usb_chg, false, 0, 0); di 3289 drivers/power/supply/ab8500_charger.c free_irq(irq, di); di 3293 drivers/power/supply/ab8500_charger.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 3296 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "%s mask and set failed\n", __func__); di 3298 drivers/power/supply/ab8500_charger.c usb_unregister_notifier(di->usb_phy, &di->nb); di 3299 drivers/power/supply/ab8500_charger.c usb_put_phy(di->usb_phy); di 3302 drivers/power/supply/ab8500_charger.c destroy_workqueue(di->charger_wq); di 3305 drivers/power/supply/ab8500_charger.c if (!di->ac_chg.enabled) di 3310 drivers/power/supply/ab8500_charger.c if (di->usb_chg.enabled) di 3311 drivers/power/supply/ab8500_charger.c power_supply_unregister(di->usb_chg.psy); di 3313 drivers/power/supply/ab8500_charger.c if (di->ac_chg.enabled && !di->ac_chg.external) di 3314 drivers/power/supply/ab8500_charger.c power_supply_unregister(di->ac_chg.psy); di 3346 drivers/power/supply/ab8500_charger.c struct ab8500_charger *di; di 3349 drivers/power/supply/ab8500_charger.c di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); di 3350 drivers/power/supply/ab8500_charger.c if (!di) { di 3359 drivers/power/supply/ab8500_charger.c di->bm = plat; di 3362 drivers/power/supply/ab8500_charger.c ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm); di 3367 drivers/power/supply/ab8500_charger.c di->autopower_cfg = of_property_read_bool(np, "autopower_cfg"); di 3369 drivers/power/supply/ab8500_charger.c di->autopower_cfg = false; di 3372 drivers/power/supply/ab8500_charger.c di->dev = &pdev->dev; di 3373 drivers/power/supply/ab8500_charger.c di->parent = dev_get_drvdata(pdev->dev.parent); di 3374 drivers/power/supply/ab8500_charger.c di->gpadc = ab8500_gpadc_get("ab8500-gpadc.0"); di 3377 drivers/power/supply/ab8500_charger.c spin_lock_init(&di->usb_state.usb_lock); di 3378 drivers/power/supply/ab8500_charger.c mutex_init(&di->usb_ipt_crnt_lock); di 3380 drivers/power/supply/ab8500_charger.c di->autopower = false; di 3381 drivers/power/supply/ab8500_charger.c di->invalid_charger_detect_state = 0; di 3386 drivers/power/supply/ab8500_charger.c ac_psy_cfg.drv_data = &di->ac_chg; di 3389 drivers/power/supply/ab8500_charger.c usb_psy_cfg.drv_data = &di->usb_chg; di 3393 drivers/power/supply/ab8500_charger.c di->ac_chg.ops.enable = &ab8500_charger_ac_en; di 3394 drivers/power/supply/ab8500_charger.c di->ac_chg.ops.check_enable = &ab8500_charger_ac_check_enable; di 3395 drivers/power/supply/ab8500_charger.c di->ac_chg.ops.kick_wd = &ab8500_charger_watchdog_kick; di 3396 drivers/power/supply/ab8500_charger.c di->ac_chg.ops.update_curr = &ab8500_charger_update_charger_current; di 3397 drivers/power/supply/ab8500_charger.c di->ac_chg.max_out_volt = ab8500_charger_voltage_map[ di 3399 drivers/power/supply/ab8500_charger.c di->ac_chg.max_out_curr = di 3400 drivers/power/supply/ab8500_charger.c di->bm->chg_output_curr[di->bm->n_chg_out_curr - 1]; di 3401 drivers/power/supply/ab8500_charger.c di->ac_chg.wdt_refresh = CHG_WD_INTERVAL; di 3402 drivers/power/supply/ab8500_charger.c di->ac_chg.enabled = di->bm->ac_enabled; di 3403 drivers/power/supply/ab8500_charger.c di->ac_chg.external = false; di 3406 drivers/power/supply/ab8500_charger.c if (!di->ac_chg.enabled) di 3412 drivers/power/supply/ab8500_charger.c di->usb_chg.ops.enable = &ab8500_charger_usb_en; di 3413 drivers/power/supply/ab8500_charger.c di->usb_chg.ops.check_enable = &ab8500_charger_usb_check_enable; di 3414 drivers/power/supply/ab8500_charger.c di->usb_chg.ops.kick_wd = &ab8500_charger_watchdog_kick; di 3415 drivers/power/supply/ab8500_charger.c di->usb_chg.ops.update_curr = &ab8500_charger_update_charger_current; di 3416 drivers/power/supply/ab8500_charger.c di->usb_chg.max_out_volt = ab8500_charger_voltage_map[ di 3418 drivers/power/supply/ab8500_charger.c di->usb_chg.max_out_curr = di 3419 drivers/power/supply/ab8500_charger.c di->bm->chg_output_curr[di->bm->n_chg_out_curr - 1]; di 3420 drivers/power/supply/ab8500_charger.c di->usb_chg.wdt_refresh = CHG_WD_INTERVAL; di 3421 drivers/power/supply/ab8500_charger.c di->usb_chg.enabled = di->bm->usb_enabled; di 3422 drivers/power/supply/ab8500_charger.c di->usb_chg.external = false; di 3423 drivers/power/supply/ab8500_charger.c di->usb_state.usb_current = -1; di 3426 drivers/power/supply/ab8500_charger.c di->charger_wq = alloc_ordered_workqueue("ab8500_charger_wq", di 3428 drivers/power/supply/ab8500_charger.c if (di->charger_wq == NULL) { di 3429 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to create work queue\n"); di 3433 drivers/power/supply/ab8500_charger.c mutex_init(&di->charger_attached_mutex); di 3436 drivers/power/supply/ab8500_charger.c INIT_DEFERRABLE_WORK(&di->check_hw_failure_work, di 3438 drivers/power/supply/ab8500_charger.c INIT_DEFERRABLE_WORK(&di->check_usbchgnotok_work, di 3441 drivers/power/supply/ab8500_charger.c INIT_DELAYED_WORK(&di->ac_charger_attached_work, di 3443 drivers/power/supply/ab8500_charger.c INIT_DELAYED_WORK(&di->usb_charger_attached_work, di 3455 drivers/power/supply/ab8500_charger.c INIT_DEFERRABLE_WORK(&di->kick_wd_work, di 3458 drivers/power/supply/ab8500_charger.c INIT_DEFERRABLE_WORK(&di->check_vbat_work, di 3461 drivers/power/supply/ab8500_charger.c INIT_DELAYED_WORK(&di->attach_work, di 3464 drivers/power/supply/ab8500_charger.c INIT_DELAYED_WORK(&di->usb_state_changed_work, di 3467 drivers/power/supply/ab8500_charger.c INIT_DELAYED_WORK(&di->vbus_drop_end_work, di 3471 drivers/power/supply/ab8500_charger.c INIT_WORK(&di->usb_link_status_work, di 3473 drivers/power/supply/ab8500_charger.c INIT_WORK(&di->ac_work, ab8500_charger_ac_work); di 3474 drivers/power/supply/ab8500_charger.c INIT_WORK(&di->detect_usb_type_work, di 3478 drivers/power/supply/ab8500_charger.c INIT_WORK(&di->check_main_thermal_prot_work, di 3480 drivers/power/supply/ab8500_charger.c INIT_WORK(&di->check_usb_thermal_prot_work, di 3488 drivers/power/supply/ab8500_charger.c di->regu = devm_regulator_get(di->dev, "vddadc"); di 3489 drivers/power/supply/ab8500_charger.c if (IS_ERR(di->regu)) { di 3490 drivers/power/supply/ab8500_charger.c ret = PTR_ERR(di->regu); di 3491 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to get vddadc regulator\n"); di 3497 drivers/power/supply/ab8500_charger.c ret = ab8500_charger_init_hw_registers(di); di 3499 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to initialize ABB registers\n"); di 3504 drivers/power/supply/ab8500_charger.c if (di->ac_chg.enabled) { di 3505 drivers/power/supply/ab8500_charger.c di->ac_chg.psy = power_supply_register(di->dev, di 3508 drivers/power/supply/ab8500_charger.c if (IS_ERR(di->ac_chg.psy)) { di 3509 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to register AC charger\n"); di 3510 drivers/power/supply/ab8500_charger.c ret = PTR_ERR(di->ac_chg.psy); di 3516 drivers/power/supply/ab8500_charger.c if (di->usb_chg.enabled) { di 3517 drivers/power/supply/ab8500_charger.c di->usb_chg.psy = power_supply_register(di->dev, di 3520 drivers/power/supply/ab8500_charger.c if (IS_ERR(di->usb_chg.psy)) { di 3521 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to register USB charger\n"); di 3522 drivers/power/supply/ab8500_charger.c ret = PTR_ERR(di->usb_chg.psy); di 3527 drivers/power/supply/ab8500_charger.c di->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2); di 3528 drivers/power/supply/ab8500_charger.c if (IS_ERR_OR_NULL(di->usb_phy)) { di 3529 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to get usb transceiver\n"); di 3533 drivers/power/supply/ab8500_charger.c di->nb.notifier_call = ab8500_charger_usb_notifier_call; di 3534 drivers/power/supply/ab8500_charger.c ret = usb_register_notifier(di->usb_phy, &di->nb); di 3536 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to register usb notifier\n"); di 3541 drivers/power/supply/ab8500_charger.c charger_status = ab8500_charger_detect_chargers(di, true); di 3543 drivers/power/supply/ab8500_charger.c di->ac.charger_connected = 1; di 3544 drivers/power/supply/ab8500_charger.c di->ac_conn = true; di 3545 drivers/power/supply/ab8500_charger.c ab8500_power_supply_changed(di, di->ac_chg.psy); di 3546 drivers/power/supply/ab8500_charger.c sysfs_notify(&di->ac_chg.psy->dev.kobj, NULL, "present"); di 3550 drivers/power/supply/ab8500_charger.c di->vbus_detected = true; di 3551 drivers/power/supply/ab8500_charger.c di->vbus_detected_start = true; di 3552 drivers/power/supply/ab8500_charger.c queue_work(di->charger_wq, di 3553 drivers/power/supply/ab8500_charger.c &di->detect_usb_type_work); di 3561 drivers/power/supply/ab8500_charger.c ab8500_charger_irq[i].name, di); di 3564 drivers/power/supply/ab8500_charger.c dev_err(di->dev, "failed to request %s IRQ %d: %d\n" di 3568 drivers/power/supply/ab8500_charger.c dev_dbg(di->dev, "Requested %s IRQ %d: %d\n", di 3572 drivers/power/supply/ab8500_charger.c platform_set_drvdata(pdev, di); di 3574 drivers/power/supply/ab8500_charger.c mutex_lock(&di->charger_attached_mutex); di 3576 drivers/power/supply/ab8500_charger.c ch_stat = ab8500_charger_detect_chargers(di, false); di 3579 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) di 3580 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 3581 drivers/power/supply/ab8500_charger.c &di->ac_charger_attached_work, di 3585 drivers/power/supply/ab8500_charger.c if (is_ab8500(di->parent)) di 3586 drivers/power/supply/ab8500_charger.c queue_delayed_work(di->charger_wq, di 3587 drivers/power/supply/ab8500_charger.c &di->usb_charger_attached_work, di 3591 drivers/power/supply/ab8500_charger.c mutex_unlock(&di->charger_attached_mutex); di 3596 drivers/power/supply/ab8500_charger.c usb_unregister_notifier(di->usb_phy, &di->nb); di 3601 drivers/power/supply/ab8500_charger.c free_irq(irq, di); di 3604 drivers/power/supply/ab8500_charger.c usb_put_phy(di->usb_phy); di 3606 drivers/power/supply/ab8500_charger.c if (di->usb_chg.enabled) di 3607 drivers/power/supply/ab8500_charger.c power_supply_unregister(di->usb_chg.psy); di 3609 drivers/power/supply/ab8500_charger.c if (di->ac_chg.enabled) di 3610 drivers/power/supply/ab8500_charger.c power_supply_unregister(di->ac_chg.psy); di 3612 drivers/power/supply/ab8500_charger.c destroy_workqueue(di->charger_wq); di 361 drivers/power/supply/ab8500_fg.c static int ab8500_fg_is_low_curr(struct ab8500_fg *di, int curr) di 366 drivers/power/supply/ab8500_fg.c if (curr > -di->bm->fg_params->high_curr_threshold) di 380 drivers/power/supply/ab8500_fg.c static int ab8500_fg_add_cap_sample(struct ab8500_fg *di, int sample) di 383 drivers/power/supply/ab8500_fg.c struct ab8500_fg_avg_cap *avg = &di->avg_cap; di 414 drivers/power/supply/ab8500_fg.c static void ab8500_fg_clear_cap_samples(struct ab8500_fg *di) di 417 drivers/power/supply/ab8500_fg.c struct ab8500_fg_avg_cap *avg = &di->avg_cap; di 437 drivers/power/supply/ab8500_fg.c static void ab8500_fg_fill_cap_sample(struct ab8500_fg *di, int sample) di 441 drivers/power/supply/ab8500_fg.c struct ab8500_fg_avg_cap *avg = &di->avg_cap; di 464 drivers/power/supply/ab8500_fg.c static int ab8500_fg_coulomb_counter(struct ab8500_fg *di, bool enable) di 467 drivers/power/supply/ab8500_fg.c mutex_lock(&di->cc_lock); di 471 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 477 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, di 479 drivers/power/supply/ab8500_fg.c di->fg_samples); di 484 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 490 drivers/power/supply/ab8500_fg.c di->flags.fg_enabled = true; di 493 drivers/power/supply/ab8500_fg.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 499 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, di 505 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 510 drivers/power/supply/ab8500_fg.c di->flags.fg_enabled = false; di 513 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, " CC enabled: %d Samples: %d\n", di 514 drivers/power/supply/ab8500_fg.c enable, di->fg_samples); di 516 drivers/power/supply/ab8500_fg.c mutex_unlock(&di->cc_lock); di 520 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "%s Enabling coulomb counter failed\n", __func__); di 521 drivers/power/supply/ab8500_fg.c mutex_unlock(&di->cc_lock); di 533 drivers/power/supply/ab8500_fg.c int ab8500_fg_inst_curr_start(struct ab8500_fg *di) di 538 drivers/power/supply/ab8500_fg.c mutex_lock(&di->cc_lock); di 540 drivers/power/supply/ab8500_fg.c di->nbr_cceoc_irq_cnt = 0; di 541 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_RTC, di 547 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "%s Enable FG\n", __func__); di 548 drivers/power/supply/ab8500_fg.c di->turn_off_fg = true; di 551 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, di 558 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 564 drivers/power/supply/ab8500_fg.c di->turn_off_fg = false; di 568 drivers/power/supply/ab8500_fg.c reinit_completion(&di->ab8500_fg_started); di 569 drivers/power/supply/ab8500_fg.c reinit_completion(&di->ab8500_fg_complete); di 570 drivers/power/supply/ab8500_fg.c enable_irq(di->irq); di 575 drivers/power/supply/ab8500_fg.c mutex_unlock(&di->cc_lock); di 585 drivers/power/supply/ab8500_fg.c int ab8500_fg_inst_curr_started(struct ab8500_fg *di) di 587 drivers/power/supply/ab8500_fg.c return completion_done(&di->ab8500_fg_started); di 596 drivers/power/supply/ab8500_fg.c int ab8500_fg_inst_curr_done(struct ab8500_fg *di) di 598 drivers/power/supply/ab8500_fg.c return completion_done(&di->ab8500_fg_complete); di 610 drivers/power/supply/ab8500_fg.c int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res) di 617 drivers/power/supply/ab8500_fg.c if (!completion_done(&di->ab8500_fg_complete)) { di 619 drivers/power/supply/ab8500_fg.c &di->ab8500_fg_complete, di 621 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Finalize time: %d ms\n", di 625 drivers/power/supply/ab8500_fg.c disable_irq(di->irq); di 626 drivers/power/supply/ab8500_fg.c di->nbr_cceoc_irq_cnt = 0; di 627 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "completion timed out [%d]\n", di 633 drivers/power/supply/ab8500_fg.c disable_irq(di->irq); di 634 drivers/power/supply/ab8500_fg.c di->nbr_cceoc_irq_cnt = 0; di 636 drivers/power/supply/ab8500_fg.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 644 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_GAS_GAUGE, di 649 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_GAS_GAUGE, di 673 drivers/power/supply/ab8500_fg.c (1000 * di->bm->fg_res); di 675 drivers/power/supply/ab8500_fg.c if (di->turn_off_fg) { di 676 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "%s Disable FG\n", __func__); di 679 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, di 685 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 690 drivers/power/supply/ab8500_fg.c mutex_unlock(&di->cc_lock); di 695 drivers/power/supply/ab8500_fg.c mutex_unlock(&di->cc_lock); di 706 drivers/power/supply/ab8500_fg.c int ab8500_fg_inst_curr_blocking(struct ab8500_fg *di) di 712 drivers/power/supply/ab8500_fg.c ret = ab8500_fg_inst_curr_start(di); di 714 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "Failed to initialize fg_inst\n"); di 719 drivers/power/supply/ab8500_fg.c if (!completion_done(&di->ab8500_fg_started)) { di 721 drivers/power/supply/ab8500_fg.c &di->ab8500_fg_started, di 723 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Start time: %d ms\n", di 727 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "completion timed out [%d]\n", di 733 drivers/power/supply/ab8500_fg.c ret = ab8500_fg_inst_curr_finalize(di, &res); di 735 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "Failed to finalize fg_inst\n"); di 739 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "%s instant current: %d", __func__, res); di 742 drivers/power/supply/ab8500_fg.c disable_irq(di->irq); di 743 drivers/power/supply/ab8500_fg.c mutex_unlock(&di->cc_lock); di 760 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = container_of(work, di 763 drivers/power/supply/ab8500_fg.c mutex_lock(&di->cc_lock); di 764 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_GAS_GAUGE, di 769 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_GAS_GAUGE, di 774 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_GAS_GAUGE, di 779 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_GAS_GAUGE, di 796 drivers/power/supply/ab8500_fg.c di->accu_charge = (val * QLSB_NANO_AMP_HOURS_X10) / di 797 drivers/power/supply/ab8500_fg.c (100 * di->bm->fg_res); di 805 drivers/power/supply/ab8500_fg.c di->avg_curr = (val * QLSB_NANO_AMP_HOURS_X10 * 36) / di 806 drivers/power/supply/ab8500_fg.c (1000 * di->bm->fg_res * (di->fg_samples / 4)); di 808 drivers/power/supply/ab8500_fg.c di->flags.conv_done = true; di 810 drivers/power/supply/ab8500_fg.c mutex_unlock(&di->cc_lock); di 812 drivers/power/supply/ab8500_fg.c queue_work(di->fg_wq, &di->fg_work); di 814 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "fg_res: %d, fg_samples: %d, gasg: %d, accu_charge: %d \n", di 815 drivers/power/supply/ab8500_fg.c di->bm->fg_res, di->fg_samples, val, di->accu_charge); di 818 drivers/power/supply/ab8500_fg.c dev_err(di->dev, di 820 drivers/power/supply/ab8500_fg.c mutex_unlock(&di->cc_lock); di 821 drivers/power/supply/ab8500_fg.c queue_work(di->fg_wq, &di->fg_work); di 830 drivers/power/supply/ab8500_fg.c static int ab8500_fg_bat_voltage(struct ab8500_fg *di) di 835 drivers/power/supply/ab8500_fg.c vbat = ab8500_gpadc_convert(di->gpadc, MAIN_BAT_V); di 837 drivers/power/supply/ab8500_fg.c dev_err(di->dev, di 854 drivers/power/supply/ab8500_fg.c static int ab8500_fg_volt_to_capacity(struct ab8500_fg *di, int voltage) di 860 drivers/power/supply/ab8500_fg.c tbl = di->bm->bat_type[di->bm->batt_id].v_to_cap_tbl, di 861 drivers/power/supply/ab8500_fg.c tbl_size = di->bm->bat_type[di->bm->batt_id].n_v_cap_tbl_elements; di 880 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "%s Vbat: %d, Cap: %d per mille", di 893 drivers/power/supply/ab8500_fg.c static int ab8500_fg_uncomp_volt_to_capacity(struct ab8500_fg *di) di 895 drivers/power/supply/ab8500_fg.c di->vbat = ab8500_fg_bat_voltage(di); di 896 drivers/power/supply/ab8500_fg.c return ab8500_fg_volt_to_capacity(di, di->vbat); di 906 drivers/power/supply/ab8500_fg.c static int ab8500_fg_battery_resistance(struct ab8500_fg *di) di 912 drivers/power/supply/ab8500_fg.c tbl = di->bm->bat_type[di->bm->batt_id].batres_tbl; di 913 drivers/power/supply/ab8500_fg.c tbl_size = di->bm->bat_type[di->bm->batt_id].n_batres_tbl_elements; di 916 drivers/power/supply/ab8500_fg.c if (di->bat_temp / 10 > tbl[i].temp) di 921 drivers/power/supply/ab8500_fg.c resist = interpolate(di->bat_temp / 10, di 932 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "%s Temp: %d battery internal resistance: %d" di 934 drivers/power/supply/ab8500_fg.c __func__, di->bat_temp, resist, di->bm->fg_res / 10, di 935 drivers/power/supply/ab8500_fg.c (di->bm->fg_res / 10) + resist); di 938 drivers/power/supply/ab8500_fg.c resist += di->bm->fg_res / 10; di 950 drivers/power/supply/ab8500_fg.c static int ab8500_fg_load_comp_volt_to_capacity(struct ab8500_fg *di) di 956 drivers/power/supply/ab8500_fg.c ab8500_fg_inst_curr_start(di); di 959 drivers/power/supply/ab8500_fg.c vbat += ab8500_fg_bat_voltage(di); di 962 drivers/power/supply/ab8500_fg.c } while (!ab8500_fg_inst_curr_done(di)); di 964 drivers/power/supply/ab8500_fg.c ab8500_fg_inst_curr_finalize(di, &di->inst_curr); di 966 drivers/power/supply/ab8500_fg.c di->vbat = vbat / i; di 967 drivers/power/supply/ab8500_fg.c res = ab8500_fg_battery_resistance(di); di 970 drivers/power/supply/ab8500_fg.c vbat_comp = di->vbat - (di->inst_curr * res) / 1000; di 972 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "%s Measured Vbat: %dmV,Compensated Vbat %dmV, " di 974 drivers/power/supply/ab8500_fg.c __func__, di->vbat, vbat_comp, res, di->inst_curr, i); di 976 drivers/power/supply/ab8500_fg.c return ab8500_fg_volt_to_capacity(di, vbat_comp); di 986 drivers/power/supply/ab8500_fg.c static int ab8500_fg_convert_mah_to_permille(struct ab8500_fg *di, int cap_mah) di 988 drivers/power/supply/ab8500_fg.c return (cap_mah * 1000) / di->bat_cap.max_mah_design; di 998 drivers/power/supply/ab8500_fg.c static int ab8500_fg_convert_permille_to_mah(struct ab8500_fg *di, int cap_pm) di 1000 drivers/power/supply/ab8500_fg.c return cap_pm * di->bat_cap.max_mah_design / 1000; di 1010 drivers/power/supply/ab8500_fg.c static int ab8500_fg_convert_mah_to_uwh(struct ab8500_fg *di, int cap_mah) di 1015 drivers/power/supply/ab8500_fg.c div_res = ((u64) cap_mah) * ((u64) di->vbat_nom); di 1032 drivers/power/supply/ab8500_fg.c static int ab8500_fg_calc_cap_charging(struct ab8500_fg *di) di 1034 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "%s cap_mah %d accu_charge %d\n", di 1036 drivers/power/supply/ab8500_fg.c di->bat_cap.mah, di 1037 drivers/power/supply/ab8500_fg.c di->accu_charge); di 1040 drivers/power/supply/ab8500_fg.c if (di->bat_cap.mah + di->accu_charge > 0) di 1041 drivers/power/supply/ab8500_fg.c di->bat_cap.mah += di->accu_charge; di 1043 drivers/power/supply/ab8500_fg.c di->bat_cap.mah = 0; di 1048 drivers/power/supply/ab8500_fg.c if (di->bat_cap.mah >= di->bat_cap.max_mah_design || di 1049 drivers/power/supply/ab8500_fg.c di->flags.force_full) { di 1050 drivers/power/supply/ab8500_fg.c di->bat_cap.mah = di->bat_cap.max_mah_design; di 1053 drivers/power/supply/ab8500_fg.c ab8500_fg_fill_cap_sample(di, di->bat_cap.mah); di 1054 drivers/power/supply/ab8500_fg.c di->bat_cap.permille = di 1055 drivers/power/supply/ab8500_fg.c ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); di 1058 drivers/power/supply/ab8500_fg.c di->vbat = ab8500_fg_bat_voltage(di); di 1059 drivers/power/supply/ab8500_fg.c di->inst_curr = ab8500_fg_inst_curr_blocking(di); di 1061 drivers/power/supply/ab8500_fg.c return di->bat_cap.mah; di 1073 drivers/power/supply/ab8500_fg.c static int ab8500_fg_calc_cap_discharge_voltage(struct ab8500_fg *di, bool comp) di 1078 drivers/power/supply/ab8500_fg.c permille = ab8500_fg_load_comp_volt_to_capacity(di); di 1080 drivers/power/supply/ab8500_fg.c permille = ab8500_fg_uncomp_volt_to_capacity(di); di 1082 drivers/power/supply/ab8500_fg.c mah = ab8500_fg_convert_permille_to_mah(di, permille); di 1084 drivers/power/supply/ab8500_fg.c di->bat_cap.mah = ab8500_fg_add_cap_sample(di, mah); di 1085 drivers/power/supply/ab8500_fg.c di->bat_cap.permille = di 1086 drivers/power/supply/ab8500_fg.c ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); di 1088 drivers/power/supply/ab8500_fg.c return di->bat_cap.mah; di 1099 drivers/power/supply/ab8500_fg.c static int ab8500_fg_calc_cap_discharge_fg(struct ab8500_fg *di) di 1103 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "%s cap_mah %d accu_charge %d\n", di 1105 drivers/power/supply/ab8500_fg.c di->bat_cap.mah, di 1106 drivers/power/supply/ab8500_fg.c di->accu_charge); di 1109 drivers/power/supply/ab8500_fg.c if (di->bat_cap.mah + di->accu_charge > 0) di 1110 drivers/power/supply/ab8500_fg.c di->bat_cap.mah += di->accu_charge; di 1112 drivers/power/supply/ab8500_fg.c di->bat_cap.mah = 0; di 1114 drivers/power/supply/ab8500_fg.c if (di->bat_cap.mah >= di->bat_cap.max_mah_design) di 1115 drivers/power/supply/ab8500_fg.c di->bat_cap.mah = di->bat_cap.max_mah_design; di 1121 drivers/power/supply/ab8500_fg.c permille = ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); di 1122 drivers/power/supply/ab8500_fg.c permille_volt = ab8500_fg_uncomp_volt_to_capacity(di); di 1125 drivers/power/supply/ab8500_fg.c di->bat_cap.permille = permille_volt; di 1126 drivers/power/supply/ab8500_fg.c di->bat_cap.mah = ab8500_fg_convert_permille_to_mah(di, di 1127 drivers/power/supply/ab8500_fg.c di->bat_cap.permille); di 1129 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "%s voltage based: perm %d perm_volt %d\n", di 1134 drivers/power/supply/ab8500_fg.c ab8500_fg_fill_cap_sample(di, di->bat_cap.mah); di 1136 drivers/power/supply/ab8500_fg.c ab8500_fg_fill_cap_sample(di, di->bat_cap.mah); di 1137 drivers/power/supply/ab8500_fg.c di->bat_cap.permille = di 1138 drivers/power/supply/ab8500_fg.c ab8500_fg_convert_mah_to_permille(di, di->bat_cap.mah); di 1141 drivers/power/supply/ab8500_fg.c return di->bat_cap.mah; di 1150 drivers/power/supply/ab8500_fg.c static int ab8500_fg_capacity_level(struct ab8500_fg *di) di 1154 drivers/power/supply/ab8500_fg.c percent = DIV_ROUND_CLOSEST(di->bat_cap.permille, 10); di 1156 drivers/power/supply/ab8500_fg.c if (percent <= di->bm->cap_levels->critical || di 1157 drivers/power/supply/ab8500_fg.c di->flags.low_bat) di 1159 drivers/power/supply/ab8500_fg.c else if (percent <= di->bm->cap_levels->low) di 1161 drivers/power/supply/ab8500_fg.c else if (percent <= di->bm->cap_levels->normal) di 1163 drivers/power/supply/ab8500_fg.c else if (percent <= di->bm->cap_levels->high) di 1179 drivers/power/supply/ab8500_fg.c static int ab8500_fg_calculate_scaled_capacity(struct ab8500_fg *di) di 1181 drivers/power/supply/ab8500_fg.c struct ab8500_fg_cap_scaling *cs = &di->bat_cap.cap_scale; di 1182 drivers/power/supply/ab8500_fg.c int capacity = di->bat_cap.prev_percent; di 1191 drivers/power/supply/ab8500_fg.c if (di->flags.fully_charged) { di 1194 drivers/power/supply/ab8500_fg.c max(capacity, di->bm->fg_params->maint_thres); di 1195 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Scale cap with %d/%d\n", di 1203 drivers/power/supply/ab8500_fg.c DIV_ROUND_CLOSEST(di->bat_cap.prev_percent * di 1207 drivers/power/supply/ab8500_fg.c if (di->flags.charging) { di 1210 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Cap to stop scale lowered %d%%\n", di 1212 drivers/power/supply/ab8500_fg.c } else if (!di->flags.fully_charged) { di 1213 drivers/power/supply/ab8500_fg.c if (di->bat_cap.prev_percent >= di 1215 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Disabling scaled capacity\n"); di 1217 drivers/power/supply/ab8500_fg.c capacity = di->bat_cap.prev_percent; di 1219 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, di 1237 drivers/power/supply/ab8500_fg.c static void ab8500_fg_update_cap_scalers(struct ab8500_fg *di) di 1239 drivers/power/supply/ab8500_fg.c struct ab8500_fg_cap_scaling *cs = &di->bat_cap.cap_scale; di 1243 drivers/power/supply/ab8500_fg.c if (di->flags.charging) { di 1244 drivers/power/supply/ab8500_fg.c di->bat_cap.cap_scale.disable_cap_level = di 1245 drivers/power/supply/ab8500_fg.c di->bat_cap.cap_scale.scaled_cap; di 1246 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Cap to stop scale at charge %d%%\n", di 1247 drivers/power/supply/ab8500_fg.c di->bat_cap.cap_scale.disable_cap_level); di 1251 drivers/power/supply/ab8500_fg.c cs->cap_to_scale[1] = di->bat_cap.prev_percent; di 1255 drivers/power/supply/ab8500_fg.c max(di->bat_cap.prev_percent, di 1256 drivers/power/supply/ab8500_fg.c di->bm->fg_params->maint_thres); di 1259 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Cap to scale at discharge %d/%d\n", di 1272 drivers/power/supply/ab8500_fg.c static void ab8500_fg_check_capacity_limits(struct ab8500_fg *di, bool init) di 1275 drivers/power/supply/ab8500_fg.c int percent = DIV_ROUND_CLOSEST(di->bat_cap.permille, 10); di 1277 drivers/power/supply/ab8500_fg.c di->bat_cap.level = ab8500_fg_capacity_level(di); di 1279 drivers/power/supply/ab8500_fg.c if (di->bat_cap.level != di->bat_cap.prev_level) { di 1284 drivers/power/supply/ab8500_fg.c if (!(!di->flags.charging && di->bat_cap.level > di 1285 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_level) || init) { di 1286 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "level changed from %d to %d\n", di 1287 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_level, di 1288 drivers/power/supply/ab8500_fg.c di->bat_cap.level); di 1289 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_level = di->bat_cap.level; di 1292 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "level not allowed to go up " di 1294 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_level, di 1295 drivers/power/supply/ab8500_fg.c di->bat_cap.level); di 1303 drivers/power/supply/ab8500_fg.c if (di->flags.low_bat) { di 1304 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Battery low, set capacity to 0\n"); di 1305 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_percent = 0; di 1306 drivers/power/supply/ab8500_fg.c di->bat_cap.permille = 0; di 1308 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_mah = 0; di 1309 drivers/power/supply/ab8500_fg.c di->bat_cap.mah = 0; di 1311 drivers/power/supply/ab8500_fg.c } else if (di->flags.fully_charged) { di 1316 drivers/power/supply/ab8500_fg.c if (di->flags.force_full) { di 1317 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_percent = percent; di 1318 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_mah = di->bat_cap.mah; di 1322 drivers/power/supply/ab8500_fg.c if (!di->bat_cap.cap_scale.enable && di 1323 drivers/power/supply/ab8500_fg.c di->bm->capacity_scaling) { di 1324 drivers/power/supply/ab8500_fg.c di->bat_cap.cap_scale.enable = true; di 1325 drivers/power/supply/ab8500_fg.c di->bat_cap.cap_scale.cap_to_scale[0] = 100; di 1326 drivers/power/supply/ab8500_fg.c di->bat_cap.cap_scale.cap_to_scale[1] = di 1327 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_percent; di 1328 drivers/power/supply/ab8500_fg.c di->bat_cap.cap_scale.disable_cap_level = 100; di 1330 drivers/power/supply/ab8500_fg.c } else if (di->bat_cap.prev_percent != percent) { di 1331 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, di 1335 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_percent = percent; di 1336 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_mah = di->bat_cap.mah; di 1340 drivers/power/supply/ab8500_fg.c } else if (di->bat_cap.prev_percent != percent) { di 1347 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_percent = 1; di 1351 drivers/power/supply/ab8500_fg.c } else if (!(!di->flags.charging && di 1352 drivers/power/supply/ab8500_fg.c percent > di->bat_cap.prev_percent) || init) { di 1357 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, di 1359 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_percent, di 1361 drivers/power/supply/ab8500_fg.c di->bat_cap.permille); di 1362 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_percent = percent; di 1363 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_mah = di->bat_cap.mah; di 1367 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "capacity not allowed to go up since " di 1369 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_percent, di 1371 drivers/power/supply/ab8500_fg.c di->bat_cap.permille); di 1376 drivers/power/supply/ab8500_fg.c if (di->bm->capacity_scaling) { di 1377 drivers/power/supply/ab8500_fg.c di->bat_cap.cap_scale.scaled_cap = di 1378 drivers/power/supply/ab8500_fg.c ab8500_fg_calculate_scaled_capacity(di); di 1380 drivers/power/supply/ab8500_fg.c dev_info(di->dev, "capacity=%d (%d)\n", di 1381 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_percent, di 1382 drivers/power/supply/ab8500_fg.c di->bat_cap.cap_scale.scaled_cap); di 1384 drivers/power/supply/ab8500_fg.c power_supply_changed(di->fg_psy); di 1385 drivers/power/supply/ab8500_fg.c if (di->flags.fully_charged && di->flags.force_full) { di 1386 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Battery full, notifying.\n"); di 1387 drivers/power/supply/ab8500_fg.c di->flags.force_full = false; di 1388 drivers/power/supply/ab8500_fg.c sysfs_notify(&di->fg_kobject, NULL, "charge_full"); di 1390 drivers/power/supply/ab8500_fg.c sysfs_notify(&di->fg_kobject, NULL, "charge_now"); di 1394 drivers/power/supply/ab8500_fg.c static void ab8500_fg_charge_state_to(struct ab8500_fg *di, di 1397 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Charge state from %d [%s] to %d [%s]\n", di 1398 drivers/power/supply/ab8500_fg.c di->charge_state, di 1399 drivers/power/supply/ab8500_fg.c charge_state[di->charge_state], di 1403 drivers/power/supply/ab8500_fg.c di->charge_state = new_state; di 1406 drivers/power/supply/ab8500_fg.c static void ab8500_fg_discharge_state_to(struct ab8500_fg *di, di 1409 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Discharge state from %d [%s] to %d [%s]\n", di 1410 drivers/power/supply/ab8500_fg.c di->discharge_state, di 1411 drivers/power/supply/ab8500_fg.c discharge_state[di->discharge_state], di 1415 drivers/power/supply/ab8500_fg.c di->discharge_state = new_state; di 1424 drivers/power/supply/ab8500_fg.c static void ab8500_fg_algorithm_charging(struct ab8500_fg *di) di 1430 drivers/power/supply/ab8500_fg.c if (di->discharge_state != AB8500_FG_DISCHARGE_INIT_RECOVERY) di 1431 drivers/power/supply/ab8500_fg.c ab8500_fg_discharge_state_to(di, di 1434 drivers/power/supply/ab8500_fg.c switch (di->charge_state) { di 1436 drivers/power/supply/ab8500_fg.c di->fg_samples = SEC_TO_SAMPLE( di 1437 drivers/power/supply/ab8500_fg.c di->bm->fg_params->accu_charging); di 1439 drivers/power/supply/ab8500_fg.c ab8500_fg_coulomb_counter(di, true); di 1440 drivers/power/supply/ab8500_fg.c ab8500_fg_charge_state_to(di, AB8500_FG_CHARGE_READOUT); di 1448 drivers/power/supply/ab8500_fg.c mutex_lock(&di->cc_lock); di 1449 drivers/power/supply/ab8500_fg.c if (!di->flags.conv_done && !di->flags.force_full) { di 1451 drivers/power/supply/ab8500_fg.c mutex_unlock(&di->cc_lock); di 1452 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "%s CC conv not done\n", di 1457 drivers/power/supply/ab8500_fg.c di->flags.conv_done = false; di 1458 drivers/power/supply/ab8500_fg.c mutex_unlock(&di->cc_lock); di 1460 drivers/power/supply/ab8500_fg.c ab8500_fg_calc_cap_charging(di); di 1469 drivers/power/supply/ab8500_fg.c ab8500_fg_check_capacity_limits(di, false); di 1472 drivers/power/supply/ab8500_fg.c static void force_capacity(struct ab8500_fg *di) di 1476 drivers/power/supply/ab8500_fg.c ab8500_fg_clear_cap_samples(di); di 1477 drivers/power/supply/ab8500_fg.c cap = di->bat_cap.user_mah; di 1478 drivers/power/supply/ab8500_fg.c if (cap > di->bat_cap.max_mah_design) { di 1479 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Remaining cap %d can't be bigger than total" di 1480 drivers/power/supply/ab8500_fg.c " %d\n", cap, di->bat_cap.max_mah_design); di 1481 drivers/power/supply/ab8500_fg.c cap = di->bat_cap.max_mah_design; di 1483 drivers/power/supply/ab8500_fg.c ab8500_fg_fill_cap_sample(di, di->bat_cap.user_mah); di 1484 drivers/power/supply/ab8500_fg.c di->bat_cap.permille = ab8500_fg_convert_mah_to_permille(di, cap); di 1485 drivers/power/supply/ab8500_fg.c di->bat_cap.mah = cap; di 1486 drivers/power/supply/ab8500_fg.c ab8500_fg_check_capacity_limits(di, true); di 1489 drivers/power/supply/ab8500_fg.c static bool check_sysfs_capacity(struct ab8500_fg *di) di 1494 drivers/power/supply/ab8500_fg.c cap = di->bat_cap.user_mah; di 1496 drivers/power/supply/ab8500_fg.c cap_permille = ab8500_fg_convert_mah_to_permille(di, di 1497 drivers/power/supply/ab8500_fg.c di->bat_cap.user_mah); di 1499 drivers/power/supply/ab8500_fg.c lower = di->bat_cap.permille - di->bm->fg_params->user_cap_limit * 10; di 1500 drivers/power/supply/ab8500_fg.c upper = di->bat_cap.permille + di->bm->fg_params->user_cap_limit * 10; di 1508 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Capacity limits:" di 1510 drivers/power/supply/ab8500_fg.c lower, cap_permille, upper, cap, di->bat_cap.mah); di 1514 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "OK! Using users cap %d uAh now\n", cap); di 1515 drivers/power/supply/ab8500_fg.c force_capacity(di); di 1518 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Capacity from user out of limits, ignoring"); di 1528 drivers/power/supply/ab8500_fg.c static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di) di 1533 drivers/power/supply/ab8500_fg.c if (di->charge_state != AB8500_FG_CHARGE_INIT) di 1534 drivers/power/supply/ab8500_fg.c ab8500_fg_charge_state_to(di, AB8500_FG_CHARGE_INIT); di 1536 drivers/power/supply/ab8500_fg.c switch (di->discharge_state) { di 1539 drivers/power/supply/ab8500_fg.c di->init_cnt = 0; di 1540 drivers/power/supply/ab8500_fg.c di->fg_samples = SEC_TO_SAMPLE(di->bm->fg_params->init_timer); di 1541 drivers/power/supply/ab8500_fg.c ab8500_fg_coulomb_counter(di, true); di 1542 drivers/power/supply/ab8500_fg.c ab8500_fg_discharge_state_to(di, di 1553 drivers/power/supply/ab8500_fg.c sleep_time = di->bm->fg_params->init_timer; di 1556 drivers/power/supply/ab8500_fg.c if (di->init_cnt > di->bm->fg_params->init_discard_time) { di 1557 drivers/power/supply/ab8500_fg.c ab8500_fg_calc_cap_discharge_voltage(di, true); di 1559 drivers/power/supply/ab8500_fg.c ab8500_fg_check_capacity_limits(di, true); di 1562 drivers/power/supply/ab8500_fg.c di->init_cnt += sleep_time; di 1563 drivers/power/supply/ab8500_fg.c if (di->init_cnt > di->bm->fg_params->init_total_time) di 1564 drivers/power/supply/ab8500_fg.c ab8500_fg_discharge_state_to(di, di 1570 drivers/power/supply/ab8500_fg.c di->recovery_cnt = 0; di 1571 drivers/power/supply/ab8500_fg.c di->recovery_needed = true; di 1572 drivers/power/supply/ab8500_fg.c ab8500_fg_discharge_state_to(di, di 1578 drivers/power/supply/ab8500_fg.c sleep_time = di->bm->fg_params->recovery_sleep_timer; di 1586 drivers/power/supply/ab8500_fg.c di->inst_curr = ab8500_fg_inst_curr_blocking(di); di 1588 drivers/power/supply/ab8500_fg.c if (ab8500_fg_is_low_curr(di, di->inst_curr)) { di 1589 drivers/power/supply/ab8500_fg.c if (di->recovery_cnt > di 1590 drivers/power/supply/ab8500_fg.c di->bm->fg_params->recovery_total_time) { di 1591 drivers/power/supply/ab8500_fg.c di->fg_samples = SEC_TO_SAMPLE( di 1592 drivers/power/supply/ab8500_fg.c di->bm->fg_params->accu_high_curr); di 1593 drivers/power/supply/ab8500_fg.c ab8500_fg_coulomb_counter(di, true); di 1594 drivers/power/supply/ab8500_fg.c ab8500_fg_discharge_state_to(di, di 1596 drivers/power/supply/ab8500_fg.c di->recovery_needed = false; di 1598 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, di 1599 drivers/power/supply/ab8500_fg.c &di->fg_periodic_work, di 1602 drivers/power/supply/ab8500_fg.c di->recovery_cnt += sleep_time; di 1604 drivers/power/supply/ab8500_fg.c di->fg_samples = SEC_TO_SAMPLE( di 1605 drivers/power/supply/ab8500_fg.c di->bm->fg_params->accu_high_curr); di 1606 drivers/power/supply/ab8500_fg.c ab8500_fg_coulomb_counter(di, true); di 1607 drivers/power/supply/ab8500_fg.c ab8500_fg_discharge_state_to(di, di 1613 drivers/power/supply/ab8500_fg.c di->fg_samples = SEC_TO_SAMPLE( di 1614 drivers/power/supply/ab8500_fg.c di->bm->fg_params->accu_high_curr); di 1615 drivers/power/supply/ab8500_fg.c ab8500_fg_coulomb_counter(di, true); di 1616 drivers/power/supply/ab8500_fg.c ab8500_fg_discharge_state_to(di, di 1621 drivers/power/supply/ab8500_fg.c di->inst_curr = ab8500_fg_inst_curr_blocking(di); di 1623 drivers/power/supply/ab8500_fg.c if (ab8500_fg_is_low_curr(di, di->inst_curr)) { di 1625 drivers/power/supply/ab8500_fg.c if (di->high_curr_mode) { di 1626 drivers/power/supply/ab8500_fg.c di->high_curr_mode = false; di 1627 drivers/power/supply/ab8500_fg.c di->high_curr_cnt = 0; di 1630 drivers/power/supply/ab8500_fg.c if (di->recovery_needed) { di 1631 drivers/power/supply/ab8500_fg.c ab8500_fg_discharge_state_to(di, di 1634 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, di 1635 drivers/power/supply/ab8500_fg.c &di->fg_periodic_work, 0); di 1640 drivers/power/supply/ab8500_fg.c ab8500_fg_calc_cap_discharge_voltage(di, true); di 1642 drivers/power/supply/ab8500_fg.c mutex_lock(&di->cc_lock); di 1643 drivers/power/supply/ab8500_fg.c if (!di->flags.conv_done) { di 1645 drivers/power/supply/ab8500_fg.c mutex_unlock(&di->cc_lock); di 1646 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "%s CC conv not done\n", di 1651 drivers/power/supply/ab8500_fg.c di->flags.conv_done = false; di 1652 drivers/power/supply/ab8500_fg.c mutex_unlock(&di->cc_lock); di 1655 drivers/power/supply/ab8500_fg.c if (!di->high_curr_mode) { di 1656 drivers/power/supply/ab8500_fg.c di->high_curr_mode = true; di 1657 drivers/power/supply/ab8500_fg.c di->high_curr_cnt = 0; di 1660 drivers/power/supply/ab8500_fg.c di->high_curr_cnt += di 1661 drivers/power/supply/ab8500_fg.c di->bm->fg_params->accu_high_curr; di 1662 drivers/power/supply/ab8500_fg.c if (di->high_curr_cnt > di 1663 drivers/power/supply/ab8500_fg.c di->bm->fg_params->high_curr_time) di 1664 drivers/power/supply/ab8500_fg.c di->recovery_needed = true; di 1666 drivers/power/supply/ab8500_fg.c ab8500_fg_calc_cap_discharge_fg(di); di 1669 drivers/power/supply/ab8500_fg.c ab8500_fg_check_capacity_limits(di, false); di 1674 drivers/power/supply/ab8500_fg.c ab8500_fg_calc_cap_discharge_voltage(di, true); di 1676 drivers/power/supply/ab8500_fg.c di->fg_samples = SEC_TO_SAMPLE( di 1677 drivers/power/supply/ab8500_fg.c di->bm->fg_params->accu_high_curr); di 1678 drivers/power/supply/ab8500_fg.c ab8500_fg_coulomb_counter(di, true); di 1679 drivers/power/supply/ab8500_fg.c ab8500_fg_discharge_state_to(di, di 1682 drivers/power/supply/ab8500_fg.c ab8500_fg_check_capacity_limits(di, false); di 1696 drivers/power/supply/ab8500_fg.c static void ab8500_fg_algorithm_calibrate(struct ab8500_fg *di) di 1700 drivers/power/supply/ab8500_fg.c switch (di->calib_state) { di 1702 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Calibration ongoing...\n"); di 1704 drivers/power/supply/ab8500_fg.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 1710 drivers/power/supply/ab8500_fg.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 1715 drivers/power/supply/ab8500_fg.c di->calib_state = AB8500_FG_CALIB_WAIT; di 1718 drivers/power/supply/ab8500_fg.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 1723 drivers/power/supply/ab8500_fg.c di->flags.calibrate = false; di 1724 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Calibration done...\n"); di 1725 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); di 1728 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Calibration WFI\n"); di 1735 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "failed to calibrate the CC\n"); di 1736 drivers/power/supply/ab8500_fg.c di->flags.calibrate = false; di 1737 drivers/power/supply/ab8500_fg.c di->calib_state = AB8500_FG_CALIB_INIT; di 1738 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); di 1747 drivers/power/supply/ab8500_fg.c static void ab8500_fg_algorithm(struct ab8500_fg *di) di 1749 drivers/power/supply/ab8500_fg.c if (di->flags.calibrate) di 1750 drivers/power/supply/ab8500_fg.c ab8500_fg_algorithm_calibrate(di); di 1752 drivers/power/supply/ab8500_fg.c if (di->flags.charging) di 1753 drivers/power/supply/ab8500_fg.c ab8500_fg_algorithm_charging(di); di 1755 drivers/power/supply/ab8500_fg.c ab8500_fg_algorithm_discharging(di); di 1758 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "[FG_DATA] %d %d %d %d %d %d %d %d %d %d " di 1760 drivers/power/supply/ab8500_fg.c di->bat_cap.max_mah_design, di 1761 drivers/power/supply/ab8500_fg.c di->bat_cap.max_mah, di 1762 drivers/power/supply/ab8500_fg.c di->bat_cap.mah, di 1763 drivers/power/supply/ab8500_fg.c di->bat_cap.permille, di 1764 drivers/power/supply/ab8500_fg.c di->bat_cap.level, di 1765 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_mah, di 1766 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_percent, di 1767 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_level, di 1768 drivers/power/supply/ab8500_fg.c di->vbat, di 1769 drivers/power/supply/ab8500_fg.c di->inst_curr, di 1770 drivers/power/supply/ab8500_fg.c di->avg_curr, di 1771 drivers/power/supply/ab8500_fg.c di->accu_charge, di 1772 drivers/power/supply/ab8500_fg.c di->flags.charging, di 1773 drivers/power/supply/ab8500_fg.c di->charge_state, di 1774 drivers/power/supply/ab8500_fg.c di->discharge_state, di 1775 drivers/power/supply/ab8500_fg.c di->high_curr_mode, di 1776 drivers/power/supply/ab8500_fg.c di->recovery_needed); di 1787 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = container_of(work, struct ab8500_fg, di 1790 drivers/power/supply/ab8500_fg.c if (di->init_capacity) { di 1792 drivers/power/supply/ab8500_fg.c ab8500_fg_calc_cap_discharge_voltage(di, true); di 1793 drivers/power/supply/ab8500_fg.c ab8500_fg_check_capacity_limits(di, true); di 1794 drivers/power/supply/ab8500_fg.c di->init_capacity = false; di 1796 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); di 1797 drivers/power/supply/ab8500_fg.c } else if (di->flags.user_cap) { di 1798 drivers/power/supply/ab8500_fg.c if (check_sysfs_capacity(di)) { di 1799 drivers/power/supply/ab8500_fg.c ab8500_fg_check_capacity_limits(di, true); di 1800 drivers/power/supply/ab8500_fg.c if (di->flags.charging) di 1801 drivers/power/supply/ab8500_fg.c ab8500_fg_charge_state_to(di, di 1804 drivers/power/supply/ab8500_fg.c ab8500_fg_discharge_state_to(di, di 1807 drivers/power/supply/ab8500_fg.c di->flags.user_cap = false; di 1808 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); di 1810 drivers/power/supply/ab8500_fg.c ab8500_fg_algorithm(di); di 1825 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = container_of(work, struct ab8500_fg, di 1832 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, di 1836 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "%s ab8500 read failed\n", __func__); di 1840 drivers/power/supply/ab8500_fg.c if (!di->flags.bat_ovv) { di 1841 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Battery OVV\n"); di 1842 drivers/power/supply/ab8500_fg.c di->flags.bat_ovv = true; di 1843 drivers/power/supply/ab8500_fg.c power_supply_changed(di->fg_psy); di 1846 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, &di->fg_check_hw_failure_work, di 1849 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Battery recovered from OVV\n"); di 1850 drivers/power/supply/ab8500_fg.c di->flags.bat_ovv = false; di 1851 drivers/power/supply/ab8500_fg.c power_supply_changed(di->fg_psy); di 1865 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = container_of(work, struct ab8500_fg, di 1868 drivers/power/supply/ab8500_fg.c vbat = ab8500_fg_bat_voltage(di); di 1871 drivers/power/supply/ab8500_fg.c if (vbat < di->bm->fg_params->lowbat_threshold) { di 1873 drivers/power/supply/ab8500_fg.c if (di->low_bat_cnt < 1) { di 1874 drivers/power/supply/ab8500_fg.c di->flags.low_bat = true; di 1875 drivers/power/supply/ab8500_fg.c dev_warn(di->dev, "Shut down pending...\n"); di 1882 drivers/power/supply/ab8500_fg.c di->low_bat_cnt--; di 1883 drivers/power/supply/ab8500_fg.c dev_warn(di->dev, "Battery voltage still LOW\n"); di 1884 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, &di->fg_low_bat_work, di 1888 drivers/power/supply/ab8500_fg.c di->flags.low_bat_delay = false; di 1889 drivers/power/supply/ab8500_fg.c di->low_bat_cnt = 10; di 1890 drivers/power/supply/ab8500_fg.c dev_warn(di->dev, "Battery voltage OK again\n"); di 1894 drivers/power/supply/ab8500_fg.c ab8500_fg_check_capacity_limits(di, false); di 1907 drivers/power/supply/ab8500_fg.c static int ab8500_fg_battok_calc(struct ab8500_fg *di, int target) di 1923 drivers/power/supply/ab8500_fg.c static int ab8500_fg_battok_init_hw_register(struct ab8500_fg *di) di 1933 drivers/power/supply/ab8500_fg.c sel0 = di->bm->fg_params->battok_falling_th_sel0; di 1934 drivers/power/supply/ab8500_fg.c sel1 = di->bm->fg_params->battok_raising_th_sel1; di 1936 drivers/power/supply/ab8500_fg.c cbp_sel0 = ab8500_fg_battok_calc(di, sel0); di 1937 drivers/power/supply/ab8500_fg.c cbp_sel1 = ab8500_fg_battok_calc(di, sel1); di 1942 drivers/power/supply/ab8500_fg.c dev_warn(di->dev, "Invalid voltage step:%d, using %d %d\n", di 1948 drivers/power/supply/ab8500_fg.c dev_warn(di->dev, "Invalid voltage step:%d, using %d %d\n", di 1953 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "using: %x %d %d\n", new_val, cbp_sel0, cbp_sel1); di 1954 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_SYS_CTRL2_BLOCK, di 1967 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = container_of(work, struct ab8500_fg, fg_work); di 1969 drivers/power/supply/ab8500_fg.c ab8500_fg_algorithm(di); di 1981 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = _di; di 1982 drivers/power/supply/ab8500_fg.c if (!di->nbr_cceoc_irq_cnt) { di 1983 drivers/power/supply/ab8500_fg.c di->nbr_cceoc_irq_cnt++; di 1984 drivers/power/supply/ab8500_fg.c complete(&di->ab8500_fg_started); di 1986 drivers/power/supply/ab8500_fg.c di->nbr_cceoc_irq_cnt = 0; di 1987 drivers/power/supply/ab8500_fg.c complete(&di->ab8500_fg_complete); di 2001 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = _di; di 2002 drivers/power/supply/ab8500_fg.c di->calib_state = AB8500_FG_CALIB_END; di 2003 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); di 2016 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = _di; di 2018 drivers/power/supply/ab8500_fg.c queue_work(di->fg_wq, &di->fg_acc_cur_work); di 2032 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = _di; di 2034 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Battery OVV\n"); di 2037 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, &di->fg_check_hw_failure_work, 0); di 2051 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = _di; di 2054 drivers/power/supply/ab8500_fg.c if (!di->flags.low_bat_delay) { di 2055 drivers/power/supply/ab8500_fg.c dev_warn(di->dev, "Battery voltage is below LOW threshold\n"); di 2056 drivers/power/supply/ab8500_fg.c di->flags.low_bat_delay = true; di 2061 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, &di->fg_low_bat_work, di 2089 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2100 drivers/power/supply/ab8500_fg.c if (di->flags.bat_ovv) di 2103 drivers/power/supply/ab8500_fg.c val->intval = di->vbat * 1000; di 2106 drivers/power/supply/ab8500_fg.c val->intval = di->inst_curr * 1000; di 2109 drivers/power/supply/ab8500_fg.c val->intval = di->avg_curr * 1000; di 2112 drivers/power/supply/ab8500_fg.c val->intval = ab8500_fg_convert_mah_to_uwh(di, di 2113 drivers/power/supply/ab8500_fg.c di->bat_cap.max_mah_design); di 2116 drivers/power/supply/ab8500_fg.c val->intval = ab8500_fg_convert_mah_to_uwh(di, di 2117 drivers/power/supply/ab8500_fg.c di->bat_cap.max_mah); di 2120 drivers/power/supply/ab8500_fg.c if (di->flags.batt_unknown && !di->bm->chg_unknown_bat && di 2121 drivers/power/supply/ab8500_fg.c di->flags.batt_id_received) di 2122 drivers/power/supply/ab8500_fg.c val->intval = ab8500_fg_convert_mah_to_uwh(di, di 2123 drivers/power/supply/ab8500_fg.c di->bat_cap.max_mah); di 2125 drivers/power/supply/ab8500_fg.c val->intval = ab8500_fg_convert_mah_to_uwh(di, di 2126 drivers/power/supply/ab8500_fg.c di->bat_cap.prev_mah); di 2129 drivers/power/supply/ab8500_fg.c val->intval = di->bat_cap.max_mah_design; di 2132 drivers/power/supply/ab8500_fg.c val->intval = di->bat_cap.max_mah; di 2135 drivers/power/supply/ab8500_fg.c if (di->flags.batt_unknown && !di->bm->chg_unknown_bat && di 2136 drivers/power/supply/ab8500_fg.c di->flags.batt_id_received) di 2137 drivers/power/supply/ab8500_fg.c val->intval = di->bat_cap.max_mah; di 2139 drivers/power/supply/ab8500_fg.c val->intval = di->bat_cap.prev_mah; di 2142 drivers/power/supply/ab8500_fg.c if (di->flags.batt_unknown && !di->bm->chg_unknown_bat && di 2143 drivers/power/supply/ab8500_fg.c di->flags.batt_id_received) di 2146 drivers/power/supply/ab8500_fg.c val->intval = di->bat_cap.prev_percent; di 2149 drivers/power/supply/ab8500_fg.c if (di->flags.batt_unknown && !di->bm->chg_unknown_bat && di 2150 drivers/power/supply/ab8500_fg.c di->flags.batt_id_received) di 2153 drivers/power/supply/ab8500_fg.c val->intval = di->bat_cap.prev_level; di 2166 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di; di 2171 drivers/power/supply/ab8500_fg.c di = power_supply_get_drvdata(psy); di 2197 drivers/power/supply/ab8500_fg.c if (!di->flags.charging) di 2199 drivers/power/supply/ab8500_fg.c di->flags.charging = false; di 2200 drivers/power/supply/ab8500_fg.c di->flags.fully_charged = false; di 2201 drivers/power/supply/ab8500_fg.c if (di->bm->capacity_scaling) di 2202 drivers/power/supply/ab8500_fg.c ab8500_fg_update_cap_scalers(di); di 2203 drivers/power/supply/ab8500_fg.c queue_work(di->fg_wq, &di->fg_work); di 2206 drivers/power/supply/ab8500_fg.c if (di->flags.fully_charged) di 2208 drivers/power/supply/ab8500_fg.c di->flags.fully_charged = true; di 2209 drivers/power/supply/ab8500_fg.c di->flags.force_full = true; di 2211 drivers/power/supply/ab8500_fg.c di->bat_cap.max_mah = di->bat_cap.mah; di 2212 drivers/power/supply/ab8500_fg.c queue_work(di->fg_wq, &di->fg_work); di 2215 drivers/power/supply/ab8500_fg.c if (di->flags.charging && di 2216 drivers/power/supply/ab8500_fg.c !di->flags.fully_charged) di 2218 drivers/power/supply/ab8500_fg.c di->flags.charging = true; di 2219 drivers/power/supply/ab8500_fg.c di->flags.fully_charged = false; di 2220 drivers/power/supply/ab8500_fg.c if (di->bm->capacity_scaling) di 2221 drivers/power/supply/ab8500_fg.c ab8500_fg_update_cap_scalers(di); di 2222 drivers/power/supply/ab8500_fg.c queue_work(di->fg_wq, &di->fg_work); di 2232 drivers/power/supply/ab8500_fg.c if (!di->flags.batt_id_received && di 2233 drivers/power/supply/ab8500_fg.c di->bm->batt_id != BATTERY_UNKNOWN) { di 2236 drivers/power/supply/ab8500_fg.c b = &(di->bm->bat_type[di->bm->batt_id]); di 2238 drivers/power/supply/ab8500_fg.c di->flags.batt_id_received = true; di 2240 drivers/power/supply/ab8500_fg.c di->bat_cap.max_mah_design = di 2244 drivers/power/supply/ab8500_fg.c di->bat_cap.max_mah = di 2245 drivers/power/supply/ab8500_fg.c di->bat_cap.max_mah_design; di 2247 drivers/power/supply/ab8500_fg.c di->vbat_nom = b->nominal_voltage; di 2251 drivers/power/supply/ab8500_fg.c di->flags.batt_unknown = false; di 2253 drivers/power/supply/ab8500_fg.c di->flags.batt_unknown = true; di 2262 drivers/power/supply/ab8500_fg.c if (di->flags.batt_id_received) di 2263 drivers/power/supply/ab8500_fg.c di->bat_temp = ret.intval; di 2282 drivers/power/supply/ab8500_fg.c static int ab8500_fg_init_hw_registers(struct ab8500_fg *di) di 2287 drivers/power/supply/ab8500_fg.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 2293 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "failed to set BATT_OVV\n"); di 2298 drivers/power/supply/ab8500_fg.c ret = abx500_mask_and_set_register_interruptible(di->dev, di 2304 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "failed to enable BATT_OVV\n"); di 2309 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, di 2313 drivers/power/supply/ab8500_fg.c di->bm->fg_params->lowbat_threshold) << 1 | di 2316 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "%s write failed\n", __func__); di 2321 drivers/power/supply/ab8500_fg.c ret = ab8500_fg_battok_init_hw_register(di); di 2323 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "BattOk init write failed.\n"); di 2327 drivers/power/supply/ab8500_fg.c if (is_ab8505(di->parent)) { di 2328 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 2329 drivers/power/supply/ab8500_fg.c AB8505_RTC_PCUT_MAX_TIME_REG, di->bm->fg_params->pcut_max_time); di 2332 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_MAX_TIME_REG\n", __func__); di 2336 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 2337 drivers/power/supply/ab8500_fg.c AB8505_RTC_PCUT_FLAG_TIME_REG, di->bm->fg_params->pcut_flag_time); di 2340 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_FLAG_TIME_REG\n", __func__); di 2344 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 2345 drivers/power/supply/ab8500_fg.c AB8505_RTC_PCUT_RESTART_REG, di->bm->fg_params->pcut_max_restart); di 2348 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_RESTART_REG\n", __func__); di 2352 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 2353 drivers/power/supply/ab8500_fg.c AB8505_RTC_PCUT_DEBOUNCE_REG, di->bm->fg_params->pcut_debounce_time); di 2356 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_DEBOUNCE_REG\n", __func__); di 2360 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 2361 drivers/power/supply/ab8500_fg.c AB8505_RTC_PCUT_CTL_STATUS_REG, di->bm->fg_params->pcut_enable); di 2364 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_CTL_STATUS_REG\n", __func__); di 2383 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2386 drivers/power/supply/ab8500_fg.c di->fg_psy, ab8500_fg_get_ext_psy_data); di 2399 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = container_of(work, struct ab8500_fg, di 2402 drivers/power/supply/ab8500_fg.c if (di->flags.calibrate == false) { di 2403 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Resetting FG state machine to init.\n"); di 2404 drivers/power/supply/ab8500_fg.c ab8500_fg_clear_cap_samples(di); di 2405 drivers/power/supply/ab8500_fg.c ab8500_fg_calc_cap_discharge_voltage(di, true); di 2406 drivers/power/supply/ab8500_fg.c ab8500_fg_charge_state_to(di, AB8500_FG_CHARGE_INIT); di 2407 drivers/power/supply/ab8500_fg.c ab8500_fg_discharge_state_to(di, AB8500_FG_DISCHARGE_INIT); di 2408 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); di 2411 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "Residual offset calibration ongoing " di 2414 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, &di->fg_reinit_work, di 2427 drivers/power/supply/ab8500_fg.c static ssize_t charge_full_show(struct ab8500_fg *di, char *buf) di 2429 drivers/power/supply/ab8500_fg.c return sprintf(buf, "%d\n", di->bat_cap.max_mah); di 2432 drivers/power/supply/ab8500_fg.c static ssize_t charge_full_store(struct ab8500_fg *di, const char *buf, di 2442 drivers/power/supply/ab8500_fg.c di->bat_cap.max_mah = (int) charge_full; di 2446 drivers/power/supply/ab8500_fg.c static ssize_t charge_now_show(struct ab8500_fg *di, char *buf) di 2448 drivers/power/supply/ab8500_fg.c return sprintf(buf, "%d\n", di->bat_cap.prev_mah); di 2451 drivers/power/supply/ab8500_fg.c static ssize_t charge_now_store(struct ab8500_fg *di, const char *buf, di 2461 drivers/power/supply/ab8500_fg.c di->bat_cap.user_mah = (int) charge_now; di 2462 drivers/power/supply/ab8500_fg.c di->flags.user_cap = true; di 2463 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); di 2477 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di; di 2480 drivers/power/supply/ab8500_fg.c di = container_of(kobj, struct ab8500_fg, fg_kobject); di 2485 drivers/power/supply/ab8500_fg.c return entry->show(di, buf); di 2492 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di; di 2495 drivers/power/supply/ab8500_fg.c di = container_of(kobj, struct ab8500_fg, fg_kobject); di 2500 drivers/power/supply/ab8500_fg.c return entry->store(di, buf, count); di 2525 drivers/power/supply/ab8500_fg.c static void ab8500_fg_sysfs_exit(struct ab8500_fg *di) di 2527 drivers/power/supply/ab8500_fg.c kobject_del(&di->fg_kobject); di 2537 drivers/power/supply/ab8500_fg.c static int ab8500_fg_sysfs_init(struct ab8500_fg *di) di 2541 drivers/power/supply/ab8500_fg.c ret = kobject_init_and_add(&di->fg_kobject, di 2545 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "failed to create sysfs entry\n"); di 2557 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2559 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_RTC, di 2580 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2590 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 2607 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2609 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_RTC, di 2631 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2641 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 2658 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2660 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_RTC, di 2681 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2691 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 2709 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2711 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_RTC, di 2732 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2734 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_RTC, di 2755 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2757 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_RTC, di 2776 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2786 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 2804 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2806 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_RTC, di 2827 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2829 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_RTC, di 2850 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2860 drivers/power/supply/ab8500_fg.c ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, di 2877 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = power_supply_get_drvdata(psy); di 2879 drivers/power/supply/ab8500_fg.c ret = abx500_get_register_interruptible(di->dev, AB8500_RTC, di 2912 drivers/power/supply/ab8500_fg.c static int ab8500_fg_sysfs_psy_create_attrs(struct ab8500_fg *di) di 2916 drivers/power/supply/ab8500_fg.c if (is_ab8505(di->parent)) { di 2918 drivers/power/supply/ab8500_fg.c if (device_create_file(&di->fg_psy->dev, di 2924 drivers/power/supply/ab8500_fg.c dev_err(&di->fg_psy->dev, "Failed creating sysfs psy attrs for ab8505.\n"); di 2926 drivers/power/supply/ab8500_fg.c device_remove_file(&di->fg_psy->dev, di 2932 drivers/power/supply/ab8500_fg.c static void ab8500_fg_sysfs_psy_remove_attrs(struct ab8500_fg *di) di 2936 drivers/power/supply/ab8500_fg.c if (is_ab8505(di->parent)) { di 2938 drivers/power/supply/ab8500_fg.c (void)device_remove_file(&di->fg_psy->dev, di 2948 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = platform_get_drvdata(pdev); di 2954 drivers/power/supply/ab8500_fg.c if (!di->flags.charging) { di 2955 drivers/power/supply/ab8500_fg.c ab8500_fg_discharge_state_to(di, AB8500_FG_DISCHARGE_WAKEUP); di 2956 drivers/power/supply/ab8500_fg.c queue_work(di->fg_wq, &di->fg_work); di 2965 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = platform_get_drvdata(pdev); di 2967 drivers/power/supply/ab8500_fg.c flush_delayed_work(&di->fg_periodic_work); di 2968 drivers/power/supply/ab8500_fg.c flush_work(&di->fg_work); di 2969 drivers/power/supply/ab8500_fg.c flush_work(&di->fg_acc_cur_work); di 2970 drivers/power/supply/ab8500_fg.c flush_delayed_work(&di->fg_reinit_work); di 2971 drivers/power/supply/ab8500_fg.c flush_delayed_work(&di->fg_low_bat_work); di 2972 drivers/power/supply/ab8500_fg.c flush_delayed_work(&di->fg_check_hw_failure_work); di 2978 drivers/power/supply/ab8500_fg.c if (di->flags.fg_enabled && !di->flags.charging) di 2979 drivers/power/supply/ab8500_fg.c ab8500_fg_coulomb_counter(di, false); di 2991 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di = platform_get_drvdata(pdev); di 2993 drivers/power/supply/ab8500_fg.c list_del(&di->node); di 2996 drivers/power/supply/ab8500_fg.c ret = ab8500_fg_coulomb_counter(di, false); di 2998 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "failed to disable coulomb counter\n"); di 3000 drivers/power/supply/ab8500_fg.c destroy_workqueue(di->fg_wq); di 3001 drivers/power/supply/ab8500_fg.c ab8500_fg_sysfs_exit(di); di 3004 drivers/power/supply/ab8500_fg.c ab8500_fg_sysfs_psy_remove_attrs(di); di 3005 drivers/power/supply/ab8500_fg.c power_supply_unregister(di->fg_psy); di 3040 drivers/power/supply/ab8500_fg.c struct ab8500_fg *di; di 3044 drivers/power/supply/ab8500_fg.c di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); di 3045 drivers/power/supply/ab8500_fg.c if (!di) { di 3054 drivers/power/supply/ab8500_fg.c di->bm = plat; di 3057 drivers/power/supply/ab8500_fg.c ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm); di 3064 drivers/power/supply/ab8500_fg.c mutex_init(&di->cc_lock); di 3067 drivers/power/supply/ab8500_fg.c di->dev = &pdev->dev; di 3068 drivers/power/supply/ab8500_fg.c di->parent = dev_get_drvdata(pdev->dev.parent); di 3069 drivers/power/supply/ab8500_fg.c di->gpadc = ab8500_gpadc_get("ab8500-gpadc.0"); di 3073 drivers/power/supply/ab8500_fg.c psy_cfg.drv_data = di; di 3075 drivers/power/supply/ab8500_fg.c di->bat_cap.max_mah_design = MILLI_TO_MICRO * di 3076 drivers/power/supply/ab8500_fg.c di->bm->bat_type[di->bm->batt_id].charge_full_design; di 3078 drivers/power/supply/ab8500_fg.c di->bat_cap.max_mah = di->bat_cap.max_mah_design; di 3080 drivers/power/supply/ab8500_fg.c di->vbat_nom = di->bm->bat_type[di->bm->batt_id].nominal_voltage; di 3082 drivers/power/supply/ab8500_fg.c di->init_capacity = true; di 3084 drivers/power/supply/ab8500_fg.c ab8500_fg_charge_state_to(di, AB8500_FG_CHARGE_INIT); di 3085 drivers/power/supply/ab8500_fg.c ab8500_fg_discharge_state_to(di, AB8500_FG_DISCHARGE_INIT); di 3088 drivers/power/supply/ab8500_fg.c di->fg_wq = alloc_ordered_workqueue("ab8500_fg_wq", WQ_MEM_RECLAIM); di 3089 drivers/power/supply/ab8500_fg.c if (di->fg_wq == NULL) { di 3090 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "failed to create work queue\n"); di 3095 drivers/power/supply/ab8500_fg.c INIT_WORK(&di->fg_work, ab8500_fg_instant_work); di 3098 drivers/power/supply/ab8500_fg.c INIT_WORK(&di->fg_acc_cur_work, ab8500_fg_acc_cur_work); di 3101 drivers/power/supply/ab8500_fg.c INIT_DEFERRABLE_WORK(&di->fg_reinit_work, di 3105 drivers/power/supply/ab8500_fg.c INIT_DEFERRABLE_WORK(&di->fg_periodic_work, di 3109 drivers/power/supply/ab8500_fg.c INIT_DEFERRABLE_WORK(&di->fg_low_bat_work, di 3113 drivers/power/supply/ab8500_fg.c INIT_DEFERRABLE_WORK(&di->fg_check_hw_failure_work, di 3117 drivers/power/supply/ab8500_fg.c di->flags.low_bat = false; di 3120 drivers/power/supply/ab8500_fg.c di->low_bat_cnt = 10; di 3123 drivers/power/supply/ab8500_fg.c ret = ab8500_fg_init_hw_registers(di); di 3125 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "failed to initialize registers\n"); di 3130 drivers/power/supply/ab8500_fg.c di->flags.batt_unknown = true; di 3131 drivers/power/supply/ab8500_fg.c di->flags.batt_id_received = false; di 3134 drivers/power/supply/ab8500_fg.c di->fg_psy = power_supply_register(di->dev, &ab8500_fg_desc, &psy_cfg); di 3135 drivers/power/supply/ab8500_fg.c if (IS_ERR(di->fg_psy)) { di 3136 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "failed to register FG psy\n"); di 3137 drivers/power/supply/ab8500_fg.c ret = PTR_ERR(di->fg_psy); di 3141 drivers/power/supply/ab8500_fg.c di->fg_samples = SEC_TO_SAMPLE(di->bm->fg_params->init_timer); di 3142 drivers/power/supply/ab8500_fg.c ab8500_fg_coulomb_counter(di, true); di 3148 drivers/power/supply/ab8500_fg.c init_completion(&di->ab8500_fg_started); di 3149 drivers/power/supply/ab8500_fg.c init_completion(&di->ab8500_fg_complete); di 3156 drivers/power/supply/ab8500_fg.c ab8500_fg_irq_th[i].name, di); di 3159 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "failed to request %s IRQ %d: %d\n", di 3163 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Requested %s IRQ %d: %d\n", di 3171 drivers/power/supply/ab8500_fg.c ab8500_fg_irq_bh[0].name, di); di 3174 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "failed to request %s IRQ %d: %d\n", di 3178 drivers/power/supply/ab8500_fg.c dev_dbg(di->dev, "Requested %s IRQ %d: %d\n", di 3181 drivers/power/supply/ab8500_fg.c di->irq = platform_get_irq_byname(pdev, "CCEOC"); di 3182 drivers/power/supply/ab8500_fg.c disable_irq(di->irq); di 3183 drivers/power/supply/ab8500_fg.c di->nbr_cceoc_irq_cnt = 0; di 3185 drivers/power/supply/ab8500_fg.c platform_set_drvdata(pdev, di); di 3187 drivers/power/supply/ab8500_fg.c ret = ab8500_fg_sysfs_init(di); di 3189 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "failed to create sysfs entry\n"); di 3193 drivers/power/supply/ab8500_fg.c ret = ab8500_fg_sysfs_psy_create_attrs(di); di 3195 drivers/power/supply/ab8500_fg.c dev_err(di->dev, "failed to create FG psy\n"); di 3196 drivers/power/supply/ab8500_fg.c ab8500_fg_sysfs_exit(di); di 3201 drivers/power/supply/ab8500_fg.c di->flags.calibrate = true; di 3202 drivers/power/supply/ab8500_fg.c di->calib_state = AB8500_FG_CALIB_INIT; di 3205 drivers/power/supply/ab8500_fg.c di->bat_temp = 210; di 3208 drivers/power/supply/ab8500_fg.c queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); di 3210 drivers/power/supply/ab8500_fg.c list_add_tail(&di->node, &ab8500_fg_list); di 3215 drivers/power/supply/ab8500_fg.c power_supply_unregister(di->fg_psy); di 3220 drivers/power/supply/ab8500_fg.c free_irq(irq, di); di 3223 drivers/power/supply/ab8500_fg.c free_irq(irq, di); di 3225 drivers/power/supply/ab8500_fg.c destroy_workqueue(di->fg_wq); di 289 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di = container_of(timer, struct abx500_chargalg, di 291 drivers/power/supply/abx500_chargalg.c dev_err(di->dev, "Safety timer expired\n"); di 292 drivers/power/supply/abx500_chargalg.c di->events.safety_timer_expired = true; di 295 drivers/power/supply/abx500_chargalg.c queue_work(di->chargalg_wq, &di->chargalg_work); di 312 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di = container_of(timer, struct abx500_chargalg, di 315 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, "Maintenance timer expired\n"); di 316 drivers/power/supply/abx500_chargalg.c di->events.maintenance_timer_expired = true; di 319 drivers/power/supply/abx500_chargalg.c queue_work(di->chargalg_wq, &di->chargalg_work); di 330 drivers/power/supply/abx500_chargalg.c static void abx500_chargalg_state_to(struct abx500_chargalg *di, di 333 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, di 335 drivers/power/supply/abx500_chargalg.c di->charge_state == state ? "NO" : "YES", di 336 drivers/power/supply/abx500_chargalg.c di->charge_state, di 337 drivers/power/supply/abx500_chargalg.c states[di->charge_state], di 341 drivers/power/supply/abx500_chargalg.c di->charge_state = state; di 344 drivers/power/supply/abx500_chargalg.c static int abx500_chargalg_check_charger_enable(struct abx500_chargalg *di) di 346 drivers/power/supply/abx500_chargalg.c switch (di->charge_state) { di 355 drivers/power/supply/abx500_chargalg.c if (di->chg_info.charger_type & USB_CHG) { di 356 drivers/power/supply/abx500_chargalg.c return di->usb_chg->ops.check_enable(di->usb_chg, di 357 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[di->bm->batt_id].normal_vol_lvl, di 358 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[di->bm->batt_id].normal_cur_lvl); di 359 drivers/power/supply/abx500_chargalg.c } else if ((di->chg_info.charger_type & AC_CHG) && di 360 drivers/power/supply/abx500_chargalg.c !(di->ac_chg->external)) { di 361 drivers/power/supply/abx500_chargalg.c return di->ac_chg->ops.check_enable(di->ac_chg, di 362 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[di->bm->batt_id].normal_vol_lvl, di 363 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[di->bm->batt_id].normal_cur_lvl); di 375 drivers/power/supply/abx500_chargalg.c static int abx500_chargalg_check_charger_connection(struct abx500_chargalg *di) di 377 drivers/power/supply/abx500_chargalg.c if (di->chg_info.conn_chg != di->chg_info.prev_conn_chg || di 378 drivers/power/supply/abx500_chargalg.c di->susp_status.suspended_change) { di 383 drivers/power/supply/abx500_chargalg.c if ((di->chg_info.conn_chg & AC_CHG) && di 384 drivers/power/supply/abx500_chargalg.c !di->susp_status.ac_suspended) { di 385 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, "Charging source is AC\n"); di 386 drivers/power/supply/abx500_chargalg.c if (di->chg_info.charger_type != AC_CHG) { di 387 drivers/power/supply/abx500_chargalg.c di->chg_info.charger_type = AC_CHG; di 388 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_NORMAL_INIT); di 390 drivers/power/supply/abx500_chargalg.c } else if ((di->chg_info.conn_chg & USB_CHG) && di 391 drivers/power/supply/abx500_chargalg.c !di->susp_status.usb_suspended) { di 392 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, "Charging source is USB\n"); di 393 drivers/power/supply/abx500_chargalg.c di->chg_info.charger_type = USB_CHG; di 394 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_NORMAL_INIT); di 395 drivers/power/supply/abx500_chargalg.c } else if (di->chg_info.conn_chg && di 396 drivers/power/supply/abx500_chargalg.c (di->susp_status.ac_suspended || di 397 drivers/power/supply/abx500_chargalg.c di->susp_status.usb_suspended)) { di 398 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, "Charging is suspended\n"); di 399 drivers/power/supply/abx500_chargalg.c di->chg_info.charger_type = NO_CHG; di 400 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_SUSPENDED_INIT); di 402 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, "Charging source is OFF\n"); di 403 drivers/power/supply/abx500_chargalg.c di->chg_info.charger_type = NO_CHG; di 404 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_HANDHELD_INIT); di 406 drivers/power/supply/abx500_chargalg.c di->chg_info.prev_conn_chg = di->chg_info.conn_chg; di 407 drivers/power/supply/abx500_chargalg.c di->susp_status.suspended_change = false; di 409 drivers/power/supply/abx500_chargalg.c return di->chg_info.conn_chg; di 421 drivers/power/supply/abx500_chargalg.c (struct abx500_chargalg *di) di 423 drivers/power/supply/abx500_chargalg.c if (di->curr_status.curr_step_change) di 424 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_NORMAL_INIT); di 425 drivers/power/supply/abx500_chargalg.c di->curr_status.curr_step_change = false; di 435 drivers/power/supply/abx500_chargalg.c static void abx500_chargalg_start_safety_timer(struct abx500_chargalg *di) di 440 drivers/power/supply/abx500_chargalg.c switch (di->chg_info.charger_type) { di 442 drivers/power/supply/abx500_chargalg.c timer_expiration = di->bm->main_safety_tmr_h; di 446 drivers/power/supply/abx500_chargalg.c timer_expiration = di->bm->usb_safety_tmr_h; di 450 drivers/power/supply/abx500_chargalg.c dev_err(di->dev, "Unknown charger to charge from\n"); di 454 drivers/power/supply/abx500_chargalg.c di->events.safety_timer_expired = false; di 455 drivers/power/supply/abx500_chargalg.c hrtimer_set_expires_range(&di->safety_timer, di 458 drivers/power/supply/abx500_chargalg.c hrtimer_start_expires(&di->safety_timer, HRTIMER_MODE_REL); di 467 drivers/power/supply/abx500_chargalg.c static void abx500_chargalg_stop_safety_timer(struct abx500_chargalg *di) di 469 drivers/power/supply/abx500_chargalg.c if (hrtimer_try_to_cancel(&di->safety_timer) >= 0) di 470 drivers/power/supply/abx500_chargalg.c di->events.safety_timer_expired = false; di 482 drivers/power/supply/abx500_chargalg.c static void abx500_chargalg_start_maintenance_timer(struct abx500_chargalg *di, di 485 drivers/power/supply/abx500_chargalg.c hrtimer_set_expires_range(&di->maintenance_timer, di 488 drivers/power/supply/abx500_chargalg.c di->events.maintenance_timer_expired = false; di 489 drivers/power/supply/abx500_chargalg.c hrtimer_start_expires(&di->maintenance_timer, HRTIMER_MODE_REL); di 499 drivers/power/supply/abx500_chargalg.c static void abx500_chargalg_stop_maintenance_timer(struct abx500_chargalg *di) di 501 drivers/power/supply/abx500_chargalg.c if (hrtimer_try_to_cancel(&di->maintenance_timer) >= 0) di 502 drivers/power/supply/abx500_chargalg.c di->events.maintenance_timer_expired = false; di 512 drivers/power/supply/abx500_chargalg.c static int abx500_chargalg_kick_watchdog(struct abx500_chargalg *di) di 515 drivers/power/supply/abx500_chargalg.c if (di->ac_chg && di->ac_chg->ops.kick_wd && di 516 drivers/power/supply/abx500_chargalg.c di->chg_info.online_chg & AC_CHG) { di 522 drivers/power/supply/abx500_chargalg.c if (di->ac_chg->external && di 523 drivers/power/supply/abx500_chargalg.c di->usb_chg && di->usb_chg->ops.kick_wd) di 524 drivers/power/supply/abx500_chargalg.c di->usb_chg->ops.kick_wd(di->usb_chg); di 526 drivers/power/supply/abx500_chargalg.c return di->ac_chg->ops.kick_wd(di->ac_chg); di 528 drivers/power/supply/abx500_chargalg.c else if (di->usb_chg && di->usb_chg->ops.kick_wd && di 529 drivers/power/supply/abx500_chargalg.c di->chg_info.online_chg & USB_CHG) di 530 drivers/power/supply/abx500_chargalg.c return di->usb_chg->ops.kick_wd(di->usb_chg); di 545 drivers/power/supply/abx500_chargalg.c static int abx500_chargalg_ac_en(struct abx500_chargalg *di, int enable, di 550 drivers/power/supply/abx500_chargalg.c if (!di->ac_chg || !di->ac_chg->ops.enable) di 554 drivers/power/supply/abx500_chargalg.c if (di->ac_chg->max_out_volt) di 555 drivers/power/supply/abx500_chargalg.c vset = min(vset, di->ac_chg->max_out_volt); di 556 drivers/power/supply/abx500_chargalg.c if (di->ac_chg->max_out_curr) di 557 drivers/power/supply/abx500_chargalg.c iset = min(iset, di->ac_chg->max_out_curr); di 559 drivers/power/supply/abx500_chargalg.c di->chg_info.ac_iset = iset; di 560 drivers/power/supply/abx500_chargalg.c di->chg_info.ac_vset = vset; di 563 drivers/power/supply/abx500_chargalg.c if (enable && di->ac_chg->external && di 566 drivers/power/supply/abx500_chargalg.c 0, di->dev); di 570 drivers/power/supply/abx500_chargalg.c return di->ac_chg->ops.enable(di->ac_chg, enable, vset, iset); di 583 drivers/power/supply/abx500_chargalg.c static int abx500_chargalg_usb_en(struct abx500_chargalg *di, int enable, di 586 drivers/power/supply/abx500_chargalg.c if (!di->usb_chg || !di->usb_chg->ops.enable) di 590 drivers/power/supply/abx500_chargalg.c if (di->usb_chg->max_out_volt) di 591 drivers/power/supply/abx500_chargalg.c vset = min(vset, di->usb_chg->max_out_volt); di 592 drivers/power/supply/abx500_chargalg.c if (di->usb_chg->max_out_curr) di 593 drivers/power/supply/abx500_chargalg.c iset = min(iset, di->usb_chg->max_out_curr); di 595 drivers/power/supply/abx500_chargalg.c di->chg_info.usb_iset = iset; di 596 drivers/power/supply/abx500_chargalg.c di->chg_info.usb_vset = vset; di 598 drivers/power/supply/abx500_chargalg.c return di->usb_chg->ops.enable(di->usb_chg, enable, vset, iset); di 609 drivers/power/supply/abx500_chargalg.c static int abx500_chargalg_update_chg_curr(struct abx500_chargalg *di, di 613 drivers/power/supply/abx500_chargalg.c if (di->ac_chg && di->ac_chg->ops.update_curr && di 614 drivers/power/supply/abx500_chargalg.c di->chg_info.charger_type & AC_CHG) { di 619 drivers/power/supply/abx500_chargalg.c if (di->ac_chg->max_out_curr) di 620 drivers/power/supply/abx500_chargalg.c iset = min(iset, di->ac_chg->max_out_curr); di 622 drivers/power/supply/abx500_chargalg.c di->chg_info.ac_iset = iset; di 624 drivers/power/supply/abx500_chargalg.c return di->ac_chg->ops.update_curr(di->ac_chg, iset); di 625 drivers/power/supply/abx500_chargalg.c } else if (di->usb_chg && di->usb_chg->ops.update_curr && di 626 drivers/power/supply/abx500_chargalg.c di->chg_info.charger_type & USB_CHG) { di 631 drivers/power/supply/abx500_chargalg.c if (di->usb_chg->max_out_curr) di 632 drivers/power/supply/abx500_chargalg.c iset = min(iset, di->usb_chg->max_out_curr); di 634 drivers/power/supply/abx500_chargalg.c di->chg_info.usb_iset = iset; di 636 drivers/power/supply/abx500_chargalg.c return di->usb_chg->ops.update_curr(di->usb_chg, iset); di 650 drivers/power/supply/abx500_chargalg.c static void abx500_chargalg_stop_charging(struct abx500_chargalg *di) di 652 drivers/power/supply/abx500_chargalg.c abx500_chargalg_ac_en(di, false, 0, 0); di 653 drivers/power/supply/abx500_chargalg.c abx500_chargalg_usb_en(di, false, 0, 0); di 654 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_safety_timer(di); di 655 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_maintenance_timer(di); di 656 drivers/power/supply/abx500_chargalg.c di->charge_status = POWER_SUPPLY_STATUS_NOT_CHARGING; di 657 drivers/power/supply/abx500_chargalg.c di->maintenance_chg = false; di 658 drivers/power/supply/abx500_chargalg.c cancel_delayed_work(&di->chargalg_wd_work); di 659 drivers/power/supply/abx500_chargalg.c power_supply_changed(di->chargalg_psy); di 670 drivers/power/supply/abx500_chargalg.c static void abx500_chargalg_hold_charging(struct abx500_chargalg *di) di 672 drivers/power/supply/abx500_chargalg.c abx500_chargalg_ac_en(di, false, 0, 0); di 673 drivers/power/supply/abx500_chargalg.c abx500_chargalg_usb_en(di, false, 0, 0); di 674 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_safety_timer(di); di 675 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_maintenance_timer(di); di 676 drivers/power/supply/abx500_chargalg.c di->charge_status = POWER_SUPPLY_STATUS_CHARGING; di 677 drivers/power/supply/abx500_chargalg.c di->maintenance_chg = false; di 678 drivers/power/supply/abx500_chargalg.c cancel_delayed_work(&di->chargalg_wd_work); di 679 drivers/power/supply/abx500_chargalg.c power_supply_changed(di->chargalg_psy); di 691 drivers/power/supply/abx500_chargalg.c static void abx500_chargalg_start_charging(struct abx500_chargalg *di, di 694 drivers/power/supply/abx500_chargalg.c switch (di->chg_info.charger_type) { di 696 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, di 698 drivers/power/supply/abx500_chargalg.c abx500_chargalg_usb_en(di, false, 0, 0); di 699 drivers/power/supply/abx500_chargalg.c abx500_chargalg_ac_en(di, true, vset, iset); di 703 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, di 705 drivers/power/supply/abx500_chargalg.c abx500_chargalg_ac_en(di, false, 0, 0); di 706 drivers/power/supply/abx500_chargalg.c abx500_chargalg_usb_en(di, true, vset, iset); di 710 drivers/power/supply/abx500_chargalg.c dev_err(di->dev, "Unknown charger to charge from\n"); di 722 drivers/power/supply/abx500_chargalg.c static void abx500_chargalg_check_temp(struct abx500_chargalg *di) di 724 drivers/power/supply/abx500_chargalg.c if (di->batt_data.temp > (di->bm->temp_low + di->t_hyst_norm) && di 725 drivers/power/supply/abx500_chargalg.c di->batt_data.temp < (di->bm->temp_high - di->t_hyst_norm)) { di 727 drivers/power/supply/abx500_chargalg.c di->events.btemp_underover = false; di 728 drivers/power/supply/abx500_chargalg.c di->events.btemp_lowhigh = false; di 729 drivers/power/supply/abx500_chargalg.c di->t_hyst_norm = 0; di 730 drivers/power/supply/abx500_chargalg.c di->t_hyst_lowhigh = 0; di 732 drivers/power/supply/abx500_chargalg.c if (((di->batt_data.temp >= di->bm->temp_high) && di 733 drivers/power/supply/abx500_chargalg.c (di->batt_data.temp < di 734 drivers/power/supply/abx500_chargalg.c (di->bm->temp_over - di->t_hyst_lowhigh))) || di 735 drivers/power/supply/abx500_chargalg.c ((di->batt_data.temp > di 736 drivers/power/supply/abx500_chargalg.c (di->bm->temp_under + di->t_hyst_lowhigh)) && di 737 drivers/power/supply/abx500_chargalg.c (di->batt_data.temp <= di->bm->temp_low))) { di 739 drivers/power/supply/abx500_chargalg.c di->events.btemp_underover = false; di 740 drivers/power/supply/abx500_chargalg.c di->events.btemp_lowhigh = true; di 741 drivers/power/supply/abx500_chargalg.c di->t_hyst_norm = di->bm->temp_hysteresis; di 742 drivers/power/supply/abx500_chargalg.c di->t_hyst_lowhigh = 0; di 743 drivers/power/supply/abx500_chargalg.c } else if (di->batt_data.temp <= di->bm->temp_under || di 744 drivers/power/supply/abx500_chargalg.c di->batt_data.temp >= di->bm->temp_over) { di 746 drivers/power/supply/abx500_chargalg.c di->events.btemp_underover = true; di 747 drivers/power/supply/abx500_chargalg.c di->events.btemp_lowhigh = false; di 748 drivers/power/supply/abx500_chargalg.c di->t_hyst_norm = 0; di 749 drivers/power/supply/abx500_chargalg.c di->t_hyst_lowhigh = di->bm->temp_hysteresis; di 752 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, "Within hysteresis limit temp: %d " di 754 drivers/power/supply/abx500_chargalg.c di->batt_data.temp, di->t_hyst_lowhigh, di 755 drivers/power/supply/abx500_chargalg.c di->t_hyst_norm); di 766 drivers/power/supply/abx500_chargalg.c static void abx500_chargalg_check_charger_voltage(struct abx500_chargalg *di) di 768 drivers/power/supply/abx500_chargalg.c if (di->chg_info.usb_volt > di->bm->chg_params->usb_volt_max) di 769 drivers/power/supply/abx500_chargalg.c di->chg_info.usb_chg_ok = false; di 771 drivers/power/supply/abx500_chargalg.c di->chg_info.usb_chg_ok = true; di 773 drivers/power/supply/abx500_chargalg.c if (di->chg_info.ac_volt > di->bm->chg_params->ac_volt_max) di 774 drivers/power/supply/abx500_chargalg.c di->chg_info.ac_chg_ok = false; di 776 drivers/power/supply/abx500_chargalg.c di->chg_info.ac_chg_ok = true; di 788 drivers/power/supply/abx500_chargalg.c static void abx500_chargalg_end_of_charge(struct abx500_chargalg *di) di 790 drivers/power/supply/abx500_chargalg.c if (di->charge_status == POWER_SUPPLY_STATUS_CHARGING && di 791 drivers/power/supply/abx500_chargalg.c di->charge_state == STATE_NORMAL && di 792 drivers/power/supply/abx500_chargalg.c !di->maintenance_chg && (di->batt_data.volt >= di 793 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[di->bm->batt_id].termination_vol || di 794 drivers/power/supply/abx500_chargalg.c di->events.usb_cv_active || di->events.ac_cv_active) && di 795 drivers/power/supply/abx500_chargalg.c di->batt_data.avg_curr < di 796 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[di->bm->batt_id].termination_curr && di 797 drivers/power/supply/abx500_chargalg.c di->batt_data.avg_curr > 0) { di 798 drivers/power/supply/abx500_chargalg.c if (++di->eoc_cnt >= EOC_COND_CNT) { di 799 drivers/power/supply/abx500_chargalg.c di->eoc_cnt = 0; di 800 drivers/power/supply/abx500_chargalg.c di->charge_status = POWER_SUPPLY_STATUS_FULL; di 801 drivers/power/supply/abx500_chargalg.c di->maintenance_chg = true; di 802 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, "EOC reached!\n"); di 803 drivers/power/supply/abx500_chargalg.c power_supply_changed(di->chargalg_psy); di 805 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, di 808 drivers/power/supply/abx500_chargalg.c di->eoc_cnt, di 812 drivers/power/supply/abx500_chargalg.c di->eoc_cnt = 0; di 816 drivers/power/supply/abx500_chargalg.c static void init_maxim_chg_curr(struct abx500_chargalg *di) di 818 drivers/power/supply/abx500_chargalg.c di->ccm.original_iset = di 819 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[di->bm->batt_id].normal_cur_lvl; di 820 drivers/power/supply/abx500_chargalg.c di->ccm.current_iset = di 821 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[di->bm->batt_id].normal_cur_lvl; di 822 drivers/power/supply/abx500_chargalg.c di->ccm.test_delta_i = di->bm->maxi->charger_curr_step; di 823 drivers/power/supply/abx500_chargalg.c di->ccm.max_current = di->bm->maxi->chg_curr; di 824 drivers/power/supply/abx500_chargalg.c di->ccm.condition_cnt = di->bm->maxi->wait_cycles; di 825 drivers/power/supply/abx500_chargalg.c di->ccm.level = 0; di 837 drivers/power/supply/abx500_chargalg.c static enum maxim_ret abx500_chargalg_chg_curr_maxim(struct abx500_chargalg *di) di 841 drivers/power/supply/abx500_chargalg.c if (!di->bm->maxi->ena_maxi) di 844 drivers/power/supply/abx500_chargalg.c delta_i = di->ccm.original_iset - di->batt_data.inst_curr; di 846 drivers/power/supply/abx500_chargalg.c if (di->events.vbus_collapsed) { di 847 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, "Charger voltage has collapsed %d\n", di 848 drivers/power/supply/abx500_chargalg.c di->ccm.wait_cnt); di 849 drivers/power/supply/abx500_chargalg.c if (di->ccm.wait_cnt == 0) { di 850 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, "lowering current\n"); di 851 drivers/power/supply/abx500_chargalg.c di->ccm.wait_cnt++; di 852 drivers/power/supply/abx500_chargalg.c di->ccm.condition_cnt = di->bm->maxi->wait_cycles; di 853 drivers/power/supply/abx500_chargalg.c di->ccm.max_current = di 854 drivers/power/supply/abx500_chargalg.c di->ccm.current_iset - di->ccm.test_delta_i; di 855 drivers/power/supply/abx500_chargalg.c di->ccm.current_iset = di->ccm.max_current; di 856 drivers/power/supply/abx500_chargalg.c di->ccm.level--; di 859 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, "waiting\n"); di 861 drivers/power/supply/abx500_chargalg.c di->ccm.wait_cnt = (di->ccm.wait_cnt + 1) % 3; di 866 drivers/power/supply/abx500_chargalg.c di->ccm.wait_cnt = 0; di 868 drivers/power/supply/abx500_chargalg.c if ((di->batt_data.inst_curr > di->ccm.original_iset)) { di 869 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, " Maximization Ibat (%dmA) too high" di 871 drivers/power/supply/abx500_chargalg.c di->batt_data.inst_curr, di->ccm.original_iset, di 872 drivers/power/supply/abx500_chargalg.c di->ccm.current_iset); di 874 drivers/power/supply/abx500_chargalg.c if (di->ccm.current_iset == di->ccm.original_iset) di 877 drivers/power/supply/abx500_chargalg.c di->ccm.condition_cnt = di->bm->maxi->wait_cycles; di 878 drivers/power/supply/abx500_chargalg.c di->ccm.current_iset = di->ccm.original_iset; di 879 drivers/power/supply/abx500_chargalg.c di->ccm.level = 0; di 884 drivers/power/supply/abx500_chargalg.c if (delta_i > di->ccm.test_delta_i && di 885 drivers/power/supply/abx500_chargalg.c (di->ccm.current_iset + di->ccm.test_delta_i) < di 886 drivers/power/supply/abx500_chargalg.c di->ccm.max_current) { di 887 drivers/power/supply/abx500_chargalg.c if (di->ccm.condition_cnt-- == 0) { di 889 drivers/power/supply/abx500_chargalg.c di->ccm.condition_cnt = di->bm->maxi->wait_cycles; di 890 drivers/power/supply/abx500_chargalg.c di->ccm.current_iset += di->ccm.test_delta_i; di 891 drivers/power/supply/abx500_chargalg.c di->ccm.level++; di 892 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, " Maximization needed, increase" di 895 drivers/power/supply/abx500_chargalg.c di->ccm.test_delta_i, di 896 drivers/power/supply/abx500_chargalg.c di->ccm.current_iset, di 897 drivers/power/supply/abx500_chargalg.c di->ccm.original_iset, di 898 drivers/power/supply/abx500_chargalg.c di->ccm.level); di 904 drivers/power/supply/abx500_chargalg.c di->ccm.condition_cnt = di->bm->maxi->wait_cycles; di 909 drivers/power/supply/abx500_chargalg.c static void handle_maxim_chg_curr(struct abx500_chargalg *di) di 914 drivers/power/supply/abx500_chargalg.c ret = abx500_chargalg_chg_curr_maxim(di); di 917 drivers/power/supply/abx500_chargalg.c result = abx500_chargalg_update_chg_curr(di, di 918 drivers/power/supply/abx500_chargalg.c di->ccm.current_iset); di 920 drivers/power/supply/abx500_chargalg.c dev_err(di->dev, "failed to set chg curr\n"); di 923 drivers/power/supply/abx500_chargalg.c result = abx500_chargalg_update_chg_curr(di, di 924 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[di->bm->batt_id].normal_cur_lvl); di 926 drivers/power/supply/abx500_chargalg.c dev_err(di->dev, "failed to set chg curr\n"); di 941 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di; di 947 drivers/power/supply/abx500_chargalg.c di = power_supply_get_drvdata(psy); di 959 drivers/power/supply/abx500_chargalg.c di->batt_data.percent = ret.intval; di 971 drivers/power/supply/abx500_chargalg.c if (!di->ac_chg && di 973 drivers/power/supply/abx500_chargalg.c di->ac_chg = psy_to_ux500_charger(ext); di 974 drivers/power/supply/abx500_chargalg.c else if (!di->usb_chg && di 976 drivers/power/supply/abx500_chargalg.c di->usb_chg = psy_to_ux500_charger(ext); di 986 drivers/power/supply/abx500_chargalg.c di->events.batt_rem = false; di 989 drivers/power/supply/abx500_chargalg.c di->events.batt_rem = true; di 994 drivers/power/supply/abx500_chargalg.c (di->chg_info.conn_chg & AC_CHG)) { di 995 drivers/power/supply/abx500_chargalg.c di->chg_info.prev_conn_chg = di 996 drivers/power/supply/abx500_chargalg.c di->chg_info.conn_chg; di 997 drivers/power/supply/abx500_chargalg.c di->chg_info.conn_chg &= ~AC_CHG; di 1001 drivers/power/supply/abx500_chargalg.c !(di->chg_info.conn_chg & AC_CHG)) { di 1002 drivers/power/supply/abx500_chargalg.c di->chg_info.prev_conn_chg = di 1003 drivers/power/supply/abx500_chargalg.c di->chg_info.conn_chg; di 1004 drivers/power/supply/abx500_chargalg.c di->chg_info.conn_chg |= AC_CHG; di 1010 drivers/power/supply/abx500_chargalg.c (di->chg_info.conn_chg & USB_CHG)) { di 1011 drivers/power/supply/abx500_chargalg.c di->chg_info.prev_conn_chg = di 1012 drivers/power/supply/abx500_chargalg.c di->chg_info.conn_chg; di 1013 drivers/power/supply/abx500_chargalg.c di->chg_info.conn_chg &= ~USB_CHG; di 1017 drivers/power/supply/abx500_chargalg.c !(di->chg_info.conn_chg & USB_CHG)) { di 1018 drivers/power/supply/abx500_chargalg.c di->chg_info.prev_conn_chg = di 1019 drivers/power/supply/abx500_chargalg.c di->chg_info.conn_chg; di 1020 drivers/power/supply/abx500_chargalg.c di->chg_info.conn_chg |= USB_CHG; di 1035 drivers/power/supply/abx500_chargalg.c (di->chg_info.online_chg & AC_CHG)) { di 1036 drivers/power/supply/abx500_chargalg.c di->chg_info.prev_online_chg = di 1037 drivers/power/supply/abx500_chargalg.c di->chg_info.online_chg; di 1038 drivers/power/supply/abx500_chargalg.c di->chg_info.online_chg &= ~AC_CHG; di 1042 drivers/power/supply/abx500_chargalg.c !(di->chg_info.online_chg & AC_CHG)) { di 1043 drivers/power/supply/abx500_chargalg.c di->chg_info.prev_online_chg = di 1044 drivers/power/supply/abx500_chargalg.c di->chg_info.online_chg; di 1045 drivers/power/supply/abx500_chargalg.c di->chg_info.online_chg |= AC_CHG; di 1046 drivers/power/supply/abx500_chargalg.c queue_delayed_work(di->chargalg_wq, di 1047 drivers/power/supply/abx500_chargalg.c &di->chargalg_wd_work, 0); di 1053 drivers/power/supply/abx500_chargalg.c (di->chg_info.online_chg & USB_CHG)) { di 1054 drivers/power/supply/abx500_chargalg.c di->chg_info.prev_online_chg = di 1055 drivers/power/supply/abx500_chargalg.c di->chg_info.online_chg; di 1056 drivers/power/supply/abx500_chargalg.c di->chg_info.online_chg &= ~USB_CHG; di 1060 drivers/power/supply/abx500_chargalg.c !(di->chg_info.online_chg & USB_CHG)) { di 1061 drivers/power/supply/abx500_chargalg.c di->chg_info.prev_online_chg = di 1062 drivers/power/supply/abx500_chargalg.c di->chg_info.online_chg; di 1063 drivers/power/supply/abx500_chargalg.c di->chg_info.online_chg |= USB_CHG; di 1064 drivers/power/supply/abx500_chargalg.c queue_delayed_work(di->chargalg_wq, di 1065 drivers/power/supply/abx500_chargalg.c &di->chargalg_wd_work, 0); di 1080 drivers/power/supply/abx500_chargalg.c di->events.mainextchnotok = true; di 1081 drivers/power/supply/abx500_chargalg.c di->events.main_thermal_prot = false; di 1082 drivers/power/supply/abx500_chargalg.c di->events.main_ovv = false; di 1083 drivers/power/supply/abx500_chargalg.c di->events.ac_wd_expired = false; di 1086 drivers/power/supply/abx500_chargalg.c di->events.ac_wd_expired = true; di 1087 drivers/power/supply/abx500_chargalg.c di->events.mainextchnotok = false; di 1088 drivers/power/supply/abx500_chargalg.c di->events.main_ovv = false; di 1089 drivers/power/supply/abx500_chargalg.c di->events.main_thermal_prot = false; di 1093 drivers/power/supply/abx500_chargalg.c di->events.main_thermal_prot = true; di 1094 drivers/power/supply/abx500_chargalg.c di->events.mainextchnotok = false; di 1095 drivers/power/supply/abx500_chargalg.c di->events.main_ovv = false; di 1096 drivers/power/supply/abx500_chargalg.c di->events.ac_wd_expired = false; di 1099 drivers/power/supply/abx500_chargalg.c di->events.main_ovv = true; di 1100 drivers/power/supply/abx500_chargalg.c di->events.mainextchnotok = false; di 1101 drivers/power/supply/abx500_chargalg.c di->events.main_thermal_prot = false; di 1102 drivers/power/supply/abx500_chargalg.c di->events.ac_wd_expired = false; di 1105 drivers/power/supply/abx500_chargalg.c di->events.main_thermal_prot = false; di 1106 drivers/power/supply/abx500_chargalg.c di->events.mainextchnotok = false; di 1107 drivers/power/supply/abx500_chargalg.c di->events.main_ovv = false; di 1108 drivers/power/supply/abx500_chargalg.c di->events.ac_wd_expired = false; di 1118 drivers/power/supply/abx500_chargalg.c di->events.usbchargernotok = true; di 1119 drivers/power/supply/abx500_chargalg.c di->events.usb_thermal_prot = false; di 1120 drivers/power/supply/abx500_chargalg.c di->events.vbus_ovv = false; di 1121 drivers/power/supply/abx500_chargalg.c di->events.usb_wd_expired = false; di 1124 drivers/power/supply/abx500_chargalg.c di->events.usb_wd_expired = true; di 1125 drivers/power/supply/abx500_chargalg.c di->events.usbchargernotok = false; di 1126 drivers/power/supply/abx500_chargalg.c di->events.usb_thermal_prot = false; di 1127 drivers/power/supply/abx500_chargalg.c di->events.vbus_ovv = false; di 1131 drivers/power/supply/abx500_chargalg.c di->events.usb_thermal_prot = true; di 1132 drivers/power/supply/abx500_chargalg.c di->events.usbchargernotok = false; di 1133 drivers/power/supply/abx500_chargalg.c di->events.vbus_ovv = false; di 1134 drivers/power/supply/abx500_chargalg.c di->events.usb_wd_expired = false; di 1137 drivers/power/supply/abx500_chargalg.c di->events.vbus_ovv = true; di 1138 drivers/power/supply/abx500_chargalg.c di->events.usbchargernotok = false; di 1139 drivers/power/supply/abx500_chargalg.c di->events.usb_thermal_prot = false; di 1140 drivers/power/supply/abx500_chargalg.c di->events.usb_wd_expired = false; di 1143 drivers/power/supply/abx500_chargalg.c di->events.usbchargernotok = false; di 1144 drivers/power/supply/abx500_chargalg.c di->events.usb_thermal_prot = false; di 1145 drivers/power/supply/abx500_chargalg.c di->events.vbus_ovv = false; di 1146 drivers/power/supply/abx500_chargalg.c di->events.usb_wd_expired = false; di 1159 drivers/power/supply/abx500_chargalg.c di->batt_data.volt = ret.intval / 1000; di 1162 drivers/power/supply/abx500_chargalg.c di->chg_info.ac_volt = ret.intval / 1000; di 1165 drivers/power/supply/abx500_chargalg.c di->chg_info.usb_volt = ret.intval / 1000; di 1178 drivers/power/supply/abx500_chargalg.c di->events.ac_cv_active = true; di 1180 drivers/power/supply/abx500_chargalg.c di->events.ac_cv_active = false; di 1187 drivers/power/supply/abx500_chargalg.c di->events.usb_cv_active = true; di 1189 drivers/power/supply/abx500_chargalg.c di->events.usb_cv_active = false; di 1201 drivers/power/supply/abx500_chargalg.c di->events.batt_unknown = false; di 1203 drivers/power/supply/abx500_chargalg.c di->events.batt_unknown = true; di 1212 drivers/power/supply/abx500_chargalg.c di->batt_data.temp = ret.intval / 10; di 1218 drivers/power/supply/abx500_chargalg.c di->chg_info.ac_curr = di 1222 drivers/power/supply/abx500_chargalg.c di->chg_info.usb_curr = di 1226 drivers/power/supply/abx500_chargalg.c di->batt_data.inst_curr = ret.intval / 1000; di 1236 drivers/power/supply/abx500_chargalg.c di->batt_data.avg_curr = ret.intval / 1000; di 1240 drivers/power/supply/abx500_chargalg.c di->events.vbus_collapsed = true; di 1242 drivers/power/supply/abx500_chargalg.c di->events.vbus_collapsed = false; di 1250 drivers/power/supply/abx500_chargalg.c di->batt_data.percent = ret.intval; di 1270 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di = power_supply_get_drvdata(psy); di 1276 drivers/power/supply/abx500_chargalg.c queue_work(di->chargalg_wq, &di->chargalg_work); di 1287 drivers/power/supply/abx500_chargalg.c static void abx500_chargalg_algorithm(struct abx500_chargalg *di) di 1295 drivers/power/supply/abx500_chargalg.c di->chargalg_psy, abx500_chargalg_get_ext_psy_data); di 1297 drivers/power/supply/abx500_chargalg.c abx500_chargalg_end_of_charge(di); di 1298 drivers/power/supply/abx500_chargalg.c abx500_chargalg_check_temp(di); di 1299 drivers/power/supply/abx500_chargalg.c abx500_chargalg_check_charger_voltage(di); di 1301 drivers/power/supply/abx500_chargalg.c charger_status = abx500_chargalg_check_charger_connection(di); di 1302 drivers/power/supply/abx500_chargalg.c abx500_chargalg_check_current_step_status(di); di 1304 drivers/power/supply/abx500_chargalg.c if (is_ab8500(di->parent)) { di 1305 drivers/power/supply/abx500_chargalg.c ret = abx500_chargalg_check_charger_enable(di); di 1307 drivers/power/supply/abx500_chargalg.c dev_err(di->dev, "Checking charger is enabled error" di 1317 drivers/power/supply/abx500_chargalg.c (di->events.batt_unknown && !di->bm->chg_unknown_bat)) { di 1318 drivers/power/supply/abx500_chargalg.c if (di->charge_state != STATE_HANDHELD) { di 1319 drivers/power/supply/abx500_chargalg.c di->events.safety_timer_expired = false; di 1320 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_HANDHELD_INIT); di 1325 drivers/power/supply/abx500_chargalg.c else if (di->charge_state == STATE_SUSPENDED_INIT || di 1326 drivers/power/supply/abx500_chargalg.c di->charge_state == STATE_SUSPENDED) { di 1331 drivers/power/supply/abx500_chargalg.c else if (di->events.safety_timer_expired) { di 1332 drivers/power/supply/abx500_chargalg.c if (di->charge_state != STATE_SAFETY_TIMER_EXPIRED) di 1333 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, di 1342 drivers/power/supply/abx500_chargalg.c else if (di->events.batt_rem) { di 1343 drivers/power/supply/abx500_chargalg.c if (di->charge_state != STATE_BATT_REMOVED) di 1344 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_BATT_REMOVED_INIT); di 1347 drivers/power/supply/abx500_chargalg.c else if (di->events.mainextchnotok || di->events.usbchargernotok) { di 1352 drivers/power/supply/abx500_chargalg.c if (di->charge_state != STATE_CHG_NOT_OK && di 1353 drivers/power/supply/abx500_chargalg.c !di->events.vbus_collapsed) di 1354 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_CHG_NOT_OK_INIT); di 1357 drivers/power/supply/abx500_chargalg.c else if (di->events.vbus_ovv || di 1358 drivers/power/supply/abx500_chargalg.c di->events.main_ovv || di 1359 drivers/power/supply/abx500_chargalg.c di->events.batt_ovv || di 1360 drivers/power/supply/abx500_chargalg.c !di->chg_info.usb_chg_ok || di 1361 drivers/power/supply/abx500_chargalg.c !di->chg_info.ac_chg_ok) { di 1362 drivers/power/supply/abx500_chargalg.c if (di->charge_state != STATE_OVV_PROTECT) di 1363 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_OVV_PROTECT_INIT); di 1366 drivers/power/supply/abx500_chargalg.c else if (di->events.main_thermal_prot || di 1367 drivers/power/supply/abx500_chargalg.c di->events.usb_thermal_prot) { di 1368 drivers/power/supply/abx500_chargalg.c if (di->charge_state != STATE_HW_TEMP_PROTECT) di 1369 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, di 1373 drivers/power/supply/abx500_chargalg.c else if (di->events.btemp_underover) { di 1374 drivers/power/supply/abx500_chargalg.c if (di->charge_state != STATE_TEMP_UNDEROVER) di 1375 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, di 1379 drivers/power/supply/abx500_chargalg.c else if (di->events.ac_wd_expired || di 1380 drivers/power/supply/abx500_chargalg.c di->events.usb_wd_expired) { di 1381 drivers/power/supply/abx500_chargalg.c if (di->charge_state != STATE_WD_EXPIRED) di 1382 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_WD_EXPIRED_INIT); di 1385 drivers/power/supply/abx500_chargalg.c else if (di->events.btemp_lowhigh) { di 1386 drivers/power/supply/abx500_chargalg.c if (di->charge_state != STATE_TEMP_LOWHIGH) di 1387 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_TEMP_LOWHIGH_INIT); di 1390 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, di 1395 drivers/power/supply/abx500_chargalg.c di->batt_data.volt, di 1396 drivers/power/supply/abx500_chargalg.c di->batt_data.avg_curr, di 1397 drivers/power/supply/abx500_chargalg.c di->batt_data.inst_curr, di 1398 drivers/power/supply/abx500_chargalg.c di->batt_data.temp, di 1399 drivers/power/supply/abx500_chargalg.c di->batt_data.percent, di 1400 drivers/power/supply/abx500_chargalg.c di->maintenance_chg, di 1401 drivers/power/supply/abx500_chargalg.c states[di->charge_state], di 1402 drivers/power/supply/abx500_chargalg.c di->chg_info.charger_type, di 1403 drivers/power/supply/abx500_chargalg.c di->charge_status, di 1404 drivers/power/supply/abx500_chargalg.c di->chg_info.conn_chg & AC_CHG, di 1405 drivers/power/supply/abx500_chargalg.c di->chg_info.conn_chg & USB_CHG, di 1406 drivers/power/supply/abx500_chargalg.c di->chg_info.online_chg & AC_CHG, di 1407 drivers/power/supply/abx500_chargalg.c di->chg_info.online_chg & USB_CHG, di 1408 drivers/power/supply/abx500_chargalg.c di->events.ac_cv_active, di 1409 drivers/power/supply/abx500_chargalg.c di->events.usb_cv_active, di 1410 drivers/power/supply/abx500_chargalg.c di->chg_info.ac_curr, di 1411 drivers/power/supply/abx500_chargalg.c di->chg_info.usb_curr, di 1412 drivers/power/supply/abx500_chargalg.c di->chg_info.ac_vset, di 1413 drivers/power/supply/abx500_chargalg.c di->chg_info.ac_iset, di 1414 drivers/power/supply/abx500_chargalg.c di->chg_info.usb_vset, di 1415 drivers/power/supply/abx500_chargalg.c di->chg_info.usb_iset); di 1417 drivers/power/supply/abx500_chargalg.c switch (di->charge_state) { di 1419 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_charging(di); di 1420 drivers/power/supply/abx500_chargalg.c di->charge_status = POWER_SUPPLY_STATUS_DISCHARGING; di 1421 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_HANDHELD); di 1428 drivers/power/supply/abx500_chargalg.c if (di->susp_status.ac_suspended) di 1429 drivers/power/supply/abx500_chargalg.c abx500_chargalg_ac_en(di, false, 0, 0); di 1430 drivers/power/supply/abx500_chargalg.c if (di->susp_status.usb_suspended) di 1431 drivers/power/supply/abx500_chargalg.c abx500_chargalg_usb_en(di, false, 0, 0); di 1432 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_safety_timer(di); di 1433 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_maintenance_timer(di); di 1434 drivers/power/supply/abx500_chargalg.c di->charge_status = POWER_SUPPLY_STATUS_NOT_CHARGING; di 1435 drivers/power/supply/abx500_chargalg.c di->maintenance_chg = false; di 1436 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_SUSPENDED); di 1437 drivers/power/supply/abx500_chargalg.c power_supply_changed(di->chargalg_psy); di 1445 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_charging(di); di 1446 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_BATT_REMOVED); di 1450 drivers/power/supply/abx500_chargalg.c if (!di->events.batt_rem) di 1451 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_NORMAL_INIT); di 1455 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_charging(di); di 1456 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_HW_TEMP_PROTECT); di 1460 drivers/power/supply/abx500_chargalg.c if (!di->events.main_thermal_prot && di 1461 drivers/power/supply/abx500_chargalg.c !di->events.usb_thermal_prot) di 1462 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_NORMAL_INIT); di 1466 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_charging(di); di 1467 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_OVV_PROTECT); di 1471 drivers/power/supply/abx500_chargalg.c if (!di->events.vbus_ovv && di 1472 drivers/power/supply/abx500_chargalg.c !di->events.main_ovv && di 1473 drivers/power/supply/abx500_chargalg.c !di->events.batt_ovv && di 1474 drivers/power/supply/abx500_chargalg.c di->chg_info.usb_chg_ok && di 1475 drivers/power/supply/abx500_chargalg.c di->chg_info.ac_chg_ok) di 1476 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_NORMAL_INIT); di 1480 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_charging(di); di 1481 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_CHG_NOT_OK); di 1485 drivers/power/supply/abx500_chargalg.c if (!di->events.mainextchnotok && di 1486 drivers/power/supply/abx500_chargalg.c !di->events.usbchargernotok) di 1487 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_NORMAL_INIT); di 1491 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_charging(di); di 1492 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_SAFETY_TIMER_EXPIRED); di 1500 drivers/power/supply/abx500_chargalg.c if (di->curr_status.curr_step == CHARGALG_CURR_STEP_LOW) di 1501 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_charging(di); di 1503 drivers/power/supply/abx500_chargalg.c curr_step_lvl = di->bm->bat_type[ di 1504 drivers/power/supply/abx500_chargalg.c di->bm->batt_id].normal_cur_lvl di 1505 drivers/power/supply/abx500_chargalg.c * di->curr_status.curr_step di 1507 drivers/power/supply/abx500_chargalg.c abx500_chargalg_start_charging(di, di 1508 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[di->bm->batt_id] di 1512 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_NORMAL); di 1513 drivers/power/supply/abx500_chargalg.c abx500_chargalg_start_safety_timer(di); di 1514 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_maintenance_timer(di); di 1515 drivers/power/supply/abx500_chargalg.c init_maxim_chg_curr(di); di 1516 drivers/power/supply/abx500_chargalg.c di->charge_status = POWER_SUPPLY_STATUS_CHARGING; di 1517 drivers/power/supply/abx500_chargalg.c di->eoc_cnt = 0; di 1518 drivers/power/supply/abx500_chargalg.c di->maintenance_chg = false; di 1519 drivers/power/supply/abx500_chargalg.c power_supply_changed(di->chargalg_psy); di 1524 drivers/power/supply/abx500_chargalg.c handle_maxim_chg_curr(di); di 1525 drivers/power/supply/abx500_chargalg.c if (di->charge_status == POWER_SUPPLY_STATUS_FULL && di 1526 drivers/power/supply/abx500_chargalg.c di->maintenance_chg) { di 1527 drivers/power/supply/abx500_chargalg.c if (di->bm->no_maintenance) di 1528 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, di 1531 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, di 1538 drivers/power/supply/abx500_chargalg.c abx500_chargalg_hold_charging(di); di 1539 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_WAIT_FOR_RECHARGE); di 1543 drivers/power/supply/abx500_chargalg.c if (di->batt_data.percent <= di 1544 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[di->bm->batt_id]. di 1546 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_NORMAL_INIT); di 1550 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_safety_timer(di); di 1551 drivers/power/supply/abx500_chargalg.c abx500_chargalg_start_maintenance_timer(di, di 1552 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[ di 1553 drivers/power/supply/abx500_chargalg.c di->bm->batt_id].maint_a_chg_timer_h); di 1554 drivers/power/supply/abx500_chargalg.c abx500_chargalg_start_charging(di, di 1555 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[ di 1556 drivers/power/supply/abx500_chargalg.c di->bm->batt_id].maint_a_vol_lvl, di 1557 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[ di 1558 drivers/power/supply/abx500_chargalg.c di->bm->batt_id].maint_a_cur_lvl); di 1559 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_MAINTENANCE_A); di 1560 drivers/power/supply/abx500_chargalg.c power_supply_changed(di->chargalg_psy); di 1564 drivers/power/supply/abx500_chargalg.c if (di->events.maintenance_timer_expired) { di 1565 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_maintenance_timer(di); di 1566 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_MAINTENANCE_B_INIT); di 1571 drivers/power/supply/abx500_chargalg.c abx500_chargalg_start_maintenance_timer(di, di 1572 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[ di 1573 drivers/power/supply/abx500_chargalg.c di->bm->batt_id].maint_b_chg_timer_h); di 1574 drivers/power/supply/abx500_chargalg.c abx500_chargalg_start_charging(di, di 1575 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[ di 1576 drivers/power/supply/abx500_chargalg.c di->bm->batt_id].maint_b_vol_lvl, di 1577 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[ di 1578 drivers/power/supply/abx500_chargalg.c di->bm->batt_id].maint_b_cur_lvl); di 1579 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_MAINTENANCE_B); di 1580 drivers/power/supply/abx500_chargalg.c power_supply_changed(di->chargalg_psy); di 1584 drivers/power/supply/abx500_chargalg.c if (di->events.maintenance_timer_expired) { di 1585 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_maintenance_timer(di); di 1586 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_NORMAL_INIT); di 1591 drivers/power/supply/abx500_chargalg.c abx500_chargalg_start_charging(di, di 1592 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[ di 1593 drivers/power/supply/abx500_chargalg.c di->bm->batt_id].low_high_vol_lvl, di 1594 drivers/power/supply/abx500_chargalg.c di->bm->bat_type[ di 1595 drivers/power/supply/abx500_chargalg.c di->bm->batt_id].low_high_cur_lvl); di 1596 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_maintenance_timer(di); di 1597 drivers/power/supply/abx500_chargalg.c di->charge_status = POWER_SUPPLY_STATUS_CHARGING; di 1598 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_TEMP_LOWHIGH); di 1599 drivers/power/supply/abx500_chargalg.c power_supply_changed(di->chargalg_psy); di 1603 drivers/power/supply/abx500_chargalg.c if (!di->events.btemp_lowhigh) di 1604 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_NORMAL_INIT); di 1608 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_charging(di); di 1609 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_WD_EXPIRED); di 1613 drivers/power/supply/abx500_chargalg.c if (!di->events.ac_wd_expired && di 1614 drivers/power/supply/abx500_chargalg.c !di->events.usb_wd_expired) di 1615 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_NORMAL_INIT); di 1619 drivers/power/supply/abx500_chargalg.c abx500_chargalg_stop_charging(di); di 1620 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_TEMP_UNDEROVER); di 1624 drivers/power/supply/abx500_chargalg.c if (!di->events.btemp_underover) di 1625 drivers/power/supply/abx500_chargalg.c abx500_chargalg_state_to(di, STATE_NORMAL_INIT); di 1630 drivers/power/supply/abx500_chargalg.c if (di->charge_state == STATE_NORMAL_INIT || di 1631 drivers/power/supply/abx500_chargalg.c di->charge_state == STATE_MAINTENANCE_A_INIT || di 1632 drivers/power/supply/abx500_chargalg.c di->charge_state == STATE_MAINTENANCE_B_INIT) di 1633 drivers/power/supply/abx500_chargalg.c queue_work(di->chargalg_wq, &di->chargalg_work); di 1644 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di = container_of(work, di 1647 drivers/power/supply/abx500_chargalg.c abx500_chargalg_algorithm(di); di 1653 drivers/power/supply/abx500_chargalg.c if (di->chg_info.conn_chg) di 1654 drivers/power/supply/abx500_chargalg.c queue_delayed_work(di->chargalg_wq, di 1655 drivers/power/supply/abx500_chargalg.c &di->chargalg_periodic_work, di 1656 drivers/power/supply/abx500_chargalg.c di->bm->interval_charging * HZ); di 1658 drivers/power/supply/abx500_chargalg.c queue_delayed_work(di->chargalg_wq, di 1659 drivers/power/supply/abx500_chargalg.c &di->chargalg_periodic_work, di 1660 drivers/power/supply/abx500_chargalg.c di->bm->interval_not_charging * HZ); di 1672 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di = container_of(work, di 1675 drivers/power/supply/abx500_chargalg.c dev_dbg(di->dev, "abx500_chargalg_wd_work\n"); di 1677 drivers/power/supply/abx500_chargalg.c ret = abx500_chargalg_kick_watchdog(di); di 1679 drivers/power/supply/abx500_chargalg.c dev_err(di->dev, "failed to kick watchdog\n"); di 1681 drivers/power/supply/abx500_chargalg.c queue_delayed_work(di->chargalg_wq, di 1682 drivers/power/supply/abx500_chargalg.c &di->chargalg_wd_work, CHG_WD_INTERVAL); di 1693 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di = container_of(work, di 1696 drivers/power/supply/abx500_chargalg.c abx500_chargalg_algorithm(di); di 1715 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di = power_supply_get_drvdata(psy); di 1719 drivers/power/supply/abx500_chargalg.c val->intval = di->charge_status; di 1722 drivers/power/supply/abx500_chargalg.c if (di->events.batt_ovv) { di 1724 drivers/power/supply/abx500_chargalg.c } else if (di->events.btemp_underover) { di 1725 drivers/power/supply/abx500_chargalg.c if (di->batt_data.temp <= di->bm->temp_under) di 1729 drivers/power/supply/abx500_chargalg.c } else if (di->charge_state == STATE_SAFETY_TIMER_EXPIRED || di 1730 drivers/power/supply/abx500_chargalg.c di->charge_state == STATE_SAFETY_TIMER_EXPIRED_INIT) { di 1744 drivers/power/supply/abx500_chargalg.c static ssize_t abx500_chargalg_curr_step_show(struct abx500_chargalg *di, di 1747 drivers/power/supply/abx500_chargalg.c return sprintf(buf, "%d\n", di->curr_status.curr_step); di 1750 drivers/power/supply/abx500_chargalg.c static ssize_t abx500_chargalg_curr_step_store(struct abx500_chargalg *di, di 1760 drivers/power/supply/abx500_chargalg.c di->curr_status.curr_step = param; di 1761 drivers/power/supply/abx500_chargalg.c if (di->curr_status.curr_step >= CHARGALG_CURR_STEP_LOW && di 1762 drivers/power/supply/abx500_chargalg.c di->curr_status.curr_step <= CHARGALG_CURR_STEP_HIGH) { di 1763 drivers/power/supply/abx500_chargalg.c di->curr_status.curr_step_change = true; di 1764 drivers/power/supply/abx500_chargalg.c queue_work(di->chargalg_wq, &di->chargalg_work); di 1766 drivers/power/supply/abx500_chargalg.c dev_info(di->dev, "Wrong current step\n" di 1775 drivers/power/supply/abx500_chargalg.c static ssize_t abx500_chargalg_en_show(struct abx500_chargalg *di, di 1779 drivers/power/supply/abx500_chargalg.c di->susp_status.ac_suspended && di 1780 drivers/power/supply/abx500_chargalg.c di->susp_status.usb_suspended); di 1783 drivers/power/supply/abx500_chargalg.c static ssize_t abx500_chargalg_en_store(struct abx500_chargalg *di, di 1798 drivers/power/supply/abx500_chargalg.c di->susp_status.ac_suspended = true; di 1799 drivers/power/supply/abx500_chargalg.c di->susp_status.usb_suspended = true; di 1800 drivers/power/supply/abx500_chargalg.c di->susp_status.suspended_change = true; di 1802 drivers/power/supply/abx500_chargalg.c queue_work(di->chargalg_wq, di 1803 drivers/power/supply/abx500_chargalg.c &di->chargalg_work); di 1807 drivers/power/supply/abx500_chargalg.c di->susp_status.ac_suspended = false; di 1808 drivers/power/supply/abx500_chargalg.c di->susp_status.suspended_change = true; di 1810 drivers/power/supply/abx500_chargalg.c queue_work(di->chargalg_wq, di 1811 drivers/power/supply/abx500_chargalg.c &di->chargalg_work); di 1815 drivers/power/supply/abx500_chargalg.c di->susp_status.usb_suspended = false; di 1816 drivers/power/supply/abx500_chargalg.c di->susp_status.suspended_change = true; di 1818 drivers/power/supply/abx500_chargalg.c queue_work(di->chargalg_wq, di 1819 drivers/power/supply/abx500_chargalg.c &di->chargalg_work); di 1822 drivers/power/supply/abx500_chargalg.c dev_info(di->dev, "Wrong input\n" di 1844 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di = container_of(kobj, di 1850 drivers/power/supply/abx500_chargalg.c return entry->show(di, buf); di 1859 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di = container_of(kobj, di 1865 drivers/power/supply/abx500_chargalg.c return entry->store(di, buf, length); di 1890 drivers/power/supply/abx500_chargalg.c static void abx500_chargalg_sysfs_exit(struct abx500_chargalg *di) di 1892 drivers/power/supply/abx500_chargalg.c kobject_del(&di->chargalg_kobject); di 1902 drivers/power/supply/abx500_chargalg.c static int abx500_chargalg_sysfs_init(struct abx500_chargalg *di) di 1906 drivers/power/supply/abx500_chargalg.c ret = kobject_init_and_add(&di->chargalg_kobject, di 1910 drivers/power/supply/abx500_chargalg.c dev_err(di->dev, "failed to create sysfs entry\n"); di 1919 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di = platform_get_drvdata(pdev); di 1922 drivers/power/supply/abx500_chargalg.c if (di->chg_info.online_chg) di 1923 drivers/power/supply/abx500_chargalg.c queue_delayed_work(di->chargalg_wq, &di->chargalg_wd_work, 0); di 1929 drivers/power/supply/abx500_chargalg.c queue_delayed_work(di->chargalg_wq, &di->chargalg_periodic_work, 0); di 1937 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di = platform_get_drvdata(pdev); di 1939 drivers/power/supply/abx500_chargalg.c if (di->chg_info.online_chg) di 1940 drivers/power/supply/abx500_chargalg.c cancel_delayed_work_sync(&di->chargalg_wd_work); di 1942 drivers/power/supply/abx500_chargalg.c cancel_delayed_work_sync(&di->chargalg_periodic_work); di 1953 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di = platform_get_drvdata(pdev); di 1956 drivers/power/supply/abx500_chargalg.c abx500_chargalg_sysfs_exit(di); di 1958 drivers/power/supply/abx500_chargalg.c hrtimer_cancel(&di->safety_timer); di 1959 drivers/power/supply/abx500_chargalg.c hrtimer_cancel(&di->maintenance_timer); di 1961 drivers/power/supply/abx500_chargalg.c cancel_delayed_work_sync(&di->chargalg_periodic_work); di 1962 drivers/power/supply/abx500_chargalg.c cancel_delayed_work_sync(&di->chargalg_wd_work); di 1963 drivers/power/supply/abx500_chargalg.c cancel_work_sync(&di->chargalg_work); di 1966 drivers/power/supply/abx500_chargalg.c destroy_workqueue(di->chargalg_wq); di 1968 drivers/power/supply/abx500_chargalg.c power_supply_unregister(di->chargalg_psy); di 1991 drivers/power/supply/abx500_chargalg.c struct abx500_chargalg *di; di 1994 drivers/power/supply/abx500_chargalg.c di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); di 1995 drivers/power/supply/abx500_chargalg.c if (!di) { di 2004 drivers/power/supply/abx500_chargalg.c di->bm = plat; di 2007 drivers/power/supply/abx500_chargalg.c ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm); di 2015 drivers/power/supply/abx500_chargalg.c di->dev = &pdev->dev; di 2016 drivers/power/supply/abx500_chargalg.c di->parent = dev_get_drvdata(pdev->dev.parent); di 2020 drivers/power/supply/abx500_chargalg.c psy_cfg.drv_data = di; di 2023 drivers/power/supply/abx500_chargalg.c hrtimer_init(&di->safety_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); di 2024 drivers/power/supply/abx500_chargalg.c di->safety_timer.function = abx500_chargalg_safety_timer_expired; di 2027 drivers/power/supply/abx500_chargalg.c hrtimer_init(&di->maintenance_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); di 2028 drivers/power/supply/abx500_chargalg.c di->maintenance_timer.function = di 2032 drivers/power/supply/abx500_chargalg.c di->chargalg_wq = alloc_ordered_workqueue("abx500_chargalg_wq", di 2034 drivers/power/supply/abx500_chargalg.c if (di->chargalg_wq == NULL) { di 2035 drivers/power/supply/abx500_chargalg.c dev_err(di->dev, "failed to create work queue\n"); di 2040 drivers/power/supply/abx500_chargalg.c INIT_DEFERRABLE_WORK(&di->chargalg_periodic_work, di 2042 drivers/power/supply/abx500_chargalg.c INIT_DEFERRABLE_WORK(&di->chargalg_wd_work, di 2046 drivers/power/supply/abx500_chargalg.c INIT_WORK(&di->chargalg_work, abx500_chargalg_work); di 2049 drivers/power/supply/abx500_chargalg.c di->chg_info.prev_conn_chg = -1; di 2052 drivers/power/supply/abx500_chargalg.c di->chargalg_psy = power_supply_register(di->dev, &abx500_chargalg_desc, di 2054 drivers/power/supply/abx500_chargalg.c if (IS_ERR(di->chargalg_psy)) { di 2055 drivers/power/supply/abx500_chargalg.c dev_err(di->dev, "failed to register chargalg psy\n"); di 2056 drivers/power/supply/abx500_chargalg.c ret = PTR_ERR(di->chargalg_psy); di 2060 drivers/power/supply/abx500_chargalg.c platform_set_drvdata(pdev, di); di 2063 drivers/power/supply/abx500_chargalg.c ret = abx500_chargalg_sysfs_init(di); di 2065 drivers/power/supply/abx500_chargalg.c dev_err(di->dev, "failed to create sysfs entry\n"); di 2068 drivers/power/supply/abx500_chargalg.c di->curr_status.curr_step = CHARGALG_CURR_STEP_HIGH; di 2071 drivers/power/supply/abx500_chargalg.c queue_delayed_work(di->chargalg_wq, &di->chargalg_periodic_work, 0); di 2073 drivers/power/supply/abx500_chargalg.c dev_info(di->dev, "probe success\n"); di 2077 drivers/power/supply/abx500_chargalg.c power_supply_unregister(di->chargalg_psy); di 2079 drivers/power/supply/abx500_chargalg.c destroy_workqueue(di->chargalg_wq); di 845 drivers/power/supply/bq27xxx_battery.c #define BQ27XXX_DM_BUF(di, i) { \ di 846 drivers/power/supply/bq27xxx_battery.c .class = (di)->dm_regs[i].subclass_id, \ di 847 drivers/power/supply/bq27xxx_battery.c .block = (di)->dm_regs[i].offset / BQ27XXX_DM_SZ, \ di 880 drivers/power/supply/bq27xxx_battery.c struct bq27xxx_device_info *di; di 889 drivers/power/supply/bq27xxx_battery.c list_for_each_entry(di, &bq27xxx_battery_devices, list) { di 890 drivers/power/supply/bq27xxx_battery.c cancel_delayed_work_sync(&di->work); di 891 drivers/power/supply/bq27xxx_battery.c schedule_delayed_work(&di->work, 0); di 912 drivers/power/supply/bq27xxx_battery.c static inline int bq27xxx_read(struct bq27xxx_device_info *di, int reg_index, di 917 drivers/power/supply/bq27xxx_battery.c if (!di || di->regs[reg_index] == INVALID_REG_ADDR) di 920 drivers/power/supply/bq27xxx_battery.c ret = di->bus.read(di, di->regs[reg_index], single); di 922 drivers/power/supply/bq27xxx_battery.c dev_dbg(di->dev, "failed to read register 0x%02x (index %d)\n", di 923 drivers/power/supply/bq27xxx_battery.c di->regs[reg_index], reg_index); di 928 drivers/power/supply/bq27xxx_battery.c static inline int bq27xxx_write(struct bq27xxx_device_info *di, int reg_index, di 933 drivers/power/supply/bq27xxx_battery.c if (!di || di->regs[reg_index] == INVALID_REG_ADDR) di 936 drivers/power/supply/bq27xxx_battery.c if (!di->bus.write) di 939 drivers/power/supply/bq27xxx_battery.c ret = di->bus.write(di, di->regs[reg_index], value, single); di 941 drivers/power/supply/bq27xxx_battery.c dev_dbg(di->dev, "failed to write register 0x%02x (index %d)\n", di 942 drivers/power/supply/bq27xxx_battery.c di->regs[reg_index], reg_index); di 947 drivers/power/supply/bq27xxx_battery.c static inline int bq27xxx_read_block(struct bq27xxx_device_info *di, int reg_index, di 952 drivers/power/supply/bq27xxx_battery.c if (!di || di->regs[reg_index] == INVALID_REG_ADDR) di 955 drivers/power/supply/bq27xxx_battery.c if (!di->bus.read_bulk) di 958 drivers/power/supply/bq27xxx_battery.c ret = di->bus.read_bulk(di, di->regs[reg_index], data, len); di 960 drivers/power/supply/bq27xxx_battery.c dev_dbg(di->dev, "failed to read_bulk register 0x%02x (index %d)\n", di 961 drivers/power/supply/bq27xxx_battery.c di->regs[reg_index], reg_index); di 966 drivers/power/supply/bq27xxx_battery.c static inline int bq27xxx_write_block(struct bq27xxx_device_info *di, int reg_index, di 971 drivers/power/supply/bq27xxx_battery.c if (!di || di->regs[reg_index] == INVALID_REG_ADDR) di 974 drivers/power/supply/bq27xxx_battery.c if (!di->bus.write_bulk) di 977 drivers/power/supply/bq27xxx_battery.c ret = di->bus.write_bulk(di, di->regs[reg_index], data, len); di 979 drivers/power/supply/bq27xxx_battery.c dev_dbg(di->dev, "failed to write_bulk register 0x%02x (index %d)\n", di 980 drivers/power/supply/bq27xxx_battery.c di->regs[reg_index], reg_index); di 985 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_seal(struct bq27xxx_device_info *di) di 989 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_write(di, BQ27XXX_REG_CTRL, BQ27XXX_SEALED, false); di 991 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "bus error on seal: %d\n", ret); di 998 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_unseal(struct bq27xxx_device_info *di) di 1002 drivers/power/supply/bq27xxx_battery.c if (di->unseal_key == 0) { di 1003 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "unseal failed due to missing key\n"); di 1007 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_write(di, BQ27XXX_REG_CTRL, (u16)(di->unseal_key >> 16), false); di 1011 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_write(di, BQ27XXX_REG_CTRL, (u16)di->unseal_key, false); di 1018 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "bus error on unseal: %d\n", ret); di 1034 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_read_dm_block(struct bq27xxx_device_info *di, di 1041 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_write(di, BQ27XXX_DM_CLASS, buf->class, true); di 1045 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_write(di, BQ27XXX_DM_BLOCK, buf->block, true); di 1051 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_read_block(di, BQ27XXX_DM_DATA, buf->data, BQ27XXX_DM_SZ); di 1055 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_read(di, BQ27XXX_DM_CKSUM, true); di 1070 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "bus error reading chip memory: %d\n", ret); di 1074 drivers/power/supply/bq27xxx_battery.c static void bq27xxx_battery_update_dm_block(struct bq27xxx_device_info *di, di 1079 drivers/power/supply/bq27xxx_battery.c struct bq27xxx_dm_reg *reg = &di->dm_regs[reg_id]; di 1084 drivers/power/supply/bq27xxx_battery.c dev_warn(di->dev, "buffer does not match %s dm spec\n", str); di 1089 drivers/power/supply/bq27xxx_battery.c dev_warn(di->dev, "%s dm spec has unsupported byte size\n", str); di 1097 drivers/power/supply/bq27xxx_battery.c dev_info(di->dev, "%s has %u\n", str, val); di 1102 drivers/power/supply/bq27xxx_battery.c if (!(di->opts & BQ27XXX_O_RAM) && !bq27xxx_dt_to_nvm) { di 1104 drivers/power/supply/bq27xxx_battery.c if (!(di->opts & BQ27XXX_O_RAM)) { di 1107 drivers/power/supply/bq27xxx_battery.c dev_warn(di->dev, "%s has %u; update to %u disallowed " di 1117 drivers/power/supply/bq27xxx_battery.c dev_info(di->dev, "update %s to %u\n", str, val); di 1123 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_cfgupdate_priv(struct bq27xxx_device_info *di, bool active) di 1129 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_write(di, BQ27XXX_REG_CTRL, cmd, false); di 1135 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_read(di, BQ27XXX_REG_FLAGS, false); di 1140 drivers/power/supply/bq27xxx_battery.c if (!try && di->chip != BQ27425) { // 425 has a bug di 1141 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "timed out waiting for cfgupdate flag %d\n", active); di 1146 drivers/power/supply/bq27xxx_battery.c dev_warn(di->dev, "cfgupdate %d, retries %d\n", active, limit - try); di 1151 drivers/power/supply/bq27xxx_battery.c static inline int bq27xxx_battery_set_cfgupdate(struct bq27xxx_device_info *di) di 1153 drivers/power/supply/bq27xxx_battery.c int ret = bq27xxx_battery_cfgupdate_priv(di, true); di 1155 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "bus error on set_cfgupdate: %d\n", ret); di 1160 drivers/power/supply/bq27xxx_battery.c static inline int bq27xxx_battery_soft_reset(struct bq27xxx_device_info *di) di 1162 drivers/power/supply/bq27xxx_battery.c int ret = bq27xxx_battery_cfgupdate_priv(di, false); di 1164 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "bus error on soft_reset: %d\n", ret); di 1169 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_write_dm_block(struct bq27xxx_device_info *di, di 1172 drivers/power/supply/bq27xxx_battery.c bool cfgup = di->opts & BQ27XXX_O_CFGUP; di 1179 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_battery_set_cfgupdate(di); di 1184 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_write(di, BQ27XXX_DM_CTRL, 0, true); di 1188 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_write(di, BQ27XXX_DM_CLASS, buf->class, true); di 1192 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_write(di, BQ27XXX_DM_BLOCK, buf->block, true); di 1198 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_write_block(di, BQ27XXX_DM_DATA, buf->data, BQ27XXX_DM_SZ); di 1202 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_write(di, BQ27XXX_DM_CKSUM, di 1214 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_battery_soft_reset(di); di 1227 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_soft_reset(di); di 1229 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "bus error writing chip memory: %d\n", ret); di 1233 drivers/power/supply/bq27xxx_battery.c static void bq27xxx_battery_set_config(struct bq27xxx_device_info *di, di 1236 drivers/power/supply/bq27xxx_battery.c struct bq27xxx_dm_buf bd = BQ27XXX_DM_BUF(di, BQ27XXX_DM_DESIGN_CAPACITY); di 1237 drivers/power/supply/bq27xxx_battery.c struct bq27xxx_dm_buf bt = BQ27XXX_DM_BUF(di, BQ27XXX_DM_TERMINATE_VOLTAGE); di 1240 drivers/power/supply/bq27xxx_battery.c if (bq27xxx_battery_unseal(di) < 0) di 1245 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_read_dm_block(di, &bd); di 1247 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_update_dm_block(di, &bd, di 1250 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_update_dm_block(di, &bd, di 1258 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_read_dm_block(di, &bt); di 1259 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_update_dm_block(di, same ? &bd : &bt, di 1266 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_write_dm_block(di, &bd); di 1267 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_write_dm_block(di, &bt); di 1269 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_seal(di); di 1271 drivers/power/supply/bq27xxx_battery.c if (updated && !(di->opts & BQ27XXX_O_CFGUP)) { di 1272 drivers/power/supply/bq27xxx_battery.c bq27xxx_write(di, BQ27XXX_REG_CTRL, BQ27XXX_RESET, false); di 1278 drivers/power/supply/bq27xxx_battery.c static void bq27xxx_battery_settings(struct bq27xxx_device_info *di) di 1283 drivers/power/supply/bq27xxx_battery.c if (power_supply_get_battery_info(di->bat, &info) < 0) di 1286 drivers/power/supply/bq27xxx_battery.c if (!di->dm_regs) { di 1287 drivers/power/supply/bq27xxx_battery.c dev_warn(di->dev, "data memory update not supported for chip\n"); di 1293 drivers/power/supply/bq27xxx_battery.c dev_warn(di->dev, "missing battery:energy-full-design-microwatt-hours\n"); di 1295 drivers/power/supply/bq27xxx_battery.c dev_warn(di->dev, "missing battery:charge-full-design-microamp-hours\n"); di 1299 drivers/power/supply/bq27xxx_battery.c max = di->dm_regs[BQ27XXX_DM_DESIGN_ENERGY].max; di 1301 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "invalid battery:energy-full-design-microwatt-hours %d\n", di 1307 drivers/power/supply/bq27xxx_battery.c max = di->dm_regs[BQ27XXX_DM_DESIGN_CAPACITY].max; di 1309 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "invalid battery:charge-full-design-microamp-hours %d\n", di 1314 drivers/power/supply/bq27xxx_battery.c min = di->dm_regs[BQ27XXX_DM_TERMINATE_VOLTAGE].min; di 1315 drivers/power/supply/bq27xxx_battery.c max = di->dm_regs[BQ27XXX_DM_TERMINATE_VOLTAGE].max; di 1319 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "invalid battery:voltage-min-design-microvolt %d\n", di 1327 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_set_config(di, &info); di 1334 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_read_soc(struct bq27xxx_device_info *di) di 1338 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_ZERO) di 1339 drivers/power/supply/bq27xxx_battery.c soc = bq27xxx_read(di, BQ27XXX_REG_SOC, true); di 1341 drivers/power/supply/bq27xxx_battery.c soc = bq27xxx_read(di, BQ27XXX_REG_SOC, false); di 1344 drivers/power/supply/bq27xxx_battery.c dev_dbg(di->dev, "error reading State-of-Charge\n"); di 1353 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_read_charge(struct bq27xxx_device_info *di, u8 reg) di 1357 drivers/power/supply/bq27xxx_battery.c charge = bq27xxx_read(di, reg, false); di 1359 drivers/power/supply/bq27xxx_battery.c dev_dbg(di->dev, "error reading charge register %02x: %d\n", di 1364 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_ZERO) di 1376 drivers/power/supply/bq27xxx_battery.c static inline int bq27xxx_battery_read_nac(struct bq27xxx_device_info *di) di 1380 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_ZERO) { di 1381 drivers/power/supply/bq27xxx_battery.c flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, true); di 1386 drivers/power/supply/bq27xxx_battery.c return bq27xxx_battery_read_charge(di, BQ27XXX_REG_NAC); di 1393 drivers/power/supply/bq27xxx_battery.c static inline int bq27xxx_battery_read_fcc(struct bq27xxx_device_info *di) di 1395 drivers/power/supply/bq27xxx_battery.c return bq27xxx_battery_read_charge(di, BQ27XXX_REG_FCC); di 1402 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_read_dcap(struct bq27xxx_device_info *di) di 1406 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_ZERO) di 1407 drivers/power/supply/bq27xxx_battery.c dcap = bq27xxx_read(di, BQ27XXX_REG_DCAP, true); di 1409 drivers/power/supply/bq27xxx_battery.c dcap = bq27xxx_read(di, BQ27XXX_REG_DCAP, false); di 1412 drivers/power/supply/bq27xxx_battery.c dev_dbg(di->dev, "error reading initial last measured discharge\n"); di 1416 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_ZERO) di 1428 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_read_energy(struct bq27xxx_device_info *di) di 1432 drivers/power/supply/bq27xxx_battery.c ae = bq27xxx_read(di, BQ27XXX_REG_AE, false); di 1434 drivers/power/supply/bq27xxx_battery.c dev_dbg(di->dev, "error reading available energy\n"); di 1438 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_ZERO) di 1450 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_read_temperature(struct bq27xxx_device_info *di) di 1454 drivers/power/supply/bq27xxx_battery.c temp = bq27xxx_read(di, BQ27XXX_REG_TEMP, false); di 1456 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "error reading temperature\n"); di 1460 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_ZERO) di 1470 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_read_cyct(struct bq27xxx_device_info *di) di 1474 drivers/power/supply/bq27xxx_battery.c cyct = bq27xxx_read(di, BQ27XXX_REG_CYCT, false); di 1476 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "error reading cycle count total\n"); di 1485 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_read_time(struct bq27xxx_device_info *di, u8 reg) di 1489 drivers/power/supply/bq27xxx_battery.c tval = bq27xxx_read(di, reg, false); di 1491 drivers/power/supply/bq27xxx_battery.c dev_dbg(di->dev, "error reading time register %02x: %d\n", di 1506 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di) di 1510 drivers/power/supply/bq27xxx_battery.c tval = bq27xxx_read(di, BQ27XXX_REG_AP, false); di 1512 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "error reading average power register %02x: %d\n", di 1517 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_ZERO) di 1526 drivers/power/supply/bq27xxx_battery.c static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags) di 1528 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_OTDC) di 1530 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_UTOT) di 1539 drivers/power/supply/bq27xxx_battery.c static bool bq27xxx_battery_undertemp(struct bq27xxx_device_info *di, u16 flags) di 1541 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_UTOT) di 1550 drivers/power/supply/bq27xxx_battery.c static bool bq27xxx_battery_dead(struct bq27xxx_device_info *di, u16 flags) di 1552 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_ZERO) di 1558 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_read_health(struct bq27xxx_device_info *di) di 1561 drivers/power/supply/bq27xxx_battery.c if (unlikely(bq27xxx_battery_overtemp(di, di->cache.flags))) di 1563 drivers/power/supply/bq27xxx_battery.c if (unlikely(bq27xxx_battery_undertemp(di, di->cache.flags))) di 1565 drivers/power/supply/bq27xxx_battery.c if (unlikely(bq27xxx_battery_dead(di, di->cache.flags))) di 1571 drivers/power/supply/bq27xxx_battery.c void bq27xxx_battery_update(struct bq27xxx_device_info *di) di 1574 drivers/power/supply/bq27xxx_battery.c bool has_ci_flag = di->opts & BQ27XXX_O_ZERO; di 1575 drivers/power/supply/bq27xxx_battery.c bool has_singe_flag = di->opts & BQ27XXX_O_ZERO; di 1577 drivers/power/supply/bq27xxx_battery.c cache.flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, has_singe_flag); di 1581 drivers/power/supply/bq27xxx_battery.c cache.temperature = bq27xxx_battery_read_temperature(di); di 1583 drivers/power/supply/bq27xxx_battery.c dev_info_once(di->dev, "battery is not calibrated! ignoring capacity values\n"); di 1592 drivers/power/supply/bq27xxx_battery.c if (di->regs[BQ27XXX_REG_TTE] != INVALID_REG_ADDR) di 1593 drivers/power/supply/bq27xxx_battery.c cache.time_to_empty = bq27xxx_battery_read_time(di, BQ27XXX_REG_TTE); di 1594 drivers/power/supply/bq27xxx_battery.c if (di->regs[BQ27XXX_REG_TTECP] != INVALID_REG_ADDR) di 1595 drivers/power/supply/bq27xxx_battery.c cache.time_to_empty_avg = bq27xxx_battery_read_time(di, BQ27XXX_REG_TTECP); di 1596 drivers/power/supply/bq27xxx_battery.c if (di->regs[BQ27XXX_REG_TTF] != INVALID_REG_ADDR) di 1597 drivers/power/supply/bq27xxx_battery.c cache.time_to_full = bq27xxx_battery_read_time(di, BQ27XXX_REG_TTF); di 1598 drivers/power/supply/bq27xxx_battery.c cache.charge_full = bq27xxx_battery_read_fcc(di); di 1599 drivers/power/supply/bq27xxx_battery.c cache.capacity = bq27xxx_battery_read_soc(di); di 1600 drivers/power/supply/bq27xxx_battery.c if (di->regs[BQ27XXX_REG_AE] != INVALID_REG_ADDR) di 1601 drivers/power/supply/bq27xxx_battery.c cache.energy = bq27xxx_battery_read_energy(di); di 1602 drivers/power/supply/bq27xxx_battery.c di->cache.flags = cache.flags; di 1603 drivers/power/supply/bq27xxx_battery.c cache.health = bq27xxx_battery_read_health(di); di 1605 drivers/power/supply/bq27xxx_battery.c if (di->regs[BQ27XXX_REG_CYCT] != INVALID_REG_ADDR) di 1606 drivers/power/supply/bq27xxx_battery.c cache.cycle_count = bq27xxx_battery_read_cyct(di); di 1607 drivers/power/supply/bq27xxx_battery.c if (di->regs[BQ27XXX_REG_AP] != INVALID_REG_ADDR) di 1608 drivers/power/supply/bq27xxx_battery.c cache.power_avg = bq27xxx_battery_read_pwr_avg(di); di 1611 drivers/power/supply/bq27xxx_battery.c if (di->charge_design_full <= 0) di 1612 drivers/power/supply/bq27xxx_battery.c di->charge_design_full = bq27xxx_battery_read_dcap(di); di 1615 drivers/power/supply/bq27xxx_battery.c if ((di->cache.capacity != cache.capacity) || di 1616 drivers/power/supply/bq27xxx_battery.c (di->cache.flags != cache.flags)) di 1617 drivers/power/supply/bq27xxx_battery.c power_supply_changed(di->bat); di 1619 drivers/power/supply/bq27xxx_battery.c if (memcmp(&di->cache, &cache, sizeof(cache)) != 0) di 1620 drivers/power/supply/bq27xxx_battery.c di->cache = cache; di 1622 drivers/power/supply/bq27xxx_battery.c di->last_update = jiffies; di 1628 drivers/power/supply/bq27xxx_battery.c struct bq27xxx_device_info *di = di 1632 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_update(di); di 1635 drivers/power/supply/bq27xxx_battery.c schedule_delayed_work(&di->work, poll_interval * HZ); di 1643 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_current(struct bq27xxx_device_info *di, di 1649 drivers/power/supply/bq27xxx_battery.c curr = bq27xxx_read(di, BQ27XXX_REG_AI, false); di 1651 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "error reading current\n"); di 1655 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_ZERO) { di 1656 drivers/power/supply/bq27xxx_battery.c flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, true); di 1658 drivers/power/supply/bq27xxx_battery.c dev_dbg(di->dev, "negative current!\n"); di 1671 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_status(struct bq27xxx_device_info *di, di 1676 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_ZERO) { di 1677 drivers/power/supply/bq27xxx_battery.c if (di->cache.flags & BQ27000_FLAG_FC) di 1679 drivers/power/supply/bq27xxx_battery.c else if (di->cache.flags & BQ27000_FLAG_CHGS) di 1681 drivers/power/supply/bq27xxx_battery.c else if (power_supply_am_i_supplied(di->bat) > 0) di 1686 drivers/power/supply/bq27xxx_battery.c if (di->cache.flags & BQ27XXX_FLAG_FC) di 1688 drivers/power/supply/bq27xxx_battery.c else if (di->cache.flags & BQ27XXX_FLAG_DSC) di 1699 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_capacity_level(struct bq27xxx_device_info *di, di 1704 drivers/power/supply/bq27xxx_battery.c if (di->opts & BQ27XXX_O_ZERO) { di 1705 drivers/power/supply/bq27xxx_battery.c if (di->cache.flags & BQ27000_FLAG_FC) di 1707 drivers/power/supply/bq27xxx_battery.c else if (di->cache.flags & BQ27000_FLAG_EDV1) di 1709 drivers/power/supply/bq27xxx_battery.c else if (di->cache.flags & BQ27000_FLAG_EDVF) di 1714 drivers/power/supply/bq27xxx_battery.c if (di->cache.flags & BQ27XXX_FLAG_FC) di 1716 drivers/power/supply/bq27xxx_battery.c else if (di->cache.flags & BQ27XXX_FLAG_SOC1) di 1718 drivers/power/supply/bq27xxx_battery.c else if (di->cache.flags & BQ27XXX_FLAG_SOCF) di 1733 drivers/power/supply/bq27xxx_battery.c static int bq27xxx_battery_voltage(struct bq27xxx_device_info *di, di 1738 drivers/power/supply/bq27xxx_battery.c volt = bq27xxx_read(di, BQ27XXX_REG_VOLT, false); di 1740 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "error reading voltage\n"); di 1765 drivers/power/supply/bq27xxx_battery.c struct bq27xxx_device_info *di = power_supply_get_drvdata(psy); di 1767 drivers/power/supply/bq27xxx_battery.c mutex_lock(&di->lock); di 1768 drivers/power/supply/bq27xxx_battery.c if (time_is_before_jiffies(di->last_update + 5 * HZ)) { di 1769 drivers/power/supply/bq27xxx_battery.c cancel_delayed_work_sync(&di->work); di 1770 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_poll(&di->work.work); di 1772 drivers/power/supply/bq27xxx_battery.c mutex_unlock(&di->lock); di 1774 drivers/power/supply/bq27xxx_battery.c if (psp != POWER_SUPPLY_PROP_PRESENT && di->cache.flags < 0) di 1779 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_battery_status(di, val); di 1782 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_battery_voltage(di, val); di 1785 drivers/power/supply/bq27xxx_battery.c val->intval = di->cache.flags < 0 ? 0 : 1; di 1788 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_battery_current(di, val); di 1791 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_simple_value(di->cache.capacity, val); di 1794 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_battery_capacity_level(di, val); di 1797 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_simple_value(di->cache.temperature, val); di 1802 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_simple_value(di->cache.time_to_empty, val); di 1805 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_simple_value(di->cache.time_to_empty_avg, val); di 1808 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_simple_value(di->cache.time_to_full, val); di 1814 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_simple_value(bq27xxx_battery_read_nac(di), val); di 1817 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_simple_value(di->cache.charge_full, val); di 1820 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_simple_value(di->charge_design_full, val); di 1830 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_simple_value(di->cache.cycle_count, val); di 1833 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_simple_value(di->cache.energy, val); di 1836 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_simple_value(di->cache.power_avg, val); di 1839 drivers/power/supply/bq27xxx_battery.c ret = bq27xxx_simple_value(di->cache.health, val); di 1853 drivers/power/supply/bq27xxx_battery.c struct bq27xxx_device_info *di = power_supply_get_drvdata(psy); di 1855 drivers/power/supply/bq27xxx_battery.c cancel_delayed_work_sync(&di->work); di 1856 drivers/power/supply/bq27xxx_battery.c schedule_delayed_work(&di->work, 0); di 1859 drivers/power/supply/bq27xxx_battery.c int bq27xxx_battery_setup(struct bq27xxx_device_info *di) di 1863 drivers/power/supply/bq27xxx_battery.c .of_node = di->dev->of_node, di 1864 drivers/power/supply/bq27xxx_battery.c .drv_data = di, di 1867 drivers/power/supply/bq27xxx_battery.c INIT_DELAYED_WORK(&di->work, bq27xxx_battery_poll); di 1868 drivers/power/supply/bq27xxx_battery.c mutex_init(&di->lock); di 1870 drivers/power/supply/bq27xxx_battery.c di->regs = bq27xxx_chip_data[di->chip].regs; di 1871 drivers/power/supply/bq27xxx_battery.c di->unseal_key = bq27xxx_chip_data[di->chip].unseal_key; di 1872 drivers/power/supply/bq27xxx_battery.c di->dm_regs = bq27xxx_chip_data[di->chip].dm_regs; di 1873 drivers/power/supply/bq27xxx_battery.c di->opts = bq27xxx_chip_data[di->chip].opts; di 1875 drivers/power/supply/bq27xxx_battery.c psy_desc = devm_kzalloc(di->dev, sizeof(*psy_desc), GFP_KERNEL); di 1879 drivers/power/supply/bq27xxx_battery.c psy_desc->name = di->name; di 1881 drivers/power/supply/bq27xxx_battery.c psy_desc->properties = bq27xxx_chip_data[di->chip].props; di 1882 drivers/power/supply/bq27xxx_battery.c psy_desc->num_properties = bq27xxx_chip_data[di->chip].props_size; di 1886 drivers/power/supply/bq27xxx_battery.c di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg); di 1887 drivers/power/supply/bq27xxx_battery.c if (IS_ERR(di->bat)) { di 1888 drivers/power/supply/bq27xxx_battery.c if (PTR_ERR(di->bat) == -EPROBE_DEFER) di 1889 drivers/power/supply/bq27xxx_battery.c dev_dbg(di->dev, "failed to register battery, deferring probe\n"); di 1891 drivers/power/supply/bq27xxx_battery.c dev_err(di->dev, "failed to register battery\n"); di 1892 drivers/power/supply/bq27xxx_battery.c return PTR_ERR(di->bat); di 1895 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_settings(di); di 1896 drivers/power/supply/bq27xxx_battery.c bq27xxx_battery_update(di); di 1899 drivers/power/supply/bq27xxx_battery.c list_add(&di->list, &bq27xxx_battery_devices); di 1906 drivers/power/supply/bq27xxx_battery.c void bq27xxx_battery_teardown(struct bq27xxx_device_info *di) di 1916 drivers/power/supply/bq27xxx_battery.c cancel_delayed_work_sync(&di->work); di 1918 drivers/power/supply/bq27xxx_battery.c power_supply_unregister(di->bat); di 1921 drivers/power/supply/bq27xxx_battery.c list_del(&di->list); di 1924 drivers/power/supply/bq27xxx_battery.c mutex_destroy(&di->lock); di 47 drivers/power/supply/bq27xxx_battery_hdq.c static int bq27xxx_battery_hdq_read(struct bq27xxx_device_info *di, u8 reg, di 50 drivers/power/supply/bq27xxx_battery_hdq.c struct w1_slave *sl = dev_to_w1_slave(di->dev); di 84 drivers/power/supply/bq27xxx_battery_hdq.c struct bq27xxx_device_info *di; di 86 drivers/power/supply/bq27xxx_battery_hdq.c di = devm_kzalloc(&sl->dev, sizeof(*di), GFP_KERNEL); di 87 drivers/power/supply/bq27xxx_battery_hdq.c if (!di) di 90 drivers/power/supply/bq27xxx_battery_hdq.c dev_set_drvdata(&sl->dev, di); di 92 drivers/power/supply/bq27xxx_battery_hdq.c di->dev = &sl->dev; di 93 drivers/power/supply/bq27xxx_battery_hdq.c di->chip = BQ27000; di 94 drivers/power/supply/bq27xxx_battery_hdq.c di->name = "bq27000-battery"; di 95 drivers/power/supply/bq27xxx_battery_hdq.c di->bus.read = bq27xxx_battery_hdq_read; di 97 drivers/power/supply/bq27xxx_battery_hdq.c return bq27xxx_battery_setup(di); di 102 drivers/power/supply/bq27xxx_battery_hdq.c struct bq27xxx_device_info *di = dev_get_drvdata(&sl->dev); di 104 drivers/power/supply/bq27xxx_battery_hdq.c bq27xxx_battery_teardown(di); di 29 drivers/power/supply/bq27xxx_battery_i2c.c struct bq27xxx_device_info *di = data; di 31 drivers/power/supply/bq27xxx_battery_i2c.c bq27xxx_battery_update(di); di 36 drivers/power/supply/bq27xxx_battery_i2c.c static int bq27xxx_battery_i2c_read(struct bq27xxx_device_info *di, u8 reg, di 39 drivers/power/supply/bq27xxx_battery_i2c.c struct i2c_client *client = to_i2c_client(di->dev); di 71 drivers/power/supply/bq27xxx_battery_i2c.c static int bq27xxx_battery_i2c_write(struct bq27xxx_device_info *di, u8 reg, di 74 drivers/power/supply/bq27xxx_battery_i2c.c struct i2c_client *client = to_i2c_client(di->dev); di 103 drivers/power/supply/bq27xxx_battery_i2c.c static int bq27xxx_battery_i2c_bulk_read(struct bq27xxx_device_info *di, u8 reg, di 106 drivers/power/supply/bq27xxx_battery_i2c.c struct i2c_client *client = to_i2c_client(di->dev); di 120 drivers/power/supply/bq27xxx_battery_i2c.c static int bq27xxx_battery_i2c_bulk_write(struct bq27xxx_device_info *di, di 123 drivers/power/supply/bq27xxx_battery_i2c.c struct i2c_client *client = to_i2c_client(di->dev); di 150 drivers/power/supply/bq27xxx_battery_i2c.c struct bq27xxx_device_info *di; di 166 drivers/power/supply/bq27xxx_battery_i2c.c di = devm_kzalloc(&client->dev, sizeof(*di), GFP_KERNEL); di 167 drivers/power/supply/bq27xxx_battery_i2c.c if (!di) di 170 drivers/power/supply/bq27xxx_battery_i2c.c di->id = num; di 171 drivers/power/supply/bq27xxx_battery_i2c.c di->dev = &client->dev; di 172 drivers/power/supply/bq27xxx_battery_i2c.c di->chip = id->driver_data; di 173 drivers/power/supply/bq27xxx_battery_i2c.c di->name = name; di 175 drivers/power/supply/bq27xxx_battery_i2c.c di->bus.read = bq27xxx_battery_i2c_read; di 176 drivers/power/supply/bq27xxx_battery_i2c.c di->bus.write = bq27xxx_battery_i2c_write; di 177 drivers/power/supply/bq27xxx_battery_i2c.c di->bus.read_bulk = bq27xxx_battery_i2c_bulk_read; di 178 drivers/power/supply/bq27xxx_battery_i2c.c di->bus.write_bulk = bq27xxx_battery_i2c_bulk_write; di 180 drivers/power/supply/bq27xxx_battery_i2c.c ret = bq27xxx_battery_setup(di); di 185 drivers/power/supply/bq27xxx_battery_i2c.c schedule_delayed_work(&di->work, 60 * HZ); di 187 drivers/power/supply/bq27xxx_battery_i2c.c i2c_set_clientdata(client, di); di 193 drivers/power/supply/bq27xxx_battery_i2c.c di->name, di); di 217 drivers/power/supply/bq27xxx_battery_i2c.c struct bq27xxx_device_info *di = i2c_get_clientdata(client); di 219 drivers/power/supply/bq27xxx_battery_i2c.c bq27xxx_battery_teardown(di); di 222 drivers/power/supply/bq27xxx_battery_i2c.c idr_remove(&battery_id, di->id); di 263 drivers/power/supply/ds2760_battery.c static int ds2760_battery_read_status(struct ds2760_device_info *di) di 267 drivers/power/supply/ds2760_battery.c if (di->update_time && time_before(jiffies, di->update_time + di 273 drivers/power/supply/ds2760_battery.c if (di->update_time == 0) { di 281 drivers/power/supply/ds2760_battery.c ret = w1_ds2760_read(di->dev, di->raw + start, start, count); di 283 drivers/power/supply/ds2760_battery.c dev_warn(di->dev, "call to w1_ds2760_read failed (0x%p)\n", di 284 drivers/power/supply/ds2760_battery.c di->dev); di 288 drivers/power/supply/ds2760_battery.c di->update_time = jiffies; di 292 drivers/power/supply/ds2760_battery.c di->voltage_raw = (di->raw[DS2760_VOLTAGE_MSB] << 3) | di 293 drivers/power/supply/ds2760_battery.c (di->raw[DS2760_VOLTAGE_LSB] >> 5); di 294 drivers/power/supply/ds2760_battery.c di->voltage_uV = di->voltage_raw * 4880; di 298 drivers/power/supply/ds2760_battery.c di->current_raw = di 299 drivers/power/supply/ds2760_battery.c (((signed char)di->raw[DS2760_CURRENT_MSB]) << 5) | di 300 drivers/power/supply/ds2760_battery.c (di->raw[DS2760_CURRENT_LSB] >> 3); di 301 drivers/power/supply/ds2760_battery.c di->current_uA = di->current_raw * 625; di 304 drivers/power/supply/ds2760_battery.c di->accum_current_raw = di 305 drivers/power/supply/ds2760_battery.c (((signed char)di->raw[DS2760_CURRENT_ACCUM_MSB]) << 8) | di 306 drivers/power/supply/ds2760_battery.c di->raw[DS2760_CURRENT_ACCUM_LSB]; di 307 drivers/power/supply/ds2760_battery.c di->accum_current_uAh = di->accum_current_raw * 250; di 312 drivers/power/supply/ds2760_battery.c di->temp_raw = (((signed char)di->raw[DS2760_TEMP_MSB]) << 3) | di 313 drivers/power/supply/ds2760_battery.c (di->raw[DS2760_TEMP_LSB] >> 5); di 314 drivers/power/supply/ds2760_battery.c di->temp_C = di->temp_raw + (di->temp_raw / 4); di 318 drivers/power/supply/ds2760_battery.c if (di->raw[DS2760_RATED_CAPACITY] < ARRAY_SIZE(rated_capacities)) di 319 drivers/power/supply/ds2760_battery.c di->rated_capacity = rated_capacities[ di 320 drivers/power/supply/ds2760_battery.c (unsigned int)di->raw[DS2760_RATED_CAPACITY]]; di 322 drivers/power/supply/ds2760_battery.c di->rated_capacity = di->raw[DS2760_RATED_CAPACITY] * 10; di 324 drivers/power/supply/ds2760_battery.c di->rated_capacity *= 1000; /* convert to µAh */ di 327 drivers/power/supply/ds2760_battery.c di->full_active_uAh = di->raw[DS2760_ACTIVE_FULL] << 8 | di 328 drivers/power/supply/ds2760_battery.c di->raw[DS2760_ACTIVE_FULL + 1]; di 333 drivers/power/supply/ds2760_battery.c if (di->full_active_uAh == 0) di 334 drivers/power/supply/ds2760_battery.c di->full_active_uAh = di->rated_capacity / 1000L; di 336 drivers/power/supply/ds2760_battery.c scale[0] = di->full_active_uAh; di 338 drivers/power/supply/ds2760_battery.c scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 1 + i]; di 340 drivers/power/supply/ds2760_battery.c di->full_active_uAh = battery_interpolate(scale, di->temp_C / 10); di 341 drivers/power/supply/ds2760_battery.c di->full_active_uAh *= 1000; /* convert to µAh */ di 344 drivers/power/supply/ds2760_battery.c scale[4] = di->raw[DS2760_ACTIVE_EMPTY + 4]; di 346 drivers/power/supply/ds2760_battery.c scale[i] = scale[i + 1] + di->raw[DS2760_ACTIVE_EMPTY + i]; di 348 drivers/power/supply/ds2760_battery.c di->empty_uAh = battery_interpolate(scale, di->temp_C / 10); di 349 drivers/power/supply/ds2760_battery.c di->empty_uAh *= 1000; /* convert to µAh */ di 351 drivers/power/supply/ds2760_battery.c if (di->full_active_uAh == di->empty_uAh) di 352 drivers/power/supply/ds2760_battery.c di->rem_capacity = 0; di 356 drivers/power/supply/ds2760_battery.c di->rem_capacity = ((di->accum_current_uAh - di->empty_uAh) * 100L) / di 357 drivers/power/supply/ds2760_battery.c (di->full_active_uAh - di->empty_uAh); di 359 drivers/power/supply/ds2760_battery.c if (di->rem_capacity < 0) di 360 drivers/power/supply/ds2760_battery.c di->rem_capacity = 0; di 361 drivers/power/supply/ds2760_battery.c if (di->rem_capacity > 100) di 362 drivers/power/supply/ds2760_battery.c di->rem_capacity = 100; di 364 drivers/power/supply/ds2760_battery.c if (di->current_uA < -100L) di 365 drivers/power/supply/ds2760_battery.c di->life_sec = -((di->accum_current_uAh - di->empty_uAh) * 36L) di 366 drivers/power/supply/ds2760_battery.c / (di->current_uA / 100L); di 368 drivers/power/supply/ds2760_battery.c di->life_sec = 0; di 373 drivers/power/supply/ds2760_battery.c static void ds2760_battery_set_current_accum(struct ds2760_device_info *di, di 385 drivers/power/supply/ds2760_battery.c if (w1_ds2760_write(di->dev, acr, DS2760_CURRENT_ACCUM_MSB, 2) < 2) di 386 drivers/power/supply/ds2760_battery.c dev_warn(di->dev, "ACR write failed\n"); di 389 drivers/power/supply/ds2760_battery.c static void ds2760_battery_update_status(struct ds2760_device_info *di) di 391 drivers/power/supply/ds2760_battery.c int old_charge_status = di->charge_status; di 393 drivers/power/supply/ds2760_battery.c ds2760_battery_read_status(di); di 395 drivers/power/supply/ds2760_battery.c if (di->charge_status == POWER_SUPPLY_STATUS_UNKNOWN) di 396 drivers/power/supply/ds2760_battery.c di->full_counter = 0; di 398 drivers/power/supply/ds2760_battery.c if (power_supply_am_i_supplied(di->bat)) { di 399 drivers/power/supply/ds2760_battery.c if (di->current_uA > 10000) { di 400 drivers/power/supply/ds2760_battery.c di->charge_status = POWER_SUPPLY_STATUS_CHARGING; di 401 drivers/power/supply/ds2760_battery.c di->full_counter = 0; di 402 drivers/power/supply/ds2760_battery.c } else if (di->current_uA < -5000) { di 403 drivers/power/supply/ds2760_battery.c if (di->charge_status != POWER_SUPPLY_STATUS_NOT_CHARGING) di 404 drivers/power/supply/ds2760_battery.c dev_notice(di->dev, "not enough power to " di 406 drivers/power/supply/ds2760_battery.c di->charge_status = POWER_SUPPLY_STATUS_NOT_CHARGING; di 407 drivers/power/supply/ds2760_battery.c di->full_counter = 0; di 408 drivers/power/supply/ds2760_battery.c } else if (di->current_uA < 10000 && di 409 drivers/power/supply/ds2760_battery.c di->charge_status != POWER_SUPPLY_STATUS_FULL) { di 415 drivers/power/supply/ds2760_battery.c di->full_counter++; di 417 drivers/power/supply/ds2760_battery.c if (di->full_counter < 2) { di 418 drivers/power/supply/ds2760_battery.c di->charge_status = POWER_SUPPLY_STATUS_CHARGING; di 420 drivers/power/supply/ds2760_battery.c di->charge_status = POWER_SUPPLY_STATUS_FULL; di 421 drivers/power/supply/ds2760_battery.c ds2760_battery_set_current_accum(di, di 422 drivers/power/supply/ds2760_battery.c di->full_active_uAh); di 426 drivers/power/supply/ds2760_battery.c di->charge_status = POWER_SUPPLY_STATUS_DISCHARGING; di 427 drivers/power/supply/ds2760_battery.c di->full_counter = 0; di 430 drivers/power/supply/ds2760_battery.c if (di->charge_status != old_charge_status) di 431 drivers/power/supply/ds2760_battery.c power_supply_changed(di->bat); di 434 drivers/power/supply/ds2760_battery.c static void ds2760_battery_write_status(struct ds2760_device_info *di, di 437 drivers/power/supply/ds2760_battery.c if (status == di->raw[DS2760_STATUS_REG]) di 440 drivers/power/supply/ds2760_battery.c w1_ds2760_write(di->dev, &status, DS2760_STATUS_WRITE_REG, 1); di 441 drivers/power/supply/ds2760_battery.c w1_ds2760_store_eeprom(di->dev, DS2760_EEPROM_BLOCK1); di 442 drivers/power/supply/ds2760_battery.c w1_ds2760_recall_eeprom(di->dev, DS2760_EEPROM_BLOCK1); di 445 drivers/power/supply/ds2760_battery.c static void ds2760_battery_write_rated_capacity(struct ds2760_device_info *di, di 448 drivers/power/supply/ds2760_battery.c if (rated_capacity == di->raw[DS2760_RATED_CAPACITY]) di 451 drivers/power/supply/ds2760_battery.c w1_ds2760_write(di->dev, &rated_capacity, DS2760_RATED_CAPACITY, 1); di 452 drivers/power/supply/ds2760_battery.c w1_ds2760_store_eeprom(di->dev, DS2760_EEPROM_BLOCK1); di 453 drivers/power/supply/ds2760_battery.c w1_ds2760_recall_eeprom(di->dev, DS2760_EEPROM_BLOCK1); di 456 drivers/power/supply/ds2760_battery.c static void ds2760_battery_write_active_full(struct ds2760_device_info *di, di 464 drivers/power/supply/ds2760_battery.c if (tmp[0] == di->raw[DS2760_ACTIVE_FULL] && di 465 drivers/power/supply/ds2760_battery.c tmp[1] == di->raw[DS2760_ACTIVE_FULL + 1]) di 468 drivers/power/supply/ds2760_battery.c w1_ds2760_write(di->dev, tmp, DS2760_ACTIVE_FULL, sizeof(tmp)); di 469 drivers/power/supply/ds2760_battery.c w1_ds2760_store_eeprom(di->dev, DS2760_EEPROM_BLOCK0); di 470 drivers/power/supply/ds2760_battery.c w1_ds2760_recall_eeprom(di->dev, DS2760_EEPROM_BLOCK0); di 474 drivers/power/supply/ds2760_battery.c di->raw[DS2760_ACTIVE_FULL] = tmp[0]; di 475 drivers/power/supply/ds2760_battery.c di->raw[DS2760_ACTIVE_FULL + 1] = tmp[1]; di 480 drivers/power/supply/ds2760_battery.c struct ds2760_device_info *di = container_of(work, di 484 drivers/power/supply/ds2760_battery.c dev_dbg(di->dev, "%s\n", __func__); di 486 drivers/power/supply/ds2760_battery.c ds2760_battery_update_status(di); di 487 drivers/power/supply/ds2760_battery.c queue_delayed_work(di->monitor_wqueue, &di->monitor_work, interval); di 492 drivers/power/supply/ds2760_battery.c struct ds2760_device_info *di = power_supply_get_drvdata(psy); di 494 drivers/power/supply/ds2760_battery.c dev_dbg(di->dev, "%s\n", __func__); di 496 drivers/power/supply/ds2760_battery.c mod_delayed_work(di->monitor_wqueue, &di->monitor_work, HZ/10); di 503 drivers/power/supply/ds2760_battery.c struct ds2760_device_info *di = container_of(work, di 506 drivers/power/supply/ds2760_battery.c dev_dbg(di->dev, "%s\n", __func__); di 508 drivers/power/supply/ds2760_battery.c ds2760_battery_read_status(di); di 518 drivers/power/supply/ds2760_battery.c if (!power_supply_am_i_supplied(di->bat)) di 521 drivers/power/supply/ds2760_battery.c bias = (signed char) di->current_raw + di 522 drivers/power/supply/ds2760_battery.c (signed char) di->raw[DS2760_CURRENT_OFFSET_BIAS]; di 524 drivers/power/supply/ds2760_battery.c dev_dbg(di->dev, "%s: bias = %d\n", __func__, bias); di 526 drivers/power/supply/ds2760_battery.c w1_ds2760_write(di->dev, &bias, DS2760_CURRENT_OFFSET_BIAS, 1); di 527 drivers/power/supply/ds2760_battery.c w1_ds2760_store_eeprom(di->dev, DS2760_EEPROM_BLOCK1); di 528 drivers/power/supply/ds2760_battery.c w1_ds2760_recall_eeprom(di->dev, DS2760_EEPROM_BLOCK1); di 532 drivers/power/supply/ds2760_battery.c di->raw[DS2760_CURRENT_OFFSET_BIAS] = bias; di 537 drivers/power/supply/ds2760_battery.c struct ds2760_device_info *di = power_supply_get_drvdata(psy); di 541 drivers/power/supply/ds2760_battery.c mod_delayed_work(di->monitor_wqueue, &di->set_charged_work, HZ * 20); di 548 drivers/power/supply/ds2760_battery.c struct ds2760_device_info *di = power_supply_get_drvdata(psy); di 552 drivers/power/supply/ds2760_battery.c val->intval = di->charge_status; di 558 drivers/power/supply/ds2760_battery.c ds2760_battery_read_status(di); di 562 drivers/power/supply/ds2760_battery.c val->intval = di->voltage_uV; di 565 drivers/power/supply/ds2760_battery.c val->intval = di->current_uA; di 568 drivers/power/supply/ds2760_battery.c val->intval = di->rated_capacity; di 571 drivers/power/supply/ds2760_battery.c val->intval = di->full_active_uAh; di 574 drivers/power/supply/ds2760_battery.c val->intval = di->empty_uAh; di 577 drivers/power/supply/ds2760_battery.c val->intval = di->accum_current_uAh; di 580 drivers/power/supply/ds2760_battery.c val->intval = di->temp_C; di 583 drivers/power/supply/ds2760_battery.c val->intval = di->life_sec; di 586 drivers/power/supply/ds2760_battery.c val->intval = di->rem_capacity; di 599 drivers/power/supply/ds2760_battery.c struct ds2760_device_info *di = power_supply_get_drvdata(psy); di 604 drivers/power/supply/ds2760_battery.c ds2760_battery_write_active_full(di, val->intval / 1000L); di 609 drivers/power/supply/ds2760_battery.c ds2760_battery_set_current_accum(di, val->intval); di 651 drivers/power/supply/ds2760_battery.c struct ds2760_device_info *di = di 657 drivers/power/supply/ds2760_battery.c di->charge_status = POWER_SUPPLY_STATUS_UNKNOWN; di 663 drivers/power/supply/ds2760_battery.c di->charge_status = POWER_SUPPLY_STATUS_UNKNOWN; di 664 drivers/power/supply/ds2760_battery.c power_supply_changed(di->bat); di 665 drivers/power/supply/ds2760_battery.c mod_delayed_work(di->monitor_wqueue, &di->monitor_work, HZ); di 680 drivers/power/supply/ds2760_battery.c struct ds2760_device_info *di; di 686 drivers/power/supply/ds2760_battery.c di = devm_kzalloc(dev, sizeof(*di), GFP_KERNEL); di 687 drivers/power/supply/ds2760_battery.c if (!di) { di 694 drivers/power/supply/ds2760_battery.c di->dev = dev; di 695 drivers/power/supply/ds2760_battery.c di->bat_desc.name = name; di 696 drivers/power/supply/ds2760_battery.c di->bat_desc.type = POWER_SUPPLY_TYPE_BATTERY; di 697 drivers/power/supply/ds2760_battery.c di->bat_desc.properties = ds2760_battery_props; di 698 drivers/power/supply/ds2760_battery.c di->bat_desc.num_properties = ARRAY_SIZE(ds2760_battery_props); di 699 drivers/power/supply/ds2760_battery.c di->bat_desc.get_property = ds2760_battery_get_property; di 700 drivers/power/supply/ds2760_battery.c di->bat_desc.set_property = ds2760_battery_set_property; di 701 drivers/power/supply/ds2760_battery.c di->bat_desc.property_is_writeable = di 703 drivers/power/supply/ds2760_battery.c di->bat_desc.set_charged = ds2760_battery_set_charged; di 704 drivers/power/supply/ds2760_battery.c di->bat_desc.external_power_changed = di 707 drivers/power/supply/ds2760_battery.c psy_cfg.drv_data = di; di 727 drivers/power/supply/ds2760_battery.c di->charge_status = POWER_SUPPLY_STATUS_UNKNOWN; di 729 drivers/power/supply/ds2760_battery.c sl->family_data = di; di 732 drivers/power/supply/ds2760_battery.c ds2760_battery_read_status(di); di 733 drivers/power/supply/ds2760_battery.c status = di->raw[DS2760_STATUS_REG]; di 739 drivers/power/supply/ds2760_battery.c ds2760_battery_write_status(di, status); di 743 drivers/power/supply/ds2760_battery.c ds2760_battery_write_rated_capacity(di, rated_capacity); di 748 drivers/power/supply/ds2760_battery.c ds2760_battery_set_current_accum(di, current_accum); di 750 drivers/power/supply/ds2760_battery.c di->bat = power_supply_register(dev, &di->bat_desc, &psy_cfg); di 751 drivers/power/supply/ds2760_battery.c if (IS_ERR(di->bat)) { di 752 drivers/power/supply/ds2760_battery.c dev_err(di->dev, "failed to register battery\n"); di 753 drivers/power/supply/ds2760_battery.c retval = PTR_ERR(di->bat); di 757 drivers/power/supply/ds2760_battery.c INIT_DELAYED_WORK(&di->monitor_work, ds2760_battery_work); di 758 drivers/power/supply/ds2760_battery.c INIT_DELAYED_WORK(&di->set_charged_work, di 760 drivers/power/supply/ds2760_battery.c di->monitor_wqueue = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); di 761 drivers/power/supply/ds2760_battery.c if (!di->monitor_wqueue) { di 765 drivers/power/supply/ds2760_battery.c queue_delayed_work(di->monitor_wqueue, &di->monitor_work, HZ * 1); di 767 drivers/power/supply/ds2760_battery.c di->pm_notifier.notifier_call = ds2760_pm_notifier; di 768 drivers/power/supply/ds2760_battery.c register_pm_notifier(&di->pm_notifier); di 773 drivers/power/supply/ds2760_battery.c power_supply_unregister(di->bat); di 782 drivers/power/supply/ds2760_battery.c struct ds2760_device_info *di = sl->family_data; di 784 drivers/power/supply/ds2760_battery.c unregister_pm_notifier(&di->pm_notifier); di 785 drivers/power/supply/ds2760_battery.c cancel_delayed_work_sync(&di->monitor_work); di 786 drivers/power/supply/ds2760_battery.c cancel_delayed_work_sync(&di->set_charged_work); di 787 drivers/power/supply/ds2760_battery.c destroy_workqueue(di->monitor_wqueue); di 788 drivers/power/supply/ds2760_battery.c power_supply_unregister(di->bat); di 41 drivers/power/supply/rx51_battery.c static int rx51_battery_read_voltage(struct rx51_device_info *di) di 43 drivers/power/supply/rx51_battery.c int voltage = rx51_battery_read_adc(di->channel_vbat); di 46 drivers/power/supply/rx51_battery.c dev_err(di->dev, "Could not read ADC: %d\n", voltage); di 93 drivers/power/supply/rx51_battery.c static int rx51_battery_read_temperature(struct rx51_device_info *di) di 97 drivers/power/supply/rx51_battery.c int raw = rx51_battery_read_adc(di->channel_temp); di 100 drivers/power/supply/rx51_battery.c dev_err(di->dev, "Could not read ADC: %d\n", raw); di 132 drivers/power/supply/rx51_battery.c static int rx51_battery_read_capacity(struct rx51_device_info *di) di 134 drivers/power/supply/rx51_battery.c int capacity = rx51_battery_read_adc(di->channel_bsi); di 137 drivers/power/supply/rx51_battery.c dev_err(di->dev, "Could not read ADC: %d\n", capacity); di 151 drivers/power/supply/rx51_battery.c struct rx51_device_info *di = power_supply_get_drvdata(psy); di 161 drivers/power/supply/rx51_battery.c val->intval = rx51_battery_read_voltage(di) ? 1 : 0; di 164 drivers/power/supply/rx51_battery.c val->intval = rx51_battery_read_voltage(di); di 167 drivers/power/supply/rx51_battery.c val->intval = rx51_battery_read_temperature(di); di 170 drivers/power/supply/rx51_battery.c val->intval = rx51_battery_read_capacity(di); di 194 drivers/power/supply/rx51_battery.c struct rx51_device_info *di; di 197 drivers/power/supply/rx51_battery.c di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); di 198 drivers/power/supply/rx51_battery.c if (!di) di 201 drivers/power/supply/rx51_battery.c platform_set_drvdata(pdev, di); di 203 drivers/power/supply/rx51_battery.c di->dev = &pdev->dev; di 204 drivers/power/supply/rx51_battery.c di->bat_desc.name = "rx51-battery"; di 205 drivers/power/supply/rx51_battery.c di->bat_desc.type = POWER_SUPPLY_TYPE_BATTERY; di 206 drivers/power/supply/rx51_battery.c di->bat_desc.properties = rx51_battery_props; di 207 drivers/power/supply/rx51_battery.c di->bat_desc.num_properties = ARRAY_SIZE(rx51_battery_props); di 208 drivers/power/supply/rx51_battery.c di->bat_desc.get_property = rx51_battery_get_property; di 210 drivers/power/supply/rx51_battery.c psy_cfg.drv_data = di; di 212 drivers/power/supply/rx51_battery.c di->channel_temp = iio_channel_get(di->dev, "temp"); di 213 drivers/power/supply/rx51_battery.c if (IS_ERR(di->channel_temp)) { di 214 drivers/power/supply/rx51_battery.c ret = PTR_ERR(di->channel_temp); di 218 drivers/power/supply/rx51_battery.c di->channel_bsi = iio_channel_get(di->dev, "bsi"); di 219 drivers/power/supply/rx51_battery.c if (IS_ERR(di->channel_bsi)) { di 220 drivers/power/supply/rx51_battery.c ret = PTR_ERR(di->channel_bsi); di 224 drivers/power/supply/rx51_battery.c di->channel_vbat = iio_channel_get(di->dev, "vbat"); di 225 drivers/power/supply/rx51_battery.c if (IS_ERR(di->channel_vbat)) { di 226 drivers/power/supply/rx51_battery.c ret = PTR_ERR(di->channel_vbat); di 230 drivers/power/supply/rx51_battery.c di->bat = power_supply_register(di->dev, &di->bat_desc, &psy_cfg); di 231 drivers/power/supply/rx51_battery.c if (IS_ERR(di->bat)) { di 232 drivers/power/supply/rx51_battery.c ret = PTR_ERR(di->bat); di 239 drivers/power/supply/rx51_battery.c iio_channel_release(di->channel_vbat); di 241 drivers/power/supply/rx51_battery.c iio_channel_release(di->channel_bsi); di 243 drivers/power/supply/rx51_battery.c iio_channel_release(di->channel_temp); di 251 drivers/power/supply/rx51_battery.c struct rx51_device_info *di = platform_get_drvdata(pdev); di 253 drivers/power/supply/rx51_battery.c power_supply_unregister(di->bat); di 255 drivers/power/supply/rx51_battery.c iio_channel_release(di->channel_vbat); di 256 drivers/power/supply/rx51_battery.c iio_channel_release(di->channel_bsi); di 257 drivers/power/supply/rx51_battery.c iio_channel_release(di->channel_temp); di 112 drivers/regulator/fan53555.c struct fan53555_device_info *di = rdev_get_drvdata(rdev); di 115 drivers/regulator/fan53555.c if (di->sleep_vol_cache == uV) di 120 drivers/regulator/fan53555.c ret = regmap_update_bits(rdev->regmap, di->sleep_reg, di 121 drivers/regulator/fan53555.c di->desc.vsel_mask, ret); di 126 drivers/regulator/fan53555.c di->sleep_vol_cache = uV; di 133 drivers/regulator/fan53555.c struct fan53555_device_info *di = rdev_get_drvdata(rdev); di 135 drivers/regulator/fan53555.c return regmap_update_bits(rdev->regmap, di->sleep_reg, di 141 drivers/regulator/fan53555.c struct fan53555_device_info *di = rdev_get_drvdata(rdev); di 143 drivers/regulator/fan53555.c return regmap_update_bits(rdev->regmap, di->sleep_reg, di 149 drivers/regulator/fan53555.c struct fan53555_device_info *di = rdev_get_drvdata(rdev); di 153 drivers/regulator/fan53555.c regmap_update_bits(rdev->regmap, di->mode_reg, di 154 drivers/regulator/fan53555.c di->mode_mask, di->mode_mask); di 157 drivers/regulator/fan53555.c regmap_update_bits(rdev->regmap, di->vol_reg, di->mode_mask, 0); di 167 drivers/regulator/fan53555.c struct fan53555_device_info *di = rdev_get_drvdata(rdev); di 171 drivers/regulator/fan53555.c ret = regmap_read(rdev->regmap, di->mode_reg, &val); di 174 drivers/regulator/fan53555.c if (val & di->mode_mask) di 193 drivers/regulator/fan53555.c struct fan53555_device_info *di = rdev_get_drvdata(rdev); di 204 drivers/regulator/fan53555.c dev_err(di->dev, "unsupported ramp value %d\n", ramp); di 229 drivers/regulator/fan53555.c static int fan53526_voltages_setup_fairchild(struct fan53555_device_info *di) di 232 drivers/regulator/fan53555.c switch (di->chip_id) { di 234 drivers/regulator/fan53555.c switch (di->chip_rev) { di 236 drivers/regulator/fan53555.c di->vsel_min = 600000; di 237 drivers/regulator/fan53555.c di->vsel_step = 6250; di 240 drivers/regulator/fan53555.c dev_err(di->dev, di 242 drivers/regulator/fan53555.c di->chip_id, di->chip_rev); di 247 drivers/regulator/fan53555.c dev_err(di->dev, di 248 drivers/regulator/fan53555.c "Chip ID %d not supported!\n", di->chip_id); di 252 drivers/regulator/fan53555.c di->vsel_count = FAN53526_NVOLTAGES; di 257 drivers/regulator/fan53555.c static int fan53555_voltages_setup_fairchild(struct fan53555_device_info *di) di 260 drivers/regulator/fan53555.c switch (di->chip_id) { di 262 drivers/regulator/fan53555.c switch (di->chip_rev) { di 264 drivers/regulator/fan53555.c di->vsel_min = 600000; di 265 drivers/regulator/fan53555.c di->vsel_step = 10000; di 268 drivers/regulator/fan53555.c di->vsel_min = 800000; di 269 drivers/regulator/fan53555.c di->vsel_step = 10000; di 272 drivers/regulator/fan53555.c dev_err(di->dev, di 274 drivers/regulator/fan53555.c di->chip_id, di->chip_rev); di 282 drivers/regulator/fan53555.c di->vsel_min = 600000; di 283 drivers/regulator/fan53555.c di->vsel_step = 10000; di 286 drivers/regulator/fan53555.c di->vsel_min = 603000; di 287 drivers/regulator/fan53555.c di->vsel_step = 12826; di 290 drivers/regulator/fan53555.c dev_err(di->dev, di 291 drivers/regulator/fan53555.c "Chip ID %d not supported!\n", di->chip_id); di 295 drivers/regulator/fan53555.c di->vsel_count = FAN53555_NVOLTAGES; di 300 drivers/regulator/fan53555.c static int fan53555_voltages_setup_silergy(struct fan53555_device_info *di) di 303 drivers/regulator/fan53555.c switch (di->chip_id) { di 305 drivers/regulator/fan53555.c di->vsel_min = 712500; di 306 drivers/regulator/fan53555.c di->vsel_step = 12500; di 309 drivers/regulator/fan53555.c dev_err(di->dev, di 310 drivers/regulator/fan53555.c "Chip ID %d not supported!\n", di->chip_id); di 314 drivers/regulator/fan53555.c di->vsel_count = FAN53555_NVOLTAGES; di 324 drivers/regulator/fan53555.c static int fan53555_device_setup(struct fan53555_device_info *di, di 332 drivers/regulator/fan53555.c di->sleep_reg = FAN53555_VSEL0; di 333 drivers/regulator/fan53555.c di->vol_reg = FAN53555_VSEL1; di 336 drivers/regulator/fan53555.c di->sleep_reg = FAN53555_VSEL1; di 337 drivers/regulator/fan53555.c di->vol_reg = FAN53555_VSEL0; di 340 drivers/regulator/fan53555.c dev_err(di->dev, "Invalid VSEL ID!\n"); di 345 drivers/regulator/fan53555.c switch (di->vendor) { di 347 drivers/regulator/fan53555.c di->mode_reg = FAN53555_CONTROL; di 351 drivers/regulator/fan53555.c di->mode_mask = CTL_MODE_VSEL1_MODE; di 354 drivers/regulator/fan53555.c di->mode_mask = CTL_MODE_VSEL0_MODE; di 360 drivers/regulator/fan53555.c di->mode_reg = di->vol_reg; di 361 drivers/regulator/fan53555.c di->mode_mask = VSEL_MODE; di 364 drivers/regulator/fan53555.c dev_err(di->dev, "vendor %d not supported!\n", di->vendor); di 369 drivers/regulator/fan53555.c switch (di->vendor) { di 371 drivers/regulator/fan53555.c ret = fan53526_voltages_setup_fairchild(di); di 374 drivers/regulator/fan53555.c ret = fan53555_voltages_setup_fairchild(di); di 377 drivers/regulator/fan53555.c ret = fan53555_voltages_setup_silergy(di); di 380 drivers/regulator/fan53555.c dev_err(di->dev, "vendor %d not supported!\n", di->vendor); di 387 drivers/regulator/fan53555.c static int fan53555_regulator_register(struct fan53555_device_info *di, di 390 drivers/regulator/fan53555.c struct regulator_desc *rdesc = &di->desc; di 397 drivers/regulator/fan53555.c rdesc->n_voltages = di->vsel_count; di 398 drivers/regulator/fan53555.c rdesc->enable_reg = di->vol_reg; di 400 drivers/regulator/fan53555.c rdesc->min_uV = di->vsel_min; di 401 drivers/regulator/fan53555.c rdesc->uV_step = di->vsel_step; di 402 drivers/regulator/fan53555.c rdesc->vsel_reg = di->vol_reg; di 403 drivers/regulator/fan53555.c rdesc->vsel_mask = di->vsel_count - 1; di 406 drivers/regulator/fan53555.c rdev = devm_regulator_register(di->dev, &di->desc, config); di 459 drivers/regulator/fan53555.c struct fan53555_device_info *di; di 466 drivers/regulator/fan53555.c di = devm_kzalloc(&client->dev, sizeof(struct fan53555_device_info), di 468 drivers/regulator/fan53555.c if (!di) di 473 drivers/regulator/fan53555.c pdata = fan53555_parse_dt(&client->dev, np, &di->desc); di 480 drivers/regulator/fan53555.c di->regulator = pdata->regulator; di 482 drivers/regulator/fan53555.c di->vendor = di 486 drivers/regulator/fan53555.c if (!di->regulator->constraints.ramp_delay) { di 492 drivers/regulator/fan53555.c di->regulator->constraints.ramp_delay di 496 drivers/regulator/fan53555.c di->vendor = id->driver_data; di 504 drivers/regulator/fan53555.c di->dev = &client->dev; di 505 drivers/regulator/fan53555.c i2c_set_clientdata(client, di); di 512 drivers/regulator/fan53555.c di->chip_id = val & DIE_ID; di 519 drivers/regulator/fan53555.c di->chip_rev = val & DIE_REV; di 521 drivers/regulator/fan53555.c di->chip_id, di->chip_rev); di 523 drivers/regulator/fan53555.c ret = fan53555_device_setup(di, pdata); di 529 drivers/regulator/fan53555.c config.dev = di->dev; di 530 drivers/regulator/fan53555.c config.init_data = di->regulator; di 532 drivers/regulator/fan53555.c config.driver_data = di; di 535 drivers/regulator/fan53555.c ret = fan53555_regulator_register(di, &config); di 39 drivers/regulator/sy8824x.c struct sy8824_device_info *di = rdev_get_drvdata(rdev); di 40 drivers/regulator/sy8824x.c const struct sy8824_config *cfg = di->cfg; di 59 drivers/regulator/sy8824x.c struct sy8824_device_info *di = rdev_get_drvdata(rdev); di 60 drivers/regulator/sy8824x.c const struct sy8824_config *cfg = di->cfg; di 86 drivers/regulator/sy8824x.c static int sy8824_regulator_register(struct sy8824_device_info *di, di 89 drivers/regulator/sy8824x.c struct regulator_desc *rdesc = &di->desc; di 90 drivers/regulator/sy8824x.c const struct sy8824_config *cfg = di->cfg; di 106 drivers/regulator/sy8824x.c rdev = devm_regulator_register(di->dev, &di->desc, config); di 120 drivers/regulator/sy8824x.c struct sy8824_device_info *di; di 125 drivers/regulator/sy8824x.c di = devm_kzalloc(dev, sizeof(struct sy8824_device_info), GFP_KERNEL); di 126 drivers/regulator/sy8824x.c if (!di) di 129 drivers/regulator/sy8824x.c di->regulator = of_get_regulator_init_data(dev, np, &di->desc); di 130 drivers/regulator/sy8824x.c if (!di->regulator) { di 135 drivers/regulator/sy8824x.c di->dev = dev; di 136 drivers/regulator/sy8824x.c di->cfg = of_device_get_match_data(dev); di 143 drivers/regulator/sy8824x.c i2c_set_clientdata(client, di); di 145 drivers/regulator/sy8824x.c config.dev = di->dev; di 146 drivers/regulator/sy8824x.c config.init_data = di->regulator; di 148 drivers/regulator/sy8824x.c config.driver_data = di; di 151 drivers/regulator/sy8824x.c ret = sy8824_regulator_register(di, &config); di 34 drivers/s390/char/sclp_sd.c u8 di; di 91 drivers/s390/char/sclp_sd.c u8 di; di 188 drivers/s390/char/sclp_sd.c static int sclp_sd_sync(unsigned long page, u8 eq, u8 di, u64 sat, u64 sa, di 206 drivers/s390/char/sclp_sd.c evbuf->di = di; di 215 drivers/s390/char/sclp_sd.c pr_debug("request (eq=%d, di=%d, id=0x%08x)\n", eq, di, listener.id); di 260 drivers/s390/char/sclp_sd.c eq, di, sccb->hdr.response_code, evbuf->hdr.flags, di 284 drivers/s390/char/sclp_sd.c static int sclp_sd_store_data(struct sclp_sd_data *result, u8 di) di 296 drivers/s390/char/sclp_sd.c rc = sclp_sd_sync(page, SD_EQ_SIZE, di, 0, 0, &dsize, &esize); di 318 drivers/s390/char/sclp_sd.c rc = sclp_sd_sync(page, SD_EQ_STORE_DATA, di, asce, (u64) data, &dsize, di 323 drivers/s390/char/sclp_sd.c sclp_sd_sync(page, SD_EQ_HALT, di, 0, 0, NULL, NULL); di 382 drivers/s390/char/sclp_sd.c rc = sclp_sd_store_data(&data, sd_file->di); di 495 drivers/s390/char/sclp_sd.c static __init struct sclp_sd_file *sclp_sd_file_create(const char *name, u8 di) di 503 drivers/s390/char/sclp_sd.c sd_file->di = di; di 108 drivers/s390/char/vmur.h #define CCWDEV_CU_DI(cutype, di) \ di 109 drivers/s390/char/vmur.h CCW_DEVICE(cutype, 0x00), .driver_info = (di) di 109 drivers/scsi/aha1740.h :6, di:1, /* Disable Interrupt */ di 269 drivers/staging/wusbcore/cbaf.c struct wusb_cbaf_device_info *di; di 272 drivers/staging/wusbcore/cbaf.c di = cbaf->buffer; di 278 drivers/staging/wusbcore/cbaf.c di, cbaf->buffer_size, USB_CTRL_GET_TIMEOUT); di 285 drivers/staging/wusbcore/cbaf.c needed = result < sizeof(*di) ? sizeof(*di) : le32_to_cpu(di->Length); di 292 drivers/staging/wusbcore/cbaf.c strlcpy(cbaf->device_name, di->DeviceFriendlyName, CBA_NAME_LEN); di 293 drivers/staging/wusbcore/cbaf.c cbaf->cdid = di->CDID; di 294 drivers/staging/wusbcore/cbaf.c cbaf->device_band_groups = le16_to_cpu(di->BandGroups); di 81 drivers/staging/wusbcore/host/whci/debug.c struct di_buf_entry *di = &whc->di_buf[d]; di 85 drivers/staging/wusbcore/host/whci/debug.c UWB_NUM_MAS, (unsigned long *)di->availability_info); di 87 drivers/staging/wusbcore/host/whci/debug.c (di->addr_sec_info & WHC_DI_SECURE) ? 'S' : ' ', di 88 drivers/staging/wusbcore/host/whci/debug.c (di->addr_sec_info & WHC_DI_DISABLE) ? 'D' : ' ', di 89 drivers/staging/wusbcore/host/whci/debug.c (di->addr_sec_info & WHC_DI_KEY_IDX_MASK) >> 8, di 90 drivers/staging/wusbcore/host/whci/debug.c (di->addr_sec_info & WHC_DI_DEV_ADDR_MASK)); di 94 drivers/staging/wusbcore/host/whci/debug.c DEFINE_SHOW_ATTRIBUTE(di); di 96 drivers/staging/wusbcore/host/whci/wusb.c struct di_buf_entry *di = &whc->di_buf[idx]; di 101 drivers/staging/wusbcore/host/whci/wusb.c uwb_mas_bm_copy_le(di->availability_info, &wusb_dev->availability); di 102 drivers/staging/wusbcore/host/whci/wusb.c di->addr_sec_info &= ~(WHC_DI_DISABLE | WHC_DI_DEV_ADDR_MASK); di 103 drivers/staging/wusbcore/host/whci/wusb.c di->addr_sec_info |= WHC_DI_DEV_ADDR(wusb_dev->addr); di 164 drivers/staging/wusbcore/host/whci/wusb.c struct di_buf_entry *di = &whc->di_buf[port_idx]; di 174 drivers/staging/wusbcore/host/whci/wusb.c di->addr_sec_info &= ~WHC_DI_KEY_IDX_MASK; di 175 drivers/staging/wusbcore/host/whci/wusb.c di->addr_sec_info |= WHC_DI_SECURE | WHC_DI_KEY_IDX(port_idx); di 177 drivers/staging/wusbcore/host/whci/wusb.c di->addr_sec_info &= ~WHC_DI_SECURE; di 767 drivers/usb/misc/sisusbvga/sisusb_init.c unsigned short si, di, bx, sf; di 819 drivers/usb/misc/sisusbvga/sisusb_init.c di = si; di 824 drivers/usb/misc/sisusbvga/sisusb_init.c table[di], table[bx], di 831 drivers/usb/misc/sisusbvga/sisusb_init.c table[di], table[si], di 2877 drivers/video/fbdev/sis/init.c unsigned short si, di, bx, sf; di 2927 drivers/video/fbdev/sis/init.c di = si; di 2931 drivers/video/fbdev/sis/init.c SiS_WriteDAC(SiS_Pr, DACData, sf, n, table[di], table[bx], table[si]); di 2936 drivers/video/fbdev/sis/init.c SiS_WriteDAC(SiS_Pr, DACData, sf, n, table[di], table[si], table[bx]); di 839 drivers/video/fbdev/tridentfb.c unsigned long fi, d, di; di 850 drivers/video/fbdev/tridentfb.c di = abs(fi - freq); di 851 drivers/video/fbdev/tridentfb.c if (di < d || (di == d && k == best_k)) { di 852 drivers/video/fbdev/tridentfb.c d = di; di 36 fs/bfs/inode.c struct bfs_inode *di; di 61 fs/bfs/inode.c di = (struct bfs_inode *)bh->b_data + off; di 63 fs/bfs/inode.c inode->i_mode = 0x0000FFFF & le32_to_cpu(di->i_mode); di 64 fs/bfs/inode.c if (le32_to_cpu(di->i_vtype) == BFS_VDIR) { di 68 fs/bfs/inode.c } else if (le32_to_cpu(di->i_vtype) == BFS_VREG) { di 75 fs/bfs/inode.c BFS_I(inode)->i_sblock = le32_to_cpu(di->i_sblock); di 76 fs/bfs/inode.c BFS_I(inode)->i_eblock = le32_to_cpu(di->i_eblock); di 77 fs/bfs/inode.c BFS_I(inode)->i_dsk_ino = le16_to_cpu(di->i_ino); di 78 fs/bfs/inode.c i_uid_write(inode, le32_to_cpu(di->i_uid)); di 79 fs/bfs/inode.c i_gid_write(inode, le32_to_cpu(di->i_gid)); di 80 fs/bfs/inode.c set_nlink(inode, le32_to_cpu(di->i_nlink)); di 81 fs/bfs/inode.c inode->i_size = BFS_FILESIZE(di); di 82 fs/bfs/inode.c inode->i_blocks = BFS_FILEBLOCKS(di); di 83 fs/bfs/inode.c inode->i_atime.tv_sec = le32_to_cpu(di->i_atime); di 84 fs/bfs/inode.c inode->i_mtime.tv_sec = le32_to_cpu(di->i_mtime); di 85 fs/bfs/inode.c inode->i_ctime.tv_sec = le32_to_cpu(di->i_ctime); di 122 fs/bfs/inode.c struct bfs_inode *di; di 128 fs/bfs/inode.c di = find_inode(inode->i_sb, ino, &bh); di 129 fs/bfs/inode.c if (IS_ERR(di)) di 130 fs/bfs/inode.c return PTR_ERR(di); di 135 fs/bfs/inode.c di->i_vtype = cpu_to_le32(BFS_VDIR); di 137 fs/bfs/inode.c di->i_vtype = cpu_to_le32(BFS_VREG); di 139 fs/bfs/inode.c di->i_ino = cpu_to_le16(ino); di 140 fs/bfs/inode.c di->i_mode = cpu_to_le32(inode->i_mode); di 141 fs/bfs/inode.c di->i_uid = cpu_to_le32(i_uid_read(inode)); di 142 fs/bfs/inode.c di->i_gid = cpu_to_le32(i_gid_read(inode)); di 143 fs/bfs/inode.c di->i_nlink = cpu_to_le32(inode->i_nlink); di 144 fs/bfs/inode.c di->i_atime = cpu_to_le32(inode->i_atime.tv_sec); di 145 fs/bfs/inode.c di->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec); di 146 fs/bfs/inode.c di->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec); di 148 fs/bfs/inode.c di->i_sblock = cpu_to_le32(i_sblock); di 149 fs/bfs/inode.c di->i_eblock = cpu_to_le32(BFS_I(inode)->i_eblock); di 150 fs/bfs/inode.c di->i_eoffset = cpu_to_le32(i_sblock * BFS_BSIZE + inode->i_size - 1); di 166 fs/bfs/inode.c struct bfs_inode *di; di 181 fs/bfs/inode.c di = find_inode(s, inode->i_ino, &bh); di 182 fs/bfs/inode.c if (IS_ERR(di)) di 187 fs/bfs/inode.c memset(di, 0, sizeof(struct bfs_inode)); di 390 fs/bfs/inode.c struct bfs_inode *di; di 403 fs/bfs/inode.c di = (struct bfs_inode *)bh->b_data + off; di 407 fs/bfs/inode.c i_eoff = le32_to_cpu(di->i_eoffset); di 408 fs/bfs/inode.c i_sblock = le32_to_cpu(di->i_sblock); di 409 fs/bfs/inode.c i_eblock = le32_to_cpu(di->i_eblock); di 425 fs/bfs/inode.c if (!di->i_ino) { di 430 fs/bfs/inode.c info->si_freeb -= BFS_FILEBLOCKS(di); di 432 fs/bfs/inode.c eblock = le32_to_cpu(di->i_eblock); di 2730 fs/btrfs/ctree.h struct btrfs_dir_item *di); di 1686 fs/btrfs/delayed-inode.c struct btrfs_dir_item *di; di 1713 fs/btrfs/delayed-inode.c di = (struct btrfs_dir_item *)curr->data; di 1714 fs/btrfs/delayed-inode.c name = (char *)(di + 1); di 1715 fs/btrfs/delayed-inode.c name_len = btrfs_stack_dir_name_len(di); di 1717 fs/btrfs/delayed-inode.c d_type = fs_ftype_to_dtype(di->type); di 1718 fs/btrfs/delayed-inode.c btrfs_disk_key_to_cpu(&location, &di->location); di 35 fs/btrfs/dir-item.c struct btrfs_dir_item *di; di 36 fs/btrfs/dir-item.c di = btrfs_match_dir_item_name(fs_info, path, name, name_len); di 37 fs/btrfs/dir-item.c if (di) di 209 fs/btrfs/dir-item.c struct btrfs_dir_item *di; di 237 fs/btrfs/dir-item.c di = btrfs_match_dir_item_name(root->fs_info, path, name, name_len); di 238 fs/btrfs/dir-item.c if (di) { di 248 fs/btrfs/dir-item.c data_size = sizeof(*di) + name_len; di 301 fs/btrfs/dir-item.c struct btrfs_dir_item *di; di 333 fs/btrfs/dir-item.c di = btrfs_match_dir_item_name(root->fs_info, path, di 335 fs/btrfs/dir-item.c if (di) di 336 fs/btrfs/dir-item.c return di; di 410 fs/btrfs/dir-item.c struct btrfs_dir_item *di) di 419 fs/btrfs/dir-item.c sub_item_len = sizeof(*di) + btrfs_dir_name_len(leaf, di) + di 420 fs/btrfs/dir-item.c btrfs_dir_data_len(leaf, di); di 426 fs/btrfs/dir-item.c unsigned long ptr = (unsigned long)di; di 4124 fs/btrfs/inode.c struct btrfs_dir_item *di; di 4136 fs/btrfs/inode.c di = btrfs_lookup_dir_item(trans, root, path, dir_ino, di 4138 fs/btrfs/inode.c if (IS_ERR_OR_NULL(di)) { di 4139 fs/btrfs/inode.c ret = di ? PTR_ERR(di) : -ENOENT; di 4142 fs/btrfs/inode.c ret = btrfs_delete_one_dir_name(trans, root, path, di); di 4295 fs/btrfs/inode.c struct btrfs_dir_item *di; di 4317 fs/btrfs/inode.c di = btrfs_lookup_dir_item(trans, root, path, dir_ino, di 4319 fs/btrfs/inode.c if (IS_ERR_OR_NULL(di)) { di 4320 fs/btrfs/inode.c ret = di ? PTR_ERR(di) : -ENOENT; di 4325 fs/btrfs/inode.c btrfs_dir_item_key_to_cpu(leaf, di, &key); di 4327 fs/btrfs/inode.c ret = btrfs_delete_one_dir_name(trans, root, path, di); di 4344 fs/btrfs/inode.c di = btrfs_search_dir_index_item(root, path, dir_ino, di 4346 fs/btrfs/inode.c if (IS_ERR_OR_NULL(di)) { di 4347 fs/btrfs/inode.c if (!di) di 4350 fs/btrfs/inode.c ret = PTR_ERR(di); di 4394 fs/btrfs/inode.c struct btrfs_dir_item *di; di 4405 fs/btrfs/inode.c di = btrfs_lookup_dir_item(NULL, fs_info->tree_root, path, di 4407 fs/btrfs/inode.c if (di && !IS_ERR(di)) { di 4408 fs/btrfs/inode.c btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key); di 5668 fs/btrfs/inode.c struct btrfs_dir_item *di; di 5677 fs/btrfs/inode.c di = btrfs_lookup_dir_item(NULL, root, path, btrfs_ino(BTRFS_I(dir)), di 5679 fs/btrfs/inode.c if (IS_ERR_OR_NULL(di)) { di 5680 fs/btrfs/inode.c ret = di ? PTR_ERR(di) : -ENOENT; di 5684 fs/btrfs/inode.c btrfs_dir_item_key_to_cpu(path->nodes[0], di, location); di 5694 fs/btrfs/inode.c *type = btrfs_dir_type(path->nodes[0], di); di 6094 fs/btrfs/inode.c struct btrfs_dir_item *di; di 6158 fs/btrfs/inode.c di = btrfs_item_ptr(leaf, slot, struct btrfs_dir_item); di 6159 fs/btrfs/inode.c name_len = btrfs_dir_name_len(leaf, di); di 6175 fs/btrfs/inode.c read_extent_buffer(leaf, name_ptr, (unsigned long)(di + 1), di 6177 fs/btrfs/inode.c put_unaligned(fs_ftype_to_dtype(btrfs_dir_type(leaf, di)), di 6179 fs/btrfs/inode.c btrfs_dir_item_key_to_cpu(leaf, di, &location); di 3957 fs/btrfs/ioctl.c struct btrfs_dir_item *di; di 4010 fs/btrfs/ioctl.c di = btrfs_lookup_dir_item(trans, fs_info->tree_root, path, di 4012 fs/btrfs/ioctl.c if (IS_ERR_OR_NULL(di)) { di 4022 fs/btrfs/ioctl.c btrfs_set_dir_item_key(path->nodes[0], di, &disk_key); di 173 fs/btrfs/print-tree.c struct btrfs_dir_item *di; di 210 fs/btrfs/print-tree.c di = btrfs_item_ptr(l, i, struct btrfs_dir_item); di 211 fs/btrfs/print-tree.c btrfs_dir_item_key_to_cpu(l, di, &found_key); di 214 fs/btrfs/print-tree.c btrfs_dir_type(l, di)); di 131 fs/btrfs/props.c struct btrfs_dir_item *di; di 159 fs/btrfs/props.c di = btrfs_item_ptr(leaf, slot, struct btrfs_dir_item); di 164 fs/btrfs/props.c u32 name_len = btrfs_dir_name_len(leaf, di); di 165 fs/btrfs/props.c u32 data_len = btrfs_dir_data_len(leaf, di); di 169 fs/btrfs/props.c this_len = sizeof(*di) + name_len + data_len; di 170 fs/btrfs/props.c name_ptr = (unsigned long)(di + 1); di 209 fs/btrfs/props.c di = (struct btrfs_dir_item *)((char *) di + this_len); di 1015 fs/btrfs/send.c struct btrfs_dir_item *di; di 1044 fs/btrfs/send.c di = btrfs_item_ptr(eb, slot, struct btrfs_dir_item); di 1051 fs/btrfs/send.c name_len = btrfs_dir_name_len(eb, di); di 1052 fs/btrfs/send.c data_len = btrfs_dir_data_len(eb, di); di 1053 fs/btrfs/send.c type = btrfs_dir_type(eb, di); di 1054 fs/btrfs/send.c btrfs_dir_item_key_to_cpu(eb, di, &di_key); di 1098 fs/btrfs/send.c read_extent_buffer(eb, buf, (unsigned long)(di + 1), di 1101 fs/btrfs/send.c len = sizeof(*di) + name_len + data_len; di 1102 fs/btrfs/send.c di = (struct btrfs_dir_item *)((char *)di + len); di 1543 fs/btrfs/send.c struct btrfs_dir_item *di; di 1557 fs/btrfs/send.c di = btrfs_lookup_dir_item(NULL, sctx->send_root, di 1561 fs/btrfs/send.c if (IS_ERR(di)) { di 1562 fs/btrfs/send.c ret = PTR_ERR(di); di 1565 fs/btrfs/send.c if (di) { di 1577 fs/btrfs/send.c di = btrfs_lookup_dir_item(NULL, sctx->parent_root, di 1581 fs/btrfs/send.c if (IS_ERR(di)) { di 1582 fs/btrfs/send.c ret = PTR_ERR(di); di 1585 fs/btrfs/send.c if (di) { di 1706 fs/btrfs/send.c struct btrfs_dir_item *di; di 1714 fs/btrfs/send.c di = btrfs_lookup_dir_item(NULL, root, path, di 1716 fs/btrfs/send.c if (IS_ERR_OR_NULL(di)) { di 1717 fs/btrfs/send.c ret = di ? PTR_ERR(di) : -ENOENT; di 1720 fs/btrfs/send.c btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key); di 1726 fs/btrfs/send.c *found_type = btrfs_dir_type(path->nodes[0], di); di 2679 fs/btrfs/send.c struct btrfs_dir_item *di; di 2716 fs/btrfs/send.c di = btrfs_item_ptr(eb, slot, struct btrfs_dir_item); di 2717 fs/btrfs/send.c btrfs_dir_item_key_to_cpu(eb, di, &di_key); di 2937 fs/btrfs/send.c struct btrfs_dir_item *di; di 2979 fs/btrfs/send.c di = btrfs_item_ptr(path->nodes[0], path->slots[0], di 2981 fs/btrfs/send.c btrfs_dir_item_key_to_cpu(path->nodes[0], di, &loc); di 3460 fs/btrfs/send.c struct btrfs_dir_item *di; di 3485 fs/btrfs/send.c di = btrfs_match_dir_item_name(fs_info, path, parent_ref->name, di 3487 fs/btrfs/send.c if (!di) { di 3499 fs/btrfs/send.c btrfs_dir_item_key_to_cpu(path->nodes[0], di, &di_key); di 1147 fs/btrfs/super.c struct btrfs_dir_item *di; di 1163 fs/btrfs/super.c di = btrfs_lookup_dir_item(NULL, root, path, dir_id, "default", 7, 0); di 1164 fs/btrfs/super.c if (IS_ERR(di)) { di 1166 fs/btrfs/super.c return PTR_ERR(di); di 1168 fs/btrfs/super.c if (!di) { di 1179 fs/btrfs/super.c btrfs_dir_item_key_to_cpu(path->nodes[0], di, &location); di 319 fs/btrfs/tree-checker.c struct btrfs_dir_item *di; di 323 fs/btrfs/tree-checker.c di = btrfs_item_ptr(leaf, slot, struct btrfs_dir_item); di 333 fs/btrfs/tree-checker.c if (cur + sizeof(*di) > item_size) { di 336 fs/btrfs/tree-checker.c cur + sizeof(*di), item_size); di 341 fs/btrfs/tree-checker.c dir_type = btrfs_dir_type(leaf, di); di 368 fs/btrfs/tree-checker.c name_len = btrfs_dir_name_len(leaf, di); di 369 fs/btrfs/tree-checker.c data_len = btrfs_dir_data_len(leaf, di); di 391 fs/btrfs/tree-checker.c total_size = sizeof(*di) + name_len + data_len; di 410 fs/btrfs/tree-checker.c (unsigned long)(di + 1), name_len); di 420 fs/btrfs/tree-checker.c di = (struct btrfs_dir_item *)((void *)di + total_size); di 854 fs/btrfs/tree-log.c struct btrfs_dir_item *di) di 865 fs/btrfs/tree-log.c btrfs_dir_item_key_to_cpu(leaf, di, &location); di 866 fs/btrfs/tree-log.c name_len = btrfs_dir_name_len(leaf, di); di 871 fs/btrfs/tree-log.c read_extent_buffer(leaf, name, (unsigned long)(di + 1), name_len); di 906 fs/btrfs/tree-log.c struct btrfs_dir_item *di; di 910 fs/btrfs/tree-log.c di = btrfs_lookup_dir_index_item(NULL, root, path, dirid, di 912 fs/btrfs/tree-log.c if (di && !IS_ERR(di)) { di 913 fs/btrfs/tree-log.c btrfs_dir_item_key_to_cpu(path->nodes[0], di, &location); di 920 fs/btrfs/tree-log.c di = btrfs_lookup_dir_item(NULL, root, path, dirid, name, name_len, 0); di 921 fs/btrfs/tree-log.c if (di && !IS_ERR(di)) { di 922 fs/btrfs/tree-log.c btrfs_dir_item_key_to_cpu(path->nodes[0], di, &location); di 1013 fs/btrfs/tree-log.c struct btrfs_dir_item *di; di 1155 fs/btrfs/tree-log.c di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir), di 1157 fs/btrfs/tree-log.c if (di && !IS_ERR(di)) { di 1158 fs/btrfs/tree-log.c ret = drop_one_dir_item(trans, root, path, dir, di); di 1165 fs/btrfs/tree-log.c di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir), di 1167 fs/btrfs/tree-log.c if (di && !IS_ERR(di)) { di 1168 fs/btrfs/tree-log.c ret = drop_one_dir_item(trans, root, path, dir, di); di 1932 fs/btrfs/tree-log.c struct btrfs_dir_item *di, di 1951 fs/btrfs/tree-log.c name_len = btrfs_dir_name_len(eb, di); di 1958 fs/btrfs/tree-log.c log_type = btrfs_dir_type(eb, di); di 1959 fs/btrfs/tree-log.c read_extent_buffer(eb, name, (unsigned long)(di + 1), di 1962 fs/btrfs/tree-log.c btrfs_dir_item_key_to_cpu(eb, di, &log_key); di 2061 fs/btrfs/tree-log.c struct btrfs_dir_item *di; di 2070 fs/btrfs/tree-log.c di = (struct btrfs_dir_item *)ptr; di 2071 fs/btrfs/tree-log.c name_len = btrfs_dir_name_len(eb, di); di 2072 fs/btrfs/tree-log.c ret = replay_one_name(trans, root, path, eb, di, key); di 2075 fs/btrfs/tree-log.c ptr = (unsigned long)(di + 1); di 2105 fs/btrfs/tree-log.c if (ret == 1 && btrfs_dir_type(eb, di) != BTRFS_FT_DIR) { di 2116 fs/btrfs/tree-log.c btrfs_dir_item_key_to_cpu(eb, di, &di_key); di 2227 fs/btrfs/tree-log.c struct btrfs_dir_item *di; di 2243 fs/btrfs/tree-log.c di = (struct btrfs_dir_item *)ptr; di 2244 fs/btrfs/tree-log.c name_len = btrfs_dir_name_len(eb, di); di 2250 fs/btrfs/tree-log.c read_extent_buffer(eb, name, (unsigned long)(di + 1), di 2265 fs/btrfs/tree-log.c btrfs_dir_item_key_to_cpu(eb, di, &location); di 2308 fs/btrfs/tree-log.c ptr = (unsigned long)(di + 1); di 2345 fs/btrfs/tree-log.c struct btrfs_dir_item *di; di 2356 fs/btrfs/tree-log.c di = btrfs_item_ptr(path->nodes[0], i, struct btrfs_dir_item); di 2360 fs/btrfs/tree-log.c u16 name_len = btrfs_dir_name_len(path->nodes[0], di); di 2361 fs/btrfs/tree-log.c u16 data_len = btrfs_dir_data_len(path->nodes[0], di); di 2362 fs/btrfs/tree-log.c u32 this_len = sizeof(*di) + name_len + data_len; di 2371 fs/btrfs/tree-log.c (unsigned long)(di + 1), name_len); di 2379 fs/btrfs/tree-log.c di = btrfs_lookup_xattr(trans, root, path, ino, di 2382 fs/btrfs/tree-log.c if (IS_ERR(di)) { di 2383 fs/btrfs/tree-log.c ret = PTR_ERR(di); di 2386 fs/btrfs/tree-log.c ASSERT(di); di 2388 fs/btrfs/tree-log.c path, di); di 2401 fs/btrfs/tree-log.c di = (struct btrfs_dir_item *)((char *)di + this_len); di 3395 fs/btrfs/tree-log.c struct btrfs_dir_item *di; di 3418 fs/btrfs/tree-log.c di = btrfs_lookup_dir_item(trans, log, path, dir_ino, di 3420 fs/btrfs/tree-log.c if (IS_ERR(di)) { di 3421 fs/btrfs/tree-log.c err = PTR_ERR(di); di 3424 fs/btrfs/tree-log.c if (di) { di 3425 fs/btrfs/tree-log.c ret = btrfs_delete_one_dir_name(trans, log, path, di); di 3433 fs/btrfs/tree-log.c di = btrfs_lookup_dir_index_item(trans, log, path, dir_ino, di 3435 fs/btrfs/tree-log.c if (IS_ERR(di)) { di 3436 fs/btrfs/tree-log.c err = PTR_ERR(di); di 3439 fs/btrfs/tree-log.c if (di) { di 3440 fs/btrfs/tree-log.c ret = btrfs_delete_one_dir_name(trans, log, path, di); di 3662 fs/btrfs/tree-log.c struct btrfs_dir_item *di; di 3698 fs/btrfs/tree-log.c di = btrfs_item_ptr(src, i, struct btrfs_dir_item); di 3699 fs/btrfs/tree-log.c btrfs_dir_item_key_to_cpu(src, di, &tmp); di 3701 fs/btrfs/tree-log.c (btrfs_dir_transid(src, di) == trans->transid || di 3702 fs/btrfs/tree-log.c btrfs_dir_type(src, di) == BTRFS_FT_DIR) && di 4760 fs/btrfs/tree-log.c struct btrfs_dir_item *di; di 4794 fs/btrfs/tree-log.c di = btrfs_lookup_dir_item(NULL, inode->root, search_path, di 4796 fs/btrfs/tree-log.c if (di && !IS_ERR(di)) { di 4800 fs/btrfs/tree-log.c di, &di_key); di 4813 fs/btrfs/tree-log.c } else if (IS_ERR(di)) { di 4814 fs/btrfs/tree-log.c ret = PTR_ERR(di); di 5596 fs/btrfs/tree-log.c struct btrfs_dir_item *di; di 5608 fs/btrfs/tree-log.c di = btrfs_item_ptr(leaf, i, struct btrfs_dir_item); di 5609 fs/btrfs/tree-log.c type = btrfs_dir_type(leaf, di); di 5610 fs/btrfs/tree-log.c if (btrfs_dir_transid(leaf, di) < trans->transid && di 5613 fs/btrfs/tree-log.c btrfs_dir_item_key_to_cpu(leaf, di, &di_key); di 26 fs/btrfs/xattr.c struct btrfs_dir_item *di; di 38 fs/btrfs/xattr.c di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(BTRFS_I(inode)), di 40 fs/btrfs/xattr.c if (!di) { di 43 fs/btrfs/xattr.c } else if (IS_ERR(di)) { di 44 fs/btrfs/xattr.c ret = PTR_ERR(di); di 51 fs/btrfs/xattr.c ret = btrfs_dir_data_len(leaf, di); di 56 fs/btrfs/xattr.c if (btrfs_dir_data_len(leaf, di) > size) { di 68 fs/btrfs/xattr.c data_ptr = (unsigned long)((char *)(di + 1) + di 69 fs/btrfs/xattr.c btrfs_dir_name_len(leaf, di)); di 71 fs/btrfs/xattr.c btrfs_dir_data_len(leaf, di)); di 72 fs/btrfs/xattr.c ret = btrfs_dir_data_len(leaf, di); di 82 fs/btrfs/xattr.c struct btrfs_dir_item *di = NULL; di 100 fs/btrfs/xattr.c di = btrfs_lookup_xattr(trans, root, path, di 102 fs/btrfs/xattr.c if (!di && (flags & XATTR_REPLACE)) di 104 fs/btrfs/xattr.c else if (IS_ERR(di)) di 105 fs/btrfs/xattr.c ret = PTR_ERR(di); di 106 fs/btrfs/xattr.c else if (di) di 107 fs/btrfs/xattr.c ret = btrfs_delete_one_dir_name(trans, root, path, di); di 120 fs/btrfs/xattr.c di = btrfs_lookup_xattr(NULL, root, path, di 122 fs/btrfs/xattr.c if (!di) di 124 fs/btrfs/xattr.c else if (IS_ERR(di)) di 125 fs/btrfs/xattr.c ret = PTR_ERR(di); di 129 fs/btrfs/xattr.c di = NULL; di 142 fs/btrfs/xattr.c di = btrfs_match_dir_item_name(fs_info, path, name, name_len); di 143 fs/btrfs/xattr.c if (!di && !(flags & XATTR_REPLACE)) { di 149 fs/btrfs/xattr.c di = btrfs_match_dir_item_name(fs_info, path, name, name_len); di 150 fs/btrfs/xattr.c ASSERT(di); /* logic error */ di 155 fs/btrfs/xattr.c if (di && (flags & XATTR_CREATE)) { di 160 fs/btrfs/xattr.c if (di) { di 170 fs/btrfs/xattr.c const u16 old_data_len = btrfs_dir_data_len(leaf, di); di 172 fs/btrfs/xattr.c const u32 data_size = sizeof(*di) + name_len + size; di 185 fs/btrfs/xattr.c if (old_data_len + name_len + sizeof(*di) == item_size) { di 193 fs/btrfs/xattr.c ret = btrfs_delete_one_dir_name(trans, root, path, di); di 202 fs/btrfs/xattr.c di = (struct btrfs_dir_item *)ptr; di 203 fs/btrfs/xattr.c btrfs_set_dir_data_len(leaf, di, size); di 204 fs/btrfs/xattr.c data_ptr = ((unsigned long)(di + 1)) + name_len; di 280 fs/btrfs/xattr.c struct btrfs_dir_item *di; di 312 fs/btrfs/xattr.c di = btrfs_item_ptr(leaf, slot, struct btrfs_dir_item); di 316 fs/btrfs/xattr.c u16 name_len = btrfs_dir_name_len(leaf, di); di 317 fs/btrfs/xattr.c u16 data_len = btrfs_dir_data_len(leaf, di); di 318 fs/btrfs/xattr.c u32 this_len = sizeof(*di) + name_len + data_len; di 319 fs/btrfs/xattr.c unsigned long name_ptr = (unsigned long)(di + 1); di 341 fs/btrfs/xattr.c di = (struct btrfs_dir_item *)((char *)di + this_len); di 4246 fs/ceph/caps.c struct ceph_dentry_info *di = ceph_dentry(dentry); di 4257 fs/ceph/caps.c if (di->lease_session && di->lease_session->s_mds == mds) di 4269 fs/ceph/caps.c if (ret && di->lease_session && di->lease_session->s_mds == mds) { di 4271 fs/ceph/caps.c dentry, mds, (int)di->lease_seq); di 4275 fs/ceph/caps.c rel->dname_seq = cpu_to_le32(di->lease_seq); di 32 fs/ceph/dir.c static bool __dentry_lease_is_valid(struct ceph_dentry_info *di); di 40 fs/ceph/dir.c struct ceph_dentry_info *di; di 42 fs/ceph/dir.c di = kmem_cache_zalloc(ceph_dentry_cachep, GFP_KERNEL); di 43 fs/ceph/dir.c if (!di) di 46 fs/ceph/dir.c di->dentry = dentry; di 47 fs/ceph/dir.c di->lease_session = NULL; di 48 fs/ceph/dir.c di->time = jiffies; di 49 fs/ceph/dir.c dentry->d_fsdata = di; di 50 fs/ceph/dir.c INIT_LIST_HEAD(&di->lease_list); di 184 fs/ceph/dir.c struct ceph_dentry_info *di; di 207 fs/ceph/dir.c di = ceph_dentry(dentry); di 209 fs/ceph/dir.c if (fpos_cmp(di->offset, ctx->pos) < 0) { di 237 fs/ceph/dir.c di = ceph_dentry(dentry); di 240 fs/ceph/dir.c di->lease_shared_gen != shared_gen) { di 246 fs/ceph/dir.c if (fpos_cmp(ctx->pos, di->offset) <= 0) { di 247 fs/ceph/dir.c __ceph_dentry_dir_lease_touch(di); di 253 fs/ceph/dir.c dout(" %llx dentry %p %pd %p\n", di->offset, di 255 fs/ceph/dir.c ctx->pos = di->offset; di 278 fs/ceph/dir.c di = ceph_dentry(last); di 280 fs/ceph/dir.c fpos_off(di->offset) + 1); di 752 fs/ceph/dir.c struct ceph_dentry_info *di = ceph_dentry(dentry); di 766 fs/ceph/dir.c di->lease_shared_gen = atomic_read(&ci->i_shared_gen); di 1150 fs/ceph/dir.c void __ceph_dentry_lease_touch(struct ceph_dentry_info *di) di 1152 fs/ceph/dir.c struct dentry *dn = di->dentry; di 1155 fs/ceph/dir.c dout("dentry_lease_touch %p %p '%pd'\n", di, dn, dn); di 1157 fs/ceph/dir.c di->flags |= CEPH_DENTRY_LEASE_LIST; di 1158 fs/ceph/dir.c if (di->flags & CEPH_DENTRY_SHRINK_LIST) { di 1159 fs/ceph/dir.c di->flags |= CEPH_DENTRY_REFERENCED; di 1165 fs/ceph/dir.c list_move_tail(&di->lease_list, &mdsc->dentry_leases); di 1170 fs/ceph/dir.c struct ceph_dentry_info *di) di 1172 fs/ceph/dir.c di->flags &= ~(CEPH_DENTRY_LEASE_LIST | CEPH_DENTRY_REFERENCED); di 1173 fs/ceph/dir.c di->lease_gen = 0; di 1174 fs/ceph/dir.c di->time = jiffies; di 1175 fs/ceph/dir.c list_move_tail(&di->lease_list, &mdsc->dentry_dir_leases); di 1184 fs/ceph/dir.c void __ceph_dentry_dir_lease_touch(struct ceph_dentry_info *di) di 1186 fs/ceph/dir.c struct dentry *dn = di->dentry; di 1190 fs/ceph/dir.c di, dn, dn, di->offset); di 1192 fs/ceph/dir.c if (!list_empty(&di->lease_list)) { di 1193 fs/ceph/dir.c if (di->flags & CEPH_DENTRY_LEASE_LIST) { di 1196 fs/ceph/dir.c if (__dentry_lease_is_valid(di)) di 1199 fs/ceph/dir.c di->flags |= CEPH_DENTRY_REFERENCED; di 1204 fs/ceph/dir.c if (di->flags & CEPH_DENTRY_SHRINK_LIST) { di 1205 fs/ceph/dir.c di->flags |= CEPH_DENTRY_REFERENCED; di 1206 fs/ceph/dir.c di->flags &= ~CEPH_DENTRY_LEASE_LIST; di 1212 fs/ceph/dir.c __dentry_dir_lease_touch(mdsc, di), di 1216 fs/ceph/dir.c static void __dentry_lease_unlist(struct ceph_dentry_info *di) di 1219 fs/ceph/dir.c if (di->flags & CEPH_DENTRY_SHRINK_LIST) di 1221 fs/ceph/dir.c if (list_empty(&di->lease_list)) di 1224 fs/ceph/dir.c mdsc = ceph_sb_to_client(di->dentry->d_sb)->mdsc; di 1226 fs/ceph/dir.c list_del_init(&di->lease_list); di 1249 fs/ceph/dir.c struct ceph_dentry_info *di, *tmp; di 1258 fs/ceph/dir.c list_for_each_entry_safe(di, tmp, list, lease_list) { di 1263 fs/ceph/dir.c dentry = di->dentry; di 1271 fs/ceph/dir.c list_del_init(&di->lease_list); di 1278 fs/ceph/dir.c __dentry_dir_lease_touch(mdsc, di); di 1284 fs/ceph/dir.c di->flags &= ~CEPH_DENTRY_REFERENCED; di 1290 fs/ceph/dir.c list_del_init(&di->lease_list); di 1292 fs/ceph/dir.c di->flags |= CEPH_DENTRY_SHRINK_LIST; di 1293 fs/ceph/dir.c list_move_tail(&di->lease_list, &dispose); di 1305 fs/ceph/dir.c di = list_first_entry(&dispose, struct ceph_dentry_info, di 1307 fs/ceph/dir.c dentry = di->dentry; di 1310 fs/ceph/dir.c list_del_init(&di->lease_list); di 1311 fs/ceph/dir.c di->flags &= ~CEPH_DENTRY_SHRINK_LIST; di 1312 fs/ceph/dir.c if (di->flags & CEPH_DENTRY_REFERENCED) { di 1314 fs/ceph/dir.c if (di->flags & CEPH_DENTRY_LEASE_LIST) { di 1315 fs/ceph/dir.c list_add_tail(&di->lease_list, di 1318 fs/ceph/dir.c __dentry_dir_lease_touch(mdsc, di); di 1334 fs/ceph/dir.c struct ceph_dentry_info *di = ceph_dentry(dentry); di 1337 fs/ceph/dir.c if (__dentry_lease_is_valid(di)) di 1350 fs/ceph/dir.c struct ceph_dentry_info *di = ceph_dentry(dentry); di 1356 fs/ceph/dir.c if (time_before(jiffies, di->time + lwc->dir_lease_ttl)) di 1364 fs/ceph/dir.c (di->flags & CEPH_DENTRY_REFERENCED)) di 1367 fs/ceph/dir.c di->lease_shared_gen = 0; di 1410 fs/ceph/dir.c struct ceph_dentry_info *di = ceph_dentry(dentry); di 1412 fs/ceph/dir.c di->time = jiffies; di 1413 fs/ceph/dir.c di->lease_shared_gen = 0; di 1414 fs/ceph/dir.c __dentry_lease_unlist(di); di 1422 fs/ceph/dir.c static bool __dentry_lease_is_valid(struct ceph_dentry_info *di) di 1426 fs/ceph/dir.c if (!di->lease_gen) di 1429 fs/ceph/dir.c session = di->lease_session; di 1439 fs/ceph/dir.c if (di->lease_gen == gen && di 1441 fs/ceph/dir.c time_before(jiffies, di->time)) di 1444 fs/ceph/dir.c di->lease_gen = 0; di 1450 fs/ceph/dir.c struct ceph_dentry_info *di; di 1456 fs/ceph/dir.c di = ceph_dentry(dentry); di 1457 fs/ceph/dir.c if (di && __dentry_lease_is_valid(di)) { di 1460 fs/ceph/dir.c if (di->lease_renew_after && di 1461 fs/ceph/dir.c time_after(jiffies, di->lease_renew_after)) { di 1470 fs/ceph/dir.c session = ceph_get_mds_session(di->lease_session); di 1471 fs/ceph/dir.c seq = di->lease_seq; di 1472 fs/ceph/dir.c di->lease_renew_after = 0; di 1473 fs/ceph/dir.c di->lease_renew_from = jiffies; di 1493 fs/ceph/dir.c struct ceph_dentry_info *di = ceph_dentry(dentry); di 1498 fs/ceph/dir.c if (!di->lease_shared_gen) di 1507 fs/ceph/dir.c if (atomic_read(&ci->i_shared_gen) == di->lease_shared_gen && di 1516 fs/ceph/dir.c di->lease_shared_gen = 0; di 1534 fs/ceph/dir.c struct ceph_dentry_info *di; di 1536 fs/ceph/dir.c di = ceph_dentry(dentry); di 1538 fs/ceph/dir.c di && di->lease_shared_gen == shared_gen) di 1539 fs/ceph/dir.c __ceph_dentry_dir_lease_touch(di); di 1651 fs/ceph/dir.c struct ceph_dentry_info *di; di 1659 fs/ceph/dir.c di = ceph_dentry(dentry); di 1660 fs/ceph/dir.c if (di) { di 1661 fs/ceph/dir.c if (__dentry_lease_is_valid(di)) di 1674 fs/ceph/dir.c struct ceph_dentry_info *di = ceph_dentry(dentry); di 1679 fs/ceph/dir.c __dentry_lease_unlist(di); di 1683 fs/ceph/dir.c if (di->lease_session) di 1684 fs/ceph/dir.c ceph_put_mds_session(di->lease_session); di 1685 fs/ceph/dir.c kmem_cache_free(ceph_dentry_cachep, di); di 1697 fs/ceph/dir.c struct ceph_dentry_info *di; di 1723 fs/ceph/dir.c di = ceph_dentry(dentry); di 1724 fs/ceph/dir.c if (di->offset > 0 && di 1725 fs/ceph/dir.c di->lease_shared_gen == atomic_read(&dir_ci->i_shared_gen)) di 1048 fs/ceph/inode.c struct ceph_dentry_info *di = ceph_dentry(dentry); di 1060 fs/ceph/inode.c di->lease_shared_gen = atomic_read(&ceph_inode(dir)->i_shared_gen); di 1062 fs/ceph/inode.c __ceph_dentry_dir_lease_touch(di); di 1066 fs/ceph/inode.c if (di->lease_gen == session->s_cap_gen && di 1067 fs/ceph/inode.c time_before(ttl, di->time)) di 1070 fs/ceph/inode.c if (di->lease_session && di->lease_session != session) { di 1071 fs/ceph/inode.c *old_lease_session = di->lease_session; di 1072 fs/ceph/inode.c di->lease_session = NULL; di 1075 fs/ceph/inode.c if (!di->lease_session) di 1076 fs/ceph/inode.c di->lease_session = ceph_get_mds_session(session); di 1077 fs/ceph/inode.c di->lease_gen = session->s_cap_gen; di 1078 fs/ceph/inode.c di->lease_seq = le32_to_cpu(lease->seq); di 1079 fs/ceph/inode.c di->lease_renew_after = half_ttl; di 1080 fs/ceph/inode.c di->lease_renew_from = 0; di 1081 fs/ceph/inode.c di->time = ttl; di 1083 fs/ceph/inode.c __ceph_dentry_lease_touch(di); di 1164 fs/ceph/inode.c struct ceph_dentry_info *di = ceph_dentry(realdn); di 1169 fs/ceph/inode.c di->time = jiffies; di 1170 fs/ceph/inode.c di->lease_shared_gen = 0; di 1171 fs/ceph/inode.c di->offset = 0; di 1664 fs/ceph/inode.c struct ceph_dentry_info *di = ceph_dentry(dn); di 1669 fs/ceph/inode.c if (di->offset > 0 && di 1670 fs/ceph/inode.c di->lease_shared_gen == di 1673 fs/ceph/inode.c di->offset = 0; di 3856 fs/ceph/mds_client.c struct ceph_dentry_info *di = ceph_dentry(dentry); di 3858 fs/ceph/mds_client.c ceph_put_mds_session(di->lease_session); di 3859 fs/ceph/mds_client.c di->lease_session = NULL; di 3869 fs/ceph/mds_client.c struct ceph_dentry_info *di; di 3918 fs/ceph/mds_client.c di = ceph_dentry(dentry); di 3921 fs/ceph/mds_client.c if (di->lease_session == session) { di 3922 fs/ceph/mds_client.c if (ceph_seq_cmp(di->lease_seq, seq) > 0) di 3923 fs/ceph/mds_client.c h->seq = cpu_to_le32(di->lease_seq); di 3930 fs/ceph/mds_client.c if (di->lease_session == session && di 3931 fs/ceph/mds_client.c di->lease_gen == session->s_cap_gen && di 3932 fs/ceph/mds_client.c di->lease_renew_from && di 3933 fs/ceph/mds_client.c di->lease_renew_after == 0) { di 3937 fs/ceph/mds_client.c di->lease_seq = seq; di 3938 fs/ceph/mds_client.c di->time = di->lease_renew_from + duration; di 3939 fs/ceph/mds_client.c di->lease_renew_after = di->lease_renew_from + di 3941 fs/ceph/mds_client.c di->lease_renew_from = 0; di 1117 fs/ceph/super.h extern void __ceph_dentry_lease_touch(struct ceph_dentry_info *di); di 1118 fs/ceph/super.h extern void __ceph_dentry_dir_lease_touch(struct ceph_dentry_info *di); di 151 fs/erofs/zmap.c struct z_erofs_vle_decompressed_index *di; di 160 fs/erofs/zmap.c di = m->kaddr + erofs_blkoff(pos); di 162 fs/erofs/zmap.c advise = le16_to_cpu(di->di_advise); di 168 fs/erofs/zmap.c m->delta[0] = le16_to_cpu(di->di_u.delta[0]); di 169 fs/erofs/zmap.c m->delta[1] = le16_to_cpu(di->di_u.delta[1]); di 173 fs/erofs/zmap.c m->clusterofs = le16_to_cpu(di->di_clusterofs); di 174 fs/erofs/zmap.c m->pblk = le32_to_cpu(di->di_u.blkaddr); di 294 fs/f2fs/f2fs.h struct discard_info di; /* discard info */ di 1259 fs/f2fs/segment.c struct discard_info di = dc->di; di 1267 fs/f2fs/segment.c dcc->undiscard_blks -= di.len; di 1269 fs/f2fs/segment.c if (blkaddr > di.lstart) { di 1276 fs/f2fs/segment.c if (blkaddr < di.lstart + di.len - 1) { di 1279 fs/f2fs/segment.c di.start + blkaddr + 1 - di.lstart, di 1280 fs/f2fs/segment.c di.lstart + di.len - 1 - blkaddr, di 1299 fs/f2fs/segment.c struct discard_info di = {0}; di 1315 fs/f2fs/segment.c di.lstart = lstart; di 1316 fs/f2fs/segment.c di.len = next_dc ? next_dc->lstart - lstart : len; di 1317 fs/f2fs/segment.c di.len = min(di.len, len); di 1318 fs/f2fs/segment.c di.start = start; di 1327 fs/f2fs/segment.c di.lstart = prev_dc->lstart + prev_dc->len; di 1328 fs/f2fs/segment.c if (di.lstart < lstart) di 1329 fs/f2fs/segment.c di.lstart = lstart; di 1330 fs/f2fs/segment.c if (di.lstart >= end) di 1334 fs/f2fs/segment.c di.len = end - di.lstart; di 1336 fs/f2fs/segment.c di.len = next_dc->lstart - di.lstart; di 1337 fs/f2fs/segment.c di.start = start + di.lstart - lstart; di 1340 fs/f2fs/segment.c if (!di.len) di 1345 fs/f2fs/segment.c __is_discard_back_mergeable(&di, &prev_dc->di, di 1347 fs/f2fs/segment.c prev_dc->di.len += di.len; di 1348 fs/f2fs/segment.c dcc->undiscard_blks += di.len; di 1350 fs/f2fs/segment.c di = prev_dc->di; di 1357 fs/f2fs/segment.c __is_discard_front_mergeable(&di, &next_dc->di, di 1359 fs/f2fs/segment.c next_dc->di.lstart = di.lstart; di 1360 fs/f2fs/segment.c next_dc->di.len += di.len; di 1361 fs/f2fs/segment.c next_dc->di.start = di.start; di 1362 fs/f2fs/segment.c dcc->undiscard_blks += di.len; di 1370 fs/f2fs/segment.c __insert_discard_tree(sbi, bdev, di.lstart, di.start, di 1371 fs/f2fs/segment.c di.len, NULL, NULL); di 122 fs/gfs2/bmap.c struct gfs2_dinode *di; di 159 fs/gfs2/bmap.c di = (struct gfs2_dinode *)dibh->b_data; di 163 fs/gfs2/bmap.c *(__be64 *)(di + 1) = cpu_to_be64(block); di 165 fs/gfs2/bmap.c di->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(&ip->i_inode)); di 169 fs/gfs2/bmap.c di->di_height = cpu_to_be16(1); di 408 fs/gfs2/inode.c struct gfs2_dinode *di = (struct gfs2_dinode *)dibh->b_data; di 409 fs/gfs2/inode.c struct gfs2_dirent *dent = (struct gfs2_dirent *)(di+1); di 412 fs/gfs2/inode.c dent->de_inum = di->di_num; /* already GFS2 endian */ di 461 fs/gfs2/inode.c struct gfs2_dinode *di; di 466 fs/gfs2/inode.c di = (struct gfs2_dinode *)dibh->b_data; di 467 fs/gfs2/inode.c gfs2_dinode_out(ip, di); di 469 fs/gfs2/inode.c di->di_major = cpu_to_be32(MAJOR(ip->i_inode.i_rdev)); di 470 fs/gfs2/inode.c di->di_minor = cpu_to_be32(MINOR(ip->i_inode.i_rdev)); di 471 fs/gfs2/inode.c di->__pad1 = 0; di 472 fs/gfs2/inode.c di->__pad2 = 0; di 473 fs/gfs2/inode.c di->__pad3 = 0; di 474 fs/gfs2/inode.c memset(&di->__pad4, 0, sizeof(di->__pad4)); di 475 fs/gfs2/inode.c memset(&di->di_reserved, 0, sizeof(di->di_reserved)); di 2422 fs/gfs2/rgrp.c struct gfs2_dinode *di = di 2425 fs/gfs2/rgrp.c di->di_goal_meta = di->di_goal_data = di 4056 fs/jfs/jfs_dtree.c int di; /* dst entry index */ di 4087 fs/jfs/jfs_dtree.c for (di = 0; si < sp->header.nextindex; si++, di++) { di 4089 fs/jfs/jfs_dtree.c dstbl[di] = dsi; di 4234 fs/jfs/jfs_dtree.c dp->header.nextindex = di; di 1856 fs/nilfs2/btree.c union nilfs_bmap_ptr_req dreq, nreq, *di, *ni; di 1861 fs/nilfs2/btree.c di = &dreq; di 1865 fs/nilfs2/btree.c di = &dreq; di 1868 fs/nilfs2/btree.c di = NULL; di 1873 fs/nilfs2/btree.c ret = nilfs_btree_prepare_convert_and_insert(btree, key, di, ni, &bh, di 1878 fs/nilfs2/btree.c di, ni, bh); di 470 fs/nilfs2/dat.c struct nilfs_dat_info *di; di 489 fs/nilfs2/dat.c err = nilfs_mdt_init(dat, NILFS_MDT_GFP, sizeof(*di)); di 497 fs/nilfs2/dat.c di = NILFS_DAT_I(dat); di 498 fs/nilfs2/dat.c lockdep_set_class(&di->mi.mi_sem, &dat_lock_key); di 499 fs/nilfs2/dat.c nilfs_palloc_setup_cache(dat, &di->palloc_cache); di 500 fs/nilfs2/dat.c nilfs_mdt_setup_shadow_map(dat, &di->shadow); di 208 fs/ntfs/compress.c int di = completed_pages[i]; di 210 fs/ntfs/compress.c dp = dest_pages[di]; di 221 fs/ntfs/compress.c if (di == xpage) di 225 fs/ntfs/compress.c dest_pages[di] = NULL; di 520 fs/ntfs/runlist.c int di, si; /* Current index into @[ds]rl. */ di 563 fs/ntfs/runlist.c si = di = 0; di 580 fs/ntfs/runlist.c for (; drl[di].length; di++) { di 581 fs/ntfs/runlist.c if (drl[di].vcn + drl[di].length > srl[sstart].vcn) di 584 fs/ntfs/runlist.c dins = di; di 587 fs/ntfs/runlist.c if ((drl[di].vcn == srl[si].vcn) && (drl[di].lcn >= 0) && di 596 fs/ntfs/runlist.c for (dend = di; drl[dend].length; dend++) di 164 fs/ocfs2/acl.c struct ocfs2_dinode *di; di 187 fs/ocfs2/acl.c di = (struct ocfs2_dinode *)di_bh->b_data; di 197 fs/ocfs2/acl.c di->i_mode = cpu_to_le16(inode->i_mode); di 198 fs/ocfs2/acl.c di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); di 199 fs/ocfs2/acl.c di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); di 175 fs/ocfs2/alloc.c struct ocfs2_dinode *di = et->et_object; di 178 fs/ocfs2/alloc.c di->i_last_eb_blk = cpu_to_le64(blkno); di 183 fs/ocfs2/alloc.c struct ocfs2_dinode *di = et->et_object; di 186 fs/ocfs2/alloc.c return le64_to_cpu(di->i_last_eb_blk); di 193 fs/ocfs2/alloc.c struct ocfs2_dinode *di = et->et_object; di 195 fs/ocfs2/alloc.c le32_add_cpu(&di->i_clusters, clusters); di 197 fs/ocfs2/alloc.c oi->ip_clusters = le32_to_cpu(di->i_clusters); di 237 fs/ocfs2/alloc.c struct ocfs2_dinode *di = et->et_object; di 240 fs/ocfs2/alloc.c BUG_ON(!OCFS2_IS_VALID_DINODE(di)); di 247 fs/ocfs2/alloc.c struct ocfs2_dinode *di = et->et_object; di 249 fs/ocfs2/alloc.c et->et_root_el = &di->id2.i_list; di 5809 fs/ocfs2/alloc.c struct ocfs2_dinode *di; di 5812 fs/ocfs2/alloc.c di = (struct ocfs2_dinode *) tl_bh->b_data; di 5813 fs/ocfs2/alloc.c tl = &di->id2.i_dealloc; di 5848 fs/ocfs2/alloc.c struct ocfs2_dinode *di; di 5855 fs/ocfs2/alloc.c di = (struct ocfs2_dinode *) tl_bh->b_data; di 5860 fs/ocfs2/alloc.c BUG_ON(!OCFS2_IS_VALID_DINODE(di)); di 5862 fs/ocfs2/alloc.c tl = &di->id2.i_dealloc; di 5924 fs/ocfs2/alloc.c struct ocfs2_dinode *di; di 5930 fs/ocfs2/alloc.c di = (struct ocfs2_dinode *) tl_bh->b_data; di 5931 fs/ocfs2/alloc.c tl = &di->id2.i_dealloc; di 5994 fs/ocfs2/alloc.c struct ocfs2_dinode *di; di 6000 fs/ocfs2/alloc.c di = (struct ocfs2_dinode *) tl_bh->b_data; di 6005 fs/ocfs2/alloc.c BUG_ON(!OCFS2_IS_VALID_DINODE(di)); di 6007 fs/ocfs2/alloc.c tl = &di->id2.i_dealloc; di 6185 fs/ocfs2/alloc.c struct ocfs2_dinode *di; di 6198 fs/ocfs2/alloc.c di = (struct ocfs2_dinode *) tl_bh->b_data; di 6203 fs/ocfs2/alloc.c BUG_ON(!OCFS2_IS_VALID_DINODE(di)); di 6205 fs/ocfs2/alloc.c tl = &di->id2.i_dealloc; di 6224 fs/ocfs2/alloc.c ocfs2_compute_meta_ecc(osb->sb, tl_bh->b_data, &di->i_check); di 7004 fs/ocfs2/alloc.c struct ocfs2_dinode *di) di 7007 fs/ocfs2/alloc.c unsigned int xattrsize = le16_to_cpu(di->i_xattr_inline_size); di 7009 fs/ocfs2/alloc.c if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_XATTR_FL) di 7010 fs/ocfs2/alloc.c memset(&di->id2, 0, blocksize - di 7014 fs/ocfs2/alloc.c memset(&di->id2, 0, blocksize - di 7019 fs/ocfs2/alloc.c struct ocfs2_dinode *di) di 7021 fs/ocfs2/alloc.c ocfs2_zero_dinode_id2_with_xattr(inode, di); di 7022 fs/ocfs2/alloc.c di->id2.i_list.l_tree_depth = 0; di 7023 fs/ocfs2/alloc.c di->id2.i_list.l_next_free_rec = 0; di 7024 fs/ocfs2/alloc.c di->id2.i_list.l_count = cpu_to_le16( di 7025 fs/ocfs2/alloc.c ocfs2_extent_recs_per_inode_with_xattr(inode->i_sb, di)); di 7028 fs/ocfs2/alloc.c void ocfs2_set_inode_data_inline(struct inode *inode, struct ocfs2_dinode *di) di 7031 fs/ocfs2/alloc.c struct ocfs2_inline_data *idata = &di->id2.i_data; di 7035 fs/ocfs2/alloc.c di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); di 7042 fs/ocfs2/alloc.c ocfs2_zero_dinode_id2_with_xattr(inode, di); di 7045 fs/ocfs2/alloc.c ocfs2_max_inline_data_with_xattr(inode->i_sb, di)); di 7058 fs/ocfs2/alloc.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 7160 fs/ocfs2/alloc.c di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); di 7164 fs/ocfs2/alloc.c ocfs2_dinode_new_extent_list(inode, di); di 7232 fs/ocfs2/alloc.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 7233 fs/ocfs2/alloc.c struct ocfs2_extent_list *root_el = &(di->id2.i_list); di 7234 fs/ocfs2/alloc.c u64 refcount_loc = le64_to_cpu(di->i_refcount_loc); di 7245 fs/ocfs2/alloc.c path = ocfs2_new_path(di_bh, &di->id2.i_list, di 7403 fs/ocfs2/alloc.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 7404 fs/ocfs2/alloc.c struct ocfs2_inline_data *idata = &di->id2.i_data; di 7416 fs/ocfs2/alloc.c !(le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL) || di 7421 fs/ocfs2/alloc.c le16_to_cpu(di->i_dyn_features), di 7453 fs/ocfs2/alloc.c di->i_size = cpu_to_le64(start); di 7459 fs/ocfs2/alloc.c di->i_ctime = di->i_mtime = cpu_to_le64(inode->i_ctime.tv_sec); di 7460 fs/ocfs2/alloc.c di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); di 156 fs/ocfs2/alloc.h void ocfs2_dinode_new_extent_list(struct inode *inode, struct ocfs2_dinode *di); di 157 fs/ocfs2/alloc.h void ocfs2_set_inode_data_inline(struct inode *inode, struct ocfs2_dinode *di); di 227 fs/ocfs2/aops.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 229 fs/ocfs2/aops.c if (!(le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL)) { di 238 fs/ocfs2/aops.c size > ocfs2_max_inline_data_with_xattr(inode->i_sb, di)) { di 248 fs/ocfs2/aops.c memcpy(kaddr, di->id2.i_data.id_data, size); di 1493 fs/ocfs2/aops.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)wc->w_di_bh->b_data; di 1526 fs/ocfs2/aops.c ocfs2_set_inode_data_inline(inode, di); di 1544 fs/ocfs2/aops.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 1546 fs/ocfs2/aops.c if (new_size <= le16_to_cpu(di->id2.i_data.id_count)) di 1559 fs/ocfs2/aops.c struct ocfs2_dinode *di = NULL; di 1592 fs/ocfs2/aops.c di = (struct ocfs2_dinode *)wc->w_di_bh->b_data; di 1594 fs/ocfs2/aops.c end > ocfs2_max_inline_data_with_xattr(inode->i_sb, di)) di 1669 fs/ocfs2/aops.c struct ocfs2_dinode *di; di 1731 fs/ocfs2/aops.c di = (struct ocfs2_dinode *)wc->w_di_bh->b_data; di 1736 fs/ocfs2/aops.c le32_to_cpu(di->i_clusters), di 1766 fs/ocfs2/aops.c &di->id2.i_list); di 1940 fs/ocfs2/aops.c struct ocfs2_dinode *di, di 1953 fs/ocfs2/aops.c memcpy(di->id2.i_data.id_data + pos, kaddr + pos, *copied); di 1959 fs/ocfs2/aops.c le16_to_cpu(di->id2.i_data.id_count), di 1960 fs/ocfs2/aops.c le16_to_cpu(di->i_dyn_features)); di 1971 fs/ocfs2/aops.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)wc->w_di_bh->b_data; di 1988 fs/ocfs2/aops.c ocfs2_write_end_inline(inode, pos, len, &copied, di, wc); di 2048 fs/ocfs2/aops.c di->i_size = cpu_to_le64((u64)i_size_read(inode)); di 2050 fs/ocfs2/aops.c di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec); di 2051 fs/ocfs2/aops.c di->i_mtime_nsec = di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); di 2302 fs/ocfs2/aops.c struct ocfs2_dinode *di; di 2345 fs/ocfs2/aops.c di = (struct ocfs2_dinode *)di_bh->b_data; di 2362 fs/ocfs2/aops.c credits = ocfs2_calc_extend_credits(inode->i_sb, &di->id2.i_list); di 434 fs/ocfs2/buffer_head_io.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data; di 453 fs/ocfs2/buffer_head_io.c ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &di->i_check); di 398 fs/ocfs2/dir.c struct ocfs2_dinode *di; di 407 fs/ocfs2/dir.c di = (struct ocfs2_dinode *)di_bh->b_data; di 408 fs/ocfs2/dir.c data = &di->id2.i_data; di 592 fs/ocfs2/dir.c static int ocfs2_read_dx_root(struct inode *dir, struct ocfs2_dinode *di, di 596 fs/ocfs2/dir.c u64 blkno = le64_to_cpu(di->i_dx_root); di 1011 fs/ocfs2/dir.c struct ocfs2_dinode *di; di 1021 fs/ocfs2/dir.c di = (struct ocfs2_dinode *)di_bh->b_data; di 1023 fs/ocfs2/dir.c ret = ocfs2_read_dx_root(dir, di, &dx_root_bh); di 1354 fs/ocfs2/dir.c struct ocfs2_dinode *di; di 1363 fs/ocfs2/dir.c di = (struct ocfs2_dinode *)di_bh->b_data; di 1364 fs/ocfs2/dir.c data = &di->id2.i_data; di 1591 fs/ocfs2/dir.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)parent_fe_bh->b_data; di 1628 fs/ocfs2/dir.c data_start = di->id2.i_data.id_data; di 1742 fs/ocfs2/dir.c struct ocfs2_dinode *di; di 1753 fs/ocfs2/dir.c di = (struct ocfs2_dinode *)di_bh->b_data; di 1754 fs/ocfs2/dir.c data = &di->id2.i_data; di 2080 fs/ocfs2/dir.c struct ocfs2_dinode *di; di 2090 fs/ocfs2/dir.c di = (struct ocfs2_dinode *)di_bh->b_data; di 2092 fs/ocfs2/dir.c ret = ocfs2_read_dx_root(inode, di, &dx_root_bh); di 2188 fs/ocfs2/dir.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 2189 fs/ocfs2/dir.c struct ocfs2_inline_data *data = &di->id2.i_data; di 2293 fs/ocfs2/dir.c struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; di 2359 fs/ocfs2/dir.c di->i_dx_root = cpu_to_le64(dr_blkno); di 2363 fs/ocfs2/dir.c di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); di 2684 fs/ocfs2/dir.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 2686 fs/ocfs2/dir.c de_buf = di->id2.i_data.id_data; di 2784 fs/ocfs2/dir.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 2909 fs/ocfs2/dir.c memcpy(dirdata_bh->b_data, di->id2.i_data.id_data, i_size_read(dir)); di 2961 fs/ocfs2/dir.c di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); di 2964 fs/ocfs2/dir.c ocfs2_dinode_new_extent_list(dir, di); di 2969 fs/ocfs2/dir.c di->i_size = cpu_to_le64(sb->s_blocksize); di 2970 fs/ocfs2/dir.c di->i_ctime = di->i_mtime = cpu_to_le64(dir->i_ctime.tv_sec); di 2971 fs/ocfs2/dir.c di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(dir->i_ctime.tv_nsec); di 3344 fs/ocfs2/dir.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 3359 fs/ocfs2/dir.c de_buf = di->id2.i_data.id_data; di 4143 fs/ocfs2/dir.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 4146 fs/ocfs2/dir.c ret = ocfs2_read_dx_root(dir, di, &dx_root_bh); di 4318 fs/ocfs2/dir.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 4361 fs/ocfs2/dir.c di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); di 4363 fs/ocfs2/dir.c di->i_dx_root = cpu_to_le64(0ULL); di 4402 fs/ocfs2/dir.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 4411 fs/ocfs2/dir.c ret = ocfs2_read_dx_root(dir, di, &dx_root_bh); di 277 fs/ocfs2/extent_map.c struct ocfs2_dinode *di) di 280 fs/ocfs2/extent_map.c u64 last_eb_blk = le64_to_cpu(di->i_last_eb_blk); di 405 fs/ocfs2/extent_map.c struct ocfs2_dinode *di; di 415 fs/ocfs2/extent_map.c di = (struct ocfs2_dinode *) di_bh->b_data; di 416 fs/ocfs2/extent_map.c el = &di->id2.i_list; di 496 fs/ocfs2/extent_map.c else if (eb->h_blkno == di->i_last_eb_blk) di 498 fs/ocfs2/extent_map.c else if (eb->h_next_leaf_blk == di->i_last_eb_blk) { di 499 fs/ocfs2/extent_map.c ret = ocfs2_last_eb_is_empty(inode, di); di 708 fs/ocfs2/extent_map.c struct ocfs2_dinode *di; di 713 fs/ocfs2/extent_map.c di = (struct ocfs2_dinode *)di_bh->b_data; di 717 fs/ocfs2/extent_map.c id_count = le16_to_cpu(di->id2.i_data.id_count); di 257 fs/ocfs2/file.c struct ocfs2_dinode *di = (struct ocfs2_dinode *) bh->b_data; di 279 fs/ocfs2/file.c di->i_atime = cpu_to_le64(inode->i_atime.tv_sec); di 280 fs/ocfs2/file.c di->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec); di 377 fs/ocfs2/file.c struct ocfs2_dinode *di; di 422 fs/ocfs2/file.c di = (struct ocfs2_dinode *) fe_bh->b_data; di 423 fs/ocfs2/file.c di->i_size = cpu_to_le64(new_i_size); di 424 fs/ocfs2/file.c di->i_ctime = di->i_mtime = cpu_to_le64(inode->i_ctime.tv_sec); di 425 fs/ocfs2/file.c di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); di 760 fs/ocfs2/file.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 827 fs/ocfs2/file.c di->i_size = cpu_to_le64((u64)i_size_read(inode)); di 829 fs/ocfs2/file.c di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec); di 830 fs/ocfs2/file.c di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); di 831 fs/ocfs2/file.c di->i_mtime_nsec = di->i_ctime_nsec; di 1371 fs/ocfs2/file.c struct ocfs2_dinode *di; di 1395 fs/ocfs2/file.c di = (struct ocfs2_dinode *) bh->b_data; di 1396 fs/ocfs2/file.c di->i_mode = cpu_to_le16(inode->i_mode); di 1707 fs/ocfs2/file.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 1708 fs/ocfs2/file.c u64 blkno, refcount_loc = le64_to_cpu(di->i_refcount_loc); di 646 fs/ocfs2/inode.c struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; di 650 fs/ocfs2/inode.c le16_to_cpu(di->i_suballoc_slot)); di 691 fs/ocfs2/inode.c di->i_dtime = cpu_to_le64(ktime_get_real_seconds()); di 692 fs/ocfs2/inode.c di->i_flags &= cpu_to_le32(~(OCFS2_VALID_FL | OCFS2_ORPHANED_FL)); di 699 fs/ocfs2/inode.c inode_alloc_bh, di); di 757 fs/ocfs2/inode.c struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; di 760 fs/ocfs2/inode.c orphaned_slot = le16_to_cpu(di->i_orphaned_slot); di 895 fs/ocfs2/inode.c struct ocfs2_dinode *di; di 916 fs/ocfs2/inode.c di = (struct ocfs2_dinode *) di_bh->b_data; di 917 fs/ocfs2/inode.c if (!(di->i_flags & cpu_to_le32(OCFS2_ORPHANED_FL)) && di 927 fs/ocfs2/inode.c if (di->i_dyn_features & cpu_to_le16(OCFS2_HAS_REFCOUNT_FL)) { di 938 fs/ocfs2/inode.c (unsigned long long)le64_to_cpu(di->i_blkno), di 939 fs/ocfs2/inode.c le32_to_cpu(di->i_flags), oi->ip_flags); di 944 fs/ocfs2/inode.c if (di->i_dtime) { di 974 fs/ocfs2/inode.c trace_ocfs2_query_inode_wipe_succ(le16_to_cpu(di->i_orphaned_slot)); di 999 fs/ocfs2/inode.c struct ocfs2_dinode *di = NULL; di 1054 fs/ocfs2/inode.c di = (struct ocfs2_dinode *)di_bh->b_data; di 1057 fs/ocfs2/inode.c if (unlikely(di->i_flags & cpu_to_le32(OCFS2_DIO_ORPHANED_FL))) { di 1367 fs/ocfs2/inode.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data; di 1378 fs/ocfs2/inode.c rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &di->i_check); di 1391 fs/ocfs2/inode.c if (!OCFS2_IS_VALID_DINODE(di)) { di 1394 fs/ocfs2/inode.c di->i_signature); di 1398 fs/ocfs2/inode.c if (le64_to_cpu(di->i_blkno) != bh->b_blocknr) { di 1401 fs/ocfs2/inode.c (unsigned long long)le64_to_cpu(di->i_blkno)); di 1405 fs/ocfs2/inode.c if (!(di->i_flags & cpu_to_le32(OCFS2_VALID_FL))) { di 1412 fs/ocfs2/inode.c if (le32_to_cpu(di->i_fs_generation) != di 1417 fs/ocfs2/inode.c le32_to_cpu(di->i_fs_generation)); di 1431 fs/ocfs2/inode.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data; di 1444 fs/ocfs2/inode.c rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &di->i_check); di 1452 fs/ocfs2/inode.c if (!OCFS2_IS_VALID_DINODE(di)) { di 1455 fs/ocfs2/inode.c (unsigned long long)bh->b_blocknr, 7, di->i_signature); di 1461 fs/ocfs2/inode.c if (le64_to_cpu(di->i_blkno) != bh->b_blocknr) { di 1465 fs/ocfs2/inode.c (unsigned long long)le64_to_cpu(di->i_blkno)); di 1470 fs/ocfs2/inode.c if (!(di->i_flags & cpu_to_le32(OCFS2_VALID_FL))) { di 1479 fs/ocfs2/inode.c if (le32_to_cpu(di->i_fs_generation) != di 1484 fs/ocfs2/inode.c le32_to_cpu(di->i_fs_generation)); di 1496 fs/ocfs2/inode.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data; di 1521 fs/ocfs2/inode.c if (!OCFS2_IS_VALID_DINODE(di)) { di 1526 fs/ocfs2/inode.c if (!(di->i_flags & cpu_to_le32(OCFS2_VALID_FL))) { di 1533 fs/ocfs2/inode.c if (le64_to_cpu(di->i_blkno) != bh->b_blocknr) { di 1534 fs/ocfs2/inode.c di->i_blkno = cpu_to_le64(bh->b_blocknr); di 1539 fs/ocfs2/inode.c (unsigned long long)le64_to_cpu(di->i_blkno)); di 1542 fs/ocfs2/inode.c if (le32_to_cpu(di->i_fs_generation) != di 1544 fs/ocfs2/inode.c di->i_fs_generation = cpu_to_le32(OCFS2_SB(sb)->fs_generation); di 1549 fs/ocfs2/inode.c le32_to_cpu(di->i_fs_generation)); di 1552 fs/ocfs2/inode.c if (changed || ocfs2_validate_meta_ecc(sb, bh->b_data, &di->i_check)) { di 1553 fs/ocfs2/inode.c ocfs2_compute_meta_ecc(sb, bh->b_data, &di->i_check); di 820 fs/ocfs2/journal.c struct ocfs2_dinode *di = NULL; di 859 fs/ocfs2/journal.c di = (struct ocfs2_dinode *)bh->b_data; di 882 fs/ocfs2/journal.c *dirty = (le32_to_cpu(di->id1.journal1.ij_flags) & di 908 fs/ocfs2/journal.c static void ocfs2_bump_recovery_generation(struct ocfs2_dinode *di) di 910 fs/ocfs2/journal.c le32_add_cpu(&(di->id1.journal1.ij_recovery_generation), 1); di 913 fs/ocfs2/journal.c static u32 ocfs2_get_recovery_generation(struct ocfs2_dinode *di) di 915 fs/ocfs2/journal.c return le32_to_cpu(di->id1.journal1.ij_recovery_generation); di 1820 fs/ocfs2/journal.c struct ocfs2_dinode *di; di 1832 fs/ocfs2/journal.c di = (struct ocfs2_dinode *)bh->b_data; di 1833 fs/ocfs2/journal.c gen = ocfs2_get_recovery_generation(di); di 2188 fs/ocfs2/journal.c struct ocfs2_dinode *di = NULL; di 2226 fs/ocfs2/journal.c di = (struct ocfs2_dinode *)di_bh->b_data; di 2228 fs/ocfs2/journal.c if (di->i_flags & cpu_to_le32(OCFS2_DIO_ORPHANED_FL)) { di 2344 fs/ocfs2/journal.c struct ocfs2_dinode *di; di 2354 fs/ocfs2/journal.c di = (struct ocfs2_dinode *) di_bh->b_data; di 2357 fs/ocfs2/journal.c ocfs2_get_recovery_generation(di); di 2359 fs/ocfs2/journal.c if (le32_to_cpu(di->id1.journal1.ij_flags) & di 777 fs/ocfs2/move_extents.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 787 fs/ocfs2/move_extents.c context->refcount_loc = le64_to_cpu(di->i_refcount_loc); di 909 fs/ocfs2/move_extents.c struct ocfs2_dinode *di; di 963 fs/ocfs2/move_extents.c di = (struct ocfs2_dinode *)di_bh->b_data; di 965 fs/ocfs2/move_extents.c di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); di 966 fs/ocfs2/move_extents.c di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); di 2609 fs/ocfs2/namei.c struct ocfs2_dinode *di = NULL; di 2617 fs/ocfs2/namei.c di = (struct ocfs2_dinode *) di_bh->b_data; di 2622 fs/ocfs2/namei.c if (unlikely(di->i_flags & cpu_to_le32(OCFS2_DIO_ORPHANED_FL))) { di 2682 fs/ocfs2/namei.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 2688 fs/ocfs2/namei.c le16_to_cpu(di->i_dio_orphaned_slot)); di 2711 fs/ocfs2/namei.c BUG_ON(!(di->i_flags & cpu_to_le32(OCFS2_DIO_ORPHANED_FL))); di 2729 fs/ocfs2/namei.c di->i_flags &= ~cpu_to_le32(OCFS2_DIO_ORPHANED_FL); di 2730 fs/ocfs2/namei.c di->i_dio_orphaned_slot = 0; di 2760 fs/ocfs2/namei.c struct ocfs2_dinode *dir_di, *di; di 2846 fs/ocfs2/namei.c di = (struct ocfs2_dinode *)di_bh->b_data; di 2847 fs/ocfs2/namei.c di->i_flags &= ~cpu_to_le32(OCFS2_ORPHANED_FL); di 2848 fs/ocfs2/namei.c di->i_orphaned_slot = 0; di 2850 fs/ocfs2/namei.c ocfs2_set_links_count(di, inode->i_nlink); di 559 fs/ocfs2/ocfs2.h static inline unsigned int ocfs2_read_links_count(struct ocfs2_dinode *di) di 561 fs/ocfs2/ocfs2.h u32 nlink = le16_to_cpu(di->i_links_count); di 562 fs/ocfs2/ocfs2.h u32 hi = le16_to_cpu(di->i_links_count_hi); di 564 fs/ocfs2/ocfs2.h if (di->i_dyn_features & cpu_to_le16(OCFS2_INDEXED_DIR_FL)) di 570 fs/ocfs2/ocfs2.h static inline void ocfs2_set_links_count(struct ocfs2_dinode *di, u32 nlink) di 577 fs/ocfs2/ocfs2.h di->i_links_count = cpu_to_le16(lo); di 578 fs/ocfs2/ocfs2.h di->i_links_count_hi = cpu_to_le16(hi); di 581 fs/ocfs2/ocfs2.h static inline void ocfs2_add_links_count(struct ocfs2_dinode *di, int n) di 583 fs/ocfs2/ocfs2.h u32 links = ocfs2_read_links_count(di); di 587 fs/ocfs2/ocfs2.h ocfs2_set_links_count(di, links); di 1248 fs/ocfs2/ocfs2_fs.h struct ocfs2_dinode *di) di 1250 fs/ocfs2/ocfs2_fs.h unsigned int xattrsize = le16_to_cpu(di->i_xattr_inline_size); di 1252 fs/ocfs2/ocfs2_fs.h if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_XATTR_FL) di 1273 fs/ocfs2/ocfs2_fs.h struct ocfs2_dinode *di) di 1276 fs/ocfs2/ocfs2_fs.h unsigned int xattrsize = le16_to_cpu(di->i_xattr_inline_size); di 1278 fs/ocfs2/ocfs2_fs.h if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_XATTR_FL) di 1446 fs/ocfs2/ocfs2_fs.h struct ocfs2_dinode *di) di 1448 fs/ocfs2/ocfs2_fs.h if (di && (di->i_dyn_features & OCFS2_INLINE_XATTR_FL)) di 1451 fs/ocfs2/ocfs2_fs.h di->i_xattr_inline_size; di 398 fs/ocfs2/refcounttree.c struct ocfs2_dinode *di; di 408 fs/ocfs2/refcounttree.c di = (struct ocfs2_dinode *)di_bh->b_data; di 409 fs/ocfs2/refcounttree.c *ref_blkno = le64_to_cpu(di->i_refcount_loc); di 555 fs/ocfs2/refcounttree.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 640 fs/ocfs2/refcounttree.c di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); di 641 fs/ocfs2/refcounttree.c di->i_refcount_loc = cpu_to_le64(first_blkno); di 696 fs/ocfs2/refcounttree.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 740 fs/ocfs2/refcounttree.c di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); di 741 fs/ocfs2/refcounttree.c di->i_refcount_loc = cpu_to_le64(refcount_loc); di 758 fs/ocfs2/refcounttree.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 767 fs/ocfs2/refcounttree.c u64 blk = 0, bg_blkno = 0, ref_blkno = le64_to_cpu(di->i_refcount_loc); di 836 fs/ocfs2/refcounttree.c di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); di 837 fs/ocfs2/refcounttree.c di->i_refcount_loc = 0; di 928 fs/ocfs2/refcounttree.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 936 fs/ocfs2/refcounttree.c if ((oi->ip_dyn_features & OCFS2_HAS_XATTR_FL) && di->i_xattr_loc) di 940 fs/ocfs2/refcounttree.c ocfs2_has_inline_xattr_value_outside(inode, di)) di 3414 fs/ocfs2/refcounttree.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 3421 fs/ocfs2/refcounttree.c ret = ocfs2_refcount_cal_cow_clusters(inode, &di->id2.i_list, di 3442 fs/ocfs2/refcounttree.c ret = ocfs2_lock_refcount_tree(osb, le64_to_cpu(di->i_refcount_loc), di 3620 fs/ocfs2/refcounttree.c struct ocfs2_dinode *di, di 3763 fs/ocfs2/refcounttree.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 3781 fs/ocfs2/refcounttree.c di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); di 3782 fs/ocfs2/refcounttree.c di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); di 3798 fs/ocfs2/refcounttree.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 3817 fs/ocfs2/refcounttree.c BUG_ON(!di->i_refcount_loc); di 3819 fs/ocfs2/refcounttree.c le64_to_cpu(di->i_refcount_loc), 1, di 4058 fs/ocfs2/refcounttree.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)t_bh->b_data; di 4084 fs/ocfs2/refcounttree.c di->i_xattr_inline_size = s_di->i_xattr_inline_size; di 4085 fs/ocfs2/refcounttree.c di->i_clusters = s_di->i_clusters; di 4086 fs/ocfs2/refcounttree.c di->i_size = s_di->i_size; di 4087 fs/ocfs2/refcounttree.c di->i_dyn_features = s_di->i_dyn_features; di 4088 fs/ocfs2/refcounttree.c di->i_attr = s_di->i_attr; di 4094 fs/ocfs2/refcounttree.c di->i_uid = s_di->i_uid; di 4095 fs/ocfs2/refcounttree.c di->i_gid = s_di->i_gid; di 4096 fs/ocfs2/refcounttree.c di->i_mode = s_di->i_mode; di 4105 fs/ocfs2/refcounttree.c di->i_ctime = cpu_to_le64(t_inode->i_ctime.tv_sec); di 4106 fs/ocfs2/refcounttree.c di->i_ctime_nsec = cpu_to_le32(t_inode->i_ctime.tv_nsec); di 4109 fs/ocfs2/refcounttree.c di->i_mtime = s_di->i_mtime; di 4110 fs/ocfs2/refcounttree.c di->i_mtime_nsec = s_di->i_mtime_nsec; di 4130 fs/ocfs2/refcounttree.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)s_bh->b_data; di 4136 fs/ocfs2/refcounttree.c le64_to_cpu(di->i_refcount_loc)); di 4150 fs/ocfs2/refcounttree.c ret = ocfs2_lock_refcount_tree(osb, le64_to_cpu(di->i_refcount_loc), di 73 fs/ocfs2/refcounttree.h struct ocfs2_dinode *di, di 372 fs/ocfs2/resize.c struct ocfs2_dinode *di, di 379 fs/ocfs2/resize.c u16 cl_bpc = le16_to_cpu(di->id2.i_chain.cl_bpc); di 381 fs/ocfs2/resize.c ret = ocfs2_check_group_descriptor(inode->i_sb, di, group_bh); di 410 fs/ocfs2/resize.c struct ocfs2_dinode *di, di 414 fs/ocfs2/resize.c u16 cl_count = le16_to_cpu(di->id2.i_chain.cl_count); di 415 fs/ocfs2/resize.c u16 cl_cpg = le16_to_cpu(di->id2.i_chain.cl_cpg); di 416 fs/ocfs2/resize.c u16 next_free = le16_to_cpu(di->id2.i_chain.cl_next_free_rec); di 418 fs/ocfs2/resize.c u32 total_clusters = le32_to_cpu(di->i_clusters); di 439 fs/ocfs2/resize.c else if ((ret = ocfs2_check_new_group(inode, di, input, group_bh))) di 201 fs/ocfs2/suballoc.c struct ocfs2_dinode *di, di 208 fs/ocfs2/suballoc.c if (di->i_blkno != gd->bg_parent_dinode) { di 212 fs/ocfs2/suballoc.c (unsigned long long)le64_to_cpu(di->i_blkno)); di 215 fs/ocfs2/suballoc.c max_bits = le16_to_cpu(di->id2.i_chain.cl_cpg) * le16_to_cpu(di->id2.i_chain.cl_bpc); di 224 fs/ocfs2/suballoc.c le16_to_cpu(di->id2.i_chain.cl_next_free_rec)) || di 226 fs/ocfs2/suballoc.c le16_to_cpu(di->id2.i_chain.cl_next_free_rec)) && !resize)) { di 242 fs/ocfs2/suballoc.c struct ocfs2_dinode *di, di 263 fs/ocfs2/suballoc.c rc = ocfs2_validate_gd_parent(sb, di, bh, 1); di 295 fs/ocfs2/suballoc.c int ocfs2_read_group_descriptor(struct inode *inode, struct ocfs2_dinode *di, di 306 fs/ocfs2/suballoc.c rc = ocfs2_validate_gd_parent(inode->i_sb, di, tmp, 0); di 1584 fs/ocfs2/suballoc.c struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; di 1585 fs/ocfs2/suballoc.c struct ocfs2_chain_list *cl = (struct ocfs2_chain_list *) &di->id2.i_chain; di 1594 fs/ocfs2/suballoc.c tmp_used = le32_to_cpu(di->id1.bitmap1.i_used); di 1595 fs/ocfs2/suballoc.c di->id1.bitmap1.i_used = cpu_to_le32(num_bits + tmp_used); di 1609 fs/ocfs2/suballoc.c struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; di 1612 fs/ocfs2/suballoc.c cl = (struct ocfs2_chain_list *)&di->id2.i_chain; di 1613 fs/ocfs2/suballoc.c tmp_used = le32_to_cpu(di->id1.bitmap1.i_used); di 1614 fs/ocfs2/suballoc.c di->id1.bitmap1.i_used = cpu_to_le32(tmp_used - num_bits); di 1644 fs/ocfs2/suballoc.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)ac->ac_bh->b_data; di 1645 fs/ocfs2/suballoc.c struct ocfs2_chain_list *cl = &di->id2.i_chain; di 1677 fs/ocfs2/suballoc.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)ac->ac_bh->b_data; di 1680 fs/ocfs2/suballoc.c ret = ocfs2_read_group_descriptor(alloc_inode, di, di 2028 fs/ocfs2/suballoc.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)parent_di_bh->b_data; di 2042 fs/ocfs2/suballoc.c else if (le16_to_cpu(di->i_suballoc_slot) == ac->ac_alloc_slot) { di 2043 fs/ocfs2/suballoc.c if (di->i_suballoc_loc) di 2044 fs/ocfs2/suballoc.c ac->ac_last_group = le64_to_cpu(di->i_suballoc_loc); di 2047 fs/ocfs2/suballoc.c le64_to_cpu(di->i_blkno), di 2048 fs/ocfs2/suballoc.c le16_to_cpu(di->i_suballoc_bit)); di 2132 fs/ocfs2/suballoc.c struct ocfs2_dinode *di = (struct ocfs2_dinode *) ac->ac_bh->b_data; di 2142 fs/ocfs2/suballoc.c ret = ocfs2_read_group_descriptor(ac->ac_inode, di, di 2529 fs/ocfs2/suballoc.c struct ocfs2_dinode *di) di 2531 fs/ocfs2/suballoc.c u64 blk = le64_to_cpu(di->i_blkno); di 2532 fs/ocfs2/suballoc.c u16 bit = le16_to_cpu(di->i_suballoc_bit); di 2535 fs/ocfs2/suballoc.c if (di->i_suballoc_loc) di 2536 fs/ocfs2/suballoc.c bg_blkno = le64_to_cpu(di->i_suballoc_loc); di 130 fs/ocfs2/suballoc.h struct ocfs2_dinode *di); di 189 fs/ocfs2/suballoc.h struct ocfs2_dinode *di, di 196 fs/ocfs2/suballoc.h int ocfs2_read_group_descriptor(struct inode *inode, struct ocfs2_dinode *di, di 110 fs/ocfs2/super.c static int ocfs2_verify_volume(struct ocfs2_dinode *di, di 731 fs/ocfs2/super.c struct ocfs2_dinode *di; di 792 fs/ocfs2/super.c di = (struct ocfs2_dinode *) (*bh)->b_data; di 795 fs/ocfs2/super.c tmpstat = ocfs2_verify_volume(di, *bh, blksize, stats); di 1999 fs/ocfs2/super.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data; di 2023 fs/ocfs2/super.c cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits); di 2024 fs/ocfs2/super.c bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits); di 2026 fs/ocfs2/super.c memcpy(&sb->s_uuid, di->id2.i_super.s_uuid, di 2027 fs/ocfs2/super.c sizeof(di->id2.i_super.s_uuid)); di 2032 fs/ocfs2/super.c osb->osb_dx_seed[i] = le32_to_cpu(di->id2.i_super.s_dx_seed[i]); di 2033 fs/ocfs2/super.c osb->osb_dx_seed[3] = le32_to_cpu(di->id2.i_super.s_uuid_hash); di 2065 fs/ocfs2/super.c osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots); di 2089 fs/ocfs2/super.c di->id2.i_super.s_xattr_inline_size); di 2132 fs/ocfs2/super.c le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_compat); di 2134 fs/ocfs2/super.c le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_ro_compat); di 2136 fs/ocfs2/super.c le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_incompat); di 2153 fs/ocfs2/super.c OCFS2_RAW_SB(di)->s_cluster_info.ci_stackflags; di 2155 fs/ocfs2/super.c OCFS2_RAW_SB(di)->s_cluster_info.ci_stack, di 2166 fs/ocfs2/super.c OCFS2_RAW_SB(di)->s_cluster_info.ci_cluster, di 2208 fs/ocfs2/super.c le32_to_cpu(di->id2.i_super.s_clustersize_bits); di 2220 fs/ocfs2/super.c le32_to_cpu(di->i_clusters)); di 2231 fs/ocfs2/super.c if (ocfs2_setup_osb_uuid(osb, di->id2.i_super.s_uuid, di 2232 fs/ocfs2/super.c sizeof(di->id2.i_super.s_uuid))) { di 2238 fs/ocfs2/super.c strlcpy(osb->vol_label, di->id2.i_super.s_label, di 2240 fs/ocfs2/super.c osb->root_blkno = le64_to_cpu(di->id2.i_super.s_root_blkno); di 2241 fs/ocfs2/super.c osb->system_dir_blkno = le64_to_cpu(di->id2.i_super.s_system_dir_blkno); di 2243 fs/ocfs2/super.c le64_to_cpu(di->id2.i_super.s_first_cluster_group); di 2244 fs/ocfs2/super.c osb->fs_generation = le32_to_cpu(di->i_fs_generation); di 2245 fs/ocfs2/super.c osb->uuid_hash = le32_to_cpu(di->id2.i_super.s_uuid_hash); di 2307 fs/ocfs2/super.c static int ocfs2_verify_volume(struct ocfs2_dinode *di, di 2314 fs/ocfs2/super.c if (memcmp(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE, di 2317 fs/ocfs2/super.c if (le32_to_cpu(di->id2.i_super.s_feature_incompat) & di 2321 fs/ocfs2/super.c &di->i_check, di 2327 fs/ocfs2/super.c if ((1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits)) != blksz) { di 2330 fs/ocfs2/super.c 1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits), di 2332 fs/ocfs2/super.c } else if (le16_to_cpu(di->id2.i_super.s_major_rev_level) != di 2334 fs/ocfs2/super.c le16_to_cpu(di->id2.i_super.s_minor_rev_level) != di 2338 fs/ocfs2/super.c le16_to_cpu(di->id2.i_super.s_major_rev_level), di 2339 fs/ocfs2/super.c le16_to_cpu(di->id2.i_super.s_minor_rev_level), di 2342 fs/ocfs2/super.c } else if (bh->b_blocknr != le64_to_cpu(di->i_blkno)) { di 2345 fs/ocfs2/super.c (unsigned long long)le64_to_cpu(di->i_blkno), di 2347 fs/ocfs2/super.c } else if (le32_to_cpu(di->id2.i_super.s_clustersize_bits) < 12 || di 2348 fs/ocfs2/super.c le32_to_cpu(di->id2.i_super.s_clustersize_bits) > 20) { di 2350 fs/ocfs2/super.c 1 << le32_to_cpu(di->id2.i_super.s_clustersize_bits)); di 2351 fs/ocfs2/super.c } else if (!le64_to_cpu(di->id2.i_super.s_root_blkno)) { di 2353 fs/ocfs2/super.c } else if (!le64_to_cpu(di->id2.i_super.s_system_dir_blkno)) { di 2355 fs/ocfs2/super.c } else if (le16_to_cpu(di->id2.i_super.s_max_slots) > OCFS2_MAX_SLOTS) { di 2359 fs/ocfs2/super.c le16_to_cpu(di->id2.i_super.s_max_slots), di 295 fs/ocfs2/xattr.c struct ocfs2_dinode *di, di 956 fs/ocfs2/xattr.c struct ocfs2_dinode *di) di 962 fs/ocfs2/xattr.c ((void *)di + inode->i_sb->s_blocksize - di 963 fs/ocfs2/xattr.c le16_to_cpu(di->i_xattr_inline_size)); di 973 fs/ocfs2/xattr.c struct ocfs2_dinode *di, di 985 fs/ocfs2/xattr.c ((void *)di + inode->i_sb->s_blocksize - di 986 fs/ocfs2/xattr.c le16_to_cpu(di->i_xattr_inline_size)); di 994 fs/ocfs2/xattr.c struct ocfs2_dinode *di, di 1002 fs/ocfs2/xattr.c if (!di->i_xattr_loc) di 1005 fs/ocfs2/xattr.c ret = ocfs2_read_xattr_block(inode, le64_to_cpu(di->i_xattr_loc), di 1032 fs/ocfs2/xattr.c struct ocfs2_dinode *di = NULL; di 1047 fs/ocfs2/xattr.c di = (struct ocfs2_dinode *)di_bh->b_data; di 1050 fs/ocfs2/xattr.c i_ret = ocfs2_xattr_ibody_list(d_inode(dentry), di, buffer, size); di 1058 fs/ocfs2/xattr.c b_ret = ocfs2_xattr_block_list(d_inode(dentry), di, di 1161 fs/ocfs2/xattr.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data; di 1169 fs/ocfs2/xattr.c xs->end = (void *)di + inode->i_sb->s_blocksize; di 1171 fs/ocfs2/xattr.c (xs->end - le16_to_cpu(di->i_xattr_inline_size)); di 1288 fs/ocfs2/xattr.c struct ocfs2_dinode *di = NULL; di 1304 fs/ocfs2/xattr.c di = (struct ocfs2_dinode *)di_bh->b_data; di 1308 fs/ocfs2/xattr.c if (ret == -ENODATA && di->i_xattr_loc) di 2272 fs/ocfs2/xattr.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data; di 2280 fs/ocfs2/xattr.c loc->xl_size = le16_to_cpu(di->i_xattr_inline_size); di 2427 fs/ocfs2/xattr.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 2436 fs/ocfs2/xattr.c ((void *)di + inode->i_sb->s_blocksize - di 2437 fs/ocfs2/xattr.c le16_to_cpu(di->i_xattr_inline_size)); di 2563 fs/ocfs2/xattr.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 2578 fs/ocfs2/xattr.c le64_to_cpu(di->i_refcount_loc), di 2597 fs/ocfs2/xattr.c if (di->i_xattr_loc) { di 2599 fs/ocfs2/xattr.c le64_to_cpu(di->i_xattr_loc), di 2621 fs/ocfs2/xattr.c di->i_xattr_loc = 0; di 2625 fs/ocfs2/xattr.c di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); di 2640 fs/ocfs2/xattr.c struct ocfs2_dinode *di) di 2650 fs/ocfs2/xattr.c struct ocfs2_inline_data *idata = &di->id2.i_data; di 2651 fs/ocfs2/xattr.c free = le16_to_cpu(idata->id_count) - le64_to_cpu(di->i_size); di 2654 fs/ocfs2/xattr.c le64_to_cpu(di->i_size); di 2656 fs/ocfs2/xattr.c struct ocfs2_extent_list *el = &di->id2.i_list; di 2679 fs/ocfs2/xattr.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data; di 2688 fs/ocfs2/xattr.c has_space = ocfs2_xattr_has_space_inline(inode, di); di 2695 fs/ocfs2/xattr.c xs->end = (void *)di + inode->i_sb->s_blocksize; di 2698 fs/ocfs2/xattr.c (xs->end - le16_to_cpu(di->i_xattr_inline_size)); di 2722 fs/ocfs2/xattr.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; di 2726 fs/ocfs2/xattr.c if (!ocfs2_xattr_has_space_inline(inode, di)) { di 2743 fs/ocfs2/xattr.c struct ocfs2_inline_data *idata = &di->id2.i_data; di 2746 fs/ocfs2/xattr.c struct ocfs2_extent_list *el = &di->id2.i_list; di 2750 fs/ocfs2/xattr.c di->i_xattr_inline_size = cpu_to_le16(xattrsize); di 2754 fs/ocfs2/xattr.c di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); di 2818 fs/ocfs2/xattr.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data; di 2823 fs/ocfs2/xattr.c if (!di->i_xattr_loc) di 2826 fs/ocfs2/xattr.c ret = ocfs2_read_xattr_block(inode, le64_to_cpu(di->i_xattr_loc), di 2870 fs/ocfs2/xattr.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)inode_bh->b_data; di 2929 fs/ocfs2/xattr.c di->i_xattr_loc = cpu_to_le64(first_blkno); di 2933 fs/ocfs2/xattr.c di->i_dyn_features = cpu_to_le16(OCFS2_I(inode)->ip_dyn_features); di 3036 fs/ocfs2/xattr.c struct ocfs2_dinode *di, di 3181 fs/ocfs2/xattr.c if (di->i_xattr_loc) { di 3184 fs/ocfs2/xattr.c le64_to_cpu(di->i_xattr_loc), di 3248 fs/ocfs2/xattr.c struct ocfs2_dinode *di, di 3263 fs/ocfs2/xattr.c ret = ocfs2_calc_xattr_set_need(inode, di, xi, xis, xbs, di 3304 fs/ocfs2/xattr.c struct ocfs2_dinode *di, di 3332 fs/ocfs2/xattr.c di, di 3352 fs/ocfs2/xattr.c if (di->i_xattr_loc && !xbs->xattr_bh) { di 3362 fs/ocfs2/xattr.c di, di 3397 fs/ocfs2/xattr.c di, di 3431 fs/ocfs2/xattr.c di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); di 3432 fs/ocfs2/xattr.c di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); di 3455 fs/ocfs2/xattr.c struct ocfs2_dinode *di; di 3497 fs/ocfs2/xattr.c di = (struct ocfs2_dinode *)di_bh->b_data; di 3510 fs/ocfs2/xattr.c ret = __ocfs2_xattr_set_handle(inode, di, &xi, &xis, &xbs, &ctxt); di 3535 fs/ocfs2/xattr.c struct ocfs2_dinode *di; di 3579 fs/ocfs2/xattr.c di = (struct ocfs2_dinode *)di_bh->b_data; di 3611 fs/ocfs2/xattr.c ret = ocfs2_prepare_refcount_xattr(inode, di, &xi, di 3632 fs/ocfs2/xattr.c ret = ocfs2_init_xattr_set_ctxt(inode, di, &xi, &xis, di 3648 fs/ocfs2/xattr.c ret = __ocfs2_xattr_set_handle(inode, di, &xi, &xis, &xbs, &ctxt); di 5760 fs/ocfs2/xattr.c struct ocfs2_dinode *di, di 5848 fs/ocfs2/xattr.c ret = ocfs2_lock_refcount_tree(osb, le64_to_cpu(di->i_refcount_loc), di 5874 fs/ocfs2/xattr.c ret = ocfs2_refcount_cow_xattr(inode, di, &vb, di 5981 fs/ocfs2/xattr.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)fe_bh->b_data; di 5984 fs/ocfs2/xattr.c le16_to_cpu(di->i_xattr_inline_size)); di 6146 fs/ocfs2/xattr.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)fe_bh->b_data; di 6159 fs/ocfs2/xattr.c if (!di->i_xattr_loc) di 6162 fs/ocfs2/xattr.c ret = ocfs2_read_xattr_block(inode, le64_to_cpu(di->i_xattr_loc), di 6469 fs/ocfs2/xattr.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)args->old_bh->b_data; di 6470 fs/ocfs2/xattr.c int inline_size = le16_to_cpu(di->i_xattr_inline_size); di 7139 fs/ocfs2/xattr.c struct ocfs2_dinode *di = (struct ocfs2_dinode *)old_bh->b_data; di 7146 fs/ocfs2/xattr.c le64_to_cpu(di->i_refcount_loc), di 7175 fs/ocfs2/xattr.c if (!di->i_xattr_loc) di 7178 fs/ocfs2/xattr.c ret = ocfs2_read_xattr_block(old_inode, le64_to_cpu(di->i_xattr_loc), di 47 fs/ocfs2/xattr.h struct ocfs2_dinode *di); di 2613 fs/quota/dquot.c static void do_get_dqblk(struct dquot *dquot, struct qc_dqblk *di) di 2617 fs/quota/dquot.c memset(di, 0, sizeof(*di)); di 2619 fs/quota/dquot.c di->d_spc_hardlimit = dm->dqb_bhardlimit; di 2620 fs/quota/dquot.c di->d_spc_softlimit = dm->dqb_bsoftlimit; di 2621 fs/quota/dquot.c di->d_ino_hardlimit = dm->dqb_ihardlimit; di 2622 fs/quota/dquot.c di->d_ino_softlimit = dm->dqb_isoftlimit; di 2623 fs/quota/dquot.c di->d_space = dm->dqb_curspace + dm->dqb_rsvspace; di 2624 fs/quota/dquot.c di->d_ino_count = dm->dqb_curinodes; di 2625 fs/quota/dquot.c di->d_spc_timer = dm->dqb_btime; di 2626 fs/quota/dquot.c di->d_ino_timer = dm->dqb_itime; di 2631 fs/quota/dquot.c struct qc_dqblk *di) di 2638 fs/quota/dquot.c do_get_dqblk(dquot, di); di 2646 fs/quota/dquot.c struct qc_dqblk *di) di 2659 fs/quota/dquot.c do_get_dqblk(dquot, di); di 2672 fs/quota/dquot.c static int do_set_dqblk(struct dquot *dquot, struct qc_dqblk *di) di 2678 fs/quota/dquot.c if (di->d_fieldmask & ~VFS_QC_MASK) di 2681 fs/quota/dquot.c if (((di->d_fieldmask & QC_SPC_SOFT) && di 2682 fs/quota/dquot.c di->d_spc_softlimit > dqi->dqi_max_spc_limit) || di 2683 fs/quota/dquot.c ((di->d_fieldmask & QC_SPC_HARD) && di 2684 fs/quota/dquot.c di->d_spc_hardlimit > dqi->dqi_max_spc_limit) || di 2685 fs/quota/dquot.c ((di->d_fieldmask & QC_INO_SOFT) && di 2686 fs/quota/dquot.c (di->d_ino_softlimit > dqi->dqi_max_ino_limit)) || di 2687 fs/quota/dquot.c ((di->d_fieldmask & QC_INO_HARD) && di 2688 fs/quota/dquot.c (di->d_ino_hardlimit > dqi->dqi_max_ino_limit))) di 2692 fs/quota/dquot.c if (di->d_fieldmask & QC_SPACE) { di 2693 fs/quota/dquot.c dm->dqb_curspace = di->d_space - dm->dqb_rsvspace; di 2698 fs/quota/dquot.c if (di->d_fieldmask & QC_SPC_SOFT) di 2699 fs/quota/dquot.c dm->dqb_bsoftlimit = di->d_spc_softlimit; di 2700 fs/quota/dquot.c if (di->d_fieldmask & QC_SPC_HARD) di 2701 fs/quota/dquot.c dm->dqb_bhardlimit = di->d_spc_hardlimit; di 2702 fs/quota/dquot.c if (di->d_fieldmask & (QC_SPC_SOFT | QC_SPC_HARD)) { di 2707 fs/quota/dquot.c if (di->d_fieldmask & QC_INO_COUNT) { di 2708 fs/quota/dquot.c dm->dqb_curinodes = di->d_ino_count; di 2713 fs/quota/dquot.c if (di->d_fieldmask & QC_INO_SOFT) di 2714 fs/quota/dquot.c dm->dqb_isoftlimit = di->d_ino_softlimit; di 2715 fs/quota/dquot.c if (di->d_fieldmask & QC_INO_HARD) di 2716 fs/quota/dquot.c dm->dqb_ihardlimit = di->d_ino_hardlimit; di 2717 fs/quota/dquot.c if (di->d_fieldmask & (QC_INO_SOFT | QC_INO_HARD)) { di 2722 fs/quota/dquot.c if (di->d_fieldmask & QC_SPC_TIMER) { di 2723 fs/quota/dquot.c dm->dqb_btime = di->d_spc_timer; di 2728 fs/quota/dquot.c if (di->d_fieldmask & QC_INO_TIMER) { di 2729 fs/quota/dquot.c dm->dqb_itime = di->d_ino_timer; di 2739 fs/quota/dquot.c } else if (!(di->d_fieldmask & QC_SPC_TIMER)) di 2748 fs/quota/dquot.c } else if (!(di->d_fieldmask & QC_INO_TIMER)) di 2764 fs/quota/dquot.c struct qc_dqblk *di) di 2774 fs/quota/dquot.c rc = do_set_dqblk(dquot, di); di 501 fs/ubifs/super.c if (c->di.ro_mode) { di 513 fs/ubifs/super.c c->leb_start = c->di.leb_start; di 515 fs/ubifs/super.c c->min_io_size = c->di.min_io_size; di 517 fs/ubifs/super.c c->max_write_size = c->di.max_write_size; di 2125 fs/ubifs/super.c ubi_get_device_info(c->vi.ubi_num, &c->di); di 1382 fs/ubifs/ubifs.h struct ubi_device_info di; di 559 fs/xfs/scrub/inode.c struct xfs_dinode di; di 573 fs/xfs/scrub/inode.c xfs_inode_to_disk(sc->ip, &di, 0); di 574 fs/xfs/scrub/inode.c xchk_dinode(sc, &di, sc->ip->i_ino); di 586 fs/xfs/scrub/inode.c xchk_inode_xref(sc, sc->ip->i_ino, &di); di 155 include/linux/hil_mlc.h struct hil_mlc_devinfo di[HIL_MLC_DEVMEM]; di 468 include/linux/mfd/abx500/ab8500-bm.h int ab8500_fg_inst_curr_start(struct ab8500_fg *di); di 469 include/linux/mfd/abx500/ab8500-bm.h int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res); di 470 include/linux/mfd/abx500/ab8500-bm.h int ab8500_fg_inst_curr_started(struct ab8500_fg *di); di 471 include/linux/mfd/abx500/ab8500-bm.h int ab8500_fg_inst_curr_done(struct ab8500_fg *di); di 217 include/linux/mtd/ubi.h struct ubi_device_info di; di 224 include/linux/mtd/ubi.h int ubi_get_device_info(int ubi_num, struct ubi_device_info *di); di 37 include/linux/power/bq27xxx_battery.h int (*read)(struct bq27xxx_device_info *di, u8 reg, bool single); di 38 include/linux/power/bq27xxx_battery.h int (*write)(struct bq27xxx_device_info *di, u8 reg, int value, bool single); di 39 include/linux/power/bq27xxx_battery.h int (*read_bulk)(struct bq27xxx_device_info *di, u8 reg, u8 *data, int len); di 40 include/linux/power/bq27xxx_battery.h int (*write_bulk)(struct bq27xxx_device_info *di, u8 reg, u8 *data, int len); di 76 include/linux/power/bq27xxx_battery.h void bq27xxx_battery_update(struct bq27xxx_device_info *di); di 77 include/linux/power/bq27xxx_battery.h int bq27xxx_battery_setup(struct bq27xxx_device_info *di); di 78 include/linux/power/bq27xxx_battery.h void bq27xxx_battery_teardown(struct bq27xxx_device_info *di); di 112 include/linux/quotaops.h struct qc_dqblk *di); di 114 include/linux/quotaops.h struct qc_dqblk *di); di 116 include/linux/quotaops.h struct qc_dqblk *di); di 288 include/video/imx-ipu-v3.h int ipu_dc_init_sync(struct ipu_dc *dc, struct ipu_di *di, bool interlaced, di 303 include/video/imx-ipu-v3.h int ipu_di_adjust_videomode(struct ipu_di *di, struct videomode *mode); di 497 include/video/imx-ipu-v3.h int di; di 2098 net/bluetooth/hci_core.c struct hci_dev_info di; di 2102 net/bluetooth/hci_core.c if (copy_from_user(&di, arg, sizeof(di))) di 2105 net/bluetooth/hci_core.c hdev = hci_dev_get(di.dev_id); di 2118 net/bluetooth/hci_core.c strcpy(di.name, hdev->name); di 2119 net/bluetooth/hci_core.c di.bdaddr = hdev->bdaddr; di 2120 net/bluetooth/hci_core.c di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x03) << 4); di 2121 net/bluetooth/hci_core.c di.flags = flags; di 2122 net/bluetooth/hci_core.c di.pkt_type = hdev->pkt_type; di 2124 net/bluetooth/hci_core.c di.acl_mtu = hdev->acl_mtu; di 2125 net/bluetooth/hci_core.c di.acl_pkts = hdev->acl_pkts; di 2126 net/bluetooth/hci_core.c di.sco_mtu = hdev->sco_mtu; di 2127 net/bluetooth/hci_core.c di.sco_pkts = hdev->sco_pkts; di 2129 net/bluetooth/hci_core.c di.acl_mtu = hdev->le_mtu; di 2130 net/bluetooth/hci_core.c di.acl_pkts = hdev->le_pkts; di 2131 net/bluetooth/hci_core.c di.sco_mtu = 0; di 2132 net/bluetooth/hci_core.c di.sco_pkts = 0; di 2134 net/bluetooth/hci_core.c di.link_policy = hdev->link_policy; di 2135 net/bluetooth/hci_core.c di.link_mode = hdev->link_mode; di 2137 net/bluetooth/hci_core.c memcpy(&di.stat, &hdev->stat, sizeof(di.stat)); di 2138 net/bluetooth/hci_core.c memcpy(&di.features, &hdev->features, sizeof(di.features)); di 2140 net/bluetooth/hci_core.c if (copy_to_user(arg, &di, sizeof(di))) di 505 net/bluetooth/rfcomm/tty.c struct rfcomm_dev_info *di; di 514 net/bluetooth/rfcomm/tty.c if (!dev_num || dev_num > (PAGE_SIZE * 4) / sizeof(*di)) di 517 net/bluetooth/rfcomm/tty.c size = sizeof(*dl) + dev_num * sizeof(*di); di 523 net/bluetooth/rfcomm/tty.c di = dl->dev_info; di 530 net/bluetooth/rfcomm/tty.c (di + n)->id = dev->id; di 531 net/bluetooth/rfcomm/tty.c (di + n)->flags = dev->flags; di 532 net/bluetooth/rfcomm/tty.c (di + n)->state = dev->dlc->state; di 533 net/bluetooth/rfcomm/tty.c (di + n)->channel = dev->channel; di 534 net/bluetooth/rfcomm/tty.c bacpy(&(di + n)->src, &dev->src); di 535 net/bluetooth/rfcomm/tty.c bacpy(&(di + n)->dst, &dev->dst); di 544 net/bluetooth/rfcomm/tty.c size = sizeof(*dl) + n * sizeof(*di); di 555 net/bluetooth/rfcomm/tty.c struct rfcomm_dev_info di; di 560 net/bluetooth/rfcomm/tty.c if (copy_from_user(&di, arg, sizeof(di))) di 563 net/bluetooth/rfcomm/tty.c dev = rfcomm_dev_get(di.id); di 567 net/bluetooth/rfcomm/tty.c di.flags = dev->flags; di 568 net/bluetooth/rfcomm/tty.c di.channel = dev->channel; di 569 net/bluetooth/rfcomm/tty.c di.state = dev->dlc->state; di 570 net/bluetooth/rfcomm/tty.c bacpy(&di.src, &dev->src); di 571 net/bluetooth/rfcomm/tty.c bacpy(&di.dst, &dev->dst); di 573 net/bluetooth/rfcomm/tty.c if (copy_to_user(arg, &di, sizeof(di))) di 64 net/netfilter/ipvs/ip_vs_wrr.c int di; /* decreasing interval */ di 118 net/netfilter/ipvs/ip_vs_wrr.c mark->di = ip_vs_wrr_gcd_weight(svc); di 119 net/netfilter/ipvs/ip_vs_wrr.c mark->mw = ip_vs_wrr_max_weight(svc) - (mark->di - 1); di 145 net/netfilter/ipvs/ip_vs_wrr.c mark->di = ip_vs_wrr_gcd_weight(svc); di 146 net/netfilter/ipvs/ip_vs_wrr.c mark->mw = ip_vs_wrr_max_weight(svc) - (mark->di - 1); di 149 net/netfilter/ipvs/ip_vs_wrr.c else if (mark->di > 1) di 150 net/netfilter/ipvs/ip_vs_wrr.c mark->cw = (mark->cw / mark->di) * mark->di + 1; di 186 net/netfilter/ipvs/ip_vs_wrr.c mark->cw -= mark->di; di 200 net/netfilter/ipvs/ip_vs_wrr.c last_pass = mark->cw <= mark->di; di 19 net/xdp/xsk_diag.c struct xdp_diag_info di = {}; di 21 net/xdp/xsk_diag.c di.ifindex = xs->dev ? xs->dev->ifindex : 0; di 22 net/xdp/xsk_diag.c di.queue_id = xs->queue_id; di 23 net/xdp/xsk_diag.c return nla_put(nlskb, XDP_DIAG_INFO, sizeof(di), &di); di 63 sound/drivers/vx/vx_mixer.c #define SET_CDC_DATA_SEL(di,s) ((di).b.mh = (u8) (s)) di 64 sound/drivers/vx/vx_mixer.c #define SET_CDC_DATA_REG(di,r) ((di).b.ml = (u8) (r)) di 65 sound/drivers/vx/vx_mixer.c #define SET_CDC_DATA_VAL(di,d) ((di).b.ll = (u8) (d)) di 66 sound/drivers/vx/vx_mixer.c #define SET_CDC_DATA_INIT(di) ((di).l = 0L, SET_CDC_DATA_SEL(di,XX_CODEC_SELECTOR)) di 7 tools/build/feature/test-libunwind-aarch64.c unw_dyn_info_t *di, di 7 tools/build/feature/test-libunwind-arm.c unw_dyn_info_t *di, di 7 tools/build/feature/test-libunwind-x86.c unw_dyn_info_t *di, di 7 tools/build/feature/test-libunwind-x86_64.c unw_dyn_info_t *di, di 7 tools/build/feature/test-libunwind.c unw_dyn_info_t *di, di 82 tools/perf/arch/x86/util/perf_regs.c SDT_NAME_REG(edi, di), di 83 tools/perf/arch/x86/util/perf_regs.c SDT_NAME_REG(rdi, di), di 84 tools/perf/arch/x86/util/perf_regs.c SDT_NAME_REG(dil, di), di 466 tools/perf/util/genelf_debug.c struct buffer_ext *di) di 475 tools/perf/util/genelf_debug.c add_compilation_unit(di, buffer_ext_size(dl)); di 489 tools/perf/util/genelf_debug.c struct buffer_ext dl, di, da; di 493 tools/perf/util/genelf_debug.c buffer_ext_init(&di); di 496 tools/perf/util/genelf_debug.c ret = jit_process_debug_info(code_addr, debug, nr_debug_entries, &dl, &da, &di); di 550 tools/perf/util/genelf_debug.c d->d_buf = buffer_ext_addr(&di); di 552 tools/perf/util/genelf_debug.c d->d_size = buffer_ext_size(&di); di 47 tools/perf/util/unwind-libunwind-local.c unw_dyn_info_t *di, di 379 tools/perf/util/unwind-libunwind-local.c unw_dyn_info_t di; di 392 tools/perf/util/unwind-libunwind-local.c memset(&di, 0, sizeof(di)); di 393 tools/perf/util/unwind-libunwind-local.c di.format = UNW_INFO_FORMAT_REMOTE_TABLE; di 394 tools/perf/util/unwind-libunwind-local.c di.start_ip = map->start; di 395 tools/perf/util/unwind-libunwind-local.c di.end_ip = map->end; di 396 tools/perf/util/unwind-libunwind-local.c di.u.rti.segbase = map->start + segbase - map->pgoff; di 397 tools/perf/util/unwind-libunwind-local.c di.u.rti.table_data = map->start + table_data - map->pgoff; di 398 tools/perf/util/unwind-libunwind-local.c di.u.rti.table_len = fde_count * sizeof(struct table_entry) di 400 tools/perf/util/unwind-libunwind-local.c ret = dwarf_search_unwind_table(as, ip, &di, pi, di 418 tools/perf/util/unwind-libunwind-local.c memset(&di, 0, sizeof(di)); di 419 tools/perf/util/unwind-libunwind-local.c if (dwarf_find_debug_frame(0, &di, ip, base, symfile, di 421 tools/perf/util/unwind-libunwind-local.c return dwarf_search_unwind_table(as, ip, &di, pi, di 373 tools/testing/selftests/bpf/bpf_helpers.h #define PT_REGS_PARM1(x) ((x)->di) di 90 tools/testing/selftests/bpf/progs/test_tcp_estats.c long di; di 11 tools/testing/selftests/x86/check_initial_reg_state.c unsigned long ax, bx, cx, dx, si, di, bp, sp, flags; di 63 tools/testing/selftests/x86/check_initial_reg_state.c if (ax || bx || cx || dx || si || di || bp di 75 tools/testing/selftests/x86/check_initial_reg_state.c SHOW(di);