All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pantelis Antoniou <panto@antoniou-consulting.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>,
	linux-arm-kernel@lists.infradead.org,
	devicetree-discuss@lists.ozlabs.org,
	linux-kernel@vger.kernel.org,
	Koen Kooi <koen@dominion.thruhere.net>,
	Matt Porter <mporter@ti.com>, Russ Dill <Russ.Dill@ti.com>,
	linux-omap@vger.kernel.org
Subject: [RFC 3/7] capebus: Beaglebone generic cape support
Date: Wed, 31 Oct 2012 18:52:09 +0200	[thread overview]
Message-ID: <1351702333-8456-4-git-send-email-panto@antoniou-consulting.com> (raw)
In-Reply-To: <1351702333-8456-1-git-send-email-panto@antoniou-consulting.com>

Introducing beaglebone generic cape support.

With this you can create almost any kind of cape driver
that doesn't require complex interconnection of the parts.

Most beaglebone capes can be created with this, including
all the display capes (DVI/VGA/LCD) with touchscreen or not,
capes that only use i2c or spi devices, gpio-keys, leds etc.

Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
 drivers/capebus/capes/Kconfig             |  6 ++
 drivers/capebus/capes/Makefile            |  1 +
 drivers/capebus/capes/bone-generic-cape.c | 96 +++++++++++++++++++++++++++++++
 3 files changed, 103 insertions(+)
 create mode 100644 drivers/capebus/capes/Kconfig
 create mode 100644 drivers/capebus/capes/Makefile
 create mode 100644 drivers/capebus/capes/bone-generic-cape.c

diff --git a/drivers/capebus/capes/Kconfig b/drivers/capebus/capes/Kconfig
new file mode 100644
index 0000000..bfe54a6
--- /dev/null
+++ b/drivers/capebus/capes/Kconfig
@@ -0,0 +1,6 @@
+config CAPEBUS_BONE_GENERIC
+	tristate "Beaglebone Generic cape driver"
+	depends on CAPEBUS_BONE_CONTROLLER
+	default n
+	help
+	  "Select this to enable a generic cape driver; LCD/DVI capes etc"
diff --git a/drivers/capebus/capes/Makefile b/drivers/capebus/capes/Makefile
new file mode 100644
index 0000000..83da381
--- /dev/null
+++ b/drivers/capebus/capes/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_CAPEBUS_BONE_GENERIC)	+= bone-generic-cape.o
diff --git a/drivers/capebus/capes/bone-generic-cape.c b/drivers/capebus/capes/bone-generic-cape.c
new file mode 100644
index 0000000..70be50a
--- /dev/null
+++ b/drivers/capebus/capes/bone-generic-cape.c
@@ -0,0 +1,96 @@
+/*
+ * Generic cape support
+ *
+ * Copyright (C) 2012 Pantelis Antoniou <panto@antoniou-consulting.com>
+ * Copyright (C) 2012 Texas Instruments Inc.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/timer.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/bitops.h>
+#include <linux/err.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
+#include <linux/pinctrl/pinctrl.h>
+#include <linux/pinctrl/pinmux.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/atomic.h>
+#include <linux/clk.h>
+#include <asm/barrier.h>
+#include <plat/clock.h>
+#include <plat/omap_device.h>
+#include <linux/clkdev.h>
+#include <linux/input/ti_am335x_tsc.h>
+#include <linux/platform_data/ti_am335x_adc.h>
+#include <linux/mfd/ti_am335x_tscadc.h>
+
+#include <linux/capebus/capebus-bone.h>
+
+/* fwd decl. */
+extern struct cape_driver bonegeneric_driver;
+
+static const struct of_device_id bonegeneric_of_match[] = {
+	{
+		.compatible = "bone-generic-cape",
+	},	{ },
+};
+MODULE_DEVICE_TABLE(of, bonegeneric_of_match);
+
+static int bonegeneric_probe(struct cape_dev *dev,
+		const struct cape_device_id *id)
+{
+	struct bone_capebus_generic_info *ginfo;
+	int err;
+
+	err = bone_capebus_probe_prolog(dev, id);
+	if (err != 0)
+		return err;
+
+	ginfo = bone_capebus_probe_generic(dev, id);
+	if (IS_ERR_OR_NULL(ginfo))
+		return IS_ERR(ginfo) ? PTR_ERR(ginfo) : -ENODEV;
+	dev->drv_priv = ginfo;
+	return 0;
+}
+
+static void bonegeneric_remove(struct cape_dev *dev)
+{
+	bone_capebus_remove_generic(dev->drv_priv);
+}
+
+struct cape_driver bonegeneric_driver = {
+	.driver = {
+		.name		= "bonegeneric",
+		.owner		= THIS_MODULE,
+		.of_match_table	= bonegeneric_of_match,
+	},
+	.probe		= bonegeneric_probe,
+	.remove		= bonegeneric_remove,
+};
+
+module_capebus_driver(bonegeneric_driver);
+
+MODULE_AUTHOR("Pantelis Antoniou");
+MODULE_DESCRIPTION("Beaglebone generic cape");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:bone-generic-cape");
-- 
1.7.12


WARNING: multiple messages have this Message-ID (diff)
From: panto@antoniou-consulting.com (Pantelis Antoniou)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 3/7] capebus: Beaglebone generic cape support
Date: Wed, 31 Oct 2012 18:52:09 +0200	[thread overview]
Message-ID: <1351702333-8456-4-git-send-email-panto@antoniou-consulting.com> (raw)
In-Reply-To: <1351702333-8456-1-git-send-email-panto@antoniou-consulting.com>

Introducing beaglebone generic cape support.

With this you can create almost any kind of cape driver
that doesn't require complex interconnection of the parts.

Most beaglebone capes can be created with this, including
all the display capes (DVI/VGA/LCD) with touchscreen or not,
capes that only use i2c or spi devices, gpio-keys, leds etc.

Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
 drivers/capebus/capes/Kconfig             |  6 ++
 drivers/capebus/capes/Makefile            |  1 +
 drivers/capebus/capes/bone-generic-cape.c | 96 +++++++++++++++++++++++++++++++
 3 files changed, 103 insertions(+)
 create mode 100644 drivers/capebus/capes/Kconfig
 create mode 100644 drivers/capebus/capes/Makefile
 create mode 100644 drivers/capebus/capes/bone-generic-cape.c

diff --git a/drivers/capebus/capes/Kconfig b/drivers/capebus/capes/Kconfig
new file mode 100644
index 0000000..bfe54a6
--- /dev/null
+++ b/drivers/capebus/capes/Kconfig
@@ -0,0 +1,6 @@
+config CAPEBUS_BONE_GENERIC
+	tristate "Beaglebone Generic cape driver"
+	depends on CAPEBUS_BONE_CONTROLLER
+	default n
+	help
+	  "Select this to enable a generic cape driver; LCD/DVI capes etc"
diff --git a/drivers/capebus/capes/Makefile b/drivers/capebus/capes/Makefile
new file mode 100644
index 0000000..83da381
--- /dev/null
+++ b/drivers/capebus/capes/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_CAPEBUS_BONE_GENERIC)	+= bone-generic-cape.o
diff --git a/drivers/capebus/capes/bone-generic-cape.c b/drivers/capebus/capes/bone-generic-cape.c
new file mode 100644
index 0000000..70be50a
--- /dev/null
+++ b/drivers/capebus/capes/bone-generic-cape.c
@@ -0,0 +1,96 @@
+/*
+ * Generic cape support
+ *
+ * Copyright (C) 2012 Pantelis Antoniou <panto@antoniou-consulting.com>
+ * Copyright (C) 2012 Texas Instruments Inc.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/timer.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/bitops.h>
+#include <linux/err.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
+#include <linux/pinctrl/pinctrl.h>
+#include <linux/pinctrl/pinmux.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/atomic.h>
+#include <linux/clk.h>
+#include <asm/barrier.h>
+#include <plat/clock.h>
+#include <plat/omap_device.h>
+#include <linux/clkdev.h>
+#include <linux/input/ti_am335x_tsc.h>
+#include <linux/platform_data/ti_am335x_adc.h>
+#include <linux/mfd/ti_am335x_tscadc.h>
+
+#include <linux/capebus/capebus-bone.h>
+
+/* fwd decl. */
+extern struct cape_driver bonegeneric_driver;
+
+static const struct of_device_id bonegeneric_of_match[] = {
+	{
+		.compatible = "bone-generic-cape",
+	},	{ },
+};
+MODULE_DEVICE_TABLE(of, bonegeneric_of_match);
+
+static int bonegeneric_probe(struct cape_dev *dev,
+		const struct cape_device_id *id)
+{
+	struct bone_capebus_generic_info *ginfo;
+	int err;
+
+	err = bone_capebus_probe_prolog(dev, id);
+	if (err != 0)
+		return err;
+
+	ginfo = bone_capebus_probe_generic(dev, id);
+	if (IS_ERR_OR_NULL(ginfo))
+		return IS_ERR(ginfo) ? PTR_ERR(ginfo) : -ENODEV;
+	dev->drv_priv = ginfo;
+	return 0;
+}
+
+static void bonegeneric_remove(struct cape_dev *dev)
+{
+	bone_capebus_remove_generic(dev->drv_priv);
+}
+
+struct cape_driver bonegeneric_driver = {
+	.driver = {
+		.name		= "bonegeneric",
+		.owner		= THIS_MODULE,
+		.of_match_table	= bonegeneric_of_match,
+	},
+	.probe		= bonegeneric_probe,
+	.remove		= bonegeneric_remove,
+};
+
+module_capebus_driver(bonegeneric_driver);
+
+MODULE_AUTHOR("Pantelis Antoniou");
+MODULE_DESCRIPTION("Beaglebone generic cape");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:bone-generic-cape");
-- 
1.7.12

  parent reply	other threads:[~2012-10-30 19:02 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 16:52 [RFC 0/7] Capebus; a bus for SoCs using simple expansion connectors Pantelis Antoniou
2012-10-31 16:52 ` Pantelis Antoniou
2012-10-31 16:52 ` [RFC 1/7] capebus: Core capebus support Pantelis Antoniou
2012-10-31 16:52   ` Pantelis Antoniou
2012-10-31 21:55   ` Russ Dill
2012-10-31 21:55     ` Russ Dill
2012-10-31 22:07     ` Pantelis Antoniou
2012-10-31 22:07       ` Pantelis Antoniou
2012-11-01  0:55       ` Russ Dill
2012-11-01  0:55         ` Russ Dill
2012-10-31 16:52 ` [RFC 2/7] capebus: Add beaglebone board support Pantelis Antoniou
2012-10-31 16:52   ` Pantelis Antoniou
2012-10-30 19:36   ` Tony Lindgren
2012-10-30 19:36     ` Tony Lindgren
2012-10-30 19:39   ` Tony Lindgren
2012-10-30 19:39     ` Tony Lindgren
2012-10-30 20:16     ` Pantelis Antoniou
2012-10-30 20:16       ` Pantelis Antoniou
2012-10-30 23:57       ` Tony Lindgren
2012-10-30 23:57         ` Tony Lindgren
2012-10-31 16:52 ` Pantelis Antoniou [this message]
2012-10-31 16:52   ` [RFC 3/7] capebus: Beaglebone generic cape support Pantelis Antoniou
2012-10-31 16:52 ` [RFC 4/7] capebus: Beaglebone geiger " Pantelis Antoniou
2012-10-31 16:52   ` Pantelis Antoniou
2012-10-31 16:52 ` [RFC 5/7] capebus: Beaglebone capebus DT update Pantelis Antoniou
2012-10-31 16:52   ` Pantelis Antoniou
2012-10-31 16:52 ` [RFC 6/7] capebus: Document DT bindings Pantelis Antoniou
2012-10-31 16:52   ` Pantelis Antoniou
2012-10-31 16:52 ` [RFC 7/7] capebus: Documentation; capebus-summary Pantelis Antoniou
2012-10-31 16:52   ` Pantelis Antoniou
2012-10-31 21:56 ` [RFC 0/7] Capebus; a bus for SoCs using simple expansion connectors Russ Dill
2012-10-31 21:56   ` Russ Dill
2012-10-31 22:03   ` Pantelis Antoniou
2012-10-31 22:03     ` Pantelis Antoniou

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=1351702333-8456-4-git-send-email-panto@antoniou-consulting.com \
    --to=panto@antoniou-consulting.com \
    --cc=Russ.Dill@ti.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=koen@dominion.thruhere.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mporter@ti.com \
    --cc=tony@atomide.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.