From patchwork Wed Mar 27 21:00:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jae Hyun Yoo X-Patchwork-Id: 10873937 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 75E1B139A for ; Wed, 27 Mar 2019 21:01:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63290287B5 for ; Wed, 27 Mar 2019 21:01:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5709D28B61; Wed, 27 Mar 2019 21:01:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEB68287B5 for ; Wed, 27 Mar 2019 21:01:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727617AbfC0VBB (ORCPT ); Wed, 27 Mar 2019 17:01:01 -0400 Received: from mga14.intel.com ([192.55.52.115]:46479 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726176AbfC0VBB (ORCPT ); Wed, 27 Mar 2019 17:01:01 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2019 14:01:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,277,1549958400"; d="scan'208";a="135345433" Received: from maru.jf.intel.com ([10.54.51.75]) by fmsmga008.fm.intel.com with ESMTP; 27 Mar 2019 14:01:00 -0700 From: Jae Hyun Yoo To: David Lechner , Dmitry Torokhov Cc: linux-input@vger.kernel.org, Jae Hyun Yoo Subject: [PATCH] Input: pwm-beeper - make 'amp' as an option Date: Wed, 27 Mar 2019 14:00:45 -0700 Message-Id: <20190327210045.21066-1-jae.hyun.yoo@linux.intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP An amplifier regulator property should be an option according to the binding document but currently it's not so this commit makes the amplifier regulator property as an option actually for cases that don't have the actual amplifier H/W. Fixes: 9e5492443278 ("Input: pwm-beeper - add optional amplifier regulator") Cc: David Lechner Cc: Dmitry Torokhov Signed-off-by: Jae Hyun Yoo --- drivers/input/misc/pwm-beeper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c index edca0d737750..a3baa52f187f 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c @@ -52,7 +52,7 @@ static int pwm_beeper_on(struct pwm_beeper *beeper, unsigned long period) if (error) return error; - if (!beeper->amplifier_on) { + if (beeper->amplifier && !beeper->amplifier_on) { error = regulator_enable(beeper->amplifier); if (error) { pwm_disable(beeper->pwm); @@ -67,7 +67,7 @@ static int pwm_beeper_on(struct pwm_beeper *beeper, unsigned long period) static void pwm_beeper_off(struct pwm_beeper *beeper) { - if (beeper->amplifier_on) { + if (beeper->amplifier && beeper->amplifier_on) { regulator_disable(beeper->amplifier); beeper->amplifier_on = false; } @@ -163,9 +163,9 @@ static int pwm_beeper_probe(struct platform_device *pdev) if (IS_ERR(beeper->amplifier)) { error = PTR_ERR(beeper->amplifier); if (error != -EPROBE_DEFER) - dev_err(dev, "Failed to get 'amp' regulator: %d\n", + dev_dbg(dev, "Failed to get 'amp' regulator: %d\n", error); - return error; + beeper->amplifier = NULL; } INIT_WORK(&beeper->work, pwm_beeper_work);