Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp385176imm; Mon, 4 Jun 2018 20:12:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKMjwF/nl0L9+FJp0Ro8sOYskKRO1qa7yWuLsTWUVCSiXgUgkGDM4smO/tzr47v4kfW2AhF X-Received: by 2002:a63:7247:: with SMTP id c7-v6mr19329553pgn.68.1528168349660; Mon, 04 Jun 2018 20:12:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528168349; cv=none; d=google.com; s=arc-20160816; b=wIto+Q7mmB6bBF/2D6ogmPat0UhCZC4RXQwQkCPxnUQTzngQbvORDUVGD3XxNjfl9/ RGOlPDE8gOdv9Qd8ZEwMUpAdr9sJULSxlj1fmv5EmlMDt6S5Y1hP1UkwUV0Uq8S6y0U8 WAvjlIpvZ06QujnsYPPHwWLG+xOFrr5wxHXRPXxr4qRnembiqpB9/e+hpeHHOcuP+efD Lo5yGDA15VgJDXwFthgWWZpTECR1X23m9mjcFnHcmJ0PFWbLDGhlAED4ZSmzl5BVw9Pl 1J1GZ8H48y760GMxcKOFW/laEhZCOt3/Oxo+O82/OyeHWSpF4cB8oV0qgRmY1RoX3FXL dOTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Sn6hRooIovfO9wfbxHE8ZoSkR4Km2B0jIpmNfUxFZTU=; b=qqtNsfWzq1dMwdKW9CCCDZNhadrzv/MxAmc12JQsSLEUGspYoTUAwi8ksMoPYk9snU y5CS1L/k6wTz5AncLbUVElDgzhV9hJtjA01Yow4LAkKqiH+JyEbrkKtFasx5AbcIn7q3 OnPum1zN6QT5ckEU1VS/mt2jNWRw3S97d+bVnHqJeQk1EAYm4EcYIG2lY2DofLy3qnm5 nkP7lVv/yzkdyWKnzCRGzaGbx5NXXFORHIMFavm9FzgtHaPJBOEWVNYehpYcyxv0nj+4 Jd4xxpxD2A29IQN3EdVdJ2euubxCRdB8EUyx/O2YZGOT/lRZOeW1XtjZDP8FlbWi8bVz enOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b75-v6si8640688pfd.41.2018.06.04.20.12.01; Mon, 04 Jun 2018 20:12:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751348AbeFEDL1 (ORCPT + 99 others); Mon, 4 Jun 2018 23:11:27 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:34351 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751263AbeFEDL0 (ORCPT ); Mon, 4 Jun 2018 23:11:26 -0400 X-Originating-IP: 96.22.60.141 Received: from localhost (modemcable141.60-22-96.mc.videotron.ca [96.22.60.141]) (Authenticated sender: hle@owl.eu.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id AB9701BF205; Tue, 5 Jun 2018 05:11:29 +0200 (CEST) Date: Mon, 4 Jun 2018 23:11:20 -0400 From: Hugo Lefeuvre To: Marcus Wolf Cc: Valentin Vidic , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , hle@owl.eu.com Subject: rf69_set_deviation in rf69.c (pi433 driver) Message-ID: <20180605031120.GB1981@hle-laptop.local> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="UHN/qo2QbUvPLonB" Content-Disposition: inline User-Agent: Mutt/1.10.0 (2018-05-17) X-Spam-Level: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --UHN/qo2QbUvPLonB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Marcus, I have been taking a look at the pi433 driver these last days, and started working on the remaining TODOs. I just stumbled across the following one (drivers/staging/pi433/rf69.c): 245 // TODO: Dependency to bitrate 246 if (deviation < 600 || deviation > 500000) { 247 dev_dbg(&spi->dev, "set_deviation: illegal input param"= ); 248 return -EINVAL; 249 } According to the datasheet[0], the deviation should always be smaller than 300kHz, and the following equation should be respected: (1) FDA + BRF/2 =3D< 500 kHz Why did you choose 500kHz as max for FDA, instead of 300kHz ? It looks like a bug to me. Concerning the TODO, I can see two solutions currently: 1. Introduce a new rf69_get_bit_rate function which reads REG_BITRATE_MSB and REG_BITRATE_LSB and returns reconstructed BRF. We could use this function in rf69_set_deviation to retrieve the BRF. + clean + intuitive - heavy / slow 2. Store BRF somewhere in rf69.c, initialize it with the default value (4.8 kb/s) and update it when rf69_set_bit_rate is called. + easy - dirty, doesn't fit well with the design of rf69.c (do not store anything, simply expose API) I'd really prefer going for the first one, but I wanted to have your opinion on this. Thanks for your work ! Best regards, Hugo [0] http://www.hoperf.com/upload/rf/RFM69CW-V1.1.pdf [CC-ing Valentin Vidic, he was quite active on the pi433 driver these last months] --=20 Hugo Lefeuvre (hle) | www.owl.eu.com 4096/ 9C4F C8BF A4B0 8FC5 48EB 56B8 1962 765B B9A8 BACA --UHN/qo2QbUvPLonB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEE5LpPtQuYJzvmooL3LVy48vb3khkFAlsV/08ACgkQLVy48vb3 khlVPAgAjghfCSeRglbwClJ4KivU/dh3hwTwITQ1GDDw7wAwfdEd0ReR1T4V8JiZ 7TYCuqfL4D/e2GZgm6kTwLLPPbPZ4s601xcoHduW57E176kdiKjkZs2yGiIPwYsD dStXvnAMuzyz8wDDRRWhcnAr27Tk2lP/5cdZrVrdqDgX0dzdJd/vMGoU7JH04Vtd aBnN0M2qq6wP3kK6ba1QL3KH21WPm9hGyvPo4QjdfFvGBxzFcihK/Neam44KLIu3 faR+nO0k1xkSaaizEwjelZobJ6Fg7THAj/M5UWvTHGqa6Ju/v+9Kha2pGC/wZVmV tOur3ksci4fdRCkOmgxVXzETW5gXug== =hAVE -----END PGP SIGNATURE----- --UHN/qo2QbUvPLonB--