Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3081559pxf; Sun, 21 Mar 2021 18:21:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwt9aEmaLZPoJg+P59EjdX4csUx22J7uj4l4IEl5udpBAwP5+RiRmp+eQm8QTKOnNNbIe9A X-Received: by 2002:a17:906:edca:: with SMTP id sb10mr16285312ejb.398.1616376094382; Sun, 21 Mar 2021 18:21:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616376094; cv=none; d=google.com; s=arc-20160816; b=ua47EYFimdIarnSF1WW7tIxebOAPa74dUBGqAcbTXMWOVp3QLj+MF6Jqn10AGnzhaE RMGRZMm+ihe/4d530UdFJ12wtpAkmdWXCMpEGu6tZXN1Tsd/491U+XRJXZXDJdJX8J9D jn/BubKK0z4VW3bfFlV10EnvfEpy8m7vwh06QX2oPB+4qaDTAzRdbGTwIOqMA214Rvkm 7/gD5XrX3aJipglXatvANs8nSJSp1/P/hV5HKnLhlMJMOaLk0yqaRT3u/vW4NIZFJEdP 0sT8K99x/lyw4a6lbzb3NAP3aZZRJnjKpj/bP63kJTmJLrnQY2yG0NI72LrKYYuMQf37 ht9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=hfs7xVzInGDXwslEYQjd+qhYAguRi3oFAn1yP3BW/2k=; b=Gv/PrU/QZYRQzLLrkfKsI+xBt2dfPuE24q+2Bf+TT13TB0XSzS2uNF+lBjfZNMhs8V pgcgab+O4nX9vMc7RtQEAvVlIZXxGphZYrtGAmQSG84PG5YgTNrPkohBM9mCw2cP2pqj hhFvIHi5w6rcv2TQI34j1uP6ePhVxzWfha8N1WCZEUOzeWQN6Osl9JHLWCD24R4G7EJn d6wgULNc6+5wOnMTMEb+cabgP22FryzvDzG3+v3TPhSsVsM/wDfNhhNagYvK/0EM3Od7 Uik9eaO0RmLPw+gOOWggs0DvRqVQOKImPwsGhlZrG5X3wD9idpOcjVy5rWtVcuXQViaw KKuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=epkhX8fu; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi22si9866223edb.191.2021.03.21.18.21.10; Sun, 21 Mar 2021 18:21:34 -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=@linaro.org header.s=google header.b=epkhX8fu; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229614AbhCVBRz (ORCPT + 99 others); Sun, 21 Mar 2021 21:17:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229761AbhCVBRX (ORCPT ); Sun, 21 Mar 2021 21:17:23 -0400 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99939C061763 for ; Sun, 21 Mar 2021 18:17:22 -0700 (PDT) Received: by mail-qk1-x732.google.com with SMTP id c4so9068373qkg.3 for ; Sun, 21 Mar 2021 18:17:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=hfs7xVzInGDXwslEYQjd+qhYAguRi3oFAn1yP3BW/2k=; b=epkhX8fuq5xMIzNlsG9pKusuN9WWzHkBij7FO7Ihg7Rl40Ylexo0nq3Pb2fQpokwDS rAQxeBZ8Pkn+F6ocbic5mNgbOc5vp+yJUCrXQfl7gAvbiOpWrqSoUSs9R/jr8+qbdrkf JYS6qNQ4p+gsg7x3VNU92iXdHUOclSxS6hA3L1yl574BaGYpRL0b3NUoiZ12lu9b0fMm jDBflZWHzV5AB2tRcIl0HBrL1UV+xrJXXgAp8cj2c6tkDR4S9ZrwwaGQ/PAmxHi8Adsw N26w4xrc/jaRY8RWdHV5CPclm7jM/byeGC0zpeLR/i87NPXiDygQrKZF9qXmf9PzPGwh 4mMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=hfs7xVzInGDXwslEYQjd+qhYAguRi3oFAn1yP3BW/2k=; b=aw4Kt6IpBBZR+5mXSHYqoI2NivoFYlOWzFvtvioWQV+PzyTQZ9i9+VfrTm2uG4JJ4z 8IWeijeGAbDevFmRCSNq0BDyZYhljQTg2cd/zbt67bHvY/oAyi9lZrd2OI5x397OHGXN HDx30W9X2EU2MPDqYYP0l1b+gun/Lxabqx7/BT99IFhPXiAkUrpVBrYyiaBXW0f1ITgP AYDZ+q4YGvSC3xHeSIhf1MKRk/CRdo1aEQIqu40JRSa5FEhFbNl+v0itjQ67XgMaziAu Xy+5k4UHc/zYrkSmKs5HjT8aEusGiTY5+FlTyJ4gbRMcQQF5TDfarh0jJOlv78Ha0VbQ cLbA== X-Gm-Message-State: AOAM530y5t46yGRnt3YCndLmij3cWoOf73V+Z7A8obF79RCCWf/t8gJ+ OeT8nWiTU6wAF3m9T2XX4fUb8MJGtxHgjw== X-Received: by 2002:a37:a913:: with SMTP id s19mr9048401qke.158.1616375841339; Sun, 21 Mar 2021 18:17:21 -0700 (PDT) Received: from [192.168.1.93] (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.gmail.com with ESMTPSA id r133sm9993160qke.20.2021.03.21.18.17.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 Mar 2021 18:17:20 -0700 (PDT) Subject: Re: [PATCH v12 5/9] drivers: thermal: tsens: Fix bug in sensor enable for msm8960 To: Ansuel Smith Cc: Andy Gross , Bjorn Andersson , Amit Kucheria , Zhang Rui , Daniel Lezcano , Rob Herring , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210319181512.7757-1-ansuelsmth@gmail.com> <20210319181512.7757-6-ansuelsmth@gmail.com> From: Thara Gopinath Message-ID: <07ad8ee4-352f-57b6-c990-1410615e5798@linaro.org> Date: Sun, 21 Mar 2021 21:17:19 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210319181512.7757-6-ansuelsmth@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/19/21 2:15 PM, Ansuel Smith wrote: > Device based on tsens VER_0 contains a hardware bug that results in some > problem with sensor enablement. Sensor id 6-11 can't be enabled > selectively and all of them must be enabled in one step. > > Signed-off-by: Ansuel Smith Acked-by: Thara Gopinath Warm Regards Thara > --- > drivers/thermal/qcom/tsens-8960.c | 23 ++++++++++++++++++++--- > 1 file changed, 20 insertions(+), 3 deletions(-) > > diff --git a/drivers/thermal/qcom/tsens-8960.c b/drivers/thermal/qcom/tsens-8960.c > index 86585f439985..bf8dfaf06428 100644 > --- a/drivers/thermal/qcom/tsens-8960.c > +++ b/drivers/thermal/qcom/tsens-8960.c > @@ -27,9 +27,9 @@ > #define EN BIT(0) > #define SW_RST BIT(1) > #define SENSOR0_EN BIT(3) > +#define MEASURE_PERIOD BIT(18) > #define SLP_CLK_ENA BIT(26) > #define SLP_CLK_ENA_8660 BIT(24) > -#define MEASURE_PERIOD 1 > #define SENSOR0_SHIFT 3 > > /* INT_STATUS_ADDR bitmasks */ > @@ -126,17 +126,34 @@ static int resume_8960(struct tsens_priv *priv) > static int enable_8960(struct tsens_priv *priv, int id) > { > int ret; > - u32 reg, mask; > + u32 reg, mask = BIT(id); > > ret = regmap_read(priv->tm_map, CNTL_ADDR, ®); > if (ret) > return ret; > > - mask = BIT(id + SENSOR0_SHIFT); > + /* HARDWARE BUG: > + * On platform with more than 6 sensors, all the remaining > + * sensors needs to be enabled all togheder or underfined > + * results are expected. (Sensor 6-7 disabled, Sensor 3 > + * disabled...) In the original driver, all the sensors > + * are enabled in one step hence this bug is not triggered. > + */ > + if (id > 5) > + mask = GENMASK(10, 6); > + > + mask <<= SENSOR0_SHIFT; > + > + /* Sensors already enabled. Skip. */ > + if ((reg & mask) == mask) > + return 0; > + > ret = regmap_write(priv->tm_map, CNTL_ADDR, reg | SW_RST); > if (ret) > return ret; > > + reg |= MEASURE_PERIOD; > + > if (priv->num_sensors > 1) > reg |= mask | SLP_CLK_ENA | EN; > else >