All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Enhance dt support and channel creation
@ 2019-05-18 21:35 Bárbara Fernandes
  2019-05-18 21:35 ` [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array Bárbara Fernandes
  2019-05-18 21:35 ` [PATCH 2/2] staging: iio: cdc: ad7150: create macro for capacitance channels Bárbara Fernandes
  0 siblings, 2 replies; 5+ messages in thread
From: Bárbara Fernandes @ 2019-05-18 21:35 UTC (permalink / raw)
  To: linux-iio; +Cc: Bárbara Fernandes

This series of patches set a struct of_device_id with all the devices this
driver is able to manage and also add a macro to facilitate channel creation for
its two capacitance channels.

Bárbara Fernandes (2):
  staging: iio: cdc: ad7150: create of_device_id array
  staging: iio: cdc: ad7150: create macro for capacitance channels

 drivers/staging/iio/cdc/ad7150.c | 39 ++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 17 deletions(-)

-- 
2.22.0.rc0.1.g337bb99195.dirty


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array
  2019-05-18 21:35 [PATCH 0/2] Enhance dt support and channel creation Bárbara Fernandes
@ 2019-05-18 21:35 ` Bárbara Fernandes
  2019-05-20  8:53   ` Alexandru Ardelean
  2019-05-18 21:35 ` [PATCH 2/2] staging: iio: cdc: ad7150: create macro for capacitance channels Bárbara Fernandes
  1 sibling, 1 reply; 5+ messages in thread
From: Bárbara Fernandes @ 2019-05-18 21:35 UTC (permalink / raw)
  To: linux-iio; +Cc: Bárbara Fernandes, Melissa Wen, Wilson Sales

Create structure of type of_device_id in order to register all devices
the driver is able to manage.

Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Co-developed-by: Melissa Wen <melissa.srw@gmail.com>
Signed-off-by: Wilson Sales <spoonm@spoonm.org>
Co-developed-by: Wilson Sales <spoonm@spoonm.org>
---
 drivers/staging/iio/cdc/ad7150.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index 4b1c90e1b0ea..072094227e1b 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -655,11 +655,21 @@ static const struct i2c_device_id ad7150_id[] = {
 	{}
 };
 
+static const struct of_device_id ad7150_of_i2c_match[] = {
+	{ .compatible = "adi,ad7150" },
+	{ .compatible = "adi,ad7151" },
+	{ .compatible = "adi,ad7156" },
+	{}
+};
+
+MODULE_DEVICE_TABLE(of, ad7150_of_i2c_match);
+
 MODULE_DEVICE_TABLE(i2c, ad7150_id);
 
 static struct i2c_driver ad7150_driver = {
 	.driver = {
 		.name = "ad7150",
+		.of_match_table = ad7150_of_i2c_match
 	},
 	.probe = ad7150_probe,
 	.id_table = ad7150_id,
-- 
2.22.0.rc0.1.g337bb99195.dirty


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] staging: iio: cdc: ad7150: create macro for capacitance channels
  2019-05-18 21:35 [PATCH 0/2] Enhance dt support and channel creation Bárbara Fernandes
  2019-05-18 21:35 ` [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array Bárbara Fernandes
@ 2019-05-18 21:35 ` Bárbara Fernandes
  1 sibling, 0 replies; 5+ messages in thread
From: Bárbara Fernandes @ 2019-05-18 21:35 UTC (permalink / raw)
  To: linux-iio; +Cc: Bárbara Fernandes, Wilson Sales

Create macro for capacitance channels in order to remove the repeated
code and improve its readability.

Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Wilson Sales <spoonm@spoonm.org>
Co-developed-by: Wilson Sales <spoonm@spoonm.org>
---
 drivers/staging/iio/cdc/ad7150.c | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index 072094227e1b..d8c43cabce25 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -468,24 +468,19 @@ static const struct iio_event_spec ad7150_events[] = {
 	},
 };
 
+#define AD7150_CAPACITANCE_CHAN(_chan)	{			\
+		.type = IIO_CAPACITANCE,			\
+		.indexed = 1,					\
+		.channel = _chan,				\
+		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |	\
+		BIT(IIO_CHAN_INFO_AVERAGE_RAW),			\
+		.event_spec = ad7150_events,			\
+		.num_event_specs = ARRAY_SIZE(ad7150_events),	\
+	}
+
 static const struct iio_chan_spec ad7150_channels[] = {
-	{
-		.type = IIO_CAPACITANCE,
-		.indexed = 1,
-		.channel = 0,
-		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
-		BIT(IIO_CHAN_INFO_AVERAGE_RAW),
-		.event_spec = ad7150_events,
-		.num_event_specs = ARRAY_SIZE(ad7150_events),
-	}, {
-		.type = IIO_CAPACITANCE,
-		.indexed = 1,
-		.channel = 1,
-		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
-		BIT(IIO_CHAN_INFO_AVERAGE_RAW),
-		.event_spec = ad7150_events,
-		.num_event_specs = ARRAY_SIZE(ad7150_events),
-	},
+	AD7150_CAPACITANCE_CHAN(0),
+	AD7150_CAPACITANCE_CHAN(1)
 };
 
 /*
-- 
2.22.0.rc0.1.g337bb99195.dirty


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array
  2019-05-18 21:35 ` [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array Bárbara Fernandes
@ 2019-05-20  8:53   ` Alexandru Ardelean
  2019-05-20 10:20     ` Ardelean, Alexandru
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandru Ardelean @ 2019-05-20  8:53 UTC (permalink / raw)
  To: Bárbara Fernandes
  Cc: linux-iio, Melissa Wen, Wilson Sales, Alexandru Ardelean

On Sun, May 19, 2019 at 12:35 AM Bárbara Fernandes
<barbara.fernandes@usp.br> wrote:
>
> Create structure of type of_device_id in order to register all devices
> the driver is able to manage.
>

Hey,

CC-ing my work-email
There are some issues with it and mailing lists; I'll hopefully sort
them out in the next weeks.

> Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
> Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
> Co-developed-by: Melissa Wen <melissa.srw@gmail.com>
> Signed-off-by: Wilson Sales <spoonm@spoonm.org>
> Co-developed-by: Wilson Sales <spoonm@spoonm.org>
> ---
>  drivers/staging/iio/cdc/ad7150.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
> index 4b1c90e1b0ea..072094227e1b 100644
> --- a/drivers/staging/iio/cdc/ad7150.c
> +++ b/drivers/staging/iio/cdc/ad7150.c
> @@ -655,11 +655,21 @@ static const struct i2c_device_id ad7150_id[] = {
>         {}
>  };
>
> +static const struct of_device_id ad7150_of_i2c_match[] = {
> +       { .compatible = "adi,ad7150" },
> +       { .compatible = "adi,ad7151" },
> +       { .compatible = "adi,ad7156" },
> +       {}
> +};
> +
> +MODULE_DEVICE_TABLE(of, ad7150_of_i2c_match);

nitpick: you don't need to add i2c in the name
so, this could be just
MODULE_DEVICE_TABLE(of, ad7150_of_match);

but it's not a blocker for this;

So,

Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

> +
>  MODULE_DEVICE_TABLE(i2c, ad7150_id);
>
>  static struct i2c_driver ad7150_driver = {
>         .driver = {
>                 .name = "ad7150",
> +               .of_match_table = ad7150_of_i2c_match
>         },
>         .probe = ad7150_probe,
>         .id_table = ad7150_id,
> --
> 2.22.0.rc0.1.g337bb99195.dirty
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array
  2019-05-20  8:53   ` Alexandru Ardelean
@ 2019-05-20 10:20     ` Ardelean, Alexandru
  0 siblings, 0 replies; 5+ messages in thread
From: Ardelean, Alexandru @ 2019-05-20 10:20 UTC (permalink / raw)
  To: ardeleanalex, barbara.fernandes; +Cc: melissa.srw, linux-iio, spoonm

On Mon, 2019-05-20 at 11:53 +0300, Alexandru Ardelean wrote:
> [External]
> 
> 
> On Sun, May 19, 2019 at 12:35 AM Bárbara Fernandes
> <barbara.fernandes@usp.br> wrote:
> > 
> > Create structure of type of_device_id in order to register all devices
> > the driver is able to manage.
> > 
> 
> Hey,
> 
> CC-ing my work-email
> There are some issues with it and mailing lists; I'll hopefully sort
> them out in the next weeks.
> 
> > Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
> > Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
> > Co-developed-by: Melissa Wen <melissa.srw@gmail.com>
> > Signed-off-by: Wilson Sales <spoonm@spoonm.org>
> > Co-developed-by: Wilson Sales <spoonm@spoonm.org>
> > ---
> >  drivers/staging/iio/cdc/ad7150.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/drivers/staging/iio/cdc/ad7150.c
> > b/drivers/staging/iio/cdc/ad7150.c
> > index 4b1c90e1b0ea..072094227e1b 100644
> > --- a/drivers/staging/iio/cdc/ad7150.c
> > +++ b/drivers/staging/iio/cdc/ad7150.c
> > @@ -655,11 +655,21 @@ static const struct i2c_device_id ad7150_id[] = {
> >         {}
> >  };
> > 
> > +static const struct of_device_id ad7150_of_i2c_match[] = {
> > +       { .compatible = "adi,ad7150" },
> > +       { .compatible = "adi,ad7151" },
> > +       { .compatible = "adi,ad7156" },
> > +       {}
> > +};
> > +
> > +MODULE_DEVICE_TABLE(of, ad7150_of_i2c_match);
> 
> nitpick: you don't need to add i2c in the name
> so, this could be just
> MODULE_DEVICE_TABLE(of, ad7150_of_match);
> 
> but it's not a blocker for this;

Actually, disregard the above comment.
I just thought of some cases where it makes sense to have the i2c in the
name. So, ad7150_of_i2c_match is fine.


> 
> So,
> 
> Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> 
> > +
> >  MODULE_DEVICE_TABLE(i2c, ad7150_id);
> > 
> >  static struct i2c_driver ad7150_driver = {
> >         .driver = {
> >                 .name = "ad7150",
> > +               .of_match_table = ad7150_of_i2c_match
> >         },
> >         .probe = ad7150_probe,
> >         .id_table = ad7150_id,
> > --
> > 2.22.0.rc0.1.g337bb99195.dirty
> > 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-05-20 10:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-18 21:35 [PATCH 0/2] Enhance dt support and channel creation Bárbara Fernandes
2019-05-18 21:35 ` [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array Bárbara Fernandes
2019-05-20  8:53   ` Alexandru Ardelean
2019-05-20 10:20     ` Ardelean, Alexandru
2019-05-18 21:35 ` [PATCH 2/2] staging: iio: cdc: ad7150: create macro for capacitance channels Bárbara Fernandes

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.