Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9083414pxu; Mon, 28 Dec 2020 06:14:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwD+ry5ljuMeAIiaPwUkXMlu77ObOFnChbjAI7nasSMre4AUH1GSi042yUKwxJseT/lKL0r X-Received: by 2002:a17:906:1796:: with SMTP id t22mr23765579eje.372.1609164848385; Mon, 28 Dec 2020 06:14:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164848; cv=none; d=google.com; s=arc-20160816; b=mL2ktShKfa7PNSoy4Wz2qdXOf6j8rxdZ1qFJu1Qp9mY4o/Xiy43Oq1IoT695EXHGvx IbhdTr08AH/13m5/fAMxksqtoKuf/W/KK3M23Gq6TkdwWFzGarX0xVUpRmo+UnTyPF5X THbgH3RRrZgus7QDqqT7zg/kl8W0hOwQvY6/OK4kgZuX1TaRrK2g5MlCDKZdhDoZcalt 22hY1E/Xtfs1Sw4SHT45l5IQGa75wfl6SV5/Jg47mMec2DiZKB+wx80ECY2IqlfYkq4g IMa9fQ9SXYwVy/jy+NKY5YfhEkW55DV4RtuLuiw8YCMDyKbQu7MCqPKURf0s3xmpSm5m 3msw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fBrVTvyPtropNmmb3F42mdobK1/0hHmatVkGmF0t2l4=; b=uWi/x4+EYlrg0Wjb0/UK1cw0oP1a/JNsV2Y0ALYjgny5gUVknL9N33Pv0EDISDxdrp FBakQm+VYG8RfORPMFjO2sPtR+tpOmmsxlRttAtMpaPBHKLaO396BtAMn7b0DeZc+2fe ZTAs2CVQ/i0gHgnehKW6KNJHym6IDvF6TacXs/CpQudk6PPKZtBm5HBfLkHh/UpccP1b EfBaZWFGyFcDfb/P5+GJfIX+2vMd+4Twhwz821R56OgD14t6l9d6mcsRZFT4tnwegVGN tIia6F7GlB3IIM510UGO82GETIAPXMRhGvzGPy39t4k2IE6wt/0azXRO3QEx9S23uGfK aruw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wrgrGaoC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t26si18569035eji.212.2020.12.28.06.13.45; Mon, 28 Dec 2020 06:14:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wrgrGaoC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439732AbgL1OLw (ORCPT + 99 others); Mon, 28 Dec 2020 09:11:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:46306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439728AbgL1OLv (ORCPT ); Mon, 28 Dec 2020 09:11:51 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7E601207B6; Mon, 28 Dec 2020 14:11:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164670; bh=wVy12jNep2eyFnbYJXmGX8vZ5VsGyWMcMzYPQVd6T7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wrgrGaoCqzb96/l1XlO14pOwThdJqNVDuIjZqnX11TNBIpCc9ri4iHSQo//OSkoR1 sMSM58w7Af3PJvBAenrrvgTaMN5JyL2+PCXEOZte0ALOwCbvnAtX3sFNeNEUBxiQwH X/WOBMU3WQquYY7f1F43KNSOdNDwZxrVXGUjObMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacopo Mondi , Geert Uytterhoeven , Kieran Bingham , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 257/717] media: max9271: Fix GPIO enable/disable Date: Mon, 28 Dec 2020 13:44:15 +0100 Message-Id: <20201228125033.306315339@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jacopo Mondi [ Upstream commit 909a0a189c677307edd461e21fd962784370d27f ] Fix GPIO enable/disable operations which wrongly read the 0x0f register to obtain the current mask of the enabled lines instead of using the correct 0x0e register. Also fix access to bit 0 of the register which is marked as reserved. Fixes: 34009bffc1c6 ("media: i2c: Add RDACM20 driver") Signed-off-by: Jacopo Mondi Reviewed-by: Geert Uytterhoeven Reviewed-by: Kieran Bingham Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/i2c/max9271.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/max9271.c b/drivers/media/i2c/max9271.c index 0f6f7a092a463..c247db569bab0 100644 --- a/drivers/media/i2c/max9271.c +++ b/drivers/media/i2c/max9271.c @@ -223,12 +223,12 @@ int max9271_enable_gpios(struct max9271_device *dev, u8 gpio_mask) { int ret; - ret = max9271_read(dev, 0x0f); + ret = max9271_read(dev, 0x0e); if (ret < 0) return 0; /* BIT(0) reserved: GPO is always enabled. */ - ret |= gpio_mask | BIT(0); + ret |= (gpio_mask & ~BIT(0)); ret = max9271_write(dev, 0x0e, ret); if (ret < 0) { dev_err(&dev->client->dev, "Failed to enable gpio (%d)\n", ret); @@ -245,12 +245,12 @@ int max9271_disable_gpios(struct max9271_device *dev, u8 gpio_mask) { int ret; - ret = max9271_read(dev, 0x0f); + ret = max9271_read(dev, 0x0e); if (ret < 0) return 0; /* BIT(0) reserved: GPO cannot be disabled */ - ret &= (~gpio_mask | BIT(0)); + ret &= ~(gpio_mask | BIT(0)); ret = max9271_write(dev, 0x0e, ret); if (ret < 0) { dev_err(&dev->client->dev, "Failed to disable gpio (%d)\n", ret); -- 2.27.0