chrome platform changes for 6.5

* Improvements
 
   - Support Pin Assignment D in getting mux state.
   - Emit an uevent when EC panics so that userland programs get chance
     to capture EC coredumps (LPC interface only).
   - Send EC_CMD_HOST_SLEEP_EVENT to EC at the very beginning/end of
     system suspend/resume so that EC can watch the duration more
     accurately (LPC interface only).
 
 * Misc
 
   - Switch back from I2C .probe_new() to .probe().
   - Use %*ph for printing hexdump of small buffers.
 -----BEGIN PGP SIGNATURE-----
 
 iIkEABYIADEWIQS0yQeDP3cjLyifNRUrxTEGBto89AUCZJkmZBMcdHp1bmdiaUBr
 ZXJuZWwub3JnAAoJECvFMQYG2jz0cngBAO0x62c4IhOmzAjGNY0Dg7M2fs4exXT+
 UHgNjk+ryxLsAPwKyHH1R3jhsO5IHz/gxfM1BQEWS4crNXDgcmA9OmIFDg==
 =pjpq
 -----END PGP SIGNATURE-----

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

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

   - Support Pin Assignment D in getting mux state

   - Emit an uevent when EC panics so that userland programs get chance
     to capture EC coredumps (LPC interface only)

   - Send EC_CMD_HOST_SLEEP_EVENT to EC at the very beginning/end of
     system suspend/resume so that EC can watch the duration more
     accurately (LPC interface only)

  Misc:

   - Switch back from I2C .probe_new() to .probe()

   - Use %*ph for printing hexdump of small buffers"

* tag 'tag-chrome-platform-for-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
  platform/chrome: cros_ec_spi: Use %*ph for printing hexdump of a small buffer
  platform/chrome: Switch i2c drivers back to use .probe()
  platform/chrome: cros_ec_lpc: Move host command to prepare/complete
  platform/chrome: cros_ec: Report EC panic as uevent
  platform/chrome: cros_typec_switch: Add Pin D support
This commit is contained in:
Linus Torvalds 2023-06-26 20:12:07 -07:00
commit 1ef6663a58
5 changed files with 21 additions and 17 deletions

View File

@ -372,7 +372,7 @@ static struct i2c_driver cros_ec_driver = {
.of_match_table = of_match_ptr(cros_ec_i2c_of_match),
.pm = &cros_ec_i2c_pm_ops,
},
.probe_new = cros_ec_i2c_probe,
.probe = cros_ec_i2c_probe,
.remove = cros_ec_i2c_remove,
.id_table = cros_ec_i2c_id,
};

View File

@ -16,6 +16,7 @@
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
@ -315,6 +316,7 @@ static int cros_ec_lpc_readmem(struct cros_ec_device *ec, unsigned int offset,
static void cros_ec_lpc_acpi_notify(acpi_handle device, u32 value, void *data)
{
static const char *env[] = { "ERROR=PANIC", NULL };
struct cros_ec_device *ec_dev = data;
bool ec_has_more_events;
int ret;
@ -324,6 +326,7 @@ static void cros_ec_lpc_acpi_notify(acpi_handle device, u32 value, void *data)
if (value == ACPI_NOTIFY_CROS_EC_PANIC) {
dev_emerg(ec_dev->dev, "CrOS EC Panic Reported. Shutdown is imminent!");
blocking_notifier_call_chain(&ec_dev->panic_notifier, 0, ec_dev);
kobject_uevent_env(&ec_dev->dev->kobj, KOBJ_CHANGE, (char **)env);
/* Begin orderly shutdown. Force shutdown after 1 second. */
hw_protection_shutdown("CrOS EC Panic", 1000);
/* Do not query for other events after a panic is reported */
@ -543,23 +546,25 @@ static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = {
MODULE_DEVICE_TABLE(dmi, cros_ec_lpc_dmi_table);
#ifdef CONFIG_PM_SLEEP
static int cros_ec_lpc_suspend(struct device *dev)
static int cros_ec_lpc_prepare(struct device *dev)
{
struct cros_ec_device *ec_dev = dev_get_drvdata(dev);
return cros_ec_suspend(ec_dev);
}
static int cros_ec_lpc_resume(struct device *dev)
static void cros_ec_lpc_complete(struct device *dev)
{
struct cros_ec_device *ec_dev = dev_get_drvdata(dev);
return cros_ec_resume(ec_dev);
cros_ec_resume(ec_dev);
}
#endif
static const struct dev_pm_ops cros_ec_lpc_pm_ops = {
SET_LATE_SYSTEM_SLEEP_PM_OPS(cros_ec_lpc_suspend, cros_ec_lpc_resume)
#ifdef CONFIG_PM_SLEEP
.prepare = cros_ec_lpc_prepare,
.complete = cros_ec_lpc_complete
#endif
};
static struct platform_driver cros_ec_lpc_driver = {

View File

@ -104,13 +104,7 @@ static void debug_packet(struct device *dev, const char *name, u8 *ptr,
int len)
{
#ifdef DEBUG
int i;
dev_dbg(dev, "%s: ", name);
for (i = 0; i < len; i++)
pr_cont(" %02x", ptr[i]);
pr_cont("\n");
dev_dbg(dev, "%s: %*ph\n", name, len, ptr);
#endif
}

View File

@ -143,7 +143,7 @@ MODULE_DEVICE_TABLE(acpi, hps_acpi_id);
#endif /* CONFIG_ACPI */
static struct i2c_driver hps_i2c_driver = {
.probe_new = hps_i2c_probe,
.probe = hps_i2c_probe,
.remove = hps_i2c_remove,
.id_table = hps_i2c_id,
.driver = {

View File

@ -51,13 +51,18 @@ static int cros_typec_cmd_mux_set(struct cros_typec_switch_data *sdata, int port
static int cros_typec_get_mux_state(unsigned long mode, struct typec_altmode *alt)
{
int ret = -EOPNOTSUPP;
u8 pin_assign;
if (mode == TYPEC_STATE_SAFE)
if (mode == TYPEC_STATE_SAFE) {
ret = USB_PD_MUX_SAFE_MODE;
else if (mode == TYPEC_STATE_USB)
} else if (mode == TYPEC_STATE_USB) {
ret = USB_PD_MUX_USB_ENABLED;
else if (alt && alt->svid == USB_TYPEC_DP_SID)
} else if (alt && alt->svid == USB_TYPEC_DP_SID) {
ret = USB_PD_MUX_DP_ENABLED;
pin_assign = mode - TYPEC_STATE_MODAL;
if (pin_assign & DP_PIN_ASSIGN_D)
ret |= USB_PD_MUX_USB_ENABLED;
}
return ret;
}