From nobody Sat Sep 13 06:12:55 2025 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 D01EEC05027 for ; Fri, 3 Feb 2023 23:13:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232755AbjBCXN4 (ORCPT ); Fri, 3 Feb 2023 18:13:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbjBCXNy (ORCPT ); Fri, 3 Feb 2023 18:13:54 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 240708D634; Fri, 3 Feb 2023 15:13:53 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id n2so4816195pfo.3; Fri, 03 Feb 2023 15:13:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=KHbHNdg7pHAZm+iH1umTf2t8yLyMxQ4O1NYUoM8SKQ4=; b=GH1GgjQZNFEmvuBmSymoXZd3w+dMuweEQssS5Sv0HcRz1X3P4GV6YymXJheadYKSSB 5/bhs3nVBE7BnbD0iGQ9VX+MDfp1oLJldRwcISktoB9IJfM3Xf/dZk4nDLhFAtdLyjZ8 IEPYimOB9brCQJ5fclnP74q+AnER8hOsOHpSRa6D//iM9HA917XbAVXQc8qN0lhcyi2x +doKrQHfVAzgMmaEdbvZmHqQJO0cDBqI1fU+gpMAaanzseDHR2N//dl2A3+8P3PbZ1R+ +wOUgZENewKDlU21i0cubU7YKCCfgUJsp/rgH6mjHsgdu0d4qiz+8on6LHEj5zj2C54y USHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KHbHNdg7pHAZm+iH1umTf2t8yLyMxQ4O1NYUoM8SKQ4=; b=AavPbVU+ZzwqmG/3wOOniiQ0rsoSvbjc5ICsRGj6GsKDKl4+0bCm3UtccaitkDc5TK BNgPwg7CDNGOgzcQnV0U3OpVE8U0j6eCl+ptMCQYD2GXHnPacHL68JEQs2N1siSM/nxh SxKxmUTCura6hbPJAarHx/EUu4rQj8ekajD8yKL7cz1DBtJSt5AlbijIbztqDSd1D4Yz gliJ/GLlaO4NEfdV72Ghh+7VI4JFkVS+hmPM9CgUbb1+dXup50X+hEW7y7NIgYnHTKmt p04XahYXfxwAIdvUp/9TlGd4LPJKw3RTpETWG/TQiqCl6zfvxmFTuisLpDHzzwYMksQD TiSQ== X-Gm-Message-State: AO0yUKVGSUJBqzcd4zubHmVCuZftouvgACzqmapiGGw8m6SRk7nuIiyt o8rGLmyVCCijRxjYNEaNvok= X-Google-Smtp-Source: AK7set/vkmoUxiQSouNiHnlki72tZjyhwr744ylOZKXLzwrJGtL6LgNiXFtHiBarLCY0WTauLkNiyQ== X-Received: by 2002:a05:6a00:330d:b0:587:8d47:acdd with SMTP id cq13-20020a056a00330d00b005878d47acddmr11019138pfb.34.1675466032436; Fri, 03 Feb 2023 15:13:52 -0800 (PST) Received: from google.com ([2620:15c:9d:2:6e90:bb76:2b36:4df2]) by smtp.gmail.com with ESMTPSA id m26-20020aa78a1a000000b0056b4c5dde61sm2441207pfa.98.2023.02.03.15.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 15:13:51 -0800 (PST) Date: Fri, 3 Feb 2023 15:13:48 -0800 From: Dmitry Torokhov To: Patrice Chotard , Mauro Carvalho Chehab Cc: Arnd Bergmann , Andy Shevchenko , Hans Verkuil , Liang He , Wan Jiabing , Hugues Fruchet , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: c8sectpfe: switch to using gpiod API Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This switches the driver from using legacy gpio API and to the newer gpiod API. Since ordinary gpiod APIs operate on logical and not electrical levels, handling of the reset GPIO is adjusted accordingly. Signed-off-by: Dmitry Torokhov Reviewed-by: Andy Shevchenko --- .../st/sti/c8sectpfe/c8sectpfe-core.c | 31 ++++++++----------- .../st/sti/c8sectpfe/c8sectpfe-core.h | 4 ++- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c b/dri= vers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c index c38b62d4f1ae..dd8141e0828d 100644 --- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c +++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c @@ -16,8 +16,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -812,30 +814,23 @@ static int c8sectpfe_probe(struct platform_device *pd= ev) } of_node_put(i2c_bus); =20 - tsin->rst_gpio =3D of_get_named_gpio(child, "reset-gpios", 0); - - ret =3D gpio_is_valid(tsin->rst_gpio); - if (!ret) { - dev_err(dev, - "reset gpio for tsin%d not valid (gpio=3D%d)\n", - tsin->tsin_id, tsin->rst_gpio); - ret =3D -EINVAL; - goto err_node_put; - } - - ret =3D devm_gpio_request_one(dev, tsin->rst_gpio, - GPIOF_OUT_INIT_LOW, "NIM reset"); + /* Acquire reset GPIO and activate it */ + tsin->rst_gpio =3D devm_fwnode_gpiod_get(dev, + of_fwnode_handle(child), + "reset", GPIOD_OUT_HIGH, + "NIM reset"); + ret =3D PTR_ERR_OR_ZERO(tsin->rst_gpio); if (ret && ret !=3D -EBUSY) { - dev_err(dev, "Can't request tsin%d reset gpio\n" - , fei->channel_data[index]->tsin_id); + dev_err(dev, "Can't request tsin%d reset gpio\n", + fei->channel_data[index]->tsin_id); goto err_node_put; } =20 if (!ret) { - /* toggle reset lines */ - gpio_direction_output(tsin->rst_gpio, 0); + /* wait for the chip to reset */ usleep_range(3500, 5000); - gpio_direction_output(tsin->rst_gpio, 1); + /* release the reset line */ + gpiod_set_value_cansleep(tsin->rst_gpio, 0); usleep_range(3000, 5000); } =20 diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h b/dri= vers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h index c9d6021904cd..bf377cc82225 100644 --- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h +++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h @@ -16,6 +16,8 @@ =20 #define C8SECTPFE_MAX_TSIN_CHAN 8 =20 +struct gpio_desc; + struct channel_info { =20 int tsin_id; @@ -25,7 +27,7 @@ struct channel_info { int i2c; int dvb_card; =20 - int rst_gpio; + struct gpio_desc *rst_gpio; =20 struct i2c_adapter *i2c_adapter; struct i2c_adapter *tuner_i2c; --=20 2.39.1.519.gcb327c4b5f-goog --=20 Dmitry