Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4396886ybz; Tue, 28 Apr 2020 10:33:52 -0700 (PDT) X-Google-Smtp-Source: APiQypLBp3FsA1ws5cqW8/vzviVJ8Yl9U83DdHEjfF3Mn4SbHOBpUONzDMT57+0I9LrLd2HjIAla X-Received: by 2002:a17:906:1ccb:: with SMTP id i11mr25243986ejh.101.1588095232327; Tue, 28 Apr 2020 10:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588095232; cv=none; d=google.com; s=arc-20160816; b=ghOQDUhx7lUCNwPGfQnAtmWY04n8EW6MRFSrKF5LMNgSOtk3O4lnoIe2DzfH4fCCtE rMsgih0XXyRvh7VqV7K/w4AfH9ws+sQ3EUFPtWvnxICbv580evCmfeINRvXn3/Hp5JIj l6nRhD/ciisA7hZbP7i0gv9gtSm39DTrLYF2H0M18FHkwzMYPCz1l7iOo760UC2oMP5i EExPaSnBsUl6HhVAZ20sZLRA1TQva8mJcLzeZk/nBoRcq6pWSggqpiGXEizdF5oftXWT 6sPAL4ckZ+eRI+odciAzWKVVdNulmIFW+Phf7fJ5DQPD9OOTLBM6Fy42UBOQ/8dG11Jw CGtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=302JfAKXdeKAFP9le9Cjh8LmYPnDyvK9wzRhL+36K80=; b=kJml0ztsy50AHT6XfaIor4M/EWhHAhPu+Yd3mRWCumX3AJI1CMqwkFiss5yaiGpzok +J6JUTxVSGjWZ1P6C3TWTqkPlaIIyCN30QDF9L/vZETzCT3QtLnjO59SuezfUQdHEyOd 6NIPyN4+NajA+/7Q6QzkWxoSIKNMvlD7wN0rgspylUddNX9/qPUGr9rTZL256VETI9wL 8vL5vcDUGYkfQvkc9HZBrATYNDv37A8YZvsqp9pXDM33Pm4OGkyPiZbvPy6A6yHHfEhJ zfx7dWpg1O4lCgnIEPNAIP7tzFQ+3lV9sp7dL/rb+crKzt72SvDtDFmSLwgnCSDeFStb QPIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XI/5dnY1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si2050706edx.606.2020.04.28.10.33.27; Tue, 28 Apr 2020 10:33:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XI/5dnY1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728551AbgD1R3q (ORCPT + 99 others); Tue, 28 Apr 2020 13:29:46 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:46186 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728519AbgD1R3o (ORCPT ); Tue, 28 Apr 2020 13:29:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588094982; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=302JfAKXdeKAFP9le9Cjh8LmYPnDyvK9wzRhL+36K80=; b=XI/5dnY13D4mxmog/WZEi7IG8HEIgtEvjoanFj9d+19AJgMSBzZxp3IMPyEoCqGBgAwHi4 9qCTCjVJMT8Y7LQWWN7NHEQgSZCKpMLuJ+CusoPAUP4pTrYpbUSnwv8EERLbO3tpPySVtp bcLK4z9Jf5JCyfTB6Ym7BOBtSxRKB84= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-323-3bqQkQLhOoGCWHtZ7pgt1A-1; Tue, 28 Apr 2020 13:29:39 -0400 X-MC-Unique: 3bqQkQLhOoGCWHtZ7pgt1A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 08BE91054F93; Tue, 28 Apr 2020 17:29:37 +0000 (UTC) Received: from x1.localdomain.com (ovpn-114-62.ams2.redhat.com [10.36.114.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71BB25C1D4; Tue, 28 Apr 2020 17:29:34 +0000 (UTC) From: Hans de Goede To: "Rafael J . Wysocki" , Len Brown , Darren Hart , Andy Shevchenko , Jonathan Cameron Cc: Hans de Goede , linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-iio@vger.kernel.org, Andy Shevchenko Subject: [PATCH v3 03/11] iio: light: cm32181: Add some extra register defines Date: Tue, 28 Apr 2020 19:29:15 +0200 Message-Id: <20200428172923.567806-3-hdegoede@redhat.com> In-Reply-To: <20200428172923.567806-1-hdegoede@redhat.com> References: <20200428172923.567806-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These come from a newer version of cm32181.c, which is floating around the net, with a copyright of: * Copyright (C) 2014 Capella Microsystems Inc. * Author: Kevin Tsai * * This program is free software; you can redistribute it and/or modify i= t * under the terms of the GNU General Public License version 2, as publis= hed * by the Free Software Foundation. Note that this removes the bogus CM32181_CMD_ALS_ENABLE define, there is no enable bit, only a disable bit and enabled is the absence of being disabled. This is a preparation patch for adding support for the older CM3218 model of the light sensor. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede --- drivers/iio/light/cm32181.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c index 5ca8bbf6667c..6fc0a753c499 100644 --- a/drivers/iio/light/cm32181.c +++ b/drivers/iio/light/cm32181.c @@ -18,6 +18,9 @@ =20 /* Registers Address */ #define CM32181_REG_ADDR_CMD 0x00 +#define CM32181_REG_ADDR_WH 0x01 +#define CM32181_REG_ADDR_WL 0x02 +#define CM32181_REG_ADDR_TEST 0x03 #define CM32181_REG_ADDR_ALS 0x04 #define CM32181_REG_ADDR_STATUS 0x06 #define CM32181_REG_ADDR_ID 0x07 @@ -26,9 +29,13 @@ #define CM32181_CONF_REG_NUM 0x01 =20 /* CMD register */ -#define CM32181_CMD_ALS_ENABLE 0x00 -#define CM32181_CMD_ALS_DISABLE 0x01 -#define CM32181_CMD_ALS_INT_EN 0x02 +#define CM32181_CMD_ALS_DISABLE BIT(0) +#define CM32181_CMD_ALS_INT_EN BIT(1) +#define CM32181_CMD_ALS_THRES_WINDOW BIT(2) + +#define CM32181_CMD_ALS_PERS_SHIFT 4 +#define CM32181_CMD_ALS_PERS_MASK (0x03 << CM32181_CMD_ALS_PERS_SHIFT) +#define CM32181_CMD_ALS_PERS_DEFAULT (0x01 << CM32181_CMD_ALS_PERS_SHIFT= ) =20 #define CM32181_CMD_ALS_IT_SHIFT 6 #define CM32181_CMD_ALS_IT_MASK (0x0F << CM32181_CMD_ALS_IT_SHIFT) @@ -82,7 +89,7 @@ static int cm32181_reg_init(struct cm32181_chip *cm3218= 1) return -ENODEV; =20 /* Default Values */ - cm32181->conf_regs[CM32181_REG_ADDR_CMD] =3D CM32181_CMD_ALS_ENABLE | + cm32181->conf_regs[CM32181_REG_ADDR_CMD] =3D CM32181_CMD_ALS_IT_DEFAULT | CM32181_CMD_ALS_SM_DEFAULT; cm32181->calibscale =3D CM32181_CALIBSCALE_DEFAULT; =20 --=20 2.26.0