From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71AA1C282C0 for ; Wed, 23 Jan 2019 17:58:07 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 33FDD217D4 for ; Wed, 23 Jan 2019 17:58:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sKWwKoSH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33FDD217D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces+kernelnewbies=archiver.kernel.org@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.91) (envelope-from ) id 1gmMmr-0003B5-L5 for kernelnewbies@archiver.kernel.org; Wed, 23 Jan 2019 12:58:05 -0500 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1gmMkw-0000xP-5F for kernelnewbies@kernelnewbies.org; Wed, 23 Jan 2019 12:56:06 -0500 Received: by mail-pl1-x642.google.com with SMTP id 101so1535924pld.6 for ; Wed, 23 Jan 2019 09:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=aO/nASu4peMbAJ+6I2yii6WRMZ4qEXjWxDjND1Wo3NM=; b=sKWwKoSHDl5fPgM5sJDqaNJtyNcIAvI5AlIk9QPytzBfyB4r2k2X+3LBomn20As+9u JJwTG5Q8LdOvcfXSqVo9xMwOs1pccMzZ7UzdwpIejmotR8C28E2NOL6NdxzPGTiM8pXk XAQG4eqkU+umq6H2k9ok7BbyHkgygo0CVHY3fSWjPRybVa/tr/hsSy0ovlHehsKtnlwj MmnuxG/gZEL0m640C49Kz2PNR1zEmrbgvhJn3gEvExMGg6n/XEknTopqM6cSL4e5n+YN +JKqqgpANA2P0T34IIv6wAncv2Ccnr/QbyN75eVAoLdbAKqFzg1vWIrpPdS7MLnQQtPr rv3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=aO/nASu4peMbAJ+6I2yii6WRMZ4qEXjWxDjND1Wo3NM=; b=Pv3W/w8IG0Cgn9N1SxSmjGhyNL73kv5Vzkkoxn5fYUoDGnwQo40OLA1MYFkdGvy+Yb 7zW6/h4yARBXO+8vD6I9poHtJUA4pzRlqUykn6Or04UB0+B463Mi1BePweMIUN09UkRG qqt1GGiYodSYhsEFKxrCXAHEoizzs8/xisOguHp/Tn44m8ktzclRZFhmuK6B88U9oYty l6qNfHenY7pOSNNp87mSvLFhalEmZt/0+xup+lbkznFvDOBHk0l2BNOajnAQ/h1lvif4 fnuJg+DY0mi3N+N/maF9EyHk4f528lmM8cJxwW+3mJZfylh+skyWfro2QSf0iR9PLnvU fqCA== X-Gm-Message-State: AJcUukd4J6IA48efyp61+vESbDTnjhC36rZkPxdGvg8JrfiN9dypb3Vs fXJXbmepfwmZ0hOqb0E2/qtjHcI3 X-Google-Smtp-Source: ALg8bN6GedDm1r64UGWdMIfIOAJq9YcX8dSSZNs9xd1aitd/19T3c2Qr7vlsALTBC/StaFxBxdtEjw== X-Received: by 2002:a17:902:4a0c:: with SMTP id w12mr3213844pld.8.1548266163508; Wed, 23 Jan 2019 09:56:03 -0800 (PST) Received: from bhar12345-VirtualBox ([103.110.42.34]) by smtp.gmail.com with ESMTPSA id e16sm24433823pfn.46.2019.01.23.09.56.02 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Jan 2019 09:56:03 -0800 (PST) Date: Wed, 23 Jan 2019 23:25:59 +0530 From: Bharath Vedartham To: himanshujha199640@gmail.com Subject: drivers: iio: dummy: Unable to add channels to simple_dummy_channel Message-ID: <20190123175556.GA1039@bhar.linux> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Cc: kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces+kernelnewbies=archiver.kernel.org@kernelnewbies.org 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