Introduce Photonicat power management MCU driver
Subsystems (9)
cover Introduce Photonicat power management MCU driver
Initial support for the power management MCU in the Ariaboard Photonicat This patch series depends on Add support for Ariaboard Photonicat RK3568 [1]
Currently implemented features:
Implement serial communication protocol with MCU [2]. Support watchdog in MCU.
Shutdown by power button and system notifies MCU to power-off. Read charger and battery supply voltage and simply calculate capacity. Read board temperature sensor.
Set status of the network status LED.
Read and set the MCU real-time clock date time.
[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
[2] https://photonicat.com/wiki/PMU_Protocol
Junhao Xie (9):
mfd: Add driver for Photonicat power management MCU
power: reset: add Photonicat PMU poweroff driver
watchdog: Add Photonicat PMU watchdog driver
power: supply: photonicat-supply: Add Photonicat PMU battery and
charger
rtc: Add Photonicat PMU real-time clock
hwmon: Add support for Photonicat PMU board temperature sensor
leds: add Photonicat PMU LED driver
dt-bindings: Add documentation for Photonicat PMU
arm64: dts: rockchip: add Photonicat PMU support for Ariaboard
Photonicat
.../hwmon/ariaboard,photonicat-pmu-hwmon.yaml | 40 ++ .../leds/ariaboard,photonicat-pmu-leds.yaml | 41 ++ .../mfd/ariaboard,photonicat-pmu.yaml | 107 ++++ .../ariaboard,photonicat-pmu-poweroff.yaml | 34 ++ .../ariaboard,photonicat-pmu-supply.yaml | 55 ++ .../rtc/ariaboard,photonicat-pmu-rtc.yaml | 37 ++ .../ariaboard,photonicat-pmu-watchdog.yaml | 37 ++ .../boot/dts/rockchip/rk3568-photonicat.dts | 43 ++ drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/photonicat-hwmon.c | 129 +++++ drivers/leds/Kconfig | 11 + drivers/leds/Makefile | 1 + drivers/leds/leds-photonicat.c | 75 +++ drivers/mfd/Kconfig | 13 + drivers/mfd/Makefile | 1 + drivers/mfd/photonicat-pmu.c | 501 ++++++++++++++++++ drivers/power/reset/Kconfig | 12 + drivers/power/reset/Makefile | 1 + drivers/power/reset/photonicat-poweroff.c | 95 ++++ drivers/power/supply/Kconfig | 12 + drivers/power/supply/Makefile | 1 + drivers/power/supply/photonicat-supply.c | 250 +++++++++ drivers/rtc/Kconfig | 12 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-photonicat.c | 190 +++++++ drivers/watchdog/Kconfig | 12 + drivers/watchdog/Makefile | 1 + drivers/watchdog/photonicat-wdt.c | 124 +++++ include/linux/mfd/photonicat-pmu.h | 86 +++ 30 files changed, 1933 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml create mode 100644 Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml create mode 100644 Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml create mode 100644 Documentation/devicetree/bindings/power/reset/ariaboard,photonicat-pmu-poweroff.yaml create mode 100644 Documentation/devicetree/bindings/power/supply/ariaboard,photonicat-pmu-supply.yaml create mode 100644 Documentation/devicetree/bindings/rtc/ariaboard,photonicat-pmu-rtc.yaml create mode 100644 Documentation/devicetree/bindings/watchdog/ariaboard,photonicat-pmu-watchdog.yaml create mode 100644 drivers/hwmon/photonicat-hwmon.c create mode 100644 drivers/leds/leds-photonicat.c create mode 100644 drivers/mfd/photonicat-pmu.c create mode 100644 drivers/power/reset/photonicat-poweroff.c create mode 100644 drivers/power/supply/photonicat-supply.c create mode 100644 drivers/rtc/rtc-photonicat.c create mode 100644 drivers/watchdog/photonicat-wdt.c create mode 100644 include/linux/mfd/photonicat-pmu.h
Signature · 1 line
2.46.0
PATCH 1/9 mfd: Add driver for Photonicat power management MCU
Add a driver for Photonicat power management MCU, which provides battery and charger power supply, real-time clock, watchdog, hardware shutdown.
This driver implementes core MFD/serdev device as well as communication subroutines necessary for commanding the device.
--- drivers/mfd/Kconfig | 13 + drivers/mfd/Makefile | 1 + drivers/mfd/photonicat-pmu.c | 501 +++++++++++++++++++++++++++++ include/linux/mfd/photonicat-pmu.h | 86 +++++ 4 files changed, 601 insertions(+) create mode 100644 drivers/mfd/photonicat-pmu.c create mode 100644 include/linux/mfd/photonicat-pmu.h
drivers/mfd/Kconfig +13 -0
@@ -1135,6 +1135,19 @@ config MFD_PM8XXX Say M here if you want to include support for PM8xxx chips as a module. This will build a module called "pm8xxx-core". +config MFD_PHOTONICAT_PMU + tristate "Photonicat Power Management MCU" + depends on OF + depends on SERIAL_DEV_BUS + select CRC16 + select MFD_CORE + help + Driver for the Power Management MCU in the Ariaboard Photonicat, + which provides battery and charger power supply, real-time clock, + watchdog, hardware shutdown. + + Say M or Y here to include this support. + config MFD_QCOM_RPM tristate "Qualcomm Resource Power Manager (RPM)" depends on ARCH_QCOM && OF
drivers/mfd/Makefile +1 -0
@@ -223,6 +223,7 @@ obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o obj-$(CONFIG_MFD_INTEL_LPSS_ACPI) += intel-lpss-acpi.o obj-$(CONFIG_MFD_INTEL_PMC_BXT) += intel_pmc_bxt.o obj-$(CONFIG_MFD_PALMAS) += palmas.o +obj-$(CONFIG_MFD_PHOTONICAT_PMU) += photonicat-pmu.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.o obj-$(CONFIG_MFD_NTXEC) += ntxec.o obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.o
drivers/mfd/photonicat-pmu.c new file +501 -0
501 lines not on this page · raw message
include/linux/mfd/photonicat-pmu.h new file +86 -0
86 lines not on this page · raw message
Signature · 1 line
2.46.0
Re: [PATCH 1/9] mfd: Add driver for Photonicat power management MCU
Quoted 16 lines · Junhao Xie
Add a driver for Photonicat power management MCU, which provides battery and charger power supply, real-time clock, watchdog, hardware shutdown.
This driver implementes core MFD/serdev device as well as communication subroutines necessary for commanding the device.
Signed-off-by Junhao Xie <[email protected]>--- drivers/mfd/Kconfig | 13 + drivers/mfd/Makefile | 1 + drivers/mfd/photonicat-pmu.c | 501 +++++++++++++++++++++++++++++ include/linux/mfd/photonicat-pmu.h | 86 +++++ 4 files changed, 601 insertions(+) create mode 100644 drivers/mfd/photonicat-pmu.c create mode 100644 include/linux/mfd/photonicat-pmu.h
...
drivers/mfd/photonicat-pmu.c line 92
Quoted 7 lines
drivers/mfd/photonicat-pmu.c new file +7
-0+void *pcat_data_get_data (struct pcat_data *data) +{ +if (!data) +return NULL ; +return data->data; +} +EXPORT_SYMBOL_GPL (pcat_data_get_data);
You need kerneldoc... or just drop it. Looks a bit useless as an export... Is it because you want to hide from your own driver pcat_data? What for? It's your driver...
Quoted 61 lines
drivers/mfd/photonicat-pmu.c new file +61
-0+ +int pcat_pmu_send (struct pcat_pmu *pmu,enum pcat_pmu_cmd cmd, +const void *data,size_t len) +{ +u16 frame_id =atomic_inc_return (&pmu->frame); + +return pcat_pmu_raw_write (pmu, frame_id, cmd, false, data, len); +} +EXPORT_SYMBOL_GPL (pcat_pmu_send); + +int pcat_pmu_execute (struct pcat_request *request) +{ +int ret =0 , retries =0 ; +unsigned long flags; +struct pcat_pmu *pmu = request->pmu; +struct pcat_request_request *req = &request->request; +struct pcat_request_reply *reply = &request->reply; + +init_completion (&request->received); +memset (reply,0 ,sizeof (request->reply)); + +mutex_lock (&pmu->reply_lock); +if (request->frame_id ==0 ) + request->frame_id =atomic_inc_return (&pmu->frame); + pmu->reply = request; +mutex_unlock (&pmu->reply_lock); + +if (req->want ==0 ) + req->want = req->cmd +1 ; + +dev_dbg (pmu->dev,"frame 0x%04X execute cmd 0x%02X\n" , + request->frame_id, req->cmd); + +while (1 ) { +spin_lock_irqsave (&pmu->bus_lock, flags); + ret =pcat_pmu_raw_write (pmu, request->frame_id, req->cmd, + true, req->data, req->size); +spin_unlock_irqrestore (&pmu->bus_lock, flags); +if (ret <0 ) { +dev_err (pmu->dev, +"frame 0x%04X write 0x%02X cmd failed: %d\n" , + request->frame_id, req->cmd, ret); + goto fail; + } +dev_dbg (pmu->dev,"frame 0x%04X waiting response for 0x%02X\n" , + request->frame_id, req->cmd); +if (!wait_for_completion_timeout (&request->received,HZ )) { +if (retries <3 ) { + retries++; +continue ; + }else { +dev_warn (pmu->dev, +"frame 0x%04X cmd 0x%02X timeout\n" , + request->frame_id, req->cmd); + ret = -ETIMEDOUT ; + goto fail; + } + } +break ; + } + dev_dbg(pmu->dev, "frame 0x%04X got response 0x%02X\n",
drivers/mfd/photonicat-pmu.c line 204
Quoted 10 lines
drivers/mfd/photonicat-pmu.c new file +10
-0+ request->frame_id, reply->head.command); + +return 0 ; +fail: +mutex_lock (&pmu->reply_lock); + pmu->reply =NULL ; +mutex_unlock (&pmu->reply_lock); +return ret; +} +EXPORT_SYMBOL_GPL (pcat_pmu_execute);
You need kerneldoc.
Quoted 7 lines
drivers/mfd/photonicat-pmu.c new file +7
-0+ +int pcat_pmu_write_data (struct pcat_pmu *pmu,enum pcat_pmu_cmd cmd, +const void *data,size_t size) +{ +int ret; +struct pcat_request request = { + .pmu = pmu,
drivers/mfd/photonicat-pmu.c line 221
Quoted 10 lines
drivers/mfd/photonicat-pmu.c new file +10
-0+ .request.cmd = cmd, + .request.data = data, + .request.size = size, + }; + ret =pcat_pmu_execute (&request); +if (request.reply.data) +devm_kfree (pmu->dev, request.reply.data); +return ret; +} +EXPORT_SYMBOL_GPL (pcat_pmu_write_data);
You need kerneldoc.
drivers/mfd/photonicat-pmu.c line 413
Quoted 7 lines
drivers/mfd/photonicat-pmu.c new file +7
-0+ +static const struct serdev_device_ops pcat_pmu_serdev_device_ops = { + .receive_buf = pcat_pmu_receive_buf, + .write_wakeup = serdev_device_write_wakeup, +}; + +int pcat_pmu_register_notify (struct pcat_pmu *pmu,struct notifier_block *nb)
You need kerneldoc.
drivers/mfd/photonicat-pmu.c line 419
Quoted 6 lines
drivers/mfd/photonicat-pmu.c new file +6
-0+{ +return blocking_notifier_chain_register (&pmu->notifier_list, nb); +} +EXPORT_SYMBOL_GPL (pcat_pmu_register_notify); + +void pcat_pmu_unregister_notify (struct pcat_pmu *pmu,struct notifier_block *nb)
You need kerneldoc.
Quoted 5 lines
drivers/mfd/photonicat-pmu.c new file +5
-0+{ +blocking_notifier_chain_unregister (&pmu->notifier_list, nb); +} +EXPORT_SYMBOL_GPL (pcat_pmu_unregister_notify); +
drivers/mfd/photonicat-pmu.c line 434
Quoted 10 lines
drivers/mfd/photonicat-pmu.c new file +10
-0+static int pcat_pmu_probe (struct serdev_device *serdev) +{ +int ret; +u32 baudrate; +u32 address; +char buffer[64 ]; +struct pcat_pmu *pmu =NULL ; +struct device *dev = &serdev->dev; + + pmu =devm_kzalloc (dev,sizeof (struct pcat_pmu ),GFP_KERNEL );
sizeof(*)
drivers/mfd/photonicat-pmu.c line 436
Quoted 2 lines
drivers/mfd/photonicat-pmu.c new file +2
-0+if (!pmu) +return -ENOMEM ;
Blank line
Quoted 26 lines
drivers/mfd/photonicat-pmu.c new file +26
-0+ pmu->dev = dev; + pmu->serdev = serdev; +spin_lock_init (&pmu->bus_lock); +mutex_init (&pmu->reply_lock); +init_completion (&pmu->first_status); + +if (of_property_read_u32 (dev->of_node,"current-speed" , &baudrate)) + baudrate =115200 ; + +if (of_property_read_u32 (dev->of_node,"local-address" , &address)) + address =1 ; + pmu->local_id = address; + +if (of_property_read_u32 (dev->of_node,"remote-address" , &address)) + address =1 ; + pmu->remote_id = address; + +serdev_device_set_client_ops (serdev, &pcat_pmu_serdev_device_ops); + ret =devm_serdev_device_open (dev, serdev); +if (ret <0 ) +return dev_err_probe (dev, ret,"Failed to open serdev\n" ); + +serdev_device_set_baudrate (serdev, baudrate); +serdev_device_set_flow_control (serdev, false); +serdev_device_set_parity (serdev,SERDEV_PARITY_NONE ); +dev_set_drvdata (dev, pmu);
drivers/mfd/photonicat-pmu.c line 472
Quoted 10 lines
drivers/mfd/photonicat-pmu.c new file +10
-0+ +/* Disable watchdog on boot */ +pcat_pmu_write_data (pmu,PCAT_CMD_WATCHDOG_TIMEOUT_SET , + (u8 []){60 ,60 ,0 },3 ); + +/* Read hardware version */ +pcat_pmu_read_string (pmu,PCAT_CMD_PMU_HW_VERSION_GET , + buffer,sizeof (buffer)); +if (buffer[0 ]) +dev_info (dev,"PMU Hardware version: %s\n" , buffer);
dev_dbg
drivers/mfd/photonicat-pmu.c line 478
Quoted 6 lines
drivers/mfd/photonicat-pmu.c new file +6
-0+ +/* Read firmware version */ +pcat_pmu_read_string (pmu,PCAT_CMD_PMU_FW_VERSION_GET , + buffer,sizeof (buffer)); +if (buffer[0 ]) +dev_info (dev,"PMU Firmware version: %s\n" , buffer);
dev_dbg. Your driver is supposed to be silent.
drivers/mfd/photonicat-pmu.c line 484
Quoted 6 lines
drivers/mfd/photonicat-pmu.c new file +6
-0+ +return devm_of_platform_populate (dev); +} + +static const struct of_device_id pcat_pmu_dt_ids[] = { + { .compatible ="ariaboard,photonicat-pmu" , },
Undocumented compatible.
Remember about correct order of patches. ABI documentation is before users.
Quoted 4 lines
drivers/mfd/photonicat-pmu.c new file +4
-0+ {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, pcat_pmu_dt_ids); +
drivers/mfd/photonicat-pmu.c line 498
Quoted 10 lines
drivers/mfd/photonicat-pmu.c new file +10
-0+static struct serdev_device_driver pcat_pmu_driver = { + .driver = { + .name ="photonicat-pmu" , + .of_match_table = pcat_pmu_dt_ids, + }, + .probe = pcat_pmu_probe, +}; +module_serdev_device_driver (pcat_pmu_driver); + +MODULE_ALIAS ("platform:photonicat-pmu" );
You should not need MODULE_ALIAS() in normal cases. If you need it, usually it means your device ID table is wrong (e.g. misses either entries or MODULE_DEVICE_TABLE()). MODULE_ALIAS() is not a substitute for incomplete ID table.
And it is not even correct. This is not a platform driver!
Best regards,
Krzysztof
Re: [PATCH 1/9] mfd: Add driver for Photonicat power management MCU
Quoted 2 lines · Krzysztof Kozlowski
Quoted 1 line · Junhao Xie
Add a driver for Photonicat power management MCU, which
[...]>> +void *pcat_data_get_data(struct pcat_data *data)
Quoted 10 lines
drivers/mfd/photonicat-pmu.c line 92
Quoted 6 lines
drivers/mfd/photonicat-pmu.c new file +6
-0+{ +if (!data) +return NULL ; +return data->data; +} +EXPORT_SYMBOL_GPL (pcat_data_get_data);You need kerneldoc... or just drop it. Looks a bit useless as an export... Is it because you want to hide from your own driver
pcat_data? What for? It's your driver...
Now struct pcat_data is in mfd-photonicat.c,
I will move it to photonicat-pmu.h and remove pcat_data_get_data.
Quoted 1 line
[...]
Quoted 3 lines
Quoted 1 line
+void
pcat_pmu_unregister_notify(struct pcat_pmu *pmu, struct notifier_block *nb)You need kerneldoc.
I will add missing kernel documentation for all exported functions.
Quoted 1 line
[...]
Quoted 8 lines
drivers/mfd/photonicat-pmu.c line 484
Quoted 3 lines
drivers/mfd/photonicat-pmu.c new file +3
-0+ +static const struct of_device_id pcat_pmu_dt_ids[] = { + { .compatible ="ariaboard,photonicat-pmu" , },Undocumented compatible.
Remember about correct order of patches. ABI documentation is before users.
I will adjust order of patches.
Quoted 1 line
[...]
Quoted 10 lines
drivers/mfd/photonicat-pmu.c line 498
Quoted 2 lines
drivers/mfd/photonicat-pmu.c new file +2
-0+ +MODULE_ALIAS ("platform:photonicat-pmu" );You should not need
MODULE_ALIAS()in normal cases. If you need it, usually it means your device ID table is wrong (e.g. misses either entries orMODULE_DEVICE_TABLE()).MODULE_ALIAS()is not a substitute for incomplete ID table.And it is not even correct. This is not a platform driver!
Yes, I will remove MODULE_ALIAS line
Quoted 4 lines
Best regards,
Krzysztof
Thanks for your review, I will fix all problems in next version!
Best regards,
Junhao
Re: [PATCH 1/9] mfd: Add driver for Photonicat power management MCU
In reply to Junhao Xie…
Quoted 2 lines
+++
b/drivers/mfd/photonicat-pmu.c(quoted diff) +0
-0@@ -0,0 +1,501 @@
…
Review
Quoted 2 lines
(quoted diff) +2
-0+int pcat_pmu_execute(struct pcat_request *request) +{
…
Under which circumstances would you become interested to apply statements like the following?
drivers/mfd/photonicat-pmu.c line 159
Quoted 5 lines
drivers/mfd/photonicat-pmu.c new file +5
-0+mutex_lock (&pmu->reply_lock); +if (request->frame_id ==0 ) + request->frame_id =atomic_inc_return (&pmu->frame); + pmu->reply = request; +mutex_unlock (&pmu->reply_lock);
…
A) guard(mutex)(&pmu->reply_lock);
https://elixir.bootlin.com/linux/v6.11-rc6/source/include/linux/mutex.h#L196
drivers/mfd/photonicat-pmu.c line 171
Quoted 4 lines
drivers/mfd/photonicat-pmu.c new file +4
-0+spin_lock_irqsave (&pmu->bus_lock, flags); + ret =pcat_pmu_raw_write (pmu, request->frame_id, req->cmd, + true, req->data, req->size); +spin_unlock_irqrestore (&pmu->bus_lock, flags);
…
B) guard(spinlock_irqsave)(&pmu->bus_lock);
https://elixir.bootlin.com/linux/v6.11-rc6/source/include/linux/spinlock.h#L572
Regards,
Markus
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Re: [PATCH 1/9] mfd: Add driver for Photonicat power management MCU
Quoted 30 lines · Markus Elfring
…
Quoted 2 lines
+++
b/drivers/mfd/photonicat-pmu.c(quoted diff) +0
-0@@ -0,0 +1,501 @@…
Review
Quoted 2 lines
(quoted diff) +2
-0+int pcat_pmu_execute(struct pcat_request *request) +{…
Under which circumstances would you become interested to apply statements like the following?
Quoted 5 lines
drivers/mfd/photonicat-pmu.c new file +5
-0+mutex_lock (&pmu->reply_lock); +if (request->frame_id ==0 ) + request->frame_id =atomic_inc_return (&pmu->frame); + pmu->reply = request; +mutex_unlock (&pmu->reply_lock);…
A) guard(mutex)(&pmu->reply_lock); https://elixir.bootlin.com/linux/v6.11-rc6/source/include/linux/mutex.h#L196Quoted 4 lines
drivers/mfd/photonicat-pmu.c new file +4
-0+spin_lock_irqsave (&pmu->bus_lock, flags); + ret =pcat_pmu_raw_write (pmu, request->frame_id, req->cmd, + true, req->data, req->size); +spin_unlock_irqrestore (&pmu->bus_lock, flags);…
Quoted 6 lines
B) guard(spinlock_irqsave)(&pmu->bus_lock); https://elixir.bootlin.com/linux/v6.11-rc6/source/include/linux/spinlock.h#L572Regards,
Markus
Thanks for your suggestions, I will try these statements.
Best regards,
Junhao
Re: [PATCH 1/9] mfd: Add driver for Photonicat power management MCU
In reply to Junhao Xie…
Quoted 2 lines
+++
b/include/linux/mfd/photonicat-pmu.h(quoted diff) +0
-0@@ -0,0 +1,86 @@
…
include/linux/mfd/photonicat-pmu.h line 7
Quoted 2 lines
include/linux/mfd/photonicat-pmu.h new file +2
-0+#ifndef _PHOTONICAT_PMU_H +#define _PHOTONICAT_PMU_H
…
I suggest to omit leading underscores from such identifiers.
https://wiki.sei.cmu.edu/confluence/display/c/DCL37-C.+Do+not+declare+or+define+a+reserved+identifier
Regards,
Markus
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Re: [PATCH 1/9] mfd: Add driver for Photonicat power management MCU
Quoted 8 lines · Markus Elfring
…
Quoted 2 lines
+++
b/include/linux/mfd/photonicat-pmu.h(quoted diff) +0
-0@@ -0,0 +1,86 @@…
Quoted 2 lines
include/linux/mfd/photonicat-pmu.h new file +2
-0+#ifndef _PHOTONICAT_PMU_H +#define _PHOTONICAT_PMU_H…
Quoted 5 lines
I suggest to omit leading underscores from such identifiers.
https://wiki.sei.cmu.edu/confluence/display/c/DCL37-C.+Do+not+declare+or+define+a+reserved+identifierRegards,
Markus
Thanks for your suggestion, does this look better? #ifndef MFD_PHOTONICAT_PMU_H
#define MFD_PHOTONICAT_PMU_H
Best regards,
Junhao
Re: [PATCH 1/9] mfd: Add driver for Photonicat power management MCU
Quoted 12 lines · Junhao Xie
Quoted 11 lines · Markus Elfring
…
Quoted 2 lines
+++
b/include/linux/mfd/photonicat-pmu.h(quoted diff) +0
-0@@ -0,0 +1,86 @@…
include/linux/mfd/photonicat-pmu.h line 7
Quoted 2 lines
include/linux/mfd/photonicat-pmu.h new file +2
-0+#ifndef _PHOTONICAT_PMU_H +#define _PHOTONICAT_PMU_H…
I suggest to omit leading underscores from such identifiers.
https://wiki.sei.cmu.edu/confluence/display/c/DCL37-C.+Do+not+declare+or+define+a+reserved+identifier
Quoted 6 lines
Quoted 2 lines
Regards,
MarkusThanks for your suggestion, does this look better? #ifndef
MFD_PHOTONICAT_PMU_H
#defineMFD_PHOTONICAT_PMU_H
<form letter>
Feel free to ignore all comments from Markus, regardless whether the suggestion is reasonable or not. This person is banned from LKML and several maintainers ignore Markus' feedback, because it is just a waste of time.
</form letter>
Best regards,
Krzysztof
Lee Jones
maintainerRe: [PATCH 1/9] mfd: Add driver for Photonicat power management MCU
Quoted 13 lines · Krzysztof Kozlowski
Quoted 12 lines · Junhao Xie
Quoted 11 lines · Markus Elfring
…
Quoted 2 lines
+++
b/include/linux/mfd/photonicat-pmu.h(quoted diff) +0
-0@@ -0,0 +1,86 @@…
include/linux/mfd/photonicat-pmu.h line 7
Quoted 2 lines
include/linux/mfd/photonicat-pmu.h new file +2
-0+#ifndef _PHOTONICAT_PMU_H +#define _PHOTONICAT_PMU_H…
I suggest to omit leading underscores from such identifiers.
https://wiki.sei.cmu.edu/confluence/display/c/DCL37-C.+Do+not+declare+or+define+a+reserved+identifier
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Regards,
MarkusThanks for your suggestion, does this look better? #ifndef
MFD_PHOTONICAT_PMU_H
#defineMFD_PHOTONICAT_PMU_H
Yes, this is better.
Quoted 6 lines
<form letter>
Feel free to ignore all comments from Markus, regardless whether the suggestion is reasonable or not. This person is banned from LKML and several maintainers ignore Markus' feedback, because it is just a waste of time.
</form letter>
If you really _must_ do this, at least keep it factual.
To the best of my knowledge Markus is not banned from LKML.
Signature · 1 line
Lee Jones [李琼斯]
PATCH 2/9 power: reset: add Photonicat PMU poweroff driver
In reply to Junhao XieThis driver implements the shutdown function of Photonicat PMU:
- Host notifies PMU to shutdown:
When powering off, a shutdown command (0x0F) needs to be sent to the MCU.
- PMU notifies host to shutdown:
If the power button is long pressed, the MCU will send a shutdown command (0x0D) to the system.
If system does not shutdown within 60 seconds,
the power will be turned off directly.
--- drivers/power/reset/Kconfig | 12 +++ drivers/power/reset/Makefile | 1 + drivers/power/reset/photonicat-poweroff.c | 95 +++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 drivers/power/reset/photonicat-poweroff.c
drivers/power/reset/Kconfig +12 -0
@@ -148,6 +148,18 @@ config POWER_RESET_ODROID_GO_ULTRA_POWEROFF help This driver supports Power off for Odroid Go Ultra device. +config POWER_RESET_PHOTONICAT_POWEROFF + tristate "Photonicat PMU power-off driver" + depends on MFD_PHOTONICAT_PMU + help + This driver supports Power off for Photonicat PMU device. + + Supports operations: + Host notifies PMU to shutdown + PMU notifies host to shutdown + + Say Y if you have a Photonicat board. + config POWER_RESET_PIIX4_POWEROFF tristate "Intel PIIX4 power-off driver" depends on PCI
drivers/power/reset/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_POWER_RESET_MT6323) += mt6323-poweroff.o obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o obj-$(CONFIG_POWER_RESET_ODROID_GO_ULTRA_POWEROFF) += odroid-go-ultra-poweroff.o +obj-$(CONFIG_POWER_RESET_PHOTONICAT_POWEROFF) += photonicat-poweroff.o obj-$(CONFIG_POWER_RESET_PIIX4_POWEROFF) += piix4-poweroff.o obj-$(CONFIG_POWER_RESET_LTC2952) += ltc2952-poweroff.o obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o
drivers/power/reset/photonicat-poweroff.c new file +95 -0
95 lines not on this page · raw message
Signature · 1 line
2.46.0
Re: [PATCH 2/9] power: reset: add Photonicat PMU poweroff driver
Quoted 25 lines · Junhao Xie
This driver implements the shutdown function of Photonicat PMU:
- Host notifies PMU to shutdown:
When powering off, a shutdown command (0x0F) needs to be sent to the MCU.- PMU notifies host to shutdown:
If the power button is long pressed, the MCU will send a shutdown command (0x0D) to the system.
If system does not shutdown within 60 seconds,
the power will be turned off directly.Signed-off-by Junhao Xie <[email protected]>--- drivers/power/reset/Kconfig | 12 +++ drivers/power/reset/Makefile | 1 + drivers/power/reset/photonicat-poweroff.c | 95 +++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 drivers/power/reset/photonicat-poweroff.cdrivers/power/reset/Kconfig +0
-0
drivers/power/reset/Kconfig config POWER_RESET_ODROID_GO_ULTRA_POWEROFF · line 153
Quoted 6 lines
drivers/power/reset/Kconfig +3
-0@@ -148,6 +148,18 @@ config POWER_RESET_ODROID_GO_ULTRA_POWEROFF help This driver supports Power off for Odroid Go Ultra device. +config POWER_RESET_PHOTONICAT_POWEROFF + tristate "Photonicat PMU power-off driver" + depends on MFD_PHOTONICAT_PMU
|| COMPILE_TEST, no?
Quoted 58 lines
drivers/power/reset/Kconfig +9
-0+ help + This driver supports Power off for Photonicat PMU device. + + Supports operations: + Host notifies PMU to shutdown + PMU notifies host to shutdown + + Say Y if you have a Photonicat board. + config POWER_RESET_PIIX4_POWEROFF tristate "Intel PIIX4 power-off driver" depends on PCIdrivers/power/reset/Makefile +1
-0@@ -17,6 +17,7 @@ obj-$(CONFIG_POWER_RESET_MT6323) += mt6323-poweroff.o obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o obj-$(CONFIG_POWER_RESET_ODROID_GO_ULTRA_POWEROFF) += odroid-go-ultra-poweroff.o +obj-$(CONFIG_POWER_RESET_PHOTONICAT_POWEROFF) += photonicat-poweroff.o obj-$(CONFIG_POWER_RESET_PIIX4_POWEROFF) += piix4-poweroff.o obj-$(CONFIG_POWER_RESET_LTC2952) += ltc2952-poweroff.o obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.odrivers/power/reset/photonicat-poweroff.c new file +28
-0@@ -0,0 +1,95 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2024 Junhao Xie <[email protected]> +*/ + +#include <linux/mfd/photonicat-pmu.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/reboot.h> + +struct pcat_poweroff { +struct device *dev; +struct pcat_pmu *pmu; +struct notifier_block nb; +}; + +static int pcat_do_poweroff (struct sys_off_data *data) +{ +struct pcat_poweroff *poweroff = data->cb_data; + +dev_info (poweroff->dev,"Host request PMU shutdown\n" ); +pcat_pmu_write_data (poweroff->pmu,PCAT_CMD_HOST_REQUEST_SHUTDOWN , +NULL ,0 ); + +return NOTIFY_DONE ; +} +
drivers/power/reset/photonicat-poweroff.c line 38
Quoted 10 lines
drivers/power/reset/photonicat-poweroff.c new file +10
-0+static int pcat_poweroff_notify (struct notifier_block *nb,unsigned long action, +void *data) +{ +struct pcat_poweroff *poweroff = + container_of(nb, struct pcat_poweroff, nb); + +if (action !=PCAT_CMD_PMU_REQUEST_SHUTDOWN ) +return NOTIFY_DONE ; + +dev_info (poweroff->dev,"PMU request host shutdown\n" );
Nope. Drop.
drivers/power/reset/photonicat-poweroff.c line 41
Quoted 3 lines
drivers/power/reset/photonicat-poweroff.c new file +3
-0+orderly_poweroff (true); + +return NOTIFY_DONE ;
Best regards,
Krzysztof
Re: [PATCH 2/9] power: reset: add Photonicat PMU poweroff driver
Quoted 3 lines · Krzysztof Kozlowski
Quoted 2 lines · Junhao Xie
This driver implements the shutdown function of Photonicat PMU:
[...]
Quoted 6 lines
drivers/power/reset/Kconfig config POWER_RESET_ODROID_GO_ULTRA_POWEROFF · line 153
Quoted 4 lines
drivers/power/reset/Kconfig +3
-0+config POWER_RESET_PHOTONICAT_POWEROFF + tristate "Photonicat PMU power-off driver" + depends on MFD_PHOTONICAT_PMU||
COMPILE_TEST, no?
I will add it
depends on MFD_PHOTONICAT_PMU || COMPILE_TEST
Quoted 3 lines
Quoted 3 lines
drivers/power/reset/Kconfig +2
-0+ help + This driver supports Power off for Photonicat PMU device.
[...]
Quoted 5 lines
Quoted 5 lines
drivers/power/reset/photonicat-poweroff.c new file +5
-0+ +static int pcat_poweroff_notify (struct notifier_block *nb,unsigned long action, +void *data) +{ + struct pcat_poweroff *poweroff =
Quoted 8 lines
drivers/power/reset/photonicat-poweroff.c line 38
Quoted 6 lines
drivers/power/reset/photonicat-poweroff.c new file +6
-0+ container_of(nb, struct pcat_poweroff, nb); + +if (action !=PCAT_CMD_PMU_REQUEST_SHUTDOWN ) +return NOTIFY_DONE ; + +dev_info (poweroff->dev,"PMU request host shutdown\n" );Nope. Drop.
I will remove this log print.
The PMU will send a shutdown command when the power button is long pressed or the battery is low. I added this line of log to indicate the shutdown command initiated by the PMU so that users will not be confused by the sudden shutdown.
Quoted 7 lines
drivers/power/reset/photonicat-poweroff.c line 41
Quoted 4 lines
drivers/power/reset/photonicat-poweroff.c new file +3
-0+orderly_poweroff (true); + +return NOTIFY_DONE ;Best regards,
Krzysztof
Thanks for your review, I will fix all problems in next version!
Best regards,
Junhao
PATCH 3/9 watchdog: Add Photonicat PMU watchdog driver
In reply to Junhao XieThis driver provides access to Photonicat PMU watchdog functionality.
--- drivers/watchdog/Kconfig | 12 +++ drivers/watchdog/Makefile | 1 + drivers/watchdog/photonicat-wdt.c | 124 ++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 drivers/watchdog/photonicat-wdt.c
drivers/watchdog/Kconfig +12 -0
@@ -300,6 +300,18 @@ config MENZ069_WATCHDOG This driver can also be built as a module. If so the module will be called menz069_wdt. +config PHOTONICAT_PMU_WDT + tristate "Photonicat PMU Watchdog" + depends on MFD_PHOTONICAT_PMU + select WATCHDOG_CORE + help + This driver provides access to Photonicat PMU watchdog functionality. + + Say Y here to include support for the Photonicat PMU Watchdog. + + This driver can also be built as a module. If so the module + will be called photonicat-wdt. + config WDAT_WDT tristate "ACPI Watchdog Action Table (WDAT)" depends on ACPI
drivers/watchdog/Makefile +1 -0
@@ -234,6 +234,7 @@ obj-$(CONFIG_ZIIRAVE_WATCHDOG) += ziirave_wdt.o obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o obj-$(CONFIG_MENF21BMC_WATCHDOG) += menf21bmc_wdt.o obj-$(CONFIG_MENZ069_WATCHDOG) += menz69_wdt.o +obj-$(CONFIG_PHOTONICAT_PMU_WDT) += photonicat-wdt.o obj-$(CONFIG_RAVE_SP_WATCHDOG) += rave-sp-wdt.o obj-$(CONFIG_STPMIC1_WATCHDOG) += stpmic1_wdt.o obj-$(CONFIG_SL28CPLD_WATCHDOG) += sl28cpld_wdt.o
drivers/watchdog/photonicat-wdt.c new file +124 -0
124 lines not on this page · raw message
Signature · 1 line
2.46.0
Guenter Roeck
maintainerRe: [PATCH 3/9] watchdog: Add Photonicat PMU watchdog driver
Quoted 54 lines · Junhao Xie
This driver provides access to Photonicat PMU watchdog functionality.
Signed-off-by Junhao Xie <[email protected]>--- drivers/watchdog/Kconfig | 12 +++ drivers/watchdog/Makefile | 1 + drivers/watchdog/photonicat-wdt.c | 124 ++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+)create mode 100644
drivers/watchdog/photonicat-wdt.cdrivers/watchdog/Kconfig +12
-0@@ -300,6 +300,18 @@ config MENZ069_WATCHDOG This driver can also be built as a module. If so the module will be called menz069_wdt. +config PHOTONICAT_PMU_WDT + tristate "Photonicat PMU Watchdog" + depends on MFD_PHOTONICAT_PMU + select WATCHDOG_CORE + help + This driver provides access to Photonicat PMU watchdog functionality. + + Say Y here to include support for the Photonicat PMU Watchdog. + + This driver can also be built as a module. If so the module + will be called photonicat-wdt. + config WDAT_WDT tristate "ACPI Watchdog Action Table (WDAT)" depends on ACPIdrivers/watchdog/Makefile +1
-0@@ -234,6 +234,7 @@ obj-$(CONFIG_ZIIRAVE_WATCHDOG) += ziirave_wdt.o obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o obj-$(CONFIG_MENF21BMC_WATCHDOG) += menf21bmc_wdt.o obj-$(CONFIG_MENZ069_WATCHDOG) += menz69_wdt.o +obj-$(CONFIG_PHOTONICAT_PMU_WDT) += photonicat-wdt.o obj-$(CONFIG_RAVE_SP_WATCHDOG) += rave-sp-wdt.o obj-$(CONFIG_STPMIC1_WATCHDOG) += stpmic1_wdt.o obj-$(CONFIG_SL28CPLD_WATCHDOG) += sl28cpld_wdt.odrivers/watchdog/photonicat-wdt.c new file +3
-0@@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2024 Junhao Xie <[email protected]>
drivers/watchdog/photonicat-wdt.c line 13
Quoted 10 lines
drivers/watchdog/photonicat-wdt.c new file +10
-0+*/ + +#include <linux/mfd/photonicat-pmu.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/watchdog.h> + +struct pcat_watchdog { +struct device *dev;
I don't see what this is used for.
Quoted 5 lines
drivers/watchdog/photonicat-wdt.c new file +5
-0+struct pcat_pmu *pmu; +struct watchdog_device wdd; +u8 timeout; +bool started; +};
drivers/watchdog/photonicat-wdt.c line 28
Quoted 10 lines
drivers/watchdog/photonicat-wdt.c new file +10
-0+ +static const struct watchdog_info pcat_wdt_info = { + .options =WDIOF_SETTIMEOUT |WDIOF_KEEPALIVEPING |WDIOF_MAGICCLOSE , + .identity ="Photonicat PMU Watchdog" , +}; + +static int pcat_wdt_setup (struct pcat_watchdog *data,int timeout) +{ +int ret; +u8 time =0 ;
Unnecessary initialization.
drivers/watchdog/photonicat-wdt.c line 34
Quoted 6 lines
drivers/watchdog/photonicat-wdt.c new file +6
-0+u8 times[3 ] = {60 ,60 ,0 }; + + time =MIN (255 ,MAX (0 , timeout)); + + ret =pcat_pmu_write_data (data->pmu,PCAT_CMD_WATCHDOG_TIMEOUT_SET , + times,sizeof (times));
Where does this actually send the timeout to the chip ?
Quoted 23 lines
drivers/watchdog/photonicat-wdt.c new file +23
-0+if (!ret) + data->started = timeout !=0 ; + +return ret; +} + +static int pcat_wdt_start (struct watchdog_device *wdev) +{ +struct pcat_watchdog *data =watchdog_get_drvdata (wdev); + +return pcat_wdt_setup (data, data->timeout); +} + +static int pcat_wdt_stop (struct watchdog_device *wdev) +{ +struct pcat_watchdog *data =watchdog_get_drvdata (wdev); + +return pcat_wdt_setup (data,0 ); +} + +static int pcat_wdt_ping (struct watchdog_device *wdev) +{ +struct pcat_watchdog *data =watchdog_get_drvdata (wdev);
drivers/watchdog/photonicat-wdt.c line 67
Quoted 10 lines
drivers/watchdog/photonicat-wdt.c new file +10
-0+ +return pcat_pmu_send (data->pmu,PCAT_CMD_HEARTBEAT ,NULL ,0 ); +} + +static int pcat_wdt_set_timeout (struct watchdog_device *wdev,unsigned int val) +{ +int ret =0 ; +struct pcat_watchdog *data =watchdog_get_drvdata (wdev); + + data->timeout = val;
This needs to store 'timeout' in wdev. Storing it locally is unnecessary.
drivers/watchdog/photonicat-wdt.c line 69
Quoted 2 lines
drivers/watchdog/photonicat-wdt.c new file +2
-0+if (data->started) + ret =pcat_wdt_setup (data, data->timeout);
This is misleading because it would permit setting the timeout to 0 when the watchdog isn't running, and then when the watchdog is started it would not really start it. The code should not use a local "started" variable but call watchdog_active(). It should also not accept "0" as a valid timeout.
Quoted 18 lines
drivers/watchdog/photonicat-wdt.c new file +18
-0+ +return ret; +} + +static const struct watchdog_ops pcat_wdt_ops = { + .owner =THIS_MODULE , + .start = pcat_wdt_start, + .stop = pcat_wdt_stop, + .ping = pcat_wdt_ping, + .set_timeout = pcat_wdt_set_timeout, +}; + +static int pcat_watchdog_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct pcat_watchdog *watchdog; + + watchdog =devm_kzalloc (dev,sizeof (*watchdog),GFP_KERNEL );
drivers/watchdog/photonicat-wdt.c line 97
Quoted 10 lines
drivers/watchdog/photonicat-wdt.c new file +10
-0+if (!watchdog) +return -ENOMEM ; + + watchdog->dev = dev; + watchdog->pmu =dev_get_drvdata (dev->parent); + watchdog->wdd.info = &pcat_wdt_info; + watchdog->wdd.ops = &pcat_wdt_ops; + watchdog->wdd.timeout =60 ; + watchdog->wdd.max_timeout =U8_MAX ; + watchdog->wdd.min_timeout =0 ;
This effectively lets the user ... kind of ... stop the watchdog by setting the timeout to 0. This is not acceptable.
drivers/watchdog/photonicat-wdt.c line 103
Quoted 6 lines
drivers/watchdog/photonicat-wdt.c new file +6
-0+ watchdog->wdd.parent = dev; + +watchdog_stop_on_reboot (&watchdog->wdd); +watchdog_set_drvdata (&watchdog->wdd, watchdog); +platform_set_drvdata (pdev, watchdog); +
No watchdog_init_timeout() ?
Quoted 21 lines
drivers/watchdog/photonicat-wdt.c new file +21
-0+return devm_watchdog_register_device (dev, &watchdog->wdd); +} + +static const struct of_device_id pcat_watchdog_dt_ids[] = { + { .compatible ="ariaboard,photonicat-pmu-watchdog" , }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, pcat_watchdog_dt_ids); + +static struct platform_driver pcat_watchdog_driver = { + .driver = { + .name ="photonicat-watchdog" , + .of_match_table = pcat_watchdog_dt_ids, + }, + .probe = pcat_watchdog_probe, +}; +module_platform_driver (pcat_watchdog_driver); + +MODULE_AUTHOR ("Junhao Xie <[email protected]>" ); +MODULE_DESCRIPTION ("Photonicat PMU watchdog" ); +MODULE_LICENSE ("GPL" );
Re: [PATCH 3/9] watchdog: Add Photonicat PMU watchdog driver
Quoted 3 lines · Guenter Roeck
Quoted 2 lines · Junhao Xie
This driver provides access to Photonicat PMU watchdog functionality.
[...]
Quoted 5 lines
drivers/watchdog/photonicat-wdt.c line 13
Quoted 3 lines
drivers/watchdog/photonicat-wdt.c new file +3
-0+ +struct pcat_watchdog { + struct device *dev;I don't see what this is used for.
I used to use this for logging, but now they are gone, I will delete it.
Quoted 1 line
[...]
Quoted 8 lines
drivers/watchdog/photonicat-wdt.c line 28
Quoted 5 lines
drivers/watchdog/photonicat-wdt.c new file +5
-0+ +static int pcat_wdt_setup (struct pcat_watchdog *data,int timeout) +{ + int ret; + u8 time = 0;Unnecessary initialization.
Quoted 9 lines
drivers/watchdog/photonicat-wdt.c line 34
Quoted 6 lines
+ u8 times[3] = { 60, 60, 0 };
drivers/watchdog/photonicat-wdt.c new file +5
-0+ + time = MIN(255, MAX(0, timeout)); + + ret = pcat_pmu_write_data(data->pmu, PCAT_CMD_WATCHDOG_TIMEOUT_SET, + times, sizeof(times));Where does this actually send the timeout to the chip ?
I forgot to fill in timeout into times[2] during refactoring process, I will fix it.
Quoted 1 line
Quoted 1 line
+ if (!ret)
[...]>> +
Quoted 9 lines
drivers/watchdog/photonicat-wdt.c line 67
Quoted 6 lines
drivers/watchdog/photonicat-wdt.c new file +6
-0+static int pcat_wdt_set_timeout (struct watchdog_device *wdev,unsigned int val) +{ + int ret = 0; + struct pcat_watchdog *data = watchdog_get_drvdata(wdev); + + data->timeout = val;This needs to store 'timeout' in wdev. Storing it locally is unnecessary.
Quoted 9 lines
Quoted 2 lines
+ if (
data->started)
+ ret =pcat_wdt_setup(data, data->timeout);This is misleading because it would permit setting the timeout to 0 when the watchdog isn't running, and then when the watchdog is started it would not really start it. The code should not use a local "started" variable but call
watchdog_active(). It should also not accept "0" as a valid timeout.
I will fix the pcat_wdt_set_timeout.
Quoted 1 line
Quoted 1 line
+
[...]
Quoted 12 lines
Quoted 8 lines
+
+watchdog->dev= dev;
+watchdog->pmu=dev_get_drvdata(dev->parent); +watchdog->wdd.info=&pcat_wdt_info; +watchdog->wdd.ops=&pcat_wdt_ops;
+watchdog->wdd.timeout= 60;
+watchdog->wdd.max_timeout=U8_MAX;
+watchdog->wdd.min_timeout= 0;This effectively lets the user ... kind of ... stop the watchdog by setting the timeout to 0. This is not acceptable.
Quoted 7 lines
drivers/watchdog/photonicat-wdt.c line 103
Quoted 6 lines
+
watchdog->wdd.parent= dev;drivers/watchdog/photonicat-wdt.c new file +5
-0+ + watchdog_stop_on_reboot(&watchdog->wdd); + watchdog_set_drvdata(&watchdog->wdd, watchdog); + platform_set_drvdata(pdev, watchdog); +No
watchdog_init_timeout()?
Thanks for your correction, I will fix it.
Quoted 2 lines
Quoted 2 lines
+ return
devm_watchdog_register_device(dev, &watchdog->wdd);
[...]
Quoted 2 lines
Quoted 1 line
+MODULE_LICENSE("GPL");
Thanks for your review, I will fix all problems in next version!
Best regards,
Junhao
PATCH 4/9 power: supply: photonicat-supply: Add Photonicat PMU battery and charger
In reply to Junhao XiePhotonicat PMU supports battery and charger power supply. The MCU only provides voltage meter.
--- drivers/power/supply/Kconfig | 12 ++ drivers/power/supply/Makefile | 1 + drivers/power/supply/photonicat-supply.c | 250 +++++++++++++++++++++++ 3 files changed, 263 insertions(+) create mode 100644 drivers/power/supply/photonicat-supply.c
drivers/power/supply/Kconfig +12 -0
@@ -455,6 +455,18 @@ config CHARGER_PCF50633 help Say Y to include support for NXP PCF50633 Main Battery Charger. +config PHOTONICAT_POWER + tristate "Photonicat PMU power supply driver" + depends on MFD_PHOTONICAT_PMU + help + Photonicat PMU supports battery and charger power supply. + The MCU only provides voltage meter. + + Say Y here to enable support for Photonicat PMU power supply. + + This driver can also be built as a module. If so, the module will be + called photonicat-supply. + config BATTERY_RX51 tristate "Nokia RX-51 (N900) battery driver" depends on TWL4030_MADC
drivers/power/supply/Makefile +1 -0
@@ -63,6 +63,7 @@ obj-$(CONFIG_CHARGER_RT9471) += rt9471.o obj-$(CONFIG_BATTERY_TWL4030_MADC) += twl4030_madc_battery.o obj-$(CONFIG_CHARGER_88PM860X) += 88pm860x_charger.o obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o +obj-$(CONFIG_PHOTONICAT_POWER) += photonicat-supply.o obj-$(CONFIG_BATTERY_RX51) += rx51_battery.o obj-$(CONFIG_AB8500_BM) += ab8500_bmdata.o ab8500_charger.o ab8500_fg.o ab8500_btemp.o ab8500_chargalg.o obj-$(CONFIG_CHARGER_CPCAP) += cpcap-charger.o
drivers/power/supply/photonicat-supply.c new file +250 -0
250 lines not on this page · raw message
Signature · 1 line
2.46.0
PATCH 5/9 rtc: Add Photonicat PMU real-time clock
In reply to Junhao XiePhotonicat PMU MCU will send status reports regularly, including the MCU RTC date time.
Use command 0x09 to update the RTC date time of MCU.
--- drivers/rtc/Kconfig | 12 +++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-photonicat.c | 190 +++++++++++++++++++++++++++++++++++ 3 files changed, 203 insertions(+) create mode 100644 drivers/rtc/rtc-photonicat.c
drivers/rtc/Kconfig +12 -0
@@ -516,6 +516,18 @@ config RTC_DRV_PCF8583 This driver can also be built as a module. If so, the module will be called rtc-pcf8583. +config RTC_DRV_PHOTONICAT_PMU + tristate "Photonicat PMU RTC" + depends on MFD_PHOTONICAT_PMU + help + Photonicat PMU MCU will send status reports regularly, + including the MCU RTC date time. + + If you say yes here you get support for the Photonicat PMU RTC. + + This driver can also be built as a module. If so, the module + will be called rtc-photonicat. + config RTC_DRV_M41T80 tristate "ST M41T62/65/M41T80/81/82/83/84/85/87 and compatible" help
drivers/rtc/Makefile +1 -0
@@ -129,6 +129,7 @@ obj-$(CONFIG_RTC_DRV_PCF8523) += rtc-pcf8523.o obj-$(CONFIG_RTC_DRV_PCF85363) += rtc-pcf85363.o obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o +obj-$(CONFIG_RTC_DRV_PHOTONICAT_PMU) += rtc-photonicat.o obj-$(CONFIG_RTC_DRV_PIC32) += rtc-pic32.o obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o
drivers/rtc/rtc-photonicat.c new file +190 -0
190 lines not on this page · raw message
Signature · 1 line
2.46.0
PATCH 6/9 hwmon: Add support for Photonicat PMU board temperature sensor
In reply to Junhao XiePhotonicat PMU MCU will send status reports regularly, including board temperature.
--- drivers/hwmon/Kconfig | 10 +++ drivers/hwmon/Makefile | 1 + drivers/hwmon/photonicat-hwmon.c | 129 +++++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 drivers/hwmon/photonicat-hwmon.c
drivers/hwmon/Kconfig +10 -0
@@ -1781,6 +1781,16 @@ config SENSORS_PT5161L This driver can also be built as a module. If so, the module will be called pt5161l. +config SENSORS_PHOTONICAT_PMU_HWMON + tristate "Photonicat PMU temperature sensor" + depends on MFD_PHOTONICAT_PMU + help + If you say yes here you get support for temperature sensor on the + Photonicat PMU. + + This driver can also be built as a module. If so, the module + will be called photonicat-hwmon. + config SENSORS_PWM_FAN tristate "PWM fan" depends on PWM || COMPILE_TEST
drivers/hwmon/Makefile +1 -0
@@ -183,6 +183,7 @@ obj-$(CONFIG_SENSORS_OXP) += oxp-sensors.o obj-$(CONFIG_SENSORS_PC87360) += pc87360.o obj-$(CONFIG_SENSORS_PC87427) += pc87427.o obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o +obj-$(CONFIG_SENSORS_PHOTONICAT_PMU_HWMON) += photonicat-hwmon.o obj-$(CONFIG_SENSORS_POWERZ) += powerz.o obj-$(CONFIG_SENSORS_POWR1220) += powr1220.o obj-$(CONFIG_SENSORS_PT5161L) += pt5161l.o
drivers/hwmon/photonicat-hwmon.c new file +129 -0
129 lines not on this page · raw message
Signature · 1 line
2.46.0
Guenter Roeck
maintainerRe: [PATCH 6/9] hwmon: Add support for Photonicat PMU board temperature sensor
Quoted 3 lines · Junhao Xie
Photonicat PMU MCU will send status reports regularly, including board temperature.
This is not an appropriate description.
Quoted 5 lines
Signed-off-by Junhao Xie <[email protected]>--- drivers/hwmon/Kconfig | 10 +++ drivers/hwmon/Makefile | 1 + drivers/hwmon/photonicat-hwmon.c | 129 +++++++++++++++++++++++++++++++
Documentation missing.
Quoted 2 lines
(quoted diff) +2
-0+static int pcat_hwmon_probe(struct platform_device *pdev) +{
...
Review
Quoted 2 lines
(quoted diff) +2
-0+ dev_info(dev, "Board Temprature: %d degress C\n", hwmon->temperature); +
Unacceptable (misspelled) noise.
drivers/hwmon/photonicat-hwmon.c line 90
Quoted 3 lines
drivers/hwmon/photonicat-hwmon.c new file +3
-0+ hwmon->hwmon =devm_hwmon_device_register_with_groups ( + dev, label, hwmon, pcat_pmu_temp_groups); +
Please use the with_info API. I am not going to review the code because it will need to be completely rewritten.
Guenter
Re: [PATCH 6/9] hwmon: Add support for Photonicat PMU board temperature sensor
Quoted 6 lines · Guenter Roeck
Quoted 3 lines · Junhao Xie
Photonicat PMU MCU will send status reports regularly, including board temperature.
This is not an appropriate description.
I will change to a better description.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Junhao Xie <[email protected]>---
drivers/hwmon/Kconfig | 10 +++ drivers/hwmon/Makefile | 1 +drivers/hwmon/photonicat-hwmon.c| 129 +++++++++++++++++++++++++++++++Documentation missing.
Does it need to be placed in Documentation/hwmon/photonicat-hwmon.rst?
Quoted 9 lines
Quoted 3 lines
(quoted diff) +2
-0+static int pcat_hwmon_probe(struct platform_device *pdev) +{...
Quoted 2 lines
+
dev_info(dev, "Board Temprature: %d degress C\n", hwmon->temperature); +Unacceptable (misspelled) noise.
Quoted 9 lines
Quoted 3 lines
+
hwmon->hwmon=devm_hwmon_device_register_with_groups( + dev, label, hwmon, pcat_pmu_temp_groups); +Please use the
with_infoAPI. I am not going to review the code because it will need to be completely rewritten.Guenter
Thanks for your review, I will rewrite this driver!
Best regards,
Junhao
Guenter Roeck
maintainerRe: [PATCH 6/9] hwmon: Add support for Photonicat PMU board temperature sensor
Quoted 17 lines · Junhao Xie
Quoted 6 lines · Guenter Roeck
Quoted 3 lines · Junhao Xie
Photonicat PMU MCU will send status reports regularly, including board temperature.
This is not an appropriate description.
I will change to a better description.
Quoted 7 lines
Quoted 6 lines
Signed-off-by Junhao Xie <[email protected]>--- drivers/hwmon/Kconfig | 10 +++ drivers/hwmon/Makefile | 1 + drivers/hwmon/photonicat-hwmon.c | 129 +++++++++++++++++++++++++++++++
Quoted 4 lines
Quoted 1 line
Documentation missing.
Does it need to be placed in
Documentation/hwmon/photonicat-hwmon.rst?
Yes.
Thanks,
Guenter
PATCH 7/9 leds: add Photonicat PMU LED driver
In reply to Junhao XiePhotonicat has a network status LED that can be controlled by system. The LED status can be set through command 0x19.
--- drivers/leds/Kconfig | 11 +++++ drivers/leds/Makefile | 1 + drivers/leds/leds-photonicat.c | 75 ++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 drivers/leds/leds-photonicat.c
drivers/leds/Kconfig +11 -0
@@ -381,6 +381,17 @@ config LEDS_PCA9532_GPIO To use a pin as gpio pca9532_type in pca9532_platform data needs to set to PCA9532_TYPE_GPIO. +config LEDS_PHOTONICAT_PMU + tristate "LED Support for Photonicat PMU" + depends on LEDS_CLASS + depends on MFD_PHOTONICAT_PMU + help + Photonicat has a network status LED that can be controlled by system, + this option enables support for LEDs connected to the Photonicat PMU. + + To compile this driver as a module, choose M here: the + module will be called leds-photonicat. + config LEDS_GPIO tristate "LED Support for GPIO connected LEDs" depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
@@ -76,6 +76,7 @@ obj-$(CONFIG_LEDS_PCA9532) += leds-pca9532.o obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o obj-$(CONFIG_LEDS_PCA963X) += leds-pca963x.o obj-$(CONFIG_LEDS_PCA995X) += leds-pca995x.o +obj-$(CONFIG_LEDS_PHOTONICAT_PMU) += leds-photonicat.o obj-$(CONFIG_LEDS_PM8058) += leds-pm8058.o obj-$(CONFIG_LEDS_POWERNV) += leds-powernv.o obj-$(CONFIG_LEDS_PWM) += leds-pwm.o
drivers/leds/leds-photonicat.c new file +75 -0
75 lines not on this page · raw message
Signature · 1 line
2.46.0
Lee Jones
maintainerRe: [PATCH 7/9] leds: add Photonicat PMU LED driver
Quoted 16 lines · Junhao Xie
Photonicat has a network status LED that can be controlled by system. The LED status can be set through command
0x19.Signed-off-by Junhao Xie <[email protected]>--- drivers/leds/Kconfig | 11 +++++ drivers/leds/Makefile | 1 + drivers/leds/leds-photonicat.c | 75 ++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 drivers/leds/leds-photonicat.cdrivers/leds/Kconfig +0
-0
drivers/leds/Kconfig config LEDS_PCA9532_GPIO · line 389
Quoted 9 lines
drivers/leds/Kconfig +6
-0@@ -381,6 +381,17 @@ config LEDS_PCA9532_GPIO To use a pin as gpio pca9532_type in pca9532_platform data needs to set to PCA9532_TYPE_GPIO. +config LEDS_PHOTONICAT_PMU + tristate "LED Support for Photonicat PMU" + depends on LEDS_CLASS + depends on MFD_PHOTONICAT_PMU + help + Photonicat has a network status LED that can be controlled by system,
"the system"
Quoted 26 lines
drivers/leds/Kconfig +5
-0+ this option enables support for LEDs connected to the Photonicat PMU. + + To compile this driver as a module, choose M here: the + module will be called leds-photonicat. + config LEDS_GPIO tristate "LED Support for GPIO connected LEDs" depends on LEDS_CLASSdrivers/leds/Makefile +1
-0@@ -76,6 +76,7 @@ obj-$(CONFIG_LEDS_PCA9532) += leds-pca9532.o obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o obj-$(CONFIG_LEDS_PCA963X) += leds-pca963x.o obj-$(CONFIG_LEDS_PCA995X) += leds-pca995x.o +obj-$(CONFIG_LEDS_PHOTONICAT_PMU) += leds-photonicat.o obj-$(CONFIG_LEDS_PM8058) += leds-pm8058.o obj-$(CONFIG_LEDS_POWERNV) += leds-powernv.o obj-$(CONFIG_LEDS_PWM) += leds-pwm.odrivers/leds/leds-photonicat.c new file +0
-0
drivers/leds/leds-photonicat.c line 10
Quoted 10 lines
drivers/leds/leds-photonicat.c new file +10
-0@@ -0,0 +1,75 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2024 Junhao Xie <[email protected]> +*/ + +#include <linux/mfd/photonicat-pmu.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/leds.h>
Alphabetical.
drivers/leds/leds-photonicat.c line 13
Quoted 2 lines
drivers/leds/leds-photonicat.c new file +2
-0+struct pcat_leds { +struct device *dev;
Where is this used?
drivers/leds/leds-photonicat.c line 14
Quoted 1 line
drivers/leds/leds-photonicat.c new file +1
-0+struct pcat_pmu *pmu;
Why do you need to store this?
Can't you get this at the call-site by:
dev_get_drvdata(cdev->dev->parent)
Quoted 10 lines
drivers/leds/leds-photonicat.c new file +10
-0+struct led_classdev cdev; +}; + +static int pcat_led_status_set (struct led_classdev *cdev, +enum led_brightness brightness) +{ + struct pcat_leds *leds = container_of(cdev, struct pcat_leds, cdev); +struct pcat_data_cmd_led_setup setup = {0 ,0 ,0 }; + +if (brightness)
drivers/leds/leds-photonicat.c line 34
Quoted 10 lines
drivers/leds/leds-photonicat.c new file +10
-0+ setup.on_time =100 ; + else + setup.down_time = 100; +return pcat_pmu_write_data (leds->pmu,PCAT_CMD_NET_STATUS_LED_SETUP , + &setup,sizeof (setup)); +} + +static int pcat_leds_probe (struct platform_device *pdev) +{ +int ret;
Small sized variables at the bottom please.
drivers/leds/leds-photonicat.c line 43
Quoted 9 lines
drivers/leds/leds-photonicat.c new file +9
-0+struct device *dev = &pdev->dev; +struct pcat_leds *leds; +const char *label; + + leds =devm_kzalloc (dev,sizeof (*leds),GFP_KERNEL ); +if (!leds) +return -ENOMEM ; + + leds->dev = dev;
Where is this used?
drivers/leds/leds-photonicat.c line 45
Quoted 2 lines
drivers/leds/leds-photonicat.c new file +2
-0+ leds->pmu =dev_get_drvdata (dev->parent); +platform_set_drvdata (pdev, leds);
Where do you platform_get_drvdata()
drivers/leds/leds-photonicat.c line 59
Quoted 13 lines
drivers/leds/leds-photonicat.c new file +13
-0+ ret =of_property_read_string (dev->of_node,"label" , &label); +if (ret) +return dev_err_probe (dev, ret,"No label property\n" ); + + leds->cdev.name = label; + leds->cdev.max_brightness =1 ; + leds->cdev.brightness_set_blocking = pcat_led_status_set; + +return devm_led_classdev_register (dev, &leds->cdev); +} + +static const struct of_device_id pcat_leds_dt_ids[] = { + { .compatible ="ariaboard,photonicat-pmu-leds" , },
How many LEDs are there?
Quoted 19 lines
drivers/leds/leds-photonicat.c new file +16
-0+ {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, pcat_leds_dt_ids); + +static struct platform_driver pcat_leds_driver = { + .driver = { + .name ="photonicat-leds" , + .of_match_table = pcat_leds_dt_ids, + }, + .probe = pcat_leds_probe, +}; +module_platform_driver (pcat_leds_driver); + +MODULE_AUTHOR ("Junhao Xie <[email protected]>" ); +MODULE_DESCRIPTION ("Photonicat PMU Status LEDs" ); +MODULE_LICENSE ("GPL" );Signature · 1 line
2.46.0
Signature · 2 lines
0) Lee Jones [李琼斯]
Re: [PATCH 7/9] leds: add Photonicat PMU LED driver
Quoted 4 lines · Lee Jones
Quoted 2 lines · Junhao Xie
Photonicat has a network status LED that can be controlled by system. The LED status can be set through command
0x19.
[...]
Quoted 10 lines
drivers/leds/Kconfig config LEDS_PCA9532_GPIO · line 389
Quoted 6 lines
drivers/leds/Kconfig +6
-0+config LEDS_PHOTONICAT_PMU + tristate "LED Support for Photonicat PMU" + depends on LEDS_CLASS + depends on MFD_PHOTONICAT_PMU + help + Photonicat has a network status LED that can be controlled by system,"the system"
Quoted 1 line
drivers/leds/Kconfig +1
-0+ this option enables support for LEDs connected to the Photonicat PMU.
[...]
Quoted 15 lines
drivers/leds/leds-photonicat.c line 10
Quoted 12 lines
+++
b/drivers/leds/leds-photonicat.cdrivers/leds/leds-photonicat.c new file +10
-0@@ -0,0 +1,75 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2024 Junhao Xie <[email protected]> +*/ + +#include <linux/mfd/photonicat-pmu.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/leds.h> Alphabetical.
Quoted 4 lines
drivers/leds/leds-photonicat.c line 13
Quoted 2 lines
drivers/leds/leds-photonicat.c new file +2
-0+struct pcat_leds { +struct device *dev;Where is this used?
I used it to print logs, but now it doesn't, I will remove it.
Quoted 8 lines
drivers/leds/leds-photonicat.c line 14
Quoted 2 lines
drivers/leds/leds-photonicat.c new file +1
-0+struct pcat_pmu *pmu;Why do you need to store this?
Can't you get this at the call-site by:
dev_get_drvdata(cdev->dev->parent)
Yes, I will change it.
Quoted 2 lines
Quoted 2 lines
(quoted diff) +2
-0+ struct led_classdev cdev; +};
[...]
Quoted 24 lines
drivers/leds/leds-photonicat.c line 34
Quoted 3 lines
drivers/leds/leds-photonicat.c new file +3
-0+static int pcat_leds_probe (struct platform_device *pdev) +{ +int ret;Small sized variables at the bottom please.
drivers/leds/leds-photonicat.c line 43
Quoted 9 lines
drivers/leds/leds-photonicat.c new file +9
-0+struct device *dev = &pdev->dev; +struct pcat_leds *leds; +const char *label; + + leds =devm_kzalloc (dev,sizeof (*leds),GFP_KERNEL ); +if (!leds) +return -ENOMEM ; + + leds->dev = dev;Where is this used?
drivers/leds/leds-photonicat.c line 45
Quoted 2 lines
drivers/leds/leds-photonicat.c new file +2
-0+ leds->pmu =dev_get_drvdata (dev->parent); +platform_set_drvdata (pdev, leds);Where do you
platform_get_drvdata()Quoted 1 line
drivers/leds/leds-photonicat.c new file +1
-0+ ret =of_property_read_string (dev->of_node,"label" , &label);
[...]
Quoted 4 lines
drivers/leds/leds-photonicat.c line 59
Quoted 2 lines
drivers/leds/leds-photonicat.c new file +2
-0+static const struct of_device_id pcat_leds_dt_ids[] = { + { .compatible ="ariaboard,photonicat-pmu-leds" , },How many LEDs are there?
Photonicat has three LEDs:
- system operation status indicator
- charging status indicator
- network status indicator
and currently only one LED (network status indicator) can be controlled.
Quoted 2 lines
Quoted 2 lines
(quoted diff) +2
-0+ { /* sentinel */ } +};
[...]
Quoted 2 lines
Quoted 2 lines
Signature · 1 line
2.46.0
Thanks for your review, I will fix all problems in next version!
Best regards,
Junhao
PATCH 8/9 dt-bindings: Add documentation for Photonicat PMU
In reply to Junhao XieAdd device tree binding documentation for Photonicat PMU MFD, LEDs, hardware monitor, power off, power supply, real-time clock watchdog.
--- .../hwmon/ariaboard,photonicat-pmu-hwmon.yaml | 40 +++++++ .../leds/ariaboard,photonicat-pmu-leds.yaml | 41 +++++++ .../mfd/ariaboard,photonicat-pmu.yaml | 107 ++++++++++++++++++ .../ariaboard,photonicat-pmu-poweroff.yaml | 34 ++++++ .../ariaboard,photonicat-pmu-supply.yaml | 55 +++++++++ .../rtc/ariaboard,photonicat-pmu-rtc.yaml | 37 ++++++ .../ariaboard,photonicat-pmu-watchdog.yaml | 37 ++++++ 7 files changed, 351 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml create mode 100644 Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml create mode 100644 Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml create mode 100644 Documentation/devicetree/bindings/power/reset/ariaboard,photonicat-pmu-poweroff.yaml create mode 100644 Documentation/devicetree/bindings/power/supply/ariaboard,photonicat-pmu-supply.yaml create mode 100644 Documentation/devicetree/bindings/rtc/ariaboard,photonicat-pmu-rtc.yaml create mode 100644 Documentation/devicetree/bindings/watchdog/ariaboard,photonicat-pmu-watchdog.yaml
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml new file +40 -0
@@ -0,0 +1,40 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/ariaboard,photonicat-pmu-hwmon.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Photonicat PMU Hardware Monitor + +maintainers: + - Junhao Xie <[email protected]> + +description: + Board temperature sensor on the Photonicat PMU MCU + +properties: + compatible: + const: ariaboard,photonicat-pmu-hwmon + + label: + $ref: /schemas/types.yaml#/definitions/string + description: Label for hwmon device + +required: + - compatible + - label + +additionalProperties: false + +examples: + - | + serial { + mcu { + compatible = "ariaboard,photonicat-pmu"; + + hwmon { + compatible = "ariaboard,photonicat-pmu-hwmon"; + label = "pcat_board"; + }; + }; + };
Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml new file +41 -0
41 lines not on this page · raw message
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +107 -0
107 lines not on this page · raw message
Documentation/devicetree/bindings/power/reset/ariaboard,photonicat-pmu-poweroff.yaml new file +34 -0
@@ -0,0 +1,34 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/reset/ariaboard,photonicat-pmu-poweroff.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Photonicat PMU Real-time clock + +maintainers: + - Junhao Xie <[email protected]> + +description: + Poweroff on the Photonicat PMU MCU + +properties: + compatible: + const: ariaboard,photonicat-pmu-poweroff + +required: + - compatible + +additionalProperties: false + +examples: + - | + serial { + mcu { + compatible = "ariaboard,photonicat-pmu"; + + poweroff { + compatible = "ariaboard,photonicat-pmu-poweroff"; + }; + }; + };
Documentation/devicetree/bindings/power/supply/ariaboard,photonicat-pmu-supply.yaml new file +55 -0
55 lines not on this page · raw message
Documentation/devicetree/bindings/rtc/ariaboard,photonicat-pmu-rtc.yaml new file +37 -0
@@ -0,0 +1,37 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/rtc/ariaboard,photonicat-pmu-rtc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Photonicat PMU Real-time clock + +maintainers: + - Junhao Xie <[email protected]> + +description: + Real-time clock on the Photonicat PMU MCU + +allOf: + - $ref: rtc.yaml# + +properties: + compatible: + const: ariaboard,photonicat-pmu-rtc + +required: + - compatible + +additionalProperties: false + +examples: + - | + serial { + mcu { + compatible = "ariaboard,photonicat-pmu"; + + rtc { + compatible = "ariaboard,photonicat-pmu-rtc"; + }; + }; + };
Documentation/devicetree/bindings/watchdog/ariaboard,photonicat-pmu-watchdog.yaml new file +37 -0
@@ -0,0 +1,37 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/watchdog/ariaboard,photonicat-pmu-watchdog.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Photonicat PMU Watchdog + +maintainers: + - Junhao Xie <[email protected]> + +description: + Watchdog on the Photonicat PMU MCU + +allOf: + - $ref: watchdog.yaml# + +properties: + compatible: + const: ariaboard,photonicat-pmu-watchdog + +required: + - compatible + +additionalProperties: false + +examples: + - | + serial { + mcu { + compatible = "ariaboard,photonicat-pmu"; + + watchdog { + compatible = "ariaboard,photonicat-pmu-watchdog"; + }; + }; + };
Signature · 1 line
2.46.0
Re: [PATCH 8/9] dt-bindings: Add documentation for Photonicat PMU
Quoted 38 lines · Junhao Xie
Add device tree binding documentation for Photonicat PMU MFD, LEDs, hardware monitor, power off, power supply, real-time clock watchdog.
Signed-off-by Junhao Xie <[email protected]>--- .../hwmon/ariaboard,photonicat-pmu-hwmon.yaml | 40 +++++++ .../leds/ariaboard,photonicat-pmu-leds.yaml | 41 +++++++ .../mfd/ariaboard,photonicat-pmu.yaml | 107 ++++++++++++++++++ .../ariaboard,photonicat-pmu-poweroff.yaml | 34 ++++++ .../ariaboard,photonicat-pmu-supply.yaml | 55 +++++++++ .../rtc/ariaboard,photonicat-pmu-rtc.yaml | 37 ++++++ .../ariaboard,photonicat-pmu-watchdog.yaml | 37 ++++++ 7 files changed, 351 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml create mode 100644 Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml create mode 100644 Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml create mode 100644 Documentation/devicetree/bindings/power/reset/ariaboard,photonicat-pmu-poweroff.yaml create mode 100644 Documentation/devicetree/bindings/power/supply/ariaboard,photonicat-pmu-supply.yaml create mode 100644 Documentation/devicetree/bindings/rtc/ariaboard,photonicat-pmu-rtc.yaml create mode 100644 Documentation/devicetree/bindings/watchdog/ariaboard,photonicat-pmu-watchdog.yamlDocumentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml new file +11
-0@@ -0,0 +1,40 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/ariaboard,photonicat-pmu-hwmon.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Photonicat PMU Hardware Monitor + +maintainers: + - Junhao Xie <[email protected]> +
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml line 21
Quoted 10 lines
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml new file +10
-0+description: + Board temperature sensor on the Photonicat PMU MCU + +properties: + compatible: + const: ariaboard,photonicat-pmu-hwmon + + label: + $ref: /schemas/types.yaml#/definitions/string + description: Label for hwmon device
No resources here. Fold it into parent binding.
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml line 33
Quoted 12 lines
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml new file +12
-0+ +required: + - compatible + - label + +additionalProperties: false + +examples: + - | + serial { + mcu { + compatible = "ariaboard,photonicat-pmu";
Drop, no need.
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml line 34
Quoted 1 line
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml new file +1
-0+
Messed indentation.
Entire example is redundant. Merge it to parent binding.
Quoted 22 lines
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml new file +6
-0+ hwmon { + compatible = "ariaboard,photonicat-pmu-hwmon"; + label = "pcat_board"; + }; + }; + };Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml new file +10
-0@@ -0,0 +1,41 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/ariaboard,photonicat-pmu-leds.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Photonicat PMU LEDs + +maintainers: + - Junhao Xie <[email protected]>
Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml line 20
Quoted 10 lines
Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml new file +10
-0+ +description: + LEDs on the Photonicat PMU MCU + +allOf: + - $ref: common.yaml# + +properties: + compatible: + const: ariaboard,photonicat-pmu-leds
Your compatibles per device do not make much sense. You organized bindings per drivers, but that's not what we want.
Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml line 22
Quoted 2 lines
Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml new file +2
-0+ + label: true
Drop
Quoted 28 lines
Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml new file +19
-0+ +required: + - compatible + - label + +additionalProperties: false + +examples: + - | + serial { + mcu { + compatible = "ariaboard,photonicat-pmu"; + + leds-status { + compatible = "ariaboard,photonicat-pmu-leds"; + label = "net-status"; + }; + }; + };Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +3
-0@@ -0,0 +1,107 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +---
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 13
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +10
-0+$id: http://devicetree.org/schemas/mfd/ariaboard,photonicat-pmu.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Ariaboard Photonicat PMU + +maintainers: + - Junhao Xie <[email protected]> + +description: + Driver for the Power Management MCU in the Ariaboard Photonicat,
Bindings are for hardware, not drivers. Drop it everywhere and explain hardware.
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 19
Quoted 6 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +6
-0+ which provides battery and charger power supply, real-time clock, + watchdog, hardware shutdown. + +properties: + compatible: + const: ariaboard,photonicat-pmu
That's the only compatible you should have. Drop all others.
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 31
Quoted 12 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +12
-0+ + current-speed: + $ref: /schemas/types.yaml#/definitions/uint32 + default: 115200 + description: PMU Serial baudrate + + local-address: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 127 + default: 1 + description: CPU board address
Address of what? In which notation? It's part of this hardware.
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 38
Quoted 7 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +7
-0+ + remote-address: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 127 + default: 1 + description: PMU board address
Eee, no. Your board knows its address. You do not have to tell it.
Quoted 5 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +5
-0+ + hwmon: + $ref: /schemas/hwmon/ariaboard,photonicat-pmu-hwmon.yaml + + poweroff:
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 53
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +10
-0+ $ref: /schemas/power/reset/ariaboard,photonicat-pmu-poweroff.yaml + + rtc: + $ref: /schemas/rtc/ariaboard,photonicat-pmu-rtc.yaml + + watchdog: + $ref: /schemas/watchdog/ariaboard,photonicat-pmu-watchdog.yaml + +patternProperties: + '^leds-(status)':
That's not a pattern.
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 57
Quoted 4 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +4
-0+ $ref: /schemas/leds/ariaboard,photonicat-pmu-leds.yaml + + '^supply-(battery|charger)$': + $ref: /schemas/power/supply/ariaboard,photonicat-pmu-supply.yaml
Why two nodes?
Quoted 8 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +8
-0+ +required: + - compatible + +additionalProperties: false + +examples: + - |
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 75
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +10
-0+ serial { + photonicat-pmu { + compatible = "ariaboard,photonicat-pmu"; + current-speed = <115200>; + local-address = <1>; + remote-address = <1>; + + supply-battery { + compatible = "ariaboard,photonicat-pmu-supply"; + label = "battery";
Nope, drop label.
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 76
Quoted 1 line
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +1
-0+ type = "battery";
No, there is no type property.
Missing monitored battery.
Quoted 19 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +19
-0+ }; + + supply-charger { + compatible = "ariaboard,photonicat-pmu-supply"; + label = "charger"; + type = "charger"; + }; + + hwmon { + compatible = "ariaboard,photonicat-pmu-hwmon"; + label = "pcat_board"; + }; + + leds-status { + compatible = "ariaboard,photonicat-pmu-leds"; + label = "net-status"; + }; + + poweroff {
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 105
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +10
-0+ compatible = "ariaboard,photonicat-pmu-poweroff"; + }; + + rtc { + compatible = "ariaboard,photonicat-pmu-rtc"; + }; + + watchdog { + compatible = "ariaboard,photonicat-pmu-watchdog"; + };
These are seriously redundant and useless nodes. There is nothing beneficial from the nodes above - they are all empty, without resources. Drop all of them.
I finish the review here.
Best regards,
Krzysztof
Re: [PATCH 8/9] dt-bindings: Add documentation for Photonicat PMU
Quoted 3 lines · Krzysztof Kozlowski
Quoted 2 lines · Junhao Xie
Add device tree binding documentation for Photonicat PMU MFD, LEDs, hardware monitor, power off, power supply, real-time clock watchdog.
[...]
Quoted 1 line
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml
Quoted 1 line
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml +0
-0
[...]>> + label:
Quoted 20 lines
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml line 21
Quoted 2 lines
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml +2
-0+ $ref: /schemas/types.yaml#/definitions/string + description: Label for hwmon deviceNo resources here. Fold it into parent binding.
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml line 33
Quoted 12 lines
Documentation/devicetree/bindings/hwmon/ariaboard,photonicat-pmu-hwmon.yaml +12
-0+ +required: + - compatible + - label + +additionalProperties: false + +examples: + - | + serial { + mcu { + compatible = "ariaboard,photonicat-pmu";Drop, no need.
Quoted 6 lines
Quoted 1 line
+
Messed indentation.
Entire example is redundant. Merge it to parent binding.
I will fix them.
Quoted 1 line
[...]
Quoted 1 line
Quoted 1 line
Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml +0
-0
[...]
Quoted 11 lines
Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml line 20
Quoted 3 lines
Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml +3
-0+properties: + compatible: + const: ariaboard,photonicat-pmu-ledsYour compatibles per device do not make much sense. You organized bindings per drivers, but that's not what we want.
Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml
Quoted 2 lines
Documentation/devicetree/bindings/leds/ariaboard,photonicat-pmu-leds.yaml +2
-0+ + label: trueDrop
I will drop it.
Quoted 1 line
[...]
Quoted 1 line
Quoted 1 line
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml +0
-0
[...]
Quoted 6 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 13
Quoted 2 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml +2
-0+description: + Driver for the Power Management MCU in the Ariaboard Photonicat,Bindings are for hardware, not drivers. Drop it everywhere and explain hardware.
I will edit it.
Maybe the following looks better?
The Power Management MCU in Ariaboard Photonicat, which provides battery and charger power supply real-time clock, watchdog, hardware shutdown, status LEDs.
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 19
Quoted 6 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml +6
-0+ which provides battery and charger power supply, real-time clock, + watchdog, hardware shutdown. + +properties: + compatible: + const: ariaboard,photonicat-pmuThat's the only compatible you should have. Drop all others.
Quoted 1 line
+
[...]
Quoted 9 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 31
Quoted 6 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml +6
-0+ local-address: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 127 + default: 1 + description: CPU board addressAddress of what? In which notation? It's part of this hardware.
Photonicat's MCU protocol documentation says it supports multiple hosts. But Photonicat only uses one.
Is it necessary to remove local-address and use a fixed address?
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 38
Quoted 8 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml +7
-0+ + remote-address: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 127 + default: 1 + description: PMU board addressEee, no. Your board knows its address. You do not have to tell it.
I will remove remote-address.
Quoted 1 line
[...]
Quoted 6 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 53
Quoted 3 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml +3
-0+ +patternProperties: + '^leds-(status)':That's not a pattern.
I originally wanted to keep it for extensions, but it didn't seem like a good idea. I will move it to properties.
Quoted 28 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 57
Quoted 4 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml +4
-0+ $ref: /schemas/leds/ariaboard,photonicat-pmu-leds.yaml + + '^supply-(battery|charger)$': + $ref: /schemas/power/supply/ariaboard,photonicat-pmu-supply.yamlWhy two nodes?
Quoted 8 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml +8
-0+ +required: + - compatible + +additionalProperties: false + +examples: + - |Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 75
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml +10
-0+ serial { + photonicat-pmu { + compatible = "ariaboard,photonicat-pmu"; + current-speed = <115200>; + local-address = <1>; + remote-address = <1>; + + supply-battery { + compatible = "ariaboard,photonicat-pmu-supply"; + label = "battery";Nope, drop label.
Quoted 3 lines
Quoted 1 line
+ type = "battery";
No, there is no type property.
There are two supplies here, one is the charger and the other is the battery. Is it necessary to change to use different compatible ones like ariaboard,photonicat-pmu-battery and ariaboard,photonicat-pmu-charger?
Quoted 3 lines
Missing monitored battery.
I will add it.
Quoted 2 lines
Quoted 2 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml +2
-0+ }; +
[...]
Quoted 8 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 105
Quoted 4 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml +4
-0+ + watchdog { + compatible = "ariaboard,photonicat-pmu-watchdog"; + };These are seriously redundant and useless nodes. There is nothing beneficial from the nodes above - they are all empty, without resources. Drop all of them.
How should I describe these devices? Using mfd_cell?
Quoted 6 lines
I finish the review here.
Best regards,
Krzysztof
Thanks for your review, I will fix all problems in next version!
Best regards,
Junhao
Re: [PATCH 8/9] dt-bindings: Add documentation for Photonicat PMU
Quoted 9 lines · Junhao Xie
Quoted 1 line
Quoted 1 line
+
[...]
Quoted 7 lines
Quoted 6 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +6
-0+ local-address: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 127 + default: 1 + description: CPU board address
Quoted 6 lines
Quoted 2 lines
Address of what? In which notation? It's part of this hardware.
Photonicat's MCU protocol documentation says it supports multiple hosts. But Photonicat only uses one.
Is it necessary to remove local-address and use a fixed address?
I don't understand what this "address" is for.
Quoted 54 lines
Quoted 11 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 38
Quoted 9 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +7
-0+ + remote-address: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 127 + default: 1 + description: PMU board addressEee, no. Your board knows its address. You do not have to tell it.
I will remove remote-address.
Quoted 1 line
[...]
Quoted 6 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 53
Quoted 3 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +3
-0+ +patternProperties: + '^leds-(status)':That's not a pattern.
I originally wanted to keep it for extensions, but it didn't seem like a good idea. I will move it to properties.
Quoted 28 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 57
Quoted 4 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +4
-0+ $ref: /schemas/leds/ariaboard,photonicat-pmu-leds.yaml + + '^supply-(battery|charger)$': + $ref: /schemas/power/supply/ariaboard,photonicat-pmu-supply.yamlWhy two nodes?
Quoted 8 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +8
-0+ +required: + - compatible + +additionalProperties: false + +examples: + - |Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml line 75
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +10
-0+ serial { + photonicat-pmu { + compatible = "ariaboard,photonicat-pmu"; + current-speed = <115200>; + local-address = <1>; + remote-address = <1>; + + supply-battery { + compatible = "ariaboard,photonicat-pmu-supply"; + label = "battery";Nope, drop label.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
+ type = "battery";
No, there is no type property.
There are two supplies here, one is the charger and the other is the battery. Is it necessary to change to use different compatible ones like ariaboard,photonicat-pmu-battery and ariaboard,photonicat-pmu-charger?
Are the devices different? Why do you even need the type?
Quoted 15 lines
Quoted 4 lines
Missing monitored battery.
I will add it.
Quoted 2 lines
Quoted 2 lines
(quoted diff) +2
-0+ }; +[...]
Quoted 5 lines
Quoted 4 lines
Documentation/devicetree/bindings/mfd/ariaboard,photonicat-pmu.yaml new file +4
-0+ + watchdog { + compatible = "ariaboard,photonicat-pmu-watchdog"; + };
Quoted 5 lines
Quoted 3 lines
These are seriously redundant and useless nodes. There is nothing beneficial from the nodes above - they are all empty, without resources. Drop all of them.
How should I describe these devices? Using
mfd_cell?
You mean drivers? MFD or auxiliary bus.
Best regards,
Krzysztof
PATCH 9/9 arm64: dts: rockchip: add Photonicat PMU support for Ariaboard Photonicat
In reply to Junhao XieThis commit adds support for Photonicat power management MCU on Ariaboard Photonicat.
--- .../boot/dts/rockchip/rk3568-photonicat.dts | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+)
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +43 -0
@@ -513,6 +513,49 @@ &uart4 { dma-names = "tx", "rx"; status = "okay"; /* Onboard power management MCU */ + + pcat_pmu: mcu { + compatible = "ariaboard,photonicat-pmu"; + current-speed = <115200>; + local-address = <1>; + remote-address = <1>; + + pcat_pmu_battery: supply-battery { + compatible = "ariaboard,photonicat-pmu-supply"; + label = "battery"; + monitored-battery = <&battery>; + power-supplies = <&pcat_pmu_charger>; + type = "battery"; + }; + + pcat_pmu_charger: supply-charger { + compatible = "ariaboard,photonicat-pmu-supply"; + label = "charger"; + type = "charger"; + }; + + pcat_pmu_hwmon: hwmon { + compatible = "ariaboard,photonicat-pmu-hwmon"; + label = "pcat_board"; + }; + + pcat_pmu_leds_status: leds-status { + compatible = "ariaboard,photonicat-pmu-leds"; + label = "net-status"; + }; + + pcat_pmu_poweroff: poweroff { + compatible = "ariaboard,photonicat-pmu-poweroff"; + }; + + pcat_pmu_rtc: rtc { + compatible = "ariaboard,photonicat-pmu-rtc"; + }; + + pcat_pmu_watchdog: watchdog { + compatible = "ariaboard,photonicat-pmu-watchdog"; + }; + }; }; &usb_host0_xhci {
Signature · 1 line
2.46.0
Re: [PATCH 9/9] arm64: dts: rockchip: add Photonicat PMU support for Ariaboard Photonicat
Quoted 14 lines · Junhao Xie
This commit adds support for Photonicat power management MCU on Ariaboard Photonicat.
Signed-off-by Junhao Xie <[email protected]>--- .../boot/dts/rockchip/rk3568-photonicat.dts | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+)arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +0
-0@@ -513,6 +513,49 @@ &uart4 { dma-names = "tx", "rx";
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts &uart4 { · line 523
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +8
-0status = "okay"; /* Onboard power management MCU */ + + pcat_pmu: mcu { + compatible = "ariaboard,photonicat-pmu"; + current-speed = <115200>; + local-address = <1>; + remote-address = <1>; + + pcat_pmu_battery: supply-battery {
Drop unused labels. Everywhere. You are not making the code more readable.
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts &uart4 { · line 527
Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +4
-0+ compatible = "ariaboard,photonicat-pmu-supply"; + label = "battery"; + monitored-battery = <&battery>; + power-supplies = <&pcat_pmu_charger>;
Why do you reference internal design of the device as DTS? You cannot have here other power supply, can you?
Best regards,
Krzysztof
Re: [PATCH 9/9] arm64: dts: rockchip: add Photonicat PMU support for Ariaboard Photonicat
Quoted 4 lines · Krzysztof Kozlowski
Quoted 3 lines · Junhao Xie
This commit adds support for Photonicat power management MCU on Ariaboard Photonicat.
[...]
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + pcat_pmu_battery: supply-battery {Drop unused labels. Everywhere. You are not making the code more readable.
I will remove them.
Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts &uart4 { · line 527
Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +4
-0+ compatible = "ariaboard,photonicat-pmu-supply"; + label = "battery"; + monitored-battery = <&battery>; + power-supplies = <&pcat_pmu_charger>;Why do you reference internal design of the device as DTS? You cannot have here other power supply, can you?
I mistakenly thought power_supply_am_i_supplied() required power-supplies property, it actually does not, I will remove it.
Quoted 4 lines
Best regards,
Krzysztof
Thanks for your review, I will fix all problems in next version!
Best regards,
Junhao
Quoted 2 lines · Junhao Xie
Initial support for the power management MCU in the Ariaboard Photonicat This patch series depends on Add support for Ariaboard Photonicat RK3568 [1]
How it depends? This prevents merging. You must decouple the patchsets.
Best regards,
Krzysztof
Quoted 11 lines · Krzysztof Kozlowski
Quoted 2 lines · Junhao Xie
Initial support for the power management MCU in the Ariaboard Photonicat This patch series depends on Add support for Ariaboard Photonicat RK3568 [1]
How it depends? This prevents merging. You must decouple the patchsets.
Best regards,
Krzysztof
Thanks for your correction, I will decouple the patchsets.
Dependencies:
* "dt-bindings: Add documentation for Photonicat PMU" [1] depends on "dt-bindings: vendor-prefixes: Add prefix for Ariaboard" [2], which requires this vendor prefix.
* "arm64: dts: rockchip: add Photonicat PMU support for Ariaboard Photonicat" [3] add nodes based on "arm64: dts: rockchip: add dts for Ariaboard Photonicat RK3568" [4]
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/
[4] https://lore.kernel.org/all/[email protected]/
Best regards,
Junhao
Hi Junhao,
Quoted 2 lines
Initial support for the power management MCU in the Ariaboard Photonicat This patch series depends on Add support for Ariaboard Photonicat RK3568 [1]
The official website says it's "Renesas RA2E1 cortex M23 ultra-low power MCU" Perhaps renaming the 'Photonicat MCU' to 'Renesas RA2E1 MCU' would be better?
Signature · 7 lines
2.25.1 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
Quoted 5 lines · Chukun Pan
Quoted 2 lines
Initial support for the power management MCU in the Ariaboard Photonicat This patch series depends on Add support for Ariaboard Photonicat RK3568 [1]
The official website says it's "Renesas RA2E1 cortex M23 ultra-low power MCU" Perhaps renaming the 'Photonicat MCU' to 'Renesas RA2E1 MCU' would be better?
Renesas RA2E1 is a MCU product line, and Ariaboard wrote firmware for this MCU. Maybe "Renesas RA2E1 MCU in Photonicat" would be better?
Best regards,
Junhao