Skip to contentSkip to conversation

misc: add support for the cc1101 RF transceiver chip from TI

PATCH In review Heiko Schocher 3 participants 7 messages Sep 22, 2019 – Oct 16, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover misc: add support for the cc1101 RF transceiver chip from TI

This driver provides support for the Low-Power Sub-1 GHz RF Transceiver chip from Texas Instruments. It provides a simple message based protocol to set chip registers, send and receive packets to/from the chip.

Heiko Schocher (2):
misc: add cc1101 devicetree binding
misc: add support for the cc1101 RF transceiver chip from TI

 .../devicetree/bindings/misc/cc1101.txt       |   27 +
 Documentation/misc-devices/cc1101.txt         |  446 ++++
 drivers/misc/Kconfig                          |   11 +
 drivers/misc/Makefile                         |    1 +
 drivers/misc/cc1101.c                         | 2004 +++++++++++++++++
 drivers/misc/cc1101.h                         |   89 +
 include/uapi/linux/cc1101_user.h              |  255 +++
 7 files changed, 2833 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/cc1101.txt
 create mode 100644 Documentation/misc-devices/cc1101.txt
 create mode 100644 drivers/misc/cc1101.c
 create mode 100644 drivers/misc/cc1101.h
 create mode 100644 include/uapi/linux/cc1101_user.h
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/2 misc: add cc1101 devicetree binding

add devicetree binding for cc1101 misc driver.

---

 .../devicetree/bindings/misc/cc1101.txt       | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/cc1101.txt
Documentation/devicetree/bindings/misc/cc1101.txt new file +27 -0
new file mode 100644
index 0000000000000..afea6acf4a9c5
@@ -0,0 +1,27 @@
+driver cc1101 Low-Power Sub-1 GHz RF Transceiver chip from Texas
+Instruments.
+
+Requires node properties:
+- compatible : should be "ti,cc1101";
+- reg        : Chip select address of device, see:
+               Documentation/devicetree/bindings/spi/spi-bus.txt
+- gpios      : list of 2 gpios, first gpio is for GDO0 pin
+               second for GDO2 pin, see more:
+               Documentation/devicetree/bindings/gpio/gpio.txt
+
+Recommended properties:
+ - spi-max-frequency: Definition as per
+                Documentation/devicetree/bindings/spi/spi-bus.txt
+ - freq       : used spi frequency for communication with cc1101 chip
+
+example:
+
+&ecspi4 {
+        cc1101@0 {
+                compatible = "ti,cc1101";
+                spi-max-frequency = <10000000>;
+                reg = <0>;
+                freq = <5000000>;
+                gpios = <&gpio2 11 GPIO_ACTIVE_HIGH &gpio5 8 GPIO_ACTIVE_HIGH>;
+        };
+};
Signature · 1 line
2.21.0
maintainer
#2 lore raw

Re: [PATCH 1/2] misc: add cc1101 devicetree binding

Quoted 8 lines · Heiko Schocher

add devicetree binding for cc1101 misc driver.

---

 .../devicetree/bindings/misc/cc1101.txt       | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/cc1101.txt

Can you please convert this to DT schema.

Documentation/devicetree/bindings/misc/cc1101.txt

Quoted 6 lines
Documentation/devicetree/bindings/misc/cc1101.txt new file +0 -0
new file mode 100644
index 0000000000000..afea6acf4a9c5

Normal naming is to use compatible string. So ti,cc1101.yaml for schema.

Documentation/devicetree/bindings/misc/cc1101.txt line 9

Quoted 10 lines
Documentation/devicetree/bindings/misc/cc1101.txt new file +9 -0
@@ -0,0 +1,27 @@
+driver cc1101 Low-Power Sub-1 GHz RF Transceiver chip from Texas
+Instruments.
+
+Requires node properties:
+- compatible : should be "ti,cc1101";
+- reg        : Chip select address of device, see:
+               Documentation/devicetree/bindings/spi/spi-bus.txt
+- gpios      : list of 2 gpios, first gpio is for GDO0 pin
+               second for GDO2 pin, see more:

Is there a GDO1? Would be hard to add later because you can't change the indices once defined.

Documentation/devicetree/bindings/misc/cc1101.txt line 14

Quoted 5 lines
Documentation/devicetree/bindings/misc/cc1101.txt new file +5 -0
+               Documentation/devicetree/bindings/gpio/gpio.txt
+
+Recommended properties:
+ - spi-max-frequency: Definition as per
+                Documentation/devicetree/bindings/spi/spi-bus.txt

Notice that this file is now just in redirection...

Documentation/devicetree/bindings/misc/cc1101.txt line 15

Quoted 1 line
Documentation/devicetree/bindings/misc/cc1101.txt new file +1 -0
+ - freq       : used spi frequency for communication with cc1101 chip

What's this? Doesn't spi-max-frequency cover it?

Quoted 15 lines
Documentation/devicetree/bindings/misc/cc1101.txt new file +12 -0
+
+example:
+
+&ecspi4 {
+        cc1101@0 {
+                compatible = "ti,cc1101";
+                spi-max-frequency = <10000000>;
+                reg = <0>;
+                freq = <5000000>;
+                gpios = <&gpio2 11 GPIO_ACTIVE_HIGH &gpio5 8 GPIO_ACTIVE_HIGH>;
+        };
+};
Signature · 1 line
2.21.0
#3 lore raw

Re: [PATCH 1/2] misc: add cc1101 devicetree binding

Hello Rob,

Am 02.10.2019 um 16:19 schrieb Rob Herring:

Quoted 11 lines · Heiko Schocher
Quoted 8 lines

add devicetree binding for cc1101 misc driver.

---

  .../devicetree/bindings/misc/cc1101.txt       | 27 +++++++++++++++++++
  1 file changed, 27 insertions(+)

create mode 100644 Documentation/devicetree/bindings/misc/cc1101.txt

Can you please convert this to DT schema.

Of course, missed this point, sorry, reworked. Is there a HowTo for writting a schema?
(beside Documentation/devicetree/bindings/example-schema.yaml)

Quoted 7 lines

Documentation/devicetree/bindings/misc/cc1101.txt

Quoted 5 lines
Documentation/devicetree/bindings/misc/cc1101.txt new file +0 -0
new file mode 100644
index 0000000000000..afea6acf4a9c5

Normal naming is to use compatible string. So ti,cc1101.yaml for schema.

renamed.

Quoted 14 lines

Documentation/devicetree/bindings/misc/cc1101.txt line 9

Quoted 11 lines
Documentation/devicetree/bindings/misc/cc1101.txt new file +9 -0
@@ -0,0 +1,27 @@
+driver cc1101 Low-Power Sub-1 GHz RF Transceiver chip from Texas
+Instruments.
+
+Requires node properties:
+- compatible : should be "ti,cc1101";
+- reg        : Chip select address of device, see:
+               Documentation/devicetree/bindings/spi/spi-bus.txt
+- gpios      : list of 2 gpios, first gpio is for GDO0 pin
+               second for GDO2 pin, see more:

Is there a GDO1? Would be hard to add later because you can't change the indices once defined.

Good point. There is a GDO1, so yes, this makes sense, added.

Quoted 8 lines

Documentation/devicetree/bindings/misc/cc1101.txt line 14

Quoted 6 lines
Documentation/devicetree/bindings/misc/cc1101.txt new file +5 -0
+               Documentation/devicetree/bindings/gpio/gpio.txt
+
+Recommended properties:
+ - spi-max-frequency: Definition as per
+                Documentation/devicetree/bindings/spi/spi-bus.txt

Notice that this file is now just in redirection...

Ok.

Quoted 4 lines

Documentation/devicetree/bindings/misc/cc1101.txt line 15

Quoted 2 lines
Documentation/devicetree/bindings/misc/cc1101.txt new file +1 -0
+ - freq       : used spi frequency for communication with cc1101 chip

What's this? Doesn't spi-max-frequency cover it?

Of course, removed.

Thanks for your time and review.

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#4 lore raw

PATCH 2/2 misc: add support for the cc1101 RF transceiver chip from TI

In reply to Heiko Schocher

This driver provides support for the Low-Power Sub-1 GHz RF Transceiver chip from Texas Instruments. It provides a simple message based protocol to set chip registers, send and receive packets to/from the chip. For more details see Documentation/misc-devices/cc1101.txt and Documentation/devicetree/bindings/misc/cc1101.txt

---

 Documentation/misc-devices/cc1101.txt |  446 ++++++
 drivers/misc/Kconfig                  |   11 +
 drivers/misc/Makefile                 |    1 +
 drivers/misc/cc1101.c                 | 2004 +++++++++++++++++++++++++
 drivers/misc/cc1101.h                 |   89 ++
 include/uapi/linux/cc1101_user.h      |  255 ++++
 6 files changed, 2806 insertions(+)
 create mode 100644 Documentation/misc-devices/cc1101.txt
 create mode 100644 drivers/misc/cc1101.c
 create mode 100644 drivers/misc/cc1101.h
 create mode 100644 include/uapi/linux/cc1101_user.h
Documentation/misc-devices/cc1101.txt new file +446 -0
new file mode 100644
index 0000000000000..61d11baa70dad
@@ -0,0 +1,446 @@
+=============
+cc1101 driver
+=============
+
+abstract
+========
+
+This driver add support for the cc1101 Low-Power Sub-1 GHz RF Transceiver
+chip from Texas Instruments [1].
+
+The driver do not know anything about the data which is received
+or transmitted, beside the first byte is always a length byte, as
+this driver supports only variable packet length mode, see [1]
+chapter "0x08: PKTCTRL0 – Packet Automation Control"
+
+driver supports:
+
+- define different cc1101 register configurations. Each configuration
+  is referenced through a name.
+
+- define delay tables which are used for CSMA delay timeouts. Each
+  delay table is referenced through a name.
+
+- receive data from the cc1101 chip.
+
+- send data to the cc1101 chip
+
+  - optionally check if channel is free (CSMA). It is configurable
+    which delay table is used for the current packet, and how many
+    times the driver tries to get a free band.
+
+  - optionally send a preamble before the data, length of the preamble
+    is configurable through module parameter preamble_timeout in msec.
+
+- communication with userspace is message based
+
+- userspace can define a job, which contains more than one message
+  the driver executes each message.
+
+- driver can generate events (if enabled in register configuration)
+  which means the driver calculates all 100 ms the current rssi value
+  and send it to userspace.
+
+module parameter
+================
+
+preamble_timeout: timeout for sending preamble in msec
+                  default: 360
+
+DTS
+===
+
+see:
+Documentation/devicetree/bindings/misc/cc1101.txt
+
+cc1101 register settings
+========================
+
+For correct working the driver needs some register settings,
+you cannot change. Without them it makes no sense to use the
+driver (for example, the GDOx pins are used as IRQ pins, and
+if they are not setup in IRQ mode you get unexpected behaviour.
+For example on GDO0 outputs a 24MHz clock ... which will stall
+your cpu when the driver enables the GDO0 pin as irq).
+
+Following the register settings the driver checks:
+
+GDO0 setting
+............
+
+IOCFG0 (0x2) mode 0x6
+Asserts when sync word has been sent / received, and de-asserts
+at the end of the packet. In RX, the pin will also deassert when
+a packet is discarded due to address or maximum length filtering
+or when the radio enters RXFIFO_OVERFLOW state. In TX the pin
+will de-assert if the TX FIFO underflows.
+
+GDO2 setting
+............
+
+IOCFG2 (0x0) mode 0xe
+Carrier sense. High if RSSI level is above threshold.
+Cleared when entering IDLE mode.
+
+set automatic rx mode
+.....................
+
+MCSM1 (0x17): RXOFF_MODE und TXOFF_MODE must be 0xf
+so the cc1101 chip go into rx mode after tx or rx finished.
+
+If this bits are not set, driver tries to set rx mode after
+successful rx or tx. But this is slow and may leads in missing
+rx packets.
+
+variable packet length mode
+...........................
+
+This driver supports variable packet length mode only,
+see [1] chapter "0x08: PKTCTRL0 – Packet Automation Control"
+
+packet format
+.............
+
+only "normal" mode (use FIFOs for RX and TX) is supported.
+
+append status
+.............
+
+This setting is optional.
+
+PKTCTRL1 (0x07) APPEND_STATUS
+-> cc1101 appends 2 bytes to each received packet
+
+
+userspace interface
+===================
+
+The driver interface is message based, which means the Userspace
+has to setup messages and send them to the driver. Also, the driver
+use messages to communicate with the Userspace process.
+
+It could be needed to send more than one message to the driver
+at once, so messages can be grouped into one job, give the job an ID
+and send it to the driver, see "send a job". The driver than go through
+the single messages in the job and executes them. For example it is
+possible to set a register configuration A, send some data, switch than
+to register configuration B and send there again some data, switch than
+back to register setting A and switch to rx mode. If the driver has
+finsihed the job, or an error occured, the driver sends back
+a message to the userspace, see "infos for a finished job".
+
+common message format
+---------------------
+
+all messages in read and write direction start with:
+
++----------+...
+| int type |
++----------+...
+
+The content of type differs between read and write direction.
+
+write to driver
+---------------
+
+The following message types are possible:
+
+- CC1101_MSG_RCV
+- CC1101_MSG_DEFINE_CONFIG
+- CC1101_MSG_DEL_CONFIG
+- CC1101_MSG_JOB
+- CC1101_MSG_DEFINE_DELAY
+- CC1101_MSG_SET_PATABLE
+- CC1101_MSG_GET_CARRIER_SENSE
+
+set receive mode
+................
+
+Use this type for setting up the cc1101 registers with
+a register configuration, defined with CC1101_MSG_DEFINE_CONFIG
+and put the cc1101 chip into rx mode.
+
+setup the struct msg_queue_user_rcv
+
++----------------+-------------------------------+
+| CC1101_MSG_RCV | config_name[CFG_NAME_MAX_LEN] |
++----------------+-------------------------------+
+
+config_name: 0 terminated string, contains the name of a register setting.
+
+define a register configuration
+...............................
+
+type: CC1101_MSG_DEFINE_CONFIG
+
+define a register setting for the cc1101 and give it a name.
+This register setting can than be used for setting a specific
+register setting. Before a register setting is applied to the
+cc1101 chip, the driver resets the cc1101 chip, so all registers
+have default values, which means, you only have to define registers
+which have different values from the default value.
+
+If you use SmartRFstudio [2] you can export a register table,
+in c friendly format which exactly contains only the differences,
+and you can use it in your userspace program.
+
+setup the struct msg_queue_user_config_data
+
++--------------------------+-------------------------------+------------+-----------+----------+      +---+---+
+| CC1101_MSG_DEFINE_CONFIG | config_name[CFG_NAME_MAX_LEN] | char flags | char addr | char val | .... | 0 | 0 |
++--------------------------+-------------------------------+------------+-----------+----------+      +---+---+
+
+flags : CC1101_FLAG_CFG_*
+config_name: 0 terminated string, contains the name of a register setting.
+followed by a list of "addr | value" elements, terminated with "0 0"
+
+Userspace example:
+
+::
+
+  static const struct config_param demo_rx[] =
+  {
+  {CCxxx0_IOCFG0, 0x06},
+  {CCxxx0_FIFOTHR, 0x47},
+  {CCxxx0_PKTCTRL0, 0x05},
+  {CCxxx0_FSCTRL1, 0x06},
+  {CCxxx0_FREQ2, 0x21},
+  {CCxxx0_FREQ1, 0x62},
+  {CCxxx0_FREQ0, 0x76},
+  {CCxxx0_MDMCFG4, 0xC8},
+  {CCxxx0_MDMCFG3, 0x93},
+  {CCxxx0_MDMCFG2, 0x13},
+  {CCxxx0_DEVIATN, 0x34},
+  {CCxxx0_MCSM0, 0x18},
+  {CCxxx0_FOCCFG, 0x16},
+  {CCxxx0_AGCCTRL2, 0x43},
+  {CCxxx0_WORCTRL, 0xFB},
+  {CCxxx0_FSCAL3, 0xE9},
+  {CCxxx0_FSCAL2, 0x2A},
+  {CCxxx0_FSCAL1, 0x00},
+  {CCxxx0_FSCAL0, 0x1F},
+  {CCxxx0_TEST2, 0x81},
+  {CCxxx0_TEST1, 0x35},
+  {CCxxx0_TEST0, 0x09},
+  {CFG_END, CFG_END},
+  };
+
+  #define CONFIG_MAX_EL	30
+  struct config_demo {
+	int		type;
+	char		config_name[CFG_NAME_MAX_LEN];
+	struct		config_param cfg[CONFIG_MAX_EL];
+  };
+
+  struct config_demo cfg1;
+
+  memset(&cfg1, 0x0, sizeof(cfg1));
+  cfg1.type = CC1101_MSG_DEFINE_CONFIG;
+  memcpy(cfg1.cfg, demo_rx, sizeof(demo_rx));
+  sprintf(cfg1.config_name, "%s", "demo");
+  ret = write(fd, &cfg1, sizeof(cfg1));
+
+delete a register configuration
+...............................
+
+not implemented yet.
+
+type = CC1101_MSG_DEL_CONFIG
+
+define a delay timing configuration
+...................................
+
+With this message userspace can define a table of count min and max
+timeout values and give this table a name. Later when sending a
+packet with csma checking activated, this table can be selected from
+the CC1101_MSG_USER_TYPE_SEND and the timeouts from this table are
+used.
+
+type: CC1101_MSG_DEFINE_DELAY
+
+setup the struct msg_queue_user_delay_data
+
++-------------------------+------------------------------+-----------+---------------+---------------+      +---+
+| CC1101_MSG_DEFINE_DELAY | delay_name[CFG_NAME_MAX_LEN] | int count | int delay_min | int delay_max | .... |   |
++-------------------------+------------------------------+-----------+---------------+---------------+      +---+
+
+config_name: 0 terminated string, contains the name of a delay table.
+count: maximal delays
+delay: list of count delays (min/max pairs) in ms
+
+example:
+
+::
+
+  static const struct delay_param delay_table_first[] =
+  {
+     {1, 4},
+     {5, 9},
+     {16, 32},
+  };
+
+  struct delay_table {
+        struct  msg_queue_user msg_user;
+        struct  msg_delay_data_user delay_data_user;
+        struct  delay_param delays[MAX_DELAYS];
+  };
+
+  struct delay_table dt;
+  memset(&dt, 0x0, sizeof(dt));
+  dt.msg_user.type = CC1101_MSG_DEFINE_DELAY;
+  dt.delay_data_user.count = sizeof(delay_table_first) / sizeof(struct delay_param);
+  sprintf(dt.delay_data_user.delay_name, "%s", "delay_first");
+  memcpy(&dt.delays, &delay_table_first, sizeof(delay_table_first));
+  ret = write(fd, &dt, sizeof(dt));
+
+Now you can select this delay table under the name "delay_first" in the
+driver.
+
+set patable
+...........
+
+Use this type for setting up the cc1101 registers 0x3e
+(PATABLE)
+
+setup the struct msg_queue_user_rcv
+
++------------------------+------------+
+| CC1101_MSG_SET_PATABLE | char value |
++------------------------+------------+
+
+value : contains the patable value
+
+send a job
+..........
+
+use this message format:
+
++----------------+------------+         ...         +
+| CC1101_MSG_JOB | int job id | n * struct msg_user |
++----------------+------------+         ...         +
+
+job id:
+  int, give the job a unique id. The driver sends a CC1101_READ_TYPE_ID
+  message with this ID back to the userspace, when the job is finished.
+
+struct msg_user:
+
++----------+--------------+----------+--------------------------+
+| int type | int preamble | int csma | buf[CC1101_MAX_DATA_LEN] |
++----------+--------------+----------+--------------------------+
+
+with
+
+type    : CC1101_MSG_USER_TYPE_
+preamble: 0 = short other long preamble
+csma    : -1 no csma,
+           0 send only
+          >0 try n times to get free channel
+buf     : dependend on type contains different content
+
+
+possible message types:
+
+CC1101_MSG_USER_TYPE_SEND
+
+send data in buf, with preamble and csma settings
+buf[0] is the length of the data
+
+CC1101_MSG_USER_TYPE_SET_CFG
+
+set a register configuration with name in buf
+buf contains a 0 terminated string.
+preamble and csma not used, should be 0
+
+CC1101_MSG_USER_TYPE_SET_DELAY
+
+set a delay table with name in buf. This table is used
+when a CC1101_MSG_USER_TYPE_SEND message with csma > 0
+value runs later.
+
+CC1101_MSG_USER_TYPE_SET_PATABLE
+
+patable value in buf[0]
+
+get carrier sense event
+.......................
+
+message format:
+
++------------------------------+
+| CC1101_MSG_GET_CARRIER_SENSE |
++------------------------------+
+
+You get back an event message:
+
+type    : CC1101_READ_TYPE_EVENT
+eventid : CC1101_READ_EVENT_ID_CARRIER
+value   : value
+reason  : CC1101_READ_EVENT_REASON_CALCULATED
+
+see events.
+
+Only enabled, if eventgeneration (CC1101_FLAG_CFG_TRIGGER) is set
+in configuration flags of the current register configuration.
+
+read from driver
+----------------
+
+all messages in read direction start with:
+
++----------+...
+| int type |
++----------+...
+
+types:
+
+rx data
+.......
+
++----------+--------+-----------+----------+-------------------------------+
+| int type | int id | char rssi | char len | char buf[CC1101_MAX_DATA_LEN] |
++----------+--------+-----------+----------+-------------------------------+
+
+  type:  CC1101_READ_TYPE_RX
+  id   : not used should be 0
+  rssi : contain rssi value
+  len  : len of received bytes
+  buf  : received data + 2 additional data bytes RSSI and LQI
+
+infos for a finished job
+........................
+
++----------+--------+---------------+-----------------------------------+
+| int type | int id | int errorcode | char data[CC1101_MAX_DATA_LEN -2] |
++----------+--------+---------------+-----------------------------------+
+
+  type      : C1101_READ_TYPE_ID
+  id        : job id
+  errorcode : CC1101_ECA_*
+
+Error                       Errorcode  data
+all fine                    0          none
+channel busy                -1         string: config name
+SPI communication error     -2         none
+unknown config name         -3         string: name of unknown config
+error setting config        -4         string: name of config
+unknown delay name          -5         string: name of unknown table
+error setting patable       -6         none
+
+events
+......
+
++----------+-------------+-----------+-----------+--------------------------------+
+| int type | int eventid | u8 value  | u8 reason | char data[CC1101_MAX_DATA_LEN] |
++----------+-------------+-----------+-----------+--------------------------------+
+
+type    : CC1101_READ_TYPE_EVENT
+eventid : CC1101_READ_EVENT_ID_*
+value   : value
+reason  : CC1101_READ_EVENT_REASON_*
+
+links
+=====
+
+[1] datasheet: http://www.ti.com/lit/ds/symlink/cc1101.pdf
+[2] smartRFstudio: http://www.ti.com/tool/SMARTRFTM-STUDIO
drivers/misc/Kconfig +11 -0
index c55b63750757d..fe2c9b8b72a63 100644
@@ -466,6 +466,17 @@ config PVPANIC
 	  a paravirtualized device provided by QEMU; it lets a virtual machine
 	  (guest) communicate panic events to the host.
 
+config CC1101
+	tristate "cc1101 device support"
+	depends on SPI
+	help
+	  This driver provides support for the Low-Power Sub-1 GHz RF
+	  Transceiver chip from Texas Instruments. It provides a
+	  simple message based protocol to set chip registers, send
+	  and receive packets to/from the chip. For more details
+	  see Documentation/misc-devices/cc1101.txt and
+	  Documentation/devicetree/bindings/misc/cc1101.txt
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
index c1860d35dc7e2..ec51e73359c48 100644
@@ -57,3 +57,4 @@ obj-y				+= cardreader/
 obj-$(CONFIG_PVPANIC)   	+= pvpanic.o
 obj-$(CONFIG_HABANA_AI)		+= habanalabs/
 obj-$(CONFIG_XILINX_SDFEC)	+= xilinx_sdfec.o
+obj-$(CONFIG_CC1101)		+= cc1101.o
drivers/misc/cc1101.c new file +2004 -0

2,004 lines not on this page · raw message

drivers/misc/cc1101.h new file +89 -0

89 lines not on this page · raw message

include/uapi/linux/cc1101_user.h new file +255 -0

255 lines not on this page · raw message

Signature · 1 line
2.21.0
#5 lore raw

include/uapi/linux/cc1101_user.h line 132

Quoted 9 lines · Heiko Schocher
include/uapi/linux/cc1101_user.h new file +9 -0
+struct __attribute__ ((packed)) msg_queue_user {
+	int	type; /* CC1101_MSG_SET_ */
+};
+
+/* CC1101_MSG_DEFINE_CONFIG */
+struct __attribute__ ((packed)) config_param {
+	char addr;
+	char val;
+};

{sigh}

None of these structures are valid ones to be passing to/from userspace/kernel at all. Please fix them up to work properly (i.e. use the correct types and such). I think there's a "how to write a correct ioctl" document in the documentation directory somewhere, you might want to search for that.

thanks,

greg k-h

#6 lore raw

Hello Greg,

Am 11.10.2019 um 08:43 schrieb Greg Kroah-Hartman:

Quoted 12 lines · Heiko Schocher

include/uapi/linux/cc1101_user.h line 132

Quoted 9 lines
include/uapi/linux/cc1101_user.h new file +9 -0
+struct __attribute__ ((packed)) msg_queue_user {
+	int	type; /* CC1101_MSG_SET_ */
+};
+
+/* CC1101_MSG_DEFINE_CONFIG */
+struct __attribute__ ((packed)) config_param {
+	char addr;
+	char val;
+};

{sigh}

Sorry for that ...

Quoted 5 lines

None of these structures are valid ones to be passing to/from userspace/kernel at all. Please fix them up to work properly (i.e. use the correct types and such). I think there's a "how to write a correct ioctl" document in the documentation directory somewhere, you might want to search for that.

Ok, the driver does not use ioctl only read/write, but the overall question is, has this driver at all a chance to go into mainline?

I searched for "write a correct" in Documentation but get:

$ grep -lr "write a correct" Documentation/
$

May "Documentation/ioctl/botching-up-ioctls.rst" helps, so I convert to use the __u* types, thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]