* Re: [PATCH v2 15/19] ASoC: tlv320aic31xx: Reset registers during power up
From: Mark Brown @ 2017-12-01 15:55 UTC (permalink / raw)
To: Andrew F. Davis
Cc: Liam Girdwood, Rob Herring, Mark Rutland, Benoît Cousson,
Tony Lindgren, alsa-devel, devicetree, linux-kernel
In-Reply-To: <f8b03c59-c7c5-da32-c0fb-de366e931bc9@ti.com>
[-- Attachment #1: Type: text/plain, Size: 446 bytes --]
On Fri, Dec 01, 2017 at 09:04:41AM -0600, Andrew F. Davis wrote:
> On 12/01/2017 07:37 AM, Mark Brown wrote:
> > On Wed, Nov 29, 2017 at 03:32:56PM -0600, Andrew F. Davis wrote:
> >> + } else {
> >> + ret = regmap_write(aic31xx->regmap, AIC31XX_RESET, 1);
> >> + if (ret < 0)
> >> + dev_err(aic31xx->dev, "Could not reset device\n");
> > Print the error to help people doing debug.
> Do you mean by adding the ret code to the print?
Yes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Re: [PATCH v2 14/19] ASoC: tlv320aic31xx: Remove regulator notification handling
From: Mark Brown @ 2017-12-01 15:55 UTC (permalink / raw)
To: Andrew F. Davis
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, linux-kernel, Rob Herring, Benoît Cousson
In-Reply-To: <216ac36e-772a-0919-67cc-86589d3916fc@ti.com>
[-- Attachment #1.1: Type: text/plain, Size: 431 bytes --]
On Fri, Dec 01, 2017 at 09:01:19AM -0600, Andrew F. Davis wrote:
> Looking into the call sites, at least in this case the only time this
> notification will be called, outside the normal enable/disable paths
> (which do the same thing here: turn on regmap cache only mode and mark
> it dirty), will be during a force disable scenario.
If all the disable sites in the driver mark the cache dirty then they
should be fixed not to.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply
* [PATCH v3] usb: xhci: allow imod-interval to be configurable
From: Adam Wallis @ 2017-12-01 15:44 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rob Herring, Mark Rutland, Matthias Brugger,
Mathias Nyman, Chunfeng Yun,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-usb-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: timur-sgV2jX0FEOL9JmXXK+q4OQ
The xHCI driver currently has the IMOD set to 160, which
translates to an IMOD interval of 40,000ns (160 * 250)ns
Commit 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")
introduced a QUIRK for the MTK platform to adjust this interval to 20,
which translates to an IMOD interval of 5,000ns (20 * 250)ns. This is
due to the fact that the MTK controller IMOD interval is 8 times
as much as defined in xHCI spec.
Instead of adding more quirk bits for additional platforms, this patch
introduces the ability for vendors to set the IMOD_INTERVAL as is
optimal for their platform. By using device_property_read_u32() on
"imod-interval", the IMOD INTERVAL can be specified in nano seconds. If
no interval is specified, the default of 40,000ns (IMOD=160) will be
used.
No bounds checking has been implemented due to the fact that a vendor
may have violated the spec and would need to specify a value outside of
the max 8,000 IRQs/second limit specified in the xHCI spec.
Signed-off-by: Adam Wallis <awallis-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
changes from v2:
* Added PCI default value [Mathias]
* Removed xhci-mtk.h from xhci-plat.c [Chunfeng Yun]
* Removed MTK quirk from xhci-plat and moved logic to xhci-mtk [Chunfeng]
* Updated bindings Documentation to use proper units [Rob Herring]
* Added imod-interval description and example to MTK binding documentation
changes from v1:
* Removed device_property_read_u32() per suggestion from greg k-h
* Used ER_IRQ_INTERVAL_MASK in place of (u16) cast
Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt | 2 ++
Documentation/devicetree/bindings/usb/usb-xhci.txt | 1 +
drivers/usb/host/xhci-mtk.c | 9 +++++++++
drivers/usb/host/xhci-pci.c | 3 +++
drivers/usb/host/xhci-plat.c | 4 ++++
drivers/usb/host/xhci.c | 7 ++-----
drivers/usb/host/xhci.h | 2 ++
7 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
index 3059596..45bbf18 100644
--- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
@@ -46,6 +46,7 @@ Optional properties:
- pinctrl-names : a pinctrl state named "default" must be defined
- pinctrl-0 : pin control group
See: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+ - imod-interval: Default interval is 5000ns
Example:
usb30: usb@11270000 {
@@ -66,6 +67,7 @@ usb30: usb@11270000 {
usb3-lpm-capable;
mediatek,syscon-wakeup = <&pericfg>;
mediatek,wakeup-src = <1>;
+ imod-interval = <10000>;
};
2nd: dual-role mode with xHCI driver
diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt b/Documentation/devicetree/bindings/usb/usb-xhci.txt
index ae6e484..89b68f1 100644
--- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
@@ -29,6 +29,7 @@ Optional properties:
- usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM
- usb3-lpm-capable: determines if platform is USB3 LPM capable
- quirk-broken-port-ped: set if the controller has broken port disable mechanism
+ - imod-interval: Default interval is 40000ns
Example:
usb@f0931000 {
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index b62a1d2..278ea3b 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -674,6 +674,15 @@ static int xhci_mtk_probe(struct platform_device *pdev)
xhci = hcd_to_xhci(hcd);
xhci->main_hcd = hcd;
+
+ /*
+ * imod_interval is the interrupt modulation value in nanoseconds.
+ * The increment interval is 8 times as much as that defined in
+ * the xHCI spec on MTK's controller.
+ */
+ xhci->imod_interval = 5000;
+ device_property_read_u32(dev, "imod-interval", &xhci->imod_interval);
+
xhci->shared_hcd = usb_create_shared_hcd(driver, dev,
dev_name(dev), hcd);
if (!xhci->shared_hcd) {
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 7ef1274..efbe57b 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -234,6 +234,9 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
if (!xhci->sbrn)
pci_read_config_byte(pdev, XHCI_SBRN_OFFSET, &xhci->sbrn);
+ /* imod_interval is the interrupt modulation value in nanoseconds. */
+ xhci->imod_interval = 40000;
+
retval = xhci_gen_setup(hcd, xhci_pci_quirks);
if (retval)
return retval;
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 09f164f..b78be87 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -269,6 +269,10 @@ static int xhci_plat_probe(struct platform_device *pdev)
if (device_property_read_bool(&pdev->dev, "quirk-broken-port-ped"))
xhci->quirks |= XHCI_BROKEN_PORT_PED;
+ /* imod_interval is the interrupt modulation value in nanoseconds. */
+ xhci->imod_interval = 40000;
+ device_property_read_u32(sysdev, "imod-interval", &xhci->imod_interval);
+
hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 0);
if (IS_ERR(hcd->usb_phy)) {
ret = PTR_ERR(hcd->usb_phy);
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 2424d30..0b7755b 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -586,11 +586,8 @@ int xhci_run(struct usb_hcd *hcd)
"// Set the interrupt modulation register");
temp = readl(&xhci->ir_set->irq_control);
temp &= ~ER_IRQ_INTERVAL_MASK;
- /*
- * the increment interval is 8 times as much as that defined
- * in xHCI spec on MTK's controller
- */
- temp |= (u32) ((xhci->quirks & XHCI_MTK_HOST) ? 20 : 160);
+ temp |= (xhci->imod_interval / 250) & ER_IRQ_INTERVAL_MASK;
+
writel(temp, &xhci->ir_set->irq_control);
/* Set the HCD state before we enable the irqs */
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 99a014a..2a4177b 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1717,6 +1717,8 @@ struct xhci_hcd {
u8 max_interrupters;
u8 max_ports;
u8 isoc_threshold;
+ /* imod_interval in ns (I * 250ns) */
+ u32 imod_interval;
int event_ring_max;
/* 4KB min, 128MB max */
int page_size;
--
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH v4 2/2] dt-bindings: input: Add documentation for cyttsp5
From: Mylène Josserand @ 2017-12-01 15:39 UTC (permalink / raw)
To: dmitry.torokhov, robh+dt, mark.rutland
Cc: linux-kernel, linux-input, devicetree, mylene.josserand,
thomas.petazzoni, maxime.ripard
In-Reply-To: <20171201153957.13053-1-mylene.josserand@free-electrons.com>
Add the Cypress TrueTouch Generation 5 touchscreen device tree bindings
documentation. It can use I2C or SPI bus.
This touchscreen can handle some defined zone that are designed and
sent as button. To be able to customize the keycode sent, the
"linux,keycodes" property can be used.
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
---
.../bindings/input/touchscreen/cypress,cyttsp5.txt | 39 ++++++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.txt
diff --git a/Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.txt b/Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.txt
new file mode 100644
index 000000000000..1e0e90e322c7
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.txt
@@ -0,0 +1,39 @@
+* Cypress cyttsp touchscreen controller, generation 5
+
+Required properties:
+ - compatible : must be "cypress,cyttsp5"
+ - reg : Device I2C address or SPI chip select number
+ - interrupt-parent : the phandle for the gpio controller
+ (see interrupt binding[0]).
+ - interrupts : (gpio) interrupt to which the chip is connected
+ (see interrupt binding[0]).
+
+Optional properties:
+ - reset-gpios : the reset gpio the chip is connected to
+ (see GPIO binding[1] for more details).
+Some other touchscreen optional properties can be defined such as
+"touchscreen-size-x". See ./touchscreen.txt[2] for more details.
+
+This touchscreen can handle some buttons that are touchscreen's defined zones.
+Each button's event can be customized using a property:
+ - linux,keycodes: List of keycode to emit.
+
+[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+[1]: Documentation/devicetree/bindings/gpio/gpio.txt
+[2]: Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
+
+Example:
+&i2c0 {
+ [...]
+
+ touchscreen@24 {
+ compatible = "cypress,cyttsp5";
+ reg = <0x24>;
+
+ interrupt-parent = <&pio>;
+ interrupts = <1 5 IRQ_TYPE_LEVEL_LOW>;
+ reset-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>;
+ touchscreen-swapped-x-y;
+ linux,keycodes = <KEY_HOMEPAGE>, <KEY_MENU>, <KEY_BACK>;
+ };
+};
--
2.11.0
^ permalink raw reply related
* [PATCH v4 1/2] Input: Add driver for Cypress Generation 5 touchscreen
From: Mylène Josserand @ 2017-12-01 15:39 UTC (permalink / raw)
To: dmitry.torokhov, robh+dt, mark.rutland
Cc: linux-kernel, linux-input, devicetree, mylene.josserand,
thomas.petazzoni, maxime.ripard
In-Reply-To: <20171201153957.13053-1-mylene.josserand@free-electrons.com>
This is the basic driver for the Cypress TrueTouch Gen5 touchscreen
controllers. This driver supports only the I2C bus but it uses regmap
so SPI support could be added later.
The touchscreen can retrieve some defined zone that are handled as
buttons (according to the hardware). That is why it handles
button and multitouch events.
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
---
drivers/input/touchscreen/Kconfig | 16 +
drivers/input/touchscreen/Makefile | 1 +
drivers/input/touchscreen/cyttsp5.c | 1110 +++++++++++++++++++++++++++++++++++
3 files changed, 1127 insertions(+)
create mode 100644 drivers/input/touchscreen/cyttsp5.c
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 0cfdb7cb610e..28eea6d5f1bb 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -238,6 +238,22 @@ config TOUCHSCREEN_CYTTSP4_SPI
To compile this driver as a module, choose M here: the
module will be called cyttsp4_spi.
+config TOUCHSCREEN_CYTTSP5
+ tristate "Cypress TrueTouch Gen5 Touchscreen Driver"
+ depends on OF
+ select REGMAP_I2C
+ select CRC_ITU_T
+ help
+ Driver for Parade TrueTouch Standard Product
+ Generation 5 touchscreen controllers.
+ I2C bus interface support only.
+
+ Say Y here if you have a Cypress Gen5 touchscreen.
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called cyttsp5.
+
config TOUCHSCREEN_DA9034
tristate "Touchscreen support for Dialog Semiconductor DA9034"
depends on PMIC_DA903X
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index d2a2b3b7af27..e7d124901dd9 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_TOUCHSCREEN_CYTTSP_SPI) += cyttsp_spi.o
obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_CORE) += cyttsp4_core.o
obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_I2C) += cyttsp4_i2c.o cyttsp_i2c_common.o
obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_SPI) += cyttsp4_spi.o
+obj-$(CONFIG_TOUCHSCREEN_CYTTSP5) += cyttsp5.o
obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o
obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o
obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o
diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c
new file mode 100644
index 000000000000..a41feea2cd5a
--- /dev/null
+++ b/drivers/input/touchscreen/cyttsp5.c
@@ -0,0 +1,1110 @@
+/*
+ * Parade TrueTouch(TM) Standard Product V5 Module.
+ * For use with Parade touchscreen controllers.
+ *
+ * Copyright (C) 2015 Parade Technologies
+ * Copyright (C) 2012-2015 Cypress Semiconductor
+ * Copyright (C) 2017 Free Electrons
+ *
+ * Author: Mylène Josserand <mylene.josserand@free-electrons.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2, and only version 2, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <asm/unaligned.h>
+#include <linux/crc-itu-t.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/gpio.h>
+#include <linux/input/mt.h>
+#include <linux/input/touchscreen.h>
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+
+#define CYTTSP5_NAME "cyttsp5"
+#define CY_I2C_DATA_SIZE (2 * 256)
+#define HID_VERSION 0x0100
+#define CY_MAX_INPUT 512
+#define CYTTSP5_PREALLOCATED_CMD_BUFFER 32
+#define CY_BITS_PER_BTN 1
+#define CY_NUM_BTN_EVENT_ID ((1 << CY_BITS_PER_BTN) - 1)
+
+#define MAX_AREA 255
+#define HID_OUTPUT_BL_SOP 0x1
+#define HID_OUTPUT_BL_EOP 0x17
+#define HID_OUTPUT_BL_LAUNCH_APP 0x3B
+#define HID_OUTPUT_BL_LAUNCH_APP_SIZE 11
+#define HID_OUTPUT_GET_SYSINFO 0x2
+#define HID_OUTPUT_GET_SYSINFO_SIZE 5
+
+#define HID_DESC_REG 0x1
+#define HID_INPUT_REG 0x3
+#define HID_OUTPUT_REG 0x4
+
+#define REPORT_ID_TOUCH 0x1
+#define REPORT_ID_BTN 0x3
+#define REPORT_SIZE_5 5
+#define REPORT_SIZE_8 8
+#define REPORT_SIZE_16 16
+
+/* Touch reports offsets */
+/* Header offsets */
+#define TOUCH_REPORT_DESC_HDR_CONTACTCOUNT 16
+/* Record offsets */
+#define TOUCH_REPORT_DESC_CONTACTID 8
+#define TOUCH_REPORT_DESC_X 16
+#define TOUCH_REPORT_DESC_Y 32
+#define TOUCH_REPORT_DESC_P 48
+#define TOUCH_REPORT_DESC_MAJ 56
+#define TOUCH_REPORT_DESC_MIN 64
+
+/* HID */
+#define HID_TOUCH_REPORT_ID 0x1
+#define HID_BTN_REPORT_ID 0x3
+#define HID_APP_RESPONSE_REPORT_ID 0x1F
+#define HID_APP_OUTPUT_REPORT_ID 0x2F
+#define HID_BL_RESPONSE_REPORT_ID 0x30
+#define HID_BL_OUTPUT_REPORT_ID 0x40
+
+#define HID_OUTPUT_RESPONSE_REPORT_OFFSET 2
+#define HID_OUTPUT_RESPONSE_CMD_OFFSET 4
+#define HID_OUTPUT_RESPONSE_CMD_MASK 0x7F
+
+#define HID_SYSINFO_SENSING_OFFSET 33
+#define HID_SYSINFO_BTN_OFFSET 48
+#define HID_SYSINFO_BTN_MASK 0xFF
+#define HID_SYSINFO_MAX_BTN 8
+
+/* Timeout in ms */
+#define CY_HID_OUTPUT_TIMEOUT 200
+#define CY_HID_OUTPUT_GET_SYSINFO_TIMEOUT 3000
+#define CY_HID_GET_HID_DESCRIPTOR_TIMEOUT 4000
+
+/* maximum number of concurrent tracks */
+#define TOUCH_REPORT_SIZE 10
+#define TOUCH_INPUT_HEADER_SIZE 7
+#define BTN_REPORT_SIZE 9
+#define BTN_INPUT_HEADER_SIZE 5
+
+/* All usage pages for Touch Report */
+#define TOUCH_REPORT_USAGE_PG_X 0x00010030
+#define TOUCH_REPORT_USAGE_PG_Y 0x00010031
+#define TOUCH_REPORT_USAGE_PG_P 0x000D0030
+#define TOUCH_REPORT_USAGE_PG_CONTACTID 0x000D0051
+#define TOUCH_REPORT_USAGE_PG_CONTACTCOUNT 0x000D0054
+#define TOUCH_REPORT_USAGE_PG_MAJ 0xFF010062
+#define TOUCH_REPORT_USAGE_PG_MIN 0xFF010063
+#define TOUCH_COL_USAGE_PG 0x000D0022
+
+/* helpers */
+#define HI_BYTE(x) (u8)(((x) >> 8) & 0xFF)
+#define LOW_BYTE(x) (u8)((x) & 0xFF)
+
+/* System Information interface definitions */
+struct cyttsp5_sensing_conf_data_dev {
+ u8 electrodes_x;
+ u8 electrodes_y;
+ __le16 len_x;
+ __le16 len_y;
+ __le16 res_x;
+ __le16 res_y;
+ __le16 max_z;
+ u8 origin_x;
+ u8 origin_y;
+ u8 btn;
+ u8 scan_mode;
+ u8 max_num_of_tch_per_refresh_cycle;
+} __packed;
+
+struct cyttsp5_sensing_conf_data {
+ u16 res_x;
+ u16 res_y;
+ u16 max_z;
+ u16 len_x;
+ u16 len_y;
+ u8 origin_x;
+ u8 origin_y;
+ u8 max_tch;
+};
+
+enum { HID_CMD_DONE, HID_CMD_BUSY } hid_cmd_state;
+
+enum cyttsp5_tch_abs { /* for ordering within the extracted touch data array */
+ CY_TCH_X, /* X */
+ CY_TCH_Y, /* Y */
+ CY_TCH_P, /* P (Z) */
+ CY_TCH_T, /* TOUCH ID */
+ CY_TCH_MAJ, /* TOUCH_MAJOR */
+ CY_TCH_MIN, /* TOUCH_MINOR */
+ CY_TCH_NUM_ABS,
+};
+
+struct cyttsp5_tch_abs_params {
+ size_t ofs; /* abs byte offset */
+ size_t size; /* size in bits */
+ size_t min; /* min value */
+ size_t max; /* max value */
+ size_t bofs; /* bit offset */
+};
+
+struct cyttsp5_touch {
+ int hdr;
+ int abs[CY_TCH_NUM_ABS];
+};
+
+struct cyttsp5_sysinfo {
+ struct cyttsp5_sensing_conf_data sensing_conf_data;
+ int num_btns;
+ struct cyttsp5_tch_abs_params tch_hdr;
+ struct cyttsp5_tch_abs_params tch_abs[CY_TCH_NUM_ABS];
+ u32 key_code[HID_SYSINFO_MAX_BTN];
+ u8 *xy_mode;
+ u8 *xy_data;
+};
+
+struct cyttsp5_hid_desc {
+ __le16 hid_desc_len;
+ u8 packet_id;
+ u8 reserved_byte;
+ __le16 bcd_version;
+ __le16 report_desc_len;
+ __le16 report_desc_register;
+ __le16 input_register;
+ __le16 max_input_len;
+ __le16 output_register;
+ __le16 max_output_len;
+ __le16 command_register;
+ __le16 data_register;
+ __le16 vendor_id;
+ __le16 product_id;
+ __le16 version_id;
+ u8 reserved[4];
+} __packed;
+
+struct cyttsp5 {
+ struct device *dev;
+ struct mutex system_lock;
+ wait_queue_head_t wait_q;
+ struct cyttsp5_sysinfo sysinfo;
+ int hid_cmd_state;
+ struct cyttsp5_hid_desc hid_desc;
+ u8 cmd_buf[CYTTSP5_PREALLOCATED_CMD_BUFFER];
+ u8 input_buf[CY_MAX_INPUT];
+ u8 response_buf[CY_MAX_INPUT];
+ struct gpio_desc *reset_gpio;
+ struct input_dev *input;
+ char phys[NAME_MAX];
+ int num_prv_rec;
+ struct regmap *regmap;
+};
+
+/*
+ * For what understood in the datasheet, the register does not
+ * matter. For consistency, used the Input Register address
+ * but it does mean anything to the device. The important data
+ * to send is the I2C address
+ */
+static int cyttsp5_read(struct cyttsp5 *ts, u8 *buf, u32 max)
+{
+ int rc;
+ u32 size;
+ u8 temp[2];
+
+ if (!buf)
+ return -EINVAL;
+
+ /* Read the frame to retrieve the size */
+ rc = regmap_bulk_read(ts->regmap, HID_INPUT_REG, temp, 2);
+ if (rc < 0)
+ return rc;
+
+ size = get_unaligned_le16(temp);
+ if (!size || size == 2)
+ return 0;
+
+ if (size > max)
+ return -EINVAL;
+
+ /* Get the real value */
+ return regmap_bulk_read(ts->regmap, HID_INPUT_REG, buf, size);
+}
+
+static int cyttsp5_write(struct cyttsp5 *ts, unsigned int reg, u8 *data,
+ size_t size)
+{
+ u8 cmd[size + 1];
+
+ /* High bytes of register address needed as first byte of cmd */
+ cmd[0] = HI_BYTE(reg);
+
+ /* Copy the rest of the data */
+ if (data)
+ memcpy(&cmd[1], data, size);
+
+ /* The hardware wants to receive a frame with the address register
+ * contains in the first two bytes. As the regmap_write function
+ * add the register adresse in the frame, we use the LOW_BYTE as
+ * first frame byte for the address register and the first
+ * data byte is the high register + left of the cmd to send
+ */
+ return regmap_bulk_write(ts->regmap, LOW_BYTE(reg), cmd, size + 1);
+}
+
+static void cyttsp5_final_sync(struct input_dev *input, int max_slots,
+ unsigned long *ids)
+{
+ int t;
+
+ for (t = 0; t < max_slots; t++) {
+ if (test_bit(t, ids))
+ continue;
+ input_mt_slot(input, t);
+ input_mt_report_slot_state(input, MT_TOOL_FINGER, false);
+ }
+
+ input_sync(input);
+}
+
+static void cyttsp5_report_slot_liftoff(struct cyttsp5 *ts, int max_slots)
+{
+ int t;
+
+ if (ts->num_prv_rec == 0)
+ return;
+
+ for (t = 0; t < max_slots; t++) {
+ input_mt_slot(ts->input, t);
+ input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, false);
+ }
+}
+
+static void cyttsp5_mt_lift_all(struct cyttsp5 *ts)
+{
+ struct cyttsp5_sysinfo *si = &ts->sysinfo;
+ int max = si->tch_abs[CY_TCH_T].max;
+
+ if (ts->num_prv_rec != 0) {
+ cyttsp5_report_slot_liftoff(ts, max);
+ input_sync(ts->input);
+ ts->num_prv_rec = 0;
+ }
+}
+
+static void cyttsp5_get_touch_axis(int *axis, int size, int max, u8 *xy_data,
+ int bofs)
+{
+ int nbyte;
+ int next;
+
+ for (nbyte = 0, *axis = 0, next = 0; nbyte < size; nbyte++)
+ *axis = *axis + ((xy_data[nbyte] >> bofs) << (nbyte * 8));
+
+ *axis &= max - 1;
+}
+
+static void cyttsp5_get_touch_record(struct cyttsp5 *ts,
+ struct cyttsp5_touch *touch, u8 *xy_data)
+{
+ struct cyttsp5_sysinfo *si = &ts->sysinfo;
+ enum cyttsp5_tch_abs abs;
+
+ for (abs = CY_TCH_X; abs < CY_TCH_NUM_ABS; abs++) {
+ cyttsp5_get_touch_axis(&touch->abs[abs],
+ si->tch_abs[abs].size,
+ si->tch_abs[abs].max,
+ xy_data + si->tch_abs[abs].ofs,
+ si->tch_abs[abs].bofs);
+ }
+}
+
+static void cyttsp5_get_mt_touches(struct cyttsp5 *ts,
+ struct cyttsp5_touch *tch, int num_cur_tch)
+{
+ struct cyttsp5_sysinfo *si = &ts->sysinfo;
+ int i, t = 0;
+ DECLARE_BITMAP(ids, si->tch_abs[CY_TCH_T].max);
+ u8 *tch_addr;
+ int tmp;
+
+ bitmap_zero(ids, si->tch_abs[CY_TCH_T].max);
+ memset(tch->abs, 0, sizeof(tch->abs));
+
+ for (i = 0; i < num_cur_tch; i++) {
+ tch_addr = si->xy_data + (i * TOUCH_REPORT_SIZE);
+ cyttsp5_get_touch_record(ts, tch, tch_addr);
+
+ /* Convert MAJOR/MINOR from mm to resolution */
+ tmp = tch->abs[CY_TCH_MAJ] * 100 * si->sensing_conf_data.res_x;
+ tch->abs[CY_TCH_MAJ] = tmp / si->sensing_conf_data.len_x;
+ tmp = tch->abs[CY_TCH_MIN] * 100 * si->sensing_conf_data.res_x;
+ tch->abs[CY_TCH_MIN] = tmp / si->sensing_conf_data.len_x;
+
+ t = tch->abs[CY_TCH_T];
+ input_mt_slot(ts->input, t);
+ input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, true);
+ __set_bit(t, ids);
+
+ /* position and pressure fields */
+ input_report_abs(ts->input, ABS_MT_POSITION_X,
+ tch->abs[CY_TCH_X]);
+ input_report_abs(ts->input, ABS_MT_POSITION_Y,
+ tch->abs[CY_TCH_Y]);
+ input_report_abs(ts->input, ABS_MT_PRESSURE,
+ tch->abs[CY_TCH_P]);
+
+ /* Get the extended touch fields */
+ input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR,
+ tch->abs[CY_TCH_MAJ]);
+ input_report_abs(ts->input, ABS_MT_TOUCH_MINOR,
+ tch->abs[CY_TCH_MIN]);
+ }
+
+ cyttsp5_final_sync(ts->input, si->tch_abs[CY_TCH_T].max, ids);
+
+ ts->num_prv_rec = num_cur_tch;
+}
+
+/* read xy_data for all current touches */
+static int cyttsp5_xy_worker(struct cyttsp5 *ts)
+{
+ struct device *dev = ts->dev;
+ struct cyttsp5_sysinfo *si = &ts->sysinfo;
+ int max_tch = si->sensing_conf_data.max_tch;
+ struct cyttsp5_touch tch;
+ u8 num_cur_tch;
+
+ cyttsp5_get_touch_axis(&tch.hdr, si->tch_hdr.size,
+ si->tch_hdr.max,
+ si->xy_mode + 3 + si->tch_hdr.ofs,
+ si->tch_hdr.bofs);
+
+ num_cur_tch = tch.hdr;
+ if (num_cur_tch > max_tch) {
+ dev_err(dev, "Num touch err detected (n=%d)\n", num_cur_tch);
+ num_cur_tch = max_tch;
+ }
+
+ if (num_cur_tch == 0 && ts->num_prv_rec == 0)
+ return 0;
+
+ /* extract xy_data for all currently reported touches */
+ if (num_cur_tch)
+ cyttsp5_get_mt_touches(ts, &tch, num_cur_tch);
+ else
+ cyttsp5_mt_lift_all(ts);
+
+ return 0;
+}
+
+static int cyttsp5_mt_attention(struct device *dev)
+{
+ struct cyttsp5 *ts = dev_get_drvdata(dev);
+ struct cyttsp5_sysinfo *si = &ts->sysinfo;
+ int rc;
+
+ if (si->xy_mode[2] != HID_TOUCH_REPORT_ID)
+ return 0;
+
+ /* core handles handshake */
+ rc = cyttsp5_xy_worker(ts);
+ if (rc < 0)
+ dev_err(dev, "xy_worker error r=%d\n", rc);
+
+ return rc;
+}
+
+static int cyttsp5_setup_input_device(struct device *dev)
+{
+ struct cyttsp5 *ts = dev_get_drvdata(dev);
+ struct cyttsp5_sysinfo *si = &ts->sysinfo;
+ int max_x, max_y, max_p;
+ int max_x_tmp, max_y_tmp;
+ int rc;
+
+ __set_bit(EV_ABS, ts->input->evbit);
+ __set_bit(EV_REL, ts->input->evbit);
+ __set_bit(EV_KEY, ts->input->evbit);
+
+ max_x_tmp = si->sensing_conf_data.res_x;
+ max_y_tmp = si->sensing_conf_data.res_y;
+ max_x = max_y_tmp - 1;
+ max_y = max_x_tmp - 1;
+ max_p = si->sensing_conf_data.max_z;
+
+ input_mt_init_slots(ts->input, si->tch_abs[CY_TCH_T].max, 0);
+
+ __set_bit(ABS_MT_POSITION_X, ts->input->absbit);
+ __set_bit(ABS_MT_POSITION_Y, ts->input->absbit);
+ __set_bit(ABS_MT_PRESSURE, ts->input->absbit);
+
+ input_set_abs_params(ts->input, ABS_MT_POSITION_X, 0, max_x, 0, 0);
+ input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, max_y, 0, 0);
+ input_set_abs_params(ts->input, ABS_MT_PRESSURE, 0, max_p, 0, 0);
+
+ input_set_abs_params(ts->input, ABS_MT_TOUCH_MAJOR, 0, MAX_AREA, 0, 0);
+ input_set_abs_params(ts->input, ABS_MT_TOUCH_MINOR, 0, MAX_AREA, 0, 0);
+
+ rc = input_register_device(ts->input);
+ if (rc < 0)
+ dev_err(dev, "Error, failed register input device r=%d\n", rc);
+
+ return rc;
+}
+
+#ifdef CONFIG_OF
+static int cyttsp5_parse_dt_key_code(struct device *dev)
+{
+ struct cyttsp5 *ts = dev_get_drvdata(dev);
+ struct cyttsp5_sysinfo *si = &ts->sysinfo;
+ struct device_node *np;
+ int i;
+
+ np = dev->of_node;
+ if (!np)
+ return -EINVAL;
+
+ if (!si->num_btns)
+ return 0;
+
+ /* Initialize the button to RESERVED */
+ for (i = 0; i < si->num_btns; i++)
+ si->key_code[i] = KEY_RESERVED;
+
+ return of_property_read_u32_array(np, "linux,keycodes",
+ si->key_code, si->num_btns);
+}
+#else
+static int cyttsp5_parse_dt_key_code(struct device *dev)
+{
+ struct cyttsp5 *ts = dev_get_drvdata(dev);
+ struct cyttsp5_sysinfo *si = &ts->sysinfo;
+ int i;
+
+ if (!si->num_btns)
+ return 0;
+
+ /* Initialize the button to RESERVED */
+ for (i = 0; i < si->num_btns; i++)
+ si->key_code[i] = KEY_RESERVED;
+
+ return 0;
+}
+#endif
+
+static int cyttsp5_btn_attention(struct device *dev)
+{
+ struct cyttsp5 *ts = dev_get_drvdata(dev);
+ struct cyttsp5_sysinfo *si = &ts->sysinfo;
+ int cur_btn;
+ int cur_btn_state;
+
+ if (si->xy_mode[2] != HID_BTN_REPORT_ID || !si->num_btns)
+ return 0;
+
+ /* extract button press/release touch information */
+ for (cur_btn = 0; cur_btn < si->num_btns; cur_btn++) {
+ /* Get current button state */
+ cur_btn_state = (si->xy_data[0] >> (cur_btn * CY_BITS_PER_BTN))
+ & CY_NUM_BTN_EVENT_ID;
+
+ input_report_key(ts->input, si->key_code[cur_btn],
+ cur_btn_state);
+ input_sync(ts->input);
+ }
+
+ return 0;
+}
+
+static u16 cyttsp5_compute_crc(u8 *buf, u32 size)
+{
+ u16 remainder = 0xFFFF;
+ u16 xor_mask = 0x0000;
+ u32 index;
+ u32 byte_value;
+ u32 table_index;
+ u32 crc_bit_width = sizeof(u16) * 8;
+
+ /* Divide the message by polynomial, via the table. */
+ for (index = 0; index < size; index++) {
+ byte_value = buf[index];
+ table_index = ((byte_value >> 4) & 0x0F)
+ ^ (remainder >> (crc_bit_width - 4));
+ remainder = crc_itu_t_table[table_index]
+ ^ (remainder << 4);
+ table_index = (byte_value & 0x0F)
+ ^ (remainder >> (crc_bit_width - 4));
+ remainder = crc_itu_t_table[table_index]
+ ^ (remainder << 4);
+ }
+
+ /* Perform the final remainder CRC. */
+ return remainder ^ xor_mask;
+}
+
+static int cyttsp5_validate_cmd_response(struct cyttsp5 *ts, u8 code)
+{
+ u16 size, crc;
+ u8 status, offset;
+ int command_code;
+
+ size = get_unaligned_le16(&ts->response_buf[0]);
+
+ if (!size)
+ return 0;
+
+ offset = ts->response_buf[HID_OUTPUT_RESPONSE_REPORT_OFFSET];
+
+ if (offset == HID_BL_RESPONSE_REPORT_ID) {
+ if (ts->response_buf[4] != HID_OUTPUT_BL_SOP) {
+ dev_err(ts->dev, "HID output response, wrong SOP\n");
+ return -EPROTO;
+ }
+
+ if (ts->response_buf[size - 1] != HID_OUTPUT_BL_EOP) {
+ dev_err(ts->dev, "HID output response, wrong EOP\n");
+ return -EPROTO;
+ }
+
+ crc = cyttsp5_compute_crc(&ts->response_buf[4], size - 7);
+ if (ts->response_buf[size - 3] != LOW_BYTE(crc) ||
+ ts->response_buf[size - 2] != HI_BYTE(crc)) {
+ dev_err(ts->dev, "HID output response, wrong CRC 0x%X\n",
+ crc);
+ return -EPROTO;
+ }
+
+ status = ts->response_buf[5];
+ if (status) {
+ dev_err(ts->dev, "HID output response, ERROR:%d\n",
+ status);
+ return -EPROTO;
+ }
+ }
+
+ if (offset == HID_APP_RESPONSE_REPORT_ID) {
+ command_code = ts->response_buf[HID_OUTPUT_RESPONSE_CMD_OFFSET]
+ & HID_OUTPUT_RESPONSE_CMD_MASK;
+ if (command_code != code) {
+ dev_err(ts->dev,
+ "HID output response, wrong command_code:%X\n",
+ command_code);
+ return -EPROTO;
+ }
+ }
+
+ return 0;
+}
+
+static void cyttsp5_si_get_btn_data(struct cyttsp5 *ts)
+{
+ struct cyttsp5_sysinfo *si = &ts->sysinfo;
+ int i;
+ unsigned int btns = ts->response_buf[HID_SYSINFO_BTN_OFFSET]
+ & HID_SYSINFO_BTN_MASK;
+
+ si->num_btns = 0;
+ for (i = 0; i < HID_SYSINFO_MAX_BTN; i++) {
+ if (btns & BIT(i))
+ si->num_btns++;
+ }
+}
+
+static int cyttsp5_get_sysinfo_regs(struct cyttsp5 *ts)
+{
+ struct cyttsp5_sensing_conf_data *scd = &ts->sysinfo.sensing_conf_data;
+ struct cyttsp5_sensing_conf_data_dev *scd_dev =
+ (struct cyttsp5_sensing_conf_data_dev *)
+ &ts->response_buf[HID_SYSINFO_SENSING_OFFSET];
+ struct cyttsp5_sysinfo *si = &ts->sysinfo;
+
+ cyttsp5_si_get_btn_data(ts);
+
+ scd->max_tch = scd_dev->max_num_of_tch_per_refresh_cycle;
+ scd->res_x = get_unaligned_le16(&scd_dev->res_x);
+ scd->res_y = get_unaligned_le16(&scd_dev->res_y);
+ scd->max_z = get_unaligned_le16(&scd_dev->max_z);
+ scd->len_x = get_unaligned_le16(&scd_dev->len_x);
+ scd->len_y = get_unaligned_le16(&scd_dev->len_y);
+
+ si->xy_data = devm_kzalloc(ts->dev, scd->max_tch * TOUCH_REPORT_SIZE,
+ GFP_KERNEL);
+ if (!si->xy_data)
+ return -ENOMEM;
+
+ si->xy_mode = devm_kzalloc(ts->dev, TOUCH_INPUT_HEADER_SIZE,
+ GFP_KERNEL);
+ if (!si->xy_mode)
+ return -ENOMEM;
+
+ return 0;
+}
+
+static int cyttsp5_hid_output_get_sysinfo(struct cyttsp5 *ts)
+{
+ int rc;
+ u8 cmd[HID_OUTPUT_GET_SYSINFO_SIZE];
+
+ ts->hid_cmd_state = HID_CMD_BUSY;
+
+ /* HI bytes of Output register address */
+ cmd[0] = LOW_BYTE(HID_OUTPUT_GET_SYSINFO_SIZE);
+ cmd[1] = HI_BYTE(HID_OUTPUT_GET_SYSINFO_SIZE);
+ cmd[2] = HID_APP_OUTPUT_REPORT_ID;
+ cmd[3] = 0x0; /* Reserved */
+ cmd[4] = HID_OUTPUT_GET_SYSINFO;
+
+ rc = cyttsp5_write(ts, HID_OUTPUT_REG, cmd,
+ HID_OUTPUT_GET_SYSINFO_SIZE);
+ if (rc) {
+ dev_err(ts->dev, "Failed to write command %d", rc);
+ goto error;
+ }
+
+ rc = wait_event_timeout(ts->wait_q, (ts->hid_cmd_state == HID_CMD_DONE),
+ msecs_to_jiffies(CY_HID_OUTPUT_GET_SYSINFO_TIMEOUT));
+ if (!rc) {
+ dev_err(ts->dev, "HID output cmd execution timed out\n");
+ rc = -ETIME;
+ goto error;
+ }
+
+ rc = cyttsp5_validate_cmd_response(ts, HID_OUTPUT_GET_SYSINFO);
+ if (rc) {
+ dev_err(ts->dev, "Validation of the response failed\n");
+ goto error;
+ }
+
+ return cyttsp5_get_sysinfo_regs(ts);
+
+error:
+ mutex_lock(&ts->system_lock);
+ ts->hid_cmd_state = HID_CMD_DONE;
+ mutex_unlock(&ts->system_lock);
+ return rc;
+}
+
+static int cyttsp5_hid_output_bl_launch_app(struct cyttsp5 *ts)
+{
+ int rc;
+ u8 cmd[HID_OUTPUT_BL_LAUNCH_APP];
+ u16 crc;
+
+ mutex_lock(&ts->system_lock);
+ ts->hid_cmd_state = HID_CMD_BUSY;
+ mutex_unlock(&ts->system_lock);
+
+ cmd[0] = LOW_BYTE(HID_OUTPUT_BL_LAUNCH_APP_SIZE);
+ cmd[1] = HI_BYTE(HID_OUTPUT_BL_LAUNCH_APP_SIZE);
+ cmd[2] = HID_BL_OUTPUT_REPORT_ID;
+ cmd[3] = 0x0; /* Reserved */
+ cmd[4] = HID_OUTPUT_BL_SOP;
+ cmd[5] = HID_OUTPUT_BL_LAUNCH_APP;
+ cmd[6] = 0x0; /* Low bytes of data */
+ cmd[7] = 0x0; /* Hi bytes of data */
+ crc = cyttsp5_compute_crc(&cmd[4], 4);
+ cmd[8] = LOW_BYTE(crc);
+ cmd[9] = HI_BYTE(crc);
+ cmd[10] = HID_OUTPUT_BL_EOP;
+
+ rc = cyttsp5_write(ts, HID_OUTPUT_REG, cmd,
+ HID_OUTPUT_BL_LAUNCH_APP_SIZE);
+ if (rc) {
+ dev_err(ts->dev, "Failed to write command %d", rc);
+ goto error;
+ }
+
+ rc = wait_event_timeout(ts->wait_q, (ts->hid_cmd_state == HID_CMD_DONE),
+ msecs_to_jiffies(CY_HID_OUTPUT_TIMEOUT));
+ if (!rc) {
+ dev_err(ts->dev, "HID output cmd execution timed out\n");
+ rc = -ETIME;
+ goto error;
+ }
+
+ rc = cyttsp5_validate_cmd_response(ts, HID_OUTPUT_BL_LAUNCH_APP);
+ if (rc) {
+ dev_err(ts->dev, "Validation of the response failed\n");
+ goto error;
+ }
+
+ return rc;
+
+error:
+ mutex_lock(&ts->system_lock);
+ ts->hid_cmd_state = HID_CMD_DONE;
+ mutex_unlock(&ts->system_lock);
+
+ return rc;
+}
+
+static int cyttsp5_get_hid_descriptor(struct cyttsp5 *ts,
+ struct cyttsp5_hid_desc *desc)
+{
+ struct device *dev = ts->dev;
+ __le16 hid_desc_register = HID_DESC_REG;
+ int rc;
+ u8 cmd[2];
+
+ /* Read HID descriptor length and version */
+ mutex_lock(&ts->system_lock);
+ ts->hid_cmd_state = HID_CMD_BUSY;
+ mutex_unlock(&ts->system_lock);
+
+ /* Set HID descriptor register */
+ memcpy(cmd, &hid_desc_register, sizeof(hid_desc_register));
+
+ rc = cyttsp5_write(ts, HID_DESC_REG, NULL, 0);
+ if (rc < 0) {
+ dev_err(dev, "Failed to get HID descriptor, rc=%d\n", rc);
+ goto error;
+ }
+
+ rc = wait_event_timeout(ts->wait_q, (ts->hid_cmd_state == HID_CMD_DONE),
+ msecs_to_jiffies(CY_HID_GET_HID_DESCRIPTOR_TIMEOUT));
+ if (!rc) {
+ dev_err(ts->dev, "HID get descriptor timed out\n");
+ rc = -ETIME;
+ goto error;
+ }
+
+ memcpy(desc, ts->response_buf, sizeof(struct cyttsp5_hid_desc));
+
+ /* Check HID descriptor length and version */
+ if (le16_to_cpu(desc->hid_desc_len) != sizeof(*desc) ||
+ le16_to_cpu(desc->bcd_version) != HID_VERSION) {
+ dev_err(dev, "Unsupported HID version\n");
+ return -ENODEV;
+ }
+
+ goto exit;
+
+error:
+ mutex_lock(&ts->system_lock);
+ ts->hid_cmd_state = HID_CMD_DONE;
+ mutex_unlock(&ts->system_lock);
+exit:
+ return rc;
+}
+
+static int fill_tch_abs(struct cyttsp5_tch_abs_params *tch_abs, int report_size,
+ int offset)
+{
+ tch_abs->ofs = offset / 8;
+ tch_abs->size = report_size / 8;
+ if (report_size % 8)
+ tch_abs->size += 1;
+ tch_abs->min = 0;
+ tch_abs->max = 1 << report_size;
+ tch_abs->bofs = offset - (tch_abs->ofs << 3);
+
+ return 0;
+}
+
+static int move_button_data(struct cyttsp5 *ts, struct cyttsp5_sysinfo *si)
+{
+ memcpy(si->xy_mode, ts->input_buf, BTN_INPUT_HEADER_SIZE);
+ memcpy(si->xy_data, &ts->input_buf[BTN_INPUT_HEADER_SIZE],
+ BTN_REPORT_SIZE);
+
+ return 0;
+}
+
+static int move_touch_data(struct cyttsp5 *ts, struct cyttsp5_sysinfo *si)
+{
+ int max_tch = si->sensing_conf_data.max_tch;
+ int num_cur_tch;
+ int length;
+ struct cyttsp5_tch_abs_params *tch = &si->tch_hdr;
+
+ memcpy(si->xy_mode, ts->input_buf, TOUCH_INPUT_HEADER_SIZE);
+
+ cyttsp5_get_touch_axis(&num_cur_tch, tch->size,
+ tch->max, si->xy_mode + 3 + tch->ofs, tch->bofs);
+ if (unlikely(num_cur_tch > max_tch))
+ num_cur_tch = max_tch;
+
+ length = num_cur_tch * TOUCH_REPORT_SIZE;
+
+ memcpy(si->xy_data, &ts->input_buf[TOUCH_INPUT_HEADER_SIZE], length);
+
+ return 0;
+}
+
+static irqreturn_t cyttsp5_handle_irq(int irq, void *handle)
+{
+ struct cyttsp5 *ts = handle;
+ int report_id;
+ int size;
+ int rc;
+
+ rc = cyttsp5_read(ts, ts->input_buf, CY_MAX_INPUT);
+ if (rc)
+ return IRQ_HANDLED;
+
+ size = get_unaligned_le16(&ts->input_buf[0]);
+
+ /* check reset */
+ if (size == 0) {
+ memcpy(ts->response_buf, ts->input_buf, 2);
+
+ mutex_lock(&ts->system_lock);
+ ts->hid_cmd_state = HID_CMD_DONE;
+ mutex_unlock(&ts->system_lock);
+ wake_up(&ts->wait_q);
+ return IRQ_HANDLED;
+ }
+
+ report_id = ts->input_buf[2];
+
+ if (report_id == HID_TOUCH_REPORT_ID) {
+ move_touch_data(ts, &ts->sysinfo);
+ cyttsp5_mt_attention(ts->dev);
+ } else if (report_id == HID_BTN_REPORT_ID) {
+ move_button_data(ts, &ts->sysinfo);
+ cyttsp5_btn_attention(ts->dev);
+ } else {
+ /* It is not an input but a command response */
+ memcpy(ts->response_buf, ts->input_buf, size);
+
+ mutex_lock(&ts->system_lock);
+ ts->hid_cmd_state = HID_CMD_DONE;
+ mutex_unlock(&ts->system_lock);
+ wake_up(&ts->wait_q);
+ }
+
+ return IRQ_HANDLED;
+}
+
+static int cyttsp5_deassert_int(struct cyttsp5 *ts)
+{
+ u16 size;
+ u8 buf[2];
+ int rc;
+
+ rc = regmap_bulk_read(ts->regmap, HID_INPUT_REG, buf, 2);
+ if (rc < 0)
+ return rc;
+
+ size = get_unaligned_le16(&buf[0]);
+ if (size == 2 || size == 0)
+ return 0;
+
+ return -EINVAL;
+}
+
+static int cyttsp5_fill_all_touch(struct cyttsp5 *ts)
+{
+ struct cyttsp5_sysinfo *si = &ts->sysinfo;
+
+ fill_tch_abs(&si->tch_abs[CY_TCH_X], REPORT_SIZE_16,
+ TOUCH_REPORT_DESC_X);
+ fill_tch_abs(&si->tch_abs[CY_TCH_Y], REPORT_SIZE_16,
+ TOUCH_REPORT_DESC_Y);
+ fill_tch_abs(&si->tch_abs[CY_TCH_P], REPORT_SIZE_8,
+ TOUCH_REPORT_DESC_P);
+ fill_tch_abs(&si->tch_abs[CY_TCH_T], REPORT_SIZE_5,
+ TOUCH_REPORT_DESC_CONTACTID);
+ fill_tch_abs(&si->tch_hdr, REPORT_SIZE_5,
+ TOUCH_REPORT_DESC_HDR_CONTACTCOUNT);
+ fill_tch_abs(&si->tch_abs[CY_TCH_MAJ], REPORT_SIZE_8,
+ TOUCH_REPORT_DESC_MAJ);
+ fill_tch_abs(&si->tch_abs[CY_TCH_MIN], REPORT_SIZE_8,
+ TOUCH_REPORT_DESC_MIN);
+
+ return 0;
+}
+
+static int cyttsp5_startup(struct cyttsp5 *ts)
+{
+ int rc;
+
+ rc = cyttsp5_deassert_int(ts);
+ if (rc) {
+ dev_err(ts->dev, "Error on deassert int r=%d\n", rc);
+ return -ENODEV;
+ }
+
+ /*
+ * Launch the application as the device starts in bootloader mode
+ * because of a power-on-reset
+ */
+ rc = cyttsp5_hid_output_bl_launch_app(ts);
+ if (rc < 0) {
+ dev_err(ts->dev, "Error on launch app r=%d\n", rc);
+ return rc;
+ }
+
+ rc = cyttsp5_get_hid_descriptor(ts, &ts->hid_desc);
+ if (rc < 0) {
+ dev_err(ts->dev, "Error on getting HID descriptor r=%d\n", rc);
+ return rc;
+ }
+
+ rc = cyttsp5_fill_all_touch(ts);
+ if (rc < 0) {
+ dev_err(ts->dev, "Error on report descriptor r=%d\n", rc);
+ return rc;
+ }
+
+ rc = cyttsp5_hid_output_get_sysinfo(ts);
+ if (rc) {
+ dev_err(ts->dev, "Error on getting sysinfo r=%d\n", rc);
+ return rc;
+ }
+
+ return rc;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id cyttsp5_of_match[] = {
+ { .compatible = "cypress,cyttsp5", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, cyttsp5_of_match);
+#endif
+
+static const struct i2c_device_id cyttsp5_i2c_id[] = {
+ { CYTTSP5_NAME, 0, },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, cyttsp5_i2c_id);
+
+static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
+ const char *name)
+{
+ struct cyttsp5 *ts;
+ struct cyttsp5_sysinfo *si;
+ int rc = 0, i;
+
+ ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL);
+ if (!ts)
+ return -ENOMEM;
+
+ /* Initialize device info */
+ ts->regmap = regmap;
+ ts->dev = dev;
+ si = &ts->sysinfo;
+ dev_set_drvdata(dev, ts);
+
+ /* Initialize mutexes and spinlocks */
+ mutex_init(&ts->system_lock);
+
+ /* Initialize wait queue */
+ init_waitqueue_head(&ts->wait_q);
+
+ /* Reset the gpio to be in a reset state */
+ ts->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR(ts->reset_gpio)) {
+ rc = PTR_ERR(ts->reset_gpio);
+ dev_err(dev, "Failed to request reset gpio, error %d\n", rc);
+ return rc;
+ }
+ gpiod_set_value(ts->reset_gpio, 1);
+
+ /* Need a delay to have device up */
+ msleep(20);
+
+ rc = devm_request_threaded_irq(dev, irq, NULL, cyttsp5_handle_irq,
+ IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+ name, ts);
+ if (rc) {
+ dev_err(dev, "unable to request IRQ\n");
+ return rc;
+ }
+
+ rc = cyttsp5_startup(ts);
+ if (rc) {
+ dev_err(ts->dev, "Fail initial startup r=%d\n", rc);
+ return rc;
+ }
+
+ rc = cyttsp5_parse_dt_key_code(dev);
+ if (rc < 0) {
+ dev_err(ts->dev, "Error while parsing dts %d\n", rc);
+ return rc;
+ }
+
+ ts->input = devm_input_allocate_device(dev);
+ if (!ts->input) {
+ dev_err(dev, "Error, failed to allocate input device\n");
+ return -ENODEV;
+ }
+
+ ts->input->name = "cyttsp5";
+ scnprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(dev));
+ ts->input->phys = ts->phys;
+ ts->input->dev.parent = ts->dev;
+ input_set_drvdata(ts->input, ts);
+
+ touchscreen_parse_properties(ts->input, true, NULL);
+
+ __set_bit(EV_KEY, ts->input->evbit);
+ for (i = 0; i < si->num_btns; i++)
+ __set_bit(si->key_code[i], ts->input->keybit);
+
+ return cyttsp5_setup_input_device(dev);
+}
+
+static int cyttsp5_i2c_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+{
+ struct regmap *regmap;
+ static const struct regmap_config config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ };
+
+ regmap = devm_regmap_init_i2c(client, &config);
+ if (IS_ERR(regmap)) {
+ dev_err(&client->dev, "regmap allocation failed: %ld\n",
+ PTR_ERR(regmap));
+ return PTR_ERR(regmap);
+ }
+
+ return cyttsp5_probe(&client->dev, regmap, client->irq, client->name);
+}
+
+static int cyttsp5_remove(struct device *dev)
+{
+ struct cyttsp5 *ts = dev_get_drvdata(dev);
+
+ input_unregister_device(ts->input);
+
+ return 0;
+}
+
+static int cyttsp5_i2c_remove(struct i2c_client *client)
+{
+ struct device *dev = &client->dev;
+
+ return cyttsp5_remove(dev);
+}
+
+static struct i2c_driver cyttsp5_i2c_driver = {
+ .driver = {
+ .name = CYTTSP5_NAME,
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(cyttsp5_of_match),
+ },
+ .probe = cyttsp5_i2c_probe,
+ .remove = cyttsp5_i2c_remove,
+ .id_table = cyttsp5_i2c_id,
+};
+
+module_i2c_driver(cyttsp5_i2c_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Touchscreen driver for Cypress TrueTouch Gen 5 Product");
+MODULE_AUTHOR("Mylène Josserand <mylene.josserand@free-electrons.com>");
--
2.11.0
^ permalink raw reply related
* [PATCH v4 0/2] Input: Add Cypress Gen5 Touchscreen driver
From: Mylène Josserand @ 2017-12-01 15:39 UTC (permalink / raw)
To: dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
Hi everyone,
Here is a V4 series to add the driver of the touchscreen Cypress,
TrueTouch Generation 5.
Based on last master branch of "input" kernel's tree, last commit c1b433e04ef9.
This touchscreen is similar to Cypress generation 4 but the
registers are different.
This driver uses regmap as it is possible to use I2C or SPI
busses. Currently, only the I2C support are available in the driver.
This touchscreen can handle some multitouch events as buttons using
some defined zones. That is why the driver handles buttons and
multitouch events.
Changes since v3:
- Rebased on last input's branch
- Changed the CRC table to use crc_itu_t_table instead of
crc_ccitt_false_table which is not merged.
- Added selection of CRC_ITU_T on KConfig
Changes since v2:
- Removed pinctrl in dt-binding example which is uncessecary.
- Added Acked-by and Reviewed-by received.
Changes since v1:
- Updated the driver according to reviews. Most important modifications:
removed unnecessary mutex, updated dev_err output, handled return cases
in a better way, created a HID_ENUM, removed magic value, used an
existing CRC table and used "linux-keycodes" instead of sub-nodes.
- Updated the dt-bindings to use linux-keycodes and removed properties'
description that comes from touchscreen's binding.
Patch 01: Add the basis of the driver for Cypress Gen5 Touchscreen.
Patch 02: Add the binding documentation for this driver.
If you have any remarks, let me know.
Thank you in advance,
Mylène
Mylène Josserand (2):
Input: Add driver for Cypress Generation 5 touchscreen
dt-bindings: input: Add documentation for cyttsp5
.../bindings/input/touchscreen/cypress,cyttsp5.txt | 39 +
drivers/input/touchscreen/Kconfig | 16 +
drivers/input/touchscreen/Makefile | 1 +
drivers/input/touchscreen/cyttsp5.c | 1110 ++++++++++++++++++++
4 files changed, 1166 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.txt
create mode 100644 drivers/input/touchscreen/cyttsp5.c
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v2 16/19] ASoC: tlv320aic31xx: Add short circuit detection support
From: Andrew F. Davis @ 2017-12-01 15:32 UTC (permalink / raw)
To: Mark Brown
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, linux-kernel, Rob Herring, Benoît Cousson
In-Reply-To: <20171201133930.xzfjjj6wzkbtk6c4@sirena.org.uk>
On 12/01/2017 07:39 AM, Mark Brown wrote:
> On Wed, Nov 29, 2017 at 03:32:57PM -0600, Andrew F. Davis wrote:
>
>> +static irqreturn_t aic31xx_irq(int irq, void *data)
>> +{
>> + struct aic31xx_priv *aic31xx = (struct aic31xx_priv *)data;
>
> There is no need to cast away from void, doing so can only mask bugs.
>
>> + ret = regmap_read(aic31xx->regmap, AIC31XX_INTRDACFLAG, &value);
>> + if (ret) {
>> + dev_err(dev, "Failed to read interrupt mask: %d\n", ret);
>> + return IRQ_NONE;
>> + }
>> +
>> + if (value & AIC31XX_HPLSCDETECT)
>> + dev_err(dev, "Short circuit on Left output is detected\n");
>> + if (value & AIC31XX_HPRSCDETECT)
>> + dev_err(dev, "Short circuit on Right output is detected\n");
>> +
>> + return IRQ_HANDLED;
>
> This will report the interrupt as handled even if we didn't see an
> interrupt we understand which will break shared interrupt lines. At the
> very least we should log other interrupt sources numerically.
>
Okay, I think I can make that work by checking if no bits are set in the
interrupt regs and returning early if not, IRQ_NONE.
>> + if (aic31xx->irq > 0) {
>> + regmap_update_bits(aic31xx->regmap, AIC31XX_GPIO1,
>> + AIC31XX_GPIO1_FUNC_MASK,
>> + AIC31XX_GPIO1_INT1 <<
>> + AIC31XX_GPIO1_FUNC_SHIFT);
>
> Is the interrupt only available on GPIO1?
>
Some devices can route this to GPIO2 IIRC.
I'm not sure how that would be supported, I think we would need to add
interrupt names to DT so users could specify which gpio they wired their
IRQ lines to.
interrupt = <&host 23>;
interrupt-name = "gpio2";
or similar?
^ permalink raw reply
* Re: [alsa-devel] [PATCH v5 04/13] IIO: inkern: API for manipulating channel attributes
From: kbuild test robot @ 2017-12-01 15:12 UTC (permalink / raw)
Cc: kbuild-all-JC7UmRfGjtg, Rob Herring, Mark Rutland,
Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Jaroslav Kysela, Takashi Iwai,
Liam Girdwood, Mark Brown, devicetree-u79uwXL29TY76Z2rM5mHXA,
alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Alexandre Torgue,
linux-iio-u79uwXL29TY76Z2rM5mHXA, arnaud.pouliquen-qxv4g6HH51o,
Maxime Coquelin,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <1511881557-28596-5-git-send-email-arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 12055 bytes --]
Hi Arnaud,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on iio/togreg]
[also build test WARNING on v4.15-rc1 next-20171201]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Arnaud-Pouliquen/Add-STM32-DFSDM-support/20171201-215409
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: x86_64-randconfig-x012-201748 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
In file included from drivers/iio/adc/envelope-detector.c:38:0:
>> include/linux/iio/consumer.h:228:20: warning: 'enum iio_chan_info_enum' declared inside parameter list will not be visible outside of this definition or declaration
int val2, enum iio_chan_info_enum attribute);
^~~~~~~~~~~~~~~~~~
include/linux/iio/consumer.h:242:27: warning: 'enum iio_chan_info_enum' declared inside parameter list will not be visible outside of this definition or declaration
int *val2, enum iio_chan_info_enum attribute);
^~~~~~~~~~~~~~~~~~
Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
Cyclomatic Complexity 1 include/linux/kernel.h:kstrtoul
Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
Cyclomatic Complexity 1 include/linux/spinlock.h:spinlock_check
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock_irq
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock_irq
Cyclomatic Complexity 1 include/linux/completion.h:__init_completion
Cyclomatic Complexity 1 include/linux/jiffies.h:_msecs_to_jiffies
Cyclomatic Complexity 3 include/linux/jiffies.h:msecs_to_jiffies
Cyclomatic Complexity 1 include/linux/workqueue.h:queue_delayed_work
Cyclomatic Complexity 1 include/linux/workqueue.h:schedule_delayed_work
Cyclomatic Complexity 1 include/linux/kobject.h:kobject_name
Cyclomatic Complexity 2 include/linux/device.h:dev_name
Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata
Cyclomatic Complexity 1 include/linux/iio/iio.h:iio_priv
Cyclomatic Complexity 1 include/linux/irq.h:irqd_get_trigger_type
Cyclomatic Complexity 2 include/linux/irq.h:irq_get_trigger_type
Cyclomatic Complexity 1 include/linux/interrupt.h:devm_request_irq
Cyclomatic Complexity 1 include/linux/platform_device.h:platform_set_drvdata
Cyclomatic Complexity 1 drivers/iio/adc/envelope-detector.c:envelope_detector_driver_init
Cyclomatic Complexity 15 drivers/iio/adc/envelope-detector.c:envelope_detector_probe
Cyclomatic Complexity 1 drivers/iio/adc/envelope-detector.c:envelope_detector_comp_isr
Cyclomatic Complexity 3 drivers/iio/adc/envelope-detector.c:envelope_store_comp_interval
Cyclomatic Complexity 1 drivers/iio/adc/envelope-detector.c:envelope_show_comp_interval
Cyclomatic Complexity 1 drivers/iio/adc/envelope-detector.c:envelope_show_invert
Cyclomatic Complexity 6 drivers/iio/adc/envelope-detector.c:envelope_store_invert
Cyclomatic Complexity 3 drivers/iio/adc/envelope-detector.c:envelope_detector_comp_latch
Cyclomatic Complexity 5 drivers/iio/adc/envelope-detector.c:envelope_detector_setup_compare
Cyclomatic Complexity 5 drivers/iio/adc/envelope-detector.c:envelope_detector_read_raw
Cyclomatic Complexity 3 drivers/iio/adc/envelope-detector.c:envelope_detector_timeout
Cyclomatic Complexity 1 drivers/iio/adc/envelope-detector.c:envelope_detector_driver_exit
--
In file included from drivers/iio/multiplexer/iio-mux.c:14:0:
>> include/linux/iio/consumer.h:228:20: warning: 'enum iio_chan_info_enum' declared inside parameter list will not be visible outside of this definition or declaration
int val2, enum iio_chan_info_enum attribute);
^~~~~~~~~~~~~~~~~~
include/linux/iio/consumer.h:242:27: warning: 'enum iio_chan_info_enum' declared inside parameter list will not be visible outside of this definition or declaration
int *val2, enum iio_chan_info_enum attribute);
^~~~~~~~~~~~~~~~~~
Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
Cyclomatic Complexity 1 include/linux/kobject.h:kobject_name
Cyclomatic Complexity 1 include/linux/device.h:devm_kzalloc
Cyclomatic Complexity 2 include/linux/device.h:dev_name
Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata
Cyclomatic Complexity 1 include/linux/iio/iio.h:iio_channel_has_info
Cyclomatic Complexity 1 include/linux/iio/iio.h:iio_channel_has_available
Cyclomatic Complexity 1 include/linux/iio/iio.h:iio_priv
Cyclomatic Complexity 1 include/linux/platform_device.h:platform_set_drvdata
Cyclomatic Complexity 1 drivers/iio/multiplexer/iio-mux.c:mux_driver_init
Cyclomatic Complexity 7 drivers/iio/multiplexer/iio-mux.c:iio_mux_select
Cyclomatic Complexity 1 drivers/iio/multiplexer/iio-mux.c:iio_mux_deselect
Cyclomatic Complexity 5 drivers/iio/multiplexer/iio-mux.c:mux_write_ext_info
Cyclomatic Complexity 2 drivers/iio/multiplexer/iio-mux.c:mux_read_ext_info
Cyclomatic Complexity 3 drivers/iio/multiplexer/iio-mux.c:mux_write_raw
Cyclomatic Complexity 3 drivers/iio/multiplexer/iio-mux.c:mux_read_avail
Cyclomatic Complexity 4 drivers/iio/multiplexer/iio-mux.c:mux_read_raw
Cyclomatic Complexity 16 drivers/iio/multiplexer/iio-mux.c:mux_configure_channel
Cyclomatic Complexity 20 drivers/iio/multiplexer/iio-mux.c:mux_probe
Cyclomatic Complexity 1 drivers/iio/multiplexer/iio-mux.c:mux_driver_exit
--
In file included from drivers/iio//adc/envelope-detector.c:38:0:
>> include/linux/iio/consumer.h:228:20: warning: 'enum iio_chan_info_enum' declared inside parameter list will not be visible outside of this definition or declaration
int val2, enum iio_chan_info_enum attribute);
^~~~~~~~~~~~~~~~~~
include/linux/iio/consumer.h:242:27: warning: 'enum iio_chan_info_enum' declared inside parameter list will not be visible outside of this definition or declaration
int *val2, enum iio_chan_info_enum attribute);
^~~~~~~~~~~~~~~~~~
Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
Cyclomatic Complexity 1 include/linux/kernel.h:kstrtoul
Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
Cyclomatic Complexity 1 include/linux/spinlock.h:spinlock_check
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock_irq
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock_irq
Cyclomatic Complexity 1 include/linux/completion.h:__init_completion
Cyclomatic Complexity 1 include/linux/jiffies.h:_msecs_to_jiffies
Cyclomatic Complexity 3 include/linux/jiffies.h:msecs_to_jiffies
Cyclomatic Complexity 1 include/linux/workqueue.h:queue_delayed_work
Cyclomatic Complexity 1 include/linux/workqueue.h:schedule_delayed_work
Cyclomatic Complexity 1 include/linux/kobject.h:kobject_name
Cyclomatic Complexity 2 include/linux/device.h:dev_name
Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata
Cyclomatic Complexity 1 include/linux/iio/iio.h:iio_priv
Cyclomatic Complexity 1 include/linux/irq.h:irqd_get_trigger_type
Cyclomatic Complexity 2 include/linux/irq.h:irq_get_trigger_type
Cyclomatic Complexity 1 include/linux/interrupt.h:devm_request_irq
Cyclomatic Complexity 1 include/linux/platform_device.h:platform_set_drvdata
Cyclomatic Complexity 1 drivers/iio//adc/envelope-detector.c:envelope_detector_driver_init
Cyclomatic Complexity 15 drivers/iio//adc/envelope-detector.c:envelope_detector_probe
Cyclomatic Complexity 1 drivers/iio//adc/envelope-detector.c:envelope_detector_comp_isr
Cyclomatic Complexity 3 drivers/iio//adc/envelope-detector.c:envelope_store_comp_interval
Cyclomatic Complexity 1 drivers/iio//adc/envelope-detector.c:envelope_show_comp_interval
Cyclomatic Complexity 1 drivers/iio//adc/envelope-detector.c:envelope_show_invert
Cyclomatic Complexity 6 drivers/iio//adc/envelope-detector.c:envelope_store_invert
Cyclomatic Complexity 3 drivers/iio//adc/envelope-detector.c:envelope_detector_comp_latch
Cyclomatic Complexity 5 drivers/iio//adc/envelope-detector.c:envelope_detector_setup_compare
Cyclomatic Complexity 5 drivers/iio//adc/envelope-detector.c:envelope_detector_read_raw
Cyclomatic Complexity 3 drivers/iio//adc/envelope-detector.c:envelope_detector_timeout
Cyclomatic Complexity 1 drivers/iio//adc/envelope-detector.c:envelope_detector_driver_exit
--
In file included from drivers/iio//multiplexer/iio-mux.c:14:0:
>> include/linux/iio/consumer.h:228:20: warning: 'enum iio_chan_info_enum' declared inside parameter list will not be visible outside of this definition or declaration
int val2, enum iio_chan_info_enum attribute);
^~~~~~~~~~~~~~~~~~
include/linux/iio/consumer.h:242:27: warning: 'enum iio_chan_info_enum' declared inside parameter list will not be visible outside of this definition or declaration
int *val2, enum iio_chan_info_enum attribute);
^~~~~~~~~~~~~~~~~~
Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
Cyclomatic Complexity 1 include/linux/kobject.h:kobject_name
Cyclomatic Complexity 1 include/linux/device.h:devm_kzalloc
Cyclomatic Complexity 2 include/linux/device.h:dev_name
Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata
Cyclomatic Complexity 1 include/linux/iio/iio.h:iio_channel_has_info
Cyclomatic Complexity 1 include/linux/iio/iio.h:iio_channel_has_available
Cyclomatic Complexity 1 include/linux/iio/iio.h:iio_priv
Cyclomatic Complexity 1 include/linux/platform_device.h:platform_set_drvdata
Cyclomatic Complexity 1 drivers/iio//multiplexer/iio-mux.c:mux_driver_init
Cyclomatic Complexity 7 drivers/iio//multiplexer/iio-mux.c:iio_mux_select
Cyclomatic Complexity 1 drivers/iio//multiplexer/iio-mux.c:iio_mux_deselect
Cyclomatic Complexity 5 drivers/iio//multiplexer/iio-mux.c:mux_write_ext_info
Cyclomatic Complexity 2 drivers/iio//multiplexer/iio-mux.c:mux_read_ext_info
Cyclomatic Complexity 3 drivers/iio//multiplexer/iio-mux.c:mux_write_raw
Cyclomatic Complexity 3 drivers/iio//multiplexer/iio-mux.c:mux_read_avail
Cyclomatic Complexity 4 drivers/iio//multiplexer/iio-mux.c:mux_read_raw
Cyclomatic Complexity 16 drivers/iio//multiplexer/iio-mux.c:mux_configure_channel
Cyclomatic Complexity 20 drivers/iio//multiplexer/iio-mux.c:mux_probe
Cyclomatic Complexity 1 drivers/iio//multiplexer/iio-mux.c:mux_driver_exit
vim +228 include/linux/iio/consumer.h
217
218 /**
219 * iio_write_channel_attribute() - Write values to the device attribute.
220 * @chan: The channel being queried.
221 * @val: Value being written.
222 * @val2: Value being written.val2 use depends on attribute type.
223 * @attribute: info attribute to be read.
224 *
225 * Returns an error code or 0.
226 */
227 int iio_write_channel_attribute(struct iio_channel *chan, int val,
> 228 int val2, enum iio_chan_info_enum attribute);
229
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28248 bytes --]
^ permalink raw reply
* Re: [PATCH v2 15/19] ASoC: tlv320aic31xx: Reset registers during power up
From: Andrew F. Davis @ 2017-12-01 15:04 UTC (permalink / raw)
To: Mark Brown
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, linux-kernel, Rob Herring, Benoît Cousson
In-Reply-To: <20171201133723.vlxqci4paw7szjce@sirena.org.uk>
On 12/01/2017 07:37 AM, Mark Brown wrote:
> On Wed, Nov 29, 2017 at 03:32:56PM -0600, Andrew F. Davis wrote:
>
>> + gpiod_set_value(aic31xx->gpio_reset, 1);
>> + ndelay(10); /* At least 10ns */
>> + gpiod_set_value(aic31xx->gpio_reset, 0);
>
> _cansleep(), this isn't being done from interrupt context.
>
will fix
>> + } else {
>> + ret = regmap_write(aic31xx->regmap, AIC31XX_RESET, 1);
>> + if (ret < 0)
>> + dev_err(aic31xx->dev, "Could not reset device\n");
>
> Print the error to help people doing debug.
>
Do you mean by adding the ret code to the print?
^ permalink raw reply
* Re: [PATCH v2 14/19] ASoC: tlv320aic31xx: Remove regulator notification handling
From: Andrew F. Davis @ 2017-12-01 15:01 UTC (permalink / raw)
To: Mark Brown
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, linux-kernel, Rob Herring, Benoît Cousson
In-Reply-To: <20171201133604.6v3ychahwvlaygxi@sirena.org.uk>
On 12/01/2017 07:36 AM, Mark Brown wrote:
> On Wed, Nov 29, 2017 at 03:32:55PM -0600, Andrew F. Davis wrote:
>> A regulator being forcefully disabled is a catastrophic event that
>> should never happen to most devices, especially not sound CODECs.
>
> That's not what the disable notification handling is for. It's there so
> that the driver can skip having to reinitialize the device if other
> constraints mean the power doesn't actually get turned off when it
> disables the regualtors. It's nothing to do with forced disables.
>
Looking into the call sites, at least in this case the only time this
notification will be called, outside the normal enable/disable paths
(which do the same thing here: turn on regmap cache only mode and mark
it dirty), will be during a force disable scenario.
^ permalink raw reply
* Re: [PATCH v2 10/19] ASoC: tlv320aic31xx: Add MICBIAS off setting
From: Andrew F. Davis @ 2017-12-01 14:56 UTC (permalink / raw)
To: Mark Brown
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, linux-kernel, Rob Herring, Benoît Cousson
In-Reply-To: <20171201133028.svemo5qedyfqrt7y@sirena.org.uk>
On 12/01/2017 07:30 AM, Mark Brown wrote:
> On Wed, Nov 29, 2017 at 03:32:51PM -0600, Andrew F. Davis wrote:
>> Leaving microphone bias off is a valid setting and even used in the DT
>> binding document example. Add this setting here and document the same.
>
>> - ai31xx-micbias-vg - MicBias Voltage setting
>> + 0 or MICBIAS_OFF - MICBIAS output is powered off
>> 1 or MICBIAS_2_0V - MICBIAS output is powered to 2.0V
>> 2 or MICBIAS_2_5V - MICBIAS output is powered to 2.5V
>> 3 or MICBIAS_AVDD - MICBIAS output is connected to AVDD
>
> This doesn't make much sense. If we enable the microphone with a
> voltage of 0V that's not going to work terribly well - I'd expect this
> property to control the voltage set when it's enabled, not if it's
> enabled.
>
I agree about this not making much sense, but I'm not sure the right way
forward here.
Personally I wouldn't have put MicBias voltage in DT to begin with, it
is runtime configurable and depends on user runtime inserted microphone,
not really a hardware description :/
The enable/disable is controlled by a DAPM and should be wired to enable
whenever we are recording from the related microphone pin. So then
without MICBIAS_OFF the user is forced to select from the above voltages
whenever recording, which may not be correct if they are using a mic
that doesn't need bias.
The best option I think would be to drop this from DT, but I don't feel
like fighting that battle right now.
^ permalink raw reply
* Re: [PATCH v5 1/5] dt-bindings: define vendor prefix for Wi2Wi, Inc.
From: Andreas Färber @ 2017-12-01 14:44 UTC (permalink / raw)
To: H. Nikolaus Schaller, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren, Russell King, Arnd Bergmann,
Greg Kroah-Hartman, Kevin Hilman, Thierry Reding,
Jonathan Cameron
Cc: devicetree, linux-kernel, linux-omap, letux-kernel, kernel,
linux-arm-kernel
In-Reply-To: <876647948fceb763a0b584b70c3805dec562072e.1512114576.git.hns@goldelico.com>
Hi,
Am 01.12.2017 um 08:49 schrieb H. Nikolaus Schaller:
> Introduce vendor prefix for Wi2Wi, Inc. for W2SG00x4 GPS modules
> and W2CBW003 Bluetooth/WiFi combo (CSR/Marvell).
If there's more iterations, maybe you could clarify what the company
does overall (just these 2?) vs. what specifically you add it for here?
>
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> Acked-by: Rob Herring <robh@kernel.org>
> ---
> Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
> 1 file changed, 1 insertion(+)
Other than that,
Reviewed-by: Andreas Färber <afaerber@suse.de>
Regards,
Andreas
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
^ permalink raw reply
* Re: [alsa-devel] [PATCH v5 13/13] ASoC: stm32: add DFSDM DAI support
From: kbuild test robot @ 2017-12-01 14:41 UTC (permalink / raw)
Cc: kbuild-all-JC7UmRfGjtg, Rob Herring, Mark Rutland,
Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Jaroslav Kysela, Takashi Iwai,
Liam Girdwood, Mark Brown, devicetree-u79uwXL29TY76Z2rM5mHXA,
alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Alexandre Torgue,
linux-iio-u79uwXL29TY76Z2rM5mHXA, arnaud.pouliquen-qxv4g6HH51o,
Maxime Coquelin,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <1511881557-28596-14-git-send-email-arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 7495 bytes --]
Hi Arnaud,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on iio/togreg]
[also build test WARNING on v4.15-rc1 next-20171201]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Arnaud-Pouliquen/Add-STM32-DFSDM-support/20171201-215409
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: blackfin-allyesconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=blackfin
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:329:0,
from include/linux/kernel.h:13,
from include/linux/clk.h:16,
from sound/soc//stm/stm32_adfsdm.c:23:
sound/soc//stm/stm32_adfsdm.c: In function 'stm32_afsdm_pcm_cb':
>> sound/soc//stm/stm32_adfsdm.c:173:20: warning: format '%d' expects argument of type 'int', but argument 7 has type 'size_t {aka long unsigned int}' [-Wformat=]
dev_dbg(rtd->dev, "%s: buff_add :%p, pos = %d, size = %d\n",
^
include/linux/dynamic_debug.h:134:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^~~
>> sound/soc//stm/stm32_adfsdm.c:173:2: note: in expansion of macro 'dev_dbg'
dev_dbg(rtd->dev, "%s: buff_add :%p, pos = %d, size = %d\n",
^~~~~~~
vim +/dev_dbg +173 sound/soc//stm/stm32_adfsdm.c
> 23 #include <linux/clk.h>
24 #include <linux/module.h>
25 #include <linux/platform_device.h>
26 #include <linux/slab.h>
27
28 #include <linux/iio/iio.h>
29 #include <linux/iio/consumer.h>
30 #include <linux/iio/adc/stm32-dfsdm-adc.h>
31
32 #include <sound/pcm.h>
33 #include <sound/soc.h>
34
35 #define STM32_ADFSDM_DRV_NAME "stm32-adfsdm"
36
37 #define DFSDM_MAX_PERIOD_SIZE (PAGE_SIZE / 2)
38 #define DFSDM_MAX_PERIODS 6
39
40 struct stm32_adfsdm_priv {
41 struct snd_soc_dai_driver dai_drv;
42 struct snd_pcm_substream *substream;
43 struct device *dev;
44
45 /* IIO */
46 struct iio_channel *iio_ch;
47 struct iio_cb_buffer *iio_cb;
48 bool iio_active;
49
50 /* PCM buffer */
51 unsigned char *pcm_buff;
52 unsigned int pos;
53 bool allocated;
54 };
55
56 struct stm32_adfsdm_data {
57 unsigned int rate; /* SNDRV_PCM_RATE value */
58 unsigned int freq; /* frequency in Hz */
59 };
60
61 static const struct snd_pcm_hardware stm32_adfsdm_pcm_hw = {
62 .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
63 SNDRV_PCM_INFO_PAUSE,
64 .formats = SNDRV_PCM_FMTBIT_S32_LE,
65
66 .rate_min = 8000,
67 .rate_max = 32000,
68
69 .channels_min = 1,
70 .channels_max = 1,
71
72 .periods_min = 2,
73 .periods_max = DFSDM_MAX_PERIODS,
74
75 .period_bytes_max = DFSDM_MAX_PERIOD_SIZE,
76 .buffer_bytes_max = DFSDM_MAX_PERIODS * DFSDM_MAX_PERIOD_SIZE
77 };
78
79 static void stm32_adfsdm_shutdown(struct snd_pcm_substream *substream,
80 struct snd_soc_dai *dai)
81 {
82 struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai);
83
84 if (priv->iio_active) {
85 iio_channel_stop_all_cb(priv->iio_cb);
86 priv->iio_active = false;
87 }
88 }
89
90 static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream,
91 struct snd_soc_dai *dai)
92 {
93 struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai);
94 int ret;
95
96 ret = iio_write_channel_attribute(priv->iio_ch,
97 substream->runtime->rate, 0,
98 IIO_CHAN_INFO_SAMP_FREQ);
99 if (ret < 0) {
100 dev_err(dai->dev, "%s: Failed to set %d sampling rate\n",
101 __func__, substream->runtime->rate);
102 return ret;
103 }
104
105 if (!priv->iio_active) {
106 ret = iio_channel_start_all_cb(priv->iio_cb);
107 if (!ret)
108 priv->iio_active = true;
109 else
110 dev_err(dai->dev, "%s: IIO channel start failed (%d)\n",
111 __func__, ret);
112 }
113
114 return ret;
115 }
116
117 static int stm32_adfsdm_set_sysclk(struct snd_soc_dai *dai, int clk_id,
118 unsigned int freq, int dir)
119 {
120 struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai);
121 ssize_t size;
122
123 dev_dbg(dai->dev, "%s: Enter for freq %d\n", __func__, freq);
124
125 /* Set IIO frequency if CODEC is master as clock comes from SPI_IN*/
126 if (dir == SND_SOC_CLOCK_IN) {
127 char str_freq[10];
128
129 snprintf(str_freq, sizeof(str_freq), "%d\n", freq);
130 size = iio_write_channel_ext_info(priv->iio_ch, "spi_clk_freq",
131 str_freq, sizeof(str_freq));
132 if (size != sizeof(str_freq)) {
133 dev_err(dai->dev, "%s: Failed to set SPI clock\n",
134 __func__);
135 return -EINVAL;
136 }
137 }
138 return 0;
139 }
140
141 static const struct snd_soc_dai_ops stm32_adfsdm_dai_ops = {
142 .shutdown = stm32_adfsdm_shutdown,
143 .prepare = stm32_adfsdm_dai_prepare,
144 .set_sysclk = stm32_adfsdm_set_sysclk,
145 };
146
147 static const struct snd_soc_dai_driver stm32_adfsdm_dai = {
148 .capture = {
149 .channels_min = 1,
150 .channels_max = 1,
151 .formats = SNDRV_PCM_FMTBIT_S32_LE,
152 .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |
153 SNDRV_PCM_RATE_32000),
154 },
155 .ops = &stm32_adfsdm_dai_ops,
156 };
157
158 static const struct snd_soc_component_driver stm32_adfsdm_dai_component = {
159 .name = "stm32_dfsdm_audio",
160 };
161
162 static int stm32_afsdm_pcm_cb(const void *data, size_t size, void *private)
163 {
164 struct stm32_adfsdm_priv *priv = private;
165 struct snd_soc_pcm_runtime *rtd = priv->substream->private_data;
166 u8 *pcm_buff = priv->pcm_buff;
167 u8 *src_buff = (u8 *)data;
168 unsigned int buff_size = snd_pcm_lib_buffer_bytes(priv->substream);
169 unsigned int period_size = snd_pcm_lib_period_bytes(priv->substream);
170 unsigned int old_pos = priv->pos;
171 unsigned int cur_size = size;
172
> 173 dev_dbg(rtd->dev, "%s: buff_add :%p, pos = %d, size = %d\n",
174 __func__, &pcm_buff[priv->pos], priv->pos, size);
175
176 if ((priv->pos + size) > buff_size) {
177 memcpy(&pcm_buff[priv->pos], src_buff, buff_size - priv->pos);
178 cur_size -= buff_size - priv->pos;
179 priv->pos = 0;
180 }
181
182 memcpy(&pcm_buff[priv->pos], &src_buff[size - cur_size], cur_size);
183 priv->pos = (priv->pos + cur_size) % buff_size;
184
185 if (cur_size != size || (old_pos && (old_pos % period_size < size)))
186 snd_pcm_period_elapsed(priv->substream);
187
188 return 0;
189 }
190
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 46104 bytes --]
^ permalink raw reply
* Re: [alsa-devel] [PATCH v5 04/13] IIO: inkern: API for manipulating channel attributes
From: kbuild test robot @ 2017-12-01 14:41 UTC (permalink / raw)
Cc: kbuild-all-JC7UmRfGjtg, Rob Herring, Mark Rutland,
Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Jaroslav Kysela, Takashi Iwai,
Liam Girdwood, Mark Brown, devicetree-u79uwXL29TY76Z2rM5mHXA,
alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Alexandre Torgue,
linux-iio-u79uwXL29TY76Z2rM5mHXA, arnaud.pouliquen-qxv4g6HH51o,
Maxime Coquelin,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <1511881557-28596-5-git-send-email-arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2102 bytes --]
Hi Arnaud,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on iio/togreg]
[also build test WARNING on v4.15-rc1 next-20171201]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Arnaud-Pouliquen/Add-STM32-DFSDM-support/20171201-215409
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All warnings (new ones prefixed by >>):
In file included from drivers/iio//adc/envelope-detector.c:38:0:
>> include/linux/iio/consumer.h:228:20: warning: 'enum iio_chan_info_enum' declared inside parameter list
int val2, enum iio_chan_info_enum attribute);
^
>> include/linux/iio/consumer.h:228:20: warning: its scope is only this definition or declaration, which is probably not what you want
include/linux/iio/consumer.h:242:27: warning: 'enum iio_chan_info_enum' declared inside parameter list
int *val2, enum iio_chan_info_enum attribute);
^
vim +228 include/linux/iio/consumer.h
217
218 /**
219 * iio_write_channel_attribute() - Write values to the device attribute.
220 * @chan: The channel being queried.
221 * @val: Value being written.
222 * @val2: Value being written.val2 use depends on attribute type.
223 * @attribute: info attribute to be read.
224 *
225 * Returns an error code or 0.
226 */
227 int iio_write_channel_attribute(struct iio_channel *chan, int val,
> 228 int val2, enum iio_chan_info_enum attribute);
229
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 51640 bytes --]
^ permalink raw reply
* Re: [PATCH 2/2] regulator: sc2731: Add regulator driver to support Spreadtrum SC2731 PMIC
From: Mark Brown @ 2017-12-01 14:24 UTC (permalink / raw)
To: Philippe Ombredanne
Cc: Erick Chen, Rob Herring, Mark Rutland,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, LKML,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
baolin.wang-QSEj5FYQhm4dnm+yROfE0A,
baolin.wang-lxIno14LUO0EEoCn2XhGlw, Linus Torvalds,
Greg Kroah-Hartman, Thomas Gleixner
In-Reply-To: <CAOFm3uHsT8PTZL0tQ0E+7Bje9C8ZUcPd13qz9v6jZHzqEoXqKQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1793 bytes --]
On Fri, Dec 01, 2017 at 02:39:42PM +0100, Philippe Ombredanne wrote:
> On Fri, Dec 1, 2017 at 1:49 PM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> >> or at least this with the id on the first and the // comment style
> >> > +// SPDX-License-Identifier: GPL-2.0
I snipped a bit of context here, the full example was actually:
| > +// SPDX-License-Identifier: GPL-2.0
| > +/*
| > + * Copyright (C) 2017 Spreadtrum Communications Inc.
| > + *
> > Are you saying SPDX requires C++ style comments? That seems totally
> > broken.
> In can understand your point, but for reference please check Linus
> [1][2][3], Thomas[4] and Greg[5] comments on the topic.
> I am just a lowly messenger and even though I personally agree with
> Linus points and taste in this area, my weightless voice does not
> matter.
OK, so that's not quite what you were saying then. The desire is to
have the SPDX block be the first line of the file (which you didn't
mention) and in general to encourage the use of C++ comments. The
second example you gave there with the C++ comment followed immediately
by a C comment is definitely bogus. If this is going to be the standard
we probably need tooling to enforce it, it's an extra requirement
compared to both cross project SPDX needs and existing Linux practice so
it's going to be really easy to end up with different things.
I have to say I'd have thought that if we were going to have a fixed
format for ease of parsing we'd be putting it at the end of files where
we already often have a block of very regularly formatted MODULE_FOO()
lines (not that that's 100% regular but it's more common than not) but
it doesn't make much difference and we've already got a large number of
these SPDX things done so it's a bit of a done deal.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Re: [PATCH v1 2/2] drm/tinydrm: add driver for ILI9225 panels
From: Linus Walleij @ 2017-12-01 14:03 UTC (permalink / raw)
To: David Lechner, Stefano Babic
Cc: open list:DRM PANEL DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Mark Rutland, Rob Herring, linux-kernel@vger.kernel.org
In-Reply-To: <1510113136-6788-3-git-send-email-david@lechnology.com>
On Wed, Nov 8, 2017 at 4:52 AM, David Lechner <david@lechnology.com> wrote:
> This adds a new driver for display panels based on the Ilitek ILI9225
> controller.
>
> This was developed for a no-name panel with a red PCB that is commonly
> marketed for Arduino. See <https://github.com/Nkawu/TFT_22_ILI9225>.
>
> I really did try very hard to find a make and model for this panel, but
> there doesn't seem to be one, so the best I can do is offer the picture
> in the link above for identification.
>
> Signed-off-by: David Lechner <david@lechnology.com>
Can you explain why tinydrm is not putting its panel drivers in
drivers/gpu/drm/panel?
I guess everybody knows except me, it's usually like that :(
I am anyways working on a driver for Ilitek 9322 that I want
to land in drivers/gpu/drm/panel. Here is the last iteration:
https://lists.freedesktop.org/archives/dri-devel/2017-August/150205.html
Yeah I got sidetracked. OK I will get to it now.
There are some similarities with the code I'm seeing here
but I believe they are essentially different. But it will be hard
to share code if you put the driver in the tinydrm framework.
I guess you have also seen:
drivers/video/backlight/ili922x.c
?
Stefano Babic who wrote the backlight driver is available for
reviewing, so includ him in follow-ups (added to To: line).
I'm putting you on CC as I'm rewriting it a bit after the DT
maintainers review, will try to repost ASAP.
Yours,
Linus Walleij
^ permalink raw reply
* Re: [PATCH v2 1/4] dt-bindings: Add vendor prefix for ilitek
From: Linus Walleij @ 2017-12-01 13:53 UTC (permalink / raw)
To: David Lechner
Cc: open list:DRM PANEL DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Mark Rutland, Rob Herring,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <1511122328-31133-2-git-send-email-david-nq/r/kbU++upp/zk7JDF2g@public.gmane.org>
On Sun, Nov 19, 2017 at 9:12 PM, David Lechner <david-nq/r/kbU++upp/zk7JDF2g@public.gmane.org> wrote:
> This adds the vendor prefix ilitek for ILI Technology Corporation (ILITEK).
>
> This prefix is already used several places and I will be adding more.
>
> Signed-off-by: David Lechner <david-nq/r/kbU++upp/zk7JDF2g@public.gmane.org>
> ---
>
> v2 changes:
> * New patch in v2
Curiously I sent a patch like this, it was ACKed and I just
haven't got around to pushing this one.
https://lists.freedesktop.org/archives/dri-devel/2017-August/150203.html
Now I don't have to.
Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Hm I need to respin my patches.
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH net-next v4 2/2] net: ethernet: socionext: add AVE ethernet driver
From: Andrew Lunn @ 2017-12-01 13:49 UTC (permalink / raw)
To: Kunihiko Hayashi
Cc: netdev, Florian Fainelli, Rob Herring, Mark Rutland,
linux-arm-kernel, linux-kernel, devicetree, Masahiro Yamada,
Masami Hiramatsu, Jassi Brar
In-Reply-To: <1512090230-27594-3-git-send-email-hayashi.kunihiko@socionext.com>
On Fri, Dec 01, 2017 at 10:03:50AM +0900, Kunihiko Hayashi wrote:
> The UniPhier platform from Socionext provides the AVE ethernet
> controller that includes MAC and MDIO bus supporting RGMII/RMII
> modes. The controller is named AVE.
>
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Hi Kunihiko
I reviewed the PHY and MDIO code. It all looks good. I cannot say much
about the rest of it though.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply
* [PATCH v4 10/10] ARM: dtsi: axp81x: set pinmux for GPIO0/1 when used as LDOs
From: Quentin Schulz @ 2017-12-01 13:44 UTC (permalink / raw)
To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
wens-jdAy2FN1RRM, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
lee.jones-QSEj5FYQhm4dnm+yROfE0A
Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Quentin Schulz
In-Reply-To: <cover.3ff63fdf302c6bda02ea7d160ad2aa5afee0899d.1512135804.git-series.quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
On AXP813/818, GPIO0 and GPIO1 can be used as LDO as (respectively)
ldo_io0 and ldo_io1.
Let's add the pinctrl properties to the said regulators.
Signed-off-by: Quentin Schulz <quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
arch/arm/boot/dts/axp81x.dtsi | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/arm/boot/dts/axp81x.dtsi b/arch/arm/boot/dts/axp81x.dtsi
index 0ef959d..fd55b89 100644
--- a/arch/arm/boot/dts/axp81x.dtsi
+++ b/arch/arm/boot/dts/axp81x.dtsi
@@ -52,6 +52,16 @@
compatible = "x-powers,axp813-gpio";
gpio-controller;
#gpio-cells = <2>;
+
+ gpio0_ldo: gpio0-ldo {
+ pins = "GPIO0";
+ function = "ldo";
+ };
+
+ gpio1_ldo: gpio1-ldo {
+ pins = "GPIO1";
+ function = "ldo";
+ };
};
regulators {
@@ -119,11 +129,15 @@
};
reg_ldo_io0: ldo-io0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&gpio0_ldo>;
/* Disable by default to avoid conflicts with GPIO */
status = "disabled";
};
reg_ldo_io1: ldo-io1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&gpio1_ldo>;
/* Disable by default to avoid conflicts with GPIO */
status = "disabled";
};
--
git-series 0.9.1
^ permalink raw reply related
* [PATCH v4 09/10] ARM: dtsi: axp81x: add GPIO DT node
From: Quentin Schulz @ 2017-12-01 13:44 UTC (permalink / raw)
To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
wens-jdAy2FN1RRM, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
lee.jones-QSEj5FYQhm4dnm+yROfE0A
Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Quentin Schulz
In-Reply-To: <cover.3ff63fdf302c6bda02ea7d160ad2aa5afee0899d.1512135804.git-series.quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
This adds DT node for the GPIO/pinctrl part present in AXP813/AXP818.
Signed-off-by: Quentin Schulz <quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
arch/arm/boot/dts/axp81x.dtsi | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm/boot/dts/axp81x.dtsi b/arch/arm/boot/dts/axp81x.dtsi
index 73b761f..0ef959d 100644
--- a/arch/arm/boot/dts/axp81x.dtsi
+++ b/arch/arm/boot/dts/axp81x.dtsi
@@ -48,6 +48,12 @@
interrupt-controller;
#interrupt-cells = <1>;
+ axp_gpio: axp-gpio {
+ compatible = "x-powers,axp813-gpio";
+ gpio-controller;
+ #gpio-cells = <2>;
+ };
+
regulators {
/* Default work frequency for buck regulators */
x-powers,dcdc-freq = <3000>;
--
git-series 0.9.1
^ permalink raw reply related
* [PATCH v4 08/10] mfd: axp20x: add pinctrl cell for AXP813
From: Quentin Schulz @ 2017-12-01 13:44 UTC (permalink / raw)
To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
wens-jdAy2FN1RRM, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
lee.jones-QSEj5FYQhm4dnm+yROfE0A
Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Quentin Schulz
In-Reply-To: <cover.3ff63fdf302c6bda02ea7d160ad2aa5afee0899d.1512135804.git-series.quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
As GPIO/pinctrl driver now supports AXP813, add a cell for it.
Signed-off-by: Quentin Schulz <quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
drivers/mfd/axp20x.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 2468b43..d8c92fb 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -878,6 +878,9 @@ static struct mfd_cell axp813_cells[] = {
.resources = axp803_pek_resources,
}, {
.name = "axp20x-regulator",
+ }, {
+ .name = "axp20x-gpio",
+ .of_compatible = "x-powers,axp813-gpio",
}
};
--
git-series 0.9.1
^ permalink raw reply related
* [PATCH v4 07/10] pinctrl: axp209: add support for AXP813 GPIOs
From: Quentin Schulz @ 2017-12-01 13:44 UTC (permalink / raw)
To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
wens-jdAy2FN1RRM, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
lee.jones-QSEj5FYQhm4dnm+yROfE0A
Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Quentin Schulz
In-Reply-To: <cover.3ff63fdf302c6bda02ea7d160ad2aa5afee0899d.1512135804.git-series.quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
The AXP813 has only two GPIOs. GPIO0 can either be used as a GPIO, an
LDO regulator or an ADC. GPIO1 can be used either as a GPIO or an LDO
regulator.
Moreover, the status bit of the GPIOs when in input mode is not offset
by 4 unlike the AXP209.
Signed-off-by: Quentin Schulz <quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
Documentation/devicetree/bindings/gpio/gpio-axp209.txt | 13 +++-
drivers/pinctrl/pinctrl-axp209.c | 35 ++++++++---
2 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
index 4705020..1bbf7ab 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
@@ -4,7 +4,9 @@ This driver follows the usual GPIO bindings found in
Documentation/devicetree/bindings/gpio/gpio.txt
Required properties:
-- compatible: Should be "x-powers,axp209-gpio"
+- compatible: Should be one of:
+ - "x-powers,axp209-gpio"
+ - "x-powers,axp813-gpio"
- #gpio-cells: Should be two. The first cell is the pin number and the
second is the GPIO flags.
- gpio-controller: Marks the device node as a GPIO controller.
@@ -49,8 +51,17 @@ Example:
GPIOs and their functions
-------------------------
+axp209
+------
GPIO | Functions
------------------------
GPIO0 | gpio_in, gpio_out, ldo, adc
GPIO1 | gpio_in, gpio_out, ldo, adc
GPIO2 | gpio_in, gpio_out
+
+axp813
+------
+GPIO | Functions
+------------------------
+GPIO0 | gpio_in, gpio_out, ldo, adc
+GPIO1 | gpio_in, gpio_out, ldo
diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index 504e96c..5f1278f 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -19,6 +19,7 @@
#include <linux/mfd/axp20x.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_device.h>
#include <linux/pinctrl/pinconf-generic.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h>
@@ -41,6 +42,8 @@
#define AXP20X_MUX_GPIO_IN BIT(1)
#define AXP20X_MUX_ADC BIT(2)
+#define AXP813_MUX_ADC (BIT(2) | BIT(0))
+
struct axp20x_pctrl_desc {
const struct pinctrl_pin_desc *pins;
unsigned int npins;
@@ -74,6 +77,11 @@ static const struct pinctrl_pin_desc axp209_pins[] = {
PINCTRL_PIN(2, "GPIO2"),
};
+static const struct pinctrl_pin_desc axp813_pins[] = {
+ PINCTRL_PIN(0, "GPIO0"),
+ PINCTRL_PIN(1, "GPIO1"),
+};
+
static const struct axp20x_pctrl_desc axp20x_data = {
.pins = axp209_pins,
.npins = ARRAY_SIZE(axp209_pins),
@@ -83,6 +91,15 @@ static const struct axp20x_pctrl_desc axp20x_data = {
.adc_mux = AXP20X_MUX_ADC,
};
+static const struct axp20x_pctrl_desc axp813_data = {
+ .pins = axp813_pins,
+ .npins = ARRAY_SIZE(axp813_pins),
+ .ldo_mask = BIT(0) | BIT(1),
+ .adc_mask = BIT(0),
+ .gpio_status_offset = 0,
+ .adc_mux = AXP813_MUX_ADC,
+};
+
static int axp20x_gpio_get_reg(unsigned offset)
{
switch (offset) {
@@ -358,10 +375,18 @@ static void axp20x_build_funcs_groups(struct platform_device *pdev)
pctl->desc->pins);
}
+static const struct of_device_id axp20x_pctl_match[] = {
+ { .compatible = "x-powers,axp209-gpio", .data = &axp20x_data, },
+ { .compatible = "x-powers,axp813-gpio", .data = &axp813_data, },
+ { }
+};
+MODULE_DEVICE_TABLE(of, axp20x_pctl_match);
+
static int axp20x_pctl_probe(struct platform_device *pdev)
{
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
struct axp20x_pctl *pctl;
+ struct device *dev = &pdev->dev;
struct pinctrl_desc *pctrl_desc;
int ret;
@@ -389,9 +414,9 @@ static int axp20x_pctl_probe(struct platform_device *pdev)
pctl->chip.set = axp20x_gpio_set;
pctl->chip.direction_input = axp20x_gpio_input;
pctl->chip.direction_output = axp20x_gpio_output;
- pctl->chip.ngpio = 3;
+ pctl->chip.ngpio = pctl->desc->npins;
- pctl->desc = &axp20x_data;
+ pctl->desc = (struct axp20x_pctrl_desc *)of_device_get_match_data(dev);
pctl->regmap = axp20x->regmap;
pctl->dev = &pdev->dev;
@@ -436,12 +461,6 @@ static int axp20x_pctl_probe(struct platform_device *pdev)
return 0;
}
-static const struct of_device_id axp20x_pctl_match[] = {
- { .compatible = "x-powers,axp209-gpio" },
- { }
-};
-MODULE_DEVICE_TABLE(of, axp20x_pctl_match);
-
static struct platform_driver axp20x_pctl_driver = {
.probe = axp20x_pctl_probe,
.driver = {
--
git-series 0.9.1
^ permalink raw reply related
* [PATCH v4 06/10] pinctrl: axp209: add programmable ADC muxing value
From: Quentin Schulz @ 2017-12-01 13:44 UTC (permalink / raw)
To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
wens-jdAy2FN1RRM, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
lee.jones-QSEj5FYQhm4dnm+yROfE0A
Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Quentin Schulz
In-Reply-To: <cover.3ff63fdf302c6bda02ea7d160ad2aa5afee0899d.1512135804.git-series.quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To prepare for patches that will add support for a new PMIC that has a
different GPIO adc muxing value, add an adc_mux within axp20x_pctl
structure and use it.
Signed-off-by: Quentin Schulz <quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
drivers/pinctrl/pinctrl-axp209.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index 3fae81f..504e96c 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -49,6 +49,7 @@ struct axp20x_pctrl_desc {
/* Stores the pins supporting ADC function. Bit offset is pin number. */
u8 adc_mask;
u8 gpio_status_offset;
+ u8 adc_mux;
};
struct axp20x_pinctrl_function {
@@ -79,6 +80,7 @@ static const struct axp20x_pctrl_desc axp20x_data = {
.ldo_mask = BIT(0) | BIT(1),
.adc_mask = BIT(0) | BIT(1),
.gpio_status_offset = 4,
+ .adc_mux = AXP20X_MUX_ADC,
};
static int axp20x_gpio_get_reg(unsigned offset)
@@ -333,7 +335,7 @@ static void axp20x_build_funcs_groups(struct platform_device *pdev)
* See comment in axp20x_pmx_set_mux.
*/
pctl->funcs[AXP20X_FUNC_ADC].name = "adc";
- pctl->funcs[AXP20X_FUNC_ADC].muxval = AXP20X_MUX_ADC;
+ pctl->funcs[AXP20X_FUNC_ADC].muxval = pctl->desc->adc_mux;
/* Every pin supports GPIO_OUT and GPIO_IN functions */
for (i = 0; i <= AXP20X_FUNC_GPIO_IN; i++) {
--
git-series 0.9.1
^ permalink raw reply related
* [PATCH v4 05/10] pinctrl: axp209: add programmable gpio_status_offset
From: Quentin Schulz @ 2017-12-01 13:44 UTC (permalink / raw)
To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
wens-jdAy2FN1RRM, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
lee.jones-QSEj5FYQhm4dnm+yROfE0A
Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Quentin Schulz
In-Reply-To: <cover.3ff63fdf302c6bda02ea7d160ad2aa5afee0899d.1512135804.git-series.quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To prepare for patches that will add support for a new PMIC that has a
different GPIO input status register, add a gpio_status_offset within
axp20x_pctl structure and use it.
Signed-off-by: Quentin Schulz <quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Acked-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
drivers/pinctrl/pinctrl-axp209.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index 6201d2b..3fae81f 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -48,6 +48,7 @@ struct axp20x_pctrl_desc {
u8 ldo_mask;
/* Stores the pins supporting ADC function. Bit offset is pin number. */
u8 adc_mask;
+ u8 gpio_status_offset;
};
struct axp20x_pinctrl_function {
@@ -77,6 +78,7 @@ static const struct axp20x_pctrl_desc axp20x_data = {
.npins = ARRAY_SIZE(axp209_pins),
.ldo_mask = BIT(0) | BIT(1),
.adc_mask = BIT(0) | BIT(1),
+ .gpio_status_offset = 4,
};
static int axp20x_gpio_get_reg(unsigned offset)
@@ -108,7 +110,7 @@ static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset)
if (ret)
return ret;
- return !!(val & BIT(offset + 4));
+ return !!(val & BIT(offset + pctl->desc->gpio_status_offset));
}
static int axp20x_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
--
git-series 0.9.1
^ permalink raw reply related
* [PATCH v4 04/10] pinctrl: axp209: rename everything from gpio to pctl
From: Quentin Schulz @ 2017-12-01 13:44 UTC (permalink / raw)
To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
wens-jdAy2FN1RRM, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
lee.jones-QSEj5FYQhm4dnm+yROfE0A
Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Quentin Schulz
In-Reply-To: <cover.3ff63fdf302c6bda02ea7d160ad2aa5afee0899d.1512135804.git-series.quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
This driver used to do only GPIO features of the GPIOs in X-Powers
AXP20X. Now that we have migrated everything to the pinctrl subsystem
and added pinctrl features, rename everything related to pinctrl from
gpio to pctl to ease the understanding of differences between GPIO
and pinctrl features.
Signed-off-by: Quentin Schulz <quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
drivers/pinctrl/pinctrl-axp209.c | 180 ++++++++++++++++----------------
1 file changed, 90 insertions(+), 90 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index 2dc286f..6201d2b 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -57,7 +57,7 @@ struct axp20x_pinctrl_function {
unsigned int ngroups;
};
-struct axp20x_gpio {
+struct axp20x_pctl {
struct gpio_chip chip;
struct regmap *regmap;
struct pinctrl_dev *pctl_dev;
@@ -100,11 +100,11 @@ static int axp20x_gpio_input(struct gpio_chip *chip, unsigned offset)
static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset)
{
- struct axp20x_gpio *gpio = gpiochip_get_data(chip);
+ struct axp20x_pctl *pctl = gpiochip_get_data(chip);
unsigned int val;
int ret;
- ret = regmap_read(gpio->regmap, AXP20X_GPIO20_SS, &val);
+ ret = regmap_read(pctl->regmap, AXP20X_GPIO20_SS, &val);
if (ret)
return ret;
@@ -113,7 +113,7 @@ static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset)
static int axp20x_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
{
- struct axp20x_gpio *gpio = gpiochip_get_data(chip);
+ struct axp20x_pctl *pctl = gpiochip_get_data(chip);
unsigned int val;
int reg, ret;
@@ -121,7 +121,7 @@ static int axp20x_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
if (reg < 0)
return reg;
- ret = regmap_read(gpio->regmap, reg, &val);
+ ret = regmap_read(pctl->regmap, reg, &val);
if (ret)
return ret;
@@ -151,14 +151,14 @@ static int axp20x_gpio_output(struct gpio_chip *chip, unsigned offset,
static void axp20x_gpio_set(struct gpio_chip *chip, unsigned offset,
int value)
{
- struct axp20x_gpio *gpio = gpiochip_get_data(chip);
+ struct axp20x_pctl *pctl = gpiochip_get_data(chip);
int reg;
reg = axp20x_gpio_get_reg(offset);
if (reg < 0)
return;
- regmap_update_bits(gpio->regmap, reg,
+ regmap_update_bits(pctl->regmap, reg,
AXP20X_GPIO_FUNCTIONS,
value ? AXP20X_GPIO_FUNCTION_OUT_HIGH :
AXP20X_GPIO_FUNCTION_OUT_LOW);
@@ -167,30 +167,30 @@ static void axp20x_gpio_set(struct gpio_chip *chip, unsigned offset,
static int axp20x_pmx_set(struct pinctrl_dev *pctldev, unsigned int offset,
u8 config)
{
- struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+ struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
int reg;
reg = axp20x_gpio_get_reg(offset);
if (reg < 0)
return reg;
- return regmap_update_bits(gpio->regmap, reg, AXP20X_GPIO_FUNCTIONS,
+ return regmap_update_bits(pctl->regmap, reg, AXP20X_GPIO_FUNCTIONS,
config);
}
static int axp20x_pmx_func_cnt(struct pinctrl_dev *pctldev)
{
- struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+ struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
- return ARRAY_SIZE(gpio->funcs);
+ return ARRAY_SIZE(pctl->funcs);
}
static const char *axp20x_pmx_func_name(struct pinctrl_dev *pctldev,
unsigned int selector)
{
- struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+ struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
- return gpio->funcs[selector].name;
+ return pctl->funcs[selector].name;
}
static int axp20x_pmx_func_groups(struct pinctrl_dev *pctldev,
@@ -198,10 +198,10 @@ static int axp20x_pmx_func_groups(struct pinctrl_dev *pctldev,
const char * const **groups,
unsigned int *num_groups)
{
- struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+ struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
- *groups = gpio->funcs[selector].groups;
- *num_groups = gpio->funcs[selector].ngroups;
+ *groups = pctl->funcs[selector].groups;
+ *num_groups = pctl->funcs[selector].ngroups;
return 0;
}
@@ -209,18 +209,18 @@ static int axp20x_pmx_func_groups(struct pinctrl_dev *pctldev,
static int axp20x_pmx_set_mux(struct pinctrl_dev *pctldev,
unsigned int function, unsigned int group)
{
- struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+ struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
unsigned int mask;
/* Every pin supports GPIO_OUT and GPIO_IN functions */
if (function <= AXP20X_FUNC_GPIO_IN)
return axp20x_pmx_set(pctldev, group,
- gpio->funcs[function].muxval);
+ pctl->funcs[function].muxval);
if (function == AXP20X_FUNC_LDO)
- mask = gpio->desc->ldo_mask;
+ mask = pctl->desc->ldo_mask;
else
- mask = gpio->desc->adc_mask;
+ mask = pctl->desc->adc_mask;
if (!(BIT(group) & mask))
return -EINVAL;
@@ -234,21 +234,21 @@ static int axp20x_pmx_set_mux(struct pinctrl_dev *pctldev,
if (function == AXP20X_FUNC_LDO)
return 0;
- return axp20x_pmx_set(pctldev, group, gpio->funcs[function].muxval);
+ return axp20x_pmx_set(pctldev, group, pctl->funcs[function].muxval);
}
static int axp20x_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range,
unsigned int offset, bool input)
{
- struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+ struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
if (input)
return axp20x_pmx_set(pctldev, offset,
- gpio->funcs[AXP20X_FUNC_GPIO_IN].muxval);
+ pctl->funcs[AXP20X_FUNC_GPIO_IN].muxval);
return axp20x_pmx_set(pctldev, offset,
- gpio->funcs[AXP20X_FUNC_GPIO_OUT].muxval);
+ pctl->funcs[AXP20X_FUNC_GPIO_OUT].muxval);
}
static const struct pinmux_ops axp20x_pmx_ops = {
@@ -262,17 +262,17 @@ static const struct pinmux_ops axp20x_pmx_ops = {
static int axp20x_groups_cnt(struct pinctrl_dev *pctldev)
{
- struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+ struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
- return gpio->desc->npins;
+ return pctl->desc->npins;
}
static int axp20x_group_pins(struct pinctrl_dev *pctldev, unsigned int selector,
const unsigned int **pins, unsigned int *num_pins)
{
- struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+ struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
- *pins = (unsigned int *)&gpio->desc->pins[selector];
+ *pins = (unsigned int *)&pctl->desc->pins[selector];
*num_pins = 1;
return 0;
@@ -281,9 +281,9 @@ static int axp20x_group_pins(struct pinctrl_dev *pctldev, unsigned int selector,
static const char *axp20x_group_name(struct pinctrl_dev *pctldev,
unsigned int selector)
{
- struct axp20x_gpio *gpio = pinctrl_dev_get_drvdata(pctldev);
+ struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
- return gpio->desc->pins[selector].name;
+ return pctl->desc->pins[selector].name;
}
static const struct pinctrl_ops axp20x_pctrl_ops = {
@@ -318,46 +318,46 @@ static void axp20x_funcs_groups_from_mask(struct device *dev, unsigned int mask,
static void axp20x_build_funcs_groups(struct platform_device *pdev)
{
- struct axp20x_gpio *gpio = platform_get_drvdata(pdev);
+ struct axp20x_pctl *pctl = platform_get_drvdata(pdev);
int i, pin;
- gpio->funcs[AXP20X_FUNC_GPIO_OUT].name = "gpio_out";
- gpio->funcs[AXP20X_FUNC_GPIO_OUT].muxval = AXP20X_MUX_GPIO_OUT;
- gpio->funcs[AXP20X_FUNC_GPIO_IN].name = "gpio_in";
- gpio->funcs[AXP20X_FUNC_GPIO_IN].muxval = AXP20X_MUX_GPIO_IN;
- gpio->funcs[AXP20X_FUNC_LDO].name = "ldo";
+ pctl->funcs[AXP20X_FUNC_GPIO_OUT].name = "gpio_out";
+ pctl->funcs[AXP20X_FUNC_GPIO_OUT].muxval = AXP20X_MUX_GPIO_OUT;
+ pctl->funcs[AXP20X_FUNC_GPIO_IN].name = "gpio_in";
+ pctl->funcs[AXP20X_FUNC_GPIO_IN].muxval = AXP20X_MUX_GPIO_IN;
+ pctl->funcs[AXP20X_FUNC_LDO].name = "ldo";
/*
* Muxval for LDO is useless as we won't use it.
* See comment in axp20x_pmx_set_mux.
*/
- gpio->funcs[AXP20X_FUNC_ADC].name = "adc";
- gpio->funcs[AXP20X_FUNC_ADC].muxval = AXP20X_MUX_ADC;
+ pctl->funcs[AXP20X_FUNC_ADC].name = "adc";
+ pctl->funcs[AXP20X_FUNC_ADC].muxval = AXP20X_MUX_ADC;
/* Every pin supports GPIO_OUT and GPIO_IN functions */
for (i = 0; i <= AXP20X_FUNC_GPIO_IN; i++) {
- gpio->funcs[i].ngroups = gpio->desc->npins;
- gpio->funcs[i].groups = devm_kzalloc(&pdev->dev,
- gpio->desc->npins * sizeof(const char *),
+ pctl->funcs[i].ngroups = pctl->desc->npins;
+ pctl->funcs[i].groups = devm_kzalloc(&pdev->dev,
+ pctl->desc->npins * sizeof(const char *),
GFP_KERNEL);
- for (pin = 0; pin < gpio->desc->npins; pin++)
- gpio->funcs[i].groups[pin] = gpio->desc->pins[pin].name;
+ for (pin = 0; pin < pctl->desc->npins; pin++)
+ pctl->funcs[i].groups[pin] = pctl->desc->pins[pin].name;
}
- axp20x_funcs_groups_from_mask(&pdev->dev, gpio->desc->ldo_mask,
- gpio->desc->npins,
- &gpio->funcs[AXP20X_FUNC_LDO],
- gpio->desc->pins);
+ axp20x_funcs_groups_from_mask(&pdev->dev, pctl->desc->ldo_mask,
+ pctl->desc->npins,
+ &pctl->funcs[AXP20X_FUNC_LDO],
+ pctl->desc->pins);
- axp20x_funcs_groups_from_mask(&pdev->dev, gpio->desc->adc_mask,
- gpio->desc->npins,
- &gpio->funcs[AXP20X_FUNC_ADC],
- gpio->desc->pins);
+ axp20x_funcs_groups_from_mask(&pdev->dev, pctl->desc->adc_mask,
+ pctl->desc->npins,
+ &pctl->funcs[AXP20X_FUNC_ADC],
+ pctl->desc->pins);
}
-static int axp20x_gpio_probe(struct platform_device *pdev)
+static int axp20x_pctl_probe(struct platform_device *pdev)
{
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
- struct axp20x_gpio *gpio;
+ struct axp20x_pctl *pctl;
struct pinctrl_desc *pctrl_desc;
int ret;
@@ -369,29 +369,29 @@ static int axp20x_gpio_probe(struct platform_device *pdev)
return -EINVAL;
}
- gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
- if (!gpio)
+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL);
+ if (!pctl)
return -ENOMEM;
- gpio->chip.base = -1;
- gpio->chip.can_sleep = true;
- gpio->chip.request = gpiochip_generic_request;
- gpio->chip.free = gpiochip_generic_free;
- gpio->chip.parent = &pdev->dev;
- gpio->chip.label = dev_name(&pdev->dev);
- gpio->chip.owner = THIS_MODULE;
- gpio->chip.get = axp20x_gpio_get;
- gpio->chip.get_direction = axp20x_gpio_get_direction;
- gpio->chip.set = axp20x_gpio_set;
- gpio->chip.direction_input = axp20x_gpio_input;
- gpio->chip.direction_output = axp20x_gpio_output;
- gpio->chip.ngpio = 3;
-
- gpio->desc = &axp20x_data;
- gpio->regmap = axp20x->regmap;
- gpio->dev = &pdev->dev;
-
- platform_set_drvdata(pdev, gpio);
+ pctl->chip.base = -1;
+ pctl->chip.can_sleep = true;
+ pctl->chip.request = gpiochip_generic_request;
+ pctl->chip.free = gpiochip_generic_free;
+ pctl->chip.parent = &pdev->dev;
+ pctl->chip.label = dev_name(&pdev->dev);
+ pctl->chip.owner = THIS_MODULE;
+ pctl->chip.get = axp20x_gpio_get;
+ pctl->chip.get_direction = axp20x_gpio_get_direction;
+ pctl->chip.set = axp20x_gpio_set;
+ pctl->chip.direction_input = axp20x_gpio_input;
+ pctl->chip.direction_output = axp20x_gpio_output;
+ pctl->chip.ngpio = 3;
+
+ pctl->desc = &axp20x_data;
+ pctl->regmap = axp20x->regmap;
+ pctl->dev = &pdev->dev;
+
+ platform_set_drvdata(pdev, pctl);
axp20x_build_funcs_groups(pdev);
@@ -401,27 +401,27 @@ static int axp20x_gpio_probe(struct platform_device *pdev)
pctrl_desc->name = dev_name(&pdev->dev);
pctrl_desc->owner = THIS_MODULE;
- pctrl_desc->pins = gpio->desc->pins;
- pctrl_desc->npins = gpio->desc->npins;
+ pctrl_desc->pins = pctl->desc->pins;
+ pctrl_desc->npins = pctl->desc->npins;
pctrl_desc->pctlops = &axp20x_pctrl_ops;
pctrl_desc->pmxops = &axp20x_pmx_ops;
- gpio->pctl_dev = devm_pinctrl_register(&pdev->dev, pctrl_desc, gpio);
- if (IS_ERR(gpio->pctl_dev)) {
+ pctl->pctl_dev = devm_pinctrl_register(&pdev->dev, pctrl_desc, pctl);
+ if (IS_ERR(pctl->pctl_dev)) {
dev_err(&pdev->dev, "couldn't register pinctrl driver\n");
- return PTR_ERR(gpio->pctl_dev);
+ return PTR_ERR(pctl->pctl_dev);
}
- ret = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio);
+ ret = devm_gpiochip_add_data(&pdev->dev, &pctl->chip, pctl);
if (ret) {
dev_err(&pdev->dev, "Failed to register GPIO chip\n");
return ret;
}
- ret = gpiochip_add_pin_range(&gpio->chip, dev_name(&pdev->dev),
- gpio->desc->pins->number,
- gpio->desc->pins->number,
- gpio->desc->npins);
+ ret = gpiochip_add_pin_range(&pctl->chip, dev_name(&pdev->dev),
+ pctl->desc->pins->number,
+ pctl->desc->pins->number,
+ pctl->desc->npins);
if (ret) {
dev_err(&pdev->dev, "failed to add pin range\n");
return ret;
@@ -432,21 +432,21 @@ static int axp20x_gpio_probe(struct platform_device *pdev)
return 0;
}
-static const struct of_device_id axp20x_gpio_match[] = {
+static const struct of_device_id axp20x_pctl_match[] = {
{ .compatible = "x-powers,axp209-gpio" },
{ }
};
-MODULE_DEVICE_TABLE(of, axp20x_gpio_match);
+MODULE_DEVICE_TABLE(of, axp20x_pctl_match);
-static struct platform_driver axp20x_gpio_driver = {
- .probe = axp20x_gpio_probe,
+static struct platform_driver axp20x_pctl_driver = {
+ .probe = axp20x_pctl_probe,
.driver = {
.name = "axp20x-gpio",
- .of_match_table = axp20x_gpio_match,
+ .of_match_table = axp20x_pctl_match,
},
};
-module_platform_driver(axp20x_gpio_driver);
+module_platform_driver(axp20x_pctl_driver);
MODULE_AUTHOR("Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>");
MODULE_AUTHOR("Quentin Schulz <quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>");
--
git-series 0.9.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox