Re: [PATCH v2 3/3] [media] mt9v032: Add V4L2 controls for AEC and AGC
Hi Laurent, On Tuesday 29 December 2015 11:38:39 Laurent Pinchart wrote: > Hi Markus, > > On Wednesday 16 December 2015 11:14:28 Markus Pargmann wrote: > > On Wednesday 16 December 2015 09:47:58 Laurent Pinchart wrote: > > > On Monday 14 December 2015 15:41:53 Markus Pargmann wrote: > > >> This patch adds V4L2 controls for Auto Exposure Control and Auto Gain > > >> Control settings. These settings include low pass filter, update > > >> frequency of these settings and the update interval for those units. > > >> > > >> Signed-off-by: Markus Pargmann > > > > > > Please see below for a few comments. If you agree about them there's no > > > need to resubmit, I'll fix the patch when applying. > > > > Most of them are fine, I commented on the open ones. > > > > >> --- > > >> > > >> drivers/media/i2c/mt9v032.c | 153 - > > >> 1 file changed, 152 insertions(+), 1 deletion(-) > > >> > > >> diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c > > >> index cc16acf001de..6cbc3b87eda9 100644 > > >> --- a/drivers/media/i2c/mt9v032.c > > >> +++ b/drivers/media/i2c/mt9v032.c > > [snip] > > > >> +static const struct v4l2_ctrl_config mt9v032_aec_max_shutter_width = { > > >> +.ops= &mt9v032_ctrl_ops, > > >> +.id = V4L2_CID_AEC_MAX_SHUTTER_WIDTH, > > >> +.type = V4L2_CTRL_TYPE_INTEGER, > > >> +.name = "aec_max_shutter_width", > > >> +.min= 1, > > >> +.max= MT9V032_TOTAL_SHUTTER_WIDTH_MAX, > > > > > > According the the MT9V032 datasheet I have, the maximum value is 2047 > > > while MT9V032_TOTAL_SHUTTER_WIDTH_MAX is defined as 32767. Do you have any > > > information that would hint for an error in the datasheet ? > > > > The register is defined as having 15 bits. I simply assumed that the already > > defined TOTAL_SHUTTER_WIDTH_MAX would apply for this register as well. At > > least it should end up controlling the same property of the chip. I didn't > > test this on mt9v032 but on mt9v024. > > According to the MT9V032 datasheet > (http://www.onsemi.com/pub/Collateral/MT9V032-D.PDF) the maximum shutter > width > in AEC mode is limited to 2047. That is documented both in the Maximum Total > Shutter Width register legal values and in the "Automatic Gain Control and > Automatic Exposure Control" section: > > "The exposure is measured in row-time by reading R0xBB. The exposure range is > 1 to 2047." > > I assume that the the AEC unit limits the shutter width to 2047 lines and > that > it's thus pointless to set the maximum total shutter width to a higher value. > Whether doing so could have any adverse effect I don't know, but better be > same than sorry. If you agree we should limit the value to 2047 I can fix > this. Yes, I agree. It would be great if you fix this. Thanks, Markus > > > >> +.step = 1, > > >> +.def= MT9V032_TOTAL_SHUTTER_WIDTH_DEF, > > >> +.flags = 0, > > >> +}; > > >> + > > >> +static const struct v4l2_ctrl_config mt9v034_aec_max_shutter_width = { > > >> +.ops= &mt9v032_ctrl_ops, > > >> +.id = V4L2_CID_AEC_MAX_SHUTTER_WIDTH, > > >> +.type = V4L2_CTRL_TYPE_INTEGER, > > >> +.name = "aec_max_shutter_width", > > >> +.min= 1, > > >> +.max= MT9V034_TOTAL_SHUTTER_WIDTH_MAX, > > >> +.step = 1, > > >> +.def= MT9V032_TOTAL_SHUTTER_WIDTH_DEF, > > >> +.flags = 0, > > >> +}; > > > > > > [snip] > > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: This is a digitally signed message part.
Re: [PATCH v2 3/3] [media] mt9v032: Add V4L2 controls for AEC and AGC
Hi Laurent, On Wednesday 16 December 2015 09:47:58 Laurent Pinchart wrote: > Hi Markus, > > Thank you for the patch. > > On Monday 14 December 2015 15:41:53 Markus Pargmann wrote: > > This patch adds V4L2 controls for Auto Exposure Control and Auto Gain > > Control settings. These settings include low pass filter, update > > frequency of these settings and the update interval for those units. > > > > Signed-off-by: Markus Pargmann > > Please see below for a few comments. If you agree about them there's no need > to resubmit, I'll fix the patch when applying. Most of them are fine, I commented on the open ones. > > > --- > > drivers/media/i2c/mt9v032.c | 153 - > > 1 file changed, 152 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c > > index cc16acf001de..6cbc3b87eda9 100644 > > --- a/drivers/media/i2c/mt9v032.c > > +++ b/drivers/media/i2c/mt9v032.c > > [snip] > > > enum mt9v032_model { > > @@ -162,6 +169,8 @@ struct mt9v032_model_data { > > unsigned int min_shutter; > > unsigned int max_shutter; > > unsigned int pclk_reg; > > + unsigned int aec_max_shutter_reg; > > + const struct v4l2_ctrl_config * const aec_max_shutter_v4l2_ctrl; > > }; > > > > struct mt9v032_model_info { > > @@ -175,6 +184,9 @@ static const struct mt9v032_model_version > > mt9v032_versions[] = { { MT9V034_CHIP_ID_REV1, "MT9V024/MT9V034 rev1" }, > > }; > > > > +static const struct v4l2_ctrl_config mt9v032_aec_max_shutter_width; > > +static const struct v4l2_ctrl_config mt9v034_aec_max_shutter_width; > > We can avoid forward declarations by moving the mt9v032_model_data array > further down in the driver. > > > static const struct mt9v032_model_data mt9v032_model_data[] = { > > { > > /* MT9V022, MT9V032 revisions 1/2/3 */ > > [snip] > > > @@ 647,6 +663,33 @@ static int mt9v032_set_selection(struct v4l2_subdev > > *subdev, */ > > > > #define V4L2_CID_TEST_PATTERN_COLOR(V4L2_CID_USER_BASE | 0x1001) > > +/* > > + * Value between 1 and 64 to set the desired bin. This is effectively a > > measure + * of how bright the image is supposed to be. Both AGC and AEC try > > to reach + * this. > > + */ > > +#define V4L2_CID_AEGC_DESIRED_BIN (V4L2_CID_USER_BASE | 0x1002) > > +/* > > + * LPF is the low pass filter capability of the chip. Both AEC and AGC have > > + * this setting. This limits the speed in which AGC/AEC adjust their > > settings. > > + * Possible values are 0-2. 0 means no LPF. For 1 and 2 this equation is > > used: > > + * if |(Calculated new exp - current exp)| > (current exp / 4) > > + * next exp = Calculated new exp > > + * else > > + * next exp = Current exp + ((Calculated new exp - current > > exp) / > 2^LPF) > > Over 80 columns, you can fix it by just reducing the indentation by one tab. > > > + */ > > +#define V4L2_CID_AEC_LPF (V4L2_CID_USER_BASE | 0x1003) > > +#define V4L2_CID_AGC_LPF (V4L2_CID_USER_BASE | 0x1004) > > +/* > > + * Value between 0 and 15. This is the number of frames being skipped > > before > > + * updating the auto exposure/gain. > > + */ > > +#define V4L2_CID_AEC_UPDATE_INTERVAL (V4L2_CID_USER_BASE | 0x1005) > > +#define V4L2_CID_AGC_UPDATE_INTERVAL (V4L2_CID_USER_BASE | 0x1006) > > +/* > > + * Maximum shutter width used for AEC. > > + */ > > +#define V4L2_CID_AEC_MAX_SHUTTER_WIDTH (V4L2_CID_USER_BASE | 0x1007) > > [snip] > > > @@ -745,6 +810,84 @@ static const struct v4l2_ctrl_config > > mt9v032_test_pattern_color = { .flags = 0, > > }; > > > > +static const struct v4l2_ctrl_config mt9v032_aegc_controls[] = { > > + { > > + .ops= &mt9v032_ctrl_ops, > > + .id = V4L2_CID_AEGC_DESIRED_BIN, > > + .type = V4L2_CTRL_TYPE_INTEGER, > > + .name = "aec_agc_desired_bin", > > I forgot to reply to your e-mail asking what proper controls names would be, > sorry. > > V4L2 control names contain spaces and use uppercase as needed. This one could > be "AEC/AGC Desired Bin" for instance. Ah I see. I was just wondering as v4l2-ctl showed everything with lowercase letters and underscores. But with a closer look it seems something between driver and v4l2-ctl transla
Re: [PATCH v2 1/3] [media] mt9v032: Add reset and standby gpios
Hi, On Monday 14 December 2015 21:26:25 Laurent Pinchart wrote: > Hi Markus, > > Thank you for the patch. > > On Monday 14 December 2015 15:41:51 Markus Pargmann wrote: > > Add optional reset and standby gpios. The reset gpio is used to reset > > the chip in power_on(). > > > > The standby gpio is not used currently. It is just unset, so the chip is > > not in standby. > > > > Signed-off-by: Markus Pargmann > > Reviewed-by: Philipp Zabel > > Acked-by: Rob Herring > > --- > > .../devicetree/bindings/media/i2c/mt9v032.txt | 2 ++ > > drivers/media/i2c/mt9v032.c| 28 +++ > > 2 files changed, 30 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt > > b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt index > > 202565313e82..100f0ae43269 100644 > > --- a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt > > +++ b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt > > @@ -20,6 +20,8 @@ Optional Properties: > > > > - link-frequencies: List of allowed link frequencies in Hz. Each frequency > > is expressed as a 64-bit big-endian integer. > > +- reset-gpios: GPIO handle which is connected to the reset pin of the chip. > > +- standby-gpios: GPIO handle which is connected to the standby pin of the > > chip. > > > > For further reading on port node refer to > > Documentation/devicetree/bindings/media/video-interfaces.txt. > > diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c > > index a68ce94ee097..c1bc564a0979 100644 > > --- a/drivers/media/i2c/mt9v032.c > > +++ b/drivers/media/i2c/mt9v032.c > > @@ -14,6 +14,7 @@ > > > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -251,6 +252,8 @@ struct mt9v032 { > > > > struct regmap *regmap; > > struct clk *clk; > > + struct gpio_desc *reset_gpio; > > + struct gpio_desc *standby_gpio; > > > > struct mt9v032_platform_data *pdata; > > const struct mt9v032_model_info *model; > > @@ -312,16 +315,31 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032) > > struct regmap *map = mt9v032->regmap; > > int ret; > > > > + if (mt9v032->reset_gpio) > > + gpiod_set_value_cansleep(mt9v032->reset_gpio, 1); > > + > > gpiod_set_value_cansleep() already checks whether the gpiod is NULL, you > don't > need to duplicate the check here. > > Apart from that, > > Acked-by: Laurent Pinchart > > No need to resubmit I'll fix this when applying. Ok, thank you. Best Regards, Markus > > > ret = clk_set_rate(mt9v032->clk, mt9v032->sysclk); > > if (ret < 0) > > return ret; > > > > + /* System clock has to be enabled before releasing the reset */ > > ret = clk_prepare_enable(mt9v032->clk); > > if (ret) > > return ret; > > > > udelay(1); > > > > + if (mt9v032->reset_gpio) { > > + gpiod_set_value_cansleep(mt9v032->reset_gpio, 0); > > + > > + /* After releasing reset we need to wait 10 clock cycles > > +* before accessing the sensor over I2C. As the minimum SYSCLK > > +* frequency is 13MHz, waiting 1µs will be enough in the worst > > +* case. > > +*/ > > + udelay(1); > > + } > > + > > /* Reset the chip and stop data read out */ > > ret = regmap_write(map, MT9V032_RESET, 1); > > if (ret < 0) > > @@ -954,6 +972,16 @@ static int mt9v032_probe(struct i2c_client *client, > > if (IS_ERR(mt9v032->clk)) > > return PTR_ERR(mt9v032->clk); > > > > + mt9v032->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", > > + GPIOD_OUT_HIGH); > > + if (IS_ERR(mt9v032->reset_gpio)) > > + return PTR_ERR(mt9v032->reset_gpio); > > + > > + mt9v032->standby_gpio = devm_gpiod_get_optional(&client->dev, "standby", > > + GPIOD_OUT_LOW); > > + if (IS_ERR(mt9v032->standby_gpio)) > > + return PTR_ERR(mt9v032->standby_gpio); > > + > > mutex_init(&mt9v032->power_lock); > > mt9v032->pdata = pdata; > > mt9v032->model = (const void *)did->driver_data; > > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: This is a digitally signed message part.
Re: [PATCH 1/3] Device tree binding documentation for gpio-switch
Hi, On Monday 14 December 2015 09:45:48 Rob Herring wrote: > On Mon, Dec 14, 2015 at 8:28 AM, Linus Walleij > wrote: > > On Fri, Dec 11, 2015 at 3:06 PM, Rob Herring wrote: > >> On Fri, Dec 11, 2015 at 6:39 AM, Linus Walleij > >> wrote: > >>> On Fri, Dec 4, 2015 at 6:31 PM, Martyn Welch > >>> wrote: > > [...] > > >>> Markus Pargmann also did a series that add initial values to > >>> hogs, which is the inverse usecase of this, where you want to > >>> *output* something by default, then maybe also make it available > >>> to userspace. > >>> > >>> So what we need to see here is a patch series that does all of these > >>> things: > >>> > >>> - Name lines > >>> > >>> - Sets them to initial values > >>> > >>> - Mark them as read-only > >>> > >>> - Mark them as "not used by the operating system" so that they > >>> can be default-exported to userspace. > >> > >> No! This should not be a DT property. > >> > >> Whether I want to control a GPIO in the kernel or userspace is not > >> known and can change over time. It could simply depend on kernel > >> config. There is also the case that a GPIO has no connection or kernel > >> driver until some time later when a DT overlay for an expansion board > >> is applied. > > > > That's correct. So from a DT point of view, what really matters is > > to give things a name, and the hogs and initvals syntax already > > has a structure for this that is in use > > (from Documentation/devicetree/bindings/gpio/gpio.txt): > > > > qe_pio_a: gpio-controller@1400 { > > compatible = "fsl,qe-pario-bank-a", "fsl,qe-pario-bank"; > > reg = <0x1400 0x18>; > > gpio-controller; > > #gpio-cells = <2>; > > > > line_b { > > gpio-hog; > > gpios = <6 0>; > > output-low; > > line-name = "foo-bar-gpio"; > > }; > > }; > > > > Markus use this also for initial values. That could easily be used in > > a budget version like this: > > > > line_b { > > /* Just naming */ > > gpios = <6 0>; > > line-name = "foo-bar-gpio"; > > }; > > > > That could grow kind of big though. Or maybe not? How many > > GPIO lines are actually properly named in a typical system? > > We should limit it to GPIOs with no connection to another node. For > example, I don't want to see a SD card detect in the list as that > should be in the SD host node. However, that is hard to enforce and > can change over time. Removing it would break userspace potentially. > Of course if the kernel starts own a signal that userspace used, then > that potentially breaks userspace regardless of the DT changing. OTOH, > using GPIOs in userspace is kind of use at your own risk. I see this a bit differently. I would really like to see the each GPIO having two different names: - GPIO label: This is the name of the GPIO line in the schematic for example - GPIO use (this is the current semantic of the GPIO name): The use of a GPIO, e.g. 'sd-card-detect', 'LED', ... I think it would be good to describe all GPIO labels in gpiochip subnodes as gpio-hogging introduced it. This would offer a use-independent naming. The use of the function could be defined in the device node that is using this gpio. As an example perhaps something like this: &gpiochip { some_interrupt { gpios = <4 0>; line-name = "some_interrupt_line"; }; line_b { gpios = <6 0>; line-name = "line-b"; }; }; randomswitch { compatible = "gpio-switch"; gpios = <&gpiochip 4 0>; use = "action-trigger"; read-only; }; Also this does seem kind of inconsistent with gpio-hogging and the proposed gpio-initval. gpio-hogging is defined in subnodes of the gpio chip while gpio-switches are not. As "gpio-switch" is not really any kind of device it would perhaps make sense to keep this consistent with gpio-hogging as well and define it
[PATCH v2 1/3] [media] mt9v032: Add reset and standby gpios
Add optional reset and standby gpios. The reset gpio is used to reset the chip in power_on(). The standby gpio is not used currently. It is just unset, so the chip is not in standby. Signed-off-by: Markus Pargmann Reviewed-by: Philipp Zabel Acked-by: Rob Herring --- .../devicetree/bindings/media/i2c/mt9v032.txt | 2 ++ drivers/media/i2c/mt9v032.c| 28 ++ 2 files changed, 30 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt index 202565313e82..100f0ae43269 100644 --- a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt +++ b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt @@ -20,6 +20,8 @@ Optional Properties: - link-frequencies: List of allowed link frequencies in Hz. Each frequency is expressed as a 64-bit big-endian integer. +- reset-gpios: GPIO handle which is connected to the reset pin of the chip. +- standby-gpios: GPIO handle which is connected to the standby pin of the chip. For further reading on port node refer to Documentation/devicetree/bindings/media/video-interfaces.txt. diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c index a68ce94ee097..c1bc564a0979 100644 --- a/drivers/media/i2c/mt9v032.c +++ b/drivers/media/i2c/mt9v032.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -251,6 +252,8 @@ struct mt9v032 { struct regmap *regmap; struct clk *clk; + struct gpio_desc *reset_gpio; + struct gpio_desc *standby_gpio; struct mt9v032_platform_data *pdata; const struct mt9v032_model_info *model; @@ -312,16 +315,31 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032) struct regmap *map = mt9v032->regmap; int ret; + if (mt9v032->reset_gpio) + gpiod_set_value_cansleep(mt9v032->reset_gpio, 1); + ret = clk_set_rate(mt9v032->clk, mt9v032->sysclk); if (ret < 0) return ret; + /* System clock has to be enabled before releasing the reset */ ret = clk_prepare_enable(mt9v032->clk); if (ret) return ret; udelay(1); + if (mt9v032->reset_gpio) { + gpiod_set_value_cansleep(mt9v032->reset_gpio, 0); + + /* After releasing reset we need to wait 10 clock cycles +* before accessing the sensor over I2C. As the minimum SYSCLK +* frequency is 13MHz, waiting 1µs will be enough in the worst +* case. +*/ + udelay(1); + } + /* Reset the chip and stop data read out */ ret = regmap_write(map, MT9V032_RESET, 1); if (ret < 0) @@ -954,6 +972,16 @@ static int mt9v032_probe(struct i2c_client *client, if (IS_ERR(mt9v032->clk)) return PTR_ERR(mt9v032->clk); + mt9v032->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", + GPIOD_OUT_HIGH); + if (IS_ERR(mt9v032->reset_gpio)) + return PTR_ERR(mt9v032->reset_gpio); + + mt9v032->standby_gpio = devm_gpiod_get_optional(&client->dev, "standby", + GPIOD_OUT_LOW); + if (IS_ERR(mt9v032->standby_gpio)) + return PTR_ERR(mt9v032->standby_gpio); + mutex_init(&mt9v032->power_lock); mt9v032->pdata = pdata; mt9v032->model = (const void *)did->driver_data; -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/3] [media] mt9v032: Do not unset master_mode
The power_on function of the driver resets the chip and sets the CHIP_CONTROL register to 0. This switches the operating mode to slave. The s_stream function sets the correct mode. But this caused problems on a board where the camera chip is operated as master. The camera started after a random amount of time streaming an image, I observed between 10 and 300 seconds. The STRFM_OUT and STLN_OUT pins are not connected on this board which may cause some issues in slave mode. I could not find any documentation about this. Keeping the chip in master mode after the reset helped to fix this issue for me. Signed-off-by: Markus Pargmann --- drivers/media/i2c/mt9v032.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c index c1bc564a0979..cc16acf001de 100644 --- a/drivers/media/i2c/mt9v032.c +++ b/drivers/media/i2c/mt9v032.c @@ -349,7 +349,8 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032) if (ret < 0) return ret; - return regmap_write(map, MT9V032_CHIP_CONTROL, 0); + return regmap_write(map, MT9V032_CHIP_CONTROL, + MT9V032_CHIP_CONTROL_MASTER_MODE); } static void mt9v032_power_off(struct mt9v032 *mt9v032) @@ -421,8 +422,7 @@ __mt9v032_get_pad_crop(struct mt9v032 *mt9v032, struct v4l2_subdev_pad_config *c static int mt9v032_s_stream(struct v4l2_subdev *subdev, int enable) { - const u16 mode = MT9V032_CHIP_CONTROL_MASTER_MODE - | MT9V032_CHIP_CONTROL_DOUT_ENABLE + const u16 mode = MT9V032_CHIP_CONTROL_DOUT_ENABLE | MT9V032_CHIP_CONTROL_SEQUENTIAL; struct mt9v032 *mt9v032 = to_mt9v032(subdev); struct v4l2_rect *crop = &mt9v032->crop; -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/3] [media] mt9v032: Add V4L2 controls for AEC and AGC
This patch adds V4L2 controls for Auto Exposure Control and Auto Gain Control settings. These settings include low pass filter, update frequency of these settings and the update interval for those units. Signed-off-by: Markus Pargmann --- drivers/media/i2c/mt9v032.c | 153 +++- 1 file changed, 152 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c index cc16acf001de..6cbc3b87eda9 100644 --- a/drivers/media/i2c/mt9v032.c +++ b/drivers/media/i2c/mt9v032.c @@ -133,9 +133,16 @@ #defineMT9V032_TEST_PATTERN_GRAY_DIAGONAL (3 << 11) #defineMT9V032_TEST_PATTERN_ENABLE (1 << 13) #defineMT9V032_TEST_PATTERN_FLIP (1 << 14) +#define MT9V032_AEGC_DESIRED_BIN 0xa5 +#define MT9V032_AEC_UPDATE_FREQUENCY 0xa6 +#define MT9V032_AEC_LPF0xa8 +#define MT9V032_AGC_UPDATE_FREQUENCY 0xa9 +#define MT9V032_AGC_LPF0xaa #define MT9V032_AEC_AGC_ENABLE 0xaf #defineMT9V032_AEC_ENABLE (1 << 0) #defineMT9V032_AGC_ENABLE (1 << 1) +#define MT9V034_AEC_MAX_SHUTTER_WIDTH 0xad +#define MT9V032_AEC_MAX_SHUTTER_WIDTH 0xbd #define MT9V032_THERMAL_INFO 0xc1 enum mt9v032_model { @@ -162,6 +169,8 @@ struct mt9v032_model_data { unsigned int min_shutter; unsigned int max_shutter; unsigned int pclk_reg; + unsigned int aec_max_shutter_reg; + const struct v4l2_ctrl_config * const aec_max_shutter_v4l2_ctrl; }; struct mt9v032_model_info { @@ -175,6 +184,9 @@ static const struct mt9v032_model_version mt9v032_versions[] = { { MT9V034_CHIP_ID_REV1, "MT9V024/MT9V034 rev1" }, }; +static const struct v4l2_ctrl_config mt9v032_aec_max_shutter_width; +static const struct v4l2_ctrl_config mt9v034_aec_max_shutter_width; + static const struct mt9v032_model_data mt9v032_model_data[] = { { /* MT9V022, MT9V032 revisions 1/2/3 */ @@ -185,6 +197,8 @@ static const struct mt9v032_model_data mt9v032_model_data[] = { .min_shutter = MT9V032_TOTAL_SHUTTER_WIDTH_MIN, .max_shutter = MT9V032_TOTAL_SHUTTER_WIDTH_MAX, .pclk_reg = MT9V032_PIXEL_CLOCK, + .aec_max_shutter_reg = MT9V032_AEC_MAX_SHUTTER_WIDTH, + .aec_max_shutter_v4l2_ctrl = &mt9v032_aec_max_shutter_width, }, { /* MT9V024, MT9V034 */ .min_row_time = 690, @@ -194,6 +208,8 @@ static const struct mt9v032_model_data mt9v032_model_data[] = { .min_shutter = MT9V034_TOTAL_SHUTTER_WIDTH_MIN, .max_shutter = MT9V034_TOTAL_SHUTTER_WIDTH_MAX, .pclk_reg = MT9V034_PIXEL_CLOCK, + .aec_max_shutter_reg = MT9V034_AEC_MAX_SHUTTER_WIDTH, + .aec_max_shutter_v4l2_ctrl = &mt9v034_aec_max_shutter_width, }, }; @@ -647,6 +663,33 @@ static int mt9v032_set_selection(struct v4l2_subdev *subdev, */ #define V4L2_CID_TEST_PATTERN_COLOR(V4L2_CID_USER_BASE | 0x1001) +/* + * Value between 1 and 64 to set the desired bin. This is effectively a measure + * of how bright the image is supposed to be. Both AGC and AEC try to reach + * this. + */ +#define V4L2_CID_AEGC_DESIRED_BIN (V4L2_CID_USER_BASE | 0x1002) +/* + * LPF is the low pass filter capability of the chip. Both AEC and AGC have + * this setting. This limits the speed in which AGC/AEC adjust their settings. + * Possible values are 0-2. 0 means no LPF. For 1 and 2 this equation is used: + * if |(Calculated new exp - current exp)| > (current exp / 4) + * next exp = Calculated new exp + * else + * next exp = Current exp + ((Calculated new exp - current exp) / 2^LPF) + */ +#define V4L2_CID_AEC_LPF (V4L2_CID_USER_BASE | 0x1003) +#define V4L2_CID_AGC_LPF (V4L2_CID_USER_BASE | 0x1004) +/* + * Value between 0 and 15. This is the number of frames being skipped before + * updating the auto exposure/gain. + */ +#define V4L2_CID_AEC_UPDATE_INTERVAL (V4L2_CID_USER_BASE | 0x1005) +#define V4L2_CID_AGC_UPDATE_INTERVAL (V4L2_CID_USER_BASE | 0x1006) +/* + * Maximum shutter width used for AEC. + */ +#define V4L2_CID_AEC_MAX_SHUTTER_WIDTH (V4L2_CID_USER_BASE | 0x1007) static int mt9v032_s_ctrl(struct v4l2_ctrl *ctrl) { @@ -716,6 +759,28 @@ static int mt9v032_s_ctrl(struct v4l2_ctrl *ctrl) break; } return regmap_write(map, MT9V032_TEST_PATTERN, data); + + case V4L2_CID_AEGC_DESIRED_BIN: + return regmap_write(map, MT9V032_AEGC_DESIRED_BIN, ctrl->val); +
[PATCH v10 3/8] ARM: dt: Binding documentation for imx25 touchscreen controller
This is the touchscreen conversion queue binding documentation. It uses the shared imx25 ADC. Signed-off-by: Markus Pargmann --- Notes: Changes in v9: - Updated binding descriptions Changes in v5: - Fix signed/unsigned comparison - Fix unused variable settling_time by putting it in the correct argument list - Use continous conversion queue with the repeat feature and a proper repeat-wait. Previously the touchscreen caused massive number of interrupts. .../bindings/input/touchscreen/fsl-mx25-tcq.txt| 35 ++ 1 file changed, 35 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt diff --git a/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt new file mode 100644 index ..cdf05f9b2329 --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt @@ -0,0 +1,35 @@ +Freescale mx25 TS conversion queue module + +mx25 touchscreen conversion queue module which controls the ADC unit of the +mx25 for attached touchscreens. + +Required properties: + - compatible: Should be "fsl,imx25-tcq". + - reg: Memory range of the device. + - interrupts: Should be the interrupt number associated with this module within + the tscadc unit (<0>). + - interrupt-parent: Should be a phandle to the tscadc unit. + - fsl,wires: Should be '<4>' or '<5>' + +Optional properties: + - fsl,pen-debounce-ns: Pen debounce time in nanoseconds. + - fsl,pen-threshold: Pen-down threshold for the touchscreen. This is a value + between 1 and 4096. It is the ratio between the internal reference voltage + and the measured voltage after the plate was precharged. Resistence between + plates and therefore the voltage decreases with pressure so that a smaller + value is equivalent to a higher pressure. + - fsl,settling-time-ns: Settling time in nanoseconds. The settling time is before + the actual touch detection to wait for an even charge distribution in the + plate. + +This device includes two conversion queues which can be added as subnodes. +The first queue is for the touchscreen, the second for general purpose ADC. + +Example: + tsc: tcq@50030400 { + compatible = "fsl,imx25-tcq"; + reg = <0x50030400 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <0>; + fsl,wires = <4>; + }; -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v10 7/8] ARM: dts: imx25: Add TSC and ADC support
From: Denis Carikli Signed-off-by: Denis Carikli Signed-off-by: Markus Pargmann --- arch/arm/boot/dts/imx25.dtsi | 29 ++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi index 677f81d9dcd5..6ac5e71d312b 100644 --- a/arch/arm/boot/dts/imx25.dtsi +++ b/arch/arm/boot/dts/imx25.dtsi @@ -265,13 +265,36 @@ status = "disabled"; }; - tsc: tsc@5003 { - compatible = "fsl,imx25-adc", "fsl,imx21-tsc"; - reg = <0x5003 0x4000>; + tscadc: tscadc@5003 { + compatible = "fsl,imx25-tsadc"; + reg = <0x5003 0xc>; interrupts = <46>; clocks = <&clks 119>; clock-names = "ipg"; + interrupt-controller; + #interrupt-cells = <1>; + #address-cells = <1>; + #size-cells = <1>; status = "disabled"; + + adc: adc@50030800 { + compatible = "fsl,imx25-gcq"; + reg = <0x50030800 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + tsc: tcq@50030400 { + compatible = "fsl,imx25-tcq"; + reg = <0x50030400 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <0>; + fsl,wires = <4>; + status = "disabled"; + }; }; ssi1: ssi@50034000 { -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v10 5/8] iio: adc: fsl,imx25-gcq driver
This is a conversion queue driver for the mx25 SoC. It uses the central ADC which is used by two seperate independent queues. This driver prepares different conversion configurations for each possible input. For a conversion it creates a conversionqueue of one item with the correct configuration for the chosen channel. It then executes the queue once and disables the conversion queue afterwards. The reference voltages are configurable through devicetree subnodes, depending on the connections of the ADC inputs. Signed-off-by: Markus Pargmann Signed-off-by: Denis Carikli Acked-by: Jonathan Cameron --- Notes: Changes in v10: - Renamed properties fsl,settling-time and fsl,pen-debounce to *-ns Changes in v7: - Remove separate functions mx25_gcq_disable/enable_eoq() as they were used at only one position - Enforce an external reference regulator if one of the conversions uses it as reference. The devm_regulator_get() call was moved into mx25_gcq_setup_cfgs() to be able to acquire the reference regulator when necessary. - Store indio_dev as platform driver data instead of the private data. This was changed in probe() and remove(). Changes in v6: - Added defines for a complete list of references in the dt binding macros drivers/iio/adc/Kconfig | 7 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/fsl-imx25-gcq.c | 417 3 files changed, 425 insertions(+) create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 7868c744fd4b..73145c53ec2c 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -183,6 +183,13 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config FSL_MX25_ADC + tristate "Freescale MX25 ADC driver" + depends on MFD_MX25_TSADC + help + Generic Conversion Queue driver used for general purpose ADC in the + MX25. This driver supports single measurements using the MX25 ADC. + config HI8435 tristate "Holt Integrated Circuits HI-8435 threshold detector" select IIO_TRIGGERED_EVENT diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 99b37a963a1e..2fe9b78e4b02 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o obj-$(CONFIG_DA9150_GPADC) += da9150-gpadc.o obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o +obj-$(CONFIG_FSL_MX25_ADC) += fsl-imx25-gcq.o obj-$(CONFIG_HI8435) += hi8435.o obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o obj-$(CONFIG_MAX1027) += max1027.o diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c new file mode 100644 index ..2fd192735d5b --- /dev/null +++ b/drivers/iio/adc/fsl-imx25-gcq.c @@ -0,0 +1,417 @@ +/* + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + * + * This is the driver for the imx25 GCQ (Generic Conversion Queue) + * connected to the imx25 ADC. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MX25_GCQ_TIMEOUT (msecs_to_jiffies(2000)) + +static const char * const driver_name = "mx25-gcq"; + +enum mx25_gcq_cfgs { + MX25_CFG_XP = 0, + MX25_CFG_YP, + MX25_CFG_XN, + MX25_CFG_YN, + MX25_CFG_WIPER, + MX25_CFG_INAUX0, + MX25_CFG_INAUX1, + MX25_CFG_INAUX2, + MX25_NUM_CFGS, +}; + +struct mx25_gcq_priv { + struct regmap *regs; + struct completion completed; + struct clk *clk; + int irq; + struct regulator *vref[4]; + u32 channel_vref_mv[MX25_NUM_CFGS]; +}; + +#define MX25_CQG_CHAN(chan, id) {\ + .type = IIO_VOLTAGE,\ + .indexed = 1,\ + .channel = chan,\ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ + BIT(IIO_CHAN_INFO_SCALE),\ + .datasheet_name = id,\ +} + +static const struct iio_chan_spec mx25_gcq_channels[MX25_NUM_CFGS] = { + MX25_CQG_CHAN(MX25_CFG_XP, "xp"), + MX25_CQG_CHAN(MX25_CFG_YP, "yp"), + MX25_CQG_CHAN(MX25_CFG_XN, "xn"), + MX25_CQG_CHAN(MX25_CFG_YN, "yn"), + MX25_CQG_CHAN(MX25_CFG_WIPER, "wiper"), + MX25_CQG_CHAN(MX25_CFG_INAUX0, "inaux0"), + MX25_CQG_CHAN(MX25_CFG_INAUX1, "inaux1"), + MX25_CQG_CHAN(MX25_CFG_INAUX2, "inaux2"), +}; + +static const char * const mx25_gcq_refp_names[] = { + [MX25_ADC_REFP_YP] = "yp", + [MX25_ADC_REFP_XP] = "
[PATCH v10 1/8] ARM: dt: Binding documentation for imx25 ADC/TSC
This documentation describes the devicetree bindings for the ADC/Touchscreen unit of the i.MX25 SoC. Signed-off-by: Markus Pargmann Acked-by: Jonathan Cameron Acked-by: Rob Herring --- Notes: Changes in v9: - Fixed some style things. Changes in v6: - Removed adc-ref property and replaced it with refp and refn for positive and negative references. The properties are optional now as the default behaviour is a positive internal reference voltage and ADC GND as negative reference. .../devicetree/bindings/mfd/fsl-imx25-tsadc.txt| 47 ++ 1 file changed, 47 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt diff --git a/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt b/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt new file mode 100644 index ..b03505286997 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt @@ -0,0 +1,47 @@ +Freescale MX25 ADC/TSC MultiFunction Device (MFD) + +This device combines two general purpose conversion queues one used for general +ADC and the other used for touchscreens. + +Required properties: + - compatible: Should be "fsl,imx25-tsadc". + - reg:Start address and size of the memory area of + the device + - interrupts: Interrupt for this device + (See: ../interrupt-controller/interrupts.txt) + - clocks: An 'ipg' clock (See: ../clock/clock-bindings.txt) + - interrupt-controller: This device is an interrupt controller. It + controls the interrupts of both + conversion queues. + - #interrupt-cells: Should be '<1>'. + - #address-cells: Should be '<1>'. + - #size-cells:Should be '<1>'. + +This device includes two conversion queues which can be added as subnodes. +The first queue is for the touchscreen, the second for general purpose ADC. + +Example: + tscadc: tscadc@5003 { + compatible = "fsl,imx25-tsadc"; + reg = <0x5003 0xc>; + interrupts = <46>; + clocks = <&clks 119>; + clock-names = "ipg"; + interrupt-controller; + #interrupt-cells = <1>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + tsc: tcq@50030400 { + compatible = "fsl,imx25-tcq"; + reg = <0x50030400 0x60>; + ... + }; + + adc: gcq@50030800 { + compatible = "fsl,imx25-gcq"; + reg = <0x50030800 0x60>; + ... + }; + }; -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v10 6/8] input: touchscreen: imx25 tcq driver
This is a driver for the imx25 ADC/TSC module. It controls the touchscreen conversion queue and creates a touchscreen input device. The driver currently only supports 4 wire touchscreens. The driver uses a simple conversion queue of precharge, touch detection, X measurement, Y measurement, precharge and another touch detection. This driver uses the regmap from the parent to setup some touch specific settings in the core driver and setup a idle configuration with touch detection. Signed-off-by: Markus Pargmann Signed-off-by: Denis Carikli [fix clock's period calculation] [fix calculation of the 'settling' value] Signed-off-by: Juergen Borleis --- Notes: Changes in v10: - Renamed devicetree properties Changes in v9: - Added module description to Kconfig item - Fixed devm_ioremap_resource() return value check to use IS_ERR() - Removed return value of mx25_tcq_create_event_for_4wire() - Renamed most 'ret' variables through 'error' - Removed IRQF_ONESHOT - Rearranged threaded handler to not mix up samples from multiple measurements Changes in v7: - Moved clk_prepare_enable() and mx25_tcq_init() into mx25_tcq_open(). This was done to be able to use devm_request_threaded_irq(). - Cleanup of the probe function through above change - Removed mx25_tcq_remove(), not necessary now drivers/input/touchscreen/Kconfig | 9 + drivers/input/touchscreen/Makefile| 1 + drivers/input/touchscreen/fsl-imx25-tcq.c | 596 ++ 3 files changed, 606 insertions(+) create mode 100644 drivers/input/touchscreen/fsl-imx25-tcq.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index ae33da7ab51f..873bf3697e35 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -811,6 +811,15 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MX25 + tristate "Freescale i.MX25 touchscreen input driver" + depends on MFD_MX25_TSADC + help + Enable support for touchscreen connected to your i.MX25. + + To compile this driver as a module, choose M here: the + module will be called fsl-imx25-tcq. + config TOUCHSCREEN_MC13783 tristate "Freescale MC13783 touchscreen input driver" depends on MFD_MC13XXX diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index cbaa6abb08da..77a2ac54101a 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -45,6 +45,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o obj-$(CONFIG_TOUCHSCREEN_MIGOR)+= migor_ts.o diff --git a/drivers/input/touchscreen/fsl-imx25-tcq.c b/drivers/input/touchscreen/fsl-imx25-tcq.c new file mode 100644 index ..fe9877a6af9e --- /dev/null +++ b/drivers/input/touchscreen/fsl-imx25-tcq.c @@ -0,0 +1,596 @@ +/* + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + * + * Based on driver from 2011: + * Juergen Beisert, Pengutronix + * + * This is the driver for the imx25 TCQ (Touchscreen Conversion Queue) + * connected to the imx25 ADC. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char mx25_tcq_name[] = "mx25-tcq"; + +enum mx25_tcq_mode { + MX25_TS_4WIRE, +}; + +struct mx25_tcq_priv { + struct regmap *regs; + struct regmap *core_regs; + struct input_dev *idev; + enum mx25_tcq_mode mode; + unsigned int pen_threshold; + unsigned int sample_count; + unsigned int expected_samples; + unsigned int pen_debounce; + unsigned int settling_time; + struct clk *clk; + int irq; + struct device *dev; +}; + +static struct regmap_config mx25_tcq_regconfig = { + .fast_io = true, + .max_register = 0x5c, + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + +static const struct of_device_id mx25_tcq_ids[] = { + { .compatible = "fsl,imx25-tcq", }, + { /* Sentinel */ } +}; + +#define TSC_4WIRE_PRE_INDEX 0 +#define TSC_4WIRE_X_INDEX 1 +#define TSC_4WIRE_Y_INDEX 2 +#define TSC_4WIRE_POST_INDEX 3 +#define TSC_4WIRE_LEAVE 4
[PATCH v10 4/8] mfd: fsl imx25 Touchscreen ADC driver
This is the core driver for imx25 touchscreen/adc driver. The module has one shared ADC and two different conversion queues which use the ADC. The two queues are identical. Both can be used for general purpose ADC but one is meant to be used for touchscreens. This driver is the core which manages the central components and registers of the TSC/ADC unit. It manages the IRQs and forwards them to the correct components. Signed-off-by: Markus Pargmann Signed-off-by: Denis Carikli [ensure correct ADC clock depending on the IPG clock] Signed-off-by: Juergen Borleis Acked-by: Jonathan Cameron --- Notes: Changes in v7: - Cleanup bit defines in header files to be more readable - Fix irq check to return with an error for irq <= 0 - Add COMPILE_TEST in Kconfig file Changes in v5: - Remove ifdef CONFIG_OF as this driver is only for DT usage - Remove module owner - Add Kconfig dependencies ARCH_MX25 and OF drivers/mfd/Kconfig | 9 ++ drivers/mfd/Makefile| 2 + drivers/mfd/fsl-imx25-tsadc.c | 203 include/linux/mfd/imx25-tsadc.h | 140 +++ 4 files changed, 354 insertions(+) create mode 100644 drivers/mfd/fsl-imx25-tsadc.c create mode 100644 include/linux/mfd/imx25-tsadc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 4d92df6ef9fe..4222e202ad2b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -271,6 +271,15 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MX25_TSADC + tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" + select REGMAP_MMIO + depends on (SOC_IMX25 && OF) || COMPILE_TEST + help + Enable support for the integrated Touchscreen and ADC unit of the + i.MX25 processors. They consist of a conversion queue for general + purpose ADC and a queue for Touchscreens. + config MFD_HI6421_PMIC tristate "HiSilicon Hi6421 PMU/Codec IC" depends on OF diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index a8b76b81b467..5741be88c173 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -81,6 +81,8 @@ obj-$(CONFIG_TWL4030_POWER)+= twl4030-power.o obj-$(CONFIG_MFD_TWL4030_AUDIO)+= twl4030-audio.o obj-$(CONFIG_TWL6040_CORE) += twl6040.o +obj-$(CONFIG_MFD_MX25_TSADC) += fsl-imx25-tsadc.o + obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c new file mode 100644 index ..77b2675cf8f5 --- /dev/null +++ b/drivers/mfd/fsl-imx25-tsadc.c @@ -0,0 +1,203 @@ +/* + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static struct regmap_config mx25_tsadc_regmap_config = { + .fast_io = true, + .max_register = 8, + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + +static void mx25_tsadc_irq_handler(struct irq_desc *desc) +{ + struct mx25_tsadc *tsadc = irq_desc_get_handler_data(desc); + struct irq_chip *chip = irq_desc_get_chip(desc); + u32 status; + + chained_irq_enter(chip, desc); + + regmap_read(tsadc->regs, MX25_TSC_TGSR, &status); + + if (status & MX25_TGSR_GCQ_INT) + generic_handle_irq(irq_find_mapping(tsadc->domain, 1)); + + if (status & MX25_TGSR_TCQ_INT) + generic_handle_irq(irq_find_mapping(tsadc->domain, 0)); + + chained_irq_exit(chip, desc); +} + +static int mx25_tsadc_domain_map(struct irq_domain *d, unsigned int irq, +irq_hw_number_t hwirq) +{ + struct mx25_tsadc *tsadc = d->host_data; + + irq_set_chip_data(irq, tsadc); + irq_set_chip_and_handler(irq, &dummy_irq_chip, +handle_level_irq); + irq_modify_status(irq, IRQ_NOREQUEST, IRQ_NOPROBE); + + return 0; +} + +static struct irq_domain_ops mx25_tsadc_domain_ops = { + .map = mx25_tsadc_domain_map, + .xlate = irq_domain_xlate_onecell, +}; + +static int mx25_tsadc_setup_irq(struct platform_device *pdev, + struct mx25_tsadc *tsadc) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + int irq; + + irq = platform_get_irq(pdev, 0); + if (irq <= 0) { + dev_err(dev, "Failed to get irq\n"); +
[PATCH v10 2/8] ARM: dt: Binding documentation for imx25 GCQ
The documentation describes the bindings for the imx25 GCQ unit which is essentially a generic conversion queue using the imx25 ADC. Signed-off-by: Markus Pargmann Acked-by: Rob Herring Acked-by: Jonathan Cameron --- Notes: Changes in v9: - Added the dt-bindings header to this patch instead of the driver Changes in v6: - Changed bindings to use adc-refp and adc-refn. Also a bit of cleanup in the setup routine. Changes in v5: - Fixed locking - Removed module owner .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 58 ++ include/dt-bindings/iio/adc/fsl-imx25-gcq.h| 18 +++ 2 files changed, 76 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h diff --git a/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt new file mode 100644 index ..b0866d36a307 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt @@ -0,0 +1,58 @@ +Freescale i.MX25 ADC GCQ device + +This is a generic conversion queue device that can convert any of the +analog inputs using the ADC unit of the i.MX25. + +Required properties: + - compatible: Should be "fsl,imx25-gcq". + - reg: Should be the register range of the module. + - interrupts: Should be the interrupt number of the module. + Typically this is <1>. + - interrupt-parent: phandle to the tsadc module of the i.MX25. + - #address-cells: Should be <1> (setting for the subnodes) + - #size-cells: Should be <0> (setting for the subnodes) + +Optional properties: + - vref-ext-supply: The regulator supplying the ADC reference voltage. + Required when at least one subnode uses the this reference. + - vref-xp-supply: The regulator supplying the ADC reference voltage on pin XP. + Required when at least one subnode uses this reference. + - vref-yp-supply: The regulator supplying the ADC reference voltage on pin YP. + Required when at least one subnode uses this reference. + +Sub-nodes: +Optionally you can define subnodes which define the reference voltage +for the analog inputs. + +Required properties for subnodes: + - reg: Should be the number of the analog input. + 0: xp + 1: yp + 2: xn + 3: yn + 4: wiper + 5: inaux0 + 6: inaux1 + 7: inaux2 +Optional properties for subnodes: + - fsl,adc-refp: specifies the positive reference input as defined in + + - fsl,adc-refn: specifies the negative reference input as defined in + + +Example: + + adc: adc@50030800 { + compatible = "fsl,imx25-gcq"; + reg = <0x50030800 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <1>; + #address-cells = <1>; + #size-cells = <0>; + + inaux@5 { + reg = <5>; + fsl,adc-refp = ; + fsl,adc-refn = ; + }; + }; diff --git a/include/dt-bindings/iio/adc/fsl-imx25-gcq.h b/include/dt-bindings/iio/adc/fsl-imx25-gcq.h new file mode 100644 index ..87abdd4a7674 --- /dev/null +++ b/include/dt-bindings/iio/adc/fsl-imx25-gcq.h @@ -0,0 +1,18 @@ +/* + * This header provides constants for configuring the I.MX25 ADC + */ + +#ifndef _DT_BINDINGS_IIO_ADC_FS_IMX25_GCQ_H +#define _DT_BINDINGS_IIO_ADC_FS_IMX25_GCQ_H + +#define MX25_ADC_REFP_YP 0 /* YP voltage reference */ +#define MX25_ADC_REFP_XP 1 /* XP voltage reference */ +#define MX25_ADC_REFP_EXT 2 /* External voltage reference */ +#define MX25_ADC_REFP_INT 3 /* Internal voltage reference */ + +#define MX25_ADC_REFN_XN 0 /* XN ground reference */ +#define MX25_ADC_REFN_YN 1 /* YN ground reference */ +#define MX25_ADC_REFN_NGND 2 /* Internal ground reference */ +#define MX25_ADC_REFN_NGND23 /* External ground reference */ + +#endif -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v10 0/8] imx25 adc and touchscreen driver
Hi, v10 includes minor fixes in the gcq driver code and the renamed two DT properties for the touchscreen which now include the units in the name. Best Regards, Markus Denis Carikli (2): ARM: dts: imx25: Add TSC and ADC support ARM: imx_v4_v5_defconfig: Add I.MX25 Touchscreen controller and ADC support. Markus Pargmann (6): ARM: dt: Binding documentation for imx25 ADC/TSC ARM: dt: Binding documentation for imx25 GCQ ARM: dt: Binding documentation for imx25 touchscreen controller mfd: fsl imx25 Touchscreen ADC driver iio: adc: fsl,imx25-gcq driver input: touchscreen: imx25 tcq driver .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 58 ++ .../bindings/input/touchscreen/fsl-mx25-tcq.txt| 35 ++ .../devicetree/bindings/mfd/fsl-imx25-tsadc.txt| 47 ++ arch/arm/boot/dts/imx25.dtsi | 29 +- arch/arm/configs/imx_v4_v5_defconfig | 4 + drivers/iio/adc/Kconfig| 7 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/fsl-imx25-gcq.c| 417 ++ drivers/input/touchscreen/Kconfig | 9 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/fsl-imx25-tcq.c | 596 + drivers/mfd/Kconfig| 9 + drivers/mfd/Makefile | 2 + drivers/mfd/fsl-imx25-tsadc.c | 203 +++ include/dt-bindings/iio/adc/fsl-imx25-gcq.h| 18 + include/linux/mfd/imx25-tsadc.h| 140 + 16 files changed, 1573 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt create mode 100644 Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt create mode 100644 Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c create mode 100644 drivers/input/touchscreen/fsl-imx25-tcq.c create mode 100644 drivers/mfd/fsl-imx25-tsadc.c create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h create mode 100644 include/linux/mfd/imx25-tsadc.h -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v10 8/8] ARM: imx_v4_v5_defconfig: Add I.MX25 Touchscreen controller and ADC support.
From: Denis Carikli Signed-off-by: Denis Carikli Signed-off-by: Markus Pargmann --- arch/arm/configs/imx_v4_v5_defconfig | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig index d3a8018639de..d6754ac47788 100644 --- a/arch/arm/configs/imx_v4_v5_defconfig +++ b/arch/arm/configs/imx_v4_v5_defconfig @@ -88,6 +88,7 @@ CONFIG_KEYBOARD_IMX=y # CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_ADS7846=m +CONFIG_TOUCHSCREEN_MX25=y CONFIG_TOUCHSCREEN_MC13783=y # CONFIG_LEGACY_PTYS is not set CONFIG_SERIAL_8250=m @@ -107,6 +108,7 @@ CONFIG_HWMON=m CONFIG_SENSORS_MC13783_ADC=m CONFIG_WATCHDOG=y CONFIG_IMX2_WDT=y +CONFIG_MFD_MX25_TSADC=y CONFIG_MFD_MC13XXX_SPI=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y @@ -172,6 +174,8 @@ CONFIG_DMADEVICES=y CONFIG_IMX_SDMA=y CONFIG_IMX_DMA=y # CONFIG_IOMMU_SUPPORT is not set +CONFIG_IIO=y +CONFIG_FSL_MX25_ADC=y CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y CONFIG_EXT4_FS=y -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v9 5/8] iio: adc: fsl,imx25-gcq driver
Hi, On Saturday 12 December 2015 17:14:24 Jonathan Cameron wrote: > On 06/12/15 19:52, Markus Pargmann wrote: > > This is a conversion queue driver for the mx25 SoC. It uses the central > > ADC which is used by two seperate independent queues. This driver > > prepares different conversion configurations for each possible input. > > For a conversion it creates a conversionqueue of one item with the > conversion queue > > correct configuration for the chosen channel. It then executes the queue > > once and disables the conversion queue afterwards. > > > > The reference voltages are configurable through devicetree subnodes, > > depending on the connections of the ADC inputs. > > > > Signed-off-by: Markus Pargmann > > Signed-off-by: Denis Carikli > A couple of little bits inline. Fix the return of 0 on fail in probe > and you can add Thanks, I fixed all your comments for the next version. Best Regards, Markus > > Acked-by: Jonathan Cameron > > --- > > > > Notes: > > Changes in v7: > > - Remove separate functions mx25_gcq_disable/enable_eoq() as they were > > used at > >only one position > > - Enforce an external reference regulator if one of the conversions > > uses it as > >reference. The devm_regulator_get() call was moved into > >mx25_gcq_setup_cfgs() to be able to acquire the reference regulator > > when > >necessary. > > - Store indio_dev as platform driver data instead of the private data. > > This > >was changed in probe() and remove(). > > > > Changes in v6: > > - Added defines for a complete list of references in the dt binding > > macros > > > > drivers/iio/adc/Kconfig | 7 + > > drivers/iio/adc/Makefile| 1 + > > drivers/iio/adc/fsl-imx25-gcq.c | 415 > > > > 3 files changed, 423 insertions(+) > > create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c > > > > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > > index 7868c744fd4b..73145c53ec2c 100644 > > --- a/drivers/iio/adc/Kconfig > > +++ b/drivers/iio/adc/Kconfig > > @@ -183,6 +183,13 @@ config EXYNOS_ADC > > To compile this driver as a module, choose M here: the module will be > > called exynos_adc. > > > > +config FSL_MX25_ADC > > + tristate "Freescale MX25 ADC driver" > > + depends on MFD_MX25_TSADC > > + help > > + Generic Conversion Queue driver used for general purpose ADC in the > > + MX25. This driver supports single measurements using the MX25 ADC. > > + > > config HI8435 > > tristate "Holt Integrated Circuits HI-8435 threshold detector" > > select IIO_TRIGGERED_EVENT > > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile > > index 99b37a963a1e..2fe9b78e4b02 100644 > > --- a/drivers/iio/adc/Makefile > > +++ b/drivers/iio/adc/Makefile > > @@ -19,6 +19,7 @@ obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o > > obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o > > obj-$(CONFIG_DA9150_GPADC) += da9150-gpadc.o > > obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o > > +obj-$(CONFIG_FSL_MX25_ADC) += fsl-imx25-gcq.o > > obj-$(CONFIG_HI8435) += hi8435.o > > obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o > > obj-$(CONFIG_MAX1027) += max1027.o > > diff --git a/drivers/iio/adc/fsl-imx25-gcq.c > > b/drivers/iio/adc/fsl-imx25-gcq.c > > new file mode 100644 > > index ..eb9570876291 > > --- /dev/null > > +++ b/drivers/iio/adc/fsl-imx25-gcq.c > > @@ -0,0 +1,415 @@ > > +/* > > + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann > > > > + * > > + * This program is free software; you can redistribute it and/or modify it > > under > > + * the terms of the GNU General Public License version 2 as published by > > the > > + * Free Software Foundation. > > + * > > + * This is the driver for the imx25 GCQ (Generic Conversion Queue) > > + * connected to the imx25 ADC. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#define MX25_GCQ_TIMEOUT (msecs_to_jiffies(2000)) > > + > > +static const char * const driver_name = "mx25-gcq"; > > + > > +enum mx25_gcq_cfgs { > > + MX25_CFG_XP = 0, > > + MX25_CFG_YP, > > + MX25_C
Re: [PATCH v9 3/8] ARM: dt: Binding documentation for imx25 touchscreen controller
Hi, On Monday 07 December 2015 14:45:46 Rob Herring wrote: > On Sun, Dec 06, 2015 at 08:52:16PM +0100, Markus Pargmann wrote: > > This is the touchscreen conversion queue binding documentation. It uses > > the shared imx25 ADC. > > > > Signed-off-by: Markus Pargmann > > --- > > > > Notes: > > Changes in v9: > > - Updated binding descriptions > > > > Changes in v5: > > - Fix signed/unsigned comparison > > - Fix unused variable settling_time by putting it in the correct > > argument list > > - Use continous conversion queue with the repeat feature and a proper > >repeat-wait. Previously the touchscreen caused massive number of > > interrupts. > > > > .../bindings/input/touchscreen/fsl-mx25-tcq.txt| 35 > > ++ > > 1 file changed, 35 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt > > > > diff --git > > a/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt > > b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt > > new file mode 100644 > > index ..d45e50872114 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt > > @@ -0,0 +1,35 @@ > > +Freescale mx25 TS conversion queue module > > + > > +mx25 touchscreen conversion queue module which controls the ADC unit of the > > +mx25 for attached touchscreens. > > + > > +Required properties: > > + - compatible: Should be "fsl,imx25-tcq". > > + - reg: Memory range of the device. > > + - interrupts: Should be the interrupt number associated with this module > > within > > + the tscadc unit (<0>). > > + - interrupt-parent: Should be a phandle to the tscadc unit. > > + - fsl,wires: Should be '<4>' or '<5>' > > + > > +Optional properties: > > + - fsl,pen-debounce: Pen debounce time in nanoseconds. > > This and ... > > > + - fsl,pen-threshold: Pen-down threshold for the touchscreen. This is a > > value > > + between 1 and 4096. It is the ratio between the internal reference > > voltage > > + and the measured voltage after the plate was precharged. Resistence > > between > > + plates and therefore the voltage decreases with pressure so that a > > smaller > > + value is equivalent to a higher pressure. > > + - fsl,settling-time: Settling time in nanoseconds. The settling time is > > before > > + the actual touch detection to wait for an even charge distribution in > > the > > + plate. > > ... this still need units (-ns) appended to the property name. Thanks. I wasn't aware that the property names itself should include the units. Will fix that. Best Regards, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: This is a digitally signed message part.
[PATCH v9 2/8] ARM: dt: Binding documentation for imx25 GCQ
The documentation describes the bindings for the imx25 GCQ unit which is essentially a generic conversion queue using the imx25 ADC. Signed-off-by: Markus Pargmann --- Notes: Changes in v9: - Added the dt-bindings header to this patch instead of the driver Changes in v6: - Changed bindings to use adc-refp and adc-refn. Also a bit of cleanup in the setup routine. Changes in v5: - Fixed locking - Removed module owner .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 58 ++ include/dt-bindings/iio/adc/fsl-imx25-gcq.h| 18 +++ 2 files changed, 76 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h diff --git a/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt new file mode 100644 index ..b0866d36a307 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt @@ -0,0 +1,58 @@ +Freescale i.MX25 ADC GCQ device + +This is a generic conversion queue device that can convert any of the +analog inputs using the ADC unit of the i.MX25. + +Required properties: + - compatible: Should be "fsl,imx25-gcq". + - reg: Should be the register range of the module. + - interrupts: Should be the interrupt number of the module. + Typically this is <1>. + - interrupt-parent: phandle to the tsadc module of the i.MX25. + - #address-cells: Should be <1> (setting for the subnodes) + - #size-cells: Should be <0> (setting for the subnodes) + +Optional properties: + - vref-ext-supply: The regulator supplying the ADC reference voltage. + Required when at least one subnode uses the this reference. + - vref-xp-supply: The regulator supplying the ADC reference voltage on pin XP. + Required when at least one subnode uses this reference. + - vref-yp-supply: The regulator supplying the ADC reference voltage on pin YP. + Required when at least one subnode uses this reference. + +Sub-nodes: +Optionally you can define subnodes which define the reference voltage +for the analog inputs. + +Required properties for subnodes: + - reg: Should be the number of the analog input. + 0: xp + 1: yp + 2: xn + 3: yn + 4: wiper + 5: inaux0 + 6: inaux1 + 7: inaux2 +Optional properties for subnodes: + - fsl,adc-refp: specifies the positive reference input as defined in + + - fsl,adc-refn: specifies the negative reference input as defined in + + +Example: + + adc: adc@50030800 { + compatible = "fsl,imx25-gcq"; + reg = <0x50030800 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <1>; + #address-cells = <1>; + #size-cells = <0>; + + inaux@5 { + reg = <5>; + fsl,adc-refp = ; + fsl,adc-refn = ; + }; + }; diff --git a/include/dt-bindings/iio/adc/fsl-imx25-gcq.h b/include/dt-bindings/iio/adc/fsl-imx25-gcq.h new file mode 100644 index ..87abdd4a7674 --- /dev/null +++ b/include/dt-bindings/iio/adc/fsl-imx25-gcq.h @@ -0,0 +1,18 @@ +/* + * This header provides constants for configuring the I.MX25 ADC + */ + +#ifndef _DT_BINDINGS_IIO_ADC_FS_IMX25_GCQ_H +#define _DT_BINDINGS_IIO_ADC_FS_IMX25_GCQ_H + +#define MX25_ADC_REFP_YP 0 /* YP voltage reference */ +#define MX25_ADC_REFP_XP 1 /* XP voltage reference */ +#define MX25_ADC_REFP_EXT 2 /* External voltage reference */ +#define MX25_ADC_REFP_INT 3 /* Internal voltage reference */ + +#define MX25_ADC_REFN_XN 0 /* XN ground reference */ +#define MX25_ADC_REFN_YN 1 /* YN ground reference */ +#define MX25_ADC_REFN_NGND 2 /* Internal ground reference */ +#define MX25_ADC_REFN_NGND23 /* External ground reference */ + +#endif -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v9 3/8] ARM: dt: Binding documentation for imx25 touchscreen controller
This is the touchscreen conversion queue binding documentation. It uses the shared imx25 ADC. Signed-off-by: Markus Pargmann --- Notes: Changes in v9: - Updated binding descriptions Changes in v5: - Fix signed/unsigned comparison - Fix unused variable settling_time by putting it in the correct argument list - Use continous conversion queue with the repeat feature and a proper repeat-wait. Previously the touchscreen caused massive number of interrupts. .../bindings/input/touchscreen/fsl-mx25-tcq.txt| 35 ++ 1 file changed, 35 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt diff --git a/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt new file mode 100644 index ..d45e50872114 --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt @@ -0,0 +1,35 @@ +Freescale mx25 TS conversion queue module + +mx25 touchscreen conversion queue module which controls the ADC unit of the +mx25 for attached touchscreens. + +Required properties: + - compatible: Should be "fsl,imx25-tcq". + - reg: Memory range of the device. + - interrupts: Should be the interrupt number associated with this module within + the tscadc unit (<0>). + - interrupt-parent: Should be a phandle to the tscadc unit. + - fsl,wires: Should be '<4>' or '<5>' + +Optional properties: + - fsl,pen-debounce: Pen debounce time in nanoseconds. + - fsl,pen-threshold: Pen-down threshold for the touchscreen. This is a value + between 1 and 4096. It is the ratio between the internal reference voltage + and the measured voltage after the plate was precharged. Resistence between + plates and therefore the voltage decreases with pressure so that a smaller + value is equivalent to a higher pressure. + - fsl,settling-time: Settling time in nanoseconds. The settling time is before + the actual touch detection to wait for an even charge distribution in the + plate. + +This device includes two conversion queues which can be added as subnodes. +The first queue is for the touchscreen, the second for general purpose ADC. + +Example: + tsc: tcq@50030400 { + compatible = "fsl,imx25-tcq"; + reg = <0x50030400 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <0>; + fsl,wires = <4>; + }; -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v9 6/8] input: touchscreen: imx25 tcq driver
This is a driver for the imx25 ADC/TSC module. It controls the touchscreen conversion queue and creates a touchscreen input device. The driver currently only supports 4 wire touchscreens. The driver uses a simple conversion queue of precharge, touch detection, X measurement, Y measurement, precharge and another touch detection. This driver uses the regmap from the parent to setup some touch specific settings in the core driver and setup a idle configuration with touch detection. Signed-off-by: Markus Pargmann Signed-off-by: Denis Carikli [fix clock's period calculation] [fix calculation of the 'settling' value] Signed-off-by: Juergen Borleis --- Notes: Changes in v9: - Added module description to Kconfig item - Fixed devm_ioremap_resource() return value check to use IS_ERR() - Removed return value of mx25_tcq_create_event_for_4wire() - Renamed most 'ret' variables through 'error' - Removed IRQF_ONESHOT - Rearranged threaded handler to not mix up samples from multiple measurements Changes in v7: - Moved clk_prepare_enable() and mx25_tcq_init() into mx25_tcq_open(). This was done to be able to use devm_request_threaded_irq(). - Cleanup of the probe function through above change - Removed mx25_tcq_remove(), not necessary now drivers/input/touchscreen/Kconfig | 9 + drivers/input/touchscreen/Makefile| 1 + drivers/input/touchscreen/fsl-imx25-tcq.c | 596 ++ 3 files changed, 606 insertions(+) create mode 100644 drivers/input/touchscreen/fsl-imx25-tcq.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index ae33da7ab51f..873bf3697e35 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -811,6 +811,15 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MX25 + tristate "Freescale i.MX25 touchscreen input driver" + depends on MFD_MX25_TSADC + help + Enable support for touchscreen connected to your i.MX25. + + To compile this driver as a module, choose M here: the + module will be called fsl-imx25-tcq. + config TOUCHSCREEN_MC13783 tristate "Freescale MC13783 touchscreen input driver" depends on MFD_MC13XXX diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index cbaa6abb08da..77a2ac54101a 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -45,6 +45,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o obj-$(CONFIG_TOUCHSCREEN_MIGOR)+= migor_ts.o diff --git a/drivers/input/touchscreen/fsl-imx25-tcq.c b/drivers/input/touchscreen/fsl-imx25-tcq.c new file mode 100644 index ..d1f3d7860ea5 --- /dev/null +++ b/drivers/input/touchscreen/fsl-imx25-tcq.c @@ -0,0 +1,596 @@ +/* + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + * + * Based on driver from 2011: + * Juergen Beisert, Pengutronix + * + * This is the driver for the imx25 TCQ (Touchscreen Conversion Queue) + * connected to the imx25 ADC. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char mx25_tcq_name[] = "mx25-tcq"; + +enum mx25_tcq_mode { + MX25_TS_4WIRE, +}; + +struct mx25_tcq_priv { + struct regmap *regs; + struct regmap *core_regs; + struct input_dev *idev; + enum mx25_tcq_mode mode; + unsigned int pen_threshold; + unsigned int sample_count; + unsigned int expected_samples; + unsigned int pen_debounce; + unsigned int settling_time; + struct clk *clk; + int irq; + struct device *dev; +}; + +static struct regmap_config mx25_tcq_regconfig = { + .fast_io = true, + .max_register = 0x5c, + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + +static const struct of_device_id mx25_tcq_ids[] = { + { .compatible = "fsl,imx25-tcq", }, + { /* Sentinel */ } +}; + +#define TSC_4WIRE_PRE_INDEX 0 +#define TSC_4WIRE_X_INDEX 1 +#define TSC_4WIRE_Y_INDEX 2 +#define TSC_4WIRE_POST_INDEX 3 +#define TSC_4WIRE_LEAVE 4 + +#define MX25_TSC_DEF_THRESHOLD 80 +#define TSC_MAX_SA
[PATCH v9 5/8] iio: adc: fsl,imx25-gcq driver
This is a conversion queue driver for the mx25 SoC. It uses the central ADC which is used by two seperate independent queues. This driver prepares different conversion configurations for each possible input. For a conversion it creates a conversionqueue of one item with the correct configuration for the chosen channel. It then executes the queue once and disables the conversion queue afterwards. The reference voltages are configurable through devicetree subnodes, depending on the connections of the ADC inputs. Signed-off-by: Markus Pargmann Signed-off-by: Denis Carikli --- Notes: Changes in v7: - Remove separate functions mx25_gcq_disable/enable_eoq() as they were used at only one position - Enforce an external reference regulator if one of the conversions uses it as reference. The devm_regulator_get() call was moved into mx25_gcq_setup_cfgs() to be able to acquire the reference regulator when necessary. - Store indio_dev as platform driver data instead of the private data. This was changed in probe() and remove(). Changes in v6: - Added defines for a complete list of references in the dt binding macros drivers/iio/adc/Kconfig | 7 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/fsl-imx25-gcq.c | 415 3 files changed, 423 insertions(+) create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 7868c744fd4b..73145c53ec2c 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -183,6 +183,13 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config FSL_MX25_ADC + tristate "Freescale MX25 ADC driver" + depends on MFD_MX25_TSADC + help + Generic Conversion Queue driver used for general purpose ADC in the + MX25. This driver supports single measurements using the MX25 ADC. + config HI8435 tristate "Holt Integrated Circuits HI-8435 threshold detector" select IIO_TRIGGERED_EVENT diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 99b37a963a1e..2fe9b78e4b02 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o obj-$(CONFIG_DA9150_GPADC) += da9150-gpadc.o obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o +obj-$(CONFIG_FSL_MX25_ADC) += fsl-imx25-gcq.o obj-$(CONFIG_HI8435) += hi8435.o obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o obj-$(CONFIG_MAX1027) += max1027.o diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c new file mode 100644 index ..eb9570876291 --- /dev/null +++ b/drivers/iio/adc/fsl-imx25-gcq.c @@ -0,0 +1,415 @@ +/* + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + * + * This is the driver for the imx25 GCQ (Generic Conversion Queue) + * connected to the imx25 ADC. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MX25_GCQ_TIMEOUT (msecs_to_jiffies(2000)) + +static const char * const driver_name = "mx25-gcq"; + +enum mx25_gcq_cfgs { + MX25_CFG_XP = 0, + MX25_CFG_YP, + MX25_CFG_XN, + MX25_CFG_YN, + MX25_CFG_WIPER, + MX25_CFG_INAUX0, + MX25_CFG_INAUX1, + MX25_CFG_INAUX2, + MX25_NUM_CFGS, +}; + +struct mx25_gcq_priv { + struct regmap *regs; + struct completion completed; + struct clk *clk; + int irq; + struct regulator *vref[4]; + u32 channel_vref_mv[MX25_NUM_CFGS]; +}; + +#define MX25_CQG_CHAN(chan, id) {\ + .type = IIO_VOLTAGE,\ + .indexed = 1,\ + .channel = chan,\ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ + BIT(IIO_CHAN_INFO_SCALE),\ + .datasheet_name = id,\ +} + +static const struct iio_chan_spec mx25_gcq_channels[MX25_NUM_CFGS] = { + MX25_CQG_CHAN(MX25_CFG_XP, "xp"), + MX25_CQG_CHAN(MX25_CFG_YP, "yp"), + MX25_CQG_CHAN(MX25_CFG_XN, "xn"), + MX25_CQG_CHAN(MX25_CFG_YN, "yn"), + MX25_CQG_CHAN(MX25_CFG_WIPER, "wiper"), + MX25_CQG_CHAN(MX25_CFG_INAUX0, "inaux0"), + MX25_CQG_CHAN(MX25_CFG_INAUX1, "inaux1"), + MX25_CQG_CHAN(MX25_CFG_INAUX2, "inaux2"), +}; + +static const char * const mx25_gcq_refp_names[] = { + [MX25_ADC_REFP_YP] = "yp", + [MX25_ADC_REFP_XP] = "xp", + [MX25_ADC_REFP_INT] = "int", + [MX25_ADC_REFP_EXT] = "ext", +}; + +static irqretu
[PATCH v9 7/8] ARM: dts: imx25: Add TSC and ADC support
From: Denis Carikli Signed-off-by: Denis Carikli Signed-off-by: Markus Pargmann --- arch/arm/boot/dts/imx25.dtsi | 29 ++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi index 677f81d9dcd5..6ac5e71d312b 100644 --- a/arch/arm/boot/dts/imx25.dtsi +++ b/arch/arm/boot/dts/imx25.dtsi @@ -265,13 +265,36 @@ status = "disabled"; }; - tsc: tsc@5003 { - compatible = "fsl,imx25-adc", "fsl,imx21-tsc"; - reg = <0x5003 0x4000>; + tscadc: tscadc@5003 { + compatible = "fsl,imx25-tsadc"; + reg = <0x5003 0xc>; interrupts = <46>; clocks = <&clks 119>; clock-names = "ipg"; + interrupt-controller; + #interrupt-cells = <1>; + #address-cells = <1>; + #size-cells = <1>; status = "disabled"; + + adc: adc@50030800 { + compatible = "fsl,imx25-gcq"; + reg = <0x50030800 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + tsc: tcq@50030400 { + compatible = "fsl,imx25-tcq"; + reg = <0x50030400 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <0>; + fsl,wires = <4>; + status = "disabled"; + }; }; ssi1: ssi@50034000 { -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v9 8/8] ARM: imx_v4_v5_defconfig: Add I.MX25 Touchscreen controller and ADC support.
From: Denis Carikli Signed-off-by: Denis Carikli Signed-off-by: Markus Pargmann --- arch/arm/configs/imx_v4_v5_defconfig | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig index d3a8018639de..d6754ac47788 100644 --- a/arch/arm/configs/imx_v4_v5_defconfig +++ b/arch/arm/configs/imx_v4_v5_defconfig @@ -88,6 +88,7 @@ CONFIG_KEYBOARD_IMX=y # CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_ADS7846=m +CONFIG_TOUCHSCREEN_MX25=y CONFIG_TOUCHSCREEN_MC13783=y # CONFIG_LEGACY_PTYS is not set CONFIG_SERIAL_8250=m @@ -107,6 +108,7 @@ CONFIG_HWMON=m CONFIG_SENSORS_MC13783_ADC=m CONFIG_WATCHDOG=y CONFIG_IMX2_WDT=y +CONFIG_MFD_MX25_TSADC=y CONFIG_MFD_MC13XXX_SPI=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y @@ -172,6 +174,8 @@ CONFIG_DMADEVICES=y CONFIG_IMX_SDMA=y CONFIG_IMX_DMA=y # CONFIG_IOMMU_SUPPORT is not set +CONFIG_IIO=y +CONFIG_FSL_MX25_ADC=y CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y CONFIG_EXT4_FS=y -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v9 0/8] imx25 adc and touchscreen driver
Hi, another larger restructuring of the touchscreen driver and some smaller changes in other parts. The changes are noted below each patch description. Best Regards, Markus Denis Carikli (2): ARM: dts: imx25: Add TSC and ADC support ARM: imx_v4_v5_defconfig: Add I.MX25 Touchscreen controller and ADC support. Markus Pargmann (6): ARM: dt: Binding documentation for imx25 ADC/TSC ARM: dt: Binding documentation for imx25 GCQ ARM: dt: Binding documentation for imx25 touchscreen controller mfd: fsl imx25 Touchscreen ADC driver iio: adc: fsl,imx25-gcq driver input: touchscreen: imx25 tcq driver .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 58 ++ .../bindings/input/touchscreen/fsl-mx25-tcq.txt| 35 ++ .../devicetree/bindings/mfd/fsl-imx25-tsadc.txt| 47 ++ arch/arm/boot/dts/imx25.dtsi | 29 +- arch/arm/configs/imx_v4_v5_defconfig | 4 + drivers/iio/adc/Kconfig| 7 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/fsl-imx25-gcq.c| 415 ++ drivers/input/touchscreen/Kconfig | 9 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/fsl-imx25-tcq.c | 596 + drivers/mfd/Kconfig| 9 + drivers/mfd/Makefile | 2 + drivers/mfd/fsl-imx25-tsadc.c | 203 +++ include/dt-bindings/iio/adc/fsl-imx25-gcq.h| 18 + include/linux/mfd/imx25-tsadc.h| 140 + 16 files changed, 1571 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt create mode 100644 Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt create mode 100644 Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c create mode 100644 drivers/input/touchscreen/fsl-imx25-tcq.c create mode 100644 drivers/mfd/fsl-imx25-tsadc.c create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h create mode 100644 include/linux/mfd/imx25-tsadc.h -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v9 4/8] mfd: fsl imx25 Touchscreen ADC driver
This is the core driver for imx25 touchscreen/adc driver. The module has one shared ADC and two different conversion queues which use the ADC. The two queues are identical. Both can be used for general purpose ADC but one is meant to be used for touchscreens. This driver is the core which manages the central components and registers of the TSC/ADC unit. It manages the IRQs and forwards them to the correct components. Signed-off-by: Markus Pargmann Signed-off-by: Denis Carikli [ensure correct ADC clock depending on the IPG clock] Signed-off-by: Juergen Borleis Acked-by: Jonathan Cameron --- Notes: Changes in v7: - Cleanup bit defines in header files to be more readable - Fix irq check to return with an error for irq <= 0 - Add COMPILE_TEST in Kconfig file Changes in v5: - Remove ifdef CONFIG_OF as this driver is only for DT usage - Remove module owner - Add Kconfig dependencies ARCH_MX25 and OF drivers/mfd/Kconfig | 9 ++ drivers/mfd/Makefile| 2 + drivers/mfd/fsl-imx25-tsadc.c | 203 include/linux/mfd/imx25-tsadc.h | 140 +++ 4 files changed, 354 insertions(+) create mode 100644 drivers/mfd/fsl-imx25-tsadc.c create mode 100644 include/linux/mfd/imx25-tsadc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 4d92df6ef9fe..4222e202ad2b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -271,6 +271,15 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MX25_TSADC + tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" + select REGMAP_MMIO + depends on (SOC_IMX25 && OF) || COMPILE_TEST + help + Enable support for the integrated Touchscreen and ADC unit of the + i.MX25 processors. They consist of a conversion queue for general + purpose ADC and a queue for Touchscreens. + config MFD_HI6421_PMIC tristate "HiSilicon Hi6421 PMU/Codec IC" depends on OF diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index a8b76b81b467..5741be88c173 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -81,6 +81,8 @@ obj-$(CONFIG_TWL4030_POWER)+= twl4030-power.o obj-$(CONFIG_MFD_TWL4030_AUDIO)+= twl4030-audio.o obj-$(CONFIG_TWL6040_CORE) += twl6040.o +obj-$(CONFIG_MFD_MX25_TSADC) += fsl-imx25-tsadc.o + obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c new file mode 100644 index ..77b2675cf8f5 --- /dev/null +++ b/drivers/mfd/fsl-imx25-tsadc.c @@ -0,0 +1,203 @@ +/* + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static struct regmap_config mx25_tsadc_regmap_config = { + .fast_io = true, + .max_register = 8, + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + +static void mx25_tsadc_irq_handler(struct irq_desc *desc) +{ + struct mx25_tsadc *tsadc = irq_desc_get_handler_data(desc); + struct irq_chip *chip = irq_desc_get_chip(desc); + u32 status; + + chained_irq_enter(chip, desc); + + regmap_read(tsadc->regs, MX25_TSC_TGSR, &status); + + if (status & MX25_TGSR_GCQ_INT) + generic_handle_irq(irq_find_mapping(tsadc->domain, 1)); + + if (status & MX25_TGSR_TCQ_INT) + generic_handle_irq(irq_find_mapping(tsadc->domain, 0)); + + chained_irq_exit(chip, desc); +} + +static int mx25_tsadc_domain_map(struct irq_domain *d, unsigned int irq, +irq_hw_number_t hwirq) +{ + struct mx25_tsadc *tsadc = d->host_data; + + irq_set_chip_data(irq, tsadc); + irq_set_chip_and_handler(irq, &dummy_irq_chip, +handle_level_irq); + irq_modify_status(irq, IRQ_NOREQUEST, IRQ_NOPROBE); + + return 0; +} + +static struct irq_domain_ops mx25_tsadc_domain_ops = { + .map = mx25_tsadc_domain_map, + .xlate = irq_domain_xlate_onecell, +}; + +static int mx25_tsadc_setup_irq(struct platform_device *pdev, + struct mx25_tsadc *tsadc) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + int irq; + + irq = platform_get_irq(pdev, 0); + if (irq <= 0) { + dev_err(dev, "Failed to get irq\n"); +
[PATCH v9 1/8] ARM: dt: Binding documentation for imx25 ADC/TSC
This documentation describes the devicetree bindings for the ADC/Touchscreen unit of the i.MX25 SoC. Signed-off-by: Markus Pargmann Acked-by: Jonathan Cameron Acked-by: Rob Herring --- Notes: Changes in v9: - Fixed some style things. Changes in v6: - Removed adc-ref property and replaced it with refp and refn for positive and negative references. The properties are optional now as the default behaviour is a positive internal reference voltage and ADC GND as negative reference. .../devicetree/bindings/mfd/fsl-imx25-tsadc.txt| 47 ++ 1 file changed, 47 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt diff --git a/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt b/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt new file mode 100644 index ..b03505286997 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt @@ -0,0 +1,47 @@ +Freescale MX25 ADC/TSC MultiFunction Device (MFD) + +This device combines two general purpose conversion queues one used for general +ADC and the other used for touchscreens. + +Required properties: + - compatible: Should be "fsl,imx25-tsadc". + - reg:Start address and size of the memory area of + the device + - interrupts: Interrupt for this device + (See: ../interrupt-controller/interrupts.txt) + - clocks: An 'ipg' clock (See: ../clock/clock-bindings.txt) + - interrupt-controller: This device is an interrupt controller. It + controls the interrupts of both + conversion queues. + - #interrupt-cells: Should be '<1>'. + - #address-cells: Should be '<1>'. + - #size-cells:Should be '<1>'. + +This device includes two conversion queues which can be added as subnodes. +The first queue is for the touchscreen, the second for general purpose ADC. + +Example: + tscadc: tscadc@5003 { + compatible = "fsl,imx25-tsadc"; + reg = <0x5003 0xc>; + interrupts = <46>; + clocks = <&clks 119>; + clock-names = "ipg"; + interrupt-controller; + #interrupt-cells = <1>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + tsc: tcq@50030400 { + compatible = "fsl,imx25-tcq"; + reg = <0x50030400 0x60>; + ... + }; + + adc: gcq@50030800 { + compatible = "fsl,imx25-gcq"; + reg = <0x50030800 0x60>; + ... + }; + }; -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 1/2] dt-bindings: GPIO: Add gpio-initval
Add a binding for GPIO initialization. Signed-off-by: Markus Pargmann --- Documentation/devicetree/bindings/gpio/gpio.txt | 34 - 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt index 069cdf6f9dac..d11abfa13add 100644 --- a/Documentation/devicetree/bindings/gpio/gpio.txt +++ b/Documentation/devicetree/bindings/gpio/gpio.txt @@ -155,29 +155,39 @@ gpio-controller@ { ngpios = <18>; } -The GPIO chip may contain GPIO hog definitions. GPIO hogging is a mechanism -providing automatic GPIO request and configuration as part of the -gpio-controller's driver probe function. +The GPIO chip may contain GPIO definitions. These define properties for single +GPIOs of this controller. -Each GPIO hog definition is represented as a child node of the GPIO controller. +There are two types of GPIO definitions: + +- GPIO hogging is a mechanism providing automatic GPIO request and + configuration as part of the gpio-controller driver's probe function. The + GPIO is held until the gpio-controller is removed. +- GPIO initialization provides an automatic initialization to known save + values. The GPIO can be used normally afterwards. + +Each GPIO definition is represented as a child node of the GPIO controller. Required properties: -- gpio-hog: A property specifying that this child node represent a GPIO hog. - gpios: Store the GPIO information (id, flags, ...). Shall contain the number of cells specified in its parent node (GPIO controller node). -Only one of the following properties scanned in the order shown below. -This means that when multiple properties are present they will be searched -in the order presented below and the first match is taken as the intended -configuration. + +Optional properties: +- line-name: The GPIO label name. If not present the node name is used. + + The following two options are mutually exclusive. One of them should be + specified, but not both: +- gpio-hog: A property specifying that this child node represent a GPIO hog. +- gpio-initval: This GPIO should be initialized to the specified configuration. + + The following three options are mutually exclusive. They change the setting of + the GPIO pin. One of them should be specified: - input: A property specifying to set the GPIO direction as input. - output-low A property specifying to set the GPIO direction as output with the value low. - output-high A property specifying to set the GPIO direction as output with the value high. -Optional properties: -- line-name: The GPIO label name. If not present the node name is used. - Example of two SOC GPIO banks defined as gpio-controller nodes: qe_pio_a: gpio-controller@1400 { -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 2/2] gpiolib: Add GPIO initialization
This functions adds a way to initialize a GPIO without hogging it. Signed-off-by: Markus Pargmann --- drivers/gpio/gpiolib-of.c | 13 - drivers/gpio/gpiolib.c| 26 ++ drivers/gpio/gpiolib.h| 2 ++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 5fe34a9df3e6..48cdc22eabf2 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -211,15 +211,18 @@ static void of_gpiochip_scan_gpios(struct gpio_chip *chip) enum gpiod_flags dflags; for_each_child_of_node(chip->of_node, np) { - if (!of_property_read_bool(np, "gpio-hog")) - continue; desc = of_parse_own_gpio(np, &name, &lflags, &dflags); - if (IS_ERR(desc)) + if (IS_ERR(desc) || !dflags) continue; - if (gpiod_hog(desc, name, lflags, dflags)) - continue; + if (of_property_read_bool(np, "gpio-hog")) + gpiod_hog(desc, name, lflags, dflags); + else if (of_property_read_bool(np, "gpio-initval")) + gpiod_initialize(desc, lflags, dflags); + else + dev_dbg(chip->dev, "GPIO line %d (%s): neither gpio-hog nor gpio-initval found.\n", + desc_to_gpio(desc), np->name); } } diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index a18f00fc1bb8..10e16b3f0667 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2329,6 +2329,32 @@ static void gpiochip_free_hogs(struct gpio_chip *chip) } /** + * gpiod_initialize - Initialize a GPIO with a given value + * @desc: gpio whose value will be assigned + * @lflags:gpio_lookup_flags - returned from of_find_gpio() or + * of_get_gpio_hog() + * @dflags:gpiod_flags - optional GPIO initialization flags + * + * This is used to initialize GPIOs that were defined in DT + */ +int gpiod_initialize(struct gpio_desc *desc, unsigned long lflags, +enum gpiod_flags dflags) +{ + int status; + + gpiod_parse_flags(desc, lflags); + + status = gpiod_configure_flags(desc, NULL, dflags); + if (status < 0) { + pr_err("initial setup of GPIO (chip %s, offset %d) failed\n", + gpiod_to_chip(desc)->label, gpio_chip_hwgpio(desc)); + return status; + } + + return 0; +} + +/** * gpiod_get_array - obtain multiple GPIOs from a multi-index GPIO function * @dev: GPIO consumer, can be NULL for system-global GPIOs * @con_id:function within the GPIO consumer diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 98ab08c0aa2d..4abf53a5e651 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -107,6 +107,8 @@ int gpiod_request(struct gpio_desc *desc, const char *label); void gpiod_free(struct gpio_desc *desc); int gpiod_hog(struct gpio_desc *desc, const char *name, unsigned long lflags, enum gpiod_flags dflags); +int gpiod_initialize(struct gpio_desc *desc, unsigned long lflags, +enum gpiod_flags dflags); /* * Return the GPIO number of the passed descriptor relative to its chip -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 0/2] gpiolib: Initializing GPIOs using DT property gpio-initval
Hi, sorry for the delay. Here is the next version of this series. I added gpiod_parse_flags() to the code for the initialization. Otherwise there are no differences. As the gpio-hog bindings already exist I didn't change the gpio-initval bindings. Best Regards, Markus Markus Pargmann (2): dt-bindings: GPIO: Add gpio-initval gpiolib: Add GPIO initialization Documentation/devicetree/bindings/gpio/gpio.txt | 34 - drivers/gpio/gpiolib-of.c | 13 ++ drivers/gpio/gpiolib.c | 26 +++ drivers/gpio/gpiolib.h | 2 ++ 4 files changed, 58 insertions(+), 17 deletions(-) -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 1/8] ARM: dt: Binding documentation for imx25 ADC/TSC
On Monday 23 November 2015 14:59:52 Lee Jones wrote: > On Mon, 16 Nov 2015, Markus Pargmann wrote: > > > This documentation describes the devicetree bindings for the > > ADC/Touchscreen unit of the i.MX25 SoC. > > > > Signed-off-by: Markus Pargmann > > Acked-by: Jonathan Cameron > > --- > > > > Notes: > > Changes in v6: > > - Removed adc-ref property and replaced it with refp and refn for > > positive and > >negative references. The properties are optional now as the default > >behaviour is a positive internal reference voltage and ADC GND as > > negative > >reference. > > > > .../devicetree/bindings/mfd/fsl-imx25-tsadc.txt| 46 > > ++ > > 1 file changed, 46 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt > > > > diff --git a/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt > > b/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt > > new file mode 100644 > > index ..a857af0eb68c > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt > > @@ -0,0 +1,46 @@ > > +Freescale mx25 ADC/TSC multifunction device > > Prefer "MX25" and "MultiFunction Device (MFD)" Fixed. > > > +This device combines two general purpose conversion queues one used for > > general > > +ADC and the other used for touchscreens. > > + > > +Required properties: > > + - compatible: Should be "fsl,imx25-tsadc". > > + - reg: Memory range of the device. > > Not exactly. More like start location and size. > > > + - interrupts: Interrupt for this device as described in > > + interrupts/interrupts.txt > > No such file. In any case, I'd prefer: > > "(See: ../interrupt-controller/interrupts.txt)". > > > + - clocks: An 'ipg' clock defined as described in clocks/clock.txt > > Didn't you check any of what you've written? > > "(See: ../clock/clock-bindings.txt)" Seems I didn't check these, sorry. > > > + - interrupt-controller: This device is an interrupt controller. It > > controls > > + the interrupts of both conversion queues. > > + - #interrupt-cells: Should be '<1>'. > > + - #address-cells: Should be '<1>'. > > + - #size-cells: Should be '<1>'. > > + - ranges > > ? > > Also, don't think think that this looks better/easier to read? Yes a bit, changed it. > > > +Required properties: > > + - compatible: Should be "fsl,imx25-tsadc". > > + - reg:Memory range of the device. > > + - interrupts: Interrupt for this device as described in > > + interrupts/interrupts.txt > > + - clocks: An 'ipg' clock defined as described in > > clocks/clock.txt > > + - interrupt-controller: This device is an interrupt controller. It > > controls > > + the interrupts of both conversion > > queues. > > + - #interrupt-cells: Should be '<1>'. > > + - #address-cells: Should be '<1>'. > > + - #size-cells:Should be '<1>'. > > [...] > > > +This device includes two conversion queues which can be added as subnodes. > > +The first queue is for the touchscreen, the second for general purpose ADC. > > + > > +Example: > > + tscadc: tscadc@5003 { > > + compatible = "fsl,imx25-tsadc"; > > + reg = <0x5003 0xc>; > > + interrupts = <46>; > > + clocks = <&clks 119>; > > + clock-names = "ipg"; > > I don't think this is required, if you only have a single clock. I prefer this variation so that you immediately see what the clock is for. The number is not terribly helpful. Thanks, Markus > > > + interrupt-controller; > > + #interrupt-cells = <1>; > > + #address-cells = <1>; > > + #size-cells = <1>; > > + ranges; > > + > > + tsc: tcq@50030400 { > > + compatible = "fsl,imx25-tcq"; > > + reg = <0x50030400 0x60>; > > + ... > > + }; > > + > > + adc: gcq@50030800 { > > + compatible = "fsl,imx25-gcq"; > > + reg = <0x50030800 0x60>; > > + ... > > + }; > > + }; > > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: This is a digitally signed message part.
Re: [PATCH v8 6/8] input: touchscreen: imx25 tcq driver
On Saturday 21 November 2015 17:48:10 Jonathan Cameron wrote: > On 16/11/15 12:01, Markus Pargmann wrote: > > This is a driver for the imx25 ADC/TSC module. It controls the > > touchscreen conversion queue and creates a touchscreen input device. > > The driver currently only supports 4 wire touchscreens. The driver uses > > a simple conversion queue of precharge, touch detection, X measurement, > > Y measurement, precharge and another touch detection. > > > > This driver uses the regmap from the parent to setup some touch specific > > settings in the core driver and setup a idle configuration with touch > > detection. > > > > Signed-off-by: Markus Pargmann > > Signed-off-by: Denis Carikli > > > > [fix clock's period calculation] > > [fix calculation of the 'settling' value] > > Signed-off-by: Juergen Borleis > I read this out of curiousity to see how you had handled the touchscreen > usecase of this hardware differently from the generic version. > > Anyhow, a few little bits and pieces inline from me as a result > > Jonathan > > --- > > > > Notes: > > Changes in v7: > > - Moved clk_prepare_enable() and mx25_tcq_init() into mx25_tcq_open(). > > This > >was done to be able to use devm_request_threaded_irq(). > > - Cleanup of the probe function through above change > > - Removed mx25_tcq_remove(), not necessary now > > > > drivers/input/touchscreen/Kconfig | 6 + > > drivers/input/touchscreen/Makefile| 1 + > > drivers/input/touchscreen/fsl-imx25-tcq.c | 600 > > ++ > > 3 files changed, 607 insertions(+) > > create mode 100644 drivers/input/touchscreen/fsl-imx25-tcq.c > > > > diff --git a/drivers/input/touchscreen/Kconfig > > b/drivers/input/touchscreen/Kconfig > > index ae33da7ab51f..b44651d33080 100644 > > --- a/drivers/input/touchscreen/Kconfig > > +++ b/drivers/input/touchscreen/Kconfig > > @@ -811,6 +811,12 @@ config TOUCHSCREEN_USB_COMPOSITE > > To compile this driver as a module, choose M here: the > > module will be called usbtouchscreen. > > > > +config TOUCHSCREEN_MX25 > > + tristate "Freescale i.MX25 touchscreen input driver" > > + depends on MFD_MX25_TSADC > > + help > > + Enable support for touchscreen connected to your i.MX25. > > + > > config TOUCHSCREEN_MC13783 > > tristate "Freescale MC13783 touchscreen input driver" > > depends on MFD_MC13XXX > > diff --git a/drivers/input/touchscreen/Makefile > > b/drivers/input/touchscreen/Makefile > > index cbaa6abb08da..77a2ac54101a 100644 > > --- a/drivers/input/touchscreen/Makefile > > +++ b/drivers/input/touchscreen/Makefile > > @@ -45,6 +45,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += > > intel-mid-touch.o > > obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o > > obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o > > obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o > > +obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o > > obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o > > obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o > > obj-$(CONFIG_TOUCHSCREEN_MIGOR)+= migor_ts.o > > diff --git a/drivers/input/touchscreen/fsl-imx25-tcq.c > > b/drivers/input/touchscreen/fsl-imx25-tcq.c > > new file mode 100644 > > index ..c833cd814972 > > --- /dev/null > > +++ b/drivers/input/touchscreen/fsl-imx25-tcq.c > > @@ -0,0 +1,600 @@ > > +/* > > + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann > > > > + * > > + * This program is free software; you can redistribute it and/or modify it > > under > > + * the terms of the GNU General Public License version 2 as published by > > the > > + * Free Software Foundation. > > + * > > + * Based on driver from 2011: > > + * Juergen Beisert, Pengutronix > > + * > > + * This is the driver for the imx25 TCQ (Touchscreen Conversion Queue) > > + * connected to the imx25 ADC. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +static const char mx25_tcq_name[] = "mx25-tcq"; > > + > > +enum mx25_tcq_mode { > > + MX25_TS_4WIRE, > > +}; > > + > > +struct mx25_tcq_priv { > > + struct regmap *regs; > > + struct regmap *core
Re: [PATCH v8 4/8] mfd: fsl imx25 Touchscreen ADC driver
On Saturday 21 November 2015 17:02:34 Jonathan Cameron wrote: > On 16/11/15 12:01, Markus Pargmann wrote: > > This is the core driver for imx25 touchscreen/adc driver. The module > > has one shared ADC and two different conversion queues which use the > > ADC. The two queues are identical. Both can be used for general purpose > > ADC but one is meant to be used for touchscreens. > > > > This driver is the core which manages the central components and > > registers of the TSC/ADC unit. It manages the IRQs and forwards them to > > the correct components. > > > > Signed-off-by: Markus Pargmann > > Signed-off-by: Denis Carikli > > > > [ensure correct ADC clock depending on the IPG clock] > > Signed-off-by: Juergen Borleis > Looks good to me - one query on meaning of a comment inline. > > Acked-by: Jonathan Cameron Thanks, comment inline. > > I'm taking the view this series wants to go through the MFD tree > but don't mind if it goes through IIO or input instead > if there is a good reason to do so. > > Jonathan > > --- > > > > Notes: > > Changes in v7: > > - Cleanup bit defines in header files to be more readable > > - Fix irq check to return with an error for irq <= 0 > > - Add COMPILE_TEST in Kconfig file > > > > Changes in v5: > > - Remove ifdef CONFIG_OF as this driver is only for DT usage > > - Remove module owner > > - Add Kconfig dependencies ARCH_MX25 and OF > > > > @Jonathan Cameron: > > I left your acked-by on the patch as these were small changes. If it > > should be > > removed, please say so. Thanks > > > > drivers/mfd/Kconfig | 9 ++ > > drivers/mfd/Makefile| 2 + > > drivers/mfd/fsl-imx25-tsadc.c | 204 > > > > include/linux/mfd/imx25-tsadc.h | 140 +++ > > 4 files changed, 355 insertions(+) > > create mode 100644 drivers/mfd/fsl-imx25-tsadc.c > > create mode 100644 include/linux/mfd/imx25-tsadc.h > > > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > > index 4d92df6ef9fe..4222e202ad2b 100644 > > --- a/drivers/mfd/Kconfig > > +++ b/drivers/mfd/Kconfig > > @@ -271,6 +271,15 @@ config MFD_MC13XXX_I2C > > help > > Select this if your MC13xxx is connected via an I2C bus. > > > > +config MFD_MX25_TSADC > > + tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" > > + select REGMAP_MMIO > > + depends on (SOC_IMX25 && OF) || COMPILE_TEST > > + help > > + Enable support for the integrated Touchscreen and ADC unit of the > > + i.MX25 processors. They consist of a conversion queue for general > > + purpose ADC and a queue for Touchscreens. > > + > > config MFD_HI6421_PMIC > > tristate "HiSilicon Hi6421 PMU/Codec IC" > > depends on OF > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > > index a8b76b81b467..5741be88c173 100644 > > --- a/drivers/mfd/Makefile > > +++ b/drivers/mfd/Makefile > > @@ -81,6 +81,8 @@ obj-$(CONFIG_TWL4030_POWER)+= twl4030-power.o > > obj-$(CONFIG_MFD_TWL4030_AUDIO)+= twl4030-audio.o > > obj-$(CONFIG_TWL6040_CORE) += twl6040.o > > > > +obj-$(CONFIG_MFD_MX25_TSADC) += fsl-imx25-tsadc.o > > + > > obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o > > obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o > > obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o > > diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c > > new file mode 100644 > > index ..e67d5ca81e10 > > --- /dev/null > > +++ b/drivers/mfd/fsl-imx25-tsadc.c > > @@ -0,0 +1,204 @@ > > +/* > > + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann > > > > + * > > + * This program is free software; you can redistribute it and/or modify it > > under > > + * the terms of the GNU General Public License version 2 as published by > > the > > + * Free Software Foundation. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +static struct regmap_config mx25_tsadc_regmap_config = { > > + .fast_io = true, > > + .max_register = 8, > > + .reg_bits = 32, > > + .val_
Re: [PATCH v8 6/8] input: touchscreen: imx25 tcq driver
Hi, On Tuesday 17 November 2015 10:17:20 Dmitry Torokhov wrote: > On Mon, Nov 16, 2015 at 01:01:07PM +0100, Markus Pargmann wrote: > > This is a driver for the imx25 ADC/TSC module. It controls the > > touchscreen conversion queue and creates a touchscreen input device. > > The driver currently only supports 4 wire touchscreens. The driver uses > > a simple conversion queue of precharge, touch detection, X measurement, > > Y measurement, precharge and another touch detection. > > > > This driver uses the regmap from the parent to setup some touch specific > > settings in the core driver and setup a idle configuration with touch > > detection. > > > > Signed-off-by: Markus Pargmann > > Signed-off-by: Denis Carikli > > > > [fix clock's period calculation] > > [fix calculation of the 'settling' value] > > Signed-off-by: Juergen Borleis > > --- > > > > Notes: > > Changes in v7: > > - Moved clk_prepare_enable() and mx25_tcq_init() into mx25_tcq_open(). > > This > >was done to be able to use devm_request_threaded_irq(). > > - Cleanup of the probe function through above change > > - Removed mx25_tcq_remove(), not necessary now > > > > drivers/input/touchscreen/Kconfig | 6 + > > drivers/input/touchscreen/Makefile| 1 + > > drivers/input/touchscreen/fsl-imx25-tcq.c | 600 > > ++ > > 3 files changed, 607 insertions(+) > > create mode 100644 drivers/input/touchscreen/fsl-imx25-tcq.c > > > > diff --git a/drivers/input/touchscreen/Kconfig > > b/drivers/input/touchscreen/Kconfig > > index ae33da7ab51f..b44651d33080 100644 > > --- a/drivers/input/touchscreen/Kconfig > > +++ b/drivers/input/touchscreen/Kconfig > > @@ -811,6 +811,12 @@ config TOUCHSCREEN_USB_COMPOSITE > > To compile this driver as a module, choose M here: the > > module will be called usbtouchscreen. > > > > +config TOUCHSCREEN_MX25 > > + tristate "Freescale i.MX25 touchscreen input driver" > > + depends on MFD_MX25_TSADC > > + help > > + Enable support for touchscreen connected to your i.MX25. > > + > > To compile this driver as a module... > > > config TOUCHSCREEN_MC13783 > > tristate "Freescale MC13783 touchscreen input driver" > > depends on MFD_MC13XXX > > diff --git a/drivers/input/touchscreen/Makefile > > b/drivers/input/touchscreen/Makefile > > index cbaa6abb08da..77a2ac54101a 100644 > > --- a/drivers/input/touchscreen/Makefile > > +++ b/drivers/input/touchscreen/Makefile > > @@ -45,6 +45,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += > > intel-mid-touch.o > > obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o > > obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o > > obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o > > +obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o > > obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o > > obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o > > obj-$(CONFIG_TOUCHSCREEN_MIGOR)+= migor_ts.o > > diff --git a/drivers/input/touchscreen/fsl-imx25-tcq.c > > b/drivers/input/touchscreen/fsl-imx25-tcq.c > > new file mode 100644 > > index ..c833cd814972 > > --- /dev/null > > +++ b/drivers/input/touchscreen/fsl-imx25-tcq.c > > @@ -0,0 +1,600 @@ > > +/* > > + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann > > > > + * > > + * This program is free software; you can redistribute it and/or modify it > > under > > + * the terms of the GNU General Public License version 2 as published by > > the > > + * Free Software Foundation. > > + * > > + * Based on driver from 2011: > > + * Juergen Beisert, Pengutronix > > + * > > + * This is the driver for the imx25 TCQ (Touchscreen Conversion Queue) > > + * connected to the imx25 ADC. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +static const char mx25_tcq_name[] = "mx25-tcq"; > > + > > +enum mx25_tcq_mode { > > + MX25_TS_4WIRE, > > +}; > > + > > +struct mx25_tcq_priv { > > + struct regmap *regs; > > + struct regmap *core_regs; > > + struct input_dev *idev; > > + enum mx25_tcq_mode mode; > > + unsigned int pen_threshold; > > + unsigned int
Re: [PATCH v3 2/2] gpiolib: Add GPIO initialization
Hi, On Tuesday 17 November 2015 11:07:58 Markus Pargmann wrote: [...] > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > index a18f00fc1bb8..3b35f2fafeb2 100644 > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -2329,6 +2329,30 @@ static void gpiochip_free_hogs(struct gpio_chip *chip) > } > > /** > + * gpiod_initialize - Initialize a GPIO with a given value > + * @desc:gpio whose value will be assigned > + * @lflags: gpio_lookup_flags - returned from of_find_gpio() or > + * of_get_gpio_hog() > + * @dflags: gpiod_flags - optional GPIO initialization flags > + * > + * This is used to initialize GPIOs that were defined in DT > + */ > +int gpiod_initialize(struct gpio_desc *desc, unsigned long lflags, > + enum gpiod_flags dflags) > +{ > + int status; > + Sorry, this is missing a gpiod_parse_flags(). Will fix this and resend tomorrow. Best Regards, Markus > + status = gpiod_configure_flags(desc, NULL, dflags); > + if (status < 0) { > + pr_err("initial setup of GPIO (chip %s, offset %d) failed\n", > +gpiod_to_chip(desc)->label, gpio_chip_hwgpio(desc)); > + return status; > + } > + > + return 0; > +} > + > +/** > * gpiod_get_array - obtain multiple GPIOs from a multi-index GPIO function > * @dev: GPIO consumer, can be NULL for system-global GPIOs > * @con_id: function within the GPIO consumer > diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h > index 98ab08c0aa2d..4abf53a5e651 100644 > --- a/drivers/gpio/gpiolib.h > +++ b/drivers/gpio/gpiolib.h > @@ -107,6 +107,8 @@ int gpiod_request(struct gpio_desc *desc, const char > *label); > void gpiod_free(struct gpio_desc *desc); > int gpiod_hog(struct gpio_desc *desc, const char *name, > unsigned long lflags, enum gpiod_flags dflags); > +int gpiod_initialize(struct gpio_desc *desc, unsigned long lflags, > + enum gpiod_flags dflags); > > /* > * Return the GPIO number of the passed descriptor relative to its chip > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: This is a digitally signed message part.
[PATCH v3 0/2] gpiolib: Initializing GPIOs using DT property gpio-initval
Hi, I completely forgot this series. Here is an update. This series adds a gpio-initval property to the devicetree. It provides a way to initialize GPIOs to a defined value. In v3 I splitted the patch into dt-bindings and the gpiolib patch. This series is now based on v4.4-rc1. gpiod_initialize() does not use common code with gpiod_hog anymore. Best Regards, Markus Markus Pargmann (2): dt-bindings: GPIO: Add gpio-initval gpiolib: Add GPIO initialization Documentation/devicetree/bindings/gpio/gpio.txt | 34 - drivers/gpio/gpiolib-of.c | 13 ++ drivers/gpio/gpiolib.c | 24 + drivers/gpio/gpiolib.h | 2 ++ 4 files changed, 56 insertions(+), 17 deletions(-) -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/2] dt-bindings: GPIO: Add gpio-initval
Add a binding for GPIO initialization. Signed-off-by: Markus Pargmann --- Documentation/devicetree/bindings/gpio/gpio.txt | 34 - 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt index 069cdf6f9dac..d11abfa13add 100644 --- a/Documentation/devicetree/bindings/gpio/gpio.txt +++ b/Documentation/devicetree/bindings/gpio/gpio.txt @@ -155,29 +155,39 @@ gpio-controller@ { ngpios = <18>; } -The GPIO chip may contain GPIO hog definitions. GPIO hogging is a mechanism -providing automatic GPIO request and configuration as part of the -gpio-controller's driver probe function. +The GPIO chip may contain GPIO definitions. These define properties for single +GPIOs of this controller. -Each GPIO hog definition is represented as a child node of the GPIO controller. +There are two types of GPIO definitions: + +- GPIO hogging is a mechanism providing automatic GPIO request and + configuration as part of the gpio-controller driver's probe function. The + GPIO is held until the gpio-controller is removed. +- GPIO initialization provides an automatic initialization to known save + values. The GPIO can be used normally afterwards. + +Each GPIO definition is represented as a child node of the GPIO controller. Required properties: -- gpio-hog: A property specifying that this child node represent a GPIO hog. - gpios: Store the GPIO information (id, flags, ...). Shall contain the number of cells specified in its parent node (GPIO controller node). -Only one of the following properties scanned in the order shown below. -This means that when multiple properties are present they will be searched -in the order presented below and the first match is taken as the intended -configuration. + +Optional properties: +- line-name: The GPIO label name. If not present the node name is used. + + The following two options are mutually exclusive. One of them should be + specified, but not both: +- gpio-hog: A property specifying that this child node represent a GPIO hog. +- gpio-initval: This GPIO should be initialized to the specified configuration. + + The following three options are mutually exclusive. They change the setting of + the GPIO pin. One of them should be specified: - input: A property specifying to set the GPIO direction as input. - output-low A property specifying to set the GPIO direction as output with the value low. - output-high A property specifying to set the GPIO direction as output with the value high. -Optional properties: -- line-name: The GPIO label name. If not present the node name is used. - Example of two SOC GPIO banks defined as gpio-controller nodes: qe_pio_a: gpio-controller@1400 { -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 2/2] gpiolib: Add GPIO initialization
This functions adds a way to initialize a GPIO without hogging it. Signed-off-by: Markus Pargmann --- drivers/gpio/gpiolib-of.c | 13 - drivers/gpio/gpiolib.c| 24 drivers/gpio/gpiolib.h| 2 ++ 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 5fe34a9df3e6..48cdc22eabf2 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -211,15 +211,18 @@ static void of_gpiochip_scan_gpios(struct gpio_chip *chip) enum gpiod_flags dflags; for_each_child_of_node(chip->of_node, np) { - if (!of_property_read_bool(np, "gpio-hog")) - continue; desc = of_parse_own_gpio(np, &name, &lflags, &dflags); - if (IS_ERR(desc)) + if (IS_ERR(desc) || !dflags) continue; - if (gpiod_hog(desc, name, lflags, dflags)) - continue; + if (of_property_read_bool(np, "gpio-hog")) + gpiod_hog(desc, name, lflags, dflags); + else if (of_property_read_bool(np, "gpio-initval")) + gpiod_initialize(desc, lflags, dflags); + else + dev_dbg(chip->dev, "GPIO line %d (%s): neither gpio-hog nor gpio-initval found.\n", + desc_to_gpio(desc), np->name); } } diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index a18f00fc1bb8..3b35f2fafeb2 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2329,6 +2329,30 @@ static void gpiochip_free_hogs(struct gpio_chip *chip) } /** + * gpiod_initialize - Initialize a GPIO with a given value + * @desc: gpio whose value will be assigned + * @lflags:gpio_lookup_flags - returned from of_find_gpio() or + * of_get_gpio_hog() + * @dflags:gpiod_flags - optional GPIO initialization flags + * + * This is used to initialize GPIOs that were defined in DT + */ +int gpiod_initialize(struct gpio_desc *desc, unsigned long lflags, +enum gpiod_flags dflags) +{ + int status; + + status = gpiod_configure_flags(desc, NULL, dflags); + if (status < 0) { + pr_err("initial setup of GPIO (chip %s, offset %d) failed\n", + gpiod_to_chip(desc)->label, gpio_chip_hwgpio(desc)); + return status; + } + + return 0; +} + +/** * gpiod_get_array - obtain multiple GPIOs from a multi-index GPIO function * @dev: GPIO consumer, can be NULL for system-global GPIOs * @con_id:function within the GPIO consumer diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 98ab08c0aa2d..4abf53a5e651 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -107,6 +107,8 @@ int gpiod_request(struct gpio_desc *desc, const char *label); void gpiod_free(struct gpio_desc *desc); int gpiod_hog(struct gpio_desc *desc, const char *name, unsigned long lflags, enum gpiod_flags dflags); +int gpiod_initialize(struct gpio_desc *desc, unsigned long lflags, +enum gpiod_flags dflags); /* * Return the GPIO number of the passed descriptor relative to its chip -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 3/8] ARM: dt: Binding documentation for imx25 touchscreen controller
Hi, On Monday 16 November 2015 08:16:09 Rob Herring wrote: > On Mon, Nov 16, 2015 at 01:01:04PM +0100, Markus Pargmann wrote: > > This is the touchscreen conversion queue binding documentation. It uses > > the shared imx25 ADC. > > > > Signed-off-by: Markus Pargmann > > --- > > > > Notes: > > Changes in v5: > > - Fix signed/unsigned comparison > > - Fix unused variable settling_time by putting it in the correct > > argument list > > - Use continous conversion queue with the repeat feature and a proper > >repeat-wait. Previously the touchscreen caused massive number of > > interrupts. > > > > .../bindings/input/touchscreen/fsl-mx25-tcq.txt| 29 > > ++ > > 1 file changed, 29 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt > > > > diff --git > > a/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt > > b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt > > new file mode 100644 > > index ..89ab47a3acc1 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt > > @@ -0,0 +1,29 @@ > > +Freescale mx25 TS conversion queue module > > + > > +mx25 touchscreen conversion queue module which controls the ADC unit of the > > +mx25 for attached touchscreens. > > + > > +Required properties: > > + - compatible: Should be "fsl,imx25-tcq". > > + - reg: Memory range of the device. > > + - interrupts: Should be the interrupt number associated with this module > > within > > + the tscadc unit (<0>). > > + - interrupt-parent: Should be a phandle to the tscadc unit. > > + - fsl,wires: Should be '<4>' or '<5>' > > + > > +Optional properties: > > + - fsl,pen-debounce: Pen debounce time in nanoseconds. > > + - fsl,pen-threshold: Pen-down threshold for the touchscreen. > > + - fsl,settling-time: Settling time in nanoseconds. > > Don't we have standard properties for these? If not, these should have > units. I just found properties like 'debounce_timeout' without a vendor prefix but they don't seem to be standard properties: Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt For fsl,pen-threshold there is no real unit. It is the ratio between the internal voltage reference and the measured voltage after one of the touchscreen plates was precharged. However there are limits, I will add a better description. > > I don't understand the difference between debounce and settling times. > Please make that clear in the doc. The settling time is the time waited after charging the touchscreen plates. The pen-debounce time is a delay after a pen down has been detected. Best Regards, Markus > > Rob > > > ___ > linux-arm-kernel mailing list > linux-arm-ker...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: This is a digitally signed message part.
Re: [PATCH v8 2/8] ARM: dt: Binding documentation for imx25 GCQ
On Monday 16 November 2015 09:12:55 Rob Herring wrote: > On Mon, Nov 16, 2015 at 01:01:03PM +0100, Markus Pargmann wrote: > > The documentation describes the bindings for the imx25 GCQ unit which is > > essentially a generic conversion queue using the imx25 ADC. > > > > Signed-off-by: Markus Pargmann > > --- > > > > Notes: > > Changes in v6: > > - Changed bindings to use adc-refp and adc-refn. Also a bit of cleanup > > in the > >setup routine. > > > > Changes in v5: > > - Fixed locking > > - Removed module owner > > > > .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 58 > > ++ > > 1 file changed, 58 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt > > > > diff --git a/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt > > b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt > > new file mode 100644 > > index ..b0866d36a307 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt > > > > +Optional properties for subnodes: > > + - fsl,adc-refp: specifies the positive reference input as defined in > > + > > + - fsl,adc-refn: specifies the negative reference input as defined in > > + > > This header should be part of this commit. Thanks, will fix that. Best Regards, Markus > > > + > > +Example: > > + > > + adc: adc@50030800 { > > + compatible = "fsl,imx25-gcq"; > > + reg = <0x50030800 0x60>; > > + interrupt-parent = <&tscadc>; > > + interrupts = <1>; > > + #address-cells = <1>; > > + #size-cells = <0>; > > + > > + inaux@5 { > > + reg = <5>; > > + fsl,adc-refp = ; > > + fsl,adc-refn = ; > > + }; > > + }; > > ___ > linux-arm-kernel mailing list > linux-arm-ker...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: This is a digitally signed message part.
[PATCH v8 1/8] ARM: dt: Binding documentation for imx25 ADC/TSC
This documentation describes the devicetree bindings for the ADC/Touchscreen unit of the i.MX25 SoC. Signed-off-by: Markus Pargmann Acked-by: Jonathan Cameron --- Notes: Changes in v6: - Removed adc-ref property and replaced it with refp and refn for positive and negative references. The properties are optional now as the default behaviour is a positive internal reference voltage and ADC GND as negative reference. .../devicetree/bindings/mfd/fsl-imx25-tsadc.txt| 46 ++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt diff --git a/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt b/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt new file mode 100644 index ..a857af0eb68c --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt @@ -0,0 +1,46 @@ +Freescale mx25 ADC/TSC multifunction device + +This device combines two general purpose conversion queues one used for general +ADC and the other used for touchscreens. + +Required properties: + - compatible: Should be "fsl,imx25-tsadc". + - reg: Memory range of the device. + - interrupts: Interrupt for this device as described in + interrupts/interrupts.txt + - clocks: An 'ipg' clock defined as described in clocks/clock.txt + - interrupt-controller: This device is an interrupt controller. It controls + the interrupts of both conversion queues. + - #interrupt-cells: Should be '<1>'. + - #address-cells: Should be '<1>'. + - #size-cells: Should be '<1>'. + - ranges + +This device includes two conversion queues which can be added as subnodes. +The first queue is for the touchscreen, the second for general purpose ADC. + +Example: + tscadc: tscadc@5003 { + compatible = "fsl,imx25-tsadc"; + reg = <0x5003 0xc>; + interrupts = <46>; + clocks = <&clks 119>; + clock-names = "ipg"; + interrupt-controller; + #interrupt-cells = <1>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + tsc: tcq@50030400 { + compatible = "fsl,imx25-tcq"; + reg = <0x50030400 0x60>; + ... + }; + + adc: gcq@50030800 { + compatible = "fsl,imx25-gcq"; + reg = <0x50030800 0x60>; + ... + }; + }; -- 2.6.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 8/8] ARM: imx_v4_v5_defconfig: Add I.MX25 Touchscreen controller and ADC support.
From: Denis Carikli Signed-off-by: Denis Carikli Signed-off-by: Markus Pargmann --- arch/arm/configs/imx_v4_v5_defconfig | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig index d3a8018639de..d6754ac47788 100644 --- a/arch/arm/configs/imx_v4_v5_defconfig +++ b/arch/arm/configs/imx_v4_v5_defconfig @@ -88,6 +88,7 @@ CONFIG_KEYBOARD_IMX=y # CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_ADS7846=m +CONFIG_TOUCHSCREEN_MX25=y CONFIG_TOUCHSCREEN_MC13783=y # CONFIG_LEGACY_PTYS is not set CONFIG_SERIAL_8250=m @@ -107,6 +108,7 @@ CONFIG_HWMON=m CONFIG_SENSORS_MC13783_ADC=m CONFIG_WATCHDOG=y CONFIG_IMX2_WDT=y +CONFIG_MFD_MX25_TSADC=y CONFIG_MFD_MC13XXX_SPI=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y @@ -172,6 +174,8 @@ CONFIG_DMADEVICES=y CONFIG_IMX_SDMA=y CONFIG_IMX_DMA=y # CONFIG_IOMMU_SUPPORT is not set +CONFIG_IIO=y +CONFIG_FSL_MX25_ADC=y CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y CONFIG_EXT4_FS=y -- 2.6.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 5/8] iio: adc: fsl,imx25-gcq driver
This is a conversion queue driver for the mx25 SoC. It uses the central ADC which is used by two seperate independent queues. This driver prepares different conversion configurations for each possible input. For a conversion it creates a conversionqueue of one item with the correct configuration for the chosen channel. It then executes the queue once and disables the conversion queue afterwards. The reference voltages are configurable through devicetree subnodes, depending on the connections of the ADC inputs. Signed-off-by: Markus Pargmann Signed-off-by: Denis Carikli --- Notes: Changes in v7: - Remove separate functions mx25_gcq_disable/enable_eoq() as they were used at only one position - Enforce an external reference regulator if one of the conversions uses it as reference. The devm_regulator_get() call was moved into mx25_gcq_setup_cfgs() to be able to acquire the reference regulator when necessary. - Store indio_dev as platform driver data instead of the private data. This was changed in probe() and remove(). Changes in v6: - Added defines for a complete list of references in the dt binding macros drivers/iio/adc/Kconfig | 7 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/fsl-imx25-gcq.c | 415 include/dt-bindings/iio/adc/fsl-imx25-gcq.h | 18 ++ 4 files changed, 441 insertions(+) create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 7868c744fd4b..73145c53ec2c 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -183,6 +183,13 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config FSL_MX25_ADC + tristate "Freescale MX25 ADC driver" + depends on MFD_MX25_TSADC + help + Generic Conversion Queue driver used for general purpose ADC in the + MX25. This driver supports single measurements using the MX25 ADC. + config HI8435 tristate "Holt Integrated Circuits HI-8435 threshold detector" select IIO_TRIGGERED_EVENT diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 99b37a963a1e..2fe9b78e4b02 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o obj-$(CONFIG_DA9150_GPADC) += da9150-gpadc.o obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o +obj-$(CONFIG_FSL_MX25_ADC) += fsl-imx25-gcq.o obj-$(CONFIG_HI8435) += hi8435.o obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o obj-$(CONFIG_MAX1027) += max1027.o diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c new file mode 100644 index ..eb9570876291 --- /dev/null +++ b/drivers/iio/adc/fsl-imx25-gcq.c @@ -0,0 +1,415 @@ +/* + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + * + * This is the driver for the imx25 GCQ (Generic Conversion Queue) + * connected to the imx25 ADC. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MX25_GCQ_TIMEOUT (msecs_to_jiffies(2000)) + +static const char * const driver_name = "mx25-gcq"; + +enum mx25_gcq_cfgs { + MX25_CFG_XP = 0, + MX25_CFG_YP, + MX25_CFG_XN, + MX25_CFG_YN, + MX25_CFG_WIPER, + MX25_CFG_INAUX0, + MX25_CFG_INAUX1, + MX25_CFG_INAUX2, + MX25_NUM_CFGS, +}; + +struct mx25_gcq_priv { + struct regmap *regs; + struct completion completed; + struct clk *clk; + int irq; + struct regulator *vref[4]; + u32 channel_vref_mv[MX25_NUM_CFGS]; +}; + +#define MX25_CQG_CHAN(chan, id) {\ + .type = IIO_VOLTAGE,\ + .indexed = 1,\ + .channel = chan,\ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ + BIT(IIO_CHAN_INFO_SCALE),\ + .datasheet_name = id,\ +} + +static const struct iio_chan_spec mx25_gcq_channels[MX25_NUM_CFGS] = { + MX25_CQG_CHAN(MX25_CFG_XP, "xp"), + MX25_CQG_CHAN(MX25_CFG_YP, "yp"), + MX25_CQG_CHAN(MX25_CFG_XN, "xn"), + MX25_CQG_CHAN(MX25_CFG_YN, "yn"), + MX25_CQG_CHAN(MX25_CFG_WIPER, "wiper"), + MX25_CQG_CHAN(MX25_CFG_INAUX0, "inaux0"), + MX25_CQG_CHAN(MX25_CFG_INAUX1, "inaux1"), + MX25_CQG_CHAN(MX25_CFG_INAUX2, "inaux2"), +}; + +static const char * const mx25_gcq_refp_names[] = { + [MX25_ADC_REFP_YP] = "yp", + [MX25_
[PATCH v8 6/8] input: touchscreen: imx25 tcq driver
This is a driver for the imx25 ADC/TSC module. It controls the touchscreen conversion queue and creates a touchscreen input device. The driver currently only supports 4 wire touchscreens. The driver uses a simple conversion queue of precharge, touch detection, X measurement, Y measurement, precharge and another touch detection. This driver uses the regmap from the parent to setup some touch specific settings in the core driver and setup a idle configuration with touch detection. Signed-off-by: Markus Pargmann Signed-off-by: Denis Carikli [fix clock's period calculation] [fix calculation of the 'settling' value] Signed-off-by: Juergen Borleis --- Notes: Changes in v7: - Moved clk_prepare_enable() and mx25_tcq_init() into mx25_tcq_open(). This was done to be able to use devm_request_threaded_irq(). - Cleanup of the probe function through above change - Removed mx25_tcq_remove(), not necessary now drivers/input/touchscreen/Kconfig | 6 + drivers/input/touchscreen/Makefile| 1 + drivers/input/touchscreen/fsl-imx25-tcq.c | 600 ++ 3 files changed, 607 insertions(+) create mode 100644 drivers/input/touchscreen/fsl-imx25-tcq.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index ae33da7ab51f..b44651d33080 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -811,6 +811,12 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MX25 + tristate "Freescale i.MX25 touchscreen input driver" + depends on MFD_MX25_TSADC + help + Enable support for touchscreen connected to your i.MX25. + config TOUCHSCREEN_MC13783 tristate "Freescale MC13783 touchscreen input driver" depends on MFD_MC13XXX diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index cbaa6abb08da..77a2ac54101a 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -45,6 +45,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o obj-$(CONFIG_TOUCHSCREEN_MIGOR)+= migor_ts.o diff --git a/drivers/input/touchscreen/fsl-imx25-tcq.c b/drivers/input/touchscreen/fsl-imx25-tcq.c new file mode 100644 index ..c833cd814972 --- /dev/null +++ b/drivers/input/touchscreen/fsl-imx25-tcq.c @@ -0,0 +1,600 @@ +/* + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + * + * Based on driver from 2011: + * Juergen Beisert, Pengutronix + * + * This is the driver for the imx25 TCQ (Touchscreen Conversion Queue) + * connected to the imx25 ADC. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char mx25_tcq_name[] = "mx25-tcq"; + +enum mx25_tcq_mode { + MX25_TS_4WIRE, +}; + +struct mx25_tcq_priv { + struct regmap *regs; + struct regmap *core_regs; + struct input_dev *idev; + enum mx25_tcq_mode mode; + unsigned int pen_threshold; + unsigned int sample_count; + unsigned int expected_samples; + unsigned int pen_debounce; + unsigned int settling_time; + struct clk *clk; + int irq; +}; + +static struct regmap_config mx25_tcq_regconfig = { + .fast_io = true, + .max_register = 0x5c, + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + +static const struct of_device_id mx25_tcq_ids[] = { + { .compatible = "fsl,imx25-tcq", }, + { /* Sentinel */ } +}; + +#define TSC_4WIRE_PRE_INDEX 0 +#define TSC_4WIRE_X_INDEX 1 +#define TSC_4WIRE_Y_INDEX 2 +#define TSC_4WIRE_POST_INDEX 3 +#define TSC_4WIRE_LEAVE 4 + +#define MX25_TSC_DEF_THRESHOLD 80 +#define TSC_MAX_SAMPLES 16 + +#define MX25_TSC_REPEAT_WAIT 14 + +enum mx25_adc_configurations { + MX25_CFG_PRECHARGE = 0, + MX25_CFG_TOUCH_DETECT, + MX25_CFG_X_MEASUREMENT, + MX25_CFG_Y_MEASUREMENT, +}; + +#define MX25_PRECHARGE_VALUE (\ + MX25_ADCQ_CFG_YPLL_OFF | \ + MX25_ADCQ_CFG_XNUR_OFF | \ + MX25_ADCQ_CFG_XPUL_HIGH | \ + MX25_ADCQ_CFG_REFP_INT | \ + MX25_ADCQ_CFG_IN_XP | \ + MX25_ADCQ_CFG_R
[PATCH v8 3/8] ARM: dt: Binding documentation for imx25 touchscreen controller
This is the touchscreen conversion queue binding documentation. It uses the shared imx25 ADC. Signed-off-by: Markus Pargmann --- Notes: Changes in v5: - Fix signed/unsigned comparison - Fix unused variable settling_time by putting it in the correct argument list - Use continous conversion queue with the repeat feature and a proper repeat-wait. Previously the touchscreen caused massive number of interrupts. .../bindings/input/touchscreen/fsl-mx25-tcq.txt| 29 ++ 1 file changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt diff --git a/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt new file mode 100644 index ..89ab47a3acc1 --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt @@ -0,0 +1,29 @@ +Freescale mx25 TS conversion queue module + +mx25 touchscreen conversion queue module which controls the ADC unit of the +mx25 for attached touchscreens. + +Required properties: + - compatible: Should be "fsl,imx25-tcq". + - reg: Memory range of the device. + - interrupts: Should be the interrupt number associated with this module within + the tscadc unit (<0>). + - interrupt-parent: Should be a phandle to the tscadc unit. + - fsl,wires: Should be '<4>' or '<5>' + +Optional properties: + - fsl,pen-debounce: Pen debounce time in nanoseconds. + - fsl,pen-threshold: Pen-down threshold for the touchscreen. + - fsl,settling-time: Settling time in nanoseconds. + +This device includes two conversion queues which can be added as subnodes. +The first queue is for the touchscreen, the second for general purpose ADC. + +Example: + tsc: tcq@50030400 { + compatible = "fsl,imx25-tcq"; + reg = <0x50030400 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <0>; + fsl,wires = <4>; + }; -- 2.6.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 0/8] imx25 adc and touchscreen driver
Hi, welcome to the next round of the never ending series ;). The last version v7 was sent roughly 8 months ago. The first version at least 1.5 years ago. This series adds two drivers for ADC and TSC of the imx25 and a MFD driver to connect these. Due to the larger changes in this version I had to remove some of the acks again. @Hartmut: Thanks for your comments. I updated the drivers accordingly. Changes in v8: - scale was defined as a shared property of the ADC although the scale can be different for each ADC channel. v8 fixes that. - Some smaller modifications of the code style in gcq code. - Redesign of the regulator handling in the gcq code. The driver does now handle regulators "vref-ext", "vref-xp" and "vref-yp" as positive voltage reference. Also the calculation of the scale property based on these voltage reference regulators was fixed. The code now uses regulator_get_optional() to avoid dummy regulators. - The missing regulator_disable() was added. Thanks to Jürgen the time behavior of the units is now fixed and within specs: - Fixed clock rates for the whole unit regarding to the reference manual. - Fixed clock/time calculations for settling times in the touchscreen driver. Best Regards, Markus Denis Carikli (2): ARM: dts: imx25: Add TSC and ADC support ARM: imx_v4_v5_defconfig: Add I.MX25 Touchscreen controller and ADC support. Markus Pargmann (6): ARM: dt: Binding documentation for imx25 ADC/TSC ARM: dt: Binding documentation for imx25 GCQ ARM: dt: Binding documentation for imx25 touchscreen controller mfd: fsl imx25 Touchscreen ADC driver iio: adc: fsl,imx25-gcq driver input: touchscreen: imx25 tcq driver .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 58 ++ .../bindings/input/touchscreen/fsl-mx25-tcq.txt| 29 + .../devicetree/bindings/mfd/fsl-imx25-tsadc.txt| 46 ++ arch/arm/boot/dts/imx25.dtsi | 30 +- arch/arm/configs/imx_v4_v5_defconfig | 4 + drivers/iio/adc/Kconfig| 7 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/fsl-imx25-gcq.c| 415 ++ drivers/input/touchscreen/Kconfig | 6 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/fsl-imx25-tcq.c | 600 + drivers/mfd/Kconfig| 9 + drivers/mfd/Makefile | 2 + drivers/mfd/fsl-imx25-tsadc.c | 204 +++ include/dt-bindings/iio/adc/fsl-imx25-gcq.h| 18 + include/linux/mfd/imx25-tsadc.h| 140 + 16 files changed, 1567 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt create mode 100644 Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt create mode 100644 Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c create mode 100644 drivers/input/touchscreen/fsl-imx25-tcq.c create mode 100644 drivers/mfd/fsl-imx25-tsadc.c create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h create mode 100644 include/linux/mfd/imx25-tsadc.h -- 2.6.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 4/8] mfd: fsl imx25 Touchscreen ADC driver
This is the core driver for imx25 touchscreen/adc driver. The module has one shared ADC and two different conversion queues which use the ADC. The two queues are identical. Both can be used for general purpose ADC but one is meant to be used for touchscreens. This driver is the core which manages the central components and registers of the TSC/ADC unit. It manages the IRQs and forwards them to the correct components. Signed-off-by: Markus Pargmann Signed-off-by: Denis Carikli [ensure correct ADC clock depending on the IPG clock] Signed-off-by: Juergen Borleis --- Notes: Changes in v7: - Cleanup bit defines in header files to be more readable - Fix irq check to return with an error for irq <= 0 - Add COMPILE_TEST in Kconfig file Changes in v5: - Remove ifdef CONFIG_OF as this driver is only for DT usage - Remove module owner - Add Kconfig dependencies ARCH_MX25 and OF @Jonathan Cameron: I left your acked-by on the patch as these were small changes. If it should be removed, please say so. Thanks drivers/mfd/Kconfig | 9 ++ drivers/mfd/Makefile| 2 + drivers/mfd/fsl-imx25-tsadc.c | 204 include/linux/mfd/imx25-tsadc.h | 140 +++ 4 files changed, 355 insertions(+) create mode 100644 drivers/mfd/fsl-imx25-tsadc.c create mode 100644 include/linux/mfd/imx25-tsadc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 4d92df6ef9fe..4222e202ad2b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -271,6 +271,15 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MX25_TSADC + tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" + select REGMAP_MMIO + depends on (SOC_IMX25 && OF) || COMPILE_TEST + help + Enable support for the integrated Touchscreen and ADC unit of the + i.MX25 processors. They consist of a conversion queue for general + purpose ADC and a queue for Touchscreens. + config MFD_HI6421_PMIC tristate "HiSilicon Hi6421 PMU/Codec IC" depends on OF diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index a8b76b81b467..5741be88c173 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -81,6 +81,8 @@ obj-$(CONFIG_TWL4030_POWER)+= twl4030-power.o obj-$(CONFIG_MFD_TWL4030_AUDIO)+= twl4030-audio.o obj-$(CONFIG_TWL6040_CORE) += twl6040.o +obj-$(CONFIG_MFD_MX25_TSADC) += fsl-imx25-tsadc.o + obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c new file mode 100644 index ..e67d5ca81e10 --- /dev/null +++ b/drivers/mfd/fsl-imx25-tsadc.c @@ -0,0 +1,204 @@ +/* + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static struct regmap_config mx25_tsadc_regmap_config = { + .fast_io = true, + .max_register = 8, + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + +static void mx25_tsadc_irq_handler(struct irq_desc *desc) +{ + struct mx25_tsadc *tsadc = irq_desc_get_handler_data(desc); + struct irq_chip *chip = irq_desc_get_chip(desc); + u32 status; + + chained_irq_enter(chip, desc); + + regmap_read(tsadc->regs, MX25_TSC_TGSR, &status); + + if (status & MX25_TGSR_GCQ_INT) + generic_handle_irq(irq_find_mapping(tsadc->domain, 1)); + + if (status & MX25_TGSR_TCQ_INT) + generic_handle_irq(irq_find_mapping(tsadc->domain, 0)); + + chained_irq_exit(chip, desc); +} + +static int mx25_tsadc_domain_map(struct irq_domain *d, unsigned int irq, +irq_hw_number_t hwirq) +{ + struct mx25_tsadc *tsadc = d->host_data; + + irq_set_chip_data(irq, tsadc); + irq_set_chip_and_handler(irq, &dummy_irq_chip, +handle_level_irq); + irq_modify_status(irq, IRQ_NOREQUEST, IRQ_NOPROBE); + + return 0; +} + +static struct irq_domain_ops mx25_tsadc_domain_ops = { + .map = mx25_tsadc_domain_map, + .xlate = irq_domain_xlate_onecell, +}; + +static int mx25_tsadc_setup_irq(struct platform_device *pdev, + struct mx25_tsadc *tsadc) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + int irq; + + irq = platform_get_irq(pdev
[PATCH v8 7/8] ARM: dts: imx25: Add TSC and ADC support
From: Denis Carikli Signed-off-by: Denis Carikli Signed-off-by: Markus Pargmann --- arch/arm/boot/dts/imx25.dtsi | 30 +++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi index 677f81d9dcd5..7b7fc7dd10bd 100644 --- a/arch/arm/boot/dts/imx25.dtsi +++ b/arch/arm/boot/dts/imx25.dtsi @@ -265,13 +265,37 @@ status = "disabled"; }; - tsc: tsc@5003 { - compatible = "fsl,imx25-adc", "fsl,imx21-tsc"; - reg = <0x5003 0x4000>; + tscadc: tscadc@5003 { + compatible = "fsl,imx25-tsadc"; + reg = <0x5003 0xc>; interrupts = <46>; clocks = <&clks 119>; clock-names = "ipg"; + interrupt-controller; + #interrupt-cells = <1>; + #address-cells = <1>; + #size-cells = <1>; + ranges; status = "disabled"; + + adc: adc@50030800 { + compatible = "fsl,imx25-gcq"; + reg = <0x50030800 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + tsc: tcq@50030400 { + compatible = "fsl,imx25-tcq"; + reg = <0x50030400 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <0>; + fsl,wires = <4>; + status = "disabled"; + }; }; ssi1: ssi@50034000 { -- 2.6.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 2/8] ARM: dt: Binding documentation for imx25 GCQ
The documentation describes the bindings for the imx25 GCQ unit which is essentially a generic conversion queue using the imx25 ADC. Signed-off-by: Markus Pargmann --- Notes: Changes in v6: - Changed bindings to use adc-refp and adc-refn. Also a bit of cleanup in the setup routine. Changes in v5: - Fixed locking - Removed module owner .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 58 ++ 1 file changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt diff --git a/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt new file mode 100644 index ..b0866d36a307 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt @@ -0,0 +1,58 @@ +Freescale i.MX25 ADC GCQ device + +This is a generic conversion queue device that can convert any of the +analog inputs using the ADC unit of the i.MX25. + +Required properties: + - compatible: Should be "fsl,imx25-gcq". + - reg: Should be the register range of the module. + - interrupts: Should be the interrupt number of the module. + Typically this is <1>. + - interrupt-parent: phandle to the tsadc module of the i.MX25. + - #address-cells: Should be <1> (setting for the subnodes) + - #size-cells: Should be <0> (setting for the subnodes) + +Optional properties: + - vref-ext-supply: The regulator supplying the ADC reference voltage. + Required when at least one subnode uses the this reference. + - vref-xp-supply: The regulator supplying the ADC reference voltage on pin XP. + Required when at least one subnode uses this reference. + - vref-yp-supply: The regulator supplying the ADC reference voltage on pin YP. + Required when at least one subnode uses this reference. + +Sub-nodes: +Optionally you can define subnodes which define the reference voltage +for the analog inputs. + +Required properties for subnodes: + - reg: Should be the number of the analog input. + 0: xp + 1: yp + 2: xn + 3: yn + 4: wiper + 5: inaux0 + 6: inaux1 + 7: inaux2 +Optional properties for subnodes: + - fsl,adc-refp: specifies the positive reference input as defined in + + - fsl,adc-refn: specifies the negative reference input as defined in + + +Example: + + adc: adc@50030800 { + compatible = "fsl,imx25-gcq"; + reg = <0x50030800 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <1>; + #address-cells = <1>; + #size-cells = <0>; + + inaux@5 { + reg = <5>; + fsl,adc-refp = ; + fsl,adc-refn = ; + }; + }; -- 2.6.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] [media] mt9v032: Add V4L2 controls for AEC and AGC
Hi Laurent, On Monday 09 November 2015 16:25:02 Markus Pargmann wrote: > On Monday 09 November 2015 15:22:06 Laurent Pinchart wrote: [...] > > > > Please use proper controls names. > > Sorry I don't really know what you mean? For me these are proper names. Could you give me a hint how these names should look like? Thanks, Markus > > > > > > + .min= 1, > > > + .max= 64, > > > + .step = 1, > > > + .def= 58, > > > + .flags = 0, > > > +}; > > > + > > > +static const struct v4l2_ctrl_config mt9v032_aec_lpf = { > > > + .ops= &mt9v032_ctrl_ops, > > > + .id = V4L2_CID_AEC_LPF, > > > + .type = V4L2_CTRL_TYPE_INTEGER, > > > + .name = "aec_lpf", > > > + .min= 0, > > > + .max= 2, > > > + .step = 1, > > > + .def= 0, > > > + .flags = 0, > > > +}; > > > + > > > +static const struct v4l2_ctrl_config mt9v032_agc_lpf = { > > > + .ops= &mt9v032_ctrl_ops, > > > + .id = V4L2_CID_AGC_LPF, > > > + .type = V4L2_CTRL_TYPE_INTEGER, > > > + .name = "agc_lpf", > > > + .min= 0, > > > + .max= 2, > > > + .step = 1, > > > + .def= 2, > > > + .flags = 0, > > > +}; > > > + > > > +static const struct v4l2_ctrl_config mt9v032_aec_update_interval = { > > > + .ops= &mt9v032_ctrl_ops, > > > + .id = V4L2_CID_AEC_UPDATE_INTERVAL, > > > + .type = V4L2_CTRL_TYPE_INTEGER, > > > + .name = "aec_update_interval", > > > + .min= 0, > > > + .max= 16, > > > + .step = 1, > > > + .def= 2, > > > + .flags = 0, > > > +}; > > > + > > > +static const struct v4l2_ctrl_config mt9v032_agc_update_interval = { > > > + .ops= &mt9v032_ctrl_ops, > > > + .id = V4L2_CID_AGC_UPDATE_INTERVAL, > > > + .type = V4L2_CTRL_TYPE_INTEGER, > > > + .name = "agc_update_interval", > > > + .min= 0, > > > + .max= 16, > > > + .step = 1, > > > + .def= 2, > > > + .flags = 0, > > > +}; > > > + > > > +static const struct v4l2_ctrl_config mt9v032_aec_max_shutter_width = { > > > + .ops= &mt9v032_ctrl_ops, > > > + .id = V4L2_CID_AEC_MAX_SHUTTER_WIDTH, > > > + .type = V4L2_CTRL_TYPE_INTEGER, > > > + .name = "aec_max_shutter_width", > > > + .min= 1, > > > + .max= MT9V034_TOTAL_SHUTTER_WIDTH_MAX, > > > > Isn't the maximum value 2047 for the MT9V0[23]2 ? > > Oh right, these differ by 2. Not really much but will fix it. > > > > > > + .step = 1, > > > + .def= MT9V032_TOTAL_SHUTTER_WIDTH_DEF, > > > + .flags = 0, > > > +}; > > > + > > > /* > > > --- > > > -- * V4L2 subdev core operations > > > */ > > > @@ -1010,6 +1147,22 @@ static int mt9v032_probe(struct i2c_client *client, > > > mt9v032_test_pattern_menu); > > > mt9v032->test_pattern_color = v4l2_ctrl_new_custom(&mt9v032->ctrls, > > > &mt9v032_test_pattern_color, NULL); > > > + mt9v032->desired_bin = v4l2_ctrl_new_custom(&mt9v032->ctrls, > > > + &mt9v032_desired_bin, > > > + NULL); > > > + mt9v032->aec_lpf = v4l2_ctrl_new_custom(&mt9v032->ctrls, > > > + &mt9v032_aec_lpf, NULL); > > > + mt9v032->agc_lpf = v4l2_ctrl_new_custom(&mt9v032->ctrls, > > > + &mt9v032_agc_lpf, NULL); > > > + mt9v032->aec_update_interval = v4l2_ctrl_new_custom(&mt9v032->ctrls, > > > + &mt9v032_aec_update_interval, > > > + NULL); > > > + mt9v032->agc_update_in
Re: [PATCH 1/3] [media] mt9v032: Add reset and standby gpios
Hi, On Monday 09 November 2015 14:28:56 Laurent Pinchart wrote: > Hi Markus, > > Thank you for the patch. > > On Friday 06 November 2015 14:13:43 Markus Pargmann wrote: > > Add optional reset and standby gpios. The reset gpio is used to reset > > the chip in power_on(). > > > > The standby gpio is not used currently. It is just unset, so the chip is > > not in standby. > > We could use a gpio hog for this, but given that the standby signal should > eventually get used, and given that specifying it in DT is a good hardware > description, that looks good to me. > > > Signed-off-by: Markus Pargmann > > Reviewed-by: Philipp Zabel > > --- > > .../devicetree/bindings/media/i2c/mt9v032.txt | 2 ++ > > drivers/media/i2c/mt9v032.c| 23 +++ > > 2 files changed, 25 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt > > b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt index > > 202565313e82..100f0ae43269 100644 > > --- a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt > > +++ b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt > > @@ -20,6 +20,8 @@ Optional Properties: > > > > - link-frequencies: List of allowed link frequencies in Hz. Each frequency > > is expressed as a 64-bit big-endian integer. > > +- reset-gpios: GPIO handle which is connected to the reset pin of the chip. > > +- standby-gpios: GPIO handle which is connected to the standby pin of the > > chip. > > > > For further reading on port node refer to > > Documentation/devicetree/bindings/media/video-interfaces.txt. > > diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c > > index a68ce94ee097..4aefde9634f5 100644 > > --- a/drivers/media/i2c/mt9v032.c > > +++ b/drivers/media/i2c/mt9v032.c > > @@ -24,6 +24,7 @@ > > #include > > #include > > #include > > +#include > > module.h escaped my vigilance, but let's try to keep headers alphabetically > sorted. > > > > #include > > #include > > @@ -251,6 +252,8 @@ struct mt9v032 { > > > > struct regmap *regmap; > > struct clk *clk; > > + struct gpio_desc *reset_gpio; > > + struct gpio_desc *standby_gpio; > > > > struct mt9v032_platform_data *pdata; > > const struct mt9v032_model_info *model; > > @@ -312,16 +315,26 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032) > > struct regmap *map = mt9v032->regmap; > > int ret; > > > > + gpiod_set_value_cansleep(mt9v032->reset_gpio, 1); > > + > > ret = clk_set_rate(mt9v032->clk, mt9v032->sysclk); > > if (ret < 0) > > return ret; > > > > + /* system clock has to be enabled before releasing the reset */ > > Nitpicking, the driver capitalizes the first letter of comments. > > > ret = clk_prepare_enable(mt9v032->clk); > > if (ret) > > return ret; > > > > udelay(1); > > > > + gpiod_set_value_cansleep(mt9v032->reset_gpio, 0); > > + > > + /* > > +* After releasing reset, it can take up to 1us until the chip is done > > +*/ > > + udelay(1); > > + > > The delay isn't necessary if there's no reset GPIO. How about > > if (mt9v032->reset_gpio) { > gpiod_set_value_cansleep(mt9v032->reset_gpio, 0); > > /* After releasing reset, it can take up to 1us until the >* chip is done. >*/ > udelay(1); > } > > And, according to the datasheet, the delay is 10 SYSCLK periods. 1µs should > be > safe as the minimum SYSCLK frequency is 13 MHz. I'd still mention it in a > comment, maybe as > > /* After releasing reset we need to wait 10 clock cycles >* before accessing the sensor over I2C. As the minimum SYSCLK >* frequency is 13MHz, waiting 1µs will be enough in the worst >* case. >*/ > udelay(1); > > If you're fine with these changes there's no need to resubmit the patch, I > can > fix it when applying it to my tree. Thanks, I am fine with all your changes. But as there will be a v2 for the other two patches I could as well send an updated version if you wish. Thanks, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: This is a digitally signed message part.
Re: [PATCH 3/3] [media] mt9v032: Add V4L2 controls for AEC and AGC
Hi, On Monday 09 November 2015 15:22:06 Laurent Pinchart wrote: > Hi Markus, > > Thank you for the patch. > > On Friday 06 November 2015 14:13:45 Markus Pargmann wrote: > > This patch adds V4L2 controls for Auto Exposure Control and Auto Gain > > Control settings. These settings include low pass filter, update > > frequency of these settings and the update interval for those units. > > > > Signed-off-by: Markus Pargmann > > --- > > drivers/media/i2c/mt9v032.c | 153 + > > 1 file changed, 153 insertions(+) > > > > diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c > > index 943c3f39ea73..978ae8cbb0cc 100644 > > --- a/drivers/media/i2c/mt9v032.c > > +++ b/drivers/media/i2c/mt9v032.c > > @@ -133,9 +133,16 @@ > > #defineMT9V032_TEST_PATTERN_GRAY_DIAGONAL (3 << 11) > > #defineMT9V032_TEST_PATTERN_ENABLE (1 << 13) > > #defineMT9V032_TEST_PATTERN_FLIP (1 << 14) > > +#define MT9V032_AEC_LPF0xa8 > > +#define MT9V032_AGC_LPF0xaa > > +#define MT9V032_DESIRED_BIN0xa5 > > To better match the datasheet, could you call this MT9V032_AEGC_DESIRED_BIN ? > Same comment for the related control name. Ok, fixed for next version. > > > +#define MT9V032_AEC_UPDATE_INTERVAL0xa6 > > +#define MT9V032_AGC_UPDATE_INTERVAL0xa9 > > Simalarly I'd call these two registers MT9V032_AEC_UPDATE_FREQUENCY and > MT9V032_AGC_UPDATE_FREQUENCY as that's how they're named in the datasheet (at > least the version I have). It makes sense to keep using interval in the > control names though, as that's how they operate. Yes they are called differently, fixed. > > Could you please keep the registers sorted numerically ? Yes sorry. > > > #define MT9V032_AEC_AGC_ENABLE 0xaf > > #defineMT9V032_AEC_ENABLE (1 << 0) > > #defineMT9V032_AGC_ENABLE (1 << 1) > > +#define MT9V024_AEC_MAX_SHUTTER_WIDTH 0xad > > As other registers specific to the MT9V024 and MT9V034 use the MT9V034 > prefix, > could you do so here as well ? Yes, fixed. > > Would it make sense to add the minimum shutter width too ? Yes perhaps, I personally just needed the extra exposure to get the image brighter. However I don't have any information about the minimum register. For mt9v032 this seems to be hardwired to 1 and for mt9v024 this is just mentioned in text without further information. > > > +#define MT9V032_AEC_MAX_SHUTTER_WIDTH 0xbd > > #define MT9V032_THERMAL_INFO 0xc1 > > > > enum mt9v032_model { > > @@ -162,6 +169,7 @@ struct mt9v032_model_data { > > unsigned int min_shutter; > > unsigned int max_shutter; > > unsigned int pclk_reg; > > + unsigned int aec_max_shutter_reg; > > }; > > > > struct mt9v032_model_info { > > @@ -185,6 +193,7 @@ static const struct mt9v032_model_data > > mt9v032_model_data[] = { .min_shutter = MT9V032_TOTAL_SHUTTER_WIDTH_MIN, > > .max_shutter = MT9V032_TOTAL_SHUTTER_WIDTH_MAX, > > .pclk_reg = MT9V032_PIXEL_CLOCK, > > + .aec_max_shutter_reg = MT9V032_AEC_MAX_SHUTTER_WIDTH, > > }, { > > /* MT9V024, MT9V034 */ > > .min_row_time = 690, > > @@ -194,6 +203,7 @@ static const struct mt9v032_model_data > > mt9v032_model_data[] = { .min_shutter = MT9V034_TOTAL_SHUTTER_WIDTH_MIN, > > .max_shutter = MT9V034_TOTAL_SHUTTER_WIDTH_MAX, > > .pclk_reg = MT9V034_PIXEL_CLOCK, > > + .aec_max_shutter_reg = MT9V024_AEC_MAX_SHUTTER_WIDTH, > > }, > > }; > > > > @@ -265,6 +275,12 @@ struct mt9v032 { > > struct { > > struct v4l2_ctrl *test_pattern; > > struct v4l2_ctrl *test_pattern_color; > > + struct v4l2_ctrl *desired_bin; > > + struct v4l2_ctrl *aec_lpf; > > + struct v4l2_ctrl *agc_lpf; > > + struct v4l2_ctrl *aec_update_interval; > > + struct v4l2_ctrl *agc_update_interval; > > + struct v4l2_ctrl *aec_max_shutter_width; > > You don't need to store all those controls in the mt9v032 structure as you > don't use the pointers anywhere. The reason why the test_pattern and > test_pa
Re: [PATCH 2/3] [media] mt9v032: Do not unset master_mode
Hi Laurent, On Monday 09 November 2015 14:46:42 Laurent Pinchart wrote: > Hi Markus, > > Thank you for the patch. > > On Friday 06 November 2015 14:13:44 Markus Pargmann wrote: > > The power_on function of the driver resets the chip and sets the > > CHIP_CONTROL register to 0. This switches the operating mode to slave. > > The s_stream function sets the correct mode. But this caused problems on > > a board where the camera chip is operated as master. The camera started > > after a random amount of time streaming an image, I observed between 10 > > and 300 seconds. > > > > The STRFM_OUT and STLN_OUT pins are not connected on this board which > > may cause some issues in slave mode. I could not find any documentation > > about this. > > > > Keeping the chip in master mode after the reset helped to fix this > > issue for me. > > > > Signed-off-by: Markus Pargmann > > --- > > drivers/media/i2c/mt9v032.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c > > index 4aefde9634f5..943c3f39ea73 100644 > > --- a/drivers/media/i2c/mt9v032.c > > +++ b/drivers/media/i2c/mt9v032.c > > @@ -344,7 +344,8 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032) > > if (ret < 0) > > return ret; > > > > - return regmap_write(map, MT9V032_CHIP_CONTROL, 0); > > + return regmap_write(map, MT9V032_CHIP_CONTROL, > > + MT9V032_CHIP_CONTROL_MASTER_MODE); > > This makes sense, but shouldn't you also fix the mt9v032_s_stream() function > then ? It clears the MT9V032_CHIP_CONTROL_MASTER_MODE bit when turning the > stream off. Oh yes, thanks. Will fix it for the next version. Best Regards, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: This is a digitally signed message part.
Re: IIO device indexing issue
On Saturday 07 November 2015 11:03:26 Vesa Jääskeläinen wrote: > On 06/11/15 11:49, Markus Pargmann wrote: > > Hi, > > > > On Thursday, November 05, 2015 07:13:41 PM Jonathan Cameron wrote: > >> On 04/11/15 18:53, Vesa Jääskeläinen wrote: > >>> To continue from this "label" property idea I was wondering if we > >>> would add it as new optional(?) file node for IIO devices.> > >>> One could then specify it like: > >>> > >>> tscadc: tscadc@44e0d000 { > >>> compatible = "ti,am3359-tscadc"; > >>> ... > >>> am335x_adc: adc { > >>> compatible = "ti,am3359-adc"; > >>> ... > >>> label = "Port A"; > >>> }; > >>> }; > >>> > >>> And this would generate file /sys/bus/iio/iio:deviceX/label with > >>> contents of "Port A". > >>> > >>> Then during the application startup it would just need to scan all > >>> devices under /sys/bus/iio and determine what labelled device it > >>> wants to use. > >>> > >>> It would be up to device's developer to determine what labels to use > >>> in their designs. This would not break ABI and would be just an > >>> extension for it. > >>> > >>> One could also auto-assign label "am335x_adc" in this case too. But > >>> if you include existing arch device tree then changing label in top > >>> level is kinda a bit annoying as you would then need to duplicate all > >>> properties with another label and disable arch device tree's > >>> settings. Could cause also conflict if there are references elsewhere > >>> to existing arch nodes. > >>> > >>> Having following in device's device tree file would allow one to > >>> override label or just only specify that. > >>> > >>> #include "am33xx.dtsi" > >>> > >>> &tscadc { > >>> status = "okay"; > >>> > >>> adc { > >>> ti,adc-channels = <4 5 6 7>; > >>> > >>> label = "Port A"; > >>> }; > >>> }; > >>> > >>> I think this "label" model would be simple to understand. > >>> > >>> Whether this needs to be implemented as per device driver feature or > >>> could be implemented as generic IIO functionality I do not know. > >> The principal looks good to me. It's not however only an IIO issue > >> so perhaps we should expand the discussion to include other subsystems > >> likely to have similar issues (though perhaps to a lesser degree) such as > >> hwmon and input? Any others? > >> > >> We could also autobuild the label from other sources such as ACPI > >> to uniquely describe the instance of the device (afterall all we really > >> care about is that it always has the same name on the same hardware, > >> being able to assign meaningful simple names would just be the icing > >> on the cake!) > > There is a similar discussion for the new character device GPIO > > interface.[1] > > > > Simple labels have the problem that they could be the same for two > > devicetree > > overlays or chips that are connected via SPI. > > > As far as I understand the overlays, you always specify a hardware > hierarchy where you want to add additional information to device tree. > This means that while adding device with overlays you have full control > what device it is and then can configure what label property device > should have. I would expect at some point in the future that there is enough tooling/hotplug/something else that you have some generic devicetrees that can be 'hotplugged' to any bus. For example If you connect two identical spi sensors to two different spi busses I would really expect that we have only one devicetree to describe this chip and some tooling to do the rest. However this is probably not right for the moment but perhaps in the future. > > If you would add two SPI devices those would be unique items in the > device tree this means that overlay adding those would be unique and > then you can assign unique label for the devices. Yes these would be unique items but only if you consider the whole path of the device. If you limit it to the simple approach that was mentioned with only a simple label property this wouldn't work. Generating/Assigning
[PATCH 2/3] [media] mt9v032: Do not unset master_mode
The power_on function of the driver resets the chip and sets the CHIP_CONTROL register to 0. This switches the operating mode to slave. The s_stream function sets the correct mode. But this caused problems on a board where the camera chip is operated as master. The camera started after a random amount of time streaming an image, I observed between 10 and 300 seconds. The STRFM_OUT and STLN_OUT pins are not connected on this board which may cause some issues in slave mode. I could not find any documentation about this. Keeping the chip in master mode after the reset helped to fix this issue for me. Signed-off-by: Markus Pargmann --- drivers/media/i2c/mt9v032.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c index 4aefde9634f5..943c3f39ea73 100644 --- a/drivers/media/i2c/mt9v032.c +++ b/drivers/media/i2c/mt9v032.c @@ -344,7 +344,8 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032) if (ret < 0) return ret; - return regmap_write(map, MT9V032_CHIP_CONTROL, 0); + return regmap_write(map, MT9V032_CHIP_CONTROL, + MT9V032_CHIP_CONTROL_MASTER_MODE); } static void mt9v032_power_off(struct mt9v032 *mt9v032) -- 2.6.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] [media] mt9v032: Add reset and standby gpios
Add optional reset and standby gpios. The reset gpio is used to reset the chip in power_on(). The standby gpio is not used currently. It is just unset, so the chip is not in standby. Signed-off-by: Markus Pargmann Reviewed-by: Philipp Zabel --- .../devicetree/bindings/media/i2c/mt9v032.txt | 2 ++ drivers/media/i2c/mt9v032.c| 23 ++ 2 files changed, 25 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt index 202565313e82..100f0ae43269 100644 --- a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt +++ b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt @@ -20,6 +20,8 @@ Optional Properties: - link-frequencies: List of allowed link frequencies in Hz. Each frequency is expressed as a 64-bit big-endian integer. +- reset-gpios: GPIO handle which is connected to the reset pin of the chip. +- standby-gpios: GPIO handle which is connected to the standby pin of the chip. For further reading on port node refer to Documentation/devicetree/bindings/media/video-interfaces.txt. diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c index a68ce94ee097..4aefde9634f5 100644 --- a/drivers/media/i2c/mt9v032.c +++ b/drivers/media/i2c/mt9v032.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -251,6 +252,8 @@ struct mt9v032 { struct regmap *regmap; struct clk *clk; + struct gpio_desc *reset_gpio; + struct gpio_desc *standby_gpio; struct mt9v032_platform_data *pdata; const struct mt9v032_model_info *model; @@ -312,16 +315,26 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032) struct regmap *map = mt9v032->regmap; int ret; + gpiod_set_value_cansleep(mt9v032->reset_gpio, 1); + ret = clk_set_rate(mt9v032->clk, mt9v032->sysclk); if (ret < 0) return ret; + /* system clock has to be enabled before releasing the reset */ ret = clk_prepare_enable(mt9v032->clk); if (ret) return ret; udelay(1); + gpiod_set_value_cansleep(mt9v032->reset_gpio, 0); + + /* +* After releasing reset, it can take up to 1us until the chip is done +*/ + udelay(1); + /* Reset the chip and stop data read out */ ret = regmap_write(map, MT9V032_RESET, 1); if (ret < 0) @@ -954,6 +967,16 @@ static int mt9v032_probe(struct i2c_client *client, if (IS_ERR(mt9v032->clk)) return PTR_ERR(mt9v032->clk); + mt9v032->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", + GPIOD_OUT_HIGH); + if (IS_ERR(mt9v032->reset_gpio)) + return PTR_ERR(mt9v032->reset_gpio); + + mt9v032->standby_gpio = devm_gpiod_get_optional(&client->dev, "standby", + GPIOD_OUT_LOW); + if (IS_ERR(mt9v032->standby_gpio)) + return PTR_ERR(mt9v032->standby_gpio); + mutex_init(&mt9v032->power_lock); mt9v032->pdata = pdata; mt9v032->model = (const void *)did->driver_data; -- 2.6.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] [media] mt9v032: Add V4L2 controls for AEC and AGC
This patch adds V4L2 controls for Auto Exposure Control and Auto Gain Control settings. These settings include low pass filter, update frequency of these settings and the update interval for those units. Signed-off-by: Markus Pargmann --- drivers/media/i2c/mt9v032.c | 153 1 file changed, 153 insertions(+) diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c index 943c3f39ea73..978ae8cbb0cc 100644 --- a/drivers/media/i2c/mt9v032.c +++ b/drivers/media/i2c/mt9v032.c @@ -133,9 +133,16 @@ #defineMT9V032_TEST_PATTERN_GRAY_DIAGONAL (3 << 11) #defineMT9V032_TEST_PATTERN_ENABLE (1 << 13) #defineMT9V032_TEST_PATTERN_FLIP (1 << 14) +#define MT9V032_AEC_LPF0xa8 +#define MT9V032_AGC_LPF0xaa +#define MT9V032_DESIRED_BIN0xa5 +#define MT9V032_AEC_UPDATE_INTERVAL0xa6 +#define MT9V032_AGC_UPDATE_INTERVAL0xa9 #define MT9V032_AEC_AGC_ENABLE 0xaf #defineMT9V032_AEC_ENABLE (1 << 0) #defineMT9V032_AGC_ENABLE (1 << 1) +#define MT9V024_AEC_MAX_SHUTTER_WIDTH 0xad +#define MT9V032_AEC_MAX_SHUTTER_WIDTH 0xbd #define MT9V032_THERMAL_INFO 0xc1 enum mt9v032_model { @@ -162,6 +169,7 @@ struct mt9v032_model_data { unsigned int min_shutter; unsigned int max_shutter; unsigned int pclk_reg; + unsigned int aec_max_shutter_reg; }; struct mt9v032_model_info { @@ -185,6 +193,7 @@ static const struct mt9v032_model_data mt9v032_model_data[] = { .min_shutter = MT9V032_TOTAL_SHUTTER_WIDTH_MIN, .max_shutter = MT9V032_TOTAL_SHUTTER_WIDTH_MAX, .pclk_reg = MT9V032_PIXEL_CLOCK, + .aec_max_shutter_reg = MT9V032_AEC_MAX_SHUTTER_WIDTH, }, { /* MT9V024, MT9V034 */ .min_row_time = 690, @@ -194,6 +203,7 @@ static const struct mt9v032_model_data mt9v032_model_data[] = { .min_shutter = MT9V034_TOTAL_SHUTTER_WIDTH_MIN, .max_shutter = MT9V034_TOTAL_SHUTTER_WIDTH_MAX, .pclk_reg = MT9V034_PIXEL_CLOCK, + .aec_max_shutter_reg = MT9V024_AEC_MAX_SHUTTER_WIDTH, }, }; @@ -265,6 +275,12 @@ struct mt9v032 { struct { struct v4l2_ctrl *test_pattern; struct v4l2_ctrl *test_pattern_color; + struct v4l2_ctrl *desired_bin; + struct v4l2_ctrl *aec_lpf; + struct v4l2_ctrl *agc_lpf; + struct v4l2_ctrl *aec_update_interval; + struct v4l2_ctrl *agc_update_interval; + struct v4l2_ctrl *aec_max_shutter_width; }; }; @@ -643,6 +659,33 @@ static int mt9v032_set_selection(struct v4l2_subdev *subdev, */ #define V4L2_CID_TEST_PATTERN_COLOR(V4L2_CID_USER_BASE | 0x1001) +/* + * Value between 1 and 64 to set the desired bin. This is effectively a measure + * of how bright the image is supposed to be. Both AGC and AEC try to reach + * this. + */ +#define V4L2_CID_DESIRED_BIN (V4L2_CID_USER_BASE | 0x1002) +/* + * LPF is the low pass filter capability of the chip. Both AEC and AGC have + * this setting. This limits the speed in which AGC/AEC adjust their settings. + * Possible values are 0-2. 0 means no LPF. For 1 and 2 this equation is used: + * if |(Calculated new exp - current exp)| > (current exp / 4) + * next exp = Calculated new exp + * else + * next exp = Current exp +- (Calculated new exp / 2^LPF) + */ +#define V4L2_CID_AEC_LPF (V4L2_CID_USER_BASE | 0x1003) +#define V4L2_CID_AGC_LPF (V4L2_CID_USER_BASE | 0x1004) +/* + * Value between 0 and 15. This is the number of frames being skipped before + * updating the auto exposure/gain. + */ +#define V4L2_CID_AEC_UPDATE_INTERVAL (V4L2_CID_USER_BASE | 0x1005) +#define V4L2_CID_AGC_UPDATE_INTERVAL (V4L2_CID_USER_BASE | 0x1006) +/* + * Maximum shutter width used for AEC. + */ +#define V4L2_CID_AEC_MAX_SHUTTER_WIDTH (V4L2_CID_USER_BASE | 0x1007) static int mt9v032_s_ctrl(struct v4l2_ctrl *ctrl) { @@ -712,6 +755,28 @@ static int mt9v032_s_ctrl(struct v4l2_ctrl *ctrl) break; } return regmap_write(map, MT9V032_TEST_PATTERN, data); + + case V4L2_CID_DESIRED_BIN: + return regmap_write(map, MT9V032_DESIRED_BIN, ctrl->val); + + case V4L2_CID_AEC_LPF: + return regmap_write(map, MT9V032_AEC_LPF, ctrl->val); + + case V4L2_CID_AGC_LPF: + return regmap_write(map, MT9V032_AGC_LPF, ctrl->val); + + case V4L2_CID_A
Re: IIO device indexing issue
Hi, On Thursday, November 05, 2015 07:13:41 PM Jonathan Cameron wrote: > On 04/11/15 18:53, Vesa Jääskeläinen wrote: > > To continue from this "label" property idea I was wondering if we > > would add it as new optional(?) file node for IIO devices.> > > One could then specify it like: > > > > tscadc: tscadc@44e0d000 { > > compatible = "ti,am3359-tscadc"; > > ... > > am335x_adc: adc { > > compatible = "ti,am3359-adc"; > > ... > > label = "Port A"; > > }; > > }; > > > > And this would generate file /sys/bus/iio/iio:deviceX/label with > > contents of "Port A". > > > > Then during the application startup it would just need to scan all > > devices under /sys/bus/iio and determine what labelled device it > > wants to use. > > > > It would be up to device's developer to determine what labels to use > > in their designs. This would not break ABI and would be just an > > extension for it. > > > > One could also auto-assign label "am335x_adc" in this case too. But > > if you include existing arch device tree then changing label in top > > level is kinda a bit annoying as you would then need to duplicate all > > properties with another label and disable arch device tree's > > settings. Could cause also conflict if there are references elsewhere > > to existing arch nodes. > > > > Having following in device's device tree file would allow one to > > override label or just only specify that. > > > > #include "am33xx.dtsi" > > > > &tscadc { > > status = "okay"; > > > > adc { > > ti,adc-channels = <4 5 6 7>; > > > > label = "Port A"; > > }; > > }; > > > > I think this "label" model would be simple to understand. > > > > Whether this needs to be implemented as per device driver feature or > > could be implemented as generic IIO functionality I do not know. > The principal looks good to me. It's not however only an IIO issue > so perhaps we should expand the discussion to include other subsystems > likely to have similar issues (though perhaps to a lesser degree) such as > hwmon and input? Any others? > > We could also autobuild the label from other sources such as ACPI > to uniquely describe the instance of the device (afterall all we really > care about is that it always has the same name on the same hardware, > being able to assign meaningful simple names would just be the icing > on the cake!) There is a similar discussion for the new character device GPIO interface.[1] Simple labels have the problem that they could be the same for two devicetree overlays or chips that are connected via SPI. Best Regards, Markus [1] http://thread.gmane.org/gmane.linux.kernel.gpio/11475 > > Jonathan > > Thanks, > > Vesa Jääskeläinen > > > > -- > To unsubscribe from this list: send the line "unsubscribe devicetree" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: This is a digitally signed message part.
Re: [PATCH v2 2/3] gpiolib: gpiod_hog remove separate name argument
On Thu, Sep 24, 2015 at 10:52:55AM -0700, Linus Walleij wrote: > On Wed, Sep 23, 2015 at 11:39 PM, Markus Pargmann wrote: > > >> - Fixed that but noted that it just alters the call to gpiod_hog() > >> in of_gpiochip_scan_hogs(), there is a local const char *name that > >> should be removed too. > > > > The local const char *name is temporarily used in > > of_gpiochip_scan_hogs() to get the name from DT and assign it to the > > descriptor: > > desc = of_parse_own_gpio(np, &name, &lflags, &dflags); > > ... > > else > > desc->name = name; > > OK the problem is that this series is dependent on the > named GPIOs series. I want this series to stand alone, > because this series is not as controversial, and I want to > merge these initvals first. OK, I think I won't get this completely independent but it shouldn't be a problem to get this before the controversial patches. Will do that. Best Regards, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v2 1/3] gpio: Use __gpiod_request directly
Hi, On Thu, Sep 24, 2015 at 10:49:57AM -0700, Linus Walleij wrote: > On Tue, Sep 22, 2015 at 9:25 PM, Alexandre Courbot wrote: > > On Sun, Aug 30, 2015 at 4:44 PM, Markus Pargmann > > wrote: > >> There is no reason to find out chip and hwnum to use to request a gpio > >> and get another gpio descriptor. We already have the descriptor we want > >> to use so we can directly use it. > >> > >> Signed-off-by: Markus Pargmann > >> --- > >> drivers/gpio/gpiolib.c | 17 ++--- > >> 1 file changed, 6 insertions(+), 11 deletions(-) > >> > >> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > >> index 79a0b41ce57b..872fdd3617c1 100644 > >> --- a/drivers/gpio/gpiolib.c > >> +++ b/drivers/gpio/gpiolib.c > >> @@ -2189,25 +2189,20 @@ EXPORT_SYMBOL_GPL(__gpiod_get_index_optional); > >> int gpiod_hog(struct gpio_desc *desc, const char *name, > >> unsigned long lflags, enum gpiod_flags dflags) > >> { > >> - struct gpio_chip *chip; > >> - struct gpio_desc *local_desc; > >> - int hwnum; > >> int status; > >> > >> - chip = gpiod_to_chip(desc); > >> - hwnum = gpio_chip_hwgpio(desc); > >> - > >> - local_desc = gpiochip_request_own_desc(chip, hwnum, name); > >> - if (IS_ERR(local_desc)) { > >> + status = __gpiod_request(desc, name); > >> + if (status) { > >> pr_err("requesting hog GPIO %s (chip %s, offset %d) > >> failed\n", > >> - name, chip->label, hwnum); > >> - return PTR_ERR(local_desc); > >> + name, gpiod_to_chip(desc)->label, > >> + gpio_chip_hwgpio(desc)); > >> + return status; > >> } > >> > >> status = gpiod_configure_flags(desc, name, lflags, dflags); > >> if (status < 0) { > >> pr_err("setup of hog GPIO %s (chip %s, offset %d) > >> failed\n", > >> - name, chip->label, hwnum); > >> + name, gpiod_to_chip(desc)->label, > >> gpio_chip_hwgpio(desc)); > >> gpiochip_free_own_desc(desc); > > > > Mmm I should have reviewed this patch earlier, but what bothers me a > > bit is that it breaks the symetry that we had by calling > > request_own_desc() and free_own_desc() in the failing case (as well as > > in gpiochip_free_hogs). And in the end you still need to call > > gpiod_to_chip() so I am not sure what the benefit is. > > > > Sure, the code is less verbose, but at the same time it has become > > slightly harder to understand. Semantically speaking > > "request_own_desc()" is exactly the action we want to convey. > > __gpiod_request() is more ambiguous. > > > > Note that this is not a reject, I just wanted to stress that "less > > code" is not necessarily the same as "easier to read". > > OK I dropped this patch for now. > > Markus can you live without this patch for 2/3 and 3/3? Yes, that's fine. I will remove it and rebase the others. Best Regards, Markus > > Yours, > Linus Walleij > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v5 3/7] ARM: dts: imx: imx7d-sbd add iomuxc-lpsr hoggrp-2 pads
On Thu, Sep 24, 2015 at 03:53:59PM -0500, Adrian Alonso wrote: > Add imx7d-sdb iomuxc-lpsr hoggrp-2 default pads settings > > Signed-off-by: Adrian Alonso > --- > Changes for V2: Resend > Changes for V3: Resend > Changes for V4: Resend > Changes for V5: Resend > > arch/arm/boot/dts/imx7d-sdb.dts | 15 +++ > 1 file changed, 15 insertions(+) > > diff --git a/arch/arm/boot/dts/imx7d-sdb.dts b/arch/arm/boot/dts/imx7d-sdb.dts > index 8059458..c8a178c 100644 > --- a/arch/arm/boot/dts/imx7d-sdb.dts > +++ b/arch/arm/boot/dts/imx7d-sdb.dts > @@ -419,3 +419,18 @@ > > }; > }; > + > +&iomuxc_lpsr { > + pinctrl-names = "default"; > + pinctrl-0 = <&pinctrl_hog_2>; > + > + imx7d-sdb { > + pinctrl_hog_2: hoggrp-2 { > + fsl,pins = < > + MX7D_PAD_GPIO1_IO05__GPIO1_IO50x14 > + MX7D_PAD_GPIO1_IO07__GPIO1_IO70x59 > + MX7D_PAD_GPIO1_IO00__WDOD1_WDOG_B 0x74 In my opinion this should still be in the pincontrol for the watchdog instead of hogging. Also it is not obvious what the GPIOs are for. Regards, Markus > + >; > + }; > + }; > +}; > -- > 2.1.4 > > > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v5 4/7] pinctrl: freescale: imx: allow mux_reg offset zero
On Thu, Sep 24, 2015 at 03:54:00PM -0500, Adrian Alonso wrote: > Allow mux_reg offset zero to be a valid pin_id, on imx7d > mux_conf reg offset is zero for iomuxc-lspr controller > > Signed-off-by: Adrian Alonso > --- > Changes for V2: Resend > Changes for V3: Resend > Changes for V4: Simplify pin_id assigment when ZERO_OFFSET_VALID is set > Changes for V5: > - Drop patch pinctrl: freescale: imx: add ZERO_OFFSET_VALID flag > - Allow mux_reg ZERO OFFSET as pin_id > > drivers/pinctrl/freescale/pinctrl-imx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c > b/drivers/pinctrl/freescale/pinctrl-imx.c > index b9c6deb..23348d8 100644 > --- a/drivers/pinctrl/freescale/pinctrl-imx.c > +++ b/drivers/pinctrl/freescale/pinctrl-imx.c > @@ -550,7 +550,7 @@ static int imx_pinctrl_parse_groups(struct device_node > *np, > conf_reg = -1; > } > > - pin_id = mux_reg ? mux_reg / 4 : conf_reg / 4; > + pin_id = (mux_reg != -1) ? mux_reg / 4 : conf_reg / 4; This will break compatibility with imx35 and imx25 pinctrl drivers. They have definitions where mux_reg can be 0x0. See imx35-pinfunc.h and imx25-pinfunc.h: git grep -E "0x0+ 0x.* 0x.* 0x.* 0x.*" This mux_reg behaviour was not described in the DT binding documentation. But it is used by some platforms. So even if you change the pincfunc headers to use "-1", it would break devicetrees compiled with earlier kernel versions. Regards, Markus > pin_reg = &info->pin_regs[pin_id]; > pin->pin = pin_id; > grp->pin_ids[i] = pin_id; > -- > 2.1.4 > > > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v2 1/3] gpio: Use __gpiod_request directly
Hi, On Wed, Sep 23, 2015 at 01:25:28PM +0900, Alexandre Courbot wrote: > On Sun, Aug 30, 2015 at 4:44 PM, Markus Pargmann wrote: > > There is no reason to find out chip and hwnum to use to request a gpio > > and get another gpio descriptor. We already have the descriptor we want > > to use so we can directly use it. > > > > Signed-off-by: Markus Pargmann > > --- > > drivers/gpio/gpiolib.c | 17 ++--- > > 1 file changed, 6 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > > index 79a0b41ce57b..872fdd3617c1 100644 > > --- a/drivers/gpio/gpiolib.c > > +++ b/drivers/gpio/gpiolib.c > > @@ -2189,25 +2189,20 @@ EXPORT_SYMBOL_GPL(__gpiod_get_index_optional); > > int gpiod_hog(struct gpio_desc *desc, const char *name, > > unsigned long lflags, enum gpiod_flags dflags) > > { > > - struct gpio_chip *chip; > > - struct gpio_desc *local_desc; > > - int hwnum; > > int status; > > > > - chip = gpiod_to_chip(desc); > > - hwnum = gpio_chip_hwgpio(desc); > > - > > - local_desc = gpiochip_request_own_desc(chip, hwnum, name); > > - if (IS_ERR(local_desc)) { > > + status = __gpiod_request(desc, name); > > + if (status) { > > pr_err("requesting hog GPIO %s (chip %s, offset %d) > > failed\n", > > - name, chip->label, hwnum); > > - return PTR_ERR(local_desc); > > + name, gpiod_to_chip(desc)->label, > > + gpio_chip_hwgpio(desc)); > > + return status; > > } > > > > status = gpiod_configure_flags(desc, name, lflags, dflags); > > if (status < 0) { > > pr_err("setup of hog GPIO %s (chip %s, offset %d) failed\n", > > - name, chip->label, hwnum); > > + name, gpiod_to_chip(desc)->label, > > gpio_chip_hwgpio(desc)); > > gpiochip_free_own_desc(desc); > > Mmm I should have reviewed this patch earlier, but what bothers me a > bit is that it breaks the symetry that we had by calling > request_own_desc() and free_own_desc() in the failing case (as well as > in gpiochip_free_hogs). And in the end you still need to call > gpiod_to_chip() so I am not sure what the benefit is. gpiod_to_chip() is only called for errors after this patch. It just seemed to me as random reader of the code that using gpiochip_request_own_desc() could be simplified by using __gpiod_request(). > > Sure, the code is less verbose, but at the same time it has become > slightly harder to understand. Semantically speaking > "request_own_desc()" is exactly the action we want to convey. > __gpiod_request() is more ambiguous. At least for me this is slightly better to read as it removes some unnecessary lines. But that is probably subjective and depends on the way someone reads code. Best Regards, Markus > > Note that this is not a reject, I just wanted to stress that "less > code" is not necessarily the same as "easier to read". -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v2 3/3] gpiolib: Add GPIO initialization
Hi, On Mon, Sep 21, 2015 at 04:42:09PM -0700, Linus Walleij wrote: > On Sun, Aug 30, 2015 at 12:44 AM, Markus Pargmann wrote: > > > This functions adds a way to initialize a GPIO without hogging it. > > > > Signed-off-by: Markus Pargmann > > (...) > > > -The GPIO chip may contain GPIO hog definitions. GPIO hogging is a mechanism > > -providing automatic GPIO request and configuration as part of the > > -gpio-controller's driver probe function. > > +The GPIO chip may contain GPIO definitions. These define properties for > > single > > +GPIOs of this controller. > > Insert text like this: > > There are two types of GPIO definitions: > > - GPIO hogs are ... > > - GPIO initializers are ... > > This list form is easier to understand. > > > -Each GPIO hog definition is represented as a child node of the GPIO > > controller. > > +GPIO hogging is a mechanism providing automatic GPIO request and > > configuration > > +as part of the gpio-controller's driver probe function. > > + > > +GPIO initialization provides an automatic initialization to known save > > values. > > +Instead of GPIO hogging the GPIO's value and direction can be modified by > > other > > +users after it was initialized. > > + > > +Each GPIO definition is represented as a child node of the GPIO controller. > > Required properties: > > -- gpio-hog: A property specifying that this child node represent a GPIO > > hog. > > - gpios: Store the GPIO information (id, flags, ...). Shall contain > > the > > number of cells specified in its parent node (GPIO controller > > node). > > -Only one of the following properties scanned in the order shown below. > > -This means that when multiple properties are present they will be searched > > -in the order presented below and the first match is taken as the intended > > -configuration. > > + > > +Optional properties: > > +- line-name: The GPIO label name. If not present the node name is used. > > + Only one of gpio-hog and gpio-initval may be specified. > > This is confusing. Instead write: "The two following options are > mutually exclusive. One of them must be specified, but not both." > > > +- gpio-hog: A property specifying that this child node represent a GPIO > > hog. > > +- gpio-initval: This GPIO should be initialized to the specified > > configuration. > > > + Only one of input, output-low and output-high may be specified: > > Insert "Of the following arguments, only one..." (etc) Okay, thanks. Will change these. > > > - input: A property specifying to set the GPIO direction as input. > > - output-low A property specifying to set the GPIO direction as output > > with > > the value low. > > - output-high A property specifying to set the GPIO direction as output > > with > > the value high. > > > > -Optional properties: > > -- line-name: The GPIO label name. If not present the node name is used. > > - > > Example of two SOC GPIO banks defined as gpio-controller nodes: > > (...) > > --- a/drivers/gpio/gpiolib-of.c > > +++ b/drivers/gpio/gpiolib-of.c > > @@ -234,6 +234,15 @@ static void of_gpiochip_scan_gpios(struct gpio_chip > > *chip) > > > > if (gpiod_hog(desc, lflags, dflags)) > > continue; > > + } else if (of_property_read_bool(np, "gpio-initval")) { > > + if (!dflags) { > > + dev_warn(chip->dev, "GPIO line %d (%s): no > > initialization state specified, bailing out\n", > > +desc_to_gpio(desc), np->name); > > + continue; > > + } > > + > > + if (gpiod_initialize(desc, lflags, dflags)) > > + continue; > > We usually do not mix implementations and bindings but it's OK with me. > > > } > > You need a terminating else {} - clause to warn if neither of gpio-hog > or gpio-initval is specified. The idea was to have three cases: 1) Just give the gpio a name (desc->name). No hogging or initialization. 2) gpio-hog to initialize and acquire the GPIO for the whole time the gpiochip is present. 2) gpio-initval to initialize the GPIO to a given value (as gpio-hog does) but releasing the GPIO afterwards. > > > -int
Re: [PATCH v2 2/3] gpiolib: gpiod_hog remove separate name argument
Hi, On Mon, Sep 21, 2015 at 04:28:48PM -0700, Linus Walleij wrote: > On Sun, Aug 30, 2015 at 12:44 AM, Markus Pargmann wrote: > > > The gpio name is now stored in the gpio descriptor, so we can simply use > > that instead of an argument to the function. > > > > Signed-off-by: Markus Pargmann > > Several problems with this patch: > > - Does not apply to v4.3-rc1 Yes, a bit older already, will rebase it. > - Fixed that but noted that it just alters the call to gpiod_hog() > in of_gpiochip_scan_hogs(), there is a local const char *name that > should be removed too. The local const char *name is temporarily used in of_gpiochip_scan_hogs() to get the name from DT and assign it to the descriptor: desc = of_parse_own_gpio(np, &name, &lflags, &dflags); ... else desc->name = name; > - Looking at of_get_gpio_hog() it is unclear to me that .name > is set in the gpio_desc as desired. Please check this. > > Crucial code looks like this: > > if (name && of_property_read_string(np, "line-name", name)) > *name = np->name; of_get_gpio_hog() only parses the properties of the DT. It does not assign any properties to the descriptor itself. So I kept it this way and added the code for assignment to of_gpiochip_scan_gpios. > > i.e. is the line-name really propagated to gpiod->name? > Are you sure you have tested this with a DTS using line-name > and verified that it propagates properly? Yes this is tested and works for me. I am using the two series together without problems. Best Regards, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v2 3/3] gpiolib: Add GPIO initialization
On Sun, Aug 30, 2015 at 09:44:46AM +0200, Markus Pargmann wrote: > This functions adds a way to initialize a GPIO without hogging it. > > Signed-off-by: Markus Pargmann > --- > Documentation/devicetree/bindings/gpio/gpio.txt | 29 +++-- > drivers/gpio/gpiolib-of.c | 9 > drivers/gpio/gpiolib.c | 55 > - > drivers/gpio/gpiolib.h | 2 + > 4 files changed, 73 insertions(+), 22 deletions(-) > > diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt > b/Documentation/devicetree/bindings/gpio/gpio.txt > index 5788d5cf1252..55d58983ba43 100644 > --- a/Documentation/devicetree/bindings/gpio/gpio.txt > +++ b/Documentation/devicetree/bindings/gpio/gpio.txt > @@ -116,29 +116,34 @@ Every GPIO controller node must contain both an empty > "gpio-controller" > property, and a #gpio-cells integer property, which indicates the number of > cells in a gpio-specifier. > > -The GPIO chip may contain GPIO hog definitions. GPIO hogging is a mechanism > -providing automatic GPIO request and configuration as part of the > -gpio-controller's driver probe function. > +The GPIO chip may contain GPIO definitions. These define properties for > single > +GPIOs of this controller. > > -Each GPIO hog definition is represented as a child node of the GPIO > controller. > +GPIO hogging is a mechanism providing automatic GPIO request and > configuration > +as part of the gpio-controller's driver probe function. > + > +GPIO initialization provides an automatic initialization to known save > values. > +Instead of GPIO hogging the GPIO's value and direction can be modified by > other > +users after it was initialized. > + > +Each GPIO definition is represented as a child node of the GPIO controller. > Required properties: > -- gpio-hog: A property specifying that this child node represent a GPIO > hog. > - gpios: Store the GPIO information (id, flags, ...). Shall contain the > number of cells specified in its parent node (GPIO controller > node). > -Only one of the following properties scanned in the order shown below. > -This means that when multiple properties are present they will be searched > -in the order presented below and the first match is taken as the intended > -configuration. > + > +Optional properties: > +- line-name: The GPIO label name. If not present the node name is used. > + Only one of gpio-hog and gpio-initval may be specified. > +- gpio-hog: A property specifying that this child node represent a GPIO > hog. > +- gpio-initval: This GPIO should be initialized to the specified > configuration. Any feedback on this new DT binding? Best Regards, Markus > + Only one of input, output-low and output-high may be specified: > - input: A property specifying to set the GPIO direction as input. > - output-low A property specifying to set the GPIO direction as output with > the value low. > - output-high A property specifying to set the GPIO direction as output with > the value high. > > -Optional properties: > -- line-name: The GPIO label name. If not present the node name is used. > - > Example of two SOC GPIO banks defined as gpio-controller nodes: > > qe_pio_a: gpio-controller@1400 { > diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c > index f1fe5123da28..ee00c2c63f57 100644 > --- a/drivers/gpio/gpiolib-of.c > +++ b/drivers/gpio/gpiolib-of.c > @@ -234,6 +234,15 @@ static void of_gpiochip_scan_gpios(struct gpio_chip > *chip) > > if (gpiod_hog(desc, lflags, dflags)) > continue; > + } else if (of_property_read_bool(np, "gpio-initval")) { > + if (!dflags) { > + dev_warn(chip->dev, "GPIO line %d (%s): no > initialization state specified, bailing out\n", > + desc_to_gpio(desc), np->name); > + continue; > + } > + > + if (gpiod_initialize(desc, lflags, dflags)) > + continue; > } > } > } > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > index f1559fa72c36..d7aa27a92e82 100644 > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -2178,15 +2178,8 @@ struct gpio_desc *__must_check > __gpiod_get_index_optional(struct device *dev, > } > EXPORT_SYMBOL_GPL(__gpiod_get_index_optional); > > -/** > - * gpiod_hog - Hog the specified GPIO desc given the provid
Re: [PATCH v4 4/8] ARM: dts: imx: imx7d-sbd add iomuxc-lpsr hoggrp-2 pads
Hi, On Fri, Sep 18, 2015 at 11:29:54AM -0500, Adrian Alonso wrote: > Add imx7d-sdb iomuxc-lpsr hoggrp-2 default pads settings > > Signed-off-by: Adrian Alonso > --- > Changes for V2: Resend > Changes for V3: Resend > Changes for V4: Resend > > arch/arm/boot/dts/imx7d-sdb.dts | 15 +++ > 1 file changed, 15 insertions(+) > > diff --git a/arch/arm/boot/dts/imx7d-sdb.dts b/arch/arm/boot/dts/imx7d-sdb.dts > index 8059458..c8a178c 100644 > --- a/arch/arm/boot/dts/imx7d-sdb.dts > +++ b/arch/arm/boot/dts/imx7d-sdb.dts > @@ -419,3 +419,18 @@ > > }; > }; > + > +&iomuxc_lpsr { > + pinctrl-names = "default"; > + pinctrl-0 = <&pinctrl_hog_2>; > + > + imx7d-sdb { > + pinctrl_hog_2: hoggrp-2 { > + fsl,pins = < > + MX7D_PAD_GPIO1_IO05__GPIO1_IO50x14 > + MX7D_PAD_GPIO1_IO07__GPIO1_IO70x59 > + MX7D_PAD_GPIO1_IO00__WDOD1_WDOG_B 0x74 I think this belong to the watchdog node. Also some comments for the GPIOs may probably be nice to know what they are for. Regards, Markus > + >; > + }; > + }; > +}; > -- > 2.1.4 > > > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
[PATCH v2 1/3] gpio: Use __gpiod_request directly
There is no reason to find out chip and hwnum to use to request a gpio and get another gpio descriptor. We already have the descriptor we want to use so we can directly use it. Signed-off-by: Markus Pargmann --- drivers/gpio/gpiolib.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 79a0b41ce57b..872fdd3617c1 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2189,25 +2189,20 @@ EXPORT_SYMBOL_GPL(__gpiod_get_index_optional); int gpiod_hog(struct gpio_desc *desc, const char *name, unsigned long lflags, enum gpiod_flags dflags) { - struct gpio_chip *chip; - struct gpio_desc *local_desc; - int hwnum; int status; - chip = gpiod_to_chip(desc); - hwnum = gpio_chip_hwgpio(desc); - - local_desc = gpiochip_request_own_desc(chip, hwnum, name); - if (IS_ERR(local_desc)) { + status = __gpiod_request(desc, name); + if (status) { pr_err("requesting hog GPIO %s (chip %s, offset %d) failed\n", - name, chip->label, hwnum); - return PTR_ERR(local_desc); + name, gpiod_to_chip(desc)->label, + gpio_chip_hwgpio(desc)); + return status; } status = gpiod_configure_flags(desc, name, lflags, dflags); if (status < 0) { pr_err("setup of hog GPIO %s (chip %s, offset %d) failed\n", - name, chip->label, hwnum); + name, gpiod_to_chip(desc)->label, gpio_chip_hwgpio(desc)); gpiochip_free_own_desc(desc); return status; } -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/3] gpiolib: gpiod_hog remove separate name argument
The gpio name is now stored in the gpio descriptor, so we can simply use that instead of an argument to the function. Signed-off-by: Markus Pargmann --- drivers/gpio/gpiolib-of.c | 2 +- drivers/gpio/gpiolib.c| 8 drivers/gpio/gpiolib.h| 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 48a7579dd62d..f1fe5123da28 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -232,7 +232,7 @@ static void of_gpiochip_scan_gpios(struct gpio_chip *chip) continue; } - if (gpiod_hog(desc, name, lflags, dflags)) + if (gpiod_hog(desc, lflags, dflags)) continue; } } diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 872fdd3617c1..f1559fa72c36 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2181,15 +2181,15 @@ EXPORT_SYMBOL_GPL(__gpiod_get_index_optional); /** * gpiod_hog - Hog the specified GPIO desc given the provided flags * @desc: gpio whose value will be assigned - * @name: gpio line name * @lflags:gpio_lookup_flags - returned from of_find_gpio() or * of_get_gpio_hog() * @dflags:gpiod_flags - optional GPIO initialization flags */ -int gpiod_hog(struct gpio_desc *desc, const char *name, - unsigned long lflags, enum gpiod_flags dflags) +int gpiod_hog(struct gpio_desc *desc, unsigned long lflags, + enum gpiod_flags dflags) { int status; + const char *name = desc->name; status = __gpiod_request(desc, name); if (status) { @@ -2211,7 +2211,7 @@ int gpiod_hog(struct gpio_desc *desc, const char *name, set_bit(FLAG_IS_HOGGED, &desc->flags); pr_info("GPIO line %d (%s) hogged as %s%s\n", - desc_to_gpio(desc), name, + desc_to_gpio(desc), desc->name, (dflags&GPIOD_FLAGS_BIT_DIR_OUT) ? "output" : "input", (dflags&GPIOD_FLAGS_BIT_DIR_OUT) ? (dflags&GPIOD_FLAGS_BIT_DIR_VAL) ? "/high" : "/low":""); diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 78e634d1c719..6c2aeff59f86 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -97,8 +97,8 @@ struct gpio_desc { int gpiod_request(struct gpio_desc *desc, const char *label); void gpiod_free(struct gpio_desc *desc); -int gpiod_hog(struct gpio_desc *desc, const char *name, - unsigned long lflags, enum gpiod_flags dflags); +int gpiod_hog(struct gpio_desc *desc, unsigned long lflags, + enum gpiod_flags dflags); /* * Return the GPIO number of the passed descriptor relative to its chip -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/3] gpiolib: Add GPIO initialization
This functions adds a way to initialize a GPIO without hogging it. Signed-off-by: Markus Pargmann --- Documentation/devicetree/bindings/gpio/gpio.txt | 29 +++-- drivers/gpio/gpiolib-of.c | 9 drivers/gpio/gpiolib.c | 55 - drivers/gpio/gpiolib.h | 2 + 4 files changed, 73 insertions(+), 22 deletions(-) diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt index 5788d5cf1252..55d58983ba43 100644 --- a/Documentation/devicetree/bindings/gpio/gpio.txt +++ b/Documentation/devicetree/bindings/gpio/gpio.txt @@ -116,29 +116,34 @@ Every GPIO controller node must contain both an empty "gpio-controller" property, and a #gpio-cells integer property, which indicates the number of cells in a gpio-specifier. -The GPIO chip may contain GPIO hog definitions. GPIO hogging is a mechanism -providing automatic GPIO request and configuration as part of the -gpio-controller's driver probe function. +The GPIO chip may contain GPIO definitions. These define properties for single +GPIOs of this controller. -Each GPIO hog definition is represented as a child node of the GPIO controller. +GPIO hogging is a mechanism providing automatic GPIO request and configuration +as part of the gpio-controller's driver probe function. + +GPIO initialization provides an automatic initialization to known save values. +Instead of GPIO hogging the GPIO's value and direction can be modified by other +users after it was initialized. + +Each GPIO definition is represented as a child node of the GPIO controller. Required properties: -- gpio-hog: A property specifying that this child node represent a GPIO hog. - gpios: Store the GPIO information (id, flags, ...). Shall contain the number of cells specified in its parent node (GPIO controller node). -Only one of the following properties scanned in the order shown below. -This means that when multiple properties are present they will be searched -in the order presented below and the first match is taken as the intended -configuration. + +Optional properties: +- line-name: The GPIO label name. If not present the node name is used. + Only one of gpio-hog and gpio-initval may be specified. +- gpio-hog: A property specifying that this child node represent a GPIO hog. +- gpio-initval: This GPIO should be initialized to the specified configuration. + Only one of input, output-low and output-high may be specified: - input: A property specifying to set the GPIO direction as input. - output-low A property specifying to set the GPIO direction as output with the value low. - output-high A property specifying to set the GPIO direction as output with the value high. -Optional properties: -- line-name: The GPIO label name. If not present the node name is used. - Example of two SOC GPIO banks defined as gpio-controller nodes: qe_pio_a: gpio-controller@1400 { diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index f1fe5123da28..ee00c2c63f57 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -234,6 +234,15 @@ static void of_gpiochip_scan_gpios(struct gpio_chip *chip) if (gpiod_hog(desc, lflags, dflags)) continue; + } else if (of_property_read_bool(np, "gpio-initval")) { + if (!dflags) { + dev_warn(chip->dev, "GPIO line %d (%s): no initialization state specified, bailing out\n", +desc_to_gpio(desc), np->name); + continue; + } + + if (gpiod_initialize(desc, lflags, dflags)) + continue; } } } diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index f1559fa72c36..d7aa27a92e82 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2178,15 +2178,8 @@ struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev, } EXPORT_SYMBOL_GPL(__gpiod_get_index_optional); -/** - * gpiod_hog - Hog the specified GPIO desc given the provided flags - * @desc: gpio whose value will be assigned - * @lflags:gpio_lookup_flags - returned from of_find_gpio() or - * of_get_gpio_hog() - * @dflags:gpiod_flags - optional GPIO initialization flags - */ -int gpiod_hog(struct gpio_desc *desc, unsigned long lflags, - enum gpiod_flags dflags) +static int _gpiod_initialize(struct gpio_desc *desc, unsigned long lflags, + enum gpiod_flags dflags) { int status; const char *name = desc->name; @@ -2202,11 +2195,31 @@ int gpiod_hog(struct gpio_desc *desc, unsigned long lflags, status = gpiod_c
[PATCH v2 0/3] gpiolib: Initializing GPIOs using DT property gpio-initval
Hi, This is basically a resend with the devicetree mailinglist added to CC. This series adds a gpio-initval property to the devicetree. It provides a way to initialize GPIOs to a defined value. There are 3 patches. The first two simplify the function gpiod_hog. The third reuses the gpiod_hog()_code for a new gpiod_initialize() and adds the parsing of the DT. This series is based on the series "[PATCH v3 0/9] gpiolib: Add GPIO name support". Best regards, Markus Changes in v2: - Fixed Signed-off-by/author Markus Pargmann (3): gpio: Use __gpiod_request directly gpiolib: gpiod_hog remove separate name argument gpiolib: Add GPIO initialization Documentation/devicetree/bindings/gpio/gpio.txt | 29 ++ drivers/gpio/gpiolib-of.c | 11 +++- drivers/gpio/gpiolib.c | 74 + drivers/gpio/gpiolib.h | 6 +- 4 files changed, 83 insertions(+), 37 deletions(-) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/5] Documentation: Detail permitted DT properties for the imx6ul_tsc
On Fri, Aug 21, 2015 at 08:30:16AM +, Chen Bough wrote: > Hi Markus, > > > -Original Message- > > From: Markus Pargmann [mailto:m...@pengutronix.de] > > Sent: Wednesday, August 19, 2015 1:55 PM > > To: Chen Haibo-B51421 > > Cc: robh...@kernel.org; pawel.m...@arm.com; mark.rutl...@arm.com; > > ijc+devicet...@hellion.org.uk; ga...@codeaurora.org; shawn...@kernel.org; > > ker...@pengutronix.de; li...@arm.linux.org.uk; dmitry.torok...@gmail.com; > > devicetree@vger.kernel.org; sbran...@broadcom.com; a...@arndb.de; > > mche...@osg.samsung.com; christian.gmei...@gmail.com; > > scott@emc.com.tw; linux-ker...@vger.kernel.org; hdego...@redhat.com; > > jonat...@broadcom.com; benjamin.tissoi...@redhat.com; > > hans.verk...@cisco.com; had...@hadess.net; linux-in...@vger.kernel.org; > > ge...@linux-m68k.org; sebastien.szyman...@armadeus.com; > > mamli...@gmail.com; linux-arm-ker...@lists.infradead.org > > Subject: Re: [PATCH v2 2/5] Documentation: Detail permitted DT properties > > for the imx6ul_tsc > > > > Hi, > > > > On Tue, Jul 28, 2015 at 05:58:38PM +0800, Haibo Chen wrote: > > > Here we apply required documentation for the imx6ul touch screen > > > controller driver which describe available properties and how to use > > > them. > > > > > > Signed-off-by: Haibo Chen > > > --- > > > .../bindings/input/touchscreen/imx6ul_tsc.txt | 36 > > ++ > > > 1 file changed, 36 insertions(+) > > > create mode 100644 > > > Documentation/devicetree/bindings/input/touchscreen/imx6ul_tsc.txt > > > > > > diff --git > > > a/Documentation/devicetree/bindings/input/touchscreen/imx6ul_tsc.txt > > > b/Documentation/devicetree/bindings/input/touchscreen/imx6ul_tsc.txt > > > new file mode 100644 > > > index 000..ac41c32 > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/input/touchscreen/imx6ul_tsc.t > > > +++ xt > > > @@ -0,0 +1,36 @@ > > > +* Freescale i.MX6UL Touch Controller > > > + > > > +Required properties: > > > +- compatible: must be "fsl,imx6ul-tsc". > > > +- reg: this touch controller address and the ADC2 address. > > > > This suggests that this driver is using a unit ADC2. Which also means > > that there are more than one ADC which are probably identical? > > > > Shouldn't these ADCs be properly described by their own device nodes > > instead of these two register ranges, two interrupts and two clocks? > > > > Is 'ADC2' usable without tsc? Then ADC1/ADC2 should perhaps get a proper > > IIO driver. > > For i.MX6UL, there are two ADC. ADC1 is a normal ADC, and ADC2 can only works > for > TSC, the channels of ADC2 are connected to TSC directly. TSC and ADC2 should > work > together as a touch screen controller. But as I understand these are two different units. Wouldn't it be better to abstract it that way in the DT? Best regards, Markus > > For ADC1, it share the driver vf610_adc.c (drivers/iio/adc/vf610_adc.c). > > Best Regards > > Haibo > > > > > Unfortunately I don't have the reference manual to have a look how this > > all works. > > > > Best regards, > > > > Markus > > > > > +- interrupts: the interrupt of this touch controller and ADC2. > > > +- clocks: the root clock of touch controller and ADC2. > > > +- clock-names; must be "tsc" and "adc". > > > +- xnur-gpio: the X- gpio this controller connect to. > > > + This xnur-gpio returns to high once the finger leave the touch > > > +screen (The > > > + last touch event the touch controller capture). > > > + > > > +Optional properties: > > > +- measure-delay-time: the value of measure delay time. > > > + Before X-axis or Y-axis measurement, the screen need some time > > > +before > > > + even potential distribution ready. > > > + This value depends on the touch screen. > > > +- pre-charge-time: the touch screen need some time to precharge. > > > + This value depends on the touch screen. > > > + > > > +Example: > > > + tsc: tsc@0204 { > > > + compatible = "fsl,imx6ul-tsc"; > > > + reg = <0x0204 0x4000>, <0x0219c000 0x4000>; > > > + interrupts = , > > > + ; > > > + clocks = <&clks IMX6UL_CLK_IPG>, > > > +
Re: [PATCH v2 1/5] input: touchscreen: add imx6ul_tsc driver support
On Tue, Jul 28, 2015 at 05:58:37PM +0800, Haibo Chen wrote: > Freescale i.MX6UL contains a internal touchscreen controller, > this patch add a driver to support this controller. > > Signed-off-by: Haibo Chen > --- > drivers/input/touchscreen/Kconfig | 12 + > drivers/input/touchscreen/Makefile | 1 + > drivers/input/touchscreen/imx6ul_tsc.c | 504 > + > 3 files changed, 517 insertions(+) > create mode 100644 drivers/input/touchscreen/imx6ul_tsc.c > > diff --git a/drivers/input/touchscreen/Kconfig > b/drivers/input/touchscreen/Kconfig > index 5b272ba..32c300d 100644 > --- a/drivers/input/touchscreen/Kconfig > +++ b/drivers/input/touchscreen/Kconfig > @@ -479,6 +479,18 @@ config TOUCHSCREEN_MTOUCH > To compile this driver as a module, choose M here: the > module will be called mtouch. > > +config TOUCHSCREEN_IMX6UL_TSC > + tristate "Freescale i.MX6UL touchscreen controller" > + depends on OF > + help > + Say Y here if you have a Freescale i.MX6UL, and want to > + use the internal touchscreen controller. > + > + If unsure, say N. > + > + To compile this driver as a module, choose M here: the > + moduel will be called imx6ul_tsc. > + > config TOUCHSCREEN_INEXIO > tristate "iNexio serial touchscreens" > select SERIO > diff --git a/drivers/input/touchscreen/Makefile > b/drivers/input/touchscreen/Makefile > index c85aae2..9379b32 100644 > --- a/drivers/input/touchscreen/Makefile > +++ b/drivers/input/touchscreen/Makefile > @@ -38,6 +38,7 @@ obj-$(CONFIG_TOUCHSCREEN_EGALAX)+= egalax_ts.o > obj-$(CONFIG_TOUCHSCREEN_FUJITSU)+= fujitsu_ts.o > obj-$(CONFIG_TOUCHSCREEN_GOODIX) += goodix.o > obj-$(CONFIG_TOUCHSCREEN_ILI210X)+= ili210x.o > +obj-$(CONFIG_TOUCHSCREEN_IMX6UL_TSC) += imx6ul_tsc.o > obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o > obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o > obj-$(CONFIG_TOUCHSCREEN_IPROC) += bcm_iproc_tsc.o > diff --git a/drivers/input/touchscreen/imx6ul_tsc.c > b/drivers/input/touchscreen/imx6ul_tsc.c > new file mode 100644 > index 000..807f1db > --- /dev/null > +++ b/drivers/input/touchscreen/imx6ul_tsc.c > @@ -0,0 +1,504 @@ > +/* > + * Freescale i.MX6UL touchscreen controller driver > + * > + * Copyright (C) 2015 Freescale Semiconductor, Inc. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +/* ADC configuration registers field define */ > +#define ADC_AIEN (0x1 << 7) > +#define ADC_CONV_DISABLE 0x1F > +#define ADC_CAL (0x1 << 7) > +#define ADC_CALF 0x2 > +#define ADC_12BIT_MODE (0x2 << 2) > +#define ADC_IPG_CLK 0x00 > +#define ADC_CLK_DIV_8(0x03 << 5) > +#define ADC_SHORT_SAMPLE_MODE(0x0 << 4) > +#define ADC_HARDWARE_TRIGGER (0x1 << 13) > +#define SELECT_CHANNEL_4 0x04 > +#define SELECT_CHANNEL_1 0x01 > +#define DISABLE_CONVERSION_INT (0x0 << 7) > + > +/* ADC registers */ > +#define REG_ADC_HC0 0x00 > +#define REG_ADC_HC1 0x04 > +#define REG_ADC_HC2 0x08 > +#define REG_ADC_HC3 0x0C > +#define REG_ADC_HC4 0x10 > +#define REG_ADC_HS 0x14 > +#define REG_ADC_R0 0x18 > +#define REG_ADC_CFG 0x2C > +#define REG_ADC_GC 0x30 > +#define REG_ADC_GS 0x34 > + > +#define ADC_TIMEOUT msecs_to_jiffies(100) These defines are in two drivers. Here and in drivers/iio/adc/vf610_adc.c > + > +/* TSC registers */ > +#define REG_TSC_BASIC_SETING 0x00 > +#define REG_TSC_PRE_CHARGE_TIME 0x10 > +#define REG_TSC_FLOW_CONTROL 0x20 > +#define REG_TSC_MEASURE_VALUE0x30 > +#define REG_TSC_INT_EN 0x40 > +#define REG_TSC_INT_SIG_EN 0x50 > +#define REG_TSC_INT_STATUS 0x60 > +#define REG_TSC_DEBUG_MODE 0x70 > +#define REG_TSC_DEBUG_MODE2 0x80 > + > +/* TSC configuration registers field define */ > +#define DETECT_4_WIRE_MODE (0x0 << 4) > +#define AUTO_MEASURE 0x1 > +#define MEASURE_SIGNAL 0x1 > +#define DETECT_SIGNAL(0x1 << 4) > +#define VALID_SIGNAL (0x1 << 8) > +#define MEASURE_INT_EN 0x1 > +#define MEASURE_SIG_EN 0x1 > +#define VALID_SIG_EN (0x1 << 8) > +#define DE_GLITCH_2 (0x2 << 29) > +#define START_SENSE (0x1 << 12) > +#define TSC_DISABLE (0x1 << 16) > +#define DETECT_MODE 0x2 > + > +struct imx6ul_tsc { > + struct device *dev; > + struct input_dev *input; > + void __iomem *tsc_regs; > + voi
Re: [PATCH 5/8] pinctrl: freescale: imx: add shared input select reg support
On Tue, Aug 18, 2015 at 10:48:56AM -0500, Adrian Alonso wrote: > - Add shared input select register support > - imx7d has two iomux controllers iomuxc and iomuxc-lpsr > which share select_input register for daisy chain settings > > Signed-off-by: Adrian Alonso > --- > drivers/pinctrl/freescale/pinctrl-imx.c | 28 +++- > drivers/pinctrl/freescale/pinctrl-imx.h | 1 + > 2 files changed, 28 insertions(+), 1 deletion(-) > > diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c > b/drivers/pinctrl/freescale/pinctrl-imx.c > index 0440b0b..1009b52 100644 > --- a/drivers/pinctrl/freescale/pinctrl-imx.c > +++ b/drivers/pinctrl/freescale/pinctrl-imx.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -39,6 +40,7 @@ struct imx_pinctrl { > struct device *dev; > struct pinctrl_dev *pctl; > void __iomem *base; > + void __iomem *input_sel_base; > const struct imx_pinctrl_soc_info *info; > }; > > @@ -254,7 +256,12 @@ static int imx_pmx_set(struct pinctrl_dev *pctldev, > unsigned selector, >* Regular select input register can never be at offset >* 0, and we only print register value for regular case. >*/ > - writel(pin->input_val, ipctl->base + pin->input_reg); > + if (info->flags & SHARE_INPUT_SELECT_REG) > + writel(pin->input_val, ipctl->input_sel_base + > + pin->input_reg); > + else > + writel(pin->input_val, ipctl->base + > + pin->input_reg); > dev_dbg(ipctl->dev, > "==>select_input: offset 0x%x val 0x%x\n", > pin->input_reg, pin->input_val); > @@ -691,6 +698,8 @@ static int imx_pinctrl_probe_dt(struct platform_device > *pdev, > int imx_pinctrl_probe(struct platform_device *pdev, > struct imx_pinctrl_soc_info *info) > { > + struct device_node *dev_np = pdev->dev.of_node; > + struct device_node *np; > struct imx_pinctrl *ipctl; > struct resource *res; > int ret; > @@ -716,6 +725,23 @@ int imx_pinctrl_probe(struct platform_device *pdev, > if (IS_ERR(ipctl->base)) > return PTR_ERR(ipctl->base); > > + if (info->flags & SHARE_INPUT_SELECT_REG) { > + np = of_get_child_by_name(dev_np->parent, "iomuxc"); Isn't there a better way to get this node than searching through the childs of the parent which may magically have the right 'iomuxc' node there and using the register range of that node? Does the other iomuxc node uses its register space as well? Regards, Markus > + if (np) { > + ipctl->input_sel_base = of_iomap(np, 0); > + if (IS_ERR(ipctl->input_sel_base)) { > + of_node_put(np); > + dev_err(&pdev->dev, > +"iomuxc base address not found\n"); > + return PTR_ERR(ipctl->input_sel_base); > + } > + } else { > + dev_err(&pdev->dev, "iomuxc device node not foud\n"); > + return -EINVAL; > + } > + of_node_put(np); > + } > + > imx_pinctrl_desc.name = dev_name(&pdev->dev); > imx_pinctrl_desc.pins = info->pins; > imx_pinctrl_desc.npins = info->npins; > diff --git a/drivers/pinctrl/freescale/pinctrl-imx.h > b/drivers/pinctrl/freescale/pinctrl-imx.h > index d22b8f6..85c701b 100644 > --- a/drivers/pinctrl/freescale/pinctrl-imx.h > +++ b/drivers/pinctrl/freescale/pinctrl-imx.h > @@ -85,6 +85,7 @@ struct imx_pinctrl_soc_info { > > #define SHARE_MUX_CONF_REG 0x1 > #define ZERO_OFFSET_VALID0x2 > +#define SHARE_INPUT_SELECT_REG 0x4 > > #define NO_MUX 0x0 > #define NO_PAD 0x0 > -- > 2.1.4 > > -- > To unsubscribe from this list: send the line "unsubscribe devicetree" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH 1/8] ARM: imx: imx7d-pinfunc: add gpio1 pad iomux settings
On Tue, Aug 18, 2015 at 10:48:52AM -0500, Adrian Alonso wrote: > - Add imx7 SoC GPIO1 pad iomuxc settings > > - Fix UART input select daisy chain setting values > > Signed-off-by: Adrian Alonso > --- > arch/arm/boot/dts/imx7d-pinfunc.h | 122 > +- > 1 file changed, 119 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/boot/dts/imx7d-pinfunc.h > b/arch/arm/boot/dts/imx7d-pinfunc.h > index a8d8149..22f849c 100644 > --- a/arch/arm/boot/dts/imx7d-pinfunc.h > +++ b/arch/arm/boot/dts/imx7d-pinfunc.h > @@ -15,6 +15,122 @@ > * > */ > > +#define MX7D_PAD_GPIO1_IO00__GPIO1_IO0 > 0x 0x0030 0x 0x0 0x0 > +#define MX7D_PAD_GPIO1_IO00__PWM4_OUT > 0x 0x0030 0x 0x1 0x0 > +#define MX7D_PAD_GPIO1_IO00__WDOD1_WDOG_ANY0x 0x0030 > 0x 0x2 0x0 > +#define MX7D_PAD_GPIO1_IO00__WDOD1_WDOG_B 0x 0x0030 > 0x 0x3 0x0 > +#define MX7D_PAD_GPIO1_IO00__WDOD1_WDOG__RST_B_DEB 0x 0x0030 > 0x 0x4 0x0 > +#define MX7D_PAD_GPIO1_IO01__GPIO1_IO1 > 0x0004 0x0034 0x 0x0 0x0 > +#define MX7D_PAD_GPIO1_IO01__PWM1_OUT > 0x0004 0x0034 0x 0x1 0x0 > +#define MX7D_PAD_GPIO1_IO01__CCM_ENET_REF_CLK3 > 0x0004 0x0034 0x 0x2 0x0 > +#define MX7D_PAD_GPIO1_IO01__SAI1_MCLK > 0x0004 0x0034 0x 0x3 0x0 > +#define MX7D_PAD_GPIO1_IO01__ANATOP_24M_OUT0x0004 0x0034 > 0x 0x4 0x0 > +#define MX7D_PAD_GPIO1_IO01__OBSERVE0_OUT 0x0004 0x0034 > 0x 0x6 0x0 > +#define MX7D_PAD_GPIO1_IO02__GPIO1_IO2 > 0x0008 0x0038 0x 0x0 0x0 > +#define MX7D_PAD_GPIO1_IO02__PWM2_OUT > 0x0008 0x0038 0x 0x1 0x0 > +#define MX7D_PAD_GPIO1_IO02__CCM_ENET_REF_CLK1 > 0x0008 0x0038 0x0564 0x2 0x3 > +#define MX7D_PAD_GPIO1_IO02__SAI2_MCLK > 0x0008 0x0038 0x 0x3 0x0 > +#define MX7D_PAD_GPIO1_IO02__CCM_CLKO1 > 0x0008 0x0038 0x 0x5 0x0 > +#define MX7D_PAD_GPIO1_IO02__OBSERVE1_OUT 0x0008 0x0038 > 0x 0x6 0x0 > +#define MX7D_PAD_GPIO1_IO02__USB_OTG1_ID 0x0008 0x0038 > 0x0734 0x7 0x3 > +#define MX7D_PAD_GPIO1_IO03__GPIO1_IO3 > 0x000C 0x003C 0x 0x0 0x0 > +#define MX7D_PAD_GPIO1_IO03__PWM3_OUT > 0x000C 0x003C 0x 0x1 0x0 > +#define MX7D_PAD_GPIO1_IO03__CCM_ENET_REF_CLK2 > 0x000C 0x003C 0x0570 0x2 0x3 > +#define MX7D_PAD_GPIO1_IO03__SAI3_MCLK > 0x000C 0x003C 0x 0x3 0x0 > +#define MX7D_PAD_GPIO1_IO03__CCM_CLKO2 > 0x000C 0x003C 0x 0x5 0x0 > +#define MX7D_PAD_GPIO1_IO03__OBSERVE2_OUT 0x000C 0x003C > 0x 0x6 0x0 > +#define MX7D_PAD_GPIO1_IO03__USB_OTG2_ID 0x000C 0x003C > 0x0730 0x7 0x3 > +#define MX7D_PAD_GPIO1_IO04__GPIO1_IO4 > 0x0010 0x0040 0x 0x0 0x0 > +#define MX7D_PAD_GPIO1_IO04__USB_OTG1_OC 0x0010 0x0040 > 0x072C 0x1 0x1 > +#define MX7D_PAD_GPIO1_IO04__FLEXTIMER1_CH40x0010 0x0040 > 0x0594 0x2 0x1 > +#define MX7D_PAD_GPIO1_IO04__UART5_CTS_B 0x0010 0x0040 > 0x0710 0x3 0x4 > +#define MX7D_PAD_GPIO1_IO04__I2C1_SCL > 0x0010 0x0040 0x05D4 0x4 0x2 > +#define MX7D_PAD_GPIO1_IO04__OBSERVE3_OUT 0x0010 0x0040 > 0x 0x6 0x0 > +#define MX7D_PAD_GPIO1_IO05__GPIO1_IO5 > 0x0014 0x0044 0x 0x0 0x0 > +#define MX7D_PAD_GPIO1_IO05__USB_OTG1_PWR 0x0014 0x0044 > 0x 0x1 0x0 > +#define MX7D_PAD_GPIO1_IO05__FLEXTIMER1_CH50x0014 0x0044 > 0x0598 0x2 0x1 > +#define MX7D_PAD_GPIO1_IO05__UART5_RTS_B 0x0014 0x0044 > 0x0710 0x3 0x5 > +#define MX7D_PAD_GPIO1_IO05__I2C1_SDA > 0x0014 0x0044 0x05D8 0x4 0x2 > +#define MX7D_PAD_GPIO1_IO05__OBSERVE4_OUT 0x0014 0x0044 > 0x 0x6 0x0 > +#define MX7D_PAD_GPIO1_IO06__GPIO1_IO6 > 0x0018 0x0048 0x 0x0 0x0 > +#define MX7D_PAD_GPIO1_IO06__USB_OTG2_OC 0x0018 0x0048 > 0x0728 0x1 0x1 > +#define MX7D_PAD_GPIO1_IO06__FLEXTIMER1_CH60x0018 0x0048 > 0x059C 0x2 0x1 > +#define MX7D_PAD_GPIO1_IO06__UART5_RX_DATA 0x0018 0x0048 > 0x0714 0x3 0x4 > +#define MX7D_PAD_GPIO1_IO06__I2C2_SCL > 0x0018 0x0048 0x05DC 0x4 0x2 > +#define MX7D_PAD_GPIO1_IO06__CCM_WAIT > 0x0018 0x0048 0x 0x5 0x0 > +#define
Re: [PATCH 8/8] pinctrl: freescale: imx: fix system crash if enable two pinctl instances
On Tue, Aug 18, 2015 at 10:48:59AM -0500, Adrian Alonso wrote: > From: Robin Gong > > Remove 'static' for 'grp_index', otherwise, it cause the groups whose number > is > smaller than the number of groups of the last pinctl instance never to be > intialized, thus cause system crash as below grp_index is used as array index. If you remove 'static' from this variable doesn't it always write to array element 0 and overwrite the last group? Regards, Markus > > [0.661012] [<802a6cb0>] (strcmp) from [<802cc80c>] > (imx_dt_node_to_map+0x58/0x208) > [0.668879] [<802cc80c>] (imx_dt_node_to_map) from [<802cbe24>] > (pinctrl_dt_to_map+0x174/0x2b0) > [0.677654] [<802cbe24>] (pinctrl_dt_to_map) from [<802c8f18>] > (pinctrl_get+0x100/0x424) > [0.685878] [<802c8f18>] (pinctrl_get) from [<802c9510>] > (pinctrl_register+0x26c/0x480) > [0.694104] [<802c9510>] (pinctrl_register) from [<802ccf3c>] > (imx_pinctrl_probe+0x580/0x6e8) > [0.702706] [<802ccf3c>] (imx_pinctrl_probe) from [<80351b58>] > (platform_drv_probe+0x44/0xa4) > [0.711455] [<80351b58>] (platform_drv_probe) from [<803503ec>] > (driver_probe_device+0x174/0x2b4) > [0.720405] [<803503ec>] (driver_probe_device) from [<803505fc>] > (__driver_attach+0x8c/0x90) > [0.728982] [<803505fc>] (__driver_attach) from [<8034e930>] > (bus_for_each_dev+0x6c/0xa0) > [0.737381] [<8034e930>] (bus_for_each_dev) from [<8034fb88>] > (bus_add_driver+0x148/0x1f0) > [0.745804] [<8034fb88>] (bus_add_driver) from [<80350c00>] > (driver_register+0x78/0xf8) > [0.753880] [<80350c00>] (driver_register) from [<800097d0>] > (do_one_initcall+0x8c/0x1d4) > [0.762282] [<800097d0>] (do_one_initcall) from [<80987dac>] > (kernel_init_freeable+0x144/0x1e4) > [0.771061] [<80987dac>] (kernel_init_freeable) from [<806d9c7c>] > (kernel_init+0x8/0xe8) > [0.779285] [<806d9c7c>] (kernel_init) from [<8000f628>] > (ret_from_fork+0x14/0x2c) > [0.786981] Code: e352 e5e32001 1afb e12fff1e (e4d03001) > > Signed-off-by: Robin Gong > Signed-off-by: Adrian Alonso > --- > drivers/pinctrl/freescale/pinctrl-imx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c > b/drivers/pinctrl/freescale/pinctrl-imx.c > index 3e02887..cdb5463 100644 > --- a/drivers/pinctrl/freescale/pinctrl-imx.c > +++ b/drivers/pinctrl/freescale/pinctrl-imx.c > @@ -595,7 +595,7 @@ static int imx_pinctrl_parse_functions(struct device_node > *np, > struct device_node *child; > struct imx_pmx_func *func; > struct imx_pin_group *grp; > - static u32 grp_index; > + u32 grp_index = 0; > u32 i = 0; > > dev_dbg(info->dev, "parse function(%d): %s\n", index, np->name); > -- > 2.1.4 > > > ___ > linux-arm-kernel mailing list > linux-arm-ker...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH 7/8] pinctrl: freescale: imx: fix flat functions default return
On Tue, Aug 18, 2015 at 10:48:58AM -0500, Adrian Alonso wrote: > Fix imx pinctrl dt flat functions default return value. > If property fsl,pins is not found in function_np and > pinctrl_np return false to indicate that DT is not using > flat functions. The for loop in this function checks the child nodes and the child's child nodes. Therefore if we exit the for loop we didn't find any nodes on any level with the 'fsl,pins' property. So this 'default' return value is never used unless there is no fsl,pins property anywhere. So this return value is not important but I wrote true because we want to use the new flat dt option as default. The extra indention doesn't make sense anymore. Regards, Markus > > Signed-off-by: Adrian Alonso > --- > drivers/pinctrl/freescale/pinctrl-imx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c > b/drivers/pinctrl/freescale/pinctrl-imx.c > index 1009b52..3e02887 100644 > --- a/drivers/pinctrl/freescale/pinctrl-imx.c > +++ b/drivers/pinctrl/freescale/pinctrl-imx.c > @@ -641,7 +641,7 @@ static bool imx_pinctrl_dt_is_flat_functions(struct > device_node *np) > } > } > > - return true; > + return false; > } > > static int imx_pinctrl_probe_dt(struct platform_device *pdev, > -- > 2.1.4 > > > ___ > linux-arm-kernel mailing list > linux-arm-ker...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v2 2/5] Documentation: Detail permitted DT properties for the imx6ul_tsc
Hi, On Tue, Jul 28, 2015 at 05:58:38PM +0800, Haibo Chen wrote: > Here we apply required documentation for the imx6ul touch screen > controller driver which describe available properties and how to > use them. > > Signed-off-by: Haibo Chen > --- > .../bindings/input/touchscreen/imx6ul_tsc.txt | 36 > ++ > 1 file changed, 36 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/input/touchscreen/imx6ul_tsc.txt > > diff --git > a/Documentation/devicetree/bindings/input/touchscreen/imx6ul_tsc.txt > b/Documentation/devicetree/bindings/input/touchscreen/imx6ul_tsc.txt > new file mode 100644 > index 000..ac41c32 > --- /dev/null > +++ b/Documentation/devicetree/bindings/input/touchscreen/imx6ul_tsc.txt > @@ -0,0 +1,36 @@ > +* Freescale i.MX6UL Touch Controller > + > +Required properties: > +- compatible: must be "fsl,imx6ul-tsc". > +- reg: this touch controller address and the ADC2 address. This suggests that this driver is using a unit ADC2. Which also means that there are more than one ADC which are probably identical? Shouldn't these ADCs be properly described by their own device nodes instead of these two register ranges, two interrupts and two clocks? Is 'ADC2' usable without tsc? Then ADC1/ADC2 should perhaps get a proper IIO driver. Unfortunately I don't have the reference manual to have a look how this all works. Best regards, Markus > +- interrupts: the interrupt of this touch controller and ADC2. > +- clocks: the root clock of touch controller and ADC2. > +- clock-names; must be "tsc" and "adc". > +- xnur-gpio: the X- gpio this controller connect to. > + This xnur-gpio returns to high once the finger leave the touch screen (The > + last touch event the touch controller capture). > + > +Optional properties: > +- measure-delay-time: the value of measure delay time. > + Before X-axis or Y-axis measurement, the screen need some time before > + even potential distribution ready. > + This value depends on the touch screen. > +- pre-charge-time: the touch screen need some time to precharge. > + This value depends on the touch screen. > + > +Example: > + tsc: tsc@0204 { > + compatible = "fsl,imx6ul-tsc"; > + reg = <0x0204 0x4000>, <0x0219c000 0x4000>; > + interrupts = , > + ; > + clocks = <&clks IMX6UL_CLK_IPG>, > + <&clks IMX6UL_CLK_ADC2>; > + clock-names = "tsc", "adc"; > + pinctrl-names = "default"; > + pinctrl-0 = <&pinctrl_tsc>; > + xnur-gpio = <&gpio1 3 GPIO_ACTIVE_HIGH>; > + measure-delay-time = <0xfff>; > + pre-charge-time = <0x>; > + status = "okay"; > + }; > -- > 1.9.1 > > > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v7 3/8] ARM: dt: Binding documentation for imx25 touchscreen controller
On Sat, Mar 07, 2015 at 05:37:04PM +, Jonathan Cameron wrote: > On 03/03/15 07:58, Markus Pargmann wrote: > > This is the touchscreen conversion queue binding documentation. It uses > > the shared imx25 ADC. > > > > Signed-off-by: Markus Pargmann > Looks fine, one more general binding approach comment though. > A lot of the vendor specific elements in here are awfully generic. > Does it not make sense to have them as standard attributes for > touch screen drivers? > > --- > > > > Notes: > > Changes in v5: > > - Fix signed/unsigned comparison > > - Fix unused variable settling_time by putting it in the correct > > argument list > > - Use continous conversion queue with the repeat feature and a proper > >repeat-wait. Previously the touchscreen caused massive number of > > interrupts. > > > > .../bindings/input/touchscreen/fsl-mx25-tcq.txt| 29 > > ++ > > 1 file changed, 29 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt > > > > diff --git > > a/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt > > b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt > > new file mode 100644 > > index ..4214a99d197a > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt > > @@ -0,0 +1,29 @@ > > +Freescale mx25 TS conversion queue module > > + > > +mx25 touchscreen conversion queue module which controls the ADC unit of the > > +mx25 for attached touchscreens. > > + > > +Required properties: > > + - compatible: Should be "fsl,imx25-tcq". > > + - reg: Memory range of the device. > > + - interrupts: Should be the interrupt number associated with this module > > within > > + the tscadc unit (<0>). > > + - interrupt-parent: Should be a phandle to the tscadc unit. > > + - fsl,wires: Should be '<4>' or '<5>' > > + > > +Optional properties: > > + - fsl,pen-debounce: Pen debounce time. > > + - fsl,pen-threshold: Pen-down threshold for the touchscreen. > > + - fsl,settling-time: Settling time in nanoseconds. > Obviously it's up to Dmitry etc, but are these not standard enough attributes > to > not be vendor specific? I'd expect say touch-pen-debouce and > touch-pen-threshold > etc to be standard binding elements for touch screens. Seems like a good idea. I just discovered that there is a 'touchscreen-fuzz-pressure' which seems to be the same as fsl,pen-threshold. So this should be replaced in my patches. The other properties do not exist. Dmitry, what do you think about some standard properties for the remaining? Best Regards, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v7 4/8] mfd: fsl imx25 Touchscreen ADC driver
Hi, Sorry for the late reply, On Mon, Mar 09, 2015 at 09:27:10AM +, Lee Jones wrote: > On Tue, 03 Mar 2015, Markus Pargmann wrote: > > > This is the core driver for imx25 touchscreen/adc driver. The module > > has one shared ADC and two different conversion queues which use the > > ADC. The two queues are identical. Both can be used for general purpose > > ADC but one is meant to be used for touchscreens. > > > > This driver is the core which manages the central components and > > registers of the TSC/ADC unit. It manages the IRQs and forwards them to > > the correct components. > > > > Signed-off-by: Markus Pargmann > > Signed-off-by: Denis Carikli > > Acked-by: Jonathan Cameron > > --- > > > > Notes: > > Changes in v7: > > - Cleanup bit defines in header files to be more readable > > - Fix irq check to return with an error for irq <= 0 > > - Add COMPILE_TEST in Kconfig file > > > > Changes in v5: > > - Remove ifdef CONFIG_OF as this driver is only for DT usage > > - Remove module owner > > - Add Kconfig dependencies ARCH_MX25 and OF > > > > @Jonathan Cameron: > > I left your acked-by on the patch as these were small changes. If it > > should be > > removed, please say so. Thanks > > > > drivers/mfd/Kconfig | 10 +++ > > drivers/mfd/Makefile| 2 + > > drivers/mfd/fsl-imx25-tsadc.c | 164 > > > > include/linux/mfd/imx25-tsadc.h | 141 ++ > > 4 files changed, 317 insertions(+) > > create mode 100644 drivers/mfd/fsl-imx25-tsadc.c > > create mode 100644 include/linux/mfd/imx25-tsadc.h > > > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > > index 38356e39adba..c0036aef61d7 100644 > > --- a/drivers/mfd/Kconfig > > +++ b/drivers/mfd/Kconfig > > @@ -244,6 +244,16 @@ config MFD_MC13XXX_I2C > > help > > Select this if your MC13xxx is connected via an I2C bus. > > > > +config MFD_MX25_TSADC > > + tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" > > + select REGMAP_MMIO > > + depends on SOC_IMX25 || COMPILE_TEST > > + depends on OF > > Are you sure you can't compile test with OF disabled? > > depends on (SOC_IMX25 && OF) || COMPILE_TEST Yes, should be possible without OF. > > > + help > > + Enable support for the integrated Touchscreen and ADC unit of the > > + i.MX25 processors. They consist of a conversion queue for general > > + purpose ADC and a queue for Touchscreens. > > + > > config MFD_HI6421_PMIC > > tristate "HiSilicon Hi6421 PMU/Codec IC" > > depends on OF > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > > index 19f3d744e3bd..acfe639e147c 100644 > > --- a/drivers/mfd/Makefile > > +++ b/drivers/mfd/Makefile > > @@ -78,6 +78,8 @@ obj-$(CONFIG_TWL4030_POWER)+= twl4030-power.o > > obj-$(CONFIG_MFD_TWL4030_AUDIO)+= twl4030-audio.o > > obj-$(CONFIG_TWL6040_CORE) += twl6040.o > > > > +obj-$(CONFIG_MFD_MX25_TSADC) += fsl-imx25-tsadc.o > > + > > obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o > > obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o > > obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o > > diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c > > new file mode 100644 > > index ..c4a3e15001ea > > --- /dev/null > > +++ b/drivers/mfd/fsl-imx25-tsadc.c > > @@ -0,0 +1,164 @@ > > +/* > > + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann > > > > + * > > + * This program is free software; you can redistribute it and/or modify it > > under > > + * the terms of the GNU General Public License version 2 as published by > > the > > + * Free Software Foundation. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +static struct regmap_config mx25_tsadc_regmap_config = { > > + .fast_io = true, > > + .max_register = 8, > > + .reg_bits = 32, > > + .val_bits = 32, > > + .reg_stride = 4, > > +}; > > + > > +static void mx25_tsadc_irq_handler(u32 irq, struct irq_desc *desc) > &g
Re: [PATCH v7 0/8] imx25 adc and touchscreen driver
On Sat, Mar 07, 2015 at 06:24:09PM +, Jonathan Cameron wrote: > On 03/03/15 07:58, Markus Pargmann wrote: > > Hi, > > > > This series adds a driver for the Freescale i.MX25 SoC internal ADC unit > > which > > is used for touchscreen and ADC. The driver consists of three parts, the MFD > > driver which handles interrupts and some central configuration registers, > > the > > ADC driver and the touchscreen driver. > > > > v7 has some modifications in the probe functions to use devres irq requests. > > irq checks were fixed to check for irqs <= 0. The header was cleaned up to > > have > > a more uniform presentation of the bit fields. Detailed changelogs are > > attached > > to the according mails. > > > > Best Regards, > > > > Markus > Almost there as far as I am concerned. Just that one unbalanced > regulator_enable > that needs dealing with. The bindings are pretty simple so whilst a > device-tree > ack would of course be great I guess it could be taken without. > > This wants to go via mfd or I suppose the freescale/arm-soc tree. Either is > fine > with me. Thanks for your review. I will fix the missing parts. Best Regards, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v7 5/8] iio: adc: fsl,imx25-gcq driver
On Sat, Mar 07, 2015 at 06:03:44PM +, Jonathan Cameron wrote: > On 03/03/15 07:58, Markus Pargmann wrote: > > This is a conversion queue driver for the mx25 SoC. It uses the central > > ADC which is used by two seperate independent queues. This driver > > prepares different conversion configurations for each possible input. > > For a conversion it creates a conversionqueue of one item with the > > correct configuration for the chosen channel. It then executes the queue > > once and disables the conversion queue afterwards. > > > > The reference voltages are configurable through devicetree subnodes, > > depending on the connections of the ADC inputs. > > > > Signed-off-by: Markus Pargmann > > Signed-off-by: Denis Carikli > > Signed-off-by: Markus Pargmann > There's an unbalanced regulator_enable that needs fixing. > Deal with that in both the remove and the error cases > and I'm happy. > > > --- > > > > Notes: > > Changes in v7: > > - Remove separate functions mx25_gcq_disable/enable_eoq() as they were > > used at > >only one position > > - Enforce an external reference regulator if one of the conversions > > uses it as > >reference. The devm_regulator_get() call was moved into > >mx25_gcq_setup_cfgs() to be able to acquire the reference regulator > > when > >necessary. > > - Store indio_dev as platform driver data instead of the private data. > > This > >was changed in probe() and remove(). > > > > Changes in v6: > > - Added defines for a complete list of references in the dt binding > > macros > > > > drivers/iio/adc/Kconfig | 7 + > > drivers/iio/adc/Makefile| 1 + > > drivers/iio/adc/fsl-imx25-gcq.c | 356 > > > > include/dt-bindings/iio/adc/fsl-imx25-gcq.h | 18 ++ > > 4 files changed, 382 insertions(+) > > create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c > > create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h > > > > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > > index 202daf889be2..947805d03d6c 100644 > > --- a/drivers/iio/adc/Kconfig > > +++ b/drivers/iio/adc/Kconfig > > @@ -154,6 +154,13 @@ config EXYNOS_ADC > > of SoCs for drivers such as the touchscreen and hwmon to use to share > > this resource. > > > > +config FSL_MX25_ADC > > + tristate "Freescale MX25 ADC driver" > > + depends on MFD_MX25_TSADC > > + help > > + Generic Conversion Queue driver used for general purpose ADC in the > > + MX25. This driver supports single measurements using the MX25 ADC. > > + > > config LP8788_ADC > > tristate "LP8788 ADC driver" > > depends on MFD_LP8788 > > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile > > index 0315af640866..409583975ba0 100644 > > --- a/drivers/iio/adc/Makefile > > +++ b/drivers/iio/adc/Makefile > > @@ -17,6 +17,7 @@ obj-$(CONFIG_AT91_ADC) += at91_adc.o > > obj-$(CONFIG_AXP288_ADC) += axp288_adc.o > > obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o > > obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o > > +obj-$(CONFIG_FSL_MX25_ADC) += fsl-imx25-gcq.o > > obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o > > obj-$(CONFIG_MAX1027) += max1027.o > > obj-$(CONFIG_MAX1363) += max1363.o > > diff --git a/drivers/iio/adc/fsl-imx25-gcq.c > > b/drivers/iio/adc/fsl-imx25-gcq.c > > new file mode 100644 > > index ..18c21888aa4e > > --- /dev/null > > +++ b/drivers/iio/adc/fsl-imx25-gcq.c > > @@ -0,0 +1,356 @@ > > +/* > > + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann > > > > + * > > + * This program is free software; you can redistribute it and/or modify it > > under > > + * the terms of the GNU General Public License version 2 as published by > > the > > + * Free Software Foundation. > > + * > > + * This is the driver for the imx25 GCQ (Generic Conversion Queue) > > + * connected to the imx25 ADC. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#define MX25_GCQ_TIMEOUT (msecs_to_jiffies(2000)) > > + > > +enum mx25_gcq_cfgs { > > + MX25_CFG_XP = 0, > > + MX25_CFG_YP, > > + MX25_CFG_XN, > >
Re: [PATCH v7 4/8] mfd: fsl imx25 Touchscreen ADC driver
On Sat, Mar 07, 2015 at 05:52:26PM +, Jonathan Cameron wrote: > On 03/03/15 07:58, Markus Pargmann wrote: > > This is the core driver for imx25 touchscreen/adc driver. The module > > has one shared ADC and two different conversion queues which use the > > ADC. The two queues are identical. Both can be used for general purpose > > ADC but one is meant to be used for touchscreens. > > > > This driver is the core which manages the central components and > > registers of the TSC/ADC unit. It manages the IRQs and forwards them to > > the correct components. > > > > Signed-off-by: Markus Pargmann > > Signed-off-by: Denis Carikli > > Acked-by: Jonathan Cameron > hehe. Read it again (backwards so only just found my Ack). > > Anyhow, one really minor comment inline. Feel free > to ignore it. Ack still stands. > > > --- > > > > Notes: > > Changes in v7: > > - Cleanup bit defines in header files to be more readable > > - Fix irq check to return with an error for irq <= 0 > > - Add COMPILE_TEST in Kconfig file > > > > Changes in v5: > > - Remove ifdef CONFIG_OF as this driver is only for DT usage > > - Remove module owner > > - Add Kconfig dependencies ARCH_MX25 and OF > > > > @Jonathan Cameron: > > I left your acked-by on the patch as these were small changes. If it > > should be > > removed, please say so. Thanks > > > > drivers/mfd/Kconfig | 10 +++ > > drivers/mfd/Makefile| 2 + > > drivers/mfd/fsl-imx25-tsadc.c | 164 > > > > include/linux/mfd/imx25-tsadc.h | 141 ++ > > 4 files changed, 317 insertions(+) > > create mode 100644 drivers/mfd/fsl-imx25-tsadc.c > > create mode 100644 include/linux/mfd/imx25-tsadc.h > > > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > > index 38356e39adba..c0036aef61d7 100644 > > --- a/drivers/mfd/Kconfig > > +++ b/drivers/mfd/Kconfig > > @@ -244,6 +244,16 @@ config MFD_MC13XXX_I2C > > help > > Select this if your MC13xxx is connected via an I2C bus. > > > > +config MFD_MX25_TSADC > > + tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" > > + select REGMAP_MMIO > > + depends on SOC_IMX25 || COMPILE_TEST > > + depends on OF > > + help > > + Enable support for the integrated Touchscreen and ADC unit of the > > + i.MX25 processors. They consist of a conversion queue for general > > + purpose ADC and a queue for Touchscreens. > > + > > config MFD_HI6421_PMIC > > tristate "HiSilicon Hi6421 PMU/Codec IC" > > depends on OF > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > > index 19f3d744e3bd..acfe639e147c 100644 > > --- a/drivers/mfd/Makefile > > +++ b/drivers/mfd/Makefile > > @@ -78,6 +78,8 @@ obj-$(CONFIG_TWL4030_POWER)+= twl4030-power.o > > obj-$(CONFIG_MFD_TWL4030_AUDIO)+= twl4030-audio.o > > obj-$(CONFIG_TWL6040_CORE) += twl6040.o > > > > +obj-$(CONFIG_MFD_MX25_TSADC) += fsl-imx25-tsadc.o > > + > > obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o > > obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o > > obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o > > diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c > > new file mode 100644 > > index ..c4a3e15001ea > > --- /dev/null > > +++ b/drivers/mfd/fsl-imx25-tsadc.c > > @@ -0,0 +1,164 @@ > > +/* > > + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann > > > > + * > > + * This program is free software; you can redistribute it and/or modify it > > under > > + * the terms of the GNU General Public License version 2 as published by > > the > > + * Free Software Foundation. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +static struct regmap_config mx25_tsadc_regmap_config = { > > + .fast_io = true, > > + .max_register = 8, > > + .reg_bits = 32, > > + .val_bits = 32, > > + .reg_stride = 4, > > +}; > > + > > +static void mx25_tsadc_irq_handler(u32 irq, struct irq_desc *desc) > > +{ > > + struct mx25_tsadc *tsadc = irq_desc_get_
Re: [PATCH v7 1/8] ARM: dt: Binding documentation for imx25 ADC/TSC
Hi, On Tue, Mar 03, 2015 at 10:02:12AM +0100, Arnd Bergmann wrote: > On Tuesday 03 March 2015 08:58:11 Markus Pargmann wrote: > > +Example: > > + tscadc: tscadc@5003 { > > + compatible = "fsl,imx25-tsadc"; > > + reg = <0x5003 0xc>; > > + interrupts = <46>; > > + clocks = <&clks 119>; > > + clock-names = "ipg"; > > + interrupt-controller; > > + #interrupt-cells = <1>; > > + #address-cells = <1>; > > + #size-cells = <1>; > > + ranges; > > + > > + tsc: tcq@50030400 { > > + compatible = "fsl,imx25-tcq"; > > + reg = <0x50030400 0x60>; > > + ... > > + }; > > + > > + adc: gcq@50030800 { > > + compatible = "fsl,imx25-gcq"; > > + reg = <0x50030800 0x60>; > > + ... > > + }; > > + }; > > > > I wonder if we should just treat this MFD as a single IIO device > that also registers to the input layer. > > Are there any other registers in the 0x5003-0x50031000 > range, or could the fsl,imx25-tcq and fsl,imx25-gcq devices > be reused outside of a fsl,imx25-tsadc device? There are no other registers in this range. The tcq and gcq devices can not be used outside of the tsadc. gcq and tcq are identical units so it may work to use both of them as gcq for example but nothing else. It may work to have this as single IIO device. However this would be a major rework of this series. There are a lot less users of imx25 than imx6 for example. And of these users barely anyone uses this unit at all. I really would like to get these drivers mainline so others can use it. But after 1 year and 7 versions of this series I don't want to put a lot of work into these drivers. I think there are other components in the kernel where the time is better used. Best Regards, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
[PATCH v7 6/8] input: touchscreen: imx25 tcq driver
This is a driver for the imx25 ADC/TSC module. It controls the touchscreen conversion queue and creates a touchscreen input device. The driver currently only supports 4 wire touchscreens. The driver uses a simple conversion queue of precharge, touch detection, X measurement, Y measurement, precharge and another touch detection. This driver uses the regmap from the parent to setup some touch specific settings in the core driver and setup a idle configuration with touch detection. Signed-off-by: Markus Pargmann Signed-off-by: Denis Carikli Acked-by: Dmitry Torokhov Signed-off-by: Markus Pargmann --- Notes: Changes in v7: - Moved clk_prepare_enable() and mx25_tcq_init() into mx25_tcq_open(). This was done to be able to use devm_request_threaded_irq(). - Cleanup of the probe function through above change - Removed mx25_tcq_remove(), not necessary now drivers/input/touchscreen/Kconfig | 6 + drivers/input/touchscreen/Makefile| 1 + drivers/input/touchscreen/fsl-imx25-tcq.c | 593 ++ 3 files changed, 600 insertions(+) create mode 100644 drivers/input/touchscreen/fsl-imx25-tcq.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 58917525126e..f1534a0cd23f 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -748,6 +748,12 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MX25 + tristate "Freescale i.MX25 touchscreen input driver" + depends on MFD_MX25_TSADC + help + Enable support for touchscreen connected to your i.MX25. + config TOUCHSCREEN_MC13783 tristate "Freescale MC13783 touchscreen input driver" depends on MFD_MC13XXX diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 0242fea2102a..bbb55a69c33c 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -41,6 +41,7 @@ obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o obj-$(CONFIG_TOUCHSCREEN_INTEL_MID)+= intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o obj-$(CONFIG_TOUCHSCREEN_MIGOR)+= migor_ts.o diff --git a/drivers/input/touchscreen/fsl-imx25-tcq.c b/drivers/input/touchscreen/fsl-imx25-tcq.c new file mode 100644 index ..638302ecfc28 --- /dev/null +++ b/drivers/input/touchscreen/fsl-imx25-tcq.c @@ -0,0 +1,593 @@ +/* + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + * + * Based on driver from 2011: + * Juergen Beisert, Pengutronix + * + * This is the driver for the imx25 TCQ (Touchscreen Conversion Queue) + * connected to the imx25 ADC. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char mx25_tcq_name[] = "mx25-tcq"; + +enum mx25_tcq_mode { + MX25_TS_4WIRE, +}; + +struct mx25_tcq_priv { + struct regmap *regs; + struct regmap *core_regs; + struct input_dev *idev; + enum mx25_tcq_mode mode; + unsigned int pen_threshold; + unsigned int sample_count; + unsigned int expected_samples; + unsigned int pen_debounce; + unsigned int settling_time; + struct clk *clk; + int irq; +}; + +static struct regmap_config mx25_tcq_regconfig = { + .fast_io = true, + .max_register = 0x5c, + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + +static struct of_device_id mx25_tcq_ids[] = { + { .compatible = "fsl,imx25-tcq", }, + { /* Sentinel */ } +}; + +#define TSC_4WIRE_PRE_INDEX 0 +#define TSC_4WIRE_X_INDEX 1 +#define TSC_4WIRE_Y_INDEX 2 +#define TSC_4WIRE_POST_INDEX 3 +#define TSC_4WIRE_LEAVE 4 + +#define MX25_TSC_DEF_THRESHOLD 80 +#define TSC_MAX_SAMPLES 16 + +#define MX25_TSC_REPEAT_WAIT 14 + +enum mx25_adc_configurations { + MX25_CFG_PRECHARGE = 0, + MX25_CFG_TOUCH_DETECT, + MX25_CFG_X_MEASUREMENT, + MX25_CFG_Y_MEASUREMENT, +}; + +#define MX25_PRECHARGE_VALUE (\ + MX25_ADCQ_CFG_YPLL_OFF | \ + MX25_ADCQ_CFG_XNUR_OFF | \ + MX25_ADCQ_CFG_XPUL_HIGH | \ + MX25_ADCQ_CFG_REFP_INT | \ + MX25_ADCQ_CFG_IN_XP | \ + MX25_ADCQ_CFG_REFN_NGND2 | \ + MX25_ADCQ_CFG
[PATCH v7 3/8] ARM: dt: Binding documentation for imx25 touchscreen controller
This is the touchscreen conversion queue binding documentation. It uses the shared imx25 ADC. Signed-off-by: Markus Pargmann --- Notes: Changes in v5: - Fix signed/unsigned comparison - Fix unused variable settling_time by putting it in the correct argument list - Use continous conversion queue with the repeat feature and a proper repeat-wait. Previously the touchscreen caused massive number of interrupts. .../bindings/input/touchscreen/fsl-mx25-tcq.txt| 29 ++ 1 file changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt diff --git a/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt new file mode 100644 index ..4214a99d197a --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt @@ -0,0 +1,29 @@ +Freescale mx25 TS conversion queue module + +mx25 touchscreen conversion queue module which controls the ADC unit of the +mx25 for attached touchscreens. + +Required properties: + - compatible: Should be "fsl,imx25-tcq". + - reg: Memory range of the device. + - interrupts: Should be the interrupt number associated with this module within + the tscadc unit (<0>). + - interrupt-parent: Should be a phandle to the tscadc unit. + - fsl,wires: Should be '<4>' or '<5>' + +Optional properties: + - fsl,pen-debounce: Pen debounce time. + - fsl,pen-threshold: Pen-down threshold for the touchscreen. + - fsl,settling-time: Settling time in nanoseconds. + +This device includes two conversion queues which can be added as subnodes. +The first queue is for the touchscreen, the second for general purpose ADC. + +Example: + tsc: tcq@50030400 { + compatible = "fsl,imx25-tcq"; + reg = <0x50030400 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <0>; + fsl,wires = <4>; + }; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 8/8] ARM: imx_v4_v5_defconfig: Add I.MX25 Touchscreen controller and ADC support.
From: Denis Carikli Signed-off-by: Denis Carikli Signed-off-by: Markus Pargmann --- arch/arm/configs/imx_v4_v5_defconfig | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig index e6b0007355f8..e1bda0136f6c 100644 --- a/arch/arm/configs/imx_v4_v5_defconfig +++ b/arch/arm/configs/imx_v4_v5_defconfig @@ -89,6 +89,7 @@ CONFIG_KEYBOARD_IMX=y # CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_ADS7846=m +CONFIG_TOUCHSCREEN_MX25=y CONFIG_TOUCHSCREEN_MC13783=y # CONFIG_LEGACY_PTYS is not set CONFIG_SERIAL_8250=m @@ -108,6 +109,7 @@ CONFIG_HWMON=m CONFIG_SENSORS_MC13783_ADC=m CONFIG_WATCHDOG=y CONFIG_IMX2_WDT=y +CONFIG_MFD_MX25_TSADC=y CONFIG_MFD_MC13XXX_SPI=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y @@ -173,6 +175,8 @@ CONFIG_DMADEVICES=y CONFIG_IMX_SDMA=y CONFIG_IMX_DMA=y # CONFIG_IOMMU_SUPPORT is not set +CONFIG_IIO=y +CONFIG_FSL_MX25_ADC=y CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y CONFIG_EXT4_FS=y -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 5/8] iio: adc: fsl,imx25-gcq driver
This is a conversion queue driver for the mx25 SoC. It uses the central ADC which is used by two seperate independent queues. This driver prepares different conversion configurations for each possible input. For a conversion it creates a conversionqueue of one item with the correct configuration for the chosen channel. It then executes the queue once and disables the conversion queue afterwards. The reference voltages are configurable through devicetree subnodes, depending on the connections of the ADC inputs. Signed-off-by: Markus Pargmann Signed-off-by: Denis Carikli Signed-off-by: Markus Pargmann --- Notes: Changes in v7: - Remove separate functions mx25_gcq_disable/enable_eoq() as they were used at only one position - Enforce an external reference regulator if one of the conversions uses it as reference. The devm_regulator_get() call was moved into mx25_gcq_setup_cfgs() to be able to acquire the reference regulator when necessary. - Store indio_dev as platform driver data instead of the private data. This was changed in probe() and remove(). Changes in v6: - Added defines for a complete list of references in the dt binding macros drivers/iio/adc/Kconfig | 7 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/fsl-imx25-gcq.c | 356 include/dt-bindings/iio/adc/fsl-imx25-gcq.h | 18 ++ 4 files changed, 382 insertions(+) create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 202daf889be2..947805d03d6c 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -154,6 +154,13 @@ config EXYNOS_ADC of SoCs for drivers such as the touchscreen and hwmon to use to share this resource. +config FSL_MX25_ADC + tristate "Freescale MX25 ADC driver" + depends on MFD_MX25_TSADC + help + Generic Conversion Queue driver used for general purpose ADC in the + MX25. This driver supports single measurements using the MX25 ADC. + config LP8788_ADC tristate "LP8788 ADC driver" depends on MFD_LP8788 diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 0315af640866..409583975ba0 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -17,6 +17,7 @@ obj-$(CONFIG_AT91_ADC) += at91_adc.o obj-$(CONFIG_AXP288_ADC) += axp288_adc.o obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o +obj-$(CONFIG_FSL_MX25_ADC) += fsl-imx25-gcq.o obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o obj-$(CONFIG_MAX1027) += max1027.o obj-$(CONFIG_MAX1363) += max1363.o diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c new file mode 100644 index ..18c21888aa4e --- /dev/null +++ b/drivers/iio/adc/fsl-imx25-gcq.c @@ -0,0 +1,356 @@ +/* + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + * + * This is the driver for the imx25 GCQ (Generic Conversion Queue) + * connected to the imx25 ADC. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MX25_GCQ_TIMEOUT (msecs_to_jiffies(2000)) + +enum mx25_gcq_cfgs { + MX25_CFG_XP = 0, + MX25_CFG_YP, + MX25_CFG_XN, + MX25_CFG_YN, + MX25_CFG_WIPER, + MX25_CFG_INAUX0, + MX25_CFG_INAUX1, + MX25_CFG_INAUX2, + MX25_NUM_CFGS, +}; + +struct mx25_gcq_priv { + struct regmap *regs; + struct completion completed; + unsigned int settling_time; + struct clk *clk; + int irq; + struct regulator *ext_vref; + u32 channel_vref_mv[MX25_NUM_CFGS]; +}; + +#define MX25_CQG_CHAN(chan, id) {\ + .type = IIO_VOLTAGE,\ + .indexed = 1,\ + .channel = chan,\ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),\ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),\ + .datasheet_name = id,\ +} + +static const struct iio_chan_spec mx25_gcq_channels[MX25_NUM_CFGS] = { + MX25_CQG_CHAN(0, "xp"), + MX25_CQG_CHAN(1, "yp"), + MX25_CQG_CHAN(2, "xn"), + MX25_CQG_CHAN(3, "yn"), + MX25_CQG_CHAN(4, "wiper"), + MX25_CQG_CHAN(5, "inaux0"), + MX25_CQG_CHAN(6, "inaux1"), + MX25_CQG_CHAN(7, "inaux2"), +}; + +static irqreturn_t mx25_gcq_irq(int irq, void *data) +{ + struct mx25_gcq_priv *priv = data; + u32 stats; + + regmap_read(priv->regs, MX25_ADCQ_SR, &stats); + + if (stats & MX25_ADCQ_SR_EOQ) { +
[PATCH v7 2/8] ARM: dt: Binding documentation for imx25 GCQ
The documentation describes the bindings for the imx25 GCQ unit which is essentially a generic conversion queue using the imx25 ADC. Signed-off-by: Markus Pargmann --- Notes: Changes in v6: - Changed bindings to use adc-refp and adc-refn. Also a bit of cleanup in the setup routine. Changes in v5: - Fixed locking - Removed module owner .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 54 ++ 1 file changed, 54 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt diff --git a/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt new file mode 100644 index ..9f7c08990034 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt @@ -0,0 +1,54 @@ +Freescale i.MX25 ADC GCQ device + +This is a generic conversion queue device that can convert any of the +analog inputs using the ADC unit of the i.MX25. + +Required properties: + - compatible: Should be "fsl,imx25-gcq". + - reg: Should be the register range of the module. + - interrupts: Should be the interrupt number of the module. + Typically this is <1>. + - interrupt-parent: phandle to the tsadc module of the i.MX25. + - #address-cells: Should be <1> (setting for the subnodes) + - #size-cells: Should be <0> (setting for the subnodes) + +Optional properties: + - vref-supply: The regulator supplying the ADC reference voltage. + Required when at least one subnode uses the external reference. + +Sub-nodes: +Optionally you can define subnodes which define the reference voltage +for the analog inputs. + +Required properties for subnodes: + - reg: Should be the number of the analog input. + 0: xp + 1: yp + 2: xn + 3: yn + 4: wiper + 5: inaux0 + 6: inaux1 + 7: inaux2 +Optional properties for subnodes: + - fsl,adc-refp: specifies the positive reference input as defined in + + - fsl,adc-refn: specifies the negative reference input as defined in + + +Example: + + adc: adc@50030800 { + compatible = "fsl,imx25-gcq"; + reg = <0x50030800 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <1>; + #address-cells = <1>; + #size-cells = <0>; + + inaux@5 { + reg = <5>; + fsl,adc-refp = ; + fsl,adc-refn = ; + }; + }; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 7/8] ARM: dts: imx25: Add TSC and ADC support
From: Denis Carikli Signed-off-by: Denis Carikli Signed-off-by: Markus Pargmann --- arch/arm/boot/dts/imx25.dtsi | 30 +++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi index e4d3aecc4ed2..4780926fa20e 100644 --- a/arch/arm/boot/dts/imx25.dtsi +++ b/arch/arm/boot/dts/imx25.dtsi @@ -265,13 +265,37 @@ status = "disabled"; }; - tsc: tsc@5003 { - compatible = "fsl,imx25-adc", "fsl,imx21-tsc"; - reg = <0x5003 0x4000>; + tscadc: tscadc@5003 { + compatible = "fsl,imx25-tsadc"; + reg = <0x5003 0xc>; interrupts = <46>; clocks = <&clks 119>; clock-names = "ipg"; + interrupt-controller; + #interrupt-cells = <1>; + #address-cells = <1>; + #size-cells = <1>; + ranges; status = "disabled"; + + adc: adc@50030800 { + compatible = "fsl,imx25-gcq"; + reg = <0x50030800 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + tsc: tcq@50030400 { + compatible = "fsl,imx25-tcq"; + reg = <0x50030400 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <0>; + fsl,wires = <4>; + status = "disabled"; + }; }; ssi1: ssi@50034000 { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 0/8] imx25 adc and touchscreen driver
Hi, This series adds a driver for the Freescale i.MX25 SoC internal ADC unit which is used for touchscreen and ADC. The driver consists of three parts, the MFD driver which handles interrupts and some central configuration registers, the ADC driver and the touchscreen driver. v7 has some modifications in the probe functions to use devres irq requests. irq checks were fixed to check for irqs <= 0. The header was cleaned up to have a more uniform presentation of the bit fields. Detailed changelogs are attached to the according mails. Best Regards, Markus Denis Carikli (2): ARM: dts: imx25: Add TSC and ADC support ARM: imx_v4_v5_defconfig: Add I.MX25 Touchscreen controller and ADC support. Markus Pargmann (6): ARM: dt: Binding documentation for imx25 ADC/TSC ARM: dt: Binding documentation for imx25 GCQ ARM: dt: Binding documentation for imx25 touchscreen controller mfd: fsl imx25 Touchscreen ADC driver iio: adc: fsl,imx25-gcq driver input: touchscreen: imx25 tcq driver .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 54 ++ .../bindings/input/touchscreen/fsl-mx25-tcq.txt| 29 + .../devicetree/bindings/mfd/fsl-imx25-tsadc.txt| 46 ++ arch/arm/boot/dts/imx25.dtsi | 30 +- arch/arm/configs/imx_v4_v5_defconfig | 4 + drivers/iio/adc/Kconfig| 7 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/fsl-imx25-gcq.c| 356 + drivers/input/touchscreen/Kconfig | 6 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/fsl-imx25-tcq.c | 593 + drivers/mfd/Kconfig| 10 + drivers/mfd/Makefile | 2 + drivers/mfd/fsl-imx25-tsadc.c | 164 ++ include/dt-bindings/iio/adc/fsl-imx25-gcq.h| 18 + include/linux/mfd/imx25-tsadc.h| 141 + 16 files changed, 1459 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt create mode 100644 Documentation/devicetree/bindings/input/touchscreen/fsl-mx25-tcq.txt create mode 100644 Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c create mode 100644 drivers/input/touchscreen/fsl-imx25-tcq.c create mode 100644 drivers/mfd/fsl-imx25-tsadc.c create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h create mode 100644 include/linux/mfd/imx25-tsadc.h -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 4/8] mfd: fsl imx25 Touchscreen ADC driver
This is the core driver for imx25 touchscreen/adc driver. The module has one shared ADC and two different conversion queues which use the ADC. The two queues are identical. Both can be used for general purpose ADC but one is meant to be used for touchscreens. This driver is the core which manages the central components and registers of the TSC/ADC unit. It manages the IRQs and forwards them to the correct components. Signed-off-by: Markus Pargmann Signed-off-by: Denis Carikli Acked-by: Jonathan Cameron --- Notes: Changes in v7: - Cleanup bit defines in header files to be more readable - Fix irq check to return with an error for irq <= 0 - Add COMPILE_TEST in Kconfig file Changes in v5: - Remove ifdef CONFIG_OF as this driver is only for DT usage - Remove module owner - Add Kconfig dependencies ARCH_MX25 and OF @Jonathan Cameron: I left your acked-by on the patch as these were small changes. If it should be removed, please say so. Thanks drivers/mfd/Kconfig | 10 +++ drivers/mfd/Makefile| 2 + drivers/mfd/fsl-imx25-tsadc.c | 164 include/linux/mfd/imx25-tsadc.h | 141 ++ 4 files changed, 317 insertions(+) create mode 100644 drivers/mfd/fsl-imx25-tsadc.c create mode 100644 include/linux/mfd/imx25-tsadc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 38356e39adba..c0036aef61d7 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -244,6 +244,16 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MX25_TSADC + tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" + select REGMAP_MMIO + depends on SOC_IMX25 || COMPILE_TEST + depends on OF + help + Enable support for the integrated Touchscreen and ADC unit of the + i.MX25 processors. They consist of a conversion queue for general + purpose ADC and a queue for Touchscreens. + config MFD_HI6421_PMIC tristate "HiSilicon Hi6421 PMU/Codec IC" depends on OF diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 19f3d744e3bd..acfe639e147c 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -78,6 +78,8 @@ obj-$(CONFIG_TWL4030_POWER)+= twl4030-power.o obj-$(CONFIG_MFD_TWL4030_AUDIO)+= twl4030-audio.o obj-$(CONFIG_TWL6040_CORE) += twl6040.o +obj-$(CONFIG_MFD_MX25_TSADC) += fsl-imx25-tsadc.o + obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o obj-$(CONFIG_MFD_MC13XXX_I2C) += mc13xxx-i2c.o diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c new file mode 100644 index ..c4a3e15001ea --- /dev/null +++ b/drivers/mfd/fsl-imx25-tsadc.c @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2014-2015 Pengutronix, Markus Pargmann + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static struct regmap_config mx25_tsadc_regmap_config = { + .fast_io = true, + .max_register = 8, + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + +static void mx25_tsadc_irq_handler(u32 irq, struct irq_desc *desc) +{ + struct mx25_tsadc *tsadc = irq_desc_get_handler_data(desc); + struct irq_chip *chip = irq_get_chip(irq); + u32 status; + + chained_irq_enter(chip, desc); + + regmap_read(tsadc->regs, MX25_TSC_TGSR, &status); + + if (status & MX25_TGSR_GCQ_INT) + generic_handle_irq(irq_find_mapping(tsadc->domain, 1)); + + if (status & MX25_TGSR_TCQ_INT) + generic_handle_irq(irq_find_mapping(tsadc->domain, 0)); + + chained_irq_exit(chip, desc); +} + +static int mx25_tsadc_domain_map(struct irq_domain *d, unsigned int irq, +irq_hw_number_t hwirq) +{ + struct mx25_tsadc *tsadc = d->host_data; + + irq_set_chip_data(irq, tsadc); + irq_set_chip_and_handler(irq, &dummy_irq_chip, +handle_level_irq); + set_irq_flags(irq, IRQF_VALID); + + return 0; +} + +static struct irq_domain_ops mx25_tsadc_domain_ops = { + .map = mx25_tsadc_domain_map, + .xlate = irq_domain_xlate_onecell, +}; + +static int mx25_tsadc_setup_irq(struct platform_device *pdev, + struct mx25_tsadc *tsadc) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + int irq; + + irq = platform_get_irq(pdev, 0); + if (irq <= 0) { +
[PATCH v7 1/8] ARM: dt: Binding documentation for imx25 ADC/TSC
This documentation describes the devicetree bindings for the ADC/Touchscreen unit of the i.MX25 SoC. Signed-off-by: Markus Pargmann --- Notes: Changes in v6: - Removed adc-ref property and replaced it with refp and refn for positive and negative references. The properties are optional now as the default behaviour is a positive internal reference voltage and ADC GND as negative reference. .../devicetree/bindings/mfd/fsl-imx25-tsadc.txt| 46 ++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt diff --git a/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt b/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt new file mode 100644 index ..a857af0eb68c --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt @@ -0,0 +1,46 @@ +Freescale mx25 ADC/TSC multifunction device + +This device combines two general purpose conversion queues one used for general +ADC and the other used for touchscreens. + +Required properties: + - compatible: Should be "fsl,imx25-tsadc". + - reg: Memory range of the device. + - interrupts: Interrupt for this device as described in + interrupts/interrupts.txt + - clocks: An 'ipg' clock defined as described in clocks/clock.txt + - interrupt-controller: This device is an interrupt controller. It controls + the interrupts of both conversion queues. + - #interrupt-cells: Should be '<1>'. + - #address-cells: Should be '<1>'. + - #size-cells: Should be '<1>'. + - ranges + +This device includes two conversion queues which can be added as subnodes. +The first queue is for the touchscreen, the second for general purpose ADC. + +Example: + tscadc: tscadc@5003 { + compatible = "fsl,imx25-tsadc"; + reg = <0x5003 0xc>; + interrupts = <46>; + clocks = <&clks 119>; + clock-names = "ipg"; + interrupt-controller; + #interrupt-cells = <1>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + tsc: tcq@50030400 { + compatible = "fsl,imx25-tcq"; + reg = <0x50030400 0x60>; + ... + }; + + adc: gcq@50030800 { + compatible = "fsl,imx25-gcq"; + reg = <0x50030800 0x60>; + ... + }; + }; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 1/6] mfd: fsl imx25 Touchscreen ADC driver
Hi, On Tue, Feb 17, 2015 at 08:14:38PM +0100, Uwe Kleine-König wrote: > Hello Markus, > > On Sat, Jan 24, 2015 at 03:01:38PM +0100, Markus Pargmann wrote: > > +config MFD_MX25_TSADC > > + tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" > > + select REGMAP_MMIO > > + depends on SOC_IMX25 > Can you make that: > > depends on SOC_IMX25 || COMPILE_TEST > > ? Yes, changed. > > > + * The code contained herein is licensed under the GNU General Public > > + * License. You may obtain a copy of the GNU General Public License > > + * Version 2 or later at the following locations: > Which version of the GPL is your code licensed under? GPLv2 as described by MODULE_LICENSE. Will change the header accordingly. > > > +static int mx25_tsadc_setup_irq(struct platform_device *pdev, > > + struct mx25_tsadc *tsadc) > > [...] > > + irq_set_chained_handler(irq, mx25_tsadc_irq_handler); > > + irq_set_handler_data(irq, tsadc); > Do you need to reverse the order of these two calls to prevent the > handler being called while handler_data is still unset? Yes that's probably better although the subdevices which may cause interrupts here are not populated at this point. Thanks, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v5 1/6] mfd: fsl imx25 Touchscreen ADC driver
On Wed, Feb 18, 2015 at 12:08:44PM +, Lee Jones wrote: > On Wed, 18 Feb 2015, Fabio Estevam wrote: > > > On Wed, Feb 18, 2015 at 6:01 AM, Lee Jones wrote: > > > On Tue, 17 Feb 2015, Fabio Estevam wrote: > > > > > >> On Mon, Feb 16, 2015 at 11:38 AM, Lee Jones wrote: > > >> > > >> >> +static int mx25_tsadc_setup_irq(struct platform_device *pdev, > > >> >> + struct mx25_tsadc *tsadc) > > >> >> +{ > > >> >> + struct device *dev = &pdev->dev; > > >> >> + struct device_node *np = dev->of_node; > > >> >> + int irq; > > >> >> + > > >> >> + irq = platform_get_irq(pdev, 0); > > >> >> + if (irq < 0) { > > >> > > > >> > What if 0 is returned? > > >> > > >> Then imx25.dtsi would be passing irq=0 for the ADC, which would be > > >> totally wrong. > > > > > > Exactly, so it should be <=. > > > > imx25.dtsi passes interrupts = <46>; for the touch screen controller, > > so the irq number will never be zero. > > It doesn't matter what happens to be passed at the moment. The > correct thing to do is enforce correct/full error checking. Yes <0 is > an error, but so is =0, so encompass it in the checks. I now changed all irq < 0 checks to irq <= 0 under the assumption that irq 0 is always an error. Thanks, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v6 5/8] iio: adc: fsl,imx25-gcq driver
Hi, On Wed, Feb 04, 2015 at 04:48:35PM +, Jonathan Cameron wrote: > On 29/01/15 14:09, Markus Pargmann wrote: > > This is a conversion queue driver for the mx25 SoC. It uses the central > > ADC which is used by two seperate independent queues. This driver > > prepares different conversion configurations for each possible input. > > For a conversion it creates a conversionqueue of one item with the > > correct configuration for the chosen channel. It then executes the queue > > once and disables the conversion queue afterwards. > > > > The reference voltages are configurable through devicetree subnodes, > > depending on the connections of the ADC inputs. > > > > Signed-off-by: Markus Pargmann > > Signed-off-by: Denis Carikli > > Signed-off-by: Markus Pargmann > Some really small bits and bobs inline... > Only non trivial one is that I'd prefer that the need for a regulator > in the event of an external reference being specified was explicitly enforced. > > --- > > drivers/iio/adc/Kconfig | 7 + > > drivers/iio/adc/Makefile| 1 + > > drivers/iio/adc/fsl-imx25-gcq.c | 361 > > > > include/dt-bindings/iio/adc/fsl-imx25-gcq.h | 18 ++ > > 4 files changed, 387 insertions(+) > > create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c > > create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h > > > > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > > index 0f79e4725763..fccbb4bf44cc 100644 > > --- a/drivers/iio/adc/Kconfig > > +++ b/drivers/iio/adc/Kconfig > > @@ -143,6 +143,13 @@ config EXYNOS_ADC > > of SoCs for drivers such as the touchscreen and hwmon to use to share > > this resource. > > > > +config FSL_MX25_ADC > > + tristate "Freescale MX25 ADC driver" > > + depends on MFD_MX25_TSADC > > + help > > + Generic Conversion Queue driver used for general purpose ADC in the > > + MX25. This driver supports single measurements using the MX25 ADC. > > + > > config LP8788_ADC > > tristate "LP8788 ADC driver" > > depends on MFD_LP8788 > > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile > > index 701fdb7c96aa..acab8d956371 100644 > > --- a/drivers/iio/adc/Makefile > > +++ b/drivers/iio/adc/Makefile > > @@ -16,6 +16,7 @@ obj-$(CONFIG_AD799X) += ad799x.o > > obj-$(CONFIG_AT91_ADC) += at91_adc.o > > obj-$(CONFIG_AXP288_ADC) += axp288_adc.o > > obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o > > +obj-$(CONFIG_FSL_MX25_ADC) += fsl-imx25-gcq.o > > obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o > > obj-$(CONFIG_MAX1027) += max1027.o > > obj-$(CONFIG_MAX1363) += max1363.o > > diff --git a/drivers/iio/adc/fsl-imx25-gcq.c > > b/drivers/iio/adc/fsl-imx25-gcq.c > > new file mode 100644 > > index ..398e40c0e4fd > > --- /dev/null > > +++ b/drivers/iio/adc/fsl-imx25-gcq.c > > @@ -0,0 +1,361 @@ > > +/* > > + * Copyright 2014 Markus Pargmann, Pengutronix > > + * > > + * The code contained herein is licensed under the GNU General Public > > + * License. You may obtain a copy of the GNU General Public License > > + * Version 2 or later at the following locations: > > + * > > + * http://www.opensource.org/licenses/gpl-license.html > > + * http://www.gnu.org/copyleft/gpl.html > > + * > > + * This is the driver for the imx25 GCQ (Generic Conversion Queue) > > + * connected to the imx25 ADC. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#define MX25_GCQ_TIMEOUT (msecs_to_jiffies(2000)) > > + > > +enum mx25_gcq_cfgs { > > + MX25_CFG_XP = 0, > > + MX25_CFG_YP, > > + MX25_CFG_XN, > > + MX25_CFG_YN, > > + MX25_CFG_WIPER, > > + MX25_CFG_INAUX0, > > + MX25_CFG_INAUX1, > > + MX25_CFG_INAUX2, > > + MX25_NUM_CFGS, > > +}; > > + > > +struct mx25_gcq_priv { > > + struct regmap *regs; > > + struct completion completed; > > + unsigned int settling_time; > > + struct clk *clk; > > + int irq; > > + struct regulator *ext_vref; > > + u32 channel_vref_mv[MX25_NUM_CFGS]; > > +}; > > + > > +#define MX25_CQG_CHAN(chan, id) {\ > > + .type = IIO_VOLTAGE,\ > > + .indexed = 1,\ > > + .channel = chan,\ > > +
Re: [PATCH v6 6/8] input: touchscreen: imx25 tcq driver
Hi, On Mon, Feb 02, 2015 at 09:51:34AM -0800, Dmitry Torokhov wrote: > On Mon, Feb 02, 2015 at 05:05:39PM +0100, Markus Pargmann wrote: > > Hi, > > > > On Fri, Jan 30, 2015 at 10:57:21AM -0800, Dmitry Torokhov wrote: > > > On Thu, Jan 29, 2015 at 07:56:40PM +0530, Varka Bhadram wrote: > > > > Hi, > > > > > > > > On Thursday 29 January 2015 07:39 PM, Markus Pargmann wrote: > > > > >This is a driver for the imx25 ADC/TSC module. It controls the > > > > >touchscreen conversion queue and creates a touchscreen input device. > > > > >The driver currently only supports 4 wire touchscreens. The driver uses > > > > >a simple conversion queue of precharge, touch detection, X measurement, > > > > >Y measurement, precharge and another touch detection. > > > > > > > > > >This driver uses the regmap from the parent to setup some touch > > > > >specific > > > > >settings in the core driver and setup a idle configuration with touch > > > > >detection. > > > > > > > > > >Signed-off-by: Markus Pargmann > > > > >Signed-off-by: Denis Carikli > > > > >Acked-by: Dmitry Torokhov > > > > >Signed-off-by: Markus Pargmann > > > > >--- > > > > > drivers/input/touchscreen/Kconfig | 6 + > > > > > drivers/input/touchscreen/Makefile| 1 + > > > > > drivers/input/touchscreen/fsl-imx25-tcq.c | 587 > > > > > ++ > > > > > 3 files changed, 594 insertions(+) > > > > > create mode 100644 drivers/input/touchscreen/fsl-imx25-tcq.c > > > > > > > > > (...) > > > > > > > > >+ ret = request_threaded_irq(priv->irq, mx25_tcq_irq, > > > > >mx25_tcq_irq_thread, > > > > >+ IRQF_ONESHOT, pdev->name, priv); > > > > > > > > We can use devres API for request_thread_irq()... > > > > > > > > >+ if (ret) { > > > > >+ dev_err(dev, "Failed requesting IRQ\n"); > > > > >+ goto err_clk_unprepare; > > > > >+ } > > > > >+ > > > > >+ ret = mx25_tcq_init(priv); > > > > >+ if (ret) { > > > > >+ dev_err(dev, "Failed to init tcq\n"); > > > > >+ goto error_free_irq; > > > > >+ } > > > > >+ > > > > >+ platform_set_drvdata(pdev, priv); > > > > >+ > > > > >+ return 0; > > > > >+ > > > > >+error_free_irq: > > > > >+ free_irq(priv->irq, priv); > > > > > > > > This is not required if we use devres API > > > > > > Yes it does - you do not really want to stop clocks in the middle of > > > servicing interrupt. > > > > Thanks, I missed the clocks. I will not use devm here then. > > Actually, you still can if you move clock enabling/disabling and > mx25_tcq_init() into input_dev->open() and ->close() callbacks. Close > will be called during input device un-registration which happens (given > your current sequence) after freeing irq by devm. Thank you. I now moved that code into open() and close(), replaced the irq_request() with devm_irq_request. mx25_tcq_remove() is gone now. > > By the way, I used my old @vmware address by accident. Can you please > replace the original acked by with: > > Acked-by: Dmitry Torokhov Replaced it. Thanks, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v6 6/8] input: touchscreen: imx25 tcq driver
Hi, On Fri, Jan 30, 2015 at 10:57:21AM -0800, Dmitry Torokhov wrote: > On Thu, Jan 29, 2015 at 07:56:40PM +0530, Varka Bhadram wrote: > > Hi, > > > > On Thursday 29 January 2015 07:39 PM, Markus Pargmann wrote: > > >This is a driver for the imx25 ADC/TSC module. It controls the > > >touchscreen conversion queue and creates a touchscreen input device. > > >The driver currently only supports 4 wire touchscreens. The driver uses > > >a simple conversion queue of precharge, touch detection, X measurement, > > >Y measurement, precharge and another touch detection. > > > > > >This driver uses the regmap from the parent to setup some touch specific > > >settings in the core driver and setup a idle configuration with touch > > >detection. > > > > > >Signed-off-by: Markus Pargmann > > >Signed-off-by: Denis Carikli > > >Acked-by: Dmitry Torokhov > > >Signed-off-by: Markus Pargmann > > >--- > > > drivers/input/touchscreen/Kconfig | 6 + > > > drivers/input/touchscreen/Makefile| 1 + > > > drivers/input/touchscreen/fsl-imx25-tcq.c | 587 > > > ++ > > > 3 files changed, 594 insertions(+) > > > create mode 100644 drivers/input/touchscreen/fsl-imx25-tcq.c > > > > > (...) > > > > >+ ret = request_threaded_irq(priv->irq, mx25_tcq_irq, mx25_tcq_irq_thread, > > >+ IRQF_ONESHOT, pdev->name, priv); > > > > We can use devres API for request_thread_irq()... > > > > >+ if (ret) { > > >+ dev_err(dev, "Failed requesting IRQ\n"); > > >+ goto err_clk_unprepare; > > >+ } > > >+ > > >+ ret = mx25_tcq_init(priv); > > >+ if (ret) { > > >+ dev_err(dev, "Failed to init tcq\n"); > > >+ goto error_free_irq; > > >+ } > > >+ > > >+ platform_set_drvdata(pdev, priv); > > >+ > > >+ return 0; > > >+ > > >+error_free_irq: > > >+ free_irq(priv->irq, priv); > > > > This is not required if we use devres API > > Yes it does - you do not really want to stop clocks in the middle of > servicing interrupt. Thanks, I missed the clocks. I will not use devm here then. For the gcq (ADC) driver, it would still works to use devm_request_irq as the interrupt can only trigger when the user requested an ADC conversion. So as soon as the device is unregistered from the IIO subsystem, there should not be any interrupts. However I would like to keep free_irq in the gcq driver as well. Unexpected interrupts wouldn't be a problem and especially if the driver is extended for continous conversion in the future, this may be better. Best regards, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v6 5/8] iio: adc: fsl,imx25-gcq driver
Hi, On Thu, Jan 29, 2015 at 08:00:49PM +0530, Varka Bhadram wrote: > Hi, > > On Thursday 29 January 2015 07:39 PM, Markus Pargmann wrote: > >This is a conversion queue driver for the mx25 SoC. It uses the central > >ADC which is used by two seperate independent queues. This driver > >prepares different conversion configurations for each possible input. > >For a conversion it creates a conversionqueue of one item with the > >correct configuration for the chosen channel. It then executes the queue > >once and disables the conversion queue afterwards. > > > >The reference voltages are configurable through devicetree subnodes, > >depending on the connections of the ADC inputs. > > > >Signed-off-by: Markus Pargmann > >Signed-off-by: Denis Carikli > >Signed-off-by: Markus Pargmann > >--- > > drivers/iio/adc/Kconfig | 7 + > > drivers/iio/adc/Makefile| 1 + > > drivers/iio/adc/fsl-imx25-gcq.c | 361 > > > > include/dt-bindings/iio/adc/fsl-imx25-gcq.h | 18 ++ > > 4 files changed, 387 insertions(+) > > create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c > > create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h > > > (...) > > >+static int mx25_gcq_probe(struct platform_device *pdev) > >+{ > >+struct iio_dev *indio_dev; > >+struct mx25_gcq_priv *priv; > >+struct mx25_tsadc *tsadc = dev_get_drvdata(pdev->dev.parent); > >+struct device *dev = &pdev->dev; > >+struct resource *res; > >+void __iomem *mem; > >+int ret; > >+ > >+indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv)); > >+if (!indio_dev) > >+return -ENOMEM; > >+ > >+priv = iio_priv(indio_dev); > >+ > >+res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > >+mem = devm_ioremap_resource(dev, res); > >+if (!mem) > >+return -ENOMEM; > >+ > >+priv->regs = devm_regmap_init_mmio(dev, mem, &mx25_gcq_regconfig); > >+if (IS_ERR(priv->regs)) { > >+dev_err(dev, "Failed to initialize regmap\n"); > >+return PTR_ERR(priv->regs); > >+} > >+ > >+init_completion(&priv->completed); > >+ > >+/* Optional external regulator */ > >+priv->ext_vref = devm_regulator_get(&pdev->dev, "vref"); > >+if (!IS_ERR_OR_NULL(priv->ext_vref)) { > >+ret = regulator_enable(priv->ext_vref); > >+if (ret) > >+return ret; > >+} > >+ > >+ret = mx25_gcq_setup_cfgs(pdev, priv); > >+if (ret) > >+return ret; > >+ > >+priv->clk = tsadc->clk; > >+ret = clk_prepare_enable(priv->clk); > >+if (ret) { > >+dev_err(dev, "Failed to enable clock\n"); > >+return ret; > >+} > >+ > >+priv->irq = platform_get_irq(pdev, 0); > >+if (priv->irq <= 0) { > >+dev_err(dev, "Failed to get IRQ\n"); > >+ret = priv->irq; > >+goto err_clk_unprepare; > >+} > >+ > >+ret = request_irq(priv->irq, mx25_gcq_irq, 0, pdev->name, priv); > > Use of devm_* API It seems to be save to use it here, as the interrupt handler only uses memory allocated for this driver and not the iio framework. So I will probably change it to devm_*. Thanks, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v5 3/6] iio: adc: fsl,imx25-gcq driver
Hi Fabio, On Thu, Jan 29, 2015 at 12:51:36PM -0200, Fabio Estevam wrote: > Hi Markus, > > On Sat, Jan 24, 2015 at 12:01 PM, Markus Pargmann wrote: > > > + priv->irq = platform_get_irq(pdev, 0); > > + if (priv->irq <= 0) { > > This should be: if (priv->irq < 0) { Thanks, fixed in both drivers. Best regards, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature