Skip to content

Commit 5b74498

Browse files
committed
Merge tag 'tag-chrome-platform-for-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform
Pull chrome-platform updates from Benson Leung: - Move mfd/cros_ec_lpc* includes to drivers/platform from mfd - Adding a new interrupt path for cros_ec_lpc * tag 'tag-chrome-platform-for-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform: platform/chrome: chromeos_tbmc - Remove unneeded const platform/chrome: Add a new interrupt path for cros_ec_lpc mfd: cros_ec: Fix and improve kerneldoc comments. platform/chrome: Move mfd/cros_ec_lpc* includes to drivers/platform.
2 parents 3dca04d + bc3f4b5 commit 5b74498

File tree

9 files changed

+337
-223
lines changed

9 files changed

+337
-223
lines changed

drivers/mfd/cros_ec_dev.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@
2626

2727
#define CROS_EC_DEV_VERSION "1.0.0"
2828

29-
/*
30-
* @offset: within EC_LPC_ADDR_MEMMAP region
31-
* @bytes: number of bytes to read. zero means "read a string" (including '\0')
32-
* (at most only EC_MEMMAP_SIZE bytes can be read)
33-
* @buffer: where to store the result
34-
* ioctl returns the number of bytes read, negative on error
29+
/**
30+
* struct cros_ec_readmem - Struct used to read mapped memory.
31+
* @offset: Within EC_LPC_ADDR_MEMMAP region.
32+
* @bytes: Number of bytes to read. Zero means "read a string" (including '\0')
33+
* At most only EC_MEMMAP_SIZE bytes can be read.
34+
* @buffer: Where to store the result. The ioctl returns the number of bytes
35+
* read or negative on error.
3536
*/
3637
struct cros_ec_readmem {
3738
uint32_t offset;

drivers/platform/chrome/chromeos_tbmc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static const struct acpi_device_id chromeos_tbmc_acpi_device_ids[] = {
9999
};
100100
MODULE_DEVICE_TABLE(acpi, chromeos_tbmc_acpi_device_ids);
101101

102-
static const SIMPLE_DEV_PM_OPS(chromeos_tbmc_pm_ops, NULL,
102+
static SIMPLE_DEV_PM_OPS(chromeos_tbmc_pm_ops, NULL,
103103
chromeos_tbmc_resume);
104104

105105
static struct acpi_driver chromeos_tbmc_driver = {

drivers/platform/chrome/cros_ec_lpc.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@
2525
#include <linux/dmi.h>
2626
#include <linux/delay.h>
2727
#include <linux/io.h>
28+
#include <linux/interrupt.h>
2829
#include <linux/mfd/cros_ec.h>
2930
#include <linux/mfd/cros_ec_commands.h>
30-
#include <linux/mfd/cros_ec_lpc_reg.h>
3131
#include <linux/module.h>
3232
#include <linux/platform_device.h>
3333
#include <linux/printk.h>
3434
#include <linux/suspend.h>
3535

36+
#include "cros_ec_lpc_reg.h"
37+
3638
#define DRV_NAME "cros_ec_lpcs"
3739
#define ACPI_DRV_NAME "GOOG0004"
3840

@@ -248,7 +250,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
248250
acpi_status status;
249251
struct cros_ec_device *ec_dev;
250252
u8 buf[2];
251-
int ret;
253+
int irq, ret;
252254

253255
if (!devm_request_region(dev, EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE,
254256
dev_name(dev))) {
@@ -287,6 +289,18 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
287289
sizeof(struct ec_response_get_protocol_info);
288290
ec_dev->dout_size = sizeof(struct ec_host_request);
289291

292+
/*
293+
* Some boards do not have an IRQ allotted for cros_ec_lpc,
294+
* which makes ENXIO an expected (and safe) scenario.
295+
*/
296+
irq = platform_get_irq(pdev, 0);
297+
if (irq > 0)
298+
ec_dev->irq = irq;
299+
else if (irq != -ENXIO) {
300+
dev_err(dev, "couldn't retrieve IRQ number (%d)\n", irq);
301+
return irq;
302+
}
303+
290304
ret = cros_ec_register(ec_dev);
291305
if (ret) {
292306
dev_err(dev, "couldn't register ec_dev (%d)\n", ret);

drivers/platform/chrome/cros_ec_lpc_mec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424
#include <linux/delay.h>
2525
#include <linux/io.h>
2626
#include <linux/mfd/cros_ec_commands.h>
27-
#include <linux/mfd/cros_ec_lpc_mec.h>
2827
#include <linux/mutex.h>
2928
#include <linux/types.h>
3029

30+
#include "cros_ec_lpc_mec.h"
31+
3132
/*
3233
* This mutex must be held while accessing the EMI unit. We can't rely on the
3334
* EC mutex because memmap data may be accessed without it being held.

include/linux/mfd/cros_ec_lpc_mec.h renamed to drivers/platform/chrome/cros_ec_lpc_mec.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
* expensive.
2222
*/
2323

24-
#ifndef __LINUX_MFD_CROS_EC_MEC_H
25-
#define __LINUX_MFD_CROS_EC_MEC_H
24+
#ifndef __CROS_EC_LPC_MEC_H
25+
#define __CROS_EC_LPC_MEC_H
2626

2727
#include <linux/mfd/cros_ec_commands.h>
2828

@@ -87,4 +87,4 @@ void cros_ec_lpc_mec_destroy(void);
8787
u8 cros_ec_lpc_io_bytes_mec(enum cros_ec_lpc_mec_io_type io_type,
8888
unsigned int offset, unsigned int length, u8 *buf);
8989

90-
#endif /* __LINUX_MFD_CROS_EC_MEC_H */
90+
#endif /* __CROS_EC_LPC_MEC_H */

drivers/platform/chrome/cros_ec_lpc_reg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
#include <linux/io.h>
2525
#include <linux/mfd/cros_ec.h>
2626
#include <linux/mfd/cros_ec_commands.h>
27-
#include <linux/mfd/cros_ec_lpc_mec.h>
27+
28+
#include "cros_ec_lpc_mec.h"
2829

2930
static u8 lpc_read_bytes(unsigned int offset, unsigned int length, u8 *dest)
3031
{

include/linux/mfd/cros_ec_lpc_reg.h renamed to drivers/platform/chrome/cros_ec_lpc_reg.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
* expensive.
2222
*/
2323

24-
#ifndef __LINUX_MFD_CROS_EC_REG_H
25-
#define __LINUX_MFD_CROS_EC_REG_H
24+
#ifndef __CROS_EC_LPC_REG_H
25+
#define __CROS_EC_LPC_REG_H
2626

2727
/**
2828
* cros_ec_lpc_read_bytes - Read bytes from a given LPC-mapped address.
@@ -58,4 +58,4 @@ void cros_ec_lpc_reg_init(void);
5858
*/
5959
void cros_ec_lpc_reg_destroy(void);
6060

61-
#endif /* __LINUX_MFD_CROS_EC_REG_H */
61+
#endif /* __CROS_EC_LPC_REG_H */

0 commit comments

Comments
 (0)