linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: davidb@codeaurora.org (David Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/6] RFC: SSBI: Simple pm8058 test driver
Date: Wed,  6 Mar 2013 16:29:47 -0800	[thread overview]
Message-ID: <1362616187-21089-7-git-send-email-davidb@codeaurora.org> (raw)
In-Reply-To: <1362616187-21089-1-git-send-email-davidb@codeaurora.org>

A very small ssbi device driver that reads the pm8058 version register
;and prints it out.

This isn't really a useful driver, hence the RFC, but it is useful for
someone wanting to test the SSBI driver itself.  Once the PMIC drivers
are finished, this isn't useful at all.

Signed-off-by: David Brown <davidb@codeaurora.org>
---
 arch/arm/boot/dts/msm8660-surf.dts |  4 +++
 arch/arm/boot/dts/msm8960-cdp.dts  |  4 +++
 drivers/ssbi/Makefile              |  1 +
 drivers/ssbi/ssbi-test.c           | 61 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 70 insertions(+)
 create mode 100644 drivers/ssbi/ssbi-test.c

diff --git a/arch/arm/boot/dts/msm8660-surf.dts b/arch/arm/boot/dts/msm8660-surf.dts
index 67f8670..68a0c7c4 100644
--- a/arch/arm/boot/dts/msm8660-surf.dts
+++ b/arch/arm/boot/dts/msm8660-surf.dts
@@ -43,5 +43,9 @@
 		compatible = "qcom,ssbi";
 		reg = <0x500000 0x1000>;
 		qcom,controller-type = "pmic-arbiter";
+
+		qcom,ssbi-test {
+			compatible = "qcom,ssbi-test";
+		};
 	};
 };
diff --git a/arch/arm/boot/dts/msm8960-cdp.dts b/arch/arm/boot/dts/msm8960-cdp.dts
index c9b09a8..60804d7 100644
--- a/arch/arm/boot/dts/msm8960-cdp.dts
+++ b/arch/arm/boot/dts/msm8960-cdp.dts
@@ -43,5 +43,9 @@
 		compatible = "qcom,ssbi";
 		reg = <0x500000 0x1000>;
 		qcom,controller-type = "pmic-arbiter";
+
+		qcom,ssbi-test {
+			compatible = "qcom,ssbi-test";
+		};
 	};
 };
diff --git a/drivers/ssbi/Makefile b/drivers/ssbi/Makefile
index ea8c1e4..3561280 100644
--- a/drivers/ssbi/Makefile
+++ b/drivers/ssbi/Makefile
@@ -2,3 +2,4 @@
 # Makefile for the MSM specific device drivers.
 #
 obj-$(CONFIG_MSM_SSBI) += ssbi.o
+obj-$(CONFIG_MSM_SSBI) += ssbi-test.o
diff --git a/drivers/ssbi/ssbi-test.c b/drivers/ssbi/ssbi-test.c
new file mode 100644
index 0000000..dea4dd0
--- /dev/null
+++ b/drivers/ssbi/ssbi-test.c
@@ -0,0 +1,61 @@
+/* A simple ssbi test device. */
+
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/msm_ssbi.h>
+
+static int __init ssbi_test_probe(struct platform_device *pdev)
+{
+	int ret;
+	char version;
+
+	dev_info(&pdev->dev, "probe, me = %p, parent = %p\n",
+		 pdev, pdev->dev.parent);
+
+	/* Let's try reading. */
+	ret = msm_ssbi_read(pdev->dev.parent, 0x02, &version, 1);
+	if (ret != 0)
+		return ret;
+
+	dev_info(&pdev->dev, "Version = %02x\n", version);
+
+	/* Should already be hooked in. */
+	return 0;
+}
+
+static int ssbi_test_remove(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static struct of_device_id ssbi_test_match_table[] = {
+	{ .compatible = "qcom,ssbi-test" },
+	{}
+};
+
+static struct platform_driver ssbi_test_driver = {
+	.remove = ssbi_test_remove,
+	.driver = {
+		.name = "sbbi_test",
+		.owner = THIS_MODULE,
+		.of_match_table = ssbi_test_match_table,
+	},
+};
+
+static int __init ssbi_test_init(void)
+{
+	int ret;
+
+	ret = platform_driver_probe(&ssbi_test_driver, ssbi_test_probe);
+	return ret;
+}
+
+static void __exit ssbi_test_exit(void)
+{
+}
+
+module_init(ssbi_test_init);
+module_exit(ssbi_test_exit);
+
+MODULE_LICENSE("GPL");
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

  parent reply	other threads:[~2013-03-07  0:29 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-07  0:29 [PATCH 0/6] Qualcomm SSBI bus driver David Brown
2013-03-07  0:29 ` [PATCH 1/6] platform-drivers: msm: add single-wire serial bus interface (SSBI) driver David Brown
2013-03-07  1:30   ` Greg Kroah-Hartman
2013-03-07  5:20     ` David Brown
2013-03-07  6:01       ` Greg Kroah-Hartman
2013-03-07 10:05         ` Sekhar Nori
2013-03-07 18:45           ` David Brown
2013-03-07 18:50         ` David Brown
2013-03-07 23:29           ` Greg Kroah-Hartman
2013-03-12  6:51     ` David Brown
2013-03-12 13:27       ` Greg Kroah-Hartman
2013-03-07  0:29 ` [PATCH 2/6] SSBI: Convert SSBI to device tree David Brown
2013-03-07  0:29 ` [PATCH 3/6] ssbi: Fix exit mismatch in remove function David Brown
2013-03-07  1:30   ` Greg Kroah-Hartman
2013-03-07  5:21     ` David Brown
2013-03-07  0:29 ` [PATCH 4/6] ssbi: Use regular init level David Brown
2013-03-07  0:29 ` [PATCH 5/6] ARM: msm: enable SSBI driver in defconfig David Brown
2013-03-07  0:29 ` David Brown [this message]
2013-03-12 18:41 ` [PATCH v2 0/11] Qualcomm SSBI bus driver David Brown
2013-03-12 18:41   ` [PATCH v2 01/11] platform-drivers: msm: add single-wire serial bus interface (SSBI) driver David Brown
2013-03-12 18:41   ` [PATCH v2 02/11] fix: Use EXPORT_SYMBOL_GPL David Brown
2013-03-12 18:41   ` [PATCH v2 03/11] ssbi: Fix exit mismatch in remove function David Brown
2013-03-12 18:41   ` [PATCH v2 04/11] ssbi: Allow compilation as a module David Brown
2013-03-12 18:41   ` [PATCH v2 05/11] SSBI: Convert SSBI to device tree David Brown
2013-03-12 20:46     ` Stephen Boyd
2013-03-12 18:41   ` [PATCH v2 06/11] ssbi: Comment the use of udelay() David Brown
2013-03-12 18:41   ` [PATCH v2 07/11] ssbi: Use regular init level David Brown
2013-03-12 20:26     ` Stephen Boyd
2013-03-12 18:41   ` [PATCH v2 08/11] ssbi: Remove extraneous logging David Brown
2013-03-12 18:41   ` [PATCH v2 09/11] SSBI: Remove MSM_ prefix from SSBI drivers David Brown
2013-03-12 18:41   ` [PATCH v2 10/11] MAINTAINERS: add ssbi David Brown
2013-03-25 17:40   ` [PATCH v2 0/11] Qualcomm SSBI bus driver Greg Kroah-Hartman
2013-03-12 20:12 ` [PATCH v2 11/11] RFC: SSBI: Simple pm8058 test driver David 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=1362616187-21089-7-git-send-email-davidb@codeaurora.org \
    --to=davidb@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).