linux/drivers/power/supply/surface_charger.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * AC driver for 7th-generation Microsoft Surface devices via Surface System
 * Aggregator Module (SSAM).
 *
 * Copyright (C) 2019-2021 Maximilian Luz <[email protected]>
 */

#include <asm/unaligned.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/power_supply.h>
#include <linux/types.h>

#include <linux/surface_aggregator/device.h>


/* -- SAM interface. -------------------------------------------------------- */

enum sam_event_cid_bat {};

enum sam_battery_sta {};

/* Get battery status (_STA). */
SSAM_DEFINE_SYNC_REQUEST_CL_R(ssam_bat_get_sta, __le32, {
	.target_category = SSAM_SSH_TC_BAT,
	.command_id      = 0x01,
});

/* Get platform power source for battery (_PSR / DPTF PSRC). */
SSAM_DEFINE_SYNC_REQUEST_CL_R(ssam_bat_get_psrc, __le32, {
	.target_category = SSAM_SSH_TC_BAT,
	.command_id      = 0x0d,
});


/* -- Device structures. ---------------------------------------------------- */

struct spwr_psy_properties {};

struct spwr_ac_device {};


/* -- State management. ----------------------------------------------------- */

static int spwr_ac_update_unlocked(struct spwr_ac_device *ac)
{}

static int spwr_ac_update(struct spwr_ac_device *ac)
{}

static int spwr_ac_recheck(struct spwr_ac_device *ac)
{}

static u32 spwr_notify_ac(struct ssam_event_notifier *nf, const struct ssam_event *event)
{}


/* -- Properties. ----------------------------------------------------------- */

static const enum power_supply_property spwr_ac_props[] =;

static int spwr_ac_get_property(struct power_supply *psy, enum power_supply_property psp,
				union power_supply_propval *val)
{}


/* -- Device setup. --------------------------------------------------------- */

static char *battery_supplied_to[] =;

static void spwr_ac_init(struct spwr_ac_device *ac, struct ssam_device *sdev,
			 struct ssam_event_registry registry, const char *name)
{}

static int spwr_ac_register(struct spwr_ac_device *ac)
{}


/* -- Driver setup. --------------------------------------------------------- */

static int __maybe_unused surface_ac_resume(struct device *dev)
{}
static SIMPLE_DEV_PM_OPS(surface_ac_pm_ops, NULL, surface_ac_resume);

static int surface_ac_probe(struct ssam_device *sdev)
{}

static void surface_ac_remove(struct ssam_device *sdev)
{}

static const struct spwr_psy_properties spwr_psy_props_adp1 =;

static const struct ssam_device_id surface_ac_match[] =;
MODULE_DEVICE_TABLE(ssam, surface_ac_match);

static struct ssam_device_driver surface_ac_driver =;
module_ssam_device_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();