Linux Input/HID development
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] HID: intel-ish-hid: fix endian-conversion
From: srinivas pandruvada @ 2024-05-31  3:49 UTC (permalink / raw)
  To: Arnd Bergmann, Lixu Zhang, Arnd Bergmann, Jiri Kosina,
	Benjamin Tissoires
  Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <508d40bb-f2df-469a-9f94-58b41a28f53a@app.fastmail.com>

On Wed, 2024-05-29 at 15:18 +0200, Arnd Bergmann wrote:
> On Wed, May 29, 2024, at 09:05, Zhang, Lixu wrote:
> 
> > > 
> > > 	for (i = 0; i < fragment->fragment_cnt && offset <
> > > ish_fw->size; i++) {
> > You added a parameter fragment_count, but you didn't use it. Did
> > you 
> > intend to use it here?
> > 
> 
> My mistake, that was again broken in my incorrect
> rebase.
> 
Do you have updated patch? Lixu can try and make sure that the
functionality is not broken by changes.

Thanks,
Srinivas

>      Arnd


^ permalink raw reply

* Re: [PATCH 0/2] Input: silead - Always support 10 fingers
From: Hans de Goede @ 2024-05-31  6:25 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Ilpo Järvinen, Andy Shevchenko, linux-input,
	platform-driver-x86
In-Reply-To: <ZlkRzbF_T8vgzxcr@google.com>

Hi,

On 5/31/24 1:54 AM, Dmitry Torokhov wrote:
> On Mon, May 27, 2024 at 09:46:54AM +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 5/26/24 6:19 AM, Dmitry Torokhov wrote:
>>> On Sat, May 25, 2024 at 09:38:52PM +0200, Hans de Goede wrote:
>>>> Hi all,
>>>>
>>>> The first patch in this series stops making the maximum number of supported
>>>> fingers in silead_ts configurable, replacing this with simply hardcoding it
>>>> to 10.
>>>>
>>>> The main reason for doing so is to avoid the need to have a boiler-plate
>>>> "silead,max-fingers=10" property in each silead touchscreen config.
>>>> The second patch removes this boilerplate from all silead touchscreen
>>>> configs in touchscreen_dmi.c .
>>>>
>>>> Dmitry, since touchscreen_dmi.c sees regular updates I believe it is
>>>> best to merge the 2 patches separately. As long as I know that patch 1/2
>>>> is queued for merging for say 6.11 then I can merge patch 2/2 independently
>>>> for the same cycle.
>>>
>>> Why don't you merge both of them with my ack for the silead.c?
>>
>> That works for me too, thanks.
>>
>> One challenge here is that I typically send out new touchscreen_dmi
>> entries as fixes. Are you ok with merging the silead change as a fix
>> too ?
> 
> Sorry, I am not sure what you mean here. Do you mean you do not want to
> wait for the next merge window and send it earlier?

Yes that is what I meant, sorry for not being clear.

> If so I'm fine with it.

Thank you.

Regards,

Hans


^ permalink raw reply

* [syzbot] Monthly input report (May 2024)
From: syzbot @ 2024-05-31  6:48 UTC (permalink / raw)
  To: linux-input, linux-kernel, syzkaller-bugs

Hello input maintainers/developers,

This is a 31-day syzbot report for the input subsystem.
All related reports/information can be found at:
https://syzkaller.appspot.com/upstream/s/input

During the period, 4 new issues were detected and 0 were fixed.
In total, 24 issues are still open and 52 have been fixed so far.

Some of the still happening issues:

Ref  Crashes Repro Title
<1>  11549   Yes   WARNING in input_mt_init_slots
                   https://syzkaller.appspot.com/bug?extid=0122fa359a69694395d5
<2>  958     Yes   WARNING in implement
                   https://syzkaller.appspot.com/bug?extid=38e7237add3712479d65
<3>  646     No    possible deadlock in evdev_pass_values (2)
                   https://syzkaller.appspot.com/bug?extid=13d3cb2a3dc61e6092f5
<4>  380     Yes   INFO: task hung in uhid_char_release
                   https://syzkaller.appspot.com/bug?extid=8fe2d362af0e1cba8735
<5>  313     Yes   WARNING in cm109_urb_irq_callback/usb_submit_urb
                   https://syzkaller.appspot.com/bug?extid=2d6d691af5ab4b7e66df
<6>  19      Yes   possible deadlock in uinput_request_submit
                   https://syzkaller.appspot.com/bug?extid=159077b1355b8cd72757
<7>  13      Yes   WARNING in cm109_input_open/usb_submit_urb (3)
                   https://syzkaller.appspot.com/bug?extid=ac0f9c4cc1e034160492
<8>  8       Yes   INFO: task hung in __input_unregister_device (5)
                   https://syzkaller.appspot.com/bug?extid=78e2288f58b881ed3c45
<9>  4       Yes   WARNING in __input_unregister_device
                   https://syzkaller.appspot.com/bug?extid=b03b0fc32e288051502d
<10> 4       Yes   WARNING in input_unregister_device (2)
                   https://syzkaller.appspot.com/bug?extid=617f4ccb03b9869f6494

---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

To disable reminders for individual bugs, reply with the following command:
#syz set <Ref> no-reminders

To change bug's subsystems, reply with:
#syz set <Ref> subsystems: new-subsystem

You may send multiple commands in a single email message.

^ permalink raw reply

* Re: [PATCH V1 5/5] Add support for Awinic sar sensor.
From: Dan Carpenter @ 2024-05-31  8:12 UTC (permalink / raw)
  To: oe-kbuild, wangshuaijie, dmitry.torokhov, robh, krzk+dt, conor+dt,
	jeff, linux-input, devicetree, linux-kernel
  Cc: lkp, oe-kbuild-all, wangshuaijie, liweilei, kangjiajun
In-Reply-To: <20240529130608.783624-6-wangshuaijie@awinic.com>

Hi,

kernel test robot noticed the following build warnings:

url:    https://github.com/intel-lab-lkp/linux/commits/wangshuaijie-awinic-com/dt-bindings-input-Add-YAML-to-Awinic-sar-sensor/20240529-211303
base:   e0cce98fe279b64f4a7d81b7f5c3a23d80b92fbc
patch link:    https://lore.kernel.org/r/20240529130608.783624-6-wangshuaijie%40awinic.com
patch subject: [PATCH V1 5/5] Add support for Awinic sar sensor.
config: riscv-randconfig-r071-20240530 (https://download.01.org/0day-ci/archive/20240531/202405310138.ry5jf9hL-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 13.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202405310138.ry5jf9hL-lkp@intel.com/

New smatch warnings:
drivers/input/misc/aw_sar/aw_sar.c:221 aw_sar_load_bin_comm() warn: 'fw' from request_firmware() not released on lines: 217.
drivers/input/misc/aw_sar/aw_sar.c:283 aw_sar_irq() error: uninitialized symbol 'irq_status'.
drivers/input/misc/aw_sar/./aw9610x/aw9610x.c:479 aw9610x_get_chip_version() error: __builtin_memcpy() 'aw9610x->chip_name[__builtin_choose_expr((4 == 1), __builtin_strlen(aw9610x->chip_name), __fortify_strlen(aw9610x->chip_name))]' too small (1 vs 2)
drivers/input/misc/aw_sar/./aw963xx/aw963xx.c:227 aw963xx_sram_data_write() error: uninitialized symbol 'ret'.
drivers/input/misc/aw_sar/./aw963xx/aw963xx.c:522 aw963xx_get_cap_offset() warn: inconsistent indenting

Old smatch warnings:
drivers/input/misc/aw_sar/./aw963xx/aw963xx.c:557 aw963xx_get_cap_offset() warn: inconsistent indenting

vim +/fw +221 drivers/input/misc/aw_sar/aw_sar.c

e5df082e247559 shuaijie wang 2024-05-29  203  static int32_t aw_sar_load_bin_comm(struct aw_sar *p_sar)
e5df082e247559 shuaijie wang 2024-05-29  204  {
e5df082e247559 shuaijie wang 2024-05-29  205  	const struct firmware *fw;
e5df082e247559 shuaijie wang 2024-05-29  206  	int32_t ret;
e5df082e247559 shuaijie wang 2024-05-29  207  
e5df082e247559 shuaijie wang 2024-05-29  208  	ret = request_firmware(&fw, p_sar->load_bin.bin_name, p_sar->dev);
e5df082e247559 shuaijie wang 2024-05-29  209  	if (ret != 0) {
e5df082e247559 shuaijie wang 2024-05-29  210  		dev_err(p_sar->dev, "parse %s error!", p_sar->load_bin.bin_name);
e5df082e247559 shuaijie wang 2024-05-29  211  		return ret;
e5df082e247559 shuaijie wang 2024-05-29  212  	}
e5df082e247559 shuaijie wang 2024-05-29  213  
e5df082e247559 shuaijie wang 2024-05-29  214  	ret = aw_sar_parse_bin(fw, p_sar);
e5df082e247559 shuaijie wang 2024-05-29  215  	if (ret != 0) {
e5df082e247559 shuaijie wang 2024-05-29  216  		dev_err(p_sar->dev, "reg_bin %s load error!", p_sar->load_bin.bin_name);

release_firmware(fw);

e5df082e247559 shuaijie wang 2024-05-29  217  		return ret;
e5df082e247559 shuaijie wang 2024-05-29  218  	}
e5df082e247559 shuaijie wang 2024-05-29  219  	release_firmware(fw);
e5df082e247559 shuaijie wang 2024-05-29  220  
e5df082e247559 shuaijie wang 2024-05-29 @221  	return 0;
e5df082e247559 shuaijie wang 2024-05-29  222  }
e5df082e247559 shuaijie wang 2024-05-29  223  
e5df082e247559 shuaijie wang 2024-05-29  224  static int32_t aw_sar_parse_dts_comm(struct device *dev, struct device_node *np,
e5df082e247559 shuaijie wang 2024-05-29  225  		struct aw_sar_dts_info *p_dts_info)
e5df082e247559 shuaijie wang 2024-05-29  226  {
e5df082e247559 shuaijie wang 2024-05-29  227  	int32_t val;
e5df082e247559 shuaijie wang 2024-05-29  228  
e5df082e247559 shuaijie wang 2024-05-29  229  	val = of_property_read_u32(np, "sar-num", &p_dts_info->sar_num);
e5df082e247559 shuaijie wang 2024-05-29  230  	dev_info(dev, "sar num = %d", p_dts_info->sar_num);
e5df082e247559 shuaijie wang 2024-05-29  231  	if (val != 0) {
e5df082e247559 shuaijie wang 2024-05-29  232  		dev_err(dev, "multiple sar failed!");
e5df082e247559 shuaijie wang 2024-05-29  233  		return -EINVAL;
e5df082e247559 shuaijie wang 2024-05-29  234  	}
e5df082e247559 shuaijie wang 2024-05-29  235  
e5df082e247559 shuaijie wang 2024-05-29  236  	p_dts_info->irq_gpio = of_get_named_gpio(np, "irq-gpio", 0);
e5df082e247559 shuaijie wang 2024-05-29  237  	if (p_dts_info->irq_gpio < 0) {
e5df082e247559 shuaijie wang 2024-05-29  238  		p_dts_info->irq_gpio = -1;
e5df082e247559 shuaijie wang 2024-05-29  239  		dev_err(dev, "no irq gpio provided.");
e5df082e247559 shuaijie wang 2024-05-29  240  		return -EINVAL;
e5df082e247559 shuaijie wang 2024-05-29  241  	}
e5df082e247559 shuaijie wang 2024-05-29  242  
e5df082e247559 shuaijie wang 2024-05-29  243  	val = of_property_read_u32(np, "channel_use_flag", &p_dts_info->channel_use_flag);
e5df082e247559 shuaijie wang 2024-05-29  244  	if (val != 0) {
e5df082e247559 shuaijie wang 2024-05-29  245  		dev_err(dev, "channel_use_flag failed!");
e5df082e247559 shuaijie wang 2024-05-29  246  		return -EINVAL;
e5df082e247559 shuaijie wang 2024-05-29  247  	}
e5df082e247559 shuaijie wang 2024-05-29  248  
e5df082e247559 shuaijie wang 2024-05-29  249  	//GPIO is set as internal pull-up input
e5df082e247559 shuaijie wang 2024-05-29  250  	p_dts_info->use_inter_pull_up = of_property_read_bool(np, "aw_sar,pin_set_inter_pull-up");
e5df082e247559 shuaijie wang 2024-05-29  251  	p_dts_info->use_pm = of_property_read_bool(np, "aw_sar,using_pm_ops");
e5df082e247559 shuaijie wang 2024-05-29  252  	p_dts_info->update_fw_flag = of_property_read_bool(np, "aw_sar,update_fw");
e5df082e247559 shuaijie wang 2024-05-29  253  	p_dts_info->use_plug_cail_flag = of_property_read_bool(np, "aw_sar,use_plug_cail");
e5df082e247559 shuaijie wang 2024-05-29  254  	p_dts_info->monitor_esd_flag = of_property_read_bool(np, "aw_sar,monitor_esd");
e5df082e247559 shuaijie wang 2024-05-29  255  
e5df082e247559 shuaijie wang 2024-05-29  256  	return 0;
e5df082e247559 shuaijie wang 2024-05-29  257  }
e5df082e247559 shuaijie wang 2024-05-29  258  
e5df082e247559 shuaijie wang 2024-05-29  259  static int32_t aw_sar_parse_dts(struct aw_sar *p_sar)
e5df082e247559 shuaijie wang 2024-05-29  260  {
e5df082e247559 shuaijie wang 2024-05-29  261  	int32_t ret;
e5df082e247559 shuaijie wang 2024-05-29  262  
e5df082e247559 shuaijie wang 2024-05-29  263  	ret = aw_sar_parse_dts_comm(p_sar->dev, p_sar->i2c->dev.of_node, &p_sar->dts_info);
e5df082e247559 shuaijie wang 2024-05-29  264  
e5df082e247559 shuaijie wang 2024-05-29  265  	//Special requirements of SAR chip
e5df082e247559 shuaijie wang 2024-05-29  266  	if (p_sar->p_sar_para->p_platform_config->p_add_parse_dts_fn != NULL)
e5df082e247559 shuaijie wang 2024-05-29  267  		ret |= p_sar->p_sar_para->p_platform_config->p_add_parse_dts_fn(p_sar);
e5df082e247559 shuaijie wang 2024-05-29  268  
e5df082e247559 shuaijie wang 2024-05-29  269  	return ret;
e5df082e247559 shuaijie wang 2024-05-29  270  }
e5df082e247559 shuaijie wang 2024-05-29  271  
e5df082e247559 shuaijie wang 2024-05-29  272  static irqreturn_t aw_sar_irq(int32_t irq, void *data)
e5df082e247559 shuaijie wang 2024-05-29  273  {
e5df082e247559 shuaijie wang 2024-05-29  274  	struct aw_sar *p_sar = (struct aw_sar *)data;
e5df082e247559 shuaijie wang 2024-05-29  275  	uint32_t irq_status;
e5df082e247559 shuaijie wang 2024-05-29  276  
e5df082e247559 shuaijie wang 2024-05-29  277  	//step1: read clear interrupt
e5df082e247559 shuaijie wang 2024-05-29  278  	if (p_sar->p_sar_para->p_platform_config->p_irq_init->rc_irq_fn != NULL)
e5df082e247559 shuaijie wang 2024-05-29  279  		irq_status = p_sar->p_sar_para->p_platform_config->p_irq_init->rc_irq_fn(p_sar->i2c);
e5df082e247559 shuaijie wang 2024-05-29  280  
e5df082e247559 shuaijie wang 2024-05-29  281  	//step2: Read the status register for status reporting
e5df082e247559 shuaijie wang 2024-05-29  282  	if (p_sar->p_sar_para->p_platform_config->p_irq_init->irq_spec_handler_fn != NULL)
e5df082e247559 shuaijie wang 2024-05-29 @283  		p_sar->p_sar_para->p_platform_config->p_irq_init->irq_spec_handler_fn(irq_status,
e5df082e247559 shuaijie wang 2024-05-29  284  				p_sar);

Probably if ->irq_spec_handler_fn is non-NULL then ->rc_irq_fn is also
non-NULL, but the static checker doesn't know that so it warns about
uninitialized variables.

e5df082e247559 shuaijie wang 2024-05-29  285  
e5df082e247559 shuaijie wang 2024-05-29  286  	//step3: The chip
e5df082e247559 shuaijie wang 2024-05-29  287  
e5df082e247559 shuaijie wang 2024-05-29  288  	if ((!p_sar->dts_info.monitor_esd_flag) && (p_sar->fault_flag == AW_SAR_UNHEALTHY)) {
e5df082e247559 shuaijie wang 2024-05-29  289  		p_sar->fault_flag = AW_SAR_HEALTHY;
e5df082e247559 shuaijie wang 2024-05-29  290  		disable_irq_nosync(p_sar->irq_init.to_irq);
e5df082e247559 shuaijie wang 2024-05-29  291  		p_sar->irq_init.host_irq_stat = IRQ_DISABLE;
e5df082e247559 shuaijie wang 2024-05-29  292  		//aw_sar_soft_reset(p_sar);
e5df082e247559 shuaijie wang 2024-05-29  293  		schedule_delayed_work(&p_sar->update_work, msecs_to_jiffies(500));
e5df082e247559 shuaijie wang 2024-05-29  294  	}
e5df082e247559 shuaijie wang 2024-05-29  295  
e5df082e247559 shuaijie wang 2024-05-29  296  	return IRQ_HANDLED;
e5df082e247559 shuaijie wang 2024-05-29  297  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply

* RE: [PATCH 1/2] HID: intel-ish-hid: fix cache management mistake
From: Zhang, Lixu @ 2024-05-31  8:51 UTC (permalink / raw)
  To: srinivas pandruvada, Arnd Bergmann, Arnd Bergmann, Jiri Kosina,
	Benjamin Tissoires, Xu, Even
  Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <ed3236173ff6fdb1cb6962f388b41e6b90586335.camel@linux.intel.com>

>-----Original Message-----
>From: Zhang, Lixu
>Sent: Thursday, May 30, 2024 3:42 PM
>To: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>; Arnd
>Bergmann <arnd@arndb.de>; Arnd Bergmann <arnd@kernel.org>; Jiri Kosina
><jikos@kernel.org>; Benjamin Tissoires <bentiss@kernel.org>; Xu, Even
><even.xu@intel.com>
>Cc: linux-input@vger.kernel.org; linux-kernel@vger.kernel.org
>Subject: RE: [PATCH 1/2] HID: intel-ish-hid: fix cache management mistake
>
>>-----Original Message-----
>>From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
>>Sent: Thursday, May 30, 2024 6:25 AM
>>To: Arnd Bergmann <arnd@arndb.de>; Zhang, Lixu <lixu.zhang@intel.com>;
>>Arnd Bergmann <arnd@kernel.org>; Jiri Kosina <jikos@kernel.org>;
>>Benjamin Tissoires <bentiss@kernel.org>
>>Cc: linux-input@vger.kernel.org; linux-kernel@vger.kernel.org
>>Subject: Re: [PATCH 1/2] HID: intel-ish-hid: fix cache management
>>mistake
>>
>>On Wed, 2024-05-29 at 09:06 +0200, Arnd Bergmann wrote:
>>> On Wed, May 29, 2024, at 08:46, Zhang, Lixu wrote:
>>> > >
>>> >
>>> > > +		dma_wmb();
>>> > I tested it on the platform, but it didn't wok.
>>> >
>>>
>>> What behavior do you see instead?
>Hi Arnd, please refer to the information below.
>
>>> If the manual cache flush works
>>> around a bug, that would indicate that the device itself is not
>>> coherent and the dma_alloc_coherent() in the architecture is broken.
>>
Hi Arnd,

Flush cache is necessary for some performance reason on this device.

Thanks,
Lixu

^ permalink raw reply

* [PATCH] HID: nintendo: Remove some unused functions
From: Jiapeng Chong @ 2024-05-31  8:55 UTC (permalink / raw)
  To: djogorchock
  Cc: jikos, bentiss, linux-input, linux-kernel, Jiapeng Chong,
	Abaci Robot

These functions are defined in the hid-nintendo.c file, but not
called elsewhere, so delete these unused functions.

drivers/hid/hid-nintendo.c:672:20: warning: unused function 'joycon_device_is_procon'.
drivers/hid/hid-nintendo.c:682:20: warning: unused function 'joycon_device_is_snescon'.
drivers/hid/hid-nintendo.c:687:20: warning: unused function 'joycon_device_is_gencon'.
drivers/hid/hid-nintendo.c:692:20: warning: unused function 'joycon_device_is_n64con'.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9265
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/hid/hid-nintendo.c | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
index b4a97803eca3..be7f7e47d65f 100644
--- a/drivers/hid/hid-nintendo.c
+++ b/drivers/hid/hid-nintendo.c
@@ -658,7 +658,6 @@ struct joycon_ctlr {
 	(ctlr->ctlr_type == JOYCON_CTLR_TYPE_JCR || \
 	 ctlr->ctlr_type == JOYCON_CTLR_TYPE_PRO)
 
-
 /*
  * Controller device helpers
  *
@@ -669,31 +668,11 @@ struct joycon_ctlr {
  * These helpers are most useful early during the HID probe or in conjunction
  * with the capability helpers below.
  */
-static inline bool joycon_device_is_procon(struct joycon_ctlr *ctlr)
-{
-	return ctlr->hdev->product == USB_DEVICE_ID_NINTENDO_PROCON;
-}
-
 static inline bool joycon_device_is_chrggrip(struct joycon_ctlr *ctlr)
 {
 	return ctlr->hdev->product == USB_DEVICE_ID_NINTENDO_CHRGGRIP;
 }
 
-static inline bool joycon_device_is_snescon(struct joycon_ctlr *ctlr)
-{
-	return ctlr->hdev->product == USB_DEVICE_ID_NINTENDO_SNESCON;
-}
-
-static inline bool joycon_device_is_gencon(struct joycon_ctlr *ctlr)
-{
-	return ctlr->hdev->product == USB_DEVICE_ID_NINTENDO_GENCON;
-}
-
-static inline bool joycon_device_is_n64con(struct joycon_ctlr *ctlr)
-{
-	return ctlr->hdev->product == USB_DEVICE_ID_NINTENDO_N64CON;
-}
-
 /*
  * Controller type helpers
  *
-- 
2.20.1.7.g153144c


^ permalink raw reply related

* Re: [PATCH] hid: asus: asus_report_fixup: fix potential read out of bounds
From: Dan Carpenter @ 2024-05-31  8:59 UTC (permalink / raw)
  To: Andrew Ballance
  Cc: syzbot+07762f019fd03d01f04c, benjamin.tissoires, bentiss, jikos,
	jkosina, linux-input, linux-kernel, linux-usb, luke,
	syzkaller-bugs, linux-kernel-mentees, skhan
In-Reply-To: <20240528050555.1150628-1-andrewjballance@gmail.com>

On Tue, May 28, 2024 at 12:05:39AM -0500, Andrew Ballance wrote:
> #syz test
> 
> there may be a read out of the bounds of rdesc.
> this adds bounds checks
> 
> Signed-off-by: Andrew Ballance <andrewjballance@gmail.com>
> ---
>  drivers/hid/hid-asus.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index 02de2bf4f790..37e6d25593c2 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
> @@ -1204,8 +1204,8 @@ static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
>  	}
>  
>  	/* match many more n-key devices */
> -	if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
> -		for (int i = 0; i < *rsize + 1; i++) {
> +	if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD && *rsize > 15) {
> +		for (int i = 0; i < *rsize - 15; i++) {

Yep.  This looks correct.  Please resend with a complete commit message
and a fixes tag etc.

>  			/* offset to the count from 0x5a report part always 14 */
>  			if (rdesc[i] == 0x85 && rdesc[i + 1] == 0x5a &&
>  			    rdesc[i + 14] == 0x95 && rdesc[i + 15] == 0x05) {

regards,
dan carpenter

^ permalink raw reply

* Re: [PATCH v6 2/5] mfd: add driver for Marvell 88PM886 PMIC
From: Lee Jones @ 2024-05-31 10:24 UTC (permalink / raw)
  To: Karel Balej
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Dmitry Torokhov,
	Liam Girdwood, Mark Brown, devicetree, linux-kernel, linux-input,
	Duje Mihanović, ~postmarketos/upstreaming, phone-devel
In-Reply-To: <20240504194632.2456-3-balejk@matfyz.cz>

On Sat, 04 May 2024, Karel Balej wrote:

> Marvell 88PM886 is a PMIC which provides various functions such as
> onkey, battery, charger and regulators. It is found for instance in the
> samsung,coreprimevelte smartphone with which this was tested. Implement
> basic support to allow for the use of regulators and onkey.
> 
> Signed-off-by: Karel Balej <balejk@matfyz.cz>
> ---
> 
> Notes:
>     v6:
>     - Address Lee's comments:
>       - Don't break long line in the power off handler.
>       - Set PLATFORM_DEVID_NONE. This should be safe with respect to
>         collisions since there are no known devices with more than one of
>         these PMICs, plus given their general purpose nature it is unlikely
>         that there would ever be. Also include the corresponding header.
>       - Move all defines to the header.
>     - Give the base page's maximum register its real name.
>     - Set irq_base to 0.
>     v5:
>     - Address Mark's feedback:
>       - Move regmap config back out of the header and rename it. Also lower
>         its maximum register based on what's actually used in the downstream
>         code.
>     RFC v4:
>     - Use MFD_CELL_* macros.
>     - Address Lee's feedback:
>       - Do not define regmap_config.val_bits and .reg_bits.
>       - Drop everything regulator related except mfd_cell (regmap
>         initialization, IDs enum etc.). Drop pm886_initialize_subregmaps.
>       - Do not store regmap pointers as an array as there is now only one
>         regmap. Also drop the corresponding enum.
>       - Move regmap_config to the header as it is needed in the regulators
>         driver.
>       - pm886_chip.whoami -> chip_id
>       - Reword chip ID mismatch error message and print the ID as
>         hexadecimal.
>       - Fix includes in include/linux/88pm886.h.
>       - Drop the pm886_irq_number enum and define the (for the moment) only
>         IRQ explicitly.
>     - Have only one MFD cell for all regulators as they are now registered
>       all at once in the regulators driver.
>     - Reword commit message.
>     - Make device table static and remove comma after the sentinel to signal
>       that nothing should come after it.
>     RFC v3:
>     - Drop onkey cell .of_compatible.
>     - Rename LDO page offset and regmap to REGULATORS.
>     RFC v2:
>     - Remove some abstraction.
>     - Sort includes alphabetically and add linux/of.h.
>     - Depend on OF, remove of_match_ptr and add MODULE_DEVICE_TABLE.
>     - Use more temporaries and break long lines.
>     - Do not initialize ret in probe.
>     - Use the wakeup-source DT property.
>     - Rename ret to err.
>     - Address Lee's comments:
>       - Drop patched in presets for base regmap and related defines.
>       - Use full sentences in comments.
>       - Remove IRQ comment.
>       - Define regmap_config member values.
>       - Rename data to sys_off_data.
>       - Add _PMIC suffix to Kconfig.
>       - Use dev_err_probe.
>       - Do not store irq_data.
>       - s/WHOAMI/CHIP_ID
>       - Drop LINUX part of include guard name.
>       - Merge in the regulator series modifications in order to have more
>         devices and modify the commit message accordingly. Changes with
>         respect to the original regulator series patches:
>         - ret -> err
>         - Add temporary for dev in pm88x_initialize_subregmaps.
>         - Drop of_compatible for the regulators.
>         - Do not duplicate LDO regmap for bucks.
>     - Rewrite commit message.
> 
>  drivers/mfd/88pm886.c       | 148 ++++++++++++++++++++++++++++++++++++
>  drivers/mfd/Kconfig         |  12 +++
>  drivers/mfd/Makefile        |   1 +
>  include/linux/mfd/88pm886.h |  69 +++++++++++++++++
>  4 files changed, 230 insertions(+)
>  create mode 100644 drivers/mfd/88pm886.c
>  create mode 100644 include/linux/mfd/88pm886.h

I don't see any more issues.

Are you planning on seeing to Mark's review comments?

-- 
Lee Jones [李琼斯]

^ permalink raw reply

* Re: [PATCH v6 2/5] mfd: add driver for Marvell 88PM886 PMIC
From: Karel Balej @ 2024-05-31 12:25 UTC (permalink / raw)
  To: Lee Jones
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Dmitry Torokhov,
	Liam Girdwood, Mark Brown, devicetree, linux-kernel, linux-input,
	Duje Mihanović, ~postmarketos/upstreaming, phone-devel
In-Reply-To: <20240531102409.GB1005600@google.com>

Lee Jones, 2024-05-31T11:24:52+01:00:
> Are you planning on seeing to Mark's review comments?

Indeed, I'm hoping that I will be able to send it over the weekend.

K. B.

^ permalink raw reply

* Re: [PATCH HID 03/13] HID: bpf: implement HID-BPF through bpf_struct_ops
From: kernel test robot @ 2024-05-31 12:29 UTC (permalink / raw)
  To: Benjamin Tissoires, Shuah Khan, Jiri Kosina, Jonathan Corbet,
	Alexei Starovoitov
  Cc: oe-kbuild-all, linux-kselftest, linux-kernel, bpf, linux-input,
	linux-doc, Benjamin Tissoires
In-Reply-To: <20240528-hid_bpf_struct_ops-v1-3-8c6663df27d8@kernel.org>

Hi Benjamin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 70ec81c2e2b4005465ad0d042e90b36087c36104]

url:    https://github.com/intel-lab-lkp/linux/commits/Benjamin-Tissoires/HID-rename-struct-hid_bpf_ops-into-hid_ops/20240528-212222
base:   70ec81c2e2b4005465ad0d042e90b36087c36104
patch link:    https://lore.kernel.org/r/20240528-hid_bpf_struct_ops-v1-3-8c6663df27d8%40kernel.org
patch subject: [PATCH HID 03/13] HID: bpf: implement HID-BPF through bpf_struct_ops
config: i386-buildonly-randconfig-002-20240531 (https://download.01.org/0day-ci/archive/20240531/202405312035.U1rZN04z-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240531/202405312035.U1rZN04z-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405312035.U1rZN04z-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/bpf_verifier.h:7:0,
                    from drivers/hid/bpf/hid_bpf_struct_ops.c:10:
   drivers/hid/bpf/hid_bpf_struct_ops.c: In function 'hid_bpf_struct_ops_init':
>> include/linux/bpf.h:1844:50: warning: statement with no effect [-Wunused-value]
    #define register_bpf_struct_ops(st_ops, type) ({ (void *)(st_ops); 0; })
                                                     ^~~~~~~~~~~~~~~~
   drivers/hid/bpf/hid_bpf_struct_ops.c:244:9: note: in expansion of macro 'register_bpf_struct_ops'
     return register_bpf_struct_ops(&bpf_hid_bpf_ops, hid_bpf_ops);
            ^~~~~~~~~~~~~~~~~~~~~~~


vim +1844 include/linux/bpf.h

c196906d50e360d Hou Tao          2021-10-25  1834  
c196906d50e360d Hou Tao          2021-10-25  1835  int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr,
c196906d50e360d Hou Tao          2021-10-25  1836  			    union bpf_attr __user *uattr);
c196906d50e360d Hou Tao          2021-10-25  1837  #endif
f6be98d19985411 Kui-Feng Lee     2024-01-19  1838  int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,
f6be98d19985411 Kui-Feng Lee     2024-01-19  1839  			     struct btf *btf,
f6be98d19985411 Kui-Feng Lee     2024-01-19  1840  			     struct bpf_verifier_log *log);
1338b93346587a2 Kui-Feng Lee     2024-01-19  1841  void bpf_map_struct_ops_info_fill(struct bpf_map_info *info, struct bpf_map *map);
1611603537a4b88 Kui-Feng Lee     2024-02-08  1842  void bpf_struct_ops_desc_release(struct bpf_struct_ops_desc *st_ops_desc);
27ae7997a66174c Martin KaFai Lau 2020-01-08  1843  #else
f6be98d19985411 Kui-Feng Lee     2024-01-19 @1844  #define register_bpf_struct_ops(st_ops, type) ({ (void *)(st_ops); 0; })
85d33df357b6346 Martin KaFai Lau 2020-01-08  1845  static inline bool bpf_try_module_get(const void *data, struct module *owner)
85d33df357b6346 Martin KaFai Lau 2020-01-08  1846  {
85d33df357b6346 Martin KaFai Lau 2020-01-08  1847  	return try_module_get(owner);
85d33df357b6346 Martin KaFai Lau 2020-01-08  1848  }
85d33df357b6346 Martin KaFai Lau 2020-01-08  1849  static inline void bpf_module_put(const void *data, struct module *owner)
85d33df357b6346 Martin KaFai Lau 2020-01-08  1850  {
85d33df357b6346 Martin KaFai Lau 2020-01-08  1851  	module_put(owner);
85d33df357b6346 Martin KaFai Lau 2020-01-08  1852  }
85d33df357b6346 Martin KaFai Lau 2020-01-08  1853  static inline int bpf_struct_ops_map_sys_lookup_elem(struct bpf_map *map,
85d33df357b6346 Martin KaFai Lau 2020-01-08  1854  						     void *key,
85d33df357b6346 Martin KaFai Lau 2020-01-08  1855  						     void *value)
85d33df357b6346 Martin KaFai Lau 2020-01-08  1856  {
85d33df357b6346 Martin KaFai Lau 2020-01-08  1857  	return -EINVAL;
85d33df357b6346 Martin KaFai Lau 2020-01-08  1858  }
68b04864ca425d1 Kui-Feng Lee     2023-03-22  1859  static inline int bpf_struct_ops_link_create(union bpf_attr *attr)
68b04864ca425d1 Kui-Feng Lee     2023-03-22  1860  {
68b04864ca425d1 Kui-Feng Lee     2023-03-22  1861  	return -EOPNOTSUPP;
68b04864ca425d1 Kui-Feng Lee     2023-03-22  1862  }
1338b93346587a2 Kui-Feng Lee     2024-01-19  1863  static inline void bpf_map_struct_ops_info_fill(struct bpf_map_info *info, struct bpf_map *map)
1338b93346587a2 Kui-Feng Lee     2024-01-19  1864  {
1338b93346587a2 Kui-Feng Lee     2024-01-19  1865  }
68b04864ca425d1 Kui-Feng Lee     2023-03-22  1866  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply

* [PATCH] [v2] HID: intel-ish-hid: fix endian-conversion
From: Arnd Bergmann @ 2024-05-31 16:28 UTC (permalink / raw)
  To: Srinivas Pandruvada, Jiri Kosina, Benjamin Tissoires, Zhang Lixu
  Cc: Arnd Bergmann, linux-input, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The newly added file causes a ton of sparse warnings about the
incorrect use of __le32 and similar types:

drivers/hid/intel-ish-hid/ishtp/loader.h:41:23: error: invalid bitfield specifier for type restricted __le32.
drivers/hid/intel-ish-hid/ishtp/loader.h:42:27: error: invalid bitfield specifier for type restricted __le32.
drivers/hid/intel-ish-hid/ishtp/loader.h:43:24: error: invalid bitfield specifier for type restricted __le32.
drivers/hid/intel-ish-hid/ishtp/loader.h:44:24: error: invalid bitfield specifier for type restricted __le32.
drivers/hid/intel-ish-hid/ishtp/loader.h:45:22: error: invalid bitfield specifier for type restricted __le32.
drivers/hid/intel-ish-hid/ishtp/loader.c:172:33: warning: restricted __le32 degrades to integer
drivers/hid/intel-ish-hid/ishtp/loader.c:178:50: warning: incorrect type in assignment (different base types)
drivers/hid/intel-ish-hid/ishtp/loader.c:178:50:    expected restricted __le32 [usertype] length
drivers/hid/intel-ish-hid/ishtp/loader.c:178:50:    got unsigned long
drivers/hid/intel-ish-hid/ishtp/loader.c:179:50: warning: incorrect type in assignment (different base types)
drivers/hid/intel-ish-hid/ishtp/loader.c:179:50:    expected restricted __le32 [usertype] fw_off
drivers/hid/intel-ish-hid/ishtp/loader.c:179:50:    got unsigned int [usertype] offset
drivers/hid/intel-ish-hid/ishtp/loader.c:180:17: warning: cast from restricted __le32
drivers/hid/intel-ish-hid/ishtp/loader.c:183:24: warning: invalid assignment: +=
drivers/hid/intel-ish-hid/ishtp/loader.c:183:24:    left side has type unsigned int
drivers/hid/intel-ish-hid/ishtp/loader.c:183:24:    right side has type restricted __le32

Add the necessary conversions and use temporary variables where appropriate
to avoid converting back.

Fixes: 579a267e4617 ("HID: intel-ish-hid: Implement loading firmware from host feature")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2:
 - fix minor issues introduced in rebasing
 - rebase again on linux-next without the cache management patch
 - fix up changelog text
---
 drivers/hid/intel-ish-hid/ishtp/loader.c | 68 +++++++++++++-----------
 drivers/hid/intel-ish-hid/ishtp/loader.h | 33 +++++++-----
 2 files changed, 56 insertions(+), 45 deletions(-)

diff --git a/drivers/hid/intel-ish-hid/ishtp/loader.c b/drivers/hid/intel-ish-hid/ishtp/loader.c
index 2785b04a2f5a..d2ebf63d0b3e 100644
--- a/drivers/hid/intel-ish-hid/ishtp/loader.c
+++ b/drivers/hid/intel-ish-hid/ishtp/loader.c
@@ -84,8 +84,8 @@ static int loader_write_message(struct ishtp_device *dev, void *buf, int len)
 static int loader_xfer_cmd(struct ishtp_device *dev, void *req, int req_len,
 			   void *resp, int resp_len)
 {
-	struct loader_msg_header *req_hdr = req;
-	struct loader_msg_header *resp_hdr = resp;
+	union loader_msg_header req_hdr;
+	union loader_msg_header resp_hdr;
 	struct device *devc = dev->devc;
 	int rv;
 
@@ -93,34 +93,37 @@ static int loader_xfer_cmd(struct ishtp_device *dev, void *req, int req_len,
 	dev->fw_loader_rx_size = resp_len;
 
 	rv = loader_write_message(dev, req, req_len);
+	req_hdr.val32 = le32_to_cpup(req);
+
 	if (rv < 0) {
-		dev_err(devc, "write cmd %u failed:%d\n", req_hdr->command, rv);
+		dev_err(devc, "write cmd %u failed:%d\n", req_hdr.command, rv);
 		return rv;
 	}
 
 	/* Wait the ACK */
 	wait_event_interruptible_timeout(dev->wait_loader_recvd_msg, dev->fw_loader_received,
 					 ISHTP_LOADER_TIMEOUT);
+	resp_hdr.val32 = le32_to_cpup(resp);
 	dev->fw_loader_rx_size = 0;
 	dev->fw_loader_rx_buf = NULL;
 	if (!dev->fw_loader_received) {
-		dev_err(devc, "wait response of cmd %u timeout\n", req_hdr->command);
+		dev_err(devc, "wait response of cmd %u timeout\n", req_hdr.command);
 		return -ETIMEDOUT;
 	}
 
-	if (!resp_hdr->is_response) {
-		dev_err(devc, "not a response for %u\n", req_hdr->command);
+	if (!resp_hdr.is_response) {
+		dev_err(devc, "not a response for %u\n", req_hdr.command);
 		return -EBADMSG;
 	}
 
-	if (req_hdr->command != resp_hdr->command) {
-		dev_err(devc, "unexpected cmd response %u:%u\n", req_hdr->command,
-			resp_hdr->command);
+	if (req_hdr.command != resp_hdr.command) {
+		dev_err(devc, "unexpected cmd response %u:%u\n", req_hdr.command,
+			resp_hdr.command);
 		return -EBADMSG;
 	}
 
-	if (resp_hdr->status) {
-		dev_err(devc, "cmd %u failed %u\n", req_hdr->command, resp_hdr->status);
+	if (resp_hdr.status) {
+		dev_err(devc, "cmd %u failed %u\n", req_hdr.command, resp_hdr.status);
 		return -EIO;
 	}
 
@@ -163,24 +166,26 @@ static void release_dma_bufs(struct ishtp_device *dev,
 static int prepare_dma_bufs(struct ishtp_device *dev,
 			    const struct firmware *ish_fw,
 			    struct loader_xfer_dma_fragment *fragment,
-			    void **dma_bufs, u32 fragment_size)
+			    void **dma_bufs, u32 fragment_size, u32 fragment_count)
 {
 	dma_addr_t dma_addr;
 	u32 offset = 0;
+	u32 length;
 	int i;
 
-	for (i = 0; i < fragment->fragment_cnt && offset < ish_fw->size; i++) {
+	for (i = 0; i < fragment_count && offset < ish_fw->size; i++) {
 		dma_bufs[i] = dma_alloc_coherent(dev->devc, fragment_size, &dma_addr, GFP_KERNEL);
 		if (!dma_bufs[i])
 			return -ENOMEM;
 
 		fragment->fragment_tbl[i].ddr_adrs = cpu_to_le64(dma_addr);
-		fragment->fragment_tbl[i].length = clamp(ish_fw->size - offset, 0, fragment_size);
-		fragment->fragment_tbl[i].fw_off = offset;
-		memcpy(dma_bufs[i], ish_fw->data + offset, fragment->fragment_tbl[i].length);
+		length = clamp(ish_fw->size - offset, 0, fragment_size);
+		fragment->fragment_tbl[i].length = cpu_to_le32(length);
+		fragment->fragment_tbl[i].fw_off = cpu_to_le32(offset);
+		memcpy(dma_bufs[i], ish_fw->data + offset, length);
 		clflush_cache_range(dma_bufs[i], fragment_size);
 
-		offset += fragment->fragment_tbl[i].length;
+		offset += length;
 	}
 
 	return 0;
@@ -208,17 +213,17 @@ void ishtp_loader_work(struct work_struct *work)
 {
 	DEFINE_RAW_FLEX(struct loader_xfer_dma_fragment, fragment, fragment_tbl, FRAGMENT_MAX_NUM);
 	struct ishtp_device *dev = container_of(work, struct ishtp_device, work_fw_loader);
-	struct loader_xfer_query query = {
-		.header.command = LOADER_CMD_XFER_QUERY,
-	};
-	struct loader_start start = {
-		.header.command = LOADER_CMD_START,
-	};
+	union loader_msg_header query_hdr = { .command = LOADER_CMD_XFER_QUERY, };
+	union loader_msg_header start_hdr = { .command = LOADER_CMD_START, };
+	union loader_msg_header fragment_hdr = { .command = LOADER_CMD_XFER_FRAGMENT, };
+	struct loader_xfer_query query = { .header = cpu_to_le32(query_hdr.val32), };
+	struct loader_start start = { .header = cpu_to_le32(start_hdr.val32), };
 	union loader_recv_message recv_msg;
 	char *filename = dev->driver_data->fw_filename;
 	const struct firmware *ish_fw;
 	void *dma_bufs[FRAGMENT_MAX_NUM] = {};
 	u32 fragment_size;
+	u32 fragment_count;
 	int retry = ISHTP_LOADER_RETRY_TIMES;
 	int rv;
 
@@ -228,23 +233,24 @@ void ishtp_loader_work(struct work_struct *work)
 		return;
 	}
 
-	fragment->fragment.header.command = LOADER_CMD_XFER_FRAGMENT;
-	fragment->fragment.xfer_mode = LOADER_XFER_MODE_DMA;
-	fragment->fragment.is_last = 1;
-	fragment->fragment.size = ish_fw->size;
+	fragment->fragment.header = cpu_to_le32(fragment_hdr.val32);;
+	fragment->fragment.xfer_mode = cpu_to_le32(LOADER_XFER_MODE_DMA);
+	fragment->fragment.is_last = cpu_to_le32(1);
+	fragment->fragment.size = cpu_to_le32(ish_fw->size);
 	/* Calculate the size of a single DMA fragment */
 	fragment_size = PFN_ALIGN(DIV_ROUND_UP(ish_fw->size, FRAGMENT_MAX_NUM));
 	/* Calculate the count of DMA fragments */
-	fragment->fragment_cnt = DIV_ROUND_UP(ish_fw->size, fragment_size);
+	fragment_count = DIV_ROUND_UP(ish_fw->size, fragment_size);
+	fragment->fragment_cnt = cpu_to_le32(fragment_count);
 
-	rv = prepare_dma_bufs(dev, ish_fw, fragment, dma_bufs, fragment_size);
+	rv = prepare_dma_bufs(dev, ish_fw, fragment, dma_bufs, fragment_size, fragment_count);
 	if (rv) {
 		dev_err(dev->devc, "prepare DMA buffer failed.\n");
 		goto out;
 	}
 
 	do {
-		query.image_size = ish_fw->size;
+		query.image_size = cpu_to_le32(ish_fw->size);
 		rv = loader_xfer_cmd(dev, &query, sizeof(query), recv_msg.raw_data,
 				     sizeof(struct loader_xfer_query_ack));
 		if (rv)
@@ -257,7 +263,7 @@ void ishtp_loader_work(struct work_struct *work)
 			recv_msg.query_ack.version_build);
 
 		rv = loader_xfer_cmd(dev, fragment,
-				     struct_size(fragment, fragment_tbl, fragment->fragment_cnt),
+				     struct_size(fragment, fragment_tbl, fragment_count),
 				     recv_msg.raw_data, sizeof(struct loader_xfer_fragment_ack));
 		if (rv)
 			continue; /* try again if failed */
diff --git a/drivers/hid/intel-ish-hid/ishtp/loader.h b/drivers/hid/intel-ish-hid/ishtp/loader.h
index 7aa45ebc3f7b..308b96085a4d 100644
--- a/drivers/hid/intel-ish-hid/ishtp/loader.h
+++ b/drivers/hid/intel-ish-hid/ishtp/loader.h
@@ -30,19 +30,23 @@ struct work_struct;
 #define LOADER_XFER_MODE_DMA BIT(0)
 
 /**
- * struct loader_msg_header - ISHTP firmware loader message header
+ * union loader_msg_header - ISHTP firmware loader message header
  * @command: Command type
  * @is_response: Indicates if the message is a response
  * @has_next: Indicates if there is a next message
  * @reserved: Reserved for future use
  * @status: Status of the message
- */
-struct loader_msg_header {
-	__le32 command:7;
-	__le32 is_response:1;
-	__le32 has_next:1;
-	__le32 reserved:15;
-	__le32 status:8;
+ * @val32: entire header as a 32-bit value
+ */
+union loader_msg_header {
+	struct {
+		__u32 command:7;
+		__u32 is_response:1;
+		__u32 has_next:1;
+		__u32 reserved:15;
+		__u32 status:8;
+	};
+	__u32 val32;
 };
 
 /**
@@ -51,7 +55,7 @@ struct loader_msg_header {
  * @image_size: Size of the image
  */
 struct loader_xfer_query {
-	struct loader_msg_header header;
+	__le32 header;
 	__le32 image_size;
 };
 
@@ -103,7 +107,7 @@ struct loader_capability {
  * @capability: Loader capability
  */
 struct loader_xfer_query_ack {
-	struct loader_msg_header header;
+	__le32 header;
 	__le16 version_major;
 	__le16 version_minor;
 	__le16 version_hotfix;
@@ -122,7 +126,7 @@ struct loader_xfer_query_ack {
  * @is_last: Is last
  */
 struct loader_xfer_fragment {
-	struct loader_msg_header header;
+	__le32 header;
 	__le32 xfer_mode;
 	__le32 offset;
 	__le32 size;
@@ -134,7 +138,7 @@ struct loader_xfer_fragment {
  * @header: Header of the message
  */
 struct loader_xfer_fragment_ack {
-	struct loader_msg_header header;
+	__le32 header;
 };
 
 /**
@@ -170,7 +174,7 @@ struct loader_xfer_dma_fragment {
  * @header: Header of the message
  */
 struct loader_start {
-	struct loader_msg_header header;
+	__le32 header;
 };
 
 /**
@@ -178,10 +182,11 @@ struct loader_start {
  * @header: Header of the message
  */
 struct loader_start_ack {
-	struct loader_msg_header header;
+	__le32 header;
 };
 
 union loader_recv_message {
+	__le32 header;
 	struct loader_xfer_query_ack query_ack;
 	struct loader_xfer_fragment_ack fragment_ack;
 	struct loader_start_ack start_ack;
-- 
2.39.2


^ permalink raw reply related

* Re: [PATCH 2/2] HID: intel-ish-hid: fix endian-conversion
From: Arnd Bergmann @ 2024-05-31 16:29 UTC (permalink / raw)
  To: srinivas.pandruvada@linux.intel.com, Lixu Zhang, Arnd Bergmann,
	Jiri Kosina, Benjamin Tissoires
  Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <93a4b3f093a3105c4731fdac37cc1964b266302c.camel@linux.intel.com>

On Fri, May 31, 2024, at 05:49, srinivas pandruvada wrote:
> On Wed, 2024-05-29 at 15:18 +0200, Arnd Bergmann wrote:
>> On Wed, May 29, 2024, at 09:05, Zhang, Lixu wrote:
>> 
>> > > 
>> > > 	for (i = 0; i < fragment->fragment_cnt && offset <
>> > > ish_fw->size; i++) {
>> > You added a parameter fragment_count, but you didn't use it. Did
>> > you 
>> > intend to use it here?
>> > 
>> 
>> My mistake, that was again broken in my incorrect
>> rebase.
>> 
> Do you have updated patch? Lixu can try and make sure that the
> functionality is not broken by changes.
>

I've sent v2 now, hopefully addressing all the issues
of the first version. I've dropped the other patch now,
though I still think something is wrong there.

    Arnd

^ permalink raw reply

* [PATCH v7 1/5] dt-bindings: mfd: add entry for Marvell 88PM886 PMIC
From: Karel Balej @ 2024-05-31 17:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Dmitry Torokhov, Liam Girdwood, Mark Brown, devicetree,
	linux-kernel, linux-input
  Cc: Duje Mihanović, ~postmarketos/upstreaming, phone-devel,
	balejk
In-Reply-To: <20240531175109.15599-1-balejk@matfyz.cz>

Marvell 88PM886 is a PMIC with several subdevices such as onkey,
regulators or battery and charger. It comes in at least two revisions,
A0 and A1 -- only A1 is described here at the moment.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Karel Balej <balejk@matfyz.cz>
---

Notes:
    RFC v4:
    - Address Krzysztof's comments:
      - Fix regulators indentation.
      - Add Krzysztof's trailer.
    RFC v3:
    - Add wakeup-source property.
    - Address Rob's feedback:
      - Move regulators into the MFD file.
      - Remove interrupt-controller and #interrupt-cells properties.
    RFC v2:
    - Address Rob's feedback:
      - Drop mention of 88PM880.
      - Make sure the file passes bindings check (add the necessary header
        and fix `interrupt-cells`).
      - Other small changes.
    - Add regulators. Changes with respect to the regulator RFC series:
      - Address Krzysztof's comments:
        - Drop unused compatible.
        - Fix sub-node pattern.

 .../bindings/mfd/marvell,88pm886-a1.yaml      | 76 +++++++++++++++++++
 1 file changed, 76 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/marvell,88pm886-a1.yaml

diff --git a/Documentation/devicetree/bindings/mfd/marvell,88pm886-a1.yaml b/Documentation/devicetree/bindings/mfd/marvell,88pm886-a1.yaml
new file mode 100644
index 000000000000..d6a71c912b76
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/marvell,88pm886-a1.yaml
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/marvell,88pm886-a1.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Marvell 88PM886 PMIC core
+
+maintainers:
+  - Karel Balej <balejk@matfyz.cz>
+
+description:
+  Marvell 88PM886 is a PMIC providing several functions such as onkey,
+  regulators or battery and charger.
+
+properties:
+  compatible:
+    const: marvell,88pm886-a1
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  wakeup-source: true
+
+  regulators:
+    type: object
+    additionalProperties: false
+    patternProperties:
+      "^(ldo(1[0-6]|[1-9])|buck[1-5])$":
+        type: object
+        $ref: /schemas/regulator/regulator.yaml#
+        description: LDO or buck regulator.
+        unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      pmic@30 {
+        compatible = "marvell,88pm886-a1";
+        reg = <0x30>;
+        interrupts = <0 4 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-parent = <&gic>;
+        wakeup-source;
+
+        regulators {
+          ldo2: ldo2 {
+            regulator-min-microvolt = <3100000>;
+            regulator-max-microvolt = <3300000>;
+          };
+
+          ldo15: ldo15 {
+            regulator-min-microvolt = <3300000>;
+            regulator-max-microvolt = <3300000>;
+          };
+
+          buck2: buck2 {
+            regulator-min-microvolt = <1800000>;
+            regulator-max-microvolt = <1800000>;
+          };
+        };
+      };
+    };
+...
-- 
2.45.1


^ permalink raw reply related

* [PATCH v7 2/5] mfd: add driver for Marvell 88PM886 PMIC
From: Karel Balej @ 2024-05-31 17:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Dmitry Torokhov, Liam Girdwood, Mark Brown, devicetree,
	linux-kernel, linux-input
  Cc: Duje Mihanović, ~postmarketos/upstreaming, phone-devel,
	balejk
In-Reply-To: <20240531175109.15599-1-balejk@matfyz.cz>

Marvell 88PM886 is a PMIC which provides various functions such as
onkey, battery, charger and regulators. It is found for instance in the
samsung,coreprimevelte smartphone with which this was tested. Implement
basic support to allow for the use of regulators and onkey.

Signed-off-by: Karel Balej <balejk@matfyz.cz>
---

Notes:
    v6:
    - Address Lee's comments:
      - Don't break long line in the power off handler.
      - Set PLATFORM_DEVID_NONE. This should be safe with respect to
        collisions since there are no known devices with more than one of
        these PMICs, plus given their general purpose nature it is unlikely
        that there would ever be. Also include the corresponding header.
      - Move all defines to the header.
    - Give the base page's maximum register its real name.
    - Set irq_base to 0.
    v5:
    - Address Mark's feedback:
      - Move regmap config back out of the header and rename it. Also lower
        its maximum register based on what's actually used in the downstream
        code.
    RFC v4:
    - Use MFD_CELL_* macros.
    - Address Lee's feedback:
      - Do not define regmap_config.val_bits and .reg_bits.
      - Drop everything regulator related except mfd_cell (regmap
        initialization, IDs enum etc.). Drop pm886_initialize_subregmaps.
      - Do not store regmap pointers as an array as there is now only one
        regmap. Also drop the corresponding enum.
      - Move regmap_config to the header as it is needed in the regulators
        driver.
      - pm886_chip.whoami -> chip_id
      - Reword chip ID mismatch error message and print the ID as
        hexadecimal.
      - Fix includes in include/linux/88pm886.h.
      - Drop the pm886_irq_number enum and define the (for the moment) only
        IRQ explicitly.
    - Have only one MFD cell for all regulators as they are now registered
      all at once in the regulators driver.
    - Reword commit message.
    - Make device table static and remove comma after the sentinel to signal
      that nothing should come after it.
    RFC v3:
    - Drop onkey cell .of_compatible.
    - Rename LDO page offset and regmap to REGULATORS.
    RFC v2:
    - Remove some abstraction.
    - Sort includes alphabetically and add linux/of.h.
    - Depend on OF, remove of_match_ptr and add MODULE_DEVICE_TABLE.
    - Use more temporaries and break long lines.
    - Do not initialize ret in probe.
    - Use the wakeup-source DT property.
    - Rename ret to err.
    - Address Lee's comments:
      - Drop patched in presets for base regmap and related defines.
      - Use full sentences in comments.
      - Remove IRQ comment.
      - Define regmap_config member values.
      - Rename data to sys_off_data.
      - Add _PMIC suffix to Kconfig.
      - Use dev_err_probe.
      - Do not store irq_data.
      - s/WHOAMI/CHIP_ID
      - Drop LINUX part of include guard name.
      - Merge in the regulator series modifications in order to have more
        devices and modify the commit message accordingly. Changes with
        respect to the original regulator series patches:
        - ret -> err
        - Add temporary for dev in pm88x_initialize_subregmaps.
        - Drop of_compatible for the regulators.
        - Do not duplicate LDO regmap for bucks.
    - Rewrite commit message.

Friday late afternoon counts as a weekend too...

 drivers/mfd/88pm886.c       | 148 ++++++++++++++++++++++++++++++++++++
 drivers/mfd/Kconfig         |  12 +++
 drivers/mfd/Makefile        |   1 +
 include/linux/mfd/88pm886.h |  69 +++++++++++++++++
 4 files changed, 230 insertions(+)
 create mode 100644 drivers/mfd/88pm886.c
 create mode 100644 include/linux/mfd/88pm886.h

diff --git a/drivers/mfd/88pm886.c b/drivers/mfd/88pm886.c
new file mode 100644
index 000000000000..dbe9efc027d2
--- /dev/null
+++ b/drivers/mfd/88pm886.c
@@ -0,0 +1,148 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <linux/i2c.h>
+#include <linux/mfd/core.h>
+#include <linux/module.h>
+#include <linux/notifier.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/regmap.h>
+
+#include <linux/mfd/88pm886.h>
+
+static const struct regmap_config pm886_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+	.max_register = PM886_REG_RTC_SPARE6,
+};
+
+static struct regmap_irq pm886_regmap_irqs[] = {
+	REGMAP_IRQ_REG(PM886_IRQ_ONKEY, 0, PM886_INT_ENA1_ONKEY),
+};
+
+static struct regmap_irq_chip pm886_regmap_irq_chip = {
+	.name = "88pm886",
+	.irqs = pm886_regmap_irqs,
+	.num_irqs = ARRAY_SIZE(pm886_regmap_irqs),
+	.num_regs = 4,
+	.status_base = PM886_REG_INT_STATUS1,
+	.ack_base = PM886_REG_INT_STATUS1,
+	.unmask_base = PM886_REG_INT_ENA_1,
+};
+
+static struct resource pm886_onkey_resources[] = {
+	DEFINE_RES_IRQ_NAMED(PM886_IRQ_ONKEY, "88pm886-onkey"),
+};
+
+static struct mfd_cell pm886_devs[] = {
+	MFD_CELL_RES("88pm886-onkey", pm886_onkey_resources),
+	MFD_CELL_NAME("88pm886-regulator"),
+};
+
+static int pm886_power_off_handler(struct sys_off_data *sys_off_data)
+{
+	struct pm886_chip *chip = sys_off_data->cb_data;
+	struct regmap *regmap = chip->regmap;
+	struct device *dev = &chip->client->dev;
+	int err;
+
+	err = regmap_update_bits(regmap, PM886_REG_MISC_CONFIG1, PM886_SW_PDOWN, PM886_SW_PDOWN);
+	if (err) {
+		dev_err(dev, "Failed to power off the device: %d\n", err);
+		return NOTIFY_BAD;
+	}
+	return NOTIFY_DONE;
+}
+
+static int pm886_setup_irq(struct pm886_chip *chip,
+		struct regmap_irq_chip_data **irq_data)
+{
+	struct regmap *regmap = chip->regmap;
+	struct device *dev = &chip->client->dev;
+	int err;
+
+	/* Set interrupt clearing mode to clear on write. */
+	err = regmap_update_bits(regmap, PM886_REG_MISC_CONFIG2,
+			PM886_INT_INV | PM886_INT_CLEAR | PM886_INT_MASK_MODE,
+			PM886_INT_WC);
+	if (err) {
+		dev_err(dev, "Failed to set interrupt clearing mode: %d\n", err);
+		return err;
+	}
+
+	err = devm_regmap_add_irq_chip(dev, regmap, chip->client->irq,
+					IRQF_ONESHOT, 0, &pm886_regmap_irq_chip,
+					irq_data);
+	if (err) {
+		dev_err(dev, "Failed to request IRQ: %d\n", err);
+		return err;
+	}
+
+	return 0;
+}
+
+static int pm886_probe(struct i2c_client *client)
+{
+	struct regmap_irq_chip_data *irq_data;
+	struct device *dev = &client->dev;
+	struct pm886_chip *chip;
+	struct regmap *regmap;
+	unsigned int chip_id;
+	int err;
+
+	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
+	if (!chip)
+		return -ENOMEM;
+
+	chip->client = client;
+	chip->chip_id = (uintptr_t)device_get_match_data(dev);
+	i2c_set_clientdata(client, chip);
+
+	regmap = devm_regmap_init_i2c(client, &pm886_regmap_config);
+	if (IS_ERR(regmap))
+		return dev_err_probe(dev, PTR_ERR(regmap), "Failed to initialize regmap\n");
+	chip->regmap = regmap;
+
+	err = regmap_read(regmap, PM886_REG_ID, &chip_id);
+	if (err)
+		return dev_err_probe(dev, err, "Failed to read chip ID\n");
+
+	if (chip->chip_id != chip_id)
+		return dev_err_probe(dev, -EINVAL, "Unsupported chip: 0x%x\n", chip_id);
+
+	err = pm886_setup_irq(chip, &irq_data);
+	if (err)
+		return err;
+
+	err = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, pm886_devs, ARRAY_SIZE(pm886_devs),
+				NULL, 0, regmap_irq_get_domain(irq_data));
+	if (err)
+		return dev_err_probe(dev, err, "Failed to add devices\n");
+
+	err = devm_register_power_off_handler(dev, pm886_power_off_handler, chip);
+	if (err)
+		return dev_err_probe(dev, err, "Failed to register power off handler\n");
+
+	device_init_wakeup(dev, device_property_read_bool(dev, "wakeup-source"));
+
+	return 0;
+}
+
+static const struct of_device_id pm886_of_match[] = {
+	{ .compatible = "marvell,88pm886-a1", .data = (void *)PM886_A1_CHIP_ID },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, pm886_of_match);
+
+static struct i2c_driver pm886_i2c_driver = {
+	.driver = {
+		.name = "88pm886",
+		.of_match_table = pm886_of_match,
+	},
+	.probe = pm886_probe,
+};
+module_i2c_driver(pm886_i2c_driver);
+
+MODULE_DESCRIPTION("Marvell 88PM886 PMIC driver");
+MODULE_AUTHOR("Karel Balej <balejk@matfyz.cz>");
+MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 266b4f54af60..96c0019b14c1 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -794,6 +794,18 @@ config MFD_88PM860X
 	  select individual components like voltage regulators, RTC and
 	  battery-charger under the corresponding menus.
 
+config MFD_88PM886_PMIC
+	bool "Marvell 88PM886 PMIC"
+	depends on I2C=y
+	depends on OF
+	select REGMAP_I2C
+	select REGMAP_IRQ
+	select MFD_CORE
+	help
+	  This enables support for Marvell 88PM886 Power Management IC.
+	  This includes the I2C driver and the core APIs _only_, you have to
+	  select individual components like onkey under the corresponding menus.
+
 config MFD_MAX14577
 	tristate "Maxim Semiconductor MAX14577/77836 MUIC + Charger Support"
 	depends on I2C
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index c66f07edcd0e..d016b7fed354 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -7,6 +7,7 @@
 obj-$(CONFIG_MFD_88PM860X)	+= 88pm860x.o
 obj-$(CONFIG_MFD_88PM800)	+= 88pm800.o 88pm80x.o
 obj-$(CONFIG_MFD_88PM805)	+= 88pm805.o 88pm80x.o
+obj-$(CONFIG_MFD_88PM886_PMIC)	+= 88pm886.o
 obj-$(CONFIG_MFD_ACT8945A)	+= act8945a.o
 obj-$(CONFIG_MFD_SM501)		+= sm501.o
 obj-$(CONFIG_ARCH_BCM2835)	+= bcm2835-pm.o
diff --git a/include/linux/mfd/88pm886.h b/include/linux/mfd/88pm886.h
new file mode 100644
index 000000000000..133aa302e492
--- /dev/null
+++ b/include/linux/mfd/88pm886.h
@@ -0,0 +1,69 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __MFD_88PM886_H
+#define __MFD_88PM886_H
+
+#include <linux/i2c.h>
+#include <linux/regmap.h>
+
+#define PM886_A1_CHIP_ID		0xa1
+
+#define PM886_IRQ_ONKEY			0
+
+#define PM886_PAGE_OFFSET_REGULATORS	1
+
+#define PM886_REG_ID			0x00
+
+#define PM886_REG_STATUS1		0x01
+#define PM886_ONKEY_STS1		BIT(0)
+
+#define PM886_REG_INT_STATUS1		0x05
+
+#define PM886_REG_INT_ENA_1		0x0a
+#define PM886_INT_ENA1_ONKEY		BIT(0)
+
+#define PM886_REG_MISC_CONFIG1		0x14
+#define PM886_SW_PDOWN			BIT(5)
+
+#define PM886_REG_MISC_CONFIG2		0x15
+#define PM886_INT_INV			BIT(0)
+#define PM886_INT_CLEAR			BIT(1)
+#define PM886_INT_RC			0x00
+#define PM886_INT_WC			BIT(1)
+#define PM886_INT_MASK_MODE		BIT(2)
+
+#define PM886_REG_RTC_SPARE6		0xef
+
+#define PM886_REG_BUCK_EN		0x08
+#define PM886_REG_LDO_EN1		0x09
+#define PM886_REG_LDO_EN2		0x0a
+#define PM886_REG_LDO1_VOUT		0x20
+#define PM886_REG_LDO2_VOUT		0x26
+#define PM886_REG_LDO3_VOUT		0x2c
+#define PM886_REG_LDO4_VOUT		0x32
+#define PM886_REG_LDO5_VOUT		0x38
+#define PM886_REG_LDO6_VOUT		0x3e
+#define PM886_REG_LDO7_VOUT		0x44
+#define PM886_REG_LDO8_VOUT		0x4a
+#define PM886_REG_LDO9_VOUT		0x50
+#define PM886_REG_LDO10_VOUT		0x56
+#define PM886_REG_LDO11_VOUT		0x5c
+#define PM886_REG_LDO12_VOUT		0x62
+#define PM886_REG_LDO13_VOUT		0x68
+#define PM886_REG_LDO14_VOUT		0x6e
+#define PM886_REG_LDO15_VOUT		0x74
+#define PM886_REG_LDO16_VOUT		0x7a
+#define PM886_REG_BUCK1_VOUT		0xa5
+#define PM886_REG_BUCK2_VOUT		0xb3
+#define PM886_REG_BUCK3_VOUT		0xc1
+#define PM886_REG_BUCK4_VOUT		0xcf
+#define PM886_REG_BUCK5_VOUT		0xdd
+
+#define PM886_LDO_VSEL_MASK		0x0f
+#define PM886_BUCK_VSEL_MASK		0x7f
+
+struct pm886_chip {
+	struct i2c_client *client;
+	unsigned int chip_id;
+	struct regmap *regmap;
+};
+#endif /* __MFD_88PM886_H */
-- 
2.45.1


^ permalink raw reply related

* [PATCH v7 0/5] initial support for Marvell 88PM886 PMIC
From: Karel Balej @ 2024-05-31 17:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Dmitry Torokhov, Liam Girdwood, Mark Brown, devicetree,
	linux-kernel, linux-input
  Cc: Duje Mihanović, ~postmarketos/upstreaming, phone-devel,
	balejk

Hello,

the following implements basic support for Marvell's 88PM886 PMIC which
is found for instance as a component of the samsung,coreprimevelte
smartphone which inspired this and also serves as a testing platform.

The code for the MFD is based primarily on this old series [1] with the
addition of poweroff based on the smartphone's downstream kernel tree
[2]. The onkey and regulators drivers are based on the latter. I am not
in possesion of the datasheet.

[1] https://lore.kernel.org/all/1434098601-3498-1-git-send-email-yizhang@marvell.com/
[2] https://github.com/CoderCharmander/g361f-kernel

Thank you, kind regards,
K. B.
---
v7:
- Rebase to v6.10-rc1.
- v6: https://lore.kernel.org/r/20240504194632.2456-1-balejk@matfyz.cz/
v6:
- Rebase to v6.9-rc6.
- Fix patchset versioning: the previous version was marked as v1 because I
  considered RFC to be its own thing. Thank you to Krzysztof for
  explaining that that is not the case. The previous version is thus now
  marked as v5 and this is v6, sorry for any confusion.
- v5: https://lore.kernel.org/r/20240331105608.7338-2-balejk@matfyz.cz/
v5:
- RFC v4: https://lore.kernel.org/r/20240311160110.32185-1-karelb@gimli.ms.mff.cuni.cz/
- Rebase to v6.9-rc1.
- Thank you to everybody for their feedback on the RFC!
RFC v4:
- RFC v3: https://lore.kernel.org/all/20240303101506.4187-1-karelb@gimli.ms.mff.cuni.cz/
RFC v3:
- Address Rob's feedback:
  - Drop onkey bindings patch.
- Rename PM88X -> PM886 everywhere.
- RFC v2: https://lore.kernel.org/all/20240211094609.2223-1-karelb@gimli.ms.mff.cuni.cz/
RFC v2:
- Merge with the regulators series to have multiple devices and thus
  justify the use of the MFD framework.
- Rebase on v6.8-rc3.
- Reorder patches.
- MFD RFC v1: https://lore.kernel.org/all/20231217131838.7569-1-karelb@gimli.ms.mff.cuni.cz/
- regulators RFC v1: https://lore.kernel.org/all/20231228100208.2932-1-karelb@gimli.ms.mff.cuni.cz/

Karel Balej (5):
  dt-bindings: mfd: add entry for Marvell 88PM886 PMIC
  mfd: add driver for Marvell 88PM886 PMIC
  regulator: add regulators driver for Marvell 88PM886 PMIC
  input: add onkey driver for Marvell 88PM886 PMIC
  MAINTAINERS: add myself for Marvell 88PM886 PMIC

 .../bindings/mfd/marvell,88pm886-a1.yaml      |  76 ++++
 MAINTAINERS                                   |   9 +
 drivers/input/misc/88pm886-onkey.c            |  98 +++++
 drivers/input/misc/Kconfig                    |   7 +
 drivers/input/misc/Makefile                   |   1 +
 drivers/mfd/88pm886.c                         | 148 +++++++
 drivers/mfd/Kconfig                           |  12 +
 drivers/mfd/Makefile                          |   1 +
 drivers/regulator/88pm886-regulator.c         | 392 ++++++++++++++++++
 drivers/regulator/Kconfig                     |   6 +
 drivers/regulator/Makefile                    |   1 +
 include/linux/mfd/88pm886.h                   |  69 +++
 12 files changed, 820 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/marvell,88pm886-a1.yaml
 create mode 100644 drivers/input/misc/88pm886-onkey.c
 create mode 100644 drivers/mfd/88pm886.c
 create mode 100644 drivers/regulator/88pm886-regulator.c
 create mode 100644 include/linux/mfd/88pm886.h

-- 
2.45.1


^ permalink raw reply

* [PATCH v7 4/5] input: add onkey driver for Marvell 88PM886 PMIC
From: Karel Balej @ 2024-05-31 17:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Dmitry Torokhov, Liam Girdwood, Mark Brown, devicetree,
	linux-kernel, linux-input
  Cc: Duje Mihanović, ~postmarketos/upstreaming, phone-devel,
	balejk
In-Reply-To: <20240531175109.15599-1-balejk@matfyz.cz>

Marvell 88PM886 PMIC provides onkey among other things. Add client
driver to handle it. The driver currently only provides a basic support
omitting additional functions found in the vendor version, such as long
onkey and GPIO integration.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Karel Balej <balejk@matfyz.cz>
---

Notes:
    v5:
    - Remove kernel.h include.
    RFC v4:
    - Reflect MFD driver changes:
      - chip->regmaps[...] -> chip->regmap
    - Address Dmitry's feedback:
      - Add ID table.
      - Add Ack.
    RFC v3:
    - Drop wakeup-source.
    RFC v2:
    - Address Dmitry's feedback:
      - Sort includes alphabetically.
      - Drop onkey->irq.
      - ret -> err in irq_handler and no initialization.
      - Break long lines and other formatting.
      - Do not clobber platform_get_irq error.
      - Do not set device parent manually.
      - Use input_set_capability.
      - Use the wakeup-source DT property.
      - Drop of_match_table.
      - Use more temporaries.
      - Use dev_err_probe.
    - Modify Kconfig description.

 drivers/input/misc/88pm886-onkey.c | 98 ++++++++++++++++++++++++++++++
 drivers/input/misc/Kconfig         |  7 +++
 drivers/input/misc/Makefile        |  1 +
 3 files changed, 106 insertions(+)
 create mode 100644 drivers/input/misc/88pm886-onkey.c

diff --git a/drivers/input/misc/88pm886-onkey.c b/drivers/input/misc/88pm886-onkey.c
new file mode 100644
index 000000000000..284ff5190b6e
--- /dev/null
+++ b/drivers/input/misc/88pm886-onkey.c
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+#include <linux/mfd/88pm886.h>
+
+struct pm886_onkey {
+	struct input_dev *idev;
+	struct pm886_chip *chip;
+};
+
+static irqreturn_t pm886_onkey_irq_handler(int irq, void *data)
+{
+	struct pm886_onkey *onkey = data;
+	struct regmap *regmap = onkey->chip->regmap;
+	struct input_dev *idev = onkey->idev;
+	struct device *parent = idev->dev.parent;
+	unsigned int val;
+	int err;
+
+	err = regmap_read(regmap, PM886_REG_STATUS1, &val);
+	if (err) {
+		dev_err(parent, "Failed to read status: %d\n", err);
+		return IRQ_NONE;
+	}
+	val &= PM886_ONKEY_STS1;
+
+	input_report_key(idev, KEY_POWER, val);
+	input_sync(idev);
+
+	return IRQ_HANDLED;
+}
+
+static int pm886_onkey_probe(struct platform_device *pdev)
+{
+	struct pm886_chip *chip = dev_get_drvdata(pdev->dev.parent);
+	struct device *dev = &pdev->dev;
+	struct pm886_onkey *onkey;
+	struct input_dev *idev;
+	int irq, err;
+
+	onkey = devm_kzalloc(dev, sizeof(*onkey), GFP_KERNEL);
+	if (!onkey)
+		return -ENOMEM;
+
+	onkey->chip = chip;
+
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return dev_err_probe(dev, irq, "Failed to get IRQ\n");
+
+	idev = devm_input_allocate_device(dev);
+	if (!idev) {
+		dev_err(dev, "Failed to allocate input device\n");
+		return -ENOMEM;
+	}
+	onkey->idev = idev;
+
+	idev->name = "88pm886-onkey";
+	idev->phys = "88pm886-onkey/input0";
+	idev->id.bustype = BUS_I2C;
+
+	input_set_capability(idev, EV_KEY, KEY_POWER);
+
+	err = devm_request_threaded_irq(dev, irq, NULL, pm886_onkey_irq_handler,
+					IRQF_ONESHOT | IRQF_NO_SUSPEND, "onkey",
+					onkey);
+	if (err)
+		return dev_err_probe(dev, err, "Failed to request IRQ\n");
+
+	err = input_register_device(idev);
+	if (err)
+		return dev_err_probe(dev, err, "Failed to register input device\n");
+
+	return 0;
+}
+
+static const struct platform_device_id pm886_onkey_id_table[] = {
+	{ "88pm886-onkey", },
+	{ }
+};
+MODULE_DEVICE_TABLE(platform, pm886_onkey_id_table);
+
+static struct platform_driver pm886_onkey_driver = {
+	.driver = {
+		.name = "88pm886-onkey",
+	},
+	.probe = pm886_onkey_probe,
+	.id_table = pm886_onkey_id_table,
+};
+module_platform_driver(pm886_onkey_driver);
+
+MODULE_DESCRIPTION("Marvell 88PM886 onkey driver");
+MODULE_AUTHOR("Karel Balej <balejk@matfyz.cz>");
+MODULE_LICENSE("GPL");
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 6ba984d7f0b1..16a079d9f0f2 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -33,6 +33,13 @@ config INPUT_88PM80X_ONKEY
 	  To compile this driver as a module, choose M here: the module
 	  will be called 88pm80x_onkey.
 
+config INPUT_88PM886_ONKEY
+	tristate "Marvell 88PM886 onkey support"
+	depends on MFD_88PM886_PMIC
+	help
+	  Support the onkey of Marvell 88PM886 PMIC as an input device
+	  reporting power button status.
+
 config INPUT_AB8500_PONKEY
 	tristate "AB8500 Pon (PowerOn) Key"
 	depends on AB8500_CORE
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 04296a4abe8e..054a6dc1ac27 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -7,6 +7,7 @@
 
 obj-$(CONFIG_INPUT_88PM860X_ONKEY)	+= 88pm860x_onkey.o
 obj-$(CONFIG_INPUT_88PM80X_ONKEY)	+= 88pm80x_onkey.o
+obj-$(CONFIG_INPUT_88PM886_ONKEY)	+= 88pm886-onkey.o
 obj-$(CONFIG_INPUT_AB8500_PONKEY)	+= ab8500-ponkey.o
 obj-$(CONFIG_INPUT_AD714X)		+= ad714x.o
 obj-$(CONFIG_INPUT_AD714X_I2C)		+= ad714x-i2c.o
-- 
2.45.1


^ permalink raw reply related

* [PATCH v7 5/5] MAINTAINERS: add myself for Marvell 88PM886 PMIC
From: Karel Balej @ 2024-05-31 17:35 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Dmitry Torokhov, Liam Girdwood, Mark Brown, devicetree,
	linux-kernel, linux-input
  Cc: Duje Mihanović, ~postmarketos/upstreaming, phone-devel,
	balejk
In-Reply-To: <20240531175109.15599-1-balejk@matfyz.cz>

Add an entry to MAINTAINERS for the Marvell 88PM886 PMIC MFD, onkey and
regulator drivers.

Signed-off-by: Karel Balej <balejk@matfyz.cz>
---

Notes:
    RFC v3:
    - Remove onkey bindings file.
    RFC v2:
    - Only mention 88PM886 in the commit message.
    - Add regulator driver.
    - Rename the entry.

 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index d6c90161c7bf..9d6c940029b8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13295,6 +13295,15 @@ F:	drivers/net/dsa/mv88e6xxx/
 F:	include/linux/dsa/mv88e6xxx.h
 F:	include/linux/platform_data/mv88e6xxx.h
 
+MARVELL 88PM886 PMIC DRIVER
+M:	Karel Balej <balejk@matfyz.cz>
+S:	Maintained
+F:	Documentation/devicetree/bindings/mfd/marvell,88pm886-a1.yaml
+F:	drivers/input/misc/88pm886-onkey.c
+F:	drivers/mfd/88pm886.c
+F:	drivers/regulators/88pm886-regulator.c
+F:	include/linux/mfd/88pm886.h
+
 MARVELL ARMADA 3700 PHY DRIVERS
 M:	Miquel Raynal <miquel.raynal@bootlin.com>
 S:	Maintained
-- 
2.45.1


^ permalink raw reply related

* [PATCH v7 3/5] regulator: add regulators driver for Marvell 88PM886 PMIC
From: Karel Balej @ 2024-05-31 17:34 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Dmitry Torokhov, Liam Girdwood, Mark Brown, devicetree,
	linux-kernel, linux-input
  Cc: Duje Mihanović, ~postmarketos/upstreaming, phone-devel,
	balejk
In-Reply-To: <20240531175109.15599-1-balejk@matfyz.cz>

Support the LDO and buck regulators of the Marvell 88PM886 PMIC.

Signed-off-by: Karel Balej <balejk@matfyz.cz>
---

Notes:
    v7:
    - Address Mark's feedback:
      - Drop get_current_limit op, max_uA values and thus unneeded struct
        pm886_regulator and adapt the code accordingly.
    v6:
    - Remove all definitions (now present in the header).
    v5:
    - Add remaining regulators.
    - Clean up includes.
    - Address Mark's feedback:
      - Use dedicated regmap config.
    RFC v4:
    - Initialize regulators regmap in the regulators driver.
    - Register all regulators at once.
    - Drop regulator IDs.
    - Add missing '\n' to dev_err_probe message.
    - Fix includes.
    - Add ID table.
    RFC v3:
    - Do not have a variable for each regulator -- define them all in the
      pm886_regulators array.
    - Use new regulators regmap index name.
    - Use dev_err_probe.
    RFC v2:
    - Drop of_compatible and related code.
    - Drop unused include.
    - Remove some abstraction: use only one regmap for all regulators and
      only mention 88PM886 in Kconfig description.
    - Reword commit message.

 drivers/regulator/88pm886-regulator.c | 392 ++++++++++++++++++++++++++
 drivers/regulator/Kconfig             |   6 +
 drivers/regulator/Makefile            |   1 +
 3 files changed, 399 insertions(+)
 create mode 100644 drivers/regulator/88pm886-regulator.c

diff --git a/drivers/regulator/88pm886-regulator.c b/drivers/regulator/88pm886-regulator.c
new file mode 100644
index 000000000000..a38bd4f312b7
--- /dev/null
+++ b/drivers/regulator/88pm886-regulator.c
@@ -0,0 +1,392 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/regulator/driver.h>
+
+#include <linux/mfd/88pm886.h>
+
+static const struct regmap_config pm886_regulator_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+	.max_register = PM886_REG_BUCK5_VOUT,
+};
+
+static const struct regulator_ops pm886_ldo_ops = {
+	.list_voltage = regulator_list_voltage_table,
+	.map_voltage = regulator_map_voltage_iterate,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+};
+
+static const struct regulator_ops pm886_buck_ops = {
+	.list_voltage = regulator_list_voltage_linear_range,
+	.map_voltage = regulator_map_voltage_linear_range,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+};
+
+static const unsigned int pm886_ldo_volt_table1[] = {
+	1700000, 1800000, 1900000, 2500000, 2800000, 2900000, 3100000, 3300000,
+};
+
+static const unsigned int pm886_ldo_volt_table2[] = {
+	1200000, 1250000, 1700000, 1800000, 1850000, 1900000, 2500000, 2600000,
+	2700000, 2750000, 2800000, 2850000, 2900000, 3000000, 3100000, 3300000,
+};
+
+static const unsigned int pm886_ldo_volt_table3[] = {
+	1700000, 1800000, 1900000, 2000000, 2100000, 2500000, 2700000, 2800000,
+};
+
+static const struct linear_range pm886_buck_volt_ranges1[] = {
+	REGULATOR_LINEAR_RANGE(600000, 0, 79, 12500),
+	REGULATOR_LINEAR_RANGE(1600000, 80, 84, 50000),
+};
+
+static const struct linear_range pm886_buck_volt_ranges2[] = {
+	REGULATOR_LINEAR_RANGE(600000, 0, 79, 12500),
+	REGULATOR_LINEAR_RANGE(1600000, 80, 114, 50000),
+};
+
+static struct regulator_desc pm886_regulators[] = {
+	{
+		.name = "LDO1",
+		.regulators_node = "regulators",
+		.of_match = "ldo1",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN1,
+		.enable_mask = BIT(0),
+		.volt_table = pm886_ldo_volt_table1,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table1),
+		.vsel_reg = PM886_REG_LDO1_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO2",
+		.regulators_node = "regulators",
+		.of_match = "ldo2",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN1,
+		.enable_mask = BIT(1),
+		.volt_table = pm886_ldo_volt_table1,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table1),
+		.vsel_reg = PM886_REG_LDO2_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO3",
+		.regulators_node = "regulators",
+		.of_match = "ldo3",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN1,
+		.enable_mask = BIT(2),
+		.volt_table = pm886_ldo_volt_table1,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table1),
+		.vsel_reg = PM886_REG_LDO3_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO4",
+		.regulators_node = "regulators",
+		.of_match = "ldo4",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN1,
+		.enable_mask = BIT(3),
+		.volt_table = pm886_ldo_volt_table2,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2),
+		.vsel_reg = PM886_REG_LDO4_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO5",
+		.regulators_node = "regulators",
+		.of_match = "ldo5",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN1,
+		.enable_mask = BIT(4),
+		.volt_table = pm886_ldo_volt_table2,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2),
+		.vsel_reg = PM886_REG_LDO5_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO6",
+		.regulators_node = "regulators",
+		.of_match = "ldo6",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN1,
+		.enable_mask = BIT(5),
+		.volt_table = pm886_ldo_volt_table2,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2),
+		.vsel_reg = PM886_REG_LDO6_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO7",
+		.regulators_node = "regulators",
+		.of_match = "ldo7",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN1,
+		.enable_mask = BIT(6),
+		.volt_table = pm886_ldo_volt_table2,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2),
+		.vsel_reg = PM886_REG_LDO7_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO8",
+		.regulators_node = "regulators",
+		.of_match = "ldo8",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN1,
+		.enable_mask = BIT(7),
+		.volt_table = pm886_ldo_volt_table2,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2),
+		.vsel_reg = PM886_REG_LDO8_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO9",
+		.regulators_node = "regulators",
+		.of_match = "ldo9",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN2,
+		.enable_mask = BIT(0),
+		.volt_table = pm886_ldo_volt_table2,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2),
+		.vsel_reg = PM886_REG_LDO9_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO10",
+		.regulators_node = "regulators",
+		.of_match = "ldo10",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN2,
+		.enable_mask = BIT(1),
+		.volt_table = pm886_ldo_volt_table2,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2),
+		.vsel_reg = PM886_REG_LDO10_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO11",
+		.regulators_node = "regulators",
+		.of_match = "ldo11",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN2,
+		.enable_mask = BIT(2),
+		.volt_table = pm886_ldo_volt_table2,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2),
+		.vsel_reg = PM886_REG_LDO11_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO12",
+		.regulators_node = "regulators",
+		.of_match = "ldo12",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN2,
+		.enable_mask = BIT(3),
+		.volt_table = pm886_ldo_volt_table2,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2),
+		.vsel_reg = PM886_REG_LDO12_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO13",
+		.regulators_node = "regulators",
+		.of_match = "ldo13",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN2,
+		.enable_mask = BIT(4),
+		.volt_table = pm886_ldo_volt_table2,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2),
+		.vsel_reg = PM886_REG_LDO13_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO14",
+		.regulators_node = "regulators",
+		.of_match = "ldo14",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN2,
+		.enable_mask = BIT(5),
+		.volt_table = pm886_ldo_volt_table2,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2),
+		.vsel_reg = PM886_REG_LDO14_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO15",
+		.regulators_node = "regulators",
+		.of_match = "ldo15",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN2,
+		.enable_mask = BIT(6),
+		.volt_table = pm886_ldo_volt_table2,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2),
+		.vsel_reg = PM886_REG_LDO15_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "LDO16",
+		.regulators_node = "regulators",
+		.of_match = "ldo16",
+		.ops = &pm886_ldo_ops,
+		.type = REGULATOR_VOLTAGE,
+		.enable_reg = PM886_REG_LDO_EN2,
+		.enable_mask = BIT(7),
+		.volt_table = pm886_ldo_volt_table3,
+		.n_voltages = ARRAY_SIZE(pm886_ldo_volt_table3),
+		.vsel_reg = PM886_REG_LDO16_VOUT,
+		.vsel_mask = PM886_LDO_VSEL_MASK,
+	},
+	{
+		.name = "buck1",
+		.regulators_node = "regulators",
+		.of_match = "buck1",
+		.ops = &pm886_buck_ops,
+		.type = REGULATOR_VOLTAGE,
+		.n_voltages = 85,
+		.linear_ranges = pm886_buck_volt_ranges1,
+		.n_linear_ranges = ARRAY_SIZE(pm886_buck_volt_ranges1),
+		.vsel_reg = PM886_REG_BUCK1_VOUT,
+		.vsel_mask = PM886_BUCK_VSEL_MASK,
+		.enable_reg = PM886_REG_BUCK_EN,
+		.enable_mask = BIT(0),
+	},
+	{
+		.name = "buck2",
+		.regulators_node = "regulators",
+		.of_match = "buck2",
+		.ops = &pm886_buck_ops,
+		.type = REGULATOR_VOLTAGE,
+		.n_voltages = 115,
+		.linear_ranges = pm886_buck_volt_ranges2,
+		.n_linear_ranges = ARRAY_SIZE(pm886_buck_volt_ranges2),
+		.vsel_reg = PM886_REG_BUCK2_VOUT,
+		.vsel_mask = PM886_BUCK_VSEL_MASK,
+		.enable_reg = PM886_REG_BUCK_EN,
+		.enable_mask = BIT(1),
+	},
+	{
+		.name = "buck3",
+		.regulators_node = "regulators",
+		.of_match = "buck3",
+		.ops = &pm886_buck_ops,
+		.type = REGULATOR_VOLTAGE,
+		.n_voltages = 115,
+		.linear_ranges = pm886_buck_volt_ranges2,
+		.n_linear_ranges = ARRAY_SIZE(pm886_buck_volt_ranges2),
+		.vsel_reg = PM886_REG_BUCK3_VOUT,
+		.vsel_mask = PM886_BUCK_VSEL_MASK,
+		.enable_reg = PM886_REG_BUCK_EN,
+		.enable_mask = BIT(2),
+	},
+	{
+		.name = "buck4",
+		.regulators_node = "regulators",
+		.of_match = "buck4",
+		.ops = &pm886_buck_ops,
+		.type = REGULATOR_VOLTAGE,
+		.n_voltages = 115,
+		.linear_ranges = pm886_buck_volt_ranges2,
+		.n_linear_ranges = ARRAY_SIZE(pm886_buck_volt_ranges2),
+		.vsel_reg = PM886_REG_BUCK4_VOUT,
+		.vsel_mask = PM886_BUCK_VSEL_MASK,
+		.enable_reg = PM886_REG_BUCK_EN,
+		.enable_mask = BIT(3),
+	},
+	{
+		.name = "buck5",
+		.regulators_node = "regulators",
+		.of_match = "buck5",
+		.ops = &pm886_buck_ops,
+		.type = REGULATOR_VOLTAGE,
+		.n_voltages = 115,
+		.linear_ranges = pm886_buck_volt_ranges2,
+		.n_linear_ranges = ARRAY_SIZE(pm886_buck_volt_ranges2),
+		.vsel_reg = PM886_REG_BUCK5_VOUT,
+		.vsel_mask = PM886_BUCK_VSEL_MASK,
+		.enable_reg = PM886_REG_BUCK_EN,
+		.enable_mask = BIT(4),
+	},
+};
+
+static int pm886_regulator_probe(struct platform_device *pdev)
+{
+	struct pm886_chip *chip = dev_get_drvdata(pdev->dev.parent);
+	struct regulator_config rcfg = { };
+	struct device *dev = &pdev->dev;
+	struct regulator_desc *rdesc;
+	struct regulator_dev *rdev;
+	struct i2c_client *page;
+	struct regmap *regmap;
+
+	page = devm_i2c_new_dummy_device(dev, chip->client->adapter,
+			chip->client->addr + PM886_PAGE_OFFSET_REGULATORS);
+	if (IS_ERR(page))
+		return dev_err_probe(dev, PTR_ERR(page),
+				"Failed to initialize regulators client\n");
+
+	regmap = devm_regmap_init_i2c(page, &pm886_regulator_regmap_config);
+	if (IS_ERR(regmap))
+		return dev_err_probe(dev, PTR_ERR(regmap),
+				"Failed to initialize regulators regmap\n");
+	rcfg.regmap = regmap;
+
+	rcfg.dev = dev->parent;
+
+	for (int i = 0; i < ARRAY_SIZE(pm886_regulators); i++) {
+		rdesc = &pm886_regulators[i];
+		rdev = devm_regulator_register(dev, rdesc, &rcfg);
+		if (IS_ERR(rdev))
+			return dev_err_probe(dev, PTR_ERR(rdev),
+					"Failed to register %s\n", rdesc->name);
+	}
+
+	return 0;
+}
+
+static const struct platform_device_id pm886_regulator_id_table[] = {
+	{ "88pm886-regulator", },
+	{ }
+};
+MODULE_DEVICE_TABLE(platform, pm886_regulator_id_table);
+
+static struct platform_driver pm886_regulator_driver = {
+	.driver = {
+		.name = "88pm886-regulator",
+	},
+	.probe = pm886_regulator_probe,
+	.id_table = pm886_regulator_id_table,
+};
+module_platform_driver(pm886_regulator_driver);
+
+MODULE_DESCRIPTION("Marvell 88PM886 PMIC regulator driver");
+MODULE_AUTHOR("Karel Balej <balejk@matfyz.cz>");
+MODULE_LICENSE("GPL");
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index d333be2bea3b..ea6f17d451eb 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -91,6 +91,12 @@ config REGULATOR_88PM8607
 	help
 	  This driver supports 88PM8607 voltage regulator chips.
 
+config REGULATOR_88PM886
+	tristate "Marvell 88PM886 voltage regulators"
+	depends on MFD_88PM886_PMIC
+	help
+	  This driver implements support for Marvell 88PM886 voltage regulators.
+
 config REGULATOR_ACT8865
 	tristate "Active-semi act8865 voltage regulator"
 	depends on I2C
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index ba15fa5f30ad..0cce5517c85d 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o
 obj-$(CONFIG_REGULATOR_88PG86X) += 88pg86x.o
 obj-$(CONFIG_REGULATOR_88PM800) += 88pm800-regulator.o
 obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o
+obj-$(CONFIG_REGULATOR_88PM886) += 88pm886-regulator.o
 obj-$(CONFIG_REGULATOR_CROS_EC) += cros-ec-regulator.o
 obj-$(CONFIG_REGULATOR_CPCAP) += cpcap-regulator.o
 obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
-- 
2.45.1


^ permalink raw reply related

* Re: [PATCH HID 03/13] HID: bpf: implement HID-BPF through bpf_struct_ops
From: Alexei Starovoitov @ 2024-05-31 18:52 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Shuah Khan, Jiri Kosina, Jonathan Corbet, Alexei Starovoitov,
	open list:KERNEL SELFTEST FRAMEWORK, LKML, bpf,
	open list:HID CORE LAYER, open list:DOCUMENTATION
In-Reply-To: <bbmrcmm2tsbxm3f7bdjbdprqt62hkrw3d7w4w4taxaxx24rlu5@iu5krfvhcaru>

On Wed, May 29, 2024 at 12:38 AM Benjamin Tissoires <bentiss@kernel.org> wrote:
>
> > Take a look at include/linux/bpf_mprog.h
> > I suspect it might be useful here too.
>
> From the quick look of it this is interesting, but for plain struct
> bpf_prog, right?
>
> So I would have to adapt this include for struct_ops?

yeah. It needs work to be adapted to work with struct-ops.
I mentioned it mainly from uapi perspective.
BPF_F_BEFORE, BPF_F_AFTER, BPF_F_REPLACE.
Would be good to keep things consistent.

> > > @@ -112,6 +113,63 @@ struct hid_ops {
> > >
> > >  extern struct hid_ops *hid_ops;
> > >
> > > +/**
> > > + * struct hid_bpf_ops - A BPF struct_ops of callbacks allowing to attach HID-BPF
> > > + *                     programs to a HID device
> > > + * @hid_id: the HID uniq ID to attach to. This is writeable before ``load()``, and
> > > + *         cannot be changed after
> > > + * @flags: &enum hid_bpf_attach_flags to assign flags before ``load()``.
> > > + *        Writeable only before ``load()``
> > > + */
> > > +struct hid_bpf_ops {
> > > +       /* hid_id needs to stay first so we can easily change it
> > > +        * from userspace.
> > > +        */
> >
> > hmm.
> > patch 5 just does:
> > +       skel->struct_ops.mouse_invert->hid_id = hid_id;
> >
> > I don't see a reason why it needs to be first.
>
> See the selftests (and my external loader, udev-hid-bpf):
>
>                 map = bpf_object__find_map_by_name(*self->skel->skeleton->obj,
>                                                           programs[i].name + 4);
>                 ASSERT_OK_PTR(map) TH_LOG("can not find struct_ops by name '%s'",
>                                           programs[i].name + 4);
>
>                 /* hid_id is the first field of struct hid_bpf_ops */
>                 ops_hid_id = bpf_map__initial_value(map, NULL);
>                 ASSERT_OK_PTR(ops_hid_id) TH_LOG("unable to retrieve struct_ops data");
>
>                 *ops_hid_id = self->hid_id;
>
> Basically, I want to have to deal with .bpf.o and not the skeletons for
> the generic case. I want to be able to drop a file in /lib/firmware/hid
> and have udev-hid-bpf load it without having to recompile udev-hid-bpf.

and with additional restriction of only one struct-ops prog per elf file,
right?
Otherwise multiple hid_bpf_ops will be in the same elf section and
the same map.

> I couldn't seem to be able to access the struct_ops BTF information from
> libbpf, so I decided to have hid_id and flags first and consider this to
> be ABI while I figure out how to get to the real offsets :)

I see. I guess it's ok for now.

^ permalink raw reply

* [PATCH] Input: i8042 - add Ayaneo Kun to i8042 quirk table
From: tjakobi @ 2024-05-31 19:00 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Tobias Jakobi, linux-input, linux-kernel

From: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>

See the added comment for details. Also fix a typo in the
quirk's define.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
 drivers/input/serio/i8042-acpipnpio.h | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/input/serio/i8042-acpipnpio.h b/drivers/input/serio/i8042-acpipnpio.h
index dfc6c581873b..0a7388985622 100644
--- a/drivers/input/serio/i8042-acpipnpio.h
+++ b/drivers/input/serio/i8042-acpipnpio.h
@@ -76,7 +76,7 @@ static inline void i8042_write_command(int val)
 #define SERIO_QUIRK_PROBE_DEFER		BIT(5)
 #define SERIO_QUIRK_RESET_ALWAYS	BIT(6)
 #define SERIO_QUIRK_RESET_NEVER		BIT(7)
-#define SERIO_QUIRK_DIECT		BIT(8)
+#define SERIO_QUIRK_DIRECT		BIT(8)
 #define SERIO_QUIRK_DUMBKBD		BIT(9)
 #define SERIO_QUIRK_NOLOOP		BIT(10)
 #define SERIO_QUIRK_NOTIMEOUT		BIT(11)
@@ -1332,6 +1332,19 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = {
 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
 	},
+	{
+		/*
+		 * The Ayaneo Kun is a handheld device where some the buttons are handled by an
+		 * AT keyboard. The keyboard is usually detected as raw, but sometimes, usually
+		 * after a cold boot, it is detected as translated.
+		 * Make sure that the keyboard is always in raw mode.
+		 */
+		.matches = {
+			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
+			DMI_MATCH(DMI_BOARD_NAME, "KUN"),
+		},
+		.driver_data = (void *)(SERIO_QUIRK_DIRECT)
+	},
 	{ }
 };
 
@@ -1655,7 +1668,7 @@ static void __init i8042_check_quirks(void)
 		if (quirks & SERIO_QUIRK_RESET_NEVER)
 			i8042_reset = I8042_RESET_NEVER;
 	}
-	if (quirks & SERIO_QUIRK_DIECT)
+	if (quirks & SERIO_QUIRK_DIRECT)
 		i8042_direct = true;
 	if (quirks & SERIO_QUIRK_DUMBKBD)
 		i8042_dumbkbd = true;
-- 
2.44.1


^ permalink raw reply related

* Re: [PATCH v3 3/3] Input: novatek-nvt-ts: add support for NT36672A touchscreen
From: Joel Selvaraj @ 2024-06-01  0:10 UTC (permalink / raw)
  To: Hans de Goede, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86
In-Reply-To: <55272a3b-575d-4212-a40b-7245beed5d80@redhat.com>

Hi Hans de Goede,

On 5/27/24 03:42, Hans de Goede wrote:
> Hi Joel,
> 
> On 5/27/24 5:26 AM, Joel Selvaraj via B4 Relay wrote:
>> From: Joel Selvaraj <joelselvaraj.oss@gmail.com>
>>
>> ---
>>   drivers/input/touchscreen/novatek-nvt-ts.c | 78 +++++++++++++++++++++++++++---
>>   1 file changed, 72 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/input/touchscreen/novatek-nvt-ts.c b/drivers/input/touchscreen/novatek-nvt-ts.c
>> index 224fd112b25a9..7a82a1b09f9d5 100644
>> --- a/drivers/input/touchscreen/novatek-nvt-ts.c
>> +++ b/drivers/input/touchscreen/novatek-nvt-ts.c
>> @@ -139,9 +143,23 @@ static irqreturn_t nvt_ts_irq(int irq, void *dev_id)
>>   	return IRQ_HANDLED;
>>   }
>>   
>> +static void nvt_ts_disable_regulators(void *_data)
>> +{
>> +	struct nvt_ts_data *data = _data;
>> +
>> +	regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
>> +}
>> +
>>   static int nvt_ts_start(struct input_dev *dev)
>>   {
>>   	struct nvt_ts_data *data = input_get_drvdata(dev);
>> +	int error;
>> +
>> +	error = regulator_bulk_enable(ARRAY_SIZE(data->regulators), data->regulators);
>> +	if (error) {
>> +		dev_err(&data->client->dev, "failed to enable regulators\n");
>> +		return error;
>> +	}
>>   
> 
> This is weird, you already enable the regulators in probe() and
> those get disabled again on remove() by the devm action you add.
> 
> So there is no need to enable / disable the regulators on start/stop .
> 
> If you want the regulators to only be enabled when the touchscreen
> is on then you should disable the regulators again in probe()
> after the nvt_ts_read_data() call there (and drop the devm action).

Yes, I want the regulators to be enabled only when the touchscreen is 
on/active. I will disable the regulators in probe and remove the devm 
action in v4.

>> @@ -277,8 +324,26 @@ static int nvt_ts_probe(struct i2c_client *client)
>>   	return 0;
>>   }
>>   
>> +static const struct nvt_ts_i2c_chip_data nvt_nt11205_ts_data = {
>> +	.wake_type = 0x05,
>> +	.chip_id = 0x05,
>> +};
>> +
>> +static const struct nvt_ts_i2c_chip_data nvt_nt36672a_ts_data = {
>> +	.wake_type = 0x01,
>> +	.chip_id = 0x08,
>> +};
>> +
>> +static const struct of_device_id nvt_ts_of_match[] = {
>> +	{ .compatible = "novatek,nt11205-ts", .data = &nvt_nt11205_ts_data },
>> +	{ .compatible = "novatek,nt36672a-ts", .data = &nvt_nt36672a_ts_data },
>> +	{ }
>> +};
>> +MODULE_DEVICE_TABLE(of, nvt_ts_of_match);
>> +
>>   static const struct i2c_device_id nvt_ts_i2c_id[] = {
>> -	{ "NT11205-ts" },
>> +	{ "NT11205-ts", (unsigned long) &nvt_nt11205_ts_data },
>> +	{ "NT36672A-ts", (unsigned long) &nvt_nt36672a_ts_data },
> 
> The i2c-subsystem will also match of compatible strings to i2c_device_ids
> by looking at the partof the compatible after the ',', so for a compatible
> of e.g. "novatek,nt36672a-ts" will match an i2c_device_id of "nt36672a-ts".
> 
> So if you change these to lower-case:
> 
> 	{ "nt11205-ts", (unsigned long) &nvt_nt11205_ts_data },
> 	{ "nt36672a-ts", (unsigned long) &nvt_nt36672a_ts_data },
> 
> Then you can drop the nvt_ts_of_match table since that is not necessary
> then.
> 
> Hmm I just realized that this will break module auto-loading though since that
> does require of modaliases .
>   
> So maybe this is not such a good idea after all. Still switching to lowercase
> i2c_device_id-s would be good for consistency and you need to respin
> the patch-set for the regulator issue anyways.

Ok. I will change it to lowercase i2c device id in v4.

Regards,
Joel Selvaraj

^ permalink raw reply

* Re: [PATCH] [v2] HID: intel-ish-hid: fix endian-conversion
From: kernel test robot @ 2024-06-01  5:18 UTC (permalink / raw)
  To: Arnd Bergmann, Srinivas Pandruvada, Jiri Kosina,
	Benjamin Tissoires, Zhang Lixu
  Cc: llvm, oe-kbuild-all, Arnd Bergmann, linux-input, linux-kernel
In-Reply-To: <20240531162836.157891-1-arnd@kernel.org>

Hi Arnd,

kernel test robot noticed the following build warnings:

[auto build test WARNING on hid/for-next]
[also build test WARNING on next-20240531]
[cannot apply to linus/master v6.10-rc1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Arnd-Bergmann/HID-intel-ish-hid-fix-endian-conversion/20240601-003303
base:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
patch link:    https://lore.kernel.org/r/20240531162836.157891-1-arnd%40kernel.org
patch subject: [PATCH] [v2] HID: intel-ish-hid: fix endian-conversion
config: x86_64-buildonly-randconfig-002-20240601 (https://download.01.org/0day-ci/archive/20240601/202406011319.hk4MAysc-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240601/202406011319.hk4MAysc-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406011319.hk4MAysc-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/hid/intel-ish-hid/ishtp/loader.c:170: warning: Function parameter or struct member 'fragment_count' not described in 'prepare_dma_bufs'


vim +170 drivers/hid/intel-ish-hid/ishtp/loader.c

579a267e4617d7 Zhang Lixu    2024-05-06  155  
579a267e4617d7 Zhang Lixu    2024-05-06  156  /**
579a267e4617d7 Zhang Lixu    2024-05-06  157   * prepare_dma_bufs() - Prepare the DMA buffer for transferring firmware fragments
579a267e4617d7 Zhang Lixu    2024-05-06  158   * @dev: The ISHTP device
579a267e4617d7 Zhang Lixu    2024-05-06  159   * @ish_fw: The ISH firmware
579a267e4617d7 Zhang Lixu    2024-05-06  160   * @fragment: The ISHTP firmware fragment descriptor
579a267e4617d7 Zhang Lixu    2024-05-06  161   * @dma_bufs: The array of DMA fragment buffers
579a267e4617d7 Zhang Lixu    2024-05-06  162   * @fragment_size: The size of a single DMA fragment
579a267e4617d7 Zhang Lixu    2024-05-06  163   *
579a267e4617d7 Zhang Lixu    2024-05-06  164   * Return: 0 on success, negative error code on failure
579a267e4617d7 Zhang Lixu    2024-05-06  165   */
579a267e4617d7 Zhang Lixu    2024-05-06  166  static int prepare_dma_bufs(struct ishtp_device *dev,
579a267e4617d7 Zhang Lixu    2024-05-06  167  			    const struct firmware *ish_fw,
579a267e4617d7 Zhang Lixu    2024-05-06  168  			    struct loader_xfer_dma_fragment *fragment,
5180be24abbcc0 Arnd Bergmann 2024-05-31  169  			    void **dma_bufs, u32 fragment_size, u32 fragment_count)
579a267e4617d7 Zhang Lixu    2024-05-06 @170  {
2360497238261f Zhang Lixu    2024-05-23  171  	dma_addr_t dma_addr;
579a267e4617d7 Zhang Lixu    2024-05-06  172  	u32 offset = 0;
5180be24abbcc0 Arnd Bergmann 2024-05-31  173  	u32 length;
579a267e4617d7 Zhang Lixu    2024-05-06  174  	int i;
579a267e4617d7 Zhang Lixu    2024-05-06  175  
5180be24abbcc0 Arnd Bergmann 2024-05-31  176  	for (i = 0; i < fragment_count && offset < ish_fw->size; i++) {
2360497238261f Zhang Lixu    2024-05-23  177  		dma_bufs[i] = dma_alloc_coherent(dev->devc, fragment_size, &dma_addr, GFP_KERNEL);
579a267e4617d7 Zhang Lixu    2024-05-06  178  		if (!dma_bufs[i])
579a267e4617d7 Zhang Lixu    2024-05-06  179  			return -ENOMEM;
579a267e4617d7 Zhang Lixu    2024-05-06  180  
2360497238261f Zhang Lixu    2024-05-23  181  		fragment->fragment_tbl[i].ddr_adrs = cpu_to_le64(dma_addr);
5180be24abbcc0 Arnd Bergmann 2024-05-31  182  		length = clamp(ish_fw->size - offset, 0, fragment_size);
5180be24abbcc0 Arnd Bergmann 2024-05-31  183  		fragment->fragment_tbl[i].length = cpu_to_le32(length);
5180be24abbcc0 Arnd Bergmann 2024-05-31  184  		fragment->fragment_tbl[i].fw_off = cpu_to_le32(offset);
5180be24abbcc0 Arnd Bergmann 2024-05-31  185  		memcpy(dma_bufs[i], ish_fw->data + offset, length);
579a267e4617d7 Zhang Lixu    2024-05-06  186  		clflush_cache_range(dma_bufs[i], fragment_size);
579a267e4617d7 Zhang Lixu    2024-05-06  187  
5180be24abbcc0 Arnd Bergmann 2024-05-31  188  		offset += length;
579a267e4617d7 Zhang Lixu    2024-05-06  189  	}
579a267e4617d7 Zhang Lixu    2024-05-06  190  
579a267e4617d7 Zhang Lixu    2024-05-06  191  	return 0;
579a267e4617d7 Zhang Lixu    2024-05-06  192  }
579a267e4617d7 Zhang Lixu    2024-05-06  193  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply

* Re: [PATCH v3 3/3] Input: novatek-nvt-ts: add support for NT36672A touchscreen
From: Hans de Goede @ 2024-06-01 14:07 UTC (permalink / raw)
  To: Joel Selvaraj, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86
In-Reply-To: <a2f68c56-e6d6-4626-8d05-b5e808da60da@gmail.com>

Hi,

On 6/1/24 2:10 AM, Joel Selvaraj wrote:
> Hi Hans de Goede,
> 
> On 5/27/24 03:42, Hans de Goede wrote:
>> Hi Joel,
>>
>> On 5/27/24 5:26 AM, Joel Selvaraj via B4 Relay wrote:
>>> From: Joel Selvaraj <joelselvaraj.oss@gmail.com>
>>>
>>> ---
>>>   drivers/input/touchscreen/novatek-nvt-ts.c | 78 +++++++++++++++++++++++++++---
>>>   1 file changed, 72 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/input/touchscreen/novatek-nvt-ts.c b/drivers/input/touchscreen/novatek-nvt-ts.c
>>> index 224fd112b25a9..7a82a1b09f9d5 100644
>>> --- a/drivers/input/touchscreen/novatek-nvt-ts.c
>>> +++ b/drivers/input/touchscreen/novatek-nvt-ts.c
>>> @@ -139,9 +143,23 @@ static irqreturn_t nvt_ts_irq(int irq, void *dev_id)
>>>       return IRQ_HANDLED;
>>>   }
>>>   +static void nvt_ts_disable_regulators(void *_data)
>>> +{
>>> +    struct nvt_ts_data *data = _data;
>>> +
>>> +    regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
>>> +}
>>> +
>>>   static int nvt_ts_start(struct input_dev *dev)
>>>   {
>>>       struct nvt_ts_data *data = input_get_drvdata(dev);
>>> +    int error;
>>> +
>>> +    error = regulator_bulk_enable(ARRAY_SIZE(data->regulators), data->regulators);
>>> +    if (error) {
>>> +        dev_err(&data->client->dev, "failed to enable regulators\n");
>>> +        return error;
>>> +    }
>>>   
>>
>> This is weird, you already enable the regulators in probe() and
>> those get disabled again on remove() by the devm action you add.
>>
>> So there is no need to enable / disable the regulators on start/stop .
>>
>> If you want the regulators to only be enabled when the touchscreen
>> is on then you should disable the regulators again in probe()
>> after the nvt_ts_read_data() call there (and drop the devm action).
> 
> Yes, I want the regulators to be enabled only when the touchscreen is on/active. I will disable the regulators in probe and remove the devm action in v4.

Sounds good.

It is great to see people working on getting mainline
kernels to work on phones like the work you are doing here.
Thank you for doing this work!

Regards,

Hans






^ permalink raw reply

* Re: [PATCH v3 3/3] Input: novatek-nvt-ts: add support for NT36672A touchscreen
From: Joel Selvaraj @ 2024-06-01 15:08 UTC (permalink / raw)
  To: Hans de Goede, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86
In-Reply-To: <cbc86440-5065-448d-b83c-83602de6651c@redhat.com>

Hi Hans de Goede,

On 6/1/24 09:07, Hans de Goede wrote:
> Sounds good.
> 
> It is great to see people working on getting mainline
> kernels to work on phones like the work you are doing here.
> Thank you for doing this work!

Thanks! :)

Regards,
Joel Selvaraj

^ permalink raw reply

* [PATCH v4 1/3] Input: novatek-nvt-ts: replace generic i2c device id with specific IC variant
From: Joel Selvaraj via B4 Relay @ 2024-06-01 15:30 UTC (permalink / raw)
  To: Hans de Goede, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86,
	Joel Selvaraj
In-Reply-To: <20240601-nvt-ts-devicetree-regulator-support-v4-0-e0c0174464c4@gmail.com>

From: Joel Selvaraj <joelselvaraj.oss@gmail.com>

This is done in preparation to introduce other variants of the Novatek NVT
touchscreen controller that can be supported by the driver.

Signed-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>
---
 drivers/input/touchscreen/novatek-nvt-ts.c       | 2 +-
 drivers/platform/x86/x86-android-tablets/other.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/novatek-nvt-ts.c b/drivers/input/touchscreen/novatek-nvt-ts.c
index 1a797e410a3fa..9bee3a0c122fb 100644
--- a/drivers/input/touchscreen/novatek-nvt-ts.c
+++ b/drivers/input/touchscreen/novatek-nvt-ts.c
@@ -278,7 +278,7 @@ static int nvt_ts_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id nvt_ts_i2c_id[] = {
-	{ "NVT-ts" },
+	{ "nt11205-ts" },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, nvt_ts_i2c_id);
diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c
index eb0e55c69dfed..129273df0fdeb 100644
--- a/drivers/platform/x86/x86-android-tablets/other.c
+++ b/drivers/platform/x86/x86-android-tablets/other.c
@@ -40,7 +40,7 @@ static const struct x86_i2c_client_info acer_b1_750_i2c_clients[] __initconst =
 	{
 		/* Novatek NVT-ts touchscreen */
 		.board_info = {
-			.type = "NVT-ts",
+			.type = "nt11205-ts",
 			.addr = 0x34,
 			.dev_name = "NVT-ts",
 		},

-- 
2.45.1



^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox