Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3401354ybi; Mon, 10 Jun 2019 09:37:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGVVLpms/xzFyOHwXSfzthsl6/ueouUiu6iah/LlF0Io3SojVtE9plxeiB3ZMuPb8YPjTW X-Received: by 2002:a63:9548:: with SMTP id t8mr16312913pgn.256.1560184651424; Mon, 10 Jun 2019 09:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560184651; cv=none; d=google.com; s=arc-20160816; b=hAqaB61y/d729smAy2+ntj+Pd8KAjgj8rqIew3Ze/pD6r92EGQ126GxUuATJAe5gkm qEkNoz9DERNJDNq4FClSEdHyfSQCilmSQQg6JvGvO12ej9tHUyL5SGmnuDstEls5HElV uFtxK34vndbXzsQ/rC13O3SZa3YYkscA85Rq3YXUJEO3+uQnAPDhxBVq0anxaI06SkHv AIvViQnjRmif6wegCB61DrzJH/uxudQErDud4Nqffr0yvaKqavQKdVL/n8LZm/+KstPg KTKkp2Ac4h7zUOJdJ5/xb0s85M9YK/LTppYh8HN4O9g8V2pWU2rePca362XTYnGa+6pA GtWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=wFdAgc99QumYHZwGHHfwMbSs2t6S4uJWD/vPRvOTdkg=; b=ljkTAawU2zRF2bZXVzB5yedIQ0W9cFbpK79mP1ZHOnQ/mwbO9OstTlfP7+dCqK/rsP spCitMrF1Yt79YlrQPtiLX8mk9RT31PR0bqol8GUMlDV6vd9UgyegpjcMztklth0K/4P jhBt+Nm6HeCAy3CcIc2Pk5X6gREQ4yQpY2Yfoxd+pWZ5NVEBeGSn/GNHmX2Hw8q4L/k6 HgA0XUeueH5pSwnlpa4oZ3Xg4wXtnTR5Z5laaHQ/V5t40cpWfG9haq295rX4mExJ4AJV a9Flzvz3JSoG6OirS1kqJeBtm6VomzrpmrRNpzrRNUHQy1MjMw80lHjm7XSB2jOBFXkj Z3iQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=opensource.cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 29si10268286pgy.132.2019.06.10.09.37.16; Mon, 10 Jun 2019 09:37:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=opensource.cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390810AbfFJP7Z (ORCPT + 99 others); Mon, 10 Jun 2019 11:59:25 -0400 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:60022 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389583AbfFJP7Z (ORCPT ); Mon, 10 Jun 2019 11:59:25 -0400 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5AFxLhp028833; Mon, 10 Jun 2019 10:59:21 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail2.cirrus.com (mail2.cirrus.com [141.131.128.20]) by mx0b-001ae601.pphosted.com with ESMTP id 2t09ep2nn6-1; Mon, 10 Jun 2019 10:59:21 -0500 Received: from EDIEX02.ad.cirrus.com (unknown [198.61.84.81]) by mail2.cirrus.com (Postfix) with ESMTP id 971B6605A6B9; Mon, 10 Jun 2019 10:59:20 -0500 (CDT) Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1591.10; Mon, 10 Jun 2019 16:59:20 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1591.10 via Frontend Transport; Mon, 10 Jun 2019 16:59:20 +0100 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id E5BE144; Mon, 10 Jun 2019 16:59:19 +0100 (BST) Date: Mon, 10 Jun 2019 16:59:19 +0100 From: Charles Keepax To: Linus Walleij CC: Liam Girdwood , Mark Brown , , Richard Fitzgerald , Subject: Re: [PATCH] regulator: wm831x: Convert to use GPIO descriptors Message-ID: <20190610155919.GQ28362@ediswmail.ad.cirrus.com> References: <20190609210025.29224-1-linus.walleij@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20190609210025.29224-1-linus.walleij@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906100109 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 09, 2019 at 11:00:25PM +0200, Linus Walleij wrote: > This converts the Wolfson Micro WM831x DCDC converter to use > a GPIO descriptor for the GPIO driving the DVS pin. > > There is just one (non-DT) machine in the kernel using this, and > that is the Wolfson Micro (now Cirrus) Cragganmore 6410 so we > patch this board to pass a descriptor table and fix up the driver > accordingly. > > Cc: Charles Keepax > Cc: Richard Fitzgerald > Cc: patches@opensource.cirrus.com > Signed-off-by: Linus Walleij > --- > +/* > + * VDDARM is eventually ending up as a regulator hanging on the MFD cell device > + * "wm831x-buckv.1" spawn from drivers/mfd/wm831x-core.c. > + * > + * From the note on the platform data we can see that this is clearly DVS1 > + * and assigned as dcdc1 resource to the MFD core which sets .id of the cell > + * spawning the DVS1 platform device to 1, resulting in the device name > + * "wm831x-buckv.1". > + */ > +static struct gpiod_lookup_table crag_pmic_gpiod_table = { > + .dev_id = "wm831x-buckv.1", This is not correct, the mfd_add_devices in wm831x-core passes an ID to the MFD core. Which is calculated from wm831x_num * 10, taken from the pdata. So this should be "wm831x-buckv.11". > + .table = { > + GPIO_LOOKUP("GPIOK", 0, "dvs", GPIO_ACTIVE_HIGH), > + { }, > + }, > +}; > + > - ret = devm_gpio_request_one(&pdev->dev, pdata->dvs_gpio, > - dcdc->dvs_gpio_state ? GPIOF_INIT_HIGH : 0, > - "DCDC DVS"); > - if (ret < 0) { > - dev_err(wm831x->dev, "Failed to get %s DVS GPIO: %d\n", > - dcdc->name, ret); > + dcdc->dvs_gpiod = devm_gpiod_get_optional(&pdev->dev, "dvs", > + dcdc->dvs_gpio_state ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW); > + if (IS_ERR(dcdc->dvs_gpiod)) { > + dev_err(wm831x->dev, "Failed to get %s DVS GPIO: %ld\n", > + dcdc->name, PTR_ERR(dcdc->dvs_gpiod)); > return; > } > Whats the thinking behind using get_optional here? A plain devm_gpiod_get looks like it would be closer to the original code. Previously if there was no GPIO we would log an error and not execute the rest of the function, this is I think no longer the case after this change. Thanks, Charles