Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp534097imm; Fri, 12 Oct 2018 02:26:30 -0700 (PDT) X-Google-Smtp-Source: ACcGV60lDmCrdJthRb8UTif7NcKlEiL4aUa6w+6I3epVizsM5VWKrGgtFm91Qipm+KCslgJeKflc X-Received: by 2002:a63:7e1c:: with SMTP id z28-v6mr4845270pgc.190.1539336390910; Fri, 12 Oct 2018 02:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539336390; cv=none; d=google.com; s=arc-20160816; b=QS+yXczXV/ij8FFx81emBn2tuQvvErUn5IHNOS65bmm9blTb5wDYjyFetWo4rWN+yC 025w3b3Wsey+nXjSXKL8q1BRx0sHY3b2afzZ28rky7yUNjeqRkcUb3P71wHiHwfjkUnL n62PDnsTgaEeoovScuA/01dHDQ87+iG16GP4ALklwVLWbwhIapbJ6HeDaDV0vWOWkBgy asKI4+UWIKNwtrLhqRJ5U9lZdOMGk4BvpHGrqFu10IFqqH/fywLFS6Dxt7ipuP809BMN OEg1cpNFLqzqopSuNVN1PZQKGbcXwcPFEv9GMaVQFRGPXzhPeNwBxWvcKDpLSgHP0CIU kVMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=mrY1CyvyMabVXJ4QRkAlmBNpSzFpNgQzn+xS2PQnbj4=; b=XLck5PcCJuNRpukWi04SyoU60yIKQSerCAB4af4huMvSUVMhmjXPwocmD6N15+ZXrv S64cAvRNQi4ORMzYCdwm5RquwBaXPEIXDBQWnML0ode85WLNXBi9hZDuglDp1UuvVEAl ZRWbWL/YAfGep8ugr5J9liO8Kp0XvMB0PV4L8LF54IH/6g00AgMWsFlzm6mqxsRWHv2k WCX4yfRsxUPHs4gjOOxj41NqQdB12nQDdd0GtKCNFqKtK0KxfCPqcW11vkOhaqW22LoU q+q3jdmiTawUa79LN3S9ENYzqKx/voigBpHlF+2dpWR6EEowhheu7lSO7K/gpOwgg+6B YtEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.org header.s=pp header.b="hX/XUZTe"; dkim=pass header.i=@raspberrypi.org header.s=google header.b=CJ6p2Tzd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=raspberrypi.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9-v6si685885pll.414.2018.10.12.02.26.16; Fri, 12 Oct 2018 02:26:30 -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; dkim=pass header.i=@raspberrypi.org header.s=pp header.b="hX/XUZTe"; dkim=pass header.i=@raspberrypi.org header.s=google header.b=CJ6p2Tzd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=raspberrypi.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728341AbeJLQza (ORCPT + 99 others); Fri, 12 Oct 2018 12:55:30 -0400 Received: from mx07-00252a01.pphosted.com ([62.209.51.214]:23767 "EHLO mx07-00252a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727808AbeJLQz3 (ORCPT ); Fri, 12 Oct 2018 12:55:29 -0400 Received: from pps.filterd (m0102628.ppops.net [127.0.0.1]) by mx07-00252a01.pphosted.com (8.16.0.23/8.16.0.23) with SMTP id w9C9NGOW016000 for ; Fri, 12 Oct 2018 10:23:57 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; h=from : to : cc : subject : date : message-id; s=pp; bh=mrY1CyvyMabVXJ4QRkAlmBNpSzFpNgQzn+xS2PQnbj4=; b=hX/XUZTeJkHwvSpVytO22tbsoZm5qmEKmmqfmVtEVYCHgSwMiEyEe1mNERxiPd4bDODv btkSvIcXQAEcTqhpGPE5FI0bj7HcOtsvu/ulrmkuzJwaY3WH/3ZizwUDQUvx/YGuSFzY TPvvgSDhVj5MPtJR8emTNr6W5jlvGYtJ9SQq7/r2oVAXRV+GN2lrz55LDDb2Gim13/Qa 69quj0QDG1Rij75FnAvkpsJR88FB2uNm/evIhL/Ysl3eiArtxw5GfuekkgPrAanwq6xB g9m5T1xjrbccNYlSGzL/UFv0+MU4ibrxfzun0E8VmtI2UaZkX3BEIEvQwQLFfB49Iw8T Ug== Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by mx07-00252a01.pphosted.com with ESMTP id 2mxjf0k6tb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 12 Oct 2018 10:23:57 +0100 Received: by mail-wm1-f70.google.com with SMTP id i8-v6so5845078wma.9 for ; Fri, 12 Oct 2018 02:23:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; s=google; h=from:to:cc:subject:date:message-id; bh=mrY1CyvyMabVXJ4QRkAlmBNpSzFpNgQzn+xS2PQnbj4=; b=CJ6p2TzdVoCwmiJ5ZAnw47FNynG2txzB27nI3xodJZW+NwTDd/Si4fr4XkLx+lfLIY ondqtZwEpVcz7V+pxTorgsr+LgWQA7u4FlF2G49EOryxk79Yu8LY0XWe8/dhpgLPKTO1 72r4+2hXFXvnAysacdFRP/RDPTgHEqzX0bHHM5A5J8FpCo6XF85nQFQo6/DvnAefPA96 A8EndvLNSZUOw1LNBeKu97LvBG+IfkFz3N3BR6uMD+tXDCsumi3Gomlbnl5Krgr9wwXO XgJHf0XVWSFQhxOVuC5Pn+iLI/kRx9F+H4OqqpioHJ/ldAeNqF3hDDeN/wLwAqv30IM/ kGsw== 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; bh=mrY1CyvyMabVXJ4QRkAlmBNpSzFpNgQzn+xS2PQnbj4=; b=S2J8X8e+pUCrElTIRO+V6yjqSQOVIppsjcutiyiKDcY7SS7WDqmtwMHTU9PGE6aITl 4ZlfjkPryYtchSdrNoNTBPg94CCiP1+5I6kWo1UI9XFfkfmMBuXepitrLYnpJ8VYrnes AcoHngQtEoROv6nl0KSE0eL+3vMaErqHhsujuLJi7xmV5cHokkxqk4uCl5bFw9NbOaqe 42Pahfno0WcnAzoHgTEy/SFRwFdJ6aOD8A+/TAUtjV/raodRTj26eA8EBSlEv6ehhRWR m6uv0T9JUa2+v4AZroKltZ3RKjvOGXBrMfPEeTBghpVmreAWSw4aMHTyxILuZdQLzLGu uFpw== X-Gm-Message-State: ABuFfohS90GLu4jDNYQaIKCG6J8LezJY3gzfF1Jq69Bk29IGS20AYbmk LK8hksnOaP7wOhYT98CGnj9cPCLo40vVxGBz9arhAYM4/d4kXIAVdPSHSl05IesLWwB3norpd2s ogM9k2+NythjElaInJfK3MrMA X-Received: by 2002:a5d:4151:: with SMTP id c17-v6mr4478417wrq.61.1539336236658; Fri, 12 Oct 2018 02:23:56 -0700 (PDT) X-Received: by 2002:a5d:4151:: with SMTP id c17-v6mr4478406wrq.61.1539336236370; Fri, 12 Oct 2018 02:23:56 -0700 (PDT) Received: from buildbot.pitowers.org ([2a00:2381:fdf7:14:d078:5595:7c26:ec82]) by smtp.gmail.com with ESMTPSA id e6-v6sm547370wrc.70.2018.10.12.02.23.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Oct 2018 02:23:55 -0700 (PDT) From: Phil Elwell To: Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Phil Elwell Subject: [PATCH] spi: Make GPIO CSs honour the SPI_NO_CS flag Date: Fri, 12 Oct 2018 10:23:18 +0100 Message-Id: <1539336198-84179-1-git-send-email-phil@raspberrypi.org> X-Mailer: git-send-email 2.7.4 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-12_08:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The SPI configuration state includes an SPI_NO_CS flag that disables all CS line manipulation, for applications that want to manage their own chip selects. However, this flag is ignored by the GPIO CS code in the SPI framework. Correct this omission with a trivial patch. Signed-off-by: Phil Elwell --- drivers/spi/spi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 84dfef4..b1d88fe 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -729,7 +729,9 @@ static void spi_set_cs(struct spi_device *spi, bool enable) enable = !enable; if (gpio_is_valid(spi->cs_gpio)) { - gpio_set_value(spi->cs_gpio, !enable); + /* Honour the SPI_NO_CS flag */ + if (!(spi->mode & SPI_NO_CS)) + gpio_set_value(spi->cs_gpio, !enable); /* Some SPI masters need both GPIO CS & slave_select */ if ((spi->controller->flags & SPI_MASTER_GPIO_SS) && spi->controller->set_cs) -- 2.7.4