Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp242895imj; Wed, 13 Feb 2019 07:37:37 -0800 (PST) X-Google-Smtp-Source: AHgI3IZjlLuO1GUfMrzK/ISVDcpf2S2khc5YZJQ8wj76WrZobx+x0KbMnMf1FVRDHobmOQ6D7RR0 X-Received: by 2002:a63:516:: with SMTP id 22mr933976pgf.353.1550072257707; Wed, 13 Feb 2019 07:37:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550072257; cv=none; d=google.com; s=arc-20160816; b=pWlks1gkcvQyTCiFVLEDuk2q8ToMWIkhu0pEXnTkcM5XJum3jrMAy5xcsBhq5fsXK+ IcYQB/B1qcQnz57YBDLn6Tl9IC3O7agJLUE768zbaNSje7u1OH9t8hbdeRquLk/NUYh5 9ujBmiyTUx6Le8XPBawxNE+gt7iHr3pvquzajLCtu0umR0P7+ZVsM1PY2fC8g2KEi8Dz Ttawf+ETIoFYdXlPooxAmjgnhdT1gAKfSX++fh5vTlM4xY+XgCFwfLgp1C2aHWs/P7jA 1G9+RtHGc/hFOvFeqMpd9Ko9QH5OSwgyjqQjnbPmtuo//mI/T8HA5Ur5lTCfHPNZ0Vr9 cxjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=9PsBb1VPUEYxBAoixX4RuhtRIFTN7lSrrueDRvXF3tE=; b=jBQRajV0Lay5SyIn1Rmi+vM4Sf9LD8z+nhECbeKKDCnAzG9bfPscOOwZtZ/LXBAwyu 8FOIwxhxrfx+PFK4Ey5oEx8kVRxcWAKcjJra0qdJbfvvisBj9VgynhBxrtBUbjgalcgj esiL0PKhTaIp29ybCzBT1PFsZPAK2MjPsGkInwQe5Y1CA6VyFjkjGBY7USAgDMasTUua WkSNfD0+PXZXMlqAw52ZlnROxns2248y9oqTV10So70BCgm/A77u9Ut+oMq7IBGPGv7p 7EP4RzAyATaRehQ/VxcpCeLdev0tXavk3rP4AX4fD1QH6WiKRzUFheefi5wi3dag0+Xv rBow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uj3WpOac; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b79si16837633pfe.273.2019.02.13.07.37.21; Wed, 13 Feb 2019 07:37:37 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uj3WpOac; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404160AbfBMPFX (ORCPT + 99 others); Wed, 13 Feb 2019 10:05:23 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36594 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbfBMPFT (ORCPT ); Wed, 13 Feb 2019 10:05:19 -0500 Received: by mail-wm1-f65.google.com with SMTP id j125so2784114wmj.1; Wed, 13 Feb 2019 07:05:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9PsBb1VPUEYxBAoixX4RuhtRIFTN7lSrrueDRvXF3tE=; b=uj3WpOacxzkSG8MLpIdVmB0Be2SWcUpRn1aMpOPSTAcXVUw59GCWAXR2Og+MFubMWs KUE0mGegVxIkWaViN2a55rRYpWY/BqcGqotQ2s/nMWNDB+J9T3p99YJfij2SQYku/LZl +z4CuspvbBKpVOGarM4tL0PMwR1jDLIq+Qv/zaxn1hCWk37SwtDkkCCoeI2CfOiEPygz 7vuH963xwWCr4yhnKJT55/s6IhukjHKolN8Si3Mtr2jqDFh49L1LQFJhzs6pH9G84gVI 0TAsijTU7OMkPsgEeSdQsgIRA6TLiF3yT6M9t+IWLdQRaHOZ5Dev26YtzPQhnAixmdWq 2cKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9PsBb1VPUEYxBAoixX4RuhtRIFTN7lSrrueDRvXF3tE=; b=IsaRwf84ZbpwsTFBVX6k+qkE4rA8EPZjwudPWft3EcB0AdlEcMrO/dvKMZ5SwCZzqL PmfcQXAW0tnSMqEWfPUFxwZ/uxn/9C/rlKKoepsv9p01JeHGcajr0asvNd0+Jnhkxhli AQc/jFG6f2CAiXItHpKybrlbmMTlcNIGzngQDklGE8iJv0P0uVQA6nH1bQfoV5aiRe6H B5lcc41s1NO+28S7HGKC6CEZ3kg0McC+T7JVlLoxAuqu7lK44H4KZydXSED3OYgoufu7 RG7GPyVIlseuEP8fIitnvAXEWF+LANI7V/QRjuRd2SkrupgO7b/imxCP/FYmVaTc//q3 LaSQ== X-Gm-Message-State: AHQUAuaNFH6TXCmAeA98/7n5oxfFF551pQ6Oolb4KpARAjt7VseYYtwc dq2x+IRLKTt+8jxsxxCcgzc= X-Received: by 2002:a7b:c766:: with SMTP id x6mr665699wmk.15.1550070316938; Wed, 13 Feb 2019 07:05:16 -0800 (PST) Received: from fuji.Parrot.Biz (smtp.parrot.biz. [62.23.167.188]) by smtp.gmail.com with ESMTPSA id f187sm7533959wma.4.2019.02.13.07.05.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 07:05:15 -0800 (PST) From: Mathieu Othacehe To: thierry.reding@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Mathieu Othacehe Subject: [PATCH v2 3/3] pwm: hibvt: Add hi3559v100 support Date: Wed, 13 Feb 2019 16:05:08 +0100 Message-Id: <20190213150508.11499-3-m.othacehe@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190213150508.11499-1-m.othacehe@gmail.com> References: <20190213150508.11499-1-m.othacehe@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for hi3559v100-shub-pwm and hisilicon,hi3559v100-pwm platforms. They require a special quirk: pwm has to be enabled again to force duty_cycle refresh. Signed-off-by: Mathieu Othacehe --- drivers/pwm/pwm-hibvt.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-hibvt.c b/drivers/pwm/pwm-hibvt.c index ffc803818c3c..b6a7942b3367 100644 --- a/drivers/pwm/pwm-hibvt.c +++ b/drivers/pwm/pwm-hibvt.c @@ -54,6 +54,7 @@ struct hibvt_pwm_chip { struct hibvt_pwm_soc { u32 num_pwms; + bool quirk_force_enable; }; static const struct hibvt_pwm_soc hi3516cv300_soc_info = { @@ -64,6 +65,16 @@ static const struct hibvt_pwm_soc hi3519v100_soc_info = { .num_pwms = 8, }; +static const struct hibvt_pwm_soc hi3559v100_shub_soc_info = { + .num_pwms = 8, + .quirk_force_enable = true, +}; + +static const struct hibvt_pwm_soc hi3559v100_soc_info = { + .num_pwms = 2, + .quirk_force_enable = true, +}; + static inline struct hibvt_pwm_chip *to_hibvt_pwm_chip(struct pwm_chip *chip) { return container_of(chip, struct hibvt_pwm_chip, chip); @@ -152,13 +163,24 @@ static void hibvt_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, static int hibvt_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, struct pwm_state *state) { + struct hibvt_pwm_chip *hi_pwm_chip = to_hibvt_pwm_chip(chip); + if (state->polarity != pwm->state.polarity) hibvt_pwm_set_polarity(chip, pwm, state->polarity); if (state->period != pwm->state.period || - state->duty_cycle != pwm->state.duty_cycle) + state->duty_cycle != pwm->state.duty_cycle) { hibvt_pwm_config(chip, pwm, state->duty_cycle, state->period); + /* + * On those platforms, it is required to enable the + * pwm again each time we want to refresh the duty + * cycle. + */ + if (hi_pwm_chip->soc->quirk_force_enable && state->enabled) + hibvt_pwm_enable(chip, pwm); + } + if (state->enabled != pwm->state.enabled) { if (state->enabled) hibvt_pwm_enable(chip, pwm); @@ -259,6 +281,10 @@ static const struct of_device_id hibvt_pwm_of_match[] = { .data = &hi3516cv300_soc_info }, { .compatible = "hisilicon,hi3519v100-pwm", .data = &hi3519v100_soc_info }, + { .compatible = "hisilicon,hi3559v100-shub-pwm", + .data = &hi3559v100_shub_soc_info }, + { .compatible = "hisilicon,hi3559v100-pwm", + .data = &hi3559v100_soc_info }, { } }; MODULE_DEVICE_TABLE(of, hibvt_pwm_of_match); -- 2.17.1