All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
To: Jonathan Cameron <jic23@kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: linux-iio@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Subject: [PATCH v3 4/8] iio: accel: kxcjk1013: make sysfs/sampling_frequency_avail dynamic
Date: Sun, 17 Sep 2017 17:01:03 +0200	[thread overview]
Message-ID: <081710b9deaff7273ba1c736e9a3db42dc0d1c93.1505660069.git.mirq-linux@rere.qmqm.pl> (raw)
In-Reply-To: <cover.1505660069.git.mirq-linux@rere.qmqm.pl>

In preparation for KXTF9 support, make sampling_frequency_avail
attribute dynamic.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/iio/accel/kxcjk-1013.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index 3022bc951dc2..9b4f953c5782 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -155,6 +155,9 @@ static const struct kx_odr_map samp_freq_table[] = {
 	{ 1600, 0, 0x07, 0x06 },
 };
 
+static const char *const kxcjk1013_samp_freq_avail =
+	"0.781000 1.563000 3.125000 6.250000 12.500000 25 50 100 200 400 800 1600";
+
 /* Refer to section 4 of the specification */
 static const struct {
 	int odr_bits;
@@ -879,13 +882,19 @@ static int kxcjk1013_buffer_postdisable(struct iio_dev *indio_dev)
 	return kxcjk1013_set_power_state(data, false);
 }
 
-static IIO_CONST_ATTR_SAMP_FREQ_AVAIL(
-	"0.781000 1.563000 3.125000 6.250000 12.500000 25 50 100 200 400 800 1600");
+static ssize_t kxcjk1013_get_samp_freq_avail(struct device *dev,
+					     struct device_attribute *attr,
+					     char *buf)
+{
+	return sprintf(buf, "%s\n", kxcjk1013_samp_freq_avail);
+}
+
+static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(kxcjk1013_get_samp_freq_avail);
 
 static IIO_CONST_ATTR(in_accel_scale_available, "0.009582 0.019163 0.038326");
 
 static struct attribute *kxcjk1013_attributes[] = {
-	&iio_const_attr_sampling_frequency_available.dev_attr.attr,
+	&iio_dev_attr_sampling_frequency_available.dev_attr.attr,
 	&iio_const_attr_in_accel_scale_available.dev_attr.attr,
 	NULL,
 };
-- 
2.11.0

  parent reply	other threads:[~2017-09-17 15:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-17 15:00 [PATCH v3 0/8] iio: accel: kxcjk1003: support Kionix KXTF9 Michał Mirosław
2017-09-17 15:01 ` [PATCH v3 1/8] iio: accel: kxcjk1003: refactor ODR setting Michał Mirosław
2017-09-30 19:58   ` Jonathan Cameron
2017-09-17 15:01 ` [PATCH v3 3/8] iio: accel: kxcjk1013: extract report_motion_event() from interrupt handler Michał Mirosław
2017-09-30 19:59   ` Jonathan Cameron
2017-09-17 15:01 ` [PATCH v3 2/8] iio: accel: kxcjk1013: fix INT_CTRL/INT_SRC1 bit names Michał Mirosław
2017-09-30 20:01   ` Jonathan Cameron
2017-09-17 15:01 ` Michał Mirosław [this message]
2017-09-30 20:01   ` [PATCH v3 4/8] iio: accel: kxcjk1013: make sysfs/sampling_frequency_avail dynamic Jonathan Cameron
2017-09-17 15:01 ` [PATCH v3 5/8] iio: accel: kxcjk1013: make sampling_frequency_avail per-type Michał Mirosław
2017-09-30 20:02   ` Jonathan Cameron
2017-09-17 15:01 ` [PATCH v3 6/8] iio: accel: kxcjk1013: add support for KXTF9 Michał Mirosław
2017-09-24 15:00   ` Jonathan Cameron
2017-09-30 20:05     ` Jonathan Cameron
2017-09-17 15:01 ` [PATCH v3 7/8] iio: accel: kxcjk1013: remove unused platform data struct Michał Mirosław
2017-09-24 15:29   ` Jonathan Cameron
2017-09-28 14:09     ` Michał Mirosław
2017-09-29 17:32     ` Srinivas Pandruvada
2017-09-30 18:14       ` Jonathan Cameron
2017-09-17 15:01 ` [PATCH v3 8/8] iio: accel: kxcjk1013: drop variation number from driver's name Michał Mirosław
2017-09-24 15:03   ` Jonathan Cameron
2017-09-29 17:45     ` Srinivas Pandruvada
2017-09-29 22:05       ` Michał Mirosław
2017-09-24 15:05 ` [PATCH v3 0/8] iio: accel: kxcjk1003: support Kionix KXTF9 Jonathan Cameron
2017-09-29 17:46   ` Srinivas Pandruvada
2017-09-27 19:16 ` Srinivas Pandruvada

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=081710b9deaff7273ba1c736e9a3db42dc0d1c93.1505660069.git.mirq-linux@rere.qmqm.pl \
    --to=mirq-linux@rere.qmqm.pl \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=srinivas.pandruvada@linux.intel.com \
    --subject='Re: [PATCH v3 4/8] iio: accel: kxcjk1013: make sysfs/sampling_frequency_avail dynamic' \
    /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

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.