From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69A4D13635C for ; Sun, 30 Nov 2025 08:07:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764490060; cv=none; b=DDPY1p5ent4APPqCO9lFgEvV6E+v9U+O9kSHnTVzz6o3Dwdsm6Z2BBk7jRQogmlhNhU0tAl3TSp1ZI+JXPxo518Pnhbpzsgqpx2W5Xs1Bsczuds7gEKZpbfhFWCrzo8kkS1yVSC8q9O4tIRM9wiswjagnl8ildI1KfFZLclEI+s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764490060; c=relaxed/simple; bh=4BqR8i04DJ4LHGlawmh3d7XuP4glW6AD9nAnEQwn4CM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UInlWEXi/vrNt8MPgj2O1YLr5vlaZRFM8wctCsAXYGutNIT+vLnut31TepDwFvUMSK12L03XHdf50RcNZQ8F88iGfV/A6lvh1906Ze2vc++8+NgvsaLFBk5tsWSd2y8HgU2CbMhytalumU/KVpa2LwyAtUza9vyglONK6h1+Njk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aDWhMsDq; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aDWhMsDq" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-47798f4059fso3741845e9.2 for ; Sun, 30 Nov 2025 00:07:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764490057; x=1765094857; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=xlsTM8X40xseZoss4FmEjFSiPfPo4hKAiGVqNHsXGAU=; b=aDWhMsDqBJKMQXfNVIHTsNL8BCw2LKygoSnqFA9hUPwJxuORsiRzy6AzDXPOA5xMbC oZYRf5TVvXXn+oIGRCZdyttLU++DW0X2OdAUuP5+e425VQurQLD8h/LcQfdIv4bNRIFl BjdgRdTcYsHDmDYPl+5RPWdrm5n3tWnqlECLPJ9/aW6uMSuQbYsaK2e8A9MetYZvfL9B xR5igGUh9aODBWfY5E+mnR7fL03AW2C7gRLn359isgHchZSdQSKRqmzt1aG6yYT3Sm+F 96o+gABO6sNoVLK1S0sjMCJnBte4/BrQ9saA7BEk35rNvgpzRSJanBywRKOym9iSRjN/ 1lnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764490057; x=1765094857; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xlsTM8X40xseZoss4FmEjFSiPfPo4hKAiGVqNHsXGAU=; b=wJ5fWeu15QyeA9s6wV1S4+eFmLKizyZN3T+DG0+Z83z6Z/jwjZeLSnJgp7cmy3ECii XXjsOmTB7VNwrHIf1Nsp3oPNXwFPXyC1V8G/29EzLXazss666l5ZWAYd4VChC69QI7CE BJjy0kRle1uBmeWckVe8/W2In25T5IN8d79U08DBwrdurHMsAiNTBviPmUMCblMcLXG/ SQ9QpCFK8KTD1/do8/ByIvZ429EA2usoK+ej6GovFEooXc8cGfG23VBRdA3AGaRJULML HGF+CHJ5bpsPfCoRVoFdMAcS5C3GBc5w2I0u7wXtRulL/lhOQeoLw6KDBpvSXQr9kE5/ KLkA== X-Forwarded-Encrypted: i=1; AJvYcCWdoE98RGWO+N52cuGMQSH18fxLO4F/ZxoPblR/Mf15dKucv6hcGAtnOHl1QeD/drazGrp9Oo7gfw/Qnv4=@vger.kernel.org X-Gm-Message-State: AOJu0YyS8nQuhjQcMWGPtD7arOaf/TLrZGFwIIWlo5VfsvkEC8glNJA8 OpK/C8jX9cGlrjg56Iw4jnGiI+W2HScXw6zGOeaaxW4MW48XyAkm1pFc X-Gm-Gg: ASbGnctAoPCWzYNOhdzvJcS4lTauVXsAClcXKxmTNqpOnqsTfXJ1wPlXZAJ/KnCtRad Fm0a2ebyKikLDsommUSZq82bWWWSihXPk0GhY9roT2d5fxc1IOCjFfl/xvyyEAJCzYmBvN67TUX ae8/MXDgIZvKXgySxBrk5tsP9K0VAY4Yw5xkb24YGgl9n0QxrQzsERnqjJofYnyMaxjUVVw1Zce 4NzEe2RN8It53CcgzdZKLZNZ414vUmPhmPLYTGPD+SL+ajmWqPxy4IkFOwXfhT4h2CNzyc0+tM0 qJ7+FxK923vBJSsg+GfGQ5kRz2bgacY6vlIFf0hBbtdwtioDRLU26o9klxlpNvoRQPwhRZjFEXT V8R8uNT+W7wPalj44wOIrxXtF4vnReDq1YNlK+/4MwjY5bTW0PrK0g1NDvYZKoac/3GHpIRD7YB 64Ew== X-Google-Smtp-Source: AGHT+IFlU1lz0wAxOd6SVfn1aivlWfEl/Ou+5sEfrekzWHqCsdYXRmCmN0O23F/dtfV/GF8aZsAtOg== X-Received: by 2002:a05:600c:628f:b0:477:9fa8:bc99 with SMTP id 5b1f17b1804b1-477c01bc376mr183264015e9.4.1764490056388; Sun, 30 Nov 2025 00:07:36 -0800 (PST) Received: from skbuf ([2a02:2f04:d106:d600:36d7:677f:b37:8ba9]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-479040a9cf4sm134950185e9.1.2025.11.30.00.07.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Nov 2025 00:07:34 -0800 (PST) Date: Sun, 30 Nov 2025 10:07:31 +0200 From: Vladimir Oltean To: Andrew Lunn Cc: Chen Minqiang , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , "Chester A. Unal" , Daniel Golle , DENG Qingfang , Sean Wang , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org Subject: Re: [PATCH v3 2/2] net: dsa: mt7530: Use GPIO polarity to generate correct reset sequence Message-ID: <20251130080731.ty2dlxaypxvodxiw@skbuf> References: <20251129234603.2544-1-ptpt52@gmail.com> <20251129234603.2544-2-ptpt52@gmail.com> <0675b35f-217d-4261-9e3f-2eb24753d43c@lunn.ch> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0675b35f-217d-4261-9e3f-2eb24753d43c@lunn.ch> On Sun, Nov 30, 2025 at 02:11:05AM +0100, Andrew Lunn wrote: > > - gpiod_set_value_cansleep(priv->reset, 0); > > + int is_active_low = !!gpiod_is_active_low(priv->reset); > > + gpiod_set_value_cansleep(priv->reset, is_active_low); > > I think you did not correctly understand what Russell said. You pass > the logical value to gpiod_set_value(). If the GPIO has been marked as > active LOW, the GPIO core will invert the logical values to the raw > value. You should not be using gpiod_is_active_low(). > > But as i said to the previous patch, i would just leave everything as > it is, except document the issue. > > Andrew > It was my suggestion to do it like this (but I don't understand why I'm again not in CC). We _know_ that the reset pin of the switch should be active low. So by using gpiod_is_active_low(), we can determine whether the device tree is wrong or not, and we can work with a wrong device tree too (just invert the logical values).