mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-17 05:45:20 +00:00
5e5f2f92cc
Lenovo Yoga C630 WOS is a laptop using Snapdragon 850 SoC. Like many laptops it uses an embedded controller (EC) to perform various platform operations, including, but not limited, to Type-C port control or power supply handlng. Add the driver for the EC, that creates devices for UCSI and power supply devices. Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20240614-yoga-ec-driver-v7-2-9f0b9b40ae76@linaro.org [ij: added #include <linux/cleanup.h>] Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
45 lines
1.3 KiB
C
45 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (c) 2022-2024, Linaro Ltd
|
|
* Authors:
|
|
* Bjorn Andersson
|
|
* Dmitry Baryshkov
|
|
*/
|
|
|
|
#ifndef _LENOVO_YOGA_C630_DATA_H
|
|
#define _LENOVO_YOGA_C630_DATA_H
|
|
|
|
struct yoga_c630_ec;
|
|
struct notifier_block;
|
|
|
|
#define YOGA_C630_MOD_NAME "lenovo_yoga_c630"
|
|
|
|
#define YOGA_C630_DEV_UCSI "ucsi"
|
|
#define YOGA_C630_DEV_PSY "psy"
|
|
|
|
int yoga_c630_ec_read8(struct yoga_c630_ec *ec, u8 addr);
|
|
int yoga_c630_ec_read16(struct yoga_c630_ec *ec, u8 addr);
|
|
|
|
int yoga_c630_ec_register_notify(struct yoga_c630_ec *ec, struct notifier_block *nb);
|
|
void yoga_c630_ec_unregister_notify(struct yoga_c630_ec *ec, struct notifier_block *nb);
|
|
|
|
#define YOGA_C630_UCSI_WRITE_SIZE 8
|
|
#define YOGA_C630_UCSI_CCI_SIZE 4
|
|
#define YOGA_C630_UCSI_DATA_SIZE 16
|
|
#define YOGA_C630_UCSI_READ_SIZE (YOGA_C630_UCSI_CCI_SIZE + YOGA_C630_UCSI_DATA_SIZE)
|
|
|
|
u16 yoga_c630_ec_ucsi_get_version(struct yoga_c630_ec *ec);
|
|
int yoga_c630_ec_ucsi_write(struct yoga_c630_ec *ec,
|
|
const u8 req[YOGA_C630_UCSI_WRITE_SIZE]);
|
|
int yoga_c630_ec_ucsi_read(struct yoga_c630_ec *ec,
|
|
u8 resp[YOGA_C630_UCSI_READ_SIZE]);
|
|
|
|
#define LENOVO_EC_EVENT_USB 0x20
|
|
#define LENOVO_EC_EVENT_UCSI 0x21
|
|
#define LENOVO_EC_EVENT_HPD 0x22
|
|
#define LENOVO_EC_EVENT_BAT_STATUS 0x24
|
|
#define LENOVO_EC_EVENT_BAT_INFO 0x25
|
|
#define LENOVO_EC_EVENT_BAT_ADPT_STATUS 0x37
|
|
|
|
#endif
|