Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e1120ae
platform/chrome: chromeos_laptop - stop setting suspend mode for Atme…
dtor Mar 20, 2018
3bd910a
platform/chrome: chromeos_laptop - introduce pr_fmt()
dtor Mar 20, 2018
e34e959
platform/chrome: chromeos_laptop - factor out getting IRQ from DMI
dtor Mar 20, 2018
ffa0bb3
platform/chrome: chromeos_laptop - rework i2c peripherals initialization
dtor Mar 20, 2018
2d76941
platform/chrome: chromeos_laptop - parse DMI IRQ data once
dtor Mar 20, 2018
07781ca
platform/chrome: chromeos_laptop - use I2C notifier to create devices
dtor Mar 20, 2018
1b67992
platform/chrome: chromeos_laptop - rely on I2C to set up interrupt tr…
dtor Mar 20, 2018
00c4979
platform/chrome: chromeos_laptop - use device properties for Pixel
dtor Mar 20, 2018
663de6d
platform/chrome: chromeos_laptop - discard data for unneeded boards
dtor Mar 20, 2018
fbf60df
platform/chrome: cros_ec_lpc: wake up from s2idle on Chrome EC
Feb 22, 2018
77d3e62
platform/chrome: cros_ec_lpc: Add support for Google devices using cu…
Mar 7, 2018
2a8331b
platform/chrome: cros_ec_sysfs: Modify error handling
gwendalcr Mar 23, 2018
c09fb8f
platform/chrome: cros_ec_sysfs: introduce to_cros_ec_dev define.
Mar 23, 2018
0c4f236
platform/chrome: cros_ec_sysfs: use permission-specific DEVICE_ATTR v…
Mar 23, 2018
70a4c69
platform/chrome: cros_ec_debugfs: Use octal permissions '0444'
Mar 23, 2018
975efde
platform/chrome: mfd/cros_ec_dev: Add sysfs entry to set keyboard wak…
gwendalcr Mar 23, 2018
360ca3d
platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device f…
dtor May 22, 2018
2d31288
Revert "mfd: cros_ec: Add ACPI GPE handler for LID0 devices"
Feb 22, 2018
906eb67
mfd: cros_ec: Retry commands when EC is known to be busy
computersforpeace May 23, 2018
7764be9
platform: chrome: Add Tablet Switch ACPI driver
gwendalcr Jan 30, 2017
3c4c60d
platform/chrome: chromeos_laptop - supply properties for ACPI devices
dtor May 4, 2018
9107533
platform: chrome: Add input dependency for tablet switch driver
arndb May 28, 2018
a6953b2
mfd: cros_ec: Fail early if we cannot identify the EC
vpalatin Apr 18, 2018
25c5ab9
mfd: cros_ec: Free IRQ automatically
vpalatin Apr 18, 2018
4904474
mfd: cros_ec: Don't try to grab log when suspended
dianders Apr 18, 2018
a4b6301
mfd: cros_ec_dev: Register cros-ec-rtc driver as a subdevice
Apr 18, 2018
2ad83d1
mfd: cros_ec_dev: Register shutdown function for debugfs
Apr 18, 2018
f080fde
mfd: cros_ec_i2c: Add ACPI module device table
aitjcize Apr 18, 2018
09011e9
GalliumOS: Config: Enable TBMC as a module
danielstuart14 Jul 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion drivers/mfd/Makefile
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o
obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o
obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o
cros_ec_core-objs := cros_ec.o
cros_ec_core-$(CONFIG_ACPI) += cros_ec_acpi_gpe.o
obj-$(CONFIG_MFD_CROS_EC) += cros_ec_core.o
obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o
obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o
Expand Down
41 changes: 14 additions & 27 deletions drivers/mfd/cros_ec.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,12 +112,16 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

mutex_init(&ec_dev->lock);

cros_ec_query_all(ec_dev);
err = cros_ec_query_all(ec_dev);
if (err) {
dev_err(dev, "Cannot identify the EC: error %d\n", err);
return err;
}

if (ec_dev->irq) {
err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
err = devm_request_threaded_irq(dev, ec_dev->irq, NULL,
ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
if (err) {
dev_err(dev, "Failed to request IRQ %d: %d",
ec_dev->irq, err);
Expand All@@ -131,7 +135,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Embedded Controller subdevice %d\n",
err);
goto fail_mfd;
return err;
}

if (ec_dev->max_passthru) {
Expand All@@ -149,7 +153,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Power Delivery subdevice %d\n",
err);
goto fail_mfd;
return err;
}
}

Expand All@@ -158,7 +162,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
if (err) {
mfd_remove_devices(dev);
dev_err(dev, "Failed to register sub-devices\n");
goto fail_mfd;
return err;
}
}

Expand All@@ -173,26 +177,14 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

dev_info(dev, "Chrome EC device registered\n");

cros_ec_acpi_install_gpe_handler(dev);

return 0;

fail_mfd:
if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);
return err;
}
EXPORT_SYMBOL(cros_ec_register);

int cros_ec_remove(struct cros_ec_device *ec_dev)
{
mfd_remove_devices(ec_dev->dev);

cros_ec_acpi_remove_gpe_handler();

if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);

return 0;
}
EXPORT_SYMBOL(cros_ec_remove);
Expand All@@ -204,14 +196,9 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev)
int ret;
u8 sleep_event;

if (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) {
sleep_event = HOST_SLEEP_EVENT_S3_SUSPEND;
} else {
sleep_event = HOST_SLEEP_EVENT_S0IX_SUSPEND;

/* Clearing the GPE status for any pending event */
cros_ec_acpi_clear_gpe();
}
sleep_event = (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) ?
HOST_SLEEP_EVENT_S3_SUSPEND :
HOST_SLEEP_EVENT_S0IX_SUSPEND;

ret = cros_ec_sleep_event(ec_dev, sleep_event);
if (ret < 0)
Expand Down
103 changes: 0 additions & 103 deletions drivers/mfd/cros_ec_acpi_gpe.c

This file was deleted.

62 changes: 43 additions & 19 deletions drivers/mfd/cros_ec_dev.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -305,8 +305,8 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)

resp = (struct ec_response_motion_sense *)msg->data;
sensor_num = resp->dump.sensor_count;
/* Allocate 2 extra sensors in case lid angle or FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 2),
/* Allocate 1 extra sensors in FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 1),
GFP_KERNEL);
if (sensor_cells == NULL)
goto error;
Expand DownExpand Up@@ -362,16 +362,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
sensor_type[resp->info.type]++;
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2) {
sensor_platforms[id].sensor_num = sensor_num;

sensor_cells[id].name = "cros-ec-angle";
sensor_cells[id].id = 0;
sensor_cells[id].platform_data = &sensor_platforms[id];
sensor_cells[id].pdata_size =
sizeof(struct cros_ec_sensor_platform);
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2)
ec->has_kb_wake_angle = true;

if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) {
sensor_cells[id].name = "cros-ec-ring";
id++;
Expand All@@ -389,6 +383,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
kfree(msg);
}

static const struct mfd_cell cros_ec_rtc_cells[] = {
{ .name = "cros-ec-rtc" }
};

static int ec_device_probe(struct platform_device *pdev)
{
int retval = -ENOMEM;
Expand DownExpand Up@@ -424,6 +422,26 @@ static int ec_device_probe(struct platform_device *pdev)
goto failed;
}

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Check whether this EC instance has RTC host command support */
if (cros_ec_check_features(ec, EC_FEATURE_RTC)) {
retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
cros_ec_rtc_cells,
ARRAY_SIZE(cros_ec_rtc_cells),
NULL, 0, NULL);
if (retval)
dev_err(ec->dev,
"failed to add cros-ec-rtc device: %d\n",
retval);
}

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

/* We can now add the sysfs class, we know which parameter to show */
retval = cdev_device_add(&ec->cdev, &ec->class_dev);
if (retval) {
dev_err(dev, "cdev_device_add failed => %d\n", retval);
Expand All@@ -433,13 +451,6 @@ static int ec_device_probe(struct platform_device *pdev)
if (cros_ec_debugfs_init(ec))
dev_warn(dev, "failed to create debugfs directory\n");

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

return 0;

failed:
Expand All@@ -461,16 +472,26 @@ static int ec_device_remove(struct platform_device *pdev)
return 0;
}

static void ec_device_shutdown(struct platform_device *pdev)
{
struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev);

/* Be sure to clear up debugfs delayed works */
cros_ec_debugfs_remove(ec);
}

static const struct platform_device_id cros_ec_id[] = {
{ DRV_NAME, 0 },
{ /* sentinel */ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, cros_ec_id);

static __maybe_unused int ec_device_suspend(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_suspend(ec);

lb_suspend(ec);

return 0;
Expand All@@ -480,6 +501,8 @@ static __maybe_unused int ec_device_resume(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_resume(ec);

lb_resume(ec);

return 0;
Expand All@@ -499,6 +522,7 @@ static struct platform_driver cros_ec_dev_driver = {
},
.probe = ec_device_probe,
.remove = ec_device_remove,
.shutdown = ec_device_shutdown,
};

static int __init cros_ec_dev_init(void)
Expand Down
12 changes: 12 additions & 0 deletions drivers/mfd/cros_ec_i2c.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand DownExpand Up@@ -344,21 +345,32 @@ static int cros_ec_i2c_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(cros_ec_i2c_pm_ops, cros_ec_i2c_suspend,
cros_ec_i2c_resume);

#ifdef CONFIG_OF
static const struct of_device_id cros_ec_i2c_of_match[] = {
{ .compatible = "google,cros-ec-i2c", },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match);
#endif

static const struct i2c_device_id cros_ec_i2c_id[] = {
{ "cros-ec-i2c", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, cros_ec_i2c_id);

#ifdef CONFIG_ACPI
static const struct acpi_device_id cros_ec_i2c_acpi_id[] = {
{ "GOOG0008", 0 },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(acpi, cros_ec_i2c_acpi_id);
#endif

static struct i2c_driver cros_ec_driver = {
.driver = {
.name = "cros-ec-i2c",
.acpi_match_table = ACPI_PTR(cros_ec_i2c_acpi_id),
.of_match_table = of_match_ptr(cros_ec_i2c_of_match),
.pm = &cros_ec_i2c_pm_ops,
},
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e1120ae
platform/chrome: chromeos_laptop - stop setting suspend mode for Atme…
dtor Mar 20, 2018
3bd910a
platform/chrome: chromeos_laptop - introduce pr_fmt()
dtor Mar 20, 2018
e34e959
platform/chrome: chromeos_laptop - factor out getting IRQ from DMI
dtor Mar 20, 2018
ffa0bb3
platform/chrome: chromeos_laptop - rework i2c peripherals initialization
dtor Mar 20, 2018
2d76941
platform/chrome: chromeos_laptop - parse DMI IRQ data once
dtor Mar 20, 2018
07781ca
platform/chrome: chromeos_laptop - use I2C notifier to create devices
dtor Mar 20, 2018
1b67992
platform/chrome: chromeos_laptop - rely on I2C to set up interrupt tr…
dtor Mar 20, 2018
00c4979
platform/chrome: chromeos_laptop - use device properties for Pixel
dtor Mar 20, 2018
663de6d
platform/chrome: chromeos_laptop - discard data for unneeded boards
dtor Mar 20, 2018
fbf60df
platform/chrome: cros_ec_lpc: wake up from s2idle on Chrome EC
Feb 22, 2018
77d3e62
platform/chrome: cros_ec_lpc: Add support for Google devices using cu…
Mar 7, 2018
2a8331b
platform/chrome: cros_ec_sysfs: Modify error handling
gwendalcr Mar 23, 2018
c09fb8f
platform/chrome: cros_ec_sysfs: introduce to_cros_ec_dev define.
Mar 23, 2018
0c4f236
platform/chrome: cros_ec_sysfs: use permission-specific DEVICE_ATTR v…
Mar 23, 2018
70a4c69
platform/chrome: cros_ec_debugfs: Use octal permissions '0444'
Mar 23, 2018
975efde
platform/chrome: mfd/cros_ec_dev: Add sysfs entry to set keyboard wak…
gwendalcr Mar 23, 2018
360ca3d
platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device f…
dtor May 22, 2018
2d31288
Revert "mfd: cros_ec: Add ACPI GPE handler for LID0 devices"
Feb 22, 2018
906eb67
mfd: cros_ec: Retry commands when EC is known to be busy
computersforpeace May 23, 2018
7764be9
platform: chrome: Add Tablet Switch ACPI driver
gwendalcr Jan 30, 2017
3c4c60d
platform/chrome: chromeos_laptop - supply properties for ACPI devices
dtor May 4, 2018
9107533
platform: chrome: Add input dependency for tablet switch driver
arndb May 28, 2018
a6953b2
mfd: cros_ec: Fail early if we cannot identify the EC
vpalatin Apr 18, 2018
25c5ab9
mfd: cros_ec: Free IRQ automatically
vpalatin Apr 18, 2018
4904474
mfd: cros_ec: Don't try to grab log when suspended
dianders Apr 18, 2018
a4b6301
mfd: cros_ec_dev: Register cros-ec-rtc driver as a subdevice
Apr 18, 2018
2ad83d1
mfd: cros_ec_dev: Register shutdown function for debugfs
Apr 18, 2018
f080fde
mfd: cros_ec_i2c: Add ACPI module device table
aitjcize Apr 18, 2018
09011e9
GalliumOS: Config: Enable TBMC as a module
danielstuart14 Jul 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion drivers/mfd/Makefile
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o
obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o
obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o
cros_ec_core-objs := cros_ec.o
cros_ec_core-$(CONFIG_ACPI) += cros_ec_acpi_gpe.o
obj-$(CONFIG_MFD_CROS_EC) += cros_ec_core.o
obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o
obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o
Expand Down
41 changes: 14 additions & 27 deletions drivers/mfd/cros_ec.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,12 +112,16 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

mutex_init(&ec_dev->lock);

cros_ec_query_all(ec_dev);
err = cros_ec_query_all(ec_dev);
if (err) {
dev_err(dev, "Cannot identify the EC: error %d\n", err);
return err;
}

if (ec_dev->irq) {
err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
err = devm_request_threaded_irq(dev, ec_dev->irq, NULL,
ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
if (err) {
dev_err(dev, "Failed to request IRQ %d: %d",
ec_dev->irq, err);
Expand All@@ -131,7 +135,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Embedded Controller subdevice %d\n",
err);
goto fail_mfd;
return err;
}

if (ec_dev->max_passthru) {
Expand All@@ -149,7 +153,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Power Delivery subdevice %d\n",
err);
goto fail_mfd;
return err;
}
}

Expand All@@ -158,7 +162,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
if (err) {
mfd_remove_devices(dev);
dev_err(dev, "Failed to register sub-devices\n");
goto fail_mfd;
return err;
}
}

Expand All@@ -173,26 +177,14 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

dev_info(dev, "Chrome EC device registered\n");

cros_ec_acpi_install_gpe_handler(dev);

return 0;

fail_mfd:
if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);
return err;
}
EXPORT_SYMBOL(cros_ec_register);

int cros_ec_remove(struct cros_ec_device *ec_dev)
{
mfd_remove_devices(ec_dev->dev);

cros_ec_acpi_remove_gpe_handler();

if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);

return 0;
}
EXPORT_SYMBOL(cros_ec_remove);
Expand All@@ -204,14 +196,9 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev)
int ret;
u8 sleep_event;

if (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) {
sleep_event = HOST_SLEEP_EVENT_S3_SUSPEND;
} else {
sleep_event = HOST_SLEEP_EVENT_S0IX_SUSPEND;

/* Clearing the GPE status for any pending event */
cros_ec_acpi_clear_gpe();
}
sleep_event = (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) ?
HOST_SLEEP_EVENT_S3_SUSPEND :
HOST_SLEEP_EVENT_S0IX_SUSPEND;

ret = cros_ec_sleep_event(ec_dev, sleep_event);
if (ret < 0)
Expand Down
103 changes: 0 additions & 103 deletions drivers/mfd/cros_ec_acpi_gpe.c

This file was deleted.

62 changes: 43 additions & 19 deletions drivers/mfd/cros_ec_dev.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -305,8 +305,8 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)

resp = (struct ec_response_motion_sense *)msg->data;
sensor_num = resp->dump.sensor_count;
/* Allocate 2 extra sensors in case lid angle or FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 2),
/* Allocate 1 extra sensors in FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 1),
GFP_KERNEL);
if (sensor_cells == NULL)
goto error;
Expand DownExpand Up@@ -362,16 +362,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
sensor_type[resp->info.type]++;
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2) {
sensor_platforms[id].sensor_num = sensor_num;

sensor_cells[id].name = "cros-ec-angle";
sensor_cells[id].id = 0;
sensor_cells[id].platform_data = &sensor_platforms[id];
sensor_cells[id].pdata_size =
sizeof(struct cros_ec_sensor_platform);
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2)
ec->has_kb_wake_angle = true;

if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) {
sensor_cells[id].name = "cros-ec-ring";
id++;
Expand All@@ -389,6 +383,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
kfree(msg);
}

static const struct mfd_cell cros_ec_rtc_cells[] = {
{ .name = "cros-ec-rtc" }
};

static int ec_device_probe(struct platform_device *pdev)
{
int retval = -ENOMEM;
Expand DownExpand Up@@ -424,6 +422,26 @@ static int ec_device_probe(struct platform_device *pdev)
goto failed;
}

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Check whether this EC instance has RTC host command support */
if (cros_ec_check_features(ec, EC_FEATURE_RTC)) {
retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
cros_ec_rtc_cells,
ARRAY_SIZE(cros_ec_rtc_cells),
NULL, 0, NULL);
if (retval)
dev_err(ec->dev,
"failed to add cros-ec-rtc device: %d\n",
retval);
}

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

/* We can now add the sysfs class, we know which parameter to show */
retval = cdev_device_add(&ec->cdev, &ec->class_dev);
if (retval) {
dev_err(dev, "cdev_device_add failed => %d\n", retval);
Expand All@@ -433,13 +451,6 @@ static int ec_device_probe(struct platform_device *pdev)
if (cros_ec_debugfs_init(ec))
dev_warn(dev, "failed to create debugfs directory\n");

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

return 0;

failed:
Expand All@@ -461,16 +472,26 @@ static int ec_device_remove(struct platform_device *pdev)
return 0;
}

static void ec_device_shutdown(struct platform_device *pdev)
{
struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev);

/* Be sure to clear up debugfs delayed works */
cros_ec_debugfs_remove(ec);
}

static const struct platform_device_id cros_ec_id[] = {
{ DRV_NAME, 0 },
{ /* sentinel */ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, cros_ec_id);

static __maybe_unused int ec_device_suspend(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_suspend(ec);

lb_suspend(ec);

return 0;
Expand All@@ -480,6 +501,8 @@ static __maybe_unused int ec_device_resume(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_resume(ec);

lb_resume(ec);

return 0;
Expand All@@ -499,6 +522,7 @@ static struct platform_driver cros_ec_dev_driver = {
},
.probe = ec_device_probe,
.remove = ec_device_remove,
.shutdown = ec_device_shutdown,
};

static int __init cros_ec_dev_init(void)
Expand Down
12 changes: 12 additions & 0 deletions drivers/mfd/cros_ec_i2c.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand DownExpand Up@@ -344,21 +345,32 @@ static int cros_ec_i2c_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(cros_ec_i2c_pm_ops, cros_ec_i2c_suspend,
cros_ec_i2c_resume);

#ifdef CONFIG_OF
static const struct of_device_id cros_ec_i2c_of_match[] = {
{ .compatible = "google,cros-ec-i2c", },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match);
#endif

static const struct i2c_device_id cros_ec_i2c_id[] = {
{ "cros-ec-i2c", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, cros_ec_i2c_id);

#ifdef CONFIG_ACPI
static const struct acpi_device_id cros_ec_i2c_acpi_id[] = {
{ "GOOG0008", 0 },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(acpi, cros_ec_i2c_acpi_id);
#endif

static struct i2c_driver cros_ec_driver = {
.driver = {
.name = "cros-ec-i2c",
.acpi_match_table = ACPI_PTR(cros_ec_i2c_acpi_id),
.of_match_table = of_match_ptr(cros_ec_i2c_of_match),
.pm = &cros_ec_i2c_pm_ops,
},
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e1120ae
platform/chrome: chromeos_laptop - stop setting suspend mode for Atme…
dtor Mar 20, 2018
3bd910a
platform/chrome: chromeos_laptop - introduce pr_fmt()
dtor Mar 20, 2018
e34e959
platform/chrome: chromeos_laptop - factor out getting IRQ from DMI
dtor Mar 20, 2018
ffa0bb3
platform/chrome: chromeos_laptop - rework i2c peripherals initialization
dtor Mar 20, 2018
2d76941
platform/chrome: chromeos_laptop - parse DMI IRQ data once
dtor Mar 20, 2018
07781ca
platform/chrome: chromeos_laptop - use I2C notifier to create devices
dtor Mar 20, 2018
1b67992
platform/chrome: chromeos_laptop - rely on I2C to set up interrupt tr…
dtor Mar 20, 2018
00c4979
platform/chrome: chromeos_laptop - use device properties for Pixel
dtor Mar 20, 2018
663de6d
platform/chrome: chromeos_laptop - discard data for unneeded boards
dtor Mar 20, 2018
fbf60df
platform/chrome: cros_ec_lpc: wake up from s2idle on Chrome EC
Feb 22, 2018
77d3e62
platform/chrome: cros_ec_lpc: Add support for Google devices using cu…
Mar 7, 2018
2a8331b
platform/chrome: cros_ec_sysfs: Modify error handling
gwendalcr Mar 23, 2018
c09fb8f
platform/chrome: cros_ec_sysfs: introduce to_cros_ec_dev define.
Mar 23, 2018
0c4f236
platform/chrome: cros_ec_sysfs: use permission-specific DEVICE_ATTR v…
Mar 23, 2018
70a4c69
platform/chrome: cros_ec_debugfs: Use octal permissions '0444'
Mar 23, 2018
975efde
platform/chrome: mfd/cros_ec_dev: Add sysfs entry to set keyboard wak…
gwendalcr Mar 23, 2018
360ca3d
platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device f…
dtor May 22, 2018
2d31288
Revert "mfd: cros_ec: Add ACPI GPE handler for LID0 devices"
Feb 22, 2018
906eb67
mfd: cros_ec: Retry commands when EC is known to be busy
computersforpeace May 23, 2018
7764be9
platform: chrome: Add Tablet Switch ACPI driver
gwendalcr Jan 30, 2017
3c4c60d
platform/chrome: chromeos_laptop - supply properties for ACPI devices
dtor May 4, 2018
9107533
platform: chrome: Add input dependency for tablet switch driver
arndb May 28, 2018
a6953b2
mfd: cros_ec: Fail early if we cannot identify the EC
vpalatin Apr 18, 2018
25c5ab9
mfd: cros_ec: Free IRQ automatically
vpalatin Apr 18, 2018
4904474
mfd: cros_ec: Don't try to grab log when suspended
dianders Apr 18, 2018
a4b6301
mfd: cros_ec_dev: Register cros-ec-rtc driver as a subdevice
Apr 18, 2018
2ad83d1
mfd: cros_ec_dev: Register shutdown function for debugfs
Apr 18, 2018
f080fde
mfd: cros_ec_i2c: Add ACPI module device table
aitjcize Apr 18, 2018
09011e9
GalliumOS: Config: Enable TBMC as a module
danielstuart14 Jul 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion drivers/mfd/Makefile
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o
obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o
obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o
cros_ec_core-objs := cros_ec.o
cros_ec_core-$(CONFIG_ACPI) += cros_ec_acpi_gpe.o
obj-$(CONFIG_MFD_CROS_EC) += cros_ec_core.o
obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o
obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o
Expand Down
41 changes: 14 additions & 27 deletions drivers/mfd/cros_ec.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,12 +112,16 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

mutex_init(&ec_dev->lock);

cros_ec_query_all(ec_dev);
err = cros_ec_query_all(ec_dev);
if (err) {
dev_err(dev, "Cannot identify the EC: error %d\n", err);
return err;
}

if (ec_dev->irq) {
err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
err = devm_request_threaded_irq(dev, ec_dev->irq, NULL,
ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
if (err) {
dev_err(dev, "Failed to request IRQ %d: %d",
ec_dev->irq, err);
Expand All@@ -131,7 +135,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Embedded Controller subdevice %d\n",
err);
goto fail_mfd;
return err;
}

if (ec_dev->max_passthru) {
Expand All@@ -149,7 +153,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Power Delivery subdevice %d\n",
err);
goto fail_mfd;
return err;
}
}

Expand All@@ -158,7 +162,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
if (err) {
mfd_remove_devices(dev);
dev_err(dev, "Failed to register sub-devices\n");
goto fail_mfd;
return err;
}
}

Expand All@@ -173,26 +177,14 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

dev_info(dev, "Chrome EC device registered\n");

cros_ec_acpi_install_gpe_handler(dev);

return 0;

fail_mfd:
if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);
return err;
}
EXPORT_SYMBOL(cros_ec_register);

int cros_ec_remove(struct cros_ec_device *ec_dev)
{
mfd_remove_devices(ec_dev->dev);

cros_ec_acpi_remove_gpe_handler();

if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);

return 0;
}
EXPORT_SYMBOL(cros_ec_remove);
Expand All@@ -204,14 +196,9 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev)
int ret;
u8 sleep_event;

if (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) {
sleep_event = HOST_SLEEP_EVENT_S3_SUSPEND;
} else {
sleep_event = HOST_SLEEP_EVENT_S0IX_SUSPEND;

/* Clearing the GPE status for any pending event */
cros_ec_acpi_clear_gpe();
}
sleep_event = (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) ?
HOST_SLEEP_EVENT_S3_SUSPEND :
HOST_SLEEP_EVENT_S0IX_SUSPEND;

ret = cros_ec_sleep_event(ec_dev, sleep_event);
if (ret < 0)
Expand Down
103 changes: 0 additions & 103 deletions drivers/mfd/cros_ec_acpi_gpe.c

This file was deleted.

62 changes: 43 additions & 19 deletions drivers/mfd/cros_ec_dev.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -305,8 +305,8 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)

resp = (struct ec_response_motion_sense *)msg->data;
sensor_num = resp->dump.sensor_count;
/* Allocate 2 extra sensors in case lid angle or FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 2),
/* Allocate 1 extra sensors in FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 1),
GFP_KERNEL);
if (sensor_cells == NULL)
goto error;
Expand DownExpand Up@@ -362,16 +362,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
sensor_type[resp->info.type]++;
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2) {
sensor_platforms[id].sensor_num = sensor_num;

sensor_cells[id].name = "cros-ec-angle";
sensor_cells[id].id = 0;
sensor_cells[id].platform_data = &sensor_platforms[id];
sensor_cells[id].pdata_size =
sizeof(struct cros_ec_sensor_platform);
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2)
ec->has_kb_wake_angle = true;

if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) {
sensor_cells[id].name = "cros-ec-ring";
id++;
Expand All@@ -389,6 +383,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
kfree(msg);
}

static const struct mfd_cell cros_ec_rtc_cells[] = {
{ .name = "cros-ec-rtc" }
};

static int ec_device_probe(struct platform_device *pdev)
{
int retval = -ENOMEM;
Expand DownExpand Up@@ -424,6 +422,26 @@ static int ec_device_probe(struct platform_device *pdev)
goto failed;
}

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Check whether this EC instance has RTC host command support */
if (cros_ec_check_features(ec, EC_FEATURE_RTC)) {
retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
cros_ec_rtc_cells,
ARRAY_SIZE(cros_ec_rtc_cells),
NULL, 0, NULL);
if (retval)
dev_err(ec->dev,
"failed to add cros-ec-rtc device: %d\n",
retval);
}

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

/* We can now add the sysfs class, we know which parameter to show */
retval = cdev_device_add(&ec->cdev, &ec->class_dev);
if (retval) {
dev_err(dev, "cdev_device_add failed => %d\n", retval);
Expand All@@ -433,13 +451,6 @@ static int ec_device_probe(struct platform_device *pdev)
if (cros_ec_debugfs_init(ec))
dev_warn(dev, "failed to create debugfs directory\n");

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

return 0;

failed:
Expand All@@ -461,16 +472,26 @@ static int ec_device_remove(struct platform_device *pdev)
return 0;
}

static void ec_device_shutdown(struct platform_device *pdev)
{
struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev);

/* Be sure to clear up debugfs delayed works */
cros_ec_debugfs_remove(ec);
}

static const struct platform_device_id cros_ec_id[] = {
{ DRV_NAME, 0 },
{ /* sentinel */ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, cros_ec_id);

static __maybe_unused int ec_device_suspend(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_suspend(ec);

lb_suspend(ec);

return 0;
Expand All@@ -480,6 +501,8 @@ static __maybe_unused int ec_device_resume(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_resume(ec);

lb_resume(ec);

return 0;
Expand All@@ -499,6 +522,7 @@ static struct platform_driver cros_ec_dev_driver = {
},
.probe = ec_device_probe,
.remove = ec_device_remove,
.shutdown = ec_device_shutdown,
};

static int __init cros_ec_dev_init(void)
Expand Down
12 changes: 12 additions & 0 deletions drivers/mfd/cros_ec_i2c.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand DownExpand Up@@ -344,21 +345,32 @@ static int cros_ec_i2c_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(cros_ec_i2c_pm_ops, cros_ec_i2c_suspend,
cros_ec_i2c_resume);

#ifdef CONFIG_OF
static const struct of_device_id cros_ec_i2c_of_match[] = {
{ .compatible = "google,cros-ec-i2c", },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match);
#endif

static const struct i2c_device_id cros_ec_i2c_id[] = {
{ "cros-ec-i2c", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, cros_ec_i2c_id);

#ifdef CONFIG_ACPI
static const struct acpi_device_id cros_ec_i2c_acpi_id[] = {
{ "GOOG0008", 0 },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(acpi, cros_ec_i2c_acpi_id);
#endif

static struct i2c_driver cros_ec_driver = {
.driver = {
.name = "cros-ec-i2c",
.acpi_match_table = ACPI_PTR(cros_ec_i2c_acpi_id),
.of_match_table = of_match_ptr(cros_ec_i2c_of_match),
.pm = &cros_ec_i2c_pm_ops,
},
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e1120ae
platform/chrome: chromeos_laptop - stop setting suspend mode for Atme…
dtor Mar 20, 2018
3bd910a
platform/chrome: chromeos_laptop - introduce pr_fmt()
dtor Mar 20, 2018
e34e959
platform/chrome: chromeos_laptop - factor out getting IRQ from DMI
dtor Mar 20, 2018
ffa0bb3
platform/chrome: chromeos_laptop - rework i2c peripherals initialization
dtor Mar 20, 2018
2d76941
platform/chrome: chromeos_laptop - parse DMI IRQ data once
dtor Mar 20, 2018
07781ca
platform/chrome: chromeos_laptop - use I2C notifier to create devices
dtor Mar 20, 2018
1b67992
platform/chrome: chromeos_laptop - rely on I2C to set up interrupt tr…
dtor Mar 20, 2018
00c4979
platform/chrome: chromeos_laptop - use device properties for Pixel
dtor Mar 20, 2018
663de6d
platform/chrome: chromeos_laptop - discard data for unneeded boards
dtor Mar 20, 2018
fbf60df
platform/chrome: cros_ec_lpc: wake up from s2idle on Chrome EC
Feb 22, 2018
77d3e62
platform/chrome: cros_ec_lpc: Add support for Google devices using cu…
Mar 7, 2018
2a8331b
platform/chrome: cros_ec_sysfs: Modify error handling
gwendalcr Mar 23, 2018
c09fb8f
platform/chrome: cros_ec_sysfs: introduce to_cros_ec_dev define.
Mar 23, 2018
0c4f236
platform/chrome: cros_ec_sysfs: use permission-specific DEVICE_ATTR v…
Mar 23, 2018
70a4c69
platform/chrome: cros_ec_debugfs: Use octal permissions '0444'
Mar 23, 2018
975efde
platform/chrome: mfd/cros_ec_dev: Add sysfs entry to set keyboard wak…
gwendalcr Mar 23, 2018
360ca3d
platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device f…
dtor May 22, 2018
2d31288
Revert "mfd: cros_ec: Add ACPI GPE handler for LID0 devices"
Feb 22, 2018
906eb67
mfd: cros_ec: Retry commands when EC is known to be busy
computersforpeace May 23, 2018
7764be9
platform: chrome: Add Tablet Switch ACPI driver
gwendalcr Jan 30, 2017
3c4c60d
platform/chrome: chromeos_laptop - supply properties for ACPI devices
dtor May 4, 2018
9107533
platform: chrome: Add input dependency for tablet switch driver
arndb May 28, 2018
a6953b2
mfd: cros_ec: Fail early if we cannot identify the EC
vpalatin Apr 18, 2018
25c5ab9
mfd: cros_ec: Free IRQ automatically
vpalatin Apr 18, 2018
4904474
mfd: cros_ec: Don't try to grab log when suspended
dianders Apr 18, 2018
a4b6301
mfd: cros_ec_dev: Register cros-ec-rtc driver as a subdevice
Apr 18, 2018
2ad83d1
mfd: cros_ec_dev: Register shutdown function for debugfs
Apr 18, 2018
f080fde
mfd: cros_ec_i2c: Add ACPI module device table
aitjcize Apr 18, 2018
09011e9
GalliumOS: Config: Enable TBMC as a module
danielstuart14 Jul 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion drivers/mfd/Makefile
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o
obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o
obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o
cros_ec_core-objs := cros_ec.o
cros_ec_core-$(CONFIG_ACPI) += cros_ec_acpi_gpe.o
obj-$(CONFIG_MFD_CROS_EC) += cros_ec_core.o
obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o
obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o
Expand Down
41 changes: 14 additions & 27 deletions drivers/mfd/cros_ec.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,12 +112,16 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

mutex_init(&ec_dev->lock);

cros_ec_query_all(ec_dev);
err = cros_ec_query_all(ec_dev);
if (err) {
dev_err(dev, "Cannot identify the EC: error %d\n", err);
return err;
}

if (ec_dev->irq) {
err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
err = devm_request_threaded_irq(dev, ec_dev->irq, NULL,
ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
if (err) {
dev_err(dev, "Failed to request IRQ %d: %d",
ec_dev->irq, err);
Expand All@@ -131,7 +135,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Embedded Controller subdevice %d\n",
err);
goto fail_mfd;
return err;
}

if (ec_dev->max_passthru) {
Expand All@@ -149,7 +153,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Power Delivery subdevice %d\n",
err);
goto fail_mfd;
return err;
}
}

Expand All@@ -158,7 +162,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
if (err) {
mfd_remove_devices(dev);
dev_err(dev, "Failed to register sub-devices\n");
goto fail_mfd;
return err;
}
}

Expand All@@ -173,26 +177,14 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

dev_info(dev, "Chrome EC device registered\n");

cros_ec_acpi_install_gpe_handler(dev);

return 0;

fail_mfd:
if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);
return err;
}
EXPORT_SYMBOL(cros_ec_register);

int cros_ec_remove(struct cros_ec_device *ec_dev)
{
mfd_remove_devices(ec_dev->dev);

cros_ec_acpi_remove_gpe_handler();

if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);

return 0;
}
EXPORT_SYMBOL(cros_ec_remove);
Expand All@@ -204,14 +196,9 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev)
int ret;
u8 sleep_event;

if (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) {
sleep_event = HOST_SLEEP_EVENT_S3_SUSPEND;
} else {
sleep_event = HOST_SLEEP_EVENT_S0IX_SUSPEND;

/* Clearing the GPE status for any pending event */
cros_ec_acpi_clear_gpe();
}
sleep_event = (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) ?
HOST_SLEEP_EVENT_S3_SUSPEND :
HOST_SLEEP_EVENT_S0IX_SUSPEND;

ret = cros_ec_sleep_event(ec_dev, sleep_event);
if (ret < 0)
Expand Down
103 changes: 0 additions & 103 deletions drivers/mfd/cros_ec_acpi_gpe.c

This file was deleted.

62 changes: 43 additions & 19 deletions drivers/mfd/cros_ec_dev.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -305,8 +305,8 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)

resp = (struct ec_response_motion_sense *)msg->data;
sensor_num = resp->dump.sensor_count;
/* Allocate 2 extra sensors in case lid angle or FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 2),
/* Allocate 1 extra sensors in FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 1),
GFP_KERNEL);
if (sensor_cells == NULL)
goto error;
Expand DownExpand Up@@ -362,16 +362,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
sensor_type[resp->info.type]++;
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2) {
sensor_platforms[id].sensor_num = sensor_num;

sensor_cells[id].name = "cros-ec-angle";
sensor_cells[id].id = 0;
sensor_cells[id].platform_data = &sensor_platforms[id];
sensor_cells[id].pdata_size =
sizeof(struct cros_ec_sensor_platform);
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2)
ec->has_kb_wake_angle = true;

if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) {
sensor_cells[id].name = "cros-ec-ring";
id++;
Expand All@@ -389,6 +383,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
kfree(msg);
}

static const struct mfd_cell cros_ec_rtc_cells[] = {
{ .name = "cros-ec-rtc" }
};

static int ec_device_probe(struct platform_device *pdev)
{
int retval = -ENOMEM;
Expand DownExpand Up@@ -424,6 +422,26 @@ static int ec_device_probe(struct platform_device *pdev)
goto failed;
}

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Check whether this EC instance has RTC host command support */
if (cros_ec_check_features(ec, EC_FEATURE_RTC)) {
retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
cros_ec_rtc_cells,
ARRAY_SIZE(cros_ec_rtc_cells),
NULL, 0, NULL);
if (retval)
dev_err(ec->dev,
"failed to add cros-ec-rtc device: %d\n",
retval);
}

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

/* We can now add the sysfs class, we know which parameter to show */
retval = cdev_device_add(&ec->cdev, &ec->class_dev);
if (retval) {
dev_err(dev, "cdev_device_add failed => %d\n", retval);
Expand All@@ -433,13 +451,6 @@ static int ec_device_probe(struct platform_device *pdev)
if (cros_ec_debugfs_init(ec))
dev_warn(dev, "failed to create debugfs directory\n");

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

return 0;

failed:
Expand All@@ -461,16 +472,26 @@ static int ec_device_remove(struct platform_device *pdev)
return 0;
}

static void ec_device_shutdown(struct platform_device *pdev)
{
struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev);

/* Be sure to clear up debugfs delayed works */
cros_ec_debugfs_remove(ec);
}

static const struct platform_device_id cros_ec_id[] = {
{ DRV_NAME, 0 },
{ /* sentinel */ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, cros_ec_id);

static __maybe_unused int ec_device_suspend(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_suspend(ec);

lb_suspend(ec);

return 0;
Expand All@@ -480,6 +501,8 @@ static __maybe_unused int ec_device_resume(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_resume(ec);

lb_resume(ec);

return 0;
Expand All@@ -499,6 +522,7 @@ static struct platform_driver cros_ec_dev_driver = {
},
.probe = ec_device_probe,
.remove = ec_device_remove,
.shutdown = ec_device_shutdown,
};

static int __init cros_ec_dev_init(void)
Expand Down
12 changes: 12 additions & 0 deletions drivers/mfd/cros_ec_i2c.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand DownExpand Up@@ -344,21 +345,32 @@ static int cros_ec_i2c_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(cros_ec_i2c_pm_ops, cros_ec_i2c_suspend,
cros_ec_i2c_resume);

#ifdef CONFIG_OF
static const struct of_device_id cros_ec_i2c_of_match[] = {
{ .compatible = "google,cros-ec-i2c", },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match);
#endif

static const struct i2c_device_id cros_ec_i2c_id[] = {
{ "cros-ec-i2c", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, cros_ec_i2c_id);

#ifdef CONFIG_ACPI
static const struct acpi_device_id cros_ec_i2c_acpi_id[] = {
{ "GOOG0008", 0 },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(acpi, cros_ec_i2c_acpi_id);
#endif

static struct i2c_driver cros_ec_driver = {
.driver = {
.name = "cros-ec-i2c",
.acpi_match_table = ACPI_PTR(cros_ec_i2c_acpi_id),
.of_match_table = of_match_ptr(cros_ec_i2c_of_match),
.pm = &cros_ec_i2c_pm_ops,
},
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e1120ae
platform/chrome: chromeos_laptop - stop setting suspend mode for Atme…
dtor Mar 20, 2018
3bd910a
platform/chrome: chromeos_laptop - introduce pr_fmt()
dtor Mar 20, 2018
e34e959
platform/chrome: chromeos_laptop - factor out getting IRQ from DMI
dtor Mar 20, 2018
ffa0bb3
platform/chrome: chromeos_laptop - rework i2c peripherals initialization
dtor Mar 20, 2018
2d76941
platform/chrome: chromeos_laptop - parse DMI IRQ data once
dtor Mar 20, 2018
07781ca
platform/chrome: chromeos_laptop - use I2C notifier to create devices
dtor Mar 20, 2018
1b67992
platform/chrome: chromeos_laptop - rely on I2C to set up interrupt tr…
dtor Mar 20, 2018
00c4979
platform/chrome: chromeos_laptop - use device properties for Pixel
dtor Mar 20, 2018
663de6d
platform/chrome: chromeos_laptop - discard data for unneeded boards
dtor Mar 20, 2018
fbf60df
platform/chrome: cros_ec_lpc: wake up from s2idle on Chrome EC
Feb 22, 2018
77d3e62
platform/chrome: cros_ec_lpc: Add support for Google devices using cu…
Mar 7, 2018
2a8331b
platform/chrome: cros_ec_sysfs: Modify error handling
gwendalcr Mar 23, 2018
c09fb8f
platform/chrome: cros_ec_sysfs: introduce to_cros_ec_dev define.
Mar 23, 2018
0c4f236
platform/chrome: cros_ec_sysfs: use permission-specific DEVICE_ATTR v…
Mar 23, 2018
70a4c69
platform/chrome: cros_ec_debugfs: Use octal permissions '0444'
Mar 23, 2018
975efde
platform/chrome: mfd/cros_ec_dev: Add sysfs entry to set keyboard wak…
gwendalcr Mar 23, 2018
360ca3d
platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device f…
dtor May 22, 2018
2d31288
Revert "mfd: cros_ec: Add ACPI GPE handler for LID0 devices"
Feb 22, 2018
906eb67
mfd: cros_ec: Retry commands when EC is known to be busy
computersforpeace May 23, 2018
7764be9
platform: chrome: Add Tablet Switch ACPI driver
gwendalcr Jan 30, 2017
3c4c60d
platform/chrome: chromeos_laptop - supply properties for ACPI devices
dtor May 4, 2018
9107533
platform: chrome: Add input dependency for tablet switch driver
arndb May 28, 2018
a6953b2
mfd: cros_ec: Fail early if we cannot identify the EC
vpalatin Apr 18, 2018
25c5ab9
mfd: cros_ec: Free IRQ automatically
vpalatin Apr 18, 2018
4904474
mfd: cros_ec: Don't try to grab log when suspended
dianders Apr 18, 2018
a4b6301
mfd: cros_ec_dev: Register cros-ec-rtc driver as a subdevice
Apr 18, 2018
2ad83d1
mfd: cros_ec_dev: Register shutdown function for debugfs
Apr 18, 2018
f080fde
mfd: cros_ec_i2c: Add ACPI module device table
aitjcize Apr 18, 2018
09011e9
GalliumOS: Config: Enable TBMC as a module
danielstuart14 Jul 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion drivers/mfd/Makefile
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o
obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o
obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o
cros_ec_core-objs := cros_ec.o
cros_ec_core-$(CONFIG_ACPI) += cros_ec_acpi_gpe.o
obj-$(CONFIG_MFD_CROS_EC) += cros_ec_core.o
obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o
obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o
Expand Down
41 changes: 14 additions & 27 deletions drivers/mfd/cros_ec.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,12 +112,16 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

mutex_init(&ec_dev->lock);

cros_ec_query_all(ec_dev);
err = cros_ec_query_all(ec_dev);
if (err) {
dev_err(dev, "Cannot identify the EC: error %d\n", err);
return err;
}

if (ec_dev->irq) {
err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
err = devm_request_threaded_irq(dev, ec_dev->irq, NULL,
ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
if (err) {
dev_err(dev, "Failed to request IRQ %d: %d",
ec_dev->irq, err);
Expand All@@ -131,7 +135,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Embedded Controller subdevice %d\n",
err);
goto fail_mfd;
return err;
}

if (ec_dev->max_passthru) {
Expand All@@ -149,7 +153,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Power Delivery subdevice %d\n",
err);
goto fail_mfd;
return err;
}
}

Expand All@@ -158,7 +162,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
if (err) {
mfd_remove_devices(dev);
dev_err(dev, "Failed to register sub-devices\n");
goto fail_mfd;
return err;
}
}

Expand All@@ -173,26 +177,14 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

dev_info(dev, "Chrome EC device registered\n");

cros_ec_acpi_install_gpe_handler(dev);

return 0;

fail_mfd:
if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);
return err;
}
EXPORT_SYMBOL(cros_ec_register);

int cros_ec_remove(struct cros_ec_device *ec_dev)
{
mfd_remove_devices(ec_dev->dev);

cros_ec_acpi_remove_gpe_handler();

if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);

return 0;
}
EXPORT_SYMBOL(cros_ec_remove);
Expand All@@ -204,14 +196,9 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev)
int ret;
u8 sleep_event;

if (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) {
sleep_event = HOST_SLEEP_EVENT_S3_SUSPEND;
} else {
sleep_event = HOST_SLEEP_EVENT_S0IX_SUSPEND;

/* Clearing the GPE status for any pending event */
cros_ec_acpi_clear_gpe();
}
sleep_event = (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) ?
HOST_SLEEP_EVENT_S3_SUSPEND :
HOST_SLEEP_EVENT_S0IX_SUSPEND;

ret = cros_ec_sleep_event(ec_dev, sleep_event);
if (ret < 0)
Expand Down
103 changes: 0 additions & 103 deletions drivers/mfd/cros_ec_acpi_gpe.c

This file was deleted.

62 changes: 43 additions & 19 deletions drivers/mfd/cros_ec_dev.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -305,8 +305,8 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)

resp = (struct ec_response_motion_sense *)msg->data;
sensor_num = resp->dump.sensor_count;
/* Allocate 2 extra sensors in case lid angle or FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 2),
/* Allocate 1 extra sensors in FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 1),
GFP_KERNEL);
if (sensor_cells == NULL)
goto error;
Expand DownExpand Up@@ -362,16 +362,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
sensor_type[resp->info.type]++;
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2) {
sensor_platforms[id].sensor_num = sensor_num;

sensor_cells[id].name = "cros-ec-angle";
sensor_cells[id].id = 0;
sensor_cells[id].platform_data = &sensor_platforms[id];
sensor_cells[id].pdata_size =
sizeof(struct cros_ec_sensor_platform);
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2)
ec->has_kb_wake_angle = true;

if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) {
sensor_cells[id].name = "cros-ec-ring";
id++;
Expand All@@ -389,6 +383,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
kfree(msg);
}

static const struct mfd_cell cros_ec_rtc_cells[] = {
{ .name = "cros-ec-rtc" }
};

static int ec_device_probe(struct platform_device *pdev)
{
int retval = -ENOMEM;
Expand DownExpand Up@@ -424,6 +422,26 @@ static int ec_device_probe(struct platform_device *pdev)
goto failed;
}

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Check whether this EC instance has RTC host command support */
if (cros_ec_check_features(ec, EC_FEATURE_RTC)) {
retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
cros_ec_rtc_cells,
ARRAY_SIZE(cros_ec_rtc_cells),
NULL, 0, NULL);
if (retval)
dev_err(ec->dev,
"failed to add cros-ec-rtc device: %d\n",
retval);
}

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

/* We can now add the sysfs class, we know which parameter to show */
retval = cdev_device_add(&ec->cdev, &ec->class_dev);
if (retval) {
dev_err(dev, "cdev_device_add failed => %d\n", retval);
Expand All@@ -433,13 +451,6 @@ static int ec_device_probe(struct platform_device *pdev)
if (cros_ec_debugfs_init(ec))
dev_warn(dev, "failed to create debugfs directory\n");

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

return 0;

failed:
Expand All@@ -461,16 +472,26 @@ static int ec_device_remove(struct platform_device *pdev)
return 0;
}

static void ec_device_shutdown(struct platform_device *pdev)
{
struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev);

/* Be sure to clear up debugfs delayed works */
cros_ec_debugfs_remove(ec);
}

static const struct platform_device_id cros_ec_id[] = {
{ DRV_NAME, 0 },
{ /* sentinel */ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, cros_ec_id);

static __maybe_unused int ec_device_suspend(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_suspend(ec);

lb_suspend(ec);

return 0;
Expand All@@ -480,6 +501,8 @@ static __maybe_unused int ec_device_resume(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_resume(ec);

lb_resume(ec);

return 0;
Expand All@@ -499,6 +522,7 @@ static struct platform_driver cros_ec_dev_driver = {
},
.probe = ec_device_probe,
.remove = ec_device_remove,
.shutdown = ec_device_shutdown,
};

static int __init cros_ec_dev_init(void)
Expand Down
12 changes: 12 additions & 0 deletions drivers/mfd/cros_ec_i2c.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand DownExpand Up@@ -344,21 +345,32 @@ static int cros_ec_i2c_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(cros_ec_i2c_pm_ops, cros_ec_i2c_suspend,
cros_ec_i2c_resume);

#ifdef CONFIG_OF
static const struct of_device_id cros_ec_i2c_of_match[] = {
{ .compatible = "google,cros-ec-i2c", },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match);
#endif

static const struct i2c_device_id cros_ec_i2c_id[] = {
{ "cros-ec-i2c", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, cros_ec_i2c_id);

#ifdef CONFIG_ACPI
static const struct acpi_device_id cros_ec_i2c_acpi_id[] = {
{ "GOOG0008", 0 },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(acpi, cros_ec_i2c_acpi_id);
#endif

static struct i2c_driver cros_ec_driver = {
.driver = {
.name = "cros-ec-i2c",
.acpi_match_table = ACPI_PTR(cros_ec_i2c_acpi_id),
.of_match_table = of_match_ptr(cros_ec_i2c_of_match),
.pm = &cros_ec_i2c_pm_ops,
},
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e1120ae
platform/chrome: chromeos_laptop - stop setting suspend mode for Atme…
dtor Mar 20, 2018
3bd910a
platform/chrome: chromeos_laptop - introduce pr_fmt()
dtor Mar 20, 2018
e34e959
platform/chrome: chromeos_laptop - factor out getting IRQ from DMI
dtor Mar 20, 2018
ffa0bb3
platform/chrome: chromeos_laptop - rework i2c peripherals initialization
dtor Mar 20, 2018
2d76941
platform/chrome: chromeos_laptop - parse DMI IRQ data once
dtor Mar 20, 2018
07781ca
platform/chrome: chromeos_laptop - use I2C notifier to create devices
dtor Mar 20, 2018
1b67992
platform/chrome: chromeos_laptop - rely on I2C to set up interrupt tr…
dtor Mar 20, 2018
00c4979
platform/chrome: chromeos_laptop - use device properties for Pixel
dtor Mar 20, 2018
663de6d
platform/chrome: chromeos_laptop - discard data for unneeded boards
dtor Mar 20, 2018
fbf60df
platform/chrome: cros_ec_lpc: wake up from s2idle on Chrome EC
Feb 22, 2018
77d3e62
platform/chrome: cros_ec_lpc: Add support for Google devices using cu…
Mar 7, 2018
2a8331b
platform/chrome: cros_ec_sysfs: Modify error handling
gwendalcr Mar 23, 2018
c09fb8f
platform/chrome: cros_ec_sysfs: introduce to_cros_ec_dev define.
Mar 23, 2018
0c4f236
platform/chrome: cros_ec_sysfs: use permission-specific DEVICE_ATTR v…
Mar 23, 2018
70a4c69
platform/chrome: cros_ec_debugfs: Use octal permissions '0444'
Mar 23, 2018
975efde
platform/chrome: mfd/cros_ec_dev: Add sysfs entry to set keyboard wak…
gwendalcr Mar 23, 2018
360ca3d
platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device f…
dtor May 22, 2018
2d31288
Revert "mfd: cros_ec: Add ACPI GPE handler for LID0 devices"
Feb 22, 2018
906eb67
mfd: cros_ec: Retry commands when EC is known to be busy
computersforpeace May 23, 2018
7764be9
platform: chrome: Add Tablet Switch ACPI driver
gwendalcr Jan 30, 2017
3c4c60d
platform/chrome: chromeos_laptop - supply properties for ACPI devices
dtor May 4, 2018
9107533
platform: chrome: Add input dependency for tablet switch driver
arndb May 28, 2018
a6953b2
mfd: cros_ec: Fail early if we cannot identify the EC
vpalatin Apr 18, 2018
25c5ab9
mfd: cros_ec: Free IRQ automatically
vpalatin Apr 18, 2018
4904474
mfd: cros_ec: Don't try to grab log when suspended
dianders Apr 18, 2018
a4b6301
mfd: cros_ec_dev: Register cros-ec-rtc driver as a subdevice
Apr 18, 2018
2ad83d1
mfd: cros_ec_dev: Register shutdown function for debugfs
Apr 18, 2018
f080fde
mfd: cros_ec_i2c: Add ACPI module device table
aitjcize Apr 18, 2018
09011e9
GalliumOS: Config: Enable TBMC as a module
danielstuart14 Jul 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion drivers/mfd/Makefile
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o
obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o
obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o
cros_ec_core-objs := cros_ec.o
cros_ec_core-$(CONFIG_ACPI) += cros_ec_acpi_gpe.o
obj-$(CONFIG_MFD_CROS_EC) += cros_ec_core.o
obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o
obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o
Expand Down
41 changes: 14 additions & 27 deletions drivers/mfd/cros_ec.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,12 +112,16 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

mutex_init(&ec_dev->lock);

cros_ec_query_all(ec_dev);
err = cros_ec_query_all(ec_dev);
if (err) {
dev_err(dev, "Cannot identify the EC: error %d\n", err);
return err;
}

if (ec_dev->irq) {
err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
err = devm_request_threaded_irq(dev, ec_dev->irq, NULL,
ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
if (err) {
dev_err(dev, "Failed to request IRQ %d: %d",
ec_dev->irq, err);
Expand All@@ -131,7 +135,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Embedded Controller subdevice %d\n",
err);
goto fail_mfd;
return err;
}

if (ec_dev->max_passthru) {
Expand All@@ -149,7 +153,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Power Delivery subdevice %d\n",
err);
goto fail_mfd;
return err;
}
}

Expand All@@ -158,7 +162,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
if (err) {
mfd_remove_devices(dev);
dev_err(dev, "Failed to register sub-devices\n");
goto fail_mfd;
return err;
}
}

Expand All@@ -173,26 +177,14 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

dev_info(dev, "Chrome EC device registered\n");

cros_ec_acpi_install_gpe_handler(dev);

return 0;

fail_mfd:
if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);
return err;
}
EXPORT_SYMBOL(cros_ec_register);

int cros_ec_remove(struct cros_ec_device *ec_dev)
{
mfd_remove_devices(ec_dev->dev);

cros_ec_acpi_remove_gpe_handler();

if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);

return 0;
}
EXPORT_SYMBOL(cros_ec_remove);
Expand All@@ -204,14 +196,9 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev)
int ret;
u8 sleep_event;

if (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) {
sleep_event = HOST_SLEEP_EVENT_S3_SUSPEND;
} else {
sleep_event = HOST_SLEEP_EVENT_S0IX_SUSPEND;

/* Clearing the GPE status for any pending event */
cros_ec_acpi_clear_gpe();
}
sleep_event = (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) ?
HOST_SLEEP_EVENT_S3_SUSPEND :
HOST_SLEEP_EVENT_S0IX_SUSPEND;

ret = cros_ec_sleep_event(ec_dev, sleep_event);
if (ret < 0)
Expand Down
103 changes: 0 additions & 103 deletions drivers/mfd/cros_ec_acpi_gpe.c

This file was deleted.

62 changes: 43 additions & 19 deletions drivers/mfd/cros_ec_dev.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -305,8 +305,8 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)

resp = (struct ec_response_motion_sense *)msg->data;
sensor_num = resp->dump.sensor_count;
/* Allocate 2 extra sensors in case lid angle or FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 2),
/* Allocate 1 extra sensors in FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 1),
GFP_KERNEL);
if (sensor_cells == NULL)
goto error;
Expand DownExpand Up@@ -362,16 +362,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
sensor_type[resp->info.type]++;
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2) {
sensor_platforms[id].sensor_num = sensor_num;

sensor_cells[id].name = "cros-ec-angle";
sensor_cells[id].id = 0;
sensor_cells[id].platform_data = &sensor_platforms[id];
sensor_cells[id].pdata_size =
sizeof(struct cros_ec_sensor_platform);
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2)
ec->has_kb_wake_angle = true;

if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) {
sensor_cells[id].name = "cros-ec-ring";
id++;
Expand All@@ -389,6 +383,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
kfree(msg);
}

static const struct mfd_cell cros_ec_rtc_cells[] = {
{ .name = "cros-ec-rtc" }
};

static int ec_device_probe(struct platform_device *pdev)
{
int retval = -ENOMEM;
Expand DownExpand Up@@ -424,6 +422,26 @@ static int ec_device_probe(struct platform_device *pdev)
goto failed;
}

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Check whether this EC instance has RTC host command support */
if (cros_ec_check_features(ec, EC_FEATURE_RTC)) {
retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
cros_ec_rtc_cells,
ARRAY_SIZE(cros_ec_rtc_cells),
NULL, 0, NULL);
if (retval)
dev_err(ec->dev,
"failed to add cros-ec-rtc device: %d\n",
retval);
}

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

/* We can now add the sysfs class, we know which parameter to show */
retval = cdev_device_add(&ec->cdev, &ec->class_dev);
if (retval) {
dev_err(dev, "cdev_device_add failed => %d\n", retval);
Expand All@@ -433,13 +451,6 @@ static int ec_device_probe(struct platform_device *pdev)
if (cros_ec_debugfs_init(ec))
dev_warn(dev, "failed to create debugfs directory\n");

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

return 0;

failed:
Expand All@@ -461,16 +472,26 @@ static int ec_device_remove(struct platform_device *pdev)
return 0;
}

static void ec_device_shutdown(struct platform_device *pdev)
{
struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev);

/* Be sure to clear up debugfs delayed works */
cros_ec_debugfs_remove(ec);
}

static const struct platform_device_id cros_ec_id[] = {
{ DRV_NAME, 0 },
{ /* sentinel */ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, cros_ec_id);

static __maybe_unused int ec_device_suspend(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_suspend(ec);

lb_suspend(ec);

return 0;
Expand All@@ -480,6 +501,8 @@ static __maybe_unused int ec_device_resume(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_resume(ec);

lb_resume(ec);

return 0;
Expand All@@ -499,6 +522,7 @@ static struct platform_driver cros_ec_dev_driver = {
},
.probe = ec_device_probe,
.remove = ec_device_remove,
.shutdown = ec_device_shutdown,
};

static int __init cros_ec_dev_init(void)
Expand Down
12 changes: 12 additions & 0 deletions drivers/mfd/cros_ec_i2c.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand DownExpand Up@@ -344,21 +345,32 @@ static int cros_ec_i2c_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(cros_ec_i2c_pm_ops, cros_ec_i2c_suspend,
cros_ec_i2c_resume);

#ifdef CONFIG_OF
static const struct of_device_id cros_ec_i2c_of_match[] = {
{ .compatible = "google,cros-ec-i2c", },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match);
#endif

static const struct i2c_device_id cros_ec_i2c_id[] = {
{ "cros-ec-i2c", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, cros_ec_i2c_id);

#ifdef CONFIG_ACPI
static const struct acpi_device_id cros_ec_i2c_acpi_id[] = {
{ "GOOG0008", 0 },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(acpi, cros_ec_i2c_acpi_id);
#endif

static struct i2c_driver cros_ec_driver = {
.driver = {
.name = "cros-ec-i2c",
.acpi_match_table = ACPI_PTR(cros_ec_i2c_acpi_id),
.of_match_table = of_match_ptr(cros_ec_i2c_of_match),
.pm = &cros_ec_i2c_pm_ops,
},
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e1120ae
platform/chrome: chromeos_laptop - stop setting suspend mode for Atme…
dtor Mar 20, 2018
3bd910a
platform/chrome: chromeos_laptop - introduce pr_fmt()
dtor Mar 20, 2018
e34e959
platform/chrome: chromeos_laptop - factor out getting IRQ from DMI
dtor Mar 20, 2018
ffa0bb3
platform/chrome: chromeos_laptop - rework i2c peripherals initialization
dtor Mar 20, 2018
2d76941
platform/chrome: chromeos_laptop - parse DMI IRQ data once
dtor Mar 20, 2018
07781ca
platform/chrome: chromeos_laptop - use I2C notifier to create devices
dtor Mar 20, 2018
1b67992
platform/chrome: chromeos_laptop - rely on I2C to set up interrupt tr…
dtor Mar 20, 2018
00c4979
platform/chrome: chromeos_laptop - use device properties for Pixel
dtor Mar 20, 2018
663de6d
platform/chrome: chromeos_laptop - discard data for unneeded boards
dtor Mar 20, 2018
fbf60df
platform/chrome: cros_ec_lpc: wake up from s2idle on Chrome EC
Feb 22, 2018
77d3e62
platform/chrome: cros_ec_lpc: Add support for Google devices using cu…
Mar 7, 2018
2a8331b
platform/chrome: cros_ec_sysfs: Modify error handling
gwendalcr Mar 23, 2018
c09fb8f
platform/chrome: cros_ec_sysfs: introduce to_cros_ec_dev define.
Mar 23, 2018
0c4f236
platform/chrome: cros_ec_sysfs: use permission-specific DEVICE_ATTR v…
Mar 23, 2018
70a4c69
platform/chrome: cros_ec_debugfs: Use octal permissions '0444'
Mar 23, 2018
975efde
platform/chrome: mfd/cros_ec_dev: Add sysfs entry to set keyboard wak…
gwendalcr Mar 23, 2018
360ca3d
platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device f…
dtor May 22, 2018
2d31288
Revert "mfd: cros_ec: Add ACPI GPE handler for LID0 devices"
Feb 22, 2018
906eb67
mfd: cros_ec: Retry commands when EC is known to be busy
computersforpeace May 23, 2018
7764be9
platform: chrome: Add Tablet Switch ACPI driver
gwendalcr Jan 30, 2017
3c4c60d
platform/chrome: chromeos_laptop - supply properties for ACPI devices
dtor May 4, 2018
9107533
platform: chrome: Add input dependency for tablet switch driver
arndb May 28, 2018
a6953b2
mfd: cros_ec: Fail early if we cannot identify the EC
vpalatin Apr 18, 2018
25c5ab9
mfd: cros_ec: Free IRQ automatically
vpalatin Apr 18, 2018
4904474
mfd: cros_ec: Don't try to grab log when suspended
dianders Apr 18, 2018
a4b6301
mfd: cros_ec_dev: Register cros-ec-rtc driver as a subdevice
Apr 18, 2018
2ad83d1
mfd: cros_ec_dev: Register shutdown function for debugfs
Apr 18, 2018
f080fde
mfd: cros_ec_i2c: Add ACPI module device table
aitjcize Apr 18, 2018
09011e9
GalliumOS: Config: Enable TBMC as a module
danielstuart14 Jul 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion drivers/mfd/Makefile
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o
obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o
obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o
cros_ec_core-objs := cros_ec.o
cros_ec_core-$(CONFIG_ACPI) += cros_ec_acpi_gpe.o
obj-$(CONFIG_MFD_CROS_EC) += cros_ec_core.o
obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o
obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o
Expand Down
41 changes: 14 additions & 27 deletions drivers/mfd/cros_ec.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,12 +112,16 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

mutex_init(&ec_dev->lock);

cros_ec_query_all(ec_dev);
err = cros_ec_query_all(ec_dev);
if (err) {
dev_err(dev, "Cannot identify the EC: error %d\n", err);
return err;
}

if (ec_dev->irq) {
err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
err = devm_request_threaded_irq(dev, ec_dev->irq, NULL,
ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
if (err) {
dev_err(dev, "Failed to request IRQ %d: %d",
ec_dev->irq, err);
Expand All@@ -131,7 +135,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Embedded Controller subdevice %d\n",
err);
goto fail_mfd;
return err;
}

if (ec_dev->max_passthru) {
Expand All@@ -149,7 +153,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Power Delivery subdevice %d\n",
err);
goto fail_mfd;
return err;
}
}

Expand All@@ -158,7 +162,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
if (err) {
mfd_remove_devices(dev);
dev_err(dev, "Failed to register sub-devices\n");
goto fail_mfd;
return err;
}
}

Expand All@@ -173,26 +177,14 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

dev_info(dev, "Chrome EC device registered\n");

cros_ec_acpi_install_gpe_handler(dev);

return 0;

fail_mfd:
if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);
return err;
}
EXPORT_SYMBOL(cros_ec_register);

int cros_ec_remove(struct cros_ec_device *ec_dev)
{
mfd_remove_devices(ec_dev->dev);

cros_ec_acpi_remove_gpe_handler();

if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);

return 0;
}
EXPORT_SYMBOL(cros_ec_remove);
Expand All@@ -204,14 +196,9 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev)
int ret;
u8 sleep_event;

if (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) {
sleep_event = HOST_SLEEP_EVENT_S3_SUSPEND;
} else {
sleep_event = HOST_SLEEP_EVENT_S0IX_SUSPEND;

/* Clearing the GPE status for any pending event */
cros_ec_acpi_clear_gpe();
}
sleep_event = (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) ?
HOST_SLEEP_EVENT_S3_SUSPEND :
HOST_SLEEP_EVENT_S0IX_SUSPEND;

ret = cros_ec_sleep_event(ec_dev, sleep_event);
if (ret < 0)
Expand Down
103 changes: 0 additions & 103 deletions drivers/mfd/cros_ec_acpi_gpe.c

This file was deleted.

62 changes: 43 additions & 19 deletions drivers/mfd/cros_ec_dev.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -305,8 +305,8 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)

resp = (struct ec_response_motion_sense *)msg->data;
sensor_num = resp->dump.sensor_count;
/* Allocate 2 extra sensors in case lid angle or FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 2),
/* Allocate 1 extra sensors in FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 1),
GFP_KERNEL);
if (sensor_cells == NULL)
goto error;
Expand DownExpand Up@@ -362,16 +362,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
sensor_type[resp->info.type]++;
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2) {
sensor_platforms[id].sensor_num = sensor_num;

sensor_cells[id].name = "cros-ec-angle";
sensor_cells[id].id = 0;
sensor_cells[id].platform_data = &sensor_platforms[id];
sensor_cells[id].pdata_size =
sizeof(struct cros_ec_sensor_platform);
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2)
ec->has_kb_wake_angle = true;

if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) {
sensor_cells[id].name = "cros-ec-ring";
id++;
Expand All@@ -389,6 +383,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
kfree(msg);
}

static const struct mfd_cell cros_ec_rtc_cells[] = {
{ .name = "cros-ec-rtc" }
};

static int ec_device_probe(struct platform_device *pdev)
{
int retval = -ENOMEM;
Expand DownExpand Up@@ -424,6 +422,26 @@ static int ec_device_probe(struct platform_device *pdev)
goto failed;
}

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Check whether this EC instance has RTC host command support */
if (cros_ec_check_features(ec, EC_FEATURE_RTC)) {
retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
cros_ec_rtc_cells,
ARRAY_SIZE(cros_ec_rtc_cells),
NULL, 0, NULL);
if (retval)
dev_err(ec->dev,
"failed to add cros-ec-rtc device: %d\n",
retval);
}

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

/* We can now add the sysfs class, we know which parameter to show */
retval = cdev_device_add(&ec->cdev, &ec->class_dev);
if (retval) {
dev_err(dev, "cdev_device_add failed => %d\n", retval);
Expand All@@ -433,13 +451,6 @@ static int ec_device_probe(struct platform_device *pdev)
if (cros_ec_debugfs_init(ec))
dev_warn(dev, "failed to create debugfs directory\n");

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

return 0;

failed:
Expand All@@ -461,16 +472,26 @@ static int ec_device_remove(struct platform_device *pdev)
return 0;
}

static void ec_device_shutdown(struct platform_device *pdev)
{
struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev);

/* Be sure to clear up debugfs delayed works */
cros_ec_debugfs_remove(ec);
}

static const struct platform_device_id cros_ec_id[] = {
{ DRV_NAME, 0 },
{ /* sentinel */ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, cros_ec_id);

static __maybe_unused int ec_device_suspend(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_suspend(ec);

lb_suspend(ec);

return 0;
Expand All@@ -480,6 +501,8 @@ static __maybe_unused int ec_device_resume(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_resume(ec);

lb_resume(ec);

return 0;
Expand All@@ -499,6 +522,7 @@ static struct platform_driver cros_ec_dev_driver = {
},
.probe = ec_device_probe,
.remove = ec_device_remove,
.shutdown = ec_device_shutdown,
};

static int __init cros_ec_dev_init(void)
Expand Down
12 changes: 12 additions & 0 deletions drivers/mfd/cros_ec_i2c.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand DownExpand Up@@ -344,21 +345,32 @@ static int cros_ec_i2c_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(cros_ec_i2c_pm_ops, cros_ec_i2c_suspend,
cros_ec_i2c_resume);

#ifdef CONFIG_OF
static const struct of_device_id cros_ec_i2c_of_match[] = {
{ .compatible = "google,cros-ec-i2c", },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match);
#endif

static const struct i2c_device_id cros_ec_i2c_id[] = {
{ "cros-ec-i2c", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, cros_ec_i2c_id);

#ifdef CONFIG_ACPI
static const struct acpi_device_id cros_ec_i2c_acpi_id[] = {
{ "GOOG0008", 0 },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(acpi, cros_ec_i2c_acpi_id);
#endif

static struct i2c_driver cros_ec_driver = {
.driver = {
.name = "cros-ec-i2c",
.acpi_match_table = ACPI_PTR(cros_ec_i2c_acpi_id),
.of_match_table = of_match_ptr(cros_ec_i2c_of_match),
.pm = &cros_ec_i2c_pm_ops,
},
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e1120ae
platform/chrome: chromeos_laptop - stop setting suspend mode for Atme…
dtor Mar 20, 2018
3bd910a
platform/chrome: chromeos_laptop - introduce pr_fmt()
dtor Mar 20, 2018
e34e959
platform/chrome: chromeos_laptop - factor out getting IRQ from DMI
dtor Mar 20, 2018
ffa0bb3
platform/chrome: chromeos_laptop - rework i2c peripherals initialization
dtor Mar 20, 2018
2d76941
platform/chrome: chromeos_laptop - parse DMI IRQ data once
dtor Mar 20, 2018
07781ca
platform/chrome: chromeos_laptop - use I2C notifier to create devices
dtor Mar 20, 2018
1b67992
platform/chrome: chromeos_laptop - rely on I2C to set up interrupt tr…
dtor Mar 20, 2018
00c4979
platform/chrome: chromeos_laptop - use device properties for Pixel
dtor Mar 20, 2018
663de6d
platform/chrome: chromeos_laptop - discard data for unneeded boards
dtor Mar 20, 2018
fbf60df
platform/chrome: cros_ec_lpc: wake up from s2idle on Chrome EC
Feb 22, 2018
77d3e62
platform/chrome: cros_ec_lpc: Add support for Google devices using cu…
Mar 7, 2018
2a8331b
platform/chrome: cros_ec_sysfs: Modify error handling
gwendalcr Mar 23, 2018
c09fb8f
platform/chrome: cros_ec_sysfs: introduce to_cros_ec_dev define.
Mar 23, 2018
0c4f236
platform/chrome: cros_ec_sysfs: use permission-specific DEVICE_ATTR v…
Mar 23, 2018
70a4c69
platform/chrome: cros_ec_debugfs: Use octal permissions '0444'
Mar 23, 2018
975efde
platform/chrome: mfd/cros_ec_dev: Add sysfs entry to set keyboard wak…
gwendalcr Mar 23, 2018
360ca3d
platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device f…
dtor May 22, 2018
2d31288
Revert "mfd: cros_ec: Add ACPI GPE handler for LID0 devices"
Feb 22, 2018
906eb67
mfd: cros_ec: Retry commands when EC is known to be busy
computersforpeace May 23, 2018
7764be9
platform: chrome: Add Tablet Switch ACPI driver
gwendalcr Jan 30, 2017
3c4c60d
platform/chrome: chromeos_laptop - supply properties for ACPI devices
dtor May 4, 2018
9107533
platform: chrome: Add input dependency for tablet switch driver
arndb May 28, 2018
a6953b2
mfd: cros_ec: Fail early if we cannot identify the EC
vpalatin Apr 18, 2018
25c5ab9
mfd: cros_ec: Free IRQ automatically
vpalatin Apr 18, 2018
4904474
mfd: cros_ec: Don't try to grab log when suspended
dianders Apr 18, 2018
a4b6301
mfd: cros_ec_dev: Register cros-ec-rtc driver as a subdevice
Apr 18, 2018
2ad83d1
mfd: cros_ec_dev: Register shutdown function for debugfs
Apr 18, 2018
f080fde
mfd: cros_ec_i2c: Add ACPI module device table
aitjcize Apr 18, 2018
09011e9
GalliumOS: Config: Enable TBMC as a module
danielstuart14 Jul 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion drivers/mfd/Makefile
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@ obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o
obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o
obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o
cros_ec_core-objs := cros_ec.o
cros_ec_core-$(CONFIG_ACPI) += cros_ec_acpi_gpe.o
obj-$(CONFIG_MFD_CROS_EC) += cros_ec_core.o
obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o
obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o
Expand Down
41 changes: 14 additions & 27 deletions drivers/mfd/cros_ec.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,12 +112,16 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

mutex_init(&ec_dev->lock);

cros_ec_query_all(ec_dev);
err = cros_ec_query_all(ec_dev);
if (err) {
dev_err(dev, "Cannot identify the EC: error %d\n", err);
return err;
}

if (ec_dev->irq) {
err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
err = devm_request_threaded_irq(dev, ec_dev->irq, NULL,
ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
if (err) {
dev_err(dev, "Failed to request IRQ %d: %d",
ec_dev->irq, err);
Expand All@@ -131,7 +135,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Embedded Controller subdevice %d\n",
err);
goto fail_mfd;
return err;
}

if (ec_dev->max_passthru) {
Expand All@@ -149,7 +153,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
dev_err(dev,
"Failed to register Power Delivery subdevice %d\n",
err);
goto fail_mfd;
return err;
}
}

Expand All@@ -158,7 +162,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
if (err) {
mfd_remove_devices(dev);
dev_err(dev, "Failed to register sub-devices\n");
goto fail_mfd;
return err;
}
}

Expand All@@ -173,26 +177,14 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

dev_info(dev, "Chrome EC device registered\n");

cros_ec_acpi_install_gpe_handler(dev);

return 0;

fail_mfd:
if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);
return err;
}
EXPORT_SYMBOL(cros_ec_register);

int cros_ec_remove(struct cros_ec_device *ec_dev)
{
mfd_remove_devices(ec_dev->dev);

cros_ec_acpi_remove_gpe_handler();

if (ec_dev->irq)
free_irq(ec_dev->irq, ec_dev);

return 0;
}
EXPORT_SYMBOL(cros_ec_remove);
Expand All@@ -204,14 +196,9 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev)
int ret;
u8 sleep_event;

if (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) {
sleep_event = HOST_SLEEP_EVENT_S3_SUSPEND;
} else {
sleep_event = HOST_SLEEP_EVENT_S0IX_SUSPEND;

/* Clearing the GPE status for any pending event */
cros_ec_acpi_clear_gpe();
}
sleep_event = (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) ?
HOST_SLEEP_EVENT_S3_SUSPEND :
HOST_SLEEP_EVENT_S0IX_SUSPEND;

ret = cros_ec_sleep_event(ec_dev, sleep_event);
if (ret < 0)
Expand Down
103 changes: 0 additions & 103 deletions drivers/mfd/cros_ec_acpi_gpe.c

This file was deleted.

62 changes: 43 additions & 19 deletions drivers/mfd/cros_ec_dev.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -305,8 +305,8 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)

resp = (struct ec_response_motion_sense *)msg->data;
sensor_num = resp->dump.sensor_count;
/* Allocate 2 extra sensors in case lid angle or FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 2),
/* Allocate 1 extra sensors in FIFO are needed */
sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 1),
GFP_KERNEL);
if (sensor_cells == NULL)
goto error;
Expand DownExpand Up@@ -362,16 +362,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
sensor_type[resp->info.type]++;
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2) {
sensor_platforms[id].sensor_num = sensor_num;

sensor_cells[id].name = "cros-ec-angle";
sensor_cells[id].id = 0;
sensor_cells[id].platform_data = &sensor_platforms[id];
sensor_cells[id].pdata_size =
sizeof(struct cros_ec_sensor_platform);
id++;
}
if (sensor_type[MOTIONSENSE_TYPE_ACCEL] >= 2)
ec->has_kb_wake_angle = true;

if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) {
sensor_cells[id].name = "cros-ec-ring";
id++;
Expand All@@ -389,6 +383,10 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
kfree(msg);
}

static const struct mfd_cell cros_ec_rtc_cells[] = {
{ .name = "cros-ec-rtc" }
};

static int ec_device_probe(struct platform_device *pdev)
{
int retval = -ENOMEM;
Expand DownExpand Up@@ -424,6 +422,26 @@ static int ec_device_probe(struct platform_device *pdev)
goto failed;
}

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Check whether this EC instance has RTC host command support */
if (cros_ec_check_features(ec, EC_FEATURE_RTC)) {
retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
cros_ec_rtc_cells,
ARRAY_SIZE(cros_ec_rtc_cells),
NULL, 0, NULL);
if (retval)
dev_err(ec->dev,
"failed to add cros-ec-rtc device: %d\n",
retval);
}

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

/* We can now add the sysfs class, we know which parameter to show */
retval = cdev_device_add(&ec->cdev, &ec->class_dev);
if (retval) {
dev_err(dev, "cdev_device_add failed => %d\n", retval);
Expand All@@ -433,13 +451,6 @@ static int ec_device_probe(struct platform_device *pdev)
if (cros_ec_debugfs_init(ec))
dev_warn(dev, "failed to create debugfs directory\n");

/* check whether this EC is a sensor hub. */
if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
cros_ec_sensors_register(ec);

/* Take control of the lightbar from the EC. */
lb_manual_suspend_ctrl(ec, 1);

return 0;

failed:
Expand All@@ -461,16 +472,26 @@ static int ec_device_remove(struct platform_device *pdev)
return 0;
}

static void ec_device_shutdown(struct platform_device *pdev)
{
struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev);

/* Be sure to clear up debugfs delayed works */
cros_ec_debugfs_remove(ec);
}

static const struct platform_device_id cros_ec_id[] = {
{ DRV_NAME, 0 },
{ /* sentinel */ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, cros_ec_id);

static __maybe_unused int ec_device_suspend(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_suspend(ec);

lb_suspend(ec);

return 0;
Expand All@@ -480,6 +501,8 @@ static __maybe_unused int ec_device_resume(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);

cros_ec_debugfs_resume(ec);

lb_resume(ec);

return 0;
Expand All@@ -499,6 +522,7 @@ static struct platform_driver cros_ec_dev_driver = {
},
.probe = ec_device_probe,
.remove = ec_device_remove,
.shutdown = ec_device_shutdown,
};

static int __init cros_ec_dev_init(void)
Expand Down
12 changes: 12 additions & 0 deletions drivers/mfd/cros_ec_i2c.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand DownExpand Up@@ -344,21 +345,32 @@ static int cros_ec_i2c_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(cros_ec_i2c_pm_ops, cros_ec_i2c_suspend,
cros_ec_i2c_resume);

#ifdef CONFIG_OF
static const struct of_device_id cros_ec_i2c_of_match[] = {
{ .compatible = "google,cros-ec-i2c", },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match);
#endif

static const struct i2c_device_id cros_ec_i2c_id[] = {
{ "cros-ec-i2c", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, cros_ec_i2c_id);

#ifdef CONFIG_ACPI
static const struct acpi_device_id cros_ec_i2c_acpi_id[] = {
{ "GOOG0008", 0 },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(acpi, cros_ec_i2c_acpi_id);
#endif

static struct i2c_driver cros_ec_driver = {
.driver = {
.name = "cros-ec-i2c",
.acpi_match_table = ACPI_PTR(cros_ec_i2c_acpi_id),
.of_match_table = of_match_ptr(cros_ec_i2c_of_match),
.pm = &cros_ec_i2c_pm_ops,
},
Expand Down
Loading