2023-03-29 06:58:20 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2023 Cirrus Logic, Inc.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2023-09-27 06:46:01 +08:00
|
|
|
#include <zephyr/internal/syscall_handler.h>
|
2023-03-29 06:58:20 +08:00
|
|
|
#include <zephyr/drivers/charger.h>
|
|
|
|
|
|
|
|
static inline int z_vrfy_charger_get_prop(const struct device *dev, const charger_prop_t prop,
|
|
|
|
union charger_propval *val)
|
|
|
|
{
|
|
|
|
union charger_propval k_val;
|
|
|
|
|
2023-09-27 19:20:28 +08:00
|
|
|
K_OOPS(K_SYSCALL_DRIVER_CHARGER(dev, get_property));
|
2023-03-29 06:58:20 +08:00
|
|
|
|
|
|
|
int ret = z_impl_charger_get_prop(dev, prop, &k_val);
|
|
|
|
|
2023-09-27 19:20:28 +08:00
|
|
|
K_OOPS(k_usermode_to_copy(val, &k_val, sizeof(union charger_propval)));
|
2023-03-29 06:58:20 +08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <syscalls/charger_get_prop_mrsh.c>
|
|
|
|
|
|
|
|
static inline int z_vrfy_charger_set_prop(const struct device *dev, const charger_prop_t prop,
|
|
|
|
const union charger_propval *val)
|
|
|
|
{
|
|
|
|
union charger_propval k_val;
|
|
|
|
|
2023-09-27 19:20:28 +08:00
|
|
|
K_OOPS(K_SYSCALL_DRIVER_CHARGER(dev, set_property));
|
2023-03-29 06:58:20 +08:00
|
|
|
|
2023-09-27 19:20:28 +08:00
|
|
|
K_OOPS(k_usermode_from_copy(&k_val, val, sizeof(union charger_propval)));
|
2023-03-29 06:58:20 +08:00
|
|
|
|
|
|
|
return z_impl_charger_set_prop(dev, prop, &k_val);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <syscalls/charger_set_prop_mrsh.c>
|
2023-12-05 06:55:29 +08:00
|
|
|
|
|
|
|
static inline int z_vrfy_charger_charge_enable(const struct device *dev, const bool enable)
|
|
|
|
{
|
|
|
|
K_OOPS(K_SYSCALL_DRIVER_CHARGER(dev, charge_enable));
|
|
|
|
|
|
|
|
return z_impl_charger_charge_enable(dev, enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <syscalls/charger_charge_enable_mrsh.c>
|