From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7D1C36C58F for ; Wed, 21 Jan 2026 11:08:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768993685; cv=none; b=eDA1sa19pGhIVEPSyLOm+HS1cQ+CWbm7802t3Kne0PRhvCo+JvIMuoXEpeE9zFtbqrkMbUVBCga46ofw+XaJwuS4pgSpjC3W2d+EgP0dnfmJZnQrVC82AogrZhOWJlBgc/obdy1OA/RJk9o//oyo5eBIsrvk7WQO8/9Gx1dLfJ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768993685; c=relaxed/simple; bh=KDeP/t5EXFpOaIWGjlox3DEQ5bzq+q1jhuHzDo3/b9Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=O9pjGaYby0LNrLkmsjVNgVRRGom2lHEWybJ8FtY+MlsQ0JLDf3MlWV5cQuJSpz4HAUHXUloqo4OT5uUuLHLRdYIaxObBEeaojd/KBSDtqgvJFnqzPhuWYxTcTwt7sQBtV4FOoB+/29lSGyiVbvIR0IyCuKbkZa/uX86eijmc5XQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=KmGMiqZF; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=P5JE7+E7; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="KmGMiqZF"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="P5JE7+E7" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60LAmpAp3315742 for ; Wed, 21 Jan 2026 11:08:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= +G4eN6UdjrFQfu6AHLdiQ8ljqUfV5jUwh6aCPXLQphQ=; b=KmGMiqZFbNbxPydB K5BSDoOcplFKzjqk/CJd2ssGgiPMW2kQIYnRjUc8QdWsZz8M7cwjQ//wCydKew/r xd5ERMrPQLRYfMSvgClQzgQO70MKnI5OtdwFTf4rblHnJaTc2AyaRx4YrGB77DfX LHxllVsBIv93BIsBTKyY0w8SLcPgnq/P5rsaTgjHPjTBKWU/D36/yzE1n02HdiqM /7lwNhS9zhkdaWmhSV4Q6PdaJFDVUqsDMMz1czBlnOWvxUpaRez93GwK25wwM53U Q9I2Rmv3WNCXsRzBNSWBzC4N2lwj5JThK/dqAoVSfYP+HqPL4j9SSayHbzNdCAkC 81DxpA== Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4btwcjg1s8-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 21 Jan 2026 11:08:02 +0000 (GMT) Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-81c765b9b03so839035b3a.1 for ; Wed, 21 Jan 2026 03:08:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1768993681; x=1769598481; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=+G4eN6UdjrFQfu6AHLdiQ8ljqUfV5jUwh6aCPXLQphQ=; b=P5JE7+E70ug0nv1XXhFOKRCezV0AXViUJr8kanKFGxA9zOrreDIIZyl7tz71kYpnu6 5ZK1zrp2V8OA9JyPCYEKWV7DBtauz3aOfC56N6WClQ72bQ5pV78+bC2ShtvIeAfzY+aI PSVVHffqOQVXIGw2DPl0Btn25M3Bg41INdaPcYzRYw7FOTqJDsENj6h866NC3ywVLXX1 anghA7Xq89ScfP2icQgZxFEHuCxRB3gxcZWFHxQcyuGcp07MVoMDjkThSArDYCPMG3Ud 3dQyuH0pEBDbqEILmnV8QfyORSRButvy7A07eMW5mfoS+6Vbucue37Cf57gQW8s0LfHb jY+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768993681; x=1769598481; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+G4eN6UdjrFQfu6AHLdiQ8ljqUfV5jUwh6aCPXLQphQ=; b=nzbwPJ8eHWlb1auCJV0ImcyjQDcvUUOz3fuYwDIRnt5McMIWPshXwSFVK4eSJbUIWg /j/ffOXukPg86JA3wxM9k8b0+AvuFAFIt35wujVLgsmY4HT1P+aDNhkz2xF3fC0kzZjL gJ8e7mUZcWcq8mnE2CzmEOB3JlYK65fRdsnpB0I2y/F3T9K+mrfU/hHmZUMCXtWM4oxO 1Ulg8ZqRDULjbxlGPJy1mHU80h47DfRuveG4y9E7jS4gS1V86Ho+crgVXLVdYQovfr8l dRtq6pzByZYw7ONMb+lDLOSZliEvhdUNiVBz49CeY2z1uSDhDwOXfpPDllzj7Ck980pm /G4w== X-Forwarded-Encrypted: i=1; AJvYcCU49aPgLoA7GO6gSwq6BKmeTqdEPW0bTvdIf7REnSXwdnp7/+r1QgWTC1csS8eVNAs4NAs+MUX7Rh1/ddk=@vger.kernel.org X-Gm-Message-State: AOJu0Yzx5ILnskG1WdjBYo+A73zllFGQ5etQiodkE02z3GgyrebJsfQZ 2uxa9D0bEbl6UMT8G4Z9AD/rN9SOQNsavPl/uurF8F/GMLyc2xHHrsVYGRF+hjq04ZiG6YIK6kA 6M43OZnw0zy9ZYJxp5ssVvDAFHJCxQ3hKenqhxuDLCcgwbn7Jley+B0AA+O3MITOWixPQUI6rGE o= X-Gm-Gg: AZuq6aIUm3j87UpLrRhkXNT42/sAwS8j0Lq2X7WhsGYCR0bGqLFPfjrzJUhSNxD0qQX gTgYnBCQP/02Ex9OpleYlD8lU5RCIVzZcKjbs5rb5u9u977aBIrmccPB5ATM96zXoZ0NYVCAUyI jKo3lpRC+m++tBHs0D0IaNpb2lfKMhIQKFiggeKX2rjsBkolGtDLRp4Mu9qik+mJaxzOqkfhwp5 IJGk091TNM1h1oZcZK5CrrYFDhfoKUEnUJH+ejIJQL6vyJMlh5SixvRH6F+ZYFFCDfbq0TXnCyt jXwwgUv877I0FSrd/L2oFIHKfOdSLZ9GGUuE0OWoYfB1hWv+hHAUxMwOE5pvSsBROSrjjlGIPek UZdJZybz1VlH63zX664BNqe/B+bJB+AHDHls= X-Received: by 2002:a05:6a00:4105:b0:7e8:3fcb:bc41 with SMTP id d2e1a72fcca58-81fa06fb8a9mr13511447b3a.22.1768993681184; Wed, 21 Jan 2026 03:08:01 -0800 (PST) X-Received: by 2002:a05:6a00:4105:b0:7e8:3fcb:bc41 with SMTP id d2e1a72fcca58-81fa06fb8a9mr13511421b3a.22.1768993680644; Wed, 21 Jan 2026 03:08:00 -0800 (PST) Received: from [10.219.50.64] ([202.46.23.19]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-81fa1278061sm14881313b3a.44.2026.01.21.03.07.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Jan 2026 03:08:00 -0800 (PST) Message-ID: <1fb6fe78-c71a-4658-b396-f48fa4a4b7f7@oss.qualcomm.com> Date: Wed, 21 Jan 2026 16:37:55 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gpio: shared: propagate configuration to pinctrl To: Bartosz Golaszewski , Linus Walleij , Bartosz Golaszewski Cc: Srinivas Kandagatla , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Mohammad Rafi Shaik , Ravi Hothi References: <20260120154913.61991-1-bartosz.golaszewski@oss.qualcomm.com> Content-Language: en-US From: Ravi Hothi In-Reply-To: <20260120154913.61991-1-bartosz.golaszewski@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: dYTeYJpUyQmA5-ROz_ACruNEDQLrkPFu X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIxMDA5MyBTYWx0ZWRfX5tlQkI4WOv3E smJ03lN9CMv8uH35icL3r8NJwS9aFu+S8LVbcGjKGSVSQycsQ0glYKfJI5oWS2kMOlDhKMHnvpS 0OOUsUs8lzBebxpZ5WJCuac4GS1sGqQM4t//wJBsgVWb47aX+/mUAZp6na4sTzV4k5KjaqyqAfy baFQbUY/lXlhaD7NViZuFBwLJOYZ+GF+UTci5lc6iOfae573AGUxYvJ4b7LVOPoiGZEbiUUOC+f XkE4FBHmgbVsL8pux2qIKyIjdbNEmsdO50nfMel+WZ05+p38YQnE2nI+154PD8u54PhAtTvLuv2 fxv33jfJycf4Ja5T96wp9/cIgb4PCVmA4UUblktc/Dr7rDk1x4eumdW5wie95ururTP5W1KSCDH Sttv9U5rGY9RLLrYhGzh19Tqc049CjPM7lwh4gUH3mvot3569HFLcRn17FM6vOJxGqWF5swAhRT DhC06ycEYbolQfiC2tA== X-Proofpoint-ORIG-GUID: dYTeYJpUyQmA5-ROz_ACruNEDQLrkPFu X-Authority-Analysis: v=2.4 cv=JpD8bc4C c=1 sm=1 tr=0 ts=6970b392 cx=c_pps a=mDZGXZTwRPZaeRUbqKGCBw==:117 a=j4ogTh8yFefVWWEFDRgCtg==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=4gj4I00feunHHkNmgvUA:9 a=QEXdDO2ut3YA:10 a=zc0IvFSfCIW2DFIPzwfm:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-21_01,2026-01-20_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 priorityscore=1501 impostorscore=0 adultscore=0 suspectscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601210093 On 1/20/2026 9:19 PM, Bartosz Golaszewski wrote: > Just toggling the descriptor's "requested" flag is not enough. We need > to properly request it in order to potentially propagate any > configuration to pinctrl via the .request() callback. > > We must not take the reference to the device at this point (the device > is not ready but we're also requesting the device's own descriptor) so > make the _commit() variants of request and free functions available to > GPIO core in order to use them instead of their regular counterparts. > > This fixes an audio issue reported on one of the Qualcomm platforms. Thanks for the patch, Issue got fixed now. Tested-by: Ravi Hothi Regards, Ravi Hothi > > Fixes: a060b8c511ab ("gpiolib: implement low-level, shared GPIO support") > Signed-off-by: Bartosz Golaszewski > --- > drivers/gpio/gpiolib-shared.c | 16 +++++++++++----- > drivers/gpio/gpiolib.c | 4 ++-- > drivers/gpio/gpiolib.h | 2 ++ > 3 files changed, 15 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpio/gpiolib-shared.c b/drivers/gpio/gpiolib-shared.c > index 17343fdc9758..9e6544203439 100644 > --- a/drivers/gpio/gpiolib-shared.c > +++ b/drivers/gpio/gpiolib-shared.c > @@ -515,7 +515,7 @@ int gpio_device_setup_shared(struct gpio_device *gdev) > { > struct gpio_shared_entry *entry; > struct gpio_shared_ref *ref; > - unsigned long *flags; > + struct gpio_desc *desc; > int ret; > > list_for_each_entry(entry, &gpio_shared_list, list) { > @@ -543,15 +543,17 @@ int gpio_device_setup_shared(struct gpio_device *gdev) > if (list_count_nodes(&entry->refs) <= 1) > continue; > > - flags = &gdev->descs[entry->offset].flags; > + desc = &gdev->descs[entry->offset]; > > - __set_bit(GPIOD_FLAG_SHARED, flags); > + __set_bit(GPIOD_FLAG_SHARED, &desc->flags); > /* > * Shared GPIOs are not requested via the normal path. Make > * them inaccessible to anyone even before we register the > * chip. > */ > - __set_bit(GPIOD_FLAG_REQUESTED, flags); > + ret = gpiod_request_commit(desc, "shared"); > + if (ret) > + return ret; > > pr_debug("GPIO %u owned by %s is shared by multiple consumers\n", > entry->offset, gpio_device_get_label(gdev)); > @@ -562,8 +564,10 @@ int gpio_device_setup_shared(struct gpio_device *gdev) > ref->con_id ?: "(none)"); > > ret = gpio_shared_make_adev(gdev, entry, ref); > - if (ret) > + if (ret) { > + gpiod_free_commit(desc); > return ret; > + } > } > } > > @@ -579,6 +583,8 @@ void gpio_device_teardown_shared(struct gpio_device *gdev) > if (!device_match_fwnode(&gdev->dev, entry->fwnode)) > continue; > > + gpiod_free_commit(&gdev->descs[entry->offset]); > + > list_for_each_entry(ref, &entry->refs, list) { > guard(mutex)(&ref->lock); > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > index fe2d107b0a84..1578cf3a8c74 100644 > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -2453,7 +2453,7 @@ EXPORT_SYMBOL_GPL(gpiochip_remove_pin_ranges); > * on each other, and help provide better diagnostics in debugfs. > * They're called even less than the "set direction" calls. > */ > -static int gpiod_request_commit(struct gpio_desc *desc, const char *label) > +int gpiod_request_commit(struct gpio_desc *desc, const char *label) > { > unsigned int offset; > int ret; > @@ -2515,7 +2515,7 @@ int gpiod_request(struct gpio_desc *desc, const char *label) > return ret; > } > > -static void gpiod_free_commit(struct gpio_desc *desc) > +void gpiod_free_commit(struct gpio_desc *desc) > { > unsigned long flags; > > diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h > index 77f6f2936dc2..3abb90385829 100644 > --- a/drivers/gpio/gpiolib.h > +++ b/drivers/gpio/gpiolib.h > @@ -244,7 +244,9 @@ DEFINE_CLASS(gpio_chip_guard, > struct gpio_desc *desc) > > int gpiod_request(struct gpio_desc *desc, const char *label); > +int gpiod_request_commit(struct gpio_desc *desc, const char *label); > void gpiod_free(struct gpio_desc *desc); > +void gpiod_free_commit(struct gpio_desc *desc); > > static inline int gpiod_request_user(struct gpio_desc *desc, const char *label) > {