diff options
Diffstat (limited to 'drivers/staging/nvec')
| -rw-r--r-- | drivers/staging/nvec/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/staging/nvec/nvec.c | 21 | ||||
| -rw-r--r-- | drivers/staging/nvec/nvec.h | 5 | ||||
| -rw-r--r-- | drivers/staging/nvec/nvec_ps2.c | 2 | 
4 files changed, 19 insertions, 11 deletions
diff --git a/drivers/staging/nvec/Kconfig b/drivers/staging/nvec/Kconfig index 7e61adacd15..9475e20c3d6 100644 --- a/drivers/staging/nvec/Kconfig +++ b/drivers/staging/nvec/Kconfig @@ -10,7 +10,7 @@ config KEYBOARD_NVEC  	tristate "Keyboard on nVidia compliant EC"  	depends on MFD_NVEC && INPUT  	help -	  Say Y here to enable support for a keyboard connected to  +	  Say Y here to enable support for a keyboard connected to  	  a nVidia compliant embedded controller.  config SERIO_NVEC_PS2 diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 5a5c6397e74..90f1c4d7fa8 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -36,7 +36,6 @@  #include <linux/slab.h>  #include <linux/spinlock.h>  #include <linux/workqueue.h> -#include <linux/clk/tegra.h>  #include "nvec.h" @@ -83,7 +82,7 @@ enum nvec_sleep_subcmds {  static struct nvec_chip *nvec_power_handle; -static struct mfd_cell nvec_devices[] = { +static const struct mfd_cell nvec_devices[] = {  	{  		.name = "nvec-kbd",  		.id = 1, @@ -679,9 +678,9 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)  			nvec->rx->data[nvec->rx->pos++] = received;  		else  			dev_err(nvec->dev, -				"RX buffer overflow on %p: " -				"Trying to write byte %u of %u\n", -				nvec->rx, nvec->rx->pos, NVEC_MSG_SIZE); +				"RX buffer overflow on %p: Trying to write byte %u of %u\n", +				nvec->rx, nvec->rx ? nvec->rx->pos : 0, +				NVEC_MSG_SIZE);  		break;  	default:  		nvec->state = 0; @@ -733,9 +732,9 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec)  	clk_prepare_enable(nvec->i2c_clk); -	tegra_periph_reset_assert(nvec->i2c_clk); +	reset_control_assert(nvec->rst);  	udelay(2); -	tegra_periph_reset_deassert(nvec->i2c_clk); +	reset_control_deassert(nvec->rst);  	val = I2C_CNFG_NEW_MASTER_SFM | I2C_CNFG_PACKET_MODE_EN |  	    (0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT); @@ -802,7 +801,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)  		unmute_speakers[] = { NVEC_OEM0, 0x10, 0x59, 0x95 },  		enable_event[7] = { NVEC_SYS, CNF_EVENT_REPORTING, true }; -	if(!pdev->dev.of_node) { +	if (!pdev->dev.of_node) {  		dev_err(&pdev->dev, "must be instantiated using device tree\n");  		return -ENODEV;  	} @@ -836,6 +835,12 @@ static int tegra_nvec_probe(struct platform_device *pdev)  		return -ENODEV;  	} +	nvec->rst = devm_reset_control_get(&pdev->dev, "i2c"); +	if (IS_ERR(nvec->rst)) { +		dev_err(nvec->dev, "failed to get controller reset\n"); +		return PTR_ERR(nvec->rst); +	} +  	nvec->base = base;  	nvec->irq = res->start;  	nvec->i2c_clk = i2c_clk; diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h index e880518935f..e271375053f 100644 --- a/drivers/staging/nvec/nvec.h +++ b/drivers/staging/nvec/nvec.h @@ -23,6 +23,7 @@  #include <linux/list.h>  #include <linux/mutex.h>  #include <linux/notifier.h> +#include <linux/reset.h>  #include <linux/spinlock.h>  #include <linux/workqueue.h> @@ -109,7 +110,8 @@ struct nvec_msg {   * @irq: The IRQ of the I2C device   * @i2c_addr: The address of the I2C slave   * @base: The base of the memory mapped region of the I2C device - * @clk: The clock of the I2C device + * @i2c_clk: The clock of the I2C device + * @rst: The reset of the I2C device   * @notifier_list: Notifiers to be called on received messages, see   *                 nvec_register_notifier()   * @rx_data: Received messages that have to be processed @@ -139,6 +141,7 @@ struct nvec_chip {  	int i2c_addr;  	void __iomem *base;  	struct clk *i2c_clk; +	struct reset_control *rst;  	struct atomic_notifier_head notifier_list;  	struct list_head rx_data, tx_data;  	struct notifier_block nvec_status_notifier; diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c index 06dbb02085a..45b2f1308e0 100644 --- a/drivers/staging/nvec/nvec_ps2.c +++ b/drivers/staging/nvec/nvec_ps2.c @@ -106,7 +106,7 @@ static int nvec_mouse_probe(struct platform_device *pdev)  	struct serio *ser_dev;  	char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 }; -	ser_dev = kzalloc(sizeof(struct serio), GFP_KERNEL); +	ser_dev = devm_kzalloc(&pdev->dev, sizeof(struct serio), GFP_KERNEL);  	if (ser_dev == NULL)  		return -ENOMEM;  | 
