Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3706612imm; Mon, 4 Jun 2018 08:02:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJzCQj69Aov1RZBedbzo3NfBbuwO9EGK7DSq4Ycw4hHGTkYADymK0ucaIovYS1Ofld7ZHKd X-Received: by 2002:a17:902:6b09:: with SMTP id o9-v6mr6708255plk.256.1528124543808; Mon, 04 Jun 2018 08:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528124543; cv=none; d=google.com; s=arc-20160816; b=0OYQOj558nOsgAKSeWUh2DwFtxYqOSWzjmL7jvdM7GAa8AbLk8LhnIWSbIv6wSwKpH pLXrz+yT5oD6gGMlrk7EVyz+YE+SyChMAbePuoDGnyS6Azr1L3l4gOBYZ1bosVF4CBDG 0uL+wfeR7dYgODfEQYY9BrOboYUkxIO4DW6AphcLEYKNMgJp6JjcyT5MJcFeTc+RBePG wfncu8ewqgfRoTQGlmN6C7luMQ7GPUOvhgONxHalhIguRHvZjDPidFjEc6+JeVG7OceS VX5oCfaQi/doPQ8c+zGl7HUd5dPrCbZ84+57WNw2K+Ik6wTPI0q5T2lNWdAANxr+qV0Q fBWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=jPDlnJybgWuu3Sop9lIczltp7g7fLwvhvf5e7iDBaOw=; b=OWsXvEvVZPOibAMqtx7yNh+ehmiu/g9uJ8BpB8Fw1RjGbmq2uUlNSZO2BSGw+wXZoA 3cWvA4jc6zV1Be7U3srx/kQc2McSF+GxZoapq9W9dkUF0/iJXGE/B3FDcXNsjJM3apex HyvGX+YjizkDu24x8Tt4MYUSYtxSc4ORl1Xpeuoxk2tWZ/owZQ5fwcJy4Ik0ekmACO+K Bn00w/IizguL1kgMBaWRjy51BRdCDorNFgCUEp7cdnc/s8PXdPfVJ4pXvBvMUCWktl2W 9Ii+cwMXDIAZuDly3mkRlBkmyJUKjUtF3l5CFAuVhCBnxqOLTbPg/b6kXbrMhoKzjn2z IaCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IYObzQeT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c3-v6si6650000pll.105.2018.06.04.08.02.02; Mon, 04 Jun 2018 08:02:23 -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; dkim=pass header.i=@linaro.org header.s=google header.b=IYObzQeT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753481AbeFDPBP (ORCPT + 99 others); Mon, 4 Jun 2018 11:01:15 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:37416 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751473AbeFDPBN (ORCPT ); Mon, 4 Jun 2018 11:01:13 -0400 Received: by mail-pg0-f65.google.com with SMTP id a13-v6so14561099pgu.4 for ; Mon, 04 Jun 2018 08:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jPDlnJybgWuu3Sop9lIczltp7g7fLwvhvf5e7iDBaOw=; b=IYObzQeTcb3tVRwUEb1S2jDe5mdqDmaQ5GPQBYmAlHz5rzmLZ85Fh82rWlb35xw2Is 86Zm6owGwetBYE07bSvDLFe+8BCpkmzAv1saeucSqz33gdqepnspNrWUGVzjwkuXZjSN CglMcpL9u8vrZ+nxp/o/gBBzy60BsuY7FtGbo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jPDlnJybgWuu3Sop9lIczltp7g7fLwvhvf5e7iDBaOw=; b=KS84QrermWla569RhwFI8qeuXAEZRXAp0u/Dab5tfUMe5YovGnwo7y5pMHN7MPwBYv 7uNbrGT5wsC/5sw3TtrPBCKoMSvhxwSRUTylVnTlb+aCtCEXZuRJ0bm3uOb8/nJ9k5/O AMhfYPJYXzgxIZZLeae7RQ6dQW2gKLzMljLMU4+VLHbzk0IVDaehS6z5yDo2C9NHlTJD tdStjV/Uw2EHAdsg5Iqs1IDdCV7ZqD1mCU6jSDV0wKjbKGwlXa3dI4eo8/sGYyAt1VZ8 6pgjgCky4T4e95w9BrsPDdWSxG50fRV8OhdTeTB64jwT9suakjOz0FkiFJeic2U5I6Ou jGNg== X-Gm-Message-State: ALKqPwcBDS8oOmPxIvPAl9WcZnpT7uaBlTPfJ3o0wmq0zv6hDBJdmQ9H f2DgF+vl/B45KXoOsnquAaE5fQ== X-Received: by 2002:a63:7e1b:: with SMTP id z27-v6mr17361558pgc.65.1528124472415; Mon, 04 Jun 2018 08:01:12 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id i72-v6sm91874656pfe.22.2018.06.04.08.01.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jun 2018 08:01:11 -0700 (PDT) Date: Mon, 4 Jun 2018 08:03:19 -0700 From: Bjorn Andersson To: Amit Kucheria Cc: linux-arm-msm@vger.kernel.org, rnayak@codeaurora.org, edubezval@gmail.com, Zhang Rui , Rob Herring , Mark Rutland , "open list:THERMAL" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list Subject: Re: [PATCH 1/2] thermal: tsens: Add support for SDM845 platform Message-ID: <20180604150319.GC510@tuxbook-pro> References: <7a0f33cff94f41110bdbff14d28d36074fae2a7d.1527937396.git.amit.kucheria@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7a0f33cff94f41110bdbff14d28d36074fae2a7d.1527937396.git.amit.kucheria@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat 02 Jun 04:11 PDT 2018, Amit Kucheria wrote: > diff --git a/drivers/thermal/qcom/tsens-sdm845.c b/drivers/thermal/qcom/tsens-sdm845.c [..] > +#define TRDY_OFFSET 0xe4 > +#define TRDY_READY_BIT BIT(1) This is bit 0. > + > +#define STATUS_OFFSET 0xa0 > +#define LAST_TEMP_MASK 0xfff > +#define STATUS_VALID_BIT BIT(21) > +#define CODE_SIGN_BIT BIT(11) > + > +static int get_temp_sdm845(struct tsens_device *tmdev, int id, int *temp) > +{ > + struct tsens_sensor *s = &tmdev->sensor[id]; > + u32 code; > + unsigned int sensor_addr; > + int last_temp = 0, last_temp2 = 0, last_temp3 = 0, ret; > + > + ret = regmap_read(tmdev->map, TRDY_OFFSET, &code); > + if (ret) > + return ret; > + if (code & TRDY_READY_BIT) > + return -ENODATA; This section is the only difference from 8996, but this register is identical to 8996 and 8998. So I think you should add this to tsens-8996.c and we can use that for 8996, 8998 and sdm845. Perhaps we should name it tsens-v2, as that seems to be the common denominator for these, according to the documentation. Regards, Bjorn