diff mbox

[2/3] IIO: Add iio_chan modifier for True/Magnetic North HID usages

Message ID 1401311175-12784-3-git-send-email-reyad.attiyat@gmail.com (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Reyad Attiyat May 28, 2014, 9:06 p.m. UTC
Updated iio_chan_info_enum for compass north sensor usages,
including magnetic/true north and tilt compensation.

Signed-off-by: Reyad Attiyat <reyad.attiyat@gmail.com>
---
 drivers/iio/industrialio-core.c | 4 ++++
 include/linux/iio/types.h       | 4 ++++
 2 files changed, 8 insertions(+)

Comments

Jonathan Cameron May 31, 2014, 10:14 a.m. UTC | #1
On 28/05/14 22:06, Reyad Attiyat wrote:
> Updated iio_chan_info_enum for compass north sensor usages,
> including magnetic/true north and tilt compensation.
>
> Signed-off-by: Reyad Attiyat <reyad.attiyat@gmail.com>
> ---
>   drivers/iio/industrialio-core.c | 4 ++++
>   include/linux/iio/types.h       | 4 ++++
>   2 files changed, 8 insertions(+)
>
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index ede16aec..41bd377 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -84,6 +84,10 @@ static const char * const iio_modifier_names[] = {
>   	[IIO_MOD_LIGHT_RED] = "red",
>   	[IIO_MOD_LIGHT_GREEN] = "green",
>   	[IIO_MOD_LIGHT_BLUE] = "blue",
> +	[IIO_MOD_MAGN_NORTH] = "north",
> +	[IIO_MOD_MAGN_NORTH_TRUE] = "north_true",
> +	[IIO_MOD_MAGN_NORTH_TILT_COMP] = "north_tilt_comp",
> +	[IIO_MOD_MAGN_NORTH_TRUE_TILT_COMP] = "north_true_tilt_comp",
>   };
I think we need the naming to explicitly mention north_magnetic instead
of just north.  Whilst it is obvious what north means when you have north
true alongside it, it won't be so obvious if one just has the north attribute
to see in a particular driver - if anything I'd have the true as the one
that was simply called north (as it might not be coming from a magnetometer
thought obviously that's the most common source)   I'd also rather the enum entries
were
IIO_MOD_NORTH_MAGN
IIO_MOD_NORTH_TRUE
IIO_MOD_NORTH_MAGN_TILT_COMP
IIO_MOD_NORTH_TRUE_TILT_COMP

It is definitely feasible that they will not come from magnetometers -
a differential bearing is common on GPS units.

>
>   /* relies on pairs of these shared then separate */
> diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
> index 084d882..f1e8be6 100644
> --- a/include/linux/iio/types.h
> +++ b/include/linux/iio/types.h
> @@ -53,6 +53,10 @@ enum iio_modifier {
>   	IIO_MOD_LIGHT_RED,
>   	IIO_MOD_LIGHT_GREEN,
>   	IIO_MOD_LIGHT_BLUE,
> +	IIO_MOD_MAGN_NORTH,
> +	IIO_MOD_MAGN_NORTH_TRUE,
> +	IIO_MOD_MAGN_NORTH_TILT_COMP,
> +	IIO_MOD_MAGN_NORTH_TRUE_TILT_COMP
>   };
>
>   enum iio_event_type {
>

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reyad Attiyat June 2, 2014, 7:54 p.m. UTC | #2
Hey Jonathan,
>
> I think we need the naming to explicitly mention north_magnetic instead
> of just north.  Whilst it is obvious what north means when you have north
> true alongside it, it won't be so obvious if one just has the north
> attribute
> to see in a particular driver - if anything I'd have the true as the one
> that was simply called north (as it might not be coming from a magnetometer
> thought obviously that's the most common source)   I'd also rather the enum
> entries
> were
> IIO_MOD_NORTH_MAGN
> IIO_MOD_NORTH_TRUE
> IIO_MOD_NORTH_MAGN_TILT_COMP
> IIO_MOD_NORTH_TRUE_TILT_COMP
>
> It is definitely feasible that they will not come from magnetometers -
> a differential bearing is common on GPS units.

Makes sense to me. I will update the patches with your suggestions. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index ede16aec..41bd377 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -84,6 +84,10 @@  static const char * const iio_modifier_names[] = {
 	[IIO_MOD_LIGHT_RED] = "red",
 	[IIO_MOD_LIGHT_GREEN] = "green",
 	[IIO_MOD_LIGHT_BLUE] = "blue",
+	[IIO_MOD_MAGN_NORTH] = "north",
+	[IIO_MOD_MAGN_NORTH_TRUE] = "north_true",
+	[IIO_MOD_MAGN_NORTH_TILT_COMP] = "north_tilt_comp",
+	[IIO_MOD_MAGN_NORTH_TRUE_TILT_COMP] = "north_true_tilt_comp",
 };
 
 /* relies on pairs of these shared then separate */
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 084d882..f1e8be6 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -53,6 +53,10 @@  enum iio_modifier {
 	IIO_MOD_LIGHT_RED,
 	IIO_MOD_LIGHT_GREEN,
 	IIO_MOD_LIGHT_BLUE,
+	IIO_MOD_MAGN_NORTH,
+	IIO_MOD_MAGN_NORTH_TRUE,
+	IIO_MOD_MAGN_NORTH_TILT_COMP,
+	IIO_MOD_MAGN_NORTH_TRUE_TILT_COMP
 };
 
 enum iio_event_type {