Re: iwlwifi: Microcode SW error

2021-04-19 Thread Gonsolo
> Do you use MFP?

I don't think so. I'm running unmodified kernels from Ubuntu PPA and
don't meddle with WIFI configs.
How can I find out?

> Could be related to
> https://patchwork.kernel.org/project/linux-wireless/patch/20210416134702.ef8486a64293.If0a9025b39c71bb91b11dd6ac45547aba682df34@changeid/
> I saw similar issues internally without that fix.

A quick "git grep" didn't show any of these two patches in the 5.12-rc7 kernel.

-- 
g


Kernel warning "TX on unused queue" for iwlwifi on 7260 with kernel 5.10-rc2

2020-11-20 Thread Gonsolo
Output of lspci -nn:

02:00.0 Network controller [0280]: Intel Corporation Wireless 7260
[8086:08b1] (rev 73)

> Guy, can you help with this one? I believe there is a bugzilla issue
> for this already...

I'd like to know this too.

-- 
g


Wifi hangs

2020-11-19 Thread Gonsolo
Hi!

Sporadically my wifi hangs. Any idea why?
This is on a 5.10.0-051000rc2-lowlatency kernel from
https://kernel.ubuntu.com/~kernel-ppa/mainline.
I have to stop and start the device to make it work again.
>From dmesg:

[  +0,000101] [ cut here ]
[  +0,02] TX on unused queue 5
[  +0,49] WARNING: CPU: 2 PID: 20577 at
drivers/net/wireless/intel/iwlwifi/pcie/tx.c:1927
iwl_trans_pcie_tx+0x676/0x7f0 [iwlwifi]
[  +0,03] Modules linked in: dvb_usb_af9035 uas usb_storage
dvb_usb_v2 dvb_core rfcomm ccm snd_seq_dummy snd_hrtimer cmac
algif_hash algif_skcipher af_alg bnep binfmt_misc nls_iso8859_1
snd_hda_codec_hdmi intel_rapl_msr snd_hda_codec_realtek
snd_hda_codec_generic snd_hda_intel snd_intel_dspcfg snd_hda_codec
snd_hda_core snd_hwdep pn544_mei mei_phy pn544 cdc_mbim
intel_rapl_common snd_pcm x86_pkg_temp_thermal intel_powerclamp
coretemp hci snd_seq_midi cdc_wdm qcserial kvm_intel nfc
snd_seq_midi_event usb_wwan mei_hdcp dell_laptop kvm ledtrig_audio
cdc_ncm usbserial snd_rawmidi cdc_ether crct10dif_pclmul usbnet
ghash_clmulni_intel mii dell_smm_hwmon iwlmvm mac80211 libarc4
aesni_intel crypto_simd uvcvideo videobuf2_vmalloc iwlwifi cryptd
glue_helper rapl intel_cstate snd_seq btusb btrtl btbcm
videobuf2_memops i915 btintel bluetooth videobuf2_v4l2
videobuf2_common snd_seq_device videodev dell_wmi snd_timer input_leds
joydev dell_smbios mc dcdbas ecdh_generic ecc sparse_keymap cfg80211
[  +0,79]  serio_raw at24 wmi_bmof dell_wmi_descriptor efi_pstore
snd drm_kms_helper cec rc_core mei_me i2c_algo_bit fb_sys_fops
syscopyarea sysfillrect mei soundcore sysimgblt dell_rbtn mac_hid
sch_fq_codel parport_pc ppdev lp drm parport ip_tables x_tables
autofs4 hid_logitech_hidpp hid_logitech_dj hid_generic usbhid hid
sdhci_pci crc32_pclmul i2c_i801 psmouse cqhci i2c_smbus sdhci ahci
libahci lpc_ich e1000e xhci_pci wmi xhci_pci_renesas video [last
unloaded: dvb_usb_af9035]
[  +0,49] CPU: 2 PID: 20577 Comm: kworker/2:1 Not tainted
5.10.0-051000rc2-lowlatency #202011012330
[  +0,01] Hardware name: Dell Inc. Latitude E7240/0R6F3F, BIOS A29
06/13/2019
[  +0,29] Workqueue: events cfg80211_rfkill_block_work [cfg80211]
[  +0,13] RIP: 0010:iwl_trans_pcie_tx+0x676/0x7f0 [iwlwifi]
[  +0,05] Code: 3d 03 5e 03 00 00 b8 ea ff ff ff 0f 85 eb fc ff ff
44 89 fe 48 c7 c7 5d b5 d3 c0 89 45 d0 c6 05 e4 5d 03 00 01 e8 7b 5d
4b c4 <0f> 0b 8b 45 d0 e9 c8 fc ff ff 41 0f b6 86 80 00 00 00 83 e0 60
3c
[  +0,02] RSP: 0018:af8f00e1f680 EFLAGS: 00010282
[  +0,02] RAX:  RBX: 9b8c8d0d0900 RCX: 9b8e96b18988
[  +0,01] RDX: ffd8 RSI: 0027 RDI: 9b8e96b18980
[  +0,01] RBP: af8f00e1f6e0 R08:  R09: af8f00e1f470
[  +0,02] R10: af8f00e1f468 R11: 86353c28 R12: 9b8d823243e8
[  +0,01] R13: 0037 R14: 0005 R15: 0005
[  +0,02] FS:  () GS:9b8e96b0()
knlGS:
[  +0,02] CS:  0010 DS:  ES:  CR0: 80050033
[  +0,01] CR2: 3a4e0b5b3080 CR3: 000105a0c002 CR4: 001706e0
[  +0,02] Call Trace:
[  +0,20]  iwl_mvm_tx_mpdu+0x1e0/0x590 [iwlmvm]
[  +0,11]  iwl_mvm_tx_skb_sta+0x153/0x1e0 [iwlmvm]
[  +0,08]  iwl_mvm_tx_skb+0x1c/0x40 [iwlmvm]
[  +0,08]  iwl_mvm_mac_itxq_xmit+0x7a/0xe0 [iwlmvm]
[  +0,10]  iwl_mvm_mac_wake_tx_queue+0x29/0x80 [iwlmvm]
[  +0,29]  drv_wake_tx_queue+0x51/0xe0 [mac80211]
[  +0,23]  ieee80211_queue_skb+0x15b/0x220 [mac80211]
[  +0,35]  ieee80211_tx+0xd6/0x140 [mac80211]
[  +0,25]  ieee80211_xmit+0xb8/0xf0 [mac80211]
[  +0,24]  __ieee80211_tx_skb_tid_band+0x6d/0x80 [mac80211]
[  +0,22]  ieee80211_send_deauth_disassoc+0xff/0x130 [mac80211]
[  +0,24]  ieee80211_set_disassoc+0x3ae/0x4b0 [mac80211]
[  +0,27]  ieee80211_mgd_deauth+0x106/0x300 [mac80211]
[  +0,04]  ? __update_blocked_fair+0xda/0x3f0
[  +0,04]  ? acpi_ut_delete_object_desc+0xa2/0xa6
[  +0,22]  ieee80211_deauth+0x18/0x20 [mac80211]
[  +0,28]  cfg80211_mlme_deauth+0xb2/0x1e0 [cfg80211]
[  +0,22]  cfg80211_mlme_down+0x64/0x80 [cfg80211]
[  +0,21]  cfg80211_disconnect+0x157/0x210 [cfg80211]
[  +0,21]  __cfg80211_leave+0x133/0x1b0 [cfg80211]
[  +0,20]  cfg80211_netdev_notifier_call+0x1bf/0x5c0 [cfg80211]
[  +0,09]  ? iwl_mvm_nic_error+0x40/0x40 [iwlmvm]
[  +0,11]  ? iwl_mvm_send_cmd_pdu+0x54/0x90 [iwlmvm]
[  +0,09]  ? iwl_mvm_send_cmd+0x1f/0x50 [iwlmvm]
[  +0,08]  ? iwl_mvm_mc_iface_iterator+0xb9/0xe0 [iwlmvm]
[  +0,23]  ? __iterate_interfaces+0xa2/0x100 [mac80211]
[  +0,08]  ? iwl_mvm_set_tim+0x50/0x50 [iwlmvm]
[  +0,09]  ? iwl_mvm_set_tim+0x50/0x50 [iwlmvm]
[  +0,24]  ? ieee80211_iterate_active_interfaces_atomic+0x38/0x50 [mac80211]
[  +0,06]  ? rtnl_is_locked+0x15/0x20
[  +0,04]  ? inetdev_event+0x34/0x400
[  +0,06]  raw_notifier_call_chain+0x49/0x60
[  +0,03]  call_netde

Re: [PATCH 1/1] Fix undefined reference to 'node_reclaim_distance'.

2020-05-04 Thread Gonsolo
Hi!

> Yes, it fixes the arch/sh/ build errors in my testing.
> I don't have a failing ppc64 .config file to test.

As of v5.7-rc4 this patch doesn't seem to have been applied and the
build is still failing:
http://kisskb.ellerman.id.au/kisskb/buildresult/14067948/

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 6ec1e595b1d4..bf20e5883026 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -1281,7 +1281,6 @@ static int  sched_domains_curr_level;
int  sched_max_numa_distance;
static int   *sched_domains_numa_distance;
static struct cpumask***sched_domains_numa_masks;
-int __read_mostlynode_reclaim_distance = RECLAIM_DISTANCE;
#endif

/*
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4785a8a2040e..733890d913ea 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3523,6 +3523,7 @@ bool zone_watermark_ok_safe(struct zone *z,
unsigned int order,
}

#ifdef CONFIG_NUMA
+int __read_mostlynode_reclaim_distance = RECLAIM_DISTANCE;
static bool zone_allows_reclaim(struct zone *local_zone, struct zone *zone)
{
return node_distance(zone_to_nid(local_zone), zone_to_nid(zone)) <=

-- 
g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
> I don't know. I was not the one that extracted the firmware. I guess
> Antti did it.

Ok.

> That's a really bad solution. Returning 0xff is what happens when
> things go wrong during I2C transfers. Several problems can cause it,
> including device misfunction. Every time someone comes with a patch
> trying to ignore it, things go sideways for other devices (existing
> or future ones).
>
> Ignoring errors is always a bad idea.

I understand.

Anyway, I have to give up for now. Maybe I will have some time in the
future to come back to this or somebody else can use the information
in this thread. :(

Thanks for your time, I appreciate that very much. It was worth a try. :)

-- 
g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
> Huh? are you using the upstream Kernel? the above code is at line 215!
> Please always use the upstream code when sending patches.

Sorry, I was confused by my vi line:
"drivers/media/dvb-frontends/si2168.c" 808 lines --26%--
 212,1-8   25%"

Twelve hours behind this screen. I think I have to have a walk in the
forest right now. :)

-- 
g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
> 1) The firmware file is likely at the Windows driver for this device
> (probably using a different format). It should be possible to get
> it from there.

If you tell me how I'm willing to do this. :)

> 2) Another possibility would be to add a way to tell the si2168 driver
> to not try to load a firmware, using the original one. That would
> require adding a field at si2168_config to allow signalizing to it
> that it should not try to load a firmware file, and add a quirk at
> the af9035 that would set such flag for Logilink VG0022A.

I don't get this. Which firmware, si2168 or si2157?

I'm still for option 3: If there is a bogus chip revision number it's
likely the VG0022A and we can safely set fw to NULL, in which case
everything works.
All already working devices will continue to work as before.
With a low probability there are other devices that will return 0x
but a) they didn't work until now and b) they receive a clear message
that they return bogus numbers and this works just for the VG0022A, in
which case this hardware can be tested.
At last, *my* VG0022A will work without a custom kernel which I'm a
big fan of. :))

Are there any counterarguments except that it is not the cleanest
solution in the universe? ;)

-- 
g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
>From si2168.c:808:
   /* Sometimes firmware returns bogus value */
if (utmp1 == 0x)
utmp1 = 0;

Maybe we can include my "bogus" hack to get at least Logilink running.
Maybe with an info message to tell users what is going on.

g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
> try other firmware?
> http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/

I tried all of them. No difference.

-- 
g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
I also tried to add a msleep(1000) after the si2168 firmware upload;
no difference.

g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
> try other firmware?
> http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/

I already downloaded version 4.0.25 from there.

-rw-r--r-- 1 rootroot6,8K Apr  5  2018
/lib/firmware/dvb-demod-si2168-b40-01.fw.gonzo
-rw-rw-r-- 1 gonsolo gonsolo  16K Okt  3 13:08
/lib/firmware/dvb-demod-si2168-b40-01.fw

No difference.

-- 
g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
> Weird... it sounds that, after si2168 has its firmware updated, it
> starts interfering at si2157. Perhaps there's a bug at si2168 I2C
> gate mux logic. Are you using a new Kernel like 5.2?

Everything is based on git://linuxtv.org/media_tree.git which is at
5.4-rc1 right now.

> I guess the best is to enable the debug logs in order to see what's
> happening on both cases.
>
> You can enable all debug messages (after loading the modules) with:
>
> # for i in $(cat /sys/kernel/debug/dynamic_debug/control |grep -E 
> '(si21|af9035)' |cut -d' ' -f 1); do echo "file $i +p" 
> >>/sys/kernel/debug/dynamic_debug/control; done

I'll give that a try.

> You could also try to disable the firmware upload at si2168 and see
> if the si2157 reads will succeed.

That too. Thanks for the advice.


-- 
g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
> With the original patch you proposed, what are the logs?

Which one do you mean? That one:

+   case SI_BOGUS:
+   dev_info(&client->dev, "Bogus chip version, trying
with no firmware\n");
+   fw_name = NULL;
+   break;

With this patch VLC is running but the chip revision number and
firmware version are still bogus.

Which means if you receive 0x you can force no firmware and it runs.

-- 
g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
> So, I would add a msleep() somewhere after the firmware update.

I tried that to no avail:

release_firmware(fw);
+   msleep(1000);

[  107.903918] si2157 2-0063: firmware version: \xff.\xff.255
[  107.903920] si2157 2-0063: querying chip revision...
[  107.906970] si2157 2-0063: chip revision: 255.255.255.255

-- 
g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
> Try to reduce the bus speed to 10kbps

Nope:

#define I2C_SPEED_REGISTER 260  // ~10k

[  117.860961] si2168 1-0067: downloading firmware from file
'dvb-demod-si2168-b40-01.fw'
[  118.958355] si2168 1-0067: firmware version: B 4.0.25
[  118.968882] si2157 2-0063: Bogus chip version, trying with new firmware
[  118.96] si2157 2-0063: found a 'Silicon Labs Si21255-\xff\xff\xff'
[  118.972005] si2157 2-0063: downloading firmware from file
'dvb-tuner-si2157-a30-01.fw'
[  121.154130] si2157 2-0063: rebooting tuner...
[  121.169626] si2157 2-0063: querying firmware version...
[  121.172799] si2157 2-0063: firmware version: \xff.\xff.255
[  121.172803] si2157 2-0063: querying chip revision...
[  121.175911] si2157 2-0063: chip revision: 255.255.255.255

g



-- 
g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
Hi!

I tried downloading a new firmware via

   case SI_BOGUS:
-   dev_info(&client->dev, "Bogus chip version, trying
with no firmware\n");
-   fw_name = NULL;
+   dev_info(&client->dev, "Bogus chip version, trying
with new firmware\n");
+   fw_name = SI2157_A30_FIRMWARE;
break;

which I downloaded from

+   //
https://github.com/CoreELEC/dvb-firmware/blob/master/firmware/dvb-tuner-si2157-a30-01.fw

resulting in

[  209.312086] si2168 1-0067: downloading firmware from file
'dvb-demod-si2168-b40-01.fw'
[  211.535097] si2168 1-0067: firmware version: B 4.0.25
[  211.554938] si2157 2-0063: Bogus chip version, trying with new firmware
[  211.554944] si2157 2-0063: found a 'Silicon Labs Si21255-\xff\xff\xff'
[  211.557978] si2157 2-0063: downloading firmware from file
'dvb-tuner-si2157-a30-01.fw'
[  215.739092] si2157 2-0063: rebooting tuner...
[  215.755271] si2157 2-0063: querying firmware version...
[  215.760756] si2157 2-0063: firmware version: \xff.\xff.255

. So even with a new firmware the queried numbers are bogus.

g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
Hi!

> It means that there's a firmware stored at the device's eeprom
> (version 4.0.2). When the driver starts, it downloads a newer firmware
> from the file dvb-demod-si2168-b40-01.fw.

Thanks for the explanation.

> Btw, could you please try the enclosed hack and post the results?

Will do in a second.

FWIW, this hack worked:

diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index e87040d6eca7..28a3a4f1640e 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -136,6 +136,7 @@ static int si2157_init(struct dvb_frontend *fe)
#define SI2147_A30 ('A' << 24 | 47 << 16 | '3' << 8 | '0' << 0)
#define SI2146_A10 ('A' << 24 | 46 << 16 | '1' << 8 | '0' << 0)
#define SI2141_A10 ('A' << 24 | 41 << 16 | '1' << 8 | '0' << 0)
+   #define GONZO (255 << 24 | 255 << 16 | 255 << 8 | 255 << 0)

switch (chip_id) {
case SI2158_A20:
@@ -148,6 +149,10 @@ static int si2157_init(struct dvb_frontend *fe)
case SI2177_A30:
fw_name = SI2157_A30_FIRMWARE;
break;
+   case GONZO:
+   dev_info(&client->dev, "trying null\n");
+   fw_name = NULL;
+   break;
case SI2157_A30:
case SI2147_A30:
case SI2146_A10:


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
Hi!

Boot time:

> [5.380991] si2168 1-0067: firmware version: B 4.0.2

When starting VLC:

> [  457.677363] si2168 1-0067: downloading firmware from file
> 'dvb-demod-si2168-b40-01.fw'
> [  458.631034] si2168 1-0067: firmware version: B 4.0.11
> [  458.650309] si2157 2-0063: unknown chip version Si21255-\xff\xff\xff

There are two different firmware versions, 4.0.2 and 4.0.11. Is that expected?

-- 
g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-03 Thread Gonsolo
Hi!

> Could you please test the enclosing patch and see if, with that, you
> can remove the hacks you added for the tuner probe to work?

I tested again on a vanilla media_tree with Mauro's patch attached.
Doesn't work. Dmesg output:

[0.788387] kernel: usb 1-1: new high-speed USB device number 2
using ehci-pci
[0.792384] kernel: usb 2-1: new high-speed USB device number 2
using xhci_hcd
[0.944937] kernel: usb 2-1: New USB device found, idVendor=1d19,
idProduct=0100, bcdDevice= 1.00
[0.944939] kernel: usb 2-1: New USB device strings: Mfr=1,
Product=2, SerialNumber=3
[0.944940] kernel: usb 2-1: Product: TS Aggregator
[0.944941] kernel: usb 2-1: Manufacturer: ITE Tech., Inc.
[0.944942] kernel: usb 2-1: SerialNumber: AF010202071

I then also used the following (additional) patch:

@@ -2119,6 +2122,8 @@ static const struct usb_device_id af9035_id_table[] = {
/* IT930x devices */
{ DVB_USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9303,
&it930x_props, "ITE 9303 Generic", NULL) },
+   { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x0100,
+   &it930x_props, "Logilink VG0022A", NULL) },
{ DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_TD310,
&it930x_props, "AVerMedia TD310 DVB-T2", NULL) },
{ }

Which gives the following output:

[5.380989] si2168 1-0067: Silicon Labs Si2168-B40 successfully identified
[5.380991] si2168 1-0067: firmware version: B 4.0.2
[5.381013] usb 2-1: DVB: registering adapter 0 frontend 0 (Silicon
Labs Si2168)...
[5.381018] dvbdev: dvb_create_media_entity: media entity 'Silicon
Labs Si2168' registered.
[5.390058] checking generic (e000 41) vs hw (e000 1000)
[5.390062] fb0: switching to inteldrmfb from EFI VGA
[5.390268] Console: switching to colour dummy device 80x25
[5.390281] i915 :00:02.0: vgaarb: deactivate vga console
[5.393438] si2157 2-0063: Silicon Labs Si2147/2148/2157/2158
successfully attached

But when I try to use VLC I get the following:

[  457.677363] si2168 1-0067: downloading firmware from file
'dvb-demod-si2168-b40-01.fw'
[  458.631034] si2168 1-0067: firmware version: B 4.0.11
[  458.650309] si2157 2-0063: unknown chip version Si21255-\xff\xff\xff

Now I'm trying other timings.

Thanks,
g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-02 Thread Gonsolo
Hi!

> Antti has some great suggestions in that thread:
> https://lkml.org/lkml/2017/5/24/245
>
> Also note https://lkml.org/lkml/2017/5/26/357 if you have access to a
> logic analyser.

I read that thread. Unfortunately I'm not a hardware engineer nor do I
have access to a logic analyser, just the device and a remote hope not
to keep my custom 4.13 kernel forever or to have to buy a new DVB T2
device. :(
In the above thread it is mentioned that even the Windows driver
receives the 's so maybe it is a hardware bug?

I'd love to see this driver upstream but I have no idea how to
proceed. Any suggestions?

-- 
g


Re: [PATCH] si2157: Add support for Logilink VG0022A.

2019-10-02 Thread Gonsolo
Hi!

> You need a message and a Signed-off-by: here.

Ok, I'll try to get that right the next time.

> > + ret = si2157_power_up(dev, client);
> > + if (ret)
> > + goto err;
> > + /* query chip revision */
> > + /* hack: do it here because after the si2168 gets 0101, commands will
> > +  * still be executed here but no result
>
> I don't understand. What problem are you seeing here? Why can't you do a
> query chip revision first?

This was explained here: https://lkml.org/lkml/2017/3/15/778. To quote:

If the si2157 is behind a e.g. si2168, the si2157 will at least in
some situations not be readable after the si268 got the command 0101.
It still accepts commands but the answer is just ff. So read the
chip id before that so the information is not lost.

The following line in kernel output is a symptome of that problem:
si2157 7-0063: unknown chip version Si21255-\x\x\x

> This needs resolving of course.

I hope so. :)

g


Re: DVB-T2 Stick

2019-10-01 Thread Gonsolo
Hi!

> Secondly there are lots of coding style issues, see:
> https://www.kernel.org/doc/html/v4.10/process/coding-style.html

I addressed most of these except one "#if 0" warning from checkpatch.

> I'm afraid there are many problems with this patch. First of all it looks
> like support was added for a si2168 tuner but it looks like it will break
> for any other si2157-type device.


Can you give me a hint how to proceed here? I don't know much about
DVB tuners or kernel development.

I attached the cleaned-up patch for 5.4.0-rc1

Thanks,
g
From 6cada6442207a67202e73721692aced665b8fdf0 Mon Sep 17 00:00:00 2001
From: Gon Solo 
Date: Tue, 1 Oct 2019 21:59:44 +0200
Subject: [PATCH] DVB-T2 with coding style updates.

---
 drivers/media/tuners/si2157.c | 44 ++---
 drivers/media/tuners/si2157_priv.h|  8 +
 drivers/media/usb/dvb-usb-v2/af9035.c | 47 ++-
 3 files changed, 93 insertions(+), 6 deletions(-)

diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index e87040d6eca7..af50e721281b 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -75,7 +75,7 @@ static int si2157_init(struct dvb_frontend *fe)
 	struct si2157_cmd cmd;
 	const struct firmware *fw;
 	const char *fw_name;
-	unsigned int uitmp, chip_id;
+	unsigned int uitmp;
 
 	dev_dbg(&client->dev, "\n");
 
@@ -117,7 +117,7 @@ static int si2157_init(struct dvb_frontend *fe)
 		if (ret)
 			goto err;
 	}
-
+#if 0
 	/* query chip revision */
 	memcpy(cmd.args, "\x02", 1);
 	cmd.wlen = 1;
@@ -138,6 +138,8 @@ static int si2157_init(struct dvb_frontend *fe)
 	#define SI2141_A10 ('A' << 24 | 41 << 16 | '1' << 8 | '0' << 0)
 
 	switch (chip_id) {
+#endif
+	switch (dev->chip_id) {
 	case SI2158_A20:
 	case SI2148_A20:
 		fw_name = SI2158_A20_FIRMWARE;
@@ -161,9 +163,9 @@ static int si2157_init(struct dvb_frontend *fe)
 		goto err;
 	}
 
-	dev_info(&client->dev, "found a 'Silicon Labs Si21%d-%c%c%c'\n",
-			cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]);
-
+//	dev_info(&client->dev, "found a 'Silicon Labs Si21%d-%c%c%c'\n",
+//			cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]);
+//
 	if (fw_name == NULL)
 		goto skip_fw_download;
 
@@ -456,6 +458,38 @@ static int si2157_probe(struct i2c_client *client,
 	memcpy(&fe->ops.tuner_ops, &si2157_ops, sizeof(struct dvb_tuner_ops));
 	fe->tuner_priv = client;
 
+	/* power up */
+	if (dev->chiptype == SI2157_CHIPTYPE_SI2146) {
+		memcpy(cmd.args, "\xc0\x05\x01\x00\x00\x0b\x00\x00\x01", 9);
+		cmd.wlen = 9;
+	} else {
+		memcpy(cmd.args,
+		"\xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01",
+		15);
+		cmd.wlen = 15;
+	}
+	cmd.rlen = 1;
+	ret = si2157_cmd_execute(client, &cmd);
+	if (ret)
+		goto err;
+	/* query chip revision */
+	/* hack: do it here because after the si2168 gets 0101, commands will
+	 * still be executed here but no result
+	 */
+	memcpy(cmd.args, "\x02", 1);
+	cmd.wlen = 1;
+	cmd.rlen = 13;
+	ret = si2157_cmd_execute(client, &cmd);
+	if (ret)
+		goto err_kfree;
+	dev->chip_id = cmd.args[1] << 24 |
+		cmd.args[2] << 16 |
+		cmd.args[3] << 8 |
+		cmd.args[4] << 0;
+	dev_info(&client->dev, "found a 'Silicon Labs Si21%d-%c%c%c'\n",
+		cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]);
+
+
 #ifdef CONFIG_MEDIA_CONTROLLER
 	if (cfg->mdev) {
 		dev->mdev = cfg->mdev;
diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h
index 2bda903358da..0f4090e184e9 100644
--- a/drivers/media/tuners/si2157_priv.h
+++ b/drivers/media/tuners/si2157_priv.h
@@ -28,6 +28,7 @@ struct si2157_dev {
 	u8 chiptype;
 	u8 if_port;
 	u32 if_frequency;
+	u32 chip_id;
 	struct delayed_work stat_work;
 
 #if defined(CONFIG_MEDIA_CONTROLLER)
@@ -43,6 +44,13 @@ struct si2157_dev {
 #define SI2157_CHIPTYPE_SI2141 2
 #define SI2157_CHIPTYPE_SI2177 3
 
+#define SI2158_A20 ('A' << 24 | 58 << 16 | '2' << 8 | '0' << 0)
+#define SI2148_A20 ('A' << 24 | 48 << 16 | '2' << 8 | '0' << 0)
+#define SI2157_A30 ('A' << 24 | 57 << 16 | '3' << 8 | '0' << 0)
+#define SI2147_A30 ('A' << 24 | 47 << 16 | '3' << 8 | '0' << 0)
+#define SI2146_A10 ('A' << 24 | 46 << 16 | '1' << 8 | '0' << 0)
+#define SI2141_A10 ('A' << 24 | 41 << 16 | '1' << 8 | '0' << 0)
+
 /* firmware command struct */
 #define SI2157_ARGLEN  30
 struct si2157_cmd {
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 3afd18733614..5b7a00cdcbd8 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -1206,7 +1206,50 @@ static int it930x_frontend_attach(struct dvb_usb_adapter *adap)
 	struct si2168_config si2168_config;
 	struct i2c_adapter *adapter;
 
-	dev_dbg(&intf->dev, "adap->id=%d\n", adap->id);
+	//dev_dbg(&intf->dev, "adap->id=%d\n", adap->id);
+	dev_dbg(&intf->dev, "%s  adap->id=%d\n", __func__, adap->id);
+
+	/* I2C master bus 2 clock speed 300k */
+	ret = af9035_wr_reg(d, 0x00f6a7, 0x07);
+	if (ret < 0)
+		goto err;
+
+	/* I2C master bus 1

DVB-T2 Stick

2019-01-30 Thread Gonsolo
Hi!

The following patch adds support for the Logilink VG0022A DVB-T2 stick.
After patching and building the kernel it shows up with lsusb and I
used w_scan to scan for channels and vlc for watching.
The original patches were from Andreas Kemnade.
The only thing that doesn't work is wake up after standby.

Do you think you can apply this patch?

Thanks
-- 
g
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index d389f1fc237a..1f923418ff10 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -84,7 +84,7 @@ static int si2157_init(struct dvb_frontend *fe)
 	struct si2157_cmd cmd;
 	const struct firmware *fw;
 	const char *fw_name;
-	unsigned int uitmp, chip_id;
+unsigned int uitmp;
 
 	dev_dbg(&client->dev, "\n");
 
@@ -126,7 +126,7 @@ static int si2157_init(struct dvb_frontend *fe)
 		if (ret)
 			goto err;
 	}
-
+#if 0
 	/* query chip revision */
 	memcpy(cmd.args, "\x02", 1);
 	cmd.wlen = 1;
@@ -146,6 +146,8 @@ static int si2157_init(struct dvb_frontend *fe)
 	#define SI2141_A10 ('A' << 24 | 41 << 16 | '1' << 8 | '0' << 0)
 
 	switch (chip_id) {
+#endif
+switch (dev->chip_id) {
 	case SI2158_A20:
 	case SI2148_A20:
 		fw_name = SI2158_A20_FIRMWARE;
@@ -166,9 +168,9 @@ static int si2157_init(struct dvb_frontend *fe)
 		goto err;
 	}
 
-	dev_info(&client->dev, "found a 'Silicon Labs Si21%d-%c%c%c'\n",
-			cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]);
-
+//	dev_info(&client->dev, "found a 'Silicon Labs Si21%d-%c%c%c'\n",
+//			cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]);
+//
 	if (fw_name == NULL)
 		goto skip_fw_download;
 
@@ -461,6 +463,38 @@ static int si2157_probe(struct i2c_client *client,
 	memcpy(&fe->ops.tuner_ops, &si2157_ops, sizeof(struct dvb_tuner_ops));
 	fe->tuner_priv = client;
 
+   /* power up */
+   if (dev->chiptype == SI2157_CHIPTYPE_SI2146) {
+   memcpy(cmd.args, "\xc0\x05\x01\x00\x00\x0b\x00\x00\x01", 9);
+   cmd.wlen = 9;
+   } else {
+   memcpy(cmd.args,
+   "\xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01",
+   15);
+   cmd.wlen = 15;
+   }
+   cmd.rlen = 1;
+   ret = si2157_cmd_execute(client, &cmd);
+   if (ret)
+   goto err;
+   /* query chip revision */
+   /* hack: do it here because after the si2168 gets 0101, commands will
+* still be executed here but no result
+*/
+   memcpy(cmd.args, "\x02", 1);
+   cmd.wlen = 1;
+   cmd.rlen = 13;
+   ret = si2157_cmd_execute(client, &cmd);
+   if (ret)
+   goto err_kfree;
+   dev->chip_id = cmd.args[1] << 24 |
+   cmd.args[2] << 16 |
+   cmd.args[3] << 8 |
+   cmd.args[4] << 0;
+   dev_info(&client->dev, "found a 'Silicon Labs Si21%d-%c%c%c'\n",
+   cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]);
+ 
+
 #ifdef CONFIG_MEDIA_CONTROLLER
 	if (cfg->mdev) {
 		dev->mdev = cfg->mdev;
diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h
index 50f86300d965..3592146cf49a 100644
--- a/drivers/media/tuners/si2157_priv.h
+++ b/drivers/media/tuners/si2157_priv.h
@@ -37,6 +37,7 @@ struct si2157_dev {
 	u8 chiptype;
 	u8 if_port;
 	u32 if_frequency;
+u32 chip_id;
 	struct delayed_work stat_work;
 
 #if defined(CONFIG_MEDIA_CONTROLLER)
@@ -51,6 +52,13 @@ struct si2157_dev {
 #define SI2157_CHIPTYPE_SI2146 1
 #define SI2157_CHIPTYPE_SI2141 2
 
+#define SI2158_A20 ('A' << 24 | 58 << 16 | '2' << 8 | '0' << 0)
+#define SI2148_A20 ('A' << 24 | 48 << 16 | '2' << 8 | '0' << 0)
+#define SI2157_A30 ('A' << 24 | 57 << 16 | '3' << 8 | '0' << 0)
+#define SI2147_A30 ('A' << 24 | 47 << 16 | '3' << 8 | '0' << 0)
+#define SI2146_A10 ('A' << 24 | 46 << 16 | '1' << 8 | '0' << 0)
+#define SI2141_A10 ('A' << 24 | 41 << 16 | '1' << 8 | '0' << 0)
+
 /* firmware command struct */
 #define SI2157_ARGLEN  30
 struct si2157_cmd {
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 80d3bd3a0f24..28b073bfe0d4 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -1216,8 +1216,51 @@ static int it930x_frontend_attach(struct dvb_usb_adapter *adap)
 	struct si2168_config si2168_config;
 	struct i2c_adapter *adapter;
 
-	dev_dbg(&intf->dev, "adap->id=%d\n", adap->id);
-
+	//dev_dbg(&intf->dev, "adap->id=%d\n", adap->id);
+   dev_dbg(&intf->dev, "%s  adap->id=%d\n", __func__, adap->id);
+
+   /* I2C master bus 2 clock speed 300k */
+   ret = af9035_wr_reg(d, 0x00f6a7, 0x07);
+   if (ret < 0)
+   goto err;
+
+   /* I2C master bus 1,3 clock speed 300k */
+   ret = af9035_wr_reg(d, 0x00f103, 0x07);
+   if (ret < 0)
+   goto err;
+
+   /* set gpio11 low */
+   ret = af9035_wr_reg_mask(d, 0xd8d4, 0x01, 0x01);
+   if (ret < 0)
+   goto 

Complete Linux history in git

2007-09-19 Thread Gonsolo
I have written a small python script that fetches the
linux archive at
git://git.kernel.org/pub/scm/linux/kernel/git/nico/archive.git,
applies patches up to 2.4.0 and commits every patch to git
with a message and a tag.
>From there it should be easy to merge old-2.6-bkcvs and
the latest Linux git and have a git archive with the complete
history.

To run it you have to download some patches from
http://gonsolo.de/kernel_history/ and start the script
from the same directory.

It is not perfect, you have to press enter a few times when
patches do not apply. I would be happy to receive feedback
or patches.

After running the script there is a git repository at "kernel" which
is approximately 1GB! After running "git gc" (which takes a long time!)
the pack file is under 100MB, IIRC.

Next step would be to download old-2.6-bkcvs repository from
git.kernel.org and merge/rebase (don't know).

Gonsolo
#!/usr/bin/python

# Fetch the git repository for kernels up to 1.0.
# Apply all patches up to 2.4 and commit to the repository.
# From here old-2.6-bkcvs can be applied.
# Some fixes are necessary these have to be downloaded seperately.

import os, shutil, urllib

# The local git directory
local='kernel/'

# Where to fetch patches
remote='http://www.kernel.org/pub/linux/kernel/'

# This can be a local directory, too
#remote= 'file:///your_local_patch_dir/www.kernel.org/pub/linux/kernel/'

def apply( patch ):
	os.system( 'bzcat ' + patch + ' | patch -s -p1 -d ' + local )
	os.remove( patch )

def retrieve_apply( dir, patch ):
	print 'apply ' + patch
	urllib.urlretrieve( dir + patch, patch )
	apply( patch )

def commit( msg ):
	os.system( 'cd ' + local + ' && git add * && git commit -q -a -m' + msg )
	os.system( 'cd ' + local + ' && git tag ' + msg )

def apply_patches(dir,begin,end,patchbase,commitbase):
	for i in range(begin,end):
		patch=patchbase + str(i) + '.bz2'
		retrieve_apply( dir, patch )
		commit( commitbase + str(i) )

def v10():
	print 'v10'
	dir=remote + 'v1.0/'

	apply_patches(dir,1,7,'patch','v1.0.')

def v11():
	print 'v11'
	dir=remote + 'v1.1/'
	patch='1.0.6-1.1.0.diff.bz2'
	retrieve_apply( dir, patch )
	commit( 'v1.1.0' )

	apply_patches(dir,1,46,'patch','v1.1.')

	# patch 45 forgets to remove files
	os.system( 'cd ' + local + ' && cat ../fix.1 | patch -s -p1' )
	commit( 'v1.1.45fix1' )

	apply_patches(dir,46,54,'patch','v1.1.')

	# patch54 is screwed
	#os.remove( local + 'fs/binfmt_elf.c' )

	apply_patches(dir,54,75,'patch','v1.1.')

	# patch75 is screwed
	os.remove( local + 'fs/msdos/mmap.c' )
	commit( 'v1.1.74a: fixup' )

	apply_patches(dir,75,77,'patch','v1.1.')

	# patch77 is whitespaced damaged
	os.system( 'cd ' + local + ' && cat ../fix.2 | patch -s -p1' )
	commit( 'v1.1.76a: fixup' )

	apply_patches(dir,77,96,'patch','v1.1.')

	# 1.1 patches add '-N' to diff
	os.system( 'cd ' + local + ' && cat ../fix.3 | patch -s -p1' )
	commit( 'v1.1.95fix2' )

def v12():
	print 'v12'
	dir=remote + 'v1.2/'

	patch='v1.1.95-1.2.0.patch.bz2'
	retrieve_apply( dir, patch )
	commit( 'v1.2.0' )

	apply_patches(dir,1,11,'patch-1.2.','v1.2.')

def v13():
	print 'v13'
	dir=remote + 'v1.3/'

	# found no patch for upgrade
	os.system( 'cat 1.2.10-1.3.0 | patch -s -p1 -d ' + local )
	commit( 'v1.3.0' )

	apply_patches(dir,1,101,'patch-1.3.','v1.3.')

	# Fix 1.3 patches
	os.system( 'cd ' + local + ' && cat ../fix.4 | patch -s -p1' )
	commit( 'v1.3.100fix3' )

	apply_patches(dir,1,15,'patch-pre2.0.','pre2.0.')

	# Fix pre2 patches
	os.system( 'cd ' + local + ' && cat ../fix.5 | patch -s -p1' )
	commit( 'v2.0fix4' )

def v20():
	print 'v20'
	dir=remote + 'v2.0/'
	
	apply_patches(dir,1,41,'patch-2.0.','v2.0.')

def v21():
	print 'v21'
	dir=remote + 'v2.1/'

	os.system( 'cd ' + local + ' && git checkout v2.0.21' )
	
	retrieve_apply( dir, 'patch-2.0.21-2.1.0.bz2')
	commit( 'v2.1.0' )

	apply_patches(dir,1,133,'patch-2.1.','v2.1.')
	apply_patches(dir,1,10,'patch-2.2.0-pre','v2.2.0-pre')

	retrieve_apply( dir, 'patch-2.2.0-final.bz2')
	commit( 'v2.2.0-final' )

def v22():
	print 'v22'
	dir=remote + 'v2.2/'

	apply_patches(dir,1,27,'patch-2.2.','v2.2.')

def v23():
	print 'v23'
	dir=remote + 'v2.3/'

	os.system( 'cd ' + local + ' && git checkout v2.2.8' )
	
	retrieve_apply( dir, 'patch-2.2.8-to-2.3.0.bz2')
	commit( 'v2.3.0' )

	apply_patches(dir,1,52,'patch-2.3.','v2.3.')
	apply_patches(dir,1,10,'patch-2.3.99-pre','v2.3.99-pre')

def v24():
	print 'v24'
	dir=remote + 'v2.4/old-test-kernels/'

	apply_patches(dir,1,13,'patch-2.4.0-test','v2.4.0-test')

	retrieve_apply( dir, 'patch-2.4.0-prerelease.bz2' )
	commit( 'v2.4.0-prerelease' )

	retrieve_apply( dir, 'prerelease-to-final.bz2' )
	commit( 'v2.4.0' )


if os.path.exists( local ):
	shutil.rmtree( local )
os.system( 'git clone git://git.kernel.org/pub/scm/linux/kernel/git/nico/archive.git ' + local )
v10()
v11()
v12()
v13()
v20()
v21()
v22()
v23()
v24()