2016-01-25 09:05:53

by Heikki Krogerus

[permalink] [raw]
Subject: [PATCHv2 0/4] net: rfkill: gpio: replace platform data with build-in property

Hi,

The changes to the unified properties interface that I have been
waiting for are finally available in v4.5-rc1.


Heikki Krogerus (4):
net: rfkill: add rfkill_find_type function
net: rfkill: gpio: get the name and type from device property
ARM: tegra: use build-in device properties with rfkill_gpio
net: rfkill: gpio: remove rfkill_gpio_platform_data

arch/arm/mach-tegra/board-paz00.c | 17 +++++++-----
include/linux/rfkill-gpio.h | 37 -------------------------
include/linux/rfkill.h | 15 +++++++++++
net/rfkill/Kconfig | 3 +--
net/rfkill/core.c | 57 ++++++++++++++++++++-------------------
net/rfkill/rfkill-gpio.c | 24 ++++++++---------
6 files changed, 66 insertions(+), 87 deletions(-)
delete mode 100644 include/linux/rfkill-gpio.h

--
2.7.0.rc3



2016-01-26 08:52:33

by Marc Dietrich

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device propertieswithrfkill_gpio

Am Dienstag, 26. Januar 2016, 09:46:56 CET schrieb Johannes Berg:
> On Mon, 2016-01-25 at 21:59 +0100, Marc Dietrich wrote:
> >
> >
> > seems to work fine. I wish we could instantiate this from device-tree
> > so we can finially get rid of this file.
>
> That'd be nice - anyone want to propose rfkill DT bindings? :)

There have been at least 5 attempts to do this in the past - all fail. You've
been warned :-)

Marc


Attachments:
signature.asc (473.00 B)
This is a digitally signed message part.

2016-01-26 08:46:59

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties withrfkill_gpio

On Mon, 2016-01-25 at 21:59 +0100, Marc Dietrich wrote:

> seems to work fine. I wish we could instantiate this from device-tree
> so we can finially get rid of this file.

That'd be nice - anyone want to propose rfkill DT bindings? :)

johannes

2016-01-25 12:18:45

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio

On Mon, Jan 25, 2016 at 12:03:48PM +0300, Heikki Krogerus wrote:
> Pass the rfkill name and type to the device with properties
> instead of driver specific platform data.
>
> Signed-off-by: Heikki Krogerus <[email protected]>
> CC: Alexandre Courbot <[email protected]>
> CC: Thierry Reding <[email protected]>
> CC: Stephen Warren <[email protected]>
> ---
> arch/arm/mach-tegra/board-paz00.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)

Looks fine to me. We might want to wait for Marc (Cc'ed) to give this a
spin, since I don't have the hardware. For reference, the series can be
found here:

http://patchwork.ozlabs.org/patch/572640/
http://patchwork.ozlabs.org/patch/572644/
http://patchwork.ozlabs.org/patch/572643/
http://patchwork.ozlabs.org/patch/572642/

Johannes, I assume that you'll want to take this through your tree
because of the dependency? In that case:

Acked-by: Thierry Reding <[email protected]>


Attachments:
(No filename) (981.00 B)
signature.asc (819.00 B)
Download all attachments

2016-01-25 09:06:00

by Heikki Krogerus

[permalink] [raw]
Subject: [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio

Pass the rfkill name and type to the device with properties
instead of driver specific platform data.

Signed-off-by: Heikki Krogerus <[email protected]>
CC: Alexandre Courbot <[email protected]>
CC: Thierry Reding <[email protected]>
CC: Stephen Warren <[email protected]>
---
arch/arm/mach-tegra/board-paz00.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 49d1110..52db8bf 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -17,23 +17,25 @@
*
*/

+#include <linux/property.h>
#include <linux/gpio/machine.h>
#include <linux/platform_device.h>
-#include <linux/rfkill-gpio.h>

#include "board.h"

-static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = {
- .name = "wifi_rfkill",
- .type = RFKILL_TYPE_WLAN,
+static struct property_entry __initdata wifi_rfkill_prop[] = {
+ PROPERTY_ENTRY_STRING("name", "wifi_rfkill"),
+ PROPERTY_ENTRY_STRING("type", "wlan"),
+ { },
+};
+
+static struct property_set __initdata wifi_rfkill_pset = {
+ .properties = wifi_rfkill_prop,
};

static struct platform_device wifi_rfkill_device = {
.name = "rfkill_gpio",
.id = -1,
- .dev = {
- .platform_data = &wifi_rfkill_platform_data,
- },
};

static struct gpiod_lookup_table wifi_gpio_lookup = {
@@ -47,6 +49,7 @@ static struct gpiod_lookup_table wifi_gpio_lookup = {

void __init tegra_paz00_wifikill_init(void)
{
+ platform_device_add_properties(&wifi_rfkill_device, &wifi_rfkill_pset);
gpiod_add_lookup_table(&wifi_gpio_lookup);
platform_device_register(&wifi_rfkill_device);
}
--
2.7.0.rc3


2016-01-25 21:01:50

by Marc Dietrich

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties withrfkill_gpio

Am Montag 25 Januar 2016, 13:18:40 schrieb Thierry Reding:
> On Mon, Jan 25, 2016 at 12:03:48PM +0300, Heikki Krogerus wrote:
> > Pass the rfkill name and type to the device with properties
> > instead of driver specific platform data.
> >
> > Signed-off-by: Heikki Krogerus <[email protected]>
> > CC: Alexandre Courbot <[email protected]>
> > CC: Thierry Reding <[email protected]>
> > CC: Stephen Warren <[email protected]>
> > ---
> >
> > arch/arm/mach-tegra/board-paz00.c | 17 ++++++++++-------
> > 1 file changed, 10 insertions(+), 7 deletions(-)
>
> Looks fine to me. We might want to wait for Marc (Cc'ed) to give this a
> spin, since I don't have the hardware. For reference, the series can be
> found here:
>
> http://patchwork.ozlabs.org/patch/572640/
> http://patchwork.ozlabs.org/patch/572644/
> http://patchwork.ozlabs.org/patch/572643/
> http://patchwork.ozlabs.org/patch/572642/
>
> Johannes, I assume that you'll want to take this through your tree
> because of the dependency? In that case:
>
> Acked-by: Thierry Reding <[email protected]>

seems to work fine. I wish we could instantiate this from device-tree so we
can finially get rid of this file.

Tested-by: Marc Dietrich <[email protected]>


Attachments:
signature.asc (490.00 B)
This is a digitally signed message part.

2016-01-25 09:05:55

by Heikki Krogerus

[permalink] [raw]
Subject: [PATCHv2 1/4] net: rfkill: add rfkill_find_type function

Helper for finding the type based on name. Useful if the
type needs to be determined based on device property.

Signed-off-by: Heikki Krogerus <[email protected]>
---
include/linux/rfkill.h | 15 +++++++++++++
net/rfkill/core.c | 57 +++++++++++++++++++++++++-------------------------
2 files changed, 44 insertions(+), 28 deletions(-)

diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index d901078..522ccbc 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -212,6 +212,15 @@ void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw);
* @rfkill: rfkill struct to query
*/
bool rfkill_blocked(struct rfkill *rfkill);
+
+/**
+ * rfkill_find_type - Helpper for finding rfkill type by name
+ * @name: the name of the type
+ *
+ * Returns enum rfkill_type that conrresponds the name.
+ */
+enum rfkill_type rfkill_find_type(const char *name);
+
#else /* !RFKILL */
static inline struct rfkill * __must_check
rfkill_alloc(const char *name,
@@ -268,6 +277,12 @@ static inline bool rfkill_blocked(struct rfkill *rfkill)
{
return false;
}
+
+static inline enum rfkill_type rfkill_find_type(const char *name)
+{
+ return RFKILL_TYPE_ALL;
+}
+
#endif /* RFKILL || RFKILL_MODULE */


diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index f53bf3b6..e9a5cdf 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -582,6 +582,33 @@ void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw)
}
EXPORT_SYMBOL(rfkill_set_states);

+static const char *rfkill_types[NUM_RFKILL_TYPES] = {
+ [RFKILL_TYPE_WLAN] = "wlan",
+ [RFKILL_TYPE_BLUETOOTH] = "bluetooth",
+ [RFKILL_TYPE_UWB] = "ultrawideband",
+ [RFKILL_TYPE_WIMAX] = "wimax",
+ [RFKILL_TYPE_WWAN] = "wwan",
+ [RFKILL_TYPE_GPS] = "gps",
+ [RFKILL_TYPE_FM] = "fm",
+ [RFKILL_TYPE_NFC] = "nfc",
+};
+
+enum rfkill_type rfkill_find_type(const char *name)
+{
+ int i;
+
+ BUILD_BUG_ON(!rfkill_types[NUM_RFKILL_TYPES - 1]);
+
+ if (!name)
+ return RFKILL_TYPE_ALL;
+
+ for (i = 1; i < NUM_RFKILL_TYPES; i++)
+ if (!strcmp(name, rfkill_types[i]))
+ return i;
+ return RFKILL_TYPE_ALL;
+}
+EXPORT_SYMBOL(rfkill_find_type);
+
static ssize_t name_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
@@ -591,38 +618,12 @@ static ssize_t name_show(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR_RO(name);

-static const char *rfkill_get_type_str(enum rfkill_type type)
-{
- BUILD_BUG_ON(NUM_RFKILL_TYPES != RFKILL_TYPE_NFC + 1);
-
- switch (type) {
- case RFKILL_TYPE_WLAN:
- return "wlan";
- case RFKILL_TYPE_BLUETOOTH:
- return "bluetooth";
- case RFKILL_TYPE_UWB:
- return "ultrawideband";
- case RFKILL_TYPE_WIMAX:
- return "wimax";
- case RFKILL_TYPE_WWAN:
- return "wwan";
- case RFKILL_TYPE_GPS:
- return "gps";
- case RFKILL_TYPE_FM:
- return "fm";
- case RFKILL_TYPE_NFC:
- return "nfc";
- default:
- BUG();
- }
-}
-
static ssize_t type_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct rfkill *rfkill = to_rfkill(dev);

- return sprintf(buf, "%s\n", rfkill_get_type_str(rfkill->type));
+ return sprintf(buf, "%s\n", rfkill_types[rfkill->type]);
}
static DEVICE_ATTR_RO(type);

@@ -768,7 +769,7 @@ static int rfkill_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
if (error)
return error;
error = add_uevent_var(env, "RFKILL_TYPE=%s",
- rfkill_get_type_str(rfkill->type));
+ rfkill_types[rfkill->type]);
if (error)
return error;
spin_lock_irqsave(&rfkill->lock, flags);
--
2.7.0.rc3


2016-01-25 09:05:58

by Heikki Krogerus

[permalink] [raw]
Subject: [PATCHv2 2/4] net: rfkill: gpio: get the name and type from device property

This prepares the driver for removal of platform data.

Signed-off-by: Heikki Krogerus <[email protected]>
---
net/rfkill/rfkill-gpio.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index 4b1e3f3..1a9c031 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -81,7 +81,6 @@ static int rfkill_gpio_acpi_probe(struct device *dev,
if (!id)
return -ENODEV;

- rfkill->name = dev_name(dev);
rfkill->type = (unsigned)id->driver_data;

return acpi_dev_add_driver_gpios(ACPI_COMPANION(dev),
@@ -93,12 +92,21 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;
struct rfkill_gpio_data *rfkill;
struct gpio_desc *gpio;
+ const char *type_name;
int ret;

rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL);
if (!rfkill)
return -ENOMEM;

+ device_property_read_string(&pdev->dev, "name", &rfkill->name);
+ device_property_read_string(&pdev->dev, "type", &type_name);
+
+ if (!rfkill->name)
+ rfkill->name = dev_name(&pdev->dev);
+
+ rfkill->type = rfkill_find_type(type_name);
+
if (ACPI_HANDLE(&pdev->dev)) {
ret = rfkill_gpio_acpi_probe(&pdev->dev, rfkill);
if (ret)
@@ -124,10 +132,8 @@ static int rfkill_gpio_probe(struct platform_device *pdev)

rfkill->shutdown_gpio = gpio;

- /* Make sure at-least one of the GPIO is defined and that
- * a name is specified for this instance
- */
- if ((!rfkill->reset_gpio && !rfkill->shutdown_gpio) || !rfkill->name) {
+ /* Make sure at-least one GPIO is defined for this instance */
+ if (!rfkill->reset_gpio && !rfkill->shutdown_gpio) {
dev_err(&pdev->dev, "invalid platform data\n");
return -EINVAL;
}
--
2.7.0.rc3


2016-01-26 08:42:08

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio

On Mon, 2016-01-25 at 13:18 +0100, Thierry Reding wrote:

> Johannes, I assume that you'll want to take this through your tree
> because of the dependency? In that case:
>
> Acked-by: Thierry Reding <[email protected]>

I can, but I don't really care - perhaps you'd rather take the entire
series through your tree to get it into one place for Marc?

In which case, you have my

Acked-by: Johannes Berg <[email protected]>

for the other 3 patches.

Let me know which you prefer.

johannes

2016-01-25 09:06:02

by Heikki Krogerus

[permalink] [raw]
Subject: [PATCHv2 4/4] net: rfkill: gpio: remove rfkill_gpio_platform_data

No more users for it.

Signed-off-by: Heikki Krogerus <[email protected]>
---
include/linux/rfkill-gpio.h | 37 -------------------------------------
net/rfkill/Kconfig | 3 +--
net/rfkill/rfkill-gpio.c | 8 --------
3 files changed, 1 insertion(+), 47 deletions(-)
delete mode 100644 include/linux/rfkill-gpio.h

diff --git a/include/linux/rfkill-gpio.h b/include/linux/rfkill-gpio.h
deleted file mode 100644
index 20bcb55..0000000
--- a/include/linux/rfkill-gpio.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2011, NVIDIA Corporation.
- *
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-
-#ifndef __RFKILL_GPIO_H
-#define __RFKILL_GPIO_H
-
-#include <linux/types.h>
-#include <linux/rfkill.h>
-
-/**
- * struct rfkill_gpio_platform_data - platform data for rfkill gpio device.
- * for unused gpio's, the expected value is -1.
- * @name: name for the gpio rf kill instance
- */
-
-struct rfkill_gpio_platform_data {
- char *name;
- enum rfkill_type type;
-};
-
-#endif /* __RFKILL_GPIO_H */
diff --git a/net/rfkill/Kconfig b/net/rfkill/Kconfig
index 598d374..868f1ad 100644
--- a/net/rfkill/Kconfig
+++ b/net/rfkill/Kconfig
@@ -41,5 +41,4 @@ config RFKILL_GPIO
default n
help
If you say yes here you get support of a generic gpio RFKILL
- driver. The platform should fill in the appropriate fields in the
- rfkill_gpio_platform_data structure and pass that to the driver.
+ driver.
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index 1a9c031..76c01cb 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -27,8 +27,6 @@
#include <linux/acpi.h>
#include <linux/gpio/consumer.h>

-#include <linux/rfkill-gpio.h>
-
struct rfkill_gpio_data {
const char *name;
enum rfkill_type type;
@@ -89,7 +87,6 @@ static int rfkill_gpio_acpi_probe(struct device *dev,

static int rfkill_gpio_probe(struct platform_device *pdev)
{
- struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;
struct rfkill_gpio_data *rfkill;
struct gpio_desc *gpio;
const char *type_name;
@@ -111,11 +108,6 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
ret = rfkill_gpio_acpi_probe(&pdev->dev, rfkill);
if (ret)
return ret;
- } else if (pdata) {
- rfkill->name = pdata->name;
- rfkill->type = pdata->type;
- } else {
- return -ENODEV;
}

rfkill->clk = devm_clk_get(&pdev->dev, NULL);
--
2.7.0.rc3


2016-02-23 10:39:10

by Marc Dietrich

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio

Am Dienstag, 23. Februar 2016, 11:31:40 CET schrieb Arnd Bergmann:
> On Tuesday 23 February 2016 11:15:31 Arnd Bergmann wrote:
> > On Thursday 18 February 2016 21:04:49 Johannes Berg wrote:
> > > On Tue, 2016-01-26 at 09:42 +0100, Johannes Berg wrote:
> > Just for my curiosity: what is the difference between a rfkill-gpio
> > device and a gpio-keys device with a KEY_RFKILL code?
> >
> > arch/arm/boot/dts/bcm4708-netgear-r6250.dts and others seem to
> > do the second approach in DT so they don't need to create the
> > platform device.
>
> I found the answer now (after discussing on IRC): just
> for reference: KEY_RFKILL is for sending the event to the kernel
> when a user presses the gpio butting, this rfkill-gpio turns
> the devices on or off when after an RFKILL event is received.

yes, paz00 has no hw key. rfkill is triggered via software (rfkill) only. The
problem in the past was how to describe such a device in the device tree.

Strictly speaking, there is no rfkill device hardware (just an interface). The
only hardware that exists is in our case is connected to a hard wired usb bus
(wifi dongle), which makes it complicated to attach a DT property or subdevice
to it. And a standalone device-tree entry for a non hardware device was
rejected in the past.

Marc


Attachments:
signature.asc (473.00 B)
This is a digitally signed message part.

2016-02-19 18:03:57

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio

On Thu, Feb 18, 2016 at 09:04:49PM +0100, Johannes Berg wrote:
> On Tue, 2016-01-26 at 09:42 +0100, Johannes Berg wrote:
> > On Mon, 2016-01-25 at 13:18 +0100, Thierry Reding wrote:
> > >  
> > > Johannes, I assume that you'll want to take this through your tree
> > > because of the dependency? In that case:
> > >
> > > Acked-by: Thierry Reding <[email protected]>
> >
> > I can, but I don't really care - perhaps you'd rather take the entire
> > series through your tree to get it into one place for Marc?
> >
> > In which case, you have my
> >
> > Acked-by: Johannes Berg <[email protected]>
> >
> > for the other 3 patches.
> >
> > Let me know which you prefer.
> >
> Did these patches get applied anywhere? Otherwise I'm willing to pick
> them up.

Might be easier for everyone if you took this one patch. My earlier
Acked-by still stands:

Acked-by: Thierry Reding <[email protected]>


Attachments:
(No filename) (910.00 B)
signature.asc (819.00 B)
Download all attachments

2016-02-23 20:39:09

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio

On Tue, 2016-02-23 at 16:06 +0100, Arnd Bergmann wrote:

> Does rfkill always have a separate device in the Linux driver model?

Yes, the rfkill core code registers and adds one in the rfkill class.

> johannes

2016-02-23 10:31:52

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio

On Tuesday 23 February 2016 11:15:31 Arnd Bergmann wrote:
> On Thursday 18 February 2016 21:04:49 Johannes Berg wrote:
> > On Tue, 2016-01-26 at 09:42 +0100, Johannes Berg wrote:

> Just for my curiosity: what is the difference between a rfkill-gpio
> device and a gpio-keys device with a KEY_RFKILL code?
>
> arch/arm/boot/dts/bcm4708-netgear-r6250.dts and others seem to
> do the second approach in DT so they don't need to create the
> platform device.

I found the answer now (after discussing on IRC): just
for reference: KEY_RFKILL is for sending the event to the kernel
when a user presses the gpio butting, this rfkill-gpio turns
the devices on or off when after an RFKILL event is received.

Arnd

2016-02-23 13:43:06

by Marc Dietrich

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio

Am Dienstag, 23. Februar 2016, 14:17:17 CET schrieb Arnd Bergmann:
> On Tuesday 23 February 2016 11:38:52 Marc Dietrich wrote:
> > Am Dienstag, 23. Februar 2016, 11:31:40 CET schrieb Arnd Bergmann:
> > > On Tuesday 23 February 2016 11:15:31 Arnd Bergmann wrote:
> > > > On Thursday 18 February 2016 21:04:49 Johannes Berg wrote:
> > > > > On Tue, 2016-01-26 at 09:42 +0100, Johannes Berg wrote:
> > > > Just for my curiosity: what is the difference between a rfkill-gpio
> > > > device and a gpio-keys device with a KEY_RFKILL code?
> > > >
> > > > arch/arm/boot/dts/bcm4708-netgear-r6250.dts and others seem to
> > > > do the second approach in DT so they don't need to create the
> > > > platform device.
> > >
> > > I found the answer now (after discussing on IRC): just
> > > for reference: KEY_RFKILL is for sending the event to the kernel
> > > when a user presses the gpio butting, this rfkill-gpio turns
> > > the devices on or off when after an RFKILL event is received.
> >
> > yes, paz00 has no hw key. rfkill is triggered via software (rfkill) only.
> > The problem in the past was how to describe such a device in the device
> > tree.
> >
> > Strictly speaking, there is no rfkill device hardware (just an interface).
> > The only hardware that exists is in our case is connected to a hard wired
> > usb bus (wifi dongle), which makes it complicated to attach a DT property
> > or subdevice to it. And a standalone device-tree entry for a non hardware
> > device was rejected in the past.
>
> Ah, so the problem of attaching DT properties to a USB device has recently
> been solved, see subject "USB: core: let USB device know device node".
>
> Would that work for you? With this, the USB driver can simply look at
> the optional DT properties of the USB function to implement its rfkill
> callbacks.

oh, that looks indeed interesting. The question is now if rfkill is a property
of a device or a subdevice itself. The latter one would only require addition
of device-tree instantiation of rfkill, while with the former one, the (or
all) usb driver(s) need to be modified to accept device tree properties,
especially gpios. The driver would then be responsible to add an rfkill
"device".

IMHO (and unfortunately), it's just a property (a way to specify the relevant
gpios), making the solution again hard to archive.

Marc


Attachments:
signature.asc (473.00 B)
This is a digitally signed message part.

2016-02-23 13:17:34

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio

On Tuesday 23 February 2016 11:38:52 Marc Dietrich wrote:
> Am Dienstag, 23. Februar 2016, 11:31:40 CET schrieb Arnd Bergmann:
> > On Tuesday 23 February 2016 11:15:31 Arnd Bergmann wrote:
> > > On Thursday 18 February 2016 21:04:49 Johannes Berg wrote:
> > > > On Tue, 2016-01-26 at 09:42 +0100, Johannes Berg wrote:
> > > Just for my curiosity: what is the difference between a rfkill-gpio
> > > device and a gpio-keys device with a KEY_RFKILL code?
> > >
> > > arch/arm/boot/dts/bcm4708-netgear-r6250.dts and others seem to
> > > do the second approach in DT so they don't need to create the
> > > platform device.
> >
> > I found the answer now (after discussing on IRC): just
> > for reference: KEY_RFKILL is for sending the event to the kernel
> > when a user presses the gpio butting, this rfkill-gpio turns
> > the devices on or off when after an RFKILL event is received.
>
> yes, paz00 has no hw key. rfkill is triggered via software (rfkill) only. The
> problem in the past was how to describe such a device in the device tree.
>
> Strictly speaking, there is no rfkill device hardware (just an interface). The
> only hardware that exists is in our case is connected to a hard wired usb bus
> (wifi dongle), which makes it complicated to attach a DT property or subdevice
> to it. And a standalone device-tree entry for a non hardware device was
> rejected in the past.
>

Ah, so the problem of attaching DT properties to a USB device has recently
been solved, see subject "USB: core: let USB device know device node".

Would that work for you? With this, the USB driver can simply look at
the optional DT properties of the USB function to implement its rfkill
callbacks.

Arnd

2016-02-18 20:04:59

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio

On Tue, 2016-01-26 at 09:42 +0100, Johannes Berg wrote:
> On Mon, 2016-01-25 at 13:18 +0100, Thierry Reding wrote:
> >  
> > Johannes, I assume that you'll want to take this through your tree
> > because of the dependency? In that case:
> >
> > Acked-by: Thierry Reding <[email protected]>
>
> I can, but I don't really care - perhaps you'd rather take the entire
> series through your tree to get it into one place for Marc?
>
> In which case, you have my
>
> Acked-by: Johannes Berg <[email protected]>
>
> for the other 3 patches.
>
> Let me know which you prefer.
>
Did these patches get applied anywhere? Otherwise I'm willing to pick
them up.

johannes

2016-02-23 10:31:34

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio

On Fri, 2016-02-19 at 19:03 +0100, Thierry Reding wrote:
> On Thu, Feb 18, 2016 at 09:04:49PM +0100, Johannes Berg wrote:
> > On Tue, 2016-01-26 at 09:42 +0100, Johannes Berg wrote:
> > > On Mon, 2016-01-25 at 13:18 +0100, Thierry Reding wrote:
> > > >  
> > > > Johannes, I assume that you'll want to take this through your
> > > > tree
> > > > because of the dependency? In that case:
> > > >
> > > > Acked-by: Thierry Reding <[email protected]>
> > >
> > > I can, but I don't really care - perhaps you'd rather take the
> > > entire
> > > series through your tree to get it into one place for Marc?
> > >
> > > In which case, you have my
> > >
> > > Acked-by: Johannes Berg <[email protected]>
> > >
> > > for the other 3 patches.
> > >
> > > Let me know which you prefer.
> > >
> > Did these patches get applied anywhere? Otherwise I'm willing to
> > pick
> > them up.
>
> Might be easier for everyone if you took this one patch. My earlier
> Acked-by still stands:
>
Yep, done. I've applied all 4 patches now.

johannes

2016-02-23 15:07:17

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio

On Tuesday 23 February 2016 14:42:55 Marc Dietrich wrote:
> Am Dienstag, 23. Februar 2016, 14:17:17 CET schrieb Arnd Bergmann:
> > On Tuesday 23 February 2016 11:38:52 Marc Dietrich wrote:
> > > Am Dienstag, 23. Februar 2016, 11:31:40 CET schrieb Arnd Bergmann:
> > Ah, so the problem of attaching DT properties to a USB device has recently
> > been solved, see subject "USB: core: let USB device know device node".
> >
> > Would that work for you? With this, the USB driver can simply look at
> > the optional DT properties of the USB function to implement its rfkill
> > callbacks.
>
> oh, that looks indeed interesting. The question is now if rfkill is a property
> of a device or a subdevice itself. The latter one would only require addition
> of device-tree instantiation of rfkill, while with the former one, the (or
> all) usb driver(s) need to be modified to accept device tree properties,
> especially gpios. The driver would then be responsible to add an rfkill
> "device".
>
> IMHO (and unfortunately), it's just a property (a way to specify the relevant
> gpios), making the solution again hard to archive.

Does rfkill always have a separate device in the Linux driver model?

I would say that if we standardize on the property names, we can
have some generic helper code that does everything with one or
two function calls, similar to how we can read a mac address from
a DT node from ROM-less USB ethernet devices.

Arnd

2016-02-23 10:15:42

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCHv2 3/4] ARM: tegra: use build-in device properties with rfkill_gpio

On Thursday 18 February 2016 21:04:49 Johannes Berg wrote:
> On Tue, 2016-01-26 at 09:42 +0100, Johannes Berg wrote:
> > On Mon, 2016-01-25 at 13:18 +0100, Thierry Reding wrote:
> > >
> > > Johannes, I assume that you'll want to take this through your tree
> > > because of the dependency? In that case:
> > >
> > > Acked-by: Thierry Reding <[email protected]>
> >
> > I can, but I don't really care - perhaps you'd rather take the entire
> > series through your tree to get it into one place for Marc?
> >
> > In which case, you have my
> >
> > Acked-by: Johannes Berg <[email protected]>
> >
> > for the other 3 patches.
> >
> > Let me know which you prefer.
> >
> Did these patches get applied anywhere? Otherwise I'm willing to pick
> them up.
>

Fine with me too:

Acked-by: Arnd Bergmann <[email protected]>

Just for my curiosity: what is the difference between a rfkill-gpio
device and a gpio-keys device with a KEY_RFKILL code?

arch/arm/boot/dts/bcm4708-netgear-r6250.dts and others seem to
do the second approach in DT so they don't need to create the
platform device.

Arnd