chrome-platform: Updates for v6.16

* New
 
   - Support MT8192 Spherion and MT8186 Corsola devices in of_hw_prober.
   - Turn cros_ec_proto from bool into tristate.
   - Support Pin Assignment E in cros_ec_typec for USB-C to DP cables.
 
 * Improvements
 
   - Avoid -Wflex-array-member-not-at-end warnings.
 
 * Cleanups
 
   - Remove a redundant dependency in Kconfig for cros_kbd_led_backlight.
 -----BEGIN PGP SIGNATURE-----
 
 iIkEABYIADEWIQS0yQeDP3cjLyifNRUrxTEGBto89AUCaDPbTxMcdHp1bmdiaUBr
 ZXJuZWwub3JnAAoJECvFMQYG2jz0wXQBALquKyOJfs8uMRTQHd6hYoG/yiektfEO
 GvYsaK1T4lojAP40/KH8KR5G0A0/9isFN717uieIwRWsCfBkZDbSXf+OAA==
 =bqQj
 -----END PGP SIGNATURE-----

Merge tag 'chrome-platform-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome-platform updates from Tzung-Bi Shih:
 "New:

   - Support MT8192 Spherion and MT8186 Corsola devices in of_hw_prober

   - Turn cros_ec_proto from bool into tristate

   - Support Pin Assignment E in cros_ec_typec for USB-C to DP cables

  Improvements:

   - Avoid -Wflex-array-member-not-at-end warnings

  Cleanups:

   - Remove a redundant dependency in Kconfig for cros_kbd_led_backlight"

* tag 'chrome-platform-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
  platform/chrome: kunit: Avoid -Wflex-array-member-not-at-end
  platform/chrome: cros_ec_typec: Set Pin Assignment E in DP PORT VDO
  platform/chrome: of_hw_prober: Support touchscreen probing on Squirtle
  platform/chrome: of_hw_prober: Support trackpad probing on Corsola family
  platform/chrome: cros_kbd_led_backlight: Fix build dependencies
  platform/chrome: cros_kbd_led_backlight: Remove CROS_EC dependency
  platform/chrome: cros_ec_proto: Allow to build as module
  platform/chrome: cros_ec_debugfs: Avoid -Wflex-array-member-not-at-end warnings
  platform/chrome: cros_kbd_led_backlight: Avoid -Wflex-array-member-not-at-end warnings
  platform/chrome: cros_ec_proto: Avoid -Wflex-array-member-not-at-end warnings
  platform/chrome: of_hw_prober: Support Google Spherion
pull/1250/head
Linus Torvalds 2025-05-27 14:54:35 -07:00
commit d48d8380d9
8 changed files with 85 additions and 67 deletions

View File

@ -155,13 +155,14 @@ config CROS_EC_LPC
module will be called cros_ec_lpcs.
config CROS_EC_PROTO
bool
tristate
help
ChromeOS EC communication protocol helpers.
config CROS_KBD_LED_BACKLIGHT
tristate "Backlight LED support for Chrome OS keyboards"
depends on LEDS_CLASS && (ACPI || CROS_EC || MFD_CROS_EC_DEV)
depends on LEDS_CLASS
depends on MFD_CROS_EC_DEV || (MFD_CROS_EC_DEV=n && ACPI)
help
This option enables support for the keyboard backlight LEDs on
select Chrome OS systems.

View File

@ -25,7 +25,8 @@ endif
obj-$(CONFIG_CROS_EC_TYPEC) += cros-ec-typec.o
obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpcs.o
obj-$(CONFIG_CROS_EC_PROTO) += cros_ec_proto.o cros_ec_trace.o
cros-ec-proto-objs := cros_ec_proto.o cros_ec_trace.o
obj-$(CONFIG_CROS_EC_PROTO) += cros-ec-proto.o
obj-$(CONFIG_CROS_KBD_LED_BACKLIGHT) += cros_kbd_led_backlight.o
obj-$(CONFIG_CROS_EC_CHARDEV) += cros_ec_chardev.o
obj-$(CONFIG_CROS_EC_LIGHTBAR) += cros_ec_lightbar.o

View File

@ -57,7 +57,9 @@ static int chromeos_i2c_component_prober(struct device *dev, const void *_data)
}
DEFINE_CHROMEOS_I2C_PROBE_DATA_DUMB_BY_TYPE(touchscreen);
DEFINE_CHROMEOS_I2C_PROBE_DATA_DUMB_BY_TYPE(trackpad);
DEFINE_CHROMEOS_I2C_PROBE_CFG_SIMPLE_BY_TYPE(touchscreen);
DEFINE_CHROMEOS_I2C_PROBE_CFG_SIMPLE_BY_TYPE(trackpad);
static const struct chromeos_i2c_probe_data chromeos_i2c_probe_hana_trackpad = {
@ -75,6 +77,17 @@ static const struct chromeos_i2c_probe_data chromeos_i2c_probe_hana_trackpad = {
},
};
static const struct chromeos_i2c_probe_data chromeos_i2c_probe_squirtle_touchscreen = {
.cfg = &chromeos_i2c_probe_simple_touchscreen_cfg,
.opts = &(const struct i2c_of_probe_simple_opts) {
.res_node_compatible = "elan,ekth6a12nay",
.supply_name = "vcc33",
.gpio_name = "reset",
.post_power_on_delay_ms = 10,
.post_gpio_config_delay_ms = 300,
},
};
static const struct hw_prober_entry hw_prober_platforms[] = {
{
.compatible = "google,hana",
@ -84,6 +97,26 @@ static const struct hw_prober_entry hw_prober_platforms[] = {
.compatible = "google,hana",
.prober = chromeos_i2c_component_prober,
.data = &chromeos_i2c_probe_hana_trackpad,
}, {
.compatible = "google,spherion",
.prober = chromeos_i2c_component_prober,
.data = &chromeos_i2c_probe_hana_trackpad,
}, {
.compatible = "google,squirtle",
.prober = chromeos_i2c_component_prober,
.data = &chromeos_i2c_probe_dumb_trackpad,
}, {
.compatible = "google,squirtle",
.prober = chromeos_i2c_component_prober,
.data = &chromeos_i2c_probe_squirtle_touchscreen,
}, {
.compatible = "google,steelix",
.prober = chromeos_i2c_component_prober,
.data = &chromeos_i2c_probe_dumb_trackpad,
}, {
.compatible = "google,voltorb",
.prober = chromeos_i2c_component_prober,
.data = &chromeos_i2c_probe_dumb_trackpad,
},
};

View File

@ -207,22 +207,15 @@ static ssize_t cros_ec_pdinfo_read(struct file *file,
char read_buf[EC_USB_PD_MAX_PORTS * 40], *p = read_buf;
struct cros_ec_debugfs *debug_info = file->private_data;
struct cros_ec_device *ec_dev = debug_info->ec->ec_dev;
struct {
struct cros_ec_command msg;
union {
struct ec_response_usb_pd_control_v1 resp;
struct ec_params_usb_pd_control params;
};
} __packed ec_buf;
struct cros_ec_command *msg;
struct ec_response_usb_pd_control_v1 *resp;
struct ec_params_usb_pd_control *params;
DEFINE_RAW_FLEX(struct cros_ec_command, msg, data,
MAX(sizeof(struct ec_response_usb_pd_control_v1),
sizeof(struct ec_params_usb_pd_control)));
struct ec_response_usb_pd_control_v1 *resp =
(struct ec_response_usb_pd_control_v1 *)msg->data;
struct ec_params_usb_pd_control *params =
(struct ec_params_usb_pd_control *)msg->data;
int i;
msg = &ec_buf.msg;
params = (struct ec_params_usb_pd_control *)msg->data;
resp = (struct ec_response_usb_pd_control_v1 *)msg->data;
msg->command = EC_CMD_USB_PD_CONTROL;
msg->version = 1;
msg->insize = sizeof(*resp);
@ -253,17 +246,15 @@ static ssize_t cros_ec_pdinfo_read(struct file *file,
static bool cros_ec_uptime_is_supported(struct cros_ec_device *ec_dev)
{
struct {
struct cros_ec_command cmd;
struct ec_response_uptime_info resp;
} __packed msg = {};
DEFINE_RAW_FLEX(struct cros_ec_command, msg, data,
sizeof(struct ec_response_uptime_info));
int ret;
msg.cmd.command = EC_CMD_GET_UPTIME_INFO;
msg.cmd.insize = sizeof(msg.resp);
msg->command = EC_CMD_GET_UPTIME_INFO;
msg->insize = sizeof(struct ec_response_uptime_info);
ret = cros_ec_cmd_xfer_status(ec_dev, &msg.cmd);
if (ret == -EPROTO && msg.cmd.result == EC_RES_INVALID_COMMAND)
ret = cros_ec_cmd_xfer_status(ec_dev, msg);
if (ret == -EPROTO && msg->result == EC_RES_INVALID_COMMAND)
return false;
/* Other errors maybe a transient error, do not rule about support. */
@ -275,20 +266,17 @@ static ssize_t cros_ec_uptime_read(struct file *file, char __user *user_buf,
{
struct cros_ec_debugfs *debug_info = file->private_data;
struct cros_ec_device *ec_dev = debug_info->ec->ec_dev;
struct {
struct cros_ec_command cmd;
struct ec_response_uptime_info resp;
} __packed msg = {};
struct ec_response_uptime_info *resp;
DEFINE_RAW_FLEX(struct cros_ec_command, msg, data,
sizeof(struct ec_response_uptime_info));
struct ec_response_uptime_info *resp =
(struct ec_response_uptime_info *)msg->data;
char read_buf[32];
int ret;
resp = (struct ec_response_uptime_info *)&msg.resp;
msg->command = EC_CMD_GET_UPTIME_INFO;
msg->insize = sizeof(*resp);
msg.cmd.command = EC_CMD_GET_UPTIME_INFO;
msg.cmd.insize = sizeof(*resp);
ret = cros_ec_cmd_xfer_status(ec_dev, &msg.cmd);
ret = cros_ec_cmd_xfer_status(ec_dev, msg);
if (ret < 0)
return ret;

View File

@ -139,12 +139,10 @@ static int cros_ec_xfer_command(struct cros_ec_device *ec_dev, struct cros_ec_co
static int cros_ec_wait_until_complete(struct cros_ec_device *ec_dev, uint32_t *result)
{
struct {
struct cros_ec_command msg;
struct ec_response_get_comms_status status;
} __packed buf;
struct cros_ec_command *msg = &buf.msg;
struct ec_response_get_comms_status *status = &buf.status;
DEFINE_RAW_FLEX(struct cros_ec_command, msg, data,
sizeof(struct ec_response_get_comms_status));
struct ec_response_get_comms_status *status =
(struct ec_response_get_comms_status *)msg->data;
int ret = 0, i;
msg->version = 0;
@ -757,16 +755,13 @@ static int get_next_event_xfer(struct cros_ec_device *ec_dev,
static int get_next_event(struct cros_ec_device *ec_dev)
{
struct {
struct cros_ec_command msg;
struct ec_response_get_next_event_v3 event;
} __packed buf;
struct cros_ec_command *msg = &buf.msg;
struct ec_response_get_next_event_v3 *event = &buf.event;
DEFINE_RAW_FLEX(struct cros_ec_command, msg, data,
sizeof(struct ec_response_get_next_event_v3));
struct ec_response_get_next_event_v3 *event =
(struct ec_response_get_next_event_v3 *)msg->data;
int cmd_version = ec_dev->mkbp_event_supported - 1;
u32 size;
memset(msg, 0, sizeof(*msg));
if (ec_dev->suspended) {
dev_dbg(ec_dev->dev, "Device suspended.\n");
return -EHOSTDOWN;
@ -1157,3 +1152,6 @@ int cros_ec_get_cmd_versions(struct cros_ec_device *ec_dev, u16 cmd)
return resp.version_mask;
}
EXPORT_SYMBOL_GPL(cros_ec_get_cmd_versions);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("ChromeOS EC communication protocol helpers");

View File

@ -13,7 +13,6 @@ struct ec_xfer_mock {
struct kunit *test;
/* input */
struct cros_ec_command msg;
void *i_data;
/* output */
@ -21,6 +20,10 @@ struct ec_xfer_mock {
int result;
void *o_data;
u32 o_data_len;
/* input */
/* Must be last -ends in a flexible-array member. */
struct cros_ec_command msg;
};
extern int cros_kunit_ec_xfer_mock_default_result;

View File

@ -22,8 +22,10 @@
#define DRV_NAME "cros-ec-typec"
#define DP_PORT_VDO (DP_CONF_SET_PIN_ASSIGN(BIT(DP_PIN_ASSIGN_C) | BIT(DP_PIN_ASSIGN_D)) | \
DP_CAP_DFP_D | DP_CAP_RECEPTACLE)
#define DP_PORT_VDO (DP_CAP_DFP_D | DP_CAP_RECEPTACLE | \
DP_CONF_SET_PIN_ASSIGN(BIT(DP_PIN_ASSIGN_C) | \
BIT(DP_PIN_ASSIGN_D) | \
BIT(DP_PIN_ASSIGN_E)))
static void cros_typec_role_switch_quirk(struct fwnode_handle *fwnode)
{

View File

@ -137,16 +137,12 @@ static int
keyboard_led_set_brightness_ec_pwm(struct led_classdev *cdev,
enum led_brightness brightness)
{
struct {
struct cros_ec_command msg;
struct ec_params_pwm_set_keyboard_backlight params;
} __packed buf;
struct ec_params_pwm_set_keyboard_backlight *params = &buf.params;
struct cros_ec_command *msg = &buf.msg;
DEFINE_RAW_FLEX(struct cros_ec_command, msg, data,
sizeof(struct ec_params_pwm_set_keyboard_backlight));
struct ec_params_pwm_set_keyboard_backlight *params =
(struct ec_params_pwm_set_keyboard_backlight *)msg->data;
struct keyboard_led *keyboard_led = container_of(cdev, struct keyboard_led, cdev);
memset(&buf, 0, sizeof(buf));
msg->command = EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT;
msg->outsize = sizeof(*params);
@ -158,17 +154,13 @@ keyboard_led_set_brightness_ec_pwm(struct led_classdev *cdev,
static enum led_brightness
keyboard_led_get_brightness_ec_pwm(struct led_classdev *cdev)
{
struct {
struct cros_ec_command msg;
struct ec_response_pwm_get_keyboard_backlight resp;
} __packed buf;
struct ec_response_pwm_get_keyboard_backlight *resp = &buf.resp;
struct cros_ec_command *msg = &buf.msg;
DEFINE_RAW_FLEX(struct cros_ec_command, msg, data,
sizeof(struct ec_response_pwm_get_keyboard_backlight));
struct ec_response_pwm_get_keyboard_backlight *resp =
(struct ec_response_pwm_get_keyboard_backlight *)msg->data;
struct keyboard_led *keyboard_led = container_of(cdev, struct keyboard_led, cdev);
int ret;
memset(&buf, 0, sizeof(buf));
msg->command = EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT;
msg->insize = sizeof(*resp);