Re: Mention Smart Battery Data Spec in smbus.h

2022-03-05 Thread patrick keshishian
On Sat, Mar 05, 2022 at 09:37:32PM +1100, Damien Miller wrote:
> without commenting on the substance of this change, it should definitely
> not be added to the copyright block

Good point.

I thought adding reference to SMBus spec and mention of ACPI
section where SMBus register offsets are sourced would be
beneficial.

How about either of the following to variants.

Version 1:  Indicate reference material at relevant section.
Version 2:  List references material at top in one comment block.

Best,
--patrick


> On Fri, 4 Mar 2022, patrick keshishian wrote:
> 
> > Hello,
> > 
> > I took a wrong turn, and got interested in where the SMBATT_CMD_*
> > defines were sourced.
> > 
> > Adding a reference to Smart Battery Data Spec might save someone
> > else the time searching through ACPI spec, then SMBus spec, to
> > finally arriving at the answer.
> > 
> > Is the following diff acceptable?
> > I believe this is the correct/definitive source.
> > 
> > Thanks,
> > --patrick


=== VERSION 1 =

Index: smbus.h
===
RCS file: /cvs/obsd/src/sys/dev/acpi/smbus.h,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 smbus.h
--- smbus.h 22 Feb 2017 16:39:56 -  1.1
+++ smbus.h 5 Mar 2022 18:37:55 -
@@ -29,6 +29,9 @@
 #ifndef _ACPI_SMBUS_H_
 #define _ACPI_SMBUS_H_
 
+/*
+ * ACPI Section 12.9.2 Protocol Description
+ */
 enum {
 SMBUS_WRITE_QUICK = 2,
 SMBUS_READ_QUICK = 3,
@@ -60,11 +63,18 @@ enum {
 
 /*
  * Smart-Battery commands and definitions
+ *
+ * SMBus Specification Appendix C
+ * http://smbus.org/specs/SMBus_3_2_20220112.pdf
  */
 
 /* Base address */
 #define SMBATT_ADDRESS 0x16
 
+/*
+ * Smart Battery Data Specification Section 5
+ * http://sbs-forum.org/specs/sbdat110.pdf
+ */
 
 /* access: READ WRITE WORD */
 #define SMBATT_CMD_MANUFACTURER_ACCESS 0



=== VERSION 2 =

Index: smbus.h
===
RCS file: /cvs/obsd/src/sys/dev/acpi/smbus.h,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 smbus.h
--- smbus.h 22 Feb 2017 16:39:56 -  1.1
+++ smbus.h 5 Mar 2022 18:45:17 -
@@ -26,6 +26,16 @@
  * $FreeBSD$
  */
 
+/*
+ * ACPI Section 12.9.2 Protocol Description
+ *
+ * SMBus Specification Appendix C
+ * http://smbus.org/specs/SMBus_3_2_20220112.pdf
+ *
+ * Smart Battery Data Specification Section 5
+ * http://sbs-forum.org/specs/sbdat110.pdf
+ */
+
 #ifndef _ACPI_SMBUS_H_
 #define _ACPI_SMBUS_H_
 





Re: Mention Smart Battery Data Spec in smbus.h

2022-03-05 Thread Damien Miller
without commenting on the substance of this change, it should definitely
not be added to the copyright block

On Fri, 4 Mar 2022, patrick keshishian wrote:

> Hello,
> 
> I took a wrong turn, and got interested in where the SMBATT_CMD_*
> defines were sourced.
> 
> Adding a reference to Smart Battery Data Spec might save someone
> else the time searching through ACPI spec, then SMBus spec, to
> finally arriving at the answer.
> 
> Is the following diff acceptable?
> I believe this is the correct/definitive source.
> 
> Thanks,
> --patrick
> 
> 
> Index: smbus.h
> ===
> RCS file: /cvs/obsd/src/sys/dev/acpi/smbus.h,v
> retrieving revision 1.1
> diff -u -p -u -p -r1.1 smbus.h
> --- smbus.h   22 Feb 2017 16:39:56 -  1.1
> +++ smbus.h   5 Mar 2022 07:37:06 -
> @@ -2,6 +2,9 @@
>   * Copyright (c) 2005 Hans Petter Selasky
>   * All rights reserved.
>   *
> + * Smart Battery Data Specification
> + * http://sbs-forum.org/specs/sbdat110.pdf
> + *
>   * Redistribution and use in source and binary forms, with or without
>   * modification, are permitted provided that the following conditions
>   * are met:
> 
> 



Mention Smart Battery Data Spec in smbus.h

2022-03-05 Thread patrick keshishian
Hello,

I took a wrong turn, and got interested in where the SMBATT_CMD_*
defines were sourced.

Adding a reference to Smart Battery Data Spec might save someone
else the time searching through ACPI spec, then SMBus spec, to
finally arriving at the answer.

Is the following diff acceptable?
I believe this is the correct/definitive source.

Thanks,
--patrick


Index: smbus.h
===
RCS file: /cvs/obsd/src/sys/dev/acpi/smbus.h,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 smbus.h
--- smbus.h 22 Feb 2017 16:39:56 -  1.1
+++ smbus.h 5 Mar 2022 07:37:06 -
@@ -2,6 +2,9 @@
  * Copyright (c) 2005 Hans Petter Selasky
  * All rights reserved.
  *
+ * Smart Battery Data Specification
+ * http://sbs-forum.org/specs/sbdat110.pdf
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met: