2014-02-14 13:21:27

by Marek Belisko

[permalink] [raw]
Subject: [PATCH] hwmon: twl4030-madc-hwmon: Add device tree support.

Signed-off-by: Marek Belisko <[email protected]>
---
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";
+};
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),
},
};

--
1.8.3.2


2014-02-14 13:31:07

by Mark Rutland

[permalink] [raw]
Subject: Re: [PATCH] hwmon: twl4030-madc-hwmon: Add device tree support.

On Fri, Feb 14, 2014 at 01:20:58PM +0000, Marek Belisko wrote:
> Signed-off-by: Marek Belisko <[email protected]>
> ---
> 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.

2014-02-14 14:08:29

by Belisko Marek

[permalink] [raw]
Subject: Re: [PATCH] hwmon: twl4030-madc-hwmon: Add device tree support.

On Fri, Feb 14, 2014 at 2:31 PM, Mark Rutland <[email protected]> wrote:
> On Fri, Feb 14, 2014 at 01:20:58PM +0000, Marek Belisko wrote:
>> Signed-off-by: Marek Belisko <[email protected]>
>> ---
>> 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

--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com

2014-02-16 16:39:59

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] hwmon: twl4030-madc-hwmon: Add device tree support.

On 02/14/2014 06:08 AM, Belisko Marek wrote:
> On Fri, Feb 14, 2014 at 2:31 PM, Mark Rutland <[email protected]> wrote:
>> On Fri, Feb 14, 2014 at 01:20:58PM +0000, Marek Belisko wrote:
>>> Signed-off-by: Marek Belisko <[email protected]>
>>> ---
>>> 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

2014-02-16 17:44:40

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH] hwmon: twl4030-madc-hwmon: Add device tree support.

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 <[email protected]> wrote:
> >>On Fri, Feb 14, 2014 at 01:20:58PM +0000, Marek Belisko wrote:
> >>>Signed-off-by: Marek Belisko <[email protected]>
> >>>---
> >>> 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


Attachments:
(No filename) (1.84 kB)
signature.asc (819.00 B)
Digital signature
Download all attachments