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=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 73C4DC3A5A9 for ; Mon, 4 May 2020 12:56:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4EFF220757 for ; Mon, 4 May 2020 12:56:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="V1r9vNS8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728684AbgEDM4o (ORCPT ); Mon, 4 May 2020 08:56:44 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:59975 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728750AbgEDM4n (ORCPT ); Mon, 4 May 2020 08:56:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588597002; 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=zdoAPMMfe24mTwVjDko1SkzfD+tlNXgnVHLr6w+1dUs=; b=V1r9vNS86D4P2EVHoQsDz1pALg/t1JpmSTGFwUQZqmtDw6PlfcIUejlT4gae+7JUbh6fYz FpBG8jslHch37mHPFpvPIEGOLroN+LPXnndm3OKYH1aa6rLsRzv4B5ds73XYPmLRTm6qtF ec5uI0KaRgSR7Q6z+zHKWERJBOjm4AA= 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-226-iTtFHvLcOz20suKCeyxdSQ-1; Mon, 04 May 2020 08:56:38 -0400 X-MC-Unique: iTtFHvLcOz20suKCeyxdSQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF12BBFCC; Mon, 4 May 2020 12:56:29 +0000 (UTC) Received: from x1.localdomain.com (ovpn-114-224.ams2.redhat.com [10.36.114.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2552A5D9D5; Mon, 4 May 2020 12:56:26 +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 v4 09/11] iio: light: cm32181: Make lux_per_bit and lux_per_bit_base_it runtime settings Date: Mon, 4 May 2020 14:55:49 +0200 Message-Id: <20200504125551.434647-9-hdegoede@redhat.com> In-Reply-To: <20200504125551.434647-1-hdegoede@redhat.com> References: <20200504125551.434647-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Content-Transfer-Encoding: quoted-printable Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Make lux_per_bit and lux_per_bit_base_it settings stored in struct cm32181_chip instead of a hardcoded (defined) values. This is a preparation patch for reading some ACPI tables which specify a device specific lux_per_bit value. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede --- drivers/iio/light/cm32181.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c index 59c95e22ad00..a0812e3cba9b 100644 --- a/drivers/iio/light/cm32181.c +++ b/drivers/iio/light/cm32181.c @@ -67,6 +67,8 @@ struct cm32181_chip { u16 conf_regs[CM32181_CONF_REG_NUM]; unsigned long init_regs_bitmap; int calibscale; + int lux_per_bit; + int lux_per_bit_base_it; }; =20 /* CM3218 Family */ @@ -129,6 +131,8 @@ static int cm32181_reg_init(struct cm32181_chip *cm32= 181) CM32181_CMD_ALS_IT_DEFAULT | CM32181_CMD_ALS_SM_DEFAULT; cm32181->init_regs_bitmap =3D BIT(CM32181_REG_ADDR_CMD); cm32181->calibscale =3D CM32181_CALIBSCALE_DEFAULT; + cm32181->lux_per_bit =3D CM32181_LUX_PER_BIT; + cm32181->lux_per_bit_base_it =3D CM32181_LUX_PER_BIT_BASE_IT; =20 /* Initialize registers*/ for_each_set_bit(i, &cm32181->init_regs_bitmap, CM32181_CONF_REG_NUM) { @@ -225,8 +229,8 @@ static int cm32181_get_lux(struct cm32181_chip *cm321= 81) if (ret < 0) return -EINVAL; =20 - lux =3D CM32181_LUX_PER_BIT; - lux *=3D CM32181_LUX_PER_BIT_BASE_IT; + lux =3D cm32181->lux_per_bit; + lux *=3D cm32181->lux_per_bit_base_it; lux =3D div_u64(lux, als_it); =20 ret =3D i2c_smbus_read_word_data(client, CM32181_REG_ADDR_ALS); --=20 2.26.0