Skip to contentSkip to conversation

DA9058 ONKEY driver

PATCH Superseded Anthony Olech 2 participants 4 messages Apr 12, 2013 – Apr 16, 2013

Subsystems (3)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 3/7 DA9058 ONKEY driver

This is the ONKEY component driver of the Dialog DA9058 PMIC. This driver is just one component of the whole DA9058 PMIC driver. It depends on the CORE component driver of the DA9058 MFD.

---
 drivers/input/misc/Kconfig        |   10 +++
 drivers/input/misc/Makefile       |    1 +
 drivers/input/misc/da9058_onkey.c |  177 +++++++++++++++++++++++++++++++++++++
 3 files changed, 188 insertions(+)
 create mode 100644 drivers/input/misc/da9058_onkey.c
drivers/input/misc/Kconfig +10 -0
index 259ef31..bd07b38 100644
@@ -93,6 +93,16 @@ config INPUT_BMA150
 	  To compile this driver as a module, choose M here: the
 	  module will be called bma150.
 
+config INPUT_DA9058_ONKEY
+	tristate "DA9058 ONKEY support"
+	depends on MFD_DA9058
+	help
+	  Support the ONKEY of DA9058 PMICs as an input device
+	  reporting power button status.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called da9058_onkey.
+
 config INPUT_PCSPKR
 	tristate "PC Speaker support"
 	depends on PCSPKR_PLATFORM
drivers/input/misc/Makefile +1 -0
index 1f1e1b1..f36bf33 100644
@@ -44,6 +44,7 @@ obj-$(CONFIG_INPUT_PCF8574)		+= pcf8574_keypad.o
 obj-$(CONFIG_INPUT_PCSPKR)		+= pcspkr.o
 obj-$(CONFIG_INPUT_PM8XXX_VIBRATOR)	+= pm8xxx-vibrator.o
 obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY)	+= pmic8xxx-pwrkey.o
+obj-$(CONFIG_INPUT_DA9058_ONKEY)		+= da9058_onkey.o
 obj-$(CONFIG_INPUT_POWERMATE)		+= powermate.o
 obj-$(CONFIG_INPUT_PWM_BEEPER)		+= pwm-beeper.o
 obj-$(CONFIG_INPUT_RB532_BUTTON)	+= rb532_button.o
drivers/input/misc/da9058_onkey.c new file +177 -0

177 lines not on this page · raw message

Signature · 1 line
end-of-patch for NEW DRIVER V4
#1 lore raw
Quoted 18 lines · Anthony Olech

This is the ONKEY component driver of the Dialog DA9058 PMIC. This driver is just one component of the whole DA9058 PMIC driver. It depends on the CORE component driver of the DA9058 MFD.

---
 drivers/input/misc/Kconfig        |   10 +++
 drivers/input/misc/Makefile       |    1 +
 drivers/input/misc/da9058_onkey.c |  177 +++++++++++++++++++++++++++++++++++++
 3 files changed, 188 insertions(+)
 create mode 100644 drivers/input/misc/da9058_onkey.c
drivers/input/misc/Kconfig +0 -0
index 259ef31..bd07b38 100644

drivers/input/misc/Kconfig config INPUT_BMA150 · line 101

Quoted 9 lines
drivers/input/misc/Kconfig +6 -0
@@ -93,6 +93,16 @@ config INPUT_BMA150
 	  To compile this driver as a module, choose M here: the
 	  module will be called bma150.
 
+config INPUT_DA9058_ONKEY
+	tristate "DA9058 ONKEY support"
+	depends on MFD_DA9058
+	help
+	  Support the ONKEY of DA9058 PMICs as an input device
+	  reporting power button status.

What possible values can a power button status have? Must be more than my KISS guess:
this software is running => ON
software not running => OFF
eh?

Quoted 51 lines
drivers/input/misc/Kconfig +4 -0
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called da9058_onkey.
+
 config INPUT_PCSPKR
 	tristate "PC Speaker support"
 	depends on PCSPKR_PLATFORM
drivers/input/misc/da9058_onkey.c new file +38 -0
new file mode 100644
index 0000000..969ad70
@@ -0,0 +1,177 @@
+/*
+ *  Copyright (C) 2012 Dialog Semiconductor Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ */
+
+
+static int da9058_onkey_probe(struct platform_device *pdev)
+{
+	struct da9058 *da9058 = dev_get_drvdata(pdev->dev.parent);
+	const struct mfd_cell *cell = mfd_get_cell(pdev);
+	struct da9058_onkey_pdata *onkey_pdata;
+	struct da9058_onkey *onkey;
+	int ret;
+
+	if (cell == NULL) {
+		ret = -ENODEV;
+		goto exit;
+	}
+
+	onkey_pdata = cell->platform_data;
+
+	if (onkey_pdata == NULL) {
+		ret = -EINVAL;
+		goto exit;
+	}
+
+	dev_info(&pdev->dev, "Starting ONKEY\n");
+
+	onkey = devm_kzalloc(&pdev->dev, sizeof(struct da9058_onkey),
+				GFP_KERNEL);
+	if (!onkey) {
+		ret = -ENOMEM;
+		goto exit;

drivers/input/misc/da9058_onkey.c line 48

Quoted 10 lines
drivers/input/misc/da9058_onkey.c new file +10 -0
+	}
+
+	platform_set_drvdata(pdev, onkey);
+
+	onkey->da9058 = da9058;
+	onkey->pdev = pdev;
+
+	onkey->irq = platform_get_irq(pdev, 0);
+	if (onkey->irq < 0) {
+		dev_err(&pdev->dev, "can not get ONKEY IRQ error=%d\n",

cannot

Quoted 1 line
drivers/input/misc/da9058_onkey.c new file +1 -0
+				onkey->irq);
Signature · 1 line
~Randy
#2 lore raw
Quoted 31 lines

-----Original Message-----
From: Randy Dunlap [mailto:[email protected]]
Sent: 12 April 2013 21:02
To: Opensource [Anthony Olech]
Cc: Dmitry Torokhov; Mark Brown; Samuel Ortiz; Ashish Jangam; Eric Andersson; Andrew Jones; [email protected]; LKML; David Dajun Chen
Subject: Re: [NEW DRIVER V4 3/7] DA9058 ONKEY driver

Quoted 22 lines · Anthony Olech

This is the ONKEY component driver of the Dialog DA9058 PMIC. This driver is just one component of the whole DA9058 PMIC driver. It depends on the CORE component driver of the DA9058 MFD.

---
 drivers/input/misc/Kconfig        |   10 +++
 drivers/input/misc/Makefile       |    1 +
 drivers/input/misc/da9058_onkey.c |  177
+++++++++++++++++++++++++++++++++++++
 3 files changed, 188 insertions(+)
 create mode 100644 drivers/input/misc/da9058_onkey.c
drivers/input/misc/Kconfig +0 -0
index 259ef31..bd07b38 100644
@@ -93,6 +93,16 @@ config INPUT_BMA150
 	  To compile this driver as a module, choose M here: the
 	  module will be called bma150.
 
Quoted 12 lines

drivers/input/misc/Kconfig config INPUT_BMA150 · line 101

Quoted 6 lines
drivers/input/misc/Kconfig +6 -0
+config INPUT_DA9058_ONKEY
+	tristate "DA9058 ONKEY support"
+	depends on MFD_DA9058
+	help
+	  Support the ONKEY of DA9058 PMICs as an input device
+	  reporting power button status.

What possible values can a power button status have? Must be more than my KISS guess:
this software is running => ON
software not running => OFF
eh?

Pressing the button briefly and pressing and holding the button will have different effects in a mobile device. The press and hold on phones normally switches them into a sleep state. So the "power button status" is the fact that the ONKEY is still being held down.

Does that answer your question? or have I missed your point??

[...]

Quoted 5 lines

drivers/input/misc/Kconfig config INPUT_BMA150 · line 104

Quoted 3 lines
drivers/input/misc/Kconfig +3 -0
+	onkey->irq = platform_get_irq(pdev, 0);
+	if (onkey->irq < 0) {
+		dev_err(&pdev->dev, "can not get ONKEY IRQ error=%d\n",

cannot

The Washington State University language site says:

"These two spellings [cannot/can not] are largely interchangeable, but by far the most common is 'cannot' and you should probably use it except when you want to be emphatic: 'No, you can not wash the dog in the Maytag.'"

Since I was not trying to be particularly emphatic, I will change to using 'cannot' as per your suggestion.

Tony Olech

#3 lore raw
Quoted 44 lines · Opensource [Anthony Olech]
Quoted 31 lines

-----Original Message-----
From: Randy Dunlap [mailto:[email protected]]
Sent: 12 April 2013 21:02
To: Opensource [Anthony Olech]
Cc: Dmitry Torokhov; Mark Brown; Samuel Ortiz; Ashish Jangam; Eric Andersson; Andrew Jones; [email protected]; LKML; David Dajun Chen
Subject: Re: [NEW DRIVER V4 3/7] DA9058 ONKEY driver

Quoted 22 lines · Anthony Olech

This is the ONKEY component driver of the Dialog DA9058 PMIC. This driver is just one component of the whole DA9058 PMIC driver. It depends on the CORE component driver of the DA9058 MFD.

---
 drivers/input/misc/Kconfig        |   10 +++
 drivers/input/misc/Makefile       |    1 +
 drivers/input/misc/da9058_onkey.c |  177
+++++++++++++++++++++++++++++++++++++
 3 files changed, 188 insertions(+)
 create mode 100644 drivers/input/misc/da9058_onkey.c
drivers/input/misc/Kconfig +0 -0
index 259ef31..bd07b38 100644
@@ -93,6 +93,16 @@ config INPUT_BMA150
 	  To compile this driver as a module, choose M here: the
 	  module will be called bma150.
 
Quoted 12 lines

drivers/input/misc/Kconfig config INPUT_BMA150 · line 101

Quoted 6 lines
drivers/input/misc/Kconfig +6 -0
+config INPUT_DA9058_ONKEY
+	tristate "DA9058 ONKEY support"
+	depends on MFD_DA9058
+	help
+	  Support the ONKEY of DA9058 PMICs as an input device
+	  reporting power button status.

What possible values can a power button status have? Must be more than my KISS guess:
this software is running => ON
software not running => OFF
eh?

Quoted 6 lines

Pressing the button briefly and pressing and holding the button will have different effects in a mobile device. The press and hold on phones normally switches them into a sleep state. So the "power button status" is the fact that the ONKEY is still being held down.

Does that answer your question? or have I missed your point??

Yes, that answers my question. I get it.

Quoted 8 lines

[...]

Quoted 5 lines

drivers/input/misc/Kconfig

Quoted 3 lines
drivers/input/misc/Kconfig +3 -0
+	onkey->irq = platform_get_irq(pdev, 0);
+	if (onkey->irq < 0) {
+		dev_err(&pdev->dev, "can not get ONKEY IRQ error=%d\n",

cannot

Quoted 8 lines

The Washington State University language site says:

"These two spellings [cannot/can not] are largely interchangeable, but by far the most common is 'cannot' and you should probably use it except when you want to be emphatic: 'No, you can not wash the dog in the Maytag.'"

Since I was not trying to be particularly emphatic, I will change to using 'cannot' as per your suggestion.

thanks.

Signature · 1 line
~Randy