From nobody Thu Feb 12 20:26:34 2026 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 553EF15B109 for ; Fri, 7 Jun 2024 08:44:49 +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=1717749892; cv=none; b=NT+KLMDOboJfvoYyru/L5a+5JzgeRxkm+eGMU29BjfTNLRYrh7shFxcTZMtD0NARgcnHXjfOvobF9xkjDyJmugj6aLNPTHWNM4bfxIphmFQQxKJ6QQiUjcOORKM1HNYvi5sMQ13pIp1FDJQOXhK5OxpeNrHKUFYIA/PaCamCLaI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717749892; c=relaxed/simple; bh=wudYmHy3qCSrWLSreH+1TgxgneyUtA3ewiC9lXDQSKs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ple3pvvwQBTIhgJITD7mhIypDaOZrOXllyEMB500SVJ4QmjFji2Ol13Hf/3x2sYQEdT7jcygUcWas0s5hk8eKNSALE0ckate2TNyx5MY2OhmAiRfm8asFjU+AvD83xytjOWe0eqiS7m4yX/1JrO/dgn+9eaB1rrv1X/5WZ6FG4s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=WRYkQq3C; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="WRYkQq3C" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-42160f2dc32so9975305e9.3 for ; Fri, 07 Jun 2024 01:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1717749888; x=1718354688; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5FGL8cAEQ0O2enVmYyGVM2Jx+NaXP9rfnR5x0k/WELA=; b=WRYkQq3Cw2ZkjAGEjYa0qecOxF1FIZEIprx0xpD9syTdNHTT6U0e4F1Nrp6MwYcDml tyToYTqhZFpNt+r/f2aSfqHECjiQk30EzxcFBs9dUyaKfPG0LyU1v/lbAUm56qnyJEhD YuTsOwrWPwlNbpLoJFP0Oxkxaz3s0QEcZSc9VOH49FvSWfLTxV/tNCkF10eRVwkbQ4Wv yqJfTt585tX9K176GFcNEoS/Ofi7UKU3Ll/6B8gt9QFYrF4ccaQbGTzX/Z5MrxqPGpfF Bia1NmsdX/HH1mnY6B3VIg08gCLAdrCJJItVYSHVHBKoAaxVACj8kS1O1+lyiZ4oTzbb DeFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717749888; x=1718354688; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5FGL8cAEQ0O2enVmYyGVM2Jx+NaXP9rfnR5x0k/WELA=; b=SZqZ8CNwRXkWhkGQHNeydXLRsTkiSzUhbvzoO6GSP5fXUWWpaA1gtSZ3KABLcotBpX 886ws4ZMuScPGTxAyzUZZi/4H2VFfEM1qh2cePxIk4zrn4NhlzU+CdAGU6alsv8M8qBi 5F6h30HJDCyBifxp59/Ku0laH3u5C78nvmB+zJlUmBNjNGTNdtm2d+6tPn/I3QQdBGOh jmpLu3PoNSXRP+jH+waR/W3kvw3uMyGC2QShRy95PnPmCT8aq0Hmw/TJx5ORo0W6Otpn Ly1ob5/CTK/4I2rJJYhlZT6nYPilucIx/smkgbYIC52vBjdklECVsEYeSsqnP95Lmprs Daxg== X-Forwarded-Encrypted: i=1; AJvYcCWTPGK4pcxqN7aCn1FeeLFSL4dw5ikBsgJvPg8YXmSAsqG85nzl/J18bMqWrtQWnLK+cHOGmsfvAW4UoEGK0K+CkL9tEjfpaRSh9tzn X-Gm-Message-State: AOJu0YypB2Uq2T4RWTQaPUlV/OylO4kRFK5Lb93bqyxw1DRNq7ty1VAD TpsVyvfBJ830miaIZmVI06cAZIO5pQSFVuSR0WcFdC+nFUJPtGGCJLwXv7hqPP4= X-Google-Smtp-Source: AGHT+IH/9XI6ce6wjpuBpjMC8y/GtYJRiFfAam5jHMBp7OViFavLuETNBz3U8/PfPmbAek4vxlG7yA== X-Received: by 2002:a05:600c:450e:b0:418:5ed2:5aa6 with SMTP id 5b1f17b1804b1-42164a3b0f0mr19195415e9.31.1717749887864; Fri, 07 Jun 2024 01:44:47 -0700 (PDT) Received: from localhost (p509153eb.dip0.t-ipconnect.de. [80.145.83.235]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215814e7bfsm80098415e9.40.2024.06.07.01.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 01:44:47 -0700 (PDT) From: "=?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Benson Leung Cc: Guenter Roeck , linux-pwm@vger.kernel.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] pwm: cros-ec: Don't care about consumers in .get_state() Date: Fri, 7 Jun 2024 10:44:15 +0200 Message-ID: <20240607084416.897777-6-u.kleine-koenig@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240607084416.897777-5-u.kleine-koenig@baylibre.com> References: <20240607084416.897777-5-u.kleine-koenig@baylibre.com> 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="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=3061; i=u.kleine-koenig@baylibre.com; h=from:subject; bh=wudYmHy3qCSrWLSreH+1TgxgneyUtA3ewiC9lXDQSKs=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBmYshl2TygktlmNS6vtWgQA7+2Bnh2F7OPpd1Z2 OFVxplP1LiJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZmLIZQAKCRCPgPtYfRL+ TjbTCACR1DiLfufuRbJltZvAy1vOOWnfILZW6Txf383BpkW755Jry1cQfC4l0KE2mqgXI9FRLmk +YL7nbP+5arxci4Hq8p1PEv1B5C9BUP7z1Xq1mk0ZlpLbBm+jGk2D9gZR71WquJp1KJfonHDd0l mGksY7Bl6kwFNrhtqRdy+JuNMQLpb7yHspr+Afm08DNYqlL8ncrTPkN+X8yiuOs9z7ZsMbt8P+1 HoHxCaKPXTW1XBXckJzT6Bpt/FaiyedOk8g/cWakA2TSctd540/d3pfiQZj6X+vspclmmkde34s z/77KO/ajGmZUu9utoA/V8bGYdIurzFPY5AUGuuRXUVu4fNB X-Developer-Key: i=u.kleine-koenig@baylibre.com; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: quoted-printable The get_state() callback is never called (in a visible way) after there is a consumer for a pwm device. The core handles loosing the information about duty_cycle just fine. Simplify the driver accordingly. Signed-off-by: Uwe Kleine-K=C3=B6nig Reviewed-by: Tzung-Bi Shih --- drivers/pwm/pwm-cros-ec.c | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/drivers/pwm/pwm-cros-ec.c b/drivers/pwm/pwm-cros-ec.c index 606ccfdaf4cc..ba4ee0b507b7 100644 --- a/drivers/pwm/pwm-cros-ec.c +++ b/drivers/pwm/pwm-cros-ec.c @@ -25,15 +25,6 @@ struct cros_ec_pwm_device { struct cros_ec_device *ec; bool use_pwm_type; - struct cros_ec_pwm *channel; -}; - -/** - * struct cros_ec_pwm - per-PWM driver data - * @duty_cycle: cached duty cycle - */ -struct cros_ec_pwm { - u16 duty_cycle; }; =20 static inline struct cros_ec_pwm_device *pwm_to_cros_ec_pwm(struct pwm_chi= p *chip) @@ -135,7 +126,6 @@ static int cros_ec_pwm_apply(struct pwm_chip *chip, str= uct pwm_device *pwm, const struct pwm_state *state) { struct cros_ec_pwm_device *ec_pwm =3D pwm_to_cros_ec_pwm(chip); - struct cros_ec_pwm *channel =3D &ec_pwm->channel[pwm->hwpwm]; u16 duty_cycle; int ret; =20 @@ -156,8 +146,6 @@ static int cros_ec_pwm_apply(struct pwm_chip *chip, str= uct pwm_device *pwm, if (ret < 0) return ret; =20 - channel->duty_cycle =3D state->duty_cycle; - return 0; } =20 @@ -165,7 +153,6 @@ static int cros_ec_pwm_get_state(struct pwm_chip *chip,= struct pwm_device *pwm, struct pwm_state *state) { struct cros_ec_pwm_device *ec_pwm =3D pwm_to_cros_ec_pwm(chip); - struct cros_ec_pwm *channel =3D &ec_pwm->channel[pwm->hwpwm]; int ret; =20 ret =3D cros_ec_pwm_get_duty(ec_pwm->ec, ec_pwm->use_pwm_type, pwm->hwpwm= ); @@ -175,23 +162,10 @@ static int cros_ec_pwm_get_state(struct pwm_chip *chi= p, struct pwm_device *pwm, } =20 state->enabled =3D (ret > 0); + state->duty_cycle =3D ret; state->period =3D EC_PWM_MAX_DUTY; state->polarity =3D PWM_POLARITY_NORMAL; =20 - /* - * Note that "disabled" and "duty cycle =3D=3D 0" are treated the same. If - * the cached duty cycle is not zero, used the cached duty cycle. This - * ensures that the configured duty cycle is kept across a disable and - * enable operation and avoids potentially confusing consumers. - * - * For the case of the initial hardware readout, channel->duty_cycle - * will be 0 and the actual duty cycle read from the EC is used. - */ - if (ret =3D=3D 0 && channel->duty_cycle > 0) - state->duty_cycle =3D channel->duty_cycle; - else - state->duty_cycle =3D ret; - return 0; } =20 @@ -291,11 +265,6 @@ static int cros_ec_pwm_probe(struct platform_device *p= dev) chip->ops =3D &cros_ec_pwm_ops; chip->of_xlate =3D cros_ec_pwm_xlate; =20 - ec_pwm->channel =3D devm_kcalloc(dev, chip->npwm, sizeof(*ec_pwm->channel= ), - GFP_KERNEL); - if (!ec_pwm->channel) - return -ENOMEM; - dev_dbg(dev, "Probed %u PWMs\n", chip->npwm); =20 ret =3D devm_pwmchip_add(dev, chip); --=20 2.43.0 From nobody Thu Feb 12 20:26:34 2026 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 010BD15B144 for ; Fri, 7 Jun 2024 08:44:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717749893; cv=none; b=a4rjYvyfCSglX0jD21DTa0zARBrehCFzMb2q43pCuFD3MserA4Wu52j3Mu6BBWF+at9EqKFSN4cPv8wHtd7HF3jwuHzvFZRva61reTW+ymk0XuDi+zUzaqmU4R2Gl3TRBcbIB2yATIltn/RVTiCjsBWhCTsn9LvFcpPDwULjHiU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717749893; c=relaxed/simple; bh=14XoLLXGkugteQS++IsQ79UO0X3PLB2TkFVDwv7Adjs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j9UBRxV1b0S6cpWXsNAdkmemXmVxsn1AKEPXrGSw9YPSeHZc5ntLWoiOHaIvWQKpqr+IN0wBDD8w9cLXpOmvv26U8PUtYBZt/kgbjOIkxK3Ah7kXjgykdGkzfS/1EtgJ+rbE2GubL1QMqz0oflKKEa69QlJQKfp52ldLMP7aPxQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=LD78OPYK; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="LD78OPYK" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4215f694749so12332945e9.2 for ; Fri, 07 Jun 2024 01:44:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1717749889; x=1718354689; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7q7foaTfDqbpSuC9Ibq8n6gkjkleMa3J/+6fe0Py97k=; b=LD78OPYKBcrjSk/AdEyqNj26XaXjd/AE4gp3en13E4Qytfayr38/chvpIl8+mIM3bK 7wisuMe3L1Y8a237cWK1dqgVGTn6FnsqtPgjAUdv+hhOZJum3GOCF1i1cDDAi4rtWbpo n84flJUrN4+raWiwLTxFUpruc7pwA5IEM0JfHSVbn9badhdSiU7hlsLJhJemhZteyb9G zCAJXIT0+PqoqfjJS8I5T4nu3qYO+T5Rv0I54yS0uUaIF74iD7aufmLUXH9fEa1a09WC 7pFpCY1DX///7mwx9YHOsolLVDuPUm9zqt8wKwtK1l0/pU1wAe+Y0UGjAVWhbygDLG5H fiRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717749889; x=1718354689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7q7foaTfDqbpSuC9Ibq8n6gkjkleMa3J/+6fe0Py97k=; b=AshGGRu815nGoQIBJu0o7s8pwoRgqB5u7+Ej2cCk0LvnNuAkC1FLtlAjoWTXt0IW3i VrceBzYF2E7YvahVUMRI2VktPJYDabgw5tSgsDgUr1kkMs2BGpp0yjozGLRpiVSsB5MP mcHPVFZkT+JTHHiUo+WdXbcNb35tgwmRmruPbkFYgAxemx0HT47UNVLdQC6vxT2TfQ2g tf8jjgvty+Iu9YXpDt7zRi9P2JVKogzB/C0RHF0OGeVVND1bDqo4QCmsBou6Jl5R+IGc LCPLuez6GNd3hyCb8Kyh3xbfYtN5bN7b55uJ//KsqqI2py0UUPvUhp5SR7WdYclluqxr nFdQ== X-Forwarded-Encrypted: i=1; AJvYcCUNop4f1ClclRaqX2tfHlSdaFD6NvhykeYHfPvpviLfv12X2+l2zVylvEmH2TUA2MUudeigcfncavFk62qjHdjAoEjdCjNwZ7CzndNd X-Gm-Message-State: AOJu0Yz8OqBMWaRwHTGAhqcig2KhlA0XjET+LgB9QEIZFBmYkBFsE5A0 luG4uWMbmz8JM9ZtAqGIFkygorFIZZP8gH/VSlBlClhk6iF3LmCKuhPAA3gJEW4= X-Google-Smtp-Source: AGHT+IEe9+phwxQEu9tnnrIDg4Ni5d7woZbFCLHmXdNQycBCcnpUZYZxG6+gFl3WGlfM7NT25DpIMw== X-Received: by 2002:a05:600c:3aca:b0:41b:f788:8ca6 with SMTP id 5b1f17b1804b1-421649ea031mr16250575e9.8.1717749889331; Fri, 07 Jun 2024 01:44:49 -0700 (PDT) Received: from localhost (p509153eb.dip0.t-ipconnect.de. [80.145.83.235]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42158f30b6fsm74942805e9.10.2024.06.07.01.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 01:44:48 -0700 (PDT) From: "=?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Benson Leung Cc: Guenter Roeck , linux-pwm@vger.kernel.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] pwm: cros-ec: Simplify device tree xlation Date: Fri, 7 Jun 2024 10:44:16 +0200 Message-ID: <20240607084416.897777-7-u.kleine-koenig@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240607084416.897777-5-u.kleine-koenig@baylibre.com> References: <20240607084416.897777-5-u.kleine-koenig@baylibre.com> 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="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=2725; i=u.kleine-koenig@baylibre.com; h=from:subject; bh=14XoLLXGkugteQS++IsQ79UO0X3PLB2TkFVDwv7Adjs=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBmYshp7ZopTDwjLkhREFWcoeKD2bW+iMngzrmDw 7XS7XCoSPyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZmLIaQAKCRCPgPtYfRL+ TrqVCACZrlNisihbk7HuvKGftuT5C8DHUxuMDxsWqdZ37JAzsXeI4P21QvllL2Zu1Rs2hkrGhCs QFvS6CnGHJkmyCV9sqjx+6TXtSBR4jurcDqtRxfspMVNdrQK8PRgy0scPY/W8nsDLDamXpOjgeJ DT1x7ZVAl0Mux5twaab9SrRPt3F8lxSg6Reb9twrcRTs53C7nEA7W4rvN6VpRzL/OWttBdcxOfc RS9nHVSagx8nOB8PR0Ex+t9KyKCZ/gJ7EmVFxomvzbFQApkv6gV7C2o1YZ9jW8ih64/r4Xyyo15 q8VeUfZnwM1y4mE8l8mIcT1kGNtafUpXLfXrMq8Ve7HJsUuF X-Developer-Key: i=u.kleine-koenig@baylibre.com; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: quoted-printable The cros-ec device tree binding only uses #pwm-cells =3D <1>, and so there is no period provided in the device tree. Up to now this was handled by hardcoding the period to the only supported value in the custom xlate callback. Apart from that, the default xlate callback (i.e. of_pwm_xlate_with_flags()) handles this just fine (and better, e.g. by checking args->args_count >=3D 1 before accessing args->args[0]). To simplify make use of of_pwm_xlate_with_flags(), drop the custom callback and provide the default period in .probe() already. Apart from simplifying the driver this also drops the last non-core user of pwm_request_from_chip() and so makes further simplifications possible. Signed-off-by: Uwe Kleine-K=C3=B6nig Reviewed-by: Tzung-Bi Shih --- drivers/pwm/pwm-cros-ec.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/pwm/pwm-cros-ec.c b/drivers/pwm/pwm-cros-ec.c index ba4ee0b507b7..fcc33a2cb878 100644 --- a/drivers/pwm/pwm-cros-ec.c +++ b/drivers/pwm/pwm-cros-ec.c @@ -169,24 +169,6 @@ static int cros_ec_pwm_get_state(struct pwm_chip *chip= , struct pwm_device *pwm, return 0; } =20 -static struct pwm_device * -cros_ec_pwm_xlate(struct pwm_chip *chip, const struct of_phandle_args *arg= s) -{ - struct pwm_device *pwm; - - if (args->args[0] >=3D chip->npwm) - return ERR_PTR(-EINVAL); - - pwm =3D pwm_request_from_chip(chip, args->args[0], NULL); - if (IS_ERR(pwm)) - return pwm; - - /* The EC won't let us change the period */ - pwm->args.period =3D EC_PWM_MAX_DUTY; - - return pwm; -} - static const struct pwm_ops cros_ec_pwm_ops =3D { .get_state =3D cros_ec_pwm_get_state, .apply =3D cros_ec_pwm_apply, @@ -237,7 +219,7 @@ static int cros_ec_pwm_probe(struct platform_device *pd= ev) struct cros_ec_pwm_device *ec_pwm; struct pwm_chip *chip; bool use_pwm_type =3D false; - unsigned int npwm; + unsigned int i, npwm; int ret; =20 if (!ec) @@ -263,7 +245,17 @@ static int cros_ec_pwm_probe(struct platform_device *p= dev) =20 /* PWM chip */ chip->ops =3D &cros_ec_pwm_ops; - chip->of_xlate =3D cros_ec_pwm_xlate; + + /* + * The device tree binding for this device is special as it only uses a + * single cell (for the hwid) and so doesn't provide a default period. + * This isn't a big problem though as the hardware only supports a + * single period length, it's just a bit ugly to make this fit into the + * pwm core abstractions. So initialize the period here, as + * of_pwm_xlate_with_flags() won't do that for us. + */ + for (i =3D 0; i < npwm; ++i) + chip->pwms[i].args.period =3D EC_PWM_MAX_DUTY; =20 dev_dbg(dev, "Probed %u PWMs\n", chip->npwm); =20 --=20 2.43.0 From nobody Thu Feb 12 20:26:34 2026 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 9CA1515B57C for ; Fri, 7 Jun 2024 08:44:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717749894; cv=none; b=hqtgW5+zpJ5+ALqLklkyOGLmD5nZQUlblZ3Bz4Yy6nx24a4KZz5ha7OF3GrLJrwKautacC0KeUUrO6wfDqeG8n/vbOikE0Q+o/U8uVUxYxshVGkUiSu9/eAiNz0drPLG7TCKonTJKPEUdMpueZOIYAKM9VijoSlGzsOMc5rZSO4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717749894; c=relaxed/simple; bh=pYHQOtcajlYkO2UvuypDcCFMuwwUrbjcEVKx/JUgZzA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VFj++1/yNOETgPD9bmglVLMU/Aab7Q1vF9gHypf0oqanxLM2CwyqwZFT/Gn+p0QYeuIZQQIDmCIhoUqmjsV6GLBZBX4O64hFNEmOhwR+CWvZSaWvjHjdCltteHyXk8yr2Ggvv/hOcu8vvThc3j9iJQ/07GPWGBfqih+ykkd20uw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=w4m3BL4B; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="w4m3BL4B" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-35e5604abdcso1862004f8f.0 for ; Fri, 07 Jun 2024 01:44:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1717749891; x=1718354691; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XJ12BO1Q3zqF+jbfOVF1AOWg2ZgELy6bEhZ4o0FIEbs=; b=w4m3BL4BfRhRcDleFpxxX/fntOvM5UPXs+rb21CDZIXGZ7DjTUurRHp+by1mahPdRO gmt3uC/XD1eB7iXwp8YhiTUiYI9amKO38XPoRAfqem7JTvCfGOQ6AXNMDztygIF9a0PY YhEsAtVETWdgkkm1oWQ4IffNqsrTeQgYks91lu4sbZa61Sv8F8R6xNCyC9GrdU5giW0l Vy1Tx/Nr6BBnU3IC/POAsJuio6FPU0QjO31YDy8ls9DNFuZdgjp/BCbb8Q6i6bqWFP+0 4cDC4Q+x6eqOfi8+wFXwOKfUzk/q9YtqVkMUYE6KJCtP3hYoThPoUKOK7U6Nz+4OOhoQ mSuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717749891; x=1718354691; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XJ12BO1Q3zqF+jbfOVF1AOWg2ZgELy6bEhZ4o0FIEbs=; b=qNNz8gxEPI/n0ElQld+BjyU6UvT6y2hrVSP1oGQOln+zEwDCtfKy3+q3I+yo31gdyM SlFTiuFD88+b+w+PTN9mBhYa2fATdreMipB9BnJRic9/w9JU2RMqdX4+YGiIxkvN4tMz ZmHH0iMzgZtbZbefCmExbf9zrXtyhywrE72GWtBKlrh8d3BtI9xSoQWxjg3UejB/6AVZ 8WgW3Qm5qIoFeONbmLTqVbA+UCgliMaLRVkkqIgGOQg5VvOEKyJG47XoEvuBte0SZJRV hNW7sWcrWQ1FAZrYMl9nYJHBnurZ0gtevFJv7VFdmADdIomUU2pCvNXmmrJI5S3YGU/b yStQ== X-Forwarded-Encrypted: i=1; AJvYcCXzPkODTVsugrFHDefJ8icKfEf2sd2vHC81/FxFHyDyQ6gUy23oc1gMJUdME/PJMqS15FCk/keT6bEAR6eY280hWwPgoaVFchD9GEgG X-Gm-Message-State: AOJu0Yw4pxKY25XD8cf9z6d4u4NZJ7cZPZ53VVZlIz+MYUeHs79CUWTR kzsowK4JgRF4VepTj1OXDtQvzewBeKO9gD03Yh/pJ6z14wksunvAY1E3kzw58SVQXLMj5ENEAX6 VmLg= X-Google-Smtp-Source: AGHT+IGh+kuwHiLuK1bBWArmsRsE8afQG4h3QaPIej4FO6gC44YuXramv8tXWjYamNgw2BeRjMBf3g== X-Received: by 2002:a5d:6d05:0:b0:351:ce05:7a33 with SMTP id ffacd0b85a97d-35efea5f084mr2365877f8f.24.1717749891224; Fri, 07 Jun 2024 01:44:51 -0700 (PDT) Received: from localhost (p509153eb.dip0.t-ipconnect.de. [80.145.83.235]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35ef5d29df7sm3489453f8f.15.2024.06.07.01.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 01:44:50 -0700 (PDT) From: "=?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Benson Leung Cc: Guenter Roeck , linux-pwm@vger.kernel.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] pwm: Make pwm_request_from_chip() private to the core Date: Fri, 7 Jun 2024 10:44:17 +0200 Message-ID: <20240607084416.897777-8-u.kleine-koenig@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240607084416.897777-5-u.kleine-koenig@baylibre.com> References: <20240607084416.897777-5-u.kleine-koenig@baylibre.com> 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="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=2393; i=u.kleine-koenig@baylibre.com; h=from:subject; bh=pYHQOtcajlYkO2UvuypDcCFMuwwUrbjcEVKx/JUgZzA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBmYshtQF5fPNcDJuPUg0vnYZs3ok++9svfh1Uqo mX/jnRq9OKJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZmLIbQAKCRCPgPtYfRL+ Tk9XB/9zXuL9wQM2r1dDBlKHUbAlzqxNseCpsdYJQ/3XPf3g3SZi98SghVxrfer0cZIT7i27Q+f vqlOJTkg5J+EsS04l+IWs28TWnwQDFQY3vrD73nlfZETANSqWtfHXLs7dRy6WK8GCi/b+EzCIQ1 oFD40pBPwZJReo4CTtggqIpBsiHXoJ8CQB164ERUe8uRDEOTvqe6XEh14lzdEFlwf/Df8Bveakj 2adlrP3rG0/OjNDG9HS2FZ6OxhX0hYq8QTUohTgAzqKhFH9wxQMnTKEjKOCI6AlrlKolfFQZKRX N0U7mdlPhEFR7mlubRCeRxPAkf7AlaEsxBWS/CoWhTv0vKVH X-Developer-Key: i=u.kleine-koenig@baylibre.com; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: quoted-printable The last user of this function outside of core.c is gone, so it can be made static. Signed-off-by: Uwe Kleine-K=C3=B6nig Reviewed-by: Tzung-Bi Shih --- drivers/pwm/core.c | 8 +++----- include/linux/pwm.h | 12 ------------ 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 18574857641e..76969d5052af 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -394,9 +394,9 @@ static int pwm_device_request(struct pwm_device *pwm, c= onst char *label) * chip. A negative error code is returned if the index is not valid for t= he * specified PWM chip or if the PWM device cannot be requested. */ -struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip, - unsigned int index, - const char *label) +static struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip, + unsigned int index, + const char *label) { struct pwm_device *pwm; int err; @@ -414,8 +414,6 @@ struct pwm_device *pwm_request_from_chip(struct pwm_chi= p *chip, mutex_unlock(&pwm_lock); return pwm; } -EXPORT_SYMBOL_GPL(pwm_request_from_chip); - =20 struct pwm_device * of_pwm_xlate_with_flags(struct pwm_chip *chip, const struct of_phandle_arg= s *args) diff --git a/include/linux/pwm.h b/include/linux/pwm.h index 60b92c2c75ef..3ac1a04acc0e 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -407,10 +407,6 @@ void pwmchip_remove(struct pwm_chip *chip); int __devm_pwmchip_add(struct device *dev, struct pwm_chip *chip, struct m= odule *owner); #define devm_pwmchip_add(dev, chip) __devm_pwmchip_add(dev, chip, THIS_MOD= ULE) =20 -struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip, - unsigned int index, - const char *label); - struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *chip, const struct of_phandle_args *args); struct pwm_device *of_pwm_single_xlate(struct pwm_chip *chip, @@ -505,14 +501,6 @@ static inline int devm_pwmchip_add(struct device *dev,= struct pwm_chip *chip) return -EINVAL; } =20 -static inline struct pwm_device *pwm_request_from_chip(struct pwm_chip *ch= ip, - unsigned int index, - const char *label) -{ - might_sleep(); - return ERR_PTR(-ENODEV); -} - static inline struct pwm_device *pwm_get(struct device *dev, const char *consumer) { --=20 2.43.0