Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp958641iob; Fri, 13 May 2022 17:43:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzynlvoEjPrPj8t8vhJnw4bDRhmx6S5o0JWkvYWm43vU3Nqtw/TwwnyiKSATZ86bykKDSt5 X-Received: by 2002:a5d:6d8f:0:b0:20c:7fb7:d59c with SMTP id l15-20020a5d6d8f000000b0020c7fb7d59cmr6148778wrs.77.1652489035881; Fri, 13 May 2022 17:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652489035; cv=none; d=google.com; s=arc-20160816; b=CWIi9m+Bo+dDdI2e7zhJdqbAYIEcBSSMd4CLbLHDZUkrVEz6d5wHXNZNqQUM2AGEFw Ey9trh9ZfZRoNNUMLnWAP4pz1gVFPEbDSxICdlEjNmojWHl9HtLQZAeOoeqI0DTgNID/ n4sPMXAUMj7mQ/wskn4X9ZnoyKIrIbwtDOVayxrRqWioFACkmzYBTqrrN4wAkmPP0riJ Q3ZxVeKOUyrJxTgpOWL4jZm99UP1GX3vxSiilbJITxbO307aTBOLYTkghBG22tjzH298 jOmPNbgO1aoWrviIHP0x9M2xzs1qkc0jRuUJLavVWU7udpql+wo/I1Q01BV5VEWxqghh md/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Ila35DCgOXi2917rqd4ZJ5RckctBCKW2T4WuIc/73kk=; b=YZxzx09ETdPHrF7Acum+3n+Kq4cZskQFmnJovJuN/j99Ui7ij5A4wRVJwZ5ivqvAmI DB03XZQKnTwJVYwtAzmPrNvrapSzoNf20XjNY60BEZvsgAyW+mbNuYUkrI62LuMJm3iE 8Qmsy42mvFXtnsTH0J27NmVNUWv4GlrZ4oSGPI7yIpwbmUvh0UsQ+VcKuYLqxRxMyRvD dbe/ZCoXGqyEzykn/t98g7NcCtQRNmhZ4KMkptrEzzKOcqtacvUZ/vDn+p93lpMmpxK7 kje5avan9J3t96xnIF2sReAmJ4RSjzNZDP4emsp9gfWLE8yYdIr8ol3UMG710qAMBrTQ 5RVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=CyYDwTVi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 18-20020a05600c269200b0039437f4ca80si3051421wmt.153.2022.05.13.17.43.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 17:43:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=CyYDwTVi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4E8063172DB; Fri, 13 May 2022 16:24:00 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346447AbiEMNug (ORCPT + 99 others); Fri, 13 May 2022 09:50:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378060AbiEMNkQ (ORCPT ); Fri, 13 May 2022 09:40:16 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8922B13FAB; Fri, 13 May 2022 06:40:14 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: shreeya) with ESMTPSA id 20E7E1F4608A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652449212; bh=X8gPJfUaPvojokUrQ1VToFmt1LKmH1dH4HkLO7C9KHE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=CyYDwTVi4ueHyg/u7jL4r3bByMb9muNVhf6HiSrmSxIDn3/qh1ZgF4hKY0Ve7GJTq NC1TSrTlB0lJuLsY2sFbzJpb7CwAoZBX0oqpF+p+IoGrcmuxmm/RBCHxEvQNnRllOO f5yX2BHYZ/IrsOovE3YL32ovPyEW6ZlcM3IPTwl/kLyR35Qe59iDQHoDp8A/LKH2iD nR8JyJJTEq6MZdtGHIqxLN1c9ppxEPIWfe9YXO6NTCvN0WhWiOJsb4BvRTwE0KkAou aCv0jmHfaxIHZ/tqMfw2g1XqFG0zSiWl/Nthk3dmXLdzOxl1e91/cGnjMnjWHQQMP9 7GELqEiEDvEzQ== Message-ID: <88b33ada-e997-05e9-f555-b9c1ed369fb7@collabora.com> Date: Fri, 13 May 2022 19:10:05 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v4 3/3] iio: light: Add support for ltrf216a sensor Content-Language: en-US To: Dmitry Osipenko , jic23@kernel.org, lars@metafoo.de, robh+dt@kernel.org, Zhigang.Shi@liteon.com, krisman@collabora.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, alvaro.soliverez@collabora.com References: <20220511094024.175994-1-shreeya.patel@collabora.com> <20220511094024.175994-4-shreeya.patel@collabora.com> From: Shreeya Patel In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=unavailable 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 On 13/05/22 05:24, Dmitry Osipenko wrote: Hi Dmitry, > 11.05.2022 12:40, Shreeya Patel пишет: >> +static int ltrf216a_init(struct iio_dev *indio_dev) >> +{ >> + int ret; >> + struct ltrf216a_data *data = iio_priv(indio_dev); >> + >> + ret = i2c_smbus_read_byte_data(data->client, LTRF216A_MAIN_CTRL); >> + if (ret < 0) { >> + dev_err(&data->client->dev, "Error reading LTRF216A_MAIN_CTRL\n"); >> + return ret; >> + } >> + >> + /* enable sensor */ >> + ret |= FIELD_PREP(LTRF216A_ALS_ENABLE_MASK, 1); >> + ret = i2c_smbus_write_byte_data(data->client, LTRF216A_MAIN_CTRL, ret); >> + if (ret < 0) { >> + dev_err(&data->client->dev, "Error writing LTRF216A_MAIN_CTRL\n"); >> + return ret; >> + } > Couldn't you write "1" directly without reading? > > What about doing SW reset? I think we are doing a read here just to make sure device registers are ready and accessible without any issues. Also, why would we want to do a SW reset here? In the datasheet, I could see the following steps to enable the sensor Supply VDD to Sensor (Sensor in Standby Mode) ---> Wait 100 ms (min) - initial startup time ---> I2C Command (Write) To enable sensor to Active Mode Thanks, Shreeya Patel >