Received: by 10.223.185.116 with SMTP id b49csp1841880wrg; Thu, 22 Feb 2018 04:08:47 -0800 (PST) X-Google-Smtp-Source: AH8x224iXPYe+IXgn1RW+U9v1RQ1D3X1qAhPxoDRS7VbIW5jCOD/qM1uH4A1+tgcwEX+K8L84zwH X-Received: by 10.99.65.199 with SMTP id o190mr5571246pga.238.1519301327108; Thu, 22 Feb 2018 04:08:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519301327; cv=none; d=google.com; s=arc-20160816; b=cZ/yjX9doAjnF5P11Z/t+tF/U4I+8Rs6Otp3oZIwlj9ImAXr/aiLW6yNPRTntuYlgX y+jP+DDJmtl/MSWXXXCPRtcTta+e4ahxcDINS/adI//vHyB0og2S62DIuD0HMUuGbvGA 9Olcpwauwy3E79Nix+JlwwquYQ8uHqhhg/uuyoH5R3JHdcQEoo5Ge0isT1UxOrdZ+4l2 8amLxN0ywhfKYP9k5yBifKYqN1BMFXaTFFtdaqszdMB6Z83bjTQYwrD4DFzzS3i2du3O hM9BcLQED1ajaTnhPR6/vuESGFU0gUGPaiGHBZqi8agrBg8o0BBt0srZCrDoUiBp5wj+ eGVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=lKeko2f2E/iNuYBMELDHpVOBgGzshZBH2Z4esbdE5WY=; b=mP+ceSxGjTbw3Y5y30X0b9R6Ocld3WazF8/S2R8gEYXMABauuNMIK258IzxE20ljJS 2bw7BrAxSYPcDZX37v7ddNdWAhXq4Mm5dbM6S7ZG9kiEaG2veKDvWKUeCGIcn66wRw49 tCIdwh1CBUtk89snr9peQSrrtsrU03qE4p1wPFMEaHHE1xMlHN27QnN6gUUcMygHTcXR T7fAERcPnC2Hd4SvqVCzeP+gPKaNVXANO6syIQQ6FN0sKRc0lRG6xBl17uRSeoK2ses5 4/aMtaVos3oDN5P95NJJxHHXHPR/1qFX2wdIe7HxVWJIZdngEiUSAZnOeML56qRAYurd yggA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t134si2573498pgc.664.2018.02.22.04.08.32; Thu, 22 Feb 2018 04:08:47 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932249AbeBVMDF (ORCPT + 99 others); Thu, 22 Feb 2018 07:03:05 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:4383 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932121AbeBVMC5 (ORCPT ); Thu, 22 Feb 2018 07:02:57 -0500 X-IronPort-AV: E=Sophos;i="5.47,377,1515481200"; d="scan'208";a="12245955" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Feb 2018 05:02:55 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Thu, 22 Feb 2018 05:02:55 -0700 From: Claudiu Beznea To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , , , , , , , , , Claudiu Beznea Subject: [PATCH v3 02/10] pwm: clps711x: populate PWM mode in of_xlate function Date: Thu, 22 Feb 2018 14:01:13 +0200 Message-ID: <1519300881-8136-3-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519300881-8136-1-git-send-email-claudiu.beznea@microchip.com> References: <1519300881-8136-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Populate PWM mode in of_xlate function to avoid pwm_apply_state() failure. Signed-off-by: Claudiu Beznea --- drivers/pwm/pwm-clps711x.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-clps711x.c b/drivers/pwm/pwm-clps711x.c index 26ec24e457b1..2a4d31ab3af0 100644 --- a/drivers/pwm/pwm-clps711x.c +++ b/drivers/pwm/pwm-clps711x.c @@ -109,10 +109,20 @@ static const struct pwm_ops clps711x_pwm_ops = { static struct pwm_device *clps711x_pwm_xlate(struct pwm_chip *chip, const struct of_phandle_args *args) { + struct pwm_device *pwm; + struct pwm_caps caps; + if (args->args[0] >= chip->npwm) return ERR_PTR(-EINVAL); - return pwm_request_from_chip(chip, args->args[0], NULL); + pwm = pwm_request_from_chip(chip, args->args[0], NULL); + if (IS_ERR(pwm)) + return pwm; + + pwm_get_caps(chip, pwm, &caps); + pwm->args.mode = BIT(ffs(caps.modes) - 1); + + return pwm; } static int clps711x_pwm_probe(struct platform_device *pdev) -- 2.7.4