Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1123625rdb; Mon, 19 Feb 2024 05:11:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUs3arJhWY3y5FwNCL62U/oAp8p1vVOGxPYJz/CxS8b03iH79rvFOb6cTfoJRCfdEuGoD4WZlqGdI+wnLmGNMtRp0MncH25yt6gG98PMg== X-Google-Smtp-Source: AGHT+IHv942A1a67D69j8iawfZg9kVUhkS8zb5Jk8H33nWoiyjYv/4QQQWC8aczb7xc4RVqXBWkp X-Received: by 2002:a05:6a00:2da6:b0:6e3:b4a5:4b53 with SMTP id fb38-20020a056a002da600b006e3b4a54b53mr5172092pfb.24.1708348302047; Mon, 19 Feb 2024 05:11:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708348302; cv=pass; d=google.com; s=arc-20160816; b=v53QF9wGJKpsYI4nkp/T7k4pvq4ET4keQ/0gCWp3L0FSRRGpc2q2vH0YZy5BQwf0es cIMy1xX+gcdDCvkwi1ldW96lzCxspoSHYwKMw4ybBFHC7NRQmhShmEokgyGg7bVOszgn lwCY/1+68T6d61KnAaHuZtgbabqL+V1AwV87hwv+70dcmwqUmeYPnzxXoFkrrmnps5xK eIw0mEkhm7b7Ae0qAiruycIhSNL5w2axH5ZtT2DSmsqLPmiM1ZA7fJxG9EOhlVjjt627 vy83j5g7MFyUbnRN3GI8GsqZDnRq+6+FQ6GLM87Wab6QEBr+IWIeq7s57GLZoXX24ZI+ Ktrw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=6+8zMw/V2WyWn4suHeG+pg/g1CLU/k+KKgRI3SCFTrE=; fh=pxWzaSNjUAXZ4Spp2WxCoh8j4W7Aqh8wQQqkvGk8F7I=; b=jT6khWcuyAJrKuVSFWz9VTtRV4p3cJTm2UIAcqFV1QmBh5F19jZj8/NDxIqDb1U8Jo vbQltNN+ql9Kg11vJlosZaMb8uScfTWD8voclIkyxANiPFKOyaX9HyaCQv2oBBRXlRgf 4+4cEgNkMVDtFCCDZMRQiJ67uf5ija03zRU3P610n6Zsiu0uEwYNRB2TR5yx5fseRNvX p3IVFgxRyCHjeCg0pcJbMGsDf6j6y6qlgisCHp+EwJIDGGj51f3VAuchJsGfxmWWYKqj Sf51D3i5aprTbv6fA4ouLc+O6JYj7++QcytmqKWrklOQLFniSmdBiTOvKJsTxbKQaeoM YlgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-71384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71384-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f8-20020a056a00238800b006e464571dcesi1528097pfc.310.2024.02.19.05.11.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 05:11:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-71384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71384-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BEF0A281E47 for ; Mon, 19 Feb 2024 13:11:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0312B3613E; Mon, 19 Feb 2024 13:11:33 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C56034CDE for ; Mon, 19 Feb 2024 13:11:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708348292; cv=none; b=p3vDRi7izu4cRHL4a9P632/R9T29cfqL4S9RiCerM5zLEVLOtMbVybgCHf4cn86v4FScR0aVl0InBkThwJ0bRLdB70SglndDoCjXz5VVJAqhyk1NuHYTO27EOjBsa96zL1tesO0J5E1u0SJ2D5MxjWR6kPet93QS81eEd5XENME= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708348292; c=relaxed/simple; bh=UGeUyFN19bQZCVUzkNSWfD9kVi6j0pXHg2utyZmuIao=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=knQ2pc4fOkAeyljNSjs0qKks+tXkuBNzMyDi0+CZb0wefQmU+Nx/XblXmmDQk7Uky0OJif9Z1khQ47mj/wyVYnt9k+7fhNEaEL7zhKuOvW4Xum+iHMT2WLYNdpNlSDiDlSEAe95mFy08/oSWEyUEhK2j7F3kJBWRBn4TvqHgEFQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1rc3QT-0005bN-NU; Mon, 19 Feb 2024 14:11:17 +0100 From: Marco Felsch To: puranjay12@gmail.com, jic23@kernel.org, lars@metafoo.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v2 2/2] iio: temperature: tmp117: add support for vcc-supply Date: Mon, 19 Feb 2024 14:11:14 +0100 Message-Id: <20240219131114.134607-2-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240219131114.134607-1-m.felsch@pengutronix.de> References: <20240219131114.134607-1-m.felsch@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::28 X-SA-Exim-Mail-From: m.felsch@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org From: Thomas Haemmerle Add support to specify the VCC supply which is required to power the device. According the datasheet 7.3.1 Power Up, the device needs 1.5ms after the supply voltage reaches the operating range before the communcation can begin. Signed-off-by: Thomas Haemmerle Signed-off-by: Marco Felsch --- v2: - add fsleep() after powering the device drivers/iio/temperature/tmp117.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iio/temperature/tmp117.c b/drivers/iio/temperature/tmp117.c index 059953015ae7..8972083d903a 100644 --- a/drivers/iio/temperature/tmp117.c +++ b/drivers/iio/temperature/tmp117.c @@ -9,6 +9,7 @@ * Note: This driver assumes that the sensor has been calibrated beforehand. */ +#include #include #include #include @@ -17,6 +18,7 @@ #include #include #include +#include #include @@ -148,10 +150,17 @@ static int tmp117_probe(struct i2c_client *client) struct tmp117_data *data; struct iio_dev *indio_dev; int dev_id; + int ret; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) return -EOPNOTSUPP; + ret = devm_regulator_get_enable(&client->dev, "vcc"); + if (ret) + return ret; + + fsleep(1500); + dev_id = i2c_smbus_read_word_swapped(client, TMP117_REG_DEVICE_ID); if (dev_id < 0) return dev_id; -- 2.39.2