All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Sebastian Reichel <sre@kernel.org>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Daniel Mack <daniel@zonque.org>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	patches@opensource.wolfsonmicro.com, linux-pm@vger.kernel.org,
	alsa-devel@alsa-project.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 9/9] Input: wm97xx: add new AC97 bus support
Date: Wed, 26 Oct 2016 21:41:47 +0200	[thread overview]
Message-ID: <1477510907-23495-10-git-send-email-robert.jarzmik@free.fr> (raw)
In-Reply-To: <1477510907-23495-1-git-send-email-robert.jarzmik@free.fr>

This adds support for the new AC97 bus code, which discovers the devices
rather than uses platform data.

As part of this discovery, it enables a multi-function device wm97xx,
which supports touchscreen, battery, ADC and an audio codec. This patch
adds the code to bind the touchscreen "cell" as the touchscreen driver.

This was tested on the pxa architecture with a pxa270 + wm9713 + the
mioa701 touchscreen.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/input/touchscreen/Kconfig       |  2 +-
 drivers/input/touchscreen/wm97xx-core.c | 56 ++++++++++++++++++++++++++++++++-
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index efca0133e266..7af06015e704 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -737,7 +737,7 @@ config TOUCHSCREEN_WM831X
 
 config TOUCHSCREEN_WM97XX
 	tristate "Support for WM97xx AC97 touchscreen controllers"
-	depends on AC97_BUS
+	depends on AC97_BUS || AC97_BUS_NEW
 	help
 	  Say Y here if you have a Wolfson Microelectronics WM97xx
 	  touchscreen connected to your system. Note that this option
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c
index 50a110e2988b..4d5c96a5ab04 100644
--- a/drivers/input/touchscreen/wm97xx-core.c
+++ b/drivers/input/touchscreen/wm97xx-core.c
@@ -44,6 +44,7 @@
 #include <linux/pm.h>
 #include <linux/interrupt.h>
 #include <linux/bitops.h>
+#include <linux/mfd/wm97xx.h>
 #include <linux/workqueue.h>
 #include <linux/wm97xx.h>
 #include <linux/uaccess.h>
@@ -763,6 +764,39 @@ static int wm97xx_remove(struct device *dev)
 	return 0;
 }
 
+static int wm97xx_mfd_probe(struct platform_device *pdev)
+{
+	struct wm97xx *wm;
+	struct wm97xx_platform_data *mfd_pdata = dev_get_platdata(&pdev->dev);
+	int ret;
+
+	wm = devm_kzalloc(&pdev->dev, sizeof(struct wm97xx), GFP_KERNEL);
+	if (!wm)
+		return -ENOMEM;
+
+	wm->dev = &pdev->dev;
+	wm->ac97 = mfd_pdata->ac97;
+
+	ret =  _wm97xx_probe(wm);
+	if (ret)
+		return ret;
+
+	ret = wm97xx_add_battery(wm, mfd_pdata->batt_pdata);
+	if (ret < 0)
+		goto batt_err;
+
+	return ret;
+
+batt_err:
+	wm97xx_unregister_touch(wm);
+	return ret;
+}
+
+static int wm97xx_mfd_remove(struct platform_device *pdev)
+{
+	return wm97xx_remove(&pdev->dev);
+}
+
 static int __maybe_unused wm97xx_suspend(struct device *dev)
 {
 	struct wm97xx *wm = dev_get_drvdata(dev);
@@ -859,21 +893,41 @@ EXPORT_SYMBOL_GPL(wm97xx_unregister_mach_ops);
 
 static struct device_driver wm97xx_driver = {
 	.name =		"wm97xx-ts",
+#ifdef CONFIG_AC97_BUS
 	.bus =		&ac97_bus_type,
+#endif
 	.owner =	THIS_MODULE,
 	.probe =	wm97xx_probe,
 	.remove =	wm97xx_remove,
 	.pm =		&wm97xx_pm_ops,
 };
 
+static struct platform_driver wm97xx_mfd_driver = {
+	.driver = {
+		.name =		"wm97xx-ts",
+		.pm =		&wm97xx_pm_ops,
+	},
+	.probe =	wm97xx_mfd_probe,
+	.remove =	wm97xx_mfd_remove,
+};
+
 static int __init wm97xx_init(void)
 {
-	return driver_register(&wm97xx_driver);
+	int ret;
+
+	ret = platform_driver_register(&wm97xx_mfd_driver);
+	if (ret)
+		return ret;
+
+	if (IS_BUILTIN(CONFIG_AC97_BUS))
+		ret =  driver_register(&wm97xx_driver);
+	return ret;
 }
 
 static void __exit wm97xx_exit(void)
 {
 	driver_unregister(&wm97xx_driver);
+	platform_driver_unregister(&wm97xx_mfd_driver);
 }
 
 module_init(wm97xx_init);
-- 
2.1.4

WARNING: multiple messages have this Message-ID (diff)
From: robert.jarzmik@free.fr (Robert Jarzmik)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 9/9] Input: wm97xx: add new AC97 bus support
Date: Wed, 26 Oct 2016 21:41:47 +0200	[thread overview]
Message-ID: <1477510907-23495-10-git-send-email-robert.jarzmik@free.fr> (raw)
In-Reply-To: <1477510907-23495-1-git-send-email-robert.jarzmik@free.fr>

This adds support for the new AC97 bus code, which discovers the devices
rather than uses platform data.

As part of this discovery, it enables a multi-function device wm97xx,
which supports touchscreen, battery, ADC and an audio codec. This patch
adds the code to bind the touchscreen "cell" as the touchscreen driver.

This was tested on the pxa architecture with a pxa270 + wm9713 + the
mioa701 touchscreen.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/input/touchscreen/Kconfig       |  2 +-
 drivers/input/touchscreen/wm97xx-core.c | 56 ++++++++++++++++++++++++++++++++-
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index efca0133e266..7af06015e704 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -737,7 +737,7 @@ config TOUCHSCREEN_WM831X
 
 config TOUCHSCREEN_WM97XX
 	tristate "Support for WM97xx AC97 touchscreen controllers"
-	depends on AC97_BUS
+	depends on AC97_BUS || AC97_BUS_NEW
 	help
 	  Say Y here if you have a Wolfson Microelectronics WM97xx
 	  touchscreen connected to your system. Note that this option
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c
index 50a110e2988b..4d5c96a5ab04 100644
--- a/drivers/input/touchscreen/wm97xx-core.c
+++ b/drivers/input/touchscreen/wm97xx-core.c
@@ -44,6 +44,7 @@
 #include <linux/pm.h>
 #include <linux/interrupt.h>
 #include <linux/bitops.h>
+#include <linux/mfd/wm97xx.h>
 #include <linux/workqueue.h>
 #include <linux/wm97xx.h>
 #include <linux/uaccess.h>
@@ -763,6 +764,39 @@ static int wm97xx_remove(struct device *dev)
 	return 0;
 }
 
+static int wm97xx_mfd_probe(struct platform_device *pdev)
+{
+	struct wm97xx *wm;
+	struct wm97xx_platform_data *mfd_pdata = dev_get_platdata(&pdev->dev);
+	int ret;
+
+	wm = devm_kzalloc(&pdev->dev, sizeof(struct wm97xx), GFP_KERNEL);
+	if (!wm)
+		return -ENOMEM;
+
+	wm->dev = &pdev->dev;
+	wm->ac97 = mfd_pdata->ac97;
+
+	ret =  _wm97xx_probe(wm);
+	if (ret)
+		return ret;
+
+	ret = wm97xx_add_battery(wm, mfd_pdata->batt_pdata);
+	if (ret < 0)
+		goto batt_err;
+
+	return ret;
+
+batt_err:
+	wm97xx_unregister_touch(wm);
+	return ret;
+}
+
+static int wm97xx_mfd_remove(struct platform_device *pdev)
+{
+	return wm97xx_remove(&pdev->dev);
+}
+
 static int __maybe_unused wm97xx_suspend(struct device *dev)
 {
 	struct wm97xx *wm = dev_get_drvdata(dev);
@@ -859,21 +893,41 @@ EXPORT_SYMBOL_GPL(wm97xx_unregister_mach_ops);
 
 static struct device_driver wm97xx_driver = {
 	.name =		"wm97xx-ts",
+#ifdef CONFIG_AC97_BUS
 	.bus =		&ac97_bus_type,
+#endif
 	.owner =	THIS_MODULE,
 	.probe =	wm97xx_probe,
 	.remove =	wm97xx_remove,
 	.pm =		&wm97xx_pm_ops,
 };
 
+static struct platform_driver wm97xx_mfd_driver = {
+	.driver = {
+		.name =		"wm97xx-ts",
+		.pm =		&wm97xx_pm_ops,
+	},
+	.probe =	wm97xx_mfd_probe,
+	.remove =	wm97xx_mfd_remove,
+};
+
 static int __init wm97xx_init(void)
 {
-	return driver_register(&wm97xx_driver);
+	int ret;
+
+	ret = platform_driver_register(&wm97xx_mfd_driver);
+	if (ret)
+		return ret;
+
+	if (IS_BUILTIN(CONFIG_AC97_BUS))
+		ret =  driver_register(&wm97xx_driver);
+	return ret;
 }
 
 static void __exit wm97xx_exit(void)
 {
 	driver_unregister(&wm97xx_driver);
+	platform_driver_unregister(&wm97xx_mfd_driver);
 }
 
 module_init(wm97xx_init);
-- 
2.1.4

  parent reply	other threads:[~2016-10-26 19:49 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26 19:41 [PATCH 0/9] AC97 device/driver model revamp Robert Jarzmik
2016-10-26 19:41 ` Robert Jarzmik
2016-10-26 19:41 ` [PATCH 1/9] ALSA: ac97: split out the generic ac97 registers Robert Jarzmik
2016-10-26 19:41   ` Robert Jarzmik
2016-10-26 19:41 ` [PATCH 2/9] ALSA: ac97: add an ac97 bus Robert Jarzmik
2016-10-26 19:41   ` Robert Jarzmik
2016-11-08 13:37   ` [alsa-devel] " Lars-Peter Clausen
2016-11-08 13:37     ` Lars-Peter Clausen
2016-11-08 21:18     ` Robert Jarzmik
2016-11-08 21:18       ` Robert Jarzmik
2016-11-08 21:18       ` Robert Jarzmik
2016-11-09 13:11       ` Lars-Peter Clausen
2016-11-09 13:11         ` Lars-Peter Clausen
2016-11-09 21:27         ` Robert Jarzmik
2016-11-09 21:27           ` Robert Jarzmik
2016-11-10 11:38           ` Lars-Peter Clausen
2016-11-10 11:38             ` Lars-Peter Clausen
2016-11-22 18:08             ` Mark Brown
2016-11-22 18:08               ` Mark Brown
2016-11-25 19:58             ` Robert Jarzmik
2016-11-25 19:58               ` Robert Jarzmik
2016-10-26 19:41 ` [PATCH 3/9] ASoC: add new ac97 bus support Robert Jarzmik
2016-10-26 19:41   ` Robert Jarzmik
2016-10-26 19:41 ` [PATCH 4/9] ASoC: wm9713: add ac97 new " Robert Jarzmik
2016-10-26 19:41   ` Robert Jarzmik
2016-10-27  8:39   ` Charles Keepax
2016-10-27  8:39     ` Charles Keepax
2016-10-27  8:39     ` Charles Keepax
2016-10-26 19:41 ` [PATCH 5/9] ASoC: pxa: switch to new ac97 " Robert Jarzmik
2016-10-26 19:41   ` Robert Jarzmik
2016-10-31  8:37   ` Robert Jarzmik
2016-10-31  8:37     ` Robert Jarzmik
2016-11-01 19:55     ` Robert Jarzmik
2016-11-01 19:55       ` Robert Jarzmik
2016-10-26 19:41 ` [PATCH 6/9] power_supply: wm97xx_battery: use power_supply_get_drvdata Robert Jarzmik
2016-10-26 19:41   ` Robert Jarzmik
2016-10-27  8:41   ` Charles Keepax
2016-10-27  8:41     ` Charles Keepax
2016-11-23 23:13   ` Sebastian Reichel
2016-11-23 23:13     ` Sebastian Reichel
2016-11-25 19:54     ` Robert Jarzmik
2016-11-25 19:54       ` Robert Jarzmik
2017-01-23 18:38   ` Kevin Hilman
2017-01-23 18:38     ` Kevin Hilman
2017-01-24  7:31     ` Robert Jarzmik
2017-01-24  7:31       ` Robert Jarzmik
2017-01-24 20:40       ` Dmitry Torokhov
2017-01-24 20:40         ` Dmitry Torokhov
2017-01-24 23:39         ` Kevin Hilman
2017-01-24 23:39           ` Kevin Hilman
2016-10-26 19:41 ` [PATCH 7/9] Input: wm97xx: split out touchscreen registering Robert Jarzmik
2016-10-26 19:41   ` Robert Jarzmik
2016-10-26 19:41   ` Robert Jarzmik
2016-10-27  9:02   ` Charles Keepax
2016-10-27  9:02     ` Charles Keepax
2016-10-27  9:02     ` Charles Keepax
2016-10-27 19:27     ` Robert Jarzmik
2016-10-27 19:27       ` Robert Jarzmik
2016-10-27 19:27       ` Robert Jarzmik
2016-10-26 19:41 ` [PATCH 8/9] mfd: wm97xx-core: core support for wm97xx Codec Robert Jarzmik
2016-10-26 19:41   ` Robert Jarzmik
2016-10-27  9:11   ` Charles Keepax
2016-10-27  9:11     ` Charles Keepax
2016-10-27  9:11     ` Charles Keepax
2016-11-18 16:50   ` Lee Jones
2016-11-18 16:50     ` Lee Jones
2016-11-19 11:39     ` Robert Jarzmik
2016-11-19 11:39       ` Robert Jarzmik
2016-11-21 10:12       ` Lee Jones
2016-11-21 10:12         ` Lee Jones
2016-11-26  9:18         ` Robert Jarzmik
2016-11-26  9:18           ` Robert Jarzmik
2016-12-06 11:13           ` Mark Brown
2016-12-06 11:13             ` Mark Brown
2017-02-03  8:37             ` Robert Jarzmik
2017-02-03  8:37               ` Robert Jarzmik
2016-10-26 19:41 ` Robert Jarzmik [this message]
2016-10-26 19:41   ` [PATCH 9/9] Input: wm97xx: add new AC97 bus support Robert Jarzmik
2016-10-27  9:13   ` Charles Keepax
2016-10-27  9:13     ` Charles Keepax
2016-10-27  9:13     ` Charles Keepax
2017-09-19 16:11   ` Applied "Input: wm97xx: add new AC97 bus support" to the asoc tree Mark Brown
2017-09-19 16:11     ` Mark Brown
2017-09-19 16:11     ` Mark Brown
2016-11-22 18:13 ` [PATCH 0/9] AC97 device/driver model revamp Mark Brown
2016-11-22 18:13   ` Mark Brown
2016-11-22 18:13   ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477510907-23495-10-git-send-email-robert.jarzmik@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=daniel@zonque.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=haojian.zhuang@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=perex@perex.cz \
    --cc=sre@kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.