#include <asm/unaligned.h>
#include <linux/input.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/workqueue.h>
#include <linux/surface_aggregator/controller.h>
#include <linux/surface_aggregator/device.h>
struct ssam_tablet_sw;
struct ssam_tablet_sw_state { … };
struct ssam_tablet_sw_ops { … };
struct ssam_tablet_sw { … };
struct ssam_tablet_sw_desc { … };
static ssize_t state_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(state);
static struct attribute *ssam_tablet_sw_attrs[] = …;
static const struct attribute_group ssam_tablet_sw_group = …;
static void ssam_tablet_sw_update_workfn(struct work_struct *work)
{ … }
static int __maybe_unused ssam_tablet_sw_resume(struct device *dev)
{ … }
static SIMPLE_DEV_PM_OPS(ssam_tablet_sw_pm_ops, NULL, ssam_tablet_sw_resume);
static int ssam_tablet_sw_probe(struct ssam_device *sdev)
{ … }
static void ssam_tablet_sw_remove(struct ssam_device *sdev)
{ … }
#define SSAM_EVENT_KIP_CID_COVER_STATE_CHANGED …
enum ssam_kip_cover_state { … };
static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw,
const struct ssam_tablet_sw_state *state)
{ … }
static bool ssam_kip_cover_state_is_tablet_mode(struct ssam_tablet_sw *sw,
const struct ssam_tablet_sw_state *state)
{ … }
SSAM_DEFINE_SYNC_REQUEST_R(__ssam_kip_get_cover_state, u8, {
.target_category = SSAM_SSH_TC_KIP,
.target_id = SSAM_SSH_TID_SAM,
.command_id = 0x1d,
.instance_id = 0x00,
});
static int ssam_kip_get_cover_state(struct ssam_tablet_sw *sw, struct ssam_tablet_sw_state *state)
{ … }
static u32 ssam_kip_sw_notif(struct ssam_event_notifier *nf, const struct ssam_event *event)
{ … }
static const struct ssam_tablet_sw_desc ssam_kip_sw_desc = …;
static bool tablet_mode_in_slate_state = …;
module_param(tablet_mode_in_slate_state, bool, 0644);
MODULE_PARM_DESC(…) …;
#define SSAM_EVENT_POS_CID_POSTURE_CHANGED …
#define SSAM_POS_MAX_SOURCES …
enum ssam_pos_source_id { … };
enum ssam_pos_state_cover { … };
enum ssam_pos_state_sls { … };
struct ssam_sources_list { … } __packed;
static const char *ssam_pos_state_name_cover(struct ssam_tablet_sw *sw, u32 state)
{ … }
static const char *ssam_pos_state_name_sls(struct ssam_tablet_sw *sw, u32 state)
{ … }
static const char *ssam_pos_state_name(struct ssam_tablet_sw *sw,
const struct ssam_tablet_sw_state *state)
{ … }
static bool ssam_pos_state_is_tablet_mode_cover(struct ssam_tablet_sw *sw, u32 state)
{ … }
static bool ssam_pos_state_is_tablet_mode_sls(struct ssam_tablet_sw *sw, u32 state)
{ … }
static bool ssam_pos_state_is_tablet_mode(struct ssam_tablet_sw *sw,
const struct ssam_tablet_sw_state *state)
{ … }
static int ssam_pos_get_sources_list(struct ssam_tablet_sw *sw, struct ssam_sources_list *sources)
{ … }
static int ssam_pos_get_source(struct ssam_tablet_sw *sw, u32 *source_id)
{ … }
SSAM_DEFINE_SYNC_REQUEST_WR(__ssam_pos_get_posture_for_source, __le32, __le32, {
.target_category = SSAM_SSH_TC_POS,
.target_id = SSAM_SSH_TID_SAM,
.command_id = 0x02,
.instance_id = 0x00,
});
static int ssam_pos_get_posture_for_source(struct ssam_tablet_sw *sw, u32 source_id, u32 *posture)
{ … }
static int ssam_pos_get_posture(struct ssam_tablet_sw *sw, struct ssam_tablet_sw_state *state)
{ … }
static u32 ssam_pos_sw_notif(struct ssam_event_notifier *nf, const struct ssam_event *event)
{ … }
static const struct ssam_tablet_sw_desc ssam_pos_sw_desc = …;
static const struct ssam_device_id ssam_tablet_sw_match[] = …;
MODULE_DEVICE_TABLE(ssam, ssam_tablet_sw_match);
static struct ssam_device_driver ssam_tablet_sw_driver = …;
module_ssam_device_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;