Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/43003 )
Change subject: drivers/intel/mipi_camera: Add guard to protect camera resources
......................................................................
Patch Set 6:
(17 comments)
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
File src/drivers/intel/mipi_camera/camera.c:
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 28: static struct resource_config *alloc_resource_config(void)
: {
: return (struct resource_config *) malloc(sizeof(struct resource_config));
: }
:
this is unnecessary, see comment below on line #625
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 42: if (res_config)
: return res_config->action;
: else
: return UNKNOWN_ACTION;
: }
nit: ternary operator would be shorter, e.g. return res_config ? res_config->action : UNKNOWN_ACTION
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 56: if (res_config)
: return res_config->type;
: else
: return UNKNOWN_CTRL;
ternary would be shorter
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 65: if (res_config)
Here you either need to check that `type` is set to CLOCK, and/or set it as well, or else it could be an undefined access of res_config->clk_conf.
if (res_config) {
res_config->type = CLOCK;
res_config->clk_conf = clk_conf;
}
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 533: switch (type) {
: case IMGCLK:
: clk_config = resource_get_clk_config(res_config);
: res_id = clk_config->clknum;
: break;
: case GPIO:
: gpio_config = resource_get_gpio_config(res_config);
: res_id = gpio_config->gpio_num;
: break;
: default:
: printk(BIOS_ERR, "Unsupported power operation: %x\n"
: "OS camera driver will likely not work", type);
: return;
: }
:
: res_index = get_resource_index(res_id, type);
you can push the logic for getting res_id into get_resource_index(), i.e., this chunk can just be:
res_index = get_resource_index(res_config, type),
where get_resource_index can handle the `type` from res_config
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 550: if (res_index != -1) {
: switch (action) {
: case ENABLE:
: snprintf(method_name, sizeof(method_name), ENABLE_METHOD_FORMAT,
: res_index);
: break;
: case DISABLE:
: snprintf(method_name, sizeof(method_name), DISABLE_METHOD_FORMAT,
: res_index);
: break;
: default:
: snprintf(method_name, sizeof(method_name), UNKNOWN_METHOD_FORMAT,
: res_index);
: acpigen_write_debug_string("Unsupported action");
: printk(BIOS_ERR, "Unsupported resource action: %x\n", action);
: return;
: }
suggestion: a helper function e.g., `get_op_method_namestring()` would clean this up here
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 587: acpigen_write_byte
nit: it's safer (and easier) to use acpigen_write_integer()
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 588: acpigen_write_byte
nit: it's safer (and easier) to use acpigen_write_integer()
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 591: acpigen_write_byte
nit: it's safer (and easier) to use acpigen_write_integer()
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 584: clk_config = resource_get_clk_config(res_config);
: if (action == ENABLE) {
: acpigen_emit_namestring("MCON");
: acpigen_write_byte(clk_config->clknum);
: acpigen_write_byte(clk_config->freq);
: } else if (action == DISABLE) {
: acpigen_emit_namestring("MCOF");
: acpigen_write_byte(clk_config->clknum);
: } else {
: acpigen_write_debug_string("Unsupported clock action");
: printk(BIOS_ERR, "Unsupported clock action: %x\n"
: "OS camera driver will likely not work", action);
: }
suggestion: a helper function, e.g. `add_clk_op(const struct clk_config*)` would make this function shorter
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 600: gpio_config = resource_get_gpio_config(res_config);
: if (action == ENABLE) {
: acpigen_soc_set_tx_gpio(gpio_config->gpio_num);
: } else if (action == DISABLE) {
: acpigen_soc_clear_tx_gpio(gpio_config->gpio_num);
: } else {
: acpigen_write_debug_string("Unsupported GPIO action");
: printk(BIOS_ERR, "Unsupported GPIO action: %x\n"
: "OS camera driver will likely not work\n", action);
: }
: break;
suggestion: a helper function, e.g. `add_gpio_op(const struct gpio_config*)` would make this function shorter
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 625: struct resource_config *res_config = alloc_resource_config();
You can just create a e.g. `struct resource_config res_config` on the stack, and then just pass it below like so: `resource_set_*_config(&res_config, &config->...);` .
`res_config` does not escape this function's lifetime, so it's safe to keep on the stack.
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 628: i < MAX_PWR_OPS
good catch 😊
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 673: _ON
method_name ?
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 662: snprintf(method_name, sizeof(method_name), ENABLE_METHOD_FORMAT,
: res_mgr.cnt);
: acpigen_write_method_serialized(method_name, 0);
: acpigen_write_if_lequal_namestr_int(varname, 0);
: resource_set_ctrl_type(res_config, seq->ops[i].type);
: resource_set_action_type(res_config, ENABLE);
: add_power_operation(res_config);
: acpigen_pop_len(); /* if */
:
: acpigen_emit_byte(INCREMENT_OP);
: acpigen_emit_namestring(varname);
: acpigen_pop_len(); /* _ON */
suggestion: a helper function, e.g. `write_enable_method()` would be nice
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 687: _ON
method_name?
https://review.coreboot.org/c/coreboot/+/43003/6/src/drivers/intel/mipi_cam…
PS6, Line 675: snprintf(method_name, sizeof(method_name), DISABLE_METHOD_FORMAT,
: res_mgr.cnt);
: acpigen_write_method_serialized(method_name, 0);
: acpigen_emit_byte(DECREMENT_OP);
: acpigen_emit_namestring(varname);
:
: acpigen_write_if_lequal_namestr_int(varname, 0);
: resource_set_ctrl_type(res_config, seq->ops[i].type);
: resource_set_action_type(res_config, DISABLE);
: add_power_operation(res_config);
: acpigen_pop_len(); /* if */
:
: acpigen_pop_len(); /* _ON */
suggestion: a helper function, e.g. `write_disable_method()` would be nice
--
To view, visit https://review.coreboot.org/c/coreboot/+/43003
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I1468459d5bbb2fb07bef4e0590c96dd4dbab0d9c
Gerrit-Change-Number: 43003
Gerrit-PatchSet: 6
Gerrit-Owner: Sugnan Prabhu S <sugnan.prabhu.s(a)intel.com>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Matt Delco <delco(a)chromium.org>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-Reviewer: Rizwan Qureshi <rizwan.qureshi(a)intel.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Reviewer: Varshit B Pandya <varshit.b.pandya(a)intel.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Wed, 08 Jul 2020 19:05:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Karthik Ramasubramanian has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/43304 )
Change subject: mb/google/dedede: Enable SIS touchscreen for Waddledee
......................................................................
Patch Set 1:
This change is ready for review.
--
To view, visit https://review.coreboot.org/c/coreboot/+/43304
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I42fdc5e8243d2c70c953b2f516c10f84a041c035
Gerrit-Change-Number: 43304
Gerrit-PatchSet: 1
Gerrit-Owner: Karthik Ramasubramanian <kramasub(a)google.com>
Gerrit-Reviewer: Evan Green <evgreen(a)chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Justin TerAvest <teravest(a)chromium.org>
Gerrit-Reviewer: Marco Chen <marcochen(a)google.com>
Gerrit-Comment-Date: Wed, 08 Jul 2020 18:30:02 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Martin Roth has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41816 )
Change subject: soc/amd/picasso: add psp_verstage
......................................................................
Patch Set 12:
(1 comment)
https://review.coreboot.org/c/coreboot/+/41816/10/src/soc/amd/picasso/memla…
File src/soc/amd/picasso/memlayout_psp_verstage.ld:
https://review.coreboot.org/c/coreboot/+/41816/10/src/soc/amd/picasso/memla…
PS10, Line 55: VERSTAGE_START + VERSTAGE_SIZE
> Sorry, I missed this comment until just now. […]
Fixed.
--
To view, visit https://review.coreboot.org/c/coreboot/+/41816
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ia58839caa5bfbae0408702ee8d02ef482f2861c4
Gerrit-Change-Number: 41816
Gerrit-PatchSet: 12
Gerrit-Owner: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Aaron Durbin <adurbin(a)chromium.org>
Gerrit-Reviewer: Bao Zheng <fishbaozi(a)gmail.com>
Gerrit-Reviewer: Eric Peers <epeers(a)google.com>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-CC: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Comment-Date: Wed, 08 Jul 2020 17:57:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Raul Rangel <rrangel(a)chromium.org>
Comment-In-Reply-To: Martin Roth <martinroth(a)google.com>
Gerrit-MessageType: comment