/* Return: 0 if all went fine, else return appropriate error.  */
static int ti_sci_cmd_dev_is_on(const struct ti_sci_handle *handle, u32 id, bool *r_state, bool *curr_state)
/* Return: 0 if all went fine, else return appropriate error.  */
static int ti_sci_cmd_dev_is_on(const struct ti_sci_handle *handle, u32 id, bool *r_state, bool *curr_state)
{
	int ret;
	u8 p_state, c_state;
	if (!r_state && !curr_state)
		return -EINVAL;
	ret =
	    ti_sci_get_device_state(handle, id, NULL, NULL, &p_state, &c_state);
	if (ret)
		return ret;
	if (r_state)
		*r_state = (p_state == MSG_DEVICE_SW_STATE_ON);
	if (curr_state)
		*curr_state = (c_state == MSG_DEVICE_HW_STATE_ON);
	return 0;
}