From patchwork Mon Dec 2 10:30:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 180587 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp5011496ile; Mon, 2 Dec 2019 02:30:37 -0800 (PST) X-Google-Smtp-Source: APXvYqx/SqHlXVGUEJxk+oqXR92c/43Pwqy+A2VQ/DzMx44qFOmI7xNjh7oaYyoXnDcta9fvr1c8 X-Received: by 2002:a63:c652:: with SMTP id x18mr18108120pgg.211.1575282637254; Mon, 02 Dec 2019 02:30:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575282637; cv=none; d=google.com; s=arc-20160816; b=j7hfBoVpjXqyhdTHMZQTlc/GrusTs/gEiICv3DQ5mQWeoUfbQOd3P1tFQmfdI8ic5z 3vqP7jugevlYiNK1TTeDeLZ6qwsxx+gYE7P0mP8THZG5edqBP1puDaB3smdPalSbs9M+ xbMMWK/eKRaJoRSFuUxkYEHk9ZjfhjeLH8smS4kETaS2ueHMYgZewtp6nMCELxc621Wt txAYSfwGOxi0GboAGDEafg7hi8loy37wh68qfdzoxouFO8WcjvsdCdOrPjVuknJ6FOp1 vDboQQoYLjIJWn+6M0vgwATt/wb4j3+Yj6Qrm/6slFnEpwb39WuzWttWDGqLcIOsMY4q Tblg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :delivered-to; bh=nTEqeVcWXWVUs5zeTmNhdphOZaQR3WuI/cM5RBgfTBo=; b=jeqcemhgBYNAd4u2/R8v0T/YW+DurEqYIloBfEra5G0/2oHxr6hmsN86eiyn3o0D8O 1i1s9gjiSJKZvlvdBUa/XtiosjWv4zZFsyTY/PRJxmNzm50csp/kvr/CrdHPNzlhHUkP /65n82vrsbuJ6l+QniRkEbB8vDu965BbpQjpa+1OALHGW3eUD3ekM+aZQ8V8XdkdvuUL 18M+YSDm4hRXGATK6+ZVjxVKy06FzazWmeY1nSD6fPBGkeYql1p8H376aIkP6Dk4EcRf LQ/3XiFP2C7UfMwPIchEUzrtdE4EqB+IGBEvRuwtmauHD2BfciiP9MTJohjtK+q1h+zx Ow9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 62si12638966pgi.406.2019.12.02.02.30.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Dec 2019 02:30:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F39C26E108; Mon, 2 Dec 2019 10:30:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id EC6C06E108 for ; Mon, 2 Dec 2019 10:30:33 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id b15so3285774lfc.4 for ; Mon, 02 Dec 2019 02:30:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JnFZnxAMO0aCxBtZvO4kwX8NBGw3P3Mu9Lb0YCCDbH4=; b=YRFh7t5bvQELiFuT6EhKJclGkxfxiUxdtaWlhkKi5e8aNDNP2OwB3lA6nKqV9RLT4I SkCLE1uCeOU4zNwS3Z1ht7LhIZkgV9RRVEtF5IR4XnW2JQhsETIWoZdhb1dWF0rdzdp3 PY/sN1TLAWuLZ0OrrvfBYWHOfaze/v0hYKlJAGFwHR3yihA29nc2ss1Nl6LnokpkYLeW ZdhgtoqtkC64LdVHCRsoQ/qsA7oovmYnGeGQBdvdlBIX39jTZT9aKSMD4wEunUcfsjW2 2lCXggvFyKDT6GM5R9vjfUQEwlEn13ff7NFAii+LcG/yPbDVsqUev4l3TOeQks6dGh2m LnAA== X-Gm-Message-State: APjAAAWJRl+quPHZPQaZ7qKPwWFP4MUs25T/8bvD2ZsBpJh8s4YfDJ2H PKKKRJp8pypKPBpCGyFJi0Hkfw== X-Received: by 2002:ac2:5b86:: with SMTP id o6mr42276413lfn.44.1575282632376; Mon, 02 Dec 2019 02:30:32 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id d24sm9303796lja.82.2019.12.02.02.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2019 02:30:30 -0800 (PST) From: Linus Walleij To: Lee Jones , Daniel Thompson , Jingoo Han , dri-devel@lists.freedesktop.org Subject: [PATCH] backlight: bd6107: Convert to use GPIO descriptor Date: Mon, 2 Dec 2019 11:30:28 +0100 Message-Id: <20191202103028.102770-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JnFZnxAMO0aCxBtZvO4kwX8NBGw3P3Mu9Lb0YCCDbH4=; b=Bjor4eG+iaxcX+8kT+WAFCS5LZycijWGXks6a8togEn+yWwuFsAeohF7nZPDbhIvFF yRP41kM4SutVBh7HFdEYJG0ql2AqLx7XyfFt1DgOTKvI9Ll5wgD9OYycwlAFDIw5lpKb FbFTJpTYVXtCFuDNSji8ZSN7/6wApSEgTAf2nTTRAk5Rez/qyPULlC/LYp3lRePQHwPU FpJVS1Vd3gAtwR+MSb6590yDq8mSLMkAX/vytEeqtdB9LfaDkhVFcyuCuXL/MUexJM2l psJSLQtwKx2ZU6pkU8KmEwLb8VOfV1gxTG1lBsxIa58T4YYDaFf3dsAUOy7ZqIV8Rdds R+mw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The Rohm BD6107 driver can pass a fixed GPIO line using the old GPIO API using platform data. As there are no in-tree users of this platform data since 2013, we can convert this to use a GPIO descriptor and require any out-of-tree consumers to pass the GPIO using a machine descriptor table instead. Cc: Laurent Pinchart Signed-off-by: Linus Walleij Reviewed-by: Laurent Pinchart Reviewed-by: Daniel Thompson --- drivers/video/backlight/bd6107.c | 24 ++++++++++++++++-------- include/linux/platform_data/bd6107.h | 1 - 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c index d344fb03cb86..d5d5fb457e78 100644 --- a/drivers/video/backlight/bd6107.c +++ b/drivers/video/backlight/bd6107.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -71,6 +71,7 @@ struct bd6107 { struct i2c_client *client; struct backlight_device *backlight; struct bd6107_platform_data *pdata; + struct gpio_desc *reset; }; static int bd6107_write(struct bd6107 *bd, u8 reg, u8 data) @@ -94,9 +95,10 @@ static int bd6107_backlight_update_status(struct backlight_device *backlight) bd6107_write(bd, BD6107_MAINCNT1, brightness); bd6107_write(bd, BD6107_LEDCNT1, BD6107_LEDCNT1_LEDONOFF1); } else { - gpio_set_value(bd->pdata->reset, 0); + /* Assert the reset line (gpiolib will handle active low) */ + gpiod_set_value(bd->reset, 1); msleep(24); - gpio_set_value(bd->pdata->reset, 1); + gpiod_set_value(bd->reset, 0); } return 0; @@ -125,8 +127,8 @@ static int bd6107_probe(struct i2c_client *client, struct bd6107 *bd; int ret; - if (pdata == NULL || !pdata->reset) { - dev_err(&client->dev, "No reset GPIO in platform data\n"); + if (pdata == NULL) { + dev_err(&client->dev, "No platform data\n"); return -EINVAL; } @@ -144,10 +146,16 @@ static int bd6107_probe(struct i2c_client *client, bd->client = client; bd->pdata = pdata; - ret = devm_gpio_request_one(&client->dev, pdata->reset, - GPIOF_DIR_OUT | GPIOF_INIT_LOW, "reset"); - if (ret < 0) { + /* + * Request the reset GPIO line with GPIOD_OUT_HIGH meaning asserted, + * so in the machine descriptor table (or other hardware description), + * the line should be flagged as active low so this will assert + * the reset. + */ + bd->reset = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(bd->reset)) { dev_err(&client->dev, "unable to request reset GPIO\n"); + ret = PTR_ERR(bd->reset); return ret; } diff --git a/include/linux/platform_data/bd6107.h b/include/linux/platform_data/bd6107.h index 3bd019037eb3..54a06a4d2618 100644 --- a/include/linux/platform_data/bd6107.h +++ b/include/linux/platform_data/bd6107.h @@ -9,7 +9,6 @@ struct device; struct bd6107_platform_data { struct device *fbdev; - int reset; /* Reset GPIO */ unsigned int def_value; };