[PATCH v2] hwmon: (ina2xx) Cast to s16 on shunt and current regs
All devices supported by ina2xx are bidirectional and reports the measured shunt voltage and power values as a signed 16 bit, but the current driver implementation caches all registers as u16, leading to an incorrect sign extension when reporting to the userspace in ina2xx_get_value(). This patch fixes the problem by casting the signed registers to s16. Tested on an INA219. Signed-off-by: Fabio Baltieri --- drivers/hwmon/ina2xx.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 93d26e8..bfd3f3e 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -148,7 +148,8 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg) switch (reg) { case INA2XX_SHUNT_VOLTAGE: - val = DIV_ROUND_CLOSEST(data->regs[reg], + /* signed register */ + val = DIV_ROUND_CLOSEST((s16)data->regs[reg], data->config->shunt_div); break; case INA2XX_BUS_VOLTAGE: @@ -160,8 +161,8 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg) val = data->regs[reg] * data->config->power_lsb; break; case INA2XX_CURRENT: - /* LSB=1mA (selected). Is in mA */ - val = data->regs[reg]; + /* signed register, LSB=1mA (selected), in mA */ + val = (s16)data->regs[reg]; break; default: /* programmer goofed */ -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [lm-sensors] [PATCH] hwmon: (ina2xx) Change register cache to signed
On Sun, Jun 8, 2014 at 9:30 PM, Guenter Roeck wrote: > On Sun, Jun 08, 2014 at 01:16:00PM -0700, Guenter Roeck wrote: >> On Sat, Jun 07, 2014 at 09:47:01PM +0100, Fabio Baltieri wrote: >> > All devices supported by the ina2xx driver are bidirectional and reports >> > the measured value as a signed 16 bit, but the current driver >> > implementation caches the number as an u16, leading to an incorrect sign >> > extension when reporting to the userspace in ina2xx_get_value(). >> > >> > This patch fixes the problem by using a s16 instead, and has been tested >> > on an INA219. >> > >> > Signed-off-by: Fabio Baltieri >> >> Applied. >> > Actually, no, this won't work. The statement above is only correct for current > and shunt voltage measurements, but not for power measurements and not for bus > voltage measurements. Changing the register to s16 won't help; conversion > needs > to be done in ina2xx_get_value() for shunt voltage and current measurement > only. > Otherwise we just move the bug from current/shunt voltage measurements to > power / bus voltage measurements. > > Even more interesting, the power is supposed to be the product of Bus voltage > and current, and the latter can be negative. However, the power register > description does not suggest that the upper bit would be a sign bit. So there > is some discrepancy in the datasheet, and we'll need some real-world data to > understand if the upper power bit is signed or not. Hi Guenter, looks like you're right here, I wasn't paying too attention to the power register and it actually always reads positive, even when the current is flowing in the reverse direction, real data from the ina219: [55694.263502] shunt_voltage=fb46 [55694.263691] bus_voltage=20c2 [55694.263847] power=00fe [55694.263954] current=fb46 I'll send a v2 to only cast the two signed register then. Many thanks for spotting this! Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [lm-sensors] [PATCH] hwmon: (ina2xx) Change register cache to signed
On Sun, Jun 8, 2014 at 9:30 PM, Guenter Roeck li...@roeck-us.net wrote: On Sun, Jun 08, 2014 at 01:16:00PM -0700, Guenter Roeck wrote: On Sat, Jun 07, 2014 at 09:47:01PM +0100, Fabio Baltieri wrote: All devices supported by the ina2xx driver are bidirectional and reports the measured value as a signed 16 bit, but the current driver implementation caches the number as an u16, leading to an incorrect sign extension when reporting to the userspace in ina2xx_get_value(). This patch fixes the problem by using a s16 instead, and has been tested on an INA219. Signed-off-by: Fabio Baltieri fabio.balti...@gmail.com Applied. Actually, no, this won't work. The statement above is only correct for current and shunt voltage measurements, but not for power measurements and not for bus voltage measurements. Changing the register to s16 won't help; conversion needs to be done in ina2xx_get_value() for shunt voltage and current measurement only. Otherwise we just move the bug from current/shunt voltage measurements to power / bus voltage measurements. Even more interesting, the power is supposed to be the product of Bus voltage and current, and the latter can be negative. However, the power register description does not suggest that the upper bit would be a sign bit. So there is some discrepancy in the datasheet, and we'll need some real-world data to understand if the upper power bit is signed or not. Hi Guenter, looks like you're right here, I wasn't paying too attention to the power register and it actually always reads positive, even when the current is flowing in the reverse direction, real data from the ina219: [55694.263502] shunt_voltage=fb46 [55694.263691] bus_voltage=20c2 [55694.263847] power=00fe [55694.263954] current=fb46 I'll send a v2 to only cast the two signed register then. Many thanks for spotting this! Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] hwmon: (ina2xx) Cast to s16 on shunt and current regs
All devices supported by ina2xx are bidirectional and reports the measured shunt voltage and power values as a signed 16 bit, but the current driver implementation caches all registers as u16, leading to an incorrect sign extension when reporting to the userspace in ina2xx_get_value(). This patch fixes the problem by casting the signed registers to s16. Tested on an INA219. Signed-off-by: Fabio Baltieri fabio.balti...@gmail.com --- drivers/hwmon/ina2xx.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 93d26e8..bfd3f3e 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -148,7 +148,8 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg) switch (reg) { case INA2XX_SHUNT_VOLTAGE: - val = DIV_ROUND_CLOSEST(data-regs[reg], + /* signed register */ + val = DIV_ROUND_CLOSEST((s16)data-regs[reg], data-config-shunt_div); break; case INA2XX_BUS_VOLTAGE: @@ -160,8 +161,8 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg) val = data-regs[reg] * data-config-power_lsb; break; case INA2XX_CURRENT: - /* LSB=1mA (selected). Is in mA */ - val = data-regs[reg]; + /* signed register, LSB=1mA (selected), in mA */ + val = (s16)data-regs[reg]; break; default: /* programmer goofed */ -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] hwmon: (ina2xx) Change register cache to signed
All devices supported by the ina2xx driver are bidirectional and reports the measured value as a signed 16 bit, but the current driver implementation caches the number as an u16, leading to an incorrect sign extension when reporting to the userspace in ina2xx_get_value(). This patch fixes the problem by using a s16 instead, and has been tested on an INA219. Signed-off-by: Fabio Baltieri --- drivers/hwmon/ina2xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 93d26e8..d994280 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -86,7 +86,7 @@ struct ina2xx_data { unsigned long last_updated; int kind; - u16 regs[INA2XX_MAX_REGISTERS]; + s16 regs[INA2XX_MAX_REGISTERS]; }; static const struct ina2xx_config ina2xx_config[] = { -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] hwmon: (ina2xx) Change register cache to signed
All devices supported by the ina2xx driver are bidirectional and reports the measured value as a signed 16 bit, but the current driver implementation caches the number as an u16, leading to an incorrect sign extension when reporting to the userspace in ina2xx_get_value(). This patch fixes the problem by using a s16 instead, and has been tested on an INA219. Signed-off-by: Fabio Baltieri fabio.balti...@gmail.com --- drivers/hwmon/ina2xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 93d26e8..d994280 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -86,7 +86,7 @@ struct ina2xx_data { unsigned long last_updated; int kind; - u16 regs[INA2XX_MAX_REGISTERS]; + s16 regs[INA2XX_MAX_REGISTERS]; }; static const struct ina2xx_config ina2xx_config[] = { -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] mac80211: use oneshot blink API for LED triggers
Change mac80211 LED trigger code to use the generic led_trigger_blink_oneshot() API for transmit and receive activity indication. This gives a better feedback to the user, as with the new API each activity event results in a visible blink, while a constant traffic results in a continuous blink at constant rate. Signed-off-by: Fabio Baltieri --- Changes from v1: - fixed some wrong indentations net/mac80211/ieee80211_i.h | 1 - net/mac80211/led.c | 19 +++ net/mac80211/led.h | 2 +- net/mac80211/status.c | 2 +- net/mac80211/tx.c | 1 - 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 8412a30..1178139 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1063,7 +1063,6 @@ struct ieee80211_local { u32 dot11TransmittedFrameCount; #ifdef CONFIG_MAC80211_LEDS - int tx_led_counter, rx_led_counter; struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; struct tpt_led_trigger *tpt_led_trigger; char tx_led_name[32], rx_led_name[32], diff --git a/net/mac80211/led.c b/net/mac80211/led.c index bcffa69..e2b8364 100644 --- a/net/mac80211/led.c +++ b/net/mac80211/led.c @@ -12,27 +12,22 @@ #include #include "led.h" +#define MAC80211_BLINK_DELAY 50 /* ms */ + void ieee80211_led_rx(struct ieee80211_local *local) { + unsigned long led_delay = MAC80211_BLINK_DELAY; if (unlikely(!local->rx_led)) return; - if (local->rx_led_counter++ % 2 == 0) - led_trigger_event(local->rx_led, LED_OFF); - else - led_trigger_event(local->rx_led, LED_FULL); + led_trigger_blink_oneshot(local->rx_led, _delay, _delay, 0); } -/* q is 1 if a packet was enqueued, 0 if it has been transmitted */ -void ieee80211_led_tx(struct ieee80211_local *local, int q) +void ieee80211_led_tx(struct ieee80211_local *local) { + unsigned long led_delay = MAC80211_BLINK_DELAY; if (unlikely(!local->tx_led)) return; - /* not sure how this is supposed to work ... */ - local->tx_led_counter += 2*q-1; - if (local->tx_led_counter % 2 == 0) - led_trigger_event(local->tx_led, LED_OFF); - else - led_trigger_event(local->tx_led, LED_FULL); + led_trigger_blink_oneshot(local->tx_led, _delay, _delay, 0); } void ieee80211_led_assoc(struct ieee80211_local *local, bool associated) diff --git a/net/mac80211/led.h b/net/mac80211/led.h index e0275d9..6ca2f29 100644 --- a/net/mac80211/led.h +++ b/net/mac80211/led.h @@ -13,7 +13,7 @@ #ifdef CONFIG_MAC80211_LEDS void ieee80211_led_rx(struct ieee80211_local *local); -void ieee80211_led_tx(struct ieee80211_local *local, int q); +void ieee80211_led_tx(struct ieee80211_local *local); void ieee80211_led_assoc(struct ieee80211_local *local, bool associated); void ieee80211_led_radio(struct ieee80211_local *local, diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 4343920..e3c889b 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c @@ -557,7 +557,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) rcu_read_unlock(); - ieee80211_led_tx(local, 0); + ieee80211_led_tx(local); /* SNMP counters * Fragments are passed to low-level drivers as separate skbs, so these diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 4105d0c..6c4e60d 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1281,7 +1281,6 @@ static bool __ieee80211_tx(struct ieee80211_local *local, txpending); ieee80211_tpt_led_trig_tx(local, fc, led_len); - ieee80211_led_tx(local, 1); WARN_ON_ONCE(!skb_queue_empty(skbs)); -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mac80211: use oneshot blink API for LED triggers
On Thu, Jul 25, 2013 at 09:58:21AM +0200, Johannes Berg wrote: > > So, are you definitely rejecting this patch or should I fix indentation > > and send a v2? > > I think I'll take it, I kinda hope nobody will really care much about it > but the behaviour looks better and the code is simpler, so ... :) Good enough... I'll send the v2 then. :-) Thanks, Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mac80211: use oneshot blink API for LED triggers
On Thu, Jul 25, 2013 at 09:58:21AM +0200, Johannes Berg wrote: So, are you definitely rejecting this patch or should I fix indentation and send a v2? I think I'll take it, I kinda hope nobody will really care much about it but the behaviour looks better and the code is simpler, so ... :) Good enough... I'll send the v2 then. :-) Thanks, Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] mac80211: use oneshot blink API for LED triggers
Change mac80211 LED trigger code to use the generic led_trigger_blink_oneshot() API for transmit and receive activity indication. This gives a better feedback to the user, as with the new API each activity event results in a visible blink, while a constant traffic results in a continuous blink at constant rate. Signed-off-by: Fabio Baltieri fabio.balti...@gmail.com --- Changes from v1: - fixed some wrong indentations net/mac80211/ieee80211_i.h | 1 - net/mac80211/led.c | 19 +++ net/mac80211/led.h | 2 +- net/mac80211/status.c | 2 +- net/mac80211/tx.c | 1 - 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 8412a30..1178139 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1063,7 +1063,6 @@ struct ieee80211_local { u32 dot11TransmittedFrameCount; #ifdef CONFIG_MAC80211_LEDS - int tx_led_counter, rx_led_counter; struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; struct tpt_led_trigger *tpt_led_trigger; char tx_led_name[32], rx_led_name[32], diff --git a/net/mac80211/led.c b/net/mac80211/led.c index bcffa69..e2b8364 100644 --- a/net/mac80211/led.c +++ b/net/mac80211/led.c @@ -12,27 +12,22 @@ #include linux/export.h #include led.h +#define MAC80211_BLINK_DELAY 50 /* ms */ + void ieee80211_led_rx(struct ieee80211_local *local) { + unsigned long led_delay = MAC80211_BLINK_DELAY; if (unlikely(!local-rx_led)) return; - if (local-rx_led_counter++ % 2 == 0) - led_trigger_event(local-rx_led, LED_OFF); - else - led_trigger_event(local-rx_led, LED_FULL); + led_trigger_blink_oneshot(local-rx_led, led_delay, led_delay, 0); } -/* q is 1 if a packet was enqueued, 0 if it has been transmitted */ -void ieee80211_led_tx(struct ieee80211_local *local, int q) +void ieee80211_led_tx(struct ieee80211_local *local) { + unsigned long led_delay = MAC80211_BLINK_DELAY; if (unlikely(!local-tx_led)) return; - /* not sure how this is supposed to work ... */ - local-tx_led_counter += 2*q-1; - if (local-tx_led_counter % 2 == 0) - led_trigger_event(local-tx_led, LED_OFF); - else - led_trigger_event(local-tx_led, LED_FULL); + led_trigger_blink_oneshot(local-tx_led, led_delay, led_delay, 0); } void ieee80211_led_assoc(struct ieee80211_local *local, bool associated) diff --git a/net/mac80211/led.h b/net/mac80211/led.h index e0275d9..6ca2f29 100644 --- a/net/mac80211/led.h +++ b/net/mac80211/led.h @@ -13,7 +13,7 @@ #ifdef CONFIG_MAC80211_LEDS void ieee80211_led_rx(struct ieee80211_local *local); -void ieee80211_led_tx(struct ieee80211_local *local, int q); +void ieee80211_led_tx(struct ieee80211_local *local); void ieee80211_led_assoc(struct ieee80211_local *local, bool associated); void ieee80211_led_radio(struct ieee80211_local *local, diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 4343920..e3c889b 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c @@ -557,7 +557,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) rcu_read_unlock(); - ieee80211_led_tx(local, 0); + ieee80211_led_tx(local); /* SNMP counters * Fragments are passed to low-level drivers as separate skbs, so these diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 4105d0c..6c4e60d 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1281,7 +1281,6 @@ static bool __ieee80211_tx(struct ieee80211_local *local, txpending); ieee80211_tpt_led_trig_tx(local, fc, led_len); - ieee80211_led_tx(local, 1); WARN_ON_ONCE(!skb_queue_empty(skbs)); -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mac80211: use oneshot blink API for LED triggers
On Wed, Jul 24, 2013 at 10:14:25AM +0200, Johannes Berg wrote: > On Wed, 2013-07-24 at 02:09 +0200, Fabio Baltieri wrote: > > Changes mac80211 LED trigger code to use the generic > > led_trigger_blink_oneshot() API for transmit and receive activity > > indication. > > > > This gives a better feedback to the user, as with the new API each > > activity event results in a visible blink, while a constant traffic > > results in a continuous blink at constant rate. > > This seems a little pointless since our throughput-based trigger can do > very similar (but somewhat better) behaviour? Maybe that should just be > the default instead, with some sane default setup values? Ok but that requires driver specific support and it's only implemented on a subset of currently available drivers. This at least makes the basic tx/rx indication capability a better. > (Regardless of that, you also have indentation problems in your patch) Ok, I guess you are referring to the this: + led_trigger_blink_oneshot(local->tx_led, + _delay, _delay, 0); So, are you definitely rejecting this patch or should I fix indentation and send a v2? Thanks, Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mac80211: use oneshot blink API for LED triggers
On Wed, Jul 24, 2013 at 10:14:25AM +0200, Johannes Berg wrote: On Wed, 2013-07-24 at 02:09 +0200, Fabio Baltieri wrote: Changes mac80211 LED trigger code to use the generic led_trigger_blink_oneshot() API for transmit and receive activity indication. This gives a better feedback to the user, as with the new API each activity event results in a visible blink, while a constant traffic results in a continuous blink at constant rate. This seems a little pointless since our throughput-based trigger can do very similar (but somewhat better) behaviour? Maybe that should just be the default instead, with some sane default setup values? Ok but that requires driver specific support and it's only implemented on a subset of currently available drivers. This at least makes the basic tx/rx indication capability a better. (Regardless of that, you also have indentation problems in your patch) Ok, I guess you are referring to the this: + led_trigger_blink_oneshot(local-tx_led, + led_delay, led_delay, 0); So, are you definitely rejecting this patch or should I fix indentation and send a v2? Thanks, Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mac80211: use oneshot blink API for LED triggers
Changes mac80211 LED trigger code to use the generic led_trigger_blink_oneshot() API for transmit and receive activity indication. This gives a better feedback to the user, as with the new API each activity event results in a visible blink, while a constant traffic results in a continuous blink at constant rate. Signed-off-by: Fabio Baltieri --- net/mac80211/ieee80211_i.h | 1 - net/mac80211/led.c | 21 + net/mac80211/led.h | 2 +- net/mac80211/status.c | 2 +- net/mac80211/tx.c | 1 - 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 8412a30..1178139 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1063,7 +1063,6 @@ struct ieee80211_local { u32 dot11TransmittedFrameCount; #ifdef CONFIG_MAC80211_LEDS - int tx_led_counter, rx_led_counter; struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; struct tpt_led_trigger *tpt_led_trigger; char tx_led_name[32], rx_led_name[32], diff --git a/net/mac80211/led.c b/net/mac80211/led.c index bcffa69..9bce15e 100644 --- a/net/mac80211/led.c +++ b/net/mac80211/led.c @@ -12,27 +12,24 @@ #include #include "led.h" +#define MAC80211_BLINK_DELAY 50 /* ms */ + void ieee80211_led_rx(struct ieee80211_local *local) { + unsigned long led_delay = MAC80211_BLINK_DELAY; if (unlikely(!local->rx_led)) return; - if (local->rx_led_counter++ % 2 == 0) - led_trigger_event(local->rx_led, LED_OFF); - else - led_trigger_event(local->rx_led, LED_FULL); + led_trigger_blink_oneshot(local->rx_led, + _delay, _delay, 0); } -/* q is 1 if a packet was enqueued, 0 if it has been transmitted */ -void ieee80211_led_tx(struct ieee80211_local *local, int q) +void ieee80211_led_tx(struct ieee80211_local *local) { + unsigned long led_delay = MAC80211_BLINK_DELAY; if (unlikely(!local->tx_led)) return; - /* not sure how this is supposed to work ... */ - local->tx_led_counter += 2*q-1; - if (local->tx_led_counter % 2 == 0) - led_trigger_event(local->tx_led, LED_OFF); - else - led_trigger_event(local->tx_led, LED_FULL); + led_trigger_blink_oneshot(local->tx_led, + _delay, _delay, 0); } void ieee80211_led_assoc(struct ieee80211_local *local, bool associated) diff --git a/net/mac80211/led.h b/net/mac80211/led.h index e0275d9..6ca2f29 100644 --- a/net/mac80211/led.h +++ b/net/mac80211/led.h @@ -13,7 +13,7 @@ #ifdef CONFIG_MAC80211_LEDS void ieee80211_led_rx(struct ieee80211_local *local); -void ieee80211_led_tx(struct ieee80211_local *local, int q); +void ieee80211_led_tx(struct ieee80211_local *local); void ieee80211_led_assoc(struct ieee80211_local *local, bool associated); void ieee80211_led_radio(struct ieee80211_local *local, diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 4343920..e3c889b 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c @@ -557,7 +557,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) rcu_read_unlock(); - ieee80211_led_tx(local, 0); + ieee80211_led_tx(local); /* SNMP counters * Fragments are passed to low-level drivers as separate skbs, so these diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 4105d0c..6c4e60d 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1281,7 +1281,6 @@ static bool __ieee80211_tx(struct ieee80211_local *local, txpending); ieee80211_tpt_led_trig_tx(local, fc, led_len); - ieee80211_led_tx(local, 1); WARN_ON_ONCE(!skb_queue_empty(skbs)); -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mac80211: use oneshot blink API for LED triggers
Hi Johannes, John, This patch changes the mac80211 LED driver to use the generic oneshot LED API. The current mac80211 blink code seems to lead to very short tx blinks and toggles the LED on tx. The oneshot API ensure a complete LED on-off cycle for each blink event, thus getting a better result for an activity indicator: one visible blink for sporadic events and a steady on-off blink sequence on constant traffic. Would you consider this patch for wireless-next? Thanks, Fabio Fabio Baltieri (1): mac80211: use oneshot blink API for LED triggers net/mac80211/ieee80211_i.h | 1 - net/mac80211/led.c | 21 + net/mac80211/led.h | 2 +- net/mac80211/status.c | 2 +- net/mac80211/tx.c | 1 - 5 files changed, 11 insertions(+), 16 deletions(-) -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mac80211: use oneshot blink API for LED triggers
Hi Johannes, John, This patch changes the mac80211 LED driver to use the generic oneshot LED API. The current mac80211 blink code seems to lead to very short tx blinks and toggles the LED on tx. The oneshot API ensure a complete LED on-off cycle for each blink event, thus getting a better result for an activity indicator: one visible blink for sporadic events and a steady on-off blink sequence on constant traffic. Would you consider this patch for wireless-next? Thanks, Fabio Fabio Baltieri (1): mac80211: use oneshot blink API for LED triggers net/mac80211/ieee80211_i.h | 1 - net/mac80211/led.c | 21 + net/mac80211/led.h | 2 +- net/mac80211/status.c | 2 +- net/mac80211/tx.c | 1 - 5 files changed, 11 insertions(+), 16 deletions(-) -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mac80211: use oneshot blink API for LED triggers
Changes mac80211 LED trigger code to use the generic led_trigger_blink_oneshot() API for transmit and receive activity indication. This gives a better feedback to the user, as with the new API each activity event results in a visible blink, while a constant traffic results in a continuous blink at constant rate. Signed-off-by: Fabio Baltieri fabio.balti...@gmail.com --- net/mac80211/ieee80211_i.h | 1 - net/mac80211/led.c | 21 + net/mac80211/led.h | 2 +- net/mac80211/status.c | 2 +- net/mac80211/tx.c | 1 - 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 8412a30..1178139 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1063,7 +1063,6 @@ struct ieee80211_local { u32 dot11TransmittedFrameCount; #ifdef CONFIG_MAC80211_LEDS - int tx_led_counter, rx_led_counter; struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; struct tpt_led_trigger *tpt_led_trigger; char tx_led_name[32], rx_led_name[32], diff --git a/net/mac80211/led.c b/net/mac80211/led.c index bcffa69..9bce15e 100644 --- a/net/mac80211/led.c +++ b/net/mac80211/led.c @@ -12,27 +12,24 @@ #include linux/export.h #include led.h +#define MAC80211_BLINK_DELAY 50 /* ms */ + void ieee80211_led_rx(struct ieee80211_local *local) { + unsigned long led_delay = MAC80211_BLINK_DELAY; if (unlikely(!local-rx_led)) return; - if (local-rx_led_counter++ % 2 == 0) - led_trigger_event(local-rx_led, LED_OFF); - else - led_trigger_event(local-rx_led, LED_FULL); + led_trigger_blink_oneshot(local-rx_led, + led_delay, led_delay, 0); } -/* q is 1 if a packet was enqueued, 0 if it has been transmitted */ -void ieee80211_led_tx(struct ieee80211_local *local, int q) +void ieee80211_led_tx(struct ieee80211_local *local) { + unsigned long led_delay = MAC80211_BLINK_DELAY; if (unlikely(!local-tx_led)) return; - /* not sure how this is supposed to work ... */ - local-tx_led_counter += 2*q-1; - if (local-tx_led_counter % 2 == 0) - led_trigger_event(local-tx_led, LED_OFF); - else - led_trigger_event(local-tx_led, LED_FULL); + led_trigger_blink_oneshot(local-tx_led, + led_delay, led_delay, 0); } void ieee80211_led_assoc(struct ieee80211_local *local, bool associated) diff --git a/net/mac80211/led.h b/net/mac80211/led.h index e0275d9..6ca2f29 100644 --- a/net/mac80211/led.h +++ b/net/mac80211/led.h @@ -13,7 +13,7 @@ #ifdef CONFIG_MAC80211_LEDS void ieee80211_led_rx(struct ieee80211_local *local); -void ieee80211_led_tx(struct ieee80211_local *local, int q); +void ieee80211_led_tx(struct ieee80211_local *local); void ieee80211_led_assoc(struct ieee80211_local *local, bool associated); void ieee80211_led_radio(struct ieee80211_local *local, diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 4343920..e3c889b 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c @@ -557,7 +557,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) rcu_read_unlock(); - ieee80211_led_tx(local, 0); + ieee80211_led_tx(local); /* SNMP counters * Fragments are passed to low-level drivers as separate skbs, so these diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 4105d0c..6c4e60d 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1281,7 +1281,6 @@ static bool __ieee80211_tx(struct ieee80211_local *local, txpending); ieee80211_tpt_led_trig_tx(local, fc, led_len); - ieee80211_led_tx(local, 1); WARN_ON_ONCE(!skb_queue_empty(skbs)); -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/6] crypto: ux500/hash: add missing static qualifiers
Add missing static qualifiers to hash_process_data and hash_hw_final. Signed-off-by: Fabio Baltieri --- drivers/crypto/ux500/hash/hash_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index 154f437..dbf7b63 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c @@ -792,8 +792,7 @@ void hash_begin(struct hash_device_data *device_data, struct hash_ctx *ctx) HASH_CLEAR_BITS(_data->base->str, HASH_STR_NBLW_MASK); } -int hash_process_data( - struct hash_device_data *device_data, +static int hash_process_data(struct hash_device_data *device_data, struct hash_ctx *ctx, struct hash_req_ctx *req_ctx, int msg_length, u8 *data_buffer, u8 *buffer, u8 *index) { @@ -992,7 +991,7 @@ out: * hash_hw_final - The final hash calculation function * @req: The hash request for the job. */ -int hash_hw_final(struct ahash_request *req) +static int hash_hw_final(struct ahash_request *req) { int ret = 0; struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/6] crypto: ux500/crypt: add missing __iomem qualifiers
Add missing __iomem to struct cryp_register pointers, this solve some "incorrect type in initializer (different address spaces)" sparse warnings. Signed-off-by: Fabio Baltieri --- drivers/crypto/ux500/cryp/cryp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ux500/cryp/cryp.c b/drivers/crypto/ux500/cryp/cryp.c index 3eafa90..43a0c8a 100644 --- a/drivers/crypto/ux500/cryp/cryp.c +++ b/drivers/crypto/ux500/cryp/cryp.c @@ -291,7 +291,7 @@ void cryp_save_device_context(struct cryp_device_data *device_data, int cryp_mode) { enum cryp_algo_mode algomode; - struct cryp_register *src_reg = device_data->base; + struct cryp_register __iomem *src_reg = device_data->base; struct cryp_config *config = (struct cryp_config *)device_data->current_ctx; @@ -349,7 +349,7 @@ void cryp_save_device_context(struct cryp_device_data *device_data, void cryp_restore_device_context(struct cryp_device_data *device_data, struct cryp_device_context *ctx) { - struct cryp_register *reg = device_data->base; + struct cryp_register __iomem *reg = device_data->base; struct cryp_config *config = (struct cryp_config *)device_data->current_ctx; -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/6] crypto: ux500: use dmaengine_prep_slave_sg API
Use dmaengine_prep_slave_sg inline function instead of going through the structures manually. Signed-off-by: Fabio Baltieri --- drivers/crypto/ux500/cryp/cryp_core.c | 20 ++-- drivers/crypto/ux500/hash/hash_core.c | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c index 1957c18..0cd89df 100644 --- a/drivers/crypto/ux500/cryp/cryp_core.c +++ b/drivers/crypto/ux500/cryp/cryp_core.c @@ -553,10 +553,10 @@ static int cryp_set_dma_transfer(struct cryp_ctx *ctx, dev_dbg(ctx->device->dev, "[%s]: Setting up DMA for buffer " "(TO_DEVICE)", __func__); - desc = channel->device->device_prep_slave_sg(channel, -ctx->device->dma.sg_src, -ctx->device->dma.sg_src_len, -direction, DMA_CTRL_ACK, NULL); + desc = dmaengine_prep_slave_sg(channel, + ctx->device->dma.sg_src, + ctx->device->dma.sg_src_len, + direction, DMA_CTRL_ACK); break; case DMA_FROM_DEVICE: @@ -577,12 +577,12 @@ static int cryp_set_dma_transfer(struct cryp_ctx *ctx, dev_dbg(ctx->device->dev, "[%s]: Setting up DMA for buffer " "(FROM_DEVICE)", __func__); - desc = channel->device->device_prep_slave_sg(channel, -ctx->device->dma.sg_dst, -ctx->device->dma.sg_dst_len, -direction, -DMA_CTRL_ACK | -DMA_PREP_INTERRUPT, NULL); + desc = dmaengine_prep_slave_sg(channel, + ctx->device->dma.sg_dst, + ctx->device->dma.sg_dst_len, + direction, + DMA_CTRL_ACK | + DMA_PREP_INTERRUPT); desc->callback = cryp_dma_out_callback; desc->callback_param = ctx; diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index 8c2817804..352 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c @@ -180,9 +180,9 @@ static int hash_set_dma_transfer(struct hash_ctx *ctx, struct scatterlist *sg, dev_dbg(ctx->device->dev, "[%s]: Setting up DMA for buffer " "(TO_DEVICE)", __func__); - desc = channel->device->device_prep_slave_sg(channel, + desc = dmaengine_prep_slave_sg(channel, ctx->device->dma.sg, ctx->device->dma.sg_len, - direction, DMA_CTRL_ACK | DMA_PREP_INTERRUPT, NULL); + direction, DMA_CTRL_ACK | DMA_PREP_INTERRUPT); if (!desc) { dev_err(ctx->device->dev, "[%s]: device_prep_slave_sg() failed!", __func__); -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/6] crypto: ux500: use dmaengine_submit API
Use dmaengine_submit instead of calling desc->tx_submit manually. Signed-off-by: Fabio Baltieri --- drivers/crypto/ux500/cryp/cryp_core.c | 2 +- drivers/crypto/ux500/hash/hash_core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c index 0cd89df..a999f53 100644 --- a/drivers/crypto/ux500/cryp/cryp_core.c +++ b/drivers/crypto/ux500/cryp/cryp_core.c @@ -594,7 +594,7 @@ static int cryp_set_dma_transfer(struct cryp_ctx *ctx, return -EFAULT; } - cookie = desc->tx_submit(desc); + cookie = dmaengine_submit(desc); dma_async_issue_pending(channel); return 0; diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index 352..496ae6a 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c @@ -192,7 +192,7 @@ static int hash_set_dma_transfer(struct hash_ctx *ctx, struct scatterlist *sg, desc->callback = hash_dma_callback; desc->callback_param = ctx; - cookie = desc->tx_submit(desc); + cookie = dmaengine_submit(desc); dma_async_issue_pending(channel); return 0; -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/6] crypto: ux500: use dmaengine_device_control API
Use dmaengine_device_control inline function instead of going through the structures manually. Signed-off-by: Fabio Baltieri --- drivers/crypto/ux500/cryp/cryp_core.c | 4 ++-- drivers/crypto/ux500/hash/hash_core.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c index b675bbd..1957c18 100644 --- a/drivers/crypto/ux500/cryp/cryp_core.c +++ b/drivers/crypto/ux500/cryp/cryp_core.c @@ -607,12 +607,12 @@ static void cryp_dma_done(struct cryp_ctx *ctx) dev_dbg(ctx->device->dev, "[%s]: ", __func__); chan = ctx->device->dma.chan_mem2cryp; - chan->device->device_control(chan, DMA_TERMINATE_ALL, 0); + dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); dma_unmap_sg(chan->device->dev, ctx->device->dma.sg_src, ctx->device->dma.sg_src_len, DMA_TO_DEVICE); chan = ctx->device->dma.chan_cryp2mem; - chan->device->device_control(chan, DMA_TERMINATE_ALL, 0); + dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); dma_unmap_sg(chan->device->dev, ctx->device->dma.sg_dst, ctx->device->dma.sg_dst_len, DMA_FROM_DEVICE); } diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index dbf7b63..8c2817804 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c @@ -203,7 +203,7 @@ static void hash_dma_done(struct hash_ctx *ctx) struct dma_chan *chan; chan = ctx->device->dma.chan_mem2hash; - chan->device->device_control(chan, DMA_TERMINATE_ALL, 0); + dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); dma_unmap_sg(chan->device->dev, ctx->device->dma.sg, ctx->device->dma.sg_len, DMA_TO_DEVICE); -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/6] crypto: ux500/hash: use readl on iomem addresses
Always use readl when reading memory mapped registers. Signed-off-by: Fabio Baltieri --- drivers/crypto/ux500/hash/hash_core.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index f89fe8a..154f437 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c @@ -473,12 +473,12 @@ static void hash_hw_write_key(struct hash_device_data *device_data, HASH_SET_DIN(, nwords); } - while (device_data->base->str & HASH_STR_DCAL_MASK) + while (readl(_data->base->str) & HASH_STR_DCAL_MASK) cpu_relax(); HASH_SET_DCAL; - while (device_data->base->str & HASH_STR_DCAL_MASK) + while (readl(_data->base->str) & HASH_STR_DCAL_MASK) cpu_relax(); } @@ -661,7 +661,7 @@ static void hash_messagepad(struct hash_device_data *device_data, if (index_bytes) HASH_SET_DIN(message, nwords); - while (device_data->base->str & HASH_STR_DCAL_MASK) + while (readl(_data->base->str) & HASH_STR_DCAL_MASK) cpu_relax(); /* num_of_bytes == 0 => NBLW <- 0 (32 bits valid in DATAIN) */ @@ -676,7 +676,7 @@ static void hash_messagepad(struct hash_device_data *device_data, (int)(readl_relaxed(_data->base->str) & HASH_STR_NBLW_MASK)); - while (device_data->base->str & HASH_STR_DCAL_MASK) + while (readl(_data->base->str) & HASH_STR_DCAL_MASK) cpu_relax(); } @@ -776,7 +776,7 @@ void hash_begin(struct hash_device_data *device_data, struct hash_ctx *ctx) /* HW and SW initializations */ /* Note: there is no need to initialize buffer and digest members */ - while (device_data->base->str & HASH_STR_DCAL_MASK) + while (readl(_data->base->str) & HASH_STR_DCAL_MASK) cpu_relax(); /* @@ -962,7 +962,7 @@ static int hash_dma_final(struct ahash_request *req) wait_for_completion(>device->dma.complete); hash_dma_done(ctx); - while (device_data->base->str & HASH_STR_DCAL_MASK) + while (readl(_data->base->str) & HASH_STR_DCAL_MASK) cpu_relax(); if (ctx->config.oper_mode == HASH_OPER_MODE_HMAC && ctx->key) { @@ -1060,7 +1060,7 @@ int hash_hw_final(struct ahash_request *req) req_ctx->state.index); } else { HASH_SET_DCAL; - while (device_data->base->str & HASH_STR_DCAL_MASK) + while (readl(_data->base->str) & HASH_STR_DCAL_MASK) cpu_relax(); } @@ -1189,7 +1189,7 @@ int hash_resume_state(struct hash_device_data *device_data, temp_cr = device_state->temp_cr; writel_relaxed(temp_cr & HASH_CR_RESUME_MASK, _data->base->cr); - if (device_data->base->cr & HASH_CR_MODE_MASK) + if (readl(_data->base->cr) & HASH_CR_MODE_MASK) hash_mode = HASH_OPER_MODE_HMAC; else hash_mode = HASH_OPER_MODE_HASH; @@ -1233,7 +1233,7 @@ int hash_save_state(struct hash_device_data *device_data, * actually makes sure that there isn't any ongoing calculation in the * hardware. */ - while (device_data->base->str & HASH_STR_DCAL_MASK) + while (readl(_data->base->str) & HASH_STR_DCAL_MASK) cpu_relax(); temp_cr = readl_relaxed(_data->base->cr); @@ -1242,7 +1242,7 @@ int hash_save_state(struct hash_device_data *device_data, device_state->din_reg = readl_relaxed(_data->base->din); - if (device_data->base->cr & HASH_CR_MODE_MASK) + if (readl(_data->base->cr) & HASH_CR_MODE_MASK) hash_mode = HASH_OPER_MODE_HMAC; else hash_mode = HASH_OPER_MODE_HASH; -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/6] Various ux500 crypto updates
Hello Herbert, these are some fixes to issue pointed out by sparse and dmaengine API udpates on the recently enabled ux500 hw crypto drivers. These are based on recent linux-next, and can probably be applied on an architecture specific branch with your ack, or just skip to the next merge window. Thanks, Fabio Fabio Baltieri (6): crypto: ux500/hash: use readl on iomem addresses crypto: ux500/hash: add missing static qualifiers crypto: ux500/crypt: add missing __iomem qualifiers crypto: ux500: use dmaengine_device_control API crypto: ux500: use dmaengine_prep_slave_sg API crypto: ux500: use dmaengine_submit API drivers/crypto/ux500/cryp/cryp.c | 4 ++-- drivers/crypto/ux500/cryp/cryp_core.c | 26 +- drivers/crypto/ux500/hash/hash_core.c | 33 - 3 files changed, 31 insertions(+), 32 deletions(-) -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/6] Various ux500 crypto updates
Hello Herbert, these are some fixes to issue pointed out by sparse and dmaengine API udpates on the recently enabled ux500 hw crypto drivers. These are based on recent linux-next, and can probably be applied on an architecture specific branch with your ack, or just skip to the next merge window. Thanks, Fabio Fabio Baltieri (6): crypto: ux500/hash: use readl on iomem addresses crypto: ux500/hash: add missing static qualifiers crypto: ux500/crypt: add missing __iomem qualifiers crypto: ux500: use dmaengine_device_control API crypto: ux500: use dmaengine_prep_slave_sg API crypto: ux500: use dmaengine_submit API drivers/crypto/ux500/cryp/cryp.c | 4 ++-- drivers/crypto/ux500/cryp/cryp_core.c | 26 +- drivers/crypto/ux500/hash/hash_core.c | 33 - 3 files changed, 31 insertions(+), 32 deletions(-) -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/6] crypto: ux500/hash: use readl on iomem addresses
Always use readl when reading memory mapped registers. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- drivers/crypto/ux500/hash/hash_core.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index f89fe8a..154f437 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c @@ -473,12 +473,12 @@ static void hash_hw_write_key(struct hash_device_data *device_data, HASH_SET_DIN(word, nwords); } - while (device_data-base-str HASH_STR_DCAL_MASK) + while (readl(device_data-base-str) HASH_STR_DCAL_MASK) cpu_relax(); HASH_SET_DCAL; - while (device_data-base-str HASH_STR_DCAL_MASK) + while (readl(device_data-base-str) HASH_STR_DCAL_MASK) cpu_relax(); } @@ -661,7 +661,7 @@ static void hash_messagepad(struct hash_device_data *device_data, if (index_bytes) HASH_SET_DIN(message, nwords); - while (device_data-base-str HASH_STR_DCAL_MASK) + while (readl(device_data-base-str) HASH_STR_DCAL_MASK) cpu_relax(); /* num_of_bytes == 0 = NBLW - 0 (32 bits valid in DATAIN) */ @@ -676,7 +676,7 @@ static void hash_messagepad(struct hash_device_data *device_data, (int)(readl_relaxed(device_data-base-str) HASH_STR_NBLW_MASK)); - while (device_data-base-str HASH_STR_DCAL_MASK) + while (readl(device_data-base-str) HASH_STR_DCAL_MASK) cpu_relax(); } @@ -776,7 +776,7 @@ void hash_begin(struct hash_device_data *device_data, struct hash_ctx *ctx) /* HW and SW initializations */ /* Note: there is no need to initialize buffer and digest members */ - while (device_data-base-str HASH_STR_DCAL_MASK) + while (readl(device_data-base-str) HASH_STR_DCAL_MASK) cpu_relax(); /* @@ -962,7 +962,7 @@ static int hash_dma_final(struct ahash_request *req) wait_for_completion(ctx-device-dma.complete); hash_dma_done(ctx); - while (device_data-base-str HASH_STR_DCAL_MASK) + while (readl(device_data-base-str) HASH_STR_DCAL_MASK) cpu_relax(); if (ctx-config.oper_mode == HASH_OPER_MODE_HMAC ctx-key) { @@ -1060,7 +1060,7 @@ int hash_hw_final(struct ahash_request *req) req_ctx-state.index); } else { HASH_SET_DCAL; - while (device_data-base-str HASH_STR_DCAL_MASK) + while (readl(device_data-base-str) HASH_STR_DCAL_MASK) cpu_relax(); } @@ -1189,7 +1189,7 @@ int hash_resume_state(struct hash_device_data *device_data, temp_cr = device_state-temp_cr; writel_relaxed(temp_cr HASH_CR_RESUME_MASK, device_data-base-cr); - if (device_data-base-cr HASH_CR_MODE_MASK) + if (readl(device_data-base-cr) HASH_CR_MODE_MASK) hash_mode = HASH_OPER_MODE_HMAC; else hash_mode = HASH_OPER_MODE_HASH; @@ -1233,7 +1233,7 @@ int hash_save_state(struct hash_device_data *device_data, * actually makes sure that there isn't any ongoing calculation in the * hardware. */ - while (device_data-base-str HASH_STR_DCAL_MASK) + while (readl(device_data-base-str) HASH_STR_DCAL_MASK) cpu_relax(); temp_cr = readl_relaxed(device_data-base-cr); @@ -1242,7 +1242,7 @@ int hash_save_state(struct hash_device_data *device_data, device_state-din_reg = readl_relaxed(device_data-base-din); - if (device_data-base-cr HASH_CR_MODE_MASK) + if (readl(device_data-base-cr) HASH_CR_MODE_MASK) hash_mode = HASH_OPER_MODE_HMAC; else hash_mode = HASH_OPER_MODE_HASH; -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/6] crypto: ux500: use dmaengine_device_control API
Use dmaengine_device_control inline function instead of going through the structures manually. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- drivers/crypto/ux500/cryp/cryp_core.c | 4 ++-- drivers/crypto/ux500/hash/hash_core.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c index b675bbd..1957c18 100644 --- a/drivers/crypto/ux500/cryp/cryp_core.c +++ b/drivers/crypto/ux500/cryp/cryp_core.c @@ -607,12 +607,12 @@ static void cryp_dma_done(struct cryp_ctx *ctx) dev_dbg(ctx-device-dev, [%s]: , __func__); chan = ctx-device-dma.chan_mem2cryp; - chan-device-device_control(chan, DMA_TERMINATE_ALL, 0); + dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); dma_unmap_sg(chan-device-dev, ctx-device-dma.sg_src, ctx-device-dma.sg_src_len, DMA_TO_DEVICE); chan = ctx-device-dma.chan_cryp2mem; - chan-device-device_control(chan, DMA_TERMINATE_ALL, 0); + dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); dma_unmap_sg(chan-device-dev, ctx-device-dma.sg_dst, ctx-device-dma.sg_dst_len, DMA_FROM_DEVICE); } diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index dbf7b63..8c2817804 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c @@ -203,7 +203,7 @@ static void hash_dma_done(struct hash_ctx *ctx) struct dma_chan *chan; chan = ctx-device-dma.chan_mem2hash; - chan-device-device_control(chan, DMA_TERMINATE_ALL, 0); + dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); dma_unmap_sg(chan-device-dev, ctx-device-dma.sg, ctx-device-dma.sg_len, DMA_TO_DEVICE); -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/6] crypto: ux500: use dmaengine_prep_slave_sg API
Use dmaengine_prep_slave_sg inline function instead of going through the structures manually. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- drivers/crypto/ux500/cryp/cryp_core.c | 20 ++-- drivers/crypto/ux500/hash/hash_core.c | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c index 1957c18..0cd89df 100644 --- a/drivers/crypto/ux500/cryp/cryp_core.c +++ b/drivers/crypto/ux500/cryp/cryp_core.c @@ -553,10 +553,10 @@ static int cryp_set_dma_transfer(struct cryp_ctx *ctx, dev_dbg(ctx-device-dev, [%s]: Setting up DMA for buffer (TO_DEVICE), __func__); - desc = channel-device-device_prep_slave_sg(channel, -ctx-device-dma.sg_src, -ctx-device-dma.sg_src_len, -direction, DMA_CTRL_ACK, NULL); + desc = dmaengine_prep_slave_sg(channel, + ctx-device-dma.sg_src, + ctx-device-dma.sg_src_len, + direction, DMA_CTRL_ACK); break; case DMA_FROM_DEVICE: @@ -577,12 +577,12 @@ static int cryp_set_dma_transfer(struct cryp_ctx *ctx, dev_dbg(ctx-device-dev, [%s]: Setting up DMA for buffer (FROM_DEVICE), __func__); - desc = channel-device-device_prep_slave_sg(channel, -ctx-device-dma.sg_dst, -ctx-device-dma.sg_dst_len, -direction, -DMA_CTRL_ACK | -DMA_PREP_INTERRUPT, NULL); + desc = dmaengine_prep_slave_sg(channel, + ctx-device-dma.sg_dst, + ctx-device-dma.sg_dst_len, + direction, + DMA_CTRL_ACK | + DMA_PREP_INTERRUPT); desc-callback = cryp_dma_out_callback; desc-callback_param = ctx; diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index 8c2817804..352 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c @@ -180,9 +180,9 @@ static int hash_set_dma_transfer(struct hash_ctx *ctx, struct scatterlist *sg, dev_dbg(ctx-device-dev, [%s]: Setting up DMA for buffer (TO_DEVICE), __func__); - desc = channel-device-device_prep_slave_sg(channel, + desc = dmaengine_prep_slave_sg(channel, ctx-device-dma.sg, ctx-device-dma.sg_len, - direction, DMA_CTRL_ACK | DMA_PREP_INTERRUPT, NULL); + direction, DMA_CTRL_ACK | DMA_PREP_INTERRUPT); if (!desc) { dev_err(ctx-device-dev, [%s]: device_prep_slave_sg() failed!, __func__); -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/6] crypto: ux500: use dmaengine_submit API
Use dmaengine_submit instead of calling desc-tx_submit manually. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- drivers/crypto/ux500/cryp/cryp_core.c | 2 +- drivers/crypto/ux500/hash/hash_core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c index 0cd89df..a999f53 100644 --- a/drivers/crypto/ux500/cryp/cryp_core.c +++ b/drivers/crypto/ux500/cryp/cryp_core.c @@ -594,7 +594,7 @@ static int cryp_set_dma_transfer(struct cryp_ctx *ctx, return -EFAULT; } - cookie = desc-tx_submit(desc); + cookie = dmaengine_submit(desc); dma_async_issue_pending(channel); return 0; diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index 352..496ae6a 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c @@ -192,7 +192,7 @@ static int hash_set_dma_transfer(struct hash_ctx *ctx, struct scatterlist *sg, desc-callback = hash_dma_callback; desc-callback_param = ctx; - cookie = desc-tx_submit(desc); + cookie = dmaengine_submit(desc); dma_async_issue_pending(channel); return 0; -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/6] crypto: ux500/crypt: add missing __iomem qualifiers
Add missing __iomem to struct cryp_register pointers, this solve some incorrect type in initializer (different address spaces) sparse warnings. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- drivers/crypto/ux500/cryp/cryp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ux500/cryp/cryp.c b/drivers/crypto/ux500/cryp/cryp.c index 3eafa90..43a0c8a 100644 --- a/drivers/crypto/ux500/cryp/cryp.c +++ b/drivers/crypto/ux500/cryp/cryp.c @@ -291,7 +291,7 @@ void cryp_save_device_context(struct cryp_device_data *device_data, int cryp_mode) { enum cryp_algo_mode algomode; - struct cryp_register *src_reg = device_data-base; + struct cryp_register __iomem *src_reg = device_data-base; struct cryp_config *config = (struct cryp_config *)device_data-current_ctx; @@ -349,7 +349,7 @@ void cryp_save_device_context(struct cryp_device_data *device_data, void cryp_restore_device_context(struct cryp_device_data *device_data, struct cryp_device_context *ctx) { - struct cryp_register *reg = device_data-base; + struct cryp_register __iomem *reg = device_data-base; struct cryp_config *config = (struct cryp_config *)device_data-current_ctx; -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/6] crypto: ux500/hash: add missing static qualifiers
Add missing static qualifiers to hash_process_data and hash_hw_final. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- drivers/crypto/ux500/hash/hash_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index 154f437..dbf7b63 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c @@ -792,8 +792,7 @@ void hash_begin(struct hash_device_data *device_data, struct hash_ctx *ctx) HASH_CLEAR_BITS(device_data-base-str, HASH_STR_NBLW_MASK); } -int hash_process_data( - struct hash_device_data *device_data, +static int hash_process_data(struct hash_device_data *device_data, struct hash_ctx *ctx, struct hash_req_ctx *req_ctx, int msg_length, u8 *data_buffer, u8 *buffer, u8 *index) { @@ -992,7 +991,7 @@ out: * hash_hw_final - The final hash calculation function * @req: The hash request for the job. */ -int hash_hw_final(struct ahash_request *req) +static int hash_hw_final(struct ahash_request *req) { int ret = 0; struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] dmaengine: ste_dma40: Declare memcpy config as static
On Fri, Jun 21, 2013 at 08:40:00AM +0530, Vinod Koul wrote: > On Thu, Jun 20, 2013 at 11:17:39AM +0200, Fabio Baltieri wrote: > > Fix sparse warnings: > > > > drivers/dma/ste_dma40.c:81:26: warning: symbol 'dma40_memcpy_conf_phy' was > > not declared. Should it be static? > > drivers/dma/ste_dma40.c:95:26: warning: symbol 'dma40_memcpy_conf_log' was > > not declared. Should it be static? > > > > Signed-off-by: Fabio Baltieri > Acked-by: Vinod Koul > > I guess this would be dependent on recent ste_dma40 patches so best way is > Linus's tree, right? Yes, but I'm not sure Linus is going to send a third pull request for dma40 so maybe I should just resend my last two dma40 patches for arm-soc directly. Thanks for the Ack. Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] dmaengine: ste_dma40: Declare memcpy config as static
On Fri, Jun 21, 2013 at 08:40:00AM +0530, Vinod Koul wrote: On Thu, Jun 20, 2013 at 11:17:39AM +0200, Fabio Baltieri wrote: Fix sparse warnings: drivers/dma/ste_dma40.c:81:26: warning: symbol 'dma40_memcpy_conf_phy' was not declared. Should it be static? drivers/dma/ste_dma40.c:95:26: warning: symbol 'dma40_memcpy_conf_log' was not declared. Should it be static? Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org Acked-by: Vinod Koul vinod.k...@intel.com I guess this would be dependent on recent ste_dma40 patches so best way is Linus's tree, right? Yes, but I'm not sure Linus is going to send a third pull request for dma40 so maybe I should just resend my last two dma40 patches for arm-soc directly. Thanks for the Ack. Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] dmaengine: ste_dma40: Declare memcpy config as static
Fix sparse warnings: drivers/dma/ste_dma40.c:81:26: warning: symbol 'dma40_memcpy_conf_phy' was not declared. Should it be static? drivers/dma/ste_dma40.c:95:26: warning: symbol 'dma40_memcpy_conf_log' was not declared. Should it be static? Signed-off-by: Fabio Baltieri --- Hi Linus, just a quick sparse error fixup on the dma driver. Thanks, Fabio drivers/dma/ste_dma40.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index fa4f9a3..8f72085 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -78,7 +78,7 @@ static int dma40_memcpy_channels[] = { }; /* Default configuration for physcial memcpy */ -struct stedma40_chan_cfg dma40_memcpy_conf_phy = { +static struct stedma40_chan_cfg dma40_memcpy_conf_phy = { .mode = STEDMA40_MODE_PHYSICAL, .dir = DMA_MEM_TO_MEM, @@ -92,7 +92,7 @@ struct stedma40_chan_cfg dma40_memcpy_conf_phy = { }; /* Default configuration for logical memcpy */ -struct stedma40_chan_cfg dma40_memcpy_conf_log = { +static struct stedma40_chan_cfg dma40_memcpy_conf_log = { .mode = STEDMA40_MODE_LOGICAL, .dir = DMA_MEM_TO_MEM, -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] pinctrl: abx500: fix abx500_gpio_get()
Hi Patrice, On Thu, Jun 20, 2013 at 09:24:44AM +0200, patrice.chotard...@gmail.com wrote: > From: Patrice Chotard > > _ allow to get output GPIO value. > _ as there is no GPIO0 on ABX500, use correct offset with > abx500_gpio_get_bit(). > > Signed-off-by: Patrice Chotard > --- > drivers/pinctrl/pinctrl-abx500.c | 16 ++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/pinctrl/pinctrl-abx500.c > b/drivers/pinctrl/pinctrl-abx500.c > index 4307b0f..070442d 100644 > --- a/drivers/pinctrl/pinctrl-abx500.c > +++ b/drivers/pinctrl/pinctrl-abx500.c > @@ -162,10 +162,22 @@ static int abx500_gpio_get(struct gpio_chip *chip, > unsigned offset) > { > struct abx500_pinctrl *pct = to_abx500_pinctrl(chip); > bool bit; > + bool is_out; > + u8 gpio_offset = offset - 1; > int ret; > > - ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG, > - offset, ); > + ret = abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG, gpio_offset, > _out); > + if (ret < 0) { > + dev_err(pct->dev, "%s failed\n", __func__); > + return ret; > + } > + > + if (is_out) > + ret = abx500_gpio_get_bit(chip, AB8500_GPIO_OUT1_REG, > + gpio_offset, ); > + else > + ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG, > + gpio_offset, ); Why would you want to read the pin state from the output register? The input one should be the one that reflect the real electrical value of the pin, and I think it may be useful to detect some fault condition too... Is there a specific reasion to use the output register instead? Thanks, Fabio > if (ret < 0) { > dev_err(pct->dev, "%s failed\n", __func__); > return ret; > -- > 1.7.10 > -- Fabio Baltieri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] pinctrl: abx500: fix abx500_pin_config_set()
On Thu, Jun 20, 2013 at 09:23:22AM +0200, patrice.chotard...@gmail.com wrote: > From: Patrice Chotard > > _ Update abx500_pin_config_set() in order to take in > account PIN_CONFIG_BIAS_DISABLE state to disable > pull up or pull down. > > _ Rework error path. > > Signed-off-by: Patrice Chotard > --- > drivers/pinctrl/pinctrl-abx500.c | 31 +-- > 1 file changed, 25 insertions(+), 6 deletions(-) > > diff --git a/drivers/pinctrl/pinctrl-abx500.c > b/drivers/pinctrl/pinctrl-abx500.c > index b5b5460..14dc078 100644 > --- a/drivers/pinctrl/pinctrl-abx500.c > +++ b/drivers/pinctrl/pinctrl-abx500.c > @@ -33,6 +33,7 @@ > #include > > #include "pinctrl-abx500.h" > +#include "core.h" > #include "pinconf.h" > > /* > @@ -963,7 +964,7 @@ static int abx500_pin_config_set(struct pinctrl_dev > *pctldev, > struct pullud *pullud = pct->soc->pullud; > struct gpio_chip *chip = >chip; > unsigned offset; > - int ret = 0; > + int ret = -EINVAL; > enum pin_config_param param = pinconf_to_config_param(config); > enum pin_config_param argument = pinconf_to_config_argument(config); > > @@ -976,13 +977,32 @@ static int abx500_pin_config_set(struct pinctrl_dev > *pctldev, > offset = pin - 1; > > switch (param) { > - case PIN_CONFIG_BIAS_PULL_DOWN: > + case PIN_CONFIG_BIAS_DISABLE: > + ret = abx500_gpio_direction_input(chip, offset); > /* > - * if argument = 1 set the pull down > - * else clear the pull down > + * Some chips only support pull down, while some actually > + * support both pull up and pull down. Such chips have > + * a "pullud" range specified for the pins that support > + * both features. If the pin is not within that range, we > + * fall back to the old bit set that only support pull down. >*/ > + if (pullud && > + pin >= pullud->first_pin && > + pin <= pullud->last_pin) This multi-line check is replicated in all conditions, would it make sense to move it on a dedicated function to improve readability? > + ret = abx500_set_pull_updown(pct, > + pin, > + ABX500_GPIO_PULL_NONE); > + else > + /* Chip only supports pull down */ > + ret = abx500_gpio_set_bits(chip, AB8500_GPIO_PUD1_REG, > + offset, ABX500_GPIO_PULL_NONE); > + break; > + > + case PIN_CONFIG_BIAS_PULL_DOWN: > ret = abx500_gpio_direction_input(chip, offset); > /* > + * if argument = 1 set the pull down > + * else clear the pull down >* Some chips only support pull down, while some actually >* support both pull up and pull down. Such chips have >* a "pullud" range specified for the pins that support > @@ -1002,6 +1022,7 @@ static int abx500_pin_config_set(struct pinctrl_dev > *pctldev, > break; > > case PIN_CONFIG_BIAS_PULL_UP: > + ret = abx500_gpio_direction_input(chip, offset); Here the return value of abx500_gpio_direction_input is set but never checked, and will be always overwritten by the next abx500_gpio_ call... Would it make sense to add a pr_err for it? On the other side, if it never fails, you can just drop the return field altogether. That's also done in other conditions in the same 'switch', it may make sense to have a patch just for that. Thanks, Fabio > /* >* if argument = 1 set the pull up >* else clear the pull up > @@ -1030,8 +1051,6 @@ static int abx500_pin_config_set(struct pinctrl_dev > *pctldev, > > default: > dev_err(chip->dev, "illegal configuration requested\n"); > - > - return -EINVAL; > } > > return ret; > -- > 1.7.10 > -- Fabio Baltieri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] pinctrl: abx500: Add device tree support
; + (*map)[*num_maps].type = PIN_MAP_TYPE_CONFIGS_PIN; > + > + (*map)[*num_maps].data.configs.group_or_pin = group; > + (*map)[*num_maps].data.configs.configs = dup_configs; > + (*map)[*num_maps].data.configs.num_configs = num_configs; > + (*num_maps)++; > + > + return 0; > +} > + > +static const char *abx500_find_pin_name(struct pinctrl_dev *pctldev, > + const char *pin_name) > +{ > + int i, pin_number; > + struct abx500_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); > + > + if (sscanf((char *)pin_name, "GPIO%d", _number) == 1) > + for (i = 0; i < npct->soc->npins; i++) > + if (npct->soc->pins[i].number == pin_number) > + return npct->soc->pins[i].name; > + return NULL; > +} > + > +int abx500_dt_subnode_to_map(struct pinctrl_dev *pctldev, Missing static? > + struct device_node *np, > + struct pinctrl_map **map, > + unsigned *reserved_maps, > + unsigned *num_maps) > +{ > + int ret; > + const char *function = NULL; > + unsigned long *configs; > + unsigned int nconfigs = 0; > + bool has_config = 0; > + unsigned reserve = 0; > + struct property *prop; > + const char *group, *gpio_name; > + struct device_node *np_config; > + > + ret = of_property_read_string(np, "ste,function", ); > + if (ret >= 0) > + reserve = 1; > + > + ret = pinconf_generic_parse_dt_config(np, , ); > + if (nconfigs) > + has_config = 1; > + > + np_config = of_parse_phandle(np, "ste,config", 0); > + if (np_config) { > + ret = pinconf_generic_parse_dt_config(np_config, , > + ); > + if (ret) > + goto exit; > + has_config |= nconfigs; > + } > + > + ret = of_property_count_strings(np, "ste,pins"); > + if (ret < 0) > + goto exit; > + > + if (has_config) > + reserve++; > + > + reserve *= ret; > + > + ret = abx500_dt_reserve_map(map, reserved_maps, num_maps, reserve); > + if (ret < 0) > + goto exit; > + > + of_property_for_each_string(np, "ste,pins", prop, group) { > + if (function) { > + ret = abx500_dt_add_map_mux(map, reserved_maps, > + num_maps, group, function); > + if (ret < 0) > + goto exit; > + } > + if (has_config) { > + gpio_name = abx500_find_pin_name(pctldev, group); > + > + ret = abx500_dt_add_map_configs(map, reserved_maps, > + num_maps, gpio_name, configs, 1); > + if (ret < 0) > + goto exit; > + } > + > + } > +exit: > + return ret; > +} > + > +int abx500_dt_node_to_map(struct pinctrl_dev *pctldev, Same here. Fabio > + struct device_node *np_config, > + struct pinctrl_map **map, unsigned *num_maps) > +{ > + unsigned reserved_maps; > + struct device_node *np; > + int ret; > + > + reserved_maps = 0; > + *map = NULL; > + *num_maps = 0; > + > + for_each_child_of_node(np_config, np) { > + ret = abx500_dt_subnode_to_map(pctldev, np, map, > + _maps, num_maps); > + if (ret < 0) { > + abx500_dt_free_map(pctldev, *map, *num_maps); > + return ret; > + } > + } > + > + return 0; > +} > + > static const struct pinctrl_ops abx500_pinctrl_ops = { > .get_groups_count = abx500_get_groups_cnt, > .get_group_name = abx500_get_group_name, > .get_group_pins = abx500_get_group_pins, > .pin_dbg_show = abx500_pin_dbg_show, > + .dt_node_to_map = abx500_dt_node_to_map, > + .dt_free_map = abx500_dt_free_map, > }; > > static int abx500_pin_config_get(struct pinctrl_dev *pctldev, > -- > 1.7.10 > -- Fabio Baltieri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] pinctrl: abx500: Add device tree support
); + if (ret 0) + goto exit; + } + + } +exit: + return ret; +} + +int abx500_dt_node_to_map(struct pinctrl_dev *pctldev, Same here. Fabio + struct device_node *np_config, + struct pinctrl_map **map, unsigned *num_maps) +{ + unsigned reserved_maps; + struct device_node *np; + int ret; + + reserved_maps = 0; + *map = NULL; + *num_maps = 0; + + for_each_child_of_node(np_config, np) { + ret = abx500_dt_subnode_to_map(pctldev, np, map, + reserved_maps, num_maps); + if (ret 0) { + abx500_dt_free_map(pctldev, *map, *num_maps); + return ret; + } + } + + return 0; +} + static const struct pinctrl_ops abx500_pinctrl_ops = { .get_groups_count = abx500_get_groups_cnt, .get_group_name = abx500_get_group_name, .get_group_pins = abx500_get_group_pins, .pin_dbg_show = abx500_pin_dbg_show, + .dt_node_to_map = abx500_dt_node_to_map, + .dt_free_map = abx500_dt_free_map, }; static int abx500_pin_config_get(struct pinctrl_dev *pctldev, -- 1.7.10 -- Fabio Baltieri -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] pinctrl: abx500: fix abx500_pin_config_set()
On Thu, Jun 20, 2013 at 09:23:22AM +0200, patrice.chotard...@gmail.com wrote: From: Patrice Chotard patrice.chot...@st.com _ Update abx500_pin_config_set() in order to take in account PIN_CONFIG_BIAS_DISABLE state to disable pull up or pull down. _ Rework error path. Signed-off-by: Patrice Chotard patrice.chot...@st.com --- drivers/pinctrl/pinctrl-abx500.c | 31 +-- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index b5b5460..14dc078 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c @@ -33,6 +33,7 @@ #include linux/pinctrl/machine.h #include pinctrl-abx500.h +#include core.h #include pinconf.h /* @@ -963,7 +964,7 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev, struct pullud *pullud = pct-soc-pullud; struct gpio_chip *chip = pct-chip; unsigned offset; - int ret = 0; + int ret = -EINVAL; enum pin_config_param param = pinconf_to_config_param(config); enum pin_config_param argument = pinconf_to_config_argument(config); @@ -976,13 +977,32 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev, offset = pin - 1; switch (param) { - case PIN_CONFIG_BIAS_PULL_DOWN: + case PIN_CONFIG_BIAS_DISABLE: + ret = abx500_gpio_direction_input(chip, offset); /* - * if argument = 1 set the pull down - * else clear the pull down + * Some chips only support pull down, while some actually + * support both pull up and pull down. Such chips have + * a pullud range specified for the pins that support + * both features. If the pin is not within that range, we + * fall back to the old bit set that only support pull down. */ + if (pullud + pin = pullud-first_pin + pin = pullud-last_pin) This multi-line check is replicated in all conditions, would it make sense to move it on a dedicated function to improve readability? + ret = abx500_set_pull_updown(pct, + pin, + ABX500_GPIO_PULL_NONE); + else + /* Chip only supports pull down */ + ret = abx500_gpio_set_bits(chip, AB8500_GPIO_PUD1_REG, + offset, ABX500_GPIO_PULL_NONE); + break; + + case PIN_CONFIG_BIAS_PULL_DOWN: ret = abx500_gpio_direction_input(chip, offset); /* + * if argument = 1 set the pull down + * else clear the pull down * Some chips only support pull down, while some actually * support both pull up and pull down. Such chips have * a pullud range specified for the pins that support @@ -1002,6 +1022,7 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev, break; case PIN_CONFIG_BIAS_PULL_UP: + ret = abx500_gpio_direction_input(chip, offset); Here the return value of abx500_gpio_direction_input is set but never checked, and will be always overwritten by the next abx500_gpio_ call... Would it make sense to add a pr_err for it? On the other side, if it never fails, you can just drop the return field altogether. That's also done in other conditions in the same 'switch', it may make sense to have a patch just for that. Thanks, Fabio /* * if argument = 1 set the pull up * else clear the pull up @@ -1030,8 +1051,6 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev, default: dev_err(chip-dev, illegal configuration requested\n); - - return -EINVAL; } return ret; -- 1.7.10 -- Fabio Baltieri -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] pinctrl: abx500: fix abx500_gpio_get()
Hi Patrice, On Thu, Jun 20, 2013 at 09:24:44AM +0200, patrice.chotard...@gmail.com wrote: From: Patrice Chotard patrice.chot...@st.com _ allow to get output GPIO value. _ as there is no GPIO0 on ABX500, use correct offset with abx500_gpio_get_bit(). Signed-off-by: Patrice Chotard patrice.chot...@st.com --- drivers/pinctrl/pinctrl-abx500.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index 4307b0f..070442d 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c @@ -162,10 +162,22 @@ static int abx500_gpio_get(struct gpio_chip *chip, unsigned offset) { struct abx500_pinctrl *pct = to_abx500_pinctrl(chip); bool bit; + bool is_out; + u8 gpio_offset = offset - 1; int ret; - ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG, - offset, bit); + ret = abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG, gpio_offset, is_out); + if (ret 0) { + dev_err(pct-dev, %s failed\n, __func__); + return ret; + } + + if (is_out) + ret = abx500_gpio_get_bit(chip, AB8500_GPIO_OUT1_REG, + gpio_offset, bit); + else + ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG, + gpio_offset, bit); Why would you want to read the pin state from the output register? The input one should be the one that reflect the real electrical value of the pin, and I think it may be useful to detect some fault condition too... Is there a specific reasion to use the output register instead? Thanks, Fabio if (ret 0) { dev_err(pct-dev, %s failed\n, __func__); return ret; -- 1.7.10 -- Fabio Baltieri -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] dmaengine: ste_dma40: Declare memcpy config as static
Fix sparse warnings: drivers/dma/ste_dma40.c:81:26: warning: symbol 'dma40_memcpy_conf_phy' was not declared. Should it be static? drivers/dma/ste_dma40.c:95:26: warning: symbol 'dma40_memcpy_conf_log' was not declared. Should it be static? Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- Hi Linus, just a quick sparse error fixup on the dma driver. Thanks, Fabio drivers/dma/ste_dma40.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index fa4f9a3..8f72085 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -78,7 +78,7 @@ static int dma40_memcpy_channels[] = { }; /* Default configuration for physcial memcpy */ -struct stedma40_chan_cfg dma40_memcpy_conf_phy = { +static struct stedma40_chan_cfg dma40_memcpy_conf_phy = { .mode = STEDMA40_MODE_PHYSICAL, .dir = DMA_MEM_TO_MEM, @@ -92,7 +92,7 @@ struct stedma40_chan_cfg dma40_memcpy_conf_phy = { }; /* Default configuration for logical memcpy */ -struct stedma40_chan_cfg dma40_memcpy_conf_log = { +static struct stedma40_chan_cfg dma40_memcpy_conf_log = { .mode = STEDMA40_MODE_LOGICAL, .dir = DMA_MEM_TO_MEM, -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ARM: ux500: set coherent_dma_mask for dma40
On Mon, Jun 17, 2013 at 05:42:48PM +0200, Linus Walleij wrote: > On Thu, Jun 13, 2013 at 3:56 PM, Fabio Baltieri > wrote: > > > Set coherent_dma_mask to DMA_BIT_MASK(32) for dma40 platform_device, as > > without this DMA allocations were failing with the error: > > > > dma40 dma40.0: coherent DMA mask is unset > > > > when booting without device-tree. > > > > Signed-off-by: Fabio Baltieri > > --- > > > > Hi Linus, Lee, > > > > I found this while removing the last hack I was keeping in my ASoC tree. > > I originally thought that I had to set this on the driver's pdata, but > > it turns out it's needed on the DMA controller one instead. > > > > When booting with device-tree enabled the mask seems to be set > > automatically. > > > > Would you consider applying this with the other dma40 patches? > > Those are now upstream in the ARM SoC tree, you'd have to send it > to a...@kernel.org and ask Olof/Arnd to apply it directly to > the next/drivers branch (I think). Ok I can resend it but I'd like to have Lee's Ack before doing that. Lee: have you had a chance to look at this patch? > I have also queued it on ux500-fixes so it won't be lost. That's nice! Thanks, Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ARM: ux500: set coherent_dma_mask for dma40
On Mon, Jun 17, 2013 at 05:42:48PM +0200, Linus Walleij wrote: On Thu, Jun 13, 2013 at 3:56 PM, Fabio Baltieri fabio.balti...@linaro.org wrote: Set coherent_dma_mask to DMA_BIT_MASK(32) for dma40 platform_device, as without this DMA allocations were failing with the error: dma40 dma40.0: coherent DMA mask is unset when booting without device-tree. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- Hi Linus, Lee, I found this while removing the last hack I was keeping in my ASoC tree. I originally thought that I had to set this on the driver's pdata, but it turns out it's needed on the DMA controller one instead. When booting with device-tree enabled the mask seems to be set automatically. Would you consider applying this with the other dma40 patches? Those are now upstream in the ARM SoC tree, you'd have to send it to a...@kernel.org and ask Olof/Arnd to apply it directly to the next/drivers branch (I think). Ok I can resend it but I'd like to have Lee's Ack before doing that. Lee: have you had a chance to look at this patch? I have also queued it on ux500-fixes so it won't be lost. That's nice! Thanks, Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] spi: pl022: remove unused ret and pins_state variables
Removes the warnings: drivers/spi/spi-pl022.c: In function 'pl022_suspend_resources': drivers/spi/spi-pl022.c:2322:24: warning: unused variable 'pins_state' [-Wunused-variable] drivers/spi/spi-pl022.c:2321:6: warning: unused variable 'ret' [-Wunused-variable] drivers/spi/spi-pl022.c: In function 'pl022_resume_resources': drivers/spi/spi-pl022.c:2334:6: warning: unused variable 'ret' [-Wunused-variable] introduced in: f1c9cf0 spi: pl022: use pinctrl PM helpers Signed-off-by: Fabio Baltieri --- Hi Linus, this is just a quick build warning fixup patch found while playing with today's linux-next, should apply cleanly on pinctrl/for-next. Thanks, Fabio drivers/spi/spi-pl022.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 9652189..abef061 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -2318,9 +2318,6 @@ pl022_remove(struct amba_device *adev) */ static void pl022_suspend_resources(struct pl022 *pl022, bool runtime) { - int ret; - struct pinctrl_state *pins_state; - clk_disable(pl022->clk); if (runtime) @@ -2331,8 +2328,6 @@ static void pl022_suspend_resources(struct pl022 *pl022, bool runtime) static void pl022_resume_resources(struct pl022 *pl022, bool runtime) { - int ret; - /* First go to the default state */ pinctrl_pm_select_default_state(>adev->dev); if (!runtime) -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] spi: pl022: remove unused ret and pins_state variables
Removes the warnings: drivers/spi/spi-pl022.c: In function 'pl022_suspend_resources': drivers/spi/spi-pl022.c:2322:24: warning: unused variable 'pins_state' [-Wunused-variable] drivers/spi/spi-pl022.c:2321:6: warning: unused variable 'ret' [-Wunused-variable] drivers/spi/spi-pl022.c: In function 'pl022_resume_resources': drivers/spi/spi-pl022.c:2334:6: warning: unused variable 'ret' [-Wunused-variable] introduced in: f1c9cf0 spi: pl022: use pinctrl PM helpers Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- Hi Linus, this is just a quick build warning fixup patch found while playing with today's linux-next, should apply cleanly on pinctrl/for-next. Thanks, Fabio drivers/spi/spi-pl022.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 9652189..abef061 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -2318,9 +2318,6 @@ pl022_remove(struct amba_device *adev) */ static void pl022_suspend_resources(struct pl022 *pl022, bool runtime) { - int ret; - struct pinctrl_state *pins_state; - clk_disable(pl022-clk); if (runtime) @@ -2331,8 +2328,6 @@ static void pl022_suspend_resources(struct pl022 *pl022, bool runtime) static void pl022_resume_resources(struct pl022 *pl022, bool runtime) { - int ret; - /* First go to the default state */ pinctrl_pm_select_default_state(pl022-adev-dev); if (!runtime) -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: ux500: add restart support via prcmu
Add necessary code to restart ux500 based machines using prcmu_system_reset(). Signed-off-by: Fabio Baltieri --- Hi Linus, this is something I had in my tree for some time. This adds basic soft-reboot support for all ux500 machines using prcmu (the actual reboot code was already there) and may also be useful as a base to add the remaining "reboot reason" code if necessary. This is based on your current ste-next branch. Thanks, Fabio arch/arm/mach-ux500/board-mop500.c | 4 arch/arm/mach-ux500/cpu-db8500.c | 1 + arch/arm/mach-ux500/cpu.c | 8 arch/arm/mach-ux500/setup.h| 2 ++ 4 files changed, 15 insertions(+) diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index 2d70e2b..bb569bf 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c @@ -697,6 +697,7 @@ MACHINE_START(U8500, "ST-Ericsson MOP500 platform") .init_time = ux500_timer_init, .init_machine = mop500_init_machine, .init_late = ux500_init_late, + .restart= ux500_restart, MACHINE_END MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520") @@ -706,6 +707,7 @@ MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520") .init_time = ux500_timer_init, .init_machine = mop500_init_machine, .init_late = ux500_init_late, + .restart= ux500_restart, MACHINE_END MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+") @@ -716,6 +718,7 @@ MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+") .init_time = ux500_timer_init, .init_machine = hrefv60_init_machine, .init_late = ux500_init_late, + .restart= ux500_restart, MACHINE_END MACHINE_START(SNOWBALL, "Calao Systems Snowball platform") @@ -727,4 +730,5 @@ MACHINE_START(SNOWBALL, "Calao Systems Snowball platform") .init_time = ux500_timer_init, .init_machine = snowball_init_machine, .init_late = NULL, + .restart= ux500_restart, MACHINE_END diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 27e5566..caded58 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c @@ -326,6 +326,7 @@ DT_MACHINE_START(U8500_DT, "ST-Ericsson Ux5x0 platform (Device Tree Support)") .init_machine = u8500_init_machine, .init_late = NULL, .dt_compat = stericsson_dt_platform_compat, + .restart= ux500_restart, MACHINE_END #endif diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c index b6145ea..7490224 100644 --- a/arch/arm/mach-ux500/cpu.c +++ b/arch/arm/mach-ux500/cpu.c @@ -31,6 +31,14 @@ #include "db8500-regs.h" #include "id.h" +void ux500_restart(char mode, const char *cmd) +{ + local_irq_disable(); + local_fiq_disable(); + + prcmu_system_reset(0); +} + /* * FIXME: Should we set up the GPIO domain here? * diff --git a/arch/arm/mach-ux500/setup.h b/arch/arm/mach-ux500/setup.h index cad3ca8..e8be021 100644 --- a/arch/arm/mach-ux500/setup.h +++ b/arch/arm/mach-ux500/setup.h @@ -15,6 +15,8 @@ #include #include +void ux500_restart(char mode, const char *cmd); + void __init ux500_map_io(void); extern void __init u8500_map_io(void); -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: ux500: add restart support via prcmu
Add necessary code to restart ux500 based machines using prcmu_system_reset(). Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- Hi Linus, this is something I had in my tree for some time. This adds basic soft-reboot support for all ux500 machines using prcmu (the actual reboot code was already there) and may also be useful as a base to add the remaining reboot reason code if necessary. This is based on your current ste-next branch. Thanks, Fabio arch/arm/mach-ux500/board-mop500.c | 4 arch/arm/mach-ux500/cpu-db8500.c | 1 + arch/arm/mach-ux500/cpu.c | 8 arch/arm/mach-ux500/setup.h| 2 ++ 4 files changed, 15 insertions(+) diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index 2d70e2b..bb569bf 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c @@ -697,6 +697,7 @@ MACHINE_START(U8500, ST-Ericsson MOP500 platform) .init_time = ux500_timer_init, .init_machine = mop500_init_machine, .init_late = ux500_init_late, + .restart= ux500_restart, MACHINE_END MACHINE_START(U8520, ST-Ericsson U8520 Platform HREFP520) @@ -706,6 +707,7 @@ MACHINE_START(U8520, ST-Ericsson U8520 Platform HREFP520) .init_time = ux500_timer_init, .init_machine = mop500_init_machine, .init_late = ux500_init_late, + .restart= ux500_restart, MACHINE_END MACHINE_START(HREFV60, ST-Ericsson U8500 Platform HREFv60+) @@ -716,6 +718,7 @@ MACHINE_START(HREFV60, ST-Ericsson U8500 Platform HREFv60+) .init_time = ux500_timer_init, .init_machine = hrefv60_init_machine, .init_late = ux500_init_late, + .restart= ux500_restart, MACHINE_END MACHINE_START(SNOWBALL, Calao Systems Snowball platform) @@ -727,4 +730,5 @@ MACHINE_START(SNOWBALL, Calao Systems Snowball platform) .init_time = ux500_timer_init, .init_machine = snowball_init_machine, .init_late = NULL, + .restart= ux500_restart, MACHINE_END diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 27e5566..caded58 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c @@ -326,6 +326,7 @@ DT_MACHINE_START(U8500_DT, ST-Ericsson Ux5x0 platform (Device Tree Support)) .init_machine = u8500_init_machine, .init_late = NULL, .dt_compat = stericsson_dt_platform_compat, + .restart= ux500_restart, MACHINE_END #endif diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c index b6145ea..7490224 100644 --- a/arch/arm/mach-ux500/cpu.c +++ b/arch/arm/mach-ux500/cpu.c @@ -31,6 +31,14 @@ #include db8500-regs.h #include id.h +void ux500_restart(char mode, const char *cmd) +{ + local_irq_disable(); + local_fiq_disable(); + + prcmu_system_reset(0); +} + /* * FIXME: Should we set up the GPIO domain here? * diff --git a/arch/arm/mach-ux500/setup.h b/arch/arm/mach-ux500/setup.h index cad3ca8..e8be021 100644 --- a/arch/arm/mach-ux500/setup.h +++ b/arch/arm/mach-ux500/setup.h @@ -15,6 +15,8 @@ #include linux/init.h #include linux/mfd/abx500/ab8500.h +void ux500_restart(char mode, const char *cmd); + void __init ux500_map_io(void); extern void __init u8500_map_io(void); -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: ux500: set coherent_dma_mask for dma40
Set coherent_dma_mask to DMA_BIT_MASK(32) for dma40 platform_device, as without this DMA allocations were failing with the error: dma40 dma40.0: coherent DMA mask is unset when booting without device-tree. Signed-off-by: Fabio Baltieri --- Hi Linus, Lee, I found this while removing the last hack I was keeping in my ASoC tree. I originally thought that I had to set this on the driver's pdata, but it turns out it's needed on the DMA controller one instead. When booting with device-tree enabled the mask seems to be set automatically. Would you consider applying this with the other dma40 patches? Thanks, Fabio arch/arm/mach-ux500/devices-db8500.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c index e21ffd8..fa8f7a5 100644 --- a/arch/arm/mach-ux500/devices-db8500.c +++ b/arch/arm/mach-ux500/devices-db8500.c @@ -49,6 +49,7 @@ struct stedma40_platform_data dma40_plat_data = { struct platform_device u8500_dma40_device = { .dev = { .platform_data = _plat_data, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .name = "dma40", .id = 0, -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: ux500: set coherent_dma_mask for dma40
Set coherent_dma_mask to DMA_BIT_MASK(32) for dma40 platform_device, as without this DMA allocations were failing with the error: dma40 dma40.0: coherent DMA mask is unset when booting without device-tree. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- Hi Linus, Lee, I found this while removing the last hack I was keeping in my ASoC tree. I originally thought that I had to set this on the driver's pdata, but it turns out it's needed on the DMA controller one instead. When booting with device-tree enabled the mask seems to be set automatically. Would you consider applying this with the other dma40 patches? Thanks, Fabio arch/arm/mach-ux500/devices-db8500.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c index e21ffd8..fa8f7a5 100644 --- a/arch/arm/mach-ux500/devices-db8500.c +++ b/arch/arm/mach-ux500/devices-db8500.c @@ -49,6 +49,7 @@ struct stedma40_platform_data dma40_plat_data = { struct platform_device u8500_dma40_device = { .dev = { .platform_data = dma40_plat_data, + .coherent_dma_mask = DMA_BIT_MASK(32), }, .name = dma40, .id = 0, -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] ASoC: ux500: Set DMA address during device init
Add a field with the tx/rx register address to the DMA parameters structure, and set it to the correct address during device initialization. This address used to be hardcoded in the DMA controller driver, it now needs to be explicitly figured out by the device driver. Signed-off-by: Fabio Baltieri --- sound/soc/ux500/ux500_msp_i2s.c | 3 +++ sound/soc/ux500/ux500_msp_i2s.h | 1 + 2 files changed, 4 insertions(+) diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index 14a4a5b..1ca8b08 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -685,6 +685,9 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, return -ENOMEM; } + msp->playback_dma_data.tx_rx_addr = res->start + MSP_DR; + msp->capture_dma_data.tx_rx_addr = res->start + MSP_DR; + msp->registers = devm_ioremap(>dev, res->start, resource_size(res)); if (msp->registers == NULL) { diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h index 8796171..258d0bc 100644 --- a/sound/soc/ux500/ux500_msp_i2s.h +++ b/sound/soc/ux500/ux500_msp_i2s.h @@ -470,6 +470,7 @@ struct ux500_msp_config { struct ux500_msp_dma_params { unsigned int data_size; + dma_addr_t tx_rx_addr; struct stedma40_chan_cfg *dma_cfg; }; -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] ASoC: ux500: Add DMA slave config prepare routine
Implement a DMA slave config prepare routine, as until now the MSP driver depended on the DMA controller completing the channel configuration on its own, but this is not the case anymore since the recent DMA driver updates. Signed-off-by: Fabio Baltieri --- sound/soc/ux500/ux500_pcm.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c index b6e5ae2..5f01c19 100644 --- a/sound/soc/ux500/ux500_pcm.c +++ b/sound/soc/ux500/ux500_pcm.c @@ -103,10 +103,40 @@ static struct dma_chan *ux500_pcm_request_chan(struct snd_soc_pcm_runtime *rtd, return snd_dmaengine_pcm_request_channel(stedma40_filter, dma_cfg); } +static int ux500_pcm_prepare_slave_config(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct dma_slave_config *slave_config) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct ux500_msp_dma_params *dma_params; + struct stedma40_chan_cfg *dma_cfg; + int ret; + + dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); + dma_cfg = dma_params->dma_cfg; + + ret = snd_hwparams_to_dma_slave_config(substream, params, slave_config); + if (ret) + return ret; + + slave_config->dst_maxburst = 4; + slave_config->dst_addr_width = dma_cfg->dst_info.data_width; + slave_config->src_maxburst = 4; + slave_config->src_addr_width = dma_cfg->src_info.data_width; + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + slave_config->dst_addr = dma_params->tx_rx_addr; + else + slave_config->src_addr = dma_params->tx_rx_addr; + + return 0; +} + static const struct snd_dmaengine_pcm_config ux500_dmaengine_pcm_config = { .pcm_hardware = _pcm_hw, .compat_request_channel = ux500_pcm_request_chan, .prealloc_buffer_size = 128 * 1024, + .prepare_slave_config = ux500_pcm_prepare_slave_config, }; int ux500_pcm_register_platform(struct platform_device *pdev) -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] ASoC: ux500: Move DMA parameters into ux500_msp
Move struct ux500_msp_dma_params declaration from ux500_msp_i2s_drvdata to ux500_msp, this saves some confusing pointer passing and allows to access all DMA configuration fields from ux500_msp_i2s. Signed-off-by: Fabio Baltieri --- sound/soc/ux500/ux500_msp_dai.c | 11 --- sound/soc/ux500/ux500_msp_dai.h | 2 -- sound/soc/ux500/ux500_msp_i2s.c | 10 ++ sound/soc/ux500/ux500_msp_i2s.h | 14 +++--- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index 7d5fc13..c6fb5cc 100644 --- a/sound/soc/ux500/ux500_msp_dai.c +++ b/sound/soc/ux500/ux500_msp_dai.c @@ -658,14 +658,11 @@ static int ux500_msp_dai_probe(struct snd_soc_dai *dai) { struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); - drvdata->playback_dma_data.dma_cfg = drvdata->msp->dma_cfg_tx; - drvdata->capture_dma_data.dma_cfg = drvdata->msp->dma_cfg_rx; + dai->playback_dma_data = >msp->playback_dma_data; + dai->capture_dma_data = >msp->capture_dma_data; - dai->playback_dma_data = >playback_dma_data; - dai->capture_dma_data = >capture_dma_data; - - drvdata->playback_dma_data.data_size = drvdata->slot_width; - drvdata->capture_dma_data.data_size = drvdata->slot_width; + drvdata->msp->playback_dma_data.data_size = drvdata->slot_width; + drvdata->msp->capture_dma_data.data_size = drvdata->slot_width; return 0; } diff --git a/sound/soc/ux500/ux500_msp_dai.h b/sound/soc/ux500/ux500_msp_dai.h index c721282..312ae53 100644 --- a/sound/soc/ux500/ux500_msp_dai.h +++ b/sound/soc/ux500/ux500_msp_dai.h @@ -51,8 +51,6 @@ enum ux500_msp_clock_id { struct ux500_msp_i2s_drvdata { struct ux500_msp *msp; struct regulator *reg_vape; - struct ux500_msp_dma_params playback_dma_data; - struct ux500_msp_dma_params capture_dma_data; unsigned int fmt; unsigned int tx_mask; unsigned int rx_mask; diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index cba0e86..14a4a5b 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -367,12 +367,14 @@ static int enable_msp(struct ux500_msp *msp, struct ux500_msp_config *config) } /* Make sure the correct DMA-directions are configured */ - if ((config->direction & MSP_DIR_RX) && (!msp->dma_cfg_rx)) { + if ((config->direction & MSP_DIR_RX) && + !msp->capture_dma_data.dma_cfg) { dev_err(msp->dev, "%s: ERROR: MSP RX-mode is not configured!", __func__); return -EINVAL; } - if ((config->direction == MSP_DIR_TX) && (!msp->dma_cfg_tx)) { + if ((config->direction == MSP_DIR_TX) && + !msp->playback_dma_data.dma_cfg) { dev_err(msp->dev, "%s: ERROR: MSP TX-mode is not configured!", __func__); return -EINVAL; @@ -673,8 +675,8 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, msp->id = platform_data->id; msp->dev = >dev; - msp->dma_cfg_rx = platform_data->msp_i2s_dma_rx; - msp->dma_cfg_tx = platform_data->msp_i2s_dma_tx; + msp->playback_dma_data.dma_cfg = platform_data->msp_i2s_dma_tx; + msp->capture_dma_data.dma_cfg = platform_data->msp_i2s_dma_rx; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res == NULL) { diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h index 189a375..8796171 100644 --- a/sound/soc/ux500/ux500_msp_i2s.h +++ b/sound/soc/ux500/ux500_msp_i2s.h @@ -468,12 +468,17 @@ struct ux500_msp_config { unsigned int iodelay; }; +struct ux500_msp_dma_params { + unsigned int data_size; + struct stedma40_chan_cfg *dma_cfg; +}; + struct ux500_msp { enum msp_i2s_id id; void __iomem *registers; struct device *dev; - struct stedma40_chan_cfg *dma_cfg_rx; - struct stedma40_chan_cfg *dma_cfg_tx; + struct ux500_msp_dma_params playback_dma_data; + struct ux500_msp_dma_params capture_dma_data; enum msp_state msp_state; int def_elem_len; unsigned int dir_busy; @@ -481,11 +486,6 @@ struct ux500_msp { unsigned int f_bitclk; }; -struct ux500_msp_dma_params { - unsigned int data_size; - struct stedma40_chan_cfg *dma_cfg; -}; - struct msp_i2s_platform_data; int ux500_msp_i2s_init_msp(struct platform_device *pdev, struct ux500_msp **msp_p, -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/3] DMA fixes for ux500 ASoC driver
Hi Mark, The DMA driver used on ux500 has been recently reworked to make it device-tree capable, but the rework required to drop some "features", such as opportunistic channel allocation and hardcoded addresses, that the ASoC driver was relying upon. This series fixes the audio driver to make it work with the current dma40 implementation, and works fine even when booting with device-tree. Would you consider merging these for asoc/topic/ux500? Thanks, Fabio Fabio Baltieri (3): ASoC: ux500: Move DMA parameters into ux500_msp ASoC: ux500: Set DMA address during device init ASoC: ux500: Add DMA slave config prepare routine sound/soc/ux500/ux500_msp_dai.c | 11 --- sound/soc/ux500/ux500_msp_dai.h | 2 -- sound/soc/ux500/ux500_msp_i2s.c | 13 + sound/soc/ux500/ux500_msp_i2s.h | 15 --- sound/soc/ux500/ux500_pcm.c | 30 ++ 5 files changed, 51 insertions(+), 20 deletions(-) -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/3] DMA fixes for ux500 ASoC driver
Hi Mark, The DMA driver used on ux500 has been recently reworked to make it device-tree capable, but the rework required to drop some features, such as opportunistic channel allocation and hardcoded addresses, that the ASoC driver was relying upon. This series fixes the audio driver to make it work with the current dma40 implementation, and works fine even when booting with device-tree. Would you consider merging these for asoc/topic/ux500? Thanks, Fabio Fabio Baltieri (3): ASoC: ux500: Move DMA parameters into ux500_msp ASoC: ux500: Set DMA address during device init ASoC: ux500: Add DMA slave config prepare routine sound/soc/ux500/ux500_msp_dai.c | 11 --- sound/soc/ux500/ux500_msp_dai.h | 2 -- sound/soc/ux500/ux500_msp_i2s.c | 13 + sound/soc/ux500/ux500_msp_i2s.h | 15 --- sound/soc/ux500/ux500_pcm.c | 30 ++ 5 files changed, 51 insertions(+), 20 deletions(-) -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] ASoC: ux500: Add DMA slave config prepare routine
Implement a DMA slave config prepare routine, as until now the MSP driver depended on the DMA controller completing the channel configuration on its own, but this is not the case anymore since the recent DMA driver updates. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- sound/soc/ux500/ux500_pcm.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c index b6e5ae2..5f01c19 100644 --- a/sound/soc/ux500/ux500_pcm.c +++ b/sound/soc/ux500/ux500_pcm.c @@ -103,10 +103,40 @@ static struct dma_chan *ux500_pcm_request_chan(struct snd_soc_pcm_runtime *rtd, return snd_dmaengine_pcm_request_channel(stedma40_filter, dma_cfg); } +static int ux500_pcm_prepare_slave_config(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct dma_slave_config *slave_config) +{ + struct snd_soc_pcm_runtime *rtd = substream-private_data; + struct ux500_msp_dma_params *dma_params; + struct stedma40_chan_cfg *dma_cfg; + int ret; + + dma_params = snd_soc_dai_get_dma_data(rtd-cpu_dai, substream); + dma_cfg = dma_params-dma_cfg; + + ret = snd_hwparams_to_dma_slave_config(substream, params, slave_config); + if (ret) + return ret; + + slave_config-dst_maxburst = 4; + slave_config-dst_addr_width = dma_cfg-dst_info.data_width; + slave_config-src_maxburst = 4; + slave_config-src_addr_width = dma_cfg-src_info.data_width; + + if (substream-stream == SNDRV_PCM_STREAM_PLAYBACK) + slave_config-dst_addr = dma_params-tx_rx_addr; + else + slave_config-src_addr = dma_params-tx_rx_addr; + + return 0; +} + static const struct snd_dmaengine_pcm_config ux500_dmaengine_pcm_config = { .pcm_hardware = ux500_pcm_hw, .compat_request_channel = ux500_pcm_request_chan, .prealloc_buffer_size = 128 * 1024, + .prepare_slave_config = ux500_pcm_prepare_slave_config, }; int ux500_pcm_register_platform(struct platform_device *pdev) -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] ASoC: ux500: Move DMA parameters into ux500_msp
Move struct ux500_msp_dma_params declaration from ux500_msp_i2s_drvdata to ux500_msp, this saves some confusing pointer passing and allows to access all DMA configuration fields from ux500_msp_i2s. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- sound/soc/ux500/ux500_msp_dai.c | 11 --- sound/soc/ux500/ux500_msp_dai.h | 2 -- sound/soc/ux500/ux500_msp_i2s.c | 10 ++ sound/soc/ux500/ux500_msp_i2s.h | 14 +++--- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index 7d5fc13..c6fb5cc 100644 --- a/sound/soc/ux500/ux500_msp_dai.c +++ b/sound/soc/ux500/ux500_msp_dai.c @@ -658,14 +658,11 @@ static int ux500_msp_dai_probe(struct snd_soc_dai *dai) { struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai-dev); - drvdata-playback_dma_data.dma_cfg = drvdata-msp-dma_cfg_tx; - drvdata-capture_dma_data.dma_cfg = drvdata-msp-dma_cfg_rx; + dai-playback_dma_data = drvdata-msp-playback_dma_data; + dai-capture_dma_data = drvdata-msp-capture_dma_data; - dai-playback_dma_data = drvdata-playback_dma_data; - dai-capture_dma_data = drvdata-capture_dma_data; - - drvdata-playback_dma_data.data_size = drvdata-slot_width; - drvdata-capture_dma_data.data_size = drvdata-slot_width; + drvdata-msp-playback_dma_data.data_size = drvdata-slot_width; + drvdata-msp-capture_dma_data.data_size = drvdata-slot_width; return 0; } diff --git a/sound/soc/ux500/ux500_msp_dai.h b/sound/soc/ux500/ux500_msp_dai.h index c721282..312ae53 100644 --- a/sound/soc/ux500/ux500_msp_dai.h +++ b/sound/soc/ux500/ux500_msp_dai.h @@ -51,8 +51,6 @@ enum ux500_msp_clock_id { struct ux500_msp_i2s_drvdata { struct ux500_msp *msp; struct regulator *reg_vape; - struct ux500_msp_dma_params playback_dma_data; - struct ux500_msp_dma_params capture_dma_data; unsigned int fmt; unsigned int tx_mask; unsigned int rx_mask; diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index cba0e86..14a4a5b 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -367,12 +367,14 @@ static int enable_msp(struct ux500_msp *msp, struct ux500_msp_config *config) } /* Make sure the correct DMA-directions are configured */ - if ((config-direction MSP_DIR_RX) (!msp-dma_cfg_rx)) { + if ((config-direction MSP_DIR_RX) + !msp-capture_dma_data.dma_cfg) { dev_err(msp-dev, %s: ERROR: MSP RX-mode is not configured!, __func__); return -EINVAL; } - if ((config-direction == MSP_DIR_TX) (!msp-dma_cfg_tx)) { + if ((config-direction == MSP_DIR_TX) + !msp-playback_dma_data.dma_cfg) { dev_err(msp-dev, %s: ERROR: MSP TX-mode is not configured!, __func__); return -EINVAL; @@ -673,8 +675,8 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, msp-id = platform_data-id; msp-dev = pdev-dev; - msp-dma_cfg_rx = platform_data-msp_i2s_dma_rx; - msp-dma_cfg_tx = platform_data-msp_i2s_dma_tx; + msp-playback_dma_data.dma_cfg = platform_data-msp_i2s_dma_tx; + msp-capture_dma_data.dma_cfg = platform_data-msp_i2s_dma_rx; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res == NULL) { diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h index 189a375..8796171 100644 --- a/sound/soc/ux500/ux500_msp_i2s.h +++ b/sound/soc/ux500/ux500_msp_i2s.h @@ -468,12 +468,17 @@ struct ux500_msp_config { unsigned int iodelay; }; +struct ux500_msp_dma_params { + unsigned int data_size; + struct stedma40_chan_cfg *dma_cfg; +}; + struct ux500_msp { enum msp_i2s_id id; void __iomem *registers; struct device *dev; - struct stedma40_chan_cfg *dma_cfg_rx; - struct stedma40_chan_cfg *dma_cfg_tx; + struct ux500_msp_dma_params playback_dma_data; + struct ux500_msp_dma_params capture_dma_data; enum msp_state msp_state; int def_elem_len; unsigned int dir_busy; @@ -481,11 +486,6 @@ struct ux500_msp { unsigned int f_bitclk; }; -struct ux500_msp_dma_params { - unsigned int data_size; - struct stedma40_chan_cfg *dma_cfg; -}; - struct msp_i2s_platform_data; int ux500_msp_i2s_init_msp(struct platform_device *pdev, struct ux500_msp **msp_p, -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] ASoC: ux500: Set DMA address during device init
Add a field with the tx/rx register address to the DMA parameters structure, and set it to the correct address during device initialization. This address used to be hardcoded in the DMA controller driver, it now needs to be explicitly figured out by the device driver. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- sound/soc/ux500/ux500_msp_i2s.c | 3 +++ sound/soc/ux500/ux500_msp_i2s.h | 1 + 2 files changed, 4 insertions(+) diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index 14a4a5b..1ca8b08 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -685,6 +685,9 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, return -ENOMEM; } + msp-playback_dma_data.tx_rx_addr = res-start + MSP_DR; + msp-capture_dma_data.tx_rx_addr = res-start + MSP_DR; + msp-registers = devm_ioremap(pdev-dev, res-start, resource_size(res)); if (msp-registers == NULL) { diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h index 8796171..258d0bc 100644 --- a/sound/soc/ux500/ux500_msp_i2s.h +++ b/sound/soc/ux500/ux500_msp_i2s.h @@ -470,6 +470,7 @@ struct ux500_msp_config { struct ux500_msp_dma_params { unsigned int data_size; + dma_addr_t tx_rx_addr; struct stedma40_chan_cfg *dma_cfg; }; -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/5] ARM: ux500: Provide auxdata to ux500 ASoC driver
On Tue, Jun 04, 2013 at 11:03:41AM +0200, Linus Walleij wrote: > On Thu, May 30, 2013 at 3:27 PM, Fabio Baltieri > wrote: > > > Ux500 ASoC driver is expected to have a specific device name to get > > clock resources correctly. This patch provides the necessary > > OF_DEV_AUXDATA to match the name in DT and non-DT cases. > > > > Signed-off-by: Fabio Baltieri > > Patch applied to my ux500-devicetree branch after some rebasing. Thanks! I saw that a lot patches are stacking up in the tree, do you plan to send an intermediate pull request to get these on arm-soc/for-next (and linux-next)? Thanks, Fabio > > Yours, > Linus Walleij > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- Fabio Baltieri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/5] ARM: ux500: Provide auxdata to ux500 ASoC driver
On Tue, Jun 04, 2013 at 11:03:41AM +0200, Linus Walleij wrote: On Thu, May 30, 2013 at 3:27 PM, Fabio Baltieri fabio.balti...@linaro.org wrote: Ux500 ASoC driver is expected to have a specific device name to get clock resources correctly. This patch provides the necessary OF_DEV_AUXDATA to match the name in DT and non-DT cases. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org Patch applied to my ux500-devicetree branch after some rebasing. Thanks! I saw that a lot patches are stacking up in the tree, do you plan to send an intermediate pull request to get these on arm-soc/for-next (and linux-next)? Thanks, Fabio Yours, Linus Walleij -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ -- Fabio Baltieri -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/5] ARM: ux500: Correct anamic2 typo in DT files
Fix typo of VAMIC2 LDO regulator name in some DT-related files. This patch replaces all occurrences with the right name. Signed-off-by: Fabio Baltieri --- arch/arm/boot/dts/dbx5x0.dtsi | 4 ++-- arch/arm/boot/dts/href.dtsi | 2 +- arch/arm/boot/dts/hrefv60plus.dts | 2 +- arch/arm/boot/dts/snowball.dts| 2 +- drivers/regulator/ab8500.c| 8 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi index e6ea7ba..d0b6e32 100644 --- a/arch/arm/boot/dts/dbx5x0.dtsi +++ b/arch/arm/boot/dts/dbx5x0.dtsi @@ -466,8 +466,8 @@ }; // supply for v-amic2; VAMIC2 LDO; reuse constants for AMIC1 - ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { - regulator-compatible = "ab8500_ldo_amamic2"; + ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 { + regulator-compatible = "ab8500_ldo_anamic2"; }; // supply for v-dmic; VDMIC LDO diff --git a/arch/arm/boot/dts/href.dtsi b/arch/arm/boot/dts/href.dtsi index c0bc426..4a53c48 100644 --- a/arch/arm/boot/dts/href.dtsi +++ b/arch/arm/boot/dts/href.dtsi @@ -256,7 +256,7 @@ regulator-name = "V-AMIC1"; }; - ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { + ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 { regulator-name = "V-AMIC2"; }; diff --git a/arch/arm/boot/dts/hrefv60plus.dts b/arch/arm/boot/dts/hrefv60plus.dts index 2b587a7..4f04af8 100644 --- a/arch/arm/boot/dts/hrefv60plus.dts +++ b/arch/arm/boot/dts/hrefv60plus.dts @@ -192,7 +192,7 @@ regulator-name = "V-AMIC1"; }; - ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { + ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 { regulator-name = "V-AMIC2"; }; diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts index db5db24..557d75e 100644 --- a/arch/arm/boot/dts/snowball.dts +++ b/arch/arm/boot/dts/snowball.dts @@ -336,7 +336,7 @@ regulator-name = "V-AMIC1"; }; - ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { + ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 { regulator-name = "V-AMIC2"; }; diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index f6656b8..a19045e 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -2901,7 +2901,7 @@ static struct of_regulator_match ab8500_regulator_match[] = { { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8500_LDO_TVOUT, }, { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8500_LDO_AUDIO, }, { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8500_LDO_ANAMIC1, }, - { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8500_LDO_ANAMIC2, }, + { .name = "ab8500_ldo_anamic2", .driver_data = (void *) AB8500_LDO_ANAMIC2, }, { .name = "ab8500_ldo_dmic",.driver_data = (void *) AB8500_LDO_DMIC, }, { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8500_LDO_ANA, }, }; @@ -2917,7 +2917,7 @@ static struct of_regulator_match ab8505_regulator_match[] = { { .name = "ab8500_ldo_adc", .driver_data = (void *) AB8505_LDO_ADC, }, { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8505_LDO_AUDIO, }, { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8505_LDO_ANAMIC1, }, - { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8505_LDO_ANAMIC2, }, + { .name = "ab8500_ldo_anamic2", .driver_data = (void *) AB8505_LDO_ANAMIC2, }, { .name = "ab8500_ldo_aux8",.driver_data = (void *) AB8505_LDO_AUX8, }, { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8505_LDO_ANA, }, }; @@ -2933,7 +2933,7 @@ static struct of_regulator_match ab8540_regulator_match[] = { { .name = "ab8500_ldo_
[PATCH 4/5] ARM: ux500: Provide auxdata to ux500 ASoC driver
Ux500 ASoC driver is expected to have a specific device name to get clock resources correctly. This patch provides the necessary OF_DEV_AUXDATA to match the name in DT and non-DT cases. Signed-off-by: Fabio Baltieri --- arch/arm/mach-ux500/cpu-db8500.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 46cca52..fb3d5a2 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c @@ -277,6 +277,8 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", _prcmu_pdata), OF_DEV_AUXDATA("smsc,lan9115", 0x5000, "smsc911x.0", NULL), + OF_DEV_AUXDATA("stericsson,snd-soc-mop500", 0, "snd-soc-mop500.0", + NULL), /* Requires device name bindings. */ OF_DEV_AUXDATA("stericsson,nmk-pinctrl", U8500_PRCMU_BASE, "pinctrl-db8500", NULL), -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/5] mfd: ab8500-core: Add of_compatible property for ab8500-codec
Add of_compatible string to the ab8500-codec cell to allow the driver to grab handlers such as regulators from device-tree when available. Signed-off-by: Fabio Baltieri --- drivers/mfd/ab8500-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index 1863985..3efb356 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -1120,6 +1120,7 @@ static struct mfd_cell ab8500_devs[] = { }, { .name = "ab8500-codec", + .of_compatible = "stericsson,ab8500-codec", }, }; -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/5] ARM: ux500: Add DT regulators for ab8500-codec
Add regulator DT bindings for the ab8500-codec driver. Signed-off-by: Fabio Baltieri --- arch/arm/boot/dts/dbx5x0.dtsi | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi index d0b6e32..8e14042 100644 --- a/arch/arm/boot/dts/dbx5x0.dtsi +++ b/arch/arm/boot/dts/dbx5x0.dtsi @@ -410,6 +410,11 @@ codec: ab8500-codec { compatible = "stericsson,ab8500-codec"; + V-AUD-supply = <_ldo_audio_reg>; + V-AMIC1-supply = <_ldo_anamic1_reg>; + V-AMIC2-supply = <_ldo_anamic2_reg>; + V-DMIC-supply = <_ldo_dmic_reg>; + stericsson,earpeice-cmv = <950>; /* Units in mV. */ }; -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/5] ARM: ux500: Fix trivial typo in v-anamic1 comment
Fix VAMIC1 LDO comment in DT files to be make it coherent with the others. Signed-off-by: Fabio Baltieri --- arch/arm/boot/dts/dbx5x0.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi index b6bc4ff..e6ea7ba 100644 --- a/arch/arm/boot/dts/dbx5x0.dtsi +++ b/arch/arm/boot/dts/dbx5x0.dtsi @@ -460,7 +460,7 @@ regulator-compatible = "ab8500_ldo_audio"; }; - // supply for v-anamic1 VAMic1-LDO + // supply for v-anamic1 VAMIC1 LDO ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 { regulator-compatible = "ab8500_ldo_anamic1"; }; -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/5] Various DT fixes related to ux500 ASoC driver
Hi Linus, Lee, these are various fixes I found while testing the ux500 ASoC driver on HREF with device-tree. First two patches are typos in DT files, while the others are specifically to support ux500 ASoC driver with DT enabled. The last patch can go in the mfd tree, while the others may safely go through arm-soc, as there are no build dependencies or regression issues in general. Thanks, Fabio Fabio Baltieri (5): ARM: ux500: Fix trivial typo in v-anamic1 comment ARM: ux500: Correct anamic2 typo in DT files ARM: ux500: Add DT regulators for ab8500-codec ARM: ux500: Provide auxdata to ux500 ASoC driver mfd: ab8500-core: Add of_compatible property for ab8500-codec arch/arm/boot/dts/dbx5x0.dtsi | 11 --- arch/arm/boot/dts/href.dtsi | 2 +- arch/arm/boot/dts/hrefv60plus.dts | 2 +- arch/arm/boot/dts/snowball.dts| 2 +- arch/arm/mach-ux500/cpu-db8500.c | 2 ++ drivers/mfd/ab8500-core.c | 1 + drivers/regulator/ab8500.c| 8 7 files changed, 18 insertions(+), 10 deletions(-) -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/5] Various DT fixes related to ux500 ASoC driver
Hi Linus, Lee, these are various fixes I found while testing the ux500 ASoC driver on HREF with device-tree. First two patches are typos in DT files, while the others are specifically to support ux500 ASoC driver with DT enabled. The last patch can go in the mfd tree, while the others may safely go through arm-soc, as there are no build dependencies or regression issues in general. Thanks, Fabio Fabio Baltieri (5): ARM: ux500: Fix trivial typo in v-anamic1 comment ARM: ux500: Correct anamic2 typo in DT files ARM: ux500: Add DT regulators for ab8500-codec ARM: ux500: Provide auxdata to ux500 ASoC driver mfd: ab8500-core: Add of_compatible property for ab8500-codec arch/arm/boot/dts/dbx5x0.dtsi | 11 --- arch/arm/boot/dts/href.dtsi | 2 +- arch/arm/boot/dts/hrefv60plus.dts | 2 +- arch/arm/boot/dts/snowball.dts| 2 +- arch/arm/mach-ux500/cpu-db8500.c | 2 ++ drivers/mfd/ab8500-core.c | 1 + drivers/regulator/ab8500.c| 8 7 files changed, 18 insertions(+), 10 deletions(-) -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/5] ARM: ux500: Fix trivial typo in v-anamic1 comment
Fix VAMIC1 LDO comment in DT files to be make it coherent with the others. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- arch/arm/boot/dts/dbx5x0.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi index b6bc4ff..e6ea7ba 100644 --- a/arch/arm/boot/dts/dbx5x0.dtsi +++ b/arch/arm/boot/dts/dbx5x0.dtsi @@ -460,7 +460,7 @@ regulator-compatible = ab8500_ldo_audio; }; - // supply for v-anamic1 VAMic1-LDO + // supply for v-anamic1 VAMIC1 LDO ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 { regulator-compatible = ab8500_ldo_anamic1; }; -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/5] ARM: ux500: Add DT regulators for ab8500-codec
Add regulator DT bindings for the ab8500-codec driver. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- arch/arm/boot/dts/dbx5x0.dtsi | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi index d0b6e32..8e14042 100644 --- a/arch/arm/boot/dts/dbx5x0.dtsi +++ b/arch/arm/boot/dts/dbx5x0.dtsi @@ -410,6 +410,11 @@ codec: ab8500-codec { compatible = stericsson,ab8500-codec; + V-AUD-supply = ab8500_ldo_audio_reg; + V-AMIC1-supply = ab8500_ldo_anamic1_reg; + V-AMIC2-supply = ab8500_ldo_anamic2_reg; + V-DMIC-supply = ab8500_ldo_dmic_reg; + stericsson,earpeice-cmv = 950; /* Units in mV. */ }; -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/5] mfd: ab8500-core: Add of_compatible property for ab8500-codec
Add of_compatible string to the ab8500-codec cell to allow the driver to grab handlers such as regulators from device-tree when available. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- drivers/mfd/ab8500-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index 1863985..3efb356 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -1120,6 +1120,7 @@ static struct mfd_cell ab8500_devs[] = { }, { .name = ab8500-codec, + .of_compatible = stericsson,ab8500-codec, }, }; -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/5] ARM: ux500: Provide auxdata to ux500 ASoC driver
Ux500 ASoC driver is expected to have a specific device name to get clock resources correctly. This patch provides the necessary OF_DEV_AUXDATA to match the name in DT and non-DT cases. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- arch/arm/mach-ux500/cpu-db8500.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 46cca52..fb3d5a2 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c @@ -277,6 +277,8 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { OF_DEV_AUXDATA(stericsson,db8500-prcmu, 0x80157000, db8500-prcmu, db8500_prcmu_pdata), OF_DEV_AUXDATA(smsc,lan9115, 0x5000, smsc911x.0, NULL), + OF_DEV_AUXDATA(stericsson,snd-soc-mop500, 0, snd-soc-mop500.0, + NULL), /* Requires device name bindings. */ OF_DEV_AUXDATA(stericsson,nmk-pinctrl, U8500_PRCMU_BASE, pinctrl-db8500, NULL), -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/5] ARM: ux500: Correct anamic2 typo in DT files
Fix typo of VAMIC2 LDO regulator name in some DT-related files. This patch replaces all occurrences with the right name. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- arch/arm/boot/dts/dbx5x0.dtsi | 4 ++-- arch/arm/boot/dts/href.dtsi | 2 +- arch/arm/boot/dts/hrefv60plus.dts | 2 +- arch/arm/boot/dts/snowball.dts| 2 +- drivers/regulator/ab8500.c| 8 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi index e6ea7ba..d0b6e32 100644 --- a/arch/arm/boot/dts/dbx5x0.dtsi +++ b/arch/arm/boot/dts/dbx5x0.dtsi @@ -466,8 +466,8 @@ }; // supply for v-amic2; VAMIC2 LDO; reuse constants for AMIC1 - ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { - regulator-compatible = ab8500_ldo_amamic2; + ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 { + regulator-compatible = ab8500_ldo_anamic2; }; // supply for v-dmic; VDMIC LDO diff --git a/arch/arm/boot/dts/href.dtsi b/arch/arm/boot/dts/href.dtsi index c0bc426..4a53c48 100644 --- a/arch/arm/boot/dts/href.dtsi +++ b/arch/arm/boot/dts/href.dtsi @@ -256,7 +256,7 @@ regulator-name = V-AMIC1; }; - ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { + ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 { regulator-name = V-AMIC2; }; diff --git a/arch/arm/boot/dts/hrefv60plus.dts b/arch/arm/boot/dts/hrefv60plus.dts index 2b587a7..4f04af8 100644 --- a/arch/arm/boot/dts/hrefv60plus.dts +++ b/arch/arm/boot/dts/hrefv60plus.dts @@ -192,7 +192,7 @@ regulator-name = V-AMIC1; }; - ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { + ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 { regulator-name = V-AMIC2; }; diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts index db5db24..557d75e 100644 --- a/arch/arm/boot/dts/snowball.dts +++ b/arch/arm/boot/dts/snowball.dts @@ -336,7 +336,7 @@ regulator-name = V-AMIC1; }; - ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { + ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 { regulator-name = V-AMIC2; }; diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index f6656b8..a19045e 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -2901,7 +2901,7 @@ static struct of_regulator_match ab8500_regulator_match[] = { { .name = ab8500_ldo_tvout, .driver_data = (void *) AB8500_LDO_TVOUT, }, { .name = ab8500_ldo_audio, .driver_data = (void *) AB8500_LDO_AUDIO, }, { .name = ab8500_ldo_anamic1, .driver_data = (void *) AB8500_LDO_ANAMIC1, }, - { .name = ab8500_ldo_amamic2, .driver_data = (void *) AB8500_LDO_ANAMIC2, }, + { .name = ab8500_ldo_anamic2, .driver_data = (void *) AB8500_LDO_ANAMIC2, }, { .name = ab8500_ldo_dmic,.driver_data = (void *) AB8500_LDO_DMIC, }, { .name = ab8500_ldo_ana, .driver_data = (void *) AB8500_LDO_ANA, }, }; @@ -2917,7 +2917,7 @@ static struct of_regulator_match ab8505_regulator_match[] = { { .name = ab8500_ldo_adc, .driver_data = (void *) AB8505_LDO_ADC, }, { .name = ab8500_ldo_audio, .driver_data = (void *) AB8505_LDO_AUDIO, }, { .name = ab8500_ldo_anamic1, .driver_data = (void *) AB8505_LDO_ANAMIC1, }, - { .name = ab8500_ldo_amamic2, .driver_data = (void *) AB8505_LDO_ANAMIC2, }, + { .name = ab8500_ldo_anamic2, .driver_data = (void *) AB8505_LDO_ANAMIC2, }, { .name = ab8500_ldo_aux8,.driver_data = (void *) AB8505_LDO_AUX8, }, { .name = ab8500_ldo_ana, .driver_data = (void *) AB8505_LDO_ANA, }, }; @@ -2933,7 +2933,7 @@ static struct of_regulator_match ab8540_regulator_match[] = { { .name = ab8500_ldo_tvout, .driver_data = (void *) AB8540_LDO_TVOUT, }, { .name = ab8500_ldo_audio, .driver_data = (void *) AB8540_LDO_AUDIO, }, { .name = ab8500_ldo_anamic1, .driver_data = (void *) AB8540_LDO_ANAMIC1, }, - { .name
[PATCH] ASoC: ux500: Ensure consistent configuration between DAIs
Current implementation of mop500_ab8500 allows for inconsistent sample rate and channel count configuration between the playback and recording interfaces, through in the hardware the two MSP controllers share common clock and frame sync signals. This patch adds the necessary code to ensure that the two device are configure consistently. The check is added at machine driver level, as how to lock DAI configuration depend of the actual hardware implementation. Signed-off-by: Fabio Baltieri --- sound/soc/ux500/mop500_ab8500.c | 35 +++ 1 file changed, 35 insertions(+) diff --git a/sound/soc/ux500/mop500_ab8500.c b/sound/soc/ux500/mop500_ab8500.c index 5e0f146..7e923ec 100644 --- a/sound/soc/ux500/mop500_ab8500.c +++ b/sound/soc/ux500/mop500_ab8500.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -44,6 +45,12 @@ static unsigned int tx_slots = DEF_TX_SLOTS; static unsigned int rx_slots = DEF_RX_SLOTS; +/* Configuration consistency parameters */ +static DEFINE_MUTEX(mop500_ab8500_params_lock); +static unsigned long mop500_ab8500_usage; +static int mop500_ab8500_rate; +static int mop500_ab8500_channels; + /* Clocks */ static const char * const enum_mclk[] = { "SYSCLK", @@ -231,6 +238,21 @@ static int mop500_ab8500_hw_params(struct snd_pcm_substream *substream, substream->name, substream->number); + /* Ensure configuration consistency between DAIs */ + mutex_lock(_ab8500_params_lock); + if (mop500_ab8500_usage) { + if (mop500_ab8500_rate != params_rate(params) || + mop500_ab8500_channels != params_channels(params)) { + mutex_unlock(_ab8500_params_lock); + return -EBUSY; + } + } else { + mop500_ab8500_rate = params_rate(params); + mop500_ab8500_channels = params_channels(params); + } + __set_bit(cpu_dai->id, _ab8500_usage); + mutex_unlock(_ab8500_params_lock); + channels = params_channels(params); switch (params_format(params)) { @@ -329,9 +351,22 @@ static int mop500_ab8500_hw_params(struct snd_pcm_substream *substream, return 0; } +static int mop500_ab8500_hw_free(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + + mutex_lock(_ab8500_params_lock); + __clear_bit(cpu_dai->id, _ab8500_usage); + mutex_unlock(_ab8500_params_lock); + + return 0; +} + struct snd_soc_ops mop500_ab8500_ops[] = { { .hw_params = mop500_ab8500_hw_params, + .hw_free = mop500_ab8500_hw_free, .startup = mop500_ab8500_startup, .shutdown = mop500_ab8500_shutdown, } -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ASoC: ux500: Ensure consistent configuration between DAIs
Current implementation of mop500_ab8500 allows for inconsistent sample rate and channel count configuration between the playback and recording interfaces, through in the hardware the two MSP controllers share common clock and frame sync signals. This patch adds the necessary code to ensure that the two device are configure consistently. The check is added at machine driver level, as how to lock DAI configuration depend of the actual hardware implementation. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- sound/soc/ux500/mop500_ab8500.c | 35 +++ 1 file changed, 35 insertions(+) diff --git a/sound/soc/ux500/mop500_ab8500.c b/sound/soc/ux500/mop500_ab8500.c index 5e0f146..7e923ec 100644 --- a/sound/soc/ux500/mop500_ab8500.c +++ b/sound/soc/ux500/mop500_ab8500.c @@ -16,6 +16,7 @@ #include linux/device.h #include linux/io.h #include linux/clk.h +#include linux/mutex.h #include sound/soc.h #include sound/soc-dapm.h @@ -44,6 +45,12 @@ static unsigned int tx_slots = DEF_TX_SLOTS; static unsigned int rx_slots = DEF_RX_SLOTS; +/* Configuration consistency parameters */ +static DEFINE_MUTEX(mop500_ab8500_params_lock); +static unsigned long mop500_ab8500_usage; +static int mop500_ab8500_rate; +static int mop500_ab8500_channels; + /* Clocks */ static const char * const enum_mclk[] = { SYSCLK, @@ -231,6 +238,21 @@ static int mop500_ab8500_hw_params(struct snd_pcm_substream *substream, substream-name, substream-number); + /* Ensure configuration consistency between DAIs */ + mutex_lock(mop500_ab8500_params_lock); + if (mop500_ab8500_usage) { + if (mop500_ab8500_rate != params_rate(params) || + mop500_ab8500_channels != params_channels(params)) { + mutex_unlock(mop500_ab8500_params_lock); + return -EBUSY; + } + } else { + mop500_ab8500_rate = params_rate(params); + mop500_ab8500_channels = params_channels(params); + } + __set_bit(cpu_dai-id, mop500_ab8500_usage); + mutex_unlock(mop500_ab8500_params_lock); + channels = params_channels(params); switch (params_format(params)) { @@ -329,9 +351,22 @@ static int mop500_ab8500_hw_params(struct snd_pcm_substream *substream, return 0; } +static int mop500_ab8500_hw_free(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream-private_data; + struct snd_soc_dai *cpu_dai = rtd-cpu_dai; + + mutex_lock(mop500_ab8500_params_lock); + __clear_bit(cpu_dai-id, mop500_ab8500_usage); + mutex_unlock(mop500_ab8500_params_lock); + + return 0; +} + struct snd_soc_ops mop500_ab8500_ops[] = { { .hw_params = mop500_ab8500_hw_params, + .hw_free = mop500_ab8500_hw_free, .startup = mop500_ab8500_startup, .shutdown = mop500_ab8500_shutdown, } -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ARM: ux500: select SND_SOC_UX500 for ux500
On Mon, May 27, 2013 at 01:44:38PM +0200, Linus Walleij wrote: > On Fri, May 24, 2013 at 3:28 PM, Fabio Baltieri > wrote: > > > Enable ux500 specific ALSA SoC drivers by default on u8500_defconfig. > > > > Signed-off-by: Fabio Baltieri > > Thanks, patch applied to my defconfig branch. > > Now I can finally use the Snowball board to run sidplay. Glad to be of help! :-) Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ARM: ux500: select SND_SOC_UX500 for ux500
On Mon, May 27, 2013 at 01:44:38PM +0200, Linus Walleij wrote: On Fri, May 24, 2013 at 3:28 PM, Fabio Baltieri fabio.balti...@linaro.org wrote: Enable ux500 specific ALSA SoC drivers by default on u8500_defconfig. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org Thanks, patch applied to my defconfig branch. Now I can finally use the Snowball board to run sidplay. Glad to be of help! :-) Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: ux500: select SND_SOC_UX500 for ux500
Enable ux500 specific ALSA SoC drivers by default on u8500_defconfig. Signed-off-by: Fabio Baltieri --- Hi Linus, As I noticed that you just updated your ux500-defconfig branch, and the ux500 sound driver should be working fine in the next kernel, I'm sending a patch to enable it by default. This applies on top of your recent commit "ARM: ux500: update defconfig base". Thanks, Fabio arch/arm/configs/u8500_defconfig | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig index da0614a..da353e0 100644 --- a/arch/arm/configs/u8500_defconfig +++ b/arch/arm/configs/u8500_defconfig @@ -69,6 +69,11 @@ CONFIG_MFD_STMPE=y CONFIG_MFD_TC3589X=y CONFIG_REGULATOR_GPIO=y CONFIG_REGULATOR_AB8500=y +CONFIG_SOUND=y +CONFIG_SND=y +CONFIG_SND_SOC=y +CONFIG_SND_SOC_UX500=y +CONFIG_SND_SOC_UX500_MACH_MOP500=y CONFIG_USB=y CONFIG_USB_MUSB_HDRC=y CONFIG_USB_MUSB_UX500=y -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/6] ASoC: ux500: Drop dangling struct i2s_controller
Drop struct i2s_controller from the ux500 ASoC driver as right now it is instantiated but not used anywhere. Also drop a mismatched device_unregister in the process. Signed-off-by: Fabio Baltieri --- sound/soc/ux500/ux500_msp_i2s.c | 19 --- sound/soc/ux500/ux500_msp_i2s.h | 12 2 files changed, 31 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index b029b2d..cba0e86 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -649,7 +649,6 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, struct msp_i2s_platform_data *platform_data) { struct resource *res = NULL; - struct i2s_controller *i2s_cont; struct device_node *np = pdev->dev.of_node; struct ux500_msp *msp; @@ -694,22 +693,6 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, msp->msp_state = MSP_STATE_IDLE; msp->loopback_enable = 0; - /* I2S-controller is allocated and added in I2S controller class. */ - i2s_cont = devm_kzalloc(>dev, sizeof(*i2s_cont), GFP_KERNEL); - if (!i2s_cont) { - dev_err(>dev, - "%s: ERROR: Failed to allocate I2S-controller!\n", - __func__); - return -ENOMEM; - } - i2s_cont->dev.parent = >dev; - i2s_cont->data = (void *)msp; - i2s_cont->id = (s16)msp->id; - snprintf(i2s_cont->name, sizeof(i2s_cont->name), "ux500-msp-i2s.%04x", - msp->id); - dev_dbg(>dev, "I2S device-name: '%s'\n", i2s_cont->name); - msp->i2s_cont = i2s_cont; - return 0; } @@ -717,8 +700,6 @@ void ux500_msp_i2s_cleanup_msp(struct platform_device *pdev, struct ux500_msp *msp) { dev_dbg(msp->dev, "%s: Enter (id = %d).\n", __func__, msp->id); - - device_unregister(>i2s_cont->dev); } MODULE_LICENSE("GPL v2"); diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h index 8ce014e..ccfcc32 100644 --- a/sound/soc/ux500/ux500_msp_i2s.h +++ b/sound/soc/ux500/ux500_msp_i2s.h @@ -469,17 +469,6 @@ struct i2s_message { size_t period_len; }; -struct i2s_controller { - struct module *owner; - unsigned int id; - unsigned int class; - const struct i2s_algorithm *algo; /* the algorithm to access the bus */ - void *data; - struct mutex bus_lock; - struct device dev; /* the controller device */ - char name[48]; -}; - struct ux500_msp_config { unsigned int f_inputclk; unsigned int rx_clk_sel; @@ -515,7 +504,6 @@ struct ux500_msp { enum enum_i2s_controller id; void __iomem *registers; struct device *dev; - struct i2s_controller *i2s_cont; struct stedma40_chan_cfg *dma_cfg_rx; struct stedma40_chan_cfg *dma_cfg_tx; struct dma_chan *tx_pipeid; -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/6] ASoC: ab8500-codec: Move codec ops on a separate structure
Define ab8500 codec operations structure on its own rather than inline with snd_soc_dai_drivers to clean up the code and make the style coherent with other codec drivers. Signed-off-by: Fabio Baltieri --- sound/soc/codecs/ab8500-codec.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c index 4ca45b9..b8ba0ad 100644 --- a/sound/soc/codecs/ab8500-codec.c +++ b/sound/soc/codecs/ab8500-codec.c @@ -2380,6 +2380,11 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, return 0; } +static const struct snd_soc_dai_ops ab8500_codec_ops = { + .set_fmt = ab8500_codec_set_dai_fmt, + .set_tdm_slot = ab8500_codec_set_dai_tdm_slot, +}; + static struct snd_soc_dai_driver ab8500_codec_dai[] = { { .name = "ab8500-codec-dai.0", @@ -2391,12 +2396,7 @@ static struct snd_soc_dai_driver ab8500_codec_dai[] = { .rates = AB8500_SUPPORTED_RATE, .formats = AB8500_SUPPORTED_FMT, }, - .ops = (struct snd_soc_dai_ops[]) { - { - .set_tdm_slot = ab8500_codec_set_dai_tdm_slot, - .set_fmt = ab8500_codec_set_dai_fmt, - } - }, + .ops = _codec_ops, .symmetric_rates = 1 }, { @@ -2409,12 +2409,7 @@ static struct snd_soc_dai_driver ab8500_codec_dai[] = { .rates = AB8500_SUPPORTED_RATE, .formats = AB8500_SUPPORTED_FMT, }, - .ops = (struct snd_soc_dai_ops[]) { - { - .set_tdm_slot = ab8500_codec_set_dai_tdm_slot, - .set_fmt = ab8500_codec_set_dai_fmt, - } - }, + .ops = _codec_ops, .symmetric_rates = 1 } }; -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/6] ASoC: ux500: Drop pinctrl sleep support
Drop pinctrl default/sleep state switching code, as it was breaking the capture interface by putting the I2S pins in hi-z mode regardless of its usage status, and not giving any real benefit. Pinctrl default mode configuration is already managed automatically by a specific pinctrl hog. Signed-off-by: Fabio Baltieri --- sound/soc/ux500/ux500_msp_i2s.c | 56 ++--- sound/soc/ux500/ux500_msp_i2s.h | 6 - 2 files changed, 2 insertions(+), 60 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index f2db6c9..b029b2d 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -26,9 +25,6 @@ #include "ux500_msp_i2s.h" -/* MSP1/3 Tx/Rx usage protection */ -static DEFINE_SPINLOCK(msp_rxtx_lock); - /* Protocol desciptors */ static const struct msp_protdesc prot_descs[] = { { /* I2S */ @@ -356,24 +352,8 @@ static int configure_multichannel(struct ux500_msp *msp, static int enable_msp(struct ux500_msp *msp, struct ux500_msp_config *config) { - int status = 0, retval = 0; + int status = 0; u32 reg_val_DMACR, reg_val_GCR; - unsigned long flags; - - /* Check msp state whether in RUN or CONFIGURED Mode */ - if (msp->msp_state == MSP_STATE_IDLE) { - spin_lock_irqsave(_rxtx_lock, flags); - if (msp->pinctrl_rxtx_ref == 0 && - !(IS_ERR(msp->pinctrl_p) || IS_ERR(msp->pinctrl_def))) { - retval = pinctrl_select_state(msp->pinctrl_p, - msp->pinctrl_def); - if (retval) - pr_err("could not set MSP defstate\n"); - } - if (!retval) - msp->pinctrl_rxtx_ref++; - spin_unlock_irqrestore(_rxtx_lock, flags); - } /* Configure msp with protocol dependent settings */ configure_protocol(msp, config); @@ -630,8 +610,7 @@ int ux500_msp_i2s_trigger(struct ux500_msp *msp, int cmd, int direction) int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir) { - int status = 0, retval = 0; - unsigned long flags; + int status = 0; dev_dbg(msp->dev, "%s: Enter (dir = 0x%01x).\n", __func__, dir); @@ -643,18 +622,6 @@ int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir) (~(FRAME_GEN_ENABLE | SRG_ENABLE))), msp->registers + MSP_GCR); - spin_lock_irqsave(_rxtx_lock, flags); - WARN_ON(!msp->pinctrl_rxtx_ref); - msp->pinctrl_rxtx_ref--; - if (msp->pinctrl_rxtx_ref == 0 && - !(IS_ERR(msp->pinctrl_p) || IS_ERR(msp->pinctrl_sleep))) { - retval = pinctrl_select_state(msp->pinctrl_p, - msp->pinctrl_sleep); - if (retval) - pr_err("could not set MSP sleepstate\n"); - } - spin_unlock_irqrestore(_rxtx_lock, flags); - writel(0, msp->registers + MSP_GCR); writel(0, msp->registers + MSP_TCF); writel(0, msp->registers + MSP_RCF); @@ -743,25 +710,6 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, dev_dbg(>dev, "I2S device-name: '%s'\n", i2s_cont->name); msp->i2s_cont = i2s_cont; - msp->pinctrl_p = pinctrl_get(msp->dev); - if (IS_ERR(msp->pinctrl_p)) - dev_err(>dev, "could not get MSP pinctrl\n"); - else { - msp->pinctrl_def = pinctrl_lookup_state(msp->pinctrl_p, - PINCTRL_STATE_DEFAULT); - if (IS_ERR(msp->pinctrl_def)) { - dev_err(>dev, - "could not get MSP defstate (%li)\n", - PTR_ERR(msp->pinctrl_def)); - } - msp->pinctrl_sleep = pinctrl_lookup_state(msp->pinctrl_p, - PINCTRL_STATE_SLEEP); - if (IS_ERR(msp->pinctrl_sleep)) - dev_err(>dev, - "could not get MSP idlestate (%li)\n", - PTR_ERR(msp->pinctrl_def)); - } - return 0; } diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h index e5cd105..8ce014e 100644 --- a/sound/soc/ux500/ux500_msp_i2s.h +++ b/sound/soc/ux500/ux500_msp_i2s.h @@ -528,12 +528,6 @@ struct ux500_msp { int loopback_enable;
[PATCH 6/6] ASoC: ux500: Drop redundant msp id enumerations
Ux500 has two equivalent enum for device id, one in platform_data and one in a local header. Fix this by dropping the local one. Signed-off-by: Fabio Baltieri --- sound/soc/ux500/ux500_msp_i2s.h | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h index d5e4176..189a375 100644 --- a/sound/soc/ux500/ux500_msp_i2s.h +++ b/sound/soc/ux500/ux500_msp_i2s.h @@ -16,6 +16,7 @@ #define UX500_MSP_I2S_H #include +#include #define MSP_INPUT_FREQ_APB 4800 @@ -365,13 +366,6 @@ enum msp_protocol { */ #define MAX_MSP_BACKUP_REGS 36 -enum enum_i2s_controller { - MSP_0_I2S_CONTROLLER = 0, - MSP_1_I2S_CONTROLLER, - MSP_2_I2S_CONTROLLER, - MSP_3_I2S_CONTROLLER, -}; - enum i2s_direction_t { MSP_DIR_TX = 0x01, MSP_DIR_RX = 0x02, @@ -475,7 +469,7 @@ struct ux500_msp_config { }; struct ux500_msp { - enum enum_i2s_controller id; + enum msp_i2s_id id; void __iomem *registers; struct device *dev; struct stedma40_chan_cfg *dma_cfg_rx; -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/6] ASoC: ux500: Add missing mop500_ab8500.h include
Add a missing include that was resulting in some sparse warning for non-static structure without forward declaration. Signed-off-by: Fabio Baltieri --- sound/soc/ux500/mop500_ab8500.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/ux500/mop500_ab8500.c b/sound/soc/ux500/mop500_ab8500.c index 884a362..5e0f146 100644 --- a/sound/soc/ux500/mop500_ab8500.c +++ b/sound/soc/ux500/mop500_ab8500.c @@ -24,6 +24,7 @@ #include "ux500_pcm.h" #include "ux500_msp_dai.h" +#include "mop500_ab8500.h" #include "../codecs/ab8500-codec.h" #define TX_SLOT_MONO 0x0008 -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/6] ASoC: ux500: Drop unused code from msp headers
Drop unused fields and structures from ux500_msp_i2s header file, as those looks like leftover from a previous implementation of the driver. Signed-off-by: Fabio Baltieri --- sound/soc/ux500/ux500_msp_dai.h | 2 -- sound/soc/ux500/ux500_msp_i2s.h | 31 --- 2 files changed, 33 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_dai.h b/sound/soc/ux500/ux500_msp_dai.h index f531043..c721282 100644 --- a/sound/soc/ux500/ux500_msp_dai.h +++ b/sound/soc/ux500/ux500_msp_dai.h @@ -58,8 +58,6 @@ struct ux500_msp_i2s_drvdata { unsigned int rx_mask; int slots; int slot_width; - u8 configured; - int data_delay; /* Clocks */ unsigned int master_clk; diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h index ccfcc32..d5e4176 100644 --- a/sound/soc/ux500/ux500_msp_i2s.h +++ b/sound/soc/ux500/ux500_msp_i2s.h @@ -341,11 +341,6 @@ enum msp_compress_mode { MSP_COMPRESS_MODE_A_LAW = 3 }; -enum msp_spi_burst_mode { - MSP_SPI_BURST_MODE_DISABLE = 0, - MSP_SPI_BURST_MODE_ENABLE = 1 -}; - enum msp_expand_mode { MSP_EXPAND_MODE_LINEAR = 0, MSP_EXPAND_MODE_LINEAR_SIGNED = 1, @@ -454,21 +449,6 @@ struct msp_protdesc { u32 clocks_per_frame; }; -struct i2s_message { - enum i2s_direction_t i2s_direction; - void *txdata; - void *rxdata; - size_t txbytes; - size_t rxbytes; - int dma_flag; - int tx_offset; - int rx_offset; - bool cyclic_dma; - dma_addr_t buf_addr; - size_t buf_len; - size_t period_len; -}; - struct ux500_msp_config { unsigned int f_inputclk; unsigned int rx_clk_sel; @@ -480,8 +460,6 @@ struct ux500_msp_config { unsigned int tx_fsync_sel; unsigned int rx_fifo_config; unsigned int tx_fifo_config; - unsigned int spi_clk_mode; - unsigned int spi_burst_mode; unsigned int loopback_enable; unsigned int tx_data_enable; unsigned int default_protdesc; @@ -491,13 +469,9 @@ struct ux500_msp_config { unsigned int direction; unsigned int protocol; unsigned int frame_freq; - unsigned int frame_size; enum msp_data_size data_size; unsigned int def_elem_len; unsigned int iodelay; - void (*handler) (void *data); - void *tx_callback_data; - void *rx_callback_data; }; struct ux500_msp { @@ -506,15 +480,10 @@ struct ux500_msp { struct device *dev; struct stedma40_chan_cfg *dma_cfg_rx; struct stedma40_chan_cfg *dma_cfg_tx; - struct dma_chan *tx_pipeid; - struct dma_chan *rx_pipeid; enum msp_state msp_state; - int (*transfer) (struct ux500_msp *msp, struct i2s_message *message); - struct timer_list notify_timer; int def_elem_len; unsigned int dir_busy; int loopback_enable; - u32 backup_regs[MAX_MSP_BACKUP_REGS]; unsigned int f_bitclk; }; -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/6] More code cleanup for ASoC ux500
Hi Mark, this series contains more various code cleanup patches that I put together while working on other stuff this drivers. The first patch is actually a resend, as Linus Walleij agreed to drop that code in the original thread (https://lkml.org/lkml/2013/5/17/487). The others are just a bunch of sparse fixes and generic code cleanup and dead code removal. Thanks, Fabio Fabio Baltieri (6): ASoC: ux500: Drop pinctrl sleep support ASoC: ab8500-codec: Move codec ops on a separate structure ASoC: ux500: Drop dangling struct i2s_controller ASoC: ux500: Drop unused code from msp headers ASoC: ux500: Add missing mop500_ab8500.h include ASoC: ux500: Drop redundant msp id enumerations sound/soc/codecs/ab8500-codec.c | 19 --- sound/soc/ux500/mop500_ab8500.c | 1 + sound/soc/ux500/ux500_msp_dai.h | 2 -- sound/soc/ux500/ux500_msp_i2s.c | 75 ++--- sound/soc/ux500/ux500_msp_i2s.h | 59 ++-- 5 files changed, 12 insertions(+), 144 deletions(-) -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/6] More code cleanup for ASoC ux500
Hi Mark, this series contains more various code cleanup patches that I put together while working on other stuff this drivers. The first patch is actually a resend, as Linus Walleij agreed to drop that code in the original thread (https://lkml.org/lkml/2013/5/17/487). The others are just a bunch of sparse fixes and generic code cleanup and dead code removal. Thanks, Fabio Fabio Baltieri (6): ASoC: ux500: Drop pinctrl sleep support ASoC: ab8500-codec: Move codec ops on a separate structure ASoC: ux500: Drop dangling struct i2s_controller ASoC: ux500: Drop unused code from msp headers ASoC: ux500: Add missing mop500_ab8500.h include ASoC: ux500: Drop redundant msp id enumerations sound/soc/codecs/ab8500-codec.c | 19 --- sound/soc/ux500/mop500_ab8500.c | 1 + sound/soc/ux500/ux500_msp_dai.h | 2 -- sound/soc/ux500/ux500_msp_i2s.c | 75 ++--- sound/soc/ux500/ux500_msp_i2s.h | 59 ++-- 5 files changed, 12 insertions(+), 144 deletions(-) -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/6] ASoC: ux500: Drop unused code from msp headers
Drop unused fields and structures from ux500_msp_i2s header file, as those looks like leftover from a previous implementation of the driver. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- sound/soc/ux500/ux500_msp_dai.h | 2 -- sound/soc/ux500/ux500_msp_i2s.h | 31 --- 2 files changed, 33 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_dai.h b/sound/soc/ux500/ux500_msp_dai.h index f531043..c721282 100644 --- a/sound/soc/ux500/ux500_msp_dai.h +++ b/sound/soc/ux500/ux500_msp_dai.h @@ -58,8 +58,6 @@ struct ux500_msp_i2s_drvdata { unsigned int rx_mask; int slots; int slot_width; - u8 configured; - int data_delay; /* Clocks */ unsigned int master_clk; diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h index ccfcc32..d5e4176 100644 --- a/sound/soc/ux500/ux500_msp_i2s.h +++ b/sound/soc/ux500/ux500_msp_i2s.h @@ -341,11 +341,6 @@ enum msp_compress_mode { MSP_COMPRESS_MODE_A_LAW = 3 }; -enum msp_spi_burst_mode { - MSP_SPI_BURST_MODE_DISABLE = 0, - MSP_SPI_BURST_MODE_ENABLE = 1 -}; - enum msp_expand_mode { MSP_EXPAND_MODE_LINEAR = 0, MSP_EXPAND_MODE_LINEAR_SIGNED = 1, @@ -454,21 +449,6 @@ struct msp_protdesc { u32 clocks_per_frame; }; -struct i2s_message { - enum i2s_direction_t i2s_direction; - void *txdata; - void *rxdata; - size_t txbytes; - size_t rxbytes; - int dma_flag; - int tx_offset; - int rx_offset; - bool cyclic_dma; - dma_addr_t buf_addr; - size_t buf_len; - size_t period_len; -}; - struct ux500_msp_config { unsigned int f_inputclk; unsigned int rx_clk_sel; @@ -480,8 +460,6 @@ struct ux500_msp_config { unsigned int tx_fsync_sel; unsigned int rx_fifo_config; unsigned int tx_fifo_config; - unsigned int spi_clk_mode; - unsigned int spi_burst_mode; unsigned int loopback_enable; unsigned int tx_data_enable; unsigned int default_protdesc; @@ -491,13 +469,9 @@ struct ux500_msp_config { unsigned int direction; unsigned int protocol; unsigned int frame_freq; - unsigned int frame_size; enum msp_data_size data_size; unsigned int def_elem_len; unsigned int iodelay; - void (*handler) (void *data); - void *tx_callback_data; - void *rx_callback_data; }; struct ux500_msp { @@ -506,15 +480,10 @@ struct ux500_msp { struct device *dev; struct stedma40_chan_cfg *dma_cfg_rx; struct stedma40_chan_cfg *dma_cfg_tx; - struct dma_chan *tx_pipeid; - struct dma_chan *rx_pipeid; enum msp_state msp_state; - int (*transfer) (struct ux500_msp *msp, struct i2s_message *message); - struct timer_list notify_timer; int def_elem_len; unsigned int dir_busy; int loopback_enable; - u32 backup_regs[MAX_MSP_BACKUP_REGS]; unsigned int f_bitclk; }; -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/6] ASoC: ux500: Drop redundant msp id enumerations
Ux500 has two equivalent enum for device id, one in platform_data and one in a local header. Fix this by dropping the local one. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- sound/soc/ux500/ux500_msp_i2s.h | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h index d5e4176..189a375 100644 --- a/sound/soc/ux500/ux500_msp_i2s.h +++ b/sound/soc/ux500/ux500_msp_i2s.h @@ -16,6 +16,7 @@ #define UX500_MSP_I2S_H #include linux/platform_device.h +#include linux/platform_data/asoc-ux500-msp.h #define MSP_INPUT_FREQ_APB 4800 @@ -365,13 +366,6 @@ enum msp_protocol { */ #define MAX_MSP_BACKUP_REGS 36 -enum enum_i2s_controller { - MSP_0_I2S_CONTROLLER = 0, - MSP_1_I2S_CONTROLLER, - MSP_2_I2S_CONTROLLER, - MSP_3_I2S_CONTROLLER, -}; - enum i2s_direction_t { MSP_DIR_TX = 0x01, MSP_DIR_RX = 0x02, @@ -475,7 +469,7 @@ struct ux500_msp_config { }; struct ux500_msp { - enum enum_i2s_controller id; + enum msp_i2s_id id; void __iomem *registers; struct device *dev; struct stedma40_chan_cfg *dma_cfg_rx; -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/6] ASoC: ux500: Add missing mop500_ab8500.h include
Add a missing include that was resulting in some sparse warning for non-static structure without forward declaration. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- sound/soc/ux500/mop500_ab8500.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/ux500/mop500_ab8500.c b/sound/soc/ux500/mop500_ab8500.c index 884a362..5e0f146 100644 --- a/sound/soc/ux500/mop500_ab8500.c +++ b/sound/soc/ux500/mop500_ab8500.c @@ -24,6 +24,7 @@ #include ux500_pcm.h #include ux500_msp_dai.h +#include mop500_ab8500.h #include ../codecs/ab8500-codec.h #define TX_SLOT_MONO 0x0008 -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/6] ASoC: ux500: Drop pinctrl sleep support
Drop pinctrl default/sleep state switching code, as it was breaking the capture interface by putting the I2S pins in hi-z mode regardless of its usage status, and not giving any real benefit. Pinctrl default mode configuration is already managed automatically by a specific pinctrl hog. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- sound/soc/ux500/ux500_msp_i2s.c | 56 ++--- sound/soc/ux500/ux500_msp_i2s.h | 6 - 2 files changed, 2 insertions(+), 60 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index f2db6c9..b029b2d 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -15,7 +15,6 @@ #include linux/module.h #include linux/platform_device.h -#include linux/pinctrl/consumer.h #include linux/delay.h #include linux/slab.h #include linux/io.h @@ -26,9 +25,6 @@ #include ux500_msp_i2s.h -/* MSP1/3 Tx/Rx usage protection */ -static DEFINE_SPINLOCK(msp_rxtx_lock); - /* Protocol desciptors */ static const struct msp_protdesc prot_descs[] = { { /* I2S */ @@ -356,24 +352,8 @@ static int configure_multichannel(struct ux500_msp *msp, static int enable_msp(struct ux500_msp *msp, struct ux500_msp_config *config) { - int status = 0, retval = 0; + int status = 0; u32 reg_val_DMACR, reg_val_GCR; - unsigned long flags; - - /* Check msp state whether in RUN or CONFIGURED Mode */ - if (msp-msp_state == MSP_STATE_IDLE) { - spin_lock_irqsave(msp_rxtx_lock, flags); - if (msp-pinctrl_rxtx_ref == 0 - !(IS_ERR(msp-pinctrl_p) || IS_ERR(msp-pinctrl_def))) { - retval = pinctrl_select_state(msp-pinctrl_p, - msp-pinctrl_def); - if (retval) - pr_err(could not set MSP defstate\n); - } - if (!retval) - msp-pinctrl_rxtx_ref++; - spin_unlock_irqrestore(msp_rxtx_lock, flags); - } /* Configure msp with protocol dependent settings */ configure_protocol(msp, config); @@ -630,8 +610,7 @@ int ux500_msp_i2s_trigger(struct ux500_msp *msp, int cmd, int direction) int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir) { - int status = 0, retval = 0; - unsigned long flags; + int status = 0; dev_dbg(msp-dev, %s: Enter (dir = 0x%01x).\n, __func__, dir); @@ -643,18 +622,6 @@ int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir) (~(FRAME_GEN_ENABLE | SRG_ENABLE))), msp-registers + MSP_GCR); - spin_lock_irqsave(msp_rxtx_lock, flags); - WARN_ON(!msp-pinctrl_rxtx_ref); - msp-pinctrl_rxtx_ref--; - if (msp-pinctrl_rxtx_ref == 0 - !(IS_ERR(msp-pinctrl_p) || IS_ERR(msp-pinctrl_sleep))) { - retval = pinctrl_select_state(msp-pinctrl_p, - msp-pinctrl_sleep); - if (retval) - pr_err(could not set MSP sleepstate\n); - } - spin_unlock_irqrestore(msp_rxtx_lock, flags); - writel(0, msp-registers + MSP_GCR); writel(0, msp-registers + MSP_TCF); writel(0, msp-registers + MSP_RCF); @@ -743,25 +710,6 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, dev_dbg(pdev-dev, I2S device-name: '%s'\n, i2s_cont-name); msp-i2s_cont = i2s_cont; - msp-pinctrl_p = pinctrl_get(msp-dev); - if (IS_ERR(msp-pinctrl_p)) - dev_err(pdev-dev, could not get MSP pinctrl\n); - else { - msp-pinctrl_def = pinctrl_lookup_state(msp-pinctrl_p, - PINCTRL_STATE_DEFAULT); - if (IS_ERR(msp-pinctrl_def)) { - dev_err(pdev-dev, - could not get MSP defstate (%li)\n, - PTR_ERR(msp-pinctrl_def)); - } - msp-pinctrl_sleep = pinctrl_lookup_state(msp-pinctrl_p, - PINCTRL_STATE_SLEEP); - if (IS_ERR(msp-pinctrl_sleep)) - dev_err(pdev-dev, - could not get MSP idlestate (%li)\n, - PTR_ERR(msp-pinctrl_def)); - } - return 0; } diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h index e5cd105..8ce014e 100644 --- a/sound/soc/ux500/ux500_msp_i2s.h +++ b/sound/soc/ux500/ux500_msp_i2s.h @@ -528,12 +528,6 @@ struct ux500_msp { int loopback_enable; u32 backup_regs[MAX_MSP_BACKUP_REGS]; unsigned int f_bitclk; - /* Pin modes */ - struct
[PATCH 2/6] ASoC: ab8500-codec: Move codec ops on a separate structure
Define ab8500 codec operations structure on its own rather than inline with snd_soc_dai_drivers to clean up the code and make the style coherent with other codec drivers. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- sound/soc/codecs/ab8500-codec.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c index 4ca45b9..b8ba0ad 100644 --- a/sound/soc/codecs/ab8500-codec.c +++ b/sound/soc/codecs/ab8500-codec.c @@ -2380,6 +2380,11 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, return 0; } +static const struct snd_soc_dai_ops ab8500_codec_ops = { + .set_fmt = ab8500_codec_set_dai_fmt, + .set_tdm_slot = ab8500_codec_set_dai_tdm_slot, +}; + static struct snd_soc_dai_driver ab8500_codec_dai[] = { { .name = ab8500-codec-dai.0, @@ -2391,12 +2396,7 @@ static struct snd_soc_dai_driver ab8500_codec_dai[] = { .rates = AB8500_SUPPORTED_RATE, .formats = AB8500_SUPPORTED_FMT, }, - .ops = (struct snd_soc_dai_ops[]) { - { - .set_tdm_slot = ab8500_codec_set_dai_tdm_slot, - .set_fmt = ab8500_codec_set_dai_fmt, - } - }, + .ops = ab8500_codec_ops, .symmetric_rates = 1 }, { @@ -2409,12 +2409,7 @@ static struct snd_soc_dai_driver ab8500_codec_dai[] = { .rates = AB8500_SUPPORTED_RATE, .formats = AB8500_SUPPORTED_FMT, }, - .ops = (struct snd_soc_dai_ops[]) { - { - .set_tdm_slot = ab8500_codec_set_dai_tdm_slot, - .set_fmt = ab8500_codec_set_dai_fmt, - } - }, + .ops = ab8500_codec_ops, .symmetric_rates = 1 } }; -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/6] ASoC: ux500: Drop dangling struct i2s_controller
Drop struct i2s_controller from the ux500 ASoC driver as right now it is instantiated but not used anywhere. Also drop a mismatched device_unregister in the process. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- sound/soc/ux500/ux500_msp_i2s.c | 19 --- sound/soc/ux500/ux500_msp_i2s.h | 12 2 files changed, 31 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index b029b2d..cba0e86 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -649,7 +649,6 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, struct msp_i2s_platform_data *platform_data) { struct resource *res = NULL; - struct i2s_controller *i2s_cont; struct device_node *np = pdev-dev.of_node; struct ux500_msp *msp; @@ -694,22 +693,6 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, msp-msp_state = MSP_STATE_IDLE; msp-loopback_enable = 0; - /* I2S-controller is allocated and added in I2S controller class. */ - i2s_cont = devm_kzalloc(pdev-dev, sizeof(*i2s_cont), GFP_KERNEL); - if (!i2s_cont) { - dev_err(pdev-dev, - %s: ERROR: Failed to allocate I2S-controller!\n, - __func__); - return -ENOMEM; - } - i2s_cont-dev.parent = pdev-dev; - i2s_cont-data = (void *)msp; - i2s_cont-id = (s16)msp-id; - snprintf(i2s_cont-name, sizeof(i2s_cont-name), ux500-msp-i2s.%04x, - msp-id); - dev_dbg(pdev-dev, I2S device-name: '%s'\n, i2s_cont-name); - msp-i2s_cont = i2s_cont; - return 0; } @@ -717,8 +700,6 @@ void ux500_msp_i2s_cleanup_msp(struct platform_device *pdev, struct ux500_msp *msp) { dev_dbg(msp-dev, %s: Enter (id = %d).\n, __func__, msp-id); - - device_unregister(msp-i2s_cont-dev); } MODULE_LICENSE(GPL v2); diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h index 8ce014e..ccfcc32 100644 --- a/sound/soc/ux500/ux500_msp_i2s.h +++ b/sound/soc/ux500/ux500_msp_i2s.h @@ -469,17 +469,6 @@ struct i2s_message { size_t period_len; }; -struct i2s_controller { - struct module *owner; - unsigned int id; - unsigned int class; - const struct i2s_algorithm *algo; /* the algorithm to access the bus */ - void *data; - struct mutex bus_lock; - struct device dev; /* the controller device */ - char name[48]; -}; - struct ux500_msp_config { unsigned int f_inputclk; unsigned int rx_clk_sel; @@ -515,7 +504,6 @@ struct ux500_msp { enum enum_i2s_controller id; void __iomem *registers; struct device *dev; - struct i2s_controller *i2s_cont; struct stedma40_chan_cfg *dma_cfg_rx; struct stedma40_chan_cfg *dma_cfg_tx; struct dma_chan *tx_pipeid; -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: ux500: select SND_SOC_UX500 for ux500
Enable ux500 specific ALSA SoC drivers by default on u8500_defconfig. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- Hi Linus, As I noticed that you just updated your ux500-defconfig branch, and the ux500 sound driver should be working fine in the next kernel, I'm sending a patch to enable it by default. This applies on top of your recent commit ARM: ux500: update defconfig base. Thanks, Fabio arch/arm/configs/u8500_defconfig | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig index da0614a..da353e0 100644 --- a/arch/arm/configs/u8500_defconfig +++ b/arch/arm/configs/u8500_defconfig @@ -69,6 +69,11 @@ CONFIG_MFD_STMPE=y CONFIG_MFD_TC3589X=y CONFIG_REGULATOR_GPIO=y CONFIG_REGULATOR_AB8500=y +CONFIG_SOUND=y +CONFIG_SND=y +CONFIG_SND_SOC=y +CONFIG_SND_SOC_UX500=y +CONFIG_SND_SOC_UX500_MACH_MOP500=y CONFIG_USB=y CONFIG_USB_MUSB_HDRC=y CONFIG_USB_MUSB_UX500=y -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] ASoC: ab8500-codec: Set rx dai slots from rx_mask
Replace hard coded rx slot numbers from ab8500_codec_set_dai_tdm_slot using the ones requested by the machine driver in rx_mask instead. Signed-off-by: Fabio Baltieri --- sound/soc/codecs/ab8500-codec.c | 29 - sound/soc/codecs/ab8500-codec.h | 35 +++ 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c index bace321..4ca45b9 100644 --- a/sound/soc/codecs/ab8500-codec.c +++ b/sound/soc/codecs/ab8500-codec.c @@ -2334,25 +2334,36 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, } /* Setup TDM AD according to active RX-slots */ + + if (rx_mask & ~0xff) + return -EINVAL; + + rx_mask = rx_mask << AB8500_AD_DATA0_OFFSET; slots_active = hweight32(rx_mask); + dev_dbg(dai->codec->dev, "%s: Slots, active, RX: %d\n", __func__, slots_active); + switch (slots_active) { case 0: break; case 1: - /* AD_OUT3 -> slot 0 & 1 */ - snd_soc_update_bits(codec, AB8500_ADSLOTSEL1, AB8500_MASK_ALL, - AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_EVEN | - AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_ODD); + slot = find_first_bit((unsigned long *)_mask, 32); + snd_soc_update_bits(codec, AB8500_ADSLOTSEL(slot), + AB8500_MASK_SLOT(slot), + AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot)); break; case 2: - /* AD_OUT3 -> slot 0, AD_OUT2 -> slot 1 */ + slot = find_first_bit((unsigned long *)_mask, 32); + snd_soc_update_bits(codec, + AB8500_ADSLOTSEL(slot), + AB8500_MASK_SLOT(slot), + AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot)); + slot = find_next_bit((unsigned long *)_mask, 32, slot + 1); snd_soc_update_bits(codec, - AB8500_ADSLOTSEL1, - AB8500_MASK_ALL, - AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_EVEN | - AB8500_ADSLOTSELX_AD_OUT2_TO_SLOT_ODD); + AB8500_ADSLOTSEL(slot), + AB8500_MASK_SLOT(slot), + AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT2, slot)); break; case 8: dev_dbg(dai->codec->dev, diff --git a/sound/soc/codecs/ab8500-codec.h b/sound/soc/codecs/ab8500-codec.h index 64c14ce..e2e5442 100644 --- a/sound/soc/codecs/ab8500-codec.h +++ b/sound/soc/codecs/ab8500-codec.h @@ -80,6 +80,7 @@ #define AB8500_ADSLOTSEL14 0x2C #define AB8500_ADSLOTSEL15 0x2D #define AB8500_ADSLOTSEL16 0x2E +#define AB8500_ADSLOTSEL(slot) (AB8500_ADSLOTSEL1 + (slot >> 1)) #define AB8500_ADSLOTHIZCTRL1 0x2F #define AB8500_ADSLOTHIZCTRL2 0x30 #define AB8500_ADSLOTHIZCTRL3 0x31 @@ -151,6 +152,7 @@ #define AB8500_CACHEREGNUM (AB8500_LAST_REG + 1) #define AB8500_MASK_ALL0xFF +#define AB8500_MASK_SLOT(slot) ((slot & 1) ? 0xF0 : 0x0F) #define AB8500_MASK_NONE 0x00 /* AB8500_POWERUP */ @@ -354,28 +356,21 @@ #define AB8500_DIGIFCONF4_IF1WL0 0 /* AB8500_ADSLOTSELX */ -#define AB8500_ADSLOTSELX_AD_OUT1_TO_SLOT_ODD 0x00 -#define AB8500_ADSLOTSELX_AD_OUT2_TO_SLOT_ODD 0x10 -#define AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_ODD 0x20 -#define AB8500_ADSLOTSELX_AD_OUT4_TO_SLOT_ODD 0x30 -#define AB8500_ADSLOTSELX_AD_OUT5_TO_SLOT_ODD 0x40 -#define AB8500_ADSLOTSELX_AD_OUT6_TO_SLOT_ODD 0x50 -#define AB8500_ADSLOTSELX_AD_OUT7_TO_SLOT_ODD 0x60 -#define AB8500_ADSLOTSELX_AD_OUT8_TO_SLOT_ODD 0x70 -#define AB8500_ADSLOTSELX_ZEROES_TO_SLOT_ODD 0x80 -#define AB8500_ADSLOTSELX_TRISTATE_TO_SLOT_ODD 0xF0 -#define AB8500_ADSLOTSELX_AD_OUT1_TO_SLOT_EVEN 0x00 -#define AB8500_ADSLOTSELX_AD_OUT2_TO_SLOT_EVEN 0x01 -#define AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_EVEN 0x02 -#define AB8500_ADSLOTSELX_AD_OUT4_TO_SLOT_EVEN 0x03 -#define AB8500_ADSLOTSELX_AD_OUT5_TO_SLOT_EVEN 0x04 -#define AB8500_ADSLOTSELX_AD_OUT6_TO_SLOT_EVEN 0x05 -#define AB8500_ADSLOTSELX_AD_OUT7_TO_SLOT_EVEN 0x06 -#define AB8500_ADSLOTSELX_AD_OUT8_TO_SLOT_EVEN 0x07 -#define AB8500_ADSLOTSELX_ZEROES_TO_SLOT_EVEN 0x08 -#define AB8500_ADSLOTSELX_TRISTATE_TO_SLOT_EVEN0x0F +#define AB8500_AD_OUT1 0x0 +#define AB8500_AD_OUT2 0x1 +#define AB8500_AD_OUT3 0x2 +#define AB8500_AD_OUT4 0x3 +#define AB8500_AD_OUT5 0x4 +#define AB8500_AD_OUT6 0x5 +#define AB8500_AD_OUT7
[PATCH 1/2] ASoC: ab8500-codec: Set tx dai slots from tx_mask
Replace hard-coded tx slot numbers from ab8500_codec_set_dai_tdm_slot using the ones requested by the machine driver in tx_mask instead. Signed-off-by: Fabio Baltieri --- sound/soc/codecs/ab8500-codec.c | 31 +++ sound/soc/codecs/ab8500-codec.h | 7 +++ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c index 3126cac..bace321 100644 --- a/sound/soc/codecs/ab8500-codec.c +++ b/sound/soc/codecs/ab8500-codec.c @@ -2236,7 +2236,7 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, int slots, int slot_width) { struct snd_soc_codec *codec = dai->codec; - unsigned int val, mask, slots_active; + unsigned int val, mask, slot, slots_active; mask = BIT(AB8500_DIGIFCONF2_IF0WL0) | BIT(AB8500_DIGIFCONF2_IF0WL1); @@ -2292,27 +2292,34 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, snd_soc_update_bits(codec, AB8500_DIGIFCONF1, mask, val); /* Setup TDM DA according to active tx slots */ + + if (tx_mask & ~0xff) + return -EINVAL; + mask = AB8500_DASLOTCONFX_SLTODAX_MASK; + tx_mask = tx_mask << AB8500_DA_DATA0_OFFSET; slots_active = hweight32(tx_mask); + dev_dbg(dai->codec->dev, "%s: Slots, active, TX: %d\n", __func__, slots_active); + switch (slots_active) { case 0: break; case 1: - /* Slot 9 -> DA_IN1 & DA_IN3 */ - snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, 11); - snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, 11); - snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, 11); - snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, 11); + slot = find_first_bit((unsigned long *)_mask, 32); + snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot); break; case 2: - /* Slot 9 -> DA_IN1 & DA_IN3, Slot 11 -> DA_IN2 & DA_IN4 */ - snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, 9); - snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, 9); - snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, 11); - snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, 11); - + slot = find_first_bit((unsigned long *)_mask, 32); + snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot); + slot = find_next_bit((unsigned long *)_mask, 32, slot + 1); + snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot); break; case 8: dev_dbg(dai->codec->dev, diff --git a/sound/soc/codecs/ab8500-codec.h b/sound/soc/codecs/ab8500-codec.h index 306d0bc..64c14ce 100644 --- a/sound/soc/codecs/ab8500-codec.h +++ b/sound/soc/codecs/ab8500-codec.h @@ -24,6 +24,13 @@ #define AB8500_SUPPORTED_RATE (SNDRV_PCM_RATE_48000) #define AB8500_SUPPORTED_FMT (SNDRV_PCM_FMTBIT_S16_LE) +/* AB8500 interface slot offset definitions */ + +#define AB8500_AD_DATA0_OFFSET 0 +#define AB8500_DA_DATA0_OFFSET 8 +#define AB8500_AD_DATA1_OFFSET 16 +#define AB8500_DA_DATA1_OFFSET 24 + /* AB8500 audio bank (0x0d) register definitions */ #define AB8500_POWERUP 0x00 -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/2] Set ab8500-codec dai slots from machine drivers
Hi Mark, these two patches rework the slot selection code in ab8500-codec to use the slots masks provided by the machine drivers instead of the hardcoded ones as suggested. The patches replaces some of the previous macros with a parametrized version in the effort of making the actual code compact and readable, and should be applied in order. Also, the second patch drops the hardcoded defintions swapped in -rc2, so you may want to rebase the ux500 topic branch to avoid the conflict, or I can resend the patch based on the topic branch directly. Just let me know. Big thanks to Ola for helping me figuring out the weird ab8500 slot mapping logic. Fabio Fabio Baltieri (2): ASoC: ab8500-codec: Set tx dai slots from tx_mask ASoC: ab8500-codec: Set rx dai slots from rx_mask sound/soc/codecs/ab8500-codec.c | 60 ++--- sound/soc/codecs/ab8500-codec.h | 42 +++-- 2 files changed, 61 insertions(+), 41 deletions(-) -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [GIT PULL v2] MFD: Fixes due for the v3.10 -rc:s
Hi Samuel, On Tue, May 21, 2013 at 10:56:50AM +0200, Samuel Ortiz wrote: > Hi Fabio, > > On Fri, May 17, 2013 at 09:51:40AM +0200, Fabio Baltieri wrote: > > Hello Samuel, > > > > On Fri, May 17, 2013 at 12:43:37AM +0200, Samuel Ortiz wrote: > > > > Fabio Baltieri (5): > > > > mfd: abx500-core: Fix sparse warning > > > > mfd: ab8500-sysctrl: Fix sparse warning > > > > mfd: ab8500-sysctrl: Set sysctrl_dev during probe > > > > mfd: ab8500-sysctrl: Let sysctrl driver work without pdata > > > Unless I'm missing something here, this one is not really rcN material, so > > > I'd appreciate if you could queue it to your for-mfd branch instead. > > > > The last two: > > > > mfd: ab8500-sysctrl: Set sysctrl_dev during probe > This one is already in mfd-fixes, the commit log was clear enough. Great! > > mfd: ab8500-sysctrl: Let sysctrl driver work without pdata > This one is not, as the commit log is not showing it actually fixes something > but only makes the code cleaner. If it really fixes something, could you > please provide me with a commit log that describes what exactly it fixes ? Ok, the fix here is that right now that driver is initialized without a specific pdata (that is plat->sysctrl), so enforcing it breaks existing platforms for no reason. To make the commit more clear I would just point that out as in (just last two sentences): --- >8 --- mfd: ab8500-sysctrl: Let sysctrl driver work without pdata A check for a valid plat->sysctrl was introduced in: 2377e52 mfd: ab8500-sysctrl: Error check clean up but the driver works just fine even without that initialization data, and enforcing it breaks existing platforms for no reason. This patch removes the check and let the driver go ahead with probe. --- >8 --- Is it better? Thanks, Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [GIT PULL v2] MFD: Fixes due for the v3.10 -rc:s
Hi Samuel, On Tue, May 21, 2013 at 10:56:50AM +0200, Samuel Ortiz wrote: Hi Fabio, On Fri, May 17, 2013 at 09:51:40AM +0200, Fabio Baltieri wrote: Hello Samuel, On Fri, May 17, 2013 at 12:43:37AM +0200, Samuel Ortiz wrote: Fabio Baltieri (5): mfd: abx500-core: Fix sparse warning mfd: ab8500-sysctrl: Fix sparse warning mfd: ab8500-sysctrl: Set sysctrl_dev during probe mfd: ab8500-sysctrl: Let sysctrl driver work without pdata Unless I'm missing something here, this one is not really rcN material, so I'd appreciate if you could queue it to your for-mfd branch instead. The last two: mfd: ab8500-sysctrl: Set sysctrl_dev during probe This one is already in mfd-fixes, the commit log was clear enough. Great! mfd: ab8500-sysctrl: Let sysctrl driver work without pdata This one is not, as the commit log is not showing it actually fixes something but only makes the code cleaner. If it really fixes something, could you please provide me with a commit log that describes what exactly it fixes ? Ok, the fix here is that right now that driver is initialized without a specific pdata (that is plat-sysctrl), so enforcing it breaks existing platforms for no reason. To make the commit more clear I would just point that out as in (just last two sentences): --- 8 --- mfd: ab8500-sysctrl: Let sysctrl driver work without pdata A check for a valid plat-sysctrl was introduced in: 2377e52 mfd: ab8500-sysctrl: Error check clean up but the driver works just fine even without that initialization data, and enforcing it breaks existing platforms for no reason. This patch removes the check and let the driver go ahead with probe. --- 8 --- Is it better? Thanks, Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/2] Set ab8500-codec dai slots from machine drivers
Hi Mark, these two patches rework the slot selection code in ab8500-codec to use the slots masks provided by the machine drivers instead of the hardcoded ones as suggested. The patches replaces some of the previous macros with a parametrized version in the effort of making the actual code compact and readable, and should be applied in order. Also, the second patch drops the hardcoded defintions swapped in -rc2, so you may want to rebase the ux500 topic branch to avoid the conflict, or I can resend the patch based on the topic branch directly. Just let me know. Big thanks to Ola for helping me figuring out the weird ab8500 slot mapping logic. Fabio Fabio Baltieri (2): ASoC: ab8500-codec: Set tx dai slots from tx_mask ASoC: ab8500-codec: Set rx dai slots from rx_mask sound/soc/codecs/ab8500-codec.c | 60 ++--- sound/soc/codecs/ab8500-codec.h | 42 +++-- 2 files changed, 61 insertions(+), 41 deletions(-) -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] ASoC: ab8500-codec: Set tx dai slots from tx_mask
Replace hard-coded tx slot numbers from ab8500_codec_set_dai_tdm_slot using the ones requested by the machine driver in tx_mask instead. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- sound/soc/codecs/ab8500-codec.c | 31 +++ sound/soc/codecs/ab8500-codec.h | 7 +++ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c index 3126cac..bace321 100644 --- a/sound/soc/codecs/ab8500-codec.c +++ b/sound/soc/codecs/ab8500-codec.c @@ -2236,7 +2236,7 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, int slots, int slot_width) { struct snd_soc_codec *codec = dai-codec; - unsigned int val, mask, slots_active; + unsigned int val, mask, slot, slots_active; mask = BIT(AB8500_DIGIFCONF2_IF0WL0) | BIT(AB8500_DIGIFCONF2_IF0WL1); @@ -2292,27 +2292,34 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, snd_soc_update_bits(codec, AB8500_DIGIFCONF1, mask, val); /* Setup TDM DA according to active tx slots */ + + if (tx_mask ~0xff) + return -EINVAL; + mask = AB8500_DASLOTCONFX_SLTODAX_MASK; + tx_mask = tx_mask AB8500_DA_DATA0_OFFSET; slots_active = hweight32(tx_mask); + dev_dbg(dai-codec-dev, %s: Slots, active, TX: %d\n, __func__, slots_active); + switch (slots_active) { case 0: break; case 1: - /* Slot 9 - DA_IN1 DA_IN3 */ - snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, 11); - snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, 11); - snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, 11); - snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, 11); + slot = find_first_bit((unsigned long *)tx_mask, 32); + snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot); break; case 2: - /* Slot 9 - DA_IN1 DA_IN3, Slot 11 - DA_IN2 DA_IN4 */ - snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, 9); - snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, 9); - snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, 11); - snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, 11); - + slot = find_first_bit((unsigned long *)tx_mask, 32); + snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot); + slot = find_next_bit((unsigned long *)tx_mask, 32, slot + 1); + snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot); + snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot); break; case 8: dev_dbg(dai-codec-dev, diff --git a/sound/soc/codecs/ab8500-codec.h b/sound/soc/codecs/ab8500-codec.h index 306d0bc..64c14ce 100644 --- a/sound/soc/codecs/ab8500-codec.h +++ b/sound/soc/codecs/ab8500-codec.h @@ -24,6 +24,13 @@ #define AB8500_SUPPORTED_RATE (SNDRV_PCM_RATE_48000) #define AB8500_SUPPORTED_FMT (SNDRV_PCM_FMTBIT_S16_LE) +/* AB8500 interface slot offset definitions */ + +#define AB8500_AD_DATA0_OFFSET 0 +#define AB8500_DA_DATA0_OFFSET 8 +#define AB8500_AD_DATA1_OFFSET 16 +#define AB8500_DA_DATA1_OFFSET 24 + /* AB8500 audio bank (0x0d) register definitions */ #define AB8500_POWERUP 0x00 -- 1.8.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] ASoC: ab8500-codec: Set rx dai slots from rx_mask
Replace hard coded rx slot numbers from ab8500_codec_set_dai_tdm_slot using the ones requested by the machine driver in rx_mask instead. Signed-off-by: Fabio Baltieri fabio.balti...@linaro.org --- sound/soc/codecs/ab8500-codec.c | 29 - sound/soc/codecs/ab8500-codec.h | 35 +++ 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c index bace321..4ca45b9 100644 --- a/sound/soc/codecs/ab8500-codec.c +++ b/sound/soc/codecs/ab8500-codec.c @@ -2334,25 +2334,36 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, } /* Setup TDM AD according to active RX-slots */ + + if (rx_mask ~0xff) + return -EINVAL; + + rx_mask = rx_mask AB8500_AD_DATA0_OFFSET; slots_active = hweight32(rx_mask); + dev_dbg(dai-codec-dev, %s: Slots, active, RX: %d\n, __func__, slots_active); + switch (slots_active) { case 0: break; case 1: - /* AD_OUT3 - slot 0 1 */ - snd_soc_update_bits(codec, AB8500_ADSLOTSEL1, AB8500_MASK_ALL, - AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_EVEN | - AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_ODD); + slot = find_first_bit((unsigned long *)rx_mask, 32); + snd_soc_update_bits(codec, AB8500_ADSLOTSEL(slot), + AB8500_MASK_SLOT(slot), + AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot)); break; case 2: - /* AD_OUT3 - slot 0, AD_OUT2 - slot 1 */ + slot = find_first_bit((unsigned long *)rx_mask, 32); + snd_soc_update_bits(codec, + AB8500_ADSLOTSEL(slot), + AB8500_MASK_SLOT(slot), + AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot)); + slot = find_next_bit((unsigned long *)rx_mask, 32, slot + 1); snd_soc_update_bits(codec, - AB8500_ADSLOTSEL1, - AB8500_MASK_ALL, - AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_EVEN | - AB8500_ADSLOTSELX_AD_OUT2_TO_SLOT_ODD); + AB8500_ADSLOTSEL(slot), + AB8500_MASK_SLOT(slot), + AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT2, slot)); break; case 8: dev_dbg(dai-codec-dev, diff --git a/sound/soc/codecs/ab8500-codec.h b/sound/soc/codecs/ab8500-codec.h index 64c14ce..e2e5442 100644 --- a/sound/soc/codecs/ab8500-codec.h +++ b/sound/soc/codecs/ab8500-codec.h @@ -80,6 +80,7 @@ #define AB8500_ADSLOTSEL14 0x2C #define AB8500_ADSLOTSEL15 0x2D #define AB8500_ADSLOTSEL16 0x2E +#define AB8500_ADSLOTSEL(slot) (AB8500_ADSLOTSEL1 + (slot 1)) #define AB8500_ADSLOTHIZCTRL1 0x2F #define AB8500_ADSLOTHIZCTRL2 0x30 #define AB8500_ADSLOTHIZCTRL3 0x31 @@ -151,6 +152,7 @@ #define AB8500_CACHEREGNUM (AB8500_LAST_REG + 1) #define AB8500_MASK_ALL0xFF +#define AB8500_MASK_SLOT(slot) ((slot 1) ? 0xF0 : 0x0F) #define AB8500_MASK_NONE 0x00 /* AB8500_POWERUP */ @@ -354,28 +356,21 @@ #define AB8500_DIGIFCONF4_IF1WL0 0 /* AB8500_ADSLOTSELX */ -#define AB8500_ADSLOTSELX_AD_OUT1_TO_SLOT_ODD 0x00 -#define AB8500_ADSLOTSELX_AD_OUT2_TO_SLOT_ODD 0x10 -#define AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_ODD 0x20 -#define AB8500_ADSLOTSELX_AD_OUT4_TO_SLOT_ODD 0x30 -#define AB8500_ADSLOTSELX_AD_OUT5_TO_SLOT_ODD 0x40 -#define AB8500_ADSLOTSELX_AD_OUT6_TO_SLOT_ODD 0x50 -#define AB8500_ADSLOTSELX_AD_OUT7_TO_SLOT_ODD 0x60 -#define AB8500_ADSLOTSELX_AD_OUT8_TO_SLOT_ODD 0x70 -#define AB8500_ADSLOTSELX_ZEROES_TO_SLOT_ODD 0x80 -#define AB8500_ADSLOTSELX_TRISTATE_TO_SLOT_ODD 0xF0 -#define AB8500_ADSLOTSELX_AD_OUT1_TO_SLOT_EVEN 0x00 -#define AB8500_ADSLOTSELX_AD_OUT2_TO_SLOT_EVEN 0x01 -#define AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_EVEN 0x02 -#define AB8500_ADSLOTSELX_AD_OUT4_TO_SLOT_EVEN 0x03 -#define AB8500_ADSLOTSELX_AD_OUT5_TO_SLOT_EVEN 0x04 -#define AB8500_ADSLOTSELX_AD_OUT6_TO_SLOT_EVEN 0x05 -#define AB8500_ADSLOTSELX_AD_OUT7_TO_SLOT_EVEN 0x06 -#define AB8500_ADSLOTSELX_AD_OUT8_TO_SLOT_EVEN 0x07 -#define AB8500_ADSLOTSELX_ZEROES_TO_SLOT_EVEN 0x08 -#define AB8500_ADSLOTSELX_TRISTATE_TO_SLOT_EVEN0x0F +#define AB8500_AD_OUT1 0x0 +#define AB8500_AD_OUT2 0x1 +#define AB8500_AD_OUT3 0x2 +#define AB8500_AD_OUT4 0x3 +#define AB8500_AD_OUT5 0x4 +#define AB8500_AD_OUT6 0x5 +#define AB8500_AD_OUT7 0x6 +#define AB8500_AD_OUT8 0x7 +#define
Re: [GIT PULL v2] MFD: Fixes due for the v3.10 -rc:s
On Fri, May 17, 2013 at 10:25:10AM +0200, Linus Walleij wrote: > On Fri, May 17, 2013 at 9:51 AM, Fabio Baltieri > wrote: > > Hello Samuel, > (...) > > The last two: > > > > mfd: ab8500-sysctrl: Set sysctrl_dev during probe > > mfd: ab8500-sysctrl: Let sysctrl driver work without pdata > > > > are actually fixes for bugs introduced in this merge window that > > inhibited the ab8500-sysctl driver as a consequence. Would you > > reconsider pulling just those? > > A good way to make sure that patches fixing regressions are applied > to the -rc series is to indicate in the commit message or even the > heading that it fixes a regression. > > I usually try to begin such commits with the text: > > this patch fixes a regression caused by change 018745435 > "foo: fix bar"... > > Then copying in some crash dump text never hurts :-) > > It makes it very easy for us as subsystem maintainers to pick > regression fixes. Right, I actually pointed to the culprit commit (applied during the merge window) in the message, but I'll try to be more direct next time. I also agree on the crash dump, but unfortunately this one was failing silently. :-) Thanks for the tip! Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ARM: ux500: update MSP1 pinctrl defintions
On Wed, May 15, 2013 at 09:35:17PM +0200, Linus Walleij wrote: > On Wed, May 8, 2013 at 11:09 AM, Fabio Baltieri > wrote: > > > Update MSP1 pinctrl definitions in mop500_family_pinmap by removing > > sleep state and setting default ones as pin hogs, as those are used by > > both ux500-msp-i2s.1 and ux500-msp-i2s.3. > > > > Signed-off-by: Fabio Baltieri > > Applied to my ux500-pinctrl branch. Thanks Linus, This one was actually sort-of related to the ASoC patch to drop sleep pin state control from the ux500 ASoC driver. Would you be able to check that one too? The subject is: [PATCH 3/6] ASoC: ux500: Drop pinctrl sleep support There are no dependency issues by applying this and the other in different trees, but I'd like to close the discussion on the other one. Thanks, Fabio -- Fabio Baltieri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/