From: Bharath Vedartham <linux.bhar@gmail.com>
To: himanshujha199640@gmail.com
Cc: kernelnewbies@kernelnewbies.org
Subject: drivers: iio: dummy: Unable to add channels to simple_dummy_channel
Date: Wed, 23 Jan 2019 23:25:59 +0530 [thread overview]
Message-ID: <20190123175556.GA1039@bhar.linux> (raw)
I am trying to add the 3-axis compass data channels to the
simple_dummy_channel. I have mounted configfs and am able to load the
modules correctly. Is this the right approach? printk is not printing
anything to syslogs.
This is part of the iio_tasks in (I have finished the first 2 tasks):
https://kernelnewbies.org/IIO_tasks
output of lsmod | grep dummy:
iio_dummy 20480 2
iio_dummy_evgen 16384 1 iio_dummy
output of ls /sys/bus/iio/devices/iio:device0/:
buffer in_sampling_frequency
in_voltage-voltage_scale
current_timestamp_clock in_steps_calibheight name
dev in_steps_en out_voltage0_raw
events in_steps_input power
in_accel_x_calibbias in_voltage0_offset scan_elements
in_accel_x_calibscale in_voltage0_raw subsystem
in_accel_x_raw in_voltage0_scale trigger
in_activity_running_input in_voltage1-voltage2_raw uevent
in_activity_walking_input in_voltage3-voltage4_raw
I have also put the diff.Added channel to iio_dummy_channels and added
element to enum simple_dummy_scan_elements.
Thank you,
Bharath
---
drivers/iio/dummy/iio_simple_dummy.c | 43 ++++++++++++++++++++++++++++++++++++
drivers/iio/dummy/iio_simple_dummy.h | 3 +++
2 files changed, 46 insertions(+)
diff --git a/drivers/iio/dummy/iio_simple_dummy.c b/drivers/iio/dummy/iio_simple_dummy.c
index 6205247..306e0cd 100644
--- a/drivers/iio/dummy/iio_simple_dummy.c
+++ b/drivers/iio/dummy/iio_simple_dummy.c
@@ -268,6 +268,48 @@ static const struct iio_chan_spec iio_dummy_channels[] = {
.num_event_specs = 1,
#endif /* CONFIG_IIO_SIMPLE_DUMMY_EVENTS */
},
+ {
+ .type = IIO_MAGN,
+ .modified = 1,
+ .channel2 = IIO_MOD_X,
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
+ .scan_index = DUMMY_INDEX_MAGNX,
+ .scan_type = {
+ .sign = 'u',
+ .realbits = 16,
+ .storagebits = 16,
+ .shift = 0,
+ },
+ },
+ {
+ .type = IIO_MAGN,
+ .modified = 1,
+ .channel2 = IIO_MOD_Y,
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
+ .scan_index = DUMMY_INDEX_MAGNY,
+ .scan_type = {
+ .sign = 'u',
+ .realbits= 16,
+ .storagebits = 16,
+ .shift = 0,
+ },
+ },
+ {
+ .type = IIO_MAGN,
+ .modified = 1,
+ .channel2 = IIO_MOD_Z,
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
+ .scan_index = DUMMY_INDEX_MAGNZ,
+ .scan_type = {
+ .sign = 'u',
+ .realbits = 16,
+ .storagebits = 16,
+ .shift = 0,
+ },
+ },
};
/**
@@ -621,6 +663,7 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
/* Provide description of available channels */
indio_dev->channels = iio_dummy_channels;
indio_dev->num_channels = ARRAY_SIZE(iio_dummy_channels);
+ printk(KERN_DEBUG "No of channels are %d\n",indio_dev -> num_channels);
/*
* Provide device type specific interface functions and
diff --git a/drivers/iio/dummy/iio_simple_dummy.h b/drivers/iio/dummy/iio_simple_dummy.h
index f7005c3..be6eff0 100644
--- a/drivers/iio/dummy/iio_simple_dummy.h
+++ b/drivers/iio/dummy/iio_simple_dummy.h
@@ -110,6 +110,9 @@ enum iio_simple_dummy_scan_elements {
DUMMY_INDEX_DIFFVOLTAGE_1M2,
DUMMY_INDEX_DIFFVOLTAGE_3M4,
DUMMY_INDEX_ACCELX,
+ DUMMY_INDEX_MAGNX,
+ DUMMY_INDEX_MAGNY,
+ DUMMY_INDEX_MAGNZ,
};
#ifdef CONFIG_IIO_SIMPLE_DUMMY_BUFFER
--
2.7.4
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next reply other threads:[~2019-01-23 17:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-23 17:55 Bharath Vedartham [this message]
2019-01-23 18:57 ` drivers: iio: dummy: Unable to add channels to simple_dummy_channel valdis.kletnieks
2019-01-24 11:05 ` Himanshu Jha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190123175556.GA1039@bhar.linux \
--to=linux.bhar@gmail.com \
--cc=himanshujha199640@gmail.com \
--cc=kernelnewbies@kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.