diff mbox series

IIO: stm32: Remove quadrature related functions from trigger driver

Message ID 20190507091224.17781-1-benjamin.gaignard@st.com (mailing list archive)
State Mainlined
Commit b299d00420e2cc4289b1909943bb1e68634ef0bb
Headers show
Series IIO: stm32: Remove quadrature related functions from trigger driver | expand

Commit Message

Benjamin GAIGNARD May 7, 2019, 9:12 a.m. UTC
Quadrature feature is now hosted on it own framework.
Remove quadrature related code from stm32-trigger driver to avoid
code duplication and simplify the ABI.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
---
 .../ABI/testing/sysfs-bus-iio-timer-stm32          | 23 ------
 drivers/iio/trigger/stm32-timer-trigger.c          | 84 ----------------------
 2 files changed, 107 deletions(-)

Comments

William Breathitt Gray May 7, 2019, 10:18 a.m. UTC | #1
On Tue, May 07, 2019 at 11:12:24AM +0200, Benjamin Gaignard wrote:
> Quadrature feature is now hosted on it own framework.
> Remove quadrature related code from stm32-trigger driver to avoid
> code duplication and simplify the ABI.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>

Although this functionality is now provided by the Counter subsystem, we
should keep the IIO Counter interface for this driver intact since
existing user applications may depend on it; this is the same reason why
the IIO Counter code in the 104-QUAD-8 device driver was not removed
despite moving to the Counter subsystem.

Once user applications have had enough time to migrate to the Generic
Counter interface, we can consider removing the deprecated IIO Counter
interface.

William Breathitt Gray
Benjamin Gaignard May 7, 2019, 12:37 p.m. UTC | #2
Le mar. 7 mai 2019 à 12:19, William Breathitt Gray
<vilhelm.gray@gmail.com> a écrit :
>
> On Tue, May 07, 2019 at 11:12:24AM +0200, Benjamin Gaignard wrote:
> > Quadrature feature is now hosted on it own framework.
> > Remove quadrature related code from stm32-trigger driver to avoid
> > code duplication and simplify the ABI.
> >
> > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
>
> Although this functionality is now provided by the Counter subsystem, we
> should keep the IIO Counter interface for this driver intact since
> existing user applications may depend on it; this is the same reason why
> the IIO Counter code in the 104-QUAD-8 device driver was not removed
> despite moving to the Counter subsystem.
>
> Once user applications have had enough time to migrate to the Generic
> Counter interface, we can consider removing the deprecated IIO Counter
> interface.

Hi William,

This SoC is not yet in production so their is no legacy on the old interface
and I would like to avoid to create one.

Benjamin

>
> William Breathitt Gray
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
William Breathitt Gray May 8, 2019, 7:34 a.m. UTC | #3
On Tue, May 07, 2019 at 02:37:07PM +0200, Benjamin Gaignard wrote:
> Le mar. 7 mai 2019 à 12:19, William Breathitt Gray
> <vilhelm.gray@gmail.com> a écrit :
> >
> > On Tue, May 07, 2019 at 11:12:24AM +0200, Benjamin Gaignard wrote:
> > > Quadrature feature is now hosted on it own framework.
> > > Remove quadrature related code from stm32-trigger driver to avoid
> > > code duplication and simplify the ABI.
> > >
> > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> >
> > Although this functionality is now provided by the Counter subsystem, we
> > should keep the IIO Counter interface for this driver intact since
> > existing user applications may depend on it; this is the same reason why
> > the IIO Counter code in the 104-QUAD-8 device driver was not removed
> > despite moving to the Counter subsystem.
> >
> > Once user applications have had enough time to migrate to the Generic
> > Counter interface, we can consider removing the deprecated IIO Counter
> > interface.
> 
> Hi William,
> 
> This SoC is not yet in production so their is no legacy on the old interface
> and I would like to avoid to create one.
> 
> Benjamin

Ah, I see what you mean, this driver is for future devices. Do the
earlier STM32 H7 series devices have a quadrature feature as well, or is
this functionality only available with the new devices?

William Breathitt Gray

> 
> >
> > William Breathitt Gray
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Benjamin GAIGNARD May 9, 2019, 7:40 a.m. UTC | #4
On 5/8/19 9:34 AM, William Breathitt Gray wrote:
> On Tue, May 07, 2019 at 02:37:07PM +0200, Benjamin Gaignard wrote:
>> Le mar. 7 mai 2019 à 12:19, William Breathitt Gray
>> <vilhelm.gray@gmail.com> a écrit :
>>> On Tue, May 07, 2019 at 11:12:24AM +0200, Benjamin Gaignard wrote:
>>>> Quadrature feature is now hosted on it own framework.
>>>> Remove quadrature related code from stm32-trigger driver to avoid
>>>> code duplication and simplify the ABI.
>>>>
>>>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
>>> Although this functionality is now provided by the Counter subsystem, we
>>> should keep the IIO Counter interface for this driver intact since
>>> existing user applications may depend on it; this is the same reason why
>>> the IIO Counter code in the 104-QUAD-8 device driver was not removed
>>> despite moving to the Counter subsystem.
>>>
>>> Once user applications have had enough time to migrate to the Generic
>>> Counter interface, we can consider removing the deprecated IIO Counter
>>> interface.
>> Hi William,
>>
>> This SoC is not yet in production so their is no legacy on the old interface
>> and I would like to avoid to create one.
>>
>> Benjamin
> Ah, I see what you mean, this driver is for future devices. Do the
> earlier STM32 H7 series devices have a quadrature feature as well, or is
> this functionality only available with the new devices?

It is available on STM32 H7 but I have never see any Linux product on 
those SOC

and even less using quadratic encoder ;-)

Benjamin

>
> William Breathitt Gray
>
>>> William Breathitt Gray
>>>
>>> _______________________________________________
>>> linux-arm-kernel mailing list
>>> linux-arm-kernel@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
William Breathitt Gray July 11, 2019, 11:50 a.m. UTC | #5
On Tue, May 07, 2019 at 11:12:24AM +0200, Benjamin Gaignard wrote:
> Quadrature feature is now hosted on it own framework.
> Remove quadrature related code from stm32-trigger driver to avoid
> code duplication and simplify the ABI.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>

What is the status of this patch? Are there any objections currently for
its inclusion?

William Breathitt Gray
Benjamin Gaignard July 11, 2019, 12:12 p.m. UTC | #6
Le jeu. 11 juil. 2019 à 13:51, William Breathitt Gray
<vilhelm.gray@gmail.com> a écrit :
>
> On Tue, May 07, 2019 at 11:12:24AM +0200, Benjamin Gaignard wrote:
> > Quadrature feature is now hosted on it own framework.
> > Remove quadrature related code from stm32-trigger driver to avoid
> > code duplication and simplify the ABI.
> >
> > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
>
> What is the status of this patch? Are there any objections currently for
> its inclusion?

You were the only one asking for more details about it :-)
If you agree I think that Jonathan can merge it.

Benjamin
>
> William Breathitt Gray
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
William Breathitt Gray July 11, 2019, 12:16 p.m. UTC | #7
On Thu, Jul 11, 2019 at 02:12:27PM +0200, Benjamin Gaignard wrote:
> Le jeu. 11 juil. 2019 à 13:51, William Breathitt Gray
> <vilhelm.gray@gmail.com> a écrit :
> >
> > On Tue, May 07, 2019 at 11:12:24AM +0200, Benjamin Gaignard wrote:
> > > Quadrature feature is now hosted on it own framework.
> > > Remove quadrature related code from stm32-trigger driver to avoid
> > > code duplication and simplify the ABI.
> > >
> > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> >
> > What is the status of this patch? Are there any objections currently for
> > its inclusion?
> 
> You were the only one asking for more details about it :-)
> If you agree I think that Jonathan can merge it.
> 
> Benjamin
> >
> > William Breathitt Gray
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Yes, Jonathan please merge this if you have no objections, I hadn't
realized I was delaying it.

Thank you,

William Breathitt Gray
Jonathan Cameron July 14, 2019, 10:09 a.m. UTC | #8
On Thu, 11 Jul 2019 21:16:20 +0900
William Breathitt Gray <vilhelm.gray@gmail.com> wrote:

> On Thu, Jul 11, 2019 at 02:12:27PM +0200, Benjamin Gaignard wrote:
> > Le jeu. 11 juil. 2019 à 13:51, William Breathitt Gray
> > <vilhelm.gray@gmail.com> a écrit :  
> > >
> > > On Tue, May 07, 2019 at 11:12:24AM +0200, Benjamin Gaignard wrote:  
> > > > Quadrature feature is now hosted on it own framework.
> > > > Remove quadrature related code from stm32-trigger driver to avoid
> > > > code duplication and simplify the ABI.
> > > >
> > > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>  
> > >
> > > What is the status of this patch? Are there any objections currently for
> > > its inclusion?  
> > 
> > You were the only one asking for more details about it :-)
> > If you agree I think that Jonathan can merge it.
> > 
> > Benjamin  
> > >
> > > William Breathitt Gray
> > >
> > > _______________________________________________
> > > linux-arm-kernel mailing list
> > > linux-arm-kernel@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel  
> 
> Yes, Jonathan please merge this if you have no objections, I hadn't
> realized I was delaying it.
> 
> Thank you,
> 
> William Breathitt Gray
One last thing...  This seems to be a userspace ABI change.  What
are our potential issues with users of this ABI?

It's not that costly to keep the code, though dropping the docs or
putting a depreciated note in them is probably a good idea.  Hence
I'm not totally convinced the risk of a regression is worth it.

If we think it's the sort of change no one will notice, then
fair enough we'll give it a go and cross our fingers.

Thanks,

Jonathan
Benjamin GAIGNARD July 14, 2019, 3:32 p.m. UTC | #9
On 7/14/19 12:09 PM, Jonathan Cameron wrote:
> On Thu, 11 Jul 2019 21:16:20 +0900
> William Breathitt Gray <vilhelm.gray@gmail.com> wrote:
>
>> On Thu, Jul 11, 2019 at 02:12:27PM +0200, Benjamin Gaignard wrote:
>>> Le jeu. 11 juil. 2019 à 13:51, William Breathitt Gray
>>> <vilhelm.gray@gmail.com> a écrit :
>>>> On Tue, May 07, 2019 at 11:12:24AM +0200, Benjamin Gaignard wrote:
>>>>> Quadrature feature is now hosted on it own framework.
>>>>> Remove quadrature related code from stm32-trigger driver to avoid
>>>>> code duplication and simplify the ABI.
>>>>>
>>>>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
>>>> What is the status of this patch? Are there any objections currently for
>>>> its inclusion?
>>> You were the only one asking for more details about it :-)
>>> If you agree I think that Jonathan can merge it.
>>>
>>> Benjamin
>>>> William Breathitt Gray
>>>>
>>>> _______________________________________________
>>>> linux-arm-kernel mailing list
>>>> linux-arm-kernel@lists.infradead.org
>>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>> Yes, Jonathan please merge this if you have no objections, I hadn't
>> realized I was delaying it.
>>
>> Thank you,
>>
>> William Breathitt Gray
> One last thing...  This seems to be a userspace ABI change.  What
> are our potential issues with users of this ABI?
>
> It's not that costly to keep the code, though dropping the docs or
> putting a depreciated note in them is probably a good idea.  Hence
> I'm not totally convinced the risk of a regression is worth it.

As far I know nobody use this interface yet for me there is no risk to 
remove this code.

Benjamin

>
> If we think it's the sort of change no one will notice, then
> fair enough we'll give it a go and cross our fingers.
>
> Thanks,
>
> Jonathan
>
>
Jonathan Cameron July 14, 2019, 5:23 p.m. UTC | #10
On Sun, 14 Jul 2019 15:32:33 +0000
Benjamin GAIGNARD <benjamin.gaignard@st.com> wrote:

> On 7/14/19 12:09 PM, Jonathan Cameron wrote:
> > On Thu, 11 Jul 2019 21:16:20 +0900
> > William Breathitt Gray <vilhelm.gray@gmail.com> wrote:
> >  
> >> On Thu, Jul 11, 2019 at 02:12:27PM +0200, Benjamin Gaignard wrote:  
> >>> Le jeu. 11 juil. 2019 à 13:51, William Breathitt Gray
> >>> <vilhelm.gray@gmail.com> a écrit :  
> >>>> On Tue, May 07, 2019 at 11:12:24AM +0200, Benjamin Gaignard wrote:  
> >>>>> Quadrature feature is now hosted on it own framework.
> >>>>> Remove quadrature related code from stm32-trigger driver to avoid
> >>>>> code duplication and simplify the ABI.
> >>>>>
> >>>>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>  
> >>>> What is the status of this patch? Are there any objections currently for
> >>>> its inclusion?  
> >>> You were the only one asking for more details about it :-)
> >>> If you agree I think that Jonathan can merge it.
> >>>
> >>> Benjamin  
> >>>> William Breathitt Gray
> >>>>
> >>>> _______________________________________________
> >>>> linux-arm-kernel mailing list
> >>>> linux-arm-kernel@lists.infradead.org
> >>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel  
> >> Yes, Jonathan please merge this if you have no objections, I hadn't
> >> realized I was delaying it.
> >>
> >> Thank you,
> >>
> >> William Breathitt Gray  
> > One last thing...  This seems to be a userspace ABI change.  What
> > are our potential issues with users of this ABI?
> >
> > It's not that costly to keep the code, though dropping the docs or
> > putting a depreciated note in them is probably a good idea.  Hence
> > I'm not totally convinced the risk of a regression is worth it.  
> 
> As far I know nobody use this interface yet for me there is no risk to 
> remove this code.
> 
> Benjamin
Hope you are right :)

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> 
> >
> > If we think it's the sort of change no one will notice, then
> > fair enough we'll give it a go and cross our fingers.
> >
> > Thanks,
> >
> > Jonathan
> >
>
diff mbox series

Patch

diff --git a/Documentation/ABI/testing/sysfs-bus-iio-timer-stm32 b/Documentation/ABI/testing/sysfs-bus-iio-timer-stm32
index 161c147d3c40..b7259234ad70 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio-timer-stm32
+++ b/Documentation/ABI/testing/sysfs-bus-iio-timer-stm32
@@ -91,29 +91,6 @@  Description:
 		When counting down the counter start from preset value
 		and fire event when reach 0.
 
-What:		/sys/bus/iio/devices/iio:deviceX/in_count_quadrature_mode_available
-KernelVersion:	4.12
-Contact:	benjamin.gaignard@st.com
-Description:
-		Reading returns the list possible quadrature modes.
-
-What:		/sys/bus/iio/devices/iio:deviceX/in_count0_quadrature_mode
-KernelVersion:	4.12
-Contact:	benjamin.gaignard@st.com
-Description:
-		Configure the device counter quadrature modes:
-		channel_A:
-			Encoder A input servers as the count input and B as
-			the UP/DOWN direction control input.
-
-		channel_B:
-			Encoder B input serves as the count input and A as
-			the UP/DOWN direction control input.
-
-		quadrature:
-			Encoder A and B inputs are mixed to get direction
-			and count with a scale of 0.25.
-
 What:		/sys/bus/iio/devices/iio:deviceX/in_count_enable_mode_available
 KernelVersion:	4.12
 Contact:	benjamin.gaignard@st.com
diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c
index ccf1ce653b25..a5dfe65cd9b9 100644
--- a/drivers/iio/trigger/stm32-timer-trigger.c
+++ b/drivers/iio/trigger/stm32-timer-trigger.c
@@ -608,86 +608,6 @@  static const struct iio_enum stm32_enable_mode_enum = {
 	.get = stm32_get_enable_mode
 };
 
-static const char *const stm32_quadrature_modes[] = {
-	"channel_A",
-	"channel_B",
-	"quadrature",
-};
-
-static int stm32_set_quadrature_mode(struct iio_dev *indio_dev,
-				     const struct iio_chan_spec *chan,
-				     unsigned int mode)
-{
-	struct stm32_timer_trigger *priv = iio_priv(indio_dev);
-
-	regmap_update_bits(priv->regmap, TIM_SMCR, TIM_SMCR_SMS, mode + 1);
-
-	return 0;
-}
-
-static int stm32_get_quadrature_mode(struct iio_dev *indio_dev,
-				     const struct iio_chan_spec *chan)
-{
-	struct stm32_timer_trigger *priv = iio_priv(indio_dev);
-	u32 smcr;
-	int mode;
-
-	regmap_read(priv->regmap, TIM_SMCR, &smcr);
-	mode = (smcr & TIM_SMCR_SMS) - 1;
-	if ((mode < 0) || (mode > ARRAY_SIZE(stm32_quadrature_modes)))
-		return -EINVAL;
-
-	return mode;
-}
-
-static const struct iio_enum stm32_quadrature_mode_enum = {
-	.items = stm32_quadrature_modes,
-	.num_items = ARRAY_SIZE(stm32_quadrature_modes),
-	.set = stm32_set_quadrature_mode,
-	.get = stm32_get_quadrature_mode
-};
-
-static const char *const stm32_count_direction_states[] = {
-	"up",
-	"down"
-};
-
-static int stm32_set_count_direction(struct iio_dev *indio_dev,
-				     const struct iio_chan_spec *chan,
-				     unsigned int dir)
-{
-	struct stm32_timer_trigger *priv = iio_priv(indio_dev);
-	u32 val;
-	int mode;
-
-	/* In encoder mode, direction is RO (given by TI1/TI2 signals) */
-	regmap_read(priv->regmap, TIM_SMCR, &val);
-	mode = (val & TIM_SMCR_SMS) - 1;
-	if ((mode >= 0) || (mode < ARRAY_SIZE(stm32_quadrature_modes)))
-		return -EBUSY;
-
-	return regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_DIR,
-				  dir ? TIM_CR1_DIR : 0);
-}
-
-static int stm32_get_count_direction(struct iio_dev *indio_dev,
-				     const struct iio_chan_spec *chan)
-{
-	struct stm32_timer_trigger *priv = iio_priv(indio_dev);
-	u32 cr1;
-
-	regmap_read(priv->regmap, TIM_CR1, &cr1);
-
-	return ((cr1 & TIM_CR1_DIR) ? 1 : 0);
-}
-
-static const struct iio_enum stm32_count_direction_enum = {
-	.items = stm32_count_direction_states,
-	.num_items = ARRAY_SIZE(stm32_count_direction_states),
-	.set = stm32_set_count_direction,
-	.get = stm32_get_count_direction
-};
-
 static ssize_t stm32_count_get_preset(struct iio_dev *indio_dev,
 				      uintptr_t private,
 				      const struct iio_chan_spec *chan,
@@ -728,10 +648,6 @@  static const struct iio_chan_spec_ext_info stm32_trigger_count_info[] = {
 		.read = stm32_count_get_preset,
 		.write = stm32_count_set_preset
 	},
-	IIO_ENUM("count_direction", IIO_SEPARATE, &stm32_count_direction_enum),
-	IIO_ENUM_AVAILABLE("count_direction", &stm32_count_direction_enum),
-	IIO_ENUM("quadrature_mode", IIO_SEPARATE, &stm32_quadrature_mode_enum),
-	IIO_ENUM_AVAILABLE("quadrature_mode", &stm32_quadrature_mode_enum),
 	IIO_ENUM("enable_mode", IIO_SEPARATE, &stm32_enable_mode_enum),
 	IIO_ENUM_AVAILABLE("enable_mode", &stm32_enable_mode_enum),
 	IIO_ENUM("trigger_mode", IIO_SEPARATE, &stm32_trigger_mode_enum),