linux/drivers/platform/arm64/acer-aspire1-ec.c

// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2024, Nikita Travkin <[email protected]> */

#include <asm-generic/unaligned.h>
#include <drm/drm_bridge.h>
#include <linux/bits.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/usb/typec_mux.h>
#include <linux/workqueue_types.h>

#define MILLI_TO_MICRO

#define ASPIRE_EC_EVENT

#define ASPIRE_EC_EVENT_WATCHDOG
#define ASPIRE_EC_EVENT_KBD_BKL_ON
#define ASPIRE_EC_EVENT_KBD_BKL_OFF
#define ASPIRE_EC_EVENT_LID_CLOSE
#define ASPIRE_EC_EVENT_LID_OPEN
#define ASPIRE_EC_EVENT_BKL_UNBLANKED
#define ASPIRE_EC_EVENT_BKL_BLANKED
#define ASPIRE_EC_EVENT_FG_INF_CHG
#define ASPIRE_EC_EVENT_FG_STA_CHG
#define ASPIRE_EC_EVENT_HPD_DIS
#define ASPIRE_EC_EVENT_HPD_CON

#define ASPIRE_EC_FG_DYNAMIC
#define ASPIRE_EC_FG_STATIC

#define ASPIRE_EC_FG_FLAG_PRESENT
#define ASPIRE_EC_FG_FLAG_FULL
#define ASPIRE_EC_FG_FLAG_DISCHARGING
#define ASPIRE_EC_FG_FLAG_CHARGING

#define ASPIRE_EC_RAM_READ
#define ASPIRE_EC_RAM_WRITE

#define ASPIRE_EC_RAM_WATCHDOG
#define ASPIRE_EC_WATCHDOG_BIT

#define ASPIRE_EC_RAM_KBD_MODE

#define ASPIRE_EC_RAM_KBD_FN_EN
#define ASPIRE_EC_RAM_KBD_MEDIA_ON_TOP
#define ASPIRE_EC_RAM_KBD_ALWAYS_SET
#define ASPIRE_EC_RAM_KBD_NUM_LAYER_EN

#define ASPIRE_EC_RAM_KBD_MODE_2

#define ASPIRE_EC_RAM_KBD_MEDIA_NOTIFY

#define ASPIRE_EC_RAM_HPD_STATUS
#define ASPIRE_EC_HPD_CONNECTED

#define ASPIRE_EC_RAM_LID_STATUS
#define ASPIRE_EC_LID_OPEN

#define ASPIRE_EC_RAM_ADP
#define ASPIRE_EC_AC_STATUS

struct aspire_ec {};

static int aspire_ec_ram_read(struct i2c_client *client, u8 off, u8 *data, u8 data_len)
{}

static int aspire_ec_ram_write(struct i2c_client *client, u8 off, u8 data)
{}

static irqreturn_t aspire_ec_irq_handler(int irq, void *data)
{}

/*
 * Power supply.
 */

struct aspire_ec_bat_psy_static_data {} __packed;

static const char * const aspire_ec_bat_psy_battery_model[] =;

static const char * const aspire_ec_bat_psy_battery_vendor[] =;

struct aspire_ec_bat_psy_dynamic_data {} __packed;

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

static enum power_supply_property aspire_ec_bat_psy_props[] =;

static const struct power_supply_desc aspire_ec_bat_psy_desc =;

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

static enum power_supply_property aspire_ec_adp_psy_props[] =;

static const struct power_supply_desc aspire_ec_adp_psy_desc =;

/*
 * USB-C DP Alt mode HPD.
 */

static int aspire_ec_bridge_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags)
{}

static void aspire_ec_bridge_update_hpd_work(struct work_struct *work)
{}

static void aspire_ec_bridge_hpd_enable(struct drm_bridge *bridge)
{}

static const struct drm_bridge_funcs aspire_ec_bridge_funcs =;

/*
 * Sysfs attributes.
 */

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

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

static DEVICE_ATTR_RW(fn_lock);

static struct attribute *aspire_ec_attrs[] =;
ATTRIBUTE_GROUPS();

static int aspire_ec_probe(struct i2c_client *client)
{}

static int aspire_ec_resume(struct device *dev)
{}

static const struct i2c_device_id aspire_ec_id[] =;
MODULE_DEVICE_TABLE(i2c, aspire_ec_id);

static const struct of_device_id aspire_ec_of_match[] =;
MODULE_DEVICE_TABLE(of, aspire_ec_of_match);

static DEFINE_SIMPLE_DEV_PM_OPS(aspire_ec_pm_ops, NULL, aspire_ec_resume);

static struct i2c_driver aspire_ec_driver =;
module_i2c_driver();

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