From patchwork Wed May 11 21:47:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markuss Broks X-Patchwork-Id: 571867 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 258B1C43219 for ; Wed, 11 May 2022 21:48:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348341AbiEKVsB (ORCPT ); Wed, 11 May 2022 17:48:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348348AbiEKVsA (ORCPT ); Wed, 11 May 2022 17:48:00 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68793377DC; Wed, 11 May 2022 14:47:59 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id w19so5791899lfu.11; Wed, 11 May 2022 14:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ot1LRa7lM+k3YsGeal4v34AufyNdy0MxZF/OmP8vaTY=; b=AXb14pPDMmOnkzOW5Lh2mzzjaK3MQWIL1k2wk9OIijlmqSbif8CGPVbuHO3N2gETCX 7wIDFgrSlLykhOrVG44eZ7CsNDS4H4NI5xFMCReT1EpftaiJUFdYySx/ouXKBLiXTkAx Gj7uViLfmAzrs98knICHzwPD27pUoxjVzm3UxddGr/rdd9dfvFFqbRU0J8smGlWETWzQ f5F7v12nmYcaeBEhLkQWP3dv8RAhViLZFt8/0J7tLJlCWEPmFx+gYTOYlwwUaTrzh0NR 1BFL5JuPVWfWHefVmoxpJmAvePkGP5oiCISvHMxqcq5Y4eelOqO73CT2fyQicKgh55fg 6kVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ot1LRa7lM+k3YsGeal4v34AufyNdy0MxZF/OmP8vaTY=; b=IPcwNeNUnB3md6zKHViL5Tlzb4IP5GrRefVwmZNH7neP3n1HSn/IBFW8xIwz5Sb2uA m6QGbAuD5fDK1WAIYhgGpq26alR86vbGE3b/ELJJdATcT+yiWCBgZXHiNKvPtlXqXRHO 1JVnAIBK4QDU1XjU5I0TqJhKWMN9SWofwHz0ziS1tJEA4YtWij/6AW85NafxxW/tjVvq gsjHMKbpwJby7H1w+uns3ckqfzkGKi24WmRNOaONlwGJQ/8clwlOepMcSJ1oEWyQOdci d9M4PW6+Nro2TKeaL3bhEn0tw14X3O6r5axC5U6ujkkoSlujrEpyB0Dok+w3/QKjpcbD TLpg== X-Gm-Message-State: AOAM533Ng+ZrlFFjqH3SbI9rjakXrJ78V1wjJXoBgjzOZXc14Ccx1iHW rXfmHhGR/6lT0LgbM1JEzL4zzbnvfn74mw== X-Google-Smtp-Source: ABdhPJznrkNMCxkMVOHw42H3DIgPFE5g6Y+i/C5ffxDgMZRnF5Av2ptrqegNJ8hHfvkCPPJ71IhRjQ== X-Received: by 2002:a05:6512:3e0c:b0:473:a933:da27 with SMTP id i12-20020a0565123e0c00b00473a933da27mr20191310lfv.574.1652305677582; Wed, 11 May 2022 14:47:57 -0700 (PDT) Received: from nergzd-desktop.localdomain ([194.39.226.133]) by smtp.gmail.com with ESMTPSA id 7-20020ac25687000000b0047255d211afsm458891lfr.222.2022.05.11.14.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 14:47:56 -0700 (PDT) From: Markuss Broks To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Markuss Broks , Konrad Dybcio , Marijn Suijten , AngeloGioacchino Del Regno , Song Qiang , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 1/5] dt-bindings: proximity: vl53l0x: Document optional supply and GPIO properties Date: Thu, 12 May 2022 00:47:13 +0300 Message-Id: <20220511214718.50879-2-markuss.broks@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220511214718.50879-1-markuss.broks@gmail.com> References: <20220511214718.50879-1-markuss.broks@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This patch adds the optional properties for the VL53L0X ToF sensor to the device-tree binding. Signed-off-by: Markuss Broks Acked-by: Krzysztof Kozlowski --- .../devicetree/bindings/iio/proximity/st,vl53l0x.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/proximity/st,vl53l0x.yaml b/Documentation/devicetree/bindings/iio/proximity/st,vl53l0x.yaml index 656460d9d8c8..322befc41de6 100644 --- a/Documentation/devicetree/bindings/iio/proximity/st,vl53l0x.yaml +++ b/Documentation/devicetree/bindings/iio/proximity/st,vl53l0x.yaml @@ -19,6 +19,11 @@ properties: interrupts: maxItems: 1 + reset-gpios: + maxItems: 1 + + vdd-supply: true + required: - compatible - reg From patchwork Wed May 11 21:47:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markuss Broks X-Patchwork-Id: 571552 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 803FFC4332F for ; Wed, 11 May 2022 21:48:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348374AbiEKVsF (ORCPT ); Wed, 11 May 2022 17:48:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348356AbiEKVsC (ORCPT ); Wed, 11 May 2022 17:48:02 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED3E23A713; Wed, 11 May 2022 14:48:01 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id b18so5809921lfv.9; Wed, 11 May 2022 14:48:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f6sP9MF85LQx8etkhW8eLxgPVA9IUY3TDzhnSN1EZPw=; b=YdVL6LTNJ4dkgB022mJ/gKM2nagkNpdgVkfKhfYl8vSc5F/ohVlcqOAObbEVCLvIX7 Y4bYVAcyPhixmN/+Xt5xiWmeyvNWEWfhoCTZ3rfAXx3guPKg2mrGE/Bg8ZMKR9O15SA4 JJsZJeu5ADIjdIA4mR6TUv2mwOvbk9Pr9MEJ7YUPpIsf1pS9Tt+V35DUflCnpHCQ7H/r EDXCCdODgGr7YeeiGJetPyiZaL3kJmQ6P5N9DBwZyuMNnf6NmpNzhOChqOPvZ3QgclcL KkcrXVnx6BqY9WI/BFTgW+9srPwJJGxnPROZt8VyWB24GW//ekz/Fnd6mew+bOcUIcbH mh+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f6sP9MF85LQx8etkhW8eLxgPVA9IUY3TDzhnSN1EZPw=; b=CgdijX9/EmQDqIxSVSvMDwc8FtCZdR5XRfiaMq7xx1vPTH8dgoo4BQqbZu+qjDFq3E OLPm5JK/es6BDiUhUM6csA7FQDySw1lJsME6T6jxUKy70ofNMbvHulZFQj23x53XSEPH 4BCWBBJRQhEScdrQsW7YE+SuCPjt2SBpYWBGcyn3jLgUpYQXnFel1mYfbCgwMqPDkl7S NnjTWiBrmXlIimT1Ub4lfvLjyLYwWl1yctoFyPLcKEwAMANj8+ZQtidFEcBFPBl8r710 9coTP8kV2F2d1jwCfZa0G+gn49CMk3Jh9sMTDIiXJyQcnLDljbXQaM05YZekT9E4b32i Ht6Q== X-Gm-Message-State: AOAM532AyGvpyIHFjo/iMmYAfdiglgpw60NelIH0/VJhYhTkISNd/5Xd VGOiCXgeFVWDARdnc/+uOSi3IQHucbu5cA== X-Google-Smtp-Source: ABdhPJzhaCRyTq1lrGTwMT9IazMt+jljd13/6bLx9BQpIW7V0d7af8al0lsKYABtrAlGNKKiPhDGXQ== X-Received: by 2002:a05:6512:3c8:b0:474:2645:f42b with SMTP id w8-20020a05651203c800b004742645f42bmr12726743lfp.126.1652305680084; Wed, 11 May 2022 14:48:00 -0700 (PDT) Received: from nergzd-desktop.localdomain ([194.39.226.133]) by smtp.gmail.com with ESMTPSA id 7-20020ac25687000000b0047255d211afsm458891lfr.222.2022.05.11.14.47.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 14:47:59 -0700 (PDT) From: Markuss Broks To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Markuss Broks , Konrad Dybcio , Marijn Suijten , AngeloGioacchino Del Regno , Song Qiang , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 2/5] proximity: vl53l0x: Prefer already initialized interrupt flags Date: Thu, 12 May 2022 00:47:14 +0300 Message-Id: <20220511214718.50879-3-markuss.broks@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220511214718.50879-1-markuss.broks@gmail.com> References: <20220511214718.50879-1-markuss.broks@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On some boards interrupt type might be different than falling edge, like hardcoded in driver. Leave interrupt flags as they were pre-configured from the device-tree. If they're not provided, default to falling edge interrupts. Signed-off-by: Markuss Broks Reported-by: kernel test robot --- drivers/iio/proximity/vl53l0x-i2c.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c index 661a79ea200d..ef2c063dfa1c 100644 --- a/drivers/iio/proximity/vl53l0x-i2c.c +++ b/drivers/iio/proximity/vl53l0x-i2c.c @@ -57,11 +57,15 @@ static irqreturn_t vl53l0x_handle_irq(int irq, void *priv) static int vl53l0x_configure_irq(struct i2c_client *client, struct iio_dev *indio_dev) { + int irq_flags = irq_get_trigger_type(client->irq); struct vl53l0x_data *data = iio_priv(indio_dev); int ret; + if (!irq_flags) + irq_flags = IRQF_TRIGGER_FALLING; + ret = devm_request_irq(&client->dev, client->irq, vl53l0x_handle_irq, - IRQF_TRIGGER_FALLING, indio_dev->name, indio_dev); + irq_flags, indio_dev->name, indio_dev); if (ret) { dev_err(&client->dev, "devm_request_irq error: %d\n", ret); return ret; From patchwork Wed May 11 21:47:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markuss Broks X-Patchwork-Id: 571866 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BCEAC433EF for ; Wed, 11 May 2022 21:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348363AbiEKVsH (ORCPT ); Wed, 11 May 2022 17:48:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348367AbiEKVsF (ORCPT ); Wed, 11 May 2022 17:48:05 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 665563C70B; Wed, 11 May 2022 14:48:03 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id bq30so5863672lfb.3; Wed, 11 May 2022 14:48:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1Ch9koX2JfsEbf0kLPJgbDufXDAbUbg6Kpk+d6uErWA=; b=fwQ06umLfUwIkrFAgaUfU/GVG6IVp4m6m5fjhJBxP/nKzvlgb8WnaHd/BwE0y1f20k 2qScdUbD3cVMKup1RI+1sl/DToj2l4SRO7EVCwGv1rjtr0BuoIfVlsLGt9AIfoyn1dCM paAayfdU+0v5CrB2d3AMZqBP6KV+Hp6+pw8Usds2rf604o9h8OzwB40T2PlhMgiZ4Tvn hb8MNxdmoQBZfUa83IYuJD+BZvNQWXNqD8VzRSu8IqNGxTHuS0dHpPbGX2vt3yAIqIe2 2Vgv9qE58979QkFvjkzsqrGmyorlSPLJG0SMk43L3i+nH01nqrItxjlojz4+4p5JsMlx mkMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1Ch9koX2JfsEbf0kLPJgbDufXDAbUbg6Kpk+d6uErWA=; b=A08N+3LT6gz91EUhFOF2tLSX+03sz3h3jCFZAyz1Q8QQSRl6tVtCC4Zwb67puWt6K8 KTyUVgi8zD4YUzHzWHY0o0okG6zm/SjTYl32orWsTgsdYGqTGJ34ViH4j6KT2ut9WWF6 UAsNbFt4/MitonrlNAniO3fCWM7s4cWsPDrl0mPoX7ULV//ODfuR3UNBBt4L6Eq2Imrb LpD3IlevVRaJCCkFC6XN93p81ZxBsY8cpVjkPIOX7OVH2TB0pI5AQVVIeUChgmf3imFd KqhYYQ14BAr3uxaSB/Jj7ooWwesQ/8vbBUVEUy+paOBmWV1/At7GZktAjOYgqpFfMPH/ hHOA== X-Gm-Message-State: AOAM532qXwdTp8Y/+7nnJlyJ2Qmz8oXvSS0UhsX90/Y5xtcps3CNaDsM 5Yp/lwh/wYLRB1xFW96+UPFe1uiH5vw28w== X-Google-Smtp-Source: ABdhPJz2b0cJ5q2w7qZIokN9SyTCOboNmFsOBoOJCId5h5/LZtXqKM5Ch7gJtMGk5IZquehFOu2IsQ== X-Received: by 2002:a05:6512:39c1:b0:472:556e:b297 with SMTP id k1-20020a05651239c100b00472556eb297mr21527917lfu.564.1652305682710; Wed, 11 May 2022 14:48:02 -0700 (PDT) Received: from nergzd-desktop.localdomain ([194.39.226.133]) by smtp.gmail.com with ESMTPSA id 7-20020ac25687000000b0047255d211afsm458891lfr.222.2022.05.11.14.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 14:48:02 -0700 (PDT) From: Markuss Broks To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Markuss Broks , Konrad Dybcio , Marijn Suijten , AngeloGioacchino Del Regno , Song Qiang , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 3/5] proximity: vl53l0x: Handle the VDD regulator Date: Thu, 12 May 2022 00:47:15 +0300 Message-Id: <20220511214718.50879-4-markuss.broks@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220511214718.50879-1-markuss.broks@gmail.com> References: <20220511214718.50879-1-markuss.broks@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Handle the regulator supplying the VDD pin of VL53L0X. Signed-off-by: Markuss Broks --- drivers/iio/proximity/vl53l0x-i2c.c | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c index ef2c063dfa1c..e65c4fcd32d6 100644 --- a/drivers/iio/proximity/vl53l0x-i2c.c +++ b/drivers/iio/proximity/vl53l0x-i2c.c @@ -42,6 +42,7 @@ struct vl53l0x_data { struct i2c_client *client; struct completion completion; + struct regulator *vdd_supply; }; static irqreturn_t vl53l0x_handle_irq(int irq, void *priv) @@ -191,10 +192,31 @@ static const struct iio_info vl53l0x_info = { .read_raw = vl53l0x_read_raw, }; +static void vl53l0x_power_off(void *_data) +{ + struct vl53l0x_data *data = _data; + + regulator_disable(data->vdd_supply); +} + +static int vl53l0x_power_on(struct vl53l0x_data *data) +{ + int ret; + + ret = regulator_enable(data->vdd_supply); + if (ret) + return ret; + + usleep_range(3200, 5000); + + return 0; +} + static int vl53l0x_probe(struct i2c_client *client) { struct vl53l0x_data *data; struct iio_dev *indio_dev; + int error; indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); if (!indio_dev) @@ -209,6 +231,21 @@ static int vl53l0x_probe(struct i2c_client *client) I2C_FUNC_SMBUS_BYTE_DATA)) return -EOPNOTSUPP; + data->vdd_supply = devm_regulator_get_optional(&client->dev, "vdd"); + if (IS_ERR(data->vdd_supply)) + return dev_err_probe(&client->dev, PTR_ERR(data->vdd_supply), + "Unable to get VDD regulator\n"); + + error = devm_add_action_or_reset(&client->dev, vl53l0x_power_off, data); + if (error) + return dev_err_probe(&client->dev, error, + "Failed to install poweroff action\n"); + + error = vl53l0x_power_on(data); + if (error) + return dev_err_probe(&client->dev, error, + "Failed to power on the chip\n"); + indio_dev->name = "vl53l0x"; indio_dev->info = &vl53l0x_info; indio_dev->channels = vl53l0x_channels; From patchwork Wed May 11 21:47:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markuss Broks X-Patchwork-Id: 571865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7176DC433FE for ; Wed, 11 May 2022 21:48:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348414AbiEKVsZ (ORCPT ); Wed, 11 May 2022 17:48:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348390AbiEKVsL (ORCPT ); Wed, 11 May 2022 17:48:11 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9D7D443E9; Wed, 11 May 2022 14:48:06 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id 4so4227209ljw.11; Wed, 11 May 2022 14:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NBwjBAjLmyyb61HAFn6uQh2uqKVzaEjVLl9vH6ELw+E=; b=mOi4Dfi99gDfBK3ToAmlb5QrQRONhoKohrWOS9c2HiM4BhUSyr29iX0z/t5Ydp+WES W0XlU8Fk6U4kqDbKtk7Vca8Ey9eAaMexZHe2p6ktCPnX3GSZMC/2syypz8i7prAvwpLg N3KO1IsL3HRqt3KD2oBwOMNuP0609LXl0ZHJDBxuoXS2WduHkR5rCbqJNxkeAw0Ila5S 0eCrfjPaXZVxUN9dseKkgGpkdRuCM4wkJlV5mq0AIy6uEgDSUxxhkwqvbMzcaPuWIi3G co8EgTvVUUC0TkxTN84UHl0g6vB3Uq9iZHrpGa4MKofWl9pdwPjQfI4Lp/cnBsRIFjnQ vN5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NBwjBAjLmyyb61HAFn6uQh2uqKVzaEjVLl9vH6ELw+E=; b=Od7Q6UnilOl4pG/rsl9eNNgzuPtkspwCCg4FXXqxaBYltoP+PV6/tXQ7Xy6TiNnIJB VrCR4WJpmmXmhc+UVWHHZc20LN7ZcTuCMwzinKIcufYvkloiK6amvyaom9gf/r1YXzrO rIHFei1paHJnvy3HCD1xO2XYMGFi+k9QR/foQFu8O2QSGaiOxv8FpFstQsD+DTitRIR4 ZJ0faPzltoG1WWsTcCx7fHwOoZlVmV+lvN5vT4usC11c+gHFFEwSsdfE/hH5VRt9JDeO 2AhZI8m/tx/boQW/VpOES+37x3V3/UBz3gYTUhfIQuR8nnCJYamzpvvZN2NepDFdvB1c 5P+g== X-Gm-Message-State: AOAM532gHrLT1OCCWDT7h7rF4mr0okxsjTC+xQAO/9Ai/zf4BQpU3Sbc ZLDKq7eXIuiaWIz4sDqch5Ygo02nn//JGQ== X-Google-Smtp-Source: ABdhPJzosFUsYOVsuX/mjcjoJuWYO84mt3rxQER1lfHU04D5qsfYeQYBlRyAhlKmkft0FBo6Xn10fA== X-Received: by 2002:a2e:351a:0:b0:24f:c3b:c2d5 with SMTP id z26-20020a2e351a000000b0024f0c3bc2d5mr17529744ljz.505.1652305685206; Wed, 11 May 2022 14:48:05 -0700 (PDT) Received: from nergzd-desktop.localdomain ([194.39.226.133]) by smtp.gmail.com with ESMTPSA id 7-20020ac25687000000b0047255d211afsm458891lfr.222.2022.05.11.14.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 14:48:04 -0700 (PDT) From: Markuss Broks To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Markuss Broks , Konrad Dybcio , Marijn Suijten , AngeloGioacchino Del Regno , Song Qiang , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 4/5] proximity: vl53l0x: Handle the reset GPIO Date: Thu, 12 May 2022 00:47:16 +0300 Message-Id: <20220511214718.50879-5-markuss.broks@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220511214718.50879-1-markuss.broks@gmail.com> References: <20220511214718.50879-1-markuss.broks@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Handle the GPIO connected to the XSHUT/RST_N pin of VL53L0X. Signed-off-by: Markuss Broks --- drivers/iio/proximity/vl53l0x-i2c.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c index e65c4fcd32d6..7aa9c1e95006 100644 --- a/drivers/iio/proximity/vl53l0x-i2c.c +++ b/drivers/iio/proximity/vl53l0x-i2c.c @@ -15,6 +15,7 @@ */ #include +#include #include #include #include @@ -43,6 +44,7 @@ struct vl53l0x_data { struct i2c_client *client; struct completion completion; struct regulator *vdd_supply; + struct gpio_desc *reset_gpio; }; static irqreturn_t vl53l0x_handle_irq(int irq, void *priv) @@ -196,6 +198,8 @@ static void vl53l0x_power_off(void *_data) { struct vl53l0x_data *data = _data; + gpiod_set_value_cansleep(data->reset_gpio, 1); + regulator_disable(data->vdd_supply); } @@ -207,6 +211,8 @@ static int vl53l0x_power_on(struct vl53l0x_data *data) if (ret) return ret; + gpiod_set_value_cansleep(data->reset_gpio, 0); + usleep_range(3200, 5000); return 0; @@ -236,6 +242,11 @@ static int vl53l0x_probe(struct i2c_client *client) return dev_err_probe(&client->dev, PTR_ERR(data->vdd_supply), "Unable to get VDD regulator\n"); + data->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(data->reset_gpio)) + return dev_err_probe(&client->dev, PTR_ERR(data->reset_gpio), + "Cannot get reset GPIO\n"); + error = devm_add_action_or_reset(&client->dev, vl53l0x_power_off, data); if (error) return dev_err_probe(&client->dev, error, From patchwork Wed May 11 21:47:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markuss Broks X-Patchwork-Id: 571551 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80729C4332F for ; Wed, 11 May 2022 21:48:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348419AbiEKVs0 (ORCPT ); Wed, 11 May 2022 17:48:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348382AbiEKVsU (ORCPT ); Wed, 11 May 2022 17:48:20 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71AD6515B0; Wed, 11 May 2022 14:48:10 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id d15so5854697lfk.5; Wed, 11 May 2022 14:48:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qjFTO1D1EZDKKiJccbHJv6i5BuHy5bt8K51ddMuen78=; b=gXg11SMVbS7MdGdULt0/Q2dwr+lb6VgC7aQA1IJ7Lz0N+iATdF4knANd0/t3M28n5m 27Rk+OdfyoNSV56ollhWuGjeOcp86A0fl8L0MUVaILWc9NSyrFA38ssX11IURCZmbHFK gSYxLBNLZoDj7L3UKIB2NSCCytNtSVkU1wcGKFnbrSs/H+2x/QjdGAsSijB/4TRQQCfR DzsYUSa1hLUgh6q8HxRHyDhNa8WQKW8kS26s7BCf8tEB09kBxnumEZtN9S7mJMudlVXJ kOE/KmcVR14QrlgDbPAjfX1ow3cK67Q1Rn32FUg5EFywEmIHU9Pit656mZ+aTxVkcPX0 8rmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qjFTO1D1EZDKKiJccbHJv6i5BuHy5bt8K51ddMuen78=; b=5jPBqL/LyiRojauO/1raxB3kxc6gR7dLpKXCMQFr5+sYF2xGJVYYwWdRqxOjfMIZsG 5T/QuojPEoOp/QrFivxiTIKb6SBN352cB6dGr32HyaUj1TLHMUikIKepfipNCn2Pb3OH rrie40YDB8OkiG2QwoGT47ZEhPXCtJgfhW7G0ndbfN6im6oENuN0h/JNqUo29sAjAidR 0PAUu5KXyelJ+6xMyoLlWZkF3+3D+l/SdBoTLWYVSpVrpViXUDIS4bEjCPdWgUohf33m DNVM2Xk5WhJsI4dRjzhu/KIVp/asw4uwLfjWnApbe4cPqJ9fll/h+Oza/wwcu1QFQpzg dBnQ== X-Gm-Message-State: AOAM531PJA+5ls2dRzbEc72M2GT7EQYxR1yUFNnha+vAshDyK/6EkBhC ASsmRkg4R57I/bYiVgI9i+ZyToM/bFRrIQ== X-Google-Smtp-Source: ABdhPJyYNFiN9PteQqRh87oyzawDjvUiMWjw4JDEft2h/aD+ItAVOoshpTcGYPYGo7KqG2JM6BlLZQ== X-Received: by 2002:a05:6512:12c3:b0:473:c7e2:b46b with SMTP id p3-20020a05651212c300b00473c7e2b46bmr21650100lfg.382.1652305688674; Wed, 11 May 2022 14:48:08 -0700 (PDT) Received: from nergzd-desktop.localdomain ([194.39.226.133]) by smtp.gmail.com with ESMTPSA id 7-20020ac25687000000b0047255d211afsm458891lfr.222.2022.05.11.14.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 14:48:08 -0700 (PDT) From: Markuss Broks To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Markuss Broks , Konrad Dybcio , Marijn Suijten , AngeloGioacchino Del Regno , Song Qiang , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 5/5] arm64: dts: qcom: msm8998-xperia: Introduce ToF sensor support Date: Thu, 12 May 2022 00:47:17 +0300 Message-Id: <20220511214718.50879-6-markuss.broks@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220511214718.50879-1-markuss.broks@gmail.com> References: <20220511214718.50879-1-markuss.broks@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This patch adds device tree support for the VL53L0X ToF sensor found on all Yoshino devices. Signed-off-by: Markuss Broks --- .../dts/qcom/msm8998-sony-xperia-yoshino.dtsi | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino.dtsi b/arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino.dtsi index 47488a1aecae..a95fa29aa18b 100644 --- a/arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino.dtsi @@ -245,6 +245,24 @@ &blsp2_uart1 { status = "okay"; }; +&blsp2_i2c2 { + status = "okay"; + + proximity@29 { + compatible = "st,vl53l0x"; + reg = <0x29>; + + interrupt-parent = <&tlmm>; + interrupts = <22 IRQ_TYPE_EDGE_FALLING>; + + reset-gpios = <&tlmm 27 GPIO_ACTIVE_LOW>; + vdd-supply = <&cam_vio_vreg>; + + pinctrl-names = "default"; + pinctrl-0 = <&tof_int &tof_reset>; + }; +}; + &ibb { regulator-min-microamp = <800000>; regulator-max-microamp = <800000>; @@ -621,6 +639,21 @@ hall_sensor0_default: acc-cover-open { input-enable; }; + tof_int: tof-int { + pins = "gpio22"; + function = "gpio"; + bias-pull-up; + drive-strength = <2>; + input-enable; + }; + + tof_reset: tof-reset { + pins = "gpio27"; + function = "gpio"; + bias-disable; + drive-strength = <2>; + }; + ts_int_n: ts-int-n { pins = "gpio125"; function = "gpio";