From patchwork Sat Nov 19 19:54:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 23308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp851242wrr; Sat, 19 Nov 2022 12:09:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf7+FW7uXxRV2WUuj3n6bJ99BOmkRzpYWfOGU6dJZbJw+CCljnYWgh40u6FIWVWbJStQ9/ix X-Received: by 2002:aa7:d9d9:0:b0:463:fec2:dfb1 with SMTP id v25-20020aa7d9d9000000b00463fec2dfb1mr10665231eds.303.1668888540861; Sat, 19 Nov 2022 12:09:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668888540; cv=none; d=google.com; s=arc-20160816; b=QY/4D1DHSJ9zTF/gIz8q0YLDH5kdBTv8aXuHubmnfVTYajtYzL44SfcHwswTtW73uD VOj6l31Tl1qxZKamqdw2zdohYipeJ0Wf6XQgHVlr0Rl0K5fBHBp2ClsZbrRx5naSKJ1J ZA67LEsXh9HQaqOagUdcFxl1WpqhfQ5MJSvmC1qL1Gw3nk+u5UucqcqbYmE/9DIjiGUu Y2+QHkzs5v2M6SB1sgEHEMyeanCTO66TUR+5iUiSmZ2Kn9OKJypQLGiAVh9asZmgHHwb 3vo9mgvQvurJQ96dCl6I0FUiz2SmdEHDZ3T2V5uYuMw+5j6xlY1XChNkp95VEzHkwbI/ CwcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=BUsZizRVkKlEHiw1tvOnOeuLnKW7zUUEKjHNpYJ9L6s=; b=rLEYNERifMbghuLdr5I7LMJF97DB8+bl63qnB8gIqnfOC9LMlsnOZ6SfjP/7u6MoLs OvBOQP0K6LTtDLfTzDuo7yxE4LUQrYmDgz1HxGksjJ3CEdyW3m3d1qL+jUbW5t9+ID/W 3dDQ+EE/xK3T5dFR+6XCZODh9rqnZVnuEM01+HfQRPHx3YAcW61t//5fXJ5RPXoZ2M/E s46jNU9wcIjyCNFzAN8pIX+IxoOKUt+I+ED27dsuozLP6QeaDorOLcVJNC2pNuG8OfmJ gXsopLawJRPSxvHwI8viQPkK5Cu21dcmVioTU1ViMCnoA3HqggEdy9HuKwKZpZmU1dKz /1gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=lCSzw6ar; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs37-20020a1709073ea500b0078dcfe6a000si5807485ejc.727.2022.11.19.12.08.35; Sat, 19 Nov 2022 12:09:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=lCSzw6ar; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234467AbiKSTyg (ORCPT + 99 others); Sat, 19 Nov 2022 14:54:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232895AbiKSTye (ORCPT ); Sat, 19 Nov 2022 14:54:34 -0500 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85765165A7 for ; Sat, 19 Nov 2022 11:54:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1668887665; bh=ZzvCx/aKQd3EBJiLy/UGUsE7vHM6TVSTh1wAr6CeKRc=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=lCSzw6arnyhsMU2jhj2JAJ6v39ZZEghds1jmihmrtdDk48TvXpqDehIjAkkHJ+eLv GcQyQoD2ej/wsYB+lhFC1qcmNTW+Qg7dk+nrtfxBq0PBmng7uHifQU6pDSCts7EemG 8B4DY8kWoQCpYQnScxRg/5TD2MfIDkjIOP1awN0c= Received: by b-6.in.mailobj.net [192.168.90.16] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 19 Nov 2022 20:54:25 +0100 (CET) X-EA-Auth: YoniFlBPfdtLBBKBkWGtb73v/GdX0sJh9s2NeO1AaQWeVUawd3H2BKTvclMzz/T07W55oJrfEUk89QEC2n3jFxzh/Throbsk Date: Sun, 20 Nov 2022 01:24:21 +0530 From: Deepak R Varma To: Greg Kroah-Hartman , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: drv@mailo.com Subject: [PATCH] staging: pi433: set DCC setting to spec recommended value Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749956470530371434?= X-GMAIL-MSGID: =?utf-8?q?1749956470530371434?= The DCCFreq value is used to obtain the DC offset canceller cut-off frequency. Upon device power reset, the bits 7-5 of the RegRxBw register that represent the DCCFreq setting are set to 0x4, which evaluates the cut-off frequency to be 1% of RxBw. In the current implementation, first, there is no configuration variable defined in the struct pi433_rx_cfg for the user to set this value as part of the UAPI. Second, the code simply ignores the value of DCC setting and allows it to never change. As per the RFM69HCW tech specs, the default value for DCC frequency is recommended to be 4% of the RxBw; which requires the DCC setting bits to be set to 010. So allow the DCC setting to change to recommended / default value for improved rx sensitivity. Signed-off-by: Deepak R Varma --- Please Note: The proposed change is compile tested only. I am unable to perform device based testing in the absence of the hardware, both the RasPi board and the Pi433 device. Please let me know if it is necessary for me to test such patches on the real device myself. I will stop sending the patches till I have the hardware to test them. Thanks. drivers/staging/pi433/rf69.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.34.1 diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index 8c7fab6a46bb..8468d4717dd0 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -465,6 +465,13 @@ static int rf69_set_bandwidth_intern(struct spi_device *spi, u8 reg, // read old value bandwidth = rf69_read_reg(spi, reg); + /* DCC setting bits [7-5] are set to 0x4 on reset. Since there is no user + * input available in the rx config struct, we should set it to default + * or the recommended value as per the technical specification. + */ + if ((bandwidth >> 5) == 0x4) + bandwidth = bandwidth & BW_DCC_4_PERCENT; + // "delete" mantisse and exponent = just keep the DCC setting bandwidth = bandwidth & MASK_BW_DCC_FREQ;