• Home
  • Raw
  • Download

Lines Matching refs:ctrl

43 	struct spmi_controller *ctrl = to_spmi_controller(dev);  in spmi_ctrl_release()  local
44 ida_simple_remove(&ctrl_ida, ctrl->nr); in spmi_ctrl_release()
45 kfree(ctrl); in spmi_ctrl_release()
70 struct spmi_controller *ctrl = sdev->ctrl; in spmi_device_add() local
73 dev_set_name(&sdev->dev, "%d-%02x", ctrl->nr, sdev->usid); in spmi_device_add()
100 spmi_cmd(struct spmi_controller *ctrl, u8 opcode, u8 sid) in spmi_cmd() argument
104 if (!ctrl || !ctrl->cmd || ctrl->dev.type != &spmi_ctrl_type) in spmi_cmd()
107 ret = ctrl->cmd(ctrl, opcode, sid); in spmi_cmd()
112 static inline int spmi_read_cmd(struct spmi_controller *ctrl, u8 opcode, in spmi_read_cmd() argument
117 if (!ctrl || !ctrl->read_cmd || ctrl->dev.type != &spmi_ctrl_type) in spmi_read_cmd()
121 ret = ctrl->read_cmd(ctrl, opcode, sid, addr, buf, len); in spmi_read_cmd()
126 static inline int spmi_write_cmd(struct spmi_controller *ctrl, u8 opcode, in spmi_write_cmd() argument
131 if (!ctrl || !ctrl->write_cmd || ctrl->dev.type != &spmi_ctrl_type) in spmi_write_cmd()
135 ret = ctrl->write_cmd(ctrl, opcode, sid, addr, buf, len); in spmi_write_cmd()
154 return spmi_read_cmd(sdev->ctrl, SPMI_CMD_READ, sdev->usid, addr, in spmi_register_read()
176 return spmi_read_cmd(sdev->ctrl, SPMI_CMD_EXT_READ, sdev->usid, addr, in spmi_ext_register_read()
198 return spmi_read_cmd(sdev->ctrl, SPMI_CMD_EXT_READL, sdev->usid, addr, in spmi_ext_register_readl()
217 return spmi_write_cmd(sdev->ctrl, SPMI_CMD_WRITE, sdev->usid, addr, in spmi_register_write()
231 return spmi_write_cmd(sdev->ctrl, SPMI_CMD_ZERO_WRITE, sdev->usid, 0, in spmi_register_zero_write()
253 return spmi_write_cmd(sdev->ctrl, SPMI_CMD_EXT_WRITE, sdev->usid, addr, in spmi_ext_register_write()
275 return spmi_write_cmd(sdev->ctrl, SPMI_CMD_EXT_WRITEL, sdev->usid, in spmi_ext_register_writel()
290 return spmi_cmd(sdev->ctrl, SPMI_CMD_RESET, sdev->usid); in spmi_command_reset()
302 return spmi_cmd(sdev->ctrl, SPMI_CMD_SLEEP, sdev->usid); in spmi_command_sleep()
315 return spmi_cmd(sdev->ctrl, SPMI_CMD_WAKEUP, sdev->usid); in spmi_command_wakeup()
327 return spmi_cmd(sdev->ctrl, SPMI_CMD_SHUTDOWN, sdev->usid); in spmi_command_shutdown()
394 struct spmi_device *spmi_device_alloc(struct spmi_controller *ctrl) in spmi_device_alloc() argument
402 sdev->ctrl = ctrl; in spmi_device_alloc()
404 sdev->dev.parent = &ctrl->dev; in spmi_device_alloc()
424 struct spmi_controller *ctrl; in spmi_controller_alloc() local
430 ctrl = kzalloc(sizeof(*ctrl) + size, GFP_KERNEL); in spmi_controller_alloc()
431 if (!ctrl) in spmi_controller_alloc()
434 device_initialize(&ctrl->dev); in spmi_controller_alloc()
435 ctrl->dev.type = &spmi_ctrl_type; in spmi_controller_alloc()
436 ctrl->dev.bus = &spmi_bus_type; in spmi_controller_alloc()
437 ctrl->dev.parent = parent; in spmi_controller_alloc()
438 ctrl->dev.of_node = parent->of_node; in spmi_controller_alloc()
439 spmi_controller_set_drvdata(ctrl, &ctrl[1]); in spmi_controller_alloc()
445 spmi_controller_put(ctrl); in spmi_controller_alloc()
449 ctrl->nr = id; in spmi_controller_alloc()
450 dev_set_name(&ctrl->dev, "spmi-%d", id); in spmi_controller_alloc()
452 dev_dbg(&ctrl->dev, "allocated controller 0x%p id %d\n", ctrl, id); in spmi_controller_alloc()
453 return ctrl; in spmi_controller_alloc()
457 static void of_spmi_register_devices(struct spmi_controller *ctrl) in of_spmi_register_devices() argument
462 if (!ctrl->dev.of_node) in of_spmi_register_devices()
465 for_each_available_child_of_node(ctrl->dev.of_node, node) { in of_spmi_register_devices()
469 dev_dbg(&ctrl->dev, "adding child %s\n", node->full_name); in of_spmi_register_devices()
473 dev_err(&ctrl->dev, in of_spmi_register_devices()
480 dev_err(&ctrl->dev, in of_spmi_register_devices()
487 dev_err(&ctrl->dev, in of_spmi_register_devices()
493 dev_dbg(&ctrl->dev, "read usid %02x\n", reg[0]); in of_spmi_register_devices()
495 sdev = spmi_device_alloc(ctrl); in of_spmi_register_devices()
518 int spmi_controller_add(struct spmi_controller *ctrl) in spmi_controller_add() argument
526 ret = device_add(&ctrl->dev); in spmi_controller_add()
531 of_spmi_register_devices(ctrl); in spmi_controller_add()
533 dev_dbg(&ctrl->dev, "spmi-%d registered: dev:%p\n", in spmi_controller_add()
534 ctrl->nr, &ctrl->dev); in spmi_controller_add()
556 void spmi_controller_remove(struct spmi_controller *ctrl) in spmi_controller_remove() argument
560 if (!ctrl) in spmi_controller_remove()
563 dummy = device_for_each_child(&ctrl->dev, NULL, in spmi_controller_remove()
565 device_del(&ctrl->dev); in spmi_controller_remove()