Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: i3c: shell: add ibi disable/enable commands #79030

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions drivers/i3c/i3c_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -1978,6 +1978,48 @@

shell_print(sh, "I3C: Issued IBI TIR");
}

/* i3c ibi enable <device> <target> */
static void cmd_i3c_ibi_enable(const struct shell *sh, size_t argc, char **argv)
{
const struct device *dev, *tdev;
struct i3c_device_desc *desc;
int ret;

ret = i3c_parse_args(sh, argv, &dev, &tdev, &desc);
if (ret != 0) {
return ret;
}

ret = i3c_ibi_enable(desc);
if (ret != 0) {
shell_error(sh, "I3C: Unable to enable IBI");
return ret;
}

shell_print(sh, "I3C: Enabled IBI");
}

/* i3c ibi disable <device> <target> */
static void cmd_i3c_ibi_disable(const struct shell *sh, size_t argc, char **argv)
{
const struct device *dev, *tdev;
struct i3c_device_desc *desc;
int ret;

ret = i3c_parse_args(sh, argv, &dev, &tdev, &desc);
if (ret != 0) {
return ret;
}

ret = i3c_ibi_disable(desc);
if (ret != 0) {
shell_error(sh, "I3C: Unable to disable IBI");
return ret;
}

shell_print(sh, "I3C: Disabled IBI");
}
#endif

static void i3c_device_list_target_name_get(size_t idx, struct shell_static_entry *entry)
Expand Down Expand Up @@ -2038,8 +2080,16 @@
"Send IBI CR\n"
"Usage: ibi cr <device>",
cmd_i3c_ibi_cr, 2, 0),
SHELL_CMD_ARG(enable, &dsub_i3c_device_attached_name,
"Enable receiving IBI from target\n"
"Usage: ibi enable <device> <target>",
cmd_i3c_ibi_enable, 3, 0),
SHELL_CMD_ARG(disable, &dsub_i3c_device_attached_name,
"Disable receiving IBI from target\n"
"Usage: ibi disable <device> <target>",
cmd_i3c_ibi_disable, 3, 0),
SHELL_SUBCMD_SET_END /* Array terminated. */
);

Check notice on line 2092 in drivers/i3c/i3c_shell.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/i3c/i3c_shell.c:2092 -SHELL_STATIC_SUBCMD_SET_CREATE( - sub_i3c_ibi_cmds, - SHELL_CMD_ARG(hj, &dsub_i3c_device_name, - "Send IBI HJ\n" - "Usage: ibi hj <device>", - cmd_i3c_ibi_hj, 2, 0), - SHELL_CMD_ARG(tir, &dsub_i3c_device_name, - "Send IBI TIR\n" - "Usage: ibi tir <device> [<byte1>, ...]", - cmd_i3c_ibi_tir, 2, MAX_I3C_BYTES), - SHELL_CMD_ARG(cr, &dsub_i3c_device_name, - "Send IBI CR\n" - "Usage: ibi cr <device>", - cmd_i3c_ibi_cr, 2, 0), - SHELL_CMD_ARG(enable, &dsub_i3c_device_attached_name, - "Enable receiving IBI from target\n" - "Usage: ibi enable <device> <target>", - cmd_i3c_ibi_enable, 3, 0), - SHELL_CMD_ARG(disable, &dsub_i3c_device_attached_name, - "Disable receiving IBI from target\n" - "Usage: ibi disable <device> <target>", - cmd_i3c_ibi_disable, 3, 0), - SHELL_SUBCMD_SET_END /* Array terminated. */ +SHELL_STATIC_SUBCMD_SET_CREATE(sub_i3c_ibi_cmds, + SHELL_CMD_ARG(hj, &dsub_i3c_device_name, + "Send IBI HJ\n" + "Usage: ibi hj <device>", + cmd_i3c_ibi_hj, 2, 0), + SHELL_CMD_ARG(tir, &dsub_i3c_device_name, + "Send IBI TIR\n" + "Usage: ibi tir <device> [<byte1>, ...]", + cmd_i3c_ibi_tir, 2, MAX_I3C_BYTES), + SHELL_CMD_ARG(cr, &dsub_i3c_device_name, + "Send IBI CR\n" + "Usage: ibi cr <device>", + cmd_i3c_ibi_cr, 2, 0), + SHELL_CMD_ARG(enable, &dsub_i3c_device_attached_name, + "Enable receiving IBI from target\n" + "Usage: ibi enable <device> <target>", + cmd_i3c_ibi_enable, 3, 0), + SHELL_CMD_ARG(disable, &dsub_i3c_device_attached_name, + "Disable receiving IBI from target\n" + "Usage: ibi disable <device> <target>", + cmd_i3c_ibi_disable, 3, 0), + SHELL_SUBCMD_SET_END /* Array terminated. */
#endif

/* L3 I3C HDR DDR Shell Commands*/
Expand Down
Loading