diff mbox

hwmon: twl4030-madc-hwmon: Add device tree support.

Message ID 1392384058-14240-1-git-send-email-marek@goldelico.com
State Superseded, archived
Headers show

Commit Message

Marek Belisko Feb. 14, 2014, 1:20 p.m. UTC
Signed-off-by: Marek Belisko <marek@goldelico.com>
---
 Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt |  9 +++++++++
 drivers/hwmon/twl4030-madc-hwmon.c                             | 10 ++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt

Comments

Mark Rutland Feb. 14, 2014, 1:31 p.m. UTC | #1
On Fri, Feb 14, 2014 at 01:20:58PM +0000, Marek Belisko wrote:
> Signed-off-by: Marek Belisko <marek@goldelico.com>
> ---
>  Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt |  9 +++++++++
>  drivers/hwmon/twl4030-madc-hwmon.c                             | 10 ++++++++++
>  2 files changed, 19 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt b/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
> new file mode 100644
> index 0000000..e8016d1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
> @@ -0,0 +1,9 @@
> +TWL4030 MADC hwmon.
> +
> +Required properties:
> +- compatible: "ti,twl4030-madc-hwmon"
> +
> +Example:
> +madc-hwmon {
> +	compatible = "ti,twl4030-madc-hwmon";
> +};

Huh?

What is this a binding for? From a look at the driver in mainline this
just calls into functions from the twl4030 madc driver (which doesn't
seem to have a binding).

This doesn't look like a description of hardware, but rather a hack to
get a Linux driver to probe. As far as I can see, no useful information
is given by this binding.

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Belisko Marek Feb. 14, 2014, 2:08 p.m. UTC | #2
On Fri, Feb 14, 2014 at 2:31 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> On Fri, Feb 14, 2014 at 01:20:58PM +0000, Marek Belisko wrote:
>> Signed-off-by: Marek Belisko <marek@goldelico.com>
>> ---
>>  Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt |  9 +++++++++
>>  drivers/hwmon/twl4030-madc-hwmon.c                             | 10 ++++++++++
>>  2 files changed, 19 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
>>
>> diff --git a/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt b/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
>> new file mode 100644
>> index 0000000..e8016d1
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
>> @@ -0,0 +1,9 @@
>> +TWL4030 MADC hwmon.
>> +
>> +Required properties:
>> +- compatible: "ti,twl4030-madc-hwmon"
>> +
>> +Example:
>> +madc-hwmon {
>> +     compatible = "ti,twl4030-madc-hwmon";
>> +};
>
> Huh?
>
> What is this a binding for? From a look at the driver in mainline this
> just calls into functions from the twl4030 madc driver (which doesn't
> seem to have a binding).
I post bindings for twl4030-madc [1]. Without probing this driver
other things will not work (twl4030-madc-battery e.g.).
Is there better way to handle this situation?
>
> This doesn't look like a description of hardware, but rather a hack to
> get a Linux driver to probe. As far as I can see, no useful information
> is given by this binding.
>
> Thanks,
> Mark.

BR,

marek
Guenter Roeck Feb. 16, 2014, 4:39 p.m. UTC | #3
On 02/14/2014 06:08 AM, Belisko Marek wrote:
> On Fri, Feb 14, 2014 at 2:31 PM, Mark Rutland <mark.rutland@arm.com> wrote:
>> On Fri, Feb 14, 2014 at 01:20:58PM +0000, Marek Belisko wrote:
>>> Signed-off-by: Marek Belisko <marek@goldelico.com>
>>> ---
>>>   Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt |  9 +++++++++
>>>   drivers/hwmon/twl4030-madc-hwmon.c                             | 10 ++++++++++
>>>   2 files changed, 19 insertions(+)
>>>   create mode 100644 Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt b/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
>>> new file mode 100644
>>> index 0000000..e8016d1
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
>>> @@ -0,0 +1,9 @@
>>> +TWL4030 MADC hwmon.
>>> +
>>> +Required properties:
>>> +- compatible: "ti,twl4030-madc-hwmon"
>>> +
>>> +Example:
>>> +madc-hwmon {
>>> +     compatible = "ti,twl4030-madc-hwmon";
>>> +};
>>
>> Huh?
>>
>> What is this a binding for? From a look at the driver in mainline this
>> just calls into functions from the twl4030 madc driver (which doesn't
>> seem to have a binding).
> I post bindings for twl4030-madc [1]. Without probing this driver
> other things will not work (twl4030-madc-battery e.g.).
> Is there better way to handle this situation?

Since you are converting twl4030-madc to be an iio driver,
can't you simply use the iio_hwmon bridge and declare this driver
obsolete ?

Guenter

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sebastian Reichel Feb. 16, 2014, 5:44 p.m. UTC | #4
On Sun, Feb 16, 2014 at 08:39:54AM -0800, Guenter Roeck wrote:
> On 02/14/2014 06:08 AM, Belisko Marek wrote:
> >On Fri, Feb 14, 2014 at 2:31 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> >>On Fri, Feb 14, 2014 at 01:20:58PM +0000, Marek Belisko wrote:
> >>>Signed-off-by: Marek Belisko <marek@goldelico.com>
> >>>---
> >>>  Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt |  9 +++++++++
> >>>  drivers/hwmon/twl4030-madc-hwmon.c                             | 10 ++++++++++
> >>>  2 files changed, 19 insertions(+)
> >>>  create mode 100644 Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
> >>>
> >>>diff --git a/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt b/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
> >>>new file mode 100644
> >>>index 0000000..e8016d1
> >>>--- /dev/null
> >>>+++ b/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
> >>>@@ -0,0 +1,9 @@
> >>>+TWL4030 MADC hwmon.
> >>>+
> >>>+Required properties:
> >>>+- compatible: "ti,twl4030-madc-hwmon"
> >>>+
> >>>+Example:
> >>>+madc-hwmon {
> >>>+     compatible = "ti,twl4030-madc-hwmon";
> >>>+};
> >>
> >>Huh?
> >>
> >>What is this a binding for? From a look at the driver in mainline this
> >>just calls into functions from the twl4030 madc driver (which doesn't
> >>seem to have a binding).
> >I post bindings for twl4030-madc [1]. Without probing this driver
> >other things will not work (twl4030-madc-battery e.g.).
> >Is there better way to handle this situation?
> 
> Since you are converting twl4030-madc to be an iio driver,
> can't you simply use the iio_hwmon bridge and declare this driver
> obsolete ?

He didn't convert the driver, I did. That's why he included this
change.

I was thinking of using the iio_hwmon bridge and deprecating the
madc-hwmon driver. I have not tested this, though (lack of time).

-- Sebastian
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt b/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
new file mode 100644
index 0000000..e8016d1
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/twl4030-madc-hwmon.txt
@@ -0,0 +1,9 @@ 
+TWL4030 MADC hwmon.
+
+Required properties:
+- compatible: "ti,twl4030-madc-hwmon"
+
+Example:
+madc-hwmon {
+	compatible = "ti,twl4030-madc-hwmon";
+};
diff --git a/drivers/hwmon/twl4030-madc-hwmon.c b/drivers/hwmon/twl4030-madc-hwmon.c
index 6c6d440..05fb572 100644
--- a/drivers/hwmon/twl4030-madc-hwmon.c
+++ b/drivers/hwmon/twl4030-madc-hwmon.c
@@ -96,6 +96,15 @@  static const struct attribute_group twl4030_madc_group = {
 	.attrs = twl4030_madc_attributes,
 };
 
+#ifdef CONFIG_OF
+
+static const struct of_device_id of_twl4030_madc_hwmon_match[] = {
+	{ .compatible = "ti,twl4030-madc-hwmon", },
+	{},
+};
+
+#endif
+
 static int twl4030_madc_hwmon_probe(struct platform_device *pdev)
 {
 	int ret;
@@ -134,6 +143,7 @@  static struct platform_driver twl4030_madc_hwmon_driver = {
 	.driver = {
 		   .name = "twl4030_madc_hwmon",
 		   .owner = THIS_MODULE,
+		   .of_match_table = of_match_ptr(of_twl4030_madc_hwmon_match),
 		   },
 };