linux/drivers/power/supply/cros_charge-control.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  ChromeOS EC driver for charge control
 *
 *  Copyright (C) 2024 Thomas Weißschuh <[email protected]>
 */
#include <acpi/battery.h>
#include <linux/container_of.h>
#include <linux/dmi.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
#include <linux/platform_device.h>
#include <linux/types.h>

#define EC_CHARGE_CONTROL_BEHAVIOURS

enum CROS_CHCTL_ATTR {};

/*
 * Semantics of data *returned* from the EC API and Linux sysfs differ
 * slightly, also the v1 API can not return any data.
 * To match the expected sysfs API, data is never read back from the EC but
 * cached in the driver.
 *
 * Changes to the EC bypassing the driver will not be reflected in sysfs.
 * Any change to "charge_behaviour" will synchronize the EC with the driver state.
 */

struct cros_chctl_priv {};

static int cros_chctl_send_charge_control_cmd(struct cros_ec_device *cros_ec,
					      u8 cmd_version, struct ec_params_charge_control *req)
{}

static int cros_chctl_configure_ec(struct cros_chctl_priv *priv)
{}

static struct cros_chctl_priv *cros_chctl_attr_to_priv(struct attribute *attr,
						       enum CROS_CHCTL_ATTR idx)
{}

static ssize_t cros_chctl_store_threshold(struct device *dev, struct cros_chctl_priv *priv,
					  int is_end_threshold, const char *buf, size_t count)
{}

static ssize_t charge_control_start_threshold_show(struct device *dev,
						   struct device_attribute *attr,
						   char *buf)
{}

static ssize_t charge_control_start_threshold_store(struct device *dev,
						    struct device_attribute *attr,
						    const char *buf, size_t count)
{}

static ssize_t charge_control_end_threshold_show(struct device *dev, struct device_attribute *attr,
						 char *buf)
{}

static ssize_t charge_control_end_threshold_store(struct device *dev, struct device_attribute *attr,
						  const char *buf, size_t count)
{}

static ssize_t charge_behaviour_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

static ssize_t charge_behaviour_store(struct device *dev, struct device_attribute *attr,
				      const char *buf, size_t count)
{}

static umode_t cros_chtl_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n)
{}

static int cros_chctl_add_battery(struct power_supply *battery, struct acpi_battery_hook *hook)
{}

static int cros_chctl_remove_battery(struct power_supply *battery, struct acpi_battery_hook *hook)
{}

static bool probe_with_fwk_charge_control;
module_param(probe_with_fwk_charge_control, bool, 0644);
MODULE_PARM_DESC();

static int cros_chctl_fwk_charge_control_versions(struct cros_ec_device *cros_ec)
{}

static int cros_chctl_probe(struct platform_device *pdev)
{}

static const struct platform_device_id cros_chctl_id[] =;

static struct platform_driver cros_chctl_driver =;
module_platform_driver();

MODULE_DEVICE_TABLE(platform, cros_chctl_id);
MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();