From patchwork Fri Sep 13 15:07:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 13803628 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92DB5FA375A for ; Fri, 13 Sep 2024 15:08:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1161310ED26; Fri, 13 Sep 2024 15:08:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lAxdKfPB"; dkim-atps=neutral Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id B93F210ED2A for ; Fri, 13 Sep 2024 15:08:39 +0000 (UTC) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5c413cf5de5so2844268a12.0 for ; Fri, 13 Sep 2024 08:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240118; x=1726844918; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KGV3WmFsQ+1pAhEILcS0ZUWipFofO4AxkBOKtNoxFJE=; b=lAxdKfPB0mmSrlqCSTUjgy4p4I4nvdMFhahDjpeHVrsh1RrlHSosz0JTLfVMp/U4yj Nx07+mIq9Q1yoWSd1pVMYtbWp0powNdUPnLX4VAmkJUsk4Cj6cXmQ9zsaSrP5ki3pGAb q3ZZHXxprqBFLrJucDrTmfec1ZRGQZvYMm2m/eUFoumT01h4wROgGoql7mWvdKZIvAhI L7XkL1ZAgOdhZqA5xYp7e0hDMHdK6TXOIBOTg9znmSkID4YZCfv5ApX2kXEkn9HwOdre u6ZAwgP7G4bhBQuEEIlEh3c1MsCkdT+P4uexxPXrKZh6jKgEUOj8m5+IL1SaaI/Wr0PS DlFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240118; x=1726844918; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KGV3WmFsQ+1pAhEILcS0ZUWipFofO4AxkBOKtNoxFJE=; b=E0fHWBJLnoEFGElEhimnzBH2rE0zxjrSCKZrUVcR+Wf6OV61QfBPrZhKSTkt3vVWJn 6Tk+cty5KIm+69KzPsjuvfmeImW9jdhHK36jXnxVCVa6s60YEjXnTTUher6Tr6RfeHwc PZE8g9h1fKh1ITcQ3qZTdovqRcxL9w963+JTYIiM7T6NtrOaSUuM6nClvHD109t+fIbN tCASWEhpQGLbtl3K7TAc+VFBBTKn9XvLYh34luLs4IlXlQ9zYnVfEQkEgPKhA7s43Heq wPgFcEhwq9QI4QDi+qKrCbmJLrti1sqiKB9tdGvSfj1UzzM4vUI8+Ulc91krVtGtQwcx Wubg== X-Forwarded-Encrypted: i=1; AJvYcCX0qSZ3E3NMYNKEuXaRm44bTLRxG6MGkY6A/yHMpkeAii26vFIMa0YXoSdYllxMrhUIwHFP6vOvWKY=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yx8WevSLb9+6H6t7FtTOZwkOHzNndZ5d7XvJ9H17MiEue/DMpBM 4kO/WCn6Q5WRuC6azVi0uf/boNorKDL49XZQJMb6yPm4vZrHPOxs X-Google-Smtp-Source: AGHT+IHmet3oVeZAIyzfyGhQipzCR5J7qgVMqR0U3qlYsOGLKQIFYN4djfEUjPbQ4Oc1wrwDnPBcKg== X-Received: by 2002:a50:cc07:0:b0:5bf:2577:32b8 with SMTP id 4fb4d7f45d1cf-5c413e10d16mr4591778a12.9.1726240118059; Fri, 13 Sep 2024 08:08:38 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:36 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:53 +0300 Subject: [PATCH v4 10/27] input: max77693: add max77705 haptic support MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-10-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> To: Sebastian Reichel , Bjorn Andersson , Michael Turquette , Stephen Boyd , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Dmitry Torokhov , Pavel Machek , Liam Girdwood , Mark Brown , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Dzmitry Sankouski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726240085; l=4227; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=JLT3fRS+yl6/Mb+tf79ZnYVcgNkISumMGZ+lQQFDBZo=; b=QWXeiajPIVlTrdpZ46bVxljmi2LWiwS0GqKpCG23HcYVw+Bp9aq3S2iNDvOVLBwdKDhO61jha OvHVW13g2C0BqFw1fsSf6jd+d1jSYQFH6MfjPlYVXo0cT3tjjJXeRfN X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add support for haptic controller on MAX77705 Multifunction device. This driver supports external pwm and LRA (Linear Resonant Actuator) motor. User can control the haptic device via force feedback framework. Signed-off-by: Dzmitry Sankouski --- Changes in v4: - add max77705 haptic support to max77693 driver - delete max77705-haptic --- drivers/input/misc/Kconfig | 4 ++-- drivers/input/misc/Makefile | 1 + drivers/input/misc/max77693-haptic.c | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 6a852c76331b..b4515c4e5cf6 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -241,11 +241,11 @@ config INPUT_MAX77650_ONKEY config INPUT_MAX77693_HAPTIC tristate "MAXIM MAX77693/MAX77843 haptic controller support" - depends on (MFD_MAX77693 || MFD_MAX77843) && PWM + depends on (MFD_MAX77693 || MFD_MAX77705 || MFD_MAX77843) && PWM select INPUT_FF_MEMLESS help This option enables support for the haptic controller on - MAXIM MAX77693 and MAX77843 chips. + MAXIM MAX77693, MAX77705 and MAX77843 chips. To compile this driver as module, choose M here: the module will be called max77693-haptic. diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index 4f7f736831ba..3e3532b27990 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -53,6 +53,7 @@ obj-$(CONFIG_INPUT_KXTJ9) += kxtj9.o obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o obj-$(CONFIG_INPUT_MAX77650_ONKEY) += max77650-onkey.o obj-$(CONFIG_INPUT_MAX77693_HAPTIC) += max77693-haptic.o +obj-$(CONFIG_INPUT_MAX77705_HAPTIC) += max77705-haptic.o obj-$(CONFIG_INPUT_MAX8925_ONKEY) += max8925_onkey.o obj-$(CONFIG_INPUT_MAX8997_HAPTIC) += max8997_haptic.o obj-$(CONFIG_INPUT_MC13783_PWRBUTTON) += mc13783-pwrbutton.o diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c index 0e646f1b257b..c3b9d33608d7 100644 --- a/drivers/input/misc/max77693-haptic.c +++ b/drivers/input/misc/max77693-haptic.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #define MAX_MAGNITUDE_SHIFT 16 @@ -115,6 +116,13 @@ static int max77693_haptic_configure(struct max77693_haptic *haptic, MAX77693_HAPTIC_PWM_DIVISOR_128); config_reg = MAX77693_HAPTIC_REG_CONFIG2; break; + case TYPE_MAX77705: + value = ((haptic->type << MAX77693_CONFIG2_MODE) | + (enable << MAX77693_CONFIG2_MEN) | + (haptic->mode << MAX77693_CONFIG2_HTYP) | + MAX77693_HAPTIC_PWM_DIVISOR_128); + config_reg = MAX77705_PMIC_REG_MCONFIG; + break; case TYPE_MAX77843: value = (haptic->type << MCONFIG_MODE_SHIFT) | (enable << MCONFIG_MEN_SHIFT) | @@ -312,6 +320,9 @@ static int max77693_haptic_probe(struct platform_device *pdev) case TYPE_MAX77693: haptic->regmap_haptic = max77693->regmap_haptic; break; + case TYPE_MAX77705: + haptic->regmap_haptic = max77693->regmap; + break; case TYPE_MAX77843: haptic->regmap_haptic = max77693->regmap; break; @@ -407,6 +418,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(max77693_haptic_pm_ops, static const struct platform_device_id max77693_haptic_id[] = { { "max77693-haptic", }, + { "max77705-haptic", }, { "max77843-haptic", }, {}, }; @@ -414,6 +426,7 @@ MODULE_DEVICE_TABLE(platform, max77693_haptic_id); static const struct of_device_id of_max77693_haptic_dt_match[] = { { .compatible = "maxim,max77693-haptic", }, + { .compatible = "maxim,max77705-haptic", }, { .compatible = "maxim,max77843-haptic", }, { /* sentinel */ }, }; @@ -432,5 +445,5 @@ module_platform_driver(max77693_haptic_driver); MODULE_AUTHOR("Jaewon Kim "); MODULE_AUTHOR("Krzysztof Kozlowski "); -MODULE_DESCRIPTION("MAXIM 77693/77843 Haptic driver"); +MODULE_DESCRIPTION("MAXIM 77693/77705/77843 Haptic driver"); MODULE_LICENSE("GPL");