* Re: [PATCHv2 2/4] ath10k: Add support to update btcoex priority value via nl80211
From: kbuild test robot @ 2016-11-17 14:36 UTC (permalink / raw)
Cc: devicetree, robh, linux-wireless, linux-kernel, ath10k,
Tamizh chelvam, tamizhchelvam, kbuild-all
In-Reply-To: <1479383064-25718-3-git-send-email-c_traja@qti.qualcomm.com>
[-- Attachment #1: Type: text/plain, Size: 10954 bytes --]
Hi Tamizh,
[auto build test ERROR on ath6kl/ath-next]
[also build test ERROR on next-20161117]
[cannot apply to v4.9-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/c_traja-qti-qualcomm-com/ath10k-Add-support-for-BTCOEX-feature/20161117-200322
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers/net/wireless/ath/ath10k/mac.c:7506:35: warning: 'struct cfg80211_btcoex_priority' declared inside parameter list will not be visible outside of this definition or declaration
ath10k_mac_get_btcoex_prio(struct cfg80211_btcoex_priority *btcoex_priority)
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c: In function 'ath10k_mac_get_btcoex_prio':
>> drivers/net/wireless/ath/ath10k/mac.c:7510:21: error: dereferencing pointer to incomplete type 'struct cfg80211_btcoex_priority'
if (btcoex_priority->wlan_be_preferred)
^~
>> drivers/net/wireless/ath/ath10k/mac.c:7511:18: error: 'WIPHY_WLAN_BE_PREFERRED' undeclared (first use in this function)
btcoex_prio |= WIPHY_WLAN_BE_PREFERRED;
^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c:7511:18: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/net/wireless/ath/ath10k/mac.c:7514:18: error: 'WIPHY_WLAN_BK_PREFERRED' undeclared (first use in this function)
btcoex_prio |= WIPHY_WLAN_BK_PREFERRED;
^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/wireless/ath/ath10k/mac.c:7517:18: error: 'WIPHY_WLAN_VI_PREFERRED' undeclared (first use in this function)
btcoex_prio |= WIPHY_WLAN_VI_PREFERRED;
^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/wireless/ath/ath10k/mac.c:7520:18: error: 'WIPHY_WLAN_VO_PREFERRED' undeclared (first use in this function)
btcoex_prio |= WIPHY_WLAN_VO_PREFERRED;
^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/wireless/ath/ath10k/mac.c:7523:18: error: 'WIPHY_WLAN_BEACON_PREFERRED' undeclared (first use in this function)
btcoex_prio |= WIPHY_WLAN_BEACON_PREFERRED;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/wireless/ath/ath10k/mac.c:7526:18: error: 'WIPHY_WLAN_MGMT_PREFERRED' undeclared (first use in this function)
btcoex_prio |= WIPHY_WLAN_MGMT_PREFERRED;
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c: At top level:
drivers/net/wireless/ath/ath10k/mac.c:7532:11: warning: 'struct cfg80211_btcoex_priority' declared inside parameter list will not be visible outside of this definition or declaration
struct cfg80211_btcoex_priority *btcoex_priority)
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c: In function 'ath10k_mac_op_set_btcoex_priority':
>> drivers/net/wireless/ath/ath10k/mac.c:7551:43: error: passing argument 1 of 'ath10k_mac_get_btcoex_prio' from incompatible pointer type [-Werror=incompatible-pointer-types]
btcoex_prio = ath10k_mac_get_btcoex_prio(btcoex_priority);
^~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c:7506:1: note: expected 'struct cfg80211_btcoex_priority *' but argument is of type 'struct cfg80211_btcoex_priority *'
ath10k_mac_get_btcoex_prio(struct cfg80211_btcoex_priority *btcoex_priority)
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c: At top level:
drivers/net/wireless/ath/ath10k/mac.c:7611:2: error: unknown field 'set_btcoex' specified in initializer
.set_btcoex = ath10k_mac_op_set_btcoex,
^
drivers/net/wireless/ath/ath10k/mac.c:7611:36: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.set_btcoex = ath10k_mac_op_set_btcoex,
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c:7611:36: note: (near initialization for 'ath10k_ops.reconfig_complete')
>> drivers/net/wireless/ath/ath10k/mac.c:7612:2: error: unknown field 'set_btcoex_priority' specified in initializer
.set_btcoex_priority = ath10k_mac_op_set_btcoex_priority,
^
drivers/net/wireless/ath/ath10k/mac.c:7612:26: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.set_btcoex_priority = ath10k_mac_op_set_btcoex_priority,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c:7612:26: note: (near initialization for 'ath10k_ops.ipv6_addr_change')
drivers/net/wireless/ath/ath10k/mac.c: In function 'ath10k_mac_register':
>> drivers/net/wireless/ath/ath10k/mac.c:8203:16: error: 'struct wiphy' has no member named 'btcoex_support_flags'
ar->hw->wiphy->btcoex_support_flags =
^~
drivers/net/wireless/ath/ath10k/mac.c:8204:4: error: 'WIPHY_WLAN_BE_PREFERRED' undeclared (first use in this function)
WIPHY_WLAN_BE_PREFERRED |
^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c:8205:4: error: 'WIPHY_WLAN_BK_PREFERRED' undeclared (first use in this function)
WIPHY_WLAN_BK_PREFERRED |
^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c:8206:4: error: 'WIPHY_WLAN_VI_PREFERRED' undeclared (first use in this function)
WIPHY_WLAN_VI_PREFERRED |
^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c:8207:4: error: 'WIPHY_WLAN_VO_PREFERRED' undeclared (first use in this function)
WIPHY_WLAN_VO_PREFERRED |
^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c:8208:4: error: 'WIPHY_WLAN_BEACON_PREFERRED' undeclared (first use in this function)
WIPHY_WLAN_BEACON_PREFERRED |
^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c:8209:4: error: 'WIPHY_WLAN_MGMT_PREFERRED' undeclared (first use in this function)
WIPHY_WLAN_MGMT_PREFERRED;
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c:8211:20: error: 'struct wiphy' has no member named 'btcoex_support_flags'
ar->hw->wiphy->btcoex_support_flags);
^~
cc1: some warnings being treated as errors
vim +7510 drivers/net/wireless/ath/ath10k/mac.c
7500 mutex_unlock(&ar->conf_mutex);
7501
7502 return ret;
7503 }
7504
7505 u32
> 7506 ath10k_mac_get_btcoex_prio(struct cfg80211_btcoex_priority *btcoex_priority)
7507 {
7508 u32 btcoex_prio = 0;
7509
> 7510 if (btcoex_priority->wlan_be_preferred)
> 7511 btcoex_prio |= WIPHY_WLAN_BE_PREFERRED;
7512
7513 if (btcoex_priority->wlan_bk_preferred)
> 7514 btcoex_prio |= WIPHY_WLAN_BK_PREFERRED;
7515
7516 if (btcoex_priority->wlan_vi_preferred)
> 7517 btcoex_prio |= WIPHY_WLAN_VI_PREFERRED;
7518
7519 if (btcoex_priority->wlan_vo_preferred)
> 7520 btcoex_prio |= WIPHY_WLAN_VO_PREFERRED;
7521
7522 if (btcoex_priority->wlan_beacon_preferred)
> 7523 btcoex_prio |= WIPHY_WLAN_BEACON_PREFERRED;
7524
7525 if (btcoex_priority->wlan_mgmt_preferred)
> 7526 btcoex_prio |= WIPHY_WLAN_MGMT_PREFERRED;
7527
7528 return btcoex_prio;
7529 }
7530
7531 static int ath10k_mac_op_set_btcoex_priority(struct ieee80211_hw *hw,
7532 struct cfg80211_btcoex_priority *btcoex_priority)
7533 {
7534 u32 btcoex_prio;
7535 struct ath10k *ar = hw->priv;
7536 int ret;
7537
7538 if (!(test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags))) {
7539 ret = -EINVAL;
7540 goto exit;
7541 }
7542
7543 mutex_lock(&ar->conf_mutex);
7544
7545 if (ar->state != ATH10K_STATE_ON &&
7546 ar->state != ATH10K_STATE_RESTARTED) {
7547 ret = -ENETDOWN;
7548 goto exit;
7549 }
7550
> 7551 btcoex_prio = ath10k_mac_get_btcoex_prio(btcoex_priority);
7552
7553 if (btcoex_prio > 0x3f) {
7554 ret = -E2BIG;
7555 goto exit;
7556 }
7557
7558 ret = ath10k_wmi_set_coex_param(ar, btcoex_prio);
7559
7560 if (ret) {
7561 ath10k_warn(ar, "failed to set btcoex priority: %d\n", ret);
7562 goto exit;
7563 }
7564
7565 exit:
7566 mutex_unlock(&ar->conf_mutex);
7567 return ret;
7568 }
7569
7570 static const struct ieee80211_ops ath10k_ops = {
7571 .tx = ath10k_mac_op_tx,
7572 .wake_tx_queue = ath10k_mac_op_wake_tx_queue,
7573 .start = ath10k_start,
7574 .stop = ath10k_stop,
7575 .config = ath10k_config,
7576 .add_interface = ath10k_add_interface,
7577 .remove_interface = ath10k_remove_interface,
7578 .configure_filter = ath10k_configure_filter,
7579 .bss_info_changed = ath10k_bss_info_changed,
7580 .set_coverage_class = ath10k_mac_op_set_coverage_class,
7581 .hw_scan = ath10k_hw_scan,
7582 .cancel_hw_scan = ath10k_cancel_hw_scan,
7583 .set_key = ath10k_set_key,
7584 .set_default_unicast_key = ath10k_set_default_unicast_key,
7585 .sta_state = ath10k_sta_state,
7586 .conf_tx = ath10k_conf_tx,
7587 .remain_on_channel = ath10k_remain_on_channel,
7588 .cancel_remain_on_channel = ath10k_cancel_remain_on_channel,
7589 .set_rts_threshold = ath10k_set_rts_threshold,
7590 .set_frag_threshold = ath10k_mac_op_set_frag_threshold,
7591 .flush = ath10k_flush,
7592 .tx_last_beacon = ath10k_tx_last_beacon,
7593 .set_antenna = ath10k_set_antenna,
7594 .get_antenna = ath10k_get_antenna,
7595 .reconfig_complete = ath10k_reconfig_complete,
7596 .get_survey = ath10k_get_survey,
7597 .set_bitrate_mask = ath10k_mac_op_set_bitrate_mask,
7598 .sta_rc_update = ath10k_sta_rc_update,
7599 .get_tsf = ath10k_get_tsf,
7600 .set_tsf = ath10k_set_tsf,
7601 .ampdu_action = ath10k_ampdu_action,
7602 .get_et_sset_count = ath10k_debug_get_et_sset_count,
7603 .get_et_stats = ath10k_debug_get_et_stats,
7604 .get_et_strings = ath10k_debug_get_et_strings,
7605 .add_chanctx = ath10k_mac_op_add_chanctx,
7606 .remove_chanctx = ath10k_mac_op_remove_chanctx,
7607 .change_chanctx = ath10k_mac_op_change_chanctx,
7608 .assign_vif_chanctx = ath10k_mac_op_assign_vif_chanctx,
7609 .unassign_vif_chanctx = ath10k_mac_op_unassign_vif_chanctx,
7610 .switch_vif_chanctx = ath10k_mac_op_switch_vif_chanctx,
> 7611 .set_btcoex = ath10k_mac_op_set_btcoex,
> 7612 .set_btcoex_priority = ath10k_mac_op_set_btcoex_priority,
7613
7614 CFG80211_TESTMODE_CMD(ath10k_tm_cmd)
7615
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 56822 bytes --]
[-- Attachment #3: Type: text/plain, Size: 146 bytes --]
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k
^ permalink raw reply
* Re: [RFC PATCH] of: base: add support to get machine model name
From: Sudeep Holla @ 2016-11-17 14:16 UTC (permalink / raw)
To: Arnd Bergmann, linuxppc-dev
Cc: Sudeep Holla, linux-arm-kernel, linux-mips, devicetree, linux-sh,
linux-kernel, linux-renesas-soc, Rob Herring
In-Reply-To: <2202339.ajrKjCY7Ro@wuerfel>
On 17/11/16 14:13, Arnd Bergmann wrote:
> On Thursday, November 17, 2016 2:08:30 PM CET Sudeep Holla wrote:
>> On 17/11/16 13:50, Arnd Bergmann wrote:
>>> On Thursday, November 17, 2016 11:50:50 AM CET Sudeep Holla wrote:
>>>> Currently platforms/drivers needing to get the machine model name are
>>>> replicating the same snippet of code. In some case, the OF reference
>>>> counting is either missing or incorrect.
>>>>
>>>> This patch adds support to read the machine model name either using
>>>> the "model" or the "compatible" property in the device tree root node.
>>>>
>>>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
>>>
>>> I like the idea. One small comment:
>>>
>>
>> Thanks. I prefer it as single patch but it can't be applied to any tree.
>> Any suggestions on handling this patch to fix the warning in -next ?
>>
> The patch that causes the warning is currently in the mmc tree, and I
> don't think it would be good to have your entire patch in there too.
>
> It's probably best to just fix the warning there now by adding another
> open-coded copy of that function, and then apply your patch on top
> for v4.11.
Sure, that's much simpler to deal with for now.
--
Regards,
Sudeep
^ permalink raw reply
* Re: [RFC PATCH] of: base: add support to get machine model name
From: Arnd Bergmann @ 2016-11-17 14:13 UTC (permalink / raw)
To: linuxppc-dev
Cc: Sudeep Holla, linux-arm-kernel, linux-mips, devicetree, linux-sh,
linux-kernel, linux-renesas-soc, Rob Herring
In-Reply-To: <622ddcbc-69b9-98f2-51f3-e256764ecb93@arm.com>
On Thursday, November 17, 2016 2:08:30 PM CET Sudeep Holla wrote:
> On 17/11/16 13:50, Arnd Bergmann wrote:
> > On Thursday, November 17, 2016 11:50:50 AM CET Sudeep Holla wrote:
> >> Currently platforms/drivers needing to get the machine model name are
> >> replicating the same snippet of code. In some case, the OF reference
> >> counting is either missing or incorrect.
> >>
> >> This patch adds support to read the machine model name either using
> >> the "model" or the "compatible" property in the device tree root node.
> >>
> >> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> >
> > I like the idea. One small comment:
> >
>
> Thanks. I prefer it as single patch but it can't be applied to any tree.
> Any suggestions on handling this patch to fix the warning in -next ?
>
The patch that causes the warning is currently in the mmc tree, and I
don't think it would be good to have your entire patch in there too.
It's probably best to just fix the warning there now by adding another
open-coded copy of that function, and then apply your patch on top
for v4.11.
Arnd
^ permalink raw reply
* Re: [RFC PATCH] of: base: add support to get machine model name
From: Sudeep Holla @ 2016-11-17 14:08 UTC (permalink / raw)
To: Arnd Bergmann, linux-arm-kernel
Cc: Sudeep Holla, linux-kernel, linux-mips, devicetree, linux-sh,
linux-renesas-soc, Rob Herring, linuxppc-dev
In-Reply-To: <3670336.mMHByOpDl4@wuerfel>
On 17/11/16 13:50, Arnd Bergmann wrote:
> On Thursday, November 17, 2016 11:50:50 AM CET Sudeep Holla wrote:
>> Currently platforms/drivers needing to get the machine model name are
>> replicating the same snippet of code. In some case, the OF reference
>> counting is either missing or incorrect.
>>
>> This patch adds support to read the machine model name either using
>> the "model" or the "compatible" property in the device tree root node.
>>
>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
>
> I like the idea. One small comment:
>
Thanks. I prefer it as single patch but it can't be applied to any tree.
Any suggestions on handling this patch to fix the warning in -next ?
>> +int of_machine_get_model_name(const char **model)
>> +{
>> + int error;
>> + struct device_node *root;
>> +
>> + root = of_find_node_by_path("/");
>> + if (!root)
>> + return -EINVAL;
>
> The global of_root variable points ot this already, and is defined
> in the same file, so I think we can just skip the lookup.
>
Ah right, will fix it.
--
Regards,
Sudeep
^ permalink raw reply
* Re: [PATCHv2 1/4] ath10k: Add support to enable or disable btcoex via nl80211
From: kbuild test robot @ 2016-11-17 13:51 UTC (permalink / raw)
Cc: devicetree, robh, linux-wireless, linux-kernel, ath10k,
Tamizh chelvam, tamizhchelvam, kbuild-all
In-Reply-To: <1479383064-25718-2-git-send-email-c_traja@qti.qualcomm.com>
[-- Attachment #1: Type: text/plain, Size: 1967 bytes --]
Hi Tamizh,
[auto build test ERROR on ath6kl/ath-next]
[also build test ERROR on v4.9-rc5 next-20161117]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/c_traja-qti-qualcomm-com/ath10k-Add-support-for-BTCOEX-feature/20161117-200322
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
>> drivers/net/wireless/ath/ath10k/mac.c:7546:2: error: unknown field 'set_btcoex' specified in initializer
.set_btcoex = ath10k_mac_op_set_btcoex,
^
>> drivers/net/wireless/ath/ath10k/mac.c:7546:36: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.set_btcoex = ath10k_mac_op_set_btcoex,
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c:7546:36: note: (near initialization for 'ath10k_ops.reconfig_complete')
cc1: some warnings being treated as errors
vim +/set_btcoex +7546 drivers/net/wireless/ath/ath10k/mac.c
7540 .add_chanctx = ath10k_mac_op_add_chanctx,
7541 .remove_chanctx = ath10k_mac_op_remove_chanctx,
7542 .change_chanctx = ath10k_mac_op_change_chanctx,
7543 .assign_vif_chanctx = ath10k_mac_op_assign_vif_chanctx,
7544 .unassign_vif_chanctx = ath10k_mac_op_unassign_vif_chanctx,
7545 .switch_vif_chanctx = ath10k_mac_op_switch_vif_chanctx,
> 7546 .set_btcoex = ath10k_mac_op_set_btcoex,
7547
7548 CFG80211_TESTMODE_CMD(ath10k_tm_cmd)
7549
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 56822 bytes --]
[-- Attachment #3: Type: text/plain, Size: 146 bytes --]
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k
^ permalink raw reply
* Re: [RFC PATCH] of: base: add support to get machine model name
From: Arnd Bergmann @ 2016-11-17 13:50 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Sudeep Holla, linux-kernel, linux-mips, devicetree, linux-sh,
linux-renesas-soc, Rob Herring, linuxppc-dev
In-Reply-To: <1479383450-19183-1-git-send-email-sudeep.holla@arm.com>
On Thursday, November 17, 2016 11:50:50 AM CET Sudeep Holla wrote:
> Currently platforms/drivers needing to get the machine model name are
> replicating the same snippet of code. In some case, the OF reference
> counting is either missing or incorrect.
>
> This patch adds support to read the machine model name either using
> the "model" or the "compatible" property in the device tree root node.
>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
I like the idea. One small comment:
> +int of_machine_get_model_name(const char **model)
> +{
> + int error;
> + struct device_node *root;
> +
> + root = of_find_node_by_path("/");
> + if (!root)
> + return -EINVAL;
The global of_root variable points ot this already, and is defined
in the same file, so I think we can just skip the lookup.
Arnd
^ permalink raw reply
* Re: [PATCH] ARM: dt: imx31: fix AVIC base address
From: Fabio Estevam @ 2016-11-17 13:44 UTC (permalink / raw)
To: Vladimir Zapolskiy
Cc: devicetree@vger.kernel.org, Russell King, Rob Herring,
Vladimir Zapolskiy, Sascha Hauer, Fabio Estevam, Shawn Guo,
linux-arm-kernel@lists.infradead.org
In-Reply-To: <20161117013051.29381-1-vz@mleia.com>
On Wed, Nov 16, 2016 at 11:30 PM, Vladimir Zapolskiy <vz@mleia.com> wrote:
> From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
>
> On i.MX31 AVIC interrupt controller base address is at 0x68000000.
>
> The problem was shadowed by the AVIC driver, which takes the correct
> base address from a SoC specific header file.
>
> Fixes: d2a37b3d91f4 ("ARM i.MX31: Add devicetree support")
> Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Yes, this is what the Reference Manual states, thanks.
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
^ permalink raw reply
* Re: [PATCH v3 2/3] drm/bridge: Add ti-tfp410 DVI transmitter driver
From: Jyri Sarha @ 2016-11-17 13:39 UTC (permalink / raw)
To: dri-devel, devicetree
Cc: bcousson, khilman, bgolaszewski, tomi.valkeinen, laurent.pinchart
In-Reply-To: <6eaa1b5d467cd354f7d5dc5ff8da1b9bf732ff11.1479388871.git.jsarha@ti.com>
On 11/17/16 15:28, Jyri Sarha wrote:
> Add very basic ti-ftp410 DVI transmitter driver. The only feature
> separating this from a completely dummy bridge is the EDID read
> support trough DDC I2C. Even that functionality should be in a
> separate generic connector driver. However, because of missing DRM
> infrastructure support the connector is implemented within the bridge
> driver. Some tfp410 HW specific features may be added later if needed,
> because there is a set of registers behind i2c if it is connected.
>
> This implementation is tested against my new tilcdc bridge support
> and it works with BeagleBone DVI-D Cape Rev A3. A DT binding document
> is also added.
>
> Signed-off-by: Jyri Sarha <jsarha@ti.com>
> ---
> .../bindings/display/bridge/ti,tfp410.txt | 40 +++
> drivers/gpu/drm/bridge/Kconfig | 7 +
> drivers/gpu/drm/bridge/Makefile | 1 +
> drivers/gpu/drm/bridge/ti-tfp410.c | 287 +++++++++++++++++++++
> 4 files changed, 335 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt
> create mode 100644 drivers/gpu/drm/bridge/ti-tfp410.c
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt b/Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt
> new file mode 100644
> index 0000000..6174b18
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt
> @@ -0,0 +1,40 @@
> +TFP410 DVI bridge bindings
> +
> +Required properties:
> + - compatible: "ti,tfp410"
> +
> +Optional properties
> + - reg: I2C address. If and only if present the device node
> + should be placed into the i2c controller node where the
> + tfp410 i2c is connected to.
> +
> +Required subnodes:
> + - port@0: Video input port node to connect the bridge to a
> + display controller output [1].
> + - port@1: Video output port node to connect the bridge to a
> + connector input [1].
> +
> +[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
> +
> +Example:
> + hdmi-bridge {
> + compatible = "ti,tfp410";
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + bridge_in: endpoint {
> + remote-endpoint = <&dc_out>;
> + };
> + };
> +
> + port@1 {
> + reg = <1>;
> + bridge_out: endpoint {
> + remote-endpoint = <&hdmi_in>;
> + };
> + };
> + };
> + };
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index bd6acc8..a424e03 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -81,6 +81,13 @@ config DRM_TOSHIBA_TC358767
> ---help---
> Toshiba TC358767 eDP bridge chip driver.
>
> +config DRM_TI_TFP410
> + tristate "TI TFP410 DVI/HDMI bridge"
> + depends on OF
> + select DRM_KMS_HELPER
> + ---help---
> + Texas Instruments TFP410 DVI/HDMI Transmitter driver
> +
> source "drivers/gpu/drm/bridge/analogix/Kconfig"
>
> source "drivers/gpu/drm/bridge/adv7511/Kconfig"
> diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
> index 97ed1a5..8b065d9 100644
> --- a/drivers/gpu/drm/bridge/Makefile
> +++ b/drivers/gpu/drm/bridge/Makefile
> @@ -11,3 +11,4 @@ obj-$(CONFIG_DRM_SII902X) += sii902x.o
> obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
> obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
> obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
> +obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
> diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
> new file mode 100644
> index 0000000..64f54e4
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/ti-tfp410.c
> @@ -0,0 +1,287 @@
> +/*
> + * Copyright (C) 2016 Texas Instruments
> + * Author: Jyri Sarha <jsarha@ti.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published by
> + * the Free Software Foundation.
> + *
> + */
> +
> +#include <linux/module.h>
> +#include <linux/of_graph.h>
> +#include <linux/platform_device.h>
> +#include <linux/i2c.h>
> +
> +#include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
> +#include <drm/drm_crtc.h>
> +#include <drm/drm_crtc_helper.h>
> +
> +struct tfp410 {
> + struct drm_bridge bridge;
> + struct drm_connector connector;
> +
> + struct i2c_adapter *ddc;
> +
> + struct device *dev;
> +};
> +
> +static inline struct tfp410 *
> +drm_bridge_to_tfp410(struct drm_bridge *bridge)
> +{
> + return container_of(bridge, struct tfp410, bridge);
> +}
> +
> +static inline struct tfp410 *
> +drm_connector_to_tfp410(struct drm_connector *connector)
> +{
> + return container_of(connector, struct tfp410, connector);
> +}
> +
> +static int tfp410_get_modes(struct drm_connector *connector)
> +{
> + struct tfp410 *dvi = drm_connector_to_tfp410(connector);
> + struct edid *edid;
> + int ret;
> +
> + if (!dvi->ddc)
> + goto fallback;
> +
> + edid = drm_get_edid(connector, dvi->ddc);
> + if (!edid) {
> + DRM_INFO("EDID read failed. Fallback to standard modes\n");
> + goto fallback;
> + }
> +
> + drm_mode_connector_update_edid_property(connector, edid);
> +
> + return drm_add_edid_modes(connector, edid);
> +fallback:
> + /* No EDID, fallback on the XGA standard modes */
> + ret = drm_add_modes_noedid(connector, 1920, 1200);
> +
> + /* And prefer a mode pretty much anything can handle */
> + drm_set_preferred_mode(connector, 1024, 768);
> +
> + return ret;
> +}
> +
> +static const struct drm_connector_helper_funcs tfp410_con_helper_funcs = {
> + .get_modes = tfp410_get_modes,
> +};
> +
> +static enum drm_connector_status
> +tfp410_connector_detect(struct drm_connector *connector, bool force)
> +{
> + struct tfp410 *dvi = drm_connector_to_tfp410(connector);
> +
> + if (dvi->ddc) {
> + if (drm_probe_ddc(dvi->ddc))
> + return connector_status_connected;
> + else
> + return connector_status_disconnected;
> + }
> +
> + return connector_status_unknown;
> +}
> +
> +static const struct drm_connector_funcs tfp410_con_funcs = {
> + .dpms = drm_atomic_helper_connector_dpms,
> + .detect = tfp410_connector_detect,
> + .fill_modes = drm_helper_probe_single_connector_modes,
> + .destroy = drm_connector_cleanup,
> + .reset = drm_atomic_helper_connector_reset,
> + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> +};
> +
> +static int tfp410_attach(struct drm_bridge *bridge)
> +{
> + struct tfp410 *dvi = drm_bridge_to_tfp410(bridge);
> + int ret;
> +
> + if (!bridge->encoder) {
> + dev_err(dvi->dev, "Missing encoder\n");
> + return -ENODEV;
> + }
> +
> + drm_connector_helper_add(&dvi->connector,
> + &tfp410_con_helper_funcs);
> + ret = drm_connector_init(bridge->dev, &dvi->connector,
> + &tfp410_con_funcs, DRM_MODE_CONNECTOR_HDMIA);
> + if (ret) {
> + dev_err(dvi->dev, "drm_connector_init() failed: %d\n", ret);
> + return ret;
> + }
> +
> + drm_mode_connector_attach_encoder(&dvi->connector,
> + bridge->encoder);
> +
> + return 0;
> +}
> +
> +static const struct drm_bridge_funcs tfp410_bridge_funcs = {
> + .attach = tfp410_attach,
> +};
> +
> +static int tfp410_get_connector_ddc(struct tfp410 *dvi)
> +{
> + struct device_node *ep = NULL, *connector_node = NULL;
> + struct device_node *ddc_phandle = NULL;
> + int ret = 0;
> +
> + /* port@1 is the connector node */
> + ep = of_graph_get_endpoint_by_regs(dvi->dev->of_node, 1, -1);
> + if (!ep)
> + goto fail;
> +
> + connector_node = of_graph_get_remote_port_parent(ep);
> + if (!connector_node)
> + goto fail;
> +
> + ddc_phandle = of_parse_phandle(connector_node, "ddc-i2c-bus", 0);
> + if (!ddc_phandle)
> + goto fail;
> +
> + dvi->ddc = of_get_i2c_adapter_by_node(ddc_phandle);
> + if (dvi->ddc)
> + dev_info(dvi->dev, "Connector's ddc i2c bus found\n");
> + else
> + ret = -EPROBE_DEFER;
> +
> +fail:
> + of_node_put(ep);
> + of_node_put(connector_node);
> + of_node_put(ddc_phandle);
> + return ret;
> +}
> +
> +static int tfp410_init(struct device *dev)
> +{
> + struct tfp410 *dvi;
> + int ret;
> +
> + if (!dev->of_node) {
> + dev_err(dev, "device-tree data is missing\n");
> + return -ENXIO;
> + }
> +
> + dvi = devm_kzalloc(dev, sizeof(*dvi), GFP_KERNEL);
> + if (!dvi)
> + return -ENOMEM;
> + dev_set_drvdata(dev, dvi);
> +
> + dvi->bridge.funcs = &tfp410_bridge_funcs;
> + dvi->bridge.of_node = dev->of_node;
> + dvi->dev = dev;
> +
> + ret = tfp410_get_connector_ddc(dvi);
> + if (ret)
> + goto fail;
> +
> + ret = drm_bridge_add(&dvi->bridge);
> + if (ret) {
> + dev_err(dev, "drm_bridge_add() failed: %d\n", ret);
> + goto fail;
> + }
> +
> + return 0;
> +fail:
> + i2c_put_adapter(dvi->ddc);
> + return ret;
> +}
> +
> +static int tfp410_fini(struct device *dev)
> +{
> + struct tfp410 *dvi = dev_get_drvdata(dev);
> +
> + drm_bridge_remove(&dvi->bridge);
> +
> + if (dvi->ddc)
> + i2c_put_adapter(dvi->ddc);
> +
> + return 0;
> +}
> +
> +static int tfp410_probe(struct platform_device *pdev)
> +{
> + return tfp410_init(&pdev->dev);
> +}
> +
> +static int tfp410_remove(struct platform_device *pdev)
> +{
> + return tfp410_fini(&pdev->dev);
> +}
> +
> +/* There is currently no i2c functionality. */
> +static int tfp410_i2c_probe(struct i2c_client *client,
> + const struct i2c_device_id *id)
> +{
> + int reg;
> +
> + if (!client->dev.of_node ||
> + of_property_read_u32(client->dev.of_node, "reg", ®)) {
> + dev_err(&client->dev,
> + "Can't get i2c reg property from device-tree\n");
> + return -ENXIO;
> + }
> +
> + return tfp410_init(&client->dev);
> +}
> +
> +static int tfp410_i2c_remove(struct i2c_client *client)
> +{
> + return tfp410_fini(&client->dev);
> +}
> +
> +static const struct of_device_id tfp410_match[] = {
> + { .compatible = "ti,tfp410" },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, tfp410_match);
> +
> +struct platform_driver tfp410_platform_driver = {
> + .probe = tfp410_probe,
> + .remove = tfp410_remove,
> + .driver = {
> + .name = "tfp410-bridge",
> + .of_match_table = tfp410_match,
> + },
> +};
> +
> +static const struct i2c_device_id tfp410_i2c_ids[] = {
> + { "tfp410", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, tfp410_i2c_ids);
> +
> +static struct i2c_driver tfp410_i2c_driver = {
> + .driver = {
> + .name = "tfp410",
> + .of_match_table = of_match_ptr(tfp410_match),
> + },
> + .id_table = tfp410_i2c_ids,
> + .probe = tfp410_i2c_probe,
> + .remove = tfp410_i2c_remove,
> +};
> +
> +static int __init tfp410_module_init(void)
> +{
> + i2c_add_driver(&tfp410_i2c_driver);
> + platform_driver_register(&tfp410_platform_driver);
Oops, forgot to handle the return values. This is how I fixed it:
static int __init tfp410_module_init(void)
{
int ret;
ret = i2c_add_driver(&tfp410_i2c_driver);
if (ret)
return ret;
ret = platform_driver_register(&tfp410_platform_driver);
if (ret)
i2c_del_driver(&tfp410_i2c_driver);
return ret;
}
> +
> + return 0;
> +}
> +module_init(tfp410_module_init);
> +
> +static void __exit tfp410_module_exit(void)
> +{
> + i2c_del_driver(&tfp410_i2c_driver);
> + platform_driver_unregister(&tfp410_platform_driver);
> +}
> +module_exit(tfp410_module_exit);
> +
> +MODULE_AUTHOR("Jyri Sarha <jsarha@ti.com>");
> +MODULE_DESCRIPTION("TI TFP410 DVI bridge driver");
> +MODULE_LICENSE("GPL");
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* [PATCH v3 3/3] drm/tilcdc: Add drm bridge support for attaching drm bridge drivers
From: Jyri Sarha @ 2016-11-17 13:28 UTC (permalink / raw)
To: dri-devel, devicetree
Cc: bcousson, khilman, Jyri Sarha, bgolaszewski, tomi.valkeinen,
laurent.pinchart
In-Reply-To: <cover.1479388871.git.jsarha@ti.com>
Adds drm bride support for attaching drm bridge drivers to tilcdc. The
decision whether a video port leads to an external encoder or bridge
is made simply based on remote device's compatible string. The code
has been tested with BeagleBone-Black with and without BeagleBone
DVI-D Cape Rev A3 using ti-tfp410 driver.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 7 +-
drivers/gpu/drm/tilcdc/tilcdc_drv.h | 2 +
drivers/gpu/drm/tilcdc/tilcdc_external.c | 140 +++++++++++++++++++++++++++----
drivers/gpu/drm/tilcdc/tilcdc_external.h | 1 +
4 files changed, 131 insertions(+), 19 deletions(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 3d2cea0..af959df 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -384,9 +384,14 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
ret = tilcdc_add_external_encoders(ddev);
if (ret < 0)
goto init_failed;
+ } else {
+ ret = tilcdc_attach_remote_device(ddev);
+ if (ret)
+ goto init_failed;
}
- if ((priv->num_encoders == 0) || (priv->num_connectors == 0)) {
+ if (!priv->remote_encoder &&
+ ((priv->num_encoders == 0) || (priv->num_connectors == 0))) {
dev_err(dev, "no encoders/connectors found\n");
ret = -ENXIO;
goto init_failed;
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
index d31fe5d..283ff28 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
@@ -90,6 +90,8 @@ struct tilcdc_drm_private {
struct drm_connector *connectors[8];
const struct drm_connector_helper_funcs *connector_funcs[8];
+ struct drm_encoder *remote_encoder;
+
bool is_registered;
bool is_componentized;
};
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c
index 06a4c58..e1576ba 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_external.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c
@@ -28,6 +28,18 @@
.raster_order = 0,
};
+static const struct tilcdc_panel_info panel_info_default = {
+ .ac_bias = 255,
+ .ac_bias_intrpt = 0,
+ .dma_burst_sz = 16,
+ .bpp = 16,
+ .fdd = 0x80,
+ .tft_alt_mode = 0,
+ .sync_edge = 0,
+ .sync_ctrl = 1,
+ .raster_order = 0,
+};
+
static int tilcdc_external_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
@@ -130,6 +142,101 @@ void tilcdc_remove_external_encoders(struct drm_device *dev)
priv->connector_funcs[i]);
}
+static const struct drm_encoder_funcs tilcdc_remote_encoder_funcs = {
+ .destroy = drm_encoder_cleanup,
+};
+
+static
+int tilcdc_attach_bridge(struct drm_device *ddev, struct drm_bridge *bridge)
+{
+ struct tilcdc_drm_private *priv = ddev->dev_private;
+ int ret;
+
+ priv->remote_encoder->possible_crtcs = BIT(0);
+ priv->remote_encoder->bridge = bridge;
+ bridge->encoder = priv->remote_encoder;
+
+ ret = drm_bridge_attach(ddev, bridge);
+ if (ret) {
+ dev_err(ddev->dev, "drm_bridge_attach() failed %d\n", ret);
+ return ret;
+ }
+
+ tilcdc_crtc_set_panel_info(priv->crtc, &panel_info_default);
+
+ return 0;
+}
+
+static int tilcdc_node_has_port(struct device_node *dev_node)
+{
+ struct device_node *node;
+
+ node = of_get_child_by_name(dev_node, "ports");
+ if (!node)
+ node = of_get_child_by_name(dev_node, "port");
+ if (!node)
+ return 0;
+ of_node_put(node);
+
+ return 1;
+}
+
+static
+struct device_node *tilcdc_get_remote_node(struct device_node *node)
+{
+ struct device_node *ep;
+ struct device_node *parent;
+
+ if (!tilcdc_node_has_port(node))
+ return NULL;
+
+ ep = of_graph_get_next_endpoint(node, NULL);
+ if (!ep)
+ return NULL;
+
+ parent = of_graph_get_remote_port_parent(ep);
+ of_node_put(ep);
+
+ return parent;
+}
+
+int tilcdc_attach_remote_device(struct drm_device *ddev)
+{
+ struct tilcdc_drm_private *priv = ddev->dev_private;
+ struct device_node *remote_node;
+ struct drm_bridge *bridge;
+ int ret;
+
+ remote_node = tilcdc_get_remote_node(ddev->dev->of_node);
+ if (!remote_node)
+ return 0;
+
+ bridge = of_drm_find_bridge(remote_node);
+ of_node_put(remote_node);
+ if (!bridge)
+ return -EPROBE_DEFER;
+
+ priv->remote_encoder = devm_kzalloc(ddev->dev,
+ sizeof(*priv->remote_encoder),
+ GFP_KERNEL);
+ if (!priv->remote_encoder)
+ return -ENOMEM;
+
+ ret = drm_encoder_init(ddev, priv->remote_encoder,
+ &tilcdc_remote_encoder_funcs,
+ DRM_MODE_ENCODER_NONE, NULL);
+ if (ret) {
+ dev_err(ddev->dev, "drm_encoder_init() failed %d\n", ret);
+ return ret;
+ }
+
+ ret = tilcdc_attach_bridge(ddev, bridge);
+ if (ret)
+ drm_encoder_cleanup(priv->remote_encoder);
+
+ return ret;
+}
+
static int dev_match_of(struct device *dev, void *data)
{
return dev->of_node == data;
@@ -141,16 +248,10 @@ int tilcdc_get_external_components(struct device *dev,
struct device_node *node;
struct device_node *ep = NULL;
int count = 0;
+ int ret = 0;
- /* Avoid error print by of_graph_get_next_endpoint() if there
- * is no ports present.
- */
- node = of_get_child_by_name(dev->of_node, "ports");
- if (!node)
- node = of_get_child_by_name(dev->of_node, "port");
- if (!node)
+ if (!tilcdc_node_has_port(dev->of_node))
return 0;
- of_node_put(node);
while ((ep = of_graph_get_next_endpoint(dev->of_node, ep))) {
node = of_graph_get_remote_port_parent(ep);
@@ -160,17 +261,20 @@ int tilcdc_get_external_components(struct device *dev,
}
dev_dbg(dev, "Subdevice node '%s' found\n", node->name);
- if (match)
- drm_of_component_match_add(dev, match, dev_match_of,
- node);
- of_node_put(node);
- count++;
- }
- if (count > 1) {
- dev_err(dev, "Only one external encoder is supported\n");
- return -EINVAL;
+ if (of_device_is_compatible(node, "nxp,tda998x")) {
+ if (match)
+ drm_of_component_match_add(dev, match,
+ dev_match_of, node);
+ ret = 1;
+ }
+
+ of_node_put(node);
+ if (count++ > 1) {
+ dev_err(dev, "Only one port is supported\n");
+ return -EINVAL;
+ }
}
- return count;
+ return ret;
}
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.h b/drivers/gpu/drm/tilcdc/tilcdc_external.h
index c700e0c..a27c365 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_external.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_external.h
@@ -22,4 +22,5 @@
void tilcdc_remove_external_encoders(struct drm_device *dev);
int tilcdc_get_external_components(struct device *dev,
struct component_match **match);
+int tilcdc_attach_remote_device(struct drm_device *ddev);
#endif /* __TILCDC_SLAVE_H__ */
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related
* [PATCH v3 2/3] drm/bridge: Add ti-tfp410 DVI transmitter driver
From: Jyri Sarha @ 2016-11-17 13:28 UTC (permalink / raw)
To: dri-devel, devicetree
Cc: bcousson, khilman, Jyri Sarha, bgolaszewski, tomi.valkeinen,
laurent.pinchart
In-Reply-To: <cover.1479388871.git.jsarha@ti.com>
Add very basic ti-ftp410 DVI transmitter driver. The only feature
separating this from a completely dummy bridge is the EDID read
support trough DDC I2C. Even that functionality should be in a
separate generic connector driver. However, because of missing DRM
infrastructure support the connector is implemented within the bridge
driver. Some tfp410 HW specific features may be added later if needed,
because there is a set of registers behind i2c if it is connected.
This implementation is tested against my new tilcdc bridge support
and it works with BeagleBone DVI-D Cape Rev A3. A DT binding document
is also added.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
.../bindings/display/bridge/ti,tfp410.txt | 40 +++
drivers/gpu/drm/bridge/Kconfig | 7 +
drivers/gpu/drm/bridge/Makefile | 1 +
drivers/gpu/drm/bridge/ti-tfp410.c | 287 +++++++++++++++++++++
4 files changed, 335 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt
create mode 100644 drivers/gpu/drm/bridge/ti-tfp410.c
diff --git a/Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt b/Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt
new file mode 100644
index 0000000..6174b18
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt
@@ -0,0 +1,40 @@
+TFP410 DVI bridge bindings
+
+Required properties:
+ - compatible: "ti,tfp410"
+
+Optional properties
+ - reg: I2C address. If and only if present the device node
+ should be placed into the i2c controller node where the
+ tfp410 i2c is connected to.
+
+Required subnodes:
+ - port@0: Video input port node to connect the bridge to a
+ display controller output [1].
+ - port@1: Video output port node to connect the bridge to a
+ connector input [1].
+
+[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
+
+Example:
+ hdmi-bridge {
+ compatible = "ti,tfp410";
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ bridge_in: endpoint {
+ remote-endpoint = <&dc_out>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ bridge_out: endpoint {
+ remote-endpoint = <&hdmi_in>;
+ };
+ };
+ };
+ };
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index bd6acc8..a424e03 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -81,6 +81,13 @@ config DRM_TOSHIBA_TC358767
---help---
Toshiba TC358767 eDP bridge chip driver.
+config DRM_TI_TFP410
+ tristate "TI TFP410 DVI/HDMI bridge"
+ depends on OF
+ select DRM_KMS_HELPER
+ ---help---
+ Texas Instruments TFP410 DVI/HDMI Transmitter driver
+
source "drivers/gpu/drm/bridge/analogix/Kconfig"
source "drivers/gpu/drm/bridge/adv7511/Kconfig"
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 97ed1a5..8b065d9 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -11,3 +11,4 @@ obj-$(CONFIG_DRM_SII902X) += sii902x.o
obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
+obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
new file mode 100644
index 0000000..64f54e4
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ti-tfp410.c
@@ -0,0 +1,287 @@
+/*
+ * Copyright (C) 2016 Texas Instruments
+ * Author: Jyri Sarha <jsarha@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/of_graph.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+
+#include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_crtc_helper.h>
+
+struct tfp410 {
+ struct drm_bridge bridge;
+ struct drm_connector connector;
+
+ struct i2c_adapter *ddc;
+
+ struct device *dev;
+};
+
+static inline struct tfp410 *
+drm_bridge_to_tfp410(struct drm_bridge *bridge)
+{
+ return container_of(bridge, struct tfp410, bridge);
+}
+
+static inline struct tfp410 *
+drm_connector_to_tfp410(struct drm_connector *connector)
+{
+ return container_of(connector, struct tfp410, connector);
+}
+
+static int tfp410_get_modes(struct drm_connector *connector)
+{
+ struct tfp410 *dvi = drm_connector_to_tfp410(connector);
+ struct edid *edid;
+ int ret;
+
+ if (!dvi->ddc)
+ goto fallback;
+
+ edid = drm_get_edid(connector, dvi->ddc);
+ if (!edid) {
+ DRM_INFO("EDID read failed. Fallback to standard modes\n");
+ goto fallback;
+ }
+
+ drm_mode_connector_update_edid_property(connector, edid);
+
+ return drm_add_edid_modes(connector, edid);
+fallback:
+ /* No EDID, fallback on the XGA standard modes */
+ ret = drm_add_modes_noedid(connector, 1920, 1200);
+
+ /* And prefer a mode pretty much anything can handle */
+ drm_set_preferred_mode(connector, 1024, 768);
+
+ return ret;
+}
+
+static const struct drm_connector_helper_funcs tfp410_con_helper_funcs = {
+ .get_modes = tfp410_get_modes,
+};
+
+static enum drm_connector_status
+tfp410_connector_detect(struct drm_connector *connector, bool force)
+{
+ struct tfp410 *dvi = drm_connector_to_tfp410(connector);
+
+ if (dvi->ddc) {
+ if (drm_probe_ddc(dvi->ddc))
+ return connector_status_connected;
+ else
+ return connector_status_disconnected;
+ }
+
+ return connector_status_unknown;
+}
+
+static const struct drm_connector_funcs tfp410_con_funcs = {
+ .dpms = drm_atomic_helper_connector_dpms,
+ .detect = tfp410_connector_detect,
+ .fill_modes = drm_helper_probe_single_connector_modes,
+ .destroy = drm_connector_cleanup,
+ .reset = drm_atomic_helper_connector_reset,
+ .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
+};
+
+static int tfp410_attach(struct drm_bridge *bridge)
+{
+ struct tfp410 *dvi = drm_bridge_to_tfp410(bridge);
+ int ret;
+
+ if (!bridge->encoder) {
+ dev_err(dvi->dev, "Missing encoder\n");
+ return -ENODEV;
+ }
+
+ drm_connector_helper_add(&dvi->connector,
+ &tfp410_con_helper_funcs);
+ ret = drm_connector_init(bridge->dev, &dvi->connector,
+ &tfp410_con_funcs, DRM_MODE_CONNECTOR_HDMIA);
+ if (ret) {
+ dev_err(dvi->dev, "drm_connector_init() failed: %d\n", ret);
+ return ret;
+ }
+
+ drm_mode_connector_attach_encoder(&dvi->connector,
+ bridge->encoder);
+
+ return 0;
+}
+
+static const struct drm_bridge_funcs tfp410_bridge_funcs = {
+ .attach = tfp410_attach,
+};
+
+static int tfp410_get_connector_ddc(struct tfp410 *dvi)
+{
+ struct device_node *ep = NULL, *connector_node = NULL;
+ struct device_node *ddc_phandle = NULL;
+ int ret = 0;
+
+ /* port@1 is the connector node */
+ ep = of_graph_get_endpoint_by_regs(dvi->dev->of_node, 1, -1);
+ if (!ep)
+ goto fail;
+
+ connector_node = of_graph_get_remote_port_parent(ep);
+ if (!connector_node)
+ goto fail;
+
+ ddc_phandle = of_parse_phandle(connector_node, "ddc-i2c-bus", 0);
+ if (!ddc_phandle)
+ goto fail;
+
+ dvi->ddc = of_get_i2c_adapter_by_node(ddc_phandle);
+ if (dvi->ddc)
+ dev_info(dvi->dev, "Connector's ddc i2c bus found\n");
+ else
+ ret = -EPROBE_DEFER;
+
+fail:
+ of_node_put(ep);
+ of_node_put(connector_node);
+ of_node_put(ddc_phandle);
+ return ret;
+}
+
+static int tfp410_init(struct device *dev)
+{
+ struct tfp410 *dvi;
+ int ret;
+
+ if (!dev->of_node) {
+ dev_err(dev, "device-tree data is missing\n");
+ return -ENXIO;
+ }
+
+ dvi = devm_kzalloc(dev, sizeof(*dvi), GFP_KERNEL);
+ if (!dvi)
+ return -ENOMEM;
+ dev_set_drvdata(dev, dvi);
+
+ dvi->bridge.funcs = &tfp410_bridge_funcs;
+ dvi->bridge.of_node = dev->of_node;
+ dvi->dev = dev;
+
+ ret = tfp410_get_connector_ddc(dvi);
+ if (ret)
+ goto fail;
+
+ ret = drm_bridge_add(&dvi->bridge);
+ if (ret) {
+ dev_err(dev, "drm_bridge_add() failed: %d\n", ret);
+ goto fail;
+ }
+
+ return 0;
+fail:
+ i2c_put_adapter(dvi->ddc);
+ return ret;
+}
+
+static int tfp410_fini(struct device *dev)
+{
+ struct tfp410 *dvi = dev_get_drvdata(dev);
+
+ drm_bridge_remove(&dvi->bridge);
+
+ if (dvi->ddc)
+ i2c_put_adapter(dvi->ddc);
+
+ return 0;
+}
+
+static int tfp410_probe(struct platform_device *pdev)
+{
+ return tfp410_init(&pdev->dev);
+}
+
+static int tfp410_remove(struct platform_device *pdev)
+{
+ return tfp410_fini(&pdev->dev);
+}
+
+/* There is currently no i2c functionality. */
+static int tfp410_i2c_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+{
+ int reg;
+
+ if (!client->dev.of_node ||
+ of_property_read_u32(client->dev.of_node, "reg", ®)) {
+ dev_err(&client->dev,
+ "Can't get i2c reg property from device-tree\n");
+ return -ENXIO;
+ }
+
+ return tfp410_init(&client->dev);
+}
+
+static int tfp410_i2c_remove(struct i2c_client *client)
+{
+ return tfp410_fini(&client->dev);
+}
+
+static const struct of_device_id tfp410_match[] = {
+ { .compatible = "ti,tfp410" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, tfp410_match);
+
+struct platform_driver tfp410_platform_driver = {
+ .probe = tfp410_probe,
+ .remove = tfp410_remove,
+ .driver = {
+ .name = "tfp410-bridge",
+ .of_match_table = tfp410_match,
+ },
+};
+
+static const struct i2c_device_id tfp410_i2c_ids[] = {
+ { "tfp410", 0 },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, tfp410_i2c_ids);
+
+static struct i2c_driver tfp410_i2c_driver = {
+ .driver = {
+ .name = "tfp410",
+ .of_match_table = of_match_ptr(tfp410_match),
+ },
+ .id_table = tfp410_i2c_ids,
+ .probe = tfp410_i2c_probe,
+ .remove = tfp410_i2c_remove,
+};
+
+static int __init tfp410_module_init(void)
+{
+ i2c_add_driver(&tfp410_i2c_driver);
+ platform_driver_register(&tfp410_platform_driver);
+
+ return 0;
+}
+module_init(tfp410_module_init);
+
+static void __exit tfp410_module_exit(void)
+{
+ i2c_del_driver(&tfp410_i2c_driver);
+ platform_driver_unregister(&tfp410_platform_driver);
+}
+module_exit(tfp410_module_exit);
+
+MODULE_AUTHOR("Jyri Sarha <jsarha@ti.com>");
+MODULE_DESCRIPTION("TI TFP410 DVI bridge driver");
+MODULE_LICENSE("GPL");
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related
* [PATCH v3 1/3] drm/tilcdc: Recover from sync lost error flood by resetting the LCDC
From: Jyri Sarha @ 2016-11-17 13:28 UTC (permalink / raw)
To: dri-devel, devicetree
Cc: bcousson, khilman, Jyri Sarha, bgolaszewski, tomi.valkeinen,
laurent.pinchart
In-Reply-To: <cover.1479388871.git.jsarha@ti.com>
Recover from sync lost error flood by resetting the LCDC instead of
turning off the SYNC_LOST error IRQ. When LCDC starves on limited
memory bandwidth it may sometimes result an error situation when the
picture may have shifted couple of pixels to right and SYNC_LOST
interrupt is generated on every frame. LCDC main reset recovers from
this situation and causes a brief blanking on the screen.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 0d09acc..c787349 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -55,6 +55,7 @@ struct tilcdc_crtc {
int sync_lost_count;
bool frame_intact;
+ struct work_struct recover_work;
};
#define to_tilcdc_crtc(x) container_of(x, struct tilcdc_crtc, base)
@@ -252,6 +253,25 @@ static bool tilcdc_crtc_is_on(struct drm_crtc *crtc)
return crtc->state && crtc->state->enable && crtc->state->active;
}
+static void tilcdc_crtc_recover_work(struct work_struct *work)
+{
+ struct tilcdc_crtc *tilcdc_crtc =
+ container_of(work, struct tilcdc_crtc, recover_work);
+ struct drm_crtc *crtc = &tilcdc_crtc->base;
+
+ dev_info(crtc->dev->dev, "%s: Reset CRTC", __func__);
+
+ drm_modeset_lock_crtc(crtc, NULL);
+
+ if (!tilcdc_crtc_is_on(crtc))
+ goto out;
+
+ tilcdc_crtc_disable(crtc);
+ tilcdc_crtc_enable(crtc);
+out:
+ drm_modeset_unlock_crtc(crtc);
+}
+
static void tilcdc_crtc_destroy(struct drm_crtc *crtc)
{
struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
@@ -838,9 +858,12 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc)
tilcdc_crtc->frame_intact = false;
if (tilcdc_crtc->sync_lost_count++ >
SYNC_LOST_COUNT_LIMIT) {
- dev_err(dev->dev, "%s(0x%08x): Sync lost flood detected, disabling the interrupt", __func__, stat);
+ dev_err(dev->dev, "%s(0x%08x): Sync lost flood detected, recovering", __func__, stat);
+ queue_work(system_wq,
+ &tilcdc_crtc->recover_work);
tilcdc_write(dev, LCDC_INT_ENABLE_CLR_REG,
LCDC_SYNC_LOST);
+ tilcdc_crtc->sync_lost_count = 0;
}
}
@@ -880,6 +903,7 @@ struct drm_crtc *tilcdc_crtc_create(struct drm_device *dev)
"unref", unref_worker);
spin_lock_init(&tilcdc_crtc->irq_lock);
+ INIT_WORK(&tilcdc_crtc->recover_work, tilcdc_crtc_recover_work);
ret = drm_crtc_init_with_planes(dev, crtc,
&tilcdc_crtc->primary,
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related
* [PATCH v3 0/3] drm/tilcdc: Add bridge support and sync-lost flood recovery
From: Jyri Sarha @ 2016-11-17 13:28 UTC (permalink / raw)
To: dri-devel, devicetree
Cc: bcousson, khilman, Jyri Sarha, bgolaszewski, tomi.valkeinen,
laurent.pinchart
Changes since v2:
- "drm/tilcdc: Recover from sync lost error flood by resetting the LCDC"
- no change
- "drm/bridge: Add ti-tfp410 DVI transmitter driver"
- Fix deveice-tree document
- "driver node" -> "device node"
- remove "(the current implementation does not yet support this)"
- Add dummy i2c support. The driver probe works also if placed under
i2c controller node, but there is no actual i2c probing.
- "drm/tilcdc: Add drm bridge support for attaching drm bridge drivers"
- no change
Changes since first version of the series:
- "drm/tilcdc: Recover from sync lost error flood by resetting the LCDC"
- no change
- "drm/bridge: Add ti-tfp410 DVI transmitter driver"
- HDMI -> DVI
- DT Binding document
- Prepare for tfp410 connected trough i2c by optional reg property
- Require two port nodes
- Implementation
- Implement connector node functionality with in tfp410 bridge
drive, but follow generic connector binding by pulling the
ddc-i2c-bus property from the connector node.
- "drm/tilcdc: Add drm bridge support for attaching drm bridge drivers"
- Remove earlier change in TD binding document. There is no need to
mention DRM implementation details, like bridge support, in DT
binding.
The first patch is an independent on and I've been testing it for
quite a while now.
The tfp410 bridge driver and the tilcdc bridge support are tested with
BeagleBone DVI-D Cape Rev A3. The tfp410 bridge driver is missing a
lot of features, because the DVI-D cape does not have too many wires
connected. The missing features can be added later when they are
needed.
Jyri Sarha (3):
drm/tilcdc: Recover from sync lost error flood by resetting the LCDC
drm/bridge: Add ti-tfp410 DVI transmitter driver
drm/tilcdc: Add drm bridge support for attaching drm bridge drivers
.../bindings/display/bridge/ti,tfp410.txt | 40 +++
drivers/gpu/drm/bridge/Kconfig | 7 +
drivers/gpu/drm/bridge/Makefile | 1 +
drivers/gpu/drm/bridge/ti-tfp410.c | 287 +++++++++++++++++++++
drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 26 +-
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 7 +-
drivers/gpu/drm/tilcdc/tilcdc_drv.h | 2 +
drivers/gpu/drm/tilcdc/tilcdc_external.c | 140 ++++++++--
drivers/gpu/drm/tilcdc/tilcdc_external.h | 1 +
9 files changed, 491 insertions(+), 20 deletions(-)
create mode 100644 Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt
create mode 100644 drivers/gpu/drm/bridge/ti-tfp410.c
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* RE: [PATCH 2/5] media: i2c: max2175: Add MAX2175 support
From: Ramesh Shanmugasundaram @ 2016-11-17 12:41 UTC (permalink / raw)
To: Rob Herring
Cc: mark.rutland-5wv7dgnIgG8@public.gmane.org,
mchehab-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org,
sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
crope-X3B1VOXEql0@public.gmane.org, Chris Paterson,
laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org,
geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org,
linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <20161114194110.fh6gyhfdciikj7kt@rob-hp-laptop>
Hi Rob,
Thanks for the review comments.
> On Wed, Nov 09, 2016 at 03:44:41PM +0000, Ramesh Shanmugasundaram wrote:
> > This patch adds driver support for MAX2175 chip. This is Maxim
> > Integrated's RF to Bits tuner front end chip designed for
> > software-defined radio solutions. This driver exposes the tuner as a
> > sub-device instance with standard and custom controls to configure the
> device.
> >
> > Signed-off-by: Ramesh Shanmugasundaram
> > <ramesh.shanmugasundaram-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
> > ---
> > .../devicetree/bindings/media/i2c/max2175.txt | 61 +
>
> It's preferred that bindings are a separate patch.
OK. I will do the same for the other driver.
>
> > drivers/media/i2c/Kconfig | 4 +
> > drivers/media/i2c/Makefile | 2 +
> > drivers/media/i2c/max2175/Kconfig | 8 +
> > drivers/media/i2c/max2175/Makefile | 4 +
> > drivers/media/i2c/max2175/max2175.c | 1558
> ++++++++++++++++++++
> > drivers/media/i2c/max2175/max2175.h | 108 ++
> > 7 files changed, 1745 insertions(+)
> > create mode 100644
> > Documentation/devicetree/bindings/media/i2c/max2175.txt
> > create mode 100644 drivers/media/i2c/max2175/Kconfig create mode
> > 100644 drivers/media/i2c/max2175/Makefile
> > create mode 100644 drivers/media/i2c/max2175/max2175.c
> > create mode 100644 drivers/media/i2c/max2175/max2175.h
> >
> > diff --git a/Documentation/devicetree/bindings/media/i2c/max2175.txt
> > b/Documentation/devicetree/bindings/media/i2c/max2175.txt
> > new file mode 100644
> > index 0000000..69f0dad
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/media/i2c/max2175.txt
> > @@ -0,0 +1,61 @@
> > +Maxim Integrated MAX2175 RF to Bits tuner
> > +-----------------------------------------
> > +
> > +The MAX2175 IC is an advanced analog/digital hybrid-radio receiver
> > +with RF to Bits(r) front-end designed for software-defined radio
> solutions.
> > +
> > +Required properties:
> > +--------------------
> > +- compatible: "maxim,max2175" for MAX2175 RF-to-bits tuner.
> > +- clocks: phandle to the fixed xtal clock.
> > +- clock-names: name of the fixed xtal clock.
> > +- port: child port node of a tuner that defines the local and remote
> > + endpoints. The remote endpoint is assumed to be an SDR device
> > + that is capable of receiving the digital samples from the tuner.
> > +
> > +Optional properties:
> > +--------------------
> > +- maxim,slave : empty property indicates this is a slave of
> > + another master tuner. This is used to define two
> > + tuners in diversity mode (1 master, 1 slave). By
> > + default each tuner is an individual master.
> > +- maxim,refout-load-pF: load capacitance value (in pF) on reference
>
> Please add 'pF' to property-units.txt.
Agreed.
>
> > + output drive level. The possible load values are
> > + 0pF (default - refout disabled)
> > + 10pF
> > + 20pF
> > + 30pF
> > + 40pF
> > + 60pF
> > + 70pF
> > +- maxim,am-hiz : empty property indicates AM Hi-Z filter path is
> > + selected for AM antenna input. By default this
> > + filter path is not used.
> > +
> > +Example:
> > +--------
> > +
> > +Board specific DTS file
> > +
> > +/* Fixed XTAL clock node */
> > +maxim_xtal: maximextal {
>
> clock {
Agreed.
>
> > + compatible = "fixed-clock";
> > + #clock-cells = <0>;
> > + clock-frequency = <36864000>;
> > +};
> > +
> > +/* A tuner device instance under i2c bus */
> > +max2175_0: tuner@60 {
> > + compatible = "maxim,max2175";
> > + reg = <0x60>;
> > + clocks = <&maxim_xtal>;
> > + clock-names = "xtal";
> > + maxim,refout-load-pF = <10>;
> > +
> > + port {
> > + max2175_0_ep: endpoint {
> > + remote-endpoint = <&slave_rx_v4l2_sdr_device>;
>
> 'v4l2' is not something that should appear in a DT.
OK. I'll leave it as "slave_rx_device".
Thanks,
Ramesh
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* RE: [RESEND][PATCH 6/6] arm64: Add DTS support for FSL's LS2088A SoC
From: Abhimanyu Saini @ 2016-11-17 12:31 UTC (permalink / raw)
To: Shawn Guo
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, Priyanka Jain,
Ashish Kumar, Scott Wood, linux-arm-kernel@lists.infradead.org
In-Reply-To: <20161114063346.GH3310@dragon>
> > Following levels of DTSI/DTS files have been created for the LS2088A
> > SoC family:
> >
> > - fsl-ls2088a.dtsi:
> > DTS-Include file for FSL LS2088A SoC.
> >
> > - fsl-ls2088a-qds.dts:
> > DTS file for FSL LS2088A QDS board.
> >
> > - fsl-ls2088a-rdb.dts:
> > DTS file for FSL LS2088A RDB board.
>
> I compared the following files.
>
> fsl-ls2088a.dtsi vs. fsl-ls2080a.dtsi
> fsl-ls2088a-qds.dtsi vs. fsl-ls2080a-qds.dtsi fsl-ls2088a-rdb.dtsi vs.
> fsl-ls2080a-rdb.dtsi
>
> They are basically identical except a couple of small changes. Can we do
> something to have these SoCs share the dts files at some level to avoid
> maintaining duplicated files?
Hi Shawn,
Yes, we could reorganize DTSI and DTS file.
I can create fsl-ls2080a-ls2088a.dtsi and move all the common nodes to this file,
Then fsl-ls2080a.dtsi and fsl-ls2088a.dtsi which will include
the common file and add ls2080a and ls2088a specific nodes respectively.
Same hierarchy can be created for fsl-ls2080a-qds.dts, fsl-ls2080a-rdb,
fsl-ls2088a-qds.dts and fsl-ls2088a-rdb, wherein the common nodes will lie in
fsl-ls2080a-ls2088a-qds.dts and fsl-ls2080a-ls2088a-rdb.dts
What do you think?
Abhimanyu
^ permalink raw reply
* [PATCH v2 3/3] hwmon: ltc2990: support all measurement modes
From: Tom Levens @ 2016-11-17 12:10 UTC (permalink / raw)
To: linux-0h96xk9xTtrk1uMJSBkQmQ
Cc: jdelvare-IBi9RG/b67k, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
mark.rutland-5wv7dgnIgG8, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-hwmon-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Tom Levens
In-Reply-To: <1479384616-12479-1-git-send-email-tom.levens-vJEk5272eHo@public.gmane.org>
Updated version of the ltc2990 driver which supports all measurement
modes available in the chip. The mode can be set through a devicetree
attribute.
Signed-off-by: Tom Levens <tom.levens-vJEk5272eHo@public.gmane.org>
---
Changes since v1:
* Refactored value conversion (patch 1/3)
* Split the devicetree binding into separate patch (patch 2/3)
* Specifying an invalid mode now returns -EINVAL, previously this
only issued a warning and used the default value
* Removed the "mode" sysfs attribute, as the mode of the chip is
hardware specific and should not be user configurable. This allows much
simpler code as a result.
Documentation/hwmon/ltc2990 | 24 ++++---
drivers/hwmon/Kconfig | 7 +--
drivers/hwmon/ltc2990.c | 167 ++++++++++++++++++++++++++++++++++++-------
3 files changed, 159 insertions(+), 39 deletions(-)
diff --git a/Documentation/hwmon/ltc2990 b/Documentation/hwmon/ltc2990
index c25211e..3ed68f6 100644
--- a/Documentation/hwmon/ltc2990
+++ b/Documentation/hwmon/ltc2990
@@ -8,6 +8,7 @@ Supported chips:
Datasheet: http://www.linear.com/product/ltc2990
Author: Mike Looijmans <mike.looijmans-Oq418RWZeHk@public.gmane.org>
+ Tom Levens <tom.levens-vJEk5272eHo@public.gmane.org>
Description
@@ -16,10 +17,8 @@ Description
LTC2990 is a Quad I2C Voltage, Current and Temperature Monitor.
The chip's inputs can measure 4 voltages, or two inputs together (1+2 and 3+4)
can be combined to measure a differential voltage, which is typically used to
-measure current through a series resistor, or a temperature.
-
-This driver currently uses the 2x differential mode only. In order to support
-other modes, the driver will need to be expanded.
+measure current through a series resistor, or a temperature with an external
+diode.
Usage Notes
@@ -32,12 +31,19 @@ devices explicitly.
Sysfs attributes
----------------
+in0_input Voltage at Vcc pin in millivolt (range 2.5V to 5V)
+temp1_input Internal chip temperature in millidegrees Celcius
+
+A subset of the following attributes are visible, depending on the measurement
+mode of the chip.
+
+in[1-4]_input Voltage at V[1-4] pin in millivolt
+temp2_input External temperature sensor TR1 in millidegrees Celcius
+temp3_input External temperature sensor TR2 in millidegrees Celcius
+curr1_input Current in mA across V1-V2 assuming a 1mOhm sense resistor
+curr2_input Current in mA across V3-V4 assuming a 1mOhm sense resistor
+
The "curr*_input" measurements actually report the voltage drop across the
input pins in microvolts. This is equivalent to the current through a 1mOhm
sense resistor. Divide the reported value by the actual sense resistor value
in mOhm to get the actual value.
-
-in0_input Voltage at Vcc pin in millivolt (range 2.5V to 5V)
-temp1_input Internal chip temperature in millidegrees Celcius
-curr1_input Current in mA across v1-v2 assuming a 1mOhm sense resistor.
-curr2_input Current in mA across v3-v4 assuming a 1mOhm sense resistor.
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 45cef3d..f7096ca 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -699,15 +699,12 @@ config SENSORS_LTC2945
be called ltc2945.
config SENSORS_LTC2990
- tristate "Linear Technology LTC2990 (current monitoring mode only)"
+ tristate "Linear Technology LTC2990"
depends on I2C
help
If you say yes here you get support for Linear Technology LTC2990
I2C System Monitor. The LTC2990 supports a combination of voltage,
- current and temperature monitoring, but in addition to the Vcc supply
- voltage and chip temperature, this driver currently only supports
- reading two currents by measuring two differential voltages across
- series resistors.
+ current and temperature monitoring.
This driver can also be built as a module. If so, the module will
be called ltc2990.
diff --git a/drivers/hwmon/ltc2990.c b/drivers/hwmon/ltc2990.c
index 0ec4102..e8d36f5 100644
--- a/drivers/hwmon/ltc2990.c
+++ b/drivers/hwmon/ltc2990.c
@@ -6,11 +6,7 @@
*
* License: GPLv2
*
- * This driver assumes the chip is wired as a dual current monitor, and
- * reports the voltage drop across two series resistors. It also reports
- * the chip's internal temperature and Vcc power supply voltage.
- *
- * Value conversion refactored
+ * Value conversion refactored and support for all measurement modes added
* by Tom Levens <tom.levens-vJEk5272eHo@public.gmane.org>
*/
@@ -21,6 +17,7 @@
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of.h>
#define LTC2990_STATUS 0x00
#define LTC2990_CONTROL 0x01
@@ -35,32 +32,96 @@
#define LTC2990_CONTROL_KELVIN BIT(7)
#define LTC2990_CONTROL_SINGLE BIT(6)
#define LTC2990_CONTROL_MEASURE_ALL (0x3 << 3)
-#define LTC2990_CONTROL_MODE_CURRENT 0x06
-#define LTC2990_CONTROL_MODE_VOLTAGE 0x07
+#define LTC2990_CONTROL_MODE_DEFAULT 0x06
+#define LTC2990_CONTROL_MODE_MAX 0x07
+
+#define LTC2990_IN0 BIT(0)
+#define LTC2990_IN1 BIT(1)
+#define LTC2990_IN2 BIT(2)
+#define LTC2990_IN3 BIT(3)
+#define LTC2990_IN4 BIT(4)
+#define LTC2990_CURR1 BIT(5)
+#define LTC2990_CURR2 BIT(6)
+#define LTC2990_TEMP1 BIT(7)
+#define LTC2990_TEMP2 BIT(8)
+#define LTC2990_TEMP3 BIT(9)
+
+static const int ltc2990_attrs_ena[] = {
+ LTC2990_IN1 | LTC2990_IN2 | LTC2990_TEMP3,
+ LTC2990_CURR1 | LTC2990_TEMP3,
+ LTC2990_CURR1 | LTC2990_IN3 | LTC2990_IN4,
+ LTC2990_TEMP2 | LTC2990_IN3 | LTC2990_IN4,
+ LTC2990_TEMP2 | LTC2990_CURR2,
+ LTC2990_TEMP2 | LTC2990_TEMP3,
+ LTC2990_CURR1 | LTC2990_CURR2,
+ LTC2990_IN1 | LTC2990_IN2 | LTC2990_IN3 | LTC2990_IN4
+};
+
+struct ltc2990_data {
+ struct i2c_client *i2c;
+ u32 mode;
+};
/* Return the converted value from the given register in uV or mC */
-static int ltc2990_get_value(struct i2c_client *i2c, u8 reg, s32 *result)
+static int ltc2990_get_value(struct i2c_client *i2c, int index, s32 *result)
{
s32 val;
+ u8 reg;
+
+ switch (index) {
+ case LTC2990_IN0:
+ reg = LTC2990_VCC_MSB;
+ break;
+ case LTC2990_IN1:
+ case LTC2990_CURR1:
+ case LTC2990_TEMP2:
+ reg = LTC2990_V1_MSB;
+ break;
+ case LTC2990_IN2:
+ reg = LTC2990_V2_MSB;
+ break;
+ case LTC2990_IN3:
+ case LTC2990_CURR2:
+ case LTC2990_TEMP3:
+ reg = LTC2990_V3_MSB;
+ break;
+ case LTC2990_IN4:
+ reg = LTC2990_V4_MSB;
+ break;
+ case LTC2990_TEMP1:
+ reg = LTC2990_TINT_MSB;
+ break;
+ default:
+ return -EINVAL;
+ }
val = i2c_smbus_read_word_swapped(i2c, reg);
if (unlikely(val < 0))
return val;
- switch (reg) {
- case LTC2990_TINT_MSB:
- /* internal temp, 0.0625 degrees/LSB, 13-bit */
+ switch (index) {
+ case LTC2990_TEMP1:
+ case LTC2990_TEMP2:
+ case LTC2990_TEMP3:
+ /* temp, 0.0625 degrees/LSB, 13-bit */
*result = sign_extend32(val, 12) * 1000 / 16;
break;
- case LTC2990_V1_MSB:
- case LTC2990_V3_MSB:
- /* Vx-Vy, 19.42uV/LSB. Depends on mode. */
+ case LTC2990_CURR1:
+ case LTC2990_CURR2:
+ /* Vx-Vy, 19.42uV/LSB */
*result = sign_extend32(val, 14) * 1942 / 100;
break;
- case LTC2990_VCC_MSB:
- /* Vcc, 305.18μV/LSB, 2.5V offset */
+ case LTC2990_IN0:
+ /* Vcc, 305.18uV/LSB, 2.5V offset */
*result = sign_extend32(val, 14) * 30518 / (100 * 1000) + 2500;
break;
+ case LTC2990_IN1:
+ case LTC2990_IN2:
+ case LTC2990_IN3:
+ case LTC2990_IN4:
+ /* Vx: 305.18uV/LSB */
+ *result = sign_extend32(val, 14) * 30518 / (100 * 1000);
+ break;
default:
return -EINVAL; /* won't happen, keep compiler happy */
}
@@ -72,48 +133,104 @@ static ssize_t ltc2990_show_value(struct device *dev,
struct device_attribute *da, char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
+ struct ltc2990_data *data = dev_get_drvdata(dev);
s32 value;
int ret;
- ret = ltc2990_get_value(dev_get_drvdata(dev), attr->index, &value);
+ ret = ltc2990_get_value(data->i2c, attr->index, &value);
if (unlikely(ret < 0))
return ret;
return snprintf(buf, PAGE_SIZE, "%d\n", value);
}
+static umode_t ltc2990_attrs_visible(struct kobject *kobj,
+ struct attribute *a, int n)
+{
+ struct device *dev = container_of(kobj, struct device, kobj);
+ struct ltc2990_data *data = dev_get_drvdata(dev);
+ struct device_attribute *da =
+ container_of(a, struct device_attribute, attr);
+ struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
+
+ if (attr->index == LTC2990_TEMP1 ||
+ attr->index == LTC2990_IN0 ||
+ attr->index & ltc2990_attrs_ena[data->mode])
+ return a->mode;
+ else
+ return 0;
+}
+
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, ltc2990_show_value, NULL,
- LTC2990_TINT_MSB);
+ LTC2990_TEMP1);
+static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, ltc2990_show_value, NULL,
+ LTC2990_TEMP2);
+static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, ltc2990_show_value, NULL,
+ LTC2990_TEMP3);
static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, ltc2990_show_value, NULL,
- LTC2990_V1_MSB);
+ LTC2990_CURR1);
static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, ltc2990_show_value, NULL,
- LTC2990_V3_MSB);
+ LTC2990_CURR2);
static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, ltc2990_show_value, NULL,
- LTC2990_VCC_MSB);
+ LTC2990_IN0);
+static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, ltc2990_show_value, NULL,
+ LTC2990_IN1);
+static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, ltc2990_show_value, NULL,
+ LTC2990_IN2);
+static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, ltc2990_show_value, NULL,
+ LTC2990_IN3);
+static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, ltc2990_show_value, NULL,
+ LTC2990_IN4);
static struct attribute *ltc2990_attrs[] = {
&sensor_dev_attr_temp1_input.dev_attr.attr,
+ &sensor_dev_attr_temp2_input.dev_attr.attr,
+ &sensor_dev_attr_temp3_input.dev_attr.attr,
&sensor_dev_attr_curr1_input.dev_attr.attr,
&sensor_dev_attr_curr2_input.dev_attr.attr,
&sensor_dev_attr_in0_input.dev_attr.attr,
+ &sensor_dev_attr_in1_input.dev_attr.attr,
+ &sensor_dev_attr_in2_input.dev_attr.attr,
+ &sensor_dev_attr_in3_input.dev_attr.attr,
+ &sensor_dev_attr_in4_input.dev_attr.attr,
NULL,
};
-ATTRIBUTE_GROUPS(ltc2990);
+
+static const struct attribute_group ltc2990_group = {
+ .attrs = ltc2990_attrs,
+ .is_visible = ltc2990_attrs_visible,
+};
+__ATTRIBUTE_GROUPS(ltc2990);
static int ltc2990_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
int ret;
struct device *hwmon_dev;
+ struct ltc2990_data *data;
+ struct device_node *of_node = i2c->dev.of_node;
if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
I2C_FUNC_SMBUS_WORD_DATA))
return -ENODEV;
- /* Setup continuous mode, current monitor */
+ data = devm_kzalloc(&i2c->dev, sizeof(struct ltc2990_data), GFP_KERNEL);
+ if (unlikely(!data))
+ return -ENOMEM;
+ data->i2c = i2c;
+
+ if (!of_node || of_property_read_u32(of_node, "lltc,mode", &data->mode))
+ data->mode = LTC2990_CONTROL_MODE_DEFAULT;
+
+ if (data->mode > LTC2990_CONTROL_MODE_MAX) {
+ dev_err(&i2c->dev, "Error: Invalid mode %d.\n", data->mode);
+ return -EINVAL;
+ }
+
+ /* Setup continuous mode */
ret = i2c_smbus_write_byte_data(i2c, LTC2990_CONTROL,
LTC2990_CONTROL_MEASURE_ALL |
- LTC2990_CONTROL_MODE_CURRENT);
+ data->mode);
if (ret < 0) {
dev_err(&i2c->dev, "Error: Failed to set control mode.\n");
return ret;
@@ -127,7 +244,7 @@ static int ltc2990_i2c_probe(struct i2c_client *i2c,
hwmon_dev = devm_hwmon_device_register_with_groups(&i2c->dev,
i2c->name,
- i2c,
+ data,
ltc2990_groups);
return PTR_ERR_OR_ZERO(hwmon_dev);
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH v2 2/3] hwmon: ltc2990: add devicetree binding
From: Tom Levens @ 2016-11-17 12:10 UTC (permalink / raw)
To: linux
Cc: jdelvare, robh+dt, mark.rutland, linux-kernel, linux-hwmon,
devicetree, Tom Levens
In-Reply-To: <1479384616-12479-1-git-send-email-tom.levens@cern.ch>
Add a devicetree binding for the ltc2990 hwmon driver.
Signed-off-by: Tom Levens <tom.levens@cern.ch>
---
.../devicetree/bindings/hwmon/ltc2990.txt | 28 ++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
create mode 100644 Documentation/devicetree/bindings/hwmon/ltc2990.txt
diff --git a/Documentation/devicetree/bindings/hwmon/ltc2990.txt b/Documentation/devicetree/bindings/hwmon/ltc2990.txt
new file mode 100644
index 0000000..e4040e0
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/ltc2990.txt
@@ -0,0 +1,28 @@
+ltc2990
+
+Required properties:
+- compatible: Must be "lltc,ltc2990"
+- reg: I2C slave address
+
+Optional properties:
+- lltc,mode:
+ Sets the chip's measurement mode, defaults to <6> if unset.
+
+ The following measurements are available in each mode:
+
+ 0: V1, V2, TR2
+ 1: V1-V2, TR2
+ 2: V1-V2, V3, V4
+ 3: TR1, V3, V4
+ 4: TR1, V3-V4
+ 5: TR1, TR2
+ 6: V1-V2, V3-V4
+ 7: V1, V2, V3, V4
+
+Example:
+
+ltc2990@4c {
+ compatible = "lltc,ltc2990";
+ reg = <0x4c>;
+ lltc,mode = <7>;
+};
--
1.7.1
^ permalink raw reply related
* [PATCH v2 1/3] hwmon: ltc2990: refactor value conversion
From: Tom Levens @ 2016-11-17 12:10 UTC (permalink / raw)
To: linux
Cc: jdelvare, robh+dt, mark.rutland, linux-kernel, linux-hwmon,
devicetree, Tom Levens
Conversion from raw values to signed integers has been refactored using
the macros in bitops.h.
Signed-off-by: Tom Levens <tom.levens@cern.ch>
---
drivers/hwmon/ltc2990.c | 27 ++++++++++-----------------
1 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/drivers/hwmon/ltc2990.c b/drivers/hwmon/ltc2990.c
index 8f8fe05..0ec4102 100644
--- a/drivers/hwmon/ltc2990.c
+++ b/drivers/hwmon/ltc2990.c
@@ -9,8 +9,12 @@
* This driver assumes the chip is wired as a dual current monitor, and
* reports the voltage drop across two series resistors. It also reports
* the chip's internal temperature and Vcc power supply voltage.
+ *
+ * Value conversion refactored
+ * by Tom Levens <tom.levens@cern.ch>
*/
+#include <linux/bitops.h>
#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
@@ -34,19 +38,10 @@
#define LTC2990_CONTROL_MODE_CURRENT 0x06
#define LTC2990_CONTROL_MODE_VOLTAGE 0x07
-/* convert raw register value to sign-extended integer in 16-bit range */
-static int ltc2990_voltage_to_int(int raw)
-{
- if (raw & BIT(14))
- return -(0x4000 - (raw & 0x3FFF)) << 2;
- else
- return (raw & 0x3FFF) << 2;
-}
-
/* Return the converted value from the given register in uV or mC */
-static int ltc2990_get_value(struct i2c_client *i2c, u8 reg, int *result)
+static int ltc2990_get_value(struct i2c_client *i2c, u8 reg, s32 *result)
{
- int val;
+ s32 val;
val = i2c_smbus_read_word_swapped(i2c, reg);
if (unlikely(val < 0))
@@ -55,18 +50,16 @@ static int ltc2990_get_value(struct i2c_client *i2c, u8 reg, int *result)
switch (reg) {
case LTC2990_TINT_MSB:
/* internal temp, 0.0625 degrees/LSB, 13-bit */
- val = (val & 0x1FFF) << 3;
- *result = (val * 1000) >> 7;
+ *result = sign_extend32(val, 12) * 1000 / 16;
break;
case LTC2990_V1_MSB:
case LTC2990_V3_MSB:
/* Vx-Vy, 19.42uV/LSB. Depends on mode. */
- *result = ltc2990_voltage_to_int(val) * 1942 / (4 * 100);
+ *result = sign_extend32(val, 14) * 1942 / 100;
break;
case LTC2990_VCC_MSB:
/* Vcc, 305.18μV/LSB, 2.5V offset */
- *result = (ltc2990_voltage_to_int(val) * 30518 /
- (4 * 100 * 1000)) + 2500;
+ *result = sign_extend32(val, 14) * 30518 / (100 * 1000) + 2500;
break;
default:
return -EINVAL; /* won't happen, keep compiler happy */
@@ -79,7 +72,7 @@ static ssize_t ltc2990_show_value(struct device *dev,
struct device_attribute *da, char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
- int value;
+ s32 value;
int ret;
ret = ltc2990_get_value(dev_get_drvdata(dev), attr->index, &value);
--
1.7.1
^ permalink raw reply related
* [RFC PATCH] of: base: add support to get machine model name
From: Sudeep Holla @ 2016-11-17 11:50 UTC (permalink / raw)
To: linux-kernel, Arnd Bergmann
Cc: Sudeep Holla, linux-mips, linux-sh, devicetree, linux-arm-kernel,
linuxppc-dev, linux-renesas-soc, Rob Herring
Currently platforms/drivers needing to get the machine model name are
replicating the same snippet of code. In some case, the OF reference
counting is either missing or incorrect.
This patch adds support to read the machine model name either using
the "model" or the "compatible" property in the device tree root node.
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
arch/arm/mach-imx/cpu.c | 4 +---
arch/arm/mach-mxs/mach-mxs.c | 3 +--
arch/mips/cavium-octeon/setup.c | 12 ++----------
arch/mips/generic/proc.c | 15 +++------------
arch/sh/boards/of-generic.c | 6 +-----
drivers/of/base.c | 34 ++++++++++++++++++++++++++++++++++
drivers/soc/fsl/guts.c | 3 +--
drivers/soc/renesas/renesas-soc.c | 4 +---
include/linux/of.h | 6 ++++++
9 files changed, 50 insertions(+), 37 deletions(-)
Hi,
While trying to fix a simple build warning(as below) in -next for fsl/guts.c,
I came across this code duplication in multiple places.
WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
With CONFIG_DEBUG_SECTION_MISMATCH enabled, the details are reported:
WARNING: vmlinux.o(.text+0x55d014): Section mismatch in reference from the
function fsl_guts_probe() to the function
.init.text:of_flat_dt_get_machine_name()
The function fsl_guts_probe() references
the function __init of_flat_dt_get_machine_name().
This is often because fsl_guts_probe lacks a __init
annotation or the annotation of of_flat_dt_get_machine_name is wrong.
I can split the patch if needed if people are OK with the idea.
Regards,
Sudeep
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index b3347d32349f..846f40008752 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -85,9 +85,7 @@ struct device * __init imx_soc_device_init(void)
soc_dev_attr->family = "Freescale i.MX";
- root = of_find_node_by_path("/");
- ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
- of_node_put(root);
+ ret = of_machine_get_model_name(&soc_dev_attr->machine);
if (ret)
goto free_soc;
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index e4f21086b42b..ed9af3a894f0 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -391,8 +391,7 @@ static void __init mxs_machine_init(void)
if (!soc_dev_attr)
return;
- root = of_find_node_by_path("/");
- ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
+ ret = of_machine_get_model_name(&soc_dev_attr->machine);
if (ret)
return;
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 9a2db1c013d9..2e2b1b5befa4 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -498,16 +498,8 @@ static void __init init_octeon_system_type(void)
char const *board_type;
board_type = cvmx_board_type_to_string(octeon_bootinfo->board_type);
- if (board_type == NULL) {
- struct device_node *root;
- int ret;
-
- root = of_find_node_by_path("/");
- ret = of_property_read_string(root, "model", &board_type);
- of_node_put(root);
- if (ret)
- board_type = "Unsupported Board";
- }
+ if (!board_type && of_machine_get_model_name(&board_type))
+ board_type = "Unsupported Board";
snprintf(octeon_system_type, sizeof(octeon_system_type), "%s (%s)",
board_type, octeon_model_get_string(read_c0_prid()));
diff --git a/arch/mips/generic/proc.c b/arch/mips/generic/proc.c
index 42b33250a4a2..f7fc067bf908 100644
--- a/arch/mips/generic/proc.c
+++ b/arch/mips/generic/proc.c
@@ -10,20 +10,11 @@
#include <linux/of.h>
-#include <asm/bootinfo.h>
-
const char *get_system_type(void)
{
const char *str;
- int err;
-
- err = of_property_read_string(of_root, "model", &str);
- if (!err)
- return str;
-
- err = of_property_read_string_index(of_root, "compatible", 0, &str);
- if (!err)
- return str;
- return "Unknown";
+ if (of_machine_get_model_name(&str))
+ return "Unknown";
+ return str;
}
diff --git a/arch/sh/boards/of-generic.c b/arch/sh/boards/of-generic.c
index 1fb6d5714bae..938a14499298 100644
--- a/arch/sh/boards/of-generic.c
+++ b/arch/sh/boards/of-generic.c
@@ -135,11 +135,7 @@ static void __init sh_of_setup(char **cmdline_p)
board_time_init = sh_of_time_init;
sh_mv.mv_name = "Unknown SH model";
- root = of_find_node_by_path("/");
- if (root) {
- of_property_read_string(root, "model", &sh_mv.mv_name);
- of_node_put(root);
- }
+ of_machine_get_model_name(&sh_mv.mv_name);
sh_of_smp_probe();
}
diff --git a/drivers/of/base.c b/drivers/of/base.c
index a0bccb54a9bd..752cb8eefd6e 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -546,6 +546,40 @@ int of_machine_is_compatible(const char *compat)
EXPORT_SYMBOL(of_machine_is_compatible);
/**
+ * of_machine_get_model_name - Find and read the model name or the compatible
+ * value for the machine.
+ * @model: pointer to null terminated return string, modified only if
+ * return value is 0.
+ *
+ * Returns a string containing either the model name or the compatible value
+ * of the machine if found, else return error.
+ *
+ * Search for a machine model name or the compatible if model name is missing
+ * in a device tree node and retrieve a null terminated string value (pointer
+ * to data, not a copy). Returns 0 on success, -EINVAL if root of the device
+ * tree is not found and other error returned by of_property_read_string on
+ * failure.
+ */
+int of_machine_get_model_name(const char **model)
+{
+ int error;
+ struct device_node *root;
+
+ root = of_find_node_by_path("/");
+ if (!root)
+ return -EINVAL;
+
+ error = of_property_read_string(root, "model", model);
+ if (error)
+ error = of_property_read_string_index(root, "compatible",
+ 0, model);
+ of_node_put(root);
+
+ return error;
+}
+EXPORT_SYMBOL(of_machine_get_model_name);
+
+/**
* __of_device_is_available - check if a device is available for use
*
* @device: Node to check for availability, with locks already held
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index 0ac88263c2d7..94aef0465451 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -152,8 +152,7 @@ static int fsl_guts_probe(struct platform_device *pdev)
return PTR_ERR(guts->regs);
/* Register soc device */
- machine = of_flat_dt_get_machine_name();
- if (machine)
+ if (!of_machine_get_model_name(&machine))
soc_dev_attr.machine = devm_kstrdup(dev, machine, GFP_KERNEL);
svr = fsl_guts_get_svr();
diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c
index 330960312296..d9a119073de5 100644
--- a/drivers/soc/renesas/renesas-soc.c
+++ b/drivers/soc/renesas/renesas-soc.c
@@ -228,9 +228,7 @@ static int __init renesas_soc_init(void)
if (!soc_dev_attr)
return -ENOMEM;
- np = of_find_node_by_path("/");
- of_property_read_string(np, "model", &soc_dev_attr->machine);
- of_node_put(np);
+ of_machine_get_model_name(&soc_dev_attr->machine);
soc_dev_attr->family = kstrdup_const(family->name, GFP_KERNEL);
soc_dev_attr->soc_id = kstrdup_const(strchr(match->compatible, ',') + 1,
diff --git a/include/linux/of.h b/include/linux/of.h
index d72f01009297..13fc66531f1b 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -367,6 +367,7 @@ extern int of_alias_get_id(struct device_node *np, const char *stem);
extern int of_alias_get_highest_id(const char *stem);
extern int of_machine_is_compatible(const char *compat);
+extern int of_machine_get_model_name(const char **model);
extern int of_add_property(struct device_node *np, struct property *prop);
extern int of_remove_property(struct device_node *np, struct property *prop);
@@ -788,6 +789,11 @@ static inline int of_machine_is_compatible(const char *compat)
return 0;
}
+static inline int of_machine_get_model_name(const char **model)
+{
+ return -EINVAL;
+}
+
static inline bool of_console_check(const struct device_node *dn, const char *name, int index)
{
return false;
--
2.7.4
^ permalink raw reply related
* [PATCHv2 4/4] ath10k: Add support to read btcoex related data from DT
From: c_traja-Rm6X0d1/PG5y9aJCnZT0Uw @ 2016-11-17 11:44 UTC (permalink / raw)
To: ath10k-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
tamizhchelvam-sgV2jX0FEOL9JmXXK+q4OQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, robh-DgEjT+Ai2ygdnm+yROfE0A,
Tamizh chelvam
In-Reply-To: <1479383064-25718-1-git-send-email-c_traja-Rm6X0d1/PG5y9aJCnZT0Uw@public.gmane.org>
From: Tamizh chelvam <c_traja-Rm6X0d1/PG5y9aJCnZT0Uw@public.gmane.org>
BTCOEX feature is not supported by all qca40xx chipsets.
Since btcoex enabled by default in firmware, host needs to
enable COEX support depends on the hardware. This patch is
used to read btcoex_support flag and btcoex gpio pin
number from DT. Depends on the btcoex_support flag value
host will expose BTCOEX support and btcoex gpio pin
number to target.
Signed-off-by: Tamizh chelvam <c_traja-Rm6X0d1/PG5y9aJCnZT0Uw@public.gmane.org>
---
drivers/net/wireless/ath/ath10k/core.c | 44 ++++++++++++++++++++++++++++++-
drivers/net/wireless/ath/ath10k/core.h | 9 +++++++
drivers/net/wireless/ath/ath10k/debug.c | 3 +++
drivers/net/wireless/ath/ath10k/mac.c | 4 ++-
drivers/net/wireless/ath/ath10k/wmi.c | 1 +
drivers/net/wireless/ath/ath10k/wmi.h | 2 ++
6 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 7005e2a..eec2436 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1439,6 +1439,39 @@ static int ath10k_download_cal_data(struct ath10k *ar)
return 0;
}
+static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar)
+{
+ struct device_node *node;
+ u32 btcoex_support = 0;
+ int ret;
+
+ node = ar->dev->of_node;
+ if (!node)
+ goto out;
+
+ ret = of_property_read_u32(node, "btcoex_support", &btcoex_support);
+ if (ret) {
+ ar->btcoex_support = ATH10K_DT_BTCOEX_NOT_FOUND;
+ goto out;
+ }
+
+ if (btcoex_support)
+ ar->btcoex_support = ATH10K_DT_BTCOEX_SUPPORTED;
+ else
+ ar->btcoex_support = ATH10K_DT_BTCOEX_NOT_SUPPORTED;
+
+ ret = of_property_read_u32(node, "btcoex_gpio_pin",
+ &ar->btcoex_gpio_pin);
+ if (ret) {
+ ar->btcoex_gpio_pin = -1;
+ goto out;
+ }
+
+out:
+ ath10k_dbg(ar, ATH10K_DBG_BOOT, "btcoex support flag :%d gpio %d\n",
+ ar->btcoex_support, ar->btcoex_gpio_pin);
+}
+
static int ath10k_init_uart(struct ath10k *ar)
{
int ret;
@@ -1920,14 +1953,23 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
if (test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map))
val |= WMI_10_4_BSS_CHANNEL_INFO_64;
+ ath10k_core_fetch_btcoex_dt(ar);
+
/* 10.4 firmware supports BT-Coex without reloading firmware
* via pdev param. To support Bluetooth coexistence pdev param,
* WMI_COEX_GPIO_SUPPORT of extended resource config should be
* enabled always.
*/
+
+ /* we can still enable BTCOEX if firmware has the support
+ * eventhough btceox_support value is
+ * ATH10K_DT_BTCOEX_NOT_FOUND
+ */
+
if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map) &&
test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
- ar->running_fw->fw_file.fw_features))
+ ar->running_fw->fw_file.fw_features) &&
+ ar->btcoex_support != ATH10K_DT_BTCOEX_NOT_SUPPORTED)
val |= WMI_10_4_COEX_GPIO_SUPPORT;
status = ath10k_mac_ext_resource_config(ar, val);
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index e8decfa..440e41c 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -656,6 +656,12 @@ enum ath10k_tx_pause_reason {
ATH10K_TX_PAUSE_MAX,
};
+enum ath10k_dt_btcoex_support_flag {
+ ATH10K_DT_BTCOEX_NOT_FOUND,
+ ATH10K_DT_BTCOEX_SUPPORTED,
+ ATH10K_DT_BTCOEX_NOT_SUPPORTED,
+};
+
struct ath10k_fw_file {
const struct firmware *firmware;
@@ -924,6 +930,9 @@ struct ath10k {
u32 reg_ack_cts_timeout_orig;
} fw_coverage;
+ enum ath10k_dt_btcoex_support_flag btcoex_support;
+ int btcoex_gpio_pin;
+
/* must be last */
u8 drv_priv[0] __aligned(sizeof(void *));
};
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index ea30fbe..e0e316c 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2149,6 +2149,9 @@ static ssize_t ath10k_write_btcoex(struct file *file,
if (strtobool(buf, &val) != 0)
return -EINVAL;
+ if (ar->btcoex_support == ATH10K_DT_BTCOEX_NOT_SUPPORTED)
+ return -EOPNOTSUPP;
+
mutex_lock(&ar->conf_mutex);
ret = ath10k_mac_set_btcoex(ar, val);
if (!ret)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index ce5d529..25d6c0a 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4562,9 +4562,11 @@ static int ath10k_start(struct ieee80211_hw *hw)
}
param = ar->wmi.pdev_param->enable_btcoex;
+
if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map) &&
test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
- ar->running_fw->fw_file.fw_features)) {
+ ar->running_fw->fw_file.fw_features) &&
+ ar->btcoex_support != ATH10K_DT_BTCOEX_NOT_SUPPORTED) {
ret = ath10k_wmi_pdev_set_param(ar, param, 0);
if (ret) {
ath10k_warn(ar,
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index de35c17..1eb5678 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -7811,6 +7811,7 @@ static int ath10k_wmi_10_4_op_get_vdev_subtype(struct ath10k *ar,
cmd = (struct wmi_ext_resource_config_10_4_cmd *)skb->data;
cmd->host_platform_config = __cpu_to_le32(type);
cmd->fw_feature_bitmap = __cpu_to_le32(fw_feature_bitmap);
+ cmd->btcoex_gpio_pin = __cpu_to_le32(ar->btcoex_gpio_pin);
ath10k_dbg(ar, ATH10K_DBG_WMI,
"wmi ext resource config host type %d firmware feature bitmap %08x\n",
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 3a739e3..f83a21e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -2734,6 +2734,8 @@ struct wmi_ext_resource_config_10_4_cmd {
__le32 host_platform_config;
/* see enum wmi_10_4_feature_mask */
__le32 fw_feature_bitmap;
+ /* Contains btcoex gpio pin number */
+ __le32 btcoex_gpio_pin;
};
struct wmi_set_coex_param_10_4_cmd {
--
1.7.9.5
^ permalink raw reply related
* [PATCHv2 3/4] dt: bindings: add new dt entry for BTCOEX feature in qcom,ath10k.txt
From: c_traja-Rm6X0d1/PG5y9aJCnZT0Uw @ 2016-11-17 11:44 UTC (permalink / raw)
To: ath10k-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
tamizhchelvam-sgV2jX0FEOL9JmXXK+q4OQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, robh-DgEjT+Ai2ygdnm+yROfE0A
In-Reply-To: <1479383064-25718-1-git-send-email-c_traja-Rm6X0d1/PG5y9aJCnZT0Uw@public.gmane.org>
From: Tamizh chelvam <tamizhchelvam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
There two things done in this patch.
1) 'btcoex_support' flag for BTCOEX feature support by the hardware.
2) 'wlan_btcoex_gpio' is used to fill wlan priority pin number for
BTCOEX priority feature support.
Signed-off-by: Tamizh chelvam <tamizhchelvam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
.../bindings/net/wireless/qcom,ath10k.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 74d7f0a..08150e2d 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -46,6 +46,10 @@ Optional properties:
hw versions.
- qcom,ath10k-pre-calibration-data : pre calibration data as an array,
the length can vary between hw versions.
+- btcoex_support : should contain eithr "0" or "1" to indicate btcoex
+ support by the hardware.
+- btcoex_gpio_pin : btcoex gpio pin number for the device which
+ supports BTCOEX.
Example (to supply the calibration data alone):
--
1.7.9.5
^ permalink raw reply related
* [PATCHv2 2/4] ath10k: Add support to update btcoex priority value via nl80211
From: c_traja @ 2016-11-17 11:44 UTC (permalink / raw)
To: ath10k
Cc: robh, devicetree, linux-wireless, linux-kernel, Tamizh chelvam,
tamizhchelvam
In-Reply-To: <1479383064-25718-1-git-send-email-c_traja@qti.qualcomm.com>
From: Tamizh chelvam <c_traja@qti.qualcomm.com>
This patch adds support to update btcoex priority value via nl80211.
Here driver will be exposing the supported frame format for this
feature via btcoex_support_flags which is a member of
wiphy structure. 10.4 based firmware support this feature.
WMI service WMI_SERVICE_BTCOEX is used to identify the firmware support
of this feature. BTCOEX needs to enable to modify this value.
This patch has dependency of
"cfg80211: Add new NL80211_CMD_SET_BTCOEX_PRIORITY to support BTCOEX"
patch.
Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/mac.c | 78 +++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath10k/wmi-ops.h | 19 +++++++
drivers/net/wireless/ath/ath10k/wmi.c | 19 +++++++
drivers/net/wireless/ath/ath10k/wmi.h | 18 +++++++
4 files changed, 134 insertions(+)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index e7131b9..ce5d529 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7502,6 +7502,71 @@ static int ath10k_mac_op_set_btcoex(struct ieee80211_hw *hw, bool enabled)
return ret;
}
+u32
+ath10k_mac_get_btcoex_prio(struct cfg80211_btcoex_priority *btcoex_priority)
+{
+ u32 btcoex_prio = 0;
+
+ if (btcoex_priority->wlan_be_preferred)
+ btcoex_prio |= WIPHY_WLAN_BE_PREFERRED;
+
+ if (btcoex_priority->wlan_bk_preferred)
+ btcoex_prio |= WIPHY_WLAN_BK_PREFERRED;
+
+ if (btcoex_priority->wlan_vi_preferred)
+ btcoex_prio |= WIPHY_WLAN_VI_PREFERRED;
+
+ if (btcoex_priority->wlan_vo_preferred)
+ btcoex_prio |= WIPHY_WLAN_VO_PREFERRED;
+
+ if (btcoex_priority->wlan_beacon_preferred)
+ btcoex_prio |= WIPHY_WLAN_BEACON_PREFERRED;
+
+ if (btcoex_priority->wlan_mgmt_preferred)
+ btcoex_prio |= WIPHY_WLAN_MGMT_PREFERRED;
+
+ return btcoex_prio;
+}
+
+static int ath10k_mac_op_set_btcoex_priority(struct ieee80211_hw *hw,
+ struct cfg80211_btcoex_priority *btcoex_priority)
+{
+ u32 btcoex_prio;
+ struct ath10k *ar = hw->priv;
+ int ret;
+
+ if (!(test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags))) {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ mutex_lock(&ar->conf_mutex);
+
+ if (ar->state != ATH10K_STATE_ON &&
+ ar->state != ATH10K_STATE_RESTARTED) {
+ ret = -ENETDOWN;
+ goto exit;
+ }
+
+ btcoex_prio = ath10k_mac_get_btcoex_prio(btcoex_priority);
+
+ if (btcoex_prio > 0x3f) {
+ ret = -E2BIG;
+ goto exit;
+ }
+
+ ret = ath10k_wmi_set_coex_param(ar, btcoex_prio);
+
+ if (ret) {
+ ath10k_warn(ar, "failed to set btcoex priority: %d\n", ret);
+ goto exit;
+ }
+
+exit:
+ mutex_unlock(&ar->conf_mutex);
+ return ret;
+}
+
static const struct ieee80211_ops ath10k_ops = {
.tx = ath10k_mac_op_tx,
.wake_tx_queue = ath10k_mac_op_wake_tx_queue,
@@ -7544,6 +7609,7 @@ static int ath10k_mac_op_set_btcoex(struct ieee80211_hw *hw, bool enabled)
.unassign_vif_chanctx = ath10k_mac_op_unassign_vif_chanctx,
.switch_vif_chanctx = ath10k_mac_op_switch_vif_chanctx,
.set_btcoex = ath10k_mac_op_set_btcoex,
+ .set_btcoex_priority = ath10k_mac_op_set_btcoex_priority,
CFG80211_TESTMODE_CMD(ath10k_tm_cmd)
@@ -8134,6 +8200,18 @@ int ath10k_mac_register(struct ath10k *ar)
*/
ar->hw->offchannel_tx_hw_queue = IEEE80211_MAX_QUEUES - 1;
+ if (test_bit(WMI_SERVICE_BTCOEX, ar->wmi.svc_map)) {
+ ar->hw->wiphy->btcoex_support_flags =
+ WIPHY_WLAN_BE_PREFERRED |
+ WIPHY_WLAN_BK_PREFERRED |
+ WIPHY_WLAN_VI_PREFERRED |
+ WIPHY_WLAN_VO_PREFERRED |
+ WIPHY_WLAN_BEACON_PREFERRED |
+ WIPHY_WLAN_MGMT_PREFERRED;
+ ath10k_dbg(ar, ATH10K_DBG_BOOT, "btcoex supported mask :%u\n",
+ ar->hw->wiphy->btcoex_support_flags);
+ }
+
switch (ar->running_fw->fw_file.wmi_op_version) {
case ATH10K_FW_WMI_OP_VERSION_MAIN:
ar->hw->wiphy->iface_combinations = ath10k_if_comb;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index c9a8bb1..90c8390 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -197,6 +197,8 @@ struct wmi_ops {
(struct ath10k *ar,
enum wmi_bss_survey_req_type type);
struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value);
+ struct sk_buff *(*gen_set_coex_param)(struct ath10k *ar,
+ u32 btcoex_prio);
};
int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
@@ -1411,4 +1413,21 @@ struct wmi_ops {
return ath10k_wmi_cmd_send(ar, skb, wmi->cmd->echo_cmdid);
}
+static inline int
+ath10k_wmi_set_coex_param(struct ath10k *ar, u32 btcoex_prio)
+{
+ struct sk_buff *skb;
+
+ if (!ar->wmi.ops->gen_set_coex_param)
+ return -EOPNOTSUPP;
+
+ skb = ar->wmi.ops->gen_set_coex_param(ar, btcoex_prio);
+
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
+
+ return ath10k_wmi_cmd_send(ar, skb,
+ ar->wmi.cmd->set_coex_param_cmdid);
+}
+
#endif
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 387c4ee..de35c17 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -710,6 +710,7 @@
.pdev_bss_chan_info_request_cmdid =
WMI_10_4_PDEV_BSS_CHAN_INFO_REQUEST_CMDID,
.ext_resource_cfg_cmdid = WMI_10_4_EXT_RESOURCE_CFG_CMDID,
+ .set_coex_param_cmdid = WMI_10_4_BTCOEX_CFG_CMDID,
};
/* MAIN WMI VDEV param map */
@@ -7859,6 +7860,23 @@ static int ath10k_wmi_10_4_op_get_vdev_subtype(struct ath10k *ar,
return 0;
}
+static struct sk_buff *
+ath10k_wmi_10_4_op_gen_set_coex_param(struct ath10k *ar,
+ u32 btcoex_prio)
+{
+ struct wmi_set_coex_param_10_4_cmd *cmd;
+ struct sk_buff *skb;
+
+ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
+ if (!skb)
+ return ERR_PTR(-ENOMEM);
+
+ cmd = (struct wmi_set_coex_param_10_4_cmd *)skb->data;
+ cmd->btcoex_prio = __cpu_to_le32(btcoex_prio);
+
+ ath10k_dbg(ar, ATH10K_DBG_WMI, "BTCOEX priority :%u\n", btcoex_prio);
+ return skb;
+}
static const struct wmi_ops wmi_ops = {
.rx = ath10k_wmi_op_rx,
.map_svc = wmi_main_svc_map,
@@ -8205,6 +8223,7 @@ static int ath10k_wmi_10_4_op_get_vdev_subtype(struct ath10k *ar,
.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
.gen_echo = ath10k_wmi_op_gen_echo,
.gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config,
+ .gen_set_coex_param = ath10k_wmi_10_4_op_gen_set_coex_param,
};
int ath10k_wmi_attach(struct ath10k *ar)
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 1b243c8..3a739e3 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -184,6 +184,8 @@ enum wmi_service {
WMI_SERVICE_TX_MODE_PUSH_ONLY,
WMI_SERVICE_TX_MODE_PUSH_PULL,
WMI_SERVICE_TX_MODE_DYNAMIC,
+ WMI_SERVICE_VDEV_RX_FILTER,
+ WMI_SERVICE_BTCOEX,
/* keep last */
WMI_SERVICE_MAX,
@@ -310,6 +312,8 @@ enum wmi_10_4_service {
WMI_10_4_SERVICE_TX_MODE_PUSH_ONLY,
WMI_10_4_SERVICE_TX_MODE_PUSH_PULL,
WMI_10_4_SERVICE_TX_MODE_DYNAMIC,
+ WMI_10_4_SERVICE_VDEV_RX_FILTER,
+ WMI_10_4_SERVICE_BTCOEX,
};
static inline char *wmi_service_name(int service_id)
@@ -408,6 +412,7 @@ static inline char *wmi_service_name(int service_id)
SVCSTR(WMI_SERVICE_TX_MODE_PUSH_ONLY);
SVCSTR(WMI_SERVICE_TX_MODE_PUSH_PULL);
SVCSTR(WMI_SERVICE_TX_MODE_DYNAMIC);
+ SVCSTR(WMI_SERVICE_BTCOEX);
default:
return NULL;
}
@@ -663,6 +668,8 @@ static inline void wmi_10_4_svc_map(const __le32 *in, unsigned long *out,
WMI_SERVICE_TX_MODE_PUSH_PULL, len);
SVCMAP(WMI_10_4_SERVICE_TX_MODE_DYNAMIC,
WMI_SERVICE_TX_MODE_DYNAMIC, len);
+ SVCMAP(WMI_10_4_SERVICE_BTCOEX,
+ WMI_SERVICE_BTCOEX, len);
}
#undef SVCMAP
@@ -837,6 +844,7 @@ struct wmi_cmd_map {
u32 pdev_bss_chan_info_request_cmdid;
u32 pdev_enable_adaptive_cca_cmdid;
u32 ext_resource_cfg_cmdid;
+ u32 set_coex_param_cmdid;
};
/*
@@ -1646,6 +1654,11 @@ enum wmi_10_4_cmd_id {
WMI_10_4_EXT_RESOURCE_CFG_CMDID,
WMI_10_4_VDEV_SET_IE_CMDID,
WMI_10_4_SET_LTEU_CONFIG_CMDID,
+ WMI_10_4_ATF_SSID_GROUPING_REQUEST_CMDID,
+ WMI_10_4_PEER_ATF_EXT_REQUEST_CMDID,
+ WMI_10_4_SET_PERIODIC_CHANNEL_STATS_CONFIG,
+ WMI_10_4_PEER_BWF_REQUEST_CMDID,
+ WMI_10_4_BTCOEX_CFG_CMDID,
WMI_10_4_PDEV_UTF_CMDID = WMI_10_4_END_CMDID - 1,
};
@@ -2723,6 +2736,11 @@ struct wmi_ext_resource_config_10_4_cmd {
__le32 fw_feature_bitmap;
};
+struct wmi_set_coex_param_10_4_cmd {
+ /* contains wlan priority frame type value preferred over bt */
+ __le32 btcoex_prio;
+};
+
/* strucutre describing host memory chunk. */
struct host_memory_chunk {
/* id of the request that is passed up in service ready */
--
1.7.9.5
^ permalink raw reply related
* [PATCHv2 1/4] ath10k: Add support to enable or disable btcoex via nl80211
From: c_traja @ 2016-11-17 11:44 UTC (permalink / raw)
To: ath10k
Cc: robh, devicetree, linux-wireless, linux-kernel, Tamizh chelvam,
tamizhchelvam
In-Reply-To: <1479383064-25718-1-git-send-email-c_traja@qti.qualcomm.com>
From: Tamizh chelvam <c_traja@qti.qualcomm.com>
This patch add support to enable or disable btcoex via nl80211.
The firmware support this feature since 10.2.4.54 on 2G-only board,
dual band or 5G boards don't support this. WMI service
WMI_SERVICE_COEX_GPIO is used to identify the firmware support of this
feature.
Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/debug.c | 37 ++------------------
drivers/net/wireless/ath/ath10k/mac.c | 58 +++++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath10k/mac.h | 1 +
3 files changed, 62 insertions(+), 34 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 82a4c67..ea30fbe 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -26,6 +26,7 @@
#include "debug.h"
#include "hif.h"
#include "wmi-ops.h"
+#include "mac.h"
/* ms */
#define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000
@@ -2138,7 +2139,6 @@ static ssize_t ath10k_write_btcoex(struct file *file,
size_t buf_size;
int ret;
bool val;
- u32 pdev_param;
buf_size = min(count, (sizeof(buf) - 1));
if (copy_from_user(buf, ubuf, buf_size))
@@ -2150,40 +2150,9 @@ static ssize_t ath10k_write_btcoex(struct file *file,
return -EINVAL;
mutex_lock(&ar->conf_mutex);
-
- if (ar->state != ATH10K_STATE_ON &&
- ar->state != ATH10K_STATE_RESTARTED) {
- ret = -ENETDOWN;
- goto exit;
- }
-
- if (!(test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags) ^ val)) {
+ ret = ath10k_mac_set_btcoex(ar, val);
+ if (!ret)
ret = count;
- goto exit;
- }
-
- pdev_param = ar->wmi.pdev_param->enable_btcoex;
- if (test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
- ar->running_fw->fw_file.fw_features)) {
- ret = ath10k_wmi_pdev_set_param(ar, pdev_param, val);
- if (ret) {
- ath10k_warn(ar, "failed to enable btcoex: %d\n", ret);
- ret = count;
- goto exit;
- }
- } else {
- ath10k_info(ar, "restarting firmware due to btcoex change");
- queue_work(ar->workqueue, &ar->restart_work);
- }
-
- if (val)
- set_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags);
- else
- clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags);
-
- ret = count;
-
-exit:
mutex_unlock(&ar->conf_mutex);
return ret;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 717b2fa..e7131b9 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7445,6 +7445,63 @@ struct ath10k_mac_change_chanctx_arg {
return 0;
}
+static inline void ath10k_mac_update_btcoex_flag(struct ath10k *ar, bool val)
+{
+ if (val)
+ set_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags);
+ else
+ clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags);
+}
+
+int ath10k_mac_set_btcoex(struct ath10k *ar, bool val)
+{
+ u32 pdev_param;
+ int ret;
+
+ lockdep_assert_held(&ar->conf_mutex);
+
+ if (ar->state != ATH10K_STATE_ON &&
+ ar->state != ATH10K_STATE_RESTARTED)
+ return -ENETDOWN;
+
+ if (!(test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags) ^ val))
+ return 0;
+
+ pdev_param = ar->wmi.pdev_param->enable_btcoex;
+ if (test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
+ ar->running_fw->fw_file.fw_features)) {
+ ret = ath10k_wmi_pdev_set_param(ar, pdev_param, val);
+
+ if (ret) {
+ ath10k_warn(ar,
+ "failed to modify btcoex state: %d\n", ret);
+ return ret;
+ }
+ ath10k_mac_update_btcoex_flag(ar, val);
+ } else {
+ ath10k_info(ar, "restarting firmware due to btcoex change");
+ ath10k_mac_update_btcoex_flag(ar, val);
+ queue_work(ar->workqueue, &ar->restart_work);
+ }
+
+ return 0;
+}
+
+static int ath10k_mac_op_set_btcoex(struct ieee80211_hw *hw, bool enabled)
+{
+ int ret;
+ struct ath10k *ar = hw->priv;
+
+ if (!test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map))
+ return -EOPNOTSUPP;
+
+ mutex_lock(&ar->conf_mutex);
+ ret = ath10k_mac_set_btcoex(ar, enabled);
+ mutex_unlock(&ar->conf_mutex);
+
+ return ret;
+}
+
static const struct ieee80211_ops ath10k_ops = {
.tx = ath10k_mac_op_tx,
.wake_tx_queue = ath10k_mac_op_wake_tx_queue,
@@ -7486,6 +7543,7 @@ struct ath10k_mac_change_chanctx_arg {
.assign_vif_chanctx = ath10k_mac_op_assign_vif_chanctx,
.unassign_vif_chanctx = ath10k_mac_op_unassign_vif_chanctx,
.switch_vif_chanctx = ath10k_mac_op_switch_vif_chanctx,
+ .set_btcoex = ath10k_mac_op_set_btcoex,
CFG80211_TESTMODE_CMD(ath10k_tm_cmd)
diff --git a/drivers/net/wireless/ath/ath10k/mac.h b/drivers/net/wireless/ath/ath10k/mac.h
index 1bd29ec..de1fa72 100644
--- a/drivers/net/wireless/ath/ath10k/mac.h
+++ b/drivers/net/wireless/ath/ath10k/mac.h
@@ -82,6 +82,7 @@ struct ieee80211_txq *ath10k_mac_txq_lookup(struct ath10k *ar,
u16 peer_id,
u8 tid);
int ath10k_mac_ext_resource_config(struct ath10k *ar, u32 val);
+int ath10k_mac_set_btcoex(struct ath10k *ar, bool val);
static inline struct ath10k_vif *ath10k_vif_to_arvif(struct ieee80211_vif *vif)
{
--
1.7.9.5
^ permalink raw reply related
* [PATCHv2 0/4] ath10k: Add support for BTCOEX feature.
From: c_traja @ 2016-11-17 11:44 UTC (permalink / raw)
To: ath10k
Cc: linux-wireless, tamizhchelvam, linux-kernel, devicetree, robh,
Tamizh chelvam
From: Tamizh chelvam <c_traja@qti.qualcomm.com>
This patch set add support to enable/disable BTCOEX via nl80211,
also support to update BTCOEX priority value for 10.4 based firmware.
Document the dt entry in qcom,ath10k.txt and reads btcoex support
flag and btcoex gpio pin detail from dt.
Tamizh chelvam (4):
ath10k: Add support to enable or disable btcoex via nl80211
ath10k: Add support to update btcoex priority value via nl80211
dt: bindings: add new dt entry for BTCOEX feature in qcom,ath10k.txt
ath10k: Add support to read btcoex related data from DT
V2:
* Added device tree list in CC
* fixed mutex unlock issue in
"ath10k: Add support to update btcoex priority value via nl80211"
.../bindings/net/wireless/qcom,ath10k.txt | 4 +
drivers/net/wireless/ath/ath10k/core.c | 44 +++++-
drivers/net/wireless/ath/ath10k/core.h | 9 ++
drivers/net/wireless/ath/ath10k/debug.c | 40 +-----
drivers/net/wireless/ath/ath10k/mac.c | 140 +++++++++++++++++++-
drivers/net/wireless/ath/ath10k/mac.h | 1 +
drivers/net/wireless/ath/ath10k/wmi-ops.h | 19 +++
drivers/net/wireless/ath/ath10k/wmi.c | 20 +++
drivers/net/wireless/ath/ath10k/wmi.h | 20 +++
9 files changed, 261 insertions(+), 36 deletions(-)
--
1.7.9.5
^ permalink raw reply
* Re: [RFC PATCH 4/7] dt-bindings: iio: iio-mux: document iio-mux bindings
From: Lars-Peter Clausen @ 2016-11-17 11:40 UTC (permalink / raw)
To: Peter Rosin, linux-kernel
Cc: Wolfram Sang, Rob Herring, Mark Rutland, Jonathan Cameron,
Hartmut Knaack, Peter Meerwald-Stadler, Arnd Bergmann,
Greg Kroah-Hartman, linux-i2c, devicetree, linux-iio
In-Reply-To: <1479340111-1259-5-git-send-email-peda@axentia.se>
On 11/17/2016 12:48 AM, Peter Rosin wrote:
> ---
> .../bindings/iio/multiplexer/iio-mux.txt | 59 ++++++++++++++++++++++
> 1 file changed, 59 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/iio/multiplexer/iio-mux.txt
>
> diff --git a/Documentation/devicetree/bindings/iio/multiplexer/iio-mux.txt b/Documentation/devicetree/bindings/iio/multiplexer/iio-mux.txt
> new file mode 100644
> index 000000000000..2f5c7fc35a42
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/multiplexer/iio-mux.txt
> @@ -0,0 +1,59 @@
> +IIO multiplexer bindings
> +
> +If a multiplexer is used to select when hardware signal is fed to
> +e.g. an ADC channel, these bindings describe that situation.
> +
> +Required properties:
> +- compatible : "iio-mux"
> +- io-channels : Channel node of the parent channel that has multiplexed
> + input.
> +- io-channel-names : Should be "parent".
> +- control-muxes : Node of the multiplexer that controls the input signal.
> +- control-mux-names : Should be "mux".
> +- #address-cells = <1>;
> +- #size-cells = <0>;
> +
> +Required properties for iio-mux child nodes:
> +- reg : The multiplexer number.
> +
> +Optional properties for iio-mux child nodes:
> +- iio-ext-info : Array of string pairs, the first item in each pair is the
> + iio ext_info attribute name, and the second item in each
> + pair is the iio ext_info value for that attribute. The
> + mux will write these ext_info values to the corresponding
> + ext_info attributes on every multiplexer switch.
This can't go into the devicetree in its current form as it exposes
implementation details of the Linux kernel drivers.
^ permalink raw reply
* Re: [PATCH v2 2/4] usb: dwc2: Add binding for AHB burst
From: Felipe Balbi @ 2016-11-17 11:27 UTC (permalink / raw)
To: John Youn; +Cc: Christian Lamparter, Stefan Wahren
In-Reply-To: <7fa1c1c4d703c435d698cdf140c9d43163347f1d.1479339900.git.johnyoun-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 911 bytes --]
Hi,
John Youn <johnyoun-HKixBCOQz3hWk0Htik3J/w@public.gmane.org> writes:
> Add the "snps,ahb-burst" binding and read it in.
>
> This property controls which burst type to perform on the AHB bus as a
> master in internal DMA mode. This overrides the legacy param value,
> which we need to keep around for now since several platforms use it.
>
> Some platforms may see better or worse performance based on this
> value. The HAPS platform is one example where all INCRx have worse
> performance than INCR.
>
> Other platforms (such as the Canyonlands board) report that the default
> value causes system hangs.
>
> Signed-off-by: John Youn <johnyoun-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>
> Cc: Christian Lamparter <chunkeey-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
it's getting rather late for this merge window. I still need an ack by
Rob or any of the devicetree folks.
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox