Skip to contentSkip to conversation

dac7512: some cleanups and DT bindings

PATCH In review Daniel Mack 3 participants 9 messages Sep 22, 2013 – Sep 26, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover dac7512: some cleanups and DT bindings

Here are some trivial things for the ti_dac7512 driver.

Mark, can you take them through your spi tree?

Thanks,
Daniel

Daniel Mack (4):
drivers: misc: ti_dac7512: drop module version
drivers: misc: ti_dac7512: drop DAC7512_DRV_NAME
drivers: misc: ti_dac7512: provide a SPI ID table
drivers: misc: ti_dac7512: add support for DT matching

 .../devicetree/bindings/misc/ti,dac7512.txt        | 20 +++++++++++++++++++
 drivers/misc/ti_dac7512.c                          | 23 +++++++++++++++++-----
 2 files changed, 38 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/misc/ti,dac7512.txt
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/4 drivers: misc: ti_dac7512: drop module version

Providing a module version doesn't add any value, so drop it.

---
 drivers/misc/ti_dac7512.c | 2 --
 1 file changed, 2 deletions(-)
drivers/misc/ti_dac7512.c +0 -2
index 9b23722..db47333 100644
@@ -24,7 +24,6 @@
 #include <linux/spi/spi.h>
 
 #define DAC7512_DRV_NAME	"dac7512"
-#define DRIVER_VERSION		"1.0"
 
 static ssize_t dac7512_store_val(struct device *dev,
 				 struct device_attribute *attr,
@@ -89,4 +88,3 @@ module_spi_driver(dac7512_driver);
 MODULE_AUTHOR("Daniel Mack <[email protected]>");
 MODULE_DESCRIPTION("DAC7512 16-bit DAC");
 MODULE_LICENSE("GPL v2");
-MODULE_VERSION(DRIVER_VERSION);
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/4 drivers: misc: ti_dac7512: drop DAC7512_DRV_NAME

In reply to Daniel Mack

The driver's name can be provided directly, so drop the #define.

---
 drivers/misc/ti_dac7512.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/misc/ti_dac7512.c +1 -3
index db47333..46dfbf3 100644
@@ -23,8 +23,6 @@
 #include <linux/init.h>
 #include <linux/spi/spi.h>
 
-#define DAC7512_DRV_NAME	"dac7512"
-
 static ssize_t dac7512_store_val(struct device *dev,
 				 struct device_attribute *attr,
 				 const char *buf, size_t count)
@@ -76,7 +74,7 @@ static int dac7512_remove(struct spi_device *spi)
 
 static struct spi_driver dac7512_driver = {
 	.driver = {
-		.name	= DAC7512_DRV_NAME,
+		.name	= "dac7512",
 		.owner	= THIS_MODULE,
 	},
 	.probe	= dac7512_probe,
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/4 drivers: misc: ti_dac7512: provide a SPI ID table

In reply to Daniel Mack

This way, the module can be autoloaded by the SPI core.

---
 drivers/misc/ti_dac7512.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/misc/ti_dac7512.c +7 -0
index 46dfbf3..6393a68 100644
@@ -72,6 +72,12 @@ static int dac7512_remove(struct spi_device *spi)
 	return 0;
 }
 
+static const struct spi_device_id dac7512_id_table[] = {
+	{ "dac7512", 0 },
+	{ }
+};
+MODULE_DEVICE_TABLE(spi, dac7512_id_table);
+
 static struct spi_driver dac7512_driver = {
 	.driver = {
 		.name	= "dac7512",
@@ -79,6 +85,7 @@ static struct spi_driver dac7512_driver = {
 	},
 	.probe	= dac7512_probe,
 	.remove	= dac7512_remove,
+	.id_table = dac7512_id_table,
 };
 
 module_spi_driver(dac7512_driver);
Signature · 6 lines
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

PATCH 4/4 drivers: misc: ti_dac7512: add support for DT matching

In reply to Daniel Mack

Only matching is done via DT, no other details can be passed.

---
 .../devicetree/bindings/misc/ti,dac7512.txt          | 20 ++++++++++++++++++++
 drivers/misc/ti_dac7512.c                            | 10 ++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/ti,dac7512.txt
Documentation/devicetree/bindings/misc/ti,dac7512.txt new file +20 -0
new file mode 100644
index 0000000..1db4593
@@ -0,0 +1,20 @@
+TI DAC7512 DEVICETREE BINDINGS
+
+Required properties:
+
+	- "compatible"		Must be set to "ti,dac7512"
+
+Property rules described in Documentation/devicetree/bindings/spi/spi-bus.txt
+apply. In particular, "reg" and "spi-max-frequency" properties must be given.
+
+
+Example:
+
+	spi_master {
+		dac7512: dac7512@0 {
+			compatible = "ti,dac7512";
+			reg = <0>; /* CS0 */
+			spi-max-frequency = <1000000>;
+		};
+	};
+
drivers/misc/ti_dac7512.c +10 -0
index 6393a68..83da711 100644
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/spi/spi.h>
+#include <linux/of.h>
 
 static ssize_t dac7512_store_val(struct device *dev,
 				 struct device_attribute *attr,
@@ -78,10 +79,19 @@ static const struct spi_device_id dac7512_id_table[] = {
 };
 MODULE_DEVICE_TABLE(spi, dac7512_id_table);
 
+#ifdef CONFIG_OF
+static const struct of_device_id dac7512_of_match[] = {
+	{ .compatible = "ti,dac7512", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, dac7512_of_match);
+#endif
+
 static struct spi_driver dac7512_driver = {
 	.driver = {
 		.name	= "dac7512",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(dac7512_of_match),
 	},
 	.probe	= dac7512_probe,
 	.remove	= dac7512_remove,
Signature · 6 lines
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw
In reply to Daniel Mack
Quoted 3 lines · Daniel Mack

Here are some trivial things for the ti_dac7512 driver.

Mark, can you take them through your spi tree?

I can but it's normally Greg who looks after drivers/misc - probably best to at least run these by him.

#6 lore raw
Quoted 7 lines · Mark Brown
Quoted 3 lines · Daniel Mack

Here are some trivial things for the ti_dac7512 driver.

Mark, can you take them through your spi tree?

I can but it's normally Greg who looks after drivers/misc - probably best to at least run these by him.

Alright. Greg, I posted the series to LKML yesterday. Can you pick the patches from there or do you want me to resend?

Thanks,
Daniel

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
Quoted 11 lines · Daniel Mack
Quoted 7 lines · Mark Brown
Quoted 3 lines · Daniel Mack

Here are some trivial things for the ti_dac7512 driver.

Mark, can you take them through your spi tree?

I can but it's normally Greg who looks after drivers/misc - probably best to at least run these by him.

Alright. Greg, I posted the series to LKML yesterday. Can you pick the patches from there or do you want me to resend?

I'll pick them up from there, thanks for pointing them out to me.

greg k-h

#8 lore raw
In reply to Daniel Mack
Quoted 11 lines · Daniel Mack
Quoted 7 lines · Mark Brown
Quoted 3 lines · Daniel Mack

Here are some trivial things for the ti_dac7512 driver.

Mark, can you take them through your spi tree?

I can but it's normally Greg who looks after drivers/misc - probably best to at least run these by him.

Alright. Greg, I posted the series to LKML yesterday. Can you pick the patches from there or do you want me to resend?

I've got them and will take them through my tree, thanks.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html